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
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "windef.h" /* HEAP_ZERO_MEMORY */
26 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(psdrv
);
41 /* map of page names in ppd file to Windows paper constants */
47 {"10x11", DMPAPER_10X11
},
48 {"10x14", DMPAPER_10X14
},
49 {"11x17", DMPAPER_11X17
}, /* not in Adobe PPD file spec */
50 {"12x11", DMPAPER_12X11
},
51 {"15x11", DMPAPER_15X11
},
52 {"9x11", DMPAPER_9X11
},
55 {"A3.Transverse", DMPAPER_A3_TRANSVERSE
},
56 {"A3Extra", DMPAPER_A3_EXTRA
},
57 {"A3Extra.Transverse", DMPAPER_A3_EXTRA_TRANSVERSE
},
58 {"A3Rotated", DMPAPER_A3_ROTATED
},
60 {"A4.Transverse", DMPAPER_A4_TRANSVERSE
},
61 {"A4Extra", DMPAPER_A4_EXTRA
},
62 {"A4Plus", DMPAPER_A4_PLUS
},
63 {"A4Rotated", DMPAPER_A4_ROTATED
},
64 {"A4Small", DMPAPER_A4SMALL
},
66 {"A5.Transverse", DMPAPER_A5_TRANSVERSE
},
67 {"A5Extra", DMPAPER_A5_EXTRA
},
68 {"A5Rotated", DMPAPER_A5_ROTATED
},
70 {"A6Rotated", DMPAPER_A6_ROTATED
},
71 {"ARCHC", DMPAPER_CSHEET
},
72 {"ARCHD", DMPAPER_DSHEET
},
73 {"ARCHE", DMPAPER_ESHEET
},
75 {"B4Rotated", DMPAPER_B4_JIS_ROTATED
},
77 {"B5.Transverse", DMPAPER_B5_TRANSVERSE
},
78 {"B5Rotated", DMPAPER_B5_JIS_ROTATED
},
79 {"B6", DMPAPER_B6_JIS
},
80 {"B6Rotated", DMPAPER_B6_JIS_ROTATED
},
81 {"C4", DMPAPER_ENV_C4
}, /* use EnvC4 */
82 {"C5", DMPAPER_ENV_C5
}, /* use EnvC5 */
83 {"C6", DMPAPER_ENV_C6
}, /* use EnvC6 */
84 {"Comm10", DMPAPER_ENV_10
}, /* use Env10 */
85 {"DL", DMPAPER_ENV_DL
}, /* use EnvDL */
86 {"DoublePostcard", DMPAPER_DBL_JAPANESE_POSTCARD
},
87 {"DoublePostcardRotated", DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED
},
88 {"Env10", DMPAPER_ENV_10
},
89 {"Env11", DMPAPER_ENV_11
},
90 {"Env12", DMPAPER_ENV_12
},
91 {"Env14", DMPAPER_ENV_14
},
92 {"Env9", DMPAPER_ENV_9
},
93 {"EnvC3", DMPAPER_ENV_C3
},
94 {"EnvC4", DMPAPER_ENV_C4
},
95 {"EnvC5", DMPAPER_ENV_C5
},
96 {"EnvC6", DMPAPER_ENV_C6
},
97 {"EnvC65", DMPAPER_ENV_C65
},
98 {"EnvChou3", DMPAPER_JENV_CHOU3
},
99 {"EnvChou3Rotated", DMPAPER_JENV_CHOU3_ROTATED
},
100 {"EnvChou4", DMPAPER_JENV_CHOU4
},
101 {"EnvChou4Rotated", DMPAPER_JENV_CHOU4_ROTATED
},
102 {"EnvDL", DMPAPER_ENV_DL
},
103 {"EnvISOB4", DMPAPER_ENV_B4
},
104 {"EnvISOB5", DMPAPER_ENV_B5
},
105 {"EnvISOB6", DMPAPER_ENV_B6
},
106 {"EnvInvite", DMPAPER_ENV_INVITE
},
107 {"EnvItalian", DMPAPER_ENV_ITALY
},
108 {"EnvKaku2", DMPAPER_JENV_KAKU2
},
109 {"EnvKaku2Rotated", DMPAPER_JENV_KAKU2_ROTATED
},
110 {"EnvKaku3", DMPAPER_JENV_KAKU3
},
111 {"EnvKaku3Rotated", DMPAPER_JENV_KAKU3_ROTATED
},
112 {"EnvMonarch", DMPAPER_ENV_MONARCH
},
113 {"EnvPRC1", DMPAPER_PENV_1
},
114 {"EnvPRC10", DMPAPER_PENV_10
},
115 {"EnvPRC10Rotated", DMPAPER_PENV_10_ROTATED
},
116 {"EnvPRC1Rotated", DMPAPER_PENV_1_ROTATED
},
117 {"EnvPRC2", DMPAPER_PENV_2
},
118 {"EnvPRC2Rotated", DMPAPER_PENV_2_ROTATED
},
119 {"EnvPRC3", DMPAPER_PENV_3
},
120 {"EnvPRC3Rotated", DMPAPER_PENV_3_ROTATED
},
121 {"EnvPRC4", DMPAPER_PENV_4
},
122 {"EnvPRC4Rotated", DMPAPER_PENV_4_ROTATED
},
123 {"EnvPRC5", DMPAPER_PENV_5
},
124 {"EnvPRC5Rotated", DMPAPER_PENV_5_ROTATED
},
125 {"EnvPRC6", DMPAPER_PENV_6
},
126 {"EnvPRC6Rotated", DMPAPER_PENV_6_ROTATED
},
127 {"EnvPRC7", DMPAPER_PENV_7
},
128 {"EnvPRC7Rotated", DMPAPER_PENV_7_ROTATED
},
129 {"EnvPRC8", DMPAPER_PENV_8
},
130 {"EnvPRC8Rotated", DMPAPER_PENV_8_ROTATED
},
131 {"EnvPRC9", DMPAPER_PENV_9
},
132 {"EnvPRC9Rotated", DMPAPER_PENV_9_ROTATED
},
133 {"EnvPersonal", DMPAPER_ENV_PERSONAL
},
134 {"EnvYou4", DMPAPER_JENV_YOU4
},
135 {"EnvYou4Rotated", DMPAPER_JENV_YOU4_ROTATED
},
136 {"Executive", DMPAPER_EXECUTIVE
},
137 {"FanFoldGerman", DMPAPER_FANFOLD_STD_GERMAN
},
138 {"FanFoldGermanLegal", DMPAPER_FANFOLD_LGL_GERMAN
},
139 {"FanFoldUS", DMPAPER_FANFOLD_US
},
140 {"Folio", DMPAPER_FOLIO
},
141 {"ISOB4", DMPAPER_ISO_B4
},
142 {"ISOB5Extra", DMPAPER_B5_EXTRA
},
143 {"Ledger", DMPAPER_LEDGER
},
144 {"Legal", DMPAPER_LEGAL
},
145 {"LegalExtra", DMPAPER_LEGAL_EXTRA
},
146 {"Letter", DMPAPER_LETTER
},
147 {"Letter.Transverse", DMPAPER_LETTER_TRANSVERSE
},
148 {"LetterExtra", DMPAPER_LETTER_EXTRA
},
149 {"LetterExtra.Transverse", DMPAPER_LETTER_EXTRA_TRANSVERSE
},
150 {"LetterPlus", DMPAPER_LETTER_PLUS
},
151 {"LetterRotated", DMPAPER_LETTER_ROTATED
},
152 {"LetterSmall", DMPAPER_LETTERSMALL
},
153 {"Monarch", DMPAPER_ENV_MONARCH
}, /* use EnvMonarch */
154 {"Note", DMPAPER_NOTE
},
155 {"PRC16K", DMPAPER_P16K
},
156 {"PRC16KRotated", DMPAPER_P16K_ROTATED
},
157 {"PRC32K", DMPAPER_P32K
},
158 {"PRC32KBig", DMPAPER_P32KBIG
},
159 {"PRC32KBigRotated", DMPAPER_P32KBIG_ROTATED
},
160 {"PRC32KRotated", DMPAPER_P32K_ROTATED
},
161 {"Postcard", DMPAPER_JAPANESE_POSTCARD
},
162 {"PostcardRotated", DMPAPER_JAPANESE_POSTCARD_ROTATED
},
163 {"Quarto", DMPAPER_QUARTO
},
164 {"Statement", DMPAPER_STATEMENT
},
165 {"SuperA", DMPAPER_A_PLUS
},
166 {"SuperB", DMPAPER_B_PLUS
},
167 {"Tabloid", DMPAPER_TABLOID
},
168 {"TabloidExtra", DMPAPER_TABLOID_EXTRA
},
172 static WORD UserPageType
= DMPAPER_USER
;
173 static WORD UserBinType
= DMBIN_USER
;
175 /***********************************************************************
179 * Copies str into a newly allocated string from the process heap subsituting
180 * hex strings enclosed in '<' and '>' for their byte codes.
183 static char *PSDRV_PPDDecodeHex(char *str
)
185 char *buf
, *in
, *out
;
188 buf
= HeapAlloc(PSDRV_Heap
, 0, strlen(str
) + 1);
192 for(in
= str
, out
= buf
; *in
; in
++) {
203 else if(isspace(*in
))
207 if(!isxdigit(*in
) || !isxdigit(*(in
+ 1))) {
208 ERR("Invalid hex char in hex string\n");
209 HeapFree(PSDRV_Heap
, 0, buf
);
213 for(i
= 0; i
< 2; i
++) {
214 if(isdigit(*(in
+ i
)))
215 *out
|= (*(in
+ i
) - '0') << ((1-i
) * 4);
217 *out
|= (toupper(*(in
+ i
)) - 'A' + 10) << ((1-i
) * 4);
229 /***********************************************************************
231 * PSDRV_PPDGetTransValue
234 static BOOL
PSDRV_PPDGetTransValue(char *start
, PPDTuple
*tuple
)
238 end
= strpbrk(start
, "\r\n");
239 if(end
== start
) return FALSE
;
240 if(!end
) end
= start
+ strlen(start
);
241 buf
= HeapAlloc( PSDRV_Heap
, 0, end
- start
+ 1 );
242 memcpy(buf
, start
, end
- start
);
243 *(buf
+ (end
- start
)) = '\0';
244 tuple
->valtrans
= PSDRV_PPDDecodeHex(buf
);
245 HeapFree( PSDRV_Heap
, 0, buf
);
250 /***********************************************************************
252 * PSDRV_PPDGetInvocationValue
254 * Passed string that should be surrounded by `"'s, return string alloced
257 static BOOL
PSDRV_PPDGetInvocationValue(FILE *fp
, char *pos
, PPDTuple
*tuple
)
259 char *start
, *end
, *buf
;
264 buf
= HeapAlloc( PSDRV_Heap
, 0, strlen(start
) + 1 );
267 end
= strchr(start
, '"');
269 buf
= HeapReAlloc( PSDRV_Heap
, 0, buf
,
270 len
+ (end
- start
) + 1 );
271 memcpy(buf
+ len
, start
, end
- start
);
272 *(buf
+ len
+ (end
- start
)) = '\0';
274 start
= strchr(end
, '/');
276 return PSDRV_PPDGetTransValue(start
+ 1, tuple
);
279 int sl
= strlen(start
);
280 buf
= HeapReAlloc( PSDRV_Heap
, 0, buf
, len
+ sl
+ 1 );
281 strcpy(buf
+ len
, start
);
284 } while( fgets((start
= line
), sizeof(line
), fp
) );
287 HeapFree( PSDRV_Heap
, 0, buf
);
292 /***********************************************************************
294 * PSDRV_PPDGetQuotedValue
296 * Passed string that should be surrounded by `"'s. Expand <xx> as hex
297 * return string alloced from process heap.
299 static BOOL
PSDRV_PPDGetQuotedValue(FILE *fp
, char *pos
, PPDTuple
*tuple
)
303 if(!PSDRV_PPDGetInvocationValue(fp
, pos
, tuple
))
305 buf
= PSDRV_PPDDecodeHex(tuple
->value
);
306 HeapFree(PSDRV_Heap
, 0, tuple
->value
);
312 /***********************************************************************
314 * PSDRV_PPDGetStringValue
316 * Just strip leading white space.
318 static BOOL
PSDRV_PPDGetStringValue(char *str
, PPDTuple
*tuple
)
320 char *start
= str
, *end
;
322 while(*start
!= '\0' && isspace(*start
))
325 end
= strpbrk(start
, "/\r\n");
326 if(!end
) end
= start
+ strlen(start
);
327 tuple
->value
= HeapAlloc( PSDRV_Heap
, 0, (end
- start
) + 1 );
328 memcpy(tuple
->value
, start
, end
- start
);
329 *(tuple
->value
+ (end
- start
)) = '\0';
331 PSDRV_PPDGetTransValue(end
+ 1, tuple
);
336 /***********************************************************************
338 * PSDRV_PPDSymbolValue
340 * Not implemented yet.
342 static BOOL
PSDRV_PPDGetSymbolValue(char *pos
, PPDTuple
*tuple
)
349 /*********************************************************************
351 * PSDRV_PPDGetNextTuple
353 * Gets the next Keyword Option Value tuple from the file. Allocs space off
354 * the process heap which should be free()ed by the caller if not needed.
356 static BOOL
PSDRV_PPDGetNextTuple(FILE *fp
, PPDTuple
*tuple
)
358 char line
[257], *opt
= NULL
, *cp
, *trans
, *endkey
;
359 BOOL gotoption
= TRUE
;
361 memset(tuple
, 0, sizeof(*tuple
));
364 if(!fgets(line
, sizeof(line
), fp
))
366 if(line
[0] == '*' && line
[1] != '%' && strncmp(line
, "*End", 4))
370 if(line
[strlen(line
)-1] != '\n') {
371 ERR("Line too long.\n");
375 for(cp
= line
; !isspace(*cp
) && *cp
!= ':'; cp
++)
379 if(*cp
== ':') { /* <key>: */
384 if(*cp
== ':') { /* <key> : */
386 } else { /* <key> <option> */
391 tuple
->key
= HeapAlloc( PSDRV_Heap
, 0, endkey
- line
+ 1 );
392 if(!tuple
->key
) return FALSE
;
394 memcpy(tuple
->key
, line
, endkey
- line
);
395 tuple
->key
[endkey
- line
] = '\0';
397 if(gotoption
) { /* opt points to 1st non-space character of the option */
398 cp
= strpbrk(opt
, ":/");
400 ERR("Error in line '%s'?\n", line
);
403 tuple
->option
= HeapAlloc( PSDRV_Heap
, 0, cp
- opt
+ 1 );
404 if(!tuple
->option
) return FALSE
;
405 memcpy(tuple
->option
, opt
, cp
- opt
);
406 tuple
->option
[cp
- opt
] = '\0';
410 cp
= strchr(trans
, ':');
412 ERR("Error in line '%s'?\n", line
);
415 buf
= HeapAlloc( PSDRV_Heap
, 0, cp
- trans
+ 1 );
416 if(!buf
) return FALSE
;
417 memcpy(buf
, trans
, cp
- trans
);
418 buf
[cp
- trans
] = '\0';
419 tuple
->opttrans
= PSDRV_PPDDecodeHex(buf
);
420 HeapFree( PSDRV_Heap
, 0, buf
);
424 /* cp should point to a ':', so we increment past it */
432 if( (!gotoption
&& strncmp(tuple
->key
, "*?", 2) ) ||
433 !strncmp(tuple
->key
, "*JCL", 4))
434 PSDRV_PPDGetQuotedValue(fp
, cp
, tuple
);
436 PSDRV_PPDGetInvocationValue(fp
, cp
, tuple
);
440 PSDRV_PPDGetSymbolValue(cp
, tuple
);
444 PSDRV_PPDGetStringValue(cp
, tuple
);
449 /*********************************************************************
451 * PSDRV_PPDGetPageSizeInfo
453 * Searches ppd PageSize list to return entry matching name or creates new
454 * entry which is appended to the list if name is not found.
457 PAGESIZE
*PSDRV_PPDGetPageSizeInfo(PPD
*ppd
, char *name
)
459 PAGESIZE
*page
= ppd
->PageSizes
, *lastpage
;
462 page
= ppd
->PageSizes
= HeapAlloc( PSDRV_Heap
,
463 HEAP_ZERO_MEMORY
, sizeof(*page
) );
466 for( ; page
; page
= page
->next
) {
467 if(!strcmp(page
->Name
, name
))
472 lastpage
->next
= HeapAlloc( PSDRV_Heap
,
473 HEAP_ZERO_MEMORY
, sizeof(*page
) );
474 return lastpage
->next
;
478 /**********************************************************************
482 * Returns ptr alloced from heap to first word in str. Strips leading spaces.
483 * Puts ptr to next word in next
485 static char *PSDRV_PPDGetWord(char *str
, char **next
)
487 char *start
, *end
, *ret
;
490 while(start
&& *start
&& isspace(*start
))
492 if(!start
|| !*start
) return FALSE
;
495 while(*end
&& !isspace(*end
))
498 ret
= HeapAlloc( PSDRV_Heap
, 0, end
- start
+ 1 );
499 memcpy(ret
, start
, end
- start
);
500 *(ret
+ (end
- start
)) = '\0';
502 while(*end
&& isspace(*end
))
512 /*******************************************************************************
516 static INT
PSDRV_AddSlot(PPD
*ppd
, LPSTR szName
, LPSTR szFullName
,
517 LPSTR szInvocationString
, WORD wWinBin
)
519 INPUTSLOT
*slot
, **insert
= &ppd
->InputSlots
;
522 insert
= &((*insert
)->next
);
524 slot
= *insert
= HeapAlloc(PSDRV_Heap
, HEAP_ZERO_MEMORY
, sizeof(INPUTSLOT
));
527 ERR("Failed to allocate %i bytes of memory\n", sizeof(INPUTSLOT
));
532 slot
->FullName
= szFullName
;
533 slot
->InvocationString
= szInvocationString
;
534 slot
->WinBin
= wWinBin
;
539 /***********************************************************************
545 PPD
*PSDRV_ParsePPD(char *fname
)
551 TRACE("file '%s'\n", fname
);
553 if((fp
= fopen(fname
, "r")) == NULL
) {
554 WARN("Couldn't open ppd file '%s'\n", fname
);
558 ppd
= HeapAlloc( PSDRV_Heap
, HEAP_ZERO_MEMORY
, sizeof(*ppd
));
560 ERR("Unable to allocate memory for ppd\n");
566 * The Windows PostScript drivers create the following "virtual bin" for
567 * every PostScript printer
569 if (PSDRV_AddSlot(ppd
, NULL
, "Automatically Select", NULL
,
572 HeapFree (PSDRV_Heap
, 0, ppd
);
577 while( PSDRV_PPDGetNextTuple(fp
, &tuple
)) {
579 if(!strcmp("*NickName", tuple
.key
)) {
580 ppd
->NickName
= tuple
.value
;
582 TRACE("NickName = '%s'\n", ppd
->NickName
);
585 else if(!strcmp("*LanguageLevel", tuple
.key
)) {
586 sscanf(tuple
.value
, "%d", &(ppd
->LanguageLevel
));
587 TRACE("LanguageLevel = %d\n", ppd
->LanguageLevel
);
590 else if(!strcmp("*ColorDevice", tuple
.key
)) {
591 if(!strcasecmp(tuple
.value
, "true"))
592 ppd
->ColorDevice
= TRUE
;
593 TRACE("ColorDevice = %d\n", (int)ppd
->ColorDevice
);
596 else if((!strcmp("*DefaultResolution", tuple
.key
)) ||
597 (!strcmp("*DefaultJCLResolution", tuple
.key
))) {
598 sscanf(tuple
.value
, "%d", &(ppd
->DefaultResolution
));
599 TRACE("DefaultResolution = %d\n", ppd
->DefaultResolution
);
602 else if(!strcmp("*Font", tuple
.key
)) {
605 for(fn
= ppd
->InstalledFonts
; fn
&& fn
->next
; fn
= fn
->next
)
608 ppd
->InstalledFonts
= HeapAlloc(PSDRV_Heap
,
609 HEAP_ZERO_MEMORY
, sizeof(*fn
));
610 fn
= ppd
->InstalledFonts
;
612 fn
->next
= HeapAlloc(PSDRV_Heap
,
613 HEAP_ZERO_MEMORY
, sizeof(*fn
));
616 fn
->Name
= tuple
.option
;
620 else if(!strcmp("*DefaultFont", tuple
.key
)) {
621 ppd
->DefaultFont
= tuple
.value
;
625 else if(!strcmp("*JCLBegin", tuple
.key
)) {
626 ppd
->JCLBegin
= tuple
.value
;
630 else if(!strcmp("*JCLToPSInterpreter", tuple
.key
)) {
631 ppd
->JCLToPSInterpreter
= tuple
.value
;
635 else if(!strcmp("*JCLEnd", tuple
.key
)) {
636 ppd
->JCLEnd
= tuple
.value
;
640 else if(!strcmp("*PageSize", tuple
.key
)) {
642 page
= PSDRV_PPDGetPageSizeInfo(ppd
, tuple
.option
);
647 page
->Name
= tuple
.option
;
650 for(i
= 0; PageTrans
[i
].PSName
; i
++) {
651 if(!strcmp(PageTrans
[i
].PSName
, page
->Name
)) { /* case ? */
652 page
->WinPage
= PageTrans
[i
].WinPage
;
657 TRACE("Can't find Windows page type for '%s' - using %u\n",
658 page
->Name
, UserPageType
);
659 page
->WinPage
= UserPageType
++;
662 if(!page
->FullName
) {
664 page
->FullName
= tuple
.opttrans
;
665 tuple
.opttrans
= NULL
;
668 page
->FullName
= HeapAlloc( PSDRV_Heap
, 0, strlen(page
->Name
)+1 );
669 strcpy( page
->FullName
, page
->Name
);
672 if(!page
->InvocationString
) {
673 page
->InvocationString
= tuple
.value
;
678 else if(!strcmp("*ImageableArea", tuple
.key
)) {
680 page
= PSDRV_PPDGetPageSizeInfo(ppd
, tuple
.option
);
683 page
->Name
= tuple
.option
;
686 if(!page
->FullName
) {
687 page
->FullName
= tuple
.opttrans
;
688 tuple
.opttrans
= NULL
;
691 #define PIA page->ImageableArea
693 PIA
= HeapAlloc( PSDRV_Heap
, 0, sizeof(*PIA
) );
694 sscanf(tuple
.value
, "%f%f%f%f", &PIA
->llx
, &PIA
->lly
,
695 &PIA
->urx
, &PIA
->ury
);
701 else if(!strcmp("*PaperDimension", tuple
.key
)) {
703 page
= PSDRV_PPDGetPageSizeInfo(ppd
, tuple
.option
);
706 page
->Name
= tuple
.option
;
709 if(!page
->FullName
) {
710 page
->FullName
= tuple
.opttrans
;
711 tuple
.opttrans
= NULL
;
714 #define PD page->PaperDimension
716 PD
= HeapAlloc( PSDRV_Heap
, 0, sizeof(*PD
) );
717 sscanf(tuple
.value
, "%f%f", &PD
->x
, &PD
->y
);
722 else if(!strcmp("*LandscapeOrientation", tuple
.key
)) {
723 if(!strcmp(tuple
.value
, "Plus90"))
724 ppd
->LandscapeOrientation
= 90;
725 else if(!strcmp(tuple
.value
, "Minus90"))
726 ppd
->LandscapeOrientation
= -90;
728 /* anything else, namely 'any', leaves value at 0 */
730 TRACE("LandscapeOrientation = %d\n",
731 ppd
->LandscapeOrientation
);
734 else if(!strcmp("*UIConstraints", tuple
.key
)) {
736 CONSTRAINT
*con
, **insert
= &ppd
->Constraints
;
739 insert
= &((*insert
)->next
);
741 con
= *insert
= HeapAlloc( PSDRV_Heap
, HEAP_ZERO_MEMORY
,
746 con
->Feature1
= PSDRV_PPDGetWord(start
, &start
);
747 con
->Value1
= PSDRV_PPDGetWord(start
, &start
);
748 con
->Feature2
= PSDRV_PPDGetWord(start
, &start
);
749 con
->Value2
= PSDRV_PPDGetWord(start
, &start
);
752 else if (!strcmp("*InputSlot", tuple
.key
))
756 tuple
.opttrans
= tuple
.option
;
758 TRACE("Using Windows bin type %u for '%s'\n", UserBinType
,
761 /* FIXME - should check for failure */
762 PSDRV_AddSlot(ppd
, tuple
.option
, tuple
.opttrans
, tuple
.value
,
765 tuple
.option
= tuple
.opttrans
= tuple
.value
= NULL
;
769 * Windows treats "manual feed" as another paper source. Most PPD
770 * files, however, treat it as a separate option which is either on or
773 else if (!strcmp("*ManualFeed", tuple
.key
) && tuple
.option
&&
774 !strcmp ("True", tuple
.option
))
776 /* FIXME - should check for failure */
777 PSDRV_AddSlot(ppd
, "Manual Feed", "Manual Feed", tuple
.value
, DMBIN_MANUAL
);
781 else if(!strcmp("*TTRasterizer", tuple
.key
)) {
782 if(!strcasecmp("None", tuple
.value
))
783 ppd
->TTRasterizer
= RO_None
;
784 else if(!strcasecmp("Accept68K", tuple
.value
))
785 ppd
->TTRasterizer
= RO_Accept68K
;
786 else if(!strcasecmp("Type42", tuple
.value
))
787 ppd
->TTRasterizer
= RO_Type42
;
788 else if(!strcasecmp("TrueImage", tuple
.value
))
789 ppd
->TTRasterizer
= RO_TrueImage
;
791 FIXME("Unknown option %s for *TTRasterizer\n",
793 ppd
->TTRasterizer
= RO_None
;
795 TRACE("*TTRasterizer = %d\n", ppd
->TTRasterizer
);
798 if(tuple
.key
) HeapFree(PSDRV_Heap
, 0, tuple
.key
);
799 if(tuple
.option
) HeapFree(PSDRV_Heap
, 0, tuple
.option
);
800 if(tuple
.value
) HeapFree(PSDRV_Heap
, 0, tuple
.value
);
801 if(tuple
.opttrans
) HeapFree(PSDRV_Heap
, 0, tuple
.opttrans
);
802 if(tuple
.valtrans
) HeapFree(PSDRV_Heap
, 0, tuple
.valtrans
);
813 OPTIONENTRY
*optionEntry
;
815 for(fn
= ppd
->InstalledFonts
; fn
; fn
= fn
->next
)
816 TRACE("'%s'\n", fn
->Name
);
818 for(page
= ppd
->PageSizes
; page
; page
= page
->next
) {
819 TRACE("'%s' aka '%s' (%d) invoked by '%s'\n", page
->Name
,
820 page
->FullName
, page
->WinPage
, page
->InvocationString
);
821 if(page
->ImageableArea
)
822 TRACE("Area = %.2f,%.2f - %.2f, %.2f\n",
823 page
->ImageableArea
->llx
, page
->ImageableArea
->lly
,
824 page
->ImageableArea
->urx
, page
->ImageableArea
->ury
);
825 if(page
->PaperDimension
)
826 TRACE("Dimension = %.2f x %.2f\n",
827 page
->PaperDimension
->x
, page
->PaperDimension
->y
);
830 for(con
= ppd
->Constraints
; con
; con
= con
->next
)
831 TRACE("CONSTRAINTS@ %s %s %s %s\n", con
->Feature1
,
832 con
->Value1
, con
->Feature2
, con
->Value2
);
834 for(option
= ppd
->InstalledOptions
; option
; option
= option
->next
) {
835 TRACE("OPTION: %s %s %s\n", option
->OptionName
,
836 option
->FullName
, option
->DefaultOption
);
837 for(optionEntry
= option
->Options
; optionEntry
;
838 optionEntry
= optionEntry
->next
)
839 TRACE("\tOPTIONENTRY: %s %s %s\n", optionEntry
->Name
,
840 optionEntry
->FullName
, optionEntry
->InvocationString
);
843 for(slot
= ppd
->InputSlots
; slot
; slot
= slot
->next
)
844 TRACE("INPUTSLOTS '%s' Name '%s' (%d) Invocation '%s'\n",
845 slot
->Name
, slot
->FullName
, slot
->WinBin
,
846 slot
->InvocationString
);