From d2ebb27a8778be7660d290c95360ec1a815f6d7e Mon Sep 17 00:00:00 2001 From: Jean Sirmai Date: Fri, 20 Sep 2024 07:28:02 +0200 Subject: [PATCH] journal concat message + value in /fsm/dispatch/ push() TODO --- include/fsm.h | 5 +++-- include/signal.h | 2 +- src/fsm/dispatch.c | 13 ++++++++++--- src/fsm/journal.c | 2 +- src/signal.c | 2 +- src/widget/topbar/dialog.c | 2 +- src/widget/topbar/{polytext.c => modal.c} | 0 7 files changed, 17 insertions(+), 9 deletions(-) rename src/widget/topbar/{polytext.c => modal.c} (100%) diff --git a/include/fsm.h b/include/fsm.h index 805149c..e7ed9c1 100644 --- a/include/fsm.h +++ b/include/fsm.h @@ -84,7 +84,7 @@ enum value { VALUE }; -#define JOURNAL_DATE_MAX_LENGTH 255 +#define JOURNAL_LOG_MAX_LENGTH 255 typedef struct unit {long yy_dd_mm; long usec; @@ -95,7 +95,8 @@ typedef struct unit {long yy_dd_mm; typedef struct {unit *first; unit *last;} journal; // journal unit access structure void fsm_journal_init (journal *jj); // init from main -void fsm_journal_push (char *message); // def: fsm/dispatch +void fsm_journal_push (char *message, + const char *string_value); // def: fsm/dispatch // call: any call that does not have // the log address void fsm_journal_clear (journal *jj, char *message); // empty the journal diff --git a/include/signal.h b/include/signal.h index 15834c2..103c4eb 100644 --- a/include/signal.h +++ b/include/signal.h @@ -27,7 +27,7 @@ #include -// void on_auto_notification (const char *message); (see "signal.c") +// void on_auto_notification (char *message); (see "signal.c") /******************************************************************************/ diff --git a/src/fsm/dispatch.c b/src/fsm/dispatch.c index 62a090e..6ae6ff8 100644 --- a/src/fsm/dispatch.c +++ b/src/fsm/dispatch.c @@ -25,6 +25,7 @@ #include #include "../../include/fsm.h" +#include "../../include/widget.h" /******************************************************************************/ @@ -58,7 +59,13 @@ static journal gg_logs; void fsm_journal_publication_request () {fsm_journal_publish (gg_logs);} -void fsm_journal_push (char *message) {fsm_journal_push_front (&gg_logs, message);} +void fsm_journal_push (char *message, const char *string_value) +{ + char to_print [JOURNAL_LOG_MAX_LENGTH] = ""; + strcat (to_print, message); + strcat (to_print, string_value); + fsm_journal_push_front (&gg_logs, message); // to_print); TODO concat strings +} // CRITICAL ERROR WARNING INFO MESSAGE DEBUG SPEW 😄️ // 0 1 2 3 4 5 6 @@ -67,11 +74,11 @@ void fsm_journal_event (char *message, int severity, int source, const char *val { if ( - severity <= SPEW + severity < SPEW && source == MAIN ) - fsm_journal_push (message); // TODO push (message + value) + fsm_journal_push (message, value); // TODO push (message + value) } #define MAIN___DIALOG___MODAL___TOPBAR___SYNTH___RULES___MEASURES___RESULTS___😄️ 0 diff --git a/src/fsm/journal.c b/src/fsm/journal.c index 8ce41ac..8e9d035 100644 --- a/src/fsm/journal.c +++ b/src/fsm/journal.c @@ -133,7 +133,7 @@ void fsm_journal_seek (journal jj, long usec, char *message) void fsm_journal_publish (journal jj) { unit *a_unit = jj.last; - char buf [JOURNAL_DATE_MAX_LENGTH]; + char buf [JOURNAL_LOG_MAX_LENGTH]; int nb = 0; while (a_unit) { diff --git a/src/signal.c b/src/signal.c index ad4d142..845ded9 100644 --- a/src/signal.c +++ b/src/signal.c @@ -34,7 +34,7 @@ #include "../include/util.h" -static void on_auto_notification (const char *message) +static void on_auto_notification (char *message) { fsm_journal_event ("signal auto notification()", DEBUG, AUTO_NOTIFICATION, message); diff --git a/src/widget/topbar/dialog.c b/src/widget/topbar/dialog.c index b6916b8..0e0113b 100644 --- a/src/widget/topbar/dialog.c +++ b/src/widget/topbar/dialog.c @@ -36,7 +36,7 @@ void widget_design_dialog_window (GtkWindow *main_window, GtkWindow *dialog_window) { - fsm_journal_event ("modal window design", INFO,MODAL_WINDOW, ""); + fsm_journal_event ("modal window design", INFO,MODAL_WINDOW, ""); char *title = " Save the current model before modifying it? "; GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ()); gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title)); diff --git a/src/widget/topbar/polytext.c b/src/widget/topbar/modal.c similarity index 100% rename from src/widget/topbar/polytext.c rename to src/widget/topbar/modal.c