journal exercices strcat/strncat &co (/util/tests)
This commit is contained in:
parent
39a4537fed
commit
f3f76ef053
|
@ -66,7 +66,7 @@ void fsm_journal_event (char *message, int priority, int filter)
|
||||||
// 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
|
||||||
|
|
||||||
if (priority <= DEBUG
|
if (priority == 0 //<= DEBUG
|
||||||
|
|
||||||
/* * * * * * * - F I L T E R S - * * * * * * *
|
/* * * * * * * - F I L T E R S - * * * * * * *
|
||||||
* This list is duplicated in both /fsm.h and /fsm/dispatch *
|
* This list is duplicated in both /fsm.h and /fsm/dispatch *
|
||||||
|
@ -99,7 +99,8 @@ void fsm_journal_event (char *message, int priority, int filter)
|
||||||
* This list is duplicated in both /fsm.h and /fsm/dispatch *
|
* This list is duplicated in both /fsm.h and /fsm/dispatch *
|
||||||
* * * * * * * - F I L T E R S - * * * * * * */
|
* * * * * * * - F I L T E R S - * * * * * * */
|
||||||
|
|
||||||
&& filter == FSM)
|
|| filter == 16
|
||||||
|
|| filter == 41)
|
||||||
fsm_journal_push (message);
|
fsm_journal_push (message);
|
||||||
}
|
}
|
||||||
#define _CRITICAL___ERROR____WARNING___INFO____MESSAGE___DEBUG ___SPEW____👋️ 0
|
#define _CRITICAL___ERROR____WARNING___INFO____MESSAGE___DEBUG ___SPEW____👋️ 0
|
||||||
|
@ -145,8 +146,7 @@ void fsm_set_preferences_modified (bool value)
|
||||||
fsm_journal_event (str1, 4, 90);
|
fsm_journal_event (str1, 4, 90);
|
||||||
|
|
||||||
fsm_journal_event ("fsm/dispatch preferences modified value = ?\n\
|
fsm_journal_event ("fsm/dispatch preferences modified value = ?\n\
|
||||||
> Je ne sais ni concatener les strings ni utiliser 'itoa'\n\
|
> Je ne sais ni concatener les strings ni utiliser 'itoa'", 4, 90);
|
||||||
> et les 'toggle' buttons envoient probablement deux events", 4, 90);
|
|
||||||
preferences_have_been_modified = value;
|
preferences_have_been_modified = value;
|
||||||
/*
|
/*
|
||||||
if (value) fsm_journal_event (
|
if (value) fsm_journal_event (
|
||||||
|
|
|
@ -148,7 +148,7 @@ int main (int argc, char **argv)
|
||||||
|
|
||||||
int status = g_application_run (G_APPLICATION (app), argc, argv);
|
int status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||||
g_object_unref (app);
|
g_object_unref (app);
|
||||||
fsm_journal_event ("main g object unref (app)", 3, 0);
|
fsm_journal_event ("main g_object unref (app)", 3, 0);
|
||||||
|
|
||||||
fsm_journal_event ("main That'all folks ! 👋️😄️", 3, 0);
|
fsm_journal_event ("main That'all folks ! 👋️😄️", 3, 0);
|
||||||
fsm_journal_publication_request();
|
fsm_journal_publication_request();
|
||||||
|
@ -213,3 +213,4 @@ TODO (bottlenecks)
|
||||||
Des 'runs' de longue durée n'ont de sens qu'une fois ce débuggage effectué.
|
Des 'runs' de longue durée n'ont de sens qu'une fois ce débuggage effectué.
|
||||||
Il y a donc peu de problèmes à craindre du fait de la limite de la bande passante.
|
Il y a donc peu de problèmes à craindre du fait de la limite de la bande passante.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ void on_bind_user_tree_factory (GtkSignalListItemFactory *factory,
|
||||||
GObject* object,
|
GObject* object,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
fsm_journal_event ("signal bind user tree factory() has began", DEBUG, 23);
|
fsm_journal_event ("signal bind user tree factory() has began", SPEW, 23);
|
||||||
GtkListItem *list_item = GTK_LIST_ITEM (object);
|
GtkListItem *list_item = GTK_LIST_ITEM (object);
|
||||||
assert (list_item);
|
assert (list_item);
|
||||||
|
|
||||||
|
@ -96,15 +96,15 @@ void on_bind_user_tree_factory (GtkSignalListItemFactory *factory,
|
||||||
row);
|
row);
|
||||||
gtk_widget_set_margin_start (expander,
|
gtk_widget_set_margin_start (expander,
|
||||||
gtk_tree_list_row_get_depth(row) * 20);
|
gtk_tree_list_row_get_depth(row) * 20);
|
||||||
fsm_journal_event ("signal bind user tree factory() has ended", DEBUG, 23);
|
fsm_journal_event ("signal bind user tree factory() has ended", SPEW, 23);
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_setup_user_tree_factory (GtkSignalListItemFactory *factory,
|
void on_setup_user_tree_factory (GtkSignalListItemFactory *factory,
|
||||||
GObject* object, gpointer user_data){
|
GObject* object, gpointer user_data){
|
||||||
fsm_journal_event ("signal setup user tree factory() has began", DEBUG, 23);
|
fsm_journal_event ("signal setup user tree factory() has began", SPEW, 23);
|
||||||
GtkWidget* expander = gtk_expander_new (NULL);
|
GtkWidget* expander = gtk_expander_new (NULL);
|
||||||
gtk_list_item_set_child (GTK_LIST_ITEM (object), expander);
|
gtk_list_item_set_child (GTK_LIST_ITEM (object), expander);
|
||||||
fsm_journal_event ("signal setup user tree factory() has ended", DEBUG, 23);
|
fsm_journal_event ("signal setup user tree factory() has ended", SPEW, 23);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,12 +29,28 @@
|
||||||
|
|
||||||
|
|
||||||
#include "../../include/util.h"
|
#include "../../include/util.h"
|
||||||
|
#include "../../include/base.h"
|
||||||
|
|
||||||
|
static const char *util_str_concat_test (char *a, char *b, int len_a, int len_b) {
|
||||||
|
char *c = malloc (len_a + len_b + 2); // char c[255]; *c = 'K'; c[1] = 'O'; *(c+1) = 'U'; c[2] = '\0'; a[len_a] = '\0'; b[len_b] = '\0';
|
||||||
|
strcpy(c, a);
|
||||||
|
strcpy(c + len_a + 1, b);
|
||||||
|
c[2] = '9'; c[3] = '9';
|
||||||
|
*(c + len_a + len_b) = '\0';
|
||||||
|
// printf ("static void current concat test (%s%s) > %s\n", a, b, c);
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
void util_trigger_test ()
|
void util_trigger_test ()
|
||||||
{
|
{
|
||||||
if (0) util_pile_test();
|
if (0) util_pile_test();
|
||||||
if (0) util_double_list_test();
|
if (0) util_double_list_test();
|
||||||
if (0) util_sorted_list_test();
|
if (0) util_sorted_list_test();
|
||||||
|
//int len_a = 11, len_b = 14;
|
||||||
|
char aaa [] = "Hello World", bbb [] = ", what's new ?";
|
||||||
|
char *c = strcat (aaa, bbb); //c[11 + 14] = '\0';
|
||||||
|
if (1) printf("%s <--- strcat () (would 'like to use: strncat() instead...)\n", c);
|
||||||
|
if (1) printf("%s <--- util_str_concat_test()\n", util_str_concat_test(aaa, bbb, 11, 14));
|
||||||
}
|
}
|
||||||
|
|
||||||
void util_pile_test()
|
void util_pile_test()
|
||||||
|
|
Loading…
Reference in New Issue