watch_engine Module

Watch loop engine and watcher state.

This module contains the watcher_t type, which: - Builds and maintains the watch list, - Tracks file fingerprints for change detection, - Runs fpm commands when changes are detected, - Coordinates optional feature plugins.

The engine is intentionally "poll-based" to remain portable across platforms.


Uses

  • module~~watch_engine~~UsesGraph module~watch_engine watch_engine fpm_filesystem fpm_filesystem module~watch_engine->fpm_filesystem fpm_strings fpm_strings module~watch_engine->fpm_strings iso_fortran_env iso_fortran_env module~watch_engine->iso_fortran_env module~watch_banner watch_banner module~watch_engine->module~watch_banner module~watch_exec watch_exec module~watch_engine->module~watch_exec module~watch_feature_factory watch_feature_factory module~watch_engine->module~watch_feature_factory module~watch_feature_manager watch_feature_manager module~watch_engine->module~watch_feature_manager module~watch_fingerprint watch_fingerprint module~watch_engine->module~watch_fingerprint module~watch_fpm_graph watch_fpm_graph module~watch_engine->module~watch_fpm_graph module~watch_log watch_log module~watch_engine->module~watch_log module~watch_time watch_time module~watch_engine->module~watch_time module~watch_types watch_types module~watch_engine->module~watch_types module~watch_util watch_util module~watch_engine->module~watch_util module~watch_banner->fpm_strings module~watch_banner->iso_fortran_env module~watch_banner->module~watch_types module~watch_banner->module~watch_util face face module~watch_banner->face fpm_command_line fpm_command_line module~watch_banner->fpm_command_line module~watch_exec->fpm_filesystem module~watch_exec->fpm_strings module~watch_exec->iso_fortran_env module~watch_exec->module~watch_types module~watch_exec->module~watch_util module~watch_exec->face module~watch_exec->fpm_command_line module~watch_feature_factory->module~watch_feature_manager module~watch_feature_factory->module~watch_log module~watch_feature_factory->module~watch_types module~watch_feat_stats watch_feat_stats module~watch_feature_factory->module~watch_feat_stats module~watch_feature_api watch_feature_api module~watch_feature_factory->module~watch_feature_api module~watch_feature_manager->fpm_strings module~watch_feature_manager->iso_fortran_env module~watch_feature_manager->module~watch_types module~watch_feature_manager->module~watch_feature_api module~watch_fingerprint->fpm_filesystem module~watch_fingerprint->fpm_strings module~watch_fingerprint->iso_fortran_env module~watch_fingerprint->fpm_command_line module~watch_fpm_graph->fpm_filesystem module~watch_fpm_graph->fpm_strings module~watch_fpm_graph->iso_fortran_env module~watch_fpm_graph->module~watch_log module~watch_fpm_graph->module~watch_types module~watch_fpm_graph->module~watch_util fpm fpm module~watch_fpm_graph->fpm module~watch_fpm_graph->fpm_command_line fpm_dependency fpm_dependency module~watch_fpm_graph->fpm_dependency fpm_error fpm_error module~watch_fpm_graph->fpm_error fpm_manifest fpm_manifest module~watch_fpm_graph->fpm_manifest fpm_model fpm_model module~watch_fpm_graph->fpm_model fpm_targets fpm_targets module~watch_fpm_graph->fpm_targets module~watch_filter watch_filter module~watch_fpm_graph->module~watch_filter module~watch_log->iso_fortran_env module~watch_log->module~watch_types module~watch_log->face module~watch_time->iso_fortran_env fpm_environment fpm_environment module~watch_time->fpm_environment iso_c_binding iso_c_binding module~watch_time->iso_c_binding module~watch_types->fpm_strings module~watch_types->iso_fortran_env module~watch_types->fpm_command_line module~watch_util->fpm_strings module~watch_feat_stats->module~watch_log module~watch_feat_stats->module~watch_types module~watch_feat_stats->module~watch_feature_api module~watch_feature_api->fpm_strings module~watch_feature_api->iso_fortran_env module~watch_feature_api->module~watch_types module~watch_filter->fpm_filesystem module~watch_filter->fpm_strings module~watch_filter->iso_fortran_env

Derived Types

type, public ::  watcher_t

Main watcher state and methods.

Read more…

Components

Type Visibility Attributes Name Initial
type(watch_config_t), public :: cfg
integer, public, allocatable :: changed_idx(:)
integer(kind=int64), public, allocatable :: file_mask(:)
type(string_t), public, allocatable :: files(:)
type(feature_manager_t), public :: fm
integer(kind=int64), public, allocatable :: fp_now(:)
integer(kind=int64), public, allocatable :: fp_prev(:)
integer(kind=int64), public :: man_prev = 0_int64
type(root_info_t), public, allocatable :: roots(:)

Type-Bound Procedures

procedure, public :: init => watcher_init
procedure, public :: run => watcher_run

Functions

private function any_manifest_changed(files, changed_idx, changed_count) result(hit)

Return whether the changed set contains fpm.toml.

Read more…

Arguments

Type IntentOptional Attributes Name
type(string_t), intent(in), allocatable :: files(:)
integer, intent(in) :: changed_idx(:)
integer, intent(in) :: changed_count

Return Value logical


Subroutines

private subroutine handle_manifest_change(self)

Handle a manifest change (fpm.toml) by rebuilding the watch list.

Read more…

Arguments

Type IntentOptional Attributes Name
class(watcher_t), intent(inout) :: self

private subroutine rebuild_watch_list(self, print_header)

Recompute the watch list, rebuild fingerprints, and print/log the result.

Read more…

Arguments

Type IntentOptional Attributes Name
class(watcher_t), intent(inout) :: self
logical, intent(in) :: print_header

private subroutine run_once(self, cmd0)

Run the configured command once without change detection.

Read more…

Arguments

Type IntentOptional Attributes Name
class(watcher_t), intent(inout) :: self
character(len=*), intent(in) :: cmd0

private subroutine watcher_init(self, cfg)

Initialize a watcher instance from configuration.

Read more…

Arguments

Type IntentOptional Attributes Name
class(watcher_t), intent(inout) :: self
type(watch_config_t), intent(in) :: cfg

private subroutine watcher_run(self)

Run the main watch loop until termination.

Read more…

Arguments

Type IntentOptional Attributes Name
class(watcher_t), intent(inout) :: self