]> granicus.if.org Git - recode/commitdiff
testdump output via subtask
authorFrançois Pinard <pinard@iro.umontreal.ca>
Sat, 23 Feb 2008 18:34:53 +0000 (13:34 -0500)
committerFrançois Pinard <pinard@iro.umontreal.ca>
Sat, 23 Feb 2008 18:34:53 +0000 (13:34 -0500)
src/ChangeLog
src/testdump.c
tests/t40_testdump.py

index 6187c0f14d953cbf15c617af0d9086dfc6691301..4e38ee719c26cf017cc725bea33fdea6e034af5b 100644 (file)
@@ -1,3 +1,8 @@
+2008-02-23  François Pinard  <pinard@iro.umontreal.ca>
+
+       * testdump.c (produce_count, produce_full_dump): Output as directed
+       by the subtask, rather than directly on stdout.
+
 2008-02-22  François Pinard  <pinard@iro.umontreal.ca>
 
        Repair all Flex steps, which were broken since version 3.6.
index 424b7b1973f7b423fb1b9f21a4dda241ae92d527..2f46742408285fc56754d717f0ff362338b565bf 100644 (file)
@@ -144,6 +144,15 @@ compare_item (const void *void_first, const void *void_second)
   return (*first)->code - (*second)->code;
 }
 
+static void
+put_string (const char *string, RECODE_SUBTASK subtask)
+{
+  const char *cursor;
+
+  for (cursor = string; *cursor; cursor++)
+    put_byte (*cursor, subtask);
+}
+
 static bool
 produce_count (RECODE_SUBTASK subtask)
 {
@@ -229,22 +238,23 @@ produce_count (RECODE_SUBTASK subtask)
 
        if (column + count_width + non_count_width > 80)
          {
-           putchar ('\n');
+           put_byte ('\n', subtask);
            delayed = 0;
            column = 0;
          }
        else
          while (delayed)
            {
-             putchar (' ');
+             put_byte (' ', subtask);
              delayed--;
            }
 
-       printf ("%*d  %.4X", count_width, (*cursor)->count, character);
+       sprintf (buffer, "%*d  %.4X", count_width, (*cursor)->count, character);
+        put_string (buffer, subtask);
        if (mnemonic)
          {
-           putchar (' ');
-           fputs (mnemonic, stdout);
+           put_byte (' ', subtask);
+           put_string (mnemonic, subtask);
            delayed = 6 - 1 - strlen (mnemonic);
          }
        else
@@ -254,7 +264,7 @@ produce_count (RECODE_SUBTASK subtask)
       }
 
     if (column)
-      putchar ('\n');
+      put_byte ('\n', subtask);
   }
 
   /* Clean-up.  */
@@ -281,6 +291,7 @@ produce_full_dump (RECODE_SUBTASK subtask)
       const char *charname;    /* charname for code */
       bool french;             /* if output should be in French */
       const char *string;      /* environment value */
+      char buffer[50];
 
       /* Decide if we prefer French or English output.  */
 
@@ -295,17 +306,21 @@ produce_full_dump (RECODE_SUBTASK subtask)
            french = true;
        }
 
-      fputs (_("UCS2   Mne   Description\n\n"), stdout);
+      put_string (_("UCS2   Mne   Description\n\n"), subtask);
 
       while (1)
        {
          const char *mnemonic = ucs2_to_rfc1345 (character);
 
-         printf ("%.4X", character);
+         sprintf (buffer, "%.4X", character);
+          put_string (buffer, subtask);
          if (mnemonic)
-           printf ("   %-3s", mnemonic);
+            {
+              sprintf (buffer, "   %-3s", mnemonic);
+              put_string (buffer, subtask);
+            }
          else
-           fputs ("      ", stdout);
+           put_string ("      ", subtask);
 
          if (french)
            {
@@ -322,10 +337,10 @@ produce_full_dump (RECODE_SUBTASK subtask)
 
          if (charname)
            {
-             fputs ("   ", stdout);
-             fputs (charname, stdout);
+             put_string ("   ", subtask);
+             put_string (charname, subtask);
            }
-         printf ("\n");
+         put_byte ('\n', subtask);
 
          if (!get_ucs2 (&character, subtask))
            break;
index cac7304dd44d76fd6ff5b60f02842c4f0e5c7195..21da2b6b9d80271ecce27046445e20044b8770f4 100644 (file)
@@ -16,7 +16,6 @@ class Test_test7:
 '''
 
     def test_1(self):
-        common.external(True)
         common.request('test7..x,us..count')
         common.validate('', self.output)
 
@@ -30,7 +29,6 @@ class Test_test8:
 '''
 
     def test_1(self):
-        common.external(True)
         common.request('test8..x,us..count')
         common.validate('', self.output)
 
@@ -45,7 +43,6 @@ class Test_test15:
 '''
 
     def test_1(self):
-        common.external(True)
         common.request('test15..x2,us..count')
         common.validate('', self.output)
 
@@ -60,6 +57,5 @@ class Test_test16:
 '''
 
     def test_1(self):
-        common.external(True)
         common.request('test16..x2,us..count')
         common.validate('', self.output)