]>
Commit | Line | Data |
---|---|---|
a603edef | 1 | /* |
7e86f2f6 | 2 | * Private PPD definitions for CUPS. |
a603edef | 3 | * |
ffbf1e61 | 4 | * Copyright © 2007-2019 by Apple Inc. |
dd204f7a | 5 | * Copyright © 1997-2007 by Easy Software Products, all rights reserved. |
a603edef | 6 | * |
89550f3f MS |
7 | * Licensed under Apache License v2.0. See the file "LICENSE" for more |
8 | * information. | |
a603edef | 9 | * |
7e86f2f6 | 10 | * PostScript is a trademark of Adobe Systems, Inc. |
a603edef MS |
11 | */ |
12 | ||
13 | #ifndef _CUPS_PPD_PRIVATE_H_ | |
14 | # define _CUPS_PPD_PRIVATE_H_ | |
15 | ||
16 | /* | |
17 | * Include necessary headers... | |
18 | */ | |
19 | ||
c7017ecc | 20 | # include <cups/cups.h> |
aaf19ab0 MS |
21 | # include <cups/ppd.h> |
22 | # include "pwg-private.h" | |
a603edef MS |
23 | |
24 | ||
25 | /* | |
26 | * C++ magic... | |
27 | */ | |
28 | ||
29 | # ifdef __cplusplus | |
30 | extern "C" { | |
31 | # endif /* __cplusplus */ | |
32 | ||
33 | ||
f14324a7 MS |
34 | /* |
35 | * Constants... | |
36 | */ | |
37 | ||
89550f3f | 38 | # define _PPD_CACHE_VERSION 9 /* Version number in cache file */ |
f14324a7 MS |
39 | |
40 | ||
66ab9486 | 41 | /* |
c7017ecc | 42 | * Types and structures... |
66ab9486 MS |
43 | */ |
44 | ||
f787e1e3 MS |
45 | typedef struct _ppd_globals_s /**** CUPS PPD global state data ****/ |
46 | { | |
47 | /* ppd.c */ | |
48 | ppd_status_t ppd_status; /* Status of last ppdOpen*() */ | |
49 | int ppd_line; /* Current line number */ | |
50 | ppd_conform_t ppd_conform; /* Level of conformance required */ | |
51 | ||
52 | /* ppd-util.c */ | |
53 | char ppd_filename[HTTP_MAX_URI]; | |
54 | /* PPD filename */ | |
55 | } _ppd_globals_t; | |
56 | ||
9c80ffa2 MS |
57 | typedef enum _ppd_localization_e /**** Selector for _ppdOpen ****/ |
58 | { | |
59 | _PPD_LOCALIZATION_DEFAULT, /* Load only the default localization */ | |
60 | _PPD_LOCALIZATION_ICC_PROFILES, /* Load only the color profile localization */ | |
61 | _PPD_LOCALIZATION_NONE, /* Load no localizations */ | |
62 | _PPD_LOCALIZATION_ALL /* Load all localizations */ | |
63 | } _ppd_localization_t; | |
64 | ||
c7017ecc MS |
65 | typedef enum _ppd_parse_e /**** Selector for _ppdParseOptions ****/ |
66 | { | |
67 | _PPD_PARSE_OPTIONS, /* Parse only the options */ | |
68 | _PPD_PARSE_PROPERTIES, /* Parse only the properties */ | |
69 | _PPD_PARSE_ALL /* Parse everything */ | |
70 | } _ppd_parse_t; | |
71 | ||
66ab9486 MS |
72 | typedef struct _ppd_cups_uiconst_s /**** Constraint from cupsUIConstraints ****/ |
73 | { | |
74 | ppd_option_t *option; /* Constrained option */ | |
75 | ppd_choice_t *choice; /* Constrained choice or @code NULL@ */ | |
76 | int installable; /* Installable option? */ | |
77 | } _ppd_cups_uiconst_t; | |
78 | ||
79 | typedef struct _ppd_cups_uiconsts_s /**** cupsUIConstraints ****/ | |
80 | { | |
81 | char resolver[PPD_MAX_NAME]; /* Resolver name */ | |
82 | int installable, /* Constrained against any installable options? */ | |
83 | num_constraints; /* Number of constraints */ | |
84 | _ppd_cups_uiconst_t *constraints; /* Constraints */ | |
85 | } _ppd_cups_uiconsts_t; | |
86 | ||
f14324a7 | 87 | typedef enum _pwg_print_color_mode_e /**** PWG print-color-mode indices ****/ |
c7017ecc | 88 | { |
f14324a7 MS |
89 | _PWG_PRINT_COLOR_MODE_MONOCHROME = 0, /* print-color-mode=monochrome */ |
90 | _PWG_PRINT_COLOR_MODE_COLOR, /* print-color-mode=color */ | |
87f34051 | 91 | /* Other values are not supported by CUPS yet. */ |
f14324a7 MS |
92 | _PWG_PRINT_COLOR_MODE_MAX |
93 | } _pwg_print_color_mode_t; | |
c7017ecc | 94 | |
dcb445bc | 95 | typedef enum _pwg_print_quality_e /**** PWG print-quality values ****/ |
c7017ecc MS |
96 | { |
97 | _PWG_PRINT_QUALITY_DRAFT = 0, /* print-quality=3 */ | |
98 | _PWG_PRINT_QUALITY_NORMAL, /* print-quality=4 */ | |
99 | _PWG_PRINT_QUALITY_HIGH, /* print-quality=5 */ | |
100 | _PWG_PRINT_QUALITY_MAX | |
101 | } _pwg_print_quality_t; | |
102 | ||
dcb445bc MS |
103 | typedef struct _pwg_finishings_s /**** PWG finishings mapping data ****/ |
104 | { | |
cb7f98ee MS |
105 | ipp_finishings_t value; /* finishings value */ |
106 | int num_options; /* Number of options to apply */ | |
107 | cups_option_t *options; /* Options to apply */ | |
dcb445bc MS |
108 | } _pwg_finishings_t; |
109 | ||
f14324a7 | 110 | struct _ppd_cache_s /**** PPD cache and PWG conversion data ****/ |
c7017ecc MS |
111 | { |
112 | int num_bins; /* Number of output bins */ | |
6961465f | 113 | pwg_map_t *bins; /* Output bins */ |
c7017ecc | 114 | int num_sizes; /* Number of media sizes */ |
6961465f | 115 | pwg_size_t *sizes; /* Media sizes */ |
c7017ecc MS |
116 | int custom_max_width, /* Maximum custom width in 2540ths */ |
117 | custom_max_length, /* Maximum custom length in 2540ths */ | |
118 | custom_min_width, /* Minimum custom width in 2540ths */ | |
119 | custom_min_length; /* Minimum custom length in 2540ths */ | |
120 | char *custom_max_keyword, /* Maximum custom size PWG keyword */ | |
121 | *custom_min_keyword, /* Minimum custom size PWG keyword */ | |
122 | custom_ppd_size[41]; /* Custom PPD size name */ | |
6961465f | 123 | pwg_size_t custom_size; /* Custom size record */ |
4220952d | 124 | char *source_option; /* PPD option for media source */ |
c7017ecc | 125 | int num_sources; /* Number of media sources */ |
6961465f | 126 | pwg_map_t *sources; /* Media sources */ |
c7017ecc | 127 | int num_types; /* Number of media types */ |
6961465f | 128 | pwg_map_t *types; /* Media types */ |
f14324a7 MS |
129 | int num_presets[_PWG_PRINT_COLOR_MODE_MAX][_PWG_PRINT_QUALITY_MAX]; |
130 | /* Number of print-color-mode/print-quality options */ | |
131 | cups_option_t *presets[_PWG_PRINT_COLOR_MODE_MAX][_PWG_PRINT_QUALITY_MAX]; | |
132 | /* print-color-mode/print-quality options */ | |
c7017ecc MS |
133 | char *sides_option, /* PPD option for sides */ |
134 | *sides_1sided, /* Choice for one-sided */ | |
135 | *sides_2sided_long, /* Choice for two-sided-long-edge */ | |
136 | *sides_2sided_short; /* Choice for two-sided-short-edge */ | |
f14324a7 MS |
137 | char *product; /* Product value */ |
138 | cups_array_t *filters, /* cupsFilter/cupsFilter2 values */ | |
139 | *prefilters; /* cupsPreFilter values */ | |
82f97232 | 140 | int single_file; /* cupsSingleFile value */ |
dcb445bc | 141 | cups_array_t *finishings; /* cupsIPPFinishings values */ |
4f63d6cd | 142 | cups_array_t *templates; /* cupsFinishingTemplate values */ |
5a9febac MS |
143 | int max_copies, /* cupsMaxCopies value */ |
144 | account_id, /* cupsJobAccountId value */ | |
145 | accounting_user_id; /* cupsJobAccountingUserId value */ | |
146 | char *password; /* cupsJobPassword value */ | |
147 | cups_array_t *mandatory; /* cupsMandatory value */ | |
a469f8a5 | 148 | char *charge_info_uri; /* cupsChargeInfoURI value */ |
2fa1ba3c | 149 | cups_array_t *strings; /* Localization strings */ |
c1420c87 | 150 | cups_array_t *support_files; /* Support files - ICC profiles, etc. */ |
f14324a7 | 151 | }; |
c7017ecc | 152 | |
66ab9486 MS |
153 | |
154 | /* | |
155 | * Prototypes... | |
156 | */ | |
157 | ||
e3586875 | 158 | extern int _cupsConvertOptions(ipp_t *request, ppd_file_t *ppd, _ppd_cache_t *pc, ipp_attribute_t *media_col_sup, ipp_attribute_t *doc_handling_sup, ipp_attribute_t *print_color_mode_sup, const char *user, const char *format, int copies, int num_options, cups_option_t *options) _CUPS_PRIVATE; |
ffbf1e61 | 159 | extern int _cupsRasterExecPS(cups_page_header2_t *h, int *preferred_bits, const char *code) _CUPS_NONNULL(3) _CUPS_PRIVATE; |
dd204f7a MS |
160 | extern int _cupsRasterInterpretPPD(cups_page_header2_t *h, ppd_file_t *ppd, int num_options, cups_option_t *options, cups_interpret_cb_t func) _CUPS_PRIVATE; |
161 | ||
f14324a7 | 162 | extern _ppd_cache_t *_ppdCacheCreateWithFile(const char *filename, |
e3586875 MS |
163 | ipp_t **attrs) _CUPS_PRIVATE; |
164 | extern _ppd_cache_t *_ppdCacheCreateWithPPD(ppd_file_t *ppd) _CUPS_PRIVATE; | |
165 | extern void _ppdCacheDestroy(_ppd_cache_t *pc) _CUPS_PRIVATE; | |
f14324a7 | 166 | extern const char *_ppdCacheGetBin(_ppd_cache_t *pc, |
e3586875 | 167 | const char *output_bin) _CUPS_PRIVATE; |
cb7f98ee MS |
168 | extern int _ppdCacheGetFinishingOptions(_ppd_cache_t *pc, |
169 | ipp_t *job, | |
170 | ipp_finishings_t value, | |
171 | int num_options, | |
e3586875 MS |
172 | cups_option_t **options) _CUPS_PRIVATE; |
173 | extern int _ppdCacheGetFinishingValues(ppd_file_t *ppd, _ppd_cache_t *pc, int max_values, int *values) _CUPS_PRIVATE; | |
f14324a7 | 174 | extern const char *_ppdCacheGetInputSlot(_ppd_cache_t *pc, ipp_t *job, |
e3586875 | 175 | const char *keyword) _CUPS_PRIVATE; |
f14324a7 | 176 | extern const char *_ppdCacheGetMediaType(_ppd_cache_t *pc, ipp_t *job, |
e3586875 | 177 | const char *keyword) _CUPS_PRIVATE; |
f14324a7 | 178 | extern const char *_ppdCacheGetOutputBin(_ppd_cache_t *pc, |
e3586875 | 179 | const char *keyword) _CUPS_PRIVATE; |
f14324a7 | 180 | extern const char *_ppdCacheGetPageSize(_ppd_cache_t *pc, ipp_t *job, |
e3586875 | 181 | const char *keyword, int *exact) _CUPS_PRIVATE; |
6961465f | 182 | extern pwg_size_t *_ppdCacheGetSize(_ppd_cache_t *pc, |
e3586875 | 183 | const char *page_size) _CUPS_PRIVATE; |
f14324a7 | 184 | extern const char *_ppdCacheGetSource(_ppd_cache_t *pc, |
e3586875 | 185 | const char *input_slot) _CUPS_PRIVATE; |
f14324a7 | 186 | extern const char *_ppdCacheGetType(_ppd_cache_t *pc, |
e3586875 | 187 | const char *media_type) _CUPS_PRIVATE; |
f14324a7 | 188 | extern int _ppdCacheWriteFile(_ppd_cache_t *pc, |
e3586875 MS |
189 | const char *filename, ipp_t *attrs) _CUPS_PRIVATE; |
190 | extern char *_ppdCreateFromIPP(char *buffer, size_t bufsize, ipp_t *response) _CUPS_PRIVATE; | |
191 | extern void _ppdFreeLanguages(cups_array_t *languages) _CUPS_PRIVATE; | |
192 | extern cups_encoding_t _ppdGetEncoding(const char *name) _CUPS_PRIVATE; | |
193 | extern cups_array_t *_ppdGetLanguages(ppd_file_t *ppd) _CUPS_PRIVATE; | |
194 | extern _ppd_globals_t *_ppdGlobals(void) _CUPS_PRIVATE; | |
195 | extern unsigned _ppdHashName(const char *name) _CUPS_PRIVATE; | |
a603edef | 196 | extern ppd_attr_t *_ppdLocalizedAttr(ppd_file_t *ppd, const char *keyword, |
e3586875 | 197 | const char *spec, const char *ll_CC) _CUPS_PRIVATE; |
5eb9da71 MS |
198 | extern char *_ppdNormalizeMakeAndModel(const char *make_and_model, |
199 | char *buffer, | |
e3586875 | 200 | size_t bufsize) _CUPS_PRIVATE; |
9c80ffa2 | 201 | extern ppd_file_t *_ppdOpen(cups_file_t *fp, |
e3586875 | 202 | _ppd_localization_t localization) _CUPS_PRIVATE; |
9c80ffa2 | 203 | extern ppd_file_t *_ppdOpenFile(const char *filename, |
e3586875 | 204 | _ppd_localization_t localization) _CUPS_PRIVATE; |
66ab9486 | 205 | extern int _ppdParseOptions(const char *s, int num_options, |
c7017ecc | 206 | cups_option_t **options, |
e3586875 | 207 | _ppd_parse_t which) _CUPS_PRIVATE; |
aaf19ab0 | 208 | extern const char *_pwgInputSlotForSource(const char *media_source, |
e3586875 | 209 | char *name, size_t namesize) _CUPS_PRIVATE; |
cc754834 | 210 | extern const char *_pwgMediaTypeForType(const char *media_type, |
e3586875 | 211 | char *name, size_t namesize) _CUPS_PRIVATE; |
6961465f | 212 | extern const char *_pwgPageSizeForMedia(pwg_media_t *media, |
e3586875 | 213 | char *name, size_t namesize) _CUPS_PRIVATE; |
a603edef MS |
214 | |
215 | ||
216 | /* | |
217 | * C++ magic... | |
218 | */ | |
219 | ||
220 | # ifdef __cplusplus | |
221 | } | |
222 | # endif /* __cplusplus */ | |
223 | #endif /* !_CUPS_PPD_PRIVATE_H_ */ |