WIP: strftime

This commit is contained in:
Jean Sirmai 2024-09-14 23:03:19 +02:00
parent 0e925fe882
commit 70c932170a
Signed by: jean
GPG Key ID: FB3115C340E057E3
7 changed files with 184 additions and 59 deletions

View File

@ -64,14 +64,14 @@ void fsm_journal_push_front_from_fsm (char *message)
void fsm_init()
{
fsm_journal_push_front (&gologos, " fsm > fsm_init() start");
fsm_journal_push_front (&gologos, "fsm fsm_init() start");
fsm_measures_list_init(); fsm_journal_push_front (&gologos, " fsm > fsm_measures_list_init()");
fsm_results_list_init(); fsm_journal_push_front (&gologos, " fsm > fsm_results_list_init()");
fsm_displayable_list_init(); fsm_journal_push_front (&gologos, " fsm > fsm_displayable_list_init()");
fsm_preferences_init(); fsm_journal_push_front (&gologos, " fsm > fsm_preferences_init()");
fsm_measures_list_init(); fsm_journal_push_front (&gologos, "fsm fsm_measures_list_init()");
fsm_results_list_init(); fsm_journal_push_front (&gologos, "fsm fsm_results_list_init()");
fsm_displayable_list_init(); fsm_journal_push_front (&gologos, "fsm fsm_displayable_list_init()");
fsm_preferences_init(); fsm_journal_push_front (&gologos, "fsm fsm_preferences_init()");
fsm_journal_push_front (&gologos, " fsm > fsm_init() end");
fsm_journal_push_front (&gologos, "fsm fsm_init() end");
}
void fsm_journal_publication_request (char *message) {fsm_journal_publish (gologos, message);}
@ -91,9 +91,9 @@ void fsm_set_preferences_state (bool value)
{
preferences_have_been_modified = value;
if (value) fsm_journal_push_front (&gologos,
" fsm > fsm_set_preferences_state() <> preferences modified = TRUE");
"fsm fsm_set_preferences_state() <> preferences modified = TRUE");
else fsm_journal_push_front (&gologos,
" fsm > fsm_set_preferences_state() <> preferences modified = FALSE");
"fsm fsm_set_preferences_state() <> preferences modified = FALSE");
}
bool fsm_get_preferences_state() {return preferences_have_been_modified;}

View File

@ -27,11 +27,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <sys/time.h>
#include "../../include/fsm.h"
/******************************************************************************/
/* A journal stores chronologically the fsm yy_dd_mms */
/* A journal stores chronologically the fsm events */
/* during a session run (rules exec, mainly) */
/******************************************************************************/
@ -121,20 +122,64 @@ void fsm_journal_seek (journal jj, long usec, char *message)
else printf ("> date (usec) %ld not found in journal\n", usec);
}
//------------------------------------------------------------------------------------
static void fsm_journal_get_event_date (char *event)
{
struct timeval tv;
gettimeofday (&tv, NULL);
long yy_dd_mm = tv.tv_sec;
long usec = tv.tv_usec;
char buf1[]="";
strftime (buf1, JOURNAL_DATE_MAX_LENGTH, "%D %T", localtime (&yy_dd_mm));
printf ("%s + %6ld ", buf1, usec);
// *event = "ldkvbhej xadrhsjfvrejhs ";
}
void fsm_journal_publish (journal jj, char *message)
{
unit *a_unit = jj.last;
char buf [JOURNAL_DATE_MAX_LENGTH];
char myString[] = "Hello World";
fsm_journal_get_event_date (myString);
int nb = 0;
while (a_unit)
{
// Format time, "ddd yyyy-mm-dd hh:mm:ss zzz" "%Y-%m-%d %H:%M:%S"
// https://www.man7.org/linux/man-pages/man3/strftime.3.html
strftime(buf, sizeof(buf), "%D %T", localtime(&a_unit->yy_dd_mm));
printf ("%s > %6ld < %s\n", buf, a_unit->usec, a_unit->message);
printf ("%s + %6ld %6d %s\n", buf, a_unit->usec, nb, a_unit->message);
a_unit = a_unit->prev;
nb ++;
}
printf ("%s (n = %d)\n", message, nb);
// char *event [JOURNAL_DATE_MAX_LENGTH] = "gyufgbyfjuvfde";
// int **p_event [JOURNAL_DATE_MAX_LENGTH];
fsm_journal_get_event_date (message);
printf ("%4d %s\n", nb, message);
}
// https://nicolasj.developpez.com/articles/libc/string/
// https://thelinuxcode.com/pass-string-function-c-language/
//
/*
void modifyString(char *str) {
*str = J; // Dereference to change first char
}
int main() {
char myString[] = "Hello World";
modifyString(myString);
printf("%s", myString); // Prints Jello World
}
Because modifyString receives a pointer to the string,
* it can modify the original by dereferencing.
*/

View File

@ -74,7 +74,7 @@ void fsm_store_restore_reset (int choice, int value)
switch (choice) {
case (STORE) :
fsm_journal_push_front_from_fsm (
"prefer > fsm_store_restore_reset() <> switch (STORE)");
"prefer fsm_store_restore_reset() <> switch (STORE)");
for (int i = 0; i < n_objects; i++) {
p [i] = widget_get_object_transparency (i);
widget_set_object_transparency_to_value (i, p [i]);
@ -82,19 +82,19 @@ void fsm_store_restore_reset (int choice, int value)
break;
case (RESTORE) :
fsm_journal_push_front_from_fsm (
"prefer > fsm_store_restore_reset() <> switch (RESTORE)");
"prefer fsm_store_restore_reset() <> switch (RESTORE)");
for (int i = 0; i < n_objects; i++)
widget_set_object_transparency_to_value (i, p [i]);
break;
case (RESET) :
fsm_journal_push_front_from_fsm (
"prefer > fsm_store_restore_reset() <> switch (RESET)");
"prefer fsm_store_restore_reset() <> switch (RESET)");
for (int i = 0; i < n_objects; i++)
widget_set_object_transparency_to_value (i, value); // i * 4 // rand() % 127
break;
default :
fsm_journal_push_front_from_fsm (
"prefer > fsm_store_restore_reset() <> switch (default)");
"prefer fsm_store_restore_reset() <> switch (default)");
}
fsm_set_preferences_state (TRUE);
@ -109,9 +109,9 @@ static int reset_situations_to_value = -1;
void fsm_reset_all_situations_transparencies_at_value (int value)
{
char str1[140] = "prefer > fsm_reset_all_situations_transparencies_at_value() ";
char str1[140] = "prefer fsm_reset_all_situations_transparencies_at_value() ";
char str2[10]; sprintf(str2, "%d, ", value); strcat(str1, str2);
fsm_journal_push_front_from_fsm ("prefer > fsm_reset_all_situations_transparencies_at_value() << TODO (prefer)"); // TODO
fsm_journal_push_front_from_fsm ("prefer fsm_reset_all_situations_transparencies_at_value() << TODO (prefer)"); // TODO
reset_situations_to_value = value;
widget_reset_all_situations_transparencies_to_value (value);
}
@ -127,7 +127,7 @@ void fsm_reset_all_situations_transparencies_at_value (int value)
void fsm_add_displayable (char *displayable_name)
{
fsm_journal_push_front_from_fsm (
strcat("prefer > fsm_add_displayable() ", displayable_name)); // TODO
strcat("prefer fsm_add_displayable() ", displayable_name)); // TODO
}
@ -137,12 +137,12 @@ void fsm_add_displayable (char *displayable_name)
void fsm_preferences_init ()
{
fsm_journal_push_front_from_fsm (
"prefer > fsm_preferences_init()");
"prefer fsm_preferences_init()");
}
void fsm_displayable_list_init ()
{
fsm_journal_push_front_from_fsm (
"prefer > fsm_displayable_list_init()");
"prefer fsm_displayable_list_init()");
}

View File

@ -145,7 +145,7 @@ int main (int argc, char **argv)
int status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
fsm_journal_publication_request ("main > fsm_journal_view_request() That'all folks ! 👋️ 😄️");
fsm_journal_publication_request ("main That'all folks ! 👋️😄️");
return status;
}

View File

@ -36,7 +36,7 @@
static void on_auto_notification (const char *message)
{
fsm_journal_widget_event ("signal > on_auto_notification()", PRIORITY_1);
fsm_journal_widget_event ("signal on_auto_notification()", PRIORITY_1);
/* Ignored (2024-06-06) because I don't know how to get "main_window" easily
if (window->toast_revealer == NULL) {
@ -63,7 +63,7 @@ static void on_auto_notification (const char *message)
static void on_user_tree_expander_toggled (GtkExpander *expander,
gpointer user_data)
{
fsm_journal_widget_event ("signal > on_user_tree_expander_toggled()", PRIORITY_1);
fsm_journal_widget_event ("signal on_user_tree_expander_toggled()", PRIORITY_1);
GtkTreeListRow *row = GTK_TREE_LIST_ROW (user_data);
gboolean is_expanded = gtk_tree_list_row_get_expanded (row);
gtk_tree_list_row_set_expanded (row, ! is_expanded);
@ -74,7 +74,7 @@ void on_bind_user_tree_factory (GtkSignalListItemFactory *factory,
GObject* object,
gpointer user_data)
{
fsm_journal_widget_event ("signal > on_bind_user_tree_factory()", PRIORITY_0);
fsm_journal_widget_event ("signal on_bind_user_tree_factory()", PRIORITY_0);
GtkListItem *list_item = GTK_LIST_ITEM (object);
assert (list_item);
@ -98,7 +98,7 @@ void on_bind_user_tree_factory (GtkSignalListItemFactory *factory,
void on_setup_user_tree_factory (GtkSignalListItemFactory *factory,
GObject* object, gpointer user_data){
fsm_journal_widget_event ("signal > on_setup_user_tree_factory()", PRIORITY_0);
fsm_journal_widget_event ("signal on_setup_user_tree_factory()", PRIORITY_0);
GtkWidget* expander = gtk_expander_new (NULL);
gtk_list_item_set_child (GTK_LIST_ITEM (object), expander);
}
@ -111,7 +111,7 @@ void on_setup_user_tree_factory (GtkSignalListItemFactory *factory,
gboolean on_glarea_render (GtkGLArea *area,
GdkGLContext *context)
{
fsm_journal_widget_event ("signal > on_glarea_render()", PRIORITY_1);
fsm_journal_widget_event ("signal on_glarea_render()", PRIORITY_1);
// Check if the widget is a glarea
if(gtk_gl_area_get_error(area) != NULL) {
on_auto_notification("An OpenGL error occured !");
@ -130,7 +130,7 @@ gboolean on_glarea_render (GtkGLArea *area,
/* We need to set up our state when we realize the GtkGLArea widget */
void on_glarea_realize (GtkWidget *widget)
{
fsm_journal_widget_event ("signal > on_glarea_realize()", PRIORITY_1);
fsm_journal_widget_event ("signal on_glarea_realize()", PRIORITY_1);
GError *internal_error = NULL;
// Make the GL context current to be able to call the GL API
@ -156,7 +156,7 @@ void on_glarea_realize (GtkWidget *widget)
/* We should tear down the state when unrealizing */
void on_glarea_unrealize (GtkWidget *widget)
{
fsm_journal_widget_event ("signal > on_glarea_unrealize()", PRIORITY_1);
fsm_journal_widget_event ("signal on_glarea_unrealize()", PRIORITY_1);
GError *internal_error = NULL;
// Make the GL context current to be able to call the GL API
@ -179,7 +179,7 @@ void on_glarea_unrealize (GtkWidget *widget)
void on_axis_value_change (GtkAdjustment *adjustment, gpointer data)
{
fsm_journal_widget_event ("signal > on_axis_value_change()", PRIORITY_1);
fsm_journal_widget_event ("signal on_axis_value_change()", PRIORITY_1);
GtkWidget *slider = gtk_widget_get_parent(GTK_WIDGET(data));
GtkWidget *container_widget = gtk_widget_get_parent(GTK_WIDGET(slider));
@ -207,7 +207,7 @@ void on_axis_value_change (GtkAdjustment *adjustment, gpointer data)
void on_save_current_model_before_editing (GtkWidget *btt_SAVE_CURRENT_MODEL,
gpointer data)
{
fsm_journal_widget_event ("signal > on_save_current_model_before_editing()", PRIORITY_1);
fsm_journal_widget_event ("signal on_save_current_model_before_editing()", PRIORITY_1);
gtk_widget_set_sensitive (GTK_WIDGET (data),
TRUE);
printf ("signal.c - SAVE_CURRENT_MODEL_BEFORE_EDITING\n");
@ -216,14 +216,14 @@ void on_save_current_model_before_editing (GtkWidget *btt_SAVE_CURRENT_MODEL,
void on_discard_current_model_before_editing (GtkWidget *btt_SAVE_CURRENT_MODEL,
gpointer data)
{
fsm_journal_widget_event ("signal > on_discard_current_model_before_editing()", PRIORITY_1);
fsm_journal_widget_event ("signal on_discard_current_model_before_editing()", PRIORITY_1);
gtk_window_close (GTK_WINDOW (data));
}
void on_write_current_model (GtkWidget *btt_WRITE_CURRENT_MODEL,
gpointer data)
{
fsm_journal_widget_event ("signal > on_write_current_model()", PRIORITY_1);
fsm_journal_widget_event ("signal on_write_current_model()", PRIORITY_1);
gtk_window_close (GTK_WINDOW (data));
printf ("signal.c - WRITE_CURRENT_MODEL\n");
}
@ -240,7 +240,7 @@ static void switch_state_rules_data();
void on_toggle_exec_edit (GtkWidget *toggled_button, gpointer user_data)
{
fsm_journal_widget_event ("signal > on_toggle_exec_edit()", PRIORITY_1);
fsm_journal_widget_event ("signal on_toggle_exec_edit()", PRIORITY_1);
if (fsm_get_exec_edit ()) { // TODO (or NOT ?) et si je ne suis pas sur la page SYNTH
gtk_button_set_icon_name (GTK_BUTTON (toggled_button),
@ -269,7 +269,7 @@ void on_toggle_exec_edit (GtkWidget *toggled_button, gpointer user_data)
static void switch_state_rules_data()
{
fsm_journal_widget_event ("signal > switch_state_rules_data()", PRIORITY_1);
fsm_journal_widget_event ("signal switch_state_rules_data()", PRIORITY_1);
switch (fsm_get_state_rules_data()) {
case (SYNTH) :
@ -321,7 +321,7 @@ static void switch_state_rules_data()
// Les noms d'icônes sont utilisés pour deux fonctions distinctes...
void on_toggle_state_rules_data (GtkWidget *toggled_button, gpointer user_data)
{
fsm_journal_widget_event ("signal > on_toggle_state_rules_data()", PRIORITY_1);
fsm_journal_widget_event ("signal on_toggle_state_rules_data()", PRIORITY_1);
const char *toggled_button_name
= gtk_check_button_get_label (GTK_CHECK_BUTTON (toggled_button));
int is_active = gtk_check_button_get_active (GTK_CHECK_BUTTON (toggled_button));
@ -339,7 +339,7 @@ void on_toggle_state_rules_data (GtkWidget *toggled_button, gpointer user_data)
// ------------ M E N U / S E A R C H / H O M E / E T C ----------- //
void on_clicked_topbar_right_search (GtkWidget *btt_menu, gpointer list_box) {
fsm_journal_widget_event ("signal > on_clicked_topbar_right_search()", PRIORITY_1);
fsm_journal_widget_event ("signal on_clicked_topbar_right_search()", PRIORITY_1);
// next line presents the text_window and works only once.\n
// It should present a menu.\n"); // TODO
gtk_window_present (GTK_WINDOW (widget_get_text_window()));
@ -348,7 +348,7 @@ void on_clicked_topbar_right_search (GtkWidget *btt_menu, gpointer list_box) {
void on_clicked_topbar_right_home (GtkWidget *btt_reset, gpointer data)
{
fsm_journal_widget_event ("signal > on_clicked_topbar_right_home()", PRIORITY_1);
fsm_journal_widget_event ("signal on_clicked_topbar_right_home()", PRIORITY_1);
// gtk_window_present (GTK_WINDOW (widget_get_dialog_window())); // NB works only once. < TODO
}
@ -363,7 +363,7 @@ void on_clicked_topbar_right_home (GtkWidget *btt_reset, gpointer data)
void on_updating_objects_transparencies (GtkWidget *btt_source, GtkScrollbar *scrollbar)
{
fsm_journal_widget_event ("signal > on_updating_objects_transparencies()", PRIORITY_1);
fsm_journal_widget_event ("signal on_updating_objects_transparencies()", PRIORITY_1);
const char *btt_name = gtk_button_get_icon_name (GTK_BUTTON (btt_source));
int value = gtk_adjustment_get_value (gtk_scrollbar_get_adjustment (scrollbar));
@ -376,7 +376,7 @@ void on_updating_objects_transparencies (GtkWidget *btt_source, GtkScrollbar *sc
void on_resetting_XYZ_in_state_page ()
{
fsm_journal_widget_event ("signal > on_resetting_XYZ_in_state_page()", PRIORITY_1);
fsm_journal_widget_event ("signal on_resetting_XYZ_in_state_page()", PRIORITY_1);
widget_state_XYZ_reset_all();
}
@ -384,7 +384,7 @@ void on_resetting_XYZ_in_state_page ()
void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrollbar)
{
fsm_journal_widget_event ("signal > on_situations_box_do_reset()", PRIORITY_1);
fsm_journal_widget_event ("signal on_situations_box_do_reset()", PRIORITY_1);
GtkAdjustment *adj_situ = gtk_scrollbar_get_adjustment (reset_scrollbar);
fsm_reset_all_situations_transparencies_at_value (gtk_adjustment_get_value (adj_situ));
}
@ -397,7 +397,7 @@ void on_situations_box_do_reset (GtkWidget *btt_reset, GtkScrollbar *reset_scrol
void on_clicked_topbar_right_measure (GtkWidget *btt, gpointer data)
{
fsm_journal_widget_event ("signal > on_clicked_topbar_right_measure()", PRIORITY_1);
fsm_journal_widget_event ("signal on_clicked_topbar_right_measure()", PRIORITY_1);
// fsm_measures_sorted_list_do something ();
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_get_measure_page()));
@ -405,98 +405,98 @@ void on_clicked_topbar_right_measure (GtkWidget *btt, gpointer data)
void on_start_new_measure (GtkWidget *btt, gpointer data)
{
fsm_journal_widget_event ("signal > on_start_new_measure()", PRIORITY_1);
fsm_journal_widget_event ("signal on_start_new_measure()", PRIORITY_1);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_select_rules_first()));
}
void on_select_rules_first (GtkWidget *btt, gpointer data)
{
fsm_journal_widget_event ("signal > on_select_rules_first()", PRIORITY_1);
fsm_journal_widget_event ("signal on_select_rules_first()", PRIORITY_1);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_depends_on_one_or_two_events()));
}
void on_measure_depends_on_a_single_event (GtkWidget *btt, gpointer data)
{
fsm_journal_widget_event ("signal > on_measure_depends_on_a_single_event()", PRIORITY_1);
fsm_journal_widget_event ("signal on_measure_depends_on_a_single_event()", PRIORITY_1);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_depends_on_a_single_event()));
}
void on_measure_depends_on_two_events (GtkWidget *btt, gpointer data)
{
fsm_journal_widget_event ("signal > on_measure_depends_on_two_events()", PRIORITY_1);
fsm_journal_widget_event ("signal on_measure_depends_on_two_events()", PRIORITY_1);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_select_a_second_rules_set()));
}
void on_select_a_second_rules_set (GtkWidget *btt, gpointer data)
{
fsm_journal_widget_event ("signal > on_select_a_second_rules_set()", PRIORITY_1);
fsm_journal_widget_event ("signal on_select_a_second_rules_set()", PRIORITY_1);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_choose_an_event_type()));
}
void on_select_a_second_measurement (GtkWidget *btt, gpointer data)
{
fsm_journal_widget_event ("signal > on_select_a_second_measurement()", PRIORITY_1);
fsm_journal_widget_event ("signal on_select_a_second_measurement()", PRIORITY_1);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_correlate()));
}
void on_skip_this_step (GtkWidget *btt, gpointer data)
{
fsm_journal_widget_event ("signal > on_skip_this_step()", PRIORITY_1);
fsm_journal_widget_event ("signal on_skip_this_step()", PRIORITY_1);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_insert_in_measurements_list ()));
}
void on_something_else (GtkWidget *btt, gpointer data)
{
fsm_journal_widget_event ("signal > on_something_else()", PRIORITY_1);
fsm_journal_widget_event ("signal on_something_else()", PRIORITY_1);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_do_end_creation_of_measurement_process()));
}
void on_closing_page (GtkWidget *btt, gpointer data)
{
fsm_journal_widget_event ("signal > on_closing_page()", PRIORITY_1);
fsm_journal_widget_event ("signal on_closing_page()", PRIORITY_1);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_get_synth_page()));
}
void on_measure_single_event_occurences_nb (GtkWidget *btt, gpointer data)
{
fsm_journal_widget_event ("signal > on_measure_single_event_occurences_nb()", PRIORITY_1);
fsm_journal_widget_event ("signal on_measure_single_event_occurences_nb()", PRIORITY_1);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_event_occurences_nb()));
}
void on_measure_single_event_occurences_dates (GtkWidget *btt, gpointer data)
{
fsm_journal_widget_event ("signal > on_measure_single_event_occurences_dates()", PRIORITY_1);
fsm_journal_widget_event ("signal on_measure_single_event_occurences_dates()", PRIORITY_1);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_event_occurences_dates()));
}
void on_measure_single_event_occurences_situations (GtkWidget *btt, gpointer data)
{
fsm_journal_widget_event ("signal > on_measure_single_event_occurences_situations()", PRIORITY_1);
fsm_journal_widget_event ("signal on_measure_single_event_occurences_situations()", PRIORITY_1);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_event_occurences_situations()));
}
void on_measure_time_elapsed_between_two_events (GtkWidget *btt, gpointer data)
{
fsm_journal_widget_event ("signal > on_measure_time_elapsed_between_two_events()", PRIORITY_1);
fsm_journal_widget_event ("signal on_measure_time_elapsed_between_two_events()", PRIORITY_1);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_time_elapsed_between_two_events()));
}
void on_measure_third_event_occurences_in_between (GtkWidget *btt, gpointer data)
{
fsm_journal_widget_event ("signal > on_measure_third_event_occurences_in_between()", PRIORITY_1);
fsm_journal_widget_event ("signal on_measure_third_event_occurences_in_between()", PRIORITY_1);
gtk_window_set_child (GTK_WINDOW (widget_get_main_window ()),
GTK_WIDGET (widget_measure_third_event_occurences_in_between()));
}
@ -508,12 +508,12 @@ void on_measure_third_event_occurences_in_between (GtkWidget *btt, gpointer data
void on_entry_name_insert_after (GtkWidget *entry, gpointer data)
{
fsm_journal_widget_event ("signal > on_entry_name_insert_after()", PRIORITY_1);
fsm_journal_widget_event ("signal on_entry_name_insert_after()", PRIORITY_1);
}
void on_entry_name_delete_after (GtkWidget *entry, gpointer data)
{
fsm_journal_widget_event ("signal > on_entry_name_delete_after()", PRIORITY_1);
fsm_journal_widget_event ("signal on_entry_name_delete_after()", PRIORITY_1);
}

View File

@ -61,7 +61,7 @@ static void action_b (GSimpleAction *action,
void on_windows_startup (GtkApplication *app) // WIP 2024-09
{
fsm_journal_widget_event (
"widget > on_windows_startup()",
"widget on_windows_startup()",
PRIORITY_1);
// on_windows_startup() is in: widget/dispatch.c NOT in: src/signal.c
}
@ -69,7 +69,7 @@ void on_windows_startup (GtkApplication *app) // WIP 2024-09
void on_windows_activation (GtkApplication *app)
{
fsm_journal_widget_event (
"widget > on_windows_activation()",
"widget on_windows_activation()",
PRIORITY_1);
// on_windows_activation() is in: widget/dispatch.c NOT in: src/signal.c

View File

@ -0,0 +1,80 @@
//------------------------------------------------------------------------------------
static void fsm_journal_get_event_date (char **event)
{
struct timeval tv;
gettimeofday (&tv, NULL);
long yy_dd_mm = tv.tv_sec;
long usec = tv.tv_usec;
//strftime (buf1, JOURNAL_DATE_MAX_LENGTH, "%D %T", localtime (&yy_dd_mm));
//printf ("%s + %6ld %6d ", buf1, usec, nb);
printf(*event);// = "ldkvbhej xadrhsjfvrejhs";
}
void fsm_journal_publish (journal jj, char *message)
{
unit *a_unit = jj.last;
char buf [JOURNAL_DATE_MAX_LENGTH];
int nb = 0;
while (a_unit)
{
// Format time, "ddd yyyy-mm-dd hh:mm:ss zzz" "%Y-%m-%d %H:%M:%S"
// https://www.man7.org/linux/man-pages/man3/strftime.3.html
strftime(buf, sizeof(buf), "%D %T", localtime(&a_unit->yy_dd_mm));
printf ("%s + %6ld %6d %s\n", buf, a_unit->usec, nb, a_unit->message);
a_unit = a_unit->prev;
nb ++;
}
// char *event [JOURNAL_DATE_MAX_LENGTH] = "gyufgbyfjuvfde";
int **p_event [JOURNAL_DATE_MAX_LENGTH];
fsm_journal_get_event_date (*p_event); // TODO
printf ("%s\n", message);
}
// https://nicolasj.developpez.com/articles/libc/string/
// https://thelinuxcode.com/pass-string-function-c-language/
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
jean@n-guix-port:~/Gem-Graph/gem-graph-client [env] $ make run
DEP build/src/fsm/journal.d
src/fsm/journal.c: Dans la fonction « fsm_journal_get_event_date »:
src/fsm/journal.c:55:10: attention: variable inutilisée « usec » [-Wunused-variable]
55 | long usec = tv.tv_usec;
| ^~~~
src/fsm/journal.c:54:10: attention: variable inutilisée « yy_dd_mm » [-Wunused-variable]
54 | long yy_dd_mm = tv.tv_sec;
| ^~~~~~~~
src/fsm/journal.c: Dans la fonction « fsm_journal_publish »:
src/fsm/journal.c:155:5: attention: « event » est utilisé sans avoir été initialisé [-Wuninitialized]
155 | fsm_journal_get_event_date (*event); // TODO
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/fsm/journal.c:154:12: note: « event » déclaré ici
154 | char **event [JOURNAL_DATE_MAX_LENGTH];
| ^~~~~
CC build/src/fsm/journal.o
LD bin/gem-graph-client
bin/gem-graph-client
09/14/24 10:05:10 + 772883 0 fsm fsm_init() start
09/14/24 10:05:10 + 772887 1 fsm fsm_measures_list_init()
09/14/24 10:05:10 + 772887 2 fsm fsm_results_list_init()
09/14/24 10:05:10 + 772887 3 prefer fsm_displayable_list_init()
09/14/24 10:05:10 + 772887 4 fsm fsm_displayable_list_init()
09/14/24 10:05:10 + 772887 5 prefer fsm_preferences_init()
09/14/24 10:05:10 + 772887 6 fsm fsm_preferences_init()
09/14/24 10:05:10 + 772887 7 fsm fsm_init() end
09/14/24 10:05:10 + 796793 8 widget on_windows_startup()
09/14/24 10:05:10 + 796798 9 widget on_windows_activation()
09/14/24 10:05:10 + 798832 10 signal on_toggle_state_rules_data()
09/14/24 10:05:10 + 798835 11 signal switch_state_rules_data()
main That'all folks ! 👋️😄️
jean@n-guix-port:~/Gem-Graph/gem-graph-client [env] $