diff --git a/Makefile b/Makefile index c5718c8..b21ecd6 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: run clean install all docs man +.PHONY: run clean install all docs man my # A phony target is not a file name .DELETE_ON_ERROR: $(BINDIR)/Getting_Started_with_GTK .DEFAULT_GOAL: all @@ -14,6 +14,10 @@ WARNINGS = -Wall DEBUG = -ggdb -fno-omit-frame-pointer \ -fdiagnostics-color=always \ -fsanitize=address,undefined -fstack-protector-strong +# -fsanitize=leak # << même sortie console que: -fsanitize=address +# -fsanitize=address -fstack-protector-strong +# -fsanitize=memory +# -fuse-ld=gold OPTIMIZE = -O3 BINDIR=bin diff --git a/docs/icons ressources b/docs/icons ressources new file mode 100644 index 0000000..e2401f4 --- /dev/null +++ b/docs/icons ressources @@ -0,0 +1,7 @@ +https://tabler.io/icons << + +design minimaliste +licence MIT +format SVG + +Jonathan Sahm CTO - Software architect \ No newline at end of file diff --git a/include/fsm.h b/include/fsm.h index b7e15fc..78d5137 100644 --- a/include/fsm.h +++ b/include/fsm.h @@ -251,3 +251,15 @@ void fsm_relay_close_log(); void fsm_init(); void fsm_close(); + + +//----------------------------------------------------------------------------- + +/** phantom documentation */ +typedef struct fsm_struct_list_tool { + int value; /**< *value phantom documentation */ + struct fsm_struct_list_tool *suiv; /**< *suiv phantom documentation */ +} fsm_struct_list_tool ; + + + diff --git a/src/fsm/control.c b/src/fsm/control.c index a7fd189..6aa2c40 100644 --- a/src/fsm/control.c +++ b/src/fsm/control.c @@ -80,6 +80,9 @@ */ static void fsm_structures_init() { + + fsm_tools_list_test(); + /**< will be introduced later on: fsm_add_log (info, FSM, "fsm/dispatch", "measures list init()", diff --git a/src/fsm/measures/data.c b/src/fsm/measures/data.c new file mode 100644 index 0000000..42c6131 --- /dev/null +++ b/src/fsm/measures/data.c @@ -0,0 +1,66 @@ +/** + * @file + * a list of available measurements, including those currently in use + * + * This file is part of Gem-graph. The operations that can be performed on the + * measurements include: select, copy, edit, erase, parameter + * (frequency, variable, etc.) + * + * @see http://www.gnuplot.info/ + * @see https://fr.wikipedia.org/wiki/Gnuplot + * @see https://fr.wikibooks.org/wiki/Mathc_gnuplot + * + * @see : fsm/measure/manage.c + * + * @cond LICENSE + * Copyright © 2021 Libre en Communs + * Copyright © 2021-2024 Adrien Bourmault + * Copyright © 2021-2024 Jean Sirmai + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU Affero General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more + * details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * @endcond + */ + +#include +#include +#include +#include +#include "../../../include/fsm.h" + +/** + * phantom documentation + * + * @param d + * @param *p_data + * @param *p_target + */ +void fsm_add_data (fsm_struct_list_data d, int *p_data, int *p_target) {} + +/** + * phantom documentation + * + * @param d + * @param from + * @param to + */ +int fsm_get_data (fsm_struct_list_data d, int from, int to) {return 0;} + +/** + * phantom documentation + * + * @param d + * @param *p_data + */ +void fsm_remove_data (fsm_struct_list_data d, int *p_data) {} + diff --git a/src/fsm/measures/tools.c b/src/fsm/measures/tools.c new file mode 100644 index 0000000..8ad4ac2 --- /dev/null +++ b/src/fsm/measures/tools.c @@ -0,0 +1,209 @@ +/** + * @file + * fsm measures lists tools (basic functions). + * + * This file is part of Gem-graph. + * + * @cond LICENSE + * Copyright © 2021 Libre en Communs + * Copyright © 2021-2024 Adrien Bourmault + * Copyright © 2021-2024 Jean Sirmai + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU Affero General Public License as published by the Free + * Software Foundation, either version 3 of the License, or (at your option) any + * later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more + * details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * @endcond + */ + +#include +#include +#include +#include "../../../include/fsm.h" + + +/******************************************************************************/ +/* An editable list of measurements is defined and maintained here */ +/* (see : fsm/measure/manage.c) */ +/* - - - */ +/* Each possible measurement can be activated or silenced */ +/* - - - */ +/* The measures relate to */ +/* - the number of occurrences of a rule or group of rules, */ +/* - the number of objects or situations before/after the rule was applied, */ +/* - the time (date) of the event, */ +/* - the time elapsed between two events, */ +/* - the occurrence of events C between events A and B, */ +/* NB This list is non limitative. ex : pattern recognition tools */ +/******************************************************************************/ + + +//------------------------------------------------------------------------------ +// structure de données : chaque "item" doit comporter : +// +// - identifiant (clé) (+/- pointeur vers : date de création, auteur,...) +// +// - type de mesure +// les 6 items suivants peuvent documenter l'ensemble de toutes les valeurs +// à recueillir pour documenter tous les types de mesure possibles; +// tous ces items ne doivent pas être simultanément complétés +// mais, si un tableau etait utilisé, il y aurait peu de place perdue; +// +// - pointeur vers le premier groupe de règles (une au moins) +// - pointeur vers un second groupe de règles (une au moins) +// - pointeur vers des objets ou situations (un au moins) +// - pointeur vers un ensemble d'évènements intercurrents +// - date de l'évènement +// - durée entre deux évènements +// +// - mesure active ? + / - +// - pointeur vers une liste de mesures similaires +// - pointeur vers des données, des représentations de données ? +//------------------------------------------------------------------------------ + + +/** + * @param **ml + * @param value + * + * @callergraph + * @see fsm_tools_list_test() + */ +void fsm_tools_list_insert (fsm_struct_list_tool **ml, int value) +{ + fsm_struct_list_tool *tmp = NULL; + fsm_struct_list_tool *cml = *ml; + fsm_struct_list_tool *elem = malloc (sizeof (fsm_struct_list_tool)); + if (!elem) exit (EXIT_FAILURE); + elem->value = value; + while (cml && cml->value < value) + { + tmp = cml; + cml = cml->suiv; + } + elem->suiv = cml; + if (tmp) tmp->suiv = elem; + else *ml = elem; +} + +/** + * @param **ml + * + * @callergraph + * @see fsm_tools_list_test() + */ +int fsm_tools_list_pop (fsm_struct_list_tool **ml) +{ + int value; + fsm_struct_list_tool *tmp; + if (! *ml) return -1; + tmp = (*ml)->suiv; + value = (*ml)->value; + free (*ml); + *ml = tmp; + return value; +} + +/** + * @param **ml + * + * @callergraph + * @see fsm_tools_list_test() + */ +int fsm_tools_list_length (fsm_struct_list_tool *ml) +{ + int n = 0; + while (ml) + { + n++; + ml = ml->suiv; + } + return n; +} + +/** + * @param **ml + * + * @callergraph + * @see fsm_tools_list_test() + */ +void fsm_tools_list_clear (fsm_struct_list_tool **ml) +{ + fsm_struct_list_tool *tmp; + while (*ml) + { + tmp = (*ml)->suiv; + free (*ml); + *ml = tmp; + } +} + +/** + * @param **ml + * + * @callergraph + * @see fsm_tools_list_test() + */ +void fsm_tools_list_view (fsm_struct_list_tool *ml) +{ + printf ("-------- view measures list (n = %d)\n", + fsm_tools_list_length (ml)); + while(ml) + { + printf("%d\n", ml->value); + ml = ml->suiv; + } + puts ("--------------"); +} + + + +//------------------------------------------------------------------------------ + +/** + * @callergraph + * @see fsm_list_init_measures()() + * + * @callgraph + * @see fsm_add_log() + * @see fsm_tools_list_insert() + * @see fsm_tools_list_pop() + * @see fsm_tools_list_view() + * @see fsm_tools_list_clear() + */ +void fsm_tools_list_test() +{ + fsm_struct_list_tool *ex_tool = NULL; + + FSM_ADD_LOG (INFO, "création d'une liste de 6 elements:"); + fsm_tools_list_insert (&ex_tool,-3); + fsm_tools_list_insert (&ex_tool,5); + fsm_tools_list_insert (&ex_tool,-1); + fsm_tools_list_insert (&ex_tool,4); + fsm_tools_list_insert (&ex_tool,2); + fsm_tools_list_insert (&ex_tool,0); + fsm_tools_list_view (ex_tool); + + FSM_ADD_LOG (INFO, "retrait des 2 premiers elements:"); + fsm_tools_list_pop (&ex_tool); + fsm_tools_list_pop (&ex_tool); + + FSM_ADD_LOG (INFO, "ajout des 2 elements (3, 1):"); + fsm_tools_list_insert (&ex_tool, 3); + fsm_tools_list_insert (&ex_tool, 1); + fsm_tools_list_view (ex_tool); + + fsm_tools_list_clear (&ex_tool); + // char string_value [10]; if one wants to check the list length: 0 + // sprintf(string_value, " (%d)", fsm_tools_list_length (ex_tool)); + FSM_ADD_LOG (INFO, "clear() > 0 élément restant"); +} + diff --git a/src/main.c b/src/main.c index 46e0359..23aa4d0 100644 --- a/src/main.c +++ b/src/main.c @@ -83,5 +83,8 @@ int main (int argc, char **argv) fsm_close(); +// g_object_unref (app); <<< GLib-GObject-CRITICAL **: 07:55:38.063: g_object_unref: assertion 'G_IS_OBJECT (object)' failed + return status; } +