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., 59 Temple Place - Suite 330, Boston, MA
28 int x1, y1; /* Upper left. */
29 int x2, y2; /* Lower right, not part of the rectangle. */
32 #if __GNUC__ > 1 && defined(__OPTIMIZE__)
33 extern inline int width (rect r) __attribute__ ((const));
34 extern inline int height (rect r) __attribute__ ((const));
39 return r.x2 - r.x1 + 1;
45 return r.y2 - r.y1 + 1;
52 #endif /* !__GNUC__ */
54 /* Color descriptor. */
57 int flags; /* 0=normal, 1=transparent (ignore r,g,b). */
58 int r; /* Red component, 0-65535. */
59 int g; /* Green component, 0-65535. */
60 int b; /* Blue component, 0-65535. */
63 /* Mount positions for the four basic fonts. Do not change the values. */
66 OUTP_F_R, /* Roman font. */
67 OUTP_F_I, /* Italic font. */
68 OUTP_F_B, /* Bold font. */
69 OUTP_F_BI /* Bold-italic font. */
72 /* Line styles. These must match:
74 ascii.c:ascii_line_*()
75 postscript.c:ps_line_*() */
78 OUTP_L_NONE = 0, /* No line. */
79 OUTP_L_SINGLE = 1, /* Single line. */
80 OUTP_L_DOUBLE = 2, /* Double line. */
81 OUTP_L_SPECIAL = 3, /* Special line of driver-defined style. */
83 OUTP_L_COUNT /* Number of line styles. */
86 /* Contains a line style for each part of an intersection. */
95 /* Text display options. */
100 /* Must match tab.h:TAB_*. */
101 OUTP_T_JUST_MASK = 00003, /* Justification mask. */
102 OUTP_T_JUST_RIGHT = 00000, /* Right justification. */
103 OUTP_T_JUST_LEFT = 00001, /* Left justification. */
104 OUTP_T_JUST_CENTER = 00002, /* Center justification. */
106 OUTP_T_HORZ = 00010, /* Horizontal size is specified. */
107 OUTP_T_VERT = 00020, /* (Max) vertical size is specified. */
109 OUTP_T_0 = 00140, /* Normal orientation. */
110 OUTP_T_CC90 = 00040, /* 90 degrees counterclockwise. */
111 OUTP_T_CC180 = 00100, /* 180 degrees counterclockwise. */
112 OUTP_T_CC270 = 00140, /* 270 degrees counterclockwise. */
113 OUTP_T_C90 = 00140, /* 90 degrees clockwise. */
114 OUTP_T_C180 = 00100, /* 180 degrees clockwise. */
115 OUTP_T_C270 = 00040, /* 270 degrees clockwise. */
117 /* Internal use by drivers only. */
118 OUTP_T_INTERNAL_DRAW = 01000 /* 1=Draw the text, 0=Metrics only. */
121 /* Describes text output. */
125 int options; /* What is specified. */
126 struct len_string s; /* String. */
127 int h, v; /* Horizontal, vertical size. */
128 int x, y; /* Position. */
130 /* Internal use only. */
131 int w, l; /* Width, length. */
137 /* Defines a class of output driver. */
140 /* Basic class information. */
141 const char *name; /* Name of this driver class. */
142 int magic; /* Driver-specific constant. */
143 int special; /* Boolean value. */
145 /* Static member functions. */
146 int (*open_global) (struct outp_class *);
147 int (*close_global) (struct outp_class *);
148 int *(*font_sizes) (struct outp_class *, int *n_valid_sizes);
150 /* Virtual member functions. */
151 int (*preopen_driver) (struct outp_driver *);
152 void (*option) (struct outp_driver *, const char *key,
153 const struct string *value);
154 int (*postopen_driver) (struct outp_driver *);
155 int (*close_driver) (struct outp_driver *);
157 int (*open_page) (struct outp_driver *);
158 int (*close_page) (struct outp_driver *);
160 /* special != 0: Used to submit tables for output. */
161 void (*submit) (struct outp_driver *, struct som_table *);
163 /* special != 0: Methods below need not be defined. */
166 void (*line_horz) (struct outp_driver *, const struct rect *,
167 const struct color *, int style);
168 void (*line_vert) (struct outp_driver *, const struct rect *,
169 const struct color *, int style);
170 void (*line_intersection) (struct outp_driver *, const struct rect *,
171 const struct color *,
172 const struct outp_styles *style);
174 /* Drawing methods. */
175 void (*box) (struct outp_driver *, const struct rect *,
176 const struct color *bord, const struct color *fill);
177 void (*polyline_begin) (struct outp_driver *, const struct color *);
178 void (*polyline_point) (struct outp_driver *, int, int);
179 void (*polyline_end) (struct outp_driver *);
182 void (*text_set_font_by_name) (struct outp_driver *, const char *s);
183 void (*text_set_font_by_position) (struct outp_driver *, int);
184 void (*text_set_font_family) (struct outp_driver *, const char *s);
185 const char *(*text_get_font_name) (struct outp_driver *);
186 const char *(*text_get_font_family) (struct outp_driver *);
187 int (*text_set_size) (struct outp_driver *, int);
188 int (*text_get_size) (struct outp_driver *, int *em_width);
189 void (*text_metrics) (struct outp_driver *, struct outp_text *);
190 void (*text_draw) (struct outp_driver *, struct outp_text *);
196 OUTP_DEV_NONE = 0, /* None of the below. */
197 OUTP_DEV_LISTING = 001, /* Listing device. */
198 OUTP_DEV_SCREEN = 002, /* Screen device. */
199 OUTP_DEV_PRINTER = 004, /* Printer device. */
200 OUTP_DEV_DISABLED = 010 /* Broken device. */
203 /* Defines the configuration of an output driver. */
206 struct outp_class *class; /* Driver class. */
207 char *name; /* Name of this driver. */
208 int driver_open; /* 1=driver is open, 0=driver is closed. */
209 int page_open; /* 1=page is open, 0=page is closed. */
211 struct outp_driver *next, *prev; /* Next, previous output driver in list. */
213 int device; /* Zero or more of OUTP_DEV_*. */
214 int res, horiz, vert; /* Device resolution. */
215 int width, length; /* Page size. */
217 int cp_x, cp_y; /* Current position. */
218 int font_height; /* Default font character height. */
219 int prop_em_width; /* Proportional font em width. */
220 int fixed_width; /* Fixed-pitch font character width. */
221 int horiz_line_width[OUTP_L_COUNT]; /* Width of horizontal lines. */
222 int vert_line_width[OUTP_L_COUNT]; /* Width of vertical lines. */
223 int horiz_line_spacing[1 << OUTP_L_COUNT];
224 int vert_line_spacing[1 << OUTP_L_COUNT];
226 void *ext; /* Private extension record. */
227 void *prc; /* Per-procedure extension record. */
230 /* Option structure for the keyword recognizer. */
233 const char *keyword; /* Keyword name. */
234 int cat; /* Category. */
235 int subcat; /* Subcategory. */
238 /* Information structure for the keyword recognizer. */
239 struct outp_option_info
241 char *initial; /* Initial characters. */
242 struct outp_option **options; /* Search starting points. */
245 /* A list of driver classes. */
246 struct outp_driver_class_list
249 struct outp_class *class;
250 struct outp_driver_class_list *next;
253 /* List of known output driver classes. */
254 extern struct outp_driver_class_list *outp_class_list;
256 /* List of configured output drivers. */
257 extern struct outp_driver *outp_driver_list;
259 /* Title, subtitle. */
260 extern char *outp_title;
261 extern char *outp_subtitle;
263 int outp_init (void);
264 int outp_read_devices (void);
265 int outp_done (void);
267 void outp_configure_clear (void);
268 void outp_configure_add (char *);
269 void outp_configure_macro (char *);
271 void outp_list_classes (void);
273 void outp_enable_device (int enable, int device);
274 struct outp_driver *outp_drivers (struct outp_driver *);
276 int outp_match_keyword (const char *, struct outp_option *,
277 struct outp_option_info *, int *);
279 int outp_evaluate_dimension (char *, char **);
280 int outp_get_paper_size (char *, int *h, int *v);
282 int outp_eject_page (struct outp_driver *);
284 int outp_string_width (struct outp_driver *, const char *);
286 /* Imported from som-frnt.c. */
287 void som_destroy_driver (struct outp_driver *);
289 #endif /* output.h */