diff --git a/include/fsm.h b/include/fsm.h index 3a7f02b..c0a6afd 100644 --- a/include/fsm.h +++ b/include/fsm.h @@ -54,9 +54,8 @@ typedef struct disp_list {int value; struct disp_list *suiv;} disp_list ; typedef struct journal {int value; struct journal *prev;} journal; // ref: sudo cat /var/log/messages -GtkApplication *fsf_get_app(); // def: main call: fsm/engine/engine; - -void fsm_init(bool mode_console); // def: fsm/dispatch; call: main; +void fsm_init(); // def: fsm/dispatch; call: main; +void fsm_engine_init(); // def: fsm/engine/engine; call main void fsm_preferences_init(); // def: fsm/prefer; call: fsm/dispatch; void fsm_measures_list_init(); // def: fsm/measure/manage.c; call: fsm/dispatch; void fsm_results_list_init(); // def: fsm/results; call: fsm/dispatch; diff --git a/src/fsm/dispatch.c b/src/fsm/dispatch.c index 11e1710..888f4d3 100644 --- a/src/fsm/dispatch.c +++ b/src/fsm/dispatch.c @@ -58,18 +58,12 @@ /* F S M I N I T */ /******************************************************************************/ -void fsm_init(bool mode_console) +void fsm_init() { - if (mode_console) fsm_engine_init(); // pour avancer, en attendant... 😇️ - else { fsm_measures_list_init(); fsm_results_list_init(); fsm_displayable_list_init(); fsm_preferences_init(); - printf("exemple de format de journal : 2024-08-31 [%s()] %s\ - < NB ce printf() se trouve dans 'fsm/dispatch.c'\n", __func__, "message"); // logging TODO TODO - // un exemple : $ sudo cat /var/log/messages - } } diff --git a/src/fsm/engine/engine.c b/src/fsm/engine/engine.c index 283bea9..08a70e7 100644 --- a/src/fsm/engine/engine.c +++ b/src/fsm/engine/engine.c @@ -28,7 +28,6 @@ #include #include #include "../../../include/fsm.h" -#include "../../../include/widget.h" /******************************************************************************/ @@ -52,6 +51,8 @@ static void fsm_strange_engine() (int)(milliseconds / 1000), /* secs (Must be Non-Negative) */ (milliseconds % 1000) * 1000000 /* nano (Must be in range of 0 to 999999999) */ }; + printf("fsm mode_console 😇️ (see@ 'src/engine/engine.c\n"); + int stop = 0; while (! stop) { printf(" | M . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); @@ -88,9 +89,9 @@ static void fsm_strange_engine() printf(" | W =-- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); printf(" | M=- . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); printf(" | W- . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem); - if (getchar() == '\n') stop = 1; + stop = (getchar() == '\n'); } -// if (stop) g_object_unref (fsf_get_app()); // widget_design_main_window (NULL); // widget_get_main_window()); + printf("\x1b[1Fsrc/fsm/engine.c | src/fsm/engine.c fsm_strange_engine stopped\n"); } diff --git a/src/main.c b/src/main.c index ad5fb46..820d020 100644 --- a/src/main.c +++ b/src/main.c @@ -133,20 +133,17 @@ #include "../include/signal.h" #include "../include/fsm.h" -GtkApplication *app; -GtkApplication *fsf_get_app() {return app;} - int main (int argc, char **argv) { int status; - app = gtk_application_new ("org.gem-graph", G_APPLICATION_DEFAULT_FLAGS); + GtkApplication *app = gtk_application_new ("org.gem-graph", G_APPLICATION_DEFAULT_FLAGS); - bool mode_console = FALSE; // TRUE FALSE - fsm_init (mode_console); // fsm = finite state machine (see : src/fsm/dispatch.c) + fsm_engine_init(); // def: fsm/engine/engine; + fsm_init (); // fsm = finite state machine (see : src/fsm/dispatch.c) g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL); - // on_windows_activation <> see : src/widget/dispatch.c + // on_windows_activation <> see: src/widget/dispatch.c (NOT src/signal.c) status = g_application_run (G_APPLICATION (app), argc, argv); g_object_unref (app); diff --git a/src/widget/dispatch.c b/src/widget/dispatch.c index 5c27d0a..3156dfd 100644 --- a/src/widget/dispatch.c +++ b/src/widget/dispatch.c @@ -66,20 +66,7 @@ void on_windows_activation (GtkApplication *app) dialog_window = GTK_WINDOW (gtk_application_window_new (app)); text_window = GTK_WINDOW (gtk_application_window_new (app)); -//-----------------------------------------------------------------------------------// -//-----------------------------------------------------------------------------------// - printf("mode_console 😇️\ - (see@ 'src/widget/dispatch.c on_windows_activation() < POUR RÉACTIVER GTK4)\n"); - -// S I P A S M O D E - C O N S O L E widget_design_main_window (main_window); // def: widget/topbar/dispatch -// S I P A S M O D E - C O N S O L E - - fsm_engine_init(); -//-----------------------------------------------------------------------------------// -//-----------------------------------------------------------------------------------// - - widget_design_dialog_window (main_window, dialog_window); widget_design_text_window (main_window, text_window); } diff --git a/src/widget/results/dispatch.c b/src/widget/results/dispatch.c index 5b9340e..2a90e53 100644 --- a/src/widget/results/dispatch.c +++ b/src/widget/results/dispatch.c @@ -45,6 +45,11 @@ void *widget_get_data_page() gtk_paned_set_shrink_start_child (GTK_PANED (measures_and_results), FALSE); gtk_paned_set_shrink_end_child (GTK_PANED (measures_and_results), FALSE); + if (0) printf("exemple de format de journal : 2024-08-31 [%s()] %s\ + < NB ce printf() se trouve dans 'widget/results/dispatch.c'\n", + __func__, "message"); // logging TODO TODO + // un exemple : $ sudo cat /var/log/messages + return measures_and_results; }