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