2 * "$Id: ppd.h 7791 2008-07-24 00:55:30Z mike $"
4 * PostScript Printer Description definitions for CUPS.
6 * THESE APIS ARE DEPRECATED. TO COMPILE WITHOUT WARNINGS ADD
7 * -D_PPD_DEPRECATED="" TO YOUR COMPILE OPTIONS. THIS HEADER AND THESE
8 * FUNCTIONS WILL BE REMOVED IN A FUTURE RELEASE OF CUPS.
10 * Copyright 2007-2012 by Apple Inc.
11 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
13 * These coded instructions, statements, and computer programs are the
14 * property of Apple Inc. and are protected by Federal copyright
15 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
16 * which should have been included with this file. If this file is
17 * file is missing or damaged, see the license at "http://www.cups.org/".
19 * PostScript is a trademark of Adobe Systems, Inc.
21 * This code and any derivative of it may be used and distributed
22 * freely under the terms of the GNU General Public License when
23 * used with GNU Ghostscript or its derivatives. Use of the code
24 * (or any derivative of it) with software other than GNU
25 * GhostScript (or its derivatives) is governed by the CUPS license
28 * This file is subject to the Apple OS-Developed Software exception.
35 * Include necessary headers...
50 # endif /* __cplusplus */
54 * Define _PPD_DEPRECATED to silence the warnings about PPD functions being
58 # ifndef _PPD_DEPRECATED
59 # if defined(__APPLE__)
60 # if defined(MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8
61 /* Building for 10.7 and earlier */
62 # define _PPD_DEPRECATED
63 # elif !defined(MAC_OS_X_VERSION_10_8)
64 /* Building for 10.7 and earlier */
65 # define _PPD_DEPRECATED
67 # define _PPD_DEPRECATED _CUPS_DEPRECATED
68 # endif /* MAC_OS_X_VERSION_10_8 && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8 */
70 # define _PPD_DEPRECATED _CUPS_DEPRECATED
71 # endif /* __APPLE__ */
72 # endif /* !_PPD_DEPRECATED */
79 # define PPD_VERSION 4.3 /* Kept in sync with Adobe version number */
83 * PPD size limits (defined in Adobe spec)
86 # define PPD_MAX_NAME 41 /* Maximum size of name + 1 for nul */
87 # define PPD_MAX_TEXT 81 /* Maximum size of text + 1 for nul */
88 # define PPD_MAX_LINE 256 /* Maximum size of line + 1 for nul */
92 * Types and structures...
95 typedef enum ppd_ui_e
/**** UI Types ****/
97 PPD_UI_BOOLEAN
, /* True or False option */
98 PPD_UI_PICKONE
, /* Pick one from a list */
99 PPD_UI_PICKMANY
/* Pick zero or more from a list */
102 typedef enum ppd_section_e
/**** Order dependency sections ****/
104 PPD_ORDER_ANY
, /* Option code can be anywhere in the file */
105 PPD_ORDER_DOCUMENT
, /* ... must be in the DocumentSetup section */
106 PPD_ORDER_EXIT
, /* ... must be sent prior to the document */
107 PPD_ORDER_JCL
, /* ... must be sent as a JCL command */
108 PPD_ORDER_PAGE
, /* ... must be in the PageSetup section */
109 PPD_ORDER_PROLOG
/* ... must be in the Prolog section */
112 typedef enum ppd_cs_e
/**** Colorspaces ****/
114 PPD_CS_CMYK
= -4, /* CMYK colorspace */
115 PPD_CS_CMY
, /* CMY colorspace */
116 PPD_CS_GRAY
= 1, /* Grayscale colorspace */
117 PPD_CS_RGB
= 3, /* RGB colorspace */
118 PPD_CS_RGBK
, /* RGBK (K = gray) colorspace */
119 PPD_CS_N
/* DeviceN colorspace */
122 typedef enum ppd_status_e
/**** Status Codes @since CUPS 1.1.19/Mac OS X 10.3@ ****/
125 PPD_FILE_OPEN_ERROR
, /* Unable to open PPD file */
126 PPD_NULL_FILE
, /* NULL PPD file pointer */
127 PPD_ALLOC_ERROR
, /* Memory allocation error */
128 PPD_MISSING_PPDADOBE4
, /* Missing PPD-Adobe-4.x header */
129 PPD_MISSING_VALUE
, /* Missing value string */
130 PPD_INTERNAL_ERROR
, /* Internal error */
131 PPD_BAD_OPEN_GROUP
, /* Bad OpenGroup */
132 PPD_NESTED_OPEN_GROUP
, /* OpenGroup without a CloseGroup first */
133 PPD_BAD_OPEN_UI
, /* Bad OpenUI/JCLOpenUI */
134 PPD_NESTED_OPEN_UI
, /* OpenUI/JCLOpenUI without a CloseUI/JCLCloseUI first */
135 PPD_BAD_ORDER_DEPENDENCY
, /* Bad OrderDependency */
136 PPD_BAD_UI_CONSTRAINTS
, /* Bad UIConstraints */
137 PPD_MISSING_ASTERISK
, /* Missing asterisk in column 0 */
138 PPD_LINE_TOO_LONG
, /* Line longer than 255 chars */
139 PPD_ILLEGAL_CHARACTER
, /* Illegal control character */
140 PPD_ILLEGAL_MAIN_KEYWORD
, /* Illegal main keyword string */
141 PPD_ILLEGAL_OPTION_KEYWORD
, /* Illegal option keyword string */
142 PPD_ILLEGAL_TRANSLATION
, /* Illegal translation string */
143 PPD_ILLEGAL_WHITESPACE
, /* Illegal whitespace character */
144 PPD_BAD_CUSTOM_PARAM
, /* Bad custom parameter */
145 PPD_MISSING_OPTION_KEYWORD
, /* Missing option keyword */
146 PPD_BAD_VALUE
, /* Bad value string */
147 PPD_MISSING_CLOSE_GROUP
, /* Missing CloseGroup */
148 PPD_MAX_STATUS
/* @private@ */
151 enum ppd_conform_e
/**** Conformance Levels @since CUPS 1.1.19/Mac OS X 10.3@ ****/
153 PPD_CONFORM_RELAXED
, /* Relax whitespace and control char */
154 PPD_CONFORM_STRICT
/* Require strict conformance */
157 typedef enum ppd_conform_e ppd_conform_t
;
158 /**** Conformance Levels @since CUPS 1.1.19/Mac OS X 10.3@ ****/
160 typedef struct ppd_attr_s
/**** PPD Attribute Structure @since CUPS 1.1.19/Mac OS X 10.3@ ****/
162 char name
[PPD_MAX_NAME
]; /* Name of attribute (cupsXYZ) */
163 char spec
[PPD_MAX_NAME
]; /* Specifier string, if any */
164 char text
[PPD_MAX_TEXT
]; /* Human-readable text, if any */
165 char *value
; /* Value string */
168 typedef struct ppd_option_s ppd_option_t
;
171 typedef struct ppd_choice_s
/**** Option choices ****/
173 char marked
; /* 0 if not selected, 1 otherwise */
174 char choice
[PPD_MAX_NAME
]; /* Computer-readable option name */
175 char text
[PPD_MAX_TEXT
]; /* Human-readable option name */
176 char *code
; /* Code to send for this option */
177 ppd_option_t
*option
; /* Pointer to parent option structure */
180 struct ppd_option_s
/**** Options ****/
182 char conflicted
; /* 0 if no conflicts exist, 1 otherwise */
183 char keyword
[PPD_MAX_NAME
]; /* Option keyword name ("PageSize", etc.) */
184 char defchoice
[PPD_MAX_NAME
];/* Default option choice */
185 char text
[PPD_MAX_TEXT
]; /* Human-readable text */
186 ppd_ui_t ui
; /* Type of UI option */
187 ppd_section_t section
; /* Section for command */
188 float order
; /* Order number */
189 int num_choices
; /* Number of option choices */
190 ppd_choice_t
*choices
; /* Option choices */
193 typedef struct ppd_group_s
/**** Groups ****/
195 /**** Group text strings are limited to 39 chars + nul in order to
196 **** preserve binary compatibility and allow applications to get
197 **** the group's keyword name.
199 char text
[PPD_MAX_TEXT
- PPD_MAX_NAME
];
200 /* Human-readable group name */
201 char name
[PPD_MAX_NAME
]; /* Group name @since CUPS 1.1.18/Mac OS X 10.3@ */
202 int num_options
; /* Number of options */
203 ppd_option_t
*options
; /* Options */
204 int num_subgroups
; /* Number of sub-groups */
205 struct ppd_group_s
*subgroups
; /* Sub-groups (max depth = 1) */
208 typedef struct ppd_const_s
/**** Constraints ****/
210 char option1
[PPD_MAX_NAME
]; /* First keyword */
211 char choice1
[PPD_MAX_NAME
]; /* First option/choice (blank for all) */
212 char option2
[PPD_MAX_NAME
]; /* Second keyword */
213 char choice2
[PPD_MAX_NAME
]; /* Second option/choice (blank for all) */
216 typedef struct ppd_size_s
/**** Page Sizes ****/
218 int marked
; /* Page size selected? */
219 char name
[PPD_MAX_NAME
]; /* Media size option */
220 float width
; /* Width of media in points */
221 float length
; /* Length of media in points */
222 float left
; /* Left printable margin in points */
223 float bottom
; /* Bottom printable margin in points */
224 float right
; /* Right printable margin in points */
225 float top
; /* Top printable margin in points */
228 typedef struct ppd_emul_s
/**** Emulators ****/
230 char name
[PPD_MAX_NAME
]; /* Emulator name */
231 char *start
; /* Code to switch to this emulation */
232 char *stop
; /* Code to stop this emulation */
235 typedef struct ppd_profile_s
/**** sRGB Color Profiles ****/
237 char resolution
[PPD_MAX_NAME
];
238 /* Resolution or "-" */
239 char media_type
[PPD_MAX_NAME
];
240 /* Media type or "-" */
241 float density
; /* Ink density to use */
242 float gamma
; /* Gamma correction to use */
243 float matrix
[3][3]; /* Transform matrix */
246 /**** New in CUPS 1.2/Mac OS X 10.5 ****/
247 typedef enum ppd_cptype_e
/**** Custom Parameter Type @since CUPS 1.2/Mac OS X 10.5@ ****/
249 PPD_CUSTOM_CURVE
, /* Curve value for f(x) = x^value */
250 PPD_CUSTOM_INT
, /* Integer number value */
251 PPD_CUSTOM_INVCURVE
, /* Curve value for f(x) = x^(1/value) */
252 PPD_CUSTOM_PASSCODE
, /* String of (hidden) numbers */
253 PPD_CUSTOM_PASSWORD
, /* String of (hidden) characters */
254 PPD_CUSTOM_POINTS
, /* Measurement value in points */
255 PPD_CUSTOM_REAL
, /* Real number value */
256 PPD_CUSTOM_STRING
/* String of characters */
259 typedef union ppd_cplimit_u
/**** Custom Parameter Limit @since CUPS 1.2/Mac OS X 10.5@ ****/
261 float custom_curve
; /* Gamma value */
262 int custom_int
; /* Integer value */
263 float custom_invcurve
; /* Gamma value */
264 int custom_passcode
; /* Passcode length */
265 int custom_password
; /* Password length */
266 float custom_points
; /* Measurement value */
267 float custom_real
; /* Real value */
268 int custom_string
; /* String length */
271 typedef union ppd_cpvalue_u
/**** Custom Parameter Value @since CUPS 1.2/Mac OS X 10.5@ ****/
273 float custom_curve
; /* Gamma value */
274 int custom_int
; /* Integer value */
275 float custom_invcurve
; /* Gamma value */
276 char *custom_passcode
; /* Passcode value */
277 char *custom_password
; /* Password value */
278 float custom_points
; /* Measurement value */
279 float custom_real
; /* Real value */
280 char *custom_string
; /* String value */
283 typedef struct ppd_cparam_s
/**** Custom Parameter @since CUPS 1.2/Mac OS X 10.5@ ****/
285 char name
[PPD_MAX_NAME
]; /* Parameter name */
286 char text
[PPD_MAX_TEXT
]; /* Human-readable text */
287 int order
; /* Order (0 to N) */
288 ppd_cptype_t type
; /* Parameter type */
289 ppd_cplimit_t minimum
, /* Minimum value */
290 maximum
; /* Maximum value */
291 ppd_cpvalue_t current
; /* Current value */
294 typedef struct ppd_coption_s
/**** Custom Option @since CUPS 1.2/Mac OS X 10.5@ ****/
296 char keyword
[PPD_MAX_NAME
]; /* Name of option that is being extended... */
297 ppd_option_t
*option
; /* Option that is being extended... */
298 int marked
; /* Extended option is marked */
299 cups_array_t
*params
; /* Parameters */
302 typedef struct _ppd_cache_s _ppd_cache_t
;
303 /**** PPD cache and mapping data @since CUPS 1.5/Mac OS X 10.7@ @private@ ****/
305 typedef struct ppd_file_s
/**** PPD File ****/
307 int language_level
; /* Language level of device */
308 int color_device
; /* 1 = color device, 0 = grayscale */
309 int variable_sizes
; /* 1 = supports variable sizes, 0 = doesn't */
310 int accurate_screens
; /* 1 = supports accurate screens, 0 = not */
311 int contone_only
; /* 1 = continuous tone only, 0 = not */
312 int landscape
; /* -90 or 90 */
313 int model_number
; /* Device-specific model number */
314 int manual_copies
; /* 1 = Copies done manually, 0 = hardware */
315 int throughput
; /* Pages per minute */
316 ppd_cs_t colorspace
; /* Default colorspace */
317 char *patches
; /* Patch commands to be sent to printer */
318 int num_emulations
; /* Number of emulations supported */
319 ppd_emul_t
*emulations
; /* Emulations and the code to invoke them */
320 char *jcl_begin
; /* Start JCL commands */
321 char *jcl_ps
; /* Enter PostScript interpreter */
322 char *jcl_end
; /* End JCL commands */
323 char *lang_encoding
; /* Language encoding */
324 char *lang_version
; /* Language version (English, Spanish, etc.) */
325 char *modelname
; /* Model name (general) */
326 char *ttrasterizer
; /* Truetype rasterizer */
327 char *manufacturer
; /* Manufacturer name */
328 char *product
; /* Product name (from PS RIP/interpreter) */
329 char *nickname
; /* Nickname (specific) */
330 char *shortnickname
; /* Short version of nickname */
331 int num_groups
; /* Number of UI groups */
332 ppd_group_t
*groups
; /* UI groups */
333 int num_sizes
; /* Number of page sizes */
334 ppd_size_t
*sizes
; /* Page sizes */
335 float custom_min
[2]; /* Minimum variable page size */
336 float custom_max
[2]; /* Maximum variable page size */
337 float custom_margins
[4]; /* Margins around page */
338 int num_consts
; /* Number of UI/Non-UI constraints */
339 ppd_const_t
*consts
; /* UI/Non-UI constraints */
340 int num_fonts
; /* Number of pre-loaded fonts */
341 char **fonts
; /* Pre-loaded fonts */
342 int num_profiles
; /* Number of sRGB color profiles @deprecated@ */
343 ppd_profile_t
*profiles
; /* sRGB color profiles @deprecated@ */
344 int num_filters
; /* Number of filters */
345 char **filters
; /* Filter strings... */
347 /**** New in CUPS 1.1 ****/
348 int flip_duplex
; /* 1 = Flip page for back sides @deprecated@ */
350 /**** New in CUPS 1.1.19 ****/
351 char *protocols
; /* Protocols (BCP, TBCP) string @since CUPS 1.1.19/Mac OS X 10.3@ */
352 char *pcfilename
; /* PCFileName string @since CUPS 1.1.19/Mac OS X 10.3@ */
353 int num_attrs
; /* Number of attributes @since CUPS 1.1.19/Mac OS X 10.3@ @private@ */
354 int cur_attr
; /* Current attribute @since CUPS 1.1.19/Mac OS X 10.3@ @private@ */
355 ppd_attr_t
**attrs
; /* Attributes @since CUPS 1.1.19/Mac OS X 10.3@ @private@ */
357 /**** New in CUPS 1.2/Mac OS X 10.5 ****/
358 cups_array_t
*sorted_attrs
; /* Attribute lookup array @since CUPS 1.2/Mac OS X 10.5@ @private@ */
359 cups_array_t
*options
; /* Option lookup array @since CUPS 1.2/Mac OS X 10.5@ @private@ */
360 cups_array_t
*coptions
; /* Custom options array @since CUPS 1.2/Mac OS X 10.5@ @private@ */
362 /**** New in CUPS 1.3/Mac OS X 10.5 ****/
363 cups_array_t
*marked
; /* Marked choices @since CUPS 1.3/Mac OS X 10.5@ @private@ */
365 /**** New in CUPS 1.4/Mac OS X 10.6 ****/
366 cups_array_t
*cups_uiconstraints
; /* cupsUIConstraints @since CUPS 1.4/Mac OS X 10.6@ @private@ */
368 /**** New in CUPS 1.5 ****/
369 _ppd_cache_t
*cache
; /* PPD cache and mapping data @since CUPS 1.5/Mac OS X 10.7@ @private@ */
377 extern int cupsMarkOptions(ppd_file_t
*ppd
, int num_options
,
378 cups_option_t
*options
);
379 extern void ppdClose(ppd_file_t
*ppd
);
380 extern int ppdCollect(ppd_file_t
*ppd
, ppd_section_t section
,
381 ppd_choice_t
***choices
);
382 extern int ppdConflicts(ppd_file_t
*ppd
);
383 extern int ppdEmit(ppd_file_t
*ppd
, FILE *fp
,
384 ppd_section_t section
);
385 extern int ppdEmitFd(ppd_file_t
*ppd
, int fd
,
386 ppd_section_t section
);
387 extern int ppdEmitJCL(ppd_file_t
*ppd
, FILE *fp
, int job_id
,
388 const char *user
, const char *title
);
389 extern ppd_choice_t
*ppdFindChoice(ppd_option_t
*o
, const char *option
);
390 extern ppd_choice_t
*ppdFindMarkedChoice(ppd_file_t
*ppd
,
391 const char *keyword
);
392 extern ppd_option_t
*ppdFindOption(ppd_file_t
*ppd
, const char *keyword
);
393 extern int ppdIsMarked(ppd_file_t
*ppd
, const char *keyword
,
395 extern void ppdMarkDefaults(ppd_file_t
*ppd
);
396 extern int ppdMarkOption(ppd_file_t
*ppd
, const char *keyword
,
398 extern ppd_file_t
*ppdOpen(FILE *fp
);
399 extern ppd_file_t
*ppdOpenFd(int fd
);
400 extern ppd_file_t
*ppdOpenFile(const char *filename
);
401 extern float ppdPageLength(ppd_file_t
*ppd
, const char *name
);
402 extern ppd_size_t
*ppdPageSize(ppd_file_t
*ppd
, const char *name
);
403 extern float ppdPageWidth(ppd_file_t
*ppd
, const char *name
);
405 /**** New in CUPS 1.1.19 ****/
406 extern const char *ppdErrorString(ppd_status_t status
) _PPD_DEPRECATED
;
407 extern ppd_attr_t
*ppdFindAttr(ppd_file_t
*ppd
, const char *name
,
408 const char *spec
) _PPD_DEPRECATED
;
409 extern ppd_attr_t
*ppdFindNextAttr(ppd_file_t
*ppd
, const char *name
,
410 const char *spec
) _PPD_DEPRECATED
;
411 extern ppd_status_t
ppdLastError(int *line
) _PPD_DEPRECATED
;
413 /**** New in CUPS 1.1.20 ****/
414 extern void ppdSetConformance(ppd_conform_t c
) _PPD_DEPRECATED
;
416 /**** New in CUPS 1.2 ****/
417 extern int ppdCollect2(ppd_file_t
*ppd
, ppd_section_t section
,
418 float min_order
, ppd_choice_t
***choices
)
420 extern int ppdEmitAfterOrder(ppd_file_t
*ppd
, FILE *fp
,
421 ppd_section_t section
, int limit
,
422 float min_order
) _PPD_DEPRECATED
;
423 extern int ppdEmitJCLEnd(ppd_file_t
*ppd
, FILE *fp
) _PPD_DEPRECATED
;
424 extern char *ppdEmitString(ppd_file_t
*ppd
, ppd_section_t section
,
425 float min_order
) _PPD_DEPRECATED
;
426 extern ppd_coption_t
*ppdFindCustomOption(ppd_file_t
*ppd
,
427 const char *keyword
) _PPD_DEPRECATED
;
428 extern ppd_cparam_t
*ppdFindCustomParam(ppd_coption_t
*opt
,
429 const char *name
) _PPD_DEPRECATED
;
430 extern ppd_cparam_t
*ppdFirstCustomParam(ppd_coption_t
*opt
) _PPD_DEPRECATED
;
431 extern ppd_option_t
*ppdFirstOption(ppd_file_t
*ppd
) _PPD_DEPRECATED
;
432 extern ppd_cparam_t
*ppdNextCustomParam(ppd_coption_t
*opt
) _PPD_DEPRECATED
;
433 extern ppd_option_t
*ppdNextOption(ppd_file_t
*ppd
) _PPD_DEPRECATED
;
434 extern int ppdLocalize(ppd_file_t
*ppd
) _PPD_DEPRECATED
;
435 extern ppd_file_t
*ppdOpen2(cups_file_t
*fp
) _PPD_DEPRECATED
;
437 /**** New in CUPS 1.3/Mac OS X 10.5 ****/
438 extern const char *ppdLocalizeIPPReason(ppd_file_t
*ppd
,
442 size_t bufsize
) _PPD_DEPRECATED
;
444 /**** New in CUPS 1.4/Mac OS X 10.6 ****/
445 extern int cupsGetConflicts(ppd_file_t
*ppd
, const char *option
,
447 cups_option_t
**options
)
449 extern int cupsResolveConflicts(ppd_file_t
*ppd
,
453 cups_option_t
**options
)
455 extern int ppdInstallableConflict(ppd_file_t
*ppd
,
459 extern ppd_attr_t
*ppdLocalizeAttr(ppd_file_t
*ppd
, const char *keyword
,
460 const char *spec
) _PPD_DEPRECATED
;
461 extern const char *ppdLocalizeMarkerName(ppd_file_t
*ppd
,
464 extern int ppdPageSizeLimits(ppd_file_t
*ppd
,
466 ppd_size_t
*maximum
) _PPD_DEPRECATED
;
475 # endif /* __cplusplus */
476 #endif /* !_CUPS_PPD_H_ */
479 * End of "$Id: ppd.h 7791 2008-07-24 00:55:30Z mike $".