1 /* PSPP - computes sample statistics.
2 Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
3 Written by Ben Pfaff <blp@gnu.org>.
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 #include <libpspp/str.h>
31 OUTP_L_NONE, /* No line. */
32 OUTP_L_SINGLE, /* Single line. */
33 OUTP_L_DOUBLE, /* Double line. */
37 /* Text justification. */
38 enum outp_justification
40 OUTP_RIGHT, /* Right justification. */
41 OUTP_LEFT, /* Left justification. */
42 OUTP_CENTER, /* Center justification. */
47 OUTP_FIXED, /* Fixed-width font. */
48 OUTP_PROPORTIONAL, /* Proportional font. */
49 OUTP_EMPHASIS, /* Proportional font used for emphasis. */
50 OUTP_FONT_CNT /* Number of fonts. */
53 /* Describes text output. */
57 enum outp_justification justification;
58 struct fixed_string string;
59 int h, v; /* Horizontal, vertical size. */
60 int x, y; /* Position. */
67 /* Defines a class of output driver. */
70 const char *name; /* Name of this driver class. */
71 int special; /* Boolean value. */
73 bool (*open_driver) (struct outp_driver *, const struct string *options);
74 bool (*close_driver) (struct outp_driver *);
76 void (*open_page) (struct outp_driver *);
77 void (*close_page) (struct outp_driver *);
79 /* special != 0 only. */
80 void (*submit) (struct outp_driver *, struct som_entity *);
82 /* special == 0 only. */
83 void (*line) (struct outp_driver *, int x0, int y0, int x1, int y1,
84 enum outp_line_style top, enum outp_line_style left,
85 enum outp_line_style bottom, enum outp_line_style right);
86 void (*text_metrics) (struct outp_driver *, const struct outp_text *,
87 int *width, int *height);
88 void (*text_draw) (struct outp_driver *, const struct outp_text *);
89 void (*initialise_chart)(struct outp_driver *, struct chart *);
90 void (*finalise_chart)(struct outp_driver *, struct chart *);
96 OUTP_DEV_NONE = 0, /* None of the below. */
97 OUTP_DEV_LISTING = 001, /* Listing device. */
98 OUTP_DEV_SCREEN = 002, /* Screen device. */
99 OUTP_DEV_PRINTER = 004, /* Printer device. */
102 /* Defines the configuration of an output driver. */
105 struct outp_driver *next, *prev; /* List of drivers. */
106 struct outp_class *class; /* Driver class. */
107 char *name; /* Name of this driver. */
108 bool page_open; /* 1=page is open, 0=page is closed. */
109 int device; /* Zero or more of OUTP_DEV_*. */
110 int cp_x, cp_y; /* Current position. */
112 int width, length; /* Page size. */
113 int font_height; /* Default font character height. */
114 int prop_em_width; /* Proportional font em width. */
115 int fixed_width; /* Fixed-pitch font character width. */
116 int horiz_line_width[OUTP_L_COUNT]; /* Width of horizontal lines. */
117 int vert_line_width[OUTP_L_COUNT]; /* Width of vertical lines. */
119 void *ext; /* Private extension record. */
120 void *prc; /* Per-procedure extension record. */
123 /* Option structure for the keyword recognizer. */
126 const char *keyword; /* Keyword name. */
127 int cat; /* Category. */
128 int subcat; /* Subcategory. */
131 /* List of configured output drivers. */
132 extern struct outp_driver *outp_driver_list;
134 /* Title, subtitle. */
135 extern char *outp_title;
136 extern char *outp_subtitle;
138 void outp_init (void);
139 void outp_read_devices (void);
140 void outp_done (void);
142 void outp_configure_clear (void);
143 void outp_configure_add (char *);
144 void outp_configure_macro (char *);
146 void outp_list_classes (void);
148 void outp_enable_device (int enable, int device);
149 struct outp_driver *outp_drivers (struct outp_driver *);
151 bool outp_parse_options (const struct string *options,
152 bool (*) (struct outp_driver *, const char *key,
153 const struct string *value),
154 struct outp_driver *);
155 int outp_match_keyword (const char *, struct outp_option *, int *);
157 int outp_evaluate_dimension (char *, char **);
158 int outp_get_paper_size (char *, int *h, int *v);
160 void outp_open_page (struct outp_driver *);
161 void outp_close_page (struct outp_driver *);
162 void outp_eject_page (struct outp_driver *);
164 int outp_string_width (struct outp_driver *, const char *, enum outp_font);
166 /* Imported from som-frnt.c. */
167 void som_destroy_driver (struct outp_driver *);
169 #endif /* output.h */