]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/ppd.h
Copyright update...
[thirdparty/cups.git] / cups / ppd.h
1 /*
2 * "$Id: ppd.h,v 1.25 2002/01/02 17:58:40 mike Exp $"
3 *
4 * PostScript Printer Description definitions for the Common UNIX Printing
5 * System (CUPS).
6 *
7 * Copyright 1997-2002 by Easy Software Products, all rights reserved.
8 *
9 * These coded instructions, statements, and computer programs are the
10 * property of Easy Software Products and are protected by Federal
11 * copyright law. Distribution and use rights are outlined in the file
12 * "LICENSE.txt" which should have been included with this file. If this
13 * file is missing or damaged please contact Easy Software Products
14 * at:
15 *
16 * Attn: CUPS Licensing Information
17 * Easy Software Products
18 * 44141 Airport View Drive, Suite 204
19 * Hollywood, Maryland 20636-3111 USA
20 *
21 * Voice: (301) 373-9603
22 * EMail: cups-info@cups.org
23 * WWW: http://www.cups.org
24 *
25 * PostScript is a trademark of Adobe Systems, Inc.
26 *
27 * This code and any derivative of it may be used and distributed
28 * freely under the terms of the GNU General Public License when
29 * used with GNU Ghostscript or its derivatives. Use of the code
30 * (or any derivative of it) with software other than GNU
31 * GhostScript (or its derivatives) is governed by the CUPS license
32 * agreement.
33 */
34
35 #ifndef _CUPS_PPD_H_
36 # define _CUPS_PPD_H_
37
38 /*
39 * Include necessary headers...
40 */
41
42 # include <stdio.h>
43
44
45 /*
46 * C++ magic...
47 */
48
49 # ifdef __cplusplus
50 extern "C" {
51 # endif /* __cplusplus */
52
53
54 /*
55 * PPD version...
56 */
57
58 # define PPD_VERSION 4.3 /* Kept in sync with Adobe version number */
59
60
61 /*
62 * PPD size limits (defined in Adobe spec)
63 */
64
65 # define PPD_MAX_NAME 41 /* Maximum size of name + 1 for nul */
66 # define PPD_MAX_TEXT 81 /* Maximum size of text + 1 for nul */
67 # define PPD_MAX_LINE 256 /* Maximum size of line + 1 for nul */
68
69
70 /*
71 * Types and structures...
72 */
73
74 typedef enum /**** UI types ****/
75 {
76 PPD_UI_BOOLEAN, /* True or False option */
77 PPD_UI_PICKONE, /* Pick one from a list */
78 PPD_UI_PICKMANY /* Pick zero or more from a list */
79 } ppd_ui_t;
80
81 typedef enum /**** Order dependency sections ****/
82 {
83 PPD_ORDER_ANY, /* Option code can be anywhere in the file */
84 PPD_ORDER_DOCUMENT, /* ... must be in the DocumentSetup section */
85 PPD_ORDER_EXIT, /* ... must be sent prior to the document */
86 PPD_ORDER_JCL, /* ... must be sent as a JCL command */
87 PPD_ORDER_PAGE, /* ... must be in the PageSetup section */
88 PPD_ORDER_PROLOG /* ... must be in the Prolog section */
89 } ppd_section_t;
90
91 typedef enum /**** Colorspaces ****/
92 {
93 PPD_CS_CMYK = -4, /* CMYK colorspace */
94 PPD_CS_CMY, /* CMY colorspace */
95 PPD_CS_GRAY = 1, /* Grayscale colorspace */
96 PPD_CS_RGB = 3, /* RGB colorspace */
97 PPD_CS_RGBK, /* RGBK (K = gray) colorspace */
98 PPD_CS_N /* DeviceN colorspace */
99 } ppd_cs_t;
100
101 typedef struct /**** Option choices ****/
102 {
103 char marked, /* 0 if not selected, 1 otherwise */
104 choice[PPD_MAX_NAME],
105 /* Computer-readable option name */
106 text[PPD_MAX_TEXT],
107 /* Human-readable option name */
108 *code; /* Code to send for this option */
109 void *option; /* Pointer to parent option structure */
110 } ppd_choice_t;
111
112 typedef struct /**** Options ****/
113 {
114 char conflicted, /* 0 if no conflicts exist, 1 otherwise */
115 keyword[PPD_MAX_NAME],
116 /* Option keyword name ("PageSize", etc.) */
117 defchoice[PPD_MAX_NAME],
118 /* Default option choice */
119 text[PPD_MAX_TEXT];
120 /* Human-readable text */
121 ppd_ui_t ui; /* Type of UI option */
122 ppd_section_t section; /* Section for command */
123 float order; /* Order number */
124 int num_choices; /* Number of option choices */
125 ppd_choice_t *choices; /* Option choices */
126 } ppd_option_t;
127
128 typedef struct ppd_group_str /**** Groups ****/
129 {
130 char text[PPD_MAX_TEXT];
131 /* Human-readable group name */
132 int num_options; /* Number of options */
133 ppd_option_t *options; /* Options */
134 int num_subgroups; /* Number of sub-groups */
135 struct ppd_group_str *subgroups;
136 /* Sub-groups (max depth = 1) */
137 } ppd_group_t;
138
139 typedef struct /**** Constraints ****/
140 {
141 char option1[PPD_MAX_NAME],
142 /* First keyword */
143 choice1[PPD_MAX_NAME],
144 /* First option/choice (blank for all) */
145 option2[PPD_MAX_NAME],
146 /* Second keyword */
147 choice2[PPD_MAX_NAME];
148 /* Second option/choice (blank for all) */
149 } ppd_const_t;
150
151 typedef struct /**** Page Sizes ****/
152 {
153 int marked; /* Page size selected? */
154 char name[PPD_MAX_NAME];
155 /* Media size option */
156 float width, /* Width of media in points */
157 length, /* Length of media in points */
158 left, /* Left printable margin in points */
159 bottom, /* Bottom printable margin in points */
160 right, /* Right printable margin in points */
161 top; /* Top printable margin in points */
162 } ppd_size_t;
163
164 typedef struct /**** Emulators ****/
165 {
166 char name[PPD_MAX_NAME],
167 /* Emulator name */
168 *start, /* Code to switch to this emulation */
169 *stop; /* Code to stop this emulation */
170 } ppd_emul_t;
171
172 typedef struct /**** sRGB Color Profiles ****/
173 {
174 char resolution[PPD_MAX_NAME],
175 /* Resolution or "-" */
176 media_type[PPD_MAX_NAME];
177 /* Media type of "-" */
178 float density, /* Ink density to use */
179 gamma, /* Gamma correction to use */
180 matrix[3][3]; /* Transform matrix */
181 } ppd_profile_t;
182
183 typedef struct /**** Files ****/
184 {
185 int language_level, /* Language level of device */
186 color_device, /* 1 = color device, 0 = grayscale */
187 variable_sizes, /* 1 = supports variable sizes, 0 = doesn't */
188 accurate_screens,/* 1 = supports accurate screens, 0 = not */
189 contone_only, /* 1 = continuous tone only, 0 = not */
190 landscape, /* -90 or 90 */
191 model_number, /* Device-specific model number */
192 manual_copies, /* 1 = Copies done manually, 0 = hardware */
193 throughput; /* Pages per minute */
194 ppd_cs_t colorspace; /* Default colorspace */
195 char *patches; /* Patch commands to be sent to printer */
196 int num_emulations; /* Number of emulations supported */
197 ppd_emul_t *emulations; /* Emulations and the code to invoke them */
198 char *jcl_begin, /* Start JCL commands */
199 *jcl_ps, /* Enter PostScript interpreter */
200 *jcl_end, /* End JCL commands */
201 *lang_encoding, /* Language encoding */
202 *lang_version, /* Language version (English, Spanish, etc.) */
203 *modelname, /* Model name (general) */
204 *ttrasterizer, /* Truetype rasterizer */
205 *manufacturer, /* Manufacturer name */
206 *product, /* Product name (from PS RIP/interpreter) */
207 *nickname, /* Nickname (specific) */
208 *shortnickname; /* Short version of nickname */
209 int num_groups; /* Number of UI groups */
210 ppd_group_t *groups; /* UI groups */
211 int num_sizes; /* Number of page sizes */
212 ppd_size_t *sizes; /* Page sizes */
213 float custom_min[2], /* Minimum variable page size */
214 custom_max[2], /* Maximum variable page size */
215 custom_margins[4];/* Margins around page */
216 int num_consts; /* Number of UI/Non-UI constraints */
217 ppd_const_t *consts; /* UI/Non-UI constraints */
218 int num_fonts; /* Number of pre-loaded fonts */
219 char **fonts; /* Pre-loaded fonts */
220 int num_profiles; /* Number of sRGB color profiles */
221 ppd_profile_t *profiles; /* sRGB color profiles */
222 int num_filters; /* Number of filters */
223 char **filters; /* Filter strings... */
224 int flip_duplex; /* 1 = Flip page for back sides */
225 } ppd_file_t;
226
227
228 /*
229 * Prototypes...
230 */
231
232 extern void ppdClose(ppd_file_t *ppd);
233 extern int ppdCollect(ppd_file_t *ppd, ppd_section_t section,
234 ppd_choice_t ***choices);
235 extern int ppdConflicts(ppd_file_t *ppd);
236 extern int ppdEmit(ppd_file_t *ppd, FILE *fp,
237 ppd_section_t section);
238 extern int ppdEmitFd(ppd_file_t *ppd, int fd,
239 ppd_section_t section);
240 extern int ppdEmitJCL(ppd_file_t *ppd, FILE *fp, int job_id,
241 const char *user, const char *title);
242 extern int ppdIsMarked(ppd_file_t *ppd, const char *keyword,
243 const char *option);
244 extern void ppdMarkDefaults(ppd_file_t *ppd);
245 extern int ppdMarkOption(ppd_file_t *ppd, const char *keyword,
246 const char *option);
247 extern ppd_choice_t *ppdFindChoice(ppd_option_t *o, const char *option);
248 extern ppd_choice_t *ppdFindMarkedChoice(ppd_file_t *ppd, const char *keyword);
249 extern ppd_option_t *ppdFindOption(ppd_file_t *ppd, const char *keyword);
250 extern ppd_file_t *ppdOpen(FILE *fp);
251 extern ppd_file_t *ppdOpenFd(int fd);
252 extern ppd_file_t *ppdOpenFile(const char *filename);
253 extern float ppdPageLength(ppd_file_t *ppd, const char *name);
254 extern ppd_size_t *ppdPageSize(ppd_file_t *ppd, const char *name);
255 extern float ppdPageWidth(ppd_file_t *ppd, const char *name);
256
257 /*
258 * C++ magic...
259 */
260
261 # ifdef __cplusplus
262 }
263 # endif /* __cplusplus */
264 #endif /* !_CUPS_PPD_H_ */
265
266 /*
267 * End of "$Id: ppd.h,v 1.25 2002/01/02 17:58:40 mike Exp $".
268 */