4 * Private PPD definitions for CUPS.
6 * Copyright 2007-2010 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 */
49 * Types and structures...
52 typedef enum _ppd_parse_e
/**** Selector for _ppdParseOptions ****/
54 _PPD_PARSE_OPTIONS
, /* Parse only the options */
55 _PPD_PARSE_PROPERTIES
, /* Parse only the properties */
56 _PPD_PARSE_ALL
/* Parse everything */
59 typedef struct _ppd_cups_uiconst_s
/**** Constraint from cupsUIConstraints ****/
61 ppd_option_t
*option
; /* Constrained option */
62 ppd_choice_t
*choice
; /* Constrained choice or @code NULL@ */
63 int installable
; /* Installable option? */
64 } _ppd_cups_uiconst_t
;
66 typedef struct _ppd_cups_uiconsts_s
/**** cupsUIConstraints ****/
68 char resolver
[PPD_MAX_NAME
]; /* Resolver name */
69 int installable
, /* Constrained against any installable options? */
70 num_constraints
; /* Number of constraints */
71 _ppd_cups_uiconst_t
*constraints
; /* Constraints */
72 } _ppd_cups_uiconsts_t
;
74 typedef enum _pwg_output_mode_e
/**** PWG output-mode indices ****/
76 _PWG_OUTPUT_MODE_MONOCHROME
= 0, /* output-mode=monochrome */
77 _PWG_OUTPUT_MODE_COLOR
, /* output-mode=color */
81 typedef enum _pwg_print_quality_e
/**** PWG print-quality indices ****/
83 _PWG_PRINT_QUALITY_DRAFT
= 0, /* print-quality=3 */
84 _PWG_PRINT_QUALITY_NORMAL
, /* print-quality=4 */
85 _PWG_PRINT_QUALITY_HIGH
, /* print-quality=5 */
86 _PWG_PRINT_QUALITY_MAX
87 } _pwg_print_quality_t
;
89 typedef struct _pwg_s
/**** PWG-PPD conversion data ****/
91 int num_bins
; /* Number of output bins */
92 _pwg_map_t
*bins
; /* Output bins */
93 int num_sizes
; /* Number of media sizes */
94 _pwg_size_t
*sizes
; /* Media sizes */
95 int custom_max_width
, /* Maximum custom width in 2540ths */
96 custom_max_length
, /* Maximum custom length in 2540ths */
97 custom_min_width
, /* Minimum custom width in 2540ths */
98 custom_min_length
; /* Minimum custom length in 2540ths */
99 char *custom_max_keyword
, /* Maximum custom size PWG keyword */
100 *custom_min_keyword
, /* Minimum custom size PWG keyword */
101 custom_ppd_size
[41]; /* Custom PPD size name */
102 _pwg_size_t custom_size
; /* Custom size record */
103 char *source_option
; /* PPD option for media source */
104 int num_sources
; /* Number of media sources */
105 _pwg_map_t
*sources
; /* Media sources */
106 int num_types
; /* Number of media types */
107 _pwg_map_t
*types
; /* Media types */
108 int num_presets
[_PWG_OUTPUT_MODE_MAX
][_PWG_PRINT_QUALITY_MAX
];
109 /* Number of output-mode/print-quality options */
110 cups_option_t
*presets
[_PWG_OUTPUT_MODE_MAX
][_PWG_PRINT_QUALITY_MAX
];
111 /* output-mode/print-quality options */
112 char *sides_option
, /* PPD option for sides */
113 *sides_1sided
, /* Choice for one-sided */
114 *sides_2sided_long
, /* Choice for two-sided-long-edge */
115 *sides_2sided_short
; /* Choice for two-sided-short-edge */
123 extern void _ppdFreeLanguages(cups_array_t
*languages
);
124 extern cups_encoding_t
_ppdGetEncoding(const char *name
);
125 extern cups_array_t
*_ppdGetLanguages(ppd_file_t
*ppd
);
126 extern unsigned _ppdHashName(const char *name
);
127 extern ppd_attr_t
*_ppdLocalizedAttr(ppd_file_t
*ppd
, const char *keyword
,
128 const char *spec
, const char *ll_CC
);
129 extern char *_ppdNormalizeMakeAndModel(const char *make_and_model
,
132 extern int _ppdParseOptions(const char *s
, int num_options
,
133 cups_option_t
**options
,
135 extern _pwg_t
*_pwgCreateWithFile(const char *filename
);
136 extern _pwg_t
*_pwgCreateWithPPD(ppd_file_t
*ppd
);
137 extern void _pwgDestroy(_pwg_t
*pwg
);
138 extern const char *_pwgGetBin(_pwg_t
*pwg
, const char *output_bin
);
139 extern const char *_pwgGetInputSlot(_pwg_t
*pwg
, ipp_t
*job
,
140 const char *keyword
);
141 extern const char *_pwgGetMediaType(_pwg_t
*pwg
, ipp_t
*job
,
142 const char *keyword
);
143 extern const char *_pwgGetOutputBin(_pwg_t
*pwg
, const char *keyword
);
144 extern const char *_pwgGetPageSize(_pwg_t
*pwg
, ipp_t
*job
,
145 const char *keyword
, int *exact
);
146 extern _pwg_size_t
*_pwgGetSize(_pwg_t
*pwg
, const char *page_size
);
147 extern const char *_pwgGetSource(_pwg_t
*pwg
, const char *input_slot
);
148 extern const char *_pwgGetType(_pwg_t
*pwg
, const char *media_type
);
149 extern const char *_pwgInputSlotForSource(const char *media_source
,
150 char *name
, size_t namesize
);
151 extern const char *_pwgMediaTypeForType(const char *media_type
,
152 char *name
, size_t namesize
);
153 extern const char *_pwgPageSizeForMedia(_pwg_media_t
*media
,
154 char *name
, size_t namesize
);
155 extern int _pwgWriteFile(_pwg_t
*pwg
, const char *filename
);
164 # endif /* __cplusplus */
165 #endif /* !_CUPS_PPD_PRIVATE_H_ */