[beast: 1/24] SFI: use Rapicorn's printout()



commit 94fbcbe762b9ff5f83a52747e5aafc2d0e88a5d7
Author: Tim Janik <timj gnu org>
Date:   Tue Sep 22 21:36:53 2015 +0200

    SFI: use Rapicorn's printout()

 sfi/sfitime.cc         |    6 ++--
 sfi/tests/misctests.cc |   60 ++++++++++++++++++++++++------------------------
 sfi/tests/ring.cc      |    6 ++--
 3 files changed, 36 insertions(+), 36 deletions(-)
---
diff --git a/sfi/sfitime.cc b/sfi/sfitime.cc
index de4420d..cd9d798 100644
--- a/sfi/sfitime.cc
+++ b/sfi/sfitime.cc
@@ -295,8 +295,8 @@ sfi_time_from_string_err (const gchar *time_string,
                                 minute[(index)] <= 59 &&       \
                                 second[(index)] >= 0 &&        \
                                 second[(index)] <= 61)
-  /* g_print ("DEBUG: \"%s\" -> y%u m%u d%u h%u m%u s%u\n", string,
-   *          year[i], month[i], day[i], hour[i], minute[i], second[i]);
+  /* printout ("DEBUG: \"%s\" -> y%u m%u d%u h%u m%u s%u\n", string,
+   *           year[i], month[i], day[i], hour[i], minute[i], second[i]);
    */
   if (!finished) /* parse "yyyy-mm-dd hh:mm:ss" e.g. "1998-04-16 23:59:59" */
     {
@@ -616,7 +616,7 @@ sfi_time_from_string_err (const gchar *time_string,
       ustime *= SFI_USEC_FACTOR;
       ustime = MAX (ustime, 0);
 
-      /* g_print ("mktime(): year(%u) month(%u) day(%u) hour(%u) minute(%u) second(%u)\n",
+      /* printout ("mktime(): year(%u) month(%u) day(%u) hour(%u) minute(%u) second(%u)\n",
        *           year[i], month[i], day[i], hour[i], minute[i], second[i]);
        */
 
diff --git a/sfi/tests/misctests.cc b/sfi/tests/misctests.cc
index 6f16ecc..248d426 100644
--- a/sfi/tests/misctests.cc
+++ b/sfi/tests/misctests.cc
@@ -67,7 +67,7 @@ test_time (void)
   /* test error returns */
   TASSERT (sfi_time_from_string_err ("foo 22", &error) == 0);
   TASSERT (error != NULL);
-  // g_print ("{%s}", error);
+  // printout ("{%s}", error);
   g_free (error);
   for (i = 0; size_t (i) < G_N_ELEMENTS (time_strings); i++)
     {
@@ -75,7 +75,7 @@ test_time (void)
       if (!error)
        TICK ();
       else
-       g_print ("{failed to parse \"%s\": %s (got: %s)\n}", time_strings[i], error, sfi_time_to_string (t)); 
/* memleak */
+       printout ("{failed to parse \"%s\": %s (got: %s)\n}", time_strings[i], error, sfi_time_to_string 
(t)); /* memleak */
       g_free (error);
       str = sfi_time_to_string (t);
       TASSERT (sfi_time_from_string_err (str, &error) == t);
@@ -131,19 +131,19 @@ test_com_ports (void)
   sfi_com_port_unref (port2);
   TDONE ();
 }
-#define SCANNER_ASSERT64(scanner, printout, token, text, svalue) { \
+#define SCANNER_ASSERT64(scanner, needprint, token, text, svalue) { \
   g_scanner_input_text (scanner, text, strlen (text)); \
   TASSERT (g_scanner_get_next_token (scanner) == token); \
-  if (printout) g_print ("{scanner.v_int64:%llu}", (long long unsigned int) (scanner->value.v_int64)); \
+  if (needprint) printout ("{scanner.v_int64:%llu}", (long long unsigned int) (scanner->value.v_int64)); \
   TASSERT (scanner->value.v_int64 == svalue); \
   TASSERT (g_scanner_get_next_token (scanner) == '#'); \
 }
-#define SCANNER_ASSERTf(scanner, printout, vtoken, text, svalue) { \
+#define SCANNER_ASSERTf(scanner, needprint, vtoken, text, svalue) { \
   g_scanner_input_text (scanner, text, strlen (text)); \
   if (g_scanner_get_next_token (scanner) != vtoken) \
     g_scanner_unexp_token (scanner, vtoken, NULL, NULL, NULL, NULL, TRUE); \
   TASSERT (scanner->token == vtoken); \
-  if (printout) g_print ("{scanner.v_float:%17g}", scanner->value.v_float); \
+  if (needprint) printout ("{scanner.v_float:%17g}", scanner->value.v_float); \
   TASSERT (scanner->value.v_float == svalue); \
   TASSERT (g_scanner_get_next_token (scanner) == '#'); \
 }
@@ -195,14 +195,14 @@ serial_pspec_check (GParamSpec *pspec,
   token = sfi_value_parse_typed (&rvalue, scanner);
   if (token != G_TOKEN_NONE)
     {
-      g_print ("{while parsing pspec \"%s\":\n\t%s\n", pspec->name, s1->str);
+      printout ("{while parsing pspec \"%s\":\n\t%s\n", pspec->name, s1->str);
       g_scanner_unexp_token (scanner, token, NULL, NULL, NULL,
                             g_strdup_format ("failed to serialize pspec \"%s\"", pspec->name), TRUE);
     }
   TASSERT (token == G_TOKEN_NONE);
   sfi_value_store_typed (&rvalue, s2);
   if (strcmp (s1->str, s2->str))
-    g_print ("{while comparing pspecs \"%s\":\n\t%s\n\t%s\n", pspec->name, s1->str, s2->str);
+    printout ("{while comparing pspecs \"%s\":\n\t%s\n\t%s\n", pspec->name, s1->str, s2->str);
   TASSERT (strcmp (s1->str, s2->str) == 0);
   g_value_unset (&rvalue);
   sfi_value_free (value);
@@ -243,10 +243,10 @@ serialize_cmp (GValue     *value,
            token = GTokenType ('(');
        }
       if (0)
-       g_print ("{parsing:%s}", gstring->str);
+       printout ("{parsing:%s}", gstring->str);
       if (token != G_TOKEN_NONE)
        {
-         g_print ("{while parsing \"%s\":\n\t%s\n", pspec->name, gstring->str);
+         printout ("{while parsing \"%s\":\n\t%s\n", pspec->name, gstring->str);
          g_scanner_unexp_token (scanner, token, NULL, NULL, NULL,
                                 g_strdup_format ("failed to serialize \"%s\"", pspec->name), TRUE);
        }
@@ -254,8 +254,8 @@ serialize_cmp (GValue     *value,
       cmp = g_param_values_cmp (pspec, value, &rvalue);
       if (cmp)
        {
-         g_print ("{after parsing:\n\t%s\n", gstring->str);
-         g_print ("while comparing:\n\t%s\nwith:\n\t%s\nresult:\n\t%d\n",
+         printout ("{after parsing:\n\t%s\n", gstring->str);
+         printout ("while comparing:\n\t%s\nwith:\n\t%s\nresult:\n\t%d\n",
                   g_strdup_value_contents (value),
                   g_strdup_value_contents (&rvalue),
                   cmp);
@@ -269,7 +269,7 @@ serialize_cmp (GValue     *value,
        }
       TASSERT (cmp == 0);
       if (0) /* generate testoutput */
-       g_print ("OK=================(%s)=================:\n%s\n", pspec->name, gstring->str);
+       printout ("OK=================(%s)=================:\n%s\n", pspec->name, gstring->str);
     }
   g_scanner_destroy (scanner);
   g_string_free (gstring, TRUE);
@@ -490,7 +490,7 @@ test_notes (void)
     }
   sfi_note_from_string_err ("NeverNote", &error);
   TASSERT (error != NULL);
-  // g_print ("{%s}", error);
+  // printout ("{%s}", error);
   g_free (error);
   TDONE ();
 }
@@ -534,29 +534,29 @@ generate_vmarshal (guint sig)
     *--s = '0' + (i & 3);
   if (!vmarshal_switch)
     {
-      g_print ("static void /* %u */\nsfi_vmarshal_%s (gpointer func, gpointer arg0, Arg *alist)\n{\n",
+      printout ("static void /* %u */\nsfi_vmarshal_%s (gpointer func, gpointer arg0, Arg *alist)\n{\n",
               vmarshal_count, s);
-      g_print ("  void (*f) (gpointer");
+      printout ("  void (*f) (gpointer");
       for (i = 0; s[i]; i++)
        switch (s[i] - '0')
          {
-         case 1:       g_print (", guint32");          break;
-         case 2:       g_print (", guint64");          break;
-         case 3:       g_print (", double");           break;
+         case 1:       printout (", guint32");         break;
+         case 2:       printout (", guint64");         break;
+         case 3:       printout (", double");          break;
          }
-      g_print (", gpointer) = func;\n");
-      g_print ("  f (arg0");
+      printout (", gpointer) = func;\n");
+      printout ("  f (arg0");
       for (i = 0; s[i]; i++)
        switch (s[i] - '0')
          {
-         case 1:       g_print (", alist[%u].v32", i);         break;
-         case 2:       g_print (", alist[%u].v64", i);         break;
-         case 3:       g_print (", alist[%u].vdbl", i);        break;
+         case 1:       printout (", alist[%u].v32", i);                break;
+         case 2:       printout (", alist[%u].v64", i);                break;
+         case 3:       printout (", alist[%u].vdbl", i);       break;
          }
-      g_print (", alist[%u].vpt);\n}\n", i);
+      printout (", alist[%u].vpt);\n}\n", i);
     }
   else
-    g_print ("    case 0x%03x: return sfi_vmarshal_%s; /* %u */\n", sig, s, vmarshal_count);
+    printout ("    case 0x%03x: return sfi_vmarshal_%s; /* %u */\n", sig, s, vmarshal_count);
 }
 
 static void
@@ -596,11 +596,11 @@ generate_vmarshal_code (void)
   vmarshal_switch = FALSE;
   generate_vmarshal_loop ();
   vmarshal_switch = TRUE;
-  g_print ("static VMarshal\nsfi_vmarshal_switch (guint sig)\n{\n");
-  g_print ("  switch (sig)\n    {\n");
+  printout ("static VMarshal\nsfi_vmarshal_switch (guint sig)\n{\n");
+  printout ("  switch (sig)\n    {\n");
   generate_vmarshal_loop ();
-  g_print ("    default: assert_unreached (); return NULL;\n");
-  g_print ("    }\n}\n");
+  printout ("    default: assert_unreached (); return NULL;\n");
+  printout ("    }\n}\n");
 }
 static const char *pointer1 = "huhu";
 static const char *pointer2 = "haha";
diff --git a/sfi/tests/ring.cc b/sfi/tests/ring.cc
index 49cd1f1..c8df20b 100644
--- a/sfi/tests/ring.cc
+++ b/sfi/tests/ring.cc
@@ -6,11 +6,11 @@
 static void
 print_ring_ints (SfiRing *ring)
 {
-  g_print ("SfiRing(%p): {", ring);
+  printout ("SfiRing(%p): {", ring);
   SfiRing *node;
   for (node = ring; node; node = sfi_ring_walk (node, ring))
-    g_print (" %zd,", (size_t) node->data);
-  g_print (" };");
+    printout (" %zd,", (size_t) node->data);
+  printout (" };");
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]