1 /* PostScript Printer Description (PPD) file parser
3 * See http://www.adobe.com/supportservice/devrelations/PDFS/TN/5003.PPD_Spec_v4.3.pdf
5 * Copyright 1998 Huw D M Davies
11 #include "winnt.h" /* HEAP_ZERO_MEMORY */
12 #include "debugtools.h"
16 DEFAULT_DEBUG_CHANNEL(psdrv
);
27 /* map of page names in ppd file to Windows paper constants */
33 {"10x11", DMPAPER_10X11
},
34 {"10x14", DMPAPER_10X14
},
35 {"11x17", DMPAPER_11X17
}, /* not in Adobe PPD file spec */
36 {"12x11", DMPAPER_12X11
},
37 {"15x11", DMPAPER_15X11
},
38 {"9x11", DMPAPER_9X11
},
41 {"A3.Transverse", DMPAPER_A3_TRANSVERSE
},
42 {"A3Extra", DMPAPER_A3_EXTRA
},
43 {"A3Extra.Transverse", DMPAPER_A3_EXTRA_TRANSVERSE
},
44 {"A3Rotated", DMPAPER_A3_ROTATED
},
46 {"A4.Transverse", DMPAPER_A4_TRANSVERSE
},
47 {"A4Extra", DMPAPER_A4_EXTRA
},
48 {"A4Plus", DMPAPER_A4_PLUS
},
49 {"A4Rotated", DMPAPER_A4_ROTATED
},
50 {"A4Small", DMPAPER_A4SMALL
},
52 {"A5.Transverse", DMPAPER_A5_TRANSVERSE
},
53 {"A5Extra", DMPAPER_A5_EXTRA
},
54 {"A5Rotated", DMPAPER_A5_ROTATED
},
56 {"A6Rotated", DMPAPER_A6_ROTATED
},
57 {"ARCHC", DMPAPER_CSHEET
},
58 {"ARCHD", DMPAPER_DSHEET
},
59 {"ARCHE", DMPAPER_ESHEET
},
61 {"B4Rotated", DMPAPER_B4_JIS_ROTATED
},
63 {"B5.Transverse", DMPAPER_B5_TRANSVERSE
},
64 {"B5Rotated", DMPAPER_B5_JIS_ROTATED
},
65 {"B6", DMPAPER_B6_JIS
},
66 {"B6Rotated", DMPAPER_B6_JIS_ROTATED
},
67 {"C4", DMPAPER_ENV_C4
}, /* use EnvC4 */
68 {"C5", DMPAPER_ENV_C5
}, /* use EnvC5 */
69 {"C6", DMPAPER_ENV_C6
}, /* use EnvC6 */
70 {"Comm10", DMPAPER_ENV_10
}, /* use Env10 */
71 {"DL", DMPAPER_ENV_DL
}, /* use EnvDL */
72 {"DoublePostcard", DMPAPER_DBL_JAPANESE_POSTCARD
},
73 {"DoublePostcardRotated", DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED
},
74 {"Env10", DMPAPER_ENV_10
},
75 {"Env11", DMPAPER_ENV_11
},
76 {"Env12", DMPAPER_ENV_12
},
77 {"Env14", DMPAPER_ENV_14
},
78 {"Env9", DMPAPER_ENV_9
},
79 {"EnvC3", DMPAPER_ENV_C3
},
80 {"EnvC4", DMPAPER_ENV_C4
},
81 {"EnvC5", DMPAPER_ENV_C5
},
82 {"EnvC6", DMPAPER_ENV_C6
},
83 {"EnvC65", DMPAPER_ENV_C65
},
84 {"EnvChou3", DMPAPER_JENV_CHOU3
},
85 {"EnvChou3Rotated", DMPAPER_JENV_CHOU3_ROTATED
},
86 {"EnvChou4", DMPAPER_JENV_CHOU4
},
87 {"EnvChou4Rotated", DMPAPER_JENV_CHOU4_ROTATED
},
88 {"EnvDL", DMPAPER_ENV_DL
},
89 {"EnvISOB4", DMPAPER_ENV_B4
},
90 {"EnvISOB5", DMPAPER_ENV_B5
},
91 {"EnvISOB6", DMPAPER_ENV_B6
},
92 {"EnvInvite", DMPAPER_ENV_INVITE
},
93 {"EnvItalian", DMPAPER_ENV_ITALY
},
94 {"EnvKaku2", DMPAPER_JENV_KAKU2
},
95 {"EnvKaku2Rotated", DMPAPER_JENV_KAKU2_ROTATED
},
96 {"EnvKaku3", DMPAPER_JENV_KAKU3
},
97 {"EnvKaku3Rotated", DMPAPER_JENV_KAKU3_ROTATED
},
98 {"EnvMonarch", DMPAPER_ENV_MONARCH
},
99 {"EnvPRC1", DMPAPER_PENV_1
},
100 {"EnvPRC10", DMPAPER_PENV_10
},
101 {"EnvPRC10Rotated", DMPAPER_PENV_10_ROTATED
},
102 {"EnvPRC1Rotated", DMPAPER_PENV_1_ROTATED
},
103 {"EnvPRC2", DMPAPER_PENV_2
},
104 {"EnvPRC2Rotated", DMPAPER_PENV_2_ROTATED
},
105 {"EnvPRC3", DMPAPER_PENV_3
},
106 {"EnvPRC3Rotated", DMPAPER_PENV_3_ROTATED
},
107 {"EnvPRC4", DMPAPER_PENV_4
},
108 {"EnvPRC4Rotated", DMPAPER_PENV_4_ROTATED
},
109 {"EnvPRC5", DMPAPER_PENV_5
},
110 {"EnvPRC5Rotated", DMPAPER_PENV_5_ROTATED
},
111 {"EnvPRC6", DMPAPER_PENV_6
},
112 {"EnvPRC6Rotated", DMPAPER_PENV_6_ROTATED
},
113 {"EnvPRC7", DMPAPER_PENV_7
},
114 {"EnvPRC7Rotated", DMPAPER_PENV_7_ROTATED
},
115 {"EnvPRC8", DMPAPER_PENV_8
},
116 {"EnvPRC8Rotated", DMPAPER_PENV_8_ROTATED
},
117 {"EnvPRC9", DMPAPER_PENV_9
},
118 {"EnvPRC9Rotated", DMPAPER_PENV_9_ROTATED
},
119 {"EnvPersonal", DMPAPER_ENV_PERSONAL
},
120 {"EnvYou4", DMPAPER_JENV_YOU4
},
121 {"EnvYou4Rotated", DMPAPER_JENV_YOU4_ROTATED
},
122 {"Executive", DMPAPER_EXECUTIVE
},
123 {"FanFoldGerman", DMPAPER_FANFOLD_STD_GERMAN
},
124 {"FanFoldGermanLegal", DMPAPER_FANFOLD_LGL_GERMAN
},
125 {"FanFoldUS", DMPAPER_FANFOLD_US
},
126 {"Folio", DMPAPER_FOLIO
},
127 {"ISOB4", DMPAPER_ISO_B4
},
128 {"ISOB5Extra", DMPAPER_B5_EXTRA
},
129 {"Ledger", DMPAPER_LEDGER
},
130 {"Legal", DMPAPER_LEGAL
},
131 {"LegalExtra", DMPAPER_LEGAL_EXTRA
},
132 {"Letter", DMPAPER_LETTER
},
133 {"Letter.Transverse", DMPAPER_LETTER_TRANSVERSE
},
134 {"LetterExtra", DMPAPER_LETTER_EXTRA
},
135 {"LetterExtra.Transverse", DMPAPER_LETTER_EXTRA_TRANSVERSE
},
136 {"LetterPlus", DMPAPER_LETTER_PLUS
},
137 {"LetterRotated", DMPAPER_LETTER_ROTATED
},
138 {"LetterSmall", DMPAPER_LETTERSMALL
},
139 {"Monarch", DMPAPER_ENV_MONARCH
}, /* use EnvMonarch */
140 {"Note", DMPAPER_NOTE
},
141 {"PRC16K", DMPAPER_P16K
},
142 {"PRC16KRotated", DMPAPER_P16K_ROTATED
},
143 {"PRC32K", DMPAPER_P32K
},
144 {"PRC32KBig", DMPAPER_P32KBIG
},
145 {"PRC32KBigRotated", DMPAPER_P32KBIG_ROTATED
},
146 {"PRC32KRotated", DMPAPER_P32K_ROTATED
},
147 {"Postcard", DMPAPER_JAPANESE_POSTCARD
},
148 {"PostcardRotated", DMPAPER_JAPANESE_POSTCARD_ROTATED
},
149 {"Quarto", DMPAPER_QUARTO
},
150 {"Statement", DMPAPER_STATEMENT
},
151 {"SuperA", DMPAPER_A_PLUS
},
152 {"SuperB", DMPAPER_B_PLUS
},
153 {"Tabloid", DMPAPER_TABLOID
},
154 {"TabloidExtra", DMPAPER_TABLOID_EXTRA
},
158 static WORD UserPageType
= DMPAPER_USER
;
159 static WORD UserBinType
= DMBIN_USER
;
161 /***********************************************************************
165 * Copies str into a newly allocated string from the process heap subsituting
166 * hex strings enclosed in '<' and '>' for their byte codes.
169 static char *PSDRV_PPDDecodeHex(char *str
)
171 char *buf
, *in
, *out
;
174 buf
= HeapAlloc(PSDRV_Heap
, 0, strlen(str
) + 1);
178 for(in
= str
, out
= buf
; *in
; in
++) {
189 else if(isspace(*in
))
193 if(!isxdigit(*in
) || !isxdigit(*(in
+ 1))) {
194 ERR("Invalid hex char in hex string\n");
195 HeapFree(PSDRV_Heap
, 0, buf
);
199 for(i
= 0; i
< 2; i
++) {
200 if(isdigit(*(in
+ i
)))
201 *out
|= (*(in
+ i
) - '0') << ((1-i
) * 4);
203 *out
|= (toupper(*(in
+ i
)) - 'A' + 10) << ((1-i
) * 4);
215 /***********************************************************************
217 * PSDRV_PPDGetTransValue
220 static BOOL
PSDRV_PPDGetTransValue(char *start
, PPDTuple
*tuple
)
224 end
= strpbrk(start
, "\r\n");
225 if(end
== start
) return FALSE
;
226 if(!end
) end
= start
+ strlen(start
);
227 buf
= HeapAlloc( PSDRV_Heap
, 0, end
- start
+ 1 );
228 memcpy(buf
, start
, end
- start
);
229 *(buf
+ (end
- start
)) = '\0';
230 tuple
->valtrans
= PSDRV_PPDDecodeHex(buf
);
231 HeapFree( PSDRV_Heap
, 0, buf
);
236 /***********************************************************************
238 * PSDRV_PPDGetInvocationValue
240 * Passed string that should be surrounded by `"'s, return string alloced
243 static BOOL
PSDRV_PPDGetInvocationValue(FILE *fp
, char *pos
, PPDTuple
*tuple
)
245 char *start
, *end
, *buf
;
250 buf
= HeapAlloc( PSDRV_Heap
, 0, strlen(start
) + 1 );
253 end
= strchr(start
, '"');
255 buf
= HeapReAlloc( PSDRV_Heap
, 0, buf
,
256 len
+ (end
- start
) + 1 );
257 memcpy(buf
+ len
, start
, end
- start
);
258 *(buf
+ len
+ (end
- start
)) = '\0';
260 start
= strchr(end
, '/');
262 return PSDRV_PPDGetTransValue(start
+ 1, tuple
);
265 int sl
= strlen(start
);
266 buf
= HeapReAlloc( PSDRV_Heap
, 0, buf
, len
+ sl
+ 1 );
267 strcpy(buf
+ len
, start
);
270 } while( fgets((start
= line
), sizeof(line
), fp
) );
273 HeapFree( PSDRV_Heap
, 0, buf
);
278 /***********************************************************************
280 * PSDRV_PPDGetQuotedValue
282 * Passed string that should be surrounded by `"'s. Expand <xx> as hex
283 * return string alloced from process heap.
285 static BOOL
PSDRV_PPDGetQuotedValue(FILE *fp
, char *pos
, PPDTuple
*tuple
)
289 if(!PSDRV_PPDGetInvocationValue(fp
, pos
, tuple
))
291 buf
= PSDRV_PPDDecodeHex(tuple
->value
);
292 HeapFree(PSDRV_Heap
, 0, tuple
->value
);
298 /***********************************************************************
300 * PSDRV_PPDGetStringValue
302 * Just strip leading white space.
304 static BOOL
PSDRV_PPDGetStringValue(char *str
, PPDTuple
*tuple
)
306 char *start
= str
, *end
;
308 while(*start
!= '\0' && isspace(*start
))
311 end
= strpbrk(start
, "/\r\n");
312 if(!end
) end
= start
+ strlen(start
);
313 tuple
->value
= HeapAlloc( PSDRV_Heap
, 0, (end
- start
) + 1 );
314 memcpy(tuple
->value
, start
, end
- start
);
315 *(tuple
->value
+ (end
- start
)) = '\0';
317 PSDRV_PPDGetTransValue(end
+ 1, tuple
);
322 /***********************************************************************
324 * PSDRV_PPDSymbolValue
326 * Not implemented yet.
328 static BOOL
PSDRV_PPDGetSymbolValue(char *pos
, PPDTuple
*tuple
)
335 /*********************************************************************
337 * PSDRV_PPDGetNextTuple
339 * Gets the next Keyword Option Value tuple from the file. Allocs space off
340 * the process heap which should be free()ed by the caller if not needed.
342 static BOOL
PSDRV_PPDGetNextTuple(FILE *fp
, PPDTuple
*tuple
)
344 char line
[257], *opt
= NULL
, *cp
, *trans
, *endkey
;
345 BOOL gotoption
= TRUE
;
347 memset(tuple
, 0, sizeof(*tuple
));
350 if(!fgets(line
, sizeof(line
), fp
))
352 if(line
[0] == '*' && line
[1] != '%' && strncmp(line
, "*End", 4))
356 if(line
[strlen(line
)-1] != '\n') {
357 ERR("Line too long.\n");
361 for(cp
= line
; !isspace(*cp
) && *cp
!= ':'; cp
++)
365 if(*cp
== ':') { /* <key>: */
370 if(*cp
== ':') { /* <key> : */
372 } else { /* <key> <option> */
377 tuple
->key
= HeapAlloc( PSDRV_Heap
, 0, endkey
- line
+ 1 );
378 if(!tuple
->key
) return FALSE
;
380 memcpy(tuple
->key
, line
, endkey
- line
);
381 tuple
->key
[endkey
- line
] = '\0';
383 if(gotoption
) { /* opt points to 1st non-space character of the option */
384 cp
= strpbrk(opt
, ":/");
386 ERR("Error in line '%s'?\n", line
);
389 tuple
->option
= HeapAlloc( PSDRV_Heap
, 0, cp
- opt
+ 1 );
390 if(!tuple
->option
) return FALSE
;
391 memcpy(tuple
->option
, opt
, cp
- opt
);
392 tuple
->option
[cp
- opt
] = '\0';
396 cp
= strchr(trans
, ':');
398 ERR("Error in line '%s'?\n", line
);
401 buf
= HeapAlloc( PSDRV_Heap
, 0, cp
- trans
+ 1 );
402 if(!buf
) return FALSE
;
403 memcpy(buf
, trans
, cp
- trans
);
404 buf
[cp
- trans
] = '\0';
405 tuple
->opttrans
= PSDRV_PPDDecodeHex(buf
);
406 HeapFree( PSDRV_Heap
, 0, buf
);
410 /* cp should point to a ':', so we increment past it */
418 if( (!gotoption
&& strncmp(tuple
->key
, "*?", 2) ) ||
419 !strncmp(tuple
->key
, "*JCL", 4))
420 PSDRV_PPDGetQuotedValue(fp
, cp
, tuple
);
422 PSDRV_PPDGetInvocationValue(fp
, cp
, tuple
);
426 PSDRV_PPDGetSymbolValue(cp
, tuple
);
430 PSDRV_PPDGetStringValue(cp
, tuple
);
435 /*********************************************************************
437 * PSDRV_PPDGetPageSizeInfo
439 * Searches ppd PageSize list to return entry matching name or creates new
440 * entry which is appended to the list if name is not found.
443 PAGESIZE
*PSDRV_PPDGetPageSizeInfo(PPD
*ppd
, char *name
)
445 PAGESIZE
*page
= ppd
->PageSizes
, *lastpage
;
448 page
= ppd
->PageSizes
= HeapAlloc( PSDRV_Heap
,
449 HEAP_ZERO_MEMORY
, sizeof(*page
) );
452 for( ; page
; page
= page
->next
) {
453 if(!strcmp(page
->Name
, name
))
458 lastpage
->next
= HeapAlloc( PSDRV_Heap
,
459 HEAP_ZERO_MEMORY
, sizeof(*page
) );
460 return lastpage
->next
;
464 /**********************************************************************
468 * Returns ptr alloced from heap to first word in str. Strips leading spaces.
469 * Puts ptr to next word in next
471 static char *PSDRV_PPDGetWord(char *str
, char **next
)
473 char *start
, *end
, *ret
;
476 while(start
&& *start
&& isspace(*start
))
478 if(!start
|| !*start
) return FALSE
;
481 while(*end
&& !isspace(*end
))
484 ret
= HeapAlloc( PSDRV_Heap
, 0, end
- start
+ 1 );
485 memcpy(ret
, start
, end
- start
);
486 *(ret
+ (end
- start
)) = '\0';
488 while(*end
&& isspace(*end
))
498 /*******************************************************************************
502 static INT
PSDRV_AddSlot(PPD
*ppd
, LPSTR szName
, LPSTR szFullName
,
503 LPSTR szInvocationString
, WORD wWinBin
)
505 INPUTSLOT
*slot
, **insert
= &ppd
->InputSlots
;
508 insert
= &((*insert
)->next
);
510 slot
= *insert
= HeapAlloc(PSDRV_Heap
, HEAP_ZERO_MEMORY
, sizeof(INPUTSLOT
));
513 ERR("Failed to allocate %i bytes of memory\n", sizeof(INPUTSLOT
));
518 slot
->FullName
= szFullName
;
519 slot
->InvocationString
= szInvocationString
;
520 slot
->WinBin
= wWinBin
;
525 /***********************************************************************
531 PPD
*PSDRV_ParsePPD(char *fname
)
537 TRACE("%s\n", fname
);
539 if((fp
= fopen(fname
, "r")) == NULL
) {
540 WARN("Couldn't open ppd file '%s'\n", fname
);
544 ppd
= HeapAlloc( PSDRV_Heap
, HEAP_ZERO_MEMORY
, sizeof(*ppd
));
546 ERR("Unable to allocate memory for ppd\n");
552 * The Windows PostScript drivers create the following "virtual bin" for
553 * every PostScript printer
555 if (PSDRV_AddSlot(ppd
, NULL
, "Automatically Select", NULL
,
558 HeapFree (PSDRV_Heap
, 0, ppd
);
563 while( PSDRV_PPDGetNextTuple(fp
, &tuple
)) {
565 if(!strcmp("*NickName", tuple
.key
)) {
566 ppd
->NickName
= tuple
.value
;
568 TRACE("NickName = '%s'\n", ppd
->NickName
);
571 else if(!strcmp("*LanguageLevel", tuple
.key
)) {
572 sscanf(tuple
.value
, "%d", &(ppd
->LanguageLevel
));
573 TRACE("LanguageLevel = %d\n", ppd
->LanguageLevel
);
576 else if(!strcmp("*ColorDevice", tuple
.key
)) {
577 if(!strcasecmp(tuple
.value
, "true"))
578 ppd
->ColorDevice
= TRUE
;
579 TRACE("ColorDevice = %d\n", (int)ppd
->ColorDevice
);
582 else if((!strcmp("*DefaultResolution", tuple
.key
)) ||
583 (!strcmp("*DefaultJCLResolution", tuple
.key
))) {
584 sscanf(tuple
.value
, "%d", &(ppd
->DefaultResolution
));
585 TRACE("DefaultResolution = %d\n", ppd
->DefaultResolution
);
588 else if(!strcmp("*Font", tuple
.key
)) {
591 for(fn
= ppd
->InstalledFonts
; fn
&& fn
->next
; fn
= fn
->next
)
594 ppd
->InstalledFonts
= HeapAlloc(PSDRV_Heap
,
595 HEAP_ZERO_MEMORY
, sizeof(*fn
));
596 fn
= ppd
->InstalledFonts
;
598 fn
->next
= HeapAlloc(PSDRV_Heap
,
599 HEAP_ZERO_MEMORY
, sizeof(*fn
));
602 fn
->Name
= tuple
.option
;
606 else if(!strcmp("*DefaultFont", tuple
.key
)) {
607 ppd
->DefaultFont
= tuple
.value
;
611 else if(!strcmp("*JCLBegin", tuple
.key
)) {
612 ppd
->JCLBegin
= tuple
.value
;
616 else if(!strcmp("*JCLToPSInterpreter", tuple
.key
)) {
617 ppd
->JCLToPSInterpreter
= tuple
.value
;
621 else if(!strcmp("*JCLEnd", tuple
.key
)) {
622 ppd
->JCLEnd
= tuple
.value
;
626 else if(!strcmp("*PageSize", tuple
.key
)) {
628 page
= PSDRV_PPDGetPageSizeInfo(ppd
, tuple
.option
);
633 page
->Name
= tuple
.option
;
636 for(i
= 0; PageTrans
[i
].PSName
; i
++) {
637 if(!strcmp(PageTrans
[i
].PSName
, page
->Name
)) { /* case ? */
638 page
->WinPage
= PageTrans
[i
].WinPage
;
643 TRACE("Can't find Windows page type for '%s' - using %u\n",
644 page
->Name
, UserPageType
);
645 page
->WinPage
= UserPageType
++;
648 if(!page
->FullName
) {
650 page
->FullName
= tuple
.opttrans
;
651 tuple
.opttrans
= NULL
;
654 page
->FullName
= HeapAlloc( PSDRV_Heap
, 0, strlen(page
->Name
)+1 );
655 strcpy( page
->FullName
, page
->Name
);
658 if(!page
->InvocationString
) {
659 page
->InvocationString
= tuple
.value
;
664 else if(!strcmp("*ImageableArea", tuple
.key
)) {
666 page
= PSDRV_PPDGetPageSizeInfo(ppd
, tuple
.option
);
669 page
->Name
= tuple
.option
;
672 if(!page
->FullName
) {
673 page
->FullName
= tuple
.opttrans
;
674 tuple
.opttrans
= NULL
;
677 #define PIA page->ImageableArea
679 PIA
= HeapAlloc( PSDRV_Heap
, 0, sizeof(*PIA
) );
680 sscanf(tuple
.value
, "%f%f%f%f", &PIA
->llx
, &PIA
->lly
,
681 &PIA
->urx
, &PIA
->ury
);
687 else if(!strcmp("*PaperDimension", tuple
.key
)) {
689 page
= PSDRV_PPDGetPageSizeInfo(ppd
, tuple
.option
);
692 page
->Name
= tuple
.option
;
695 if(!page
->FullName
) {
696 page
->FullName
= tuple
.opttrans
;
697 tuple
.opttrans
= NULL
;
700 #define PD page->PaperDimension
702 PD
= HeapAlloc( PSDRV_Heap
, 0, sizeof(*PD
) );
703 sscanf(tuple
.value
, "%f%f", &PD
->x
, &PD
->y
);
708 else if(!strcmp("*LandscapeOrientation", tuple
.key
)) {
709 if(!strcmp(tuple
.value
, "Plus90"))
710 ppd
->LandscapeOrientation
= 90;
711 else if(!strcmp(tuple
.value
, "Minus90"))
712 ppd
->LandscapeOrientation
= -90;
714 /* anything else, namely 'any', leaves value at 0 */
716 TRACE("LandscapeOrientation = %d\n",
717 ppd
->LandscapeOrientation
);
720 else if(!strcmp("*UIConstraints", tuple
.key
)) {
722 CONSTRAINT
*con
, **insert
= &ppd
->Constraints
;
725 insert
= &((*insert
)->next
);
727 con
= *insert
= HeapAlloc( PSDRV_Heap
, HEAP_ZERO_MEMORY
,
732 con
->Feature1
= PSDRV_PPDGetWord(start
, &start
);
733 con
->Value1
= PSDRV_PPDGetWord(start
, &start
);
734 con
->Feature2
= PSDRV_PPDGetWord(start
, &start
);
735 con
->Value2
= PSDRV_PPDGetWord(start
, &start
);
738 else if (!strcmp("*InputSlot", tuple
.key
))
742 tuple
.opttrans
= tuple
.option
;
744 TRACE("Using Windows bin type %u for '%s'\n", UserBinType
,
747 /* FIXME - should check for failure */
748 PSDRV_AddSlot(ppd
, tuple
.option
, tuple
.opttrans
, tuple
.value
,
751 tuple
.option
= tuple
.opttrans
= tuple
.value
= NULL
;
755 * Windows treats "manual feed" as another paper source. Most PPD
756 * files, however, treat it as a separate option which is either on or
759 else if (!strcmp("*ManualFeed", tuple
.key
) && tuple
.option
&&
760 !strcmp ("True", tuple
.option
))
762 /* FIXME - should check for failure */
763 PSDRV_AddSlot(ppd
, NULL
, "Manual Feed", tuple
.value
, DMBIN_MANUAL
);
767 if(tuple
.key
) HeapFree(PSDRV_Heap
, 0, tuple
.key
);
768 if(tuple
.option
) HeapFree(PSDRV_Heap
, 0, tuple
.option
);
769 if(tuple
.value
) HeapFree(PSDRV_Heap
, 0, tuple
.value
);
770 if(tuple
.opttrans
) HeapFree(PSDRV_Heap
, 0, tuple
.opttrans
);
771 if(tuple
.valtrans
) HeapFree(PSDRV_Heap
, 0, tuple
.valtrans
);
782 OPTIONENTRY
*optionEntry
;
784 for(fn
= ppd
->InstalledFonts
; fn
; fn
= fn
->next
)
785 TRACE("'%s'\n", fn
->Name
);
787 for(page
= ppd
->PageSizes
; page
; page
= page
->next
) {
788 TRACE("'%s' aka '%s' (%d) invoked by '%s'\n", page
->Name
,
789 page
->FullName
, page
->WinPage
, page
->InvocationString
);
790 if(page
->ImageableArea
)
791 TRACE("Area = %.2f,%.2f - %.2f, %.2f\n",
792 page
->ImageableArea
->llx
, page
->ImageableArea
->lly
,
793 page
->ImageableArea
->urx
, page
->ImageableArea
->ury
);
794 if(page
->PaperDimension
)
795 TRACE("Dimension = %.2f x %.2f\n",
796 page
->PaperDimension
->x
, page
->PaperDimension
->y
);
799 for(con
= ppd
->Constraints
; con
; con
= con
->next
)
800 TRACE("CONSTRAINTS@ %s %s %s %s\n", con
->Feature1
,
801 con
->Value1
, con
->Feature2
, con
->Value2
);
803 for(option
= ppd
->InstalledOptions
; option
; option
= option
->next
) {
804 TRACE("OPTION: %s %s %s\n", option
->OptionName
,
805 option
->FullName
, option
->DefaultOption
);
806 for(optionEntry
= option
->Options
; optionEntry
;
807 optionEntry
= optionEntry
->next
)
808 TRACE("\tOPTIONENTRY: %s %s %s\n", optionEntry
->Name
,
809 optionEntry
->FullName
, optionEntry
->InvocationString
);
812 for(slot
= ppd
->InputSlots
; slot
; slot
= slot
->next
)
813 TRACE("INPUTSLOTS '%s' Name '%s' (%d) Invocation '%s'\n",
814 slot
->Name
, slot
->FullName
, slot
->WinBin
,
815 slot
->InvocationString
);