From 635ff8f07632e313738e12f60c512e363a211106 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Mon, 19 Aug 2024 22:53:47 +0200 Subject: [PATCH] =?UTF-8?q?Il=20y=20a=20des=20pr=C3=A9f=C3=A9rences=20qui?= =?UTF-8?q?=20sont=20des=20=C3=A9tats=20de=20la=20fsm...=20How=20to=20=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/fsm.h | 6 ++++++ include/prefer.h | 3 +++ src/fsm/dispatch.c | 12 ++++++++++++ src/fsm/measure.c | 23 +++++++++++++---------- src/fsm/result.c | 5 +++++ src/main.c | 15 +++++++++++---- src/prefer.c | 4 ++++ src/signal.c | 2 +- src/widget/dispatch.c | 14 ++++++++++++++ 9 files changed, 69 insertions(+), 15 deletions(-) diff --git a/include/fsm.h b/include/fsm.h index 1123396..019cb5e 100644 --- a/include/fsm.h +++ b/include/fsm.h @@ -30,6 +30,7 @@ #pragma once #include +#include /******************************************************************************/ @@ -46,7 +47,12 @@ enum fsm_choice_STORE_RESTORE_RESET { STORE, RESTORE, RESET }; // xor #define n_objects 32 // arbitrary too, #define n_situations 128 // and so on... +bool fsm_init (); +void fsm_measures_list_init (); +void fsm_results_list_init (); +void prefer_displayable_list_init (); +// TODO Eh oui ! Il y a des préférences qui sont des états de la fsm... How to ? int fsm_get_exec_edit (); int fsm_get_state_rules_data (); diff --git a/include/prefer.h b/include/prefer.h index c90f25e..918fbef 100644 --- a/include/prefer.h +++ b/include/prefer.h @@ -38,3 +38,6 @@ const char get_button_icon_name (int n); void fsm_reset_all_situations_transparencies_at_value (int value); // provisoire... void *fsm_add_displayable (char *displayable_name); + +void prefer_init (); + diff --git a/src/fsm/dispatch.c b/src/fsm/dispatch.c index 9d6d35d..8d181eb 100644 --- a/src/fsm/dispatch.c +++ b/src/fsm/dispatch.c @@ -59,6 +59,18 @@ /******************************************************************************/ +/******************************************************************************/ +/* F S M I N I T */ +/******************************************************************************/ + +bool fsm_init () +{ + fsm_measures_list_init (); + fsm_results_list_init (); +// prefer_displayable_list_init (); <> see prefer_init () + return TRUE; +} + /******************************************************************************/ /* S T A T E S */ diff --git a/src/fsm/measure.c b/src/fsm/measure.c index 66ba10f..f18a5fb 100644 --- a/src/fsm/measure.c +++ b/src/fsm/measure.c @@ -28,12 +28,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include - #include "../../include/fsm.h" -#include "../../include/prefer.h" -#include "../../include/widget.h" -#include "../../include/fsm.h" - /******************************************************************************/ /* */ @@ -76,8 +71,9 @@ // When a list of measurements is established, it is possible to evaluate // if the results of a measurement are correlated with some other results. +// https://fr.wikibooks.org/wiki/Structures_de_donn%C3%A9es_en_C/Les_listes_simples -// structure de données : tableau ? Si oui, chaque "item" comprtera : +// structure de données : chaque "item" comportera : // - identifiant (clé) (+/- pointeur vers : date de création, auteur,...) @@ -98,11 +94,18 @@ // - pointeur vers des données, des représentations de données ? -static void *list_measures; +void *fsm_add_measure (char *measure_name) {fsm_debug (2, 0, measure_name, 2); return NULL;} -void *fsm_add_measure (char *measure_name) +//static void *list_measures; +typedef struct s_List List; +struct s_List { - fsm_debug (2, 0, measure_name, 2); - return NULL; + List *next; /* pointeur sur le reste de la liste */ + void *data; /* pointeur sur une donnée générique */ +}; + +void fsm_measures_list_init () +{ + fsm_debug (0,0, "fsm_measures_list_init()", 2); // sub_automaton 2 } diff --git a/src/fsm/result.c b/src/fsm/result.c index 034d621..b9dbda4 100644 --- a/src/fsm/result.c +++ b/src/fsm/result.c @@ -74,3 +74,8 @@ void *fsm_add_result (char *result_name) return NULL; } +void fsm_results_list_init () +{ + fsm_debug (0,0, "fsm_results_list_init()", 2); // sub_automaton 2 +} + diff --git a/src/main.c b/src/main.c index 6f9a9fc..01f87a8 100644 --- a/src/main.c +++ b/src/main.c @@ -45,7 +45,7 @@ * model_get_dim_value() * * Le fichier 'state.c' est devenu un dossier contenant - * les fichiers 'top.c', 'middle.c', 'bottom.c' et 'distrib.c' + * les fichiers 'top.c', 'middle.c', 'bottom.c' et 'distrib.c' (2024-08) * * 'middle.c' deviendra, s'il est trop volumineux, un dossier 'middle' * contenant, par exemple, les fichiers 'camera.c' ou 'contrasts.c' et d'autres @@ -92,7 +92,8 @@ * 2) Les structures transversales. * -------------------------------- * - * Les fonctions 'transversales' comme celles de 'graphics', 'parse', 'fsm', 'prefer' + * Les fonctions 'transversales' comme celles de 'graphics', 'parse', 'fsm', 'prefer', + * et peut-être des structures communes à tous les arbres, listes, etc. * doivent pouvoir être accédées directement * sans avoir à passer par la hiérarchie des widgets et/ou callbacks. * Elles restent à la racine: 'src/ @@ -132,16 +133,18 @@ * ******************************************************************************* * L I S T E D E S F O N C T I O N S A P P E L É E S * - * ***************************************************************************** + ******************************************************************************* * ******************************************************************************* * L I S T E D E S A P P E L S D E F O N C T I O N S * - * ***************************************************************************** + ******************************************************************************* */ #include "../include/widget.h" #include "../include/signal.h" +#include "../include/prefer.h" +#include "../include/fsm.h" int main (int argc, char **argv) @@ -151,7 +154,11 @@ int main (int argc, char **argv) app = gtk_application_new ("org.gem-graph", G_APPLICATION_DEFAULT_FLAGS); + fsm_init (); // fsm = finite state machine (see src/fsm/dispatch) + prefer_init (); // preferences (see src/prefer/dispatch) + g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL); + // on_windows_activation <> is in src/widget/dispatch status = g_application_run (G_APPLICATION (app), argc, argv); g_object_unref (app); diff --git a/src/prefer.c b/src/prefer.c index 55096a9..506a926 100644 --- a/src/prefer.c +++ b/src/prefer.c @@ -124,3 +124,7 @@ void *fsm_add_displayable (char *displayable_name) printf("fsm_add_displayable %p <<< %s (see prefer.c)\n", list_displayables, displayable_name); return NULL; } + + +void prefer_init () {prefer_displayable_list_init ();} +void prefer_displayable_list_init () { printf("prefer <> prefer_displayable_list_init()\n");} diff --git a/src/signal.c b/src/signal.c index ff710ff..9462a52 100644 --- a/src/signal.c +++ b/src/signal.c @@ -350,7 +350,7 @@ void on_resetting_XYZ_in_state_page () widget_state_XYZ_reset_all(); } -// -------------------------- S IT U A T I O N S ------------------------ // +// -------------------------- S I T U A T I O N S ----------------------- // void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar) { diff --git a/src/widget/dispatch.c b/src/widget/dispatch.c index cdd3529..ef4ea64 100644 --- a/src/widget/dispatch.c +++ b/src/widget/dispatch.c @@ -32,6 +32,20 @@ #include "../../include/widget.h" +/******************************************************************************/ +/* */ +/* # # ### ##### ###### ######## ######## */ +/* # # # # ## ## ## # # */ +/* # # # # ## ## # # */ +/* # # # # ## ## #### # */ +/* # # # # # # # # # */ +/* # # # # # # ## ## #### # # */ +/* ## ## # # ## ## ## # # */ +/* ## ## ### ###### ####### ######## # */ +/* */ +/******************************************************************************/ + + /******************************************************************************/ /* W I N D O W S */ /******************************************************************************/