143 lines
2.9 KiB
C
143 lines
2.9 KiB
C
#include <gtk-4.0/gtk/gtk.h>
|
|
#include <assert.h>
|
|
#include "callback.h"
|
|
#include "automaton.h"
|
|
|
|
|
|
/******************************************************************************/
|
|
/* S T A T E S */
|
|
/******************************************************************************/
|
|
|
|
/* (exec / edit) < MODE
|
|
* X
|
|
* (state / rules / data) < VIEW
|
|
* X
|
|
* (measure / analyse / interpret)
|
|
*/
|
|
|
|
static int mode = RUN;
|
|
void set_mode (int prescribed) {mode = prescribed;}
|
|
int get_mode () {return mode;}
|
|
|
|
static int view = INTER; // int get_view () {return view;}
|
|
void set_view (int prescribed) {view = prescribed;}
|
|
int get_view () {return view;}
|
|
|
|
|
|
/******************************************************************************/
|
|
/* T R A N S I T I O N S */
|
|
/******************************************************************************/
|
|
|
|
void toggle_TO (int mode, int view) {
|
|
switch (view) {
|
|
case (INTER) : printf ("switch to INTER\n"); break;
|
|
case (STATE) : printf ("switch to STATE\n"); break;
|
|
case (RULES) : printf ("switch to RULES\n"); break;
|
|
case (DATA) : printf ("switch to DATA \n"); break;
|
|
default : ;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
enum { // S T A T E S
|
|
INTER,
|
|
EXEC_STOP,
|
|
EXEC_RUN,
|
|
EDIT_STATE,
|
|
EDIT_RULES_TREE,
|
|
EDIT_RULE,
|
|
EDIT_MEASURE,
|
|
OBSERVE,
|
|
ANALYSE,
|
|
HELP,
|
|
CONFIGURE
|
|
};
|
|
|
|
static int view = EXEC_STOP; // int get_view () {return view;}
|
|
|
|
enum { // T R A N S I T I O N S
|
|
BEGIN_TO_EXEC_STOP
|
|
EXEC_STOP_TO_RUN,
|
|
EXEC_RUN_TO_STOP,
|
|
EXEC_TO_INTER,
|
|
INTER_TO_EDIT,
|
|
EDIT_TO_INTER,
|
|
INTER_TO_EXEC,
|
|
};
|
|
|
|
|
|
void set_view (int prescribed) {
|
|
view = prescribed; if (0) printf ("view = %d\n", view);
|
|
|
|
switch (view) {
|
|
case (0) : // EXEC_STOP DATA_ANALYSIS
|
|
view = EXEC_RUN;
|
|
break;
|
|
case (1) : // EXEC_RUN
|
|
// Ici, il faudra prévenir l'utilisateur par une pop-up window : (sauvegarde automatique sinon)
|
|
// S'il ne prend pas la main, les données de la simulation en cours risquent d'être perdues
|
|
view = EXEC_STOP;
|
|
break;
|
|
case (2) : // EXEC_STOP_EDIT_STOP
|
|
view = EXEC_RUN_EDIT_RULE;
|
|
break;
|
|
case (3) : // EXEC_RUN_EDIT_RULE
|
|
view = EXEC_STOP_EDIT_RULE;
|
|
break;
|
|
case (4) : // EXEC_STOP_EDIT_MEASURE
|
|
view = EXEC_RUN_EDIT_MEASURE;
|
|
break;
|
|
case (5) : // EXEC_RUN_EDIT_MEASURE
|
|
view = EXEC_STOP_EDIT_MEASURE;
|
|
break;
|
|
case (6) : // EDIT_STATE
|
|
break;
|
|
case (7) : // EDIT_RULE
|
|
break;
|
|
case (8) : // OBSERVE
|
|
break;
|
|
case (9) : // INTERPRET
|
|
break;
|
|
case (10) : // HELP
|
|
break;
|
|
case (11) : // CONFIGURE
|
|
break;
|
|
case (12) : // OTHER
|
|
break;
|
|
default : ;
|
|
}
|
|
} */
|