From aa3c7bcc82671c32f66213d94feb6eb9eae5ccf2 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Sun, 16 Jun 2024 06:38:14 +0200 Subject: [PATCH] =?UTF-8?q?WIP:=20reprise=20de=20l'automate=20:=20=C3=A9ta?= =?UTF-8?q?ts=20d'abord=20(using=20printf()=20only)=20-=20window=20design?= =?UTF-8?q?=20ensuite?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- automaton.c | 36 ++++++++++++++++++------------------ automaton.h | 20 +++++++++++++++++--- contain.c | 3 ++- 3 files changed, 37 insertions(+), 22 deletions(-) diff --git a/automaton.c b/automaton.c index 8893837..cc08492 100644 --- a/automaton.c +++ b/automaton.c @@ -10,7 +10,7 @@ /* (exec / edit) < MODE * X - * (state / rules / data) < STATUS + * (state / rules / data) < VIEW * X * (measure / analyse / interpret) * X @@ -21,9 +21,9 @@ 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;} +static int view = INTER; // int get_view () {return view;} +void set_view (int prescribed) {view = prescribed;} +int get_view () {return view;} /******************************************************************************/ @@ -33,16 +33,16 @@ int get_status () {return status;} void SWITCH_TO (int asked) { switch (asked) { case (INTER) : - status = INTER; printf ("SWITCH_TO INTER\n"); + view = INTER; printf ("SWITCH_TO INTER\n"); break; case (STATE) : // BEGIN_TO_EXEC_STOP - status = STATE; printf ("SWITCH_TO STATE\n"); + view = STATE; printf ("SWITCH_TO STATE\n"); break; case (RULES) : // EXEC_STOP_TO_RUN - status = RULES; printf ("SWITCH_TO RULES\n"); + view = RULES; printf ("SWITCH_TO RULES\n"); break; case (DATA) : // EXEC_RUN_TO_STOP - status = DATA; printf ("SWITCH_TO DATA\n"); + view = DATA; printf ("SWITCH_TO DATA\n"); break; default : ; } @@ -73,7 +73,7 @@ enum { // S T A T E S 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 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) { - status = prescribed; if (0) printf ("status = %d\n", status); +void set_view (int prescribed) { + view = prescribed; if (0) printf ("view = %d\n", view); - switch (status) { + switch (view) { case (0) : // EXEC_STOP DATA_ANALYSIS - status = EXEC_RUN; + 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 - status = EXEC_STOP; + view = EXEC_STOP; break; case (2) : // EXEC_STOP_EDIT_STOP - status = EXEC_RUN_EDIT_RULE; + view = EXEC_RUN_EDIT_RULE; break; case (3) : // EXEC_RUN_EDIT_RULE - status = EXEC_STOP_EDIT_RULE; + view = EXEC_STOP_EDIT_RULE; break; case (4) : // EXEC_STOP_EDIT_MEASURE - status = EXEC_RUN_EDIT_MEASURE; + view = EXEC_RUN_EDIT_MEASURE; break; case (5) : // EXEC_RUN_EDIT_MEASURE - status = EXEC_STOP_EDIT_MEASURE; + view = EXEC_STOP_EDIT_MEASURE; break; case (6) : // EDIT_STATE break; diff --git a/automaton.h b/automaton.h index da12b02..c7a9755 100644 --- a/automaton.h +++ b/automaton.h @@ -1,13 +1,27 @@ #include #include -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); int get_mode (); enum mode { RUN, EDIT }; -enum choice { INTER, STATE, RULES, DATA }; +enum view { INTER, STATE, RULES, DATA }; // MEASURE, OBSERVE, INTERPRET, HELP, CONFIGURE }; void SWITCH_TO (int asked); diff --git a/contain.c b/contain.c index 61098dc..85a55fa 100644 --- a/contain.c +++ b/contain.c @@ -203,7 +203,7 @@ void window_header_bar (GtkWindow *window, char *title){ } void window_main_child (GtkWindow *main_window, int selected_page){ -// in automaton.h : enum { INTER, STATE, RULES, DATA } +/* switch (selected_page) { case (INTER) : //SWITCH_TO (INTER); 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" } // printf ("%d\n", get_status()); +*/ } void main_window_design (GtkWindow *main_window){