2024-06-02 22:49:16 +02:00
|
|
|
#include <gtk-4.0/gtk/gtk.h>
|
|
|
|
#include <assert.h>
|
2024-06-03 05:46:01 +02:00
|
|
|
#include "callback.h"
|
2024-06-13 00:08:10 +02:00
|
|
|
#include "automaton.h"
|
2024-06-02 22:49:16 +02:00
|
|
|
|
|
|
|
|
2024-06-04 06:25:47 +02:00
|
|
|
/******************************************************************************/
|
2024-06-09 11:23:42 +02:00
|
|
|
/* S T A T E S */
|
2024-06-04 06:25:47 +02:00
|
|
|
/******************************************************************************/
|
2024-06-03 05:46:01 +02:00
|
|
|
|
2024-06-28 08:16:45 +02:00
|
|
|
static int choice_EXEC_EDIT = EXEC;
|
|
|
|
static int choice_STATE_RULES_DATA = STATE;
|
2024-06-03 05:46:01 +02:00
|
|
|
|
2024-06-28 10:13:22 +02:00
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
/* T R A N S I T I O N S */
|
|
|
|
/******************************************************************************/
|
|
|
|
|
2024-06-28 12:46:31 +02:00
|
|
|
static void debug_printing (int prescribed, int sub_automaton);
|
2024-06-28 10:13:22 +02:00
|
|
|
|
2024-06-28 08:16:45 +02:00
|
|
|
void set_EXEC_EDIT (int prescribed) {
|
2024-06-28 10:13:22 +02:00
|
|
|
if (choice_EXEC_EDIT != prescribed) {
|
2024-06-28 12:46:31 +02:00
|
|
|
debug_printing (prescribed, 0); // EXEC_EDIT is sub_automaton 0
|
2024-06-28 10:13:22 +02:00
|
|
|
choice_EXEC_EDIT = prescribed;
|
|
|
|
}
|
2024-06-28 08:16:45 +02:00
|
|
|
}
|
2024-06-16 00:06:49 +02:00
|
|
|
|
2024-06-28 08:16:45 +02:00
|
|
|
void set_STATE_RULES_DATA (int prescribed) {
|
2024-06-28 10:13:22 +02:00
|
|
|
if (choice_STATE_RULES_DATA != prescribed) {
|
2024-06-28 12:46:31 +02:00
|
|
|
debug_printing (prescribed, 1); // STATE_RULES_DATA is sub_automaton 1
|
2024-06-28 10:13:22 +02:00
|
|
|
choice_STATE_RULES_DATA = prescribed;
|
|
|
|
}
|
2024-06-28 08:16:45 +02:00
|
|
|
}
|
2024-06-16 00:06:49 +02:00
|
|
|
|
2024-06-04 06:25:47 +02:00
|
|
|
|
|
|
|
/******************************************************************************/
|
2024-06-28 10:13:22 +02:00
|
|
|
/* G E T T E R S & D E B U G G E R S */
|
2024-06-04 06:25:47 +02:00
|
|
|
/******************************************************************************/
|
|
|
|
|
2024-06-28 10:13:22 +02:00
|
|
|
int get_EXEC_EDIT () {return choice_EXEC_EDIT;}
|
|
|
|
int get_STATE_RULES_DATA () {return choice_STATE_RULES_DATA;}
|
|
|
|
|
2024-06-28 12:46:31 +02:00
|
|
|
static char *get_str_EXEC_EDIT (int value) {
|
2024-06-28 10:13:22 +02:00
|
|
|
switch (value) {
|
|
|
|
case (EXEC) : return "EXEC";
|
|
|
|
case (EDIT) : return "EDIT";
|
|
|
|
default : printf("default in automaton.get_EXEC_EDIT ()\n"); return NULL;
|
2024-06-09 15:55:36 +02:00
|
|
|
}
|
2024-06-28 10:13:22 +02:00
|
|
|
}
|
2024-06-11 00:11:50 +02:00
|
|
|
|
2024-06-28 12:46:31 +02:00
|
|
|
static char *get_str_STATE_RULES_DATA (int value) {
|
2024-06-28 10:13:22 +02:00
|
|
|
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;
|
|
|
|
}
|
2024-06-09 15:55:36 +02:00
|
|
|
}
|
2024-06-28 10:13:22 +02:00
|
|
|
|
2024-06-28 12:46:31 +02:00
|
|
|
static void debug_printing (int prescribed, int sub_automaton) {
|
|
|
|
switch (sub_automaton) { // sub_automaton 0 is EXEC_EDIT and
|
|
|
|
// sub_automaton 1 is STATE_RULES_DATA
|
2024-06-28 10:13:22 +02:00
|
|
|
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));
|
|
|
|
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));
|
|
|
|
break;
|
|
|
|
default : printf("default in automaton.debug_printing()\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|