Gem-graph 0.1.0
A modelling tool based on rewriting of geometric graphs.
|
fsm (Finite State Machine) tasks dispatcher More...
#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) |
fsm init is the first function called by main.c It initiates the journal and the four lists: 'measures', 'results', 'displayables results' and 'preferences'. | |
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 () |
some client pages (in particular "state" and "rules") will be displayed and behave differently depending on whether the fsm is in edit or run state. | |
int | fsm_get_state_rules_data () |
The value of the static int choice_STATE_RULES_DATA can be one of the enum include/fsm enum fsm_enum_state_rules_data. | |
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) | |
fsm (Finite State Machine) tasks dispatcher
This file is part of Gem-graph.
The Finite State Machine (fsm) describes all the possible states of the Gem-graph client and all the transitions between them. It manages several kinds of exclusive states:
Each state of the fsm is a combination of each of these states.
The current state of the fsm must be
No state of the fsm should be defined in another module.
No fsm transition should be executed in another module.
The journal is created, edited and published from here.
int fsm_get_exec_edit | ( | ) |
some client pages (in particular "state" and "rules") will be displayed and behave differently depending on whether the fsm is in edit or run state.
Any function which modifies the appearance or behavior of these pages must use this getter to access the choice_EXEC_EDIT value.
see include/fsm enum fsm_enum_exec_edit { EXEC, EDIT } The current int may be replaced by a boolean . TODO
bool fsm_get_preferences_state | ( | ) |
getter for the static boolean: 'preferences_have_been_modified'
int fsm_get_state_rules_data | ( | ) |
The value of the static int choice_STATE_RULES_DATA can be one of the enum include/fsm enum fsm_enum_state_rules_data.
To each value is associated a different page and different possible behaviors. Any function that modifies the client window must get this value.
see include/fsm enum fsm_enum_state_rules_data { SYNTH, STATE, RULES, DATA }
void fsm_init | ( | char * | initial_message_from_main | ) |
fsm init is the first function called by main.c It initiates the journal and the four lists: 'measures', 'results', 'displayables results' and 'preferences'.
The items selected in these lists define the current state of the fsm.
*initial_message_from_main |
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.
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.
severity | <> |
source | <> |
*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. |
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.
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 }
choice | < a boolean value which can be "EXEC" or "EDIT" |
void fsm_set_preferences_modified | ( | bool | value | ) |
setter for the static boolean: 'preferences_have_been_modified'
value | = TRUE if preferences_have_been_modified. |
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'.
choice |