https://fr.wikibooks.org/wiki/Mathc_gnuplot/Fichiers_pour_gnuplot (@fsm/measure/data_list.c)
This commit is contained in:
parent
07cbfe9fcb
commit
270b408d28
|
@ -0,0 +1,8 @@
|
||||||
|
# Fichier de commande pour gnuplot
|
||||||
|
# En ligne de commande : load "a_main.plt"
|
||||||
|
#
|
||||||
|
set zeroaxis
|
||||||
|
plot cos(x),\
|
||||||
|
sin(x)
|
||||||
|
|
||||||
|
reset
|
|
@ -49,8 +49,9 @@ enum fsm_measure_type {DATE_RULE_EXEC, RULE_EXEC_NB, OBJECT_NB, ELAPSED_TIME };
|
||||||
#define n_situations 128 // and so on...
|
#define n_situations 128 // and so on...
|
||||||
|
|
||||||
typedef struct tool_list {int value; struct tool_list *suiv;} tool_list ;
|
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 data_list {int value; struct data_list *suiv;} data_list ;
|
||||||
typedef struct disp_list {int value; struct disp_list *suiv;} disp_list ;
|
typedef struct disp_list {int value; struct disp_list *suiv;} disp_list ;
|
||||||
|
typedef struct journal {int value; struct journal *prev;} journal;
|
||||||
|
|
||||||
void 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_preferences_init(); // def: fsm/prefer; call: fsm/dispatch;
|
||||||
|
@ -88,23 +89,28 @@ void fsm_msg (int choice, int value, char *string, int sub_automaton);
|
||||||
|
|
||||||
// --------------------------------------------------------------- WIP ------
|
// --------------------------------------------------------------- WIP ------
|
||||||
// def: measure/tool_list call: measure/tool_list (about the following functions...)
|
// def: measure/tool_list call: measure/tool_list (about the following functions...)
|
||||||
void fsm_tools_sort_list_insert (tool_list **tl, int value);
|
void fsm_tools_list_insert (tool_list **tl, int value);
|
||||||
int fsm_tools_sort_list_pop (tool_list **tl);
|
int fsm_tools_list_pop (tool_list **tl);
|
||||||
int fsm_tools_sort_list_length (tool_list *tl);
|
int fsm_tools_list_length (tool_list *tl);
|
||||||
void fsm_tools_sort_list_clear (tool_list **tl);
|
void fsm_tools_list_clear (tool_list **tl);
|
||||||
void fsm_tools_sort_list_view (tool_list *tl);
|
void fsm_tools_list_view (tool_list *tl);
|
||||||
void fsm_tools_sort_list_test(); // def: measure/manage; call: measure/manage;
|
void fsm_tools_list_test(); // def: measure/manage; call: measure/manage;
|
||||||
|
|
||||||
// def: fsm/measure/manage/; call: rule exec
|
// def: fsm/measure/manage/; call: rule exec
|
||||||
void fsm_rule_trig_measure (int rule_id, int object_id, int measure_id);
|
void fsm_rule_trig_measure (int rule_id, int object_id, int measure_id);
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------- WIP ------
|
// --------------------------------------------------------------- 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_push (journal **jj, int v_value);
|
||||||
int fsm_journal_pop (journal **jj);
|
int fsm_journal_pop (journal **jj);
|
||||||
void fsm_journal_clear (journal **jj);
|
void fsm_journal_clear (journal **jj);
|
||||||
int fsm_journal_length (journal *jj);
|
int fsm_journal_length (journal *jj);
|
||||||
void fsm_journal_view (journal *jj);
|
void fsm_journal_view (journal *jj);
|
||||||
void fsm_journal_seek (journal *jj, int v_value);
|
void fsm_journal_seek (journal *jj, int vv);
|
||||||
|
|
||||||
|
|
||||||
|
// --------------------------------------------------------------- WIP ------
|
||||||
|
void fsm_data_new_insert (data_list d, int *p_data);
|
||||||
|
void fsm_data_new_concat (data_list d, int *p_data, int *p_target);
|
||||||
|
void *fsm_data_get(); // (data_list d, int from, int to);
|
||||||
|
void fsm_data_erase (data_list d, int from, int to);
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
/* ------------------------------------ */
|
||||||
|
double H(
|
||||||
|
double x)
|
||||||
|
{
|
||||||
|
if(x>0.)return(1.);
|
||||||
|
else return(0.);
|
||||||
|
}
|
||||||
|
/* ------------------------------------ */
|
|
@ -0,0 +1,52 @@
|
||||||
|
/* --------------------------------------------------------------- */
|
||||||
|
/* gnuplot : xdef.h */
|
||||||
|
/* https://fr.wikibooks.org/wiki/Mathc_gnuplot/Fichiers_h_:_xdef */
|
||||||
|
/* --------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifndef PI
|
||||||
|
#define PI 3.14159265359
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ------------------------------------ */
|
||||||
|
void clrscrn(void)
|
||||||
|
{
|
||||||
|
printf("\n\n\n\n\n\n\n\n\n\n\n"
|
||||||
|
"\n\n\n\n\n\n\n\n\n\n\n"
|
||||||
|
"\n\n\n\n\n\n\n\n\n\n\n");
|
||||||
|
}
|
||||||
|
/* ------------------------------------ */
|
||||||
|
void Pause(void)
|
||||||
|
{
|
||||||
|
int i=300;
|
||||||
|
int j;
|
||||||
|
|
||||||
|
while(--i){j=600000;while(--j);}
|
||||||
|
}
|
||||||
|
/* ------------------------------------ */
|
||||||
|
/* First file name : */
|
||||||
|
/* */
|
||||||
|
/* char fname[]= "a_paaa"; */
|
||||||
|
/* ------------------------------------ */
|
||||||
|
char *NewName(
|
||||||
|
char *name
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if(name[5]<'z')
|
||||||
|
|
||||||
|
++name[5];
|
||||||
|
|
||||||
|
else if(name[4]<'z')
|
||||||
|
{
|
||||||
|
name[5]='a';
|
||||||
|
++name[4];
|
||||||
|
}
|
||||||
|
else if(name[3]<'z')
|
||||||
|
{
|
||||||
|
name[5]='a';
|
||||||
|
name[4]='a';
|
||||||
|
++name[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
return(name);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
/* ------------------------------------------------------------------ */
|
||||||
|
/* gnuplot : xfx_x.h */
|
||||||
|
/* https://fr.wikibooks.org/wiki/Mathc_gnuplot/Fichiers_h_:_xfx_x */
|
||||||
|
/* ------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
/* ------------------------------------
|
||||||
|
f'(a) = f(a+h) - f(a-h)
|
||||||
|
-------------
|
||||||
|
2h
|
||||||
|
---------------------------------- */
|
||||||
|
double fx_x(
|
||||||
|
double (*P_f)(double x),
|
||||||
|
double a,
|
||||||
|
double h
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return( ( ((*P_f)(a+h))-((*P_f)(a-h)) ) / (2.*h) );
|
||||||
|
}
|
||||||
|
/* ------------------------------------
|
||||||
|
f''(a) = f(a+h) - 2 f(a) + f(a-h)
|
||||||
|
----------------------
|
||||||
|
h**2
|
||||||
|
---------------------------------- */
|
||||||
|
double fx_xx(
|
||||||
|
double (*P_f)(double x),
|
||||||
|
double a,
|
||||||
|
double h
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return( (((*P_f)(a+h))-2*((*P_f)(a))+((*P_f)(a-h))) / (h*h) );
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
/* ------------------------------------------------------------------ */
|
||||||
|
/* gnuplot : xfxy_x.h */
|
||||||
|
/* https://fr.wikibooks.org/wiki/Mathc_gnuplot/Fichiers_h_:_xfxy_x */
|
||||||
|
/* ------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
#include "xspv.h"
|
||||||
|
|
||||||
|
double fxy_x(
|
||||||
|
double (*P_f)(double x, double y),
|
||||||
|
double h,
|
||||||
|
point2d p
|
||||||
|
)
|
||||||
|
{
|
||||||
|
double tplsh;
|
||||||
|
double tmnsh;
|
||||||
|
|
||||||
|
tplsh = ((*P_f)(p.x+h,p.y));
|
||||||
|
tmnsh = ((*P_f)(p.x-h,p.y));
|
||||||
|
|
||||||
|
return(( tplsh-tmnsh)/(2.*h) );
|
||||||
|
}
|
||||||
|
/* ------------------------------------ */
|
||||||
|
double fxy_y(
|
||||||
|
double (*P_f)(double x, double y),
|
||||||
|
double h,
|
||||||
|
point2d p
|
||||||
|
)
|
||||||
|
{
|
||||||
|
double tplsh;
|
||||||
|
double tmnsh;
|
||||||
|
|
||||||
|
tplsh = ((*P_f)(p.x,p.y+h));
|
||||||
|
tmnsh = ((*P_f)(p.x,p.y-h));
|
||||||
|
|
||||||
|
return(( tplsh-tmnsh)/(2.*h) );
|
||||||
|
}
|
||||||
|
/* ------------------------------------ */
|
||||||
|
double fxy_xx(
|
||||||
|
double (*P_f)(double x, double y),
|
||||||
|
double h,
|
||||||
|
point2d p
|
||||||
|
)
|
||||||
|
{
|
||||||
|
double t;
|
||||||
|
double tplsh;
|
||||||
|
double tmnsh;
|
||||||
|
|
||||||
|
t = ((*P_f)(p.x , p.y));
|
||||||
|
tplsh = ((*P_f)(p.x+h, p.y));
|
||||||
|
tmnsh = ((*P_f)(p.x-h, p.y));
|
||||||
|
|
||||||
|
return( (tplsh-2*t+tmnsh)/(h*h) );
|
||||||
|
}
|
||||||
|
/* ------------------------------------ */
|
||||||
|
double fxy_yy(
|
||||||
|
double (*P_f)(double x, double y),
|
||||||
|
double h,
|
||||||
|
point2d p
|
||||||
|
)
|
||||||
|
{
|
||||||
|
double t;
|
||||||
|
double tplsh;
|
||||||
|
double tmnsh;
|
||||||
|
|
||||||
|
t = ((*P_f)(p.x, p.y ));
|
||||||
|
tplsh = ((*P_f)(p.x, p.y+h));
|
||||||
|
tmnsh = ((*P_f)(p.x, p.y-h));
|
||||||
|
|
||||||
|
return( (tplsh-2*t+tmnsh)/(h*h) );
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
/* ------------------------------------------------------------------ */
|
||||||
|
/* gnuplot : xfxyz_x.h */
|
||||||
|
/* https://fr.wikibooks.org/wiki/Mathc_gnuplot/Fichiers_h_:_xfxyz_x */
|
||||||
|
/* ------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
#include "xspv.h"
|
||||||
|
|
||||||
|
double fxyz_x(
|
||||||
|
double (*P_f)(double x, double y, double z),
|
||||||
|
double h,
|
||||||
|
point3d p
|
||||||
|
)
|
||||||
|
{
|
||||||
|
double tplsh;
|
||||||
|
double tmnsh;
|
||||||
|
|
||||||
|
tplsh = ((*P_f)(p.x+h,p.y,p.z));
|
||||||
|
tmnsh = ((*P_f)(p.x-h,p.y,p.z));
|
||||||
|
|
||||||
|
return(( tplsh-tmnsh)/(2.*h) );
|
||||||
|
}
|
||||||
|
/* ------------------------------------ */
|
||||||
|
double fxyz_y(
|
||||||
|
double (*P_f)(double x, double y, double z),
|
||||||
|
double h,
|
||||||
|
point3d p
|
||||||
|
)
|
||||||
|
{
|
||||||
|
double tplsh;
|
||||||
|
double tmnsh;
|
||||||
|
|
||||||
|
tplsh = ((*P_f)(p.x,p.y+h,p.z));
|
||||||
|
tmnsh = ((*P_f)(p.x,p.y-h,p.z));
|
||||||
|
|
||||||
|
return(( tplsh-tmnsh)/(2.*h) );
|
||||||
|
}
|
||||||
|
/* ------------------------------------ */
|
||||||
|
double fxyz_z(
|
||||||
|
double (*P_f)(double x, double y, double z),
|
||||||
|
double h,
|
||||||
|
point3d p
|
||||||
|
)
|
||||||
|
{
|
||||||
|
double tplsh;
|
||||||
|
double tmnsh;
|
||||||
|
|
||||||
|
tplsh = ((*P_f)(p.x,p.y,p.z+h));
|
||||||
|
tmnsh = ((*P_f)(p.x,p.y,p.z-h));
|
||||||
|
|
||||||
|
return(( tplsh-tmnsh)/(2.*h) );
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
/* --------------------------------------------------------------- */
|
||||||
|
/* gnuplot : xplt.h */
|
||||||
|
/* https://fr.wikibooks.org/wiki/Mathc_gnuplot/Fichiers_h_:_xplt */
|
||||||
|
/* --------------------------------------------------------------- */
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
double xmini; double xmaxi;
|
||||||
|
double ymini; double ymaxi;
|
||||||
|
|
||||||
|
}W_Ctrl, *PW_Ctrl;
|
||||||
|
/* ------------------------------------ */
|
||||||
|
W_Ctrl i_WGnuplot(
|
||||||
|
double xmini, double xmaxi,
|
||||||
|
double ymini, double ymaxi
|
||||||
|
)
|
||||||
|
{
|
||||||
|
W_Ctrl w = {xmini,xmaxi,ymini,ymaxi};
|
||||||
|
|
||||||
|
return (w);}
|
||||||
|
/* ------------------------------------ */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
double xmini; double xmaxi;
|
||||||
|
double ymini; double ymaxi;
|
||||||
|
double zmini; double zmaxi;
|
||||||
|
|
||||||
|
}Ws_Ctrl, *PWs_Ctrl;
|
||||||
|
/* ------------------------------------ */
|
||||||
|
Ws_Ctrl i_WsGnuplot(
|
||||||
|
double xmini, double xmaxi,
|
||||||
|
double ymini, double ymaxi,
|
||||||
|
double zmini, double zmaxi
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Ws_Ctrl w = {xmini,xmaxi,ymini,ymaxi,zmini,zmaxi};
|
||||||
|
|
||||||
|
return (w);}
|
||||||
|
/* ------------------------------------ */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
double rot_x; double rot_z;
|
||||||
|
double scale; double scale_z;
|
||||||
|
|
||||||
|
}View_Ctrl, *PView_Ctrl;
|
||||||
|
/* ------------------------------------ */
|
||||||
|
View_Ctrl i_VGnuplot(
|
||||||
|
double rot_x, double rot_z,
|
||||||
|
double scale, double scale_z
|
||||||
|
)
|
||||||
|
{
|
||||||
|
View_Ctrl V = {rot_x,rot_z,scale_z,scale_z};
|
||||||
|
|
||||||
|
return (V);}
|
||||||
|
/* ------------------------------------ */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
double mini; double maxi;
|
||||||
|
double step;
|
||||||
|
|
||||||
|
}t_Ctrl, *Pt_Ctrl;
|
||||||
|
/* ------------------------------------ */
|
||||||
|
t_Ctrl i_time(
|
||||||
|
double mini, double maxi,
|
||||||
|
double step
|
||||||
|
)
|
||||||
|
{
|
||||||
|
t_Ctrl t = {mini,maxi,step};
|
||||||
|
|
||||||
|
return (t);}
|
|
@ -0,0 +1,60 @@
|
||||||
|
/* --------------------------------------------------------------- */
|
||||||
|
/* gnuplot : xspv.h */
|
||||||
|
/* https://fr.wikibooks.org/wiki/Mathc_gnuplot/Fichiers_h_:_xspv */
|
||||||
|
/* --------------------------------------------------------------- */
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
double x; double y;
|
||||||
|
|
||||||
|
}point2d, *Ppoint2d;
|
||||||
|
/* ------------------------------------ */
|
||||||
|
point2d i_point2d(
|
||||||
|
double x, double y
|
||||||
|
)
|
||||||
|
{
|
||||||
|
point2d p = {x,y};
|
||||||
|
|
||||||
|
return (p);}
|
||||||
|
/* ------------------------------------ */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
double x; double y; double z;
|
||||||
|
|
||||||
|
}point3d, *Ppoint3d;
|
||||||
|
/* ------------------------------------ */
|
||||||
|
point3d i_point3d(
|
||||||
|
double x, double y, double z
|
||||||
|
)
|
||||||
|
{
|
||||||
|
point3d p = {x,y,z};
|
||||||
|
|
||||||
|
return (p);}
|
||||||
|
/* ------------------------------------ */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
double i; double j;
|
||||||
|
|
||||||
|
}vector2d, *Pvector2d;
|
||||||
|
/* ------------------------------------ */
|
||||||
|
vector2d i_vector2d(
|
||||||
|
double i, double j
|
||||||
|
)
|
||||||
|
{
|
||||||
|
vector2d v = {i,j};
|
||||||
|
|
||||||
|
return (v);}
|
||||||
|
/* ------------------------------------ */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
double i; double j; double k;
|
||||||
|
|
||||||
|
}vector3d, *Pvector3d;
|
||||||
|
/* ------------------------------------ */
|
||||||
|
vector3d i_vector3d(
|
||||||
|
double i, double j, double k
|
||||||
|
)
|
||||||
|
{
|
||||||
|
vector3d v = {i,j,k};
|
||||||
|
|
||||||
|
return (v);}
|
|
@ -0,0 +1,11 @@
|
||||||
|
-5.000 0.959
|
||||||
|
-4.000 0.757
|
||||||
|
-3.000 -0.141
|
||||||
|
-2.000 -0.909
|
||||||
|
-1.000 -0.841
|
||||||
|
0.000 0.000
|
||||||
|
1.000 0.841
|
||||||
|
2.000 0.909
|
||||||
|
3.000 0.141
|
||||||
|
4.000 -0.757
|
||||||
|
5.000 -0.959
|
|
@ -1,34 +1,32 @@
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
* *
|
* *
|
||||||
* Gem-graph client *
|
* Gem-graph client *
|
||||||
|
* Finite State Machine (src/fsm/measure/dispatch.c) *
|
||||||
* *
|
* *
|
||||||
* 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> *
|
||||||
* *
|
* *
|
||||||
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
|
* This file is part of Gem-graph. *
|
||||||
* 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 *
|
* This program is free software: you can redistribute it and/or modify it *
|
||||||
* under the terms of the GNU Affero General Public License *
|
* under the terms of the GNU Affero General Public License *
|
||||||
* as published by the Free Software Foundation, *
|
* as published by the Free Software Foundation, *
|
||||||
* either version 3 of the License, *
|
* either version 3 of the License, *
|
||||||
* or (at your option) any later version. *
|
* or (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
* This program is distributed in the hope that it will be useful, *
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* but WITHOUT ANY WARRANTY; *
|
* but WITHOUT ANY WARRANTY; *
|
||||||
* without even the implied warranty of MERCHANTABILITY *
|
* without even the implied warranty of MERCHANTABILITY *
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. *
|
* or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
* See the GNU Affero General Public License for more details. *
|
* See the GNU Affero General Public License for more details. *
|
||||||
* *
|
* *
|
||||||
* You should have received a copy of the GNU Affero General Public License *
|
* 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/>. *
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
* *
|
* *
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "../../include/fsm.h"
|
#include "../../include/fsm.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,20 +121,22 @@ void fsm_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 ("fsm/dispatch.message | switch %5s x %5s > %5s x %5s\n",
|
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_EXEC_EDIT], 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 ("fsm/dispatch.message | switch %5s x %5s > %5s x %5s\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_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/dispatch.message | %s\n", string);
|
case (2) : printf ("fsm/dispatch.message | %s\n", string);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (3) : printf ("fsm/dispatch.message | %2d\n", choice);
|
case (3) : printf ("fsm/dispatch.message | %2d\n", choice);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,6 @@ int fsm_journal_pop (journal **jj)
|
||||||
return vv; // retourne la value retirée du journal.
|
return vv; // retourne la value retirée du journal.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void fsm_journal_clear (journal **jj)
|
void fsm_journal_clear (journal **jj)
|
||||||
{
|
{
|
||||||
journal *tmp;
|
journal *tmp;
|
||||||
|
@ -95,7 +94,7 @@ void fsm_journal_view (journal *jj)
|
||||||
puts ("------");
|
puts ("------");
|
||||||
}
|
}
|
||||||
|
|
||||||
void fsm_journal_seek (journal *jj, int value)
|
void fsm_journal_seek (journal *jj, int vv)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
* *
|
||||||
|
* 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 <math.h>
|
||||||
|
#include "../../../include/fsm.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* An editable list of results is defined and maintained here. */
|
||||||
|
/* Some operations can be performed on them. */
|
||||||
|
/* (see : fsm/measure/manage.c) */
|
||||||
|
/* - - - */
|
||||||
|
/* ex : filter, concat, inverse, scale, correlate, etc. */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
void fsm_data_new_insert (data_list d, int *p_data) {}
|
||||||
|
void fsm_data_new_concat (data_list d, int *p_data, int *p_target) {}
|
||||||
|
void fsm_data_erase (data_list d, int from, int to) {}
|
||||||
|
|
||||||
|
char heq[] = "sin(x)";
|
||||||
|
char geq[] = "cos(x)";
|
||||||
|
|
||||||
|
void *fsm_data_get () // (data_list d, int from, int to)
|
||||||
|
{
|
||||||
|
int v[10];
|
||||||
|
for (int i = 0; i < 10; i++) {v[i] = rand() % 10; printf("%d ", v[i]);}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
FILE *fp;
|
||||||
|
double a;
|
||||||
|
fp = fopen("list.txt","w");
|
||||||
|
for(a = -5.0; a <= 5.0; a++) fprintf(fp, " %6.3f %6.3f\n", a, sin(a));
|
||||||
|
fclose(fp);
|
||||||
|
printf("file list.txt opened\npress 'return' to continue.");
|
||||||
|
getchar();
|
||||||
|
|
||||||
|
fp = fopen("a_main.plt","w");
|
||||||
|
|
||||||
|
fprintf(fp,"# Fichier de commande pour gnuplot \n"
|
||||||
|
"# En ligne de commande : load \"a_main.plt\"\n"
|
||||||
|
"#\n"
|
||||||
|
" set zeroaxis\n"
|
||||||
|
" plot %s,\\\n"
|
||||||
|
" %s \n\n"
|
||||||
|
" reset", geq, heq);
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
printf("\n\nload \"a_main.plt\" with gnuplot."
|
||||||
|
"\n\npress return to continue. ");
|
||||||
|
getchar();
|
||||||
|
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
|
@ -1,29 +1,28 @@
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
* *
|
* *
|
||||||
* Gem-graph client *
|
* Gem-graph client *
|
||||||
|
* State machine / Measures *
|
||||||
* *
|
* *
|
||||||
* 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> *
|
||||||
* *
|
* *
|
||||||
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
|
* This file is part of Gem-graph. *
|
||||||
* 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 *
|
* This program is free software: you can redistribute it and/or modify it *
|
||||||
* under the terms of the GNU Affero General Public License *
|
* under the terms of the GNU Affero General Public License *
|
||||||
* as published by the Free Software Foundation, *
|
* as published by the Free Software Foundation, *
|
||||||
* either version 3 of the License, *
|
* either version 3 of the License, *
|
||||||
* or (at your option) any later version. *
|
* or (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
* This program is distributed in the hope that it will be useful, *
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* but WITHOUT ANY WARRANTY; *
|
* but WITHOUT ANY WARRANTY; *
|
||||||
* without even the implied warranty of MERCHANTABILITY *
|
* without even the implied warranty of MERCHANTABILITY *
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. *
|
* or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
* See the GNU Affero General Public License for more details. *
|
* See the GNU Affero General Public License for more details. *
|
||||||
* *
|
* *
|
||||||
* You should have received a copy of the GNU Affero General Public License *
|
* 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/>. *
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
* *
|
* *
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
||||||
* *
|
|
||||||
* 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. */
|
|
||||||
/******************************************************************************/
|
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,28 @@
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
* *
|
* *
|
||||||
* Gem-graph client *
|
* Gem-graph client *
|
||||||
|
* State machine / Measures *
|
||||||
* *
|
* *
|
||||||
* 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> *
|
||||||
* *
|
* *
|
||||||
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
|
* This file is part of Gem-graph. *
|
||||||
* 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 *
|
* This program is free software: you can redistribute it and/or modify it *
|
||||||
* under the terms of the GNU Affero General Public License *
|
* under the terms of the GNU Affero General Public License *
|
||||||
* as published by the Free Software Foundation, *
|
* as published by the Free Software Foundation, *
|
||||||
* either version 3 of the License, *
|
* either version 3 of the License, *
|
||||||
* or (at your option) any later version. *
|
* or (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
* This program is distributed in the hope that it will be useful, *
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* but WITHOUT ANY WARRANTY; *
|
* but WITHOUT ANY WARRANTY; *
|
||||||
* without even the implied warranty of MERCHANTABILITY *
|
* without even the implied warranty of MERCHANTABILITY *
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. *
|
* or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
* See the GNU Affero General Public License for more details. *
|
* See the GNU Affero General Public License for more details. *
|
||||||
* *
|
* *
|
||||||
* You should have received a copy of the GNU Affero General Public License *
|
* 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/>. *
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
* *
|
* *
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
@ -79,9 +78,11 @@
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// use gnuplot ? gtkwave ? TODO check
|
||||||
|
|
||||||
|
|
||||||
void fsm_add_measure (char *measure_name) {fsm_msg (2, 0, measure_name, 2);}
|
void fsm_add_measure (char *measure_name) {fsm_msg (2, 0, measure_name, 2);}
|
||||||
|
void fsm_measures_list_init() {if (0) fsm_tools_list_test(); fsm_data_get();}
|
||||||
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) {}
|
void fsm_rule_trig_measure (int rule_id, int object_id, int measure_id) {}
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,28 @@
|
||||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
* *
|
* *
|
||||||
* Gem-graph client *
|
* Gem-graph client *
|
||||||
|
* Finite State Machine (src/fsm/measure/tool_list.c) *
|
||||||
* *
|
* *
|
||||||
* 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> *
|
||||||
* *
|
* *
|
||||||
* Copyright © 2024 Libre en Communs <contact@a-lec.org> *
|
* This file is part of Gem-graph. *
|
||||||
* 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 *
|
* This program is free software: you can redistribute it and/or modify it *
|
||||||
* under the terms of the GNU Affero General Public License *
|
* under the terms of the GNU Affero General Public License *
|
||||||
* as published by the Free Software Foundation, *
|
* as published by the Free Software Foundation, *
|
||||||
* either version 3 of the License, *
|
* either version 3 of the License, *
|
||||||
* or (at your option) any later version. *
|
* or (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
* This program is distributed in the hope that it will be useful, *
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* but WITHOUT ANY WARRANTY; *
|
* but WITHOUT ANY WARRANTY; *
|
||||||
* without even the implied warranty of MERCHANTABILITY *
|
* without even the implied warranty of MERCHANTABILITY *
|
||||||
* or FITNESS FOR A PARTICULAR PURPOSE. *
|
* or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||||
* See the GNU Affero General Public License for more details. *
|
* See the GNU Affero General Public License for more details. *
|
||||||
* *
|
* *
|
||||||
* You should have received a copy of the GNU Affero General Public License *
|
* 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/>. *
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
* *
|
* *
|
||||||
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
@ -73,7 +72,7 @@
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void fsm_tools_sort_list_insert (tool_list **ml, int value)
|
void fsm_tools_list_insert (tool_list **ml, int value)
|
||||||
{
|
{
|
||||||
tool_list *tmp = NULL;
|
tool_list *tmp = NULL;
|
||||||
tool_list *cml = *ml;
|
tool_list *cml = *ml;
|
||||||
|
@ -90,7 +89,7 @@ void fsm_tools_sort_list_insert (tool_list **ml, int value)
|
||||||
else *ml = elem;
|
else *ml = elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fsm_tools_sort_list_pop (tool_list **ml)
|
int fsm_tools_list_pop (tool_list **ml)
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
tool_list *tmp;
|
tool_list *tmp;
|
||||||
|
@ -103,7 +102,7 @@ int fsm_tools_sort_list_pop (tool_list **ml)
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fsm_tools_sort_list_length (tool_list *ml)
|
int fsm_tools_list_length (tool_list *ml)
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
while (ml)
|
while (ml)
|
||||||
|
@ -114,7 +113,7 @@ int fsm_tools_sort_list_length (tool_list *ml)
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fsm_tools_sort_list_clear (tool_list **ml)
|
void fsm_tools_list_clear (tool_list **ml)
|
||||||
{
|
{
|
||||||
tool_list *tmp;
|
tool_list *tmp;
|
||||||
while (*ml)
|
while (*ml)
|
||||||
|
@ -125,10 +124,10 @@ void fsm_tools_sort_list_clear (tool_list **ml)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fsm_tools_sort_list_view (tool_list *ml)
|
void fsm_tools_list_view (tool_list *ml)
|
||||||
{
|
{
|
||||||
printf ("-------- view measures list (n = %d)\n",
|
printf ("-------- view measures list (n = %d)\n",
|
||||||
fsm_tools_sort_list_length (ml));
|
fsm_tools_list_length (ml));
|
||||||
while(ml)
|
while(ml)
|
||||||
{
|
{
|
||||||
printf("%d\n", ml->value);
|
printf("%d\n", ml->value);
|
||||||
|
@ -138,62 +137,31 @@ void fsm_tools_sort_list_view (tool_list *ml)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void fsm_tools_list_test()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void fsm_tools_sort_list_test()
|
|
||||||
{
|
{
|
||||||
tool_list *ex_tool = NULL;
|
tool_list *ex_tool = NULL;
|
||||||
|
|
||||||
puts("\ncréation d'une liste de 10 elements :");
|
puts("\nfsm/measure/ fsm_tools_list_test() > création d'une liste de 6 elements :");
|
||||||
fsm_tools_sort_list_insert (&ex_tool,9);
|
fsm_tools_list_insert (&ex_tool,-3);
|
||||||
fsm_tools_sort_list_insert (&ex_tool,-8);
|
fsm_tools_list_insert (&ex_tool,5);
|
||||||
fsm_tools_sort_list_insert (&ex_tool,3);
|
fsm_tools_list_insert (&ex_tool,-1);
|
||||||
fsm_tools_sort_list_insert (&ex_tool,5);
|
fsm_tools_list_insert (&ex_tool,4);
|
||||||
fsm_tools_sort_list_insert (&ex_tool,-1);
|
fsm_tools_list_insert (&ex_tool,2);
|
||||||
fsm_tools_sort_list_insert (&ex_tool,4);
|
fsm_tools_list_insert (&ex_tool,0);
|
||||||
fsm_tools_sort_list_insert (&ex_tool,-6);
|
fsm_tools_list_view (ex_tool);
|
||||||
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 :");
|
puts("retrait des 2 premiers elements :");
|
||||||
fsm_tools_sort_list_pop (&ex_tool);
|
fsm_tools_list_pop (&ex_tool);
|
||||||
fsm_tools_sort_list_pop (&ex_tool);
|
fsm_tools_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) :");
|
puts("ajout des 2 elements (3, 1) :");
|
||||||
fsm_tools_sort_list_insert (&ex_tool,8);
|
fsm_tools_list_insert (&ex_tool,3);
|
||||||
fsm_tools_sort_list_insert (&ex_tool,1);
|
fsm_tools_list_insert (&ex_tool,1);
|
||||||
fsm_tools_sort_list_insert (&ex_tool,6);
|
fsm_tools_list_view (ex_tool);
|
||||||
fsm_tools_sort_list_view (ex_tool);
|
|
||||||
|
|
||||||
fsm_tools_sort_list_clear (&ex_tool);
|
fsm_tools_list_clear (&ex_tool);
|
||||||
printf("clear()\n> nombre d'éléments restant = %d\n\n",
|
printf("clear()\n> nombre d'éléments restant = %d\n\n",
|
||||||
fsm_tools_sort_list_length(ex_tool));
|
fsm_tools_list_length(ex_tool));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -132,5 +132,7 @@ void fsm_add_displayable (char *displayable_name)
|
||||||
/* P R E F E R E N C E S */
|
/* P R E F E R E N C E S */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
void fsm_preferences_init () {fsm_displayable_list_init ();}
|
void fsm_preferences_init () {printf("src/fsm/prefer.c\
|
||||||
void fsm_displayable_list_init () { printf("src/fsm/prefer.c fsm_displayable_list_init()\n");}
|
| src/fsm/prefer.c fsm_preferences_init()\n");}
|
||||||
|
void fsm_displayable_list_init () {printf("src/fsm/prefer.c\
|
||||||
|
| src/fsm/prefer.c fsm_displayable_list_init()\n");}
|
||||||
|
|
|
@ -93,7 +93,7 @@ void util_sorted_list_test()
|
||||||
{
|
{
|
||||||
slist *Mysl = NULL;
|
slist *Mysl = NULL;
|
||||||
|
|
||||||
puts("\ncréation d'une liste de 10 elements :");
|
puts("\nfsm/util util_sorted_list_test() > création d'une liste de 10 elements :");
|
||||||
util_sorted_list_insert (&Mysl,9);
|
util_sorted_list_insert (&Mysl,9);
|
||||||
util_sorted_list_insert (&Mysl,-8);
|
util_sorted_list_insert (&Mysl,-8);
|
||||||
util_sorted_list_insert (&Mysl,3);
|
util_sorted_list_insert (&Mysl,3);
|
||||||
|
@ -118,6 +118,13 @@ void util_sorted_list_test()
|
||||||
util_sorted_list_insert (&Mysl,6);
|
util_sorted_list_insert (&Mysl,6);
|
||||||
util_sorted_list_view (Mysl);
|
util_sorted_list_view (Mysl);
|
||||||
|
|
||||||
|
puts("retrait des 5 derniers elements :");
|
||||||
|
util_sorted_list_pop (&Mysl);
|
||||||
|
util_sorted_list_pop (&Mysl);
|
||||||
|
util_sorted_list_pop (&Mysl);
|
||||||
|
util_sorted_list_pop (&Mysl);
|
||||||
|
util_sorted_list_pop (&Mysl);
|
||||||
|
|
||||||
util_sorted_list_clear (&Mysl);
|
util_sorted_list_clear (&Mysl);
|
||||||
printf("clear()\n> nombre d'éléments restant = %d\n\n",
|
printf("clear()\n> nombre d'éléments restant = %d\n\n",
|
||||||
util_sorted_list_length(Mysl));
|
util_sorted_list_length(Mysl));
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include "../../../../include/signal.h"
|
#include "../../../../include/signal.h"
|
||||||
|
|
||||||
#define MAX_SIZE 255
|
#define MAX_SIZE 255
|
||||||
|
#define CHECK_STACK 0
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Below is ^c^v from RMS C manual (p 77) 24 * 256 * 256 * 2 = 3 145 728
|
// Below is ^c^v from RMS C manual (p 77) 24 * 256 * 256 * 2 = 3 145 728
|
||||||
|
@ -77,7 +78,7 @@ static void push (Stack *stack, GtkWidget *value)
|
||||||
{
|
{
|
||||||
if (isFull(stack)) { printf("Stack Overflow\n"); return; }
|
if (isFull(stack)) { printf("Stack Overflow\n"); return; }
|
||||||
stack->arr[++stack->top] = value;
|
stack->arr[++stack->top] = value;
|
||||||
printf("%d ", stack->top);
|
if (CHECK_STACK) printf("%d ", stack->top);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget *pop (Stack *stack)
|
static GtkWidget *pop (Stack *stack)
|
||||||
|
@ -85,8 +86,8 @@ static GtkWidget *pop (Stack *stack)
|
||||||
if (isEmpty(stack)) { printf("Stack Underflow\n"); return NULL; }
|
if (isEmpty(stack)) { printf("Stack Underflow\n"); return NULL; }
|
||||||
GtkWidget *popped = stack->arr[stack->top];
|
GtkWidget *popped = stack->arr[stack->top];
|
||||||
stack->top--;
|
stack->top--;
|
||||||
printf("Popped %p from the stack %2d ", popped, stack->top);
|
if (CHECK_STACK) printf("Popped %p from the stack %2d ", popped, stack->top);
|
||||||
if ((stack->top + 1) % 3 == 0) printf("\n");
|
if (CHECK_STACK) if ((stack->top + 1) % 3 == 0) printf("\n");
|
||||||
return popped;
|
return popped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +172,7 @@ void *widget_get_an_impression_of_what_a_rules_comparator_could_be(){
|
||||||
push(&stack_b, GTK_WIDGET (gtk_picture_new_for_filename
|
push(&stack_b, GTK_WIDGET (gtk_picture_new_for_filename
|
||||||
("/home/jean/Gem-Graph/gem-graph-client/data/image/folic acid.png")));
|
("/home/jean/Gem-Graph/gem-graph-client/data/image/folic acid.png")));
|
||||||
|
|
||||||
printf(" ---------\
|
if (CHECK_STACK) printf(" ---------\
|
||||||
widget/rules/tree_tools/compare.c widget_get_an_impression_of_...()\n");//%d\n", *stack_b->arr[0]);
|
widget/rules/tree_tools/compare.c widget_get_an_impression_of_...()\n");//%d\n", *stack_b->arr[0]);
|
||||||
|
|
||||||
// peek(&stack_b);
|
// peek(&stack_b);
|
||||||
|
@ -235,7 +236,7 @@ static GtkWidget *do_rtfd (Stack stack) // TODO
|
||||||
static void *push_images_onto_stack (Stack stack)
|
static void *push_images_onto_stack (Stack stack)
|
||||||
{
|
{
|
||||||
clock_t start, end;
|
clock_t start, end;
|
||||||
printf("compare.c push_images_onto_stack() start >> ");
|
if (CHECK_STACK) printf("widget/rules/tree_tools/compare.c push_images_onto_stack() start >> ");
|
||||||
start = clock();
|
start = clock();
|
||||||
/*
|
/*
|
||||||
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
|
push(&stack, GTK_WIDGET (gtk_picture_new_for_filename
|
||||||
|
@ -285,6 +286,6 @@ static void *push_images_onto_stack (Stack stack)
|
||||||
*/
|
*/
|
||||||
end = clock();
|
end = clock();
|
||||||
long double t = (long double)(end - start) / CLOCKS_PER_SEC;
|
long double t = (long double)(end - start) / CLOCKS_PER_SEC;
|
||||||
printf(" << %9Lg sec\n", t);
|
if (CHECK_STACK) printf(" << %9Lg sec\n", t);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,8 +84,7 @@ void window_design_topbar_left (GtkWidget *header_bar)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define YOU_WANT_TO_START_ON_ANOTHER_PAGE 0
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* use the next lineS to select the page that will be presented first */
|
/* use the next lineS to select the page that will be presented first */
|
||||||
/* it triggers <=> signal.on_toggle_state_rule_data (a btt_NAME) */
|
/* it triggers <=> signal.on_toggle_state_rule_data (a btt_NAME) */
|
||||||
|
@ -93,11 +92,12 @@ void window_design_topbar_left (GtkWidget *header_bar)
|
||||||
/* the last one is the winner (and the winner takes it all !...) */
|
/* the last one is the winner (and the winner takes it all !...) */
|
||||||
/* 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_synth()), TRUE);
|
||||||
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_rules()), TRUE);
|
if (YOU_WANT_TO_START_ON_ANOTHER_PAGE) { // select one
|
||||||
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_state()), TRUE);
|
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_rules()), 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_state()), TRUE);
|
||||||
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_synth()), TRUE);
|
gtk_check_button_set_active (GTK_CHECK_BUTTON (widget_get_btt_data()), TRUE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue