2 * Private PPD definitions for CUPS.
4 * Copyright 2007-2015 by Apple Inc.
5 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
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/".
13 * PostScript is a trademark of Adobe Systems, Inc.
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
22 * This file is subject to the Apple OS-Developed Software exception.
25 #ifndef _CUPS_PPD_PRIVATE_H_
26 # define _CUPS_PPD_PRIVATE_H_
29 * Include necessary headers...
32 # include <cups/cups.h>
33 # include <cups/ppd.h>
34 # include "pwg-private.h"
43 # endif /* __cplusplus */
50 # define _PPD_CACHE_VERSION 7 /* Version number in cache file */
54 * Types and structures...
57 typedef struct _ppd_globals_s
/**** CUPS PPD global state data ****/
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 */
65 char ppd_filename
[HTTP_MAX_URI
];
69 typedef enum _ppd_localization_e
/**** Selector for _ppdOpen ****/
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
;
77 typedef enum _ppd_parse_e
/**** Selector for _ppdParseOptions ****/
79 _PPD_PARSE_OPTIONS
, /* Parse only the options */
80 _PPD_PARSE_PROPERTIES
, /* Parse only the properties */
81 _PPD_PARSE_ALL
/* Parse everything */
84 typedef struct _ppd_cups_uiconst_s
/**** Constraint from cupsUIConstraints ****/
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
;
91 typedef struct _ppd_cups_uiconsts_s
/**** cupsUIConstraints ****/
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
;
99 typedef enum _pwg_print_color_mode_e
/**** PWG print-color-mode indices ****/
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
;
107 typedef enum _pwg_print_quality_e
/**** PWG print-quality values ****/
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
;
115 typedef struct _pwg_finishings_s
/**** PWG finishings mapping data ****/
117 ipp_finishings_t value
; /* finishings value */
118 int num_options
; /* Number of options to apply */
119 cups_option_t
*options
; /* Options to apply */
122 typedef struct _pwg_material_s
/**** PWG material mapping data ****/
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 */
130 struct _ppd_cache_s
/**** PPD cache and PWG conversion data ****/
132 int num_bins
; /* Number of output bins */
133 pwg_map_t
*bins
; /* Output bins */
134 int num_sizes
; /* Number of media sizes */
135 pwg_size_t
*sizes
; /* Media sizes */
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 */
143 pwg_size_t custom_size
; /* Custom size record */
144 char *source_option
; /* PPD option for media source */
145 int num_sources
; /* Number of media sources */
146 pwg_map_t
*sources
; /* Media sources */
147 int num_types
; /* Number of media types */
148 pwg_map_t
*types
; /* Media types */
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 */
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 */
157 char *product
; /* Product value */
158 cups_array_t
*filters
, /* cupsFilter/cupsFilter2 values */
159 *prefilters
; /* cupsPreFilter values */
160 int single_file
; /* cupsSingleFile value */
161 cups_array_t
*finishings
; /* cupsIPPFinishings values */
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 */
167 char *charge_info_uri
; /* cupsChargeInfoURI value */
168 cups_array_t
*support_files
; /* Support files - ICC profiles, etc. */
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 */
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
);
182 extern _ppd_cache_t
*_ppdCacheCreateWithFile(const char *filename
,
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
);
188 extern int _ppdCacheGetFinishingOptions(_ppd_cache_t
*pc
,
190 ipp_finishings_t value
,
192 cups_option_t
**options
);
193 extern int _ppdCacheGetFinishingValues(_ppd_cache_t
*pc
,
195 cups_option_t
*options
,
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
);
206 extern pwg_size_t
*_ppdCacheGetSize(_ppd_cache_t
*pc
,
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
);
214 extern char *_ppdCreateFromIPP(char *buffer
, size_t bufsize
, ipp_t
*response
);
215 extern void _ppdFreeLanguages(cups_array_t
*languages
);
216 extern cups_encoding_t
_ppdGetEncoding(const char *name
);
217 extern cups_array_t
*_ppdGetLanguages(ppd_file_t
*ppd
);
218 extern _ppd_globals_t
*_ppdGlobals(void);
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
);
222 extern char *_ppdNormalizeMakeAndModel(const char *make_and_model
,
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
);
229 extern int _ppdParseOptions(const char *s
, int num_options
,
230 cups_option_t
**options
,
232 extern const char *_pwgInputSlotForSource(const char *media_source
,
233 char *name
, size_t namesize
);
234 extern const char *_pwgMediaTypeForType(const char *media_type
,
235 char *name
, size_t namesize
);
236 extern const char *_pwgPageSizeForMedia(pwg_media_t
*media
,
237 char *name
, size_t namesize
);
246 # endif /* __cplusplus */
247 #endif /* !_CUPS_PPD_PRIVATE_H_ */