2 * "$Id: ppd.h 7791 2008-07-24 00:55:30Z mike $"
4 * PostScript Printer Description definitions for CUPS.
6 * Copyright 2007-2010 by Apple Inc.
7 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
9 * These coded instructions, statements, and computer programs are the
10 * property of Apple Inc. and are protected by Federal copyright
11 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
12 * which should have been included with this file. If this file is
13 * file is missing or damaged, see the license at "http://www.cups.org/".
15 * PostScript is a trademark of Adobe Systems, Inc.
17 * This code and any derivative of it may be used and distributed
18 * freely under the terms of the GNU General Public License when
19 * used with GNU Ghostscript or its derivatives. Use of the code
20 * (or any derivative of it) with software other than GNU
21 * GhostScript (or its derivatives) is governed by the CUPS license
24 * This file is subject to the Apple OS-Developed Software exception.
31 * Include necessary headers...
46 # endif /* __cplusplus */
53 # define PPD_VERSION 4.3 /* Kept in sync with Adobe version number */
57 * PPD size limits (defined in Adobe spec)
60 # define PPD_MAX_NAME 41 /* Maximum size of name + 1 for nul */
61 # define PPD_MAX_TEXT 81 /* Maximum size of text + 1 for nul */
62 # define PPD_MAX_LINE 256 /* Maximum size of line + 1 for nul */
66 * Types and structures...
69 typedef enum ppd_ui_e
/**** UI Types ****/
71 PPD_UI_BOOLEAN
, /* True or False option */
72 PPD_UI_PICKONE
, /* Pick one from a list */
73 PPD_UI_PICKMANY
/* Pick zero or more from a list */
76 typedef enum ppd_section_e
/**** Order dependency sections ****/
78 PPD_ORDER_ANY
, /* Option code can be anywhere in the file */
79 PPD_ORDER_DOCUMENT
, /* ... must be in the DocumentSetup section */
80 PPD_ORDER_EXIT
, /* ... must be sent prior to the document */
81 PPD_ORDER_JCL
, /* ... must be sent as a JCL command */
82 PPD_ORDER_PAGE
, /* ... must be in the PageSetup section */
83 PPD_ORDER_PROLOG
/* ... must be in the Prolog section */
86 typedef enum ppd_cs_e
/**** Colorspaces ****/
88 PPD_CS_CMYK
= -4, /* CMYK colorspace */
89 PPD_CS_CMY
, /* CMY colorspace */
90 PPD_CS_GRAY
= 1, /* Grayscale colorspace */
91 PPD_CS_RGB
= 3, /* RGB colorspace */
92 PPD_CS_RGBK
, /* RGBK (K = gray) colorspace */
93 PPD_CS_N
/* DeviceN colorspace */
96 typedef enum ppd_status_e
/**** Status Codes @since CUPS 1.1.19/Mac OS X 10.3@ ****/
99 PPD_FILE_OPEN_ERROR
, /* Unable to open PPD file */
100 PPD_NULL_FILE
, /* NULL PPD file pointer */
101 PPD_ALLOC_ERROR
, /* Memory allocation error */
102 PPD_MISSING_PPDADOBE4
, /* Missing PPD-Adobe-4.x header */
103 PPD_MISSING_VALUE
, /* Missing value string */
104 PPD_INTERNAL_ERROR
, /* Internal error */
105 PPD_BAD_OPEN_GROUP
, /* Bad OpenGroup */
106 PPD_NESTED_OPEN_GROUP
, /* OpenGroup without a CloseGroup first */
107 PPD_BAD_OPEN_UI
, /* Bad OpenUI/JCLOpenUI */
108 PPD_NESTED_OPEN_UI
, /* OpenUI/JCLOpenUI without a CloseUI/JCLCloseUI first */
109 PPD_BAD_ORDER_DEPENDENCY
, /* Bad OrderDependency */
110 PPD_BAD_UI_CONSTRAINTS
, /* Bad UIConstraints */
111 PPD_MISSING_ASTERISK
, /* Missing asterisk in column 0 */
112 PPD_LINE_TOO_LONG
, /* Line longer than 255 chars */
113 PPD_ILLEGAL_CHARACTER
, /* Illegal control character */
114 PPD_ILLEGAL_MAIN_KEYWORD
, /* Illegal main keyword string */
115 PPD_ILLEGAL_OPTION_KEYWORD
, /* Illegal option keyword string */
116 PPD_ILLEGAL_TRANSLATION
, /* Illegal translation string */
117 PPD_ILLEGAL_WHITESPACE
, /* Illegal whitespace character */
118 PPD_BAD_CUSTOM_PARAM
, /* Bad custom parameter */
119 PPD_MISSING_OPTION_KEYWORD
, /* Missing option keyword */
120 PPD_BAD_VALUE
, /* Bad value string */
121 PPD_MAX_STATUS
/* @private@ */
124 enum ppd_conform_e
/**** Conformance Levels @since CUPS 1.1.19/Mac OS X 10.3@ ****/
126 PPD_CONFORM_RELAXED
, /* Relax whitespace and control char */
127 PPD_CONFORM_STRICT
/* Require strict conformance */
130 typedef enum ppd_conform_e ppd_conform_t
;
131 /**** Conformance Levels @since CUPS 1.1.19/Mac OS X 10.3@ ****/
133 typedef struct ppd_attr_s
/**** PPD Attribute Structure @since CUPS 1.1.19/Mac OS X 10.3@ ****/
135 char name
[PPD_MAX_NAME
]; /* Name of attribute (cupsXYZ) */
136 char spec
[PPD_MAX_NAME
]; /* Specifier string, if any */
137 char text
[PPD_MAX_TEXT
]; /* Human-readable text, if any */
138 char *value
; /* Value string */
141 typedef struct ppd_option_s ppd_option_t
;
144 typedef struct ppd_choice_s
/**** Option choices ****/
146 char marked
; /* 0 if not selected, 1 otherwise */
147 char choice
[PPD_MAX_NAME
]; /* Computer-readable option name */
148 char text
[PPD_MAX_TEXT
]; /* Human-readable option name */
149 char *code
; /* Code to send for this option */
150 ppd_option_t
*option
; /* Pointer to parent option structure */
153 struct ppd_option_s
/**** Options ****/
155 char conflicted
; /* 0 if no conflicts exist, 1 otherwise */
156 char keyword
[PPD_MAX_NAME
]; /* Option keyword name ("PageSize", etc.) */
157 char defchoice
[PPD_MAX_NAME
];/* Default option choice */
158 char text
[PPD_MAX_TEXT
]; /* Human-readable text */
159 ppd_ui_t ui
; /* Type of UI option */
160 ppd_section_t section
; /* Section for command */
161 float order
; /* Order number */
162 int num_choices
; /* Number of option choices */
163 ppd_choice_t
*choices
; /* Option choices */
166 typedef struct ppd_group_s
/**** Groups ****/
168 /**** Group text strings are limited to 39 chars + nul in order to
169 **** preserve binary compatibility and allow applications to get
170 **** the group's keyword name.
172 char text
[PPD_MAX_TEXT
- PPD_MAX_NAME
];
173 /* Human-readable group name */
174 char name
[PPD_MAX_NAME
]; /* Group name @since CUPS 1.1.18/Mac OS X 10.3@ */
175 int num_options
; /* Number of options */
176 ppd_option_t
*options
; /* Options */
177 int num_subgroups
; /* Number of sub-groups */
178 struct ppd_group_s
*subgroups
; /* Sub-groups (max depth = 1) */
181 typedef struct ppd_const_s
/**** Constraints ****/
183 char option1
[PPD_MAX_NAME
]; /* First keyword */
184 char choice1
[PPD_MAX_NAME
]; /* First option/choice (blank for all) */
185 char option2
[PPD_MAX_NAME
]; /* Second keyword */
186 char choice2
[PPD_MAX_NAME
]; /* Second option/choice (blank for all) */
189 typedef struct ppd_size_s
/**** Page Sizes ****/
191 int marked
; /* Page size selected? */
192 char name
[PPD_MAX_NAME
]; /* Media size option */
193 float width
; /* Width of media in points */
194 float length
; /* Length of media in points */
195 float left
; /* Left printable margin in points */
196 float bottom
; /* Bottom printable margin in points */
197 float right
; /* Right printable margin in points */
198 float top
; /* Top printable margin in points */
201 typedef struct ppd_emul_s
/**** Emulators ****/
203 char name
[PPD_MAX_NAME
]; /* Emulator name */
204 char *start
; /* Code to switch to this emulation */
205 char *stop
; /* Code to stop this emulation */
208 typedef struct ppd_profile_s
/**** sRGB Color Profiles ****/
210 char resolution
[PPD_MAX_NAME
];
211 /* Resolution or "-" */
212 char media_type
[PPD_MAX_NAME
];
213 /* Media type or "-" */
214 float density
; /* Ink density to use */
215 float gamma
; /* Gamma correction to use */
216 float matrix
[3][3]; /* Transform matrix */
219 /**** New in CUPS 1.2/Mac OS X 10.5 ****/
220 typedef enum ppd_cptype_e
/**** Custom Parameter Type @since CUPS 1.2/Mac OS X 10.5@ ****/
222 PPD_CUSTOM_CURVE
, /* Curve value for f(x) = x^value */
223 PPD_CUSTOM_INT
, /* Integer number value */
224 PPD_CUSTOM_INVCURVE
, /* Curve value for f(x) = x^(1/value) */
225 PPD_CUSTOM_PASSCODE
, /* String of (hidden) numbers */
226 PPD_CUSTOM_PASSWORD
, /* String of (hidden) characters */
227 PPD_CUSTOM_POINTS
, /* Measurement value in points */
228 PPD_CUSTOM_REAL
, /* Real number value */
229 PPD_CUSTOM_STRING
/* String of characters */
232 typedef union ppd_cplimit_u
/**** Custom Parameter Limit @since CUPS 1.2/Mac OS X 10.5@ ****/
234 float custom_curve
; /* Gamma value */
235 int custom_int
; /* Integer value */
236 float custom_invcurve
; /* Gamma value */
237 int custom_passcode
; /* Passcode length */
238 int custom_password
; /* Password length */
239 float custom_points
; /* Measurement value */
240 float custom_real
; /* Real value */
241 int custom_string
; /* String length */
244 typedef union ppd_cpvalue_u
/**** Custom Parameter Value @since CUPS 1.2/Mac OS X 10.5@ ****/
246 float custom_curve
; /* Gamma value */
247 int custom_int
; /* Integer value */
248 float custom_invcurve
; /* Gamma value */
249 char *custom_passcode
; /* Passcode value */
250 char *custom_password
; /* Password value */
251 float custom_points
; /* Measurement value */
252 float custom_real
; /* Real value */
253 char *custom_string
; /* String value */
256 typedef struct ppd_cparam_s
/**** Custom Parameter @since CUPS 1.2/Mac OS X 10.5@ ****/
258 char name
[PPD_MAX_NAME
]; /* Parameter name */
259 char text
[PPD_MAX_TEXT
]; /* Human-readable text */
260 int order
; /* Order (0 to N) */
261 ppd_cptype_t type
; /* Parameter type */
262 ppd_cplimit_t minimum
, /* Minimum value */
263 maximum
; /* Maximum value */
264 ppd_cpvalue_t current
; /* Current value */
267 typedef struct ppd_coption_s
/**** Custom Option @since CUPS 1.2/Mac OS X 10.5@ ****/
269 char keyword
[PPD_MAX_NAME
]; /* Name of option that is being extended... */
270 ppd_option_t
*option
; /* Option that is being extended... */
271 int marked
; /* Extended option is marked */
272 cups_array_t
*params
; /* Parameters */
275 typedef struct ppd_file_s
/**** PPD File ****/
277 int language_level
; /* Language level of device */
278 int color_device
; /* 1 = color device, 0 = grayscale */
279 int variable_sizes
; /* 1 = supports variable sizes, 0 = doesn't */
280 int accurate_screens
; /* 1 = supports accurate screens, 0 = not */
281 int contone_only
; /* 1 = continuous tone only, 0 = not */
282 int landscape
; /* -90 or 90 */
283 int model_number
; /* Device-specific model number */
284 int manual_copies
; /* 1 = Copies done manually, 0 = hardware */
285 int throughput
; /* Pages per minute */
286 ppd_cs_t colorspace
; /* Default colorspace */
287 char *patches
; /* Patch commands to be sent to printer */
288 int num_emulations
; /* Number of emulations supported */
289 ppd_emul_t
*emulations
; /* Emulations and the code to invoke them */
290 char *jcl_begin
; /* Start JCL commands */
291 char *jcl_ps
; /* Enter PostScript interpreter */
292 char *jcl_end
; /* End JCL commands */
293 char *lang_encoding
; /* Language encoding */
294 char *lang_version
; /* Language version (English, Spanish, etc.) */
295 char *modelname
; /* Model name (general) */
296 char *ttrasterizer
; /* Truetype rasterizer */
297 char *manufacturer
; /* Manufacturer name */
298 char *product
; /* Product name (from PS RIP/interpreter) */
299 char *nickname
; /* Nickname (specific) */
300 char *shortnickname
; /* Short version of nickname */
301 int num_groups
; /* Number of UI groups */
302 ppd_group_t
*groups
; /* UI groups */
303 int num_sizes
; /* Number of page sizes */
304 ppd_size_t
*sizes
; /* Page sizes */
305 float custom_min
[2]; /* Minimum variable page size */
306 float custom_max
[2]; /* Maximum variable page size */
307 float custom_margins
[4]; /* Margins around page */
308 int num_consts
; /* Number of UI/Non-UI constraints */
309 ppd_const_t
*consts
; /* UI/Non-UI constraints */
310 int num_fonts
; /* Number of pre-loaded fonts */
311 char **fonts
; /* Pre-loaded fonts */
312 int num_profiles
; /* Number of sRGB color profiles @deprecated@ */
313 ppd_profile_t
*profiles
; /* sRGB color profiles @deprecated@ */
314 int num_filters
; /* Number of filters */
315 char **filters
; /* Filter strings... */
317 /**** New in CUPS 1.1 ****/
318 int flip_duplex
; /* 1 = Flip page for back sides @deprecated@ */
320 /**** New in CUPS 1.1.19 ****/
321 char *protocols
; /* Protocols (BCP, TBCP) string @since CUPS 1.1.19/Mac OS X 10.3@ */
322 char *pcfilename
; /* PCFileName string @since CUPS 1.1.19/Mac OS X 10.3@ */
323 int num_attrs
; /* Number of attributes @since CUPS 1.1.19/Mac OS X 10.3@ @private@ */
324 int cur_attr
; /* Current attribute @since CUPS 1.1.19/Mac OS X 10.3@ @private@ */
325 ppd_attr_t
**attrs
; /* Attributes @since CUPS 1.1.19/Mac OS X 10.3@ @private@ */
327 /**** New in CUPS 1.2/Mac OS X 10.5 ****/
328 cups_array_t
*sorted_attrs
; /* Attribute lookup array @since CUPS 1.2/Mac OS X 10.5@ @private@ */
329 cups_array_t
*options
; /* Option lookup array @since CUPS 1.2/Mac OS X 10.5@ @private@ */
330 cups_array_t
*coptions
; /* Custom options array @since CUPS 1.2/Mac OS X 10.5@ @private@ */
332 /**** New in CUPS 1.3/Mac OS X 10.5 ****/
333 cups_array_t
*marked
; /* Marked choices @since CUPS 1.3/Mac OS X 10.5@ @private@ */
335 /**** New in CUPS 1.4/Mac OS X 10.6 ****/
336 cups_array_t
*cups_uiconstraints
; /* cupsUIConstraints @since CUPS 1.4/Mac OS X 10.6@ @private@ */
338 /**** New in CUPS 1.5 ****/
339 void *pwg
; /* PWG to/from PPD mappings */
347 extern int cupsMarkOptions(ppd_file_t
*ppd
, int num_options
,
348 cups_option_t
*options
);
349 extern void ppdClose(ppd_file_t
*ppd
);
350 extern int ppdCollect(ppd_file_t
*ppd
, ppd_section_t section
,
351 ppd_choice_t
***choices
);
352 extern int ppdConflicts(ppd_file_t
*ppd
);
353 extern int ppdEmit(ppd_file_t
*ppd
, FILE *fp
,
354 ppd_section_t section
);
355 extern int ppdEmitFd(ppd_file_t
*ppd
, int fd
,
356 ppd_section_t section
);
357 extern int ppdEmitJCL(ppd_file_t
*ppd
, FILE *fp
, int job_id
,
358 const char *user
, const char *title
);
359 extern ppd_choice_t
*ppdFindChoice(ppd_option_t
*o
, const char *option
);
360 extern ppd_choice_t
*ppdFindMarkedChoice(ppd_file_t
*ppd
, const char *keyword
);
361 extern ppd_option_t
*ppdFindOption(ppd_file_t
*ppd
, const char *keyword
);
362 extern int ppdIsMarked(ppd_file_t
*ppd
, const char *keyword
,
364 extern void ppdMarkDefaults(ppd_file_t
*ppd
);
365 extern int ppdMarkOption(ppd_file_t
*ppd
, const char *keyword
,
367 extern ppd_file_t
*ppdOpen(FILE *fp
);
368 extern ppd_file_t
*ppdOpenFd(int fd
);
369 extern ppd_file_t
*ppdOpenFile(const char *filename
);
370 extern float ppdPageLength(ppd_file_t
*ppd
, const char *name
);
371 extern ppd_size_t
*ppdPageSize(ppd_file_t
*ppd
, const char *name
);
372 extern float ppdPageWidth(ppd_file_t
*ppd
, const char *name
);
374 /**** New in CUPS 1.1.19 ****/
375 extern const char *ppdErrorString(ppd_status_t status
) _CUPS_API_1_1_19
;
376 extern ppd_attr_t
*ppdFindAttr(ppd_file_t
*ppd
, const char *name
,
377 const char *spec
) _CUPS_API_1_1_19
;
378 extern ppd_attr_t
*ppdFindNextAttr(ppd_file_t
*ppd
, const char *name
,
379 const char *spec
) _CUPS_API_1_1_19
;
380 extern ppd_status_t
ppdLastError(int *line
) _CUPS_API_1_1_19
;
382 /**** New in CUPS 1.1.20 ****/
383 extern void ppdSetConformance(ppd_conform_t c
) _CUPS_API_1_1_20
;
385 /**** New in CUPS 1.2 ****/
386 extern int ppdCollect2(ppd_file_t
*ppd
, ppd_section_t section
,
387 float min_order
, ppd_choice_t
***choices
) _CUPS_API_1_2
;
388 extern int ppdEmitAfterOrder(ppd_file_t
*ppd
, FILE *fp
,
389 ppd_section_t section
, int limit
,
390 float min_order
) _CUPS_API_1_2
;
391 extern int ppdEmitJCLEnd(ppd_file_t
*ppd
, FILE *fp
) _CUPS_API_1_2
;
392 extern char *ppdEmitString(ppd_file_t
*ppd
, ppd_section_t section
,
393 float min_order
) _CUPS_API_1_2
;
394 extern ppd_coption_t
*ppdFindCustomOption(ppd_file_t
*ppd
,
395 const char *keyword
) _CUPS_API_1_2
;
396 extern ppd_cparam_t
*ppdFindCustomParam(ppd_coption_t
*opt
,
397 const char *name
) _CUPS_API_1_2
;
398 extern ppd_cparam_t
*ppdFirstCustomParam(ppd_coption_t
*opt
) _CUPS_API_1_2
;
399 extern ppd_option_t
*ppdFirstOption(ppd_file_t
*ppd
) _CUPS_API_1_2
;
400 extern ppd_cparam_t
*ppdNextCustomParam(ppd_coption_t
*opt
) _CUPS_API_1_2
;
401 extern ppd_option_t
*ppdNextOption(ppd_file_t
*ppd
) _CUPS_API_1_2
;
402 extern int ppdLocalize(ppd_file_t
*ppd
) _CUPS_API_1_2
;
403 extern ppd_file_t
*ppdOpen2(cups_file_t
*fp
) _CUPS_API_1_2
;
405 /**** New in CUPS 1.3/Mac OS X 10.5 ****/
406 extern const char *ppdLocalizeIPPReason(ppd_file_t
*ppd
,
410 size_t bufsize
) _CUPS_API_1_3
;
412 /**** New in CUPS 1.4/Mac OS X 10.6 ****/
413 extern int cupsGetConflicts(ppd_file_t
*ppd
, const char *option
,
415 cups_option_t
**options
)
417 extern int cupsResolveConflicts(ppd_file_t
*ppd
, const char *option
,
420 cups_option_t
**options
)
422 extern int ppdInstallableConflict(ppd_file_t
*ppd
,
426 extern ppd_attr_t
*ppdLocalizeAttr(ppd_file_t
*ppd
, const char *keyword
,
427 const char *spec
) _CUPS_API_1_4
;
428 extern const char *ppdLocalizeMarkerName(ppd_file_t
*ppd
,
429 const char *name
) _CUPS_API_1_4
;
430 extern int ppdPageSizeLimits(ppd_file_t
*ppd
,
432 ppd_size_t
*maximum
) _CUPS_API_1_4
;
441 # endif /* __cplusplus */
442 #endif /* !_CUPS_PPD_H_ */
445 * End of "$Id: ppd.h 7791 2008-07-24 00:55:30Z mike $".