Cleaning static debug_printing() in fsm.c using static char *tab[] = { STATE, RULES, DATA }
This commit is contained in:
parent
8e0ef0fdbd
commit
6142fac0d4
43
src/fsm.c
43
src/fsm.c
|
@ -80,50 +80,33 @@ void fsm_set_SITUATIONS_box_RESET_VALUE (int value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
/* G E T T E R S & D E B U G G E R S */
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
int fsm_get_EXEC_EDIT () {return choice_EXEC_EDIT;}
|
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;}
|
||||||
int fsm_get_OBJECTS_box_RESET_VALUE () {return choice_OBJECTS_box_RESET_VALUE;}
|
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;}
|
int fsm_get_SITUATIONS_box_RESET_VALUE () {return choice_SITUATIONS_box_RESET_VALUE;}
|
||||||
|
|
||||||
static char *fsm_get_str_EXEC_EDIT (int value)
|
|
||||||
{
|
|
||||||
switch (value) {
|
|
||||||
case (EXEC) : return "EXEC";
|
|
||||||
case (EDIT) : return "EDIT";
|
|
||||||
default : printf("default in automaton.fsm_get_EXEC_EDIT ()\n"); return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *fsm_get_str_STATE_RULES_DATA (int value)
|
/******************************************************************************/
|
||||||
{
|
/* D E B U G G E R S */
|
||||||
switch (value) {
|
/******************************************************************************/
|
||||||
case (STATE) : return "STATE";
|
|
||||||
case (RULES) : return "RULES";
|
static char *tab[] = { "STATE", "RULES", "DATA" };
|
||||||
case (DATA) : return "DATA";
|
|
||||||
default : printf("default in automaton.fsm_get_STATE_RULES_DATA ()\n"); return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void debug_printing (int value, int sub_automaton)
|
static void debug_printing (int value, 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
|
||||||
case (0) : printf("switch %5s x %5s > %5s x %5s\n",
|
case (0) : printf("switch %5s x %5s > %5s x %5s\n",
|
||||||
fsm_get_str_EXEC_EDIT (choice_EXEC_EDIT),
|
tab [choice_EXEC_EDIT],
|
||||||
fsm_get_str_STATE_RULES_DATA (choice_STATE_RULES_DATA),
|
tab [choice_STATE_RULES_DATA],
|
||||||
fsm_get_str_EXEC_EDIT (value),
|
tab [value],
|
||||||
fsm_get_str_STATE_RULES_DATA (choice_STATE_RULES_DATA));
|
tab [choice_STATE_RULES_DATA]);
|
||||||
break;
|
break;
|
||||||
case (1) : printf("switch %5s x %5s > %5s x %5s\n",
|
case (1) : printf("switch %5s x %5s > %5s x %5s\n",
|
||||||
fsm_get_str_EXEC_EDIT (choice_EXEC_EDIT),
|
tab [choice_EXEC_EDIT],
|
||||||
fsm_get_str_STATE_RULES_DATA (choice_STATE_RULES_DATA),
|
tab [choice_STATE_RULES_DATA],
|
||||||
fsm_get_str_EXEC_EDIT (choice_EXEC_EDIT),
|
tab [choice_EXEC_EDIT],
|
||||||
fsm_get_str_STATE_RULES_DATA (value));
|
tab [value]);
|
||||||
break;
|
break;
|
||||||
case (2) : printf("automat.fsm_set_OBJECTS_box_RESET_VALUE : %2d > %2d\n",
|
case (2) : printf("automat.fsm_set_OBJECTS_box_RESET_VALUE : %2d > %2d\n",
|
||||||
fsm_get_OBJECTS_box_RESET_VALUE(), value);
|
fsm_get_OBJECTS_box_RESET_VALUE(), value);
|
||||||
|
|
|
@ -101,8 +101,8 @@
|
||||||
* Exemple, muni des deux 'sous-automates' :
|
* Exemple, muni des deux 'sous-automates' :
|
||||||
* > { EXEC, EDIT }; // xor
|
* > { EXEC, EDIT }; // xor
|
||||||
* > { STATE, RULES, DATA }; // xor
|
* > { STATE, RULES, DATA }; // xor
|
||||||
* la 'state machine' peut se trouver dans 2 x 3 = 6 états.
|
* la 'finite state machine' peut se trouver dans 2 x 3 = 6 états.
|
||||||
* (voir automat.h lignes 39-40)
|
* (voir fsm.h lignes 40-41)
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Les grandes fonctions du client seront lancées par cette state machine :
|
* Les grandes fonctions du client seront lancées par cette state machine :
|
||||||
|
@ -129,7 +129,7 @@
|
||||||
* *****************************************************************************
|
* *****************************************************************************
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
* L I S T E D E S A P P E L S D E F O N C T I O N S *
|
* L I S T E D E S A P P E L S D E F O N C T I O N S *
|
||||||
* *****************************************************************************
|
* *****************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue