src/fsm/control.c fsm_init() and fsm_close() can be now triggered from main().
These two functions (defined in control.c) initiate the log and print it just before the end of the program. It is now possible to send messages that reports the events occuring during a session: the creation of the log, then of the application and their closure in the reverse order. As previously,there is no g signal connect (activate) and no window is created. This triggers the same error message in the console. What is new, in this commit, is that a first log is printed in the console.
This commit is contained in:
parent
55a43c7861
commit
6e72f1f392
|
@ -403,7 +403,7 @@ MARKDOWN_ID_STYLE = DOXYGEN
|
|||
# globally by setting AUTOLINK_SUPPORT to NO.
|
||||
# The default value is: YES.
|
||||
|
||||
AUTOLINK_SUPPORT = YES
|
||||
AUTOLINK_SUPPORT = NO
|
||||
|
||||
# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
|
||||
# to include (a tag file for) the STL sources as input, then you should set this
|
||||
|
@ -565,7 +565,7 @@ EXTRACT_PACKAGE = NO
|
|||
# included in the documentation.
|
||||
# The default value is: NO.
|
||||
|
||||
EXTRACT_STATIC = NO
|
||||
EXTRACT_STATIC = YES
|
||||
|
||||
# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
|
||||
# locally in source files will be included in the documentation. If set to NO,
|
||||
|
@ -573,7 +573,7 @@ EXTRACT_STATIC = NO
|
|||
# for Java sources.
|
||||
# The default value is: YES.
|
||||
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_CLASSES = NO
|
||||
|
||||
# This flag is only useful for Objective-C code. If set to YES, local methods,
|
||||
# which are defined in the implementation section but not in the interface are
|
||||
|
@ -614,7 +614,7 @@ HIDE_UNDOC_MEMBERS = NO
|
|||
# if EXTRACT_ALL is enabled.
|
||||
# The default value is: NO.
|
||||
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_UNDOC_CLASSES = YES
|
||||
|
||||
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
|
||||
# declarations. If set to NO, these declarations will be included in the
|
||||
|
|
385
docs/readme
385
docs/readme
|
@ -1,385 +0,0 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Gem-graph client *
|
||||
* What the documentation contains and how to use it *
|
||||
* Docstring content: rationale and usage *
|
||||
* Alphabetic Index 2024 of functions names *
|
||||
* *
|
||||
* Copyright © 2021 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 publishedby 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/>. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
|
||||
Attention
|
||||
Let's repeat that, because it is often overlooked:
|
||||
to document global objects (functions, typedefs, enum, macros, etc),
|
||||
you must document the file in which they are defined.
|
||||
In other words, there must at least be a
|
||||
/** \file */
|
||||
(or /*! \file */)
|
||||
line in this file.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
*
|
||||
* docstrings
|
||||
* ----------
|
||||
* Pour chaque fonction, quelles sont les infos prioritaires ?
|
||||
*
|
||||
* @brief
|
||||
* @details
|
||||
* @date
|
||||
* @author
|
||||
* @callgraph
|
||||
* @see (liste des fonctions appelées par cette fonction)
|
||||
* @callergraph
|
||||
* @see (liste des fonctions qui appellent cette fonction)
|
||||
* @param (liste des paramètres)
|
||||
* @return
|
||||
|
||||
autres (à envisager) @see https://www.doxygen.nl/manual/commands.html
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
git commit 2024-10-14 avant d'exécuter une commande sed
|
||||
qui remplacera tous les commentaires 'fantômes':
|
||||
/** phantom documentation used to test the functioning of doxygen */
|
||||
/**< a_variable_name phantom documentation */
|
||||
|
||||
|
||||
sed -i 's/phantom documentation used to test the functioning of doxygen/\n
|
||||
* @brief \n * @details \n * @dir \n * @file \n * @date \n * @author \n
|
||||
* @callgraph \n * @see \n * @callergraph \n * @see\n * @param \n * @return \n/'
|
||||
./src/main.c < or any other file...
|
||||
|
||||
NB signal et journal n'ont pas été 'tagués' <<<<<<<<<<
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
|
||||
*
|
||||
*
|
||||
* TODO : actuellement, valgrind bin/gem-graph-client détecte :
|
||||
*
|
||||
* HEAP SUMMARY:
|
||||
* in use at exit: 11,537,505 bytes in 42,285 blocks
|
||||
* total heap usage: 483,548 allocs,
|
||||
* 441,263 frees,
|
||||
* 112,049,363 bytes allocated
|
||||
* LEAK SUMMARY:
|
||||
* definitely lost: 40,161 bytes in 79 blocks
|
||||
* indirectly lost: 11,233 bytes in 489 blocks
|
||||
* possibly lost: 7,879,639 bytes in 7,844 blocks
|
||||
* still reachable: 3,412,408 bytes in 32,248 blocks
|
||||
* suppressed: 0 bytes in 0 blocks
|
||||
* Rerun with --leak-check=full to see details of leaked memory
|
||||
*
|
||||
* valgrind --leak-check=full > ERROR SUMMARY: 1572 errors from 680 contexts
|
||||
* --track-origins=yes ERROR SUMMARY: 896 errors from 4 contexts
|
||||
* --show-leak-kinds=all
|
||||
*
|
||||
* sanitize <<
|
||||
*
|
||||
*
|
||||
* TODO des scripts devraient pouvoir recueillir ces informations
|
||||
* pour produire automatiquement, à la demande, des listes comme celle qui suit.
|
||||
* (voir le dossier 'scripts')
|
||||
* > plutôt utiliser Doxygen.
|
||||
*
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* C O N V E N T I O N S E T R È G L E S D E N O M M A G E - 2 0 2 4
|
||||
*
|
||||
* Le nom d'une fonction doit permettre d'identifier facilement:
|
||||
* - le lieu (le fichier) où elle est définie,
|
||||
* - le type d'action qu'elle exécute et
|
||||
* - les objets modifiés par son action.
|
||||
*
|
||||
* - - -
|
||||
*
|
||||
* Ces trois informations sont encodées au moyen de trois "préfixes"
|
||||
* associés et concaténés dans cet ordre pour former le nom.
|
||||
*
|
||||
* - - -
|
||||
*
|
||||
* En octobre 2024, la première version de cet:
|
||||
* "index alphabétique des fonctiond du client gem-graph"
|
||||
* classe en trois listes l'ensemble des préfixes utilisés.
|
||||
*
|
||||
* Ces listes sont en cours d'élaboration.
|
||||
* Elles ne sont ni limitatives ni exhaustives ni ordonnées.
|
||||
* TODO
|
||||
*
|
||||
* - - -
|
||||
*
|
||||
* Le premier préfixe est l'adresse du fichier dans la hiérarchie "src":
|
||||
* ex: graphics_draw_
|
||||
* fsm_measures_manager_
|
||||
* util_draw_gl_
|
||||
* widget_one_rule_algebra_assign_
|
||||
*
|
||||
* Le deuxième préfixe est choisi dans une liste de fonctions types:
|
||||
* get, set, reset, read, write, print, edit, concat, design,
|
||||
* init, create, add, remove, erase, restore, trigger, draw, push
|
||||
* setup, shutdown, update, list, sort, seek, select, fix, debug,
|
||||
* render, realize, unrealize, activate, exec, stop, signal,
|
||||
*
|
||||
* Le troisième préfixe est choisi dans une liste d'objets ou d'états
|
||||
* qui sont modifiés par les fonctions.
|
||||
* Ce préfixe peut être composé de deux, trois ou quatre items
|
||||
* appartenant à cette liste et d'une conjonction si besoin.
|
||||
* ex: axis_slider, stack_slot_size, user_tree_model_child,
|
||||
* grids_on_space_faces_lines, current_model_before_editing, etc.
|
||||
*
|
||||
* number, string, view, image, window, list, tree, stack,
|
||||
* file, buffer, callback, signal,
|
||||
* widget, button, slider, color, glarea, shader,
|
||||
* point, line, plan, space_unit, site, arrow, slot, vertex, ridge, axis
|
||||
* state, rules, data, results, stock,
|
||||
*
|
||||
*
|
||||
*
|
||||
* Le 2024-10-05, seules trois fonctions ne sont pas nommées selon ces règles:
|
||||
* > create_axis_slider, free_stack_slot, free_stack_slot_size <
|
||||
*
|
||||
* et les noms de cinq autres pourraient être améliorés.
|
||||
* graphics_shutdown_graphics_stack > graphics_shutdown_stack < ex.
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
|
||||
|
||||
create_axis_slider util/draw/gl 223 << to rename
|
||||
free_stack_slot graphics/init 36 << to rename
|
||||
free_stack_slot_size graphics/init 37 << to rename
|
||||
get_user_tree_model util/tree 66 static
|
||||
get_user_tree_model_child util/tree 49 static
|
||||
graphics_create_shader 187 ?
|
||||
graphics_debug_callback graphics/init 53 static
|
||||
graphics_draw graphics/draw 150
|
||||
graphics_draw_color graphics/draw 74
|
||||
graphics_draw_grids_on_space_faces_lines graphics/grid 129
|
||||
graphics_draw_grids_on_space_faces_vertex graphics/grid 75
|
||||
graphics_draw_line graphics/draw 100
|
||||
graphics_draw_one_arrow_line 365 ?
|
||||
graphics_draw_one_arrow_vertex 355 ?
|
||||
graphics_draw_plan graphics/draw 124
|
||||
graphics_draw_space_ridges_lines graphics/grid 62
|
||||
graphics_draw_space_ridges_vertex graphics/grid 30
|
||||
graphics_draw_vertex graphics/draw 40
|
||||
graphics_init graphics/init 108
|
||||
graphics_init_buffers graphics/init 326
|
||||
graphics_init_graphics_stack 127 ?
|
||||
graphics_init_shaders graphics/init 370
|
||||
graphics_model_setup graphics/init 228
|
||||
graphics_print_stack 221 ?
|
||||
graphics_render_stack 87 ?
|
||||
graphics_set_arrow 401 ?
|
||||
graphics_setup_glarea 89 ?
|
||||
graphics_shutdown graphics/init 169
|
||||
graphics_shutdown_graphics_stack 128 << to rename
|
||||
graphics_stack graphics/init 34
|
||||
graphics_stack_size graphics/init 35
|
||||
graphics_stack_t graphics.h
|
||||
graphics_update_axis_stack 129 ?
|
||||
fsm_add_data fsm/measures/data_list
|
||||
fsm_add_displayable fsm/preferences/manager
|
||||
fsm_add_measure fsm/measures/manager
|
||||
fsm_add_result fsm/results/manager
|
||||
fsm_disp_add_chart fsm/measures/disp_list
|
||||
fsm_disp_get_chart fsm/measures/disp_list
|
||||
fsm_disp_remove_chart fsm/measures/disp_list
|
||||
fsm_enum_exec_edit fsm.h
|
||||
fsm_enum_journal_severity fsm.h
|
||||
fsm_enum_journal_source fsm.h
|
||||
fsm_enum_measure_type fsm.h
|
||||
fsm_enum_state_rules_data fsm.h
|
||||
fsm_enum_store_restore_reset fsm.h
|
||||
fsm_get_data fsm/measures/data_list
|
||||
fsm_get_exec_edit fsm/dispatch
|
||||
fsm_get_preferences_state fsm/dispatch
|
||||
fsm_get_state_rules_data fsm/dispatch
|
||||
fsm_init fsm/dispatch
|
||||
fsm_journal_clear src/journal
|
||||
fsm_journal_event fsm/dispatch
|
||||
fsm_journal_init src/journal
|
||||
fsm_journal_length src/journal
|
||||
fsm_journal_pop_back src/journal
|
||||
fsm_journal_publication_request fsm/dispatch
|
||||
fsm_journal_publish src/journal
|
||||
fsm_journal_push_front src/journal
|
||||
fsm_journal_seek src/journal
|
||||
fsm_list_init_displayables fsm/prefer
|
||||
fsm_list_init_measures fsm/measures/manager
|
||||
fsm_list_init_preferences fsm/preferences/manager
|
||||
fsm_list_init_results fsm/results/manager
|
||||
fsm_list_tools_clear fsm/measures/tools_list
|
||||
fsm_list_tools_insert fsm/measures/tools_list
|
||||
fsm_list_tools_length fsm/measures/tools_list
|
||||
fsm_list_tools_pop fsm/measures/tools_list
|
||||
fsm_list_tools_test fsm/measures/tools_list
|
||||
fsm_list_tools_view fsm/measures/tools_list
|
||||
fsm_remove_data fsm/measures/data_list
|
||||
fsm_reset_all_situations_values fsm/preferences/manager
|
||||
fsm_rule_trig_measure fsm/measures/manager
|
||||
fsm_set_exec_edit fsm/dispatch
|
||||
fsm_set_preferences_modified fsm/dispatch
|
||||
fsm_set_state_rules_data fsm/dispatch
|
||||
fsm_set_store_restore_reset fsm/dispatch
|
||||
fsm_struct_journal fsm.h
|
||||
fsm_struct_journal_unit fsm.h
|
||||
fsm_struct_list_data fsm.h
|
||||
fsm_struct_list_disp fsm.h
|
||||
fsm_struct_list_tool fsm.h
|
||||
on_auto_notification signal 37 static
|
||||
on_axis_value_change signal 181
|
||||
on_bind_user_tree_factory signal 81
|
||||
on_clicked_topbar_right_home signal 373 << to rename
|
||||
on_clicked_topbar_right_search signal 364 << to rename
|
||||
on_discard_current_model_before_editing signal 228
|
||||
on_entry_name_delete_after signal 547
|
||||
on_entry_name_insert_after signal 542
|
||||
on_glarea_realize signal 132
|
||||
on_glarea_render signal 112
|
||||
on_glarea_unrealize signal 158
|
||||
on_measure_ ... signal 453 sqq.
|
||||
on_realize_debug util/draw/gl 335 static
|
||||
on_render_debug util/draw/gl 345 static
|
||||
on_resetting_XYZ_in_state_page signal 404
|
||||
on_save_current_model_before_editing signal 220
|
||||
on_select_rules_first signal 446
|
||||
on_setup_user_tree_factory signal 73
|
||||
on_situations_box_do_reset signal 412
|
||||
on_start_new_measure signal 439
|
||||
on_toggle_exec_edit signal 254 << to rename
|
||||
on_toggle_state_rules_data signal 286 << to rename
|
||||
on_topbar_right_measure_clicked signal 426
|
||||
on_updating_objects_transparencies signal 389
|
||||
on_user_tree_expander_toggled signal 64 static
|
||||
on_windows_activation widget/dispatch 67
|
||||
on_windows_startup widget/dispatch 61
|
||||
on_write_current_model signal 236
|
||||
parse_model_get_dim util/parse 231
|
||||
parse_model_get_dim_value util/parse 244
|
||||
parse_model_get_multiplicity util/parse 255
|
||||
parse_model_get_next_arrow util/parse 346
|
||||
parse_model_get_next_state util/parse 269
|
||||
parse_model_get_state_arrows_count util/parse 295
|
||||
parse_model_init 29 (not used)
|
||||
parse_model_shutdown util/parse 88
|
||||
parse_parse_model_init util/parse 46
|
||||
shader frag graphics/shader
|
||||
shader vert graphics/shader
|
||||
stack_index stack_index 38
|
||||
stack_index_size stack_index 39
|
||||
stack_index_t util/draw/gl.c 32
|
||||
switch_state_rules_data signal 305 static
|
||||
TreeNode_t widget.h (rename ?)
|
||||
util_concat util/strings_op
|
||||
util_gl_clean_stack_index util/draw/gl.c 150
|
||||
util_gl_get_stack util/draw/gl.c 66
|
||||
util_gl_init_stack util/draw/gl.c 102
|
||||
util_gl_is_ready util/draw/gl.c 84
|
||||
util_gl_is_util_ready 92 TODO
|
||||
util_gl_render_stack util/draw/gl.c 166
|
||||
util_gl_set_arrow util/draw/gl.c 42
|
||||
util_gl_setup_glarea util/draw/gl.c 364
|
||||
util_gl_shutdown_all_stacks util/draw/gl.c 207
|
||||
util_gl_shutdown_stack util/draw/gl.c 133
|
||||
util_gl_update_axis util/draw/gl.c 187
|
||||
util_list_2x2_ ^c^v (8 fonctions) util/list_2x2
|
||||
util_pile_ ^c^v (5 fonctions) util/pile
|
||||
util_read_file util/io
|
||||
util_sorted_list_ ^c^v (5 fonctions) util/sorted_list
|
||||
util_test_double_list util/tests
|
||||
util_test_pile util/tests
|
||||
util_test_sorted_list util/tests
|
||||
util_trigger_test util/tests
|
||||
widget_add_tree_child_node util/tree 32
|
||||
widget_create_user_rules_tree_node util/tree 41
|
||||
widget_design_dialog_window widget/dispatch
|
||||
widget_design_main_window widget/dispatch
|
||||
widget_design_text_window widget/dispatch
|
||||
widget_measure_do_select_rules_first widget/measure/dispatch
|
||||
widget_measure_do_ ... 295 sqq.
|
||||
widget_measure_event_occurences_dates widget/measure/dispatch
|
||||
widget_measure_event_occurences_nb widget/measure/dispatch
|
||||
widget_measure_event_occurences_situations widget/measure/dispatch
|
||||
widget_measure_other_events_between_the_two widget/measure/dispatch
|
||||
widget_measure_time_elapsed_between_two_events widget/measure/dispatch
|
||||
widget_get_address_text_theory widget/topbar/dispatch
|
||||
widget_get_address_text_practice widget/topbar/dispatch
|
||||
widget_get_btt_label_data widget/topbar/left
|
||||
widget_get_btt_label_rules widget/topbar/left
|
||||
widget_get_btt_label_state widget/topbar/left
|
||||
widget_get_btt_label_synth widget/topbar/left
|
||||
widget_get_dialog_window widget/dispatch
|
||||
widget_get_graph_view_control widget/state/middle
|
||||
widget_get_main_window widget/dispatch
|
||||
widget_get_non_time_dependent widget/synth/dispatch
|
||||
widget_get_object_transparency widget/state/top
|
||||
widget_get_page_data widget/results/dispatch
|
||||
widget_get_page_engine 104 TODO
|
||||
widget_get_page_measure widget/measure/dispatch
|
||||
widget_get_page_state widget/state/dispatch
|
||||
widget_get_page_synth widget/synth/dispatch
|
||||
widget_get_pane_all_rules_left widget/all_rules/dispatch
|
||||
widget_get_pane_selected_rule_right widget/one_rule/dispatch
|
||||
widget_get_results_box_display widget/results/display
|
||||
widget_get_results_box_organize widget/results/organize
|
||||
widget_get_results_box_time widget/results/display
|
||||
widget_get_rule_edition_tools widget/one_rule/geometry/edit
|
||||
widget_get_rule_investigation_tools widget/one_rule/geometry/investigate
|
||||
widget_get_rule_geometry_and_algebra 187 TODO (not yet used)
|
||||
widget_get_rules_pilot_box widget/all_rules/tree/pilot_box
|
||||
widget_get_rules_tree_tools widget/all_rules/tree/pilot_box
|
||||
widget_get_rules_use widget/all_rules/tree/freq
|
||||
widget_get_selected_rule widget/one_rule/dispatch
|
||||
widget_get_selected_rule_algebra widget/one_rule/algebra/dispatch
|
||||
widget_get_selected_rule_assignations_list_btt widget/one_rule/algebra/assign
|
||||
widget_get_selected_rule_before_after widget/one_rule/geometry/geometry
|
||||
widget_get_selected_rule_camera widget/one_rule/geometry/camera
|
||||
widget_get_selected_rule_conditions_list_btt widget/one_rule/algebra/conditions
|
||||
widget_get_selected_rule_geometry widget/one_rule/geometry/dispatch
|
||||
widget_get_selected_rule_identity_btt widget/one_rule/algebra/identity
|
||||
widget_get_sequence_control widget/state/bottom
|
||||
widget_get_space_edit_control widget/state/bottom
|
||||
widget_get_space_view widget/state/middle
|
||||
widget_get_space_vs_non_time_dependent widget/synth/dispatch
|
||||
widget_get_text_from_address widget/topbar/modal
|
||||
widget_get_text_window widget/dispatch
|
||||
widget_get_time_dependent widget/synth/time
|
||||
widget_get_user_rules_tree util/tree 88
|
||||
widget_reset_XYZ_in_state_pane widget/state/middle TODO (dispatch)
|
||||
widget_reset_XYZ_scrollbars_rule 166 TODO
|
||||
widget_reset_XYZ_scrollbars_state 167 TODO
|
||||
widget_reset_XYZ_scrollbars_synth 168 TODO
|
||||
widget_set_item_text widget/one_rule/algebra/dispatch
|
||||
widget_set_objects_value widget/state/top
|
||||
widget_set_situations_value widget/state/top
|
||||
window_design_topbar_left widget/dispatch
|
||||
window_design_topbar_right widget/dispatch
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
Welcome to Gem-graph !
|
||||
|
||||
Gem-graph lets you move or transform drawn objects and can be used in all cases where drawings, designs or patterns are useful. You can draw anything you like. You can make it move or transform as you like. It is your design and you decide how you want it to evolve! You can use it to make a game. You can use it to make an animated representation (a model) of a phenomenon that interests you. You can represent what you want simply or in more realistic detail. Simple parts and more detailed parts can coexist in the same design. You can watch what you have created evolve without interfering or guiding it towards what you want to achieve. You can observe it in detail, go back, start again, measure, compare and keep the results that interest you so that you can play them again.
|
||||
|
||||
However, a certain amount of effort may be required to achieve the desired results. A complicated model will require more work than a simpler one, but it is possible to start with something simple and develop it step by step. In any case, you must draw what you want to see and say how you want it to move. Gem-graph cannot do that for you. Gem-graph can only help you to draw up and develop your idea. However, it can give you powerful tools to do so. All this is possible because the drawings that gem-graph manipulates are made up of very simple elements, all similar, driven by simple rules that can therefore be processed automatically. The tools provided by gem-graph give you access to the power of the automaton it uses to draw and animate your drawings, and this manual is here to help you to learn how to master them.
|
||||
|
||||
One way of doing this is to reproduce a very simple example, such as when a word processing program asks you to write "Hello world". For gem-graph, the equivalent of "Hello world" will be to move a small line on your screen. Once you have done this simple example, you will know enough to quickly build and animate much more complex drawings that suit your desires. If you like learning this way, this example is explained (here). If you prefer to learn by reading what the commands you see on the screen are doing, they have been detailed (here). The table of contents goes from the simplest to the most complicated. How to set up a simple model, observe it and measure what it does, then transform it by changing what you see and how it reacts.
|
||||
|
||||
------------
|
||||
|
||||
Our "Hello world" is the simplest program that gem-graph can execute. It consists of a single short arrow, which moves in a straight line in a single direction. To do this, we first had to draw this little arrow and then make it move. The result is certainly not very exciting, but this example is enough to show how a drawing is made and how it is animated. One state and one rule are enough. The rule only says: if an arrow is drawn here, I erase it and redraw it on the next square. For the moment, you don't need to know in detail how the rule works (it's described here). All that gem-graph needs to know is written in the "Hello world" file (here). If you open this file, you'll find a description of the arrow (here) and its movement (here).
|
||||
|
||||
------------
|
||||
|
||||
To improve this model, it is possible to give the arrow the ability to move in two directions: forwards or backwards. To do this, we need to add a second rule. This second rule says: if an arrow is drawn here, I erase it and redraw it on the previous square. A random draw (described here) is also necessary to determine whether the first or second rule applies. With these two rules and the random draw, the arrow now sometimes goes forwards, sometimes backwards. We can call this second model a "random walk".
|
||||
|
||||
------------
|
||||
|
||||
The second model (the random walk) had one state (the arrow) and two rules (forward/backward). Now here's a model with two states and two rules: the pendulum. This time, the arrow can be drawn either tilted forwards or tilted backwards (these are the two possible states) and the two rules switch the drawn arrow from one state to the other or vice versa. In the file, the states are (here) and the rules (here). The pendulum does not change place, but alternates between left and right. Like the previous ones, the programme is slowed down so that you can see the movements.
|
||||
|
||||
------------
|
||||
|
||||
Once you know how to write a state and a rule, you can write thousands of them: they will always be combinations of the same elementary form. However, it is also possible to combine programs: for example, you can combine the reports and rules from the two previous models to create a new model that shows both phenomena simultaneously. Once again, in the file, the states are (here) and the rules (here).
|
||||
|
||||
------------
|
||||
|
||||
A final simple example shows how a single rule can be applied to a multitude of states. The rule is the same as for the first model: an arrow can only be moved one square forward, but this time you have to check that the square forward is free. If it isn't, the arrow won't move. And this time, the space contains a multitude of arrows that have been randomly placed all over the place (see details here).
|
||||
When you open this model, you see a multitude of small lines, all similar, some vertical, some horizontal, placed on a grid. When you set the model in motion, you see these little lines moving from left to right if they are horizontal, and up and down if they are vertical (a second rule vas added to do that). Their number is constant. They don't change shape or direction. There seems to be no accident when they cross. Nothing else happens.
|
||||
|
||||
------------
|
||||
|
||||
These five examples give an initial idea of the diversity of possible models and the operations that can be performed on them.
|
||||
|
||||
|
|
@ -1,18 +1,29 @@
|
|||
/**
|
||||
* @file
|
||||
* Fsm (finite state machine) header
|
||||
* Client fsm (finite state machine) header
|
||||
*
|
||||
* This file is part of Gem-graph.
|
||||
*
|
||||
*
|
||||
* This commit introduces the functions that the log needs.
|
||||
* This commit introduces:
|
||||
*
|
||||
* - the two functions that enable main() to init and close the log:
|
||||
* fsm_trigger_log_init() and fsm_trigger_log_close()
|
||||
*
|
||||
* - the two functions that enable main() to init and close the fsm:
|
||||
* fsm_init() and fsm_close()
|
||||
*
|
||||
* - the two functions that enable the fsm to init and close its structures:
|
||||
* fsm_structures_init() and fsm_structures_close()
|
||||
*
|
||||
*
|
||||
* @see readme.docs and this text below.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* The two structures and the two enums listed below will stay in the fsm header.
|
||||
* The two log structures and the two enums listed below stay in the fsm header.
|
||||
*
|
||||
* All functions are now in dedicated files.
|
||||
* All log functions are now in dedicated files.
|
||||
*
|
||||
* The most important function: fsm_add_log() is in the file:
|
||||
* /src/fsm/log/manager.c
|
||||
|
@ -104,7 +115,7 @@
|
|||
* https://en.wikipedia.org/wiki/Syslog
|
||||
*
|
||||
* All logs must contain at least one item from this enum and only one.
|
||||
* This item can not be set to NULL.
|
||||
* This item can NOT be set to NULL.
|
||||
*
|
||||
* @see fsm_add_log()
|
||||
*/
|
||||
|
@ -238,10 +249,16 @@ long fsm_remove_log (fsm_log_struct *jj,
|
|||
const char *function_source,
|
||||
const char *string_value);
|
||||
|
||||
void fsm_add_log (int severity,
|
||||
int source,
|
||||
const char *file_source,
|
||||
const char *function_source,
|
||||
const char *string_value);
|
||||
void fsm_add_log (int severity,
|
||||
int source,
|
||||
const char *file_source,
|
||||
const char *function_source,
|
||||
const char *string_value);
|
||||
|
||||
void fsm_trigger_log_init();
|
||||
void fsm_trigger_log_close();
|
||||
|
||||
void fsm_init (const char *initial_message_from_main);
|
||||
void fsm_close (const char *final_message_from_main);
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,214 @@
|
|||
/**
|
||||
* @file
|
||||
* Client fsm (Finite State Machine) control file.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* The fsm control instance
|
||||
* - **initialises** the log and the rest of the fsm when triggered by main()
|
||||
* - **checks** all triggered operations and **allocates** them if they are valid
|
||||
* - **closes** all the elements it opened before handing over to main()
|
||||
* .
|
||||
*
|
||||
* About code organization, see src/readme.dox
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* @cond LICENSE
|
||||
* Copyright © 2021 Libre en Communs <contact@a-lec.org>
|
||||
* Copyright © 2021-2024 Adrien Bourmault <neox@a-lec.org>
|
||||
* Copyright © 2021-2024 Jean Sirmai <jean@a-lec.org>
|
||||
*
|
||||
* 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/>.
|
||||
* @endcond
|
||||
*
|
||||
* @file
|
||||
* @brief
|
||||
*
|
||||
* This file is part of Gem-graph.
|
||||
*
|
||||
* @details
|
||||
* The Finite State Machine (fsm) describes all the possible states of the
|
||||
* Gem-graph client and all the transitions between them.
|
||||
* It manages several kinds of exclusive states:
|
||||
* - Run the model or edit it.
|
||||
* - Select a single view of the model from all those possible.
|
||||
* The different views show either the space, or the rule tree,
|
||||
* or a single rule of interest, or measurements or results.
|
||||
* NB an overview is possible, but it does not provide details.
|
||||
* - Apply a selected measurement to the currently running model
|
||||
* - Select some results for study or/and presentation.
|
||||
* - Choose the user's preferred values for a set of parameters
|
||||
* used to modify the appearance or behaviour of gem-graph.
|
||||
*
|
||||
* Each state of the fsm is a combination of each of these states.
|
||||
*
|
||||
* The current state of the fsm must be
|
||||
* - saved at the end of a work session and
|
||||
* - reread (available to the user) at the start of a new session.
|
||||
*
|
||||
* No state of the fsm should be defined in another module.
|
||||
*
|
||||
* No fsm transition should be executed in another module.
|
||||
*
|
||||
* The journal is created, edited and published from here.
|
||||
*
|
||||
* @cond LICENSE
|
||||
* Copyright © 2021 Libre en Communs <contact@a-lec.org>
|
||||
* Copyright © 2021-2024 Adrien Bourmault <neox@a-lec.org>
|
||||
* Copyright © 2021-2024 Jean Sirmai <jean@a-lec.org>
|
||||
*
|
||||
* 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/>.
|
||||
* @endcond
|
||||
*/
|
||||
|
||||
|
||||
#include "../../include/fsm.h"
|
||||
|
||||
|
||||
/**
|
||||
* Initiates the four lists:
|
||||
* 'measures', 'results', 'displayables results' and 'preferences'.
|
||||
* The items selected in these lists contribute to define the current state of
|
||||
* the fsm.
|
||||
* The exact number and status of the structures of the fsm are still being
|
||||
* assessed.
|
||||
*
|
||||
* @callergraph
|
||||
* @see fsm_init()
|
||||
*/
|
||||
static void fsm_structures_init()
|
||||
{
|
||||
/**< will be introduced later on:
|
||||
|
||||
fsm_add_log (info, FSM, "fsm/dispatch", "measures list init()",
|
||||
"measurement processes");
|
||||
fsm_list_init_measures();
|
||||
|
||||
fsm_add_log (info, FSM, "fsm/dispatch", "results list init()",
|
||||
"measurement results (gross)");
|
||||
fsm_list_init_results();
|
||||
|
||||
fsm_add_log (info, FSM, "fsm/dispatch", "displayables list init()",
|
||||
"displayable results");
|
||||
fsm_list_init_displayables();
|
||||
|
||||
fsm_add_log (info, FSM, "fsm/dispatch", "preferences list init()",
|
||||
"preferences");
|
||||
fsm_list_init_preferences();
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Closes the four lists:
|
||||
* 'measures', 'results', 'displayables results' and 'preferences'.
|
||||
* The items selected in these lists contribute to define the current state of
|
||||
* the fsm.
|
||||
* The exact number and status of the structures of the fsm are still being
|
||||
* assessed.
|
||||
*
|
||||
* @callergraph
|
||||
* @see fsm_close()
|
||||
*/
|
||||
static void fsm_structures_close()
|
||||
{
|
||||
/**< ? */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief fsm_init() is the first function called by main.c
|
||||
* It initiates the journal and calls fsm_structures_init() that
|
||||
*
|
||||
* @since 2024-08
|
||||
*
|
||||
* @callergraph
|
||||
* @see main()
|
||||
*
|
||||
* @callgraph
|
||||
* @see trigger_fsm_log_init()
|
||||
* @see fsm_add_log()
|
||||
* @see fsm_list_init_measures()
|
||||
* @see fsm_list_init_results()
|
||||
* @see fsm_list_init_displayables()
|
||||
* @see fsm_list_init_preferences()
|
||||
*
|
||||
* @param *initial_info_from_main
|
||||
*/
|
||||
void fsm_init (const char *initial_info_from_main)
|
||||
{
|
||||
fsm_trigger_log_init(); /**< fsm_init_log(() can't be called from here
|
||||
* because static fsm_log_struct gg_logs
|
||||
* is in src/fsm/log/manager.c */
|
||||
|
||||
fsm_add_log (INFO, MAIN, "main", initial_info_from_main,
|
||||
"👋️ (☕️) Hi everybody ! Here is Gem-Graph.");
|
||||
|
||||
fsm_add_log (INFO, FSM, "fsm/control", "fsm initialisation", "has began ✍️");
|
||||
fsm_structures_init();
|
||||
fsm_add_log (INFO, FSM, "fsm/control", "fsm initialisation", "has ended 😇️");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief fsm_close() is the last function called by main.c It closes all that
|
||||
* was opened in reverse order before handing over to main().
|
||||
*
|
||||
* @details It ensures the fsm state is saved:
|
||||
* - preferences
|
||||
* - model
|
||||
*
|
||||
* Then it closes the four lists:
|
||||
* - 'measures',
|
||||
* - 'results',
|
||||
* - 'displayables results' and
|
||||
* - 'preferences'.
|
||||
* and closes the journal
|
||||
*
|
||||
* @since 2024-08
|
||||
*
|
||||
* @callergraph
|
||||
* @see main()
|
||||
*
|
||||
* @callgraph
|
||||
* @see fsm_structures_close()
|
||||
* @see fsm_trigger_log_close()
|
||||
* @see fsm_add_log()
|
||||
*
|
||||
* @param *closing_info_from_main
|
||||
*/
|
||||
void fsm_close (const char *closing_info_from_main)
|
||||
{
|
||||
fsm_add_log (INFO, FSM, "fsm/control", "fsm closing", "has began");
|
||||
fsm_structures_close();
|
||||
fsm_add_log (INFO, FSM, "fsm/control", "fsm closing", "has ended");
|
||||
|
||||
fsm_add_log (INFO, MAIN, "main", closing_info_from_main,
|
||||
"👋️😄️ That'all folks !");
|
||||
|
||||
fsm_trigger_log_close(); /**< fsm_clear_log(() can't be called from here
|
||||
* because static fsm_log_struct gg_logs
|
||||
* is in src/fsm/log/manager.c */
|
||||
}
|
|
@ -57,9 +57,8 @@ static fsm_log_struct gg_logs;
|
|||
*
|
||||
* A message is send to the log for each documented event.
|
||||
*
|
||||
* If there are too many events, one or several filters can be applied
|
||||
* here (and only here) before publication, to select only some events
|
||||
* of interest (during debugging, for example).
|
||||
* One or several filters can be applied here (and only here) before publication,
|
||||
* to select only some events of interest (during debugging, for example).
|
||||
*
|
||||
* These filters can operate on any the following five parameters:
|
||||
* severity, source, file_source (text), function_source (text),
|
||||
|
@ -102,3 +101,38 @@ void fsm_add_log (int severity,
|
|||
)
|
||||
fsm_add_log_event (&gg_logs, file_source, function_source, string_value);
|
||||
}
|
||||
|
||||
/**
|
||||
* this function is a relay: fsm_init_log() can't be called directly from
|
||||
* fsm_init() in control because static fsm_log_struct gg_logs is in
|
||||
* src/fsm/log/manager.c
|
||||
*
|
||||
*
|
||||
* @since 2024-08
|
||||
*
|
||||
* @callergraph
|
||||
* @see main()
|
||||
*
|
||||
*/
|
||||
void fsm_trigger_log_init()
|
||||
{
|
||||
fsm_init_log (&gg_logs);
|
||||
}
|
||||
|
||||
/**
|
||||
* this function is a relay: fsm_publish_log() and fsm_clear_log() can't be
|
||||
* called directly from fsm_close() in control because static fsm_log_struct
|
||||
* gg_logs is in src/fsm/log/manager.c
|
||||
*
|
||||
* @since 2024-08
|
||||
*
|
||||
* @callergraph
|
||||
* @see main()
|
||||
*
|
||||
*/
|
||||
void fsm_trigger_log_close()
|
||||
{
|
||||
fsm_publish_log (gg_logs);
|
||||
fsm_clear_log (&gg_logs);
|
||||
}
|
||||
|
||||
|
|
67
src/main.c
67
src/main.c
|
@ -1,7 +1,6 @@
|
|||
/**
|
||||
* @file
|
||||
*
|
||||
* Gem-graph main file
|
||||
* Gem-graph-client main file.
|
||||
*
|
||||
* This file is part of Gem-graph. It contains only the main() function.
|
||||
*
|
||||
|
@ -26,16 +25,22 @@
|
|||
*
|
||||
* ---
|
||||
*
|
||||
* The main() function will **initialise** the log, the finite state machine (fsm),
|
||||
* the application and the windows and **close** all the elements it opened
|
||||
* before the end of program execution.
|
||||
* The main() function
|
||||
* - **initialise**
|
||||
* -# the log,
|
||||
* -# the finite state machine (fsm),
|
||||
* -# the application,
|
||||
* -# the windows and
|
||||
*
|
||||
* - **close** all the elements it opened in reverse order
|
||||
* before ending the program execution
|
||||
* .
|
||||
*
|
||||
* In this commit, it does not implement g_application_activate() and has no
|
||||
* handlers connected to the 'activate' signal (which triggers an error message).
|
||||
*
|
||||
* The default values of the fsm initial state will be specified in:
|
||||
* src/fsm/dispatch(). They are user preference and, in accordance, the overview
|
||||
* page of the current model will be displayed as they specify it in:
|
||||
* src/widget/main_window/designer/widget_design_main_window().
|
||||
* src/fsm/control(). They are user preferences.
|
||||
*
|
||||
* About code organization, see src/readme.dox
|
||||
*
|
||||
|
@ -43,19 +48,49 @@
|
|||
*/
|
||||
|
||||
#include <gtk-4.0/gtk/gtk.h>
|
||||
#include "../include/fsm.h" // finite state machine (fsm)
|
||||
|
||||
/**
|
||||
* @since 2024-04
|
||||
*
|
||||
* @callgraph
|
||||
* @see fsm_trigger_log_init()
|
||||
* @see fsm_init()
|
||||
* @see fsm_close()
|
||||
* @see fsm_trigger_log_close()
|
||||
* @see fsm_add_log()
|
||||
*
|
||||
* @param argc
|
||||
* @param **argv
|
||||
* @return status, the program errorlevel
|
||||
*/
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
GtkApplication *app;
|
||||
int status;
|
||||
GtkApplication *app;
|
||||
int status;
|
||||
|
||||
app = gtk_application_new ("org.gem-graph", G_APPLICATION_DEFAULT_FLAGS);
|
||||
fsm_init ("first instruction / first log");
|
||||
|
||||
//g_signal_connect (app, "activate", G_CALLBACK (on_main_window_activation), NULL);
|
||||
//g_signal_connect (app, "activate", G_CALLBACK (on_dialog_window_activation), NULL);
|
||||
fsm_add_log (INFO, MAIN, "main", "*app = gtk_application_new()",
|
||||
"| 👉️ trigger app initialization");
|
||||
app = gtk_application_new ("org.gem-graph", G_APPLICATION_DEFAULT_FLAGS);
|
||||
|
||||
status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||
g_object_unref (app);
|
||||
fsm_add_log (INFO, MAIN, "main",
|
||||
"g signal connect (activate)",
|
||||
"| 👉️ windows creation requested");
|
||||
|
||||
return status;
|
||||
// g_signal_connect (app, "startup", G_CALLBACK (on_windows_startup), NULL);
|
||||
// g_signal_connect (app, "activate", G_CALLBACK (on_windows_activation), NULL);
|
||||
|
||||
fsm_add_log (INFO, MAIN, "main",
|
||||
"no g signal connect (activate)",
|
||||
"| 🖐️ windows creation denied");
|
||||
|
||||
status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||
g_object_unref (app);
|
||||
fsm_add_log (INFO, MAIN, "main", "g_object unref (app)", "| 👌️ bye bye app !");
|
||||
|
||||
fsm_close("last instruction / last log");
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue