2 Copyright (c) 1999-2012 OPEN CASCADE SAS
4 The content of this file is subject to the Open CASCADE Technology Public
5 License Version 6.5 (the "License"). You may not use the content of this file
6 except in compliance with the License. Please obtain a copy of the License
7 at http://www.opencascade.org and read it completely before using this file.
9 The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10 main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 The Original Code and all software distributed under the License is
13 distributed on an "AS IS" basis, without warranty of any kind, and the
14 Initial Developer hereby disclaims all such warranties, including without
15 limitation, any warranties of merchantability, fitness for a particular
16 purpose or non-infringement. Please see the License for the specific terms
17 and conditions governing the rights and limitations under the License.
24 /* Include all files on which this is dependent. */
33 /* All default values set within the control program */
34 /* with Character encoding defaults */
37 /* Initialise flags */
39 Enum cgmstate = MF_CLOSED; /* Initial CGM State */
41 Logical cgmterm = FALSE; /* Flag set for input from stdin */
43 Logical cgmEOF = FALSE; /* End of File flag is OFF */
45 Logical cgmfinished = FALSE ; /* Interpreter finished flag */
47 /* Default string start and terminator */
49 Code st_start = 0x1b58, st_term = 0x1b5c;
54 char *name; /* Name or abreviation */
55 int chrs; /* Minimum number of characters to match */
56 Enum type; /* Output driver */
59 /* Arrays for decoding Clear Text elements */
61 const struct commands cgmelement[] = {
63 /* Graphics primitives */
65 {0x20, "LINE"}, {0x20, "INCRLINE"},
66 {0x21, "DISJTLINE"}, {0x21, "INCRDISJTLINE"},
67 {0x22, "MARKER"}, {0x22, "INCRMARKER"},
71 {0x26, "POLYGON"}, {0x26, "INCRPOLYGON"},
72 {0x27, "POLYGONSET"}, {0x27, "INCRPOLYGONSET"},
79 {0x3422, "ARC3PTCLOSE"},
81 {0x3424, "ARCCTRCLOSE"},
84 {0x3427, "ELLIPARCCLOSE"},
86 /* Attribute elements */
88 {0x3520, "LINEINDEX"},
90 {0x3522, "LINEWIDTH"},
92 {0x3524, "MARKERINDEX"},
93 {0x3525, "MARKERTYPE"},
94 {0x3526, "MARKERSIZE"},
95 {0x3527, "MARKERCOLR"},
97 {0x3530, "TEXTINDEX"},
98 {0x3531, "TEXTFONTINDEX"},
100 {0x3533, "CHAREXPAN"},
101 {0x3534, "CHARSPACE"},
102 {0x3535, "TEXTCOLR"},
103 {0x3536, "CHARHEIGHT"},
105 {0x3538, "TEXTPATH"},
106 {0x3539, "TEXTALIGN"},
107 {0x353A, "CHARSETINDEX"},
108 {0x353B, "ALTCHARSETINDEX"},
110 {0x3620, "FILLINDEX"},
111 {0x3621, "INTSTYLE"},
112 {0x3622, "FILLCOLR"},
113 {0x3623, "HATCHINDEX"},
114 {0x3624, "PATINDEX"},
115 {0x3625, "EDGEINDEX"},
116 {0x3626, "EDGETYPE"},
117 {0x3627, "EDGEWIDTH"},
118 {0x3628, "EDGECOLR"},
121 {0x362A, "FILLREFPT"},
122 {0x362B, "PATTABLE"},
124 {0x3630, "COLRTABLE"},
127 /* Control elements */
129 {0x3320, "VDCINTEGERPREC"},
130 {0x3321, "VDCREALPREC"},
132 {0x3323, "TRANSPARENCY"},
133 {0x3324, "CLIPRECT"},
136 /* Metafile Control Elements */
141 {0x3023, "BEGPICBODY"},
144 /* Metafile Descriptor elements */
146 {0x3120, "MFVERSION"},
149 {0x3123, "INTEGERPREC"},
150 {0x3124, "REALPREC"},
151 {0x3125, "INDEXPREC"},
152 {0x3126, "COLRPREC"},
153 {0x3127, "COLRINDEXPREC"},
154 {0x3128, "MAXCOLRINDEX"},
155 {0x3129, "COLRVALUEEXT"},
156 {0x312A, "MFELEMLIST"},
157 {0x312B, "BEGMFDEFAULTS"},
158 {0x312C, "ENDMFDEFAULTS"},
159 {0x312D, "FONTLIST"},
160 {0x312E, "CHARSETLIST"},
161 {0x312F, "CHARCODING"},
163 /* Picture descriptor elements */
165 {0x3220, "SCALEMODE"},
166 {0x3221, "COLRMODE"},
167 {0x3222, "LINEWIDTHMODE"},
168 {0x3223, "MARKERSIZEMODE"},
169 {0x3224, "EDGEWIDTHMODE"},
171 {0x3226, "BACKCOLR"},
173 /* Escape Elements */
177 {0x3722, "APPLDATA"},
179 /* Version 2 element names */
187 {0x3029, "BEGGKSSESSIONMF"},
188 {0x302A, "BEGGKSSESSION"},
189 {0x302B, "ENDGKSSESSION"},
191 {0x3130, "NAMEPREC"},
192 {0x3131, "MAXVDCEXT"},
193 {0x3132, "SEGPRIEXT"},
196 {0x3228, "DEVVPMODE"},
197 {0x3229, "DEVVPMAP"},
199 {0x322B, "MARKERREP"},
204 {0x3326, "LINECLIPMODE"},
205 {0x3327, "MARKERCLIPMODE"},
206 {0x3328, "EDGECLIPMODE"},
207 {0x3329, "NEWREGION"},
208 {0x332A, "SAVEPRIMCONT"},
209 {0x332B, "RESPRIMCONT"},
216 {0x3428, "ARCCTRREV"},
217 {0x3429, "CONNEDGE"},
222 {0x3821, "INHFILTER"},
224 {0x3823, "SEGTRANS"},
225 {0x3824, "SEGHIGHLIGHT"},
226 {0x3825, "SEGDISPPRI"},
227 {0x3826, "SEGPICKPRI"},
230 {0x3828, "RENAMESEG"},
231 {0x3829, "REDRAWALLSEG"},
237 {0x302C, "BEGPROTREGION"},
238 {0x302D, "ENDPROTREGION"},
239 {0x302E, "BEGCOMPOLINE"},
240 {0x302F, "ENDCOMPOLINE"},
241 {0x3030, "BEGCOMPOTEXTPATH"},
242 {0x3031, "ENDCOMPOTEXTPATH"},
243 {0x3032, "BEGTILEARRAY"},
244 {0x3033, "ENDTILEARRAY"},
246 {0x3133, "COLRMODEL"},
247 {0x3134, "COLRCALIB"},
248 {0x3135, "FONTPROP"},
249 {0x3136, "GLYPHMAP"},
250 {0x3137, "SYMBOLLIBLIST"},
252 {0x322F, "INTSTYLEMODE"},
253 {0x3230, "LINEEDGETYPEDEF"},
254 {0x3231, "HATCHSTYLEDEF"},
255 {0x3232, "GEOPATDEF"},
257 {0x3330, "PROTREGION"},
258 {0x3331, "GENTEXTPATHMODE"},
259 {0x3332, "MITRELLIMIT"},
260 {0x3333, "TRANSPCELLCOLR"},
262 {0x342A, "HYPERBARC"},
263 {0x342B, "PARABARC"},
266 {0x342E, "POLYBEZIER"},
267 {0x342F, "SYMBOL"}, {0x342F, "INCRSYMBOL"},
268 {0x3430, "BITONALTILE"},
272 {0x3529, "LINEJOIN"},
273 {0x352A, "LINETYPECONT"},
274 {0x352B, "LINETYPEINITOFFSET"},
275 {0x352C, "TEXTSCORETYPE"},
276 {0x352D, "RESTTEXTTYPE"},
277 {0x352E, "INTERPINT"},
279 {0x362D, "EDGEJOIN"},
280 {0x362E, "EDGETYPECONT"},
281 {0x362F, "EDGETYPEINITOFFSET"},
282 {0x3633, "SYMBOLLIBINDEX"},
283 {0x3634, "SYMBOLCOLR"},
284 {0x3635, "SYMBOLSIZE"},
285 {0x3636, "SYMBOLORI"},
290 /* MFelemlist special names */
292 {0x10, "DRAWINGSET"},
293 {0x11, "DRAWINGPLUS"},
297 {0x14, "VERSION2GKSM"},
306 /* Metafile Default settings */
308 const struct char_defaults chardef = {
309 10, /* integer prec */
311 20, /* vdc integer prec */
312 {10, -10, -10, 1}, /* real precision */
313 {10, -10, -10, 1}, /* vdc real precision */
315 10, /* colour index prec */
316 {0, 0, 0, 0}, /* minimum colour extent */
317 {1, 63, 63, 63}, /* maximum colour extent */
318 0, 1, 1 /* ring parameters for DCC (Huffman codes) */
320 struct char_defaults mfchar, mfichar, curichar, curchar, oldchar;
322 const struct text_defaults textdef = {
323 -32767, /* min integer */
324 32767, /* max integer */
327 -32767.0F, /* min real */
328 32767.0F, /* max real */
330 {-32767, 0.0F}, /* min VDC (int, real) */
331 { 32767, 1.0F}, /* max VDC (int, real) */
333 127, /* colour index*/
334 255, /* colour precision*/
335 {0, 0, 0, 0}, /* minimum colour value extent */
336 {1, 255, 255, 255} /* maximum colour value extent */
338 struct text_defaults mftext, mfitext, curitext, curtext;
340 const struct bin_defaults bindef = {
341 16, /* integer prec */
343 16, /* vdc integer prec */
347 16, /* real fraction */
348 16, /* vdc real whole */
349 16, /* vdc real fraction */
351 8, /* colour index prec */
352 {0, 0, 0, 0}, /* minimum colour value extent */
353 {1, 255, 255, 255} /* maximum colour value extent */
355 struct bin_defaults mfbin, mfibin, curibin, curbin;
357 const struct defaults commondef = {
358 63, /* max colour index */
360 ON, /* clip indicator */
361 ON, /* transparency */
362 INDEXED, /* colour mode */
363 ABSTRACT, /* scale mode */
364 1.0F, /* scale factor */
365 SCALED, /* line width mode */
366 SCALED, /* marker size mode */
367 SCALED, /* edge width mode */
368 {0, 0, 0, 0}, /* background colour */
369 {0, 0, 0, 0}, /* auxilary colour (device dependent) */
370 {{{0, 0.0F}, {0, 0.0F}}, /* vdc extent - bottom left */
371 {{32767, 1.0F}, {32767, 1.0F}}}, /* top right */
372 {{{0, 0.0F}, {0, 0.0F}}, /* clip rectangle - bottom left */
373 {{32767, 1.0F}, {32767, 1.0F}}}, /* top right */
375 /* set precisions to character defaults */
378 10, /* vdcint prec */
384 10, /* colind_prec */
385 -32767.0F, /* min_real */
386 32767.0F, /* max_real */
387 0.00015F, /* realmin */
390 0.00015F, /* vdcmin */
391 -10, 1, /* Real default exp and exponent allowed */
392 -10, 1, /* VDC default exp and exponent allowed */
393 {0, 0, 0, 0}, /* min_rgb */
394 {1, 255,255,255}, /* max_rgb */
395 FALSE, FALSE /* Colour prec & value extent not yet set */
398 /* also use structure for picture defaults and current settings */
400 struct defaults mf, cur, old;
402 /* Hold current attributes seperately */
404 const struct attributes defatt = {
406 1, /* marker index */
414 {33, 1.0F}, /* line width */
415 {327, 1.0F}, /* marker size */
416 {33, 1.0F}, /* edge width */
417 {1, 1,1,1}, /* line colour */
418 {1, 1,1,1}, /* marker colour */
419 {1, 1,1,1}, /* text colour */
420 {1, 1,1,1}, /* fill colour */
421 {1, 1,1,1}, /* edge colour */
424 0, /* horiz alignment */
425 0, /* vertical alignment */
427 1.0F, /* continuous horiz alignment */
428 1.0F, /* continuous vertical alignment */
429 1, /* character set */
430 1, /* alt character set */
431 1.0F, /* character expansion */
432 0.0F, /* character space */
433 {{0, 0.0F}, {1, 1.0F}}, /* character up vector*/
434 {{1, 1.0F}, {0, 0.0F}}, /* character base vector */
435 {327, 0.01F}, /* character height */
436 0, /* interior style */
438 1, /* pattern index */
439 {{0, 0.0F}, {0, 0.0F}}, /* fill Reference point */
440 {{{0, 0.0F}, {1, 1.0F}}, /* pattern size - height */
441 {{1, 1.0F}, {0, 0.0F}}}, /* width */
442 {0, 0, 0, /* Aspect source flags - line (all individual) */
443 0, 0, 0, /* marker */
444 0, 0, 0, 0, 0, /* text */
445 0, 0, 0, 0, /* fill */
447 FALSE, FALSE, FALSE, FALSE, FALSE /* VDC dependent flag settings */
449 struct attributes mfatt, curatt, oldatt;
451 /* Flags for changes to attributes - initially set to false */
457 /* Set default values for common flags */
459 Int cgmerrcount = ERROR_MAX; /* USE error count limit by default */
461 Logical cgmralgks = DEFRALGKSGDP; /* Use RAL-GKS GDPs */
463 Logical cgmralbin = FALSE; /* Old version of RALCGM Binary CGM */
465 Logical cgmverbose = DEFVERBOSE; /* Verbose output */
467 Logical cgmquiet = DEFQUIET; /* Quiet output */
469 /* Clear text listing */
471 Logical cgmlist = FALSE;
474 /* Structures for Font list and Character set */
476 struct cgmfont cgmfonts;
477 struct cgmcset cgmcsets;
479 /* Null pointer for function calls - to fool LINT */
483 /* Default colour table */
485 const RGBcolour GKScol[256] = {
487 /* GKS default colours */
489 {0, 0, 0}, /* Background - Black */
490 {255, 255, 255}, /* Foreground - White */
491 {255, 0, 0}, /* Red */
492 {0, 255, 0}, /* Green */
493 {0, 0, 255}, /* Blue */
494 {255, 255, 0}, /* Yellow */
495 {0, 255, 255}, /* Cyan */
496 {255, 0, 255}, /* Magenta */
498 /* 8 Grey scales ( White to Black ) */
500 {255, 255, 255}, {177, 177, 177}, {158, 158, 158}, {128, 128, 128},
501 {100, 100, 100}, { 78, 78, 78}, { 64, 64, 64}, { 0, 0, 0},
503 /* GKS colour maps from Versatec 16 - 255 */
505 {98, 192, 255}, {139, 122, 255}, { 92, 70, 255}, { 51, 0, 243},
506 {28, 0, 133}, { 20, 0, 93}, { 14, 0, 65}, { 11, 0, 56},
507 {9, 0, 46}, {128, 138, 255}, { 85, 85, 255}, { 0, 0, 255},
508 {0, 0, 168}, { 0, 13, 116}, { 0, 8, 76}, { 0, 8, 68},
510 {122, 139, 255}, { 80, 93, 255}, { 0, 59, 252}, { 0, 39, 168},
511 {0, 28, 122}, { 0, 18, 80}, { 0, 16, 70}, { 122, 149, 255},
512 {70, 108, 255}, { 0, 83, 230}, { 0, 61, 175}, { 0, 44, 128},
513 {0, 29, 85}, { 0, 26, 74}, { 116, 154, 255}, { 59, 118, 255},
515 {0, 97, 219}, { 0, 77, 182}, { 0, 56, 133}, { 0, 37, 89},
516 {0, 33, 79}, {110, 159, 255}, { 43, 131, 255}, { 0, 112, 225},
517 {0, 92, 186}, { 0, 68, 138}, { 0, 46, 93}, { 0, 40, 80},
518 {177, 213, 255}, {104, 173, 255}, { 0, 151, 250}, { 0, 136, 225},
520 {0, 120, 198}, { 0, 89, 147}, { 0, 59, 97}, { 0, 52, 86},
521 {0, 43, 70}, { 0, 186, 186}, { 0, 160, 147}, { 0, 142, 129},
522 {0, 121, 106}, { 0, 89, 78}, { 0, 62, 55}, { 0, 53, 46},
523 {0, 192, 160}, { 0, 160, 123}, { 0, 138, 105}, { 0, 119, 91},
525 {0, 89, 68}, { 0, 59, 44}, { 0, 53, 40}, { 0, 243, 169},
526 {0, 192, 134}, { 0, 160, 113}, { 0, 138, 97}, { 0, 118, 83},
527 {0, 89, 63}, { 0, 59, 41}, { 0, 51, 36}, { 0, 43, 30},
528 {0, 216, 115}, { 0, 175, 113}, { 0, 151, 102}, { 0, 138, 91},
530 {0, 104, 68}, { 0, 70, 46}, { 0, 61, 40}, { 0, 230, 74},
531 {0, 189, 110}, { 0, 171, 100}, { 0, 156, 92}, { 0, 116, 69},
532 {0, 80, 47}, { 0, 56, 33}, { 105, 238, 0}, { 0, 216, 46},
533 {0, 202, 65}, { 0, 189, 71}, { 0, 142, 53}, { 0, 97, 36},
535 {0, 83, 31}, {161, 240, 0}, { 99, 225, 0}, { 120, 219, 0},
536 {92, 208, 0}, { 69, 156, 0}, { 46, 104, 0}, { 41, 93, 0},
537 {197, 243, 0}, {172, 232, 0}, { 168, 227, 0}, { 160, 219, 0},
538 {122, 168, 0}, { 80, 110, 0}, { 70, 97, 0}, { 255, 251, 175},
540 {255, 250, 110}, {255, 249, 70}, { 254, 248, 0}, { 253, 245, 0},
541 {189, 183, 0}, {128, 124, 0}, { 113, 110, 0}, { 89, 86, 0},
542 {255, 209, 116}, {255, 194, 97}, { 255, 191, 85}, { 255, 177, 65},
543 {195, 136, 0}, {133, 92, 0}, { 116, 81, 0}, { 255, 190, 119},
545 {255, 163, 104}, {255, 168, 89}, { 255, 160, 80}, { 195, 113, 0},
546 {133, 77, 0}, {116, 67, 0}, { 255, 173, 122}, { 255, 154, 107},
547 {255, 142, 89}, {255, 112, 0}, { 195, 86, 0}, { 128, 56, 0},
548 {113, 50, 0}, {255, 162, 122}, { 255, 125, 104}, { 255, 100, 65},
550 {247, 80, 0}, {186, 60, 0}, { 122, 39, 0}, { 110, 35, 0},
551 {255, 147, 124}, {255, 98, 89}, { 255, 56, 43}, { 238, 44, 0},
552 {182, 34, 0}, {122, 22, 0}, { 104, 19, 0}, { 255, 168, 170},
553 {255, 122, 128}, {255, 70, 80}, { 250, 0, 38}, { 225, 0, 35},
555 {168, 0, 26}, {110, 0, 17}, { 100, 0, 15}, { 80, 0, 12},
556 {255, 122, 147}, {255, 70, 108}, { 247, 0, 83}, { 225, 0, 72},
557 {168, 0, 54}, {110, 0, 35}, { 97, 0, 31}, { 255, 166, 197},
558 {255, 110, 170}, {255, 43, 150}, { 232, 0, 134}, { 211, 0, 122},
560 {160, 0, 92}, {104, 0, 60}, { 93, 0, 54}, { 76, 0, 44},
561 {255, 80, 204}, {227, 0, 189}, { 199, 0, 165}, { 168, 0, 142},
562 {122, 0, 104}, { 85, 0, 72}, { 74, 0, 63}, { 255, 70, 225},
563 {205, 0, 213}, {175, 0, 175}, { 141, 0, 147}, { 106, 0, 110},
565 {71, 0, 74}, { 62, 0, 65}, { 245, 43, 255}, { 193, 0, 227},
566 {153, 0, 195}, {107, 0, 147}, { 80, 0, 110}, { 55, 0, 76},
567 {47, 0, 65}, {216, 89, 255}, { 150, 43, 255}, { 118, 0, 216},
568 {80, 0, 147}, { 59, 0, 107}, { 38, 0, 70}, { 35, 0, 64},
570 {187, 110, 255}, {122, 59, 255}, { 86, 0, 230}, { 55, 0, 147},
571 {38, 0, 100}, { 25, 0, 68}, { 22, 0, 60}, { 177, 177, 177},
572 {158, 158, 158}, {128, 128, 128}, { 100, 100, 100}, { 78, 78, 78},
573 {0, 0, 0}, { 61, 50, 59}, { 52, 45, 62}, { 36, 61, 59},
575 {127, 118, 109}, { 91, 70, 72}, { 71, 57, 64}, { 79, 62, 64},
576 {28, 33, 32}, { 34, 31, 36}, { 31, 0, 22}, { 252, 182, 142},
577 {223, 145, 135}, {191, 133, 119}, { 155, 100, 94}, { 137, 94, 90},
578 {64, 51, 53}, { 48, 41, 42}, { 255, 148, 116}, { 151, 96, 91}
581 #endif /* end of cgminit.h */