https://chgi.developpez.com/liste/ < ^c^v > OK
This commit is contained in:
parent
85754fc91c
commit
085b165a6a
|
@ -38,19 +38,19 @@
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
// called by widgets through signal functions
|
// called by widgets through signal functions
|
||||||
|
|
||||||
enum fsm_choice_EXEC_EDIT { EXEC, EDIT }; // xor
|
enum fsm_choice_EXEC_EDIT { EXEC, EDIT };
|
||||||
enum fsm_choice_STATE_RULES_DATA { SYNTH, STATE, RULES, DATA }; // xor
|
enum fsm_choice_STATE_RULES_DATA { SYNTH, STATE, RULES, DATA };
|
||||||
enum fsm_choice_STORE_RESTORE_RESET { STORE, RESTORE, RESET }; // xor
|
enum fsm_choice_STORE_RESTORE_RESET { STORE, RESTORE, RESET };
|
||||||
|
|
||||||
|
|
||||||
#define n_rules 128 // arbitrary
|
#define n_rules 128 // arbitrary
|
||||||
#define n_objects 32 // arbitrary too,
|
#define n_objects 32 // arbitrary too,
|
||||||
#define n_situations 128 // and so on...
|
#define n_situations 128 // and so on...
|
||||||
|
|
||||||
bool fsm_init(); // def: fsm/dispatch; call: main;
|
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; call: fsm/dispatch;
|
void fsm_measures_list_init(); // def: fsm/measure; call: fsm/dispatch;
|
||||||
void fsm_results_list_init(); // def: fsm/results; call: fsm/dispatch;
|
void fsm_results_list_init(); // def: fsm/results; call: fsm/dispatch;
|
||||||
void fsm_preferences_init(); // def: fsm/prefer; call: fsm/dispatch;
|
|
||||||
void fsm_displayable_list_init(); // def: fsm/prefer; call: fsm/dispatch;
|
void fsm_displayable_list_init(); // def: fsm/prefer; call: fsm/dispatch;
|
||||||
|
|
||||||
int fsm_get_exec_edit(); // def: fsm/dispatch; call: signal;
|
int fsm_get_exec_edit(); // def: fsm/dispatch; call: signal;
|
||||||
|
@ -75,7 +75,8 @@ void fsm_reset_all_situations_transparencies_at_value (int value); // provisoire
|
||||||
// def: fsm/prefer; call: signal;
|
// def: fsm/prefer; call: signal;
|
||||||
|
|
||||||
|
|
||||||
void fsm_debug (int choice, int value, char *string, int sub_automaton);
|
void fsm_debug_msg (int choice, int value, char *string, int sub_automaton);
|
||||||
// def: fsm/dispatch; call: fsm/dispatch;
|
// def: fsm/dispatch; call: fsm/dispatch;
|
||||||
// fsm/measure;
|
// fsm/measure;
|
||||||
// fsm/result;
|
// fsm/result;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* *
|
||||||
|
* 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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// https://chgi.developpez.com/liste/ < ^c^v
|
||||||
|
|
||||||
|
|
||||||
|
/* Structure représentant un élément de la pile. */
|
||||||
|
|
||||||
|
typedef struct pile
|
||||||
|
{
|
||||||
|
int valeur;
|
||||||
|
struct pile *prec;
|
||||||
|
} pile ;
|
||||||
|
|
||||||
|
|
||||||
|
/* Push empile une valeur sur la pile. */
|
||||||
|
|
||||||
|
void Push(pile **, int);
|
||||||
|
|
||||||
|
|
||||||
|
/* Pop retire la dernière valeur empilée sur la pile. */
|
||||||
|
|
||||||
|
int Pop(pile **);
|
||||||
|
|
||||||
|
|
||||||
|
/* Clear vide la pile. */
|
||||||
|
|
||||||
|
void Clear(pile **);
|
||||||
|
|
||||||
|
|
||||||
|
/* Length retourne le nombre d'éléments de la pile. */
|
||||||
|
|
||||||
|
int Length(pile *p);
|
||||||
|
|
||||||
|
|
||||||
|
/* Affiche la totalité de la pile en commençant par le sommet. */
|
||||||
|
|
||||||
|
void View(pile *);
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ void widget_design_text_window (GtkWindow *main_window, GtkWindow *text_window
|
||||||
#define W_IMAGE_100 100
|
#define W_IMAGE_100 100
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* T O P B A R */
|
/* T O P B A R */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -117,6 +118,9 @@ void *widget_get_measure_page();// in : widget / measure / dispatch.c
|
||||||
// repartitions.c WIP
|
// repartitions.c WIP
|
||||||
// correlations.c WIP
|
// correlations.c WIP
|
||||||
|
|
||||||
|
#define H_PARTITION_SYNTH 1600
|
||||||
|
#define W_PARTITION_SYNTH 400
|
||||||
|
|
||||||
void *widget_get_time_dependent_results_and_time_controls();
|
void *widget_get_time_dependent_results_and_time_controls();
|
||||||
// *widget_get_space_vs_non_time_dependent_analysis(); WIP
|
// *widget_get_space_vs_non_time_dependent_analysis(); WIP
|
||||||
// *widget_get_non_time_dependent_analysis_elements(); WIP
|
// *widget_get_non_time_dependent_analysis_elements(); WIP
|
||||||
|
@ -129,6 +133,9 @@ void *widget_get_time_dependent_results_and_time_controls();
|
||||||
// defined in : widget / state / middle
|
// defined in : widget / state / middle
|
||||||
// defined in : widget / state / bottom
|
// defined in : widget / state / bottom
|
||||||
|
|
||||||
|
#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_STATE 1850
|
||||||
#define PARTITION_SPACE_VS_CAMERA_IN_SYNTH 1560
|
#define PARTITION_SPACE_VS_CAMERA_IN_SYNTH 1560
|
||||||
|
|
||||||
|
@ -198,6 +205,8 @@ void *widget_get_selected_rule_images();
|
||||||
// defined in : widget / results / organize.c
|
// defined in : widget / results / organize.c
|
||||||
// display.c
|
// display.c
|
||||||
|
|
||||||
|
#define H_PARTITION_RESULTS 140
|
||||||
|
|
||||||
void *widget_get_organize_results_box();
|
void *widget_get_organize_results_box();
|
||||||
void *widget_get_display_results_box();
|
void *widget_get_display_results_box();
|
||||||
void *widget_get_time_results_box ();
|
void *widget_get_time_results_box ();
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
/* FF SS SS MMMM MMMM */
|
/* FF SS SS MMMM MMMM */
|
||||||
/* FF SS MM MM MM MM */
|
/* FF SS MM MM MM MM */
|
||||||
/* FFFFFFF SS MM MM MM MM */
|
/* FFFFFFF SS MM MM MM MM */
|
||||||
/* FF SS MM MM MM */
|
/* FF SS MM MMM MM */
|
||||||
/* FF SS MM MM */
|
/* FF SS MM MM */
|
||||||
/* FF SS SS MM MM */
|
/* FF SS SS MM MM */
|
||||||
/* FF SSSSS MM MM */
|
/* FF SSSSS MM MM */
|
||||||
|
@ -60,13 +60,12 @@
|
||||||
/* F S M I N I T */
|
/* F S M I N I T */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
bool fsm_init ()
|
void fsm_init()
|
||||||
{
|
{
|
||||||
fsm_measures_list_init ();
|
fsm_measures_list_init();
|
||||||
fsm_results_list_init ();
|
fsm_results_list_init();
|
||||||
fsm_displayable_list_init ();
|
fsm_displayable_list_init();
|
||||||
fsm_preferences_init ();
|
fsm_preferences_init();
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,7 +76,7 @@ bool fsm_init ()
|
||||||
static int preferences_have_been_modified = FALSE;
|
static int preferences_have_been_modified = FALSE;
|
||||||
|
|
||||||
void fsm_set_preferences_state (bool value) {preferences_have_been_modified = value;}
|
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
|
// preferences_have_been_modified
|
||||||
// and should be stored before closing the current session. TODO
|
// and should be stored before closing the current session. TODO
|
||||||
|
|
||||||
|
@ -85,8 +84,8 @@ bool fsm_get_preferences_state () {return preferences_have_been_modified;}
|
||||||
static int choice_EXEC_EDIT = EXEC;
|
static int choice_EXEC_EDIT = EXEC;
|
||||||
static int choice_STATE_RULES_DATA = STATE;
|
static int choice_STATE_RULES_DATA = STATE;
|
||||||
|
|
||||||
int fsm_get_exec_edit () {return choice_EXEC_EDIT;}
|
int fsm_get_exec_edit() {return choice_EXEC_EDIT;}
|
||||||
int fsm_get_state_rules_data () {return choice_STATE_RULES_DATA;}
|
int fsm_get_state_rules_data() {return choice_STATE_RULES_DATA;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -97,7 +96,7 @@ int fsm_get_state_rules_data () {return choice_STATE_RULES_DATA;}
|
||||||
void fsm_set_exec_edit (int choice)
|
void fsm_set_exec_edit (int choice)
|
||||||
{
|
{
|
||||||
if (choice_EXEC_EDIT != choice) {
|
if (choice_EXEC_EDIT != choice) {
|
||||||
fsm_debug (choice, 0, "", 0); // EXEC_EDIT is sub_automaton 0
|
fsm_debug_msg (choice, 0, "", 0); // EXEC_EDIT is sub_automaton 0
|
||||||
choice_EXEC_EDIT = choice;
|
choice_EXEC_EDIT = choice;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,7 +104,7 @@ void fsm_set_exec_edit (int choice)
|
||||||
void fsm_set_state_rules_data (int choice)
|
void fsm_set_state_rules_data (int choice)
|
||||||
{
|
{
|
||||||
if (choice_STATE_RULES_DATA != choice) {
|
if (choice_STATE_RULES_DATA != choice) {
|
||||||
fsm_debug (choice, 0, "", 1); // STATE_RULES_DATA is sub_automaton 1
|
fsm_debug_msg (choice, 0, "", 1); // STATE_RULES_DATA is sub_automaton 1
|
||||||
choice_STATE_RULES_DATA = choice;
|
choice_STATE_RULES_DATA = choice;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,33 +117,29 @@ void fsm_set_state_rules_data (int choice)
|
||||||
static char *tab_0 [] = { "EXEC", "EDIT" };
|
static char *tab_0 [] = { "EXEC", "EDIT" };
|
||||||
static char *tab_1 [] = { "SYNTH", "STATE", "RULES", "DATA" };
|
static char *tab_1 [] = { "SYNTH", "STATE", "RULES", "DATA" };
|
||||||
|
|
||||||
void fsm_debug (int choice, int value, char *string, int sub_automaton)
|
void fsm_debug_msg (int choice, int value, char *string, int sub_automaton)
|
||||||
{
|
{
|
||||||
switch (sub_automaton) { // sub_automaton 0 is EXEC_EDIT and
|
switch (sub_automaton) { // sub_automaton 0 is EXEC_EDIT and
|
||||||
// sub_automaton 1 is STATE_RULES_DATA
|
// sub_automaton 1 is STATE_RULES_DATA
|
||||||
// sub_automaton 2 is MEASURE
|
// sub_automaton 2 is MEASURE
|
||||||
case (0) : printf("switch %5s x %5s > %5s x %5s\n",
|
case (0) : printf ("switch %5s x %5s > %5s x %5s\n",
|
||||||
tab_0 [choice_EXEC_EDIT],
|
tab_0 [choice_EXEC_EDIT], tab_1 [choice_STATE_RULES_DATA],
|
||||||
tab_1 [choice_STATE_RULES_DATA],
|
tab_0 [choice], tab_1 [choice_STATE_RULES_DATA]);
|
||||||
tab_0 [choice],
|
|
||||||
tab_1 [choice_STATE_RULES_DATA]);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (1) : printf("switch %5s x %5s > %5s x %5s\n",
|
case (1) : printf ("switch %5s x %5s > %5s x %5s\n",
|
||||||
tab_0 [choice_EXEC_EDIT],
|
tab_0 [choice_EXEC_EDIT], tab_1 [choice_STATE_RULES_DATA],
|
||||||
tab_1 [choice_STATE_RULES_DATA],
|
tab_0 [choice_EXEC_EDIT], tab_1 [choice]);
|
||||||
tab_0 [choice_EXEC_EDIT],
|
|
||||||
tab_1 [choice]);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (2) : printf("fsm <> %s\n", string);
|
case (2) : printf ("fsm <> %s\n", string);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (3) : printf("fsm debug <> %2d\n", choice);
|
case (3) : printf ("fsm debug <> %2d\n", choice);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
default : printf("default in fsm/dispatch.fsm_debug()\n");
|
default : printf ("default in fsm/dispatch.fsm_debug_msg()\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "../../include/fsm.h"
|
#include "../../include/fsm.h"
|
||||||
|
#include "../../include/util.h"
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
|
@ -96,124 +97,51 @@
|
||||||
// - pointeur vers des données, des représentations de données ?
|
// - pointeur vers des données, des représentations de données ?
|
||||||
|
|
||||||
|
|
||||||
void fsm_add_measure (char *measure_name) {fsm_debug (2, 0, measure_name, 2);}
|
void fsm_add_measure (char *measure_name) {fsm_debug_msg (2, 0, measure_name, 2);}
|
||||||
|
|
||||||
void fsm_measures_list_init ()
|
void fsm_measures_list_init ()
|
||||||
{
|
{
|
||||||
fsm_debug (0,0, "fsm_measures_list_init()", 2); // sub_automaton 2
|
fsm_debug_msg (0,0, "fsm_measures_list_init()", 2); // sub_automaton 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// https://chgi.developpez.com/liste/ < ^c^v
|
||||||
|
|
||||||
|
|
||||||
|
pile *MaPile = NULL; /* Impératif de l'initialiser à NULL */
|
||||||
|
|
||||||
|
Push(&MaPile, 10);
|
||||||
|
Push(&MaPile, 25);
|
||||||
|
Push(&MaPile, 33);
|
||||||
|
Push(&MaPile, 12); /* Empile 4 valeurs. */
|
||||||
|
|
||||||
|
puts("Affichage de la pile :");
|
||||||
|
View(MaPile); /* Affiche la totalité de la pile. */
|
||||||
|
puts("------");
|
||||||
|
|
||||||
|
printf("Nb d'elements : %d\n",Length(MaPile));
|
||||||
|
puts("------");
|
||||||
|
|
||||||
|
puts("Deux valeurs soutirees de la pile :");
|
||||||
|
printf("%d\n",Pop(&MaPile)); /* Affiche deux valeurs */
|
||||||
|
printf("%d\n",Pop(&MaPile)); /* soutirées de la pile. */
|
||||||
|
puts("------");
|
||||||
|
|
||||||
|
puts("Affichage de la pile :");
|
||||||
|
View(MaPile); /* Affiche la totalité de la pile. */
|
||||||
|
puts("------");
|
||||||
|
|
||||||
|
Clear(&MaPile); /* Vide la pile. */
|
||||||
|
|
||||||
|
Push(&MaPile, 18); /* Empile une valeur. */
|
||||||
|
|
||||||
|
puts("Affichage de la pile apres vidage et ajout d'une valeur :");
|
||||||
|
View(MaPile); /* Affiche la totalité de la pile. */
|
||||||
|
puts("------\n");
|
||||||
|
|
||||||
|
Clear(&MaPile); /* Vider la pile avant de quitter. */
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
//------------------------------------------------------------------------------'
|
|
||||||
// https://chgi.developpez.com/liste/ < a l'air plutôt bien fait
|
|
||||||
// https://learntutorials.net/fr/c/topic/560/listes-liees < ^c^v vvv
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct doubly_node
|
|
||||||
{
|
|
||||||
struct doubly_node * prev;
|
|
||||||
struct doubly_node * next;
|
|
||||||
};
|
|
||||||
|
|
||||||
void doubly_node_bind (struct doubly_node * prev, struct doubly_node * next)
|
|
||||||
{
|
|
||||||
prev->next = next;
|
|
||||||
next->prev = prev;
|
|
||||||
}
|
|
||||||
|
|
||||||
void doubly_node_make_empty_circularly_list (struct doubly_node * head)
|
|
||||||
{
|
|
||||||
doubly_node_bind (head, head);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doubly_node_insert_between
|
|
||||||
(struct doubly_node * prev, struct doubly_node * next, struct doubly_node * insertion)
|
|
||||||
{
|
|
||||||
doubly_node_bind (prev, insertion);
|
|
||||||
doubly_node_bind (insertion, next);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doubly_node_insert_before
|
|
||||||
(struct doubly_node * tail, struct doubly_node * insertion)
|
|
||||||
{
|
|
||||||
doubly_node_insert_between (tail->prev, tail, insertion);
|
|
||||||
}
|
|
||||||
|
|
||||||
void doubly_node_insert_after
|
|
||||||
(struct doubly_node * head, struct doubly_node * insertion)
|
|
||||||
{
|
|
||||||
doubly_node_insert_between (head, head->next, insertion);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Node {
|
|
||||||
int data;
|
|
||||||
struct Node *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
void insert_node (struct Node **head, int nodeValue);
|
|
||||||
void print_list (struct Node *head);
|
|
||||||
|
|
||||||
int any () {
|
|
||||||
struct Node* headNode;
|
|
||||||
headNode = NULL; /* Initialize our first node pointer to be NULL. */
|
|
||||||
size_t listSize, i;
|
|
||||||
do {
|
|
||||||
printf("How many numbers would you like to input?\n");
|
|
||||||
} while(1 != scanf("%zu", &listSize));
|
|
||||||
|
|
||||||
for (i = 0; i < listSize; i++) {
|
|
||||||
int numToAdd;
|
|
||||||
do {
|
|
||||||
printf("Enter a number:\n");
|
|
||||||
} while (1 != scanf("%d", &numToAdd));
|
|
||||||
|
|
||||||
insert_node (&headNode, numToAdd);
|
|
||||||
printf("Current list after your inserted node: \n");
|
|
||||||
print_list(headNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void print_list (struct Node *head) {
|
|
||||||
struct Node* currentNode = head;
|
|
||||||
|
|
||||||
/* Iterate through each link. */
|
|
||||||
while (currentNode != NULL) {
|
|
||||||
printf("Value: %d\n", currentNode->data);
|
|
||||||
currentNode = currentNode -> next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void insert_node (struct Node **head, int nodeValue) {
|
|
||||||
struct Node *currentNode = malloc(sizeof *currentNode);
|
|
||||||
currentNode->data = nodeValue;
|
|
||||||
currentNode->next = (*head);
|
|
||||||
|
|
||||||
*head = currentNode;
|
|
||||||
}
|
|
||||||
|
|
|
@ -74,6 +74,6 @@ void fsm_add_result (char *result_name)
|
||||||
|
|
||||||
void fsm_results_list_init ()
|
void fsm_results_list_init ()
|
||||||
{
|
{
|
||||||
fsm_debug (0,0, "fsm_results_list_init()", 2); // sub_automaton 2
|
fsm_debug_msg (0,0, "fsm_results_list_init()", 2); // sub_automaton 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,146 @@
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* *
|
||||||
|
* 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 <stdbool.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// https://learntutorials.net/fr/c/topic/560/listes-liees < ^c^v vvv
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct doubly_node
|
||||||
|
{
|
||||||
|
struct doubly_node * prev;
|
||||||
|
struct doubly_node * next;
|
||||||
|
};
|
||||||
|
|
||||||
|
void doubly_node_bind (struct doubly_node * prev, struct doubly_node * next)
|
||||||
|
{
|
||||||
|
prev->next = next;
|
||||||
|
next->prev = prev;
|
||||||
|
}
|
||||||
|
|
||||||
|
void doubly_node_make_empty_circularly_list (struct doubly_node * head)
|
||||||
|
{
|
||||||
|
doubly_node_bind (head, head);
|
||||||
|
}
|
||||||
|
|
||||||
|
void doubly_node_insert_between
|
||||||
|
(struct doubly_node * prev, struct doubly_node * next, struct doubly_node * insertion)
|
||||||
|
{
|
||||||
|
doubly_node_bind (prev, insertion);
|
||||||
|
doubly_node_bind (insertion, next);
|
||||||
|
}
|
||||||
|
|
||||||
|
void doubly_node_insert_before
|
||||||
|
(struct doubly_node * tail, struct doubly_node * insertion)
|
||||||
|
{
|
||||||
|
doubly_node_insert_between (tail->prev, tail, insertion);
|
||||||
|
}
|
||||||
|
|
||||||
|
void doubly_node_insert_after
|
||||||
|
(struct doubly_node * head, struct doubly_node * insertion)
|
||||||
|
{
|
||||||
|
doubly_node_insert_between (head, head->next, insertion);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Node {
|
||||||
|
int data;
|
||||||
|
struct Node *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void insert_node (struct Node **head, int nodeValue);
|
||||||
|
void print_list (struct Node *head);
|
||||||
|
|
||||||
|
int any () {
|
||||||
|
struct Node* headNode;
|
||||||
|
headNode = NULL; /* Initialize our first node pointer to be NULL. */
|
||||||
|
size_t listSize, i;
|
||||||
|
do {
|
||||||
|
printf("How many numbers would you like to input?\n");
|
||||||
|
} while(1 != scanf("%zu", &listSize));
|
||||||
|
|
||||||
|
for (i = 0; i < listSize; i++) {
|
||||||
|
int numToAdd;
|
||||||
|
do {
|
||||||
|
printf("Enter a number:\n");
|
||||||
|
} while (1 != scanf("%d", &numToAdd));
|
||||||
|
|
||||||
|
insert_node (&headNode, numToAdd);
|
||||||
|
printf("Current list after your inserted node: \n");
|
||||||
|
print_list(headNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void print_list (struct Node *head) {
|
||||||
|
struct Node* currentNode = head;
|
||||||
|
|
||||||
|
/* Iterate through each link. */
|
||||||
|
while (currentNode != NULL) {
|
||||||
|
printf("Value: %d\n", currentNode->data);
|
||||||
|
currentNode = currentNode -> next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void insert_node (struct Node **head, int nodeValue) {
|
||||||
|
struct Node *currentNode = malloc(sizeof *currentNode);
|
||||||
|
currentNode->data = nodeValue;
|
||||||
|
currentNode->next = (*head);
|
||||||
|
|
||||||
|
*head = currentNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,104 @@
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* *
|
||||||
|
* 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 <stdbool.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <gtk-4.0/gtk/gtk.h>
|
||||||
|
|
||||||
|
#include "../../include/util.h"
|
||||||
|
|
||||||
|
|
||||||
|
// https://chgi.developpez.com/liste/ < ^c^v
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
void Push(pile **p, int Val)
|
||||||
|
{
|
||||||
|
pile *element = malloc(sizeof(pile));
|
||||||
|
if(!element) exit(EXIT_FAILURE); /* Si l'allocation a échoué. */
|
||||||
|
element->valeur = Val;
|
||||||
|
element->prec = *p;
|
||||||
|
*p = element; /* Le pointeur pointe sur le dernier élément. */
|
||||||
|
}
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
int Pop(pile **p)
|
||||||
|
{
|
||||||
|
int Val;
|
||||||
|
pile *tmp;
|
||||||
|
if(!*p) return -1; /* Retourne -1 si la pile est vide. */
|
||||||
|
tmp = (*p)->prec;
|
||||||
|
Val = (*p)->valeur;
|
||||||
|
free(*p);
|
||||||
|
*p = tmp; /* Le pointeur pointe sur le dernier élément. */
|
||||||
|
return Val; /* Retourne la valeur soutirée de la pile. */
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
void Clear(pile **p)
|
||||||
|
{
|
||||||
|
pile *tmp;
|
||||||
|
while(*p)
|
||||||
|
{
|
||||||
|
tmp = (*p)->prec;
|
||||||
|
free(*p);
|
||||||
|
*p = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
int Length(pile *p)
|
||||||
|
{
|
||||||
|
int n=0;
|
||||||
|
while(p)
|
||||||
|
{
|
||||||
|
n++;
|
||||||
|
p = p->prec;
|
||||||
|
}
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
void View(pile *p)
|
||||||
|
{
|
||||||
|
while(p)
|
||||||
|
{
|
||||||
|
printf("%d\n",p->valeur);
|
||||||
|
p = p->prec;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
// "graph", "chart", "plot" and "diagram" are ambiguous terms, sometimes used interchangeably.
|
// "graph", "chart", "plot" and "diagram" are ambiguous terms, sometimes used interchangeably.
|
||||||
// https://www.mathsisfun.com/data/data-graph.php
|
// https://www.mathsisfun.com/data/data-graph.php
|
||||||
|
|
||||||
#define H_PARTITION_RESULTS 140
|
|
||||||
|
|
||||||
|
|
||||||
void *widget_get_data_page()
|
void *widget_get_data_page()
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
void *widget_get_time_results_box () {
|
void *widget_get_time_results_box () {
|
||||||
GtkBox *time_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2));
|
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\
|
gtk_box_append (time_box, GTK_WIDGET (gtk_button_new_with_label ("\n a widget\n\
|
||||||
intended to\n modulate\n the intensities\n of the various\n represented\n flows\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
|
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")));
|
("/home/jean/Gem-Graph/gem-graph-client/data/image/data évolutions parallèles (n > 30) étendu.png")));
|
||||||
return GTK_WIDGET (time_box);
|
return GTK_WIDGET (time_box);
|
||||||
|
|
|
@ -46,15 +46,15 @@ void *widget_get_organize_results_box ()
|
||||||
GtkBox *access_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
GtkBox *access_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
||||||
gtk_box_append (access_box, gtk_button_new_with_label ("measurements\
|
gtk_box_append (access_box, gtk_button_new_with_label ("measurements\
|
||||||
activate or create mesurement tools \
|
activate or create mesurement tools \
|
||||||
"));
|
"));
|
||||||
gtk_box_append (access_box, gtk_button_new_with_label ("measures\
|
gtk_box_append (access_box, gtk_button_new_with_label ("measures\
|
||||||
apply a mesurement tool to a situation to create a data flow\
|
apply a mesurement tool to a situation to create a data flow\
|
||||||
"));
|
"));
|
||||||
gtk_box_append (access_box, gtk_button_new_with_label ("results\
|
gtk_box_append (access_box, gtk_button_new_with_label ("results\
|
||||||
get some results and operate them (filter, concat, analyze, transform, etc.)"));
|
get some results and operate on them (filter, concat, analyze, transform, etc.)"));
|
||||||
gtk_box_append (access_box, gtk_button_new_with_label ("presentation\
|
gtk_box_append (access_box, gtk_button_new_with_label ("presentation\
|
||||||
display (plot) results and tune the chart (graph, diagram) appearance\
|
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 (ad_hoc_box));
|
||||||
gtk_box_append (all_box, GTK_WIDGET (front_box));
|
gtk_box_append (all_box, GTK_WIDGET (front_box));
|
||||||
gtk_box_append (all_box, GTK_WIDGET (access_box));
|
gtk_box_append (all_box, GTK_WIDGET (access_box));
|
||||||
|
|
|
@ -52,9 +52,6 @@
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#define PARTITION_SPACE_VS_CONTROLS_1 920
|
|
||||||
#define PARTITION_SPACE_VS_CONTROLS_2 800
|
|
||||||
|
|
||||||
void *widget_get_state_page()
|
void *widget_get_state_page()
|
||||||
{
|
{
|
||||||
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
GtkBox *page_box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));
|
||||||
|
|
|
@ -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 */
|
/* 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()
|
void *widget_get_graph_view_control()
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,8 +47,6 @@ static void *widget_get_non_time_dependent_analysis_elements() // for fun !
|
||||||
return results_box;
|
return results_box;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define H_PARTITION_SYNTH 1600
|
|
||||||
#define W_PARTITION_SYNTH 400
|
|
||||||
|
|
||||||
static void *widget_get_space_vs_non_time_dependent_analysis()
|
static void *widget_get_space_vs_non_time_dependent_analysis()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue