1 | /*DDK*************************************************************************/
|
---|
2 | /* */
|
---|
3 | /* COPYRIGHT Copyright (C) 1991, 2003 IBM Corporation */
|
---|
4 | /* */
|
---|
5 | /* The following IBM OS/2 source code is provided to you solely for */
|
---|
6 | /* the purpose of assisting you in your development of OS/2 device */
|
---|
7 | /* drivers. You may use this code in accordance with the IBM License */
|
---|
8 | /* Agreement provided in the IBM Developer Connection Device Driver */
|
---|
9 | /* Source Kit for OS/2. This Copyright statement may not be removed. */
|
---|
10 | /* */
|
---|
11 | /*****************************************************************************/
|
---|
12 | /****************************************************************************/
|
---|
13 | /* */
|
---|
14 | /* */
|
---|
15 | /* */
|
---|
16 | /* */
|
---|
17 | /* */
|
---|
18 | /****************************************************************************/
|
---|
19 |
|
---|
20 | /**************************************************************************
|
---|
21 | *
|
---|
22 | * SOURCE FILE NAME = PPD2BIN.H
|
---|
23 | *
|
---|
24 | * DESCRIPTIVE NAME = Header file for PPD2BIN.H
|
---|
25 | *
|
---|
26 | * VERSION = V2.0
|
---|
27 | *
|
---|
28 | * DATE 08/12/91
|
---|
29 | *
|
---|
30 | * DESCRIPTION Header file for PPD Formatter
|
---|
31 | *
|
---|
32 | *
|
---|
33 | * FUNCTIONS
|
---|
34 | *
|
---|
35 | *
|
---|
36 | * NOTES
|
---|
37 | *
|
---|
38 | *
|
---|
39 | * STRUCTURES
|
---|
40 | *
|
---|
41 | * EXTERNAL REFERENCES
|
---|
42 | *
|
---|
43 | * EXTERNAL FUNCTIONS
|
---|
44 | *
|
---|
45 | */
|
---|
46 | #pragma pack(1)
|
---|
47 | #include "uinames.h"
|
---|
48 |
|
---|
49 | #define PPB_DIR "ppd\\"
|
---|
50 | #define RC_FILE_NAME "PPBS.RC"
|
---|
51 | #define DIRECTORY_NAME "directry.ppb"
|
---|
52 | #define NAME_LEN 32
|
---|
53 |
|
---|
54 | enum symbtype
|
---|
55 | {
|
---|
56 | password, /* Password */
|
---|
57 | throughput, /* Throughput */
|
---|
58 | freevm, /* FreeVM */
|
---|
59 | productname, /* Product */
|
---|
60 | shortnickname, /* ShortNickName */
|
---|
61 | printername, /* NickName */
|
---|
62 | // setresolution, /* SetResolution */
|
---|
63 | defaultres, /* DefaultResolution */
|
---|
64 | defaultJCLRes, /* DefaultJCLResoultion */
|
---|
65 | screenfreq, /* ScreenFreq */
|
---|
66 | // defaultpsize, /* DefaultPageSize */
|
---|
67 | defaultfont, /* DefaultFont */
|
---|
68 | // pagenamelist, /* PageSize */
|
---|
69 | pagesizelist, /* PaperDimension */
|
---|
70 | imageablearea, /* ImageableArea */
|
---|
71 | // inputbinlist, /* InputSlot */
|
---|
72 | /*
|
---|
73 | ** This is not used in the compiler.
|
---|
74 | */
|
---|
75 | // outputbinlist, /* OutputBin */
|
---|
76 | fontnamelist, /* Font*/
|
---|
77 | colordevice, /* ColorDevice */
|
---|
78 | filesystem, /* FileSystem */
|
---|
79 | exitserver, /* ExitServer */
|
---|
80 | reset, /* Reset*/
|
---|
81 | variablepaper, /* VariablePaperSize */
|
---|
82 | screenangle, /* ScreenAngle */
|
---|
83 | // defpageregion, /* DefaultPageRegion */
|
---|
84 | // pageregion, /* PageRegion */
|
---|
85 | defpapertray, /* DefaultPaperTray */
|
---|
86 | defimagearea, /* DefaultImageableArea */
|
---|
87 | defpaperdim, /* DefaultPaperDimension */
|
---|
88 | /*
|
---|
89 | ** This is not used in the compiler.
|
---|
90 | */
|
---|
91 | // defoutputbin, /* DefaultOutputBin */
|
---|
92 | // definputslot, /* DefaultInputSlot */
|
---|
93 | // defmanualfeed, /* DefaultManualFeed */
|
---|
94 | // manualfeed, /* ManualFeed */
|
---|
95 | defoutputorder, /* DefaultOutputOrder */
|
---|
96 | outputorder, /* OutputOrder */
|
---|
97 | transfernor, /* Transfer Normalized */
|
---|
98 | transferinv, /* Transfer Normalized.Inverse */
|
---|
99 | initstring, /* InitPostScriptMode */
|
---|
100 | termstring, /* TermPostScriptMode */
|
---|
101 | // SetJobResolution, /* SetJobResolution */
|
---|
102 | LanguageLevel, /* LanguageLevel */
|
---|
103 | JCLBegin, /* JCLBegin */
|
---|
104 | JCLToPSInterpreter, /* JCLToPSInterpreter */
|
---|
105 | JCLEnd, /* JCLEnd */
|
---|
106 | // Resolution, /* Resolution */
|
---|
107 | // JCLResolution,
|
---|
108 | OpenUI,
|
---|
109 | PCFileName,
|
---|
110 | OpenGroup,
|
---|
111 | CloseGroup,
|
---|
112 | UIConstraints,
|
---|
113 | JCLOpenUI,
|
---|
114 | CustomPageSize,
|
---|
115 | ParamCustomPageSize,
|
---|
116 | maximum
|
---|
117 | } ;
|
---|
118 |
|
---|
119 | typedef enum symbtype Symbtype;
|
---|
120 |
|
---|
121 | char *szSearch[maximum] =
|
---|
122 | {
|
---|
123 | "*Password",
|
---|
124 | "*Throughput",
|
---|
125 | "*FreeVM",
|
---|
126 | "*Product",
|
---|
127 | "*ShortNickName",
|
---|
128 | "*NickName",
|
---|
129 | // "*SetResolution",
|
---|
130 | "*DefaultResolution",
|
---|
131 | "*DefaultJCLResolution",
|
---|
132 | "*ScreenFreq",
|
---|
133 | // "*DefaultPageSize",
|
---|
134 | "*DefaultFont",
|
---|
135 | // "*PageSize",
|
---|
136 | "*PaperDimension",
|
---|
137 | "*ImageableArea",
|
---|
138 | // "*InputSlot",
|
---|
139 | /*
|
---|
140 | ** This is not used in the compiler.
|
---|
141 | */
|
---|
142 | // "*OutputBin",
|
---|
143 | "*Font",
|
---|
144 | "*ColorDevice",
|
---|
145 | "*FileSystem",
|
---|
146 | "*ExitServer",
|
---|
147 | "*Reset",
|
---|
148 | "*VariablePaperSize",
|
---|
149 | "*ScreenAngle",
|
---|
150 | // "*DefaultPageRegion",
|
---|
151 | // "*PageRegion",
|
---|
152 | "*DefaultPaperTray",
|
---|
153 | "*DefaultImageableArea",
|
---|
154 | "*DefaultPaperDimension",
|
---|
155 | /*
|
---|
156 | ** This is not used in the compiler.
|
---|
157 | */
|
---|
158 | // "*DefaultOutputBin",
|
---|
159 | // "*DefaultInputSlot",
|
---|
160 | // "*DefaultManualFeed",
|
---|
161 | // "*ManualFeed",
|
---|
162 | "*DefaultOutputOrder",
|
---|
163 | "*OutputOrder",
|
---|
164 | "*Transfer Normalized",
|
---|
165 | "*Transfer Normalized.Inverse",
|
---|
166 | "*InitPostScriptMode",
|
---|
167 | "*TermPostScriptMode",
|
---|
168 | // "*SetJobResolution",
|
---|
169 | "*LanguageLevel",
|
---|
170 | "*JCLBegin",
|
---|
171 | "*JCLToPSInterpreter",
|
---|
172 | "*JCLEnd",
|
---|
173 | // "*Resolution",
|
---|
174 | // "*JCLResolution",
|
---|
175 | "*OpenUI",
|
---|
176 | "*PCFileName",
|
---|
177 | "*OpenGroup",
|
---|
178 | "*CloseGroup",
|
---|
179 | "*UIConstraints",
|
---|
180 | "*JCLOpenUI",
|
---|
181 | "*CustomPageSize",
|
---|
182 | "*ParamCustomPageSize"
|
---|
183 | } ;
|
---|
184 |
|
---|
185 | /*
|
---|
186 | ** This structure makes up the list of pre-defined UI's. A predefined UI
|
---|
187 | ** is a UI that is displayed in Job/Printer Properties, on a page other
|
---|
188 | ** than the "Features" page and on any OEM pages.
|
---|
189 | ** An example is "MediaType". Although MediaType is a UI, it is used in
|
---|
190 | ** the "Forms" page in Job Properties, and it is not listed in the "Features"
|
---|
191 | ** page.
|
---|
192 | **
|
---|
193 | ** By defining the string here, a flag is inserted in the UI block so that
|
---|
194 | ** when the UI list is displayed in "Features", the flag causes the Features
|
---|
195 | ** code to skip over the current UI block.
|
---|
196 | **
|
---|
197 | ** IMPORTANT
|
---|
198 | ** The strings in this structure should not be defined anywhere else above.
|
---|
199 | ** Otherwise, the string will not be identified as a UI and the process will
|
---|
200 | ** never reach the code that accesses this structure.
|
---|
201 | */
|
---|
202 | #define MAX_PREDEFINED 11
|
---|
203 |
|
---|
204 | /*
|
---|
205 | ** The IBM 4019 requires that "ManualFeed" Postscript preceed
|
---|
206 | ** "InputSlot". In order for that to work, UINAME_MANUALFEED must
|
---|
207 | ** preceed UINAME_INPUTSLOT.
|
---|
208 | */
|
---|
209 | char *szPredefined[ MAX_PREDEFINED ] =
|
---|
210 | {
|
---|
211 | UINAME_COLORMODEL,
|
---|
212 | UINAME_DUPLEX,
|
---|
213 | UINAME_JCLRESOLUTION,
|
---|
214 | UINAME_MANUALFEED,
|
---|
215 | UINAME_INPUTSLOT,
|
---|
216 | UINAME_MEDIATYPE,
|
---|
217 | UINAME_PAGEREGION,
|
---|
218 | UINAME_PAGESIZE,
|
---|
219 | UINAME_RESOLUTION,
|
---|
220 | "SetResolution",
|
---|
221 | UINAME_COLLATE
|
---|
222 | } ;
|
---|
223 |
|
---|
224 | // Structure to define Keywords to search and replace during PPD parsing
|
---|
225 | typedef struct _SR_KEYWORDS
|
---|
226 | {
|
---|
227 | char *szSearch; // Keywoard to search
|
---|
228 | char *szReplace; // Keywoard to replace
|
---|
229 | } SR_KEYWORDS, *PSR_KEYWORDS;
|
---|
230 |
|
---|
231 | SR_KEYWORDS SRKeywords[]={
|
---|
232 | { UINAME_HPCOLLATE, UINAME_COLLATE },
|
---|
233 | { UINAME_XRXZCOLLATE, UINAME_COLLATE },
|
---|
234 | { UINAME_TKCOLLATE, UINAME_COLLATE },
|
---|
235 | { UINAME_JCLCOLLATE, UINAME_COLLATE },
|
---|
236 | { UINAME_MICOLLATE, UINAME_COLLATE },
|
---|
237 | { UINAME_EFCOLLATE, UINAME_COLLATE },
|
---|
238 | { "XRXAMediaType", UINAME_MEDIATYPE },
|
---|
239 | { "JCLMediaType", UINAME_MEDIATYPE },
|
---|
240 | { "CNMediaType", UINAME_MEDIATYPE },
|
---|
241 | { 0, 0 }
|
---|
242 | } ;
|
---|
243 |
|
---|
244 | /*** Predefined Medias in Kyoceras printers
|
---|
245 | */
|
---|
246 | /*
|
---|
247 | #define MAX_PREDEF_MEDIA 28 //HP5500, HP46005
|
---|
248 | char *szPredefMedia[ MAX_PREDEF_MEDIA ]=
|
---|
249 | {
|
---|
250 | "None", //HP5500, HP4600
|
---|
251 | "Plain",
|
---|
252 | "Transparency",
|
---|
253 | "Labels",
|
---|
254 | "Letterhead",
|
---|
255 | "Bond",
|
---|
256 | "Color",
|
---|
257 | "Preprinted",
|
---|
258 | "Prepunched",
|
---|
259 | "Recycled",
|
---|
260 | "Rough",
|
---|
261 | "Cardstock",
|
---|
262 | "Vellum",
|
---|
263 | "User",
|
---|
264 | "Duplex",
|
---|
265 | "CoatedPaper",
|
---|
266 | };
|
---|
267 | */
|
---|
268 | /*
|
---|
269 | ** Add 'err_maxPPDs' to verify that the number of PPD's in the
|
---|
270 | ** list does not exceed the maximum limit of the compiler.
|
---|
271 | */
|
---|
272 | enum errtype
|
---|
273 | {
|
---|
274 | err_ver,
|
---|
275 | err_usage,
|
---|
276 | err_option,
|
---|
277 | err_arg,
|
---|
278 | err_cantopen,
|
---|
279 | err_cantcreate,
|
---|
280 | err_badoutput,
|
---|
281 | err_eof,
|
---|
282 | err_eofin,
|
---|
283 | err_badnum,
|
---|
284 | err_badreal,
|
---|
285 | err_expected,
|
---|
286 | err_missingsemi,
|
---|
287 | err_expectedname,
|
---|
288 | err_output,
|
---|
289 | err_overflow,
|
---|
290 | err_seek,
|
---|
291 | err_output1,
|
---|
292 | err_output2,
|
---|
293 | err_maxPPDs,
|
---|
294 | err_max
|
---|
295 | } ;
|
---|
296 |
|
---|
297 | typedef enum errtype ErrType;
|
---|
298 |
|
---|
299 | /*
|
---|
300 | ** Added the string:
|
---|
301 | ** "number of PPDs exceed maximum limit"
|
---|
302 | ** to verify that the number of PPD's in the
|
---|
303 | ** list does not exceed the maximum limit of the compiler.
|
---|
304 | */
|
---|
305 | char *szErrmsgs[err_max] =
|
---|
306 | {
|
---|
307 | "IBM (R) Ppd File Compiler Version 1.00\nCopyright (c) IBM Corp 1995. All rights reserved.\n",
|
---|
308 | "Usage: ppd2bin -i <ppd file list> -o <outputfile> -g <genericfile> <-e#> <-w>"
|
---|
309 | "unknown option",
|
---|
310 | "unknown argument",
|
---|
311 | "cannot open",
|
---|
312 | "cannot create",
|
---|
313 | "cannot write to input file",
|
---|
314 | "unexpected eof",
|
---|
315 | "unexpected eof in",
|
---|
316 | "invalid number",
|
---|
317 | "invalid real number",
|
---|
318 | "expected",
|
---|
319 | "missing semicolon",
|
---|
320 | "expected name field",
|
---|
321 | "error in writing to output file",
|
---|
322 | "output buffer overflow",
|
---|
323 | "error in seek ",
|
---|
324 | "error in items output",
|
---|
325 | "error in signature output",
|
---|
326 | "number of PPDs exceed maximum limit"
|
---|
327 | } ;
|
---|