un petit détour par la console... (taper 'entrée' pour ouvrir le fenêtre et... patientez un peu)
This commit is contained in:
parent
16bfcdd4df
commit
cbb8495783
|
@ -54,7 +54,9 @@ typedef struct disp_list {int value; struct disp_list *suiv;} disp_list ;
|
||||||
typedef struct journal {int value; struct journal *prev;} journal;
|
typedef struct journal {int value; struct journal *prev;} journal;
|
||||||
// ref: sudo cat /var/log/messages
|
// ref: sudo cat /var/log/messages
|
||||||
|
|
||||||
void fsm_init(); // def: fsm/dispatch; call: main;
|
GtkApplication *fsf_get_app(); // def: main call: fsm/engine/engine;
|
||||||
|
|
||||||
|
void fsm_init(bool mode_console); // def: fsm/dispatch; call: main;
|
||||||
void fsm_preferences_init(); // def: fsm/prefer; call: fsm/dispatch;
|
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_measures_list_init(); // def: fsm/measure/manage.c; 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;
|
||||||
|
@ -103,6 +105,7 @@ void fsm_rule_trig_measure (int rule_id, int object_id, int measure_id);
|
||||||
|
|
||||||
// --------------------------------------------------------------- WIP ------
|
// --------------------------------------------------------------- WIP ------
|
||||||
void fsm_engine_init();
|
void fsm_engine_init();
|
||||||
|
void fsm_poetic_engine();
|
||||||
|
|
||||||
// --------------------------------------------------------------- WIP ------
|
// --------------------------------------------------------------- WIP ------
|
||||||
int fsm_journal_push (journal **jj, int v_value);
|
int fsm_journal_push (journal **jj, int v_value);
|
||||||
|
@ -124,3 +127,4 @@ void fsm_disp_add_chart (disp_list d, int *p_chart);
|
||||||
int fsm_disp_get_chart (disp_list d, int from, int to);
|
int fsm_disp_get_chart (disp_list d, int from, int to);
|
||||||
void fsm_disp_remove_chart (disp_list d, int *p_chart);
|
void fsm_disp_remove_chart (disp_list d, int *p_chart);
|
||||||
|
|
||||||
|
void fsm_another_proto_engine ();
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
"libxml2"
|
"libxml2"
|
||||||
"glu"
|
"glu"
|
||||||
"glew"
|
"glew"
|
||||||
"glfw"
|
;; "glfw"
|
||||||
"cglm"
|
"cglm"
|
||||||
"libepoxy"
|
"libepoxy"
|
||||||
"pango@1.90.0"
|
"pango@1.90.0"
|
||||||
|
|
|
@ -58,15 +58,18 @@
|
||||||
/* F S M I N I T */
|
/* F S M I N I T */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
void fsm_init()
|
void fsm_init(bool mode_console)
|
||||||
{
|
{
|
||||||
|
if (mode_console) fsm_engine_init(); // pour avancer, en attendant... 😇️
|
||||||
|
else {
|
||||||
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();
|
||||||
|
printf("exemple de format de journal : 2024-08-31 [%s()] %s\
|
||||||
// fsm_engine_init(); // pour avancer, en attendant... 😇️
|
< NB ce printf() se trouve dans 'fsm/dispatch.c'\n", __func__, "message"); // logging TODO TODO
|
||||||
|
// un exemple : $ sudo cat /var/log/messages
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
101
src/fsm/engine.c
101
src/fsm/engine.c
|
@ -1,101 +0,0 @@
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
* *
|
|
||||||
* Gem-graph client *
|
|
||||||
* Finite State Machine Engine *
|
|
||||||
* *
|
|
||||||
* Copyright © 2024 Libre en Communs <contact@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 <time.h>
|
|
||||||
#include "../../include/fsm.h"
|
|
||||||
#include "../../include/signal.h"
|
|
||||||
#include "../../include/widget.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 */
|
|
||||||
/* */
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
static void proto_proto_proto_engine();
|
|
||||||
void fsm_engine_init()
|
|
||||||
{
|
|
||||||
if (0) printf ("src/fsm/engine.c | src/fsm/engine.c fsm_engine_init()\n");
|
|
||||||
proto_proto_proto_engine();
|
|
||||||
// \x1b[1F \x1b[2K == move to the beginning of previous line and clear it
|
|
||||||
}
|
|
||||||
|
|
||||||
static void proto_proto_proto_engine()
|
|
||||||
{
|
|
||||||
int milliseconds = 200;
|
|
||||||
struct timespec rem;
|
|
||||||
struct timespec req= {
|
|
||||||
(int)(milliseconds / 1000), /* secs (Must be Non-Negative) */
|
|
||||||
(milliseconds % 1000) * 1000000 /* nano (Must be in range of 0 to 999999999) */
|
|
||||||
};
|
|
||||||
while (true) {
|
|
||||||
printf("O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf("O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf("-O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf("---O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf("--- -O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf("- - - O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf(" - - O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf("- O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf(" O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf(" O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf(" O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf(" O. \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf(" .O \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf(" . O \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf(" . O \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf(" . O \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf(" . O \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf(" . O \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf(" . O \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf(" . O \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf(" . O \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf(" O \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf(" O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf("- O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf(" -O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf("-O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf("O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf("O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf("O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf("O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf("-O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf("O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf("O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
printf("O . \n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,105 @@
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* *
|
||||||
|
* Gem-graph client *
|
||||||
|
* Finite State Machine Engine *
|
||||||
|
* *
|
||||||
|
* Copyright © 2024 Libre en Communs <contact@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 <time.h>
|
||||||
|
#include "../../../include/fsm.h"
|
||||||
|
#include "../../../include/widget.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 */
|
||||||
|
/* */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
static void fsm_strange_engine()
|
||||||
|
{
|
||||||
|
int milliseconds = 100;
|
||||||
|
struct timespec rem;
|
||||||
|
struct timespec req= {
|
||||||
|
(int)(milliseconds / 1000), /* secs (Must be Non-Negative) */
|
||||||
|
(milliseconds % 1000) * 1000000 /* nano (Must be in range of 0 to 999999999) */
|
||||||
|
};
|
||||||
|
int stop = 0;
|
||||||
|
while (! stop) {
|
||||||
|
printf(" | M . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | W . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | MO * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | W=-O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | D=-- -O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | =- - - O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | -- O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | - O (*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O (*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O (*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O (*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | (*O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | (*) O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | (*) O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | (*) O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | D . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | M- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | W =- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | M = --- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | W =-- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | M=- . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | W- . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
if (getchar() == '\n') stop = 1;
|
||||||
|
}
|
||||||
|
// if (stop) g_object_unref (fsf_get_app()); // widget_design_main_window (NULL); // widget_get_main_window());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void fsm_engine_init()
|
||||||
|
{
|
||||||
|
if (1) printf ("src/fsm/engine.c | src/fsm/engine.c fsm_engine_init()\n");
|
||||||
|
fsm_strange_engine();
|
||||||
|
// \x1b[1F \x1b[2K == move to the beginning of previous line and clear it
|
||||||
|
//fsm_another_proto_engine();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* *
|
||||||
|
* Gem-graph client *
|
||||||
|
* Finite State Machine Engine *
|
||||||
|
* ... a little touch of poetry ... *
|
||||||
|
* *
|
||||||
|
* Copyright © 2024 Jean Sirmai <jean@a-lec.org> *
|
||||||
|
* *
|
||||||
|
* This file is part of Gem-graph and of the dreams it may reveal. *
|
||||||
|
* *
|
||||||
|
* 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 <time.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 */
|
||||||
|
/* */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
void fsm_poetic_engine() // 2024-08-31
|
||||||
|
{
|
||||||
|
int milliseconds = 100;
|
||||||
|
struct timespec rem;
|
||||||
|
struct timespec req= {
|
||||||
|
(int)(milliseconds / 1000), /* secs (Must be Non-Negative) */
|
||||||
|
(milliseconds % 1000) * 1000000 /* nano (Must be in range of 0 to 999999999) */
|
||||||
|
};
|
||||||
|
while (true) {
|
||||||
|
printf(" | O . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | DO * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | D=-O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | D=-- -O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | =- - - O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | -- O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | - O (*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O (*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O (*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O (*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O*) |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | (*O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | (*) O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | (*) O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | (*) O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | * O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O * |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | O . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | D . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | D- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | D =- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | D = --- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | D =-- . . |\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | D=- . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
printf(" | D- . .|\n\x1b[1F\x1b[2K"); nanosleep(&req , &rem);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* *
|
||||||
|
* Gem-graph client *
|
||||||
|
* Finite State Machine Engine *
|
||||||
|
* *
|
||||||
|
* Copyright © 2024 Libre en Communs <contact@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 <time.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 */
|
||||||
|
/* */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
static int l = 196;
|
||||||
|
static char t[200]; // = {'|',' ','-',' ','|',' ','-',' ','|',' ','-',' ','|',' ','-',' ','|'};
|
||||||
|
|
||||||
|
static void init()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < l; i++) {
|
||||||
|
if (i % 4 == 0) t[i] = 'O';
|
||||||
|
if (i % 4 == 1) t[i] = ' ';
|
||||||
|
if (i % 4 == 2) t[i] = '-';
|
||||||
|
if (i % 4 == 3) t[i] = ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void console()
|
||||||
|
{
|
||||||
|
int milliseconds = 100;
|
||||||
|
struct timespec rem;
|
||||||
|
struct timespec req= {
|
||||||
|
(int)(milliseconds / 1000), /* secs (Must be Non-Negative) */
|
||||||
|
(milliseconds % 1000) * 1000000 /* nano (Must be in range of 0 to 999999999) */
|
||||||
|
};
|
||||||
|
printf("\n> ");
|
||||||
|
for (int i = 0; i < l; i++) printf("%c", t[i]);
|
||||||
|
printf("<\n\x1b[1F\x1b[2K");
|
||||||
|
nanosleep(&req , &rem);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fsm_another_proto_engine ()
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
console();
|
||||||
|
}
|
||||||
|
|
12
src/main.c
12
src/main.c
|
@ -133,22 +133,20 @@
|
||||||
#include "../include/signal.h"
|
#include "../include/signal.h"
|
||||||
#include "../include/fsm.h"
|
#include "../include/fsm.h"
|
||||||
|
|
||||||
|
GtkApplication *app;
|
||||||
|
GtkApplication *fsf_get_app() {return app;}
|
||||||
|
|
||||||
int main (int argc, char **argv)
|
int main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
GtkApplication *app;
|
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
printf("exemple de format de journal : 2024-08-31 [%s()] %s\
|
|
||||||
< NB ce printf() se trouve dans 'main'\n", __func__, "message"); // logging TODO TODO
|
|
||||||
// un exemple : $ sudo cat /var/log/messages
|
|
||||||
|
|
||||||
app = gtk_application_new ("org.gem-graph", G_APPLICATION_DEFAULT_FLAGS);
|
app = gtk_application_new ("org.gem-graph", G_APPLICATION_DEFAULT_FLAGS);
|
||||||
|
|
||||||
fsm_init (); // fsm = finite state machine (see : src/fsm/dispatch.c)
|
bool mode_console = FALSE; // TRUE FALSE
|
||||||
|
fsm_init (mode_console); // fsm = finite state machine (see : src/fsm/dispatch.c)
|
||||||
|
|
||||||
g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL);
|
g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL);
|
||||||
// on_windows_activation <> see : src/widget/dispatch
|
// on_windows_activation <> see : src/widget/dispatch.c
|
||||||
|
|
||||||
status = g_application_run (G_APPLICATION (app), argc, argv);
|
status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||||
g_object_unref (app);
|
g_object_unref (app);
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include "../../include/widget.h"
|
#include "../../include/widget.h"
|
||||||
|
#include "../../include/fsm.h"
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -60,16 +61,25 @@ void on_windows_activation (GtkApplication *app)
|
||||||
{
|
{
|
||||||
// g_application_activate (G_APPLICATION (app)); < how ? > in main.c is
|
// g_application_activate (G_APPLICATION (app)); < how ? > in main.c is
|
||||||
// g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL);
|
// g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL);
|
||||||
/*
|
|
||||||
printf(" We apologise for the temporary interruption to the window. 😇️\n\
|
|
||||||
Please, ask 'src/widget/dispatch.c on_windows_activation (GtkApplication *app)'\n\
|
|
||||||
to call: widget_design_main_window (main_window)\n");
|
|
||||||
*/
|
|
||||||
main_window = GTK_WINDOW (gtk_application_window_new (app));
|
main_window = GTK_WINDOW (gtk_application_window_new (app));
|
||||||
dialog_window = GTK_WINDOW (gtk_application_window_new (app));
|
dialog_window = GTK_WINDOW (gtk_application_window_new (app));
|
||||||
text_window = GTK_WINDOW (gtk_application_window_new (app));
|
text_window = GTK_WINDOW (gtk_application_window_new (app));
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------//
|
||||||
|
//-----------------------------------------------------------------------------------//
|
||||||
|
printf("mode_console 😇️\
|
||||||
|
(see@ 'src/widget/dispatch.c on_windows_activation() < POUR RÉACTIVER GTK4)\n");
|
||||||
|
|
||||||
|
// S I P A S M O D E - C O N S O L E
|
||||||
widget_design_main_window (main_window); // def: widget/topbar/dispatch
|
widget_design_main_window (main_window); // def: widget/topbar/dispatch
|
||||||
|
// S I P A S M O D E - C O N S O L E
|
||||||
|
|
||||||
|
fsm_engine_init();
|
||||||
|
//-----------------------------------------------------------------------------------//
|
||||||
|
//-----------------------------------------------------------------------------------//
|
||||||
|
|
||||||
|
|
||||||
widget_design_dialog_window (main_window, dialog_window);
|
widget_design_dialog_window (main_window, dialog_window);
|
||||||
widget_design_text_window (main_window, text_window);
|
widget_design_text_window (main_window, text_window);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue