WIP: reprise de l'automate : états d'abord (using printf() only) - window design ensuite
This commit is contained in:
parent
e6871816a4
commit
aa3c7bcc82
36
automaton.c
36
automaton.c
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
/* (exec / edit) < MODE
|
/* (exec / edit) < MODE
|
||||||
* X
|
* X
|
||||||
* (state / rules / data) < STATUS
|
* (state / rules / data) < VIEW
|
||||||
* X
|
* X
|
||||||
* (measure / analyse / interpret)
|
* (measure / analyse / interpret)
|
||||||
* X
|
* X
|
||||||
|
@ -21,9 +21,9 @@ static int mode = RUN;
|
||||||
void set_mode (int prescribed) {mode = prescribed;}
|
void set_mode (int prescribed) {mode = prescribed;}
|
||||||
int get_mode () {return mode;}
|
int get_mode () {return mode;}
|
||||||
|
|
||||||
static int status = INTER; // int get_status () {return status;}
|
static int view = INTER; // int get_view () {return view;}
|
||||||
void set_status (int prescribed) {status = prescribed;}
|
void set_view (int prescribed) {view = prescribed;}
|
||||||
int get_status () {return status;}
|
int get_view () {return view;}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -33,16 +33,16 @@ int get_status () {return status;}
|
||||||
void SWITCH_TO (int asked) {
|
void SWITCH_TO (int asked) {
|
||||||
switch (asked) {
|
switch (asked) {
|
||||||
case (INTER) :
|
case (INTER) :
|
||||||
status = INTER; printf ("SWITCH_TO INTER\n");
|
view = INTER; printf ("SWITCH_TO INTER\n");
|
||||||
break;
|
break;
|
||||||
case (STATE) : // BEGIN_TO_EXEC_STOP
|
case (STATE) : // BEGIN_TO_EXEC_STOP
|
||||||
status = STATE; printf ("SWITCH_TO STATE\n");
|
view = STATE; printf ("SWITCH_TO STATE\n");
|
||||||
break;
|
break;
|
||||||
case (RULES) : // EXEC_STOP_TO_RUN
|
case (RULES) : // EXEC_STOP_TO_RUN
|
||||||
status = RULES; printf ("SWITCH_TO RULES\n");
|
view = RULES; printf ("SWITCH_TO RULES\n");
|
||||||
break;
|
break;
|
||||||
case (DATA) : // EXEC_RUN_TO_STOP
|
case (DATA) : // EXEC_RUN_TO_STOP
|
||||||
status = DATA; printf ("SWITCH_TO DATA\n");
|
view = DATA; printf ("SWITCH_TO DATA\n");
|
||||||
break;
|
break;
|
||||||
default : ;
|
default : ;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ enum { // S T A T E S
|
||||||
CONFIGURE
|
CONFIGURE
|
||||||
};
|
};
|
||||||
|
|
||||||
static int status = EXEC_STOP; // int get_status () {return status;}
|
static int view = EXEC_STOP; // int get_view () {return view;}
|
||||||
|
|
||||||
enum { // T R A N S I T I O N S
|
enum { // T R A N S I T I O N S
|
||||||
BEGIN_TO_EXEC_STOP
|
BEGIN_TO_EXEC_STOP
|
||||||
|
@ -86,29 +86,29 @@ enum { // T R A N S I T I O N S
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void set_status (int prescribed) {
|
void set_view (int prescribed) {
|
||||||
status = prescribed; if (0) printf ("status = %d\n", status);
|
view = prescribed; if (0) printf ("view = %d\n", view);
|
||||||
|
|
||||||
switch (status) {
|
switch (view) {
|
||||||
case (0) : // EXEC_STOP DATA_ANALYSIS
|
case (0) : // EXEC_STOP DATA_ANALYSIS
|
||||||
status = EXEC_RUN;
|
view = EXEC_RUN;
|
||||||
break;
|
break;
|
||||||
case (1) : // EXEC_RUN
|
case (1) : // EXEC_RUN
|
||||||
// Ici, il faudra prévenir l'utilisateur par une pop-up window : (sauvegarde automatique sinon)
|
// 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
|
// S'il ne prend pas la main, les données de la simulation en cours risquent d'être perdues
|
||||||
status = EXEC_STOP;
|
view = EXEC_STOP;
|
||||||
break;
|
break;
|
||||||
case (2) : // EXEC_STOP_EDIT_STOP
|
case (2) : // EXEC_STOP_EDIT_STOP
|
||||||
status = EXEC_RUN_EDIT_RULE;
|
view = EXEC_RUN_EDIT_RULE;
|
||||||
break;
|
break;
|
||||||
case (3) : // EXEC_RUN_EDIT_RULE
|
case (3) : // EXEC_RUN_EDIT_RULE
|
||||||
status = EXEC_STOP_EDIT_RULE;
|
view = EXEC_STOP_EDIT_RULE;
|
||||||
break;
|
break;
|
||||||
case (4) : // EXEC_STOP_EDIT_MEASURE
|
case (4) : // EXEC_STOP_EDIT_MEASURE
|
||||||
status = EXEC_RUN_EDIT_MEASURE;
|
view = EXEC_RUN_EDIT_MEASURE;
|
||||||
break;
|
break;
|
||||||
case (5) : // EXEC_RUN_EDIT_MEASURE
|
case (5) : // EXEC_RUN_EDIT_MEASURE
|
||||||
status = EXEC_STOP_EDIT_MEASURE;
|
view = EXEC_STOP_EDIT_MEASURE;
|
||||||
break;
|
break;
|
||||||
case (6) : // EDIT_STATE
|
case (6) : // EDIT_STATE
|
||||||
break;
|
break;
|
||||||
|
|
20
automaton.h
20
automaton.h
|
@ -1,13 +1,27 @@
|
||||||
#include <gtk-4.0/gtk/gtk.h>
|
#include <gtk-4.0/gtk/gtk.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
void set_status (int prescribed);
|
/******************************************************************************/
|
||||||
int get_status ();
|
/* S T A T E S */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/* (exec / edit) < MODE
|
||||||
|
* X
|
||||||
|
* (state / rules / data) < VIEW
|
||||||
|
* X
|
||||||
|
* (measure / analyse / interpret) < DATA
|
||||||
|
* X
|
||||||
|
* (read / write) < R__W
|
||||||
|
*/
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
void set_view (int prescribed);
|
||||||
|
int get_view ();
|
||||||
void set_mode (int prescribed);
|
void set_mode (int prescribed);
|
||||||
int get_mode ();
|
int get_mode ();
|
||||||
|
|
||||||
enum mode { RUN, EDIT };
|
enum mode { RUN, EDIT };
|
||||||
enum choice { INTER, STATE, RULES, DATA };
|
enum view { INTER, STATE, RULES, DATA };
|
||||||
// MEASURE, OBSERVE, INTERPRET, HELP, CONFIGURE };
|
// MEASURE, OBSERVE, INTERPRET, HELP, CONFIGURE };
|
||||||
|
|
||||||
void SWITCH_TO (int asked);
|
void SWITCH_TO (int asked);
|
||||||
|
|
|
@ -203,7 +203,7 @@ void window_header_bar (GtkWindow *window, char *title){
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_main_child (GtkWindow *main_window, int selected_page){
|
void window_main_child (GtkWindow *main_window, int selected_page){
|
||||||
// in automaton.h : enum { INTER, STATE, RULES, DATA }
|
/*
|
||||||
switch (selected_page) {
|
switch (selected_page) {
|
||||||
case (INTER) : //SWITCH_TO (INTER);
|
case (INTER) : //SWITCH_TO (INTER);
|
||||||
break;
|
break;
|
||||||
|
@ -231,6 +231,7 @@ void window_main_child (GtkWindow *main_window, int selected_page){
|
||||||
default : gtk_window_set_child (main_window, GTK_WIDGET (get_SPACE_VIEW_box())); // + un "help message"
|
default : gtk_window_set_child (main_window, GTK_WIDGET (get_SPACE_VIEW_box())); // + un "help message"
|
||||||
}
|
}
|
||||||
// printf ("%d\n", get_status());
|
// printf ("%d\n", get_status());
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void main_window_design (GtkWindow *main_window){
|
void main_window_design (GtkWindow *main_window){
|
||||||
|
|
Loading…
Reference in New Issue