Compare commits

..

30 Commits

Author SHA1 Message Date
Jean Sirmai 07cbfe9fcb
introduction of the fsm journal 2024-08-29 08:21:22 +02:00
Jean Sirmai 6877d4fea2
in fsm/measure creation of : manage.c, tool_list.c, flow_list.c et disp_list.c 2024-08-28 16:52:16 +02:00
Jean Sirmai 571e247fd8
measures list pourrait être une liste simple triée 2024-08-28 06:19:06 +02:00
Jean Sirmai 9e0ef7d28f
création de measure/list.c et de measure/manage.c (+ struct m_pile in fsm.h) 2024-08-27 15:07:16 +02:00
Jean Sirmai d2af43dcc9
struct pile // 1er essai : measures (2024-08-26) < générique == compliqué Comment faire ? 2024-08-26 22:11:51 +02:00
Jean Sirmai 432a0202a2
sorted list added <> OK 2024-08-26 16:03:07 +02:00
Jean Sirmai eb3bb2dc24
cleaning pile & list 2024-08-26 07:26:53 +02:00
Jean Sirmai e5d1c124e6
Copyright © 2016 CGi. Aucune reproduction, même partielle,... > Je vais demander l'autorisation. 2024-08-25 22:03:16 +02:00
Jean Sirmai b64df19b3b
double chained list ^c^v success from https://chgi.developpez.com/liste/ 2024-08-25 11:35:43 +02:00
Jean Sirmai 6545c587d2
WIP: cleaning names in util.h ! WARNING ! GRAPHICS #include ../../util.h modified 2024-08-24 15:26:56 +02:00
Jean Sirmai 961e470c2c
Introduction de src/util/io.c où est déplacée: 'char *read_file(char *filename)' < OK 2024-08-24 15:01:32 +02:00
Jean Sirmai 07bafc912a
introduction de src/util/... (util ? use ?...) 2024-08-24 10:52:28 +02:00
Jean Sirmai 085b165a6a
https://chgi.developpez.com/liste/ < ^c^v > OK 2024-08-23 23:30:39 +02:00
Jean Sirmai 85754fc91c
cleaning + a widget intended to modulate the intensities of the various represented flows 2024-08-22 22:01:33 +02:00
Jean Sirmai 61fb16da52
cleaning / adding a scroll bar allowing to detail the data along the time elapsed during the simulation in results 2024-08-22 00:53:23 +02:00
Jean Sirmai 2da17cc549
comments (fsm.f) & https://learntutorials.net/fr/c/topic/560/listes-liees < ^c^v > fsm/measure.c 2024-08-21 23:19:27 +02:00
Jean Sirmai 3d71b6e9c1
cleaning & simplifying 2024-08-20 09:50:20 +02:00
Jean Sirmai 0d7f90cf18
prefer.c devient un fichier de src/fsm/ et include/prefer.h disparait 2024-08-20 09:32:20 +02:00
Jean Sirmai 635ff8f076
Il y a des préférences qui sont des états de la fsm... How to ? 2024-08-19 22:53:47 +02:00
Jean Sirmai 2d269755f1
WIP: linking fsm/measure.c fsm_add() to the debug function in fsm/dispatch 2024-08-19 20:00:06 +02:00
Jean Sirmai 4297242f16
WIP: cleaning (micro-commit) 2024-08-19 16:46:25 +02:00
Jean Sirmai 3d2f7db7a6
creation of dir : src/fsm that contains : dispatch.c measure.c result.c 2024-08-19 16:23:10 +02:00
Jean Sirmai 0d95832c96
WIP: cleaning (micro-commit) 2024-08-19 16:09:31 +02:00
Jean Sirmai 06b57458c6
displayed results list should be defined and maintained in prefer.c 2024-08-18 22:16:46 +02:00
Jean Sirmai 154e2ad57b
measurements and results lists should be defined and maintained in fsm.c 2024-08-18 12:32:21 +02:00
Jean Sirmai 4c4df5f3ec
WIP: results II bis 2024-08-17 20:32:20 +02:00
Jean Sirmai d2f7ab8f44
WIP: results I 2024-08-09 15:28:52 +02:00
Jean Sirmai 055c510142
Starting reorganization of the results page. 2024-08-09 14:47:59 +02:00
Jean Sirmai d1621fb4be
cleaning results measures synth view 2024-08-09 11:33:44 +02:00
Jean Sirmai 20deb6a9eb
WIP: measures process XI 2024-08-09 09:21:04 +02:00
36 changed files with 1633 additions and 339 deletions

View File

@ -76,43 +76,3 @@ struct arrow_t { uint load; uint site; uint x; uint y; uint z; };
#define SOUTH 4 // + z blue
#define NORTH 5 // - z yellow
/******************************************************************************/
/* U T I L I T I E S */
/******************************************************************************/
/*
* char *read_file(char *filename)
* reads a file from filename into a provided buffer
*
* @param filename, file name
* contents, target ptr
*
* @return void
*/
static inline char *read_file(char *filename)
{
int fd;
int filesize;
char *contents;
fd = open(filename, O_RDONLY);
if (fd < 0) {
printf("Couldn't read file: %s\n",filename);
return NULL;
}
filesize = lseek(fd, 0, SEEK_END) + 1 ;
contents = g_malloc(filesize * sizeof(char));
assert (contents);
lseek(fd, 0, SEEK_SET);
read(fd,contents,filesize);
contents[filesize-1] = '\0';
close(fd);
return contents;
}

View File

@ -30,33 +30,81 @@
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <gtk-4.0/gtk/gtk.h>
/******************************************************************************/
/* S T A T E M A C H I N E */
/******************************************************************************/
// called by widgets through signal functions
enum fsm_choice_EXEC_EDIT { EXEC, EDIT }; // xor
enum fsm_choice_STATE_RULES_DATA { SYNTH, STATE, RULES, DATA }; // xor
enum fsm_choice_STORE_RESTORE_RESET { STORE, RESTORE, RESET }; // xor
enum fsm_select_EXEC_EDIT { EXEC, EDIT };
enum fsm_select_STATE_RULES_DATA { SYNTH, STATE, RULES, DATA };
enum fsm_select_STORE_RESTORE_RESET { STORE, RESTORE, RESET };
enum fsm_measure_type {DATE_RULE_EXEC, RULE_EXEC_NB, OBJECT_NB, ELAPSED_TIME };
#define n_rules 128 // arbitrary
#define n_objects 32 // arbitrary too,
#define n_situations 128 // and so on...
typedef struct tool_list {int value; struct tool_list *suiv;} tool_list ;
typedef struct flow_list {int value; struct flow_list *suiv;} flow_list ;
typedef struct disp_list {int value; struct disp_list *suiv;} disp_list ;
void fsm_init(); // def: fsm/dispatch; 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;
void fsm_displayable_list_init(); // def: fsm/prefer; call: fsm/dispatch;
int fsm_get_exec_edit(); // def: fsm/dispatch; call: signal;
// widget/state/dispatch;
// widget/rules/selected/dispatch;
int fsm_get_state_rules_data(); // def: fsm/dispatch; call: signal;
void fsm_set_exec_edit (int value);// def: fsm/dispatch; call: signal;
void fsm_set_state_rules_data (int value); // def: fsm/dispatch; call: signal;
void fsm_store_restore_reset (int choice, int value);// def: prefer; call: signal;
bool fsm_get_preferences_state(); // def: fsm/dispatch; call: - - -
void fsm_set_preferences_state (bool value); // def: fsm/dispatch; call: signal;
// fsm/prefer;
void fsm_add_measure (char *measure_name); // def: fsm/measure/manage.c;
// call: widget/measure/dispatch;
void fsm_add_result (char *result_name); // def: fsm/result; call: - - -
void fsm_add_displayable (char *displayable_name);// def: fsm/prefer; call: fsm/prefer;
void fsm_reset_all_situations_transparencies_at_value (int value); // provisoire...
// def: fsm/prefer; call: signal;
int fsm_get_exec_edit ();
int fsm_get_state_rules_data ();
int fsm_get_store_restore_reset ();
void fsm_msg (int choice, int value, char *string, int sub_automaton);
// def: fsm/dispatch; call: fsm/dispatch;
// fsm/measure;
// fsm/result;
void fsm_set_exec_edit (int value);
void fsm_set_state_rules_data (int value);
void fsm_set_store_restore_reset (int target, int value);
// --------------------------------------------------------------- WIP ------
// def: measure/tool_list call: measure/tool_list (about the following functions...)
void fsm_tools_sort_list_insert (tool_list **tl, int value);
int fsm_tools_sort_list_pop (tool_list **tl);
int fsm_tools_sort_list_length (tool_list *tl);
void fsm_tools_sort_list_clear (tool_list **tl);
void fsm_tools_sort_list_view (tool_list *tl);
void fsm_tools_sort_list_test(); // def: measure/manage; call: measure/manage;
// def: fsm/measure/manage/; call: rule exec
void fsm_rule_trig_measure (int rule_id, int object_id, int measure_id);
bool fsm_get_preferences_state ();
void fsm_set_preferences_state (bool value);
// --------------------------------------------------------------- WIP ------
typedef struct journal {int value; struct journal *prev;} journal; // structure d'un élément
int fsm_journal_push (journal **jj, int v_value);
int fsm_journal_pop (journal **jj);
void fsm_journal_clear (journal **jj);
int fsm_journal_length (journal *jj);
void fsm_journal_view (journal *jj);
void fsm_journal_seek (journal *jj, int v_value);

View File

@ -156,6 +156,8 @@ void on_measure_third_event_occurences_in_between (GtkWidget *btt, gpointer data
// correlate ?
void on_select_a_second_measurement (GtkWidget *btt, gpointer data);
void on_not_yet_defined (GtkWidget *btt, gpointer data);
void on_skip_this_step (GtkWidget *btt, gpointer data);
void on_something_else (GtkWidget *btt, gpointer data);
void on_closing_page (GtkWidget *btt, gpointer data);

90
include/util.h Normal file
View File

@ -0,0 +1,90 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* Finite State Machine (fsm) header *
* *
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
* *
* This file is part of Gem-graph. *
* *
* 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 <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <gtk-4.0/gtk/gtk.h>
#include "../include/fsm.h"
char *util_read_file (char *filename);
//------------------------------------------------------------------------------
// https://chgi.developpez.com/liste/ < ^c^v
// Copyright © 2016 CGi.
// Aucune reproduction, même partielle, ne peut être faite de ce site
// ni de l'ensemble de son contenu : textes, documents, images, etc.
// sans l'autorisation expresse de l'auteur.
// Sinon vous encourez selon la loi jusqu'à trois ans de prison
// et jusqu'à 300 000 € de dommages et intérêts.
// Le piratage est illégal,
// de même que sont interdits: cracks, warez, sérials (sauf évaluation), etc.
// Est bien sûr autorisé tout ce qui concerne les logiciels gratuits, freewares et évaluation.
//------------------------------------------------------------------------------
typedef struct pile {int value; struct pile *prev;} pile; // structure d'un élément
void util_pile_clear (pile **); // vide toute la pile
void util_pile_view (pile *); // affiche la pile en commençant par le sommet
int util_pile_push (pile **, int); // ajoute une valeur sur la pile
int util_pile_pop (pile **); // retire la dernière valeur empilée
int util_pile_length (pile *p); // renvoie le nombre d'éléments de la pile
//------------------------------------------------------------------------------
typedef struct elem {int value; struct elem *prev; struct elem *next;} elem;
typedef struct {elem *first; elem *last;} dblist; // structure d'accès à la liste
void util_list_2x2_init (dblist *l); // initialisation
void util_list_2x2_clear (dblist *l); // vide toute la liste
void util_list_2x2_view (dblist l); // affiche les valeurs de toute la liste
int util_list_2x2_push_back (dblist *l, int val); // ajoute une valeur en fin de liste
int util_list_2x2_push_front (dblist *l, int val); // ajoute une valeur en début de liste
int util_list_2x2_pop_back (dblist *l); // retire une valeur en fin de liste
int util_list_2x2_pop_front (dblist *l); // retire une valeur en début de liste
int util_list_2x2_length (dblist l); // renvoie le nombre d'éléments de la liste
//------------------------------------------------------------------------------
typedef struct slist {int value; struct slist *suiv;} slist ;
void util_sorted_list_clear (slist **sl); // vide toute la liste
void util_sorted_list_view (slist *sl); // affiche toute la liste
int util_sorted_list_insert (slist **sl, int val); // insertion d'un élément selon son rang
int util_sorted_list_pop (slist **sl); // retire la dernière valeur de la liste
int util_sorted_list_length (slist *sl); // renvoie le nombre d'éléments de la liste
//------------------------------------------------------------------------------
void util_trigger_test(); // def: util/tests.c calls: ...
void util_pile_test(); // called in fsm/measure.c
void util_double_list_test(); // " "
void util_sorted_list_test(); // " "

View File

@ -65,8 +65,9 @@ void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window
/******************************************************************************/
#define W_TREE 160
#define W_DO_UNDO_REDO_BOX 1300
#define W_XYZ_BOX 62
#define H_XYZ_BOX 200
#define H_E_COLI 790
#define H_E_COLI 760
#define H_OBJECTS_SITUATIONS 130
#define W_COMPARATOR 64
#define W_RULES_USE 90
@ -75,6 +76,7 @@ void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window
#define W_IMAGE_100 100
/******************************************************************************/
/* T O P B A R */
/******************************************************************************/
@ -116,6 +118,9 @@ void *widget_get_measure_page();// in : widget / measure / dispatch.c
// repartitions.c WIP
// correlations.c WIP
#define H_PARTITION_SYNTH 1600
#define W_PARTITION_SYNTH 400
void *widget_get_time_dependent_results_and_time_controls();
// *widget_get_space_vs_non_time_dependent_analysis(); WIP
// *widget_get_non_time_dependent_analysis_elements(); WIP
@ -128,8 +133,14 @@ void *widget_get_time_dependent_results_and_time_controls();
// defined in : widget / state / middle
// defined in : widget / state / bottom
void *widget_get_space_view(); // middle
void *widget_get_graph_view_control(); // middle
#define PARTITION_STATE_TOP 600
#define PARTITION_SPACE_VS_CONTROLS_1 920
#define PARTITION_SPACE_VS_CONTROLS_2 800
#define PARTITION_SPACE_VS_CAMERA_IN_STATE 1850
#define PARTITION_SPACE_VS_CAMERA_IN_SYNTH 1560
void *widget_get_space_view (int partition_space_vs_camera); // middle
void *widget_get_graph_view_control(); // middle
void *widget_get_space_edit_control(); // bottom
void *widget_get_sequence_control(); // bottom
@ -190,14 +201,15 @@ void *widget_get_selected_rule_images();
/******************************************************************************/
/* D A T A */
/******************************************************************************/
// called by : widget / data / dispatch / widget_get_data_page()
// defined in : widget / data / measures.c
// operations.c
// results.c
// called by : widget / results / dispatch / widget_get_data_page()
// defined in : widget / results / organize.c
// display.c
void *widget_get_measures_page();
void *widget_get_results_page();
void *widget_get_operations_on_results_page();
#define H_PARTITION_RESULTS 140
void *widget_get_organize_results_box();
void *widget_get_display_results_box();
void *widget_get_time_results_box ();
/******************************************************************************/
@ -253,16 +265,21 @@ void widget_let_us_create_a_complex_useless_and_expensive_tree (struct TreeNode_
// defined in : widget / measure / dispatch.c
void *widget_measure_new();
// La séquence logique à suivre pour créer une nouvelle mesure
void *widget_measure_do_select_rules_first();
void *widget_measure_do_depends_on_one_or_two_events();
void *widget_measure_do_depends_on_a_single_event();
void *widget_measure_do_depends_on_two_events();
void *widget_measure_do_select_a_second_rules_set();
void *widget_measure_do_choose_an_event_type();
void *widget_measure_do_correlate();
void *widget_measure_do_insert_in_measurements_list();
void *widget_measure_do_end_creation_of_measurement_process();
// Les cinq types de mesures possibles
void *widget_measure_event_occurences_nb();
void *widget_measure_event_occurences_dates();
void *widget_measure_event_occurences_situations();
void *widget_measure_time_elapsed_between_two_events();
void *widget_measure_third_event_occurences_in_between();
void *widget_measure_do_we_select_another_measurement();
void *widget_not_yet_defined();

101
journal.c Normal file
View File

@ -0,0 +1,101 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* State machine / Measures *
* *
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
* Copyright © 2024 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2024 Jean Sirmai <jean@a-lec.org> *
* *
* This file is part of Gem-graph. *
* *
* 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 <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "../../../include/fsm.h"
/******************************************************************************/
/* A journal (a pile) stores chronologically the fsm events */
/* during a session run (rules exec, mainly) */
/******************************************************************************/
int fsm_journal_push (journal **jj, int vv)
{
journal *element = malloc (sizeof(journal));
if (!element) exit (EXIT_FAILURE); // Si l'allocation a échoué.
element->value = vv;
element->prev = *jj;
*jj = element; // Le pointeur pointe sur le dernier élément.
return vv;
}
int fsm_journal_pop (journal **jj)
{
int vv;
journal *tmp;
if (!*jj) return -1; // Retourne -1 si le journal est vide.
tmp = (*jj)->prev;
vv = (*jj)->value;
free (*jj);
*jj = tmp; // Le pointeur pointe sur le dernier élément.
return vv; // retourne la value retirée du journal.
}
void fsm_journal_clear (journal **jj)
{
journal *tmp;
while (*jj)
{
tmp = (*jj)->prev;
free (*jj);
*jj = tmp;
}
}
int fsm_journal_length (journal *jj)
{
int n=0;
while (jj)
{
n++;
jj = jj->prev;
}
return n;
}
void fsm_journal_view (journal *jj)
{
printf ("view journal (n = %d)\n", fsm_journal_length (jj));
while (jj)
{
printf ("> %d\n", jj->value);
jj = jj->prev;
}
puts ("------");
}
void fsm_journal_seek (journal *jj, int value)
{
}

View File

@ -29,39 +29,75 @@
#include <stdbool.h>
#include "../include/fsm.h"
#include "../include/prefer.h"
#include "../include/widget.h"
#include "../../include/fsm.h"
/******************************************************************************/
/* */
/* OOOOOOOOOOO OOOOO OOO OOO */
/* OO OO OO OOOO OOOO */
/* OO OO OO OO OO OO */
/* OOOOOO OO OO OO OO OO */
/* OO OO OO OOO OO */
/* OO OO OO OO */
/* OO OO OOO OO OO */
/* OO OOOOOO OO OO */
/* */
/******************************************************************************/
/******************************************************************************/
/* Each state of the finite state machine (fsm) must be */
/* - saved at the end of a work session and */
/* - reread (available) at the start of a new session. */
/* */
/* No state of the fsm should be defined in another module. */
/* No fsm transition needs to be executed in another module. */
/******************************************************************************/
/******************************************************************************/
/* F S M I N I T */
/******************************************************************************/
void fsm_init()
{
fsm_measures_list_init();
fsm_results_list_init();
fsm_displayable_list_init();
fsm_preferences_init();
}
/******************************************************************************/
/* S T A T E S */
/******************************************************************************/
static int choice_EXEC_EDIT = EXEC;
static int choice_STATE_RULES_DATA = STATE;
static int preferences_have_been_modified = FALSE;
int fsm_get_exec_edit () {return choice_EXEC_EDIT;}
int fsm_get_state_rules_data () {return choice_STATE_RULES_DATA;}
void fsm_set_preferences_state (bool value) {preferences_have_been_modified = value;}
bool fsm_get_preferences_state () {return preferences_have_been_modified;}
bool fsm_get_preferences_state() {return preferences_have_been_modified;}
// preferences_have_been_modified
// and should be stored before closing the current session. TODO
static int choice_EXEC_EDIT = EXEC;
static int choice_STATE_RULES_DATA = SYNTH; // THE FIRST PAGE TO BE PRESENTED
// SEE ALSO fsm/dispatch.c window_design_topbar_left() (the end)
int fsm_get_exec_edit() {return choice_EXEC_EDIT;}
int fsm_get_state_rules_data() {return choice_STATE_RULES_DATA;}
/******************************************************************************/
/* T R A N S I T I O N S */
/******************************************************************************/
static void debug_printing (int choice, int value, int sub_automaton);
void fsm_set_exec_edit (int choice)
{
if (choice_EXEC_EDIT != choice) {
debug_printing (choice, 0, 0); // EXEC_EDIT is sub_automaton 0
fsm_msg (choice, 0, "", 0); // EXEC_EDIT is sub_automaton 0
choice_EXEC_EDIT = choice;
}
}
@ -69,59 +105,42 @@ void fsm_set_exec_edit (int choice)
void fsm_set_state_rules_data (int choice)
{
if (choice_STATE_RULES_DATA != choice) {
debug_printing (choice, 0, 1); // STATE_RULES_DATA is sub_automaton 1
fsm_msg (choice, 0, "", 1); // STATE_RULES_DATA is sub_automaton 1
choice_STATE_RULES_DATA = choice;
}
}
/******************************************************************************/
/* D E B U G G E R S */
/* D E B U G G I N G */
/******************************************************************************/
static char *tab_0 [] = { "EXEC", "EDIT" };
static char *tab_1 [] = { "SYNTH", "STATE", "RULES", "DATA" };
static void debug_printing (int choice, int value, int sub_automaton)
void fsm_msg (int choice, int value, char *string, int sub_automaton)
{
switch (sub_automaton) { // sub_automaton 0 is EXEC_EDIT and
// sub_automaton 1 is STATE_RULES_DATA
case (0) : printf("switch %5s x %5s > %5s x %5s\n",
tab_0 [choice_EXEC_EDIT],
tab_1 [choice_STATE_RULES_DATA],
tab_0 [choice],
tab_1 [choice_STATE_RULES_DATA]);
// sub_automaton 1 is STATE_RULES_DATA
// sub_automaton 2 is MEASURE
case (0) : printf ("fsm/dispatch.message | switch %5s x %5s > %5s x %5s\n",
tab_0 [choice_EXEC_EDIT], tab_1 [choice_STATE_RULES_DATA],
tab_0 [choice], tab_1 [choice_STATE_RULES_DATA]);
break;
case (1) : printf("switch %5s x %5s > %5s x %5s\n",
tab_0 [choice_EXEC_EDIT],
tab_1 [choice_STATE_RULES_DATA],
tab_0 [choice_EXEC_EDIT],
tab_1 [choice]);
break;
case (2) : break;
case (3) : break;
default : printf("default in automaton.debug_printing()\n");
case (1) : printf ("fsm/dispatch.message | switch %5s x %5s > %5s x %5s\n",
tab_0 [choice_EXEC_EDIT], tab_1 [choice_STATE_RULES_DATA],
tab_0 [choice_EXEC_EDIT], tab_1 [choice]);
break;
case (2) : printf ("fsm/dispatch.message | %s\n", string);
break;
case (3) : printf ("fsm/dispatch.message | %2d\n", choice);
break;
default : printf ("default in fsm/dispatch.fsm_msg()\n");
}
}
/******************************************************************************/
/* N O N E X C L U S I V E S E L E C T I O N S */
/******************************************************************************/
// ?
/******************************************************************************/
/* M E A S U R E S */
/******************************************************************************/
// list of measurements requested by the user
// this list is editable (see widget / measure)
// the results of each measurement can be displayed in diagrams (charts,...)
// liste des diagrammes

101
src/fsm/journal.c Normal file
View File

@ -0,0 +1,101 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* Finite State Machine / Journal *
* *
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
* Copyright © 2024 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2024 Jean Sirmai <jean@a-lec.org> *
* *
* This file is part of Gem-graph. *
* *
* 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 <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "../../include/fsm.h"
/******************************************************************************/
/* A journal (a pile) stores chronologically the fsm events */
/* during a session run (rules exec, mainly) */
/******************************************************************************/
int fsm_journal_push (journal **jj, int vv)
{
journal *element = malloc (sizeof(journal));
if (!element) exit (EXIT_FAILURE); // Si l'allocation a échoué.
element->value = vv;
element->prev = *jj;
*jj = element; // Le pointeur pointe sur le dernier élément.
return vv;
}
int fsm_journal_pop (journal **jj)
{
int vv;
journal *tmp;
if (!*jj) return -1; // Retourne -1 si le journal est vide.
tmp = (*jj)->prev;
vv = (*jj)->value;
free (*jj);
*jj = tmp; // Le pointeur pointe sur le dernier élément.
return vv; // retourne la value retirée du journal.
}
void fsm_journal_clear (journal **jj)
{
journal *tmp;
while (*jj)
{
tmp = (*jj)->prev;
free (*jj);
*jj = tmp;
}
}
int fsm_journal_length (journal *jj)
{
int n=0;
while (jj)
{
n++;
jj = jj->prev;
}
return n;
}
void fsm_journal_view (journal *jj)
{
printf ("view journal (n = %d)\n", fsm_journal_length (jj));
while (jj)
{
printf ("> %d\n", jj->value);
jj = jj->prev;
}
puts ("------");
}
void fsm_journal_seek (journal *jj, int value)
{
}

View File

@ -1,8 +1,8 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* Gem-graph client *
* *
* Main *
* State machine / Measures *
* *
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
* Copyright © 2024 Adrien Bourmault <neox@a-lec.org> *
@ -27,14 +27,18 @@
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "../../../include/fsm.h"
#pragma once
#include <gtk-4.0/gtk/gtk.h>
/******************************************************************************/
/* An editable list of displayed results is defined and maintained here */
/* (see : fsm/measure/manage.c) */
/* - - - */
/* NB some data may be displayed simultaneously in different pages */
/* ex : pages SYNTH & RESULTS */
/******************************************************************************/
void pref_set_store_restore_reset (int choice, int value);
const char get_button_icon_name (int n);
void fsm_reset_all_situations_transparencies_at_value (int value); // provisoire...
void *prefer_add_measure (char *measure_name);

View File

@ -0,0 +1,49 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* State machine / Measures *
* *
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
* Copyright © 2024 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2024 Jean Sirmai <jean@a-lec.org> *
* *
* This file is part of Gem-graph. *
* *
* 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 <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "../../../include/fsm.h"
// data_list or flow_list
// ?
// when does a stream of numbers become data
// ?
/******************************************************************************/
/* An editable list of results is defined and maintained here */
/* and some operations can be performed on them. */
/* (see : fsm/measure/manage.c) */
/* - - - */
/* ex : filter, concat, inverse, scale, correlate, etc. */
/******************************************************************************/

87
src/fsm/measure/manage.c Normal file
View File

@ -0,0 +1,87 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* State machine / Measures *
* *
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
* Copyright © 2024 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2024 Jean Sirmai <jean@a-lec.org> *
* *
* This file is part of Gem-graph. *
* *
* 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 <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "../../../include/fsm.h"
/******************************************************************************/
/* F R O M M E A S U R E M E N T S T O P R E S E N T A T I O N S */
/* */
/* How should the sequence */
/* from measurements to results presentation */
/* be organized */
/* ? */
/* */
/* (1) create/edit some mesurement tools and/or activate existing ones */
/* (2) apply a mesurement tool to a situation to create a new data flow */
/* and possibly carry out any operations on these results */
/* (3) display (plot) the results and adjust the appearance of the tables */
/* - - - */
/* */
/* As a consequence, three lists at least */
/* must be created and maintained : */
/* */
/* (1) a mesurement tools list (see : fsm/measure/tool_list.c) */
/* which should mention if the tool is 'active' or 'inactive' */
/* NB each rule ou rules-tree edition may change some items of that list */
/* */
/* (2) a data flows list (see : fsm/measure/flow_list.c) */
/* (it could either be named : fsm/measure/data_list.c) */
/* on which some operations could be performed : */
/* ex : filter, concat, inverse, scale, correlate, etc. */
/* NB each data flow should be available in a 'displayable form' */
/* */
/* (3) a displayed data list (see : fsm/measure/disp_list.c) */
/* NB some data may be displayed simultaneously in different pages */
/* ex : SYNTH & RESULTS */
/* */
/* NB these three lists should be stored in the XML model */
/* and restored at the beginning of a new session */
/* - - - */
/* */
/* (4) a journal (a pile) stores chronologically the fsm events */
/* during a session run (rules exec, mainly) */
/* - - - */
/* */
/* When a rule is adequately tagged, it triggers a measure : */
/* fsm_rule_trig_measure (rule_id, object_id, measure_id) {...} */
/* */
/* The measurement is then taken and the result stored. */
/* */
/******************************************************************************/
void fsm_add_measure (char *measure_name) {fsm_msg (2, 0, measure_name, 2);}
void fsm_measures_list_init() {if (0) fsm_tools_sort_list_test();}
void fsm_rule_trig_measure (int rule_id, int object_id, int measure_id) {}

199
src/fsm/measure/tool_list.c Normal file
View File

@ -0,0 +1,199 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* State machine / Measures *
* *
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
* Copyright © 2024 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2024 Jean Sirmai <jean@a-lec.org> *
* *
* This file is part of Gem-graph. *
* *
* 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 <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#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 ?
//------------------------------------------------------------------------------
void fsm_tools_sort_list_insert (tool_list **ml, int value)
{
tool_list *tmp = NULL;
tool_list *cml = *ml;
tool_list *elem = malloc (sizeof (tool_list));
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;
}
int fsm_tools_sort_list_pop (tool_list **ml)
{
int value;
tool_list *tmp;
if (! *ml) return -1;
tmp = (*ml)->suiv;
value = (*ml)->value;
printf("value = %d < removed from the measures list\n", (*ml)->value);
free (*ml);
*ml = tmp;
return value;
}
int fsm_tools_sort_list_length (tool_list *ml)
{
int n = 0;
while (ml)
{
n++;
ml = ml->suiv;
}
return n;
}
void fsm_tools_sort_list_clear (tool_list **ml)
{
tool_list *tmp;
while (*ml)
{
tmp = (*ml)->suiv;
free (*ml);
*ml = tmp;
}
}
void fsm_tools_sort_list_view (tool_list *ml)
{
printf ("-------- view measures list (n = %d)\n",
fsm_tools_sort_list_length (ml));
while(ml)
{
printf("%d\n", ml->value);
ml = ml->suiv;
}
puts ("--------------");
}
void fsm_tools_sort_list_test()
{
tool_list *ex_tool = NULL;
puts("\ncréation d'une liste de 10 elements :");
fsm_tools_sort_list_insert (&ex_tool,9);
fsm_tools_sort_list_insert (&ex_tool,-8);
fsm_tools_sort_list_insert (&ex_tool,3);
fsm_tools_sort_list_insert (&ex_tool,5);
fsm_tools_sort_list_insert (&ex_tool,-1);
fsm_tools_sort_list_insert (&ex_tool,4);
fsm_tools_sort_list_insert (&ex_tool,-6);
fsm_tools_sort_list_insert (&ex_tool,2);
fsm_tools_sort_list_insert (&ex_tool,0);
fsm_tools_sort_list_insert (&ex_tool,7);
fsm_tools_sort_list_view (ex_tool);
puts("retrait des 3 premiers elements :");
fsm_tools_sort_list_pop (&ex_tool);
fsm_tools_sort_list_pop (&ex_tool);
fsm_tools_sort_list_pop (&ex_tool);
fsm_tools_sort_list_view (ex_tool);
puts("ajout des 3 elements (8, 1, 6) :");
fsm_tools_sort_list_insert (&ex_tool,8);
fsm_tools_sort_list_insert (&ex_tool,1);
fsm_tools_sort_list_insert (&ex_tool,6);
fsm_tools_sort_list_view (ex_tool);
fsm_tools_sort_list_clear (&ex_tool);
printf("clear()\n> nombre d'éléments restant = %d\n\n",
fsm_tools_sort_list_length(ex_tool));
}

View File

@ -29,9 +29,9 @@
#include "../include/fsm.h"
#include "../include/signal.h"
#include "../include/widget.h"
#include "../../include/fsm.h"
#include "../../include/signal.h"
#include "../../include/widget.h"
// TODO Les noms d'icônes sont utilisés pour deux fonctions distinctes :
@ -39,7 +39,7 @@
// 2) dans signal.c on_updating_objects_transparencies()
// où ils servent à identifier le bouton source (activé)
// Cette identification va déterminer le choix du switch
// de la fonction : pref_set_store_restore_reset ()
// de la fonction : fsm_store_restore_reset()
// ! WARNING ! Cette méthode d'identification est dangereuse:
// Si un utilisateur modifie l'apparence d'un bouton (parce que préférence...)
@ -50,13 +50,20 @@
// Les "symbolics" (les noms) des icônes devraient être déclarées une seule fois (ici))
// de façon à ce qu'une seule variable soit utilisée pour les deux fonctions.
/* use this ?
static const char *icon_name [3] = {
"document-revert-rtl-symbolic",
"edit-undo-symbolic",
"view-refresh-symbolic"
};
// transtypage vers un pointeur depuis un entier de taille différente vvv TODO
const char *get_button_icon_name (int n) {return (const char*) icon_name [n];}
const char *fsm_get_button_icon_name (int n) {return (const char*) icon_name [n];}
*/
/******************************************************************************/
/* S T A T E A P P E A R A N C E */
/******************************************************************************/
// ------------------------- O B J E C T S ------------------------------//
@ -66,7 +73,7 @@ struct preferences *pref_jean = NULL; // TODO (voir graphics_init(...))
// en attendant:
static int p[n_objects] = {};
void pref_set_store_restore_reset (int choice, int value)
void fsm_store_restore_reset (int choice, int value)
{
switch (choice) {
case (STORE) :
@ -109,13 +116,21 @@ void fsm_reset_all_situations_transparencies_at_value (int value)
/******************************************************************************/
/* M E A S U R E S */
/* D I S P L A Y E D R E S U L T S */
/******************************************************************************/
static void *list_measures;
static void *list_displayables;
void *prefer_add_measure (char *measure_name)
void fsm_add_displayable (char *displayable_name)
{
printf("prefer_add_measure %p <<< %s (see prefer.c)\n", list_measures, measure_name);
return NULL;
printf("fsm_add_displayable %p <<< %s (see prefer.c)\n",
list_displayables, displayable_name);
}
/******************************************************************************/
/* P R E F E R E N C E S */
/******************************************************************************/
void fsm_preferences_init () {fsm_displayable_list_init ();}
void fsm_displayable_list_init () { printf("src/fsm/prefer.c fsm_displayable_list_init()\n");}

79
src/fsm/result.c Normal file
View File

@ -0,0 +1,79 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* State machine *
* *
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
* Copyright © 2024 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2024 Jean Sirmai <jean@a-lec.org> *
* *
* This file is part of Gem-graph. *
* *
* 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 <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdbool.h>
#include "../../include/fsm.h"
#include "../../include/widget.h"
/******************************************************************************/
/* Each state of the finite state machine (fsm) must be */
/* - saved at the end of a work session and */
/* - reread (available) at the start of a new session. */
/* */
/* No state of the fsm should be defined in another module. */
/* No fsm transition needs to be executed in another module. */
/******************************************************************************/
/******************************************************************************/
/* R E S U L T S */
/******************************************************************************/
// An editable list of displayable results is maintained. (add, remove, display)
// A preferred presentation should be available for each result.
// NB : "graph", "chart", "plot" and "diagram" are ambiguous terms.
// The list of results currently displayed is defined in : prefer.c
// structure de données : tableau ?
// - identifiant (clé) (+/- pointeur vers : date de création, auteur,...)
// - type de données 1
// - type de données 2
// - ... ?
// - pointeur vers le premier groupe de données
// - pointeur vers le second groupe de données
// - ... ?
// - pointeur vers une liste de données similaires
// - concat ?
static void *list_results;
void fsm_add_result (char *result_name)
{
printf("fsm_add_result %p <<< %s (see fsm.c)\n", list_results, result_name);
}
void fsm_results_list_init ()
{
fsm_msg (0,0, "src/fsm/result.c fsm_results_list_init()", 2); // sub_automaton 2
}

View File

@ -28,6 +28,8 @@
#include "../../include/graphics.h"
#include "../../include/parse.h"
#include "../../include/util.h"
#define TEST 0
@ -380,7 +382,7 @@ bool graphics_init_shaders(const int stack_id)
GLuint p = 0;
// Load vertex shader file
vertex_shader = read_file(VERTEX_SHADER_FILE);
vertex_shader = util_read_file(VERTEX_SHADER_FILE);
if (vertex_shader == NULL)
return false;
vertex = graphics_create_shader(stack_id, GL_VERTEX_SHADER, vertex_shader);
@ -392,7 +394,7 @@ bool graphics_init_shaders(const int stack_id)
}
// Load fragment shader file
fragment_shader = read_file(FRAG_SHADER_FILE);
fragment_shader = util_read_file(FRAG_SHADER_FILE);
if (fragment_shader == NULL)
return false;
fragment = graphics_create_shader(stack_id, GL_FRAGMENT_SHADER, fragment_shader);

View File

@ -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,17 @@
*
*******************************************************************************
* 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/fsm.h"
int main (int argc, char **argv)
@ -151,7 +153,10 @@ 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.c)
g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL);
// on_windows_activation <> see : src/widget/dispatch
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);

View File

@ -32,7 +32,6 @@
#include "../include/fsm.h"
#include "../include/signal.h"
#include "../include/widget.h"
#include "../include/prefer.h"
#include "../include/graphics.h"
@ -338,9 +337,9 @@ void on_updating_objects_transparencies (GtkWidget *btt_source, GtkScrollbar *sc
const char *btt_name = gtk_button_get_icon_name (GTK_BUTTON (btt_source));
int value = gtk_adjustment_get_value (gtk_scrollbar_get_adjustment (scrollbar));
if ( ! strcmp (btt_name, "document-revert-rtl-symbolic")) pref_set_store_restore_reset (STORE, value);
if ( ! strcmp (btt_name, "edit-undo-symbolic")) pref_set_store_restore_reset (RESTORE, value);
if ( ! strcmp (btt_name, "view-refresh-symbolic")) pref_set_store_restore_reset (RESET, value);
if ( ! strcmp (btt_name, "document-revert-rtl-symbolic")) fsm_store_restore_reset (STORE, value);
if ( ! strcmp (btt_name, "edit-undo-symbolic")) fsm_store_restore_reset (RESTORE, value);
if ( ! strcmp (btt_name, "view-refresh-symbolic")) fsm_store_restore_reset (RESET, value);
fsm_set_preferences_state (TRUE); // << à détailler TODO
}
@ -350,7 +349,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)
{
@ -366,6 +365,7 @@ void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrol
void on_clicked_topbar_right_measure (GtkWidget *btt, gpointer data)
{
// fsm_measures_sorted_list_do something ();
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_get_measure_page()));
}
@ -394,33 +394,34 @@ void on_measure_depends_on_two_events (GtkWidget *btt, gpointer data)
GTK_WIDGET (widget_measure_do_select_a_second_rules_set()));
}
void on_select_a_second_rules_set (GtkWidget *btt, gpointer data)
{
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_choose_an_event_type()));
}
void on_select_a_second_measurement (GtkWidget *btt, gpointer data)
{
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_we_select_another_measurement()));
GTK_WIDGET (widget_measure_do_correlate()));
}
void on_not_yet_defined (GtkWidget *btt, gpointer data)
void on_skip_this_step (GtkWidget *btt, gpointer data)
{
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_not_yet_defined ()));
GTK_WIDGET (widget_measure_do_insert_in_measurements_list ()));
}
void on_something_else (GtkWidget *btt, gpointer data)
{
printf("insert in measurements list (this print comes from signal.c)\n");
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_end_creation_of_measurement_process()));
}
void on_closing_page (GtkWidget *btt, gpointer data)
{
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_get_synth_page()));
}
void on_measure_single_event_occurences_nb (GtkWidget *btt, gpointer data)

View File

@ -1,10 +1,11 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* Gem-graph client *
* *
* Stock *
* Base header *
* *
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
* *
* This file is part of Gem-graph. *
@ -27,24 +28,55 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../../include/base.h"
#include "../../../include/signal.h"
#include "../../../include/widget.h"
void *widget_get_operations_on_results_page () {
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h> // Defines NULL.
#include <stdbool.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
GtkWidget *btt_A = gtk_toggle_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (btt_A), "view-refresh-symbolic");
#include "../../include/util.h"
// GtkWidget *data_chart = GTK_WIDGET (gtk_picture_new_for_filename
// ("/home/jean/Gem-Graph/gem-graph-client/data/image/data charts.png"));
GtkWidget* frame_analysis = gtk_frame_new ("analysis");
// GtkBox *analysis_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 8));
gtk_frame_set_child (GTK_FRAME (frame_analysis), GTK_WIDGET (btt_A));
// gtk_frame_set_child (GTK_FRAME (frame_analysis), GTK_WIDGET (data_chart));
/*
* char *read_file(char *filename)
* reads a file from filename into a provided buffer
*
* @param filename, file name
* contents, target ptr
*
* @return void
*/
char *util_read_file(char *filename)
{
int fd;
int filesize;
char *contents;
return GTK_WIDGET (frame_analysis);
fd = open(filename, O_RDONLY);
if (fd < 0) {
printf("Couldn't read file: %s\n",filename);
return NULL;
}
filesize = lseek(fd, 0, SEEK_END) + 1 ;
contents = g_malloc(filesize * sizeof(char));
assert (contents);
lseek(fd, 0, SEEK_SET);
read(fd,contents,filesize);
contents[filesize-1] = '\0';
close(fd);
return contents;
}

130
src/util/list_2x2.c Normal file
View File

@ -0,0 +1,130 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* Finite State Machine (fsm) header *
* *
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
* *
* This file is part of Gem-graph. *
* *
* 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 <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../include/util.h"
void util_list_2x2_init (dblist *l)
{
l->first = NULL;
l->last = NULL;
}
int util_list_2x2_push_back (dblist *l, int val)
{
elem *nouv = malloc (sizeof(elem));
if (! nouv) exit (EXIT_FAILURE);
nouv->value = val;
nouv->prev = l->last;
nouv->next = NULL;
if (l->last) l->last->next = nouv;
else l->first = nouv;
l->last = nouv;
return val;
}
int util_list_2x2_push_front (dblist *l, int val)
{
elem *nouv = malloc(sizeof(elem));
if (! nouv) exit (EXIT_FAILURE);
nouv->value = val;
nouv->next = l->first;
nouv->prev = NULL;
if (l->first) l->first->prev = nouv;
else l->last = nouv;
l->first = nouv;
return val;
}
int util_list_2x2_pop_back (dblist *l)
{
int val;
elem *tmp = l->last;
if (! tmp) return -1;
val = tmp->value;
l->last = tmp->prev;
if (l->last) l->last->next = NULL;
else l->first = NULL;
free (tmp);
return val;
}
int util_list_2x2_pop_front (dblist *l)
{
int val;
elem *tmp = l->first;
if (! tmp) return -1;
val = tmp->value;
l->first = tmp->next;
if (l->first)l->first->prev = NULL;
else l->last = NULL;
free (tmp);
return val;
}
void util_list_2x2_clear (dblist *l)
{
elem *tmp;
elem *pelem = l->first;
while(pelem)
{
tmp = pelem;
pelem = pelem->next;
free(tmp);
}
l->first = NULL;
l->last = NULL;
}
int util_list_2x2_length (dblist l)
{
elem *pelem = l.first;
int cpt = 0;
while (pelem)
{
cpt ++;
pelem = pelem->next;
}
return cpt;
}
void util_list_2x2_view (dblist l)
{
printf ("-------- view liste (n = %d)\n", util_list_2x2_length (l));
elem *pelem = l.first;
while (pelem)
{
printf ("> %d <\n", pelem->value);
pelem = pelem->next;
}
puts ("--------------");
}

View File

@ -1,10 +1,11 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* Gem-graph client *
* *
* Stock *
* Finite State Machine (fsm) header *
* *
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
* *
* This file is part of Gem-graph. *
@ -27,40 +28,63 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../../include/base.h"
#include "../../../include/signal.h"
#include "../../../include/widget.h"
#include "../../include/util.h"
void *widget_get_measures_page ()
int util_pile_push (pile **p, int Val)
{
GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 32));
pile *element = malloc (sizeof(pile));
if (!element) exit (EXIT_FAILURE); // Si l'allocation a échoué.
element->value = Val;
element->prev = *p;
*p = element; // Le pointeur pointe sur le dernier élément.
return Val;
}
GtkWidget* frame_rule_effect = gtk_frame_new ("rule effect");
GtkBox *rule_effect_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8));
gtk_frame_set_child (GTK_FRAME (frame_rule_effect), GTK_WIDGET (rule_effect_box));
GtkWidget* frame_rule_topic = gtk_frame_new ("rule topic");
GtkBox *rule_topic_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8));
gtk_frame_set_child (GTK_FRAME (frame_rule_topic), GTK_WIDGET (rule_topic_box));
gtk_box_append (rule_effect_box, gtk_button_new_with_label ("movement"));
gtk_box_append (rule_effect_box, gtk_button_new_with_label ("transport"));
gtk_box_append (rule_effect_box, gtk_button_new_with_label ("transformation"));
gtk_box_append (rule_topic_box, gtk_button_new_with_label ("objects"));
gtk_box_append (rule_topic_box, gtk_button_new_with_label ("situations"));
GtkWidget *btt_B = gtk_toggle_button_new ();
gtk_button_set_icon_name (GTK_BUTTON (btt_B), "folder-saved-search-symbolic");
gtk_box_append (data_box, GTK_WIDGET (btt_B));
gtk_box_append (data_box, GTK_WIDGET (frame_rule_effect));
gtk_box_append (data_box, GTK_WIDGET (frame_rule_topic));
GtkWidget* frame_measures = gtk_frame_new ("measures");
gtk_frame_set_child (GTK_FRAME (frame_measures), GTK_WIDGET (data_box));
return GTK_WIDGET (frame_measures);
int util_pile_pop (pile **p)
{
int Val;
pile *tmp;
if (!*p) return -1; // Retourne -1 si la pile est vide.
tmp = (*p)->prev;
Val = (*p)->value;
free (*p);
*p = tmp; // Le pointeur pointe sur le dernier élément.
return Val; // Retourne la value soutirée de la pile.
}
void util_pile_clear (pile **p)
{
pile *tmp;
while (*p)
{
tmp = (*p)->prev;
free (*p);
*p = tmp;
}
}
int util_pile_length (pile *p)
{
int n=0;
while (p)
{
n++;
p = p->prev;
}
return n;
}
void util_pile_view (pile *p)
{
printf ("view pile (n = %d)\n", util_pile_length (p));
while (p)
{
printf ("> %d\n", p->value);
p = p->prev;
}
puts ("------");
}

97
src/util/sorted_list.c Normal file
View File

@ -0,0 +1,97 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* Finite State Machine (fsm) header *
* *
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
* Copyright © 2021 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
* *
* This file is part of Gem-graph. *
* *
* 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 <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../include/util.h"
void util_sorted_list_clear (slist **sl)
{
slist *tmp;
while (*sl)
{
tmp = (*sl)->suiv;
free (*sl);
*sl = tmp;
}
}
void util_sorted_list_view (slist *sl)
{
printf ("-------- view liste (n = %d)\n", util_sorted_list_length (sl));
while(sl)
{
printf("%d\n",sl->value);
sl = sl->suiv;
}
puts ("--------------");
}
int util_sorted_list_insert (slist **sl, int value)
{
slist *tmp = NULL;
slist *csl = *sl;
slist *elem = malloc (sizeof (slist));
if (!elem) exit (EXIT_FAILURE);
elem->value = value;
while (csl && csl->value < value)
{
tmp = csl;
csl = csl->suiv;
}
elem->suiv = csl;
if(tmp) tmp->suiv = elem;
else *sl = elem;
return 0;
}
int util_sorted_list_pop (slist **sl)
{
int value;
slist *tmp;
if (! *sl) return -1;
tmp = (*sl)->suiv;
value = (*sl)->value;
printf("value = %d <> removed from the list by pop()\n", (*sl)->value);
free (*sl);
*sl = tmp;
return value;
}
int util_sorted_list_length (slist *sl)
{
int n = 0;
while (sl)
{
n++;
sl = sl->suiv;
}
return n;
}

126
src/util/tests.c Normal file
View File

@ -0,0 +1,126 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* State machine *
* *
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
* Copyright © 2024 Adrien Bourmault <neox@a-lec.org> *
* Copyright © 2024 Jean Sirmai <jean@a-lec.org> *
* *
* This file is part of Gem-graph. *
* *
* 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 <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../include/util.h"
void util_trigger_test ()
{
if (0) util_pile_test();
if (0) util_double_list_test();
if (0) util_sorted_list_test();
}
void util_pile_test()
{
pile *exemple = NULL; // doit être initialisée à NULL
puts ("------");
printf ("push > %d\n", util_pile_push (&exemple, 1));
printf ("push > %d\n", util_pile_push (&exemple, 2));
printf ("push > %d\n", util_pile_push (&exemple, 3));
printf ("push > %d\n", util_pile_push (&exemple, 4));
util_pile_view (exemple);
printf ("pop > %d\n", util_pile_pop (&exemple));
printf ("pop > %d\n", util_pile_pop (&exemple));
util_pile_view (exemple);
printf ("clear pile\n"); util_pile_clear (&exemple);
util_pile_view (exemple);
}
void util_double_list_test()
{
dblist exemple;
util_list_2x2_init (&exemple);
printf ("push front > %d\n", util_list_2x2_push_front (&exemple, 10));
printf ("push back > %d\n", util_list_2x2_push_back (&exemple, 100));
printf ("push back > %d\n", util_list_2x2_push_back (&exemple, 1000));
printf ("push front > %d\n", util_list_2x2_push_front (&exemple, 1));
util_list_2x2_view (exemple);
printf ("pop back > %d\n", util_list_2x2_pop_back (&exemple));
printf ("pop back > %d\n", util_list_2x2_pop_back (&exemple));
printf ("pop back > %d\n", util_list_2x2_pop_back (&exemple));
printf ("pop back > %d\n", util_list_2x2_push_back (&exemple, 2));
util_list_2x2_view (exemple);
printf ("push back > %d\n", util_list_2x2_push_back (&exemple, 3));
printf ("push front > %d\n", util_list_2x2_push_front (&exemple, 0));
util_list_2x2_view (exemple);
printf ("clear list\n"); util_list_2x2_clear (&exemple);
util_list_2x2_view (exemple);
}
void util_sorted_list_test()
{
slist *Mysl = NULL;
puts("\ncréation d'une liste de 10 elements :");
util_sorted_list_insert (&Mysl,9);
util_sorted_list_insert (&Mysl,-8);
util_sorted_list_insert (&Mysl,3);
util_sorted_list_insert (&Mysl,5);
util_sorted_list_insert (&Mysl,-1);
util_sorted_list_insert (&Mysl,4);
util_sorted_list_insert (&Mysl,-6);
util_sorted_list_insert (&Mysl,2);
util_sorted_list_insert (&Mysl,0);
util_sorted_list_insert (&Mysl,7);
util_sorted_list_view (Mysl);
puts("retrait des 3 premiers elements :");
util_sorted_list_pop (&Mysl);
util_sorted_list_pop (&Mysl);
util_sorted_list_pop (&Mysl);
util_sorted_list_view (Mysl);
puts("ajout des 3 elements (8, 1, 6) :");
util_sorted_list_insert (&Mysl,8);
util_sorted_list_insert (&Mysl,1);
util_sorted_list_insert (&Mysl,6);
util_sorted_list_view (Mysl);
util_sorted_list_clear (&Mysl);
printf("clear()\n> nombre d'éléments restant = %d\n\n",
util_sorted_list_length(Mysl));
}

View File

@ -32,6 +32,20 @@
#include "../../include/widget.h"
/******************************************************************************/
/* */
/* ## ## ### ##### ###### ######## ######## */
/* # # # # ## ## ## # # */
/* # # # # ## ## # # */
/* # # # # ## ## #### # */
/* # # # # # # # # # # */
/* # # # # # # ## ## #### # # */
/* ## ## # # ## ## ## # # */
/* ## ## ### ###### ####### ######## # */
/* */
/******************************************************************************/
/******************************************************************************/
/* W I N D O W S */
/******************************************************************************/
@ -51,8 +65,11 @@ void on_windows_activation (GtkApplication *app)
dialog_window = GTK_WINDOW (gtk_application_window_new (app));
text_window = GTK_WINDOW (gtk_application_window_new (app));
widget_design_main_window (main_window);
widget_design_main_window (main_window); // def: widget/topbar/dispatch
widget_design_dialog_window (main_window, dialog_window);
widget_design_text_window (main_window, text_window);
}
/******************************************************************************/
/* M A I N W I N D O W <> see T O P B A R */
/******************************************************************************/

View File

@ -31,15 +31,57 @@
#include "../../../include/base.h"
#include "../../../include/signal.h"
#include "../../../include/widget.h"
#include "../../../include/prefer.h"
#include "../../../include/fsm.h"
/******************************************************************************/
/* M E A S U R E S */
/******************************************************************************/
// Measure concerns
// - nb of occurences of the rule
// - nb of objects / situations before / after > select target
// - time (date) of event
// - time elapsed between two events
// - occurence of events C between events A and B
// Then, add this new measure to the list of measures
// When a list is established, it is possible to evaluate
// if the results of this measure are correlated with some other results.
static GtkBox *measure_page;
void *widget_measure_event_occurences_nb()
{
fsm_add_measure ("new measure count one event occurences");
return measure_page;
}
void *widget_measure_event_occurences_dates()
{
fsm_add_measure ("new measure one event occurences dates");
return measure_page;
}
void *widget_measure_event_occurences_situations()
{
fsm_add_measure ("new measure one event occurences situations");
return measure_page;
}
void *widget_measure_time_elapsed_between_two_events()
{
fsm_add_measure ("new measure time elapsed between two events");
return measure_page;
}
void *widget_measure_third_event_occurences_in_between()
{
fsm_add_measure ("new measure of the frequency of a third event\
occurring between two other events");
return measure_page;
}
static GtkBox *edit_a_new_measure_box;
static GtkWidget *caliper;
static GtkWidget *btt_edit_a_new_measure;
@ -68,30 +110,38 @@ static GtkWidget *bridge;
static GtkWidget *btt_time_elapsed;
static GtkWidget *btt_event_in_between;
static GtkBox *correlation_measures_box; //TODO
static GtkBox *correlation_measures_box;
static GtkWidget *correl;
static GtkWidget *btt_select_another_measurement_question;
static GtkWidget *btt_skip_this_step;
static GtkBox *insertion_in_list_measurements_box; //TODO
static GtkBox *insertion_in_list_measurements_box;
static GtkWidget *insert;
static GtkWidget *btt_insert_in_measurements_list;
static GtkBox *last_one;
static GtkWidget *clean;
static GtkWidget *btt_end;
// Measure concerns
// - nb of occurences of the rule
// - nb of objects / situations before / after > select target
// - time (date) of event
// - time elapsed between two events
// - occurence of events C between events A and B
// Then, add this new measure to the list of measures
// Is this measure to be correlated to some others ?
void *widget_not_yet_defined()
void *widget_measure_do_end_creation_of_measurement_process()
{
last_one = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
clean = gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/stamp/clean.png");
btt_end = gtk_toggle_button_new_with_label
("click to end the creation of a new measurement process");
// g_signal_connect (btt_end, "toggled", G_CALLBACK (on_closing_page), NULL);
gtk_box_append (last_one, GTK_WIDGET (clean));
gtk_box_append (last_one, GTK_WIDGET (btt_end));
gtk_box_append (last_one, GTK_WIDGET (gtk_label_new
(" < triggers redirection to the 'SYNTY' page")));
gtk_box_append (measure_page, GTK_WIDGET (last_one));
return measure_page;
}
void *widget_measure_do_insert_in_measurements_list()
{
// printf("insert in measurements list\n");
insertion_in_list_measurements_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
insert = gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/stamp/data collection.png");
@ -100,68 +150,34 @@ void *widget_not_yet_defined()
g_signal_connect (btt_insert_in_measurements_list, "toggled",
G_CALLBACK (on_something_else), NULL);
gtk_box_append (insertion_in_list_measurements_box, GTK_WIDGET (insert));
gtk_box_append (insertion_in_list_measurements_box,
GTK_WIDGET (gtk_label_new
("Specify the frequency with which this measurement must be carried out and ")));
gtk_box_append (insertion_in_list_measurements_box, GTK_WIDGET (btt_insert_in_measurements_list));
gtk_box_append (measure_page, GTK_WIDGET (insertion_in_list_measurements_box));
return measure_page;
}
void *widget_measure_do_we_select_another_measurement()
void *widget_measure_do_correlate()
{
// printf("Could this measurement be related to another one ?\n");
correlation_measures_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
correl = gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/stamp/buoy.png");
btt_select_another_measurement_question =
gtk_toggle_button_new_with_label ("select another measurement to correlate with ?");
g_signal_connect (btt_select_another_measurement_question, "toggled",
G_CALLBACK (on_not_yet_defined), NULL);
("/home/jean/Gem-Graph/gem-graph-client/data/stamp/harbor.png");
btt_skip_this_step =
gtk_toggle_button_new_with_label ("next");
// g_signal_connect (btt_skip_this_step, "toggled", G_CALLBACK (on_skip_this_step), NULL);
gtk_box_append (correlation_measures_box, GTK_WIDGET (correl));
gtk_box_append (correlation_measures_box, GTK_WIDGET (btt_select_another_measurement_question));
gtk_box_append (correlation_measures_box,
GTK_WIDGET (gtk_label_new
("The current measurement will be inserted in the list of available measures.\n\
Two measurements or more can be selected there to study potential correlations.")));
gtk_box_append (correlation_measures_box, GTK_WIDGET (btt_skip_this_step));
gtk_box_append (measure_page, GTK_WIDGET (correlation_measures_box));
return measure_page;
}
void *widget_measure_event_occurences_nb()
{
// printf("measure event_occurences_nb\n");
prefer_add_measure ("new measure count one event occurences");
return measure_page;
}
void *widget_measure_event_occurences_dates()
{
// printf("measure event_occurences_dates\n");
prefer_add_measure ("new measure one event occurences dates");
return measure_page;
}
void *widget_measure_event_occurences_situations()
{
// printf("measure event_occurences_situations\n");
prefer_add_measure ("new measure one event occurences situations");
return measure_page;
}
void *widget_measure_time_elapsed_between_two_events()
{
// printf("measure time_elapsed_between_two_events\n");
prefer_add_measure ("new measure time elapsed between two events");
return measure_page;
}
void *widget_measure_third_event_occurences_in_between()
{
// printf("measure third_event_occurences_in_between\n");
prefer_add_measure ("new measure of the frequency of a third event\
occurring between two other events");
return measure_page;
}
void *widget_measure_do_depends_on_a_single_event()
{
gtk_box_remove (select_one_or_two_rules_events_box, GTK_WIDGET (btt_select_second_of_two));
@ -187,6 +203,7 @@ void *widget_measure_do_depends_on_a_single_event()
G_CALLBACK (on_select_a_second_measurement), NULL);
gtk_box_append (one_rule_measures_box, GTK_WIDGET (scale));
gtk_box_append (one_rule_measures_box, GTK_WIDGET (gtk_label_new (" select one > ")));
gtk_box_append (one_rule_measures_box, GTK_WIDGET (btt_select_nb));
gtk_box_append (one_rule_measures_box, GTK_WIDGET (btt_select_date));
gtk_box_append (one_rule_measures_box, GTK_WIDGET (btt_select_situation));
@ -213,9 +230,9 @@ void *widget_measure_do_select_a_second_rules_set()
void *widget_measure_do_choose_an_event_type()
{
gtk_box_remove (select_one_or_two_rules_events_box, GTK_WIDGET (btt_select_first_of_two));
// ici, il faut inactiver le btt_select_second_of_two
// ici, il faudrait inactiver le btt_select_second_of_two
gtk_box_append (select_second_rules_set_box,
gtk_toggle_button_new_with_label ("< done > a second set of rules was selected"));
gtk_label_new (" < done. A second set of rules was selected"));
two_rules_measures_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
bridge = gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/stamp/measure temperature icon.png");
@ -232,6 +249,7 @@ void *widget_measure_do_choose_an_event_type()
G_CALLBACK (on_select_a_second_measurement), NULL);
gtk_box_append (two_rules_measures_box, GTK_WIDGET (bridge));
gtk_box_append (two_rules_measures_box, GTK_WIDGET (gtk_label_new (" select one > ")));
gtk_box_append (two_rules_measures_box, GTK_WIDGET (btt_time_elapsed));
gtk_box_append (two_rules_measures_box, GTK_WIDGET (btt_event_in_between));
gtk_box_append (measure_page, GTK_WIDGET (two_rules_measures_box));
@ -241,8 +259,8 @@ void *widget_measure_do_choose_an_event_type()
void *widget_measure_do_depends_on_one_or_two_events()
{
gtk_box_append (select_rules_first_box,
gtk_toggle_button_new_with_label ("< done > a set of rules was selected"));
// ici, il faut inactiver le btt_select_rules_first
gtk_label_new ("< done. A set of rules was selected"));
// ici, il faudrait inactiver le btt_select_rules_first
select_one_or_two_rules_events_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
balance = gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/stamp/balance icon.png");

View File

@ -34,15 +34,14 @@
// "graph", "chart", "plot" and "diagram" are ambiguous terms, sometimes used interchangeably.
// https://www.mathsisfun.com/data/data-graph.php
#define PARTITION_700 700
void *widget_get_data_page()
{
GtkWidget *measures_and_results = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
gtk_paned_set_start_child (GTK_PANED(measures_and_results), GTK_WIDGET (widget_get_measures_page()));
gtk_paned_set_end_child (GTK_PANED(measures_and_results), GTK_WIDGET (widget_get_results_page()));
gtk_paned_set_position (GTK_PANED (measures_and_results), PARTITION_700);
gtk_paned_set_start_child (GTK_PANED(measures_and_results), GTK_WIDGET (widget_get_organize_results_box()));
gtk_paned_set_end_child (GTK_PANED(measures_and_results), GTK_WIDGET (widget_get_display_results_box()));
gtk_paned_set_position (GTK_PANED (measures_and_results), H_PARTITION_RESULTS);
gtk_paned_set_shrink_start_child (GTK_PANED (measures_and_results), FALSE);
gtk_paned_set_shrink_end_child (GTK_PANED (measures_and_results), FALSE);

View File

@ -31,28 +31,37 @@
#include "../../../include/signal.h"
#include "../../../include/widget.h"
void *widget_get_results_page () {
void *widget_get_time_results_box () {
GtkBox *time_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
gtk_box_append (time_box, GTK_WIDGET (gtk_button_new_with_label ("\n a widget\n\
intended to\n modulate\n the look of\n the various\n represented\n flows\n")));
gtk_box_append (time_box, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/data évolutions parallèles (n > 30) étendu.png")));
return GTK_WIDGET (time_box);
}
void *widget_get_display_results_box () {
GtkBox *data_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
GtkWidget* frame_data_type = gtk_frame_new ("about the fsm / about the model");
GtkBox *data_type_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_frame_set_child (GTK_FRAME (frame_data_type), GTK_WIDGET (data_type_box));
gtk_box_append (data_box, GTK_WIDGET (frame_data_type));
gtk_box_append (data_type_box, gtk_button_new_with_label ("evolutions"));
gtk_box_append (data_type_box, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/data évolutions parallèles (n > 30) étendu.png")));
gtk_box_append (data_type_box, gtk_button_new_with_label ("repartitions (1D, 2D)"));
gtk_box_append (data_type_box, GTK_WIDGET (gtk_picture_new_for_filename
gtk_box_append (data_box, gtk_button_new_with_label ("repartitions (1D, 2D)"));
gtk_box_append (data_box, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/data bar graph vertical.png")));
gtk_box_append (data_type_box, gtk_button_new_with_label ("correlations"));
gtk_box_append (data_type_box, GTK_WIDGET (gtk_picture_new_for_filename
gtk_box_append (data_box, gtk_button_new_with_label ("correlations"));
gtk_box_append (data_box, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/data correlations (4, horizontal).png")));
gtk_widget_set_size_request (GTK_WIDGET (data_box), 1800, 700); // provisoire TODO
gtk_box_append (data_box, gtk_button_new_with_label ("evolutions"));
GtkBox *scroll_bar_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (scroll_bar_box, GTK_WIDGET(gtk_label_new ("\
a scroll bar allowing to detail the data along the time elapsed during the simulation")));
gtk_box_append (scroll_bar_box, GTK_WIDGET (gtk_progress_bar_new ()));
GtkAdjustment *adjust = gtk_adjustment_new (30, 0, 100, 1, 0, 0);
gtk_box_append (data_box, GTK_WIDGET (widget_get_time_results_box ()));
gtk_box_append (scroll_bar_box,
GTK_WIDGET (gtk_scrollbar_new (GTK_ORIENTATION_HORIZONTAL, adjust)));
gtk_box_append (data_box, GTK_WIDGET (scroll_bar_box));
return GTK_WIDGET (data_box);
}
@ -66,7 +75,9 @@ void *widget_get_results_page () {
/******************************************************************************/
/*
/* names
(propositions)
"rule effect"
"rule topic"
"data type"

View File

@ -0,0 +1,62 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
* *
* Gem-graph client *
* *
* Stock *
* *
* Copyright © 2021 Libre en Communs <contact@a-lec.org> *
* Copyright © 2021 Jean Sirmai <jean@a-lec.org> *
* *
* This file is part of Gem-graph. *
* *
* 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 <http://www.gnu.org/licenses/>. *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../../include/base.h"
#include "../../../include/signal.h"
#include "../../../include/widget.h"
void *widget_get_organize_results_box ()
{
GtkBox *all_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
GtkBox *ad_hoc_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (ad_hoc_box, gtk_button_new_with_label ("\n\n\n\n\n\n \
\
"));
GtkBox *front_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (front_box, gtk_button_new_with_label ("\n how should \n\
the sequence \n from measurements\n to results presentation \n\
be organized\n ?"));
GtkBox *access_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (access_box, gtk_button_new_with_label ("measurements\
activate or create mesurement tools \
"));
gtk_box_append (access_box, gtk_button_new_with_label ("measures\
apply a mesurement tool to a situation to create a data flow\
"));
gtk_box_append (access_box, gtk_button_new_with_label ("results\
get some results and operate on them (filter, concat, analyze, transform, etc.)"));
gtk_box_append (access_box, gtk_button_new_with_label ("presentation\
display (plot) results and tune the chart (graph, diagram) appearance\
"));
gtk_box_append (all_box, GTK_WIDGET (ad_hoc_box));
gtk_box_append (all_box, GTK_WIDGET (front_box));
gtk_box_append (all_box, GTK_WIDGET (access_box));
return GTK_WIDGET (all_box);
}

View File

@ -171,7 +171,8 @@ void *widget_get_an_impression_of_what_a_rules_comparator_could_be(){
push(&stack_b, GTK_WIDGET (gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/folic acid.png")));
printf(" --------- \n");//%d\n", *stack_b->arr[0]);
printf(" ---------\
widget/rules/tree_tools/compare.c widget_get_an_impression_of_...()\n");//%d\n", *stack_b->arr[0]);
// peek(&stack_b);
// gtk_box_append (compare_left, peek(&stack_b));
@ -209,12 +210,12 @@ static GtkWidget *do_rtfd (Stack stack) // TODO
// it works !!! >>> GIcon *hello_dream = G_ICON (image_insuline);
//
GtkWidget *widget_insuline = GTK_WIDGET (image_insuline);
if (image_insuline_storage_type == GTK_IMAGE_ICON_NAME)
printf("insuline image now at : %p storage_type : %s\n",
if (0 && image_insuline_storage_type == GTK_IMAGE_ICON_NAME)
printf("src/widget/rules/tree_tools/compare.c do_rtfd() insuline image now at : %p storage_type : %s\n",
&image_insuline, "GTK_IMAGE_ICON_NAME");
push_images_onto_stack (stack); // totalement inutile ici
push_images_onto_stack (stack); // totalement inutile ici
// peek (NULL); // idem + Erreur de segmentation
// free_intlist (NULL); // idem
// add_to_mylist (0); // idem

View File

@ -52,15 +52,12 @@
/******************************************************************************/
#define PARTITION_SPACE_VS_CONTROLS_1 920
#define PARTITION_SPACE_VS_CONTROLS_2 800
void *widget_get_state_page()
{
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (page_box, GTK_WIDGET (widget_get_graph_view_control()));
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
gtk_box_append (page_box, GTK_WIDGET (widget_get_space_view()));
gtk_box_append (page_box, GTK_WIDGET (widget_get_space_view(PARTITION_SPACE_VS_CAMERA_IN_STATE)));
gtk_box_append (page_box, GTK_WIDGET (gtk_separator_new (GTK_ORIENTATION_HORIZONTAL)));
GtkWidget *view_space_vs_controls = gtk_paned_new (GTK_ORIENTATION_VERTICAL);

View File

@ -57,7 +57,7 @@ static void *get_XYZ_box()
GtkWidget *scroll_X = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, X_adjust);
GtkWidget *scroll_Y = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, Y_adjust);
GtkWidget *scroll_Z = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, Z_adjust);
gtk_widget_set_size_request (GTK_WIDGET (scroll_X), 1, H_XYZ_BOX); // (provisoire) TODO
gtk_widget_set_size_request (GTK_WIDGET (XYZ_scrollbar_box), W_XYZ_BOX, H_XYZ_BOX); // (provisoire) TODO
gtk_box_append (XYZ_scrollbar_box, GTK_WIDGET (gtk_label_new (" "))); // AD HOC (pour "centrer")
gtk_box_append (XYZ_scrollbar_box, scroll_X);
@ -73,23 +73,23 @@ static void *get_XYZ_box()
gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new ("\nX Y Z")));
gtk_box_append (XYZ_labels_box, GTK_WIDGET (XYZ_scrollbar_box));
gtk_box_append (XYZ_labels_box, GTK_WIDGET (btt_reset));
gtk_box_append (XYZ_labels_box, GTK_WIDGET (gtk_label_new ("")));
return XYZ_labels_box;
}
static void *get_ZOOM_box()
{
GtkBox *ZOOM_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
GtkWidget *ZOOM_Label = GTK_WIDGET (gtk_label_new (\
"\n TOOLS\n ---\n zoom\n ---\n space\n struct.\n\
---\n arrows\n struct.\n ---\n orient\n state\n in space\n"));
GtkWidget *ZOOM_Label = GTK_WIDGET (gtk_label_new (
"\n TOOLS\n\
---\n zoom\n\
---\n space\n struct.\n\
---\n arrows\n struct.\n\
---\n orient\n state\n in\n space\n"));
gtk_box_append (ZOOM_box, ZOOM_Label);
return ZOOM_box;
}
#define PARTITION_SPACE_VS_CAMERA 1860
void *widget_get_space_view()
void *widget_get_space_view(int partition_space_vs_camera)
{
GtkBox *E_coli = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
gtk_box_append (GTK_BOX (E_coli), GTK_WIDGET (gtk_picture_new_for_filename
@ -108,15 +108,11 @@ void *widget_get_space_view()
gtk_paned_set_end_child (GTK_PANED (view_space_vs_camera), GTK_WIDGET (camera));
gtk_paned_set_shrink_start_child (GTK_PANED (view_space_vs_camera), FALSE);
gtk_paned_set_shrink_end_child (GTK_PANED (view_space_vs_camera), FALSE);
gtk_paned_set_position (GTK_PANED (view_space_vs_camera), PARTITION_SPACE_VS_CAMERA);
gtk_paned_set_position (GTK_PANED (view_space_vs_camera), partition_space_vs_camera);
/* GtkBox *un_essai = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6));
gtk_box_append (GTK_BOX (un_essai), GTK_WIDGET (E_coli));
gtk_box_append (GTK_BOX (un_essai), GTK_WIDGET (camera));
return GTK_WIDGET (un_essai); <<< Ça devrait suffire ? */
return GTK_WIDGET (view_space_vs_camera);
}

View File

@ -182,7 +182,6 @@ static void *get_situations_box()
/* S T A T E p a g e > t o p l e v e l b o x */
/******************************************************************************/
#define PARTITION_STATE_TOP 600
void *widget_get_graph_view_control()
{

View File

@ -47,16 +47,15 @@ static void *widget_get_non_time_dependent_analysis_elements() // for fun !
return results_box;
}
#define PARTITION_SYNTH 1540
static void *widget_get_space_vs_non_time_dependent_analysis()
{
GtkWidget *space_vs_non_time_dependent_analysis = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
gtk_paned_set_start_child (GTK_PANED (space_vs_non_time_dependent_analysis),
GTK_WIDGET (widget_get_space_view()));
GTK_WIDGET (widget_get_space_view(PARTITION_SPACE_VS_CAMERA_IN_SYNTH)));
gtk_paned_set_end_child (GTK_PANED (space_vs_non_time_dependent_analysis),
GTK_WIDGET (widget_get_non_time_dependent_analysis_elements()));
gtk_paned_set_position (GTK_PANED (space_vs_non_time_dependent_analysis), PARTITION_SYNTH);
gtk_paned_set_position (GTK_PANED (space_vs_non_time_dependent_analysis), H_PARTITION_SYNTH);
gtk_paned_set_shrink_start_child (GTK_PANED (space_vs_non_time_dependent_analysis), FALSE);
gtk_paned_set_shrink_end_child (GTK_PANED (space_vs_non_time_dependent_analysis), FALSE); // TRUE
@ -70,7 +69,7 @@ void *widget_get_synth_page()
GTK_WIDGET (widget_get_space_vs_non_time_dependent_analysis()));
gtk_paned_set_end_child (GTK_PANED (space_and_analysis_vs_history),
GTK_WIDGET (widget_get_time_dependent_results_and_time_controls()));
gtk_paned_set_position (GTK_PANED (space_and_analysis_vs_history), PARTITION_SYNTH);
gtk_paned_set_position (GTK_PANED (space_and_analysis_vs_history), W_PARTITION_SYNTH);
gtk_paned_set_shrink_start_child (GTK_PANED (space_and_analysis_vs_history), FALSE);
gtk_paned_set_shrink_end_child (GTK_PANED (space_and_analysis_vs_history), FALSE);
gtk_widget_set_size_request (space_and_analysis_vs_history, 0, H_MY_SCREEN); // OK (required))
@ -126,3 +125,4 @@ src/widget/synth/dispatch.c: gtk_paned_set_shrink_end_child (GTK_
*/

View File

@ -35,8 +35,7 @@ void *widget_get_time_dependent_results_and_time_controls()
{
GtkBox *time_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
gtk_box_append (time_box, GTK_WIDGET(widget_get_sequence_control()));
gtk_box_append (time_box, GTK_WIDGET(gtk_picture_new_for_filename
("/home/jean/Gem-Graph/gem-graph-client/data/image/data évolutions parallèles (n > 30) étendu.png")));
gtk_box_append (time_box, GTK_WIDGET (widget_get_time_results_box ()));
return time_box;
}

View File

@ -46,16 +46,6 @@ void widget_design_main_window (GtkWindow *main_window)
window_design_topbar_left (topbar);
window_design_topbar_right (topbar);
// use the next lineS to select the page that will be presented first
// it triggers <=> signal.on_toggle_state_rule_data (a btt_NAME)
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_rules()), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_state()), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_data()), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_synth()), TRUE);
// THE LAST ONE IS THE WINNER (AND THE WINNER TAKES IT ALL !...)
gtk_window_present (GTK_WINDOW (main_window));
}

View File

@ -81,6 +81,23 @@ void window_design_topbar_left (GtkWidget *header_bar)
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_RULES));
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar), GTK_WIDGET (btt_DATA));
/******************************************************************************/
/* use the next lineS to select the page that will be presented first */
/* it triggers <=> signal.on_toggle_state_rule_data (a btt_NAME) */
/* and remember: */
/* the last one is the winner (and the winner takes it all !...) */
/* THE LAST ONE IS THE WINNER (AND THE WINNER TAKES IT ALL !...) */
/******************************************************************************/
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_rules()), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_state()), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_data()), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_synth()), TRUE);
}

View File

@ -28,7 +28,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "../../../include/base.h"
#include "../../../include/util.h"
#include "../../../include/signal.h"
#include "../../../include/widget.h"
@ -59,7 +59,7 @@ void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window)
void *widget_get_text_from_address (gchar *text_address) {
GtkWidget *view = gtk_text_view_new ();
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_buffer_set_text (buffer, read_file (text_address), -1);
gtk_text_buffer_set_text (buffer, util_read_file (text_address), -1);
gtk_text_buffer_set_modified (buffer, FALSE);
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (gtk_scrolled_window_new());