src/fsm/dispatch.c File Reference src/fsm/dispatch.c OOOOOOOOOOO OOOOO OOO OOO * OO OO OO OOOO OOOO * OO OO OO OO OO OO * OOOOOO OO OO OO OO OO * OO OO OO OOO OO * OO OO OO OO * OO OO OOO OO OO * OO OOOOOO OO OO * #include <stdbool.h>#include "../../include/fsm.h"#include "../../include/util.h"#include "../../include/widget.h" Functions void fsm_journal_publication_request () The fsm_journal_publication_request() is called only once, by main(), just after closing the app and before ending the program. void fsm_journal_event (int severity, int source, const char *file_source, const char *function_source, const char *string_value) It is mandatory for any event to call this function to be published in the journal. void fsm_init (char *initial_message_from_main) F S M I N I T *. void fsm_set_preferences_modified (bool value) setter for the static boolean: 'preferences_have_been_modified' bool fsm_get_preferences_state () getter for the static boolean: 'preferences_have_been_modified' int fsm_get_exec_edit () Any function that modifies the client window must obtain this boolean. int fsm_get_state_rules_data () Any function that modifies the client window must obtain this value. void fsm_set_exec_edit (int choice) setter for the static value: 'choice_STATE_RULES_DATA' (in this file) void fsm_set_state_rules_data (int choice) setter for the static value: 'choice_STATE_RULES_DATA' (in this file)
Detailed Description OOOOOOOOOOO OOOOO OOO OOO * OO OO OO OOOO OOOO * OO OO OO OO OO OO * OOOOOO OO OO OO OO OO * OO OO OO OOO OO * OO OO OO OO * OO OO OOO OO OO * OO OOOOOO OO OO * This Finite State Machine (fsm) describes all the possible states of the Gem-graph client and all the transitions between these states. gem-graph-client fsm (Finite State Machine) manages four topics: engine (window appearance) measures (current measurements) results (current data acquisition and displays) preferences (current user preferences) Each state of the finite state machine (fsm) is a combination of their states. It must be saved at the end of a work session and reread (available) at the start of a new session. No state of the fsm should be defined in another module. No fsm transition needs to be executed in another module. The journal is created, edited and published from here.
Function Documentation
fsm_get_exec_edit() fsm_get_exec_editdispatch.c dispatch.cfsm_get_exec_edit int fsm_get_exec_edit ( ) Any function that modifies the client window must obtain this boolean. The 'state' and 'rules' pages appearance depends heavily on this. see include/fsm enum fsm_enum_exec_edit { EXEC, EDIT } The current int may be replaced by a boolean before publication. TODO Date 2024-08 Author Jean See also src/widget/one_rule/dispatch src/widget/state/dispatch * 2 src/signal include/fsm enum fsm_enum_exec_edit { EXEC, EDIT } << TODO check this Returns choice_EXEC_EDIT
fsm_get_preferences_state() fsm_get_preferences_statedispatch.c dispatch.cfsm_get_preferences_state bool fsm_get_preferences_state ( ) getter for the static boolean: 'preferences_have_been_modified' Date 2024-08 Author Jean See also TODO A function must obtain this boolean when it stores the current state of the fsm (including preferences) before closing the current session. (none) Returns preferences_have_been_modified
fsm_get_state_rules_data() fsm_get_state_rules_datadispatch.c dispatch.cfsm_get_state_rules_data int fsm_get_state_rules_data ( ) Any function that modifies the client window must obtain this value. The pages selection and the window appearance depends heavily on this. see include/fsm enum fsm_enum_state_rules_data { SYNTH, STATE, RULES, DATA } Date 2024-08 Author Jean See also src/widget/topbar/left src/signal (none) Returns choice_STATE_RULES_DATA
fsm_init() fsm_initdispatch.c dispatch.cfsm_init void fsm_init (char * initial_message_from_main) F S M I N I T *. This is the first function called by 'main.c' It initiates the journal and four lists which are: 'measures', 'results', 'displayables results' and 'preferences'. These lists will be used to define the current state of the fsm. Date 2024-08 Author Jean See also src/main/main() src/journal/fsm_journal_init() src/fsm/dispatch/fsm_journal_event() src/fsm/measures/manager/fsm_list_init_measures() src/fsm/results/manager/fsm_list_init_results() src/fsm/preferences/manager/fsm_list_init_displayables() src/fsm/preferences/manager/fsm_list_init_preferences() Parameters *initial_message_from_main
fsm_journal_event() fsm_journal_eventdispatch.c dispatch.cfsm_journal_event void fsm_journal_event (int severity, int source, const char * file_source, const char * function_source, const char * string_value) It is mandatory for any event to call this function to be published in the journal. Before publication, a filter can be applied here (and only here) to select only some events of interest (during debugging, for example). If there are too many events, a filter can be applied here to select a few interesting events for publication in the log. This filter can operate on any the following five parameters: severity, source, *file_source, *function_source, *string_value. See also below (params) Simple filters (on a single parameter) can be combined using the logical operators 'and' and 'or' and parentheses. Use: $ grep -r "fsm_journal_event" to confirm the callergraph calls. Date 2024-08 Author Jean See also src/journal.c/fsm_journal_push_front() src/main/main() src/widget/topbar/modal.c src/widget/topbar/right.c src/widget/topbar/dialog.c src/widget/topbar/left.c src/widget/topbar/dispatch.c * 3 src/widget/one_rule/dispatch.c src/widget/one_rule/algebra/conditions.c * 2 src/widget/measure/dispatch.c src/widget/dispatch.c * 3 src/widget/all_rules/dispatch.c src/fsm/preferences/manager.c * 8 src/fsm/measures/manager.c * 2 src/fsm/measures/tools_list.c * 4 src/fsm/dispatch.c * 10 src/fsm/results/manager.c src/util/tree.c src/signal.c * 38 Parameters severity <>
See also enum fsm_enum_journal_severity in include/fsm.h 'severity' is a pre-defined value that must be associated to each event. It ranges from zero to six : CRITICAL ERROR WARNING INFO MESSAGE DEBUG SPEW 0 1 2 3 4 5 6 Parameters source <>
See also enum fsm_enum_journal_source in include/fsm.h 'source' is a pre-defined value that can be associated to each event. It is not mandatory. It can be set to 'NULL'. Parameters *file_source <> the name of the file that emits the event. *function_source <> the function that emits the event. *string_value <> any value that can qualify the event and provides useful information when reading the log.
fsm_journal_publication_request() fsm_journal_publication_requestdispatch.c dispatch.cfsm_journal_publication_request void fsm_journal_publication_request ( ) The fsm_journal_publication_request() is called only once, by main(), just after closing the app and before ending the program. This is to guarantee the chronological order of the events in the journal. The log is modified for each event but events can be send asynchronously. This is why the journal is only published once, before the end of "main()", Its chronological order is therefore guaranteed. src/journal.c/fsm_journal_publish() (called here) is the last function of the program to be executed. The fsm_struct_journal (gg_logs) is a static instance in this file. Therefore, all the functions that read or write it are in this file. This is to avoid uncontrolled operations on it. Date 2024-08 Author Jean See also src/main/main() src/journal/fsm_journal_publish()
fsm_set_exec_edit() fsm_set_exec_editdispatch.c dispatch.cfsm_set_exec_edit void fsm_set_exec_edit (int choice) setter for the static value: 'choice_STATE_RULES_DATA' (in this file) see include/fsm enum fsm_enum_exec_edit { EXEC, EDIT } Date 2024-08 Author Jean See also (none) src/signal * 2 Parameters choice < a boolean value which can be "EXEC" or "EDIT"
fsm_set_preferences_modified() fsm_set_preferences_modifieddispatch.c dispatch.cfsm_set_preferences_modified void fsm_set_preferences_modified (bool value) setter for the static boolean: 'preferences_have_been_modified' Date 2024-08 Author Jean See also TODO To be used by any function that modifies the current user preferences fsm_journal_event() Parameters value = TRUE if preferences_have_been_modified.
fsm_set_state_rules_data() fsm_set_state_rules_datadispatch.c dispatch.cfsm_set_state_rules_data void fsm_set_state_rules_data (int choice) setter for the static value: 'choice_STATE_RULES_DATA' (in this file) see include/fsm enum fsm_enum_state_rules_data { SYNTH, STATE, RULES, DATA } Today (2024-10) the initial page is set to 'SYNTH'. See also line 292 choice_STATE_RULES_DATA = SYNTH; NB This choice can be temporarily modified for debugging purpose: end of the function: fsm/dispatch.c window_design_topbar_left() Date 2024-08 Author Jean See also src/signal * 4 (none) Parameters choice