gem-graph-client/include/fsm.h

64 lines
3.3 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>
/******************************************************************************/
/* 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 { STATE, RULES, DATA }; // xor
enum fsm_choice_STORE_RESTORE_RESET { STORE, RESTORE, RESET }; // xor
#define n_rules 128 // arbitrary
#define n_objects 32 // arbitrary too,
#define n_situations 128 // and so on...
int fsm_get_exec_edit ();
int fsm_get_state_rules_data ();
int fsm_get_store_restore_reset ();
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);
void fsm_reset_all_situations_transparencies_at_value (int value); // provisoire...
bool fsm_get_preferences_state ();
void fsm_set_preferences_state (bool value);