output: Remove PostScript driver.
[pspp-builds.git] / src / output / output.h
index 8f44b1d9f74f85220d39eb9eedea0c704aeb69fb..398781f05f547fef57f429386e20af6da4993b31 100644 (file)
@@ -1,30 +1,25 @@
-/* PSPP - computes sample statistics.
-   Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
-   Written by Ben Pfaff <blp@gnu.org>.
+/* PSPP - a program for statistical analysis.
+   Copyright (C) 1997-9, 2000, 2007, 2009 Free Software Foundation, Inc.
 
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
 
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA. */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
-#if !output_h
-#define output_h 1
-
-#include <config.h>
+#ifndef OUTPUT_OUTPUT_H
+#define OUTPUT_OUTPUT_H 1
 
+#include <libpspp/ll.h>
 #include <libpspp/str.h>
 
-
 /* Line styles.  */
 enum outp_line_style
   {
@@ -42,7 +37,7 @@ enum outp_justification
     OUTP_CENTER,                /* Center justification. */
   };
 
-enum outp_font 
+enum outp_font
   {
     OUTP_FIXED,                 /* Fixed-width font. */
     OUTP_PROPORTIONAL,          /* Proportional font. */
@@ -55,7 +50,7 @@ struct outp_text
   {
     enum outp_font font;
     enum outp_justification justification;
-    struct fixed_string string;
+    struct substring string;
     int h, v;                  /* Horizontal, vertical size. */
     int x, y;                  /* Position. */
   };
@@ -70,15 +65,20 @@ struct outp_class
     const char *name;          /* Name of this driver class. */
     int special;               /* Boolean value. */
 
-    bool (*open_driver) (struct outp_driver *, const struct string *options);
+    bool (*open_driver) (const char *name, int types,
+                         struct substring options);
     bool (*close_driver) (struct outp_driver *);
 
     void (*open_page) (struct outp_driver *);
     void (*close_page) (struct outp_driver *);
 
+    void (*flush) (struct outp_driver *);
+
+    void (*output_chart) (struct outp_driver *, const struct chart *);
+
     /* special != 0 only. */
     void (*submit) (struct outp_driver *, struct som_entity *);
-    
+
     /* special == 0 only.  */
     void (*line) (struct outp_driver *, int x0, int y0, int x1, int y1,
                   enum outp_line_style top, enum outp_line_style left,
@@ -86,8 +86,6 @@ struct outp_class
     void (*text_metrics) (struct outp_driver *, const struct outp_text *,
                           int *width, int *height);
     void (*text_draw) (struct outp_driver *, const struct outp_text *);
-    void (*initialise_chart)(struct outp_driver *, struct chart *);
-    void (*finalise_chart)(struct outp_driver *, struct chart *);
   };
 
 /* Device types. */
@@ -102,8 +100,8 @@ enum
 /* Defines the configuration of an output driver. */
 struct outp_driver
   {
-    struct outp_driver *next, *prev; /* List of drivers. */
-    struct outp_class *class;  /* Driver class. */
+    struct ll node;             /* Node in list of drivers. */
+    const struct outp_class *class;    /* Driver class. */
     char *name;                        /* Name of this driver. */
     bool page_open;            /* 1=page is open, 0=page is closed. */
     int device;                        /* Zero or more of OUTP_DEV_*. */
@@ -117,7 +115,6 @@ struct outp_driver
     int vert_line_width[OUTP_L_COUNT]; /* Width of vertical lines. */
 
     void *ext;                 /* Private extension record. */
-    void *prc;                 /* Per-procedure extension record. */
   };
 
 /* Option structure for the keyword recognizer. */
@@ -128,16 +125,21 @@ struct outp_option
     int subcat;                        /* Subcategory. */
   };
 
-/* List of configured output drivers. */
-extern struct outp_driver *outp_driver_list;
 
 /* Title, subtitle. */
 extern char *outp_title;
 extern char *outp_subtitle;
 
 void outp_init (void);
-void outp_read_devices (void);
 void outp_done (void);
+void outp_read_devices (void);
+void outp_configure_driver_line (struct substring);
+
+struct outp_driver *outp_allocate_driver (const struct outp_class *class,
+                                          const char *name, int types);
+void outp_free_driver (struct outp_driver *);
+void outp_register_driver (struct outp_driver *);
+void outp_unregister_driver (struct outp_driver *);
 
 void outp_configure_clear (void);
 void outp_configure_add (char *);
@@ -145,25 +147,33 @@ void outp_configure_macro (char *);
 
 void outp_list_classes (void);
 
-void outp_enable_device (int enable, int device);
+void outp_enable_device (bool enable, int device);
 struct outp_driver *outp_drivers (struct outp_driver *);
 
-bool outp_parse_options (const struct string *options,
-                         bool (*) (struct outp_driver *, const char *key,
-                                   const struct string *value),
-                         struct outp_driver *);
-int outp_match_keyword (const char *, struct outp_option *, int *);
+bool outp_parse_options (const char *driver_name, struct substring options,
+                         bool (*callback) (void *aux, const char *key,
+                                           const struct string *value),
+                         void *aux);
+int outp_match_keyword (const char *, const struct outp_option *, int *);
 
-int outp_evaluate_dimension (char *, char **);
-int outp_get_paper_size (char *, int *h, int *v);
+int outp_evaluate_dimension (const char *);
+bool outp_get_paper_size (const char *, int *h, int *v);
 
 void outp_open_page (struct outp_driver *);
 void outp_close_page (struct outp_driver *);
 void outp_eject_page (struct outp_driver *);
+void outp_flush (struct outp_driver *);
 
 int outp_string_width (struct outp_driver *, const char *, enum outp_font);
 
 /* Imported from som-frnt.c. */
 void som_destroy_driver (struct outp_driver *);
 
-#endif /* output.h */
+/* Common drivers. */
+extern const struct outp_class ascii_class;
+#ifdef HAVE_CAIRO
+extern const struct outp_class cairo_class;
+#endif
+extern const struct outp_class odt_class;
+
+#endif /* output/output.h */