2 * Private PPD definitions for CUPS.
4 * Copyright 2007-2017 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 * 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 8 /* 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 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 struct _ppd_cache_s
/**** PPD cache and PWG conversion data ****/
124 int num_bins
; /* Number of output bins */
125 pwg_map_t
*bins
; /* Output bins */
126 int num_sizes
; /* Number of media sizes */
127 pwg_size_t
*sizes
; /* Media sizes */
128 int custom_max_width
, /* Maximum custom width in 2540ths */
129 custom_max_length
, /* Maximum custom length in 2540ths */
130 custom_min_width
, /* Minimum custom width in 2540ths */
131 custom_min_length
; /* Minimum custom length in 2540ths */
132 char *custom_max_keyword
, /* Maximum custom size PWG keyword */
133 *custom_min_keyword
, /* Minimum custom size PWG keyword */
134 custom_ppd_size
[41]; /* Custom PPD size name */
135 pwg_size_t custom_size
; /* Custom size record */
136 char *source_option
; /* PPD option for media source */
137 int num_sources
; /* Number of media sources */
138 pwg_map_t
*sources
; /* Media sources */
139 int num_types
; /* Number of media types */
140 pwg_map_t
*types
; /* Media types */
141 int num_presets
[_PWG_PRINT_COLOR_MODE_MAX
][_PWG_PRINT_QUALITY_MAX
];
142 /* Number of print-color-mode/print-quality options */
143 cups_option_t
*presets
[_PWG_PRINT_COLOR_MODE_MAX
][_PWG_PRINT_QUALITY_MAX
];
144 /* print-color-mode/print-quality options */
145 char *sides_option
, /* PPD option for sides */
146 *sides_1sided
, /* Choice for one-sided */
147 *sides_2sided_long
, /* Choice for two-sided-long-edge */
148 *sides_2sided_short
; /* Choice for two-sided-short-edge */
149 char *product
; /* Product value */
150 cups_array_t
*filters
, /* cupsFilter/cupsFilter2 values */
151 *prefilters
; /* cupsPreFilter values */
152 int single_file
; /* cupsSingleFile value */
153 cups_array_t
*finishings
; /* cupsIPPFinishings values */
154 int max_copies
, /* cupsMaxCopies value */
155 account_id
, /* cupsJobAccountId value */
156 accounting_user_id
; /* cupsJobAccountingUserId value */
157 char *password
; /* cupsJobPassword value */
158 cups_array_t
*mandatory
; /* cupsMandatory value */
159 char *charge_info_uri
; /* cupsChargeInfoURI value */
160 cups_array_t
*support_files
; /* Support files - ICC profiles, etc. */
168 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
);
169 extern _ppd_cache_t
*_ppdCacheCreateWithFile(const char *filename
,
171 extern _ppd_cache_t
*_ppdCacheCreateWithPPD(ppd_file_t
*ppd
);
172 extern void _ppdCacheDestroy(_ppd_cache_t
*pc
);
173 extern const char *_ppdCacheGetBin(_ppd_cache_t
*pc
,
174 const char *output_bin
);
175 extern int _ppdCacheGetFinishingOptions(_ppd_cache_t
*pc
,
177 ipp_finishings_t value
,
179 cups_option_t
**options
);
180 extern int _ppdCacheGetFinishingValues(_ppd_cache_t
*pc
,
182 cups_option_t
*options
,
185 extern const char *_ppdCacheGetInputSlot(_ppd_cache_t
*pc
, ipp_t
*job
,
186 const char *keyword
);
187 extern const char *_ppdCacheGetMediaType(_ppd_cache_t
*pc
, ipp_t
*job
,
188 const char *keyword
);
189 extern const char *_ppdCacheGetOutputBin(_ppd_cache_t
*pc
,
190 const char *keyword
);
191 extern const char *_ppdCacheGetPageSize(_ppd_cache_t
*pc
, ipp_t
*job
,
192 const char *keyword
, int *exact
);
193 extern pwg_size_t
*_ppdCacheGetSize(_ppd_cache_t
*pc
,
194 const char *page_size
);
195 extern const char *_ppdCacheGetSource(_ppd_cache_t
*pc
,
196 const char *input_slot
);
197 extern const char *_ppdCacheGetType(_ppd_cache_t
*pc
,
198 const char *media_type
);
199 extern int _ppdCacheWriteFile(_ppd_cache_t
*pc
,
200 const char *filename
, ipp_t
*attrs
);
201 extern char *_ppdCreateFromIPP(char *buffer
, size_t bufsize
, ipp_t
*response
);
202 extern void _ppdFreeLanguages(cups_array_t
*languages
);
203 extern cups_encoding_t
_ppdGetEncoding(const char *name
);
204 extern cups_array_t
*_ppdGetLanguages(ppd_file_t
*ppd
);
205 extern _ppd_globals_t
*_ppdGlobals(void);
206 extern unsigned _ppdHashName(const char *name
);
207 extern ppd_attr_t
*_ppdLocalizedAttr(ppd_file_t
*ppd
, const char *keyword
,
208 const char *spec
, const char *ll_CC
);
209 extern char *_ppdNormalizeMakeAndModel(const char *make_and_model
,
212 extern ppd_file_t
*_ppdOpen(cups_file_t
*fp
,
213 _ppd_localization_t localization
);
214 extern ppd_file_t
*_ppdOpenFile(const char *filename
,
215 _ppd_localization_t localization
);
216 extern int _ppdParseOptions(const char *s
, int num_options
,
217 cups_option_t
**options
,
219 extern const char *_pwgInputSlotForSource(const char *media_source
,
220 char *name
, size_t namesize
);
221 extern const char *_pwgMediaTypeForType(const char *media_type
,
222 char *name
, size_t namesize
);
223 extern const char *_pwgPageSizeForMedia(pwg_media_t
*media
,
224 char *name
, size_t namesize
);
233 # endif /* __cplusplus */
234 #endif /* !_CUPS_PPD_PRIVATE_H_ */