WIP: linking fsm/measure.c fsm_add() to the debug function in fsm/dispatch

This commit is contained in:
Jean Sirmai 2024-08-19 20:00:06 +02:00
parent 4297242f16
commit 2d269755f1
Signed by: jean
GPG Key ID: FB3115C340E057E3
4 changed files with 24 additions and 13 deletions

View File

@ -62,3 +62,5 @@ void fsm_set_preferences_state (bool value);
void *fsm_add_measure (char *measure_name); void *fsm_add_measure (char *measure_name);
void *fsm_add_result (char *result_name); void *fsm_add_result (char *result_name);
void fsm_debug (int choice, int value, char *string, int sub_automaton);

View File

@ -38,5 +38,3 @@ const char get_button_icon_name (int n);
void fsm_reset_all_situations_transparencies_at_value (int value); // provisoire... void fsm_reset_all_situations_transparencies_at_value (int value); // provisoire...
void *fsm_add_displayable (char *displayable_name); void *fsm_add_displayable (char *displayable_name);
//void debug_printing (int choice, int value, int sub_automaton);

View File

@ -31,7 +31,7 @@
#include "../../include/fsm.h" #include "../../include/fsm.h"
#include "../../include/prefer.h" #include "../../include/prefer.h"
#include "../../include/widget.h" //#include "../../include/widget.h"
#include "../../include/fsm.h" #include "../../include/fsm.h"
@ -79,17 +79,15 @@ int fsm_get_exec_edit () {return choice_EXEC_EDIT;}
int fsm_get_state_rules_data () {return choice_STATE_RULES_DATA;} int fsm_get_state_rules_data () {return choice_STATE_RULES_DATA;}
/******************************************************************************/ /******************************************************************************/
/* T R A N S I T I O N S */ /* T R A N S I T I O N S */
/******************************************************************************/ /******************************************************************************/
static void debug_printing (int choice, int value, int sub_automaton);
void fsm_set_exec_edit (int choice) void fsm_set_exec_edit (int choice)
{ {
if (choice_EXEC_EDIT != choice) { if (choice_EXEC_EDIT != choice) {
debug_printing (choice, 0, 0); // EXEC_EDIT is sub_automaton 0 fsm_debug (choice, 0, "", 0); // EXEC_EDIT is sub_automaton 0
choice_EXEC_EDIT = choice; choice_EXEC_EDIT = choice;
} }
} }
@ -97,7 +95,7 @@ void fsm_set_exec_edit (int choice)
void fsm_set_state_rules_data (int choice) void fsm_set_state_rules_data (int choice)
{ {
if (choice_STATE_RULES_DATA != choice) { if (choice_STATE_RULES_DATA != choice) {
debug_printing (choice, 0, 1); // STATE_RULES_DATA is sub_automaton 1 fsm_debug (choice, 0, "", 1); // STATE_RULES_DATA is sub_automaton 1
choice_STATE_RULES_DATA = choice; choice_STATE_RULES_DATA = choice;
} }
} }
@ -110,7 +108,7 @@ void fsm_set_state_rules_data (int choice)
static char *tab_0 [] = { "EXEC", "EDIT" }; static char *tab_0 [] = { "EXEC", "EDIT" };
static char *tab_1 [] = { "SYNTH", "STATE", "RULES", "DATA" }; static char *tab_1 [] = { "SYNTH", "STATE", "RULES", "DATA" };
static void debug_printing (int choice, int value, int sub_automaton) void fsm_debug (int choice, int value, char *string, int sub_automaton)
{ {
switch (sub_automaton) { // sub_automaton 0 is EXEC_EDIT and switch (sub_automaton) { // sub_automaton 0 is EXEC_EDIT and
// sub_automaton 1 is STATE_RULES_DATA // sub_automaton 1 is STATE_RULES_DATA
@ -126,10 +124,10 @@ static void debug_printing (int choice, int value, int sub_automaton)
tab_0 [choice_EXEC_EDIT], tab_0 [choice_EXEC_EDIT],
tab_1 [choice]); tab_1 [choice]);
break; break;
case (2) : printf("FSM debug <> choice = %2d\n", choice); break; case (2) : printf("fsm <> %s\n", string); break;
case (3) : printf("FSM debug <> choice = %2d\n", choice); break; case (3) : printf("FSM debug <> choice = %2d\n", choice); break;
default : printf("default in automaton.debug_printing()\n"); default : printf("default in fsm/dispatch.fsm_debug()\n");
} }
} }

View File

@ -35,6 +35,20 @@
#include "../../include/fsm.h" #include "../../include/fsm.h"
/******************************************************************************/
/* */
/* FFFFFFFFFFFF SSSS MM MM */
/* FF SS SS MMMM MMMM */
/* FF SS MM MM MM MM */
/* FFFFFFF SS MM MM MM MM */
/* FF SS MM MM MM */
/* FF SS MM MM */
/* FF SS SS MM MM */
/* FF SSSSS MM MM */
/* */
/******************************************************************************/
/******************************************************************************/ /******************************************************************************/
/* Each state of the finite state machine (fsm) must be */ /* Each state of the finite state machine (fsm) must be */
/* - saved at the end of a work session and */ /* - saved at the end of a work session and */
@ -88,8 +102,7 @@ static void *list_measures;
void *fsm_add_measure (char *measure_name) void *fsm_add_measure (char *measure_name)
{ {
printf("fsm_add_measure %p <<< %s (see fsm.c)\n", list_measures, measure_name); fsm_debug (2, 0, measure_name, 2);
// debug_printing (2, 0, 0);
return NULL; return NULL;
} }