From 300524adbf2f1bd6f447dd6dfd5e1ae1196553c8 Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Sun, 6 Oct 2024 15:32:02 +0200 Subject: [PATCH] WIP: Docstrings unsing Doxygen; parsing functions names (a Python3 script) --- read_me.doc | 67 ++++++++++++++++++--------- scripts/Hello World, I'm back ! 😄.py | 5 -- scripts/junk | 39 +++++++++++++++- scripts/let_us_read_and_write.py | 13 ------ scripts/let_us_read_this_file.py | 20 -------- scripts/parsing_functions_names | 11 ----- scripts/parsing_functions_names.py | 33 ++++++++++--- src/main.c | 2 +- src/widget/state/middle.c | 6 +++ 9 files changed, 117 insertions(+), 79 deletions(-) delete mode 100755 scripts/let_us_read_and_write.py delete mode 100755 scripts/let_us_read_this_file.py delete mode 100644 scripts/parsing_functions_names diff --git a/read_me.doc b/read_me.doc index b6bbcee..70ce6ec 100644 --- a/read_me.doc +++ b/read_me.doc @@ -33,31 +33,54 @@ * ---------- * * 1) localisées dans les headers; une avant chaque fonction; + * 2) structure: (ref: Doxygen) * - * 2) structure: + * @fn (une phrase) décrit ce que fait la fonction + * @brief (texte libre) détaille comment, pourquoi, le type d'algorithme, + * historique, discussion avantages/inconvénients,... + * @warning (si besoin de préciser) + * @todo + * @fixme (on espère que pas, mais...) + * @file + * @callgraph + * @see (liste des fonctions qui dépendent de cette fonction) + * @callergraph + * @see (liste des fonctions dont cette fonction dépend) + * @param + * @return + * @author (1,2,...) + * @since (date) + * @struct pour documenter une structure C. + * @union pour documenter une union C. + * @enum pour documenter un type énuméré. + * @var pour documenter une variable / un typedef / un énuméré. + * @def pour documenter un #define. + * @typedef pour documenter la définition d'un type. * - * texte libre: décrit ce que fait la fonction, - * où elle est définie (dans quel fichier), - * et par quelles fonctions elle est appelée. - * @param les paramètres pris en entrée - * @return la valeur retournée en sortie - * @use la liste de fonctions GTK appelées par cette fonction, dont: - * @use_mem? celles qui doivent être 'free' après usage + * 3) prioritaires: + * @file + * @callgraph + * @see (liste des fonctions qui dépendent de cette fonction) + * @callergraph + * @see (liste des fonctions dont cette fonction dépend) + * @param + * @return * - * 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 + * 4) 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 @@ -66,7 +89,7 @@ * sanitize << * * - * 3) TODO des scripts devraient pouvoir recueillir ces informations + * 5) TODO des scripts devraient pouvoir recueillir ces informations * pour produire automatiquement, à la demande, des listes comme celle qui suit. * (voir le dossier 'scripts') * diff --git a/scripts/Hello World, I'm back ! 😄.py b/scripts/Hello World, I'm back ! 😄.py index f6158cd..51e1176 100755 --- a/scripts/Hello World, I'm back ! 😄.py +++ b/scripts/Hello World, I'm back ! 😄.py @@ -1,7 +1,2 @@ #!/usr/bin/env python3 -# uses scripts/doctext - -#https://python.developpez.com/tutoriels/python-basic-par-exemple/?page=gestion-des-fichiers -#https://note.nkmk.me/en/python-docstring/ - print("Hello World, I'm back ! 😄") diff --git a/scripts/junk b/scripts/junk index 954590a..89873ee 100644 --- a/scripts/junk +++ b/scripts/junk @@ -1 +1,38 @@ - * 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 +widget_set_item_text +*widget_get_address_text_alpha_index +*widget_get_address_text_practice +*widget_get_address_text_theory +char +char +char +char + +TreeNode_t +TreeNode_t +*widget_get_an_impression_of_what_a_rules_comparator_could_be(); + +*widget_get_dialog_window(); + +*widget_get_graph_view_control(); +*widget_get_main_window(); + +*widget_get_non_time_dependent(); + +*widget_get_page_data(); +*widget_get_page_engine(); +*widget_get_page_measure();// +*widget_get_page_state(); +*widget_get_page_synth(); +*widget_get_pane_all_rules_left(); + +*widget_get_pane_selected_rule_right(); + +*widget_get_results_box_display(); + +*widget_get_results_box_organize(); + +*widget_get_results_box_time +*widget_get_rule_edition_tools(); +*widget_get_rule_investigation_tools(); +*widget_get_rules_pilot_box(); +*widget_get_rules_tree_tools(); diff --git a/scripts/let_us_read_and_write.py b/scripts/let_us_read_and_write.py deleted file mode 100755 index 954c49e..0000000 --- a/scripts/let_us_read_and_write.py +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python3 - -rr = open('read_me.doc', 'r', encoding='UTF-8') -ww = open('scripts/junk', "w") - -for line in rr: - if (line == " * 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\n"): - print(line) - ww.write(line) - -rr.close() -ww.close() - diff --git a/scripts/let_us_read_this_file.py b/scripts/let_us_read_this_file.py deleted file mode 100755 index 9d14764..0000000 --- a/scripts/let_us_read_this_file.py +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env python3 - -filename = 'read_me.doc' -f = open(filename, 'r', encoding='UTF-8') - -print("Contenu de " + filename) -print('-' * 30) -for line in f: - print(line, end='') - -f.close() - -# 'with' est une solution plus simple, qui gère automatiquement la fermeture du fichier. -filename = 'read_me.doc' - -print("\n\nContenu de " + filename) -print('-' * 30) -with open(filename, 'r', encoding='UTF-8') as f: - for line in f: - print(line, end='') diff --git a/scripts/parsing_functions_names b/scripts/parsing_functions_names deleted file mode 100644 index f945165..0000000 --- a/scripts/parsing_functions_names +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env python3 - -filename = 'read_me.doc' -f = open(filename, 'r', encoding='UTF-8') - -# print("Contenu de " + filename) print('-' * 30) -for line in f: - print(line, end='') - -f.close() - diff --git a/scripts/parsing_functions_names.py b/scripts/parsing_functions_names.py index f945165..322db73 100755 --- a/scripts/parsing_functions_names.py +++ b/scripts/parsing_functions_names.py @@ -1,11 +1,32 @@ #!/usr/bin/env python3 -filename = 'read_me.doc' -f = open(filename, 'r', encoding='UTF-8') +#rr = open('read_me.doc', 'r', encoding='UTF-8') +rr = open('include/widget.h', 'r', encoding='UTF-8') +ww = open('scripts/junk', "w") -# print("Contenu de " + filename) print('-' * 30) -for line in f: - print(line, end='') +l = [None] * 75 +n = 0 -f.close() +for line in rr: + if (line [0:4] == 'void' + or line [0:3] == 'int' + or line [0:4] == 'char' + or line [0:10] == 'const char' + or line [0:8] == 'GtkEntry' + or line [0:17] == 'struct TreeNode_t'): + #print(n, ' ', line [:len(line)-1]) + #ww.write(line [:len(line)]) + l[n] = line + n += 1 + +l.sort() +n = 0 +for line in l: + print(n, ' ', line [:len(line)-1]) + if n in range(30): + ww.write(line.split(' ')[1] + '\n') + n += 1 + +rr.close() +ww.close() diff --git a/src/main.c b/src/main.c index bce0b40..dcd14dd 100644 --- a/src/main.c +++ b/src/main.c @@ -38,7 +38,7 @@ * gcc `pkg-config --cflags --libs gtk4 epoxy glib-2.0` -lm -o instanced_cubes instanced_cubes.c * ./instanced_cubes * - * + * https://docs.gtk.org/gdk4/class.Cursor.html TODO * * * diff --git a/src/widget/state/middle.c b/src/widget/state/middle.c index 1887ebb..6932d4b 100644 --- a/src/widget/state/middle.c +++ b/src/widget/state/middle.c @@ -90,6 +90,12 @@ static void *get_ZOOM_box() void *widget_get_space_view(int partition_space_vs_camera) { GtkBox *drawbox = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0)); + GdkSurface *drawsurface = gdk_surface_new_toplevel (gdk_display_get_default()); + gdk_display_beep (gdk_display_get_default()); + GdkCursor *drawbox_cursor = gdk_cursor_new_from_name ("cell", + gdk_cursor_new_from_name ("default", NULL)); + gdk_surface_set_cursor (drawsurface, drawbox_cursor); + // util_gl_setup_glarea (0, GTK_WIDGET (drawbox)); GtkBox *camera = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 2));