]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/ppd-private.h
Merge changes from CUPS 1.6svn-r10127.
[thirdparty/cups.git] / cups / ppd-private.h
1 /*
2 * "$Id$"
3 *
4 * Private PPD definitions for CUPS.
5 *
6 * Copyright 2007-2011 by Apple Inc.
7 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
8 *
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/".
14 *
15 * PostScript is a trademark of Adobe Systems, Inc.
16 *
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
22 * agreement.
23 *
24 * This file is subject to the Apple OS-Developed Software exception.
25 */
26
27 #ifndef _CUPS_PPD_PRIVATE_H_
28 # define _CUPS_PPD_PRIVATE_H_
29
30 /*
31 * Include necessary headers...
32 */
33
34 # include <cups/cups.h>
35 # include <cups/ppd.h>
36 # include "pwg-private.h"
37
38
39 /*
40 * C++ magic...
41 */
42
43 # ifdef __cplusplus
44 extern "C" {
45 # endif /* __cplusplus */
46
47
48 /*
49 * Constants...
50 */
51
52 # define _PPD_CACHE_VERSION 1 /* Version number in cache file */
53
54
55 /*
56 * Types and structures...
57 */
58
59 typedef enum _ppd_localization_e /**** Selector for _ppdOpen ****/
60 {
61 _PPD_LOCALIZATION_DEFAULT, /* Load only the default localization */
62 _PPD_LOCALIZATION_ICC_PROFILES, /* Load only the color profile localization */
63 _PPD_LOCALIZATION_NONE, /* Load no localizations */
64 _PPD_LOCALIZATION_ALL /* Load all localizations */
65 } _ppd_localization_t;
66
67 typedef enum _ppd_parse_e /**** Selector for _ppdParseOptions ****/
68 {
69 _PPD_PARSE_OPTIONS, /* Parse only the options */
70 _PPD_PARSE_PROPERTIES, /* Parse only the properties */
71 _PPD_PARSE_ALL /* Parse everything */
72 } _ppd_parse_t;
73
74 typedef struct _ppd_cups_uiconst_s /**** Constraint from cupsUIConstraints ****/
75 {
76 ppd_option_t *option; /* Constrained option */
77 ppd_choice_t *choice; /* Constrained choice or @code NULL@ */
78 int installable; /* Installable option? */
79 } _ppd_cups_uiconst_t;
80
81 typedef struct _ppd_cups_uiconsts_s /**** cupsUIConstraints ****/
82 {
83 char resolver[PPD_MAX_NAME]; /* Resolver name */
84 int installable, /* Constrained against any installable options? */
85 num_constraints; /* Number of constraints */
86 _ppd_cups_uiconst_t *constraints; /* Constraints */
87 } _ppd_cups_uiconsts_t;
88
89 typedef enum _pwg_print_color_mode_e /**** PWG print-color-mode indices ****/
90 {
91 _PWG_PRINT_COLOR_MODE_MONOCHROME = 0, /* print-color-mode=monochrome */
92 _PWG_PRINT_COLOR_MODE_COLOR, /* print-color-mode=color */
93 /* Other proposed values are not supported by CUPS yet. */
94 _PWG_PRINT_COLOR_MODE_MAX
95 } _pwg_print_color_mode_t;
96
97 typedef enum _pwg_print_quality_e /**** PWG print-quality indices ****/
98 {
99 _PWG_PRINT_QUALITY_DRAFT = 0, /* print-quality=3 */
100 _PWG_PRINT_QUALITY_NORMAL, /* print-quality=4 */
101 _PWG_PRINT_QUALITY_HIGH, /* print-quality=5 */
102 _PWG_PRINT_QUALITY_MAX
103 } _pwg_print_quality_t;
104
105 struct _ppd_cache_s /**** PPD cache and PWG conversion data ****/
106 {
107 int num_bins; /* Number of output bins */
108 _pwg_map_t *bins; /* Output bins */
109 int num_sizes; /* Number of media sizes */
110 _pwg_size_t *sizes; /* Media sizes */
111 int custom_max_width, /* Maximum custom width in 2540ths */
112 custom_max_length, /* Maximum custom length in 2540ths */
113 custom_min_width, /* Minimum custom width in 2540ths */
114 custom_min_length; /* Minimum custom length in 2540ths */
115 char *custom_max_keyword, /* Maximum custom size PWG keyword */
116 *custom_min_keyword, /* Minimum custom size PWG keyword */
117 custom_ppd_size[41]; /* Custom PPD size name */
118 _pwg_size_t custom_size; /* Custom size record */
119 char *source_option; /* PPD option for media source */
120 int num_sources; /* Number of media sources */
121 _pwg_map_t *sources; /* Media sources */
122 int num_types; /* Number of media types */
123 _pwg_map_t *types; /* Media types */
124 int num_presets[_PWG_PRINT_COLOR_MODE_MAX][_PWG_PRINT_QUALITY_MAX];
125 /* Number of print-color-mode/print-quality options */
126 cups_option_t *presets[_PWG_PRINT_COLOR_MODE_MAX][_PWG_PRINT_QUALITY_MAX];
127 /* print-color-mode/print-quality options */
128 char *sides_option, /* PPD option for sides */
129 *sides_1sided, /* Choice for one-sided */
130 *sides_2sided_long, /* Choice for two-sided-long-edge */
131 *sides_2sided_short; /* Choice for two-sided-short-edge */
132 char *product; /* Product value */
133 cups_array_t *filters, /* cupsFilter/cupsFilter2 values */
134 *prefilters; /* cupsPreFilter values */
135 int single_file; /* cupsSingleFile value */
136 };
137
138
139 /*
140 * Prototypes...
141 */
142
143 extern _ppd_cache_t *_ppdCacheCreateWithFile(const char *filename,
144 ipp_t **attrs);
145 extern _ppd_cache_t *_ppdCacheCreateWithPPD(ppd_file_t *ppd);
146 extern void _ppdCacheDestroy(_ppd_cache_t *pc);
147 extern const char *_ppdCacheGetBin(_ppd_cache_t *pc,
148 const char *output_bin);
149 extern const char *_ppdCacheGetInputSlot(_ppd_cache_t *pc, ipp_t *job,
150 const char *keyword);
151 extern const char *_ppdCacheGetMediaType(_ppd_cache_t *pc, ipp_t *job,
152 const char *keyword);
153 extern const char *_ppdCacheGetOutputBin(_ppd_cache_t *pc,
154 const char *keyword);
155 extern const char *_ppdCacheGetPageSize(_ppd_cache_t *pc, ipp_t *job,
156 const char *keyword, int *exact);
157 extern _pwg_size_t *_ppdCacheGetSize(_ppd_cache_t *pc,
158 const char *page_size);
159 extern const char *_ppdCacheGetSource(_ppd_cache_t *pc,
160 const char *input_slot);
161 extern const char *_ppdCacheGetType(_ppd_cache_t *pc,
162 const char *media_type);
163 extern int _ppdCacheWriteFile(_ppd_cache_t *pc,
164 const char *filename, ipp_t *attrs);
165 extern void _ppdFreeLanguages(cups_array_t *languages);
166 extern cups_encoding_t _ppdGetEncoding(const char *name);
167 extern cups_array_t *_ppdGetLanguages(ppd_file_t *ppd);
168 extern unsigned _ppdHashName(const char *name);
169 extern ppd_attr_t *_ppdLocalizedAttr(ppd_file_t *ppd, const char *keyword,
170 const char *spec, const char *ll_CC);
171 extern char *_ppdNormalizeMakeAndModel(const char *make_and_model,
172 char *buffer,
173 size_t bufsize);
174 extern ppd_file_t *_ppdOpen(cups_file_t *fp,
175 _ppd_localization_t localization);
176 extern ppd_file_t *_ppdOpenFile(const char *filename,
177 _ppd_localization_t localization);
178 extern int _ppdParseOptions(const char *s, int num_options,
179 cups_option_t **options,
180 _ppd_parse_t which);
181 extern const char *_pwgInputSlotForSource(const char *media_source,
182 char *name, size_t namesize);
183 extern const char *_pwgMediaTypeForType(const char *media_type,
184 char *name, size_t namesize);
185 extern const char *_pwgPageSizeForMedia(_pwg_media_t *media,
186 char *name, size_t namesize);
187
188
189 /*
190 * C++ magic...
191 */
192
193 # ifdef __cplusplus
194 }
195 # endif /* __cplusplus */
196 #endif /* !_CUPS_PPD_PRIVATE_H_ */
197
198 /*
199 * End of "$Id$".
200 */