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