111 lines
6.2 KiB
C
111 lines
6.2 KiB
C
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
* *
|
|
* 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>
|
|
|
|
/******************************************************************************/
|
|
/* S T A T E M A C H I N E */
|
|
/******************************************************************************/
|
|
// called by widgets through signal functions
|
|
|
|
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;
|
|
|
|
|
|
void fsm_msg (int choice, int value, char *string, int sub_automaton);
|
|
// def: fsm/dispatch; call: fsm/dispatch;
|
|
// fsm/measure;
|
|
// fsm/result;
|
|
|
|
// --------------------------------------------------------------- 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);
|
|
|
|
|
|
// --------------------------------------------------------------- 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);
|