From 2d269755f16d125666bc435221281c9b7fd9bb82 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Mon, 19 Aug 2024 20:00:06 +0200 Subject: [PATCH] WIP: linking fsm/measure.c fsm_add() to the debug function in fsm/dispatch --- include/fsm.h | 2 ++ include/prefer.h | 2 -- src/fsm/dispatch.c | 16 +++++++--------- src/fsm/measure.c | 17 +++++++++++++++-- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/include/fsm.h b/include/fsm.h index 7a4eb80..1123396 100644 --- a/include/fsm.h +++ b/include/fsm.h @@ -62,3 +62,5 @@ void fsm_set_preferences_state (bool value); void *fsm_add_measure (char *measure_name); void *fsm_add_result (char *result_name); + +void fsm_debug (int choice, int value, char *string, int sub_automaton); diff --git a/include/prefer.h b/include/prefer.h index 6007459..c90f25e 100644 --- a/include/prefer.h +++ b/include/prefer.h @@ -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_add_displayable (char *displayable_name); - -//void debug_printing (int choice, int value, int sub_automaton); diff --git a/src/fsm/dispatch.c b/src/fsm/dispatch.c index b4d7869..9d6d35d 100644 --- a/src/fsm/dispatch.c +++ b/src/fsm/dispatch.c @@ -31,7 +31,7 @@ #include "../../include/fsm.h" #include "../../include/prefer.h" -#include "../../include/widget.h" +//#include "../../include/widget.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;} + /******************************************************************************/ /* 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) { 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; } } @@ -97,7 +95,7 @@ void fsm_set_exec_edit (int choice) void fsm_set_state_rules_data (int 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; } } @@ -110,7 +108,7 @@ void fsm_set_state_rules_data (int choice) static char *tab_0 [] = { "EXEC", "EDIT" }; 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 // 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_1 [choice]); 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; - default : printf("default in automaton.debug_printing()\n"); + default : printf("default in fsm/dispatch.fsm_debug()\n"); } } diff --git a/src/fsm/measure.c b/src/fsm/measure.c index 817bcdc..66ba10f 100644 --- a/src/fsm/measure.c +++ b/src/fsm/measure.c @@ -35,6 +35,20 @@ #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 */ /* - saved at the end of a work session and */ @@ -88,8 +102,7 @@ static void *list_measures; void *fsm_add_measure (char *measure_name) { - printf("fsm_add_measure %p <<< %s (see fsm.c)\n", list_measures, measure_name); -// debug_printing (2, 0, 0); + fsm_debug (2, 0, measure_name, 2); return NULL; }