gem-graph-client/automaton.c

60 lines
1.8 KiB
C

#include <gtk-4.0/gtk/gtk.h>
#include <assert.h>
#include "callback.h"
#include "automaton.h"
/******************************************************************************/
/* S T A T E S */
/******************************************************************************/
static int choice_EXEC_EDIT = EXEC;
static int choice_STATE_RULES_DATA = STATE;
void set_EXEC_EDIT (int prescribed) {
choice_EXEC_EDIT = prescribed;
SWITCH_TO (choice_EXEC_EDIT, choice_STATE_RULES_DATA);
}
int get_EXEC_EDIT () {return choice_EXEC_EDIT;}
void set_STATE_RULES_DATA (int prescribed) {
choice_STATE_RULES_DATA = prescribed;
SWITCH_TO (choice_EXEC_EDIT, choice_STATE_RULES_DATA);
}
int get_STATE_RULES_DATA () {return choice_STATE_RULES_DATA;}
/******************************************************************************/
/* T R A N S I T I O N S */
/******************************************************************************/
void SWITCH_TO (int choice_EXEC_EDIT, int choice_STATE_RULES_DATA)
{
switch (choice_STATE_RULES_DATA) {
case (STATE) :
choice_STATE_RULES_DATA = STATE;
if (choice_EXEC_EDIT ) choice_EXEC_EDIT = EXEC;
else choice_EXEC_EDIT = EDIT;
break;
case (RULES) :
choice_STATE_RULES_DATA = RULES;
if (choice_EXEC_EDIT ) choice_EXEC_EDIT = EXEC;
else choice_EXEC_EDIT = EDIT;
break;
case (DATA) :
choice_STATE_RULES_DATA = DATA;
if (choice_EXEC_EDIT ) choice_EXEC_EDIT = EXEC;
else choice_EXEC_EDIT = EDIT;
break;
default : printf("default in automaton.SWITCH_TO()\n");
}
printf("SWITCH_TO %d X %d (EXEC_EDIT X STATE_RULES_DATA)\n",
choice_EXEC_EDIT,
choice_STATE_RULES_DATA);
}