4 * Private PPD definitions for CUPS.
6 * Copyright 2007-2011 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 1 /* Version number in cache file */
56 * Types and structures...
59 typedef enum _ppd_parse_e
/**** Selector for _ppdParseOptions ****/
61 _PPD_PARSE_OPTIONS
, /* Parse only the options */
62 _PPD_PARSE_PROPERTIES
, /* Parse only the properties */
63 _PPD_PARSE_ALL
/* Parse everything */
66 typedef struct _ppd_cups_uiconst_s
/**** Constraint from cupsUIConstraints ****/
68 ppd_option_t
*option
; /* Constrained option */
69 ppd_choice_t
*choice
; /* Constrained choice or @code NULL@ */
70 int installable
; /* Installable option? */
71 } _ppd_cups_uiconst_t
;
73 typedef struct _ppd_cups_uiconsts_s
/**** cupsUIConstraints ****/
75 char resolver
[PPD_MAX_NAME
]; /* Resolver name */
76 int installable
, /* Constrained against any installable options? */
77 num_constraints
; /* Number of constraints */
78 _ppd_cups_uiconst_t
*constraints
; /* Constraints */
79 } _ppd_cups_uiconsts_t
;
81 typedef enum _pwg_print_color_mode_e
/**** PWG print-color-mode indices ****/
83 _PWG_PRINT_COLOR_MODE_MONOCHROME
= 0, /* print-color-mode=monochrome */
84 _PWG_PRINT_COLOR_MODE_COLOR
, /* print-color-mode=color */
85 /* Other proposed values are not supported by CUPS yet. */
86 _PWG_PRINT_COLOR_MODE_MAX
87 } _pwg_print_color_mode_t
;
89 typedef enum _pwg_print_quality_e
/**** PWG print-quality indices ****/
91 _PWG_PRINT_QUALITY_DRAFT
= 0, /* print-quality=3 */
92 _PWG_PRINT_QUALITY_NORMAL
, /* print-quality=4 */
93 _PWG_PRINT_QUALITY_HIGH
, /* print-quality=5 */
94 _PWG_PRINT_QUALITY_MAX
95 } _pwg_print_quality_t
;
97 struct _ppd_cache_s
/**** PPD cache and PWG conversion data ****/
99 int num_bins
; /* Number of output bins */
100 _pwg_map_t
*bins
; /* Output bins */
101 int num_sizes
; /* Number of media sizes */
102 _pwg_size_t
*sizes
; /* Media sizes */
103 int custom_max_width
, /* Maximum custom width in 2540ths */
104 custom_max_length
, /* Maximum custom length in 2540ths */
105 custom_min_width
, /* Minimum custom width in 2540ths */
106 custom_min_length
; /* Minimum custom length in 2540ths */
107 char *custom_max_keyword
, /* Maximum custom size PWG keyword */
108 *custom_min_keyword
, /* Minimum custom size PWG keyword */
109 custom_ppd_size
[41]; /* Custom PPD size name */
110 _pwg_size_t custom_size
; /* Custom size record */
111 char *source_option
; /* PPD option for media source */
112 int num_sources
; /* Number of media sources */
113 _pwg_map_t
*sources
; /* Media sources */
114 int num_types
; /* Number of media types */
115 _pwg_map_t
*types
; /* Media types */
116 int num_presets
[_PWG_PRINT_COLOR_MODE_MAX
][_PWG_PRINT_QUALITY_MAX
];
117 /* Number of print-color-mode/print-quality options */
118 cups_option_t
*presets
[_PWG_PRINT_COLOR_MODE_MAX
][_PWG_PRINT_QUALITY_MAX
];
119 /* print-color-mode/print-quality options */
120 char *sides_option
, /* PPD option for sides */
121 *sides_1sided
, /* Choice for one-sided */
122 *sides_2sided_long
, /* Choice for two-sided-long-edge */
123 *sides_2sided_short
; /* Choice for two-sided-short-edge */
124 char *product
; /* Product value */
125 cups_array_t
*filters
, /* cupsFilter/cupsFilter2 values */
126 *prefilters
; /* cupsPreFilter values */
127 int single_file
; /* cupsSingleFile value */
135 extern _ppd_cache_t
*_ppdCacheCreateWithFile(const char *filename
,
137 extern _ppd_cache_t
*_ppdCacheCreateWithPPD(ppd_file_t
*ppd
);
138 extern void _ppdCacheDestroy(_ppd_cache_t
*pc
);
139 extern const char *_ppdCacheGetBin(_ppd_cache_t
*pc
,
140 const char *output_bin
);
141 extern const char *_ppdCacheGetInputSlot(_ppd_cache_t
*pc
, ipp_t
*job
,
142 const char *keyword
);
143 extern const char *_ppdCacheGetMediaType(_ppd_cache_t
*pc
, ipp_t
*job
,
144 const char *keyword
);
145 extern const char *_ppdCacheGetOutputBin(_ppd_cache_t
*pc
,
146 const char *keyword
);
147 extern const char *_ppdCacheGetPageSize(_ppd_cache_t
*pc
, ipp_t
*job
,
148 const char *keyword
, int *exact
);
149 extern _pwg_size_t
*_ppdCacheGetSize(_ppd_cache_t
*pc
,
150 const char *page_size
);
151 extern const char *_ppdCacheGetSource(_ppd_cache_t
*pc
,
152 const char *input_slot
);
153 extern const char *_ppdCacheGetType(_ppd_cache_t
*pc
,
154 const char *media_type
);
155 extern int _ppdCacheWriteFile(_ppd_cache_t
*pc
,
156 const char *filename
, ipp_t
*attrs
);
157 extern void _ppdFreeLanguages(cups_array_t
*languages
);
158 extern cups_encoding_t
_ppdGetEncoding(const char *name
);
159 extern cups_array_t
*_ppdGetLanguages(ppd_file_t
*ppd
);
160 extern unsigned _ppdHashName(const char *name
);
161 extern ppd_attr_t
*_ppdLocalizedAttr(ppd_file_t
*ppd
, const char *keyword
,
162 const char *spec
, const char *ll_CC
);
163 extern char *_ppdNormalizeMakeAndModel(const char *make_and_model
,
166 extern int _ppdParseOptions(const char *s
, int num_options
,
167 cups_option_t
**options
,
169 extern const char *_pwgInputSlotForSource(const char *media_source
,
170 char *name
, size_t namesize
);
171 extern const char *_pwgMediaTypeForType(const char *media_type
,
172 char *name
, size_t namesize
);
173 extern const char *_pwgPageSizeForMedia(_pwg_media_t
*media
,
174 char *name
, size_t namesize
);
183 # endif /* __cplusplus */
184 #endif /* !_CUPS_PPD_PRIVATE_H_ */