#include #include #include "callback.h" #include "automaton.h" /******************************************************************************/ /* S T A T E S */ /******************************************************************************/ /* (exec / edit) < MODE * X * (state / rules / data) < STATUS * X * (measure / analyse / interpret) * X * (read / write) */ static int mode = RUN; void set_mode (int prescribed) {mode = prescribed;} int get_mode () {return mode;} static int status = INTER; // int get_status () {return status;} void set_status (int prescribed) {status = prescribed;} int get_status () {return status;} /******************************************************************************/ /* T R A N S I T I O N S */ /******************************************************************************/ void SWITCH_TO (int asked) { switch (asked) { case (INTER) : status = INTER; printf ("SWITCH_TO INTER\n"); break; case (STATE) : // BEGIN_TO_EXEC_STOP status = STATE; printf ("SWITCH_TO STATE\n"); break; case (RULES) : // EXEC_STOP_TO_RUN status = RULES; printf ("SWITCH_TO RULES\n"); break; case (DATA) : // EXEC_RUN_TO_STOP status = DATA; printf ("SWITCH_TO DATA\n"); break; default : ; } //q gtk_window_present (GTK_WINDOW (main_window)); } /* 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 status = EXEC_STOP; // int get_status () {return status;} 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_status (int prescribed) { status = prescribed; if (0) printf ("status = %d\n", status); switch (status) { case (0) : // EXEC_STOP DATA_ANALYSIS status = 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 status = EXEC_STOP; break; case (2) : // EXEC_STOP_EDIT_STOP status = EXEC_RUN_EDIT_RULE; break; case (3) : // EXEC_RUN_EDIT_RULE status = EXEC_STOP_EDIT_RULE; break; case (4) : // EXEC_STOP_EDIT_MEASURE status = EXEC_RUN_EDIT_MEASURE; break; case (5) : // EXEC_RUN_EDIT_MEASURE status = 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 : ; } } */