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