1
2 /* A Bison parser, made from g:\\cxx\\scorched\\3dsparse\\aseFile.y
3 by GNU Bison version 1.25
4 */
5
6 #define YYBISON 1 /* Identify Bison output. */
7
8 #if !defined(__FreeBSD__) && !defined(__DARWIN__) && !defined(_WIN32)
9 #define alloca
10 #endif //!defined(__FreeBSD__) && !defined(__DARWIN__)
11
12 #define yyparse aseparse
13 #define yylex aselex
14 #define yyerror aseerror
15 #define yylval aselval
16 #define yychar asechar
17 #define yydebug asedebug
18 #define yynerrs asenerrs
19 #define MAX_DIGIT 258
20 #define MAX_FLOAT 259
21 #define MAX_STRING 260
22 #define MAX_LBRACKET 261
23 #define MAX_RBRACKET 262
24 #define MAX_ASCIIEXPORT_SYM 263
25 #define MAX_COMMENT 264
26 #define MAX_MESH_FACE_ID 265
27 #define MAX_SCENE 266
28 #define MAX_SCENE_TOKEN 267
29 #define MAX_MATERIAL_LIST 268
30 #define MAX_MATERIAL_LIST_TOKEN 269
31 #define MAX_GEOMOBJECT 270
32 #define MAX_NODE_NAME 271
33 #define MAX_NODE_TM 272
34 #define MAX_NODE_TM_TOKEN 273
35 #define MAX_MESH 274
36 #define MAX_TIMEVALUE 275
37 #define MAX_MESH_NUMVERTEX 276
38 #define MAX_MESH_NUMFACES 277
39 #define MAX_MESH_VERTEX_LIST 278
40 #define MAX_MESH_VERTEX 279
41 #define MAX_MESH_FACE_LIST 280
42 #define MAX_MESH_FACE 281
43 #define MAX_MESH_SMOOTHING 282
44 #define MAX_MESH_MTLID 283
45 #define MAX_MESH_NUMTVERTEX 284
46 #define MAX_MESH_NORMALS 285
47 #define MAX_MESH_FACENORMAL 286
48 #define MAX_MESH_VERTEXNORMAL 287
49 #define MAX_PROP_MOTIONBLUR 288
50 #define MAX_PROP_CASTSHADOW 289
51 #define MAX_PROP_RECVSHADOW 290
52 #define MAX_WIREFRAME_COLOR 291
53 #define MAX_TM_ROW0 292
54 #define MAX_TM_ROW1 293
55 #define MAX_TM_ROW2 294
56 #define MAX_TM_ROW3 295
57
58 #include <common/Defines.h>
59 #include <3dsparse/ASEModelFactory.h>
60
61 static FixedVector tmRow[3];
62
63 Face aseFace;
64 int aseFaceNo;
65
66 extern FixedVector aseVector;
67 extern char aseString[1024];
68 extern float aseFloat;
69 extern int aseDigit;
70 extern int aselex();
71
72 int aseerror(const char *errmsg);
73 int asewarning(const char *warningmsg);
74 int asedebug(const char *debugmsg);
75
76 extern char *asetext;
77 extern int aselineno;
78
79 #ifndef YYSTYPE
80 #define YYSTYPE int
81 #endif
82 #include <stdio.h>
83
84 #ifndef __cplusplus
85 #ifndef __STDC__
86 #define const
87 #endif
88 #endif
89
90
91
92 #define YYFINAL 166
93 #define YYFLAG 32768
94 #define YYNTBASE 41
95
96 #define YYTRANSLATE(x) ((unsigned)(x) <= 295 ? yytranslate[x] : 70)
97
98 static const char yytranslate[] = { 0,
99 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
100 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
101 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
102 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
103 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
104 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
105 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
106 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
107 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
108 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
109 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
110 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
111 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
112 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
113 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
114 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
115 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
116 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
117 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
118 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
119 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
120 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
121 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
122 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
123 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
124 2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
125 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
126 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
127 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
128 36, 37, 38, 39, 40
129 };
130
131 #if YYDEBUG != 0
132 static const short yyprhs[] = { 0,
133 0, 6, 9, 12, 30, 36, 38, 41, 55, 58,
134 61, 96, 99, 102, 105, 129, 131, 134, 138, 140,
135 143, 159, 162, 165, 168, 170, 173, 178, 182, 186,
136 190, 194, 196
137 };
138
139 static const short yyrhs[] = { 42,
140 43, 44, 45, 46, 0, 8, 3, 0, 9, 68,
141 0, 11, 6, 12, 5, 12, 3, 12, 3, 12,
142 3, 12, 3, 12, 69, 12, 69, 7, 0, 13,
143 6, 14, 3, 7, 0, 47, 0, 46, 47, 0,
144 15, 6, 49, 50, 54, 33, 3, 34, 3, 35,
145 3, 48, 7, 0, 36, 69, 0, 16, 68, 0,
146 17, 6, 16, 5, 18, 3, 3, 3, 18, 3,
147 3, 3, 18, 3, 3, 3, 51, 52, 53, 40,
148 69, 18, 69, 18, 69, 18, 4, 18, 69, 18,
149 69, 18, 4, 7, 0, 37, 69, 0, 38, 69,
150 0, 39, 69, 0, 19, 6, 20, 3, 21, 3,
151 22, 3, 23, 6, 55, 7, 25, 6, 57, 7,
152 29, 3, 30, 6, 62, 7, 7, 0, 56, 0,
153 55, 56, 0, 24, 3, 69, 0, 58, 0, 57,
154 58, 0, 26, 10, 59, 60, 61, 10, 3, 10,
155 3, 10, 3, 27, 3, 28, 3, 0, 10, 3,
156 0, 10, 3, 0, 10, 3, 0, 63, 0, 62,
157 63, 0, 64, 65, 66, 67, 0, 31, 3, 69,
158 0, 32, 3, 69, 0, 32, 3, 69, 0, 32,
159 3, 69, 0, 5, 0, 4, 4, 4, 0
160 };
161
162 #endif
163
164 #if YYDEBUG != 0
165 static const short yyrline[] = { 0,
166 44, 52, 56, 60, 72, 78, 79, 83, 95, 100,
167 105, 124, 129, 134, 139, 151, 152, 156, 161, 162,
168 166, 178, 183, 188, 196, 197, 201, 208, 213, 218,
169 223, 228, 232
170 };
171 #endif
172
173
174 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
175
176 static const char * const yytname[] = { "$","error","$undefined.","MAX_DIGIT",
177 "MAX_FLOAT","MAX_STRING","MAX_LBRACKET","MAX_RBRACKET","MAX_ASCIIEXPORT_SYM",
178 "MAX_COMMENT","MAX_MESH_FACE_ID","MAX_SCENE","MAX_SCENE_TOKEN","MAX_MATERIAL_LIST",
179 "MAX_MATERIAL_LIST_TOKEN","MAX_GEOMOBJECT","MAX_NODE_NAME","MAX_NODE_TM","MAX_NODE_TM_TOKEN",
180 "MAX_MESH","MAX_TIMEVALUE","MAX_MESH_NUMVERTEX","MAX_MESH_NUMFACES","MAX_MESH_VERTEX_LIST",
181 "MAX_MESH_VERTEX","MAX_MESH_FACE_LIST","MAX_MESH_FACE","MAX_MESH_SMOOTHING",
182 "MAX_MESH_MTLID","MAX_MESH_NUMTVERTEX","MAX_MESH_NORMALS","MAX_MESH_FACENORMAL",
183 "MAX_MESH_VERTEXNORMAL","MAX_PROP_MOTIONBLUR","MAX_PROP_CASTSHADOW","MAX_PROP_RECVSHADOW",
184 "MAX_WIREFRAME_COLOR","MAX_TM_ROW0","MAX_TM_ROW1","MAX_TM_ROW2","MAX_TM_ROW3",
185 "MaxFile","MaxExport","MaxComment","MaxScene","MaxMaterialList","MaxGeomObjectList",
186 "MaxGeomObject","MaxColor","MaxGeomObjectInit","MaxNodeTm","MaxNodeTmRow0","MaxNodeTmRow1",
187 "MaxNodeTmRow2","MaxMesh","MaxVertexList","MaxVertex","MaxFaceList","MaxFace",
188 "MaxFaceA","MaxFaceB","MaxFaceC","MaxNormalList","MaxNormal","MaxFaceNormal",
189 "MaxVertexNormal0","MaxVertexNormal1","MaxVertexNormal2","MaxString","MaxVector", NULL
190 };
191 #endif
192
193 static const short yyr1[] = { 0,
194 41, 42, 43, 44, 45, 46, 46, 47, 48, 49,
195 50, 51, 52, 53, 54, 55, 55, 56, 57, 57,
196 58, 59, 60, 61, 62, 62, 63, 64, 65, 66,
197 67, 68, 69
198 };
199
200 static const short yyr2[] = { 0,
201 5, 2, 2, 17, 5, 1, 2, 13, 2, 2,
202 34, 2, 2, 2, 23, 1, 2, 3, 1, 2,
203 15, 2, 2, 2, 1, 2, 4, 3, 3, 3,
204 3, 1, 3
205 };
206
207 static const short yydefact[] = { 0,
208 0, 0, 2, 0, 0, 32, 3, 0, 0, 0,
209 0, 0, 0, 0, 0, 1, 6, 0, 0, 0,
210 7, 0, 0, 0, 0, 0, 5, 10, 0, 0,
211 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
212 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
213 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
214 0, 0, 0, 0, 0, 0, 0, 0, 9, 8,
215 33, 0, 0, 0, 4, 0, 0, 0, 16, 0,
216 0, 0, 17, 0, 18, 0, 0, 0, 0, 0,
217 0, 19, 0, 0, 0, 0, 20, 12, 0, 0,
218 0, 0, 0, 13, 0, 0, 22, 0, 0, 0,
219 14, 0, 23, 0, 0, 0, 0, 24, 0, 0,
220 0, 0, 0, 0, 25, 0, 0, 0, 0, 0,
221 26, 0, 0, 0, 0, 28, 15, 0, 0, 0,
222 0, 0, 29, 0, 0, 27, 0, 0, 30, 0,
223 0, 0, 31, 0, 0, 0, 0, 0, 21, 0,
224 0, 0, 11, 0, 0, 0
225 };
226
227 static const short yydefgoto[] = { 164,
228 2, 5, 9, 12, 16, 17, 64, 25, 30, 94,
229 100, 106, 34, 78, 79, 91, 92, 102, 109, 115,
230 124, 125, 126, 133, 140, 146, 7, 60
231 };
232
233 static const short yypact[] = { -4,
234 3, -1,-32768, 2, 0,-32768,-32768, 4, 1, -3,
235 6, 5, 8, 9, 10, 5,-32768, 7, 12, 11,
236 -32768, 14, 17, 2, 15, 16,-32768,-32768, 20, 18,
237 26, 19, 25, 13, 21, 29, 23, 35, 36, 22,
238 38, 27, 32, 42, 30, 44, 45, 47, 49, 24,
239 41, 51, 33, 53, 56, 39, 59, 28, 61, 55,
240 60, 46, 56, 63, 64, 56, 69, 67,-32768,-32768,
241 -32768, 70, 71, 52,-32768, 62, 75, -2,-32768, 76,
242 56, 57,-32768, 80,-32768, 78, 82, 66, 65, 79,
243 -5,-32768, 56, 48, 83, 68,-32768,-32768, 56, 72,
244 85, 84, 87,-32768, 56, 58,-32768, 93, 89, 73,
245 -32768, 56,-32768, 97, 91, 98, 88,-32768, 102, 77,
246 56, 99, 104, -6,-32768, 81, 92, 109, 56, 107,
247 -32768, 112, 86, 56, 106,-32768,-32768, 56, 114, 90,
248 101, 117,-32768, 56, 118,-32768, 119, 100,-32768, 56,
249 108, 121,-32768, 56, 103, 110, 122, 56,-32768, 111,
250 126, 125,-32768, 133, 134,-32768
251 };
252
253 static const short yypgoto[] = {-32768,
254 -32768,-32768,-32768,-32768,-32768, 120,-32768,-32768,-32768,-32768,
255 -32768,-32768,-32768,-32768, 74,-32768, 50,-32768,-32768,-32768,
256 -32768, 31,-32768,-32768,-32768,-32768, 113, -63
257 };
258
259
260 #define YYLAST 155
261
262
263 static const short yytable[] = { 69,
264 130, 96, 72, 1, 82, 3, 6, 4, 13, 10,
265 8, 14, 18, 11, 23, 20, 26, 85, 22, 15,
266 90, 77, 19, 27, 123, 32, 24, 31, 35, 98,
267 37, 29, 39, 40, 36, 104, 33, 42, 43, 44,
268 45, 111, 41, 47, 48, 38, 50, 51, 117, 52,
269 49, 53, 55, 56, 57, 58, 61, 127, 54, 59,
270 46, 62, 67, 63, 65, 136, 66, 71, 68, 70,
271 141, 73, 74, 76, 143, 77, 75, 81, 84, 80,
272 149, 86, 87, 88, 89, 99, 153, 107, 95, 110,
273 156, 90, 101, 108, 160, 113, 103, 112, 114, 118,
274 119, 93, 116, 120, 122, 121, 129, 123, 128, 134,
275 105, 135, 132, 137, 138, 142, 144, 139, 147, 148,
276 150, 145, 151, 155, 159, 154, 152, 158, 161, 162,
277 157, 163, 165, 166, 0, 21, 28, 0, 0, 0,
278 97, 0, 0, 0, 0, 0, 0, 0, 0, 0,
279 0, 83, 0, 0, 131
280 };
281
282 static const short yycheck[] = { 63,
283 7, 7, 66, 8, 7, 3, 5, 9, 12, 6,
284 11, 6, 5, 13, 3, 6, 3, 81, 12, 15,
285 26, 24, 14, 7, 31, 6, 16, 12, 3, 93,
286 6, 17, 12, 5, 16, 99, 19, 3, 3, 18,
287 3, 105, 20, 12, 3, 33, 3, 3, 112, 3,
288 21, 3, 12, 3, 22, 3, 18, 121, 35, 4,
289 34, 3, 3, 36, 4, 129, 12, 4, 23, 7,
290 134, 3, 6, 3, 138, 24, 7, 3, 3, 18,
291 144, 25, 3, 6, 3, 38, 150, 3, 10, 3,
292 154, 26, 10, 10, 158, 3, 29, 40, 10, 3,
293 10, 37, 30, 6, 3, 18, 3, 31, 10, 18,
294 39, 3, 32, 7, 3, 10, 3, 32, 18, 3,
295 3, 32, 4, 3, 3, 18, 27, 18, 18, 4,
296 28, 7, 0, 0, -1, 16, 24, -1, -1, -1,
297 91, -1, -1, -1, -1, -1, -1, -1, -1, -1,
298 -1, 78, -1, -1, 124
299 };
300 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
301
302 /* Skeleton output parser for bison,
303 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
304
305 This program is free software; you can redistribute it and/or modify
306 it under the terms of the GNU General Public License as published by
307 the Free Software Foundation; either version 2, or (at your option)
308 any later version.
309
310 This program is distributed in the hope that it will be useful,
311 but WITHOUT ANY WARRANTY; without even the implied warranty of
312 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
313 GNU General Public License for more details.
314
315 You should have received a copy of the GNU General Public License
316 along with this program; if not, write to the Free Software
317 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
318
319 /* As a special exception, when this file is copied by Bison into a
320 Bison output file, you may use that output file without restriction.
321 This special exception was added by the Free Software Foundation
322 in version 1.24 of Bison. */
323
324 #ifndef alloca
325 #ifdef __GNUC__
326 #define alloca __builtin_alloca
327 #else /* not GNU C. */
328 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
329 #include <alloca.h>
330 #else /* not sparc */
331 #if defined (MSDOS) && !defined (__TURBOC__)
332 #include <malloc.h>
333 #else /* not MSDOS, or __TURBOC__ */
334 #if defined(_AIX)
335 #include <malloc.h>
336 #pragma alloca
337 #else /* not MSDOS, __TURBOC__, or _AIX */
338 #ifdef __hpux
339 #ifdef __cplusplus
340 extern "C" {
341 void *alloca (unsigned int);
342 };
343 #else /* not __cplusplus */
344 void *alloca ();
345 #endif /* not __cplusplus */
346 #endif /* __hpux */
347 #endif /* not _AIX */
348 #endif /* not MSDOS, or __TURBOC__ */
349 #endif /* not sparc. */
350 #endif /* not GNU C. */
351 #endif /* alloca not defined. */
352
353 /* This is the parser code that is written into each bison parser
354 when the %semantic_parser declaration is not specified in the grammar.
355 It was written by Richard Stallman by simplifying the hairy parser
356 used when %semantic_parser is specified. */
357
358 /* Note: there must be only one dollar sign in this file.
359 It is replaced by the list of actions, each action
360 as one case of the switch. */
361
362 #define yyerrok (yyerrstatus = 0)
363 #define yyclearin (yychar = YYEMPTY)
364 #define YYEMPTY -2
365 #define YYEOF 0
366 #define YYACCEPT return(0)
367 #define YYABORT return(1)
368 #define YYERROR goto yyerrlab1
369 /* Like YYERROR except do call yyerror.
370 This remains here temporarily to ease the
371 transition to the new meaning of YYERROR, for GCC.
372 Once GCC version 2 has supplanted version 1, this can go. */
373 #define YYFAIL goto yyerrlab
374 #define YYRECOVERING() (!!yyerrstatus)
375 #define YYBACKUP(token, value) \
376 do \
377 if (yychar == YYEMPTY && yylen == 1) \
378 { yychar = (token), yylval = (value); \
379 yychar1 = YYTRANSLATE (yychar); \
380 YYPOPSTACK; \
381 goto yybackup; \
382 } \
383 else \
384 { yyerror ("syntax error: cannot back up"); YYERROR; } \
385 while (0)
386
387 #define YYTERROR 1
388 #define YYERRCODE 256
389
390 #ifndef YYPURE
391 #define YYLEX yylex()
392 #endif
393
394 #ifdef YYPURE
395 #ifdef YYLSP_NEEDED
396 #ifdef YYLEX_PARAM
397 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
398 #else
399 #define YYLEX yylex(&yylval, &yylloc)
400 #endif
401 #else /* not YYLSP_NEEDED */
402 #ifdef YYLEX_PARAM
403 #define YYLEX yylex(&yylval, YYLEX_PARAM)
404 #else
405 #define YYLEX yylex(&yylval)
406 #endif
407 #endif /* not YYLSP_NEEDED */
408 #endif
409
410 /* If nonreentrant, generate the variables here */
411
412 #ifndef YYPURE
413
414 int yychar; /* the lookahead symbol */
415 YYSTYPE yylval; /* the semantic value of the */
416 /* lookahead symbol */
417
418 #ifdef YYLSP_NEEDED
419 YYLTYPE yylloc; /* location data for the lookahead */
420 /* symbol */
421 #endif
422
423 int yynerrs; /* number of parse errors so far */
424 #endif /* not YYPURE */
425
426 #if YYDEBUG != 0
427 int yydebug; /* nonzero means print parse trace */
428 /* Since this is uninitialized, it does not stop multiple parsers
429 from coexisting. */
430 #endif
431
432 /* YYINITDEPTH indicates the initial size of the parser's stacks */
433
434 #ifndef YYINITDEPTH
435 #define YYINITDEPTH 200
436 #endif
437
438 /* YYMAXDEPTH is the maximum size the stacks can grow to
439 (effective only if the built-in stack extension method is used). */
440
441 #if YYMAXDEPTH == 0
442 #undef YYMAXDEPTH
443 #endif
444
445 #ifndef YYMAXDEPTH
446 #define YYMAXDEPTH 10000
447 #endif
448
449 /* Prevent warning if -Wstrict-prototypes. */
450 #ifdef __GNUC__
451 int yyparse (void);
452 #endif
453 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
454 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
455 #else /* not GNU C or C++ */
456 #ifndef __cplusplus
457
458 /* This is the most reliable way to avoid incompatibilities
459 in available built-in functions on various systems. */
460 static void
461 __yy_memcpy (to, from, count)
462 char *to;
463 char *from;
464 int count;
465 {
466 register char *f = from;
467 register char *t = to;
468 register int i = count;
469
470 while (i-- > 0)
471 *t++ = *f++;
472 }
473
474 #else /* __cplusplus */
475
476 /* This is the most reliable way to avoid incompatibilities
477 in available built-in functions on various systems. */
478 static void
__yy_memcpy(char * to,char * from,int count)479 __yy_memcpy (char *to, char *from, int count)
480 {
481 register char *f = from;
482 register char *t = to;
483 register int i = count;
484
485 while (i-- > 0)
486 *t++ = *f++;
487 }
488
489 #endif
490 #endif
491
492 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
493 into yyparse. The argument should have type void *.
494 It should actually point to an object.
495 Grammar actions can access the variable by casting it
496 to the proper pointer type. */
497
498 #ifdef YYPARSE_PARAM
499 #ifdef __cplusplus
500 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
501 #define YYPARSE_PARAM_DECL
502 #else /* not __cplusplus */
503 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
504 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
505 #endif /* not __cplusplus */
506 #else /* not YYPARSE_PARAM */
507 #define YYPARSE_PARAM_ARG
508 #define YYPARSE_PARAM_DECL
509 #endif /* not YYPARSE_PARAM */
510
511 int
yyparse(YYPARSE_PARAM_ARG)512 yyparse(YYPARSE_PARAM_ARG)
513 YYPARSE_PARAM_DECL
514 {
515 register int yystate;
516 register int yyn;
517 register short *yyssp;
518 register YYSTYPE *yyvsp;
519 int yyerrstatus; /* number of tokens to shift before error messages enabled */
520 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
521
522 short yyssa[YYINITDEPTH]; /* the state stack */
523 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
524
525 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
526 YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
527
528 #ifdef YYLSP_NEEDED
529 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
530 YYLTYPE *yyls = yylsa;
531 YYLTYPE *yylsp;
532
533 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
534 #else
535 #define YYPOPSTACK (yyvsp--, yyssp--)
536 #endif
537
538 int yystacksize = YYINITDEPTH;
539
540 #ifdef YYPURE
541 int yychar;
542 YYSTYPE yylval;
543 int yynerrs;
544 #ifdef YYLSP_NEEDED
545 YYLTYPE yylloc;
546 #endif
547 #endif
548
549 YYSTYPE yyval; /* the variable used to return */
550 /* semantic values from the action */
551 /* routines */
552
553 int yylen;
554
555 #if YYDEBUG != 0
556 if (yydebug)
557 fprintf(stderr, "Starting parse\n");
558 #endif
559
560 yystate = 0;
561 yyerrstatus = 0;
562 yynerrs = 0;
563 yychar = YYEMPTY; /* Cause a token to be read. */
564
565 /* Initialize stack pointers.
566 Waste one element of value and location stack
567 so that they stay on the same level as the state stack.
568 The wasted elements are never initialized. */
569
570 yyssp = yyss - 1;
571 yyvsp = yyvs;
572 #ifdef YYLSP_NEEDED
573 yylsp = yyls;
574 #endif
575
576 /* Push a new state, which is found in yystate . */
577 /* In all cases, when you get here, the value and location stacks
578 have just been pushed. so pushing a state here evens the stacks. */
579 yynewstate:
580
581 *++yyssp = (short) yystate;
582
583 if (yyssp >= yyss + yystacksize - 1)
584 {
585 /* Give user a chance to reallocate the stack */
586 /* Use copies of these so that the &'s don't force the real ones into memory. */
587 YYSTYPE *yyvs1 = yyvs;
588 short *yyss1 = yyss;
589 #ifdef YYLSP_NEEDED
590 YYLTYPE *yyls1 = yyls;
591 #endif
592
593 /* Get the current used size of the three stacks, in elements. */
594 int size = (int)(yyssp - yyss + 1);
595
596 #ifdef yyoverflow
597 /* Each stack pointer address is followed by the size of
598 the data in use in that stack, in bytes. */
599 #ifdef YYLSP_NEEDED
600 /* This used to be a conditional around just the two extra args,
601 but that might be undefined if yyoverflow is a macro. */
602 yyoverflow("parser stack overflow",
603 &yyss1, size * sizeof (*yyssp),
604 &yyvs1, size * sizeof (*yyvsp),
605 &yyls1, size * sizeof (*yylsp),
606 &yystacksize);
607 #else
608 yyoverflow("parser stack overflow",
609 &yyss1, size * sizeof (*yyssp),
610 &yyvs1, size * sizeof (*yyvsp),
611 &yystacksize);
612 #endif
613
614 yyss = yyss1; yyvs = yyvs1;
615 #ifdef YYLSP_NEEDED
616 yyls = yyls1;
617 #endif
618 #else /* no yyoverflow */
619 /* Extend the stack our own way. */
620 if (yystacksize >= YYMAXDEPTH)
621 {
622 yyerror("parser stack overflow");
623 return 2;
624 }
625 yystacksize *= 2;
626 if (yystacksize > YYMAXDEPTH)
627 yystacksize = YYMAXDEPTH;
628 yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
629 __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
630 yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
631 __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
632 #ifdef YYLSP_NEEDED
633 yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
634 __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
635 #endif
636 #endif /* no yyoverflow */
637
638 yyssp = yyss + size - 1;
639 yyvsp = yyvs + size - 1;
640 #ifdef YYLSP_NEEDED
641 yylsp = yyls + size - 1;
642 #endif
643
644 #if YYDEBUG != 0
645 if (yydebug)
646 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
647 #endif
648
649 if (yyssp >= yyss + yystacksize - 1)
650 YYABORT;
651 }
652
653 #if YYDEBUG != 0
654 if (yydebug)
655 fprintf(stderr, "Entering state %d\n", yystate);
656 #endif
657
658 goto yybackup;
659 yybackup:
660
661 /* Do appropriate processing given the current state. */
662 /* Read a lookahead token if we need one and don't already have one. */
663 /* yyresume: */
664
665 /* First try to decide what to do without reference to lookahead token. */
666
667 yyn = yypact[yystate];
668 if (yyn == YYFLAG)
669 goto yydefault;
670
671 /* Not known => get a lookahead token if don't already have one. */
672
673 /* yychar is either YYEMPTY or YYEOF
674 or a valid token in external form. */
675
676 if (yychar == YYEMPTY)
677 {
678 #if YYDEBUG != 0
679 if (yydebug)
680 fprintf(stderr, "Reading a token: ");
681 #endif
682 yychar = YYLEX;
683 }
684
685 /* Convert token to internal form (in yychar1) for indexing tables with */
686
687 if (yychar <= 0) /* This means end of input. */
688 {
689 yychar1 = 0;
690 yychar = YYEOF; /* Don't call YYLEX any more */
691
692 #if YYDEBUG != 0
693 if (yydebug)
694 fprintf(stderr, "Now at end of input.\n");
695 #endif
696 }
697 else
698 {
699 yychar1 = YYTRANSLATE(yychar);
700
701 #if YYDEBUG != 0
702 if (yydebug)
703 {
704 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
705 /* Give the individual parser a way to print the precise meaning
706 of a token, for further debugging info. */
707 #ifdef YYPRINT
708 YYPRINT (stderr, yychar, yylval);
709 #endif
710 fprintf (stderr, ")\n");
711 }
712 #endif
713 }
714
715 yyn += yychar1;
716 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
717 goto yydefault;
718
719 yyn = yytable[yyn];
720
721 /* yyn is what to do for this token type in this state.
722 Negative => reduce, -yyn is rule number.
723 Positive => shift, yyn is new state.
724 New state is final state => don't bother to shift,
725 just return success.
726 0, or most negative number => error. */
727
728 if (yyn < 0)
729 {
730 if (yyn == YYFLAG)
731 goto yyerrlab;
732 yyn = -yyn;
733 goto yyreduce;
734 }
735 else if (yyn == 0)
736 goto yyerrlab;
737
738 if (yyn == YYFINAL)
739 YYACCEPT;
740
741 /* Shift the lookahead token. */
742
743 #if YYDEBUG != 0
744 if (yydebug)
745 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
746 #endif
747
748 /* Discard the token being shifted unless it is eof. */
749 if (yychar != YYEOF)
750 yychar = YYEMPTY;
751
752 *++yyvsp = yylval;
753 #ifdef YYLSP_NEEDED
754 *++yylsp = yylloc;
755 #endif
756
757 /* count tokens shifted since error; after three, turn off error status. */
758 if (yyerrstatus) yyerrstatus--;
759
760 yystate = yyn;
761 goto yynewstate;
762
763 /* Do the default action for the current state. */
764 yydefault:
765
766 yyn = yydefact[yystate];
767 if (yyn == 0)
768 goto yyerrlab;
769
770 /* Do a reduction. yyn is the number of a rule to reduce with. */
771 yyreduce:
772 yylen = yyr2[yyn];
773 if (yylen > 0)
774 yyval = yyvsp[1-yylen]; /* implement default value of the action */
775
776 #if YYDEBUG != 0
777 if (yydebug)
778 {
779 int i;
780
781 fprintf (stderr, "Reducing via rule %d (line %d), ",
782 yyn, yyrline[yyn]);
783
784 /* Print the symbols being reduced, and their result. */
785 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
786 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
787 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
788 }
789 #endif
790
791
792 switch (yyn) {
793
794 case 9:
795 {
796 FixedVector4 ambientColor(fixed(true, 6000), fixed(true, 6000), fixed(true, 6000), 1);
797 FixedVector4 diffuseColor(fixed(true, 8000), fixed(true, 8000), fixed(true, 8000), 1);
798 ASEModelFactory::getCurrent()->getCurrentMesh()->getAmbientColor() = ambientColor;
799 ASEModelFactory::getCurrent()->getCurrentMesh()->getDiffuseColor() = diffuseColor;
800 ASEModelFactory::getCurrent()->getCurrentMesh()->getEmissiveColor() = FixedVector4::getNullVector();
801 ASEModelFactory::getCurrent()->getCurrentMesh()->getSpecularColor() = FixedVector4::getNullVector();
802
803 FixedVector ambientNoTexColor = aseVector * fixed(true, 6000);
804 FixedVector diffuseNoTexColor = aseVector * fixed(true, 8000);
805 ASEModelFactory::getCurrent()->getCurrentMesh()->getAmbientNoTexColor() = ambientNoTexColor;
806 ASEModelFactory::getCurrent()->getCurrentMesh()->getDiffuseNoTexColor() = diffuseNoTexColor;
807 ASEModelFactory::getCurrent()->getCurrentMesh()->getEmissiveNoTexColor() = FixedVector4::getNullVector();
808 ASEModelFactory::getCurrent()->getCurrentMesh()->getSpecularNoTexColor() = FixedVector4::getNullVector();
809
810 ASEModelFactory::getCurrent()->getCurrentMesh()->getShininessColor() = 0;
811
812 break;
813 }
814 case 10:
815 { ASEModelFactory::getCurrent()->addMesh(aseString); ;
816 break;}
817 case 12:
818 { tmRow[0] = aseVector.Normalize();
819 break;}
820 case 13:
821 { tmRow[1] = aseVector.Normalize();
822 break;}
823 case 14:
824 { tmRow[2] = aseVector.Normalize();
825 break;}
826 case 18:
827 {
828 Vertex vertex;
829 vertex.position = aseVector;
830 vertex.boneIndex = -1;
831 ASEModelFactory::getCurrent()->getCurrentMesh()->insertVertex(vertex); ;
832 break;}
833 case 22:
834 { aseFace.v[0] = aseDigit; ;
835 break;}
836 case 23:
837 { aseFace.v[1] = aseDigit; ;
838 break;}
839 case 24:
840 {
841 aseFace.v[2] = aseDigit;
842 ASEModelFactory::getCurrent()->getCurrentMesh()->insertFace(aseFace);
843 ;
844 break;}
845 case 28:
846 { aseFaceNo = aseDigit; ;
847 break;}
848 case 29:
849 {
850 FixedVector n(
851 aseVector[0] * tmRow[0][0] + aseVector[1] * tmRow[1][0] + aseVector[2] * tmRow[2][0],
852 aseVector[0] * tmRow[0][1] + aseVector[1] * tmRow[1][1] + aseVector[2] * tmRow[2][1],
853 aseVector[0] * tmRow[0][2] + aseVector[1] * tmRow[1][2] + aseVector[2] * tmRow[2][2]);
854
855 ASEModelFactory::getCurrent()->getCurrentMesh()->setFaceNormal(n, aseFaceNo, 0);
856 break;}
857 case 30:
858 {
859 FixedVector n(
860 aseVector[0] * tmRow[0][0] + aseVector[1] * tmRow[1][0] + aseVector[2] * tmRow[2][0],
861 aseVector[0] * tmRow[0][1] + aseVector[1] * tmRow[1][1] + aseVector[2] * tmRow[2][1],
862 aseVector[0] * tmRow[0][2] + aseVector[1] * tmRow[1][2] + aseVector[2] * tmRow[2][2]);
863
864 ASEModelFactory::getCurrent()->getCurrentMesh()->setFaceNormal(n, aseFaceNo, 1);
865 break;}
866 case 31:
867 {
868 FixedVector n(
869 aseVector[0] * tmRow[0][0] + aseVector[1] * tmRow[1][0] + aseVector[2] * tmRow[2][0],
870 aseVector[0] * tmRow[0][1] + aseVector[1] * tmRow[1][1] + aseVector[2] * tmRow[2][1],
871 aseVector[0] * tmRow[0][2] + aseVector[1] * tmRow[1][2] + aseVector[2] * tmRow[2][2]);
872
873 ASEModelFactory::getCurrent()->getCurrentMesh()->setFaceNormal(n, aseFaceNo, 2);
874 break;}
875 }
876 /* the action file gets copied in in place of this dollarsign */
877
878 yyvsp -= yylen;
879 yyssp -= yylen;
880 #ifdef YYLSP_NEEDED
881 yylsp -= yylen;
882 #endif
883
884 #if YYDEBUG != 0
885 if (yydebug)
886 {
887 short *ssp1 = yyss - 1;
888 fprintf (stderr, "state stack now");
889 while (ssp1 != yyssp)
890 fprintf (stderr, " %d", *++ssp1);
891 fprintf (stderr, "\n");
892 }
893 #endif
894
895 *++yyvsp = yyval;
896
897 #ifdef YYLSP_NEEDED
898 yylsp++;
899 if (yylen == 0)
900 {
901 yylsp->first_line = yylloc.first_line;
902 yylsp->first_column = yylloc.first_column;
903 yylsp->last_line = (yylsp-1)->last_line;
904 yylsp->last_column = (yylsp-1)->last_column;
905 yylsp->text = 0;
906 }
907 else
908 {
909 yylsp->last_line = (yylsp+yylen-1)->last_line;
910 yylsp->last_column = (yylsp+yylen-1)->last_column;
911 }
912 #endif
913
914 /* Now "shift" the result of the reduction.
915 Determine what state that goes to,
916 based on the state we popped back to
917 and the rule number reduced by. */
918
919 yyn = yyr1[yyn];
920
921 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
922 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
923 yystate = yytable[yystate];
924 else
925 yystate = yydefgoto[yyn - YYNTBASE];
926
927 goto yynewstate;
928
929 yyerrlab: /* here on detecting error */
930
931 if (! yyerrstatus)
932 /* If not already recovering from an error, report this error. */
933 {
934 ++yynerrs;
935
936 #ifdef YYERROR_VERBOSE
937 yyn = yypact[yystate];
938
939 if (yyn > YYFLAG && yyn < YYLAST)
940 {
941 int size = 0;
942 char *msg;
943 int x, count;
944
945 count = 0;
946 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
947 for (x = (yyn < 0 ? -yyn : 0);
948 x < (sizeof(yytname) / sizeof(char *)); x++)
949 if (yycheck[x + yyn] == x)
950 size += strlen(yytname[x]) + 15, count++;
951 msg = (char *) malloc(size + 15);
952 if (msg != 0)
953 {
954 strcpy(msg, "parse error");
955
956 if (count < 5)
957 {
958 count = 0;
959 for (x = (yyn < 0 ? -yyn : 0);
960 x < (sizeof(yytname) / sizeof(char *)); x++)
961 if (yycheck[x + yyn] == x)
962 {
963 strcat(msg, count == 0 ? ", expecting `" : " or `");
964 strcat(msg, yytname[x]);
965 strcat(msg, "'");
966 count++;
967 }
968 }
969 yyerror(msg);
970 free(msg);
971 }
972 else
973 yyerror ("parse error; also virtual memory exceeded");
974 }
975 else
976 #endif /* YYERROR_VERBOSE */
977 yyerror("parse error");
978 }
979
980 goto yyerrlab1;
981 yyerrlab1: /* here on error raised explicitly by an action */
982
983 if (yyerrstatus == 3)
984 {
985 /* if just tried and failed to reuse lookahead token after an error, discard it. */
986
987 /* return failure if at end of input */
988 if (yychar == YYEOF)
989 YYABORT;
990
991 #if YYDEBUG != 0
992 if (yydebug)
993 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
994 #endif
995
996 yychar = YYEMPTY;
997 }
998
999 /* Else will try to reuse lookahead token
1000 after shifting the error token. */
1001
1002 yyerrstatus = 3; /* Each real token shifted decrements this */
1003
1004 goto yyerrhandle;
1005
1006 yyerrdefault: /* current state does not do anything special for the error token. */
1007
1008 #if 0
1009 /* This is wrong; only states that explicitly want error tokens
1010 should shift them. */
1011 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1012 if (yyn) goto yydefault;
1013 #endif
1014
1015 yyerrpop: /* pop the current state because it cannot handle the error token */
1016
1017 if (yyssp == yyss) YYABORT;
1018 yyvsp--;
1019 yystate = *--yyssp;
1020 #ifdef YYLSP_NEEDED
1021 yylsp--;
1022 #endif
1023
1024 #if YYDEBUG != 0
1025 if (yydebug)
1026 {
1027 short *ssp1 = yyss - 1;
1028 fprintf (stderr, "Error: state stack now");
1029 while (ssp1 != yyssp)
1030 fprintf (stderr, " %d", *++ssp1);
1031 fprintf (stderr, "\n");
1032 }
1033 #endif
1034
1035 yyerrhandle:
1036
1037 yyn = yypact[yystate];
1038 if (yyn == YYFLAG)
1039 goto yyerrdefault;
1040
1041 yyn += YYTERROR;
1042 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1043 goto yyerrdefault;
1044
1045 yyn = yytable[yyn];
1046 if (yyn < 0)
1047 {
1048 if (yyn == YYFLAG)
1049 goto yyerrpop;
1050 yyn = -yyn;
1051 goto yyreduce;
1052 }
1053 else if (yyn == 0)
1054 goto yyerrpop;
1055
1056 if (yyn == YYFINAL)
1057 YYACCEPT;
1058
1059 #if YYDEBUG != 0
1060 if (yydebug)
1061 fprintf(stderr, "Shifting error token, ");
1062 #endif
1063
1064 *++yyvsp = yylval;
1065 #ifdef YYLSP_NEEDED
1066 *++yylsp = yylloc;
1067 #endif
1068
1069 yystate = yyn;
1070 goto yynewstate;
1071 }
1072
aseerror(const char * errmsg)1073 int aseerror(const char *errmsg)
1074 {
1075 char buffer[1024];
1076 snprintf(buffer, 1024, "%i:%s\n", aselineno, errmsg);
1077 S3D::dialogMessage("Lexer", buffer);
1078 return 0;
1079 }
1080
asewarning(const char * warningmsg)1081 int asewarning(const char *warningmsg)
1082 {
1083 char buffer[1024];
1084 snprintf(buffer, 1024, "%i:%s\n", aselineno, warningmsg);
1085 S3D::dialogMessage("Lexer", buffer);
1086 return 0;
1087 }
1088
asedebug(const char * debugmsg)1089 int asedebug(const char *debugmsg)
1090 {
1091 char buffer[1024];
1092 snprintf(buffer, 1024, "%i:%s\n", aselineno, debugmsg);
1093 S3D::dialogMessage("Lexer", buffer);
1094 return 0;
1095 }
1096