2 * "$Id: ppd.h,v 1.38 2004/06/29 03:44:52 mike Exp $"
4 * PostScript Printer Description definitions for the Common UNIX Printing
7 * Copyright 1997-2004 by Easy Software Products, all rights reserved.
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
16 * Attn: CUPS Licensing Information
17 * Easy Software Products
18 * 44141 Airport View Drive, Suite 204
19 * Hollywood, Maryland 20636-3142 USA
21 * Voice: (301) 373-9600
22 * EMail: cups-info@cups.org
23 * WWW: http://www.cups.org
25 * PostScript is a trademark of Adobe Systems, Inc.
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
34 * This file is subject to the Apple OS-Developed Software exception.
41 * Include necessary headers...
53 # endif /* __cplusplus */
60 # define PPD_VERSION 4.3 /* Kept in sync with Adobe version number */
64 * PPD size limits (defined in Adobe spec)
67 # define PPD_MAX_NAME 41 /* Maximum size of name + 1 for nul */
68 # define PPD_MAX_TEXT 81 /* Maximum size of text + 1 for nul */
69 # define PPD_MAX_LINE 256 /* Maximum size of line + 1 for nul */
73 * Types and structures...
76 typedef enum /**** UI Types ****/
78 PPD_UI_BOOLEAN
, /* True or False option */
79 PPD_UI_PICKONE
, /* Pick one from a list */
80 PPD_UI_PICKMANY
/* Pick zero or more from a list */
83 typedef enum /**** Order dependency sections ****/
85 PPD_ORDER_ANY
, /* Option code can be anywhere in the file */
86 PPD_ORDER_DOCUMENT
, /* ... must be in the DocumentSetup section */
87 PPD_ORDER_EXIT
, /* ... must be sent prior to the document */
88 PPD_ORDER_JCL
, /* ... must be sent as a JCL command */
89 PPD_ORDER_PAGE
, /* ... must be in the PageSetup section */
90 PPD_ORDER_PROLOG
/* ... must be in the Prolog section */
93 typedef enum /**** Colorspaces ****/
95 PPD_CS_CMYK
= -4, /* CMYK colorspace */
96 PPD_CS_CMY
, /* CMY colorspace */
97 PPD_CS_GRAY
= 1, /* Grayscale colorspace */
98 PPD_CS_RGB
= 3, /* RGB colorspace */
99 PPD_CS_RGBK
, /* RGBK (K = gray) colorspace */
100 PPD_CS_N
/* DeviceN colorspace */
103 typedef enum /**** Status Codes ****/
106 PPD_FILE_OPEN_ERROR
, /* Unable to open PPD file */
107 PPD_NULL_FILE
, /* NULL PPD file pointer */
108 PPD_ALLOC_ERROR
, /* Memory allocation error */
109 PPD_MISSING_PPDADOBE4
, /* Missing PPD-Adobe-4.x header */
110 PPD_MISSING_VALUE
, /* Missing value string */
111 PPD_INTERNAL_ERROR
, /* Internal error */
112 PPD_BAD_OPEN_GROUP
, /* Bad OpenGroup */
113 PPD_NESTED_OPEN_GROUP
, /* OpenGroup without a CloseGroup first */
114 PPD_BAD_OPEN_UI
, /* Bad OpenUI/JCLOpenUI */
115 PPD_NESTED_OPEN_UI
, /* OpenUI/JCLOpenUI without a CloseUI/JCLCloseUI first */
116 PPD_BAD_ORDER_DEPENDENCY
, /* Bad OrderDependency */
117 PPD_BAD_UI_CONSTRAINTS
, /* Bad UIConstraints */
118 PPD_MISSING_ASTERISK
, /* Missing asterisk in column 0 */
119 PPD_LINE_TOO_LONG
, /* Line longer than 255 chars */
120 PPD_ILLEGAL_CHARACTER
, /* Illegal control character */
121 PPD_ILLEGAL_MAIN_KEYWORD
, /* Illegal main keyword string */
122 PPD_ILLEGAL_OPTION_KEYWORD
, /* Illegal option keyword string */
123 PPD_ILLEGAL_TRANSLATION
, /* Illegal translation string */
124 PPD_ILLEGAL_WHITESPACE
/* Illegal whitespace character */
127 typedef enum /**** Conformance Levels ****/
129 PPD_CONFORM_RELAXED
, /* Relax whitespace and control char */
130 PPD_CONFORM_STRICT
/* Require strict conformance */
133 typedef struct /**** PPD Attribute Structure ****/
135 char name
[PPD_MAX_NAME
],
136 /* Name of attribute (cupsXYZ) */
138 /* Specifier string, if any */
140 /* Human-readable text, if any */
141 *value
; /* Value string */
144 typedef struct /**** Option choices ****/
146 char marked
, /* 0 if not selected, 1 otherwise */
147 choice
[PPD_MAX_NAME
],
148 /* Computer-readable option name */
150 /* Human-readable option name */
151 *code
; /* Code to send for this option */
152 void *option
; /* Pointer to parent option structure */
155 typedef struct /**** Options ****/
157 char conflicted
, /* 0 if no conflicts exist, 1 otherwise */
158 keyword
[PPD_MAX_NAME
],
159 /* Option keyword name ("PageSize", etc.) */
160 defchoice
[PPD_MAX_NAME
],
161 /* Default option choice */
163 /* Human-readable text */
164 ppd_ui_t ui
; /* Type of UI option */
165 ppd_section_t section
; /* Section for command */
166 float order
; /* Order number */
167 int num_choices
; /* Number of option choices */
168 ppd_choice_t
*choices
; /* Option choices */
171 typedef struct ppd_group_str
/**** Groups ****/
173 /**** Group text strings are limited to 39 chars + nul in order to
174 **** preserve binary compatibility and allow applications to get
175 **** the group's keyword name.
177 char text
[PPD_MAX_TEXT
- PPD_MAX_NAME
],
178 /* Human-readable group name */
181 int num_options
; /* Number of options */
182 ppd_option_t
*options
; /* Options */
183 int num_subgroups
; /* Number of sub-groups */
184 struct ppd_group_str
*subgroups
;
185 /* Sub-groups (max depth = 1) */
188 typedef struct /**** Constraints ****/
190 char option1
[PPD_MAX_NAME
],
192 choice1
[PPD_MAX_NAME
],
193 /* First option/choice (blank for all) */
194 option2
[PPD_MAX_NAME
],
196 choice2
[PPD_MAX_NAME
];
197 /* Second option/choice (blank for all) */
200 typedef struct /**** Page Sizes ****/
202 int marked
; /* Page size selected? */
203 char name
[PPD_MAX_NAME
];
204 /* Media size option */
205 float width
, /* Width of media in points */
206 length
, /* Length of media in points */
207 left
, /* Left printable margin in points */
208 bottom
, /* Bottom printable margin in points */
209 right
, /* Right printable margin in points */
210 top
; /* Top printable margin in points */
213 typedef struct /**** Emulators ****/
215 char name
[PPD_MAX_NAME
],
217 *start
, /* Code to switch to this emulation */
218 *stop
; /* Code to stop this emulation */
221 typedef struct /**** sRGB Color Profiles ****/
223 char resolution
[PPD_MAX_NAME
],
224 /* Resolution or "-" */
225 media_type
[PPD_MAX_NAME
];
226 /* Media type of "-" */
227 float density
, /* Ink density to use */
228 gamma
, /* Gamma correction to use */
229 matrix
[3][3]; /* Transform matrix */
232 typedef struct /**** Files ****/
234 int language_level
, /* Language level of device */
235 color_device
, /* 1 = color device, 0 = grayscale */
236 variable_sizes
, /* 1 = supports variable sizes, 0 = doesn't */
237 accurate_screens
,/* 1 = supports accurate screens, 0 = not */
238 contone_only
, /* 1 = continuous tone only, 0 = not */
239 landscape
, /* -90 or 90 */
240 model_number
, /* Device-specific model number */
241 manual_copies
, /* 1 = Copies done manually, 0 = hardware */
242 throughput
; /* Pages per minute */
243 ppd_cs_t colorspace
; /* Default colorspace */
244 char *patches
; /* Patch commands to be sent to printer */
245 int num_emulations
; /* Number of emulations supported */
246 ppd_emul_t
*emulations
; /* Emulations and the code to invoke them */
247 char *jcl_begin
, /* Start JCL commands */
248 *jcl_ps
, /* Enter PostScript interpreter */
249 *jcl_end
, /* End JCL commands */
250 *lang_encoding
, /* Language encoding */
251 *lang_version
, /* Language version (English, Spanish, etc.) */
252 *modelname
, /* Model name (general) */
253 *ttrasterizer
, /* Truetype rasterizer */
254 *manufacturer
, /* Manufacturer name */
255 *product
, /* Product name (from PS RIP/interpreter) */
256 *nickname
, /* Nickname (specific) */
257 *shortnickname
; /* Short version of nickname */
258 int num_groups
; /* Number of UI groups */
259 ppd_group_t
*groups
; /* UI groups */
260 int num_sizes
; /* Number of page sizes */
261 ppd_size_t
*sizes
; /* Page sizes */
262 float custom_min
[2], /* Minimum variable page size */
263 custom_max
[2], /* Maximum variable page size */
264 custom_margins
[4];/* Margins around page */
265 int num_consts
; /* Number of UI/Non-UI constraints */
266 ppd_const_t
*consts
; /* UI/Non-UI constraints */
267 int num_fonts
; /* Number of pre-loaded fonts */
268 char **fonts
; /* Pre-loaded fonts */
269 int num_profiles
; /* Number of sRGB color profiles */
270 ppd_profile_t
*profiles
; /* sRGB color profiles */
271 int num_filters
; /* Number of filters */
272 char **filters
; /* Filter strings... */
274 /**** New in CUPS 1.1 ****/
275 int flip_duplex
; /* 1 = Flip page for back sides */
277 /**** New in CUPS 1.1.19 ****/
278 char *protocols
, /* Protocols (BCP, TBCP) string */
279 *pcfilename
; /* PCFileName string */
280 int num_attrs
, /* Number of attributes */
281 cur_attr
; /* Current attribute */
282 ppd_attr_t
**attrs
; /* Attributes */
290 extern void ppdClose(ppd_file_t
*ppd
);
291 extern int ppdCollect(ppd_file_t
*ppd
, ppd_section_t section
,
292 ppd_choice_t
***choices
);
293 extern int ppdConflicts(ppd_file_t
*ppd
);
294 extern int ppdEmit(ppd_file_t
*ppd
, FILE *fp
,
295 ppd_section_t section
);
296 extern int ppdEmitFd(ppd_file_t
*ppd
, int fd
,
297 ppd_section_t section
);
298 extern int ppdEmitJCL(ppd_file_t
*ppd
, FILE *fp
, int job_id
,
299 const char *user
, const char *title
);
300 extern ppd_choice_t
*ppdFindChoice(ppd_option_t
*o
, const char *option
);
301 extern ppd_choice_t
*ppdFindMarkedChoice(ppd_file_t
*ppd
, const char *keyword
);
302 extern ppd_option_t
*ppdFindOption(ppd_file_t
*ppd
, const char *keyword
);
303 extern int ppdIsMarked(ppd_file_t
*ppd
, const char *keyword
,
305 extern void ppdMarkDefaults(ppd_file_t
*ppd
);
306 extern int ppdMarkOption(ppd_file_t
*ppd
, const char *keyword
,
308 extern ppd_file_t
*ppdOpen(FILE *fp
);
309 extern ppd_file_t
*ppdOpenFd(int fd
);
310 extern ppd_file_t
*ppdOpenFile(const char *filename
);
311 extern float ppdPageLength(ppd_file_t
*ppd
, const char *name
);
312 extern ppd_size_t
*ppdPageSize(ppd_file_t
*ppd
, const char *name
);
313 extern float ppdPageWidth(ppd_file_t
*ppd
, const char *name
);
315 /**** New in CUPS 1.1.19 ****/
316 extern const char *ppdErrorString(ppd_status_t status
);
317 extern ppd_attr_t
*ppdFindAttr(ppd_file_t
*ppd
, const char *name
,
319 extern ppd_attr_t
*ppdFindNextAttr(ppd_file_t
*ppd
, const char *name
,
321 extern ppd_status_t
ppdLastError(int *line
);
323 /**** New in CUPS 1.1.20 ****/
324 extern void ppdSetConformance(ppd_conform_t c
);
333 # endif /* __cplusplus */
334 #endif /* !_CUPS_PPD_H_ */
337 * End of "$Id: ppd.h,v 1.38 2004/06/29 03:44:52 mike Exp $".