]>
Commit | Line | Data |
---|---|---|
a603edef | 1 | /* |
7e86f2f6 | 2 | * Private PPD definitions for CUPS. |
a603edef | 3 | * |
f099325e | 4 | * Copyright 2007-2015 by Apple Inc. |
7e86f2f6 | 5 | * Copyright 1997-2007 by Easy Software Products, all rights reserved. |
a603edef | 6 | * |
7e86f2f6 MS |
7 | * These coded instructions, statements, and computer programs are the |
8 | * property of Apple Inc. and are protected by Federal copyright | |
9 | * law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
10 | * which should have been included with this file. If this file is | |
11 | * file is missing or damaged, see the license at "http://www.cups.org/". | |
a603edef | 12 | * |
7e86f2f6 | 13 | * PostScript is a trademark of Adobe Systems, Inc. |
a603edef | 14 | * |
7e86f2f6 MS |
15 | * This code and any derivative of it may be used and distributed |
16 | * freely under the terms of the GNU General Public License when | |
17 | * used with GNU Ghostscript or its derivatives. Use of the code | |
18 | * (or any derivative of it) with software other than GNU | |
19 | * GhostScript (or its derivatives) is governed by the CUPS license | |
20 | * agreement. | |
a603edef | 21 | * |
7e86f2f6 | 22 | * This file is subject to the Apple OS-Developed Software exception. |
a603edef MS |
23 | */ |
24 | ||
25 | #ifndef _CUPS_PPD_PRIVATE_H_ | |
26 | # define _CUPS_PPD_PRIVATE_H_ | |
27 | ||
28 | /* | |
29 | * Include necessary headers... | |
30 | */ | |
31 | ||
c7017ecc | 32 | # include <cups/cups.h> |
aaf19ab0 MS |
33 | # include <cups/ppd.h> |
34 | # include "pwg-private.h" | |
a603edef MS |
35 | |
36 | ||
37 | /* | |
38 | * C++ magic... | |
39 | */ | |
40 | ||
41 | # ifdef __cplusplus | |
42 | extern "C" { | |
43 | # endif /* __cplusplus */ | |
44 | ||
45 | ||
f14324a7 MS |
46 | /* |
47 | * Constants... | |
48 | */ | |
49 | ||
9b4bd602 | 50 | # define _PPD_CACHE_VERSION 7 /* Version number in cache file */ |
f14324a7 MS |
51 | |
52 | ||
66ab9486 | 53 | /* |
c7017ecc | 54 | * Types and structures... |
66ab9486 MS |
55 | */ |
56 | ||
f787e1e3 MS |
57 | typedef struct _ppd_globals_s /**** CUPS PPD global state data ****/ |
58 | { | |
59 | /* ppd.c */ | |
60 | ppd_status_t ppd_status; /* Status of last ppdOpen*() */ | |
61 | int ppd_line; /* Current line number */ | |
62 | ppd_conform_t ppd_conform; /* Level of conformance required */ | |
63 | ||
64 | /* ppd-util.c */ | |
65 | char ppd_filename[HTTP_MAX_URI]; | |
66 | /* PPD filename */ | |
67 | } _ppd_globals_t; | |
68 | ||
9c80ffa2 MS |
69 | typedef enum _ppd_localization_e /**** Selector for _ppdOpen ****/ |
70 | { | |
71 | _PPD_LOCALIZATION_DEFAULT, /* Load only the default localization */ | |
72 | _PPD_LOCALIZATION_ICC_PROFILES, /* Load only the color profile localization */ | |
73 | _PPD_LOCALIZATION_NONE, /* Load no localizations */ | |
74 | _PPD_LOCALIZATION_ALL /* Load all localizations */ | |
75 | } _ppd_localization_t; | |
76 | ||
c7017ecc MS |
77 | typedef enum _ppd_parse_e /**** Selector for _ppdParseOptions ****/ |
78 | { | |
79 | _PPD_PARSE_OPTIONS, /* Parse only the options */ | |
80 | _PPD_PARSE_PROPERTIES, /* Parse only the properties */ | |
81 | _PPD_PARSE_ALL /* Parse everything */ | |
82 | } _ppd_parse_t; | |
83 | ||
66ab9486 MS |
84 | typedef struct _ppd_cups_uiconst_s /**** Constraint from cupsUIConstraints ****/ |
85 | { | |
86 | ppd_option_t *option; /* Constrained option */ | |
87 | ppd_choice_t *choice; /* Constrained choice or @code NULL@ */ | |
88 | int installable; /* Installable option? */ | |
89 | } _ppd_cups_uiconst_t; | |
90 | ||
91 | typedef struct _ppd_cups_uiconsts_s /**** cupsUIConstraints ****/ | |
92 | { | |
93 | char resolver[PPD_MAX_NAME]; /* Resolver name */ | |
94 | int installable, /* Constrained against any installable options? */ | |
95 | num_constraints; /* Number of constraints */ | |
96 | _ppd_cups_uiconst_t *constraints; /* Constraints */ | |
97 | } _ppd_cups_uiconsts_t; | |
98 | ||
f14324a7 | 99 | typedef enum _pwg_print_color_mode_e /**** PWG print-color-mode indices ****/ |
c7017ecc | 100 | { |
f14324a7 MS |
101 | _PWG_PRINT_COLOR_MODE_MONOCHROME = 0, /* print-color-mode=monochrome */ |
102 | _PWG_PRINT_COLOR_MODE_COLOR, /* print-color-mode=color */ | |
103 | /* Other proposed values are not supported by CUPS yet. */ | |
104 | _PWG_PRINT_COLOR_MODE_MAX | |
105 | } _pwg_print_color_mode_t; | |
c7017ecc | 106 | |
dcb445bc | 107 | typedef enum _pwg_print_quality_e /**** PWG print-quality values ****/ |
c7017ecc MS |
108 | { |
109 | _PWG_PRINT_QUALITY_DRAFT = 0, /* print-quality=3 */ | |
110 | _PWG_PRINT_QUALITY_NORMAL, /* print-quality=4 */ | |
111 | _PWG_PRINT_QUALITY_HIGH, /* print-quality=5 */ | |
112 | _PWG_PRINT_QUALITY_MAX | |
113 | } _pwg_print_quality_t; | |
114 | ||
dcb445bc MS |
115 | typedef struct _pwg_finishings_s /**** PWG finishings mapping data ****/ |
116 | { | |
cb7f98ee MS |
117 | ipp_finishings_t value; /* finishings value */ |
118 | int num_options; /* Number of options to apply */ | |
119 | cups_option_t *options; /* Options to apply */ | |
dcb445bc MS |
120 | } _pwg_finishings_t; |
121 | ||
5a08320a MS |
122 | typedef struct _pwg_material_s /**** PWG material mapping data ****/ |
123 | { | |
124 | char *key, /* material-key value */ | |
125 | *name; /* material-name value */ | |
126 | int num_props; /* Number of properties */ | |
127 | cups_option_t *props; /* Material properties */ | |
128 | } _pwg_material_t; | |
129 | ||
f14324a7 | 130 | struct _ppd_cache_s /**** PPD cache and PWG conversion data ****/ |
c7017ecc MS |
131 | { |
132 | int num_bins; /* Number of output bins */ | |
6961465f | 133 | pwg_map_t *bins; /* Output bins */ |
c7017ecc | 134 | int num_sizes; /* Number of media sizes */ |
6961465f | 135 | pwg_size_t *sizes; /* Media sizes */ |
c7017ecc MS |
136 | int custom_max_width, /* Maximum custom width in 2540ths */ |
137 | custom_max_length, /* Maximum custom length in 2540ths */ | |
138 | custom_min_width, /* Minimum custom width in 2540ths */ | |
139 | custom_min_length; /* Minimum custom length in 2540ths */ | |
140 | char *custom_max_keyword, /* Maximum custom size PWG keyword */ | |
141 | *custom_min_keyword, /* Minimum custom size PWG keyword */ | |
142 | custom_ppd_size[41]; /* Custom PPD size name */ | |
6961465f | 143 | pwg_size_t custom_size; /* Custom size record */ |
4220952d | 144 | char *source_option; /* PPD option for media source */ |
c7017ecc | 145 | int num_sources; /* Number of media sources */ |
6961465f | 146 | pwg_map_t *sources; /* Media sources */ |
c7017ecc | 147 | int num_types; /* Number of media types */ |
6961465f | 148 | pwg_map_t *types; /* Media types */ |
f14324a7 MS |
149 | int num_presets[_PWG_PRINT_COLOR_MODE_MAX][_PWG_PRINT_QUALITY_MAX]; |
150 | /* Number of print-color-mode/print-quality options */ | |
151 | cups_option_t *presets[_PWG_PRINT_COLOR_MODE_MAX][_PWG_PRINT_QUALITY_MAX]; | |
152 | /* print-color-mode/print-quality options */ | |
c7017ecc MS |
153 | char *sides_option, /* PPD option for sides */ |
154 | *sides_1sided, /* Choice for one-sided */ | |
155 | *sides_2sided_long, /* Choice for two-sided-long-edge */ | |
156 | *sides_2sided_short; /* Choice for two-sided-short-edge */ | |
f14324a7 MS |
157 | char *product; /* Product value */ |
158 | cups_array_t *filters, /* cupsFilter/cupsFilter2 values */ | |
159 | *prefilters; /* cupsPreFilter values */ | |
82f97232 | 160 | int single_file; /* cupsSingleFile value */ |
dcb445bc | 161 | cups_array_t *finishings; /* cupsIPPFinishings values */ |
5a9febac MS |
162 | int max_copies, /* cupsMaxCopies value */ |
163 | account_id, /* cupsJobAccountId value */ | |
164 | accounting_user_id; /* cupsJobAccountingUserId value */ | |
165 | char *password; /* cupsJobPassword value */ | |
166 | cups_array_t *mandatory; /* cupsMandatory value */ | |
a469f8a5 | 167 | char *charge_info_uri; /* cupsChargeInfoURI value */ |
c1420c87 | 168 | cups_array_t *support_files; /* Support files - ICC profiles, etc. */ |
5a08320a MS |
169 | char *cups_3d, /* cups3D value */ |
170 | *cups_layer_order; /* cupsLayerOrder value */ | |
171 | int cups_accuracy[3]; /* cupsAccuracy value - x, y, and z in nanometers */ | |
172 | int cups_volume[3]; /* cupsVolume value - x, y, and z in millimeters */ | |
173 | cups_array_t *materials; /* cupsMaterial values */ | |
f14324a7 | 174 | }; |
c7017ecc | 175 | |
66ab9486 MS |
176 | |
177 | /* | |
178 | * Prototypes... | |
179 | */ | |
180 | ||
f099325e | 181 | 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); |
f14324a7 MS |
182 | extern _ppd_cache_t *_ppdCacheCreateWithFile(const char *filename, |
183 | ipp_t **attrs); | |
184 | extern _ppd_cache_t *_ppdCacheCreateWithPPD(ppd_file_t *ppd); | |
185 | extern void _ppdCacheDestroy(_ppd_cache_t *pc); | |
186 | extern const char *_ppdCacheGetBin(_ppd_cache_t *pc, | |
187 | const char *output_bin); | |
cb7f98ee MS |
188 | extern int _ppdCacheGetFinishingOptions(_ppd_cache_t *pc, |
189 | ipp_t *job, | |
190 | ipp_finishings_t value, | |
191 | int num_options, | |
dcb445bc | 192 | cups_option_t **options); |
cb7f98ee MS |
193 | extern int _ppdCacheGetFinishingValues(_ppd_cache_t *pc, |
194 | int num_options, | |
dcb445bc | 195 | cups_option_t *options, |
cb7f98ee MS |
196 | int max_values, |
197 | int *values); | |
f14324a7 MS |
198 | extern const char *_ppdCacheGetInputSlot(_ppd_cache_t *pc, ipp_t *job, |
199 | const char *keyword); | |
200 | extern const char *_ppdCacheGetMediaType(_ppd_cache_t *pc, ipp_t *job, | |
201 | const char *keyword); | |
202 | extern const char *_ppdCacheGetOutputBin(_ppd_cache_t *pc, | |
203 | const char *keyword); | |
204 | extern const char *_ppdCacheGetPageSize(_ppd_cache_t *pc, ipp_t *job, | |
205 | const char *keyword, int *exact); | |
6961465f | 206 | extern pwg_size_t *_ppdCacheGetSize(_ppd_cache_t *pc, |
f14324a7 MS |
207 | const char *page_size); |
208 | extern const char *_ppdCacheGetSource(_ppd_cache_t *pc, | |
209 | const char *input_slot); | |
210 | extern const char *_ppdCacheGetType(_ppd_cache_t *pc, | |
211 | const char *media_type); | |
212 | extern int _ppdCacheWriteFile(_ppd_cache_t *pc, | |
213 | const char *filename, ipp_t *attrs); | |
d9fc71e4 | 214 | extern char *_ppdCreateFromIPP(char *buffer, size_t bufsize, ipp_t *response); |
a603edef | 215 | extern void _ppdFreeLanguages(cups_array_t *languages); |
5eb9da71 | 216 | extern cups_encoding_t _ppdGetEncoding(const char *name); |
a603edef | 217 | extern cups_array_t *_ppdGetLanguages(ppd_file_t *ppd); |
f787e1e3 | 218 | extern _ppd_globals_t *_ppdGlobals(void); |
a603edef MS |
219 | extern unsigned _ppdHashName(const char *name); |
220 | extern ppd_attr_t *_ppdLocalizedAttr(ppd_file_t *ppd, const char *keyword, | |
221 | const char *spec, const char *ll_CC); | |
5eb9da71 MS |
222 | extern char *_ppdNormalizeMakeAndModel(const char *make_and_model, |
223 | char *buffer, | |
224 | size_t bufsize); | |
9c80ffa2 MS |
225 | extern ppd_file_t *_ppdOpen(cups_file_t *fp, |
226 | _ppd_localization_t localization); | |
227 | extern ppd_file_t *_ppdOpenFile(const char *filename, | |
228 | _ppd_localization_t localization); | |
66ab9486 | 229 | extern int _ppdParseOptions(const char *s, int num_options, |
c7017ecc MS |
230 | cups_option_t **options, |
231 | _ppd_parse_t which); | |
aaf19ab0 MS |
232 | extern const char *_pwgInputSlotForSource(const char *media_source, |
233 | char *name, size_t namesize); | |
cc754834 | 234 | extern const char *_pwgMediaTypeForType(const char *media_type, |
f14324a7 | 235 | char *name, size_t namesize); |
6961465f | 236 | extern const char *_pwgPageSizeForMedia(pwg_media_t *media, |
aaf19ab0 | 237 | char *name, size_t namesize); |
a603edef MS |
238 | |
239 | ||
240 | /* | |
241 | * C++ magic... | |
242 | */ | |
243 | ||
244 | # ifdef __cplusplus | |
245 | } | |
246 | # endif /* __cplusplus */ | |
247 | #endif /* !_CUPS_PPD_PRIVATE_H_ */ |