From 01b59ee7acd4fb14164ada16c15ce1635d715dfe Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Wed, 24 Jul 2024 18:22:59 +0200 Subject: [PATCH] WIP: cleaning, cleaning... --- include/fsm.h | 5 +--- src/fsm.c | 78 +++++++++++---------------------------------------- 2 files changed, 17 insertions(+), 66 deletions(-) diff --git a/include/fsm.h b/include/fsm.h index f11a00f..191e0c2 100644 --- a/include/fsm.h +++ b/include/fsm.h @@ -44,13 +44,10 @@ enum fsm_choice_STORE_RESTORE_RESET { STORE, RESTORE, RESET }; // xor int fsm_get_exec_edit (); int fsm_get_state_rules_data (); -int fsm_get_objects_box_reset_value (); -int fsm_get_situations_box_reset_value (); +int fsm_get_store_restore_reset (); void fsm_set_exec_edit (int value); void fsm_set_state_rules_data (int value); void fsm_set_store_restore_reset (int target, int value); void fsm_reset_all_situations_transparencies_at_value (int value); - - diff --git a/src/fsm.c b/src/fsm.c index 257d72e..67de22d 100644 --- a/src/fsm.c +++ b/src/fsm.c @@ -41,8 +41,9 @@ static int choice_EXEC_EDIT = EXEC; static int choice_STATE_RULES_DATA = STATE; static int choice_STORE_RESTORE_RESET = STORE; -static int choice_OBJECTS_box_RESET_VALUE = -1; -static int choice_SITUATIONS_box_RESET_VALUE = -1; +int fsm_get_exec_edit () {return choice_EXEC_EDIT;} +int fsm_get_state_rules_data () {return choice_STATE_RULES_DATA;} +int fsm_get_store_restore_reset () {return choice_STORE_RESTORE_RESET;} /******************************************************************************/ @@ -69,84 +70,35 @@ void fsm_set_state_rules_data (int value) void fsm_set_store_restore_reset (int target, int value) { - printf("fsm_set_store_restore_reset(%d,%3d) > ", target, value); + choice_STORE_RESTORE_RESET = target; + switch (target) { - case (STORE) : printf("STORE\n"); break; - case (RESTORE) : printf("RESTORE\n"); break; - case (RESET) : printf("RESET\n"); break; + case (STORE) : break; + case (RESTORE) : break; + case (RESET) : break; default : printf("default in signal.switch_store_restore_reset()\n"); } -// debug_printing (target, 2); // STORE_RESTORE_RESET is sub_automaton 2 - // choice_STORE_RESTORE_RESET = value; + + debug_printing (target, 2); // STORE_RESTORE_RESET is sub_automaton 2 } - - - - - - - - - - -void fsm_restore_all_objects_transparencies_from_mem (int value) -{ - print_sth("Officially introducing : ' P R E F E R E N C E S' !"); - debug_printing (value, 2); // OBJECTS_box_RESET_VALUES is sub_automaton 2 -} - -void fsm_store_all_objects_transparencies_current_values (int value) -{ - debug_printing (value, 3); // OBJECTS_box_STORE_VALUES is sub_automaton 3 -} - -void fsm_reset_all_objects_transparencies_at_value (int value) -{ -// if (choice_OBJECTS_box_RESET_VALUE != value) { << NON: Je veux pouvoir -// d'emblée tout remettre à zéro sans avoir eu à manipuler le curseur auparavant. -// Tant pis si cette fonction s'exécute parce qu'un reset inutile a été demandé. - - debug_printing (value, 4); // OBJECTS_box_RESET_VALUE is sub_automaton 2 - choice_OBJECTS_box_RESET_VALUE = value; - widget_reset_all_objects_transparencies_to_value (value); -} - - - - - - - - // ---------------------- S I T U A T I O N S ---------------------------// +static int choice_SITUATIONS_box_RESET_VALUE = -1; + void fsm_reset_all_situations_transparencies_at_value (int value) { - debug_printing (value, 5); // SITUATIONS_box_RESTORE_VALUES is sub_automaton 4 + debug_printing (value, 3); // SITUATIONS_box_RESTORE_VALUES is sub_automaton 4 choice_SITUATIONS_box_RESET_VALUE = value; widget_reset_all_situations_transparencies_to_value (value); } -void fsm_set_situations_box_reset_value (int value) -{ - if (choice_SITUATIONS_box_RESET_VALUE != value) { - debug_printing (value, 5); // SITUATIONS_box_RESET_VALUE is sub_automaton 5 - choice_SITUATIONS_box_RESET_VALUE = value; - } -} - -int fsm_get_exec_edit () {return choice_EXEC_EDIT;} -int fsm_get_state_rules_data () {return choice_STATE_RULES_DATA;} -int fsm_get_objects_box_reset_value () {return choice_OBJECTS_box_RESET_VALUE;} -int fsm_get_situations_box_reset_value () {return choice_SITUATIONS_box_RESET_VALUE;} - /******************************************************************************/ /* D E B U G G E R S */ -/******************************************************************************/ +/***************************************************************************ù***/ static char *tab_0 [] = { "EXEC", "EDIT" }; static char *tab_1 [] = { "STATE", "RULES", "DATA" }; @@ -171,6 +123,8 @@ static void debug_printing (int value, int sub_automaton) case (2) : printf("fsm_set_store_restore_reset <> target = %s\n", tab_2 [choice_STORE_RESTORE_RESET]); break; + case (3) : printf("fsm_reset_all_situations_transparencies_at_value : %3d\n", value); + break; default : printf("default in automaton.debug_printing()\n"); }