Disable all code related to libXp
[oweals/cde.git] / cde / programs / dtinfo / DtMmdb / StyleSheet / style.C
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 // $TOG: style.C /main/6 1998/04/17 11:51:49 mgreess $
24 #ifndef lint
25 static const char stylesccsid[] = "@(#)yaccpar  1.8 (Berkeley) 01/20/90";
26 #endif
27 #define styleBYACC 1
28 #include <stdio.h>
29 #include <ctype.h>
30 #include <sstream>
31 #include <iostream>
32 using namespace std;
33 #include <assert.h>
34 #include "StyleSheetExceptions.h"
35 #include "VariableTable.h"
36 #include "FeatureValue.h"
37 #include "Expression.h"
38 #include "SSPath.h"
39 #include "PathTable.h"
40 #include "Renderer.h"
41 #include "PathQualifier.h"
42 #include "Debug.h"
43 #include "ParserConst.h"
44 #include "FeatureDefDictionary.h"
45 #include <utility/funcs.h>
46
47 #include "HardCopy/autoNumberFP.h"
48 extern autoNumberFP gAutoNumberFP;
49
50
51 #ifdef alloca
52 # undef alloca
53 #endif
54 #define alloca(x)       (malloc(x))
55
56 extern void styleerror(char*);
57 extern int stylelex();
58
59 extern void enter_sgmlgi_context();
60
61 extern featureDefDictionary* g_FeatureDefDictionary;
62 extern unsigned g_validation_mode;
63 extern unsigned g_hasSemanticError;
64
65 static char localCharToCharPtrBuf[2];
66
67 #undef stylewrap
68
69 const char* toUpperCase(unsigned char* string)
70 {
71    static char buffer[512];
72    int j=0;
73    for ( unsigned int i=0; i<strlen((const char*)string); i++ )
74    {
75                  if (islower(string[i]))
76                    buffer[j] = toupper(string[i]) ;
77                  else
78                    buffer[j] = (char)string[i] ;
79                  j++;
80    }
81    buffer[j] = 0;
82    return buffer;
83 }
84
85 typedef union
86 {
87  unsigned char  charData;
88  unsigned char* charPtrData;
89  unsigned int   boolData;
90  int            intData;
91  float          realData;
92  Expression*    expPtrData;
93  TermNode*      termNodePtrData;
94  FeatureValue*  FeatureValuePtrData;
95  FeatureSet*    FeatureSetPtrData;
96  Feature*       FeaturePtrData;
97  SSPath*        PathPtrData;
98  PathTerm*      PathTermPtrData;
99  charPtrDlist*  charPtrDlistData;
100  PathFeatureList* PathFeatureListPtrData;
101  CompositeVariableNode*      CompositeVariableNodePtrData;
102
103  CC_TPtrSlist<FeatureValue>* FeatureValueSlistPtrData;
104
105  PQExpr*        PQExprPtrData;
106 } styleSTYPE;
107 #define INTEGER 257
108 #define OPER_equality 258
109 #define OPER_relational 259
110 #define BOOLVAL 260
111 #define REAL 261
112 #define OPER_assign 262
113 #define ARRAYOPEN 263
114 #define ARRAYCLOSE 264
115 #define SEPARATOR 265
116 #define FSOPEN 266
117 #define FSCLOSE 267
118 #define OPER_modify 268
119 #define OPER_parent 269
120 #define OPER_attr 270
121 #define OPER_oneof 271
122 #define OPER_star 272
123 #define OPER_or 273
124 #define OPER_and 274
125 #define OPER_div 275
126 #define OPER_parenopen 276
127 #define OPER_parenclose 277
128 #define OPER_logicalnegate 278
129 #define PMEMOPEN 279
130 #define PMEMCLOSE 280
131 #define OPER_period 281
132 #define OPER_plus 282
133 #define OPER_minus 283
134 #define DIMENSION 284
135 #define NORMAL_STRING 285
136 #define UNIT_STRING 286
137 #define QUOTED_STRING 287
138 #define GI_CASE_SENSITIVE 288
139 #define SGMLGI_STRING 289
140 #define styleERRCODE 256
141 short stylelhs[] = {                                        -1,
142     0,   37,   38,   38,   39,   13,   13,   13,   22,   22,
143    14,   15,   19,   19,   19,   11,   11,   10,   10,    7,
144     7,    6,    6,   12,   12,   12,   12,   12,   12,   12,
145    12,   12,   12,   20,   20,    4,    4,   23,   23,   21,
146    21,   17,   17,   18,   18,   40,   40,   24,   29,   29,
147    28,   28,   27,   27,   25,   25,   26,   26,   26,    9,
148     8,    8,    2,   41,    5,    5,    5,   16,    3,    3,
149    34,   30,   30,   31,   31,   32,   32,    1,    1,   35,
150    35,   36,   36,   42,   42,   33,   33,
151 };
152 short stylelen[] = {                                         2,
153     2,    3,    1,    1,    3,    1,    2,    1,    3,    1,
154     2,    2,    1,    1,    1,    3,    1,    3,    1,    1,
155     1,    1,    1,    1,    2,    1,    1,    1,    2,    2,
156     1,    1,    3,    4,    3,    1,    0,    3,    1,    1,
157     1,    4,    2,    3,    1,    1,    0,    3,    3,    1,
158     2,    4,    3,    1,    2,    1,    2,    1,    1,    1,
159     1,    1,    1,    0,    4,    2,    1,    1,    1,    1,
160     3,    1,    3,    1,    3,    4,    3,    1,    1,    1,
161     0,    1,    0,    2,    1,    1,    0,
162 };
163 short styledefred[] = {                                      0,
164     0,    0,    0,   80,    0,   58,   59,   69,   70,    0,
165     0,   63,    0,   56,    4,    1,   85,    3,    0,    2,
166     0,   57,   86,    0,    0,    0,    0,    0,   51,   55,
167    84,    0,    0,    0,    0,   74,    0,   24,    0,    0,
168     0,    0,   68,   28,    0,    0,    0,    0,   19,    0,
169     0,    6,   27,   15,    5,   14,    0,    0,   43,   50,
170     0,   45,    0,    0,   54,    0,    0,   71,    0,    0,
171    29,   30,   11,   12,   10,    0,    0,   22,   23,    0,
172    61,   62,    0,   25,    0,   60,    0,   65,    0,    0,
173     0,    0,    0,   52,    0,   78,   79,   77,    0,   75,
174    33,   35,    0,   41,    0,    0,   18,    0,    9,   44,
175    42,   48,   49,   53,   76,    0,   34,   38,
176 };
177 short styledgoto[] = {                                       2,
178    98,   10,   28,   46,   12,   80,    0,   83,   87,   47,
179    48,   49,   50,   51,   52,   53,   54,   61,   55,   56,
180   105,   57,  106,   62,   13,   14,   64,   15,   63,   34,
181    35,   36,   22,   23,    3,   16,    4,   17,   18,   90,
182    58,   19,
183 };
184 short stylesindex[] = {                                   -277,
185  -246,    0, -225,    0, -218,    0,    0,    0,    0, -231,
186  -228,    0, -259,    0,    0,    0,    0,    0, -225,    0,
187  -265,    0,    0, -221,    0, -234, -225, -222,    0,    0,
188     0, -229, -196, -206, -204,    0, -213,    0, -187, -229,
189  -229, -168,    0,    0,    0, -156, -251, -177,    0, -172,
190  -229,    0,    0,    0,    0,    0, -161, -167,    0,    0,
191  -141,    0, -237, -255,    0, -133, -249,    0, -265, -265,
192     0,    0,    0,    0,    0, -199, -189,    0,    0, -168,
193     0,    0, -168,    0, -161,    0, -229,    0, -229, -139,
194  -221, -229, -225,    0, -158,    0,    0,    0, -204,    0,
195     0,    0, -177,    0, -132, -130,    0, -251,    0,    0,
196     0,    0,    0,    0,    0, -168,    0,    0,
197 };
198 short stylerindex[] = {                                     37,
199     0,    0,  132,    0,    0,    0,    0,    0,    0, -145,
200  -257,    0,    0,    0,    0,    0,    0,    0,  135,    0,
201     0,    0,    0, -127,    1,    0,    0,   30,    0,    0,
202     0,    0,    0,    0, -179,    0,  169,    0,  178,    0,
203     0,    0,    0,    0,   54,    0,  123,  130,    0,  200,
204     0,    0,    0,    0,    0,    0,   77,    0,    0,    0,
205  -129,    0,    0,    0,    0,    0,    0,    0,    0,    0,
206     0,    0,    0,    0,    0,    0, -127,    0,    0,    0,
207     0,    0,    0,    0,  100,    0,    0,    0, -128,    0,
208  -127,    0,    0,    0,    0,    0,    0,    0, -160,    0,
209     0,    0, -155,    0, -122,    0,    0,  146,    0,    0,
210     0,    0,    0,    0,    0, -127,    0,    0,
211 };
212 short stylegindex[] = {                                      0,
213     0,   71,   -1,    0,    0,    0,    0,    0,   74,   60,
214   -42,   64,    0,    0,    0,    0,  134,    0,   57,  -73,
215     0,   94,   33,   61,    0,  138,    0,  -24,    0,    0,
216    83,   84,    0,    0,    0,    0,    0,  136,    0,    0,
217     0,    0,
218 };
219 #define styleTABLESIZE 485
220 short styletable[] = {                                      76,
221    66,   11,   65,  104,   32,   67,   26,   96,   67,   93,
222     1,    6,    7,   67,   67,    5,   27,   11,   67,   33,
223    78,   94,   45,   79,   60,    8,    9,   67,   67,   67,
224    91,   21,   59,   24,  103,   37,   81,   97,   38,   39,
225    75,   20,  104,   86,   26,    6,    7,   40,   41,   75,
226     8,    9,   25,   10,   42,    8,    9,   68,   25,    8,
227     9,   67,   43,    8,    9,   44,   69,   37,  114,   70,
228    38,   39,   71,  103,  102,   45,    8,  101,   75,   40,
229    41,   75,   81,   82,   72,  109,   42,   60,   37,   45,
230   113,   38,   39,   72,   43,    8,    9,   44,   72,    7,
231    40,   41,   66,   73,   81,   82,   77,   42,   40,   40,
232    73,   74,   73,   84,   45,   43,    8,    9,   44,   86,
233    87,   88,   17,   89,   95,   87,   87,  111,  115,   13,
234    87,   83,  116,  117,   82,   37,   92,   47,   46,   87,
235    87,   39,  108,  107,   85,   16,   29,  112,  118,  110,
236    30,   99,    0,  100,   31,    0,    0,    0,    0,    0,
237     0,    0,    0,    0,    0,    0,    0,    0,   31,    0,
238     0,    0,    0,    0,    0,    0,    0,   32,    0,    0,
239     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
240     0,    0,    0,    0,    0,    0,    0,    0,    0,   26,
241     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
242     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
243     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
244     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
245     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
246     0,    0,    0,    0,    0,    0,    0,    0,   66,    0,
247     0,    0,    0,   66,   66,   66,   66,   66,    0,    0,
248     0,   66,   66,    0,    0,   66,   66,   66,    0,    0,
249     0,    0,   66,   66,    0,   66,   66,   67,    0,   64,
250     0,    0,   67,   67,   67,   67,   67,    0,    0,    0,
251    67,   67,    0,    0,   67,   67,   67,   81,   81,    0,
252     0,   67,   67,    0,   67,   67,   36,   10,   10,    0,
253    10,   81,   81,    0,   10,   10,    0,    0,   10,    0,
254     0,    0,    0,    0,   10,   10,   10,    0,   10,   10,
255     8,    8,    0,    8,    0,    0,    0,    8,    8,    0,
256     0,    8,    0,    8,    0,    0,    0,    0,    8,    8,
257     0,    8,    8,    7,    7,    0,    7,    0,    0,    0,
258     7,    7,    0,    0,    7,    0,    7,    0,    0,    0,
259     0,    7,    7,    0,    7,    7,   17,   17,    0,   17,
260     0,    0,    0,   17,   13,    0,   13,    0,    0,   17,
261    13,   13,    0,    0,   17,   17,    0,   17,   17,   16,
262    16,    0,   16,    0,   13,   13,   16,    0,    0,    0,
263     0,    0,   16,    0,    0,    0,    0,   16,   16,    0,
264    16,   16,   31,   31,    0,   31,    0,    0,    0,   31,
265    31,   32,   32,   31,   32,   31,    0,    0,   32,   32,
266    31,   31,   32,   31,   32,    0,    0,    0,    0,   32,
267    32,    0,   32,   26,   26,    0,   26,    0,    0,    0,
268    26,   26,    0,    0,   26,    0,   26,    0,    0,    0,
269     0,   26,   26,    0,   26,
270 };
271 short stylecheck[] = {                                      42,
272     0,    3,   27,   77,  270,  263,  266,  257,  266,  265,
273   288,  271,  272,  271,  272,  262,  276,   19,  276,  285,
274   272,  277,   24,  275,   26,  285,  286,  285,  286,    0,
275   268,  263,  267,  262,   77,  257,    0,  287,  260,  261,
276    42,  260,  116,  281,  266,  271,  272,  269,  270,   51,
277   285,  286,  281,    0,  276,  285,  286,  264,  281,  285,
278   286,  258,  284,  285,  286,  287,  273,  257,   93,  274,
279   260,  261,  286,  116,  264,   77,    0,  277,   80,  269,
280   270,   83,  282,  283,  264,   87,  276,   89,  257,   91,
281    92,  260,  261,  273,  284,  285,  286,  287,  286,    0,
282   269,  270,   32,  264,  282,  283,  263,  276,  264,  265,
283    40,   41,  273,  286,  116,  284,  285,  286,  287,  281,
284   266,  289,    0,  265,  258,  271,  272,  267,  287,    0,
285   276,    0,  265,  264,    0,  263,   63,  267,  267,  285,
286   286,  264,   83,   80,   51,    0,   13,   91,  116,   89,
287    13,   69,   -1,   70,   19,   -1,   -1,   -1,   -1,   -1,
288    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,    0,   -1,
289    -1,   -1,   -1,   -1,   -1,   -1,   -1,    0,   -1,   -1,
290    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
291    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,    0,
292    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
293    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
294    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
295    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
296    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
297    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  258,   -1,
298    -1,   -1,   -1,  263,  264,  265,  266,  267,   -1,   -1,
299    -1,  271,  272,   -1,   -1,  275,  276,  277,   -1,   -1,
300    -1,   -1,  282,  283,   -1,  285,  286,  258,   -1,  289,
301    -1,   -1,  263,  264,  265,  266,  267,   -1,   -1,   -1,
302   271,  272,   -1,   -1,  275,  276,  277,  271,  272,   -1,
303    -1,  282,  283,   -1,  285,  286,  263,  264,  265,   -1,
304   267,  285,  286,   -1,  271,  272,   -1,   -1,  275,   -1,
305    -1,   -1,   -1,   -1,  281,  282,  283,   -1,  285,  286,
306   264,  265,   -1,  267,   -1,   -1,   -1,  271,  272,   -1,
307    -1,  275,   -1,  277,   -1,   -1,   -1,   -1,  282,  283,
308    -1,  285,  286,  264,  265,   -1,  267,   -1,   -1,   -1,
309   271,  272,   -1,   -1,  275,   -1,  277,   -1,   -1,   -1,
310    -1,  282,  283,   -1,  285,  286,  264,  265,   -1,  267,
311    -1,   -1,   -1,  271,  265,   -1,  267,   -1,   -1,  277,
312   271,  272,   -1,   -1,  282,  283,   -1,  285,  286,  264,
313   265,   -1,  267,   -1,  285,  286,  271,   -1,   -1,   -1,
314    -1,   -1,  277,   -1,   -1,   -1,   -1,  282,  283,   -1,
315   285,  286,  264,  265,   -1,  267,   -1,   -1,   -1,  271,
316   272,  264,  265,  275,  267,  277,   -1,   -1,  271,  272,
317   282,  283,  275,  285,  277,   -1,   -1,   -1,   -1,  282,
318   283,   -1,  285,  264,  265,   -1,  267,   -1,   -1,   -1,
319   271,  272,   -1,   -1,  275,   -1,  277,   -1,   -1,   -1,
320    -1,  282,  283,   -1,  285,
321 };
322 #define styleFINAL 2
323 #ifndef styleDEBUG
324 #define styleDEBUG 0
325 #endif
326 #define styleMAXTOKEN 289
327 #if styleDEBUG
328 char *stylename[] = {
329 "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
330 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
331 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
332 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
333 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
334 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
335 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"INTEGER","OPER_equality",
336 "OPER_relational","BOOLVAL","REAL","OPER_assign","ARRAYOPEN","ARRAYCLOSE",
337 "SEPARATOR","FSOPEN","FSCLOSE","OPER_modify","OPER_parent","OPER_attr",
338 "OPER_oneof","OPER_star","OPER_or","OPER_and","OPER_div","OPER_parenopen",
339 "OPER_parenclose","OPER_logicalnegate","PMEMOPEN","PMEMCLOSE","OPER_period",
340 "OPER_plus","OPER_minus","DIMENSION","NORMAL_STRING","UNIT_STRING",
341 "QUOTED_STRING","GI_CASE_SENSITIVE","SGMLGI_STRING",
342 };
343 char *stylerule[] = {
344 "$accept : stylesheet",
345 "stylesheet : sensitivityOPTL statement.gpOPTL",
346 "sensitivity : GI_CASE_SENSITIVE OPER_assign BOOLVAL",
347 "statement.gp : var_assignment",
348 "statement.gp : path_expr",
349 "var_assignment : STRING OPER_assign rhs.gp",
350 "symbol : attr",
351 "symbol : parent string_list",
352 "symbol : string_list",
353 "string_list : string_list OPER_feature STRING",
354 "string_list : STRING",
355 "parent : OPER_parent SGMLGI",
356 "attr : OPER_attr SGMLGI",
357 "rhs.gp : simple_expr",
358 "rhs.gp : array",
359 "rhs.gp : featureset",
360 "simple_expr : simple_expr OPER_add multi_expr",
361 "simple_expr : multi_expr",
362 "multi_expr : multi_expr OPER_mult term",
363 "multi_expr : term",
364 "OPER_binop : OPER_mult",
365 "OPER_binop : OPER_add",
366 "OPER_mult : OPER_star",
367 "OPER_mult : OPER_div",
368 "term : BOOLVAL",
369 "term : symbol UNIT_STRING",
370 "term : symbol",
371 "term : dimension",
372 "term : QUOTED_STRING",
373 "term : INTEGER UNIT_STRING",
374 "term : REAL UNIT_STRING",
375 "term : INTEGER",
376 "term : REAL",
377 "term : OPER_parenopen simple_expr OPER_parenclose",
378 "array : array_name ARRAYOPEN array_member_list ARRAYCLOSE",
379 "array : array_name ARRAYOPEN ARRAYCLOSE",
380 "array_name : STRING",
381 "array_name :",
382 "array_member_list : array_member SEPARATOR array_member_list",
383 "array_member_list : array_member",
384 "array_member : simple_expr",
385 "array_member : array",
386 "featureset : FSOPEN feature_list SEPARATOR_OPTL FSCLOSE",
387 "featureset : FSOPEN FSCLOSE",
388 "feature_list : feature_list SEPARATOR feature",
389 "feature_list : feature",
390 "SEPARATOR_OPTL : SEPARATOR",
391 "SEPARATOR_OPTL :",
392 "feature : feature_name_list OPER_modify rhs.gp",
393 "feature_name_list : feature_name_list OPER_feature STRING",
394 "feature_name_list : STRING",
395 "path_expr : path_term_list featureset",
396 "path_expr : path_term_list OPER_parenopen path_expr_list OPER_parenclose",
397 "path_expr_list : path_expr_list SEPARATOR path_expr",
398 "path_expr_list : path_expr",
399 "path_term_list : path_term_list path_term",
400 "path_term_list : path_term",
401 "path_term : SGMLGI path_selectorOPTL",
402 "path_term : OPER_oneof",
403 "path_term : OPER_star",
404 "OPER_feature : OPER_period",
405 "OPER_add : OPER_plus",
406 "OPER_add : OPER_minus",
407 "SGMLGI : SGMLGI_CONTENT",
408 "$$1 :",
409 "SGMLGI_CONTENT : STRING OPER_period $$1 SGMLGI_STRING",
410 "SGMLGI_CONTENT : STRING OPER_period",
411 "SGMLGI_CONTENT : STRING",
412 "dimension : DIMENSION",
413 "STRING : NORMAL_STRING",
414 "STRING : UNIT_STRING",
415 "path_selector : ARRAYOPEN boolean_expr ARRAYCLOSE",
416 "boolean_expr : logical_and_expr",
417 "boolean_expr : boolean_expr OPER_or logical_and_expr",
418 "logical_and_expr : equality_expr",
419 "logical_and_expr : logical_and_expr OPER_and equality_expr",
420 "equality_expr : OPER_attr SGMLGI OPER_equality QUOTED_STRING",
421 "equality_expr : NORMAL_STRING OPER_equality POSITION_VALUE",
422 "POSITION_VALUE : INTEGER",
423 "POSITION_VALUE : QUOTED_STRING",
424 "sensitivityOPTL : sensitivity",
425 "sensitivityOPTL :",
426 "statement.gpOPTL : statement.gpPLUS",
427 "statement.gpOPTL :",
428 "statement.gpPLUS : statement.gpPLUS statement.gp",
429 "statement.gpPLUS : statement.gp",
430 "path_selectorOPTL : path_selector",
431 "path_selectorOPTL :",
432 };
433 #endif
434 #define styleclearin (stylechar=(-1))
435 #define styleerrok (styleerrflag=0)
436 #ifdef styleSTACKSIZE
437 #ifndef styleMAXDEPTH
438 #define styleMAXDEPTH styleSTACKSIZE
439 #endif
440 #else
441 #ifdef styleMAXDEPTH
442 #define styleSTACKSIZE styleMAXDEPTH
443 #else
444 #define styleSTACKSIZE 500
445 #define styleMAXDEPTH 500
446 #endif
447 #endif
448 int styledebug;
449 int stylenerrs;
450 int styleerrflag;
451 int stylechar;
452 short *stylessp;
453 styleSTYPE *stylevsp;
454 styleSTYPE styleval;
455 styleSTYPE stylelval;
456 short styless[styleSTACKSIZE];
457 styleSTYPE stylevs[styleSTACKSIZE];
458 #define stylestacksize styleSTACKSIZE
459 #define styleABORT goto styleabort
460 #define styleACCEPT goto styleaccept
461 #define styleERROR goto styleerrlab
462 #if styleDEBUG
463 #ifndef __cplusplus
464 extern char *getenv(const char *);
465 #endif
466 #endif
467 int
468 styleparse()
469 {
470     register int stylem, stylen, stylestate;
471 #if styleDEBUG
472     register char *styles;
473
474     if (styles = getenv("styleDEBUG"))
475     {
476         stylen = *styles;
477         if (stylen >= '0' && stylen <= '9')
478             styledebug = stylen - '0';
479     }
480 #endif
481
482     stylenerrs = 0;
483     styleerrflag = 0;
484     stylechar = (-1);
485
486     stylessp = styless;
487     stylevsp = stylevs;
488     *stylessp = stylestate = 0;
489
490 styleloop:
491     if ((stylen = styledefred[stylestate])) goto stylereduce;
492     if (stylechar < 0)
493     {
494         if ((stylechar = stylelex()) < 0) stylechar = 0;
495 #if styleDEBUG
496         if (styledebug)
497         {
498             styles = 0;
499             if (stylechar <= styleMAXTOKEN) styles = stylename[stylechar];
500             if (!styles) styles = "illegal-symbol";
501             printf("styledebug: state %d, reading %d (%s)\n", stylestate,
502                     stylechar, styles);
503         }
504 #endif
505     }
506     if ((stylen = stylesindex[stylestate]) && (stylen += stylechar) >= 0 &&
507             stylen <= styleTABLESIZE && stylecheck[stylen] == stylechar)
508     {
509 #if styleDEBUG
510         if (styledebug)
511             printf("styledebug: state %d, shifting to state %d\n",
512                     stylestate, styletable[stylen]);
513 #endif
514         if (stylessp >= styless + stylestacksize - 1)
515         {
516             goto styleoverflow;
517         }
518         *++stylessp = stylestate = styletable[stylen];
519         *++stylevsp = stylelval;
520         stylechar = (-1);
521         if (styleerrflag > 0)  --styleerrflag;
522         goto styleloop;
523     }
524     if ((stylen = stylerindex[stylestate]) && (stylen += stylechar) >= 0 &&
525             stylen <= styleTABLESIZE && stylecheck[stylen] == stylechar)
526     {
527         stylen = styletable[stylen];
528         goto stylereduce;
529     }
530     if (styleerrflag) goto styleinrecovery;
531 #if 0                                   /* remove if needed */
532 #ifdef lint
533     goto stylenewerror;
534 #endif
535 stylenewerror:
536 #endif  /* if 0 */
537     styleerror((char*)"syntax error");
538 #if 0                                   /* remove if needed */
539 #ifdef lint
540     goto styleerrlab;
541 #endif
542 styleerrlab:
543 #endif /* if 0 */
544     ++stylenerrs;
545 styleinrecovery:
546     if (styleerrflag < 3)
547     {
548         styleerrflag = 3;
549         for (;;)
550         {
551             if ((stylen = stylesindex[*stylessp]) && (stylen += styleERRCODE) >= 0 &&
552                     stylen <= styleTABLESIZE && stylecheck[stylen] == styleERRCODE)
553             {
554 #if styleDEBUG
555                 if (styledebug)
556                     printf("styledebug: state %d, error recovery shifting\
557  to state %d\n", *stylessp, styletable[stylen]);
558 #endif
559                 if (stylessp >= styless + stylestacksize - 1)
560                 {
561                     goto styleoverflow;
562                 }
563                 *++stylessp = stylestate = styletable[stylen];
564                 *++stylevsp = stylelval;
565                 goto styleloop;
566             }
567             else
568             {
569 #if styleDEBUG
570                 if (styledebug)
571                     printf("styledebug: error recovery discarding state %d\n",
572                             *stylessp);
573 #endif
574                 if (stylessp <= styless) goto styleabort;
575                 --stylessp;
576                 --stylevsp;
577             }
578         }
579     }
580     else
581     {
582         if (stylechar == 0) goto styleabort;
583 #if styleDEBUG
584         if (styledebug)
585         {
586             styles = 0;
587             if (stylechar <= styleMAXTOKEN) styles = stylename[stylechar];
588             if (!styles) styles = "illegal-symbol";
589             printf("styledebug: state %d, error recovery discards token %d (%s)\n",
590                     stylestate, stylechar, styles);
591         }
592 #endif
593         stylechar = (-1);
594         goto styleloop;
595     }
596 stylereduce:
597 #if styleDEBUG
598     if (styledebug)
599         printf("styledebug: state %d, reducing by rule %d (%s)\n",
600                 stylestate, stylen, stylerule[stylen]);
601 #endif
602     stylem = stylelen[stylen];
603     styleval = stylevsp[1-stylem];
604     switch (stylen)
605     {
606 case 1:
607 {
608         }
609 break;
610 case 2:
611 {
612           gGI_CASE_SENSITIVE = stylevsp[0].boolData;
613         }
614 break;
615 case 3:
616 {
617         }
618 break;
619 case 4:
620 {
621           /* copy items form the feature list into the path table */
622           PathFeatureListIterator l_Iter(*(stylevsp[0].PathFeatureListPtrData));
623
624           PathFeature *x = 0;
625
626           while ( ++l_Iter ) {
627
628             x = l_Iter.key();
629
630             if ( g_validation_mode == true )
631               if ( g_FeatureDefDictionary -> checkSemantics(x -> featureSet()) == false )
632                  g_hasSemanticError = true;
633                
634             gPathTab -> addPathFeatureSet( x );
635
636
637           }
638
639 /* clear out the first list so the elements are not deleted
640              with the list because they are still referenced by the
641              path table */
642
643           stylevsp[0].PathFeatureListPtrData -> clear();
644           delete stylevsp[0].PathFeatureListPtrData;
645
646         }
647 break;
648 case 5:
649 {
650            Expression *x = new Expression(new ConstantNode(stylevsp[0].FeatureValuePtrData));
651
652            if ( gAutoNumberFP.accept((const char*)stylevsp[-2].charPtrData, x) ) {
653                  delete stylevsp[-2].charPtrData;
654                  delete x;
655                  break;
656            }
657
658            gVariableTable -> enter( gSymTab -> intern((const char*)stylevsp[-2].charPtrData), x);
659            delete stylevsp[-2].charPtrData;
660         }
661 break;
662 case 6:
663 {
664           styleval.termNodePtrData=stylevsp[0].termNodePtrData;
665         }
666 break;
667 case 7:
668 {
669           styleval.termNodePtrData=stylevsp[-1].termNodePtrData;
670         }
671 break;
672 case 8:
673 {
674           const Symbol* x = stylevsp[0].CompositeVariableNodePtrData -> convertableToVariable();
675           if ( x ) {
676             styleval.termNodePtrData=new VariableNode(*x);
677             delete stylevsp[0].CompositeVariableNodePtrData;
678           } else
679             styleval.termNodePtrData=stylevsp[0].CompositeVariableNodePtrData;
680         }
681 break;
682 case 9:
683 {
684
685           stylevsp[-2].CompositeVariableNodePtrData->appendItem(gSymTab->intern(toUpperCase(stylevsp[0].charPtrData)));
686           styleval.CompositeVariableNodePtrData=stylevsp[-2].CompositeVariableNodePtrData;
687           delete stylevsp[0].charPtrData ;
688         }
689 break;
690 case 10:
691 {
692           styleval.CompositeVariableNodePtrData=new CompositeVariableNode;
693           styleval.CompositeVariableNodePtrData -> appendItem(gSymTab->intern(toUpperCase(stylevsp[0].charPtrData)));
694           delete stylevsp[0].charPtrData;
695         }
696 break;
697 case 11:
698 {
699 /*
700           $$=new
701             ParentNode(gSymTab->intern((const char*)$1));
702 */
703           MESSAGE(cerr, "^ operator not supported.");
704           throw(CASTSSEXCEPT StyleSheetException());
705         }
706 break;
707 case 12:
708 {
709           styleval.termNodePtrData=new
710             SgmlAttributeNode(gSymTab->intern((const char*)stylevsp[0].charPtrData));
711           delete stylevsp[0].charPtrData;
712         }
713 break;
714 case 13:
715 {
716           styleval.FeatureValuePtrData=new FeatureValueExpression(stylevsp[0].expPtrData);
717         }
718 break;
719 case 14:
720 {
721           styleval.FeatureValuePtrData=stylevsp[0].FeatureValuePtrData;
722         }
723 break;
724 case 15:
725 {
726           styleval.FeatureValuePtrData=new FeatureValueFeatureSet(stylevsp[0].FeatureSetPtrData);
727         }
728 break;
729 case 16:
730 {
731            BinaryOperatorNode::operatorType opType;
732            switch (stylevsp[-1].charData) {
733              case '+': opType=BinaryOperatorNode::PLUS; break;
734              case '-': opType=BinaryOperatorNode::MINUS; break;
735              default:
736               throw(CASTBEEXCEPT badEvaluationException());
737            }
738
739            FeatureValueExpression* FVexprL = new FeatureValueExpression(stylevsp[-2].expPtrData);
740            FeatureValueExpression* FVexprR = new FeatureValueExpression(stylevsp[0].expPtrData);
741            
742            styleval.expPtrData = new Expression(
743                  new BinaryOperatorNode(opType, 
744                                         new ConstantNode(FVexprL),
745                                         new ConstantNode(FVexprR)
746                                        )
747                               );
748         }
749 break;
750 case 17:
751 {
752            styleval.expPtrData=stylevsp[0].expPtrData;
753         }
754 break;
755 case 18:
756 {
757            BinaryOperatorNode::operatorType opType;
758            switch (stylevsp[-1].charData) {
759              case '*': opType=BinaryOperatorNode::TIMES; break;
760              case '/': opType=BinaryOperatorNode::DIVIDE; break;
761              default:
762               throw(CASTBEEXCEPT badEvaluationException());
763            }
764
765            FeatureValueExpression* FVexpr = new FeatureValueExpression(stylevsp[-2].expPtrData);
766            
767            styleval.expPtrData = new Expression(
768                  new BinaryOperatorNode(opType, new ConstantNode(FVexpr), stylevsp[0].termNodePtrData)
769                               );
770         }
771 break;
772 case 19:
773 {
774            styleval.expPtrData = new Expression(stylevsp[0].termNodePtrData);
775         }
776 break;
777 case 20:
778 {
779            styleval.charData=stylevsp[0].charData;
780         }
781 break;
782 case 21:
783 {
784            styleval.charData=stylevsp[0].charData;
785         }
786 break;
787 case 22:
788 {
789            styleval.charData=stylevsp[0].charData;
790         }
791 break;
792 case 23:
793 {
794            styleval.charData=stylevsp[0].charData;
795         }
796 break;
797 case 24:
798 {
799           styleval.termNodePtrData=new ConstantNode(new FeatureValueInt(int(stylevsp[0].boolData)));
800         }
801 break;
802 case 25:
803 {
804           FeatureValueExpression* fve = 
805                 new FeatureValueExpression(new Expression(stylevsp[-1].termNodePtrData));
806           FeatureValueDimension* x = 
807              new FeatureValueDimension(fve, (const char*)stylevsp[0].charPtrData);
808           delete stylevsp[0].charPtrData ;
809           styleval.termNodePtrData=new ConstantNode(x);
810         }
811 break;
812 case 26:
813 {
814           styleval.termNodePtrData=stylevsp[0].termNodePtrData;
815         }
816 break;
817 case 27:
818 {
819           styleval.termNodePtrData=stylevsp[0].termNodePtrData;
820         }
821 break;
822 case 28:
823 {
824           styleval.termNodePtrData=new ConstantNode(new FeatureValueString((const char*)stylevsp[0].charPtrData));
825           delete stylevsp[0].charPtrData ;
826         }
827 break;
828 case 29:
829 {
830           styleval.termNodePtrData=new ConstantNode(new FeatureValueDimension(new FeatureValueInt(stylevsp[-1].intData), (const char*)stylevsp[0].charPtrData));
831           delete stylevsp[0].charPtrData ;
832         }
833 break;
834 case 30:
835 {
836           styleval.termNodePtrData=new ConstantNode(new FeatureValueDimension(new FeatureValueReal(stylevsp[-1].realData), (const char*)stylevsp[0].charPtrData));
837           delete stylevsp[0].charPtrData ;
838         }
839 break;
840 case 31:
841 {
842           styleval.termNodePtrData=new ConstantNode(new FeatureValueInt(stylevsp[0].intData));
843         }
844 break;
845 case 32:
846 {
847           styleval.termNodePtrData=new ConstantNode(new FeatureValueReal(stylevsp[0].realData));
848         }
849 break;
850 case 33:
851 {
852           styleval.termNodePtrData=new ConstantNode(new FeatureValueExpression(stylevsp[-1].expPtrData));
853         }
854 break;
855 case 34:
856 {
857           FeatureValueArray* x = 
858              new FeatureValueArray((const char*)stylevsp[-3].charPtrData, stylevsp[-1].FeatureValueSlistPtrData -> entries());
859           CC_TPtrSlistIterator<FeatureValue> iter(*stylevsp[-1].FeatureValueSlistPtrData);
860
861           int i = 0;
862           while ( ++iter ) {
863             (*x)[i++] = iter.key();
864           }
865
866           delete stylevsp[-3].charPtrData;
867           delete stylevsp[-1].FeatureValueSlistPtrData;
868
869           styleval.FeatureValuePtrData = x;
870         }
871 break;
872 case 35:
873 {
874           styleval.FeatureValuePtrData = new FeatureValueArray((const char*)stylevsp[-2].charPtrData, 0);
875           delete stylevsp[-2].charPtrData;
876         }
877 break;
878 case 36:
879 {
880           styleval.charPtrData = stylevsp[0].charPtrData;
881         }
882 break;
883 case 37:
884 {
885           styleval.charPtrData = new unsigned char[1];
886           styleval.charPtrData[0] = 0;
887         }
888 break;
889 case 38:
890 {
891            stylevsp[0].FeatureValueSlistPtrData -> prepend(stylevsp[-2].FeatureValuePtrData);
892            styleval.FeatureValueSlistPtrData = stylevsp[0].FeatureValueSlistPtrData;
893         }
894 break;
895 case 39:
896 {
897            styleval.FeatureValueSlistPtrData=new CC_TPtrSlist<FeatureValue>;
898            styleval.FeatureValueSlistPtrData -> append(stylevsp[0].FeatureValuePtrData);
899         }
900 break;
901 case 40:
902 {
903            styleval.FeatureValuePtrData = new FeatureValueExpression(stylevsp[0].expPtrData);
904         }
905 break;
906 case 41:
907 {
908            styleval.FeatureValuePtrData=stylevsp[0].FeatureValuePtrData;
909         }
910 break;
911 case 42:
912 {
913            styleval.FeatureSetPtrData=stylevsp[-2].FeatureSetPtrData;
914         }
915 break;
916 case 43:
917 {
918           styleval.FeatureSetPtrData = new FeatureSet ();
919         }
920 break;
921 case 44:
922 {
923            if (stylevsp[0].FeaturePtrData -> name() == Symbol(gSymTab->intern("FAMILY"))) {
924              /* the evaluate() call clones $3 */
925              FeatureValueFeatureSet *fvfs = 
926                (FeatureValueFeatureSet*) stylevsp[0].FeaturePtrData->evaluate();
927              const FeatureSet* fs = fvfs->value();
928               const Feature* charsetF =
929                 fs->lookup(gSymTab->intern("CHARSET"));
930               /* charsetF is a mandatory entry in fontfamily*/
931               assert( charsetF );
932               const FeatureValueString* fv_string =
933                         (FeatureValueString*)charsetF->value();
934               const char* charset = *fv_string;
935               assert( charset );
936               
937               int entries = stylevsp[-2].FeatureSetPtrData -> entries();
938               for (int i=0; i<entries; i++) {
939                 const Feature* entry = stylevsp[-2].FeatureSetPtrData->at(i);
940                 if (! (entry->name() == Symbol(gSymTab->intern("FAMILY"))))
941                   continue;
942                 const FeatureSet* entry_fs =
943                         ((FeatureValueFeatureSet*)(entry->evaluate()))->value();
944                 const Feature* entry_charsetF =
945                         entry_fs->lookup(gSymTab->intern("CHARSET"));
946                 assert( entry_charsetF );
947                 const char* entry_charset =
948                         *((FeatureValueString*)(entry_charsetF->value()));
949                 assert( entry_charset );
950                 if (! strcmp(charset, entry_charset)) {
951                   delete stylevsp[-2].FeatureSetPtrData -> removeAt(i);
952                   break; /* escape from for-loop*/
953                 }
954               }
955               delete fvfs ;
956
957               styleval.FeatureSetPtrData = stylevsp[-2].FeatureSetPtrData;
958               styleval.FeatureSetPtrData -> add(stylevsp[0].FeaturePtrData);
959            }
960            else {
961               if ( stylevsp[-2].FeatureSetPtrData -> find((Feature*)stylevsp[0].FeaturePtrData) ) {
962                 FeatureSet* fs = new FeatureSet();
963                 fs -> add(stylevsp[0].FeaturePtrData);
964
965                 styleval.FeatureSetPtrData =new FeatureSet(*stylevsp[-2].FeatureSetPtrData, *fs);
966                 delete stylevsp[-2].FeatureSetPtrData;
967                 delete fs;
968               }
969               else {
970                 styleval.FeatureSetPtrData=stylevsp[-2].FeatureSetPtrData;
971                 styleval.FeatureSetPtrData -> add(stylevsp[0].FeaturePtrData);
972               }
973            }
974         }
975 break;
976 case 45:
977 {
978            styleval.FeatureSetPtrData=new FeatureSet();
979            styleval.FeatureSetPtrData -> add(stylevsp[0].FeaturePtrData);
980         }
981 break;
982 case 46:
983 {
984         }
985 break;
986 case 47:
987 {
988         }
989 break;
990 case 48:
991 {
992           CC_TPtrDlistIterator<char> l_Iter(*(stylevsp[-2].charPtrDlistData));
993
994           FeatureSet *fs = 0;
995           Feature *f = 0;
996           FeatureValue *fv = stylevsp[0].FeatureValuePtrData;
997           const char* cptr = 0;
998           char buffer[256];
999           while (++l_Iter) {
1000              cptr = l_Iter.key();
1001              int index = 0 ;
1002              const char *c = cptr ;
1003              while (*c)
1004                {
1005                  if (islower(*c))
1006                    buffer[index] = toupper(*c) ;
1007                  else
1008                    buffer[index] = *c ;
1009                  c++ ;
1010                  index++;
1011                }
1012              buffer[index] = 0;
1013              /* fprintf(stderr, "converted: %s to %s\n", cptr, buffer); */
1014              f = new Feature(gSymTab -> intern(buffer), fv);
1015
1016              if ( stylevsp[-2].charPtrDlistData -> last() != cptr ) {
1017                 fs = new FeatureSet();
1018                 fs -> add(f);
1019                 fv = new FeatureValueFeatureSet(fs);
1020              }
1021           }
1022
1023           stylevsp[-2].charPtrDlistData->clearAndDestroy();
1024           delete stylevsp[-2].charPtrDlistData ;
1025           styleval.FeaturePtrData=f;
1026         }
1027 break;
1028 case 49:
1029 {
1030           stylevsp[-2].charPtrDlistData -> prepend((char *)stylevsp[0].charPtrData);
1031           styleval.charPtrDlistData=stylevsp[-2].charPtrDlistData;
1032         }
1033 break;
1034 case 50:
1035 {
1036           styleval.charPtrDlistData=new CC_TPtrDlist<char>;
1037           styleval.charPtrDlistData -> append((char *)stylevsp[0].charPtrData);
1038         }
1039 break;
1040 case 51:
1041 {
1042            styleval.PathFeatureListPtrData=new PathFeatureList;
1043            styleval.PathFeatureListPtrData -> append(new PathFeature(stylevsp[-1].PathPtrData, stylevsp[0].FeatureSetPtrData));
1044         }
1045 break;
1046 case 52:
1047 {
1048           
1049           PathFeatureListIterator l_Iter(*(stylevsp[-1].PathFeatureListPtrData));
1050
1051           while ( ++l_Iter ) {
1052              (l_Iter.key()) -> path() -> prependPath(*stylevsp[-3].PathPtrData);
1053           }
1054           delete stylevsp[-3].PathPtrData;
1055           styleval.PathFeatureListPtrData=stylevsp[-1].PathFeatureListPtrData;
1056         }
1057 break;
1058 case 53:
1059 {
1060            styleval.PathFeatureListPtrData=stylevsp[-2].PathFeatureListPtrData;
1061            styleval.PathFeatureListPtrData -> appendList(*stylevsp[0].PathFeatureListPtrData);
1062            delete stylevsp[0].PathFeatureListPtrData ;
1063         }
1064 break;
1065 case 54:
1066 {
1067            styleval.PathFeatureListPtrData=stylevsp[0].PathFeatureListPtrData;
1068         }
1069 break;
1070 case 55:
1071 {
1072           stylevsp[-1].PathPtrData -> appendPathTerm(stylevsp[0].PathTermPtrData);
1073           styleval.PathPtrData=stylevsp[-1].PathPtrData;
1074         }
1075 break;
1076 case 56:
1077 {
1078           styleval.PathPtrData = new SSPath;
1079           styleval.PathPtrData -> appendPathTerm(stylevsp[0].PathTermPtrData);
1080         }
1081 break;
1082 case 57:
1083 {
1084           styleval.PathTermPtrData=new PathTerm((const char*)stylevsp[-1].charPtrData, stylevsp[0].PQExprPtrData);
1085           delete stylevsp[-1].charPtrData;
1086         }
1087 break;
1088 case 58:
1089 {
1090           localCharToCharPtrBuf[0]=stylevsp[0].charData; localCharToCharPtrBuf[1]=0;
1091           styleval.PathTermPtrData=new PathTerm(localCharToCharPtrBuf, 0);
1092         }
1093 break;
1094 case 59:
1095 {
1096           localCharToCharPtrBuf[0]=stylevsp[0].charData; localCharToCharPtrBuf[1]=0;
1097           styleval.PathTermPtrData=new PathTerm(localCharToCharPtrBuf, 0);
1098         }
1099 break;
1100 case 60:
1101 {
1102         }
1103 break;
1104 case 61:
1105 {
1106         }
1107 break;
1108 case 62:
1109 {
1110         }
1111 break;
1112 case 63:
1113 {
1114         /* char % can start an OLIAS internal element which*/
1115         /* is used only by the browser.*/
1116         /* Example %BOGUS within HEAD1 in OLIAS book*/
1117
1118            if ( stylevsp[0].charPtrData[0] != '%' && isalnum(stylevsp[0].charPtrData[0]) == 0 ) {
1119               MESSAGE(cerr, form("%s is not a SGMLGI", stylevsp[0].charPtrData));
1120               throw(CASTBEEXCEPT badEvaluationException());
1121            }
1122           /* note, should probably be using RCStrings, would make wide */
1123           /* char handling better too? */
1124            if ( gGI_CASE_SENSITIVE == false )
1125              {
1126                for (unsigned int i=0; i<strlen((const char*)stylevsp[0].charPtrData); i++)
1127                  if ( islower(stylevsp[0].charPtrData[i]) )
1128                    stylevsp[0].charPtrData[i] = toupper(stylevsp[0].charPtrData[i]);
1129              }
1130            styleval.charPtrData=stylevsp[0].charPtrData;
1131         }
1132 break;
1133 case 64:
1134 {enter_sgmlgi_context();}
1135 break;
1136 case 65:
1137 {
1138            int l3 = strlen((char*)stylevsp[-3].charPtrData);
1139            int l0 = strlen((char*)stylevsp[0].charPtrData);
1140            int l = l3 + l0 + 2;
1141            styleval.charPtrData=new unsigned char[l];
1142
1143            *((char *) memcpy((char*)styleval.charPtrData,
1144                              (char*)stylevsp[-3].charPtrData, l3) + l3) = '\0';
1145            *((char *) memcpy((char*)(styleval.charPtrData + l3),
1146                              ".", 1) + 1) = '\0';
1147            *((char *) memcpy((char*)(styleval.charPtrData + l3 + 1),
1148                              (char*)stylevsp[0].charPtrData, l0) + l0) = '\0';
1149
1150            delete stylevsp[-3].charPtrData;
1151            delete stylevsp[0].charPtrData;
1152         }
1153 break;
1154 case 66:
1155 {
1156            int l1 = strlen((char*)stylevsp[-1].charPtrData);
1157            int l = l1 + 2;
1158            styleval.charPtrData=new unsigned char[l];
1159
1160            *((char *) memcpy((char*)styleval.charPtrData,
1161                              (char*)stylevsp[-1].charPtrData, l1) + l1) = '\0';
1162            *((char *) memcpy((char*)styleval.charPtrData + l1,
1163                              ".", 1) + 1) = '\0';
1164
1165            delete stylevsp[-1].charPtrData;
1166         }
1167 break;
1168 case 67:
1169 {
1170            styleval.charPtrData=stylevsp[0].charPtrData;
1171         }
1172 break;
1173 case 68:
1174 {
1175           unsigned int i;
1176
1177           for (i=0; i<strlen((const char*)stylevsp[0].charPtrData); i++) {
1178
1179             if ( isalpha(stylevsp[0].charPtrData[i]) ) 
1180                break;
1181           }
1182
1183           char c;
1184           float x;
1185           if ( i > 0 ) {
1186              c = stylevsp[0].charPtrData[i]; stylevsp[0].charPtrData[i]=0;
1187              x = atof((const char*)stylevsp[0].charPtrData);
1188              stylevsp[0].charPtrData[i]=c;
1189           } else
1190              x = 1;
1191
1192           styleval.termNodePtrData=new ConstantNode(new FeatureValueDimension(new FeatureValueReal(x), (const char*)&stylevsp[0].charPtrData[i]));
1193
1194           delete stylevsp[0].charPtrData;
1195         }
1196 break;
1197 case 69:
1198 {
1199            styleval.charPtrData=stylevsp[0].charPtrData;
1200         }
1201 break;
1202 case 70:
1203 {
1204            styleval.charPtrData=stylevsp[0].charPtrData;
1205         }
1206 break;
1207 case 71:
1208 {
1209            styleval.PQExprPtrData=stylevsp[-1].PQExprPtrData;
1210         }
1211 break;
1212 case 72:
1213 {
1214 /*////////////////////////////////////////////////////*/
1215 /* This portion of the code (up to equality_expr) is */
1216 /* hacked for V1.1 only. Due to the way */
1217 /* PathQualifier.h is written, this code is not */
1218 /* general at all. qfc 8/16/94*/
1219 /*////////////////////////////////////////////////////*/
1220            styleval.PQExprPtrData=stylevsp[0].PQExprPtrData;
1221         }
1222 break;
1223 case 73:
1224 {
1225            styleval.PQExprPtrData = new PQLogExpr(stylevsp[-2].PQExprPtrData, PQor, stylevsp[0].PQExprPtrData);
1226         }
1227 break;
1228 case 74:
1229 {
1230            styleval.PQExprPtrData=stylevsp[0].PQExprPtrData;
1231         }
1232 break;
1233 case 75:
1234 {
1235            styleval.PQExprPtrData = new PQLogExpr(stylevsp[-2].PQExprPtrData, PQand, stylevsp[0].PQExprPtrData);
1236         }
1237 break;
1238 case 76:
1239 {
1240           styleval.PQExprPtrData = new PQAttributeSelector(
1241                         gSymTab->intern((const char*)stylevsp[-2].charPtrData),
1242                         ( stylevsp[-1].intData == EQUAL ) ? PQEqual : PQNotEqual,
1243                         (const char*)stylevsp[0].charPtrData
1244                                       );
1245           delete stylevsp[-2].charPtrData;
1246           delete stylevsp[0].charPtrData;
1247         }
1248 break;
1249 case 77:
1250 {
1251            if ( strcasecmp((char*)stylevsp[-2].charPtrData, "position") == 0 ) {
1252              styleval.PQExprPtrData=new PQPosition(
1253                   ( stylevsp[-1].intData == EQUAL ) ? PQEqual : PQNotEqual, 
1254                   stylevsp[0].intData
1255                                 );
1256            } else
1257            if ( strcasecmp((char*)stylevsp[-2].charPtrData, "sibling") == 0 ) {
1258              styleval.PQExprPtrData=new PQSibling(
1259                   ( stylevsp[-1].intData == EQUAL ) ? PQEqual : PQNotEqual, 
1260                   stylevsp[0].intData
1261                                 );
1262            } else
1263               throw(CASTSSEXCEPT StyleSheetException());
1264
1265            delete stylevsp[-2].charPtrData;
1266         }
1267 break;
1268 case 78:
1269 {
1270            styleval.intData = (int)stylevsp[0].intData;
1271         }
1272 break;
1273 case 79:
1274 {
1275            if ( strcasecmp((char*)stylevsp[0].charPtrData, "#LAST") != 0 ) 
1276               throw(CASTSSEXCEPT StyleSheetException());
1277
1278            styleval.intData = -1;
1279         }
1280 break;
1281 case 80:
1282 {
1283
1284         }
1285 break;
1286 case 81:
1287 {
1288
1289         }
1290 break;
1291 case 82:
1292 {
1293         }
1294 break;
1295 case 83:
1296 {
1297         }
1298 break;
1299 case 84:
1300 {
1301
1302         }
1303 break;
1304 case 85:
1305 {
1306
1307         }
1308 break;
1309 case 86:
1310 {
1311           styleval.PQExprPtrData=stylevsp[0].PQExprPtrData;
1312         }
1313 break;
1314 case 87:
1315 {
1316           styleval.PQExprPtrData=0;
1317         }
1318 break;
1319     }
1320     stylessp -= stylem;
1321     stylestate = *stylessp;
1322     stylevsp -= stylem;
1323     stylem = stylelhs[stylen];
1324     if (stylestate == 0 && stylem == 0)
1325     {
1326 #if styleDEBUG
1327         if (styledebug)
1328             printf("styledebug: after reduction, shifting from state 0 to\
1329  state %d\n", styleFINAL);
1330 #endif
1331         stylestate = styleFINAL;
1332         *++stylessp = styleFINAL;
1333         *++stylevsp = styleval;
1334         if (stylechar < 0)
1335         {
1336             if ((stylechar = stylelex()) < 0) stylechar = 0;
1337 #if styleDEBUG
1338             if (styledebug)
1339             {
1340                 styles = 0;
1341                 if (stylechar <= styleMAXTOKEN) styles = stylename[stylechar];
1342                 if (!styles) styles = "illegal-symbol";
1343                 printf("styledebug: state %d, reading %d (%s)\n",
1344                         styleFINAL, stylechar, styles);
1345             }
1346 #endif
1347         }
1348         if (stylechar == 0) goto styleaccept;
1349         goto styleloop;
1350     }
1351     if ((stylen = stylegindex[stylem]) && (stylen += stylestate) >= 0 &&
1352             stylen <= styleTABLESIZE && stylecheck[stylen] == stylestate)
1353         stylestate = styletable[stylen];
1354     else
1355         stylestate = styledgoto[stylem];
1356 #if styleDEBUG
1357     if (styledebug)
1358         printf("styledebug: after reduction, shifting from state %d \
1359 to state %d\n", *stylessp, stylestate);
1360 #endif
1361     if (stylessp >= styless + stylestacksize - 1)
1362     {
1363         goto styleoverflow;
1364     }
1365     *++stylessp = stylestate;
1366     *++stylevsp = styleval;
1367     goto styleloop;
1368 styleoverflow:
1369     styleerror((char*)"yacc stack overflow");
1370 styleabort:
1371     return (1);
1372 styleaccept:
1373     return (0);
1374 }