journal concat message + value in /fsm/dispatch/ push() TODO

This commit is contained in:
Jean Sirmai 2024-09-20 07:28:02 +02:00
parent 10e6d95f53
commit d2ebb27a87
Signed by: jean
GPG Key ID: FB3115C340E057E3
7 changed files with 17 additions and 9 deletions

View File

@ -84,7 +84,7 @@ enum value {
VALUE VALUE
}; };
#define JOURNAL_DATE_MAX_LENGTH 255 #define JOURNAL_LOG_MAX_LENGTH 255
typedef struct unit {long yy_dd_mm; typedef struct unit {long yy_dd_mm;
long usec; long usec;
@ -95,7 +95,8 @@ typedef struct unit {long yy_dd_mm;
typedef struct {unit *first; unit *last;} journal; // journal unit access structure typedef struct {unit *first; unit *last;} journal; // journal unit access structure
void fsm_journal_init (journal *jj); // init from main 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 // call: any call that does not have
// the log address // the log address
void fsm_journal_clear (journal *jj, char *message); // empty the journal void fsm_journal_clear (journal *jj, char *message); // empty the journal

View File

@ -27,7 +27,7 @@
#include <gtk-4.0/gtk/gtk.h> #include <gtk-4.0/gtk/gtk.h>
// void on_auto_notification (const char *message); (see "signal.c") // void on_auto_notification (char *message); (see "signal.c")
/******************************************************************************/ /******************************************************************************/

View File

@ -25,6 +25,7 @@
#include <stdbool.h> #include <stdbool.h>
#include "../../include/fsm.h" #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_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 😄️ // CRITICAL ERROR WARNING INFO MESSAGE DEBUG SPEW 😄️
// 0 1 2 3 4 5 6 // 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 if
( (
severity <= SPEW severity < SPEW
&& source == MAIN && 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 #define MAIN___DIALOG___MODAL___TOPBAR___SYNTH___RULES___MEASURES___RESULTS___😄 0

View File

@ -133,7 +133,7 @@ void fsm_journal_seek (journal jj, long usec, char *message)
void fsm_journal_publish (journal jj) void fsm_journal_publish (journal jj)
{ {
unit *a_unit = jj.last; unit *a_unit = jj.last;
char buf [JOURNAL_DATE_MAX_LENGTH]; char buf [JOURNAL_LOG_MAX_LENGTH];
int nb = 0; int nb = 0;
while (a_unit) while (a_unit)
{ {

View File

@ -34,7 +34,7 @@
#include "../include/util.h" #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()", fsm_journal_event ("signal auto notification()",
DEBUG, AUTO_NOTIFICATION, message); DEBUG, AUTO_NOTIFICATION, message);

View File

@ -36,7 +36,7 @@
void widget_design_dialog_window (GtkWindow *main_window, GtkWindow *dialog_window) 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? "; char *title = " Save the current model before modifying it? ";
GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ()); GtkWidget *header_bar = GTK_WIDGET (gtk_header_bar_new ());
gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title)); gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header_bar), gtk_label_new (title));