Renommage (fsm) suite audit

This commit is contained in:
Jean Sirmai 2024-07-19 00:17:19 +02:00
parent 31923af432
commit 19f3483c2c
Signed by: jean
GPG Key ID: FB3115C340E057E3
4 changed files with 56 additions and 56 deletions

View File

@ -40,14 +40,14 @@
enum choice_EXEC_EDIT { EXEC, EDIT }; // xor
enum choice_STATE_RULES_DATA { STATE, RULES, DATA }; // xor
int get_EXEC_EDIT ();
int get_STATE_RULES_DATA ();
int get_OBJECTS_box_RESET_VALUE ();
int get_SITUATIONS_box_RESET_VALUE ();
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 ();
void set_EXEC_EDIT (int prescribed);
void set_STATE_RULES_DATA (int prescribed);
void set_OBJECTS_box_RESET_VALUE (int prescribed);
void set_SITUATIONS_box_RESET_VALUE (int prescribed);
void fsm_set_EXEC_EDIT (int value);
void fsm_set_STATE_RULES_DATA (int value);
void fsm_set_OBJECTS_box_RESET_VALUE (int value);
void fsm_set_SITUATIONS_box_RESET_VALUE (int value);

View File

@ -46,37 +46,37 @@ static int choice_SITUATIONS_box_RESET_VALUE = 0;
/* T R A N S I T I O N S */
/******************************************************************************/
static void debug_printing (int prescribed, int sub_automaton);
static void debug_printing (int value, int sub_automaton);
void set_EXEC_EDIT (int prescribed)
void fsm_set_EXEC_EDIT (int value)
{
if (choice_EXEC_EDIT != prescribed) {
debug_printing (prescribed, 0); // EXEC_EDIT is sub_automaton 0
choice_EXEC_EDIT = prescribed;
if (choice_EXEC_EDIT != value) {
debug_printing (value, 0); // EXEC_EDIT is sub_automaton 0
choice_EXEC_EDIT = value;
}
}
void set_STATE_RULES_DATA (int prescribed)
void fsm_set_STATE_RULES_DATA (int value)
{
if (choice_STATE_RULES_DATA != prescribed) {
debug_printing (prescribed, 1); // STATE_RULES_DATA is sub_automaton 1
choice_STATE_RULES_DATA = prescribed;
if (choice_STATE_RULES_DATA != value) {
debug_printing (value, 1); // STATE_RULES_DATA is sub_automaton 1
choice_STATE_RULES_DATA = value;
}
}
void set_OBJECTS_box_RESET_VALUE (int prescribed)
void fsm_set_OBJECTS_box_RESET_VALUE (int value)
{
if (choice_OBJECTS_box_RESET_VALUE != prescribed) {
debug_printing (prescribed, 2); // OBJECTS_box_RESET_VALUE is sub_automaton 2
choice_OBJECTS_box_RESET_VALUE = prescribed;
if (choice_OBJECTS_box_RESET_VALUE != value) {
debug_printing (value, 2); // OBJECTS_box_RESET_VALUE is sub_automaton 2
choice_OBJECTS_box_RESET_VALUE = value;
}
}
void set_SITUATIONS_box_RESET_VALUE (int prescribed)
void fsm_set_SITUATIONS_box_RESET_VALUE (int value)
{
if (choice_SITUATIONS_box_RESET_VALUE != prescribed) {
debug_printing (prescribed, 3); // SITUATIONS_box_RESET_VALUE is sub_automaton 3
choice_SITUATIONS_box_RESET_VALUE = prescribed;
if (choice_SITUATIONS_box_RESET_VALUE != value) {
debug_printing (value, 3); // SITUATIONS_box_RESET_VALUE is sub_automaton 3
choice_SITUATIONS_box_RESET_VALUE = value;
}
}
@ -85,48 +85,48 @@ void set_SITUATIONS_box_RESET_VALUE (int prescribed)
/* G E T T E R S & D E B U G G E R S */
/******************************************************************************/
int get_EXEC_EDIT () {return choice_EXEC_EDIT;}
int get_STATE_RULES_DATA () {return choice_STATE_RULES_DATA;}
int get_OBJECTS_box_RESET_VALUE () {return choice_OBJECTS_box_RESET_VALUE;}
int get_SITUATIONS_box_RESET_VALUE () {return choice_SITUATIONS_box_RESET_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;}
static char *get_str_EXEC_EDIT (int 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.get_EXEC_EDIT ()\n"); return NULL;
default : printf("default in automaton.fsm_get_EXEC_EDIT ()\n"); return NULL;
}
}
static char *get_str_STATE_RULES_DATA (int value) {
static char *fsm_get_str_STATE_RULES_DATA (int value) {
switch (value) {
case (STATE) : return "STATE";
case (RULES) : return "RULES";
case (DATA) : return "DATA";
default : printf("default in automaton.get_STATE_RULES_DATA ()\n"); return NULL;
default : printf("default in automaton.fsm_get_STATE_RULES_DATA ()\n"); return NULL;
}
}
static void debug_printing (int prescribed, int sub_automaton) {
static void debug_printing (int value, int sub_automaton) {
switch (sub_automaton) { // sub_automaton 0 is EXEC_EDIT and
// sub_automaton 1 is STATE_RULES_DATA
case (0) : printf("switch %5s x %5s > %5s x %5s\n",
get_str_EXEC_EDIT (choice_EXEC_EDIT),
get_str_STATE_RULES_DATA (choice_STATE_RULES_DATA),
get_str_EXEC_EDIT (prescribed),
get_str_STATE_RULES_DATA (choice_STATE_RULES_DATA));
fsm_get_str_EXEC_EDIT (choice_EXEC_EDIT),
fsm_get_str_STATE_RULES_DATA (choice_STATE_RULES_DATA),
fsm_get_str_EXEC_EDIT (value),
fsm_get_str_STATE_RULES_DATA (choice_STATE_RULES_DATA));
break;
case (1) : printf("switch %5s x %5s > %5s x %5s\n",
get_str_EXEC_EDIT (choice_EXEC_EDIT),
get_str_STATE_RULES_DATA (choice_STATE_RULES_DATA),
get_str_EXEC_EDIT (choice_EXEC_EDIT),
get_str_STATE_RULES_DATA (prescribed));
fsm_get_str_EXEC_EDIT (choice_EXEC_EDIT),
fsm_get_str_STATE_RULES_DATA (choice_STATE_RULES_DATA),
fsm_get_str_EXEC_EDIT (choice_EXEC_EDIT),
fsm_get_str_STATE_RULES_DATA (value));
break;
case (2) : printf("automat.set_OBJECTS_box_RESET_VALUE : %2d > %2d\n",
get_OBJECTS_box_RESET_VALUE(), prescribed);
case (2) : printf("automat.fsm_set_OBJECTS_box_RESET_VALUE : %2d > %2d\n",
fsm_get_OBJECTS_box_RESET_VALUE(), value);
break;
case (3) : printf("automat.set_SITUATIONS_box_RESET_VALUE : %2d > %2d\n",
get_SITUATIONS_box_RESET_VALUE(), prescribed);
case (3) : printf("automat.fsm_set_SITUATIONS_box_RESET_VALUE : %2d > %2d\n",
fsm_get_SITUATIONS_box_RESET_VALUE(), value);
break;
default : printf("default in automaton.debug_printing()\n");
}

View File

@ -248,7 +248,7 @@ void on_WRITE_CURRENT_MODEL (GtkWidget *btt_WRITE_CURRENT_MODEL,
static void switch_STATE_RULES_DATA()
{
switch (get_STATE_RULES_DATA()) {
switch (fsm_get_STATE_RULES_DATA()) {
case (STATE) :
gtk_window_set_child (widget_head_rec_MAIN_WINDOW(),
@ -272,11 +272,11 @@ static void switch_STATE_RULES_DATA()
void on_toggle_EXEC_EDIT (GtkWidget *toggled_button, gpointer user_data)
{
if (get_EXEC_EDIT ()) {
if (fsm_get_EXEC_EDIT ()) {
gtk_button_set_icon_name (GTK_BUTTON (toggled_button),
"power-profile-balanced-rtl-symbolic");
set_EXEC_EDIT (EXEC);
fsm_set_EXEC_EDIT (EXEC);
} else {
@ -286,7 +286,7 @@ void on_toggle_EXEC_EDIT (GtkWidget *toggled_button, gpointer user_data)
// https://docs.gtk.org/gtk4/class.Window.html TODO 2024-06-30
// gtk_window_present (GTK_WINDOW (widget_head_rec_DIALOG_WINDOW())); // works once only !
set_EXEC_EDIT (EDIT);
fsm_set_EXEC_EDIT (EDIT);
}
switch_STATE_RULES_DATA();
@ -299,15 +299,15 @@ void on_toggle_STATE_RULES_DATA (GtkWidget *toggled_button, gpointer user_data)
int is_active = gtk_check_button_get_active (GTK_CHECK_BUTTON (toggled_button));
if (! strcmp (toggled_button_name, "state")) {
set_STATE_RULES_DATA (STATE);
fsm_set_STATE_RULES_DATA (STATE);
}
if (! strcmp (toggled_button_name, "rules")) {
set_STATE_RULES_DATA (RULES);
fsm_set_STATE_RULES_DATA (RULES);
}
if (! strcmp (toggled_button_name, "data analysis")) {
set_STATE_RULES_DATA (DATA);
fsm_set_STATE_RULES_DATA (DATA);
}
if (is_active) {
@ -334,12 +334,12 @@ void on_OBJECTS_box_DO_RESET (GtkWidget *btt_reset, gpointer data)
et reportée dans le module 'automat'.\n");
// utiliser gpointer data pour transmettre la valeur choisie TODO
set_OBJECTS_box_RESET_VALUE (1);
fsm_set_OBJECTS_box_RESET_VALUE (1);
}
void on_SITUATIONS_box_DO_RESET (GtkWidget *btt_reset, gpointer data)
{
set_SITUATIONS_box_RESET_VALUE (1);
fsm_set_SITUATIONS_box_RESET_VALUE (1);
}

View File

@ -251,7 +251,7 @@ GtkWidget *widget_rec_STATE_page()
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (page_box, GTK_WIDGET (get_SPACE_VIEW_box()));
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
if (get_EXEC_EDIT ()) gtk_box_append (page_box, GTK_WIDGET (get_SPACE_EDIT_CONTROL_box()));
if (fsm_get_EXEC_EDIT ()) gtk_box_append (page_box, GTK_WIDGET (get_SPACE_EDIT_CONTROL_box()));
else gtk_box_append (page_box, GTK_WIDGET (get_SEQUENCE_CONTROL_box()));
return GTK_WIDGET (page_box);
}