Continue reforming procedure execution. In this phase, move
[pspp-builds.git] / src / language / data-io / print.c
index 9d835abe5204f439fbe97b18b7a091a9b8b8e1bd..63270160d949dd9654776fd13ffa4e8572415cd0 100644 (file)
 /* FIXME: seems like a lot of code duplication with data-list.c. */
 
 #include <config.h>
-#include <libpspp/message.h>
+
 #include <stdlib.h>
-#include <libpspp/alloc.h>
+
 #include <data/case.h>
+#include <data/procedure.h>
+#include <data/transformations.h>
+#include <data/variable.h>
 #include <language/command.h>
-#include <libpspp/compiler.h>
 #include <language/data-io/data-writer.h>
-#include <libpspp/message.h>
-#include <language/expressions/public.h>
 #include <language/data-io/file-handle.h>
+#include <language/expressions/public.h>
 #include <language/lexer/lexer.h>
+#include <libpspp/alloc.h>
+#include <libpspp/compiler.h>
+#include <libpspp/message.h>
+#include <libpspp/message.h>
 #include <libpspp/misc.h>
 #include <output/manager.h>
 #include <output/table.h>
-#include <data/variable.h>
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
@@ -810,12 +814,12 @@ dump_table (const struct file_handle *fh)
        {
          int len = strlen (spec->u.c);
          nspec++;
-         tab_text (t, 0, nspec, TAB_LEFT | TAT_FIX | TAT_PRINTF,
+         tab_text (t, 0, nspec, TAB_LEFT | TAB_FIX | TAT_PRINTF,
                        "\"%s\"", spec->u.c);
          tab_text (t, 1, nspec, TAT_PRINTF, "%d", recno + 1);
          tab_text (t, 2, nspec, TAT_PRINTF, "%3d-%3d",
                        spec->fc + 1, spec->fc + len);
-         tab_text (t, 3, nspec, TAB_LEFT | TAT_FIX | TAT_PRINTF,
+         tab_text (t, 3, nspec, TAB_LEFT | TAB_FIX | TAT_PRINTF,
                        "A%d", len);
          break;
        }
@@ -826,7 +830,7 @@ dump_table (const struct file_handle *fh)
          tab_text (t, 1, nspec, TAT_PRINTF, "%d", recno + 1);
          tab_text (t, 2, nspec, TAT_PRINTF, "%3d-%3d",
                        spec->fc + 1, spec->fc + spec->u.v.f.w);
-         tab_text (t, 3, nspec, TAB_LEFT | TAT_FIX,
+         tab_text (t, 3, nspec, TAB_LEFT | TAB_FIX,
                        fmt_to_string (&spec->u.v.f));
          break;
        }
@@ -837,22 +841,15 @@ dump_table (const struct file_handle *fh)
       }
 
   if (fh != NULL)
-    tab_title (t, 1, ngettext ("Writing %d record to %s.",
-                               "Writing %d records to %s.", recno),
+    tab_title (t, ngettext ("Writing %d record to %s.",
+                            "Writing %d records to %s.", recno),
                recno, fh_get_name (fh));
   else
-    tab_title (t, 1, ngettext ("Writing %d record.",
-                               "Writing %d records.", recno), recno);
+    tab_title (t, ngettext ("Writing %d record.",
+                            "Writing %d records.", recno), recno);
   tab_submit (t);
 }
 
-/* PORTME: The number of characters in a line terminator. */
-#ifdef __MSDOS__ 
-#define LINE_END_WIDTH 2       /* \r\n */
-#else
-#define LINE_END_WIDTH 1       /* \n */
-#endif
-
 /* Calculates the maximum possible line width and allocates a buffer
    big enough to contain it */
 static void
@@ -891,7 +888,7 @@ alloc_line (void)
       if (pot_w > w)
        w = pot_w;
     }
-  prt.max_width = w + LINE_END_WIDTH + 1;
+  prt.max_width = w + 2;
   prt.line = xmalloc (prt.max_width);
 }
 \f
@@ -927,19 +924,13 @@ print_trns_proc (void *trns_, struct ccase *c, int case_num UNUSED)
        if (t->writer == NULL)
          {
            buf[len] = 0;
-           tab_output_text (TAT_FIX | TAT_NOWRAP, buf);
+           tab_output_text (TAB_FIX | TAT_NOWRAP, buf);
          }
        else
          {
            if ((t->options & PRT_CMD_MASK) == PRT_PRINT
                 || !(t->options & PRT_BINARY))
-             {
-               /* PORTME: Line ends. */
-#ifdef __MSDOS__
-               buf[len++] = '\r';
-#endif
-               buf[len++] = '\n';
-             }
+              buf[len++] = '\n';
 
            dfm_put_record (t->writer, buf, len);
          }