Get rid of capacity argument to ds_init() and update all callers.
[pspp-builds.git] / src / output / postscript.c
index 53e81104f87851069ce7d3598876f786bf141001..919d1bb7debd31de3f6f5338fbbedc9db2c638c0 100644 (file)
 #include <libpspp/compiler.h>
 #include <libpspp/freaderror.h>
 #include <libpspp/hash.h>
-#include <libpspp/message.h>
 #include <libpspp/misc.h>
 #include <libpspp/start-date.h>
 #include <libpspp/version.h>
 
-#include <data/filename.h>
+#include <data/file-name.h>
 
 #include "afm.h"
 #include "chart.h"
@@ -130,7 +129,7 @@ static void setup_font (struct outp_driver *this, struct font *, int index);
 /* Driver initialization. */
 
 static bool
-ps_open_driver (struct outp_driver *this, const char *options)
+ps_open_driver (struct outp_driver *this, const struct string *options)
 {
   struct ps_driver_ext *x;
   size_t i;
@@ -425,16 +424,16 @@ handle_option (struct outp_driver *this, const char *key,
 }
 
 /* Looks for a PostScript font file or config file in all the
-   appropriate places.  Returns the filename on success, NULL on
+   appropriate places.  Returns the file name on success, NULL on
    failure. */
 static char *
 find_ps_file (const char *name)
 {
-  if (fn_absolute_p (name))
+  if (fn_is_absolute (name))
     return xstrdup (name);
   else
     {
-      char *base_name = xasprintf ("psfonts%c%s", DIR_SEPARATOR, name);
+      char *base_name = xasprintf ("psfonts/%s", name);
       char *file_name = fn_search_path (base_name, config_path, NULL);
       free (base_name);
       return file_name;
@@ -675,35 +674,35 @@ ps_line (struct outp_driver *this,
          enum outp_line_style top, enum outp_line_style left,
          enum outp_line_style bottom, enum outp_line_style right)
 {
-/* The algorithm here is somewhat subtle, to allow it to handle
-   all the kinds of intersections that we need.
-
-   Three additional ordinates are assigned along the x axis.  The
-   first is xc, midway between x0 and x3.  The others are x1 and
-   x2; for a single vertical line these are equal to xc, and for
-   a double vertical line they are the ordinates of the left and
-   right half of the double line.
-
-   yc, y1, and y2 are assigned similarly along the y axis.
-
-   The following diagram shows the coordinate system and output
-   for double top and bottom lines, single left line, and no
-   right line:
-
-               x0       x1 xc  x2      x3
-             y0 ________________________
-                |        #     #       |
-                |        #     #       |
-                |        #     #       |
-                |        #     #       |
-                |        #     #       |
-   y1 = y2 = yc |#########     #       |
-                |        #     #       |
-                |        #     #       |
-                |        #     #       |
-                |        #     #       |
-             y3 |________#_____#_______|
-*/
+  /* The algorithm here is somewhat subtle, to allow it to handle
+     all the kinds of intersections that we need.
+
+     Three additional ordinates are assigned along the x axis.  The
+     first is xc, midway between x0 and x3.  The others are x1 and
+     x2; for a single vertical line these are equal to xc, and for
+     a double vertical line they are the ordinates of the left and
+     right half of the double line.
+
+     yc, y1, and y2 are assigned similarly along the y axis.
+
+     The following diagram shows the coordinate system and output
+     for double top and bottom lines, single left line, and no
+     right line:
+
+                 x0       x1 xc  x2      x3
+               y0 ________________________
+                  |        #     #       |
+                  |        #     #       |
+                  |        #     #       |
+                  |        #     #       |
+                  |        #     #       |
+     y1 = y2 = yc |#########     #       |
+                  |        #     #       |
+                  |        #     #       |
+                  |        #     #       |
+                  |        #     #       |
+               y3 |________#_____#_______|
+  */
   struct ps_driver_ext *ext = this->ext;
 
   /* Offset from center of each line in a pair of double lines. */
@@ -875,7 +874,7 @@ write_text (struct outp_driver *this,
       fprintf (ext->file, "F%d setfont\n", font);
     }
 
-  ds_init (&out, 0);
+  ds_init (&out);
   for (i = 0; i < char_cnt; i = j)
     {
       for (j = i + 1; j < char_cnt; j++)
@@ -1146,7 +1145,7 @@ ps_chart_finalise (struct outp_driver *this UNUSED, struct chart *ch UNUSED)
     continue;
   fclose (ch->file);
 
-  fputs ("%%%%EndDocument\n"
+  fputs ("%%EndDocument\n"
          "end\n"
          "sp restore\n",
          x->file);
@@ -1383,7 +1382,7 @@ reencode_font (struct outp_driver *this, struct font *font)
 
   line_number = 0;
 
-  ds_init (&line, 0);
+  ds_init (&line);
   while (ds_get_config_line (file, &line, &line_number))
     {
       char *pschar, *code;