2 * "$Id: ppd.h 5238 2006-03-07 04:41:42Z mike $"
4 * PostScript Printer Description definitions for the Common UNIX Printing
7 * Copyright 1997-2006 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 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...
55 # endif /* __cplusplus */
62 # define PPD_VERSION 4.3 /* Kept in sync with Adobe version number */
66 * PPD size limits (defined in Adobe spec)
69 # define PPD_MAX_NAME 41 /* Maximum size of name + 1 for nul */
70 # define PPD_MAX_TEXT 81 /* Maximum size of text + 1 for nul */
71 # define PPD_MAX_LINE 256 /* Maximum size of line + 1 for nul */
75 * Types and structures...
78 typedef enum ppd_ui_e
/**** UI Types ****/
80 PPD_UI_BOOLEAN
, /* True or False option */
81 PPD_UI_PICKONE
, /* Pick one from a list */
82 PPD_UI_PICKMANY
/* Pick zero or more from a list */
85 typedef enum ppd_section_e
/**** Order dependency sections ****/
87 PPD_ORDER_ANY
, /* Option code can be anywhere in the file */
88 PPD_ORDER_DOCUMENT
, /* ... must be in the DocumentSetup section */
89 PPD_ORDER_EXIT
, /* ... must be sent prior to the document */
90 PPD_ORDER_JCL
, /* ... must be sent as a JCL command */
91 PPD_ORDER_PAGE
, /* ... must be in the PageSetup section */
92 PPD_ORDER_PROLOG
/* ... must be in the Prolog section */
95 typedef enum ppd_cs_e
/**** Colorspaces ****/
97 PPD_CS_CMYK
= -4, /* CMYK colorspace */
98 PPD_CS_CMY
, /* CMY colorspace */
99 PPD_CS_GRAY
= 1, /* Grayscale colorspace */
100 PPD_CS_RGB
= 3, /* RGB colorspace */
101 PPD_CS_RGBK
, /* RGBK (K = gray) colorspace */
102 PPD_CS_N
/* DeviceN colorspace */
105 typedef enum ppd_status_e
/**** Status Codes @since CUPS 1.1.19@ ****/
108 PPD_FILE_OPEN_ERROR
, /* Unable to open PPD file */
109 PPD_NULL_FILE
, /* NULL PPD file pointer */
110 PPD_ALLOC_ERROR
, /* Memory allocation error */
111 PPD_MISSING_PPDADOBE4
, /* Missing PPD-Adobe-4.x header */
112 PPD_MISSING_VALUE
, /* Missing value string */
113 PPD_INTERNAL_ERROR
, /* Internal error */
114 PPD_BAD_OPEN_GROUP
, /* Bad OpenGroup */
115 PPD_NESTED_OPEN_GROUP
, /* OpenGroup without a CloseGroup first */
116 PPD_BAD_OPEN_UI
, /* Bad OpenUI/JCLOpenUI */
117 PPD_NESTED_OPEN_UI
, /* OpenUI/JCLOpenUI without a CloseUI/JCLCloseUI first */
118 PPD_BAD_ORDER_DEPENDENCY
, /* Bad OrderDependency */
119 PPD_BAD_UI_CONSTRAINTS
, /* Bad UIConstraints */
120 PPD_MISSING_ASTERISK
, /* Missing asterisk in column 0 */
121 PPD_LINE_TOO_LONG
, /* Line longer than 255 chars */
122 PPD_ILLEGAL_CHARACTER
, /* Illegal control character */
123 PPD_ILLEGAL_MAIN_KEYWORD
, /* Illegal main keyword string */
124 PPD_ILLEGAL_OPTION_KEYWORD
, /* Illegal option keyword string */
125 PPD_ILLEGAL_TRANSLATION
, /* Illegal translation string */
126 PPD_ILLEGAL_WHITESPACE
, /* Illegal whitespace character */
127 PPD_BAD_CUSTOM_PARAM
/* Bad custom parameter */
130 typedef enum ppd_conform_e
/**** Conformance Levels @since CUPS 1.1.19@ ****/
132 PPD_CONFORM_RELAXED
, /* Relax whitespace and control char */
133 PPD_CONFORM_STRICT
/* Require strict conformance */
136 typedef struct ppd_attr_s
/**** PPD Attribute Structure @since CUPS 1.1.19@ ****/
138 char name
[PPD_MAX_NAME
]; /* Name of attribute (cupsXYZ) */
139 char spec
[PPD_MAX_NAME
]; /* Specifier string, if any */
140 char text
[PPD_MAX_TEXT
]; /* Human-readable text, if any */
141 char *value
; /* Value string */
144 typedef struct ppd_option_s ppd_option_t
;
147 typedef struct ppd_choice_s
/**** Option choices ****/
149 char marked
; /* 0 if not selected, 1 otherwise */
150 char choice
[PPD_MAX_NAME
]; /* Computer-readable option name */
151 char text
[PPD_MAX_TEXT
]; /* Human-readable option name */
152 char *code
; /* Code to send for this option */
153 ppd_option_t
*option
; /* Pointer to parent option structure */
156 struct ppd_option_s
/**** Options ****/
158 char conflicted
; /* 0 if no conflicts exist, 1 otherwise */
159 char keyword
[PPD_MAX_NAME
]; /* Option keyword name ("PageSize", etc.) */
160 char defchoice
[PPD_MAX_NAME
];/* Default option choice */
161 char text
[PPD_MAX_TEXT
]; /* Human-readable text */
162 ppd_ui_t ui
; /* Type of UI option */
163 ppd_section_t section
; /* Section for command */
164 float order
; /* Order number */
165 int num_choices
; /* Number of option choices */
166 ppd_choice_t
*choices
; /* Option choices */
169 typedef struct ppd_group_s
/**** Groups ****/
171 /**** Group text strings are limited to 39 chars + nul in order to
172 **** preserve binary compatibility and allow applications to get
173 **** the group's keyword name.
175 char text
[PPD_MAX_TEXT
- PPD_MAX_NAME
];
176 /* Human-readable group name */
177 char name
[PPD_MAX_NAME
]; /* Group name @since CUPS 1.1.18@ */
178 int num_options
; /* Number of options */
179 ppd_option_t
*options
; /* Options */
180 int num_subgroups
; /* Number of sub-groups */
181 struct ppd_group_s
*subgroups
; /* Sub-groups (max depth = 1) */
184 typedef struct /**** Constraints ****/
186 char option1
[PPD_MAX_NAME
]; /* First keyword */
187 char choice1
[PPD_MAX_NAME
]; /* First option/choice (blank for all) */
188 char option2
[PPD_MAX_NAME
]; /* Second keyword */
189 char choice2
[PPD_MAX_NAME
]; /* Second option/choice (blank for all) */
192 typedef struct ppd_size_s
/**** Page Sizes ****/
194 int marked
; /* Page size selected? */
195 char name
[PPD_MAX_NAME
]; /* Media size option */
196 float width
; /* Width of media in points */
197 float length
; /* Length of media in points */
198 float left
; /* Left printable margin in points */
199 float bottom
; /* Bottom printable margin in points */
200 float right
; /* Right printable margin in points */
201 float top
; /* Top printable margin in points */
204 typedef struct ppd_emul_s
/**** Emulators ****/
206 char name
[PPD_MAX_NAME
]; /* Emulator name */
207 char *start
; /* Code to switch to this emulation */
208 char *stop
; /* Code to stop this emulation */
211 typedef struct ppd_profile_s
/**** sRGB Color Profiles ****/
213 char resolution
[PPD_MAX_NAME
];
214 /* Resolution or "-" */
215 char media_type
[PPD_MAX_NAME
];
216 /* Media type or "-" */
217 float density
; /* Ink density to use */
218 float gamma
; /* Gamma correction to use */
219 float matrix
[3][3]; /* Transform matrix */
222 /**** New in CUPS 1.2 ****/
223 typedef enum ppd_cptype_e
/**** Custom Parameter Type @since CUPS 1.2@ ****/
225 PPD_CUSTOM_CURVE
, /* Curve value for f(x) = x^value */
226 PPD_CUSTOM_INT
, /* Integer number value */
227 PPD_CUSTOM_INVCURVE
, /* Curve value for f(x) = x^(1/value) */
228 PPD_CUSTOM_PASSCODE
, /* String of (hidden) numbers */
229 PPD_CUSTOM_PASSWORD
, /* String of (hidden) characters */
230 PPD_CUSTOM_POINTS
, /* Measurement value in points */
231 PPD_CUSTOM_REAL
, /* Real number value */
232 PPD_CUSTOM_STRING
/* String of characters */
235 typedef union ppd_cplimit_u
/**** Custom Parameter Limit @since CUPS 1.2@ ****/
237 float custom_curve
; /* Gamma value */
238 int custom_int
; /* Integer value */
239 float custom_invcurve
; /* Gamma value */
240 int custom_passcode
; /* Passcode length */
241 int custom_password
; /* Password length */
242 float custom_points
; /* Measurement value */
243 float custom_real
; /* Real value */
244 int custom_string
; /* String length */
247 typedef union ppd_cpvalue_u
/**** Custom Parameter Value @since CUPS 1.2@ ****/
249 float custom_curve
; /* Gamma value */
250 int custom_int
; /* Integer value */
251 float custom_invcurve
; /* Gamma value */
252 char *custom_passcode
; /* Passcode value */
253 char *custom_password
; /* Password value */
254 float custom_points
; /* Measurement value */
255 float custom_real
; /* Real value */
256 char *custom_string
; /* String value */
259 typedef struct ppd_cparam_s
/**** Custom Parameter @since CUPS 1.2@ ****/
261 char name
[PPD_MAX_NAME
]; /* Parameter name */
262 char text
[PPD_MAX_TEXT
]; /* Human-readable text */
263 int order
; /* Order (0 to N) */
264 ppd_cptype_t type
; /* Parameter type */
265 ppd_cplimit_t minimum
, /* Minimum value */
266 maximum
; /* Maximum value */
267 ppd_cpvalue_t current
; /* Current value */
270 typedef struct ppd_coption_s
/**** Custom Option @since CUPS 1.2@ ****/
272 char keyword
[PPD_MAX_NAME
]; /* Name of option that is being extended... */
273 ppd_option_t
*option
; /* Option that is being extended... */
274 int marked
; /* Extended option is marked */
275 cups_array_t
*params
; /* Parameters */
278 typedef struct ppd_file_s
/**** PPD File ****/
280 int language_level
; /* Language level of device */
281 int color_device
; /* 1 = color device, 0 = grayscale */
282 int variable_sizes
; /* 1 = supports variable sizes, 0 = doesn't */
283 int accurate_screens
; /* 1 = supports accurate screens, 0 = not */
284 int contone_only
; /* 1 = continuous tone only, 0 = not */
285 int landscape
; /* -90 or 90 */
286 int model_number
; /* Device-specific model number */
287 int manual_copies
; /* 1 = Copies done manually, 0 = hardware */
288 int throughput
; /* Pages per minute */
289 ppd_cs_t colorspace
; /* Default colorspace */
290 char *patches
; /* Patch commands to be sent to printer */
291 int num_emulations
; /* Number of emulations supported */
292 ppd_emul_t
*emulations
; /* Emulations and the code to invoke them */
293 char *jcl_begin
; /* Start JCL commands */
294 char *jcl_ps
; /* Enter PostScript interpreter */
295 char *jcl_end
; /* End JCL commands */
296 char *lang_encoding
; /* Language encoding */
297 char *lang_version
; /* Language version (English, Spanish, etc.) */
298 char *modelname
; /* Model name (general) */
299 char *ttrasterizer
; /* Truetype rasterizer */
300 char *manufacturer
; /* Manufacturer name */
301 char *product
; /* Product name (from PS RIP/interpreter) */
302 char *nickname
; /* Nickname (specific) */
303 char *shortnickname
; /* Short version of nickname */
304 int num_groups
; /* Number of UI groups */
305 ppd_group_t
*groups
; /* UI groups */
306 int num_sizes
; /* Number of page sizes */
307 ppd_size_t
*sizes
; /* Page sizes */
308 float custom_min
[2]; /* Minimum variable page size */
309 float custom_max
[2]; /* Maximum variable page size */
310 float custom_margins
[4]; /* Margins around page */
311 int num_consts
; /* Number of UI/Non-UI constraints */
312 ppd_const_t
*consts
; /* UI/Non-UI constraints */
313 int num_fonts
; /* Number of pre-loaded fonts */
314 char **fonts
; /* Pre-loaded fonts */
315 int num_profiles
; /* Number of sRGB color profiles */
316 ppd_profile_t
*profiles
; /* sRGB color profiles */
317 int num_filters
; /* Number of filters */
318 char **filters
; /* Filter strings... */
320 /**** New in CUPS 1.1 ****/
321 int flip_duplex
; /* 1 = Flip page for back sides @since CUPS 1.1@ */
323 /**** New in CUPS 1.1.19 ****/
324 char *protocols
; /* Protocols (BCP, TBCP) string @since CUPS 1.1.19@ */
325 char *pcfilename
; /* PCFileName string @since CUPS 1.1.19@ */
326 int num_attrs
; /* Number of attributes @since CUPS 1.1.19@ @private@ */
327 int cur_attr
; /* Current attribute @since CUPS 1.1.19@ @private@ */
328 ppd_attr_t
**attrs
; /* Attributes @since CUPS 1.1.19@ @private@ */
330 /**** New in CUPS 1.2 ****/
331 cups_array_t
*sorted_attrs
; /* Attribute lookup array @since CUPS 1.2@ @private@ */
332 cups_array_t
*options
; /* Option lookup array @since CUPS 1.2@ @private@ */
333 cups_array_t
*coptions
; /* Custom options array @since CUPS 1.2@ @private@ */
341 extern void ppdClose(ppd_file_t
*ppd
);
342 extern int ppdCollect(ppd_file_t
*ppd
, ppd_section_t section
,
343 ppd_choice_t
***choices
);
344 extern int ppdConflicts(ppd_file_t
*ppd
);
345 extern int ppdEmit(ppd_file_t
*ppd
, FILE *fp
,
346 ppd_section_t section
);
347 extern int ppdEmitFd(ppd_file_t
*ppd
, int fd
,
348 ppd_section_t section
);
349 extern int ppdEmitJCL(ppd_file_t
*ppd
, FILE *fp
, int job_id
,
350 const char *user
, const char *title
);
351 extern ppd_choice_t
*ppdFindChoice(ppd_option_t
*o
, const char *option
);
352 extern ppd_choice_t
*ppdFindMarkedChoice(ppd_file_t
*ppd
, const char *keyword
);
353 extern ppd_option_t
*ppdFindOption(ppd_file_t
*ppd
, const char *keyword
);
354 extern int ppdIsMarked(ppd_file_t
*ppd
, const char *keyword
,
356 extern void ppdMarkDefaults(ppd_file_t
*ppd
);
357 extern int ppdMarkOption(ppd_file_t
*ppd
, const char *keyword
,
359 extern ppd_file_t
*ppdOpen(FILE *fp
);
360 extern ppd_file_t
*ppdOpenFd(int fd
);
361 extern ppd_file_t
*ppdOpenFile(const char *filename
);
362 extern float ppdPageLength(ppd_file_t
*ppd
, const char *name
);
363 extern ppd_size_t
*ppdPageSize(ppd_file_t
*ppd
, const char *name
);
364 extern float ppdPageWidth(ppd_file_t
*ppd
, const char *name
);
366 /**** New in CUPS 1.1.19 ****/
367 extern const char *ppdErrorString(ppd_status_t status
);
368 extern ppd_attr_t
*ppdFindAttr(ppd_file_t
*ppd
, const char *name
,
370 extern ppd_attr_t
*ppdFindNextAttr(ppd_file_t
*ppd
, const char *name
,
372 extern ppd_status_t
ppdLastError(int *line
);
374 /**** New in CUPS 1.1.20 ****/
375 extern void ppdSetConformance(ppd_conform_t c
);
377 /**** New in CUPS 1.2 ****/
378 extern int ppdCollect2(ppd_file_t
*ppd
, ppd_section_t section
,
379 float min_order
, ppd_choice_t
***choices
);
380 extern int ppdEmitAfterOrder(ppd_file_t
*ppd
, FILE *fp
,
381 ppd_section_t section
, int limit
,
383 extern int ppdEmitJCLEnd(ppd_file_t
*ppd
, FILE *fp
);
384 extern char *ppdEmitString(ppd_file_t
*ppd
, ppd_section_t section
,
386 extern ppd_coption_t
*ppdFindCustomOption(ppd_file_t
*ppd
,
387 const char *keyword
);
388 extern ppd_cparam_t
*ppdFindCustomParam(ppd_coption_t
*opt
,
390 extern ppd_cparam_t
*ppdFirstCustomParam(ppd_coption_t
*opt
);
391 extern ppd_option_t
*ppdFirstOption(ppd_file_t
*ppd
);
392 extern ppd_cparam_t
*ppdNextCustomParam(ppd_coption_t
*opt
);
393 extern ppd_option_t
*ppdNextOption(ppd_file_t
*ppd
);
394 extern int ppdLocalize(ppd_file_t
*ppd
);
395 extern ppd_file_t
*ppdOpen2(cups_file_t
*fp
);
404 # endif /* __cplusplus */
405 #endif /* !_CUPS_PPD_H_ */
408 * End of "$Id: ppd.h 5238 2006-03-07 04:41:42Z mike $".