/src/ghostpdl/pcl/pxl/pxptable.c
Line | Count | Source |
1 | | /* Copyright (C) 2001-2023 Artifex Software, Inc. |
2 | | All Rights Reserved. |
3 | | |
4 | | This software is provided AS-IS with no warranty, either express or |
5 | | implied. |
6 | | |
7 | | This software is distributed under license and may not be copied, |
8 | | modified or distributed except as expressly authorized under the terms |
9 | | of the license contained in the file LICENSE in this distribution. |
10 | | |
11 | | Refer to licensing information at http://www.artifex.com or contact |
12 | | Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco, |
13 | | CA 94129, USA, for further information. |
14 | | */ |
15 | | |
16 | | |
17 | | /* pxptable.c */ |
18 | | /* PCL XL parser tables */ |
19 | | |
20 | | #include "std.h" |
21 | | #include "pxenum.h" |
22 | | #include "pxoper.h" |
23 | | #include "pxvalue.h" |
24 | | #include "pxptable.h" /* requires pxenum.h, pxoper.h, pxvalue.h */ |
25 | | #include "pxstate.h" |
26 | | |
27 | | /* ---------------- Attribute values ---------------- */ |
28 | | |
29 | | #define sc(sizes) {pxd_scalar|sizes} /* scalar */ |
30 | | #define scp(sizes,proc) {pxd_scalar|sizes, 0, proc} |
31 | | #define scub() {pxd_scalar|ub, 255} |
32 | | #define xy(sizes) {pxd_xy|sizes} /* XY pair */ |
33 | | #define xyp(sizes,proc) {pxd_xy|sizes, 0, proc} |
34 | | #define box(sizes) {pxd_box|sizes} /* box */ |
35 | | #define arr(sizes) {pxd_array|sizes} /* array */ |
36 | | #define arrp(sizes,proc) {pxd_array|sizes, 0, proc} |
37 | | #define en(limit) {pxd_scalar|pxd_ubyte, (limit)-1} /* enumeration */ |
38 | | #define enp(limit,proc) {pxd_scalar|pxd_ubyte, (limit)-1, proc} |
39 | | #define zero en(1) /* must be zero */ |
40 | | #define ub pxd_ubyte |
41 | | #define us pxd_uint16 |
42 | | #define ul pxd_uint32 |
43 | | #define ss pxd_sint16 |
44 | | #define sl pxd_sint32 |
45 | | #define rl pxd_real32 |
46 | | |
47 | | #define none {0} |
48 | | #define none5 none, none, none, none, none |
49 | | |
50 | | #define ok_iff(test)\ |
51 | 27.3k | ((test) ? 0 : gs_note_error(errorIllegalAttributeValue)) |
52 | | |
53 | | static int |
54 | | checkCharAngle(const px_value_t * pv) |
55 | 3.32k | { |
56 | 3.32k | real v = real_value(pv, 0); |
57 | | |
58 | 3.32k | return ok_iff(v >= -360 && v <= 360); |
59 | 3.32k | } |
60 | | static int |
61 | | checkCharBoldValue(const px_value_t * pv) |
62 | 0 | { |
63 | 0 | return ok_iff(pv->value.r >= 0 && pv->value.r <= 1); |
64 | 0 | } |
65 | | static int |
66 | | checkCharScale(const px_value_t * pv) |
67 | 2 | { |
68 | 2 | real x = real_value(pv, 0), y = real_value(pv, 1); |
69 | | |
70 | 2 | return ok_iff(x >= -32768 && x <= 32767 && y >= -32768 && y <= 32767); |
71 | 2 | } |
72 | | #define checkCharShear checkCharScale |
73 | | static int |
74 | | checkDestinationSize(const px_value_t * pv) |
75 | 194 | { |
76 | 194 | return ok_iff(pv->value.ia[0] != 0 && pv->value.ia[1] != 0); |
77 | 194 | } |
78 | | static int |
79 | | checkDitherMatrixDataType(const px_value_t * pv) |
80 | 0 | { |
81 | 0 | return ok_iff(pv->value.i == eUByte); |
82 | 0 | } |
83 | | static int |
84 | | checkDitherMatrixDepth(const px_value_t * pv) |
85 | 0 | { |
86 | 0 | return ok_iff(pv->value.i == e8Bit); |
87 | 0 | } |
88 | | static int |
89 | | checkDitherMatrixSize(const px_value_t * pv) |
90 | 0 | { |
91 | 0 | return ok_iff(pv->value.i >= 1 && pv->value.i <= 256); |
92 | 0 | } |
93 | | static int |
94 | | checkGrayLevel(const px_value_t * pv) |
95 | 3.62k | { |
96 | 3.62k | return ok_iff(pv->type & pxd_any_real ? |
97 | 3.62k | pv->value.r >= 0 && pv->value.r <= 1 : true); |
98 | 3.62k | } |
99 | | |
100 | | static int |
101 | | checkPageAngle(const px_value_t * pv) |
102 | 221 | { |
103 | | /* XL 1.0 generates an error for non-orthogonal page angles */ |
104 | 221 | return 0; |
105 | 221 | } |
106 | | |
107 | | static int |
108 | | checkPageScale(const px_value_t * pv) |
109 | 220 | { |
110 | 220 | real x = real_value(pv, 0), y = real_value(pv, 1); |
111 | | |
112 | 220 | return ok_iff(x >= 0 && x <= 32767 && y >= 0 && y <= 32767); |
113 | 220 | } |
114 | | static int |
115 | | checkRGBColor(const px_value_t * pv) |
116 | 3.18k | { |
117 | 3.18k | if (pv->value.array.size != 3) |
118 | 1 | return_error(errorIllegalArraySize); |
119 | 3.18k | if (pv->type & pxd_any_real) { /* Check for values between 0 and 1. */ |
120 | 0 | uint i; |
121 | |
|
122 | 0 | for (i = 0; i < pv->value.array.size; ++i) { |
123 | 0 | real v = real_elt(pv, i); |
124 | |
|
125 | 0 | if (v < 0.0 || v > 1.0) |
126 | 0 | return_error(errorIllegalAttributeValue); |
127 | 0 | } |
128 | 0 | } |
129 | 3.18k | return 0; |
130 | 3.18k | } |
131 | | static int |
132 | | checkSourceHeight(const px_value_t * pv) |
133 | 382 | { |
134 | 382 | return ok_iff(pv->value.i >= 1 && pv->value.i <= 65535); |
135 | 382 | } |
136 | | #define checkSourceWidth checkSourceHeight |
137 | | static int |
138 | | checkUnitsPerMeasure(const px_value_t * pv) |
139 | 1.82k | { |
140 | 1.82k | real x = real_value(pv, 0), y = real_value(pv, 1); |
141 | | |
142 | 1.82k | return ok_iff(x > 0 && x <= 65535 && y > 0 && y <= 65535); |
143 | 1.82k | } |
144 | | #undef ok_iff |
145 | | |
146 | | const px_attr_value_type_t px_attr_value_types[] = { |
147 | | /* 0 */ none, |
148 | | /* 1 */ none, |
149 | | /* 2 */ en(pxeColorDepth_next), /* PaletteDepth */ |
150 | | /* 3 */ en(pxeColorSpace_next), /* ColorSpace */ |
151 | | /* 4 */ zero, /* NullBrush */ |
152 | | /* 5 */ zero, /* NullPen */ |
153 | | /* 6 */ arr(ub), /* PaletteData */ |
154 | | /* 7 */ none, |
155 | | /* 8 */ sc(ss), /* PatternSelectID */ |
156 | | /* 9 */ scp(ub | rl, checkGrayLevel), /* GrayLevel */ |
157 | | /* 10 */ none, |
158 | | /* 11 */ arrp(ub | rl, checkRGBColor), /* RGBColor */ |
159 | | /* 12 */ xy(ss), /* PatternOrigin */ |
160 | | /* 13 */ xyp(us, checkDestinationSize), /* NewDestinationSize */ |
161 | | /* 14 */ arr(ub), /* PrimaryArray */ |
162 | | /* 15 */ en(pxeColorDepth_next), /* PrimaryDepth */ |
163 | | /* 16 */ none, |
164 | | /* 17 */ none, /* ColorimetricColorSpace */ |
165 | | /* 18 */ arr(rl), /* XYChromaticities */ |
166 | | /* 19 */ arr(rl), /* WhiteReferencePoint */ |
167 | | /* 20 */ arr(rl), /* CRGBMinMax */ |
168 | | /* 21 */ arr(rl), /* GammaGain */ |
169 | | /* 22 */ none, |
170 | | /* 23 */ none, |
171 | | /* 24 */ none, |
172 | | /* 25 */ none, |
173 | | /* 26 */ none, |
174 | | /* 27 */ none, |
175 | | /* 28 */ none, |
176 | | /* 29 */ en(pxeColorTrapping_next), /* AllObjects NB ColorTrapping is largest enum */ |
177 | | /* 30 */ en(pxeColorTrapping_next), /* TextObjects */ |
178 | | /* 31 */ en(pxeColorTrapping_next), /* VectorObjects */ |
179 | | /* 32 */ en(pxeColorTrapping_next), /* RasterObjects */ |
180 | | /* 33 */ en(pxeDitherMatrix_next), /* DeviceMatrix */ |
181 | | /* 34 */ enp(pxeDataType_next, checkDitherMatrixDataType), /* DitherMatrixDataType */ |
182 | | /* 35 */ xy(ub | us | ss), /* DitherOrigin */ |
183 | | /* 36 */ scub(), /* MediaDestination */ |
184 | | /* 37 */ {pxd_scalar | pxd_array | pxd_ubyte, 255}, /* MediaSize */ |
185 | | /* 38 */ scub(), /* MediaSource */ |
186 | | /* 39 */ arr(ub), /* MediaType */ |
187 | | /* 40 */ scub(), /* Orientation -- illegal values only produce a warning! */ |
188 | | /* 41 */ scp(us | ss, checkPageAngle), /* PageAngle */ |
189 | | /* 42 */ xy(ub | us | ss), /* PageOrigin */ |
190 | | /* 43 */ xyp(ub | us | rl, checkPageScale), /* PageScale */ |
191 | | /* 44 */ scub(), /* ROP3 */ |
192 | | /* 45 */ en(pxeTxMode_next), /* TxMode */ |
193 | | /* 46 */ none, |
194 | | /* 47 */ xy(us | rl), /* CustomMediaSize */ |
195 | | /* 48 */ en(pxeMeasure_next), /* CustomMediaSizeUnits */ |
196 | | /* 49 */ sc(us), /* PageCopies */ |
197 | | /* 50 */ xyp(us, checkDitherMatrixSize), /* DitherMatrixSize */ |
198 | | /* 51 */ enp(pxeColorDepth_next, checkDitherMatrixDepth), /* DitherMatrixDepth */ |
199 | | /* 52 */ en(pxeSimplexPageMode_next), /* SimplexPageMode */ |
200 | | /* 53 */ en(pxeDuplexPageMode_next), /* DuplexPageMode */ |
201 | | /* 54 */ en(pxeDuplexPageSide_next), /* DuplexPageSide */ |
202 | | /* 55 */ none, |
203 | | /* 56 */ none, |
204 | | /* 57 */ none, |
205 | | /* 58 */ none, |
206 | | /* 59 */ none, |
207 | | /* 60 */ none, |
208 | | /* 61 */ none, |
209 | | /* 62 */ none, |
210 | | /* 63 */ none, |
211 | | /* 64 */ none, |
212 | | /* 65 */ en(pxeArcDirection_next), /* ArcDirection */ |
213 | | /* 66 */ box(ub | us | ss), /* BoundingBox */ |
214 | | /* 67 */ sc(ub | us | ss), /* DashOffset */ |
215 | | /* 68 */ xy(ub | us), /* EllipseDimension */ |
216 | | /* 69 */ xy(ub | us | ss), /* EndPoint */ |
217 | | /* 70 */ en(pxeFillMode_next), /* FillMode */ |
218 | | /* 71 */ en(pxeLineCap_next), /* LineCapStyle */ |
219 | | /* 72 */ en(pxeLineJoin_next), /* LineJoinStyle */ |
220 | | /* 73 */ sc(ub | us), /* MiterLength */ |
221 | | /* 74 */ arr(ub | us | ss), /* LineDashStyle */ |
222 | | /* 75 */ sc(ub | us), /* PenWidth */ |
223 | | /* 76 */ xy(ub | us | ss), /* Point */ |
224 | | /* 77 */ sc(ub | us), /* NumberOfPoints */ |
225 | | /* 78 */ zero, /* SolidLine */ |
226 | | /* 79 */ xy(ub | us | ss), /* StartPoint */ |
227 | | /* 80 */ en(pxeDataType_next), /* PointType */ |
228 | | /* 81 */ xy(ub | us | ss), /* ControlPoint1 */ |
229 | | /* 82 */ xy(ub | us | ss), /* ControlPoint2 */ |
230 | | /* 83 */ en(pxeClipRegion_next), /* ClipRegion */ |
231 | | /* 84 */ en(pxeClipMode_next), /* ClipMode */ |
232 | | /* 85 */ none, |
233 | | /* 86 */ none, |
234 | | /* 87 */ none, |
235 | | /* 88 */ none, |
236 | | /* 89 */ none, |
237 | | /* 90 */ none, |
238 | | /* 91 */ none, |
239 | | /* 92 */ none, |
240 | | /* 93 */ none, |
241 | | /* 94 */ none, |
242 | | /* 95 */ none, |
243 | | /* 96 */ none, |
244 | | /* 97 */ none, |
245 | | /* 98 */ en(pxeColorDepth_next), /* ColorDepth */ |
246 | | /* 99 */ sc(us), /* BlockHeight */ |
247 | | /* 100 */ en(pxeColorMapping_next), /* ColorMapping */ |
248 | | /* 101 */ en(pxeCompressMode_next), /* CompressMode */ |
249 | | /* 102 */ box(us), /* DestinationBox */ |
250 | | /* 103 */ xyp(us, checkDestinationSize), /* DestinationSize */ |
251 | | /* 104 */ en(pxePatternPersistence_next), /* PatternPersistence */ |
252 | | /* 105 */ sc(ss), /* PatternDefineID */ |
253 | | /* 106 */ none, |
254 | | /* 107 */ scp(us, checkSourceHeight), /* SourceHeight */ |
255 | | /* 108 */ scp(us, checkSourceWidth), /* SourceWidth */ |
256 | | /* 109 */ sc(us), /* StartLine */ |
257 | | /* 110 */ scub(), /* PadBytesMultiple */ |
258 | | /* 111 */ sc(ul), /* BlockByteLength */ |
259 | | /* 112 */ none, |
260 | | /* 113 */ none, |
261 | | /* 114 */ none, |
262 | | /* 115 */ sc(us), /* NumberOfScanLines */ |
263 | | /* 116 */ none, |
264 | | /* 117 */ none, |
265 | | /* 118 */ none, |
266 | | /* 119 */ none, |
267 | | /* 120 */ en(pxeColorTreatment_next), /* ColorTreatment */ |
268 | | /* 121 */ none, |
269 | | /* 122 */ none, |
270 | | /* 123 */ none, |
271 | | /* 124 */ none, |
272 | | /* 125 */ none, |
273 | | /* 126 */ none, |
274 | | /* 127 */ none, |
275 | | /* 128 */ none, |
276 | | /* 129 */ arr(ub | us), /* CommentData */ |
277 | | /* 130 */ en(pxeDataOrg_next), /* DataOrg */ |
278 | | /* 131 */ none, |
279 | | /* 132 */ none, |
280 | | /* 133 */ none, |
281 | | /* 134 */ en(pxeMeasure_next), /* Measure */ |
282 | | /* 135 */ none, |
283 | | /* 136 */ en(pxeDataSource_next), /* DataSource */ |
284 | | /* 137 */ xyp(us | rl, checkUnitsPerMeasure), /* UnitsPerMeasure */ |
285 | | /* 138 */ none, |
286 | | /* 139 */ arr(ub | us), /* StreamName */ |
287 | | /* 140 */ sc(ul), /* StreamDataLength */ |
288 | | /* 141 */ arr(ub | us), /* PCLSelectFont */ |
289 | | /* 142 */ none, |
290 | | /* 143 */ en(pxeErrorReport_next), /* ErrorReport */ |
291 | | /* 144 */ none, |
292 | | /* 145 */ sc(ul), /* VUExtension */ |
293 | | /* 146 */ sc(ul), /* VUDataLength */ |
294 | | /* 147 */ sc(ub | us | ul), /* VUAttr1 */ |
295 | | /* 148 */ sc(ub | us | ul), /* VUAttr2 */ |
296 | | /* 149 */ sc(ub | us | ul), /* VUAttr3 */ |
297 | | /* 150 */ sc(ub | us | ul), /* VUAttr4 */ |
298 | | /* 151 */ sc(ub | us | ul), /* VUAttr5 */ |
299 | | /* 152 */ sc(ub | us | ul), /* VUAttr6 */ |
300 | | /* 153 */ none, |
301 | | /* 154 */ none, |
302 | | /* 155 */ none, |
303 | | /* 156 */ none, |
304 | | /* 157 */ none, |
305 | | /* 158 */ none, |
306 | | /* 159 */ none, |
307 | | /* 160 */ none, |
308 | | /* 161 */ scp(us | ss | rl, checkCharAngle), /* CharAngle */ |
309 | | /* 162 */ sc(ub | us), /* CharCode */ |
310 | | /* 163 */ sc(us | ul), /* CharDataSize HP spec says us - driver sometimes emits ul */ |
311 | | /* 164 */ xyp(ub | us | rl, checkCharScale), /* CharScale */ |
312 | | /* 165 */ xyp(ub | us | ss | rl, checkCharShear), /* CharShear */ |
313 | | /* 166 */ sc(ub | us | rl), /* CharSize */ |
314 | | /* 167 */ sc(us), /* FontHeaderLength */ |
315 | | /* 168 */ arr(ub | us), /* FontName */ |
316 | | /* 169 */ zero, /* FontFormat */ |
317 | | /* 170 */ sc(us), /* SymbolSet */ |
318 | | /* 171 */ arr(ub | us), /* TextData */ |
319 | | /* 172 */ arr(ub), /* CharSubModeArray */ |
320 | | /* 173 */ en(pxeWritingMode_next), /* WritingMode */ |
321 | | /* 174 */ none, |
322 | | /* 175 */ arr(ub | us | ss), /* XSpacingData */ |
323 | | /* 176 */ arr(ub | us | ss), /* YSpacingData */ |
324 | | /* 177 */ scp(rl, checkCharBoldValue), /* CharBoldValue */ |
325 | | }; |
326 | | |
327 | | #undef v |
328 | | #undef vp |
329 | | #undef vub |
330 | | #undef xy |
331 | | #undef xyp |
332 | | #undef box |
333 | | #undef array |
334 | | #undef arrayp |
335 | | #undef en |
336 | | #undef enp |
337 | | #undef zero |
338 | | #undef ub |
339 | | #undef us |
340 | | #undef ul |
341 | | #undef ss |
342 | | #undef sl |
343 | | #undef rl |
344 | | #undef none |
345 | | #undef none5 |
346 | | |
347 | | /* ---------------- Attribute names for debugging ---------------- */ |
348 | | |
349 | | #ifdef DEBUG |
350 | | |
351 | | const char *px_attribute_names[] = { |
352 | | /*0*/ |
353 | | 0, 0, "PaletteDepth", "ColorSpace", "NullBrush", |
354 | | "NullPen", "PaletteData", 0, "PatternSelectID", "GrayLevel", |
355 | | /*10*/ |
356 | | 0, "RGBColor", "PatternOrigin", "NewDestinationSize", "PrimaryArray", |
357 | | "PrimaryDepth", 0, |
358 | | "ColorimetricColorSpace", "XYChromaticities", "WhiteReferencePoint", |
359 | | "CRGBMinMax", "GammaGain", |
360 | | /*22*/ |
361 | | 0, 0, 0, 0, |
362 | | 0, 0, 0, "AllObjectTypes", |
363 | | /*30*/ |
364 | | "TextObjects", "VectorObjects", "RasterObjects", "DeviceMatrix", |
365 | | "DitherMatrixDataType", |
366 | | "DitherOrigin", "MediaDestination", "MediaSize", "MediaSource", |
367 | | "MediaType", |
368 | | /*40*/ |
369 | | "Orientation", "PageAngle", "PageOrigin", "PageScale", "ROP3", |
370 | | "TxMode", 0, "CustomMediaSize", "CustomMediaSizeUnits", "PageCopies", |
371 | | /*50*/ |
372 | | "DitherMatrixSize", "DitherMatrixDepth", "SimplexPageMode", |
373 | | "DuplexPageMode", |
374 | | "DuplexPageSide", |
375 | | 0, 0, 0, 0, 0, |
376 | | /*60*/ |
377 | | 0, 0, 0, 0, 0, |
378 | | "ArcDirection", "BoundingBox", "DashOffset", "EllipseDimension", |
379 | | "EndPoint", |
380 | | /*70*/ |
381 | | "FillMode", "LineCapStyle", "LineJoinStyle", "MiterLength", |
382 | | "LineDashStyle", |
383 | | "PenWidth", "Point", "NumberOfPoints", "SolidLine", "StartPoint", |
384 | | /*80*/ |
385 | | "PointType", "ControlPoint1", "ControlPoint2", "ClipRegion", "ClipMode", |
386 | | 0, 0, 0, 0, 0, |
387 | | /*90*/ |
388 | | 0, 0, 0, 0, 0, |
389 | | 0, 0, 0, "ColorDepth", "BlockHeight", |
390 | | /*100*/ |
391 | | "ColorMapping", "CompressMode", "DestinationBox", "DestinationSize", |
392 | | "PatternPersistence", |
393 | | "PatternDefineID", 0, "SourceHeight", "SourceWidth", "StartLine", |
394 | | /*110*/ |
395 | | "PadBytesMultiple", |
396 | | "BlockByteLength", |
397 | | 0, 0, 0, |
398 | | "NumberOfScanLines", 0, 0, 0, 0, |
399 | | /*120*/ |
400 | | "ColorTreatment", 0, 0, 0, 0, |
401 | | 0, 0, 0, 0, "CommentData", |
402 | | /*130*/ |
403 | | "DataOrg", 0, 0, 0, "Measure", |
404 | | 0, "SourceType", "UnitsPerMeasure", 0, "StreamName", |
405 | | /*140*/ |
406 | | "StreamDataLength", 0, 0, "ErrorReport", "PCLSelectFont", |
407 | | "VUExtension", "VUDataLength", "VUAttr1", "VUAttr2", "VUAttr3", |
408 | | /*150*/ |
409 | | "VUAttr4", "VUAttr5", "VUAttr6", 0, 0, |
410 | | 0, 0, 0, 0, 0, |
411 | | /*160*/ |
412 | | 0, "CharAngle", "CharCode", "CharDataSize", "CharScale", |
413 | | "CharShear", "CharSize", "FontHeaderLength", "FontName", "FontFormat", |
414 | | /*170*/ |
415 | | "SymbolSet", "TextData", "CharSubModeArray", 0, 0, |
416 | | "XSpacingData", "YSpacingData", "CharBoldValue" |
417 | | }; |
418 | | |
419 | | #endif |
420 | | |
421 | | /* ---------------- Tag names for debugging ---------------- */ |
422 | | |
423 | | #ifdef DEBUG |
424 | | |
425 | | const char *px_tag_0_names[0x40] = { |
426 | | /*0x*/ |
427 | | "Null", 0, 0, 0, |
428 | | 0, 0, 0, 0, |
429 | | 0, "HT", "LF", "VT", |
430 | | "FF", "CR", 0, 0, |
431 | | /*1x*/ |
432 | | 0, 0, 0, 0, |
433 | | 0, 0, 0, 0, |
434 | | 0, 0, 0, "ESC", |
435 | | 0, 0, 0, 0, |
436 | | /*2x*/ |
437 | | "Space", 0, 0, 0, |
438 | | 0, 0, 0, "_beginASCII", |
439 | | "_beginBinaryMSB", "_beginBinaryLSB", 0, 0, |
440 | | 0, 0, 0, 0, |
441 | | /*3x*/ |
442 | | 0, 0, 0, 0, |
443 | | 0, 0, 0, 0, |
444 | | 0, 0, 0, 0, |
445 | | 0, 0, 0, 0 |
446 | | }; |
447 | | |
448 | | const char *px_tag_c0_names[0x40] = { |
449 | | /*cx*/ |
450 | | "_ubyte", "_uint16", "_uint32", "_sint16", |
451 | | "_sint32", "_real32", 0, 0, |
452 | | "_ubyte_array", "_uint16_array", "_uint32_array", "_sint16_array", |
453 | | "_sint32_array", "_real32_array", 0, 0, |
454 | | /*dx*/ |
455 | | "_ubyte_xy", "_uint16_xy", "_uint32_xy", "_sint16_xy", |
456 | | "_sint32_xy", "_real32_xy", 0, 0, |
457 | | 0, 0, 0, 0, |
458 | | 0, 0, 0, 0, |
459 | | /*ex*/ |
460 | | "_ubyte_box", "_uint16_box", "_uint32_box", "_sint16_box", |
461 | | "_sint32_box", "_real32_box", 0, 0, |
462 | | 0, 0, 0, 0, |
463 | | 0, 0, 0, 0, |
464 | | /*fx*/ |
465 | | 0, 0, 0, 0, |
466 | | 0, 0, 0, 0, |
467 | | "_attr_ubyte", "_attr_uint16", "_dataLength", "_dataLengthByte", |
468 | | 0, 0, 0, 0 |
469 | | }; |
470 | | |
471 | | #endif |
472 | | |
473 | | /* ---------------- Operator names ---------------- */ |
474 | | |
475 | | /* These are needed even in non-debug configurations, */ |
476 | | /* for producing error reports. */ |
477 | | |
478 | | const char *px_operator_names[0x80] = { |
479 | | /*4x*/ |
480 | | 0, "BeginSession", "EndSession", "BeginPage", |
481 | | "EndPage", 0, "VendorUnique", "Comment", |
482 | | "OpenDataSource", "CloseDataSource", 0, 0, |
483 | | 0, 0, 0, "BeginFontHeader", |
484 | | /*5x*/ |
485 | | "ReadFontHeader", "EndFontHeader", "BeginChar", "ReadChar", |
486 | | "EndChar", "RemoveFont", |
487 | | "SetCharAttributes", |
488 | | "SetDefaultGS", "SetColorTreatment", |
489 | | 0, 0, "BeginStream", |
490 | | "ReadStream", "EndStream", "ExecStream", "RemoveStream", |
491 | | /*6x*/ |
492 | | "PopGS", "PushGS", "SetClipReplace", "SetBrushSource", |
493 | | "SetCharAngle", "SetCharScale", "SetCharShear", "SetClipIntersect", |
494 | | "SetClipRectangle", "SetClipToPage", "SetColorSpace", "SetCursor", |
495 | | "SetCursorRel", "SetHalftoneMethod", "SetFillMode", "SetFont", |
496 | | /*7x*/ |
497 | | "SetLineDash", "SetLineCap", "SetLineJoin", "SetMiterLimit", |
498 | | "SetPageDefaultCTM", "SetPageOrigin", "SetPageRotation", "SetPageScale", |
499 | | "SetPaintTxMode", "SetPenSource", "SetPenWidth", "SetROP", |
500 | | "SetSourceTxMode", "SetCharBoldValue", "SetNeutralAxis", "SetClipMode", |
501 | | /*8x*/ |
502 | | "SetPathToClip", "SetCharSubMode", "BeginUserDefinedLineCap", |
503 | | "pxtEndUserDefinedLineCap", |
504 | | "CloseSubPath", "NewPath", "PaintPath", 0, |
505 | | 0, 0, 0, 0, |
506 | | 0, 0, 0, 0, |
507 | | /*9x*/ |
508 | | 0, "ArcPath", "SetColorTrapping", "BezierPath", |
509 | | "SetAdaptiveHalftoning", "BezierRelPath", "Chord", "ChordPath", |
510 | | "Ellipse", "EllipsePath", 0, "LinePath", |
511 | | 0, "LineRelPath", "Pie", "PiePath", |
512 | | /*ax*/ |
513 | | "Rectangle", "RectanglePath", "RoundRectangle", "RoundRectanglePath", |
514 | | 0, 0, 0, 0, |
515 | | "Text", "TextPath", 0, 0, |
516 | | 0, 0, 0, 0, |
517 | | /*bx*/ |
518 | | "BeginImage", "ReadImage", "EndImage", "BeginRastPattern", |
519 | | "ReadRastPattern", "EndRastPattern", "BeginScan", 0, |
520 | | "EndScan", "ScanLineRel", 0, 0, |
521 | | 0, 0, 0, "Passthrough" |
522 | | }; |
523 | | |
524 | | /* ---------------- Operator definitions ---------------- */ |
525 | | |
526 | | /* Define the implementation of undefined operators. */ |
527 | | static const byte apxBadOperator[] = { 0, 0 }; |
528 | | static int |
529 | | pxBadOperator(px_args_t * par, px_state_t * pxs) |
530 | 121 | { |
531 | 121 | return_error(errorIllegalTag); |
532 | 121 | } |
533 | | |
534 | | #define none {pxBadOperator, apxBadOperator} |
535 | | |
536 | | const px_operator_definition_t px_operator_definitions[] = { |
537 | | /*4x*/ |
538 | | none, |
539 | | {pxBeginSession, apxBeginSession}, |
540 | | {pxEndSession, apxEndSession}, |
541 | | {pxBeginPage, apxBeginPage}, |
542 | | {pxEndPage, apxEndPage}, |
543 | | none, |
544 | | {pxVendorUnique, apxVendorUnique}, |
545 | | {pxComment, apxComment}, |
546 | | {pxOpenDataSource, apxOpenDataSource}, |
547 | | {pxCloseDataSource, apxCloseDataSource}, |
548 | | none, |
549 | | none, |
550 | | none, |
551 | | none, |
552 | | none, |
553 | | {pxBeginFontHeader, apxBeginFontHeader}, |
554 | | /*5x*/ |
555 | | {pxReadFontHeader, apxReadFontHeader}, |
556 | | {pxEndFontHeader, apxEndFontHeader}, |
557 | | {pxBeginChar, apxBeginChar}, |
558 | | {pxReadChar, apxReadChar}, |
559 | | {pxEndChar, apxEndChar}, |
560 | | {pxRemoveFont, apxRemoveFont}, |
561 | | {pxSetCharAttributes, apxSetCharAttributes}, |
562 | | {pxSetDefaultGS, apxSetDefaultGS}, |
563 | | {pxSetColorTreatment, apxSetColorTreatment}, |
564 | | none, |
565 | | none, |
566 | | {pxBeginStream, apxBeginStream}, |
567 | | {pxReadStream, apxReadStream}, |
568 | | {pxEndStream, apxEndStream}, |
569 | | {pxExecStream, apxExecStream}, |
570 | | {pxRemoveStream, apxRemoveStream}, |
571 | | /*6x*/ |
572 | | {pxPopGS, apxPopGS}, |
573 | | {pxPushGS, apxPushGS}, |
574 | | {pxSetClipReplace, apxSetClipReplace}, |
575 | | {pxSetBrushSource, apxSetBrushSource}, |
576 | | {pxSetCharAngle, apxSetCharAngle}, |
577 | | {pxSetCharScale, apxSetCharScale}, |
578 | | {pxSetCharShear, apxSetCharShear}, |
579 | | {pxSetClipIntersect, apxSetClipIntersect}, |
580 | | {pxSetClipRectangle, apxSetClipRectangle}, |
581 | | {pxSetClipToPage, apxSetClipToPage}, |
582 | | {pxSetColorSpace, apxSetColorSpace}, |
583 | | {pxSetCursor, apxSetCursor}, |
584 | | {pxSetCursorRel, apxSetCursorRel}, |
585 | | {pxSetHalftoneMethod, apxSetHalftoneMethod}, |
586 | | {pxSetFillMode, apxSetFillMode}, |
587 | | {pxSetFont, apxSetFont}, |
588 | | /*7x*/ |
589 | | {pxSetLineDash, apxSetLineDash}, |
590 | | {pxSetLineCap, apxSetLineCap}, |
591 | | {pxSetLineJoin, apxSetLineJoin}, |
592 | | {pxSetMiterLimit, apxSetMiterLimit}, |
593 | | {pxSetPageDefaultCTM, apxSetPageDefaultCTM}, |
594 | | {pxSetPageOrigin, apxSetPageOrigin}, |
595 | | {pxSetPageRotation, apxSetPageRotation}, |
596 | | {pxSetPageScale, apxSetPageScale}, |
597 | | {pxSetPaintTxMode, apxSetPaintTxMode}, |
598 | | {pxSetPenSource, apxSetPenSource}, |
599 | | {pxSetPenWidth, apxSetPenWidth}, |
600 | | {pxSetROP, apxSetROP}, |
601 | | {pxSetSourceTxMode, apxSetSourceTxMode}, |
602 | | {pxSetCharBoldValue, apxSetCharBoldValue}, |
603 | | {pxSetNeutralAxis, apxSetNeutralAxis}, |
604 | | {pxSetClipMode, apxSetClipMode}, |
605 | | /*8x*/ |
606 | | {pxSetPathToClip, apxSetPathToClip}, |
607 | | {pxSetCharSubMode, apxSetCharSubMode}, |
608 | | {pxBeginUserDefinedLineCap, apxBeginUserDefinedLineCap}, |
609 | | {pxEndUserDefinedLineCap, apxEndUserDefinedLineCap}, |
610 | | {pxCloseSubPath, apxCloseSubPath}, |
611 | | {pxNewPath, apxNewPath}, |
612 | | {pxPaintPath, apxPaintPath}, |
613 | | none, |
614 | | none, |
615 | | none, |
616 | | none, |
617 | | none, |
618 | | none, |
619 | | none, |
620 | | none, |
621 | | none, |
622 | | /*9x*/ |
623 | | none, |
624 | | {pxArcPath, apxArcPath}, |
625 | | {pxSetColorTrapping, apxSetColorTrapping}, |
626 | | {pxBezierPath, apxBezierPath}, |
627 | | {pxSetAdaptiveHalftoning, apxSetAdaptiveHalftoning}, |
628 | | {pxBezierRelPath, apxBezierRelPath}, |
629 | | {pxChord, apxChord}, |
630 | | {pxChordPath, apxChordPath}, |
631 | | {pxEllipse, apxEllipse}, |
632 | | {pxEllipsePath, apxEllipsePath}, |
633 | | none, |
634 | | {pxLinePath, apxLinePath}, |
635 | | none, |
636 | | {pxLineRelPath, apxLineRelPath}, |
637 | | {pxPie, apxPie}, |
638 | | {pxPiePath, apxPiePath}, |
639 | | /*ax*/ |
640 | | {pxRectangle, apxRectangle}, |
641 | | {pxRectanglePath, apxRectanglePath}, |
642 | | {pxRoundRectangle, apxRoundRectangle}, |
643 | | {pxRoundRectanglePath, apxRoundRectanglePath}, |
644 | | none, |
645 | | none, |
646 | | none, |
647 | | none, |
648 | | {pxText, apxText}, |
649 | | {pxTextPath, apxTextPath}, |
650 | | none, |
651 | | none, |
652 | | none, |
653 | | none, |
654 | | none, |
655 | | none, |
656 | | /*bx*/ |
657 | | {pxBeginImage, apxBeginImage}, |
658 | | {pxReadImage, apxReadImage}, |
659 | | {pxEndImage, apxEndImage}, |
660 | | {pxBeginRastPattern, apxBeginRastPattern}, |
661 | | {pxReadRastPattern, apxReadRastPattern}, |
662 | | {pxEndRastPattern, apxEndRastPattern}, |
663 | | {pxBeginScan, apxBeginScan}, |
664 | | none, |
665 | | {pxEndScan, apxEndScan}, |
666 | | {pxScanLineRel, apxScanLineRel}, |
667 | | none, |
668 | | none, |
669 | | none, |
670 | | none, |
671 | | none, |
672 | | {pxPassthrough, apxPassthrough} |
673 | | }; |