diff options
Diffstat (limited to 'src/others/mimesh/libg3d-0.0.8/plugins/import/imp_vrml/imp_vrml_v1.c')
-rw-r--r-- | src/others/mimesh/libg3d-0.0.8/plugins/import/imp_vrml/imp_vrml_v1.c | 2788 |
1 files changed, 2788 insertions, 0 deletions
diff --git a/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_vrml/imp_vrml_v1.c b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_vrml/imp_vrml_v1.c new file mode 100644 index 0000000..38e0497 --- /dev/null +++ b/src/others/mimesh/libg3d-0.0.8/plugins/import/imp_vrml/imp_vrml_v1.c | |||
@@ -0,0 +1,2788 @@ | |||
1 | #line 2 "imp_vrml_v1.c" | ||
2 | |||
3 | #line 4 "imp_vrml_v1.c" | ||
4 | |||
5 | #define YY_INT_ALIGNED short int | ||
6 | |||
7 | /* A lexical scanner generated by flex */ | ||
8 | |||
9 | #define FLEX_SCANNER | ||
10 | #define YY_FLEX_MAJOR_VERSION 2 | ||
11 | #define YY_FLEX_MINOR_VERSION 5 | ||
12 | #define YY_FLEX_SUBMINOR_VERSION 35 | ||
13 | #if YY_FLEX_SUBMINOR_VERSION > 0 | ||
14 | #define FLEX_BETA | ||
15 | #endif | ||
16 | |||
17 | /* First, we deal with platform-specific or compiler-specific issues. */ | ||
18 | |||
19 | /* begin standard C headers. */ | ||
20 | #include <stdio.h> | ||
21 | #include <string.h> | ||
22 | #include <errno.h> | ||
23 | #include <stdlib.h> | ||
24 | |||
25 | /* end standard C headers. */ | ||
26 | |||
27 | /* flex integer type definitions */ | ||
28 | |||
29 | #ifndef FLEXINT_H | ||
30 | #define FLEXINT_H | ||
31 | |||
32 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ | ||
33 | |||
34 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L | ||
35 | |||
36 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, | ||
37 | * if you want the limit (max/min) macros for int types. | ||
38 | */ | ||
39 | #ifndef __STDC_LIMIT_MACROS | ||
40 | #define __STDC_LIMIT_MACROS 1 | ||
41 | #endif | ||
42 | |||
43 | #include <inttypes.h> | ||
44 | typedef int8_t flex_int8_t; | ||
45 | typedef uint8_t flex_uint8_t; | ||
46 | typedef int16_t flex_int16_t; | ||
47 | typedef uint16_t flex_uint16_t; | ||
48 | typedef int32_t flex_int32_t; | ||
49 | typedef uint32_t flex_uint32_t; | ||
50 | #else | ||
51 | typedef signed char flex_int8_t; | ||
52 | typedef short int flex_int16_t; | ||
53 | typedef int flex_int32_t; | ||
54 | typedef unsigned char flex_uint8_t; | ||
55 | typedef unsigned short int flex_uint16_t; | ||
56 | typedef unsigned int flex_uint32_t; | ||
57 | |||
58 | /* Limits of integral types. */ | ||
59 | #ifndef INT8_MIN | ||
60 | #define INT8_MIN (-128) | ||
61 | #endif | ||
62 | #ifndef INT16_MIN | ||
63 | #define INT16_MIN (-32767-1) | ||
64 | #endif | ||
65 | #ifndef INT32_MIN | ||
66 | #define INT32_MIN (-2147483647-1) | ||
67 | #endif | ||
68 | #ifndef INT8_MAX | ||
69 | #define INT8_MAX (127) | ||
70 | #endif | ||
71 | #ifndef INT16_MAX | ||
72 | #define INT16_MAX (32767) | ||
73 | #endif | ||
74 | #ifndef INT32_MAX | ||
75 | #define INT32_MAX (2147483647) | ||
76 | #endif | ||
77 | #ifndef UINT8_MAX | ||
78 | #define UINT8_MAX (255U) | ||
79 | #endif | ||
80 | #ifndef UINT16_MAX | ||
81 | #define UINT16_MAX (65535U) | ||
82 | #endif | ||
83 | #ifndef UINT32_MAX | ||
84 | #define UINT32_MAX (4294967295U) | ||
85 | #endif | ||
86 | |||
87 | #endif /* ! C99 */ | ||
88 | |||
89 | #endif /* ! FLEXINT_H */ | ||
90 | |||
91 | #ifdef __cplusplus | ||
92 | |||
93 | /* The "const" storage-class-modifier is valid. */ | ||
94 | #define YY_USE_CONST | ||
95 | |||
96 | #else /* ! __cplusplus */ | ||
97 | |||
98 | /* C99 requires __STDC__ to be defined as 1. */ | ||
99 | #if defined (__STDC__) | ||
100 | |||
101 | #define YY_USE_CONST | ||
102 | |||
103 | #endif /* defined (__STDC__) */ | ||
104 | #endif /* ! __cplusplus */ | ||
105 | |||
106 | #ifdef YY_USE_CONST | ||
107 | #define yyconst const | ||
108 | #else | ||
109 | #define yyconst | ||
110 | #endif | ||
111 | |||
112 | /* Returned upon end-of-file. */ | ||
113 | #define YY_NULL 0 | ||
114 | |||
115 | /* Promotes a possibly negative, possibly signed char to an unsigned | ||
116 | * integer for use as an array index. If the signed char is negative, | ||
117 | * we want to instead treat it as an 8-bit unsigned char, hence the | ||
118 | * double cast. | ||
119 | */ | ||
120 | #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) | ||
121 | |||
122 | /* An opaque pointer. */ | ||
123 | #ifndef YY_TYPEDEF_YY_SCANNER_T | ||
124 | #define YY_TYPEDEF_YY_SCANNER_T | ||
125 | typedef void* yyscan_t; | ||
126 | #endif | ||
127 | |||
128 | /* For convenience, these vars (plus the bison vars far below) | ||
129 | are macros in the reentrant scanner. */ | ||
130 | #define yyin yyg->yyin_r | ||
131 | #define yyout yyg->yyout_r | ||
132 | #define yyextra yyg->yyextra_r | ||
133 | #define yyleng yyg->yyleng_r | ||
134 | #define yytext yyg->yytext_r | ||
135 | #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) | ||
136 | #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) | ||
137 | #define yy_flex_debug yyg->yy_flex_debug_r | ||
138 | |||
139 | /* Enter a start condition. This macro really ought to take a parameter, | ||
140 | * but we do it the disgusting crufty way forced on us by the ()-less | ||
141 | * definition of BEGIN. | ||
142 | */ | ||
143 | #define BEGIN yyg->yy_start = 1 + 2 * | ||
144 | |||
145 | /* Translate the current start state into a value that can be later handed | ||
146 | * to BEGIN to return to the state. The YYSTATE alias is for lex | ||
147 | * compatibility. | ||
148 | */ | ||
149 | #define YY_START ((yyg->yy_start - 1) / 2) | ||
150 | #define YYSTATE YY_START | ||
151 | |||
152 | /* Action number for EOF rule of a given start state. */ | ||
153 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) | ||
154 | |||
155 | /* Special action meaning "start processing a new file". */ | ||
156 | #define YY_NEW_FILE vrml_v1_yyrestart(yyin ,yyscanner ) | ||
157 | |||
158 | #define YY_END_OF_BUFFER_CHAR 0 | ||
159 | |||
160 | /* Size of default input buffer. */ | ||
161 | #ifndef YY_BUF_SIZE | ||
162 | #define YY_BUF_SIZE 16384 | ||
163 | #endif | ||
164 | |||
165 | /* The state buf must be large enough to hold one state per character in the main buffer. | ||
166 | */ | ||
167 | #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) | ||
168 | |||
169 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE | ||
170 | #define YY_TYPEDEF_YY_BUFFER_STATE | ||
171 | typedef struct yy_buffer_state *YY_BUFFER_STATE; | ||
172 | #endif | ||
173 | |||
174 | #define EOB_ACT_CONTINUE_SCAN 0 | ||
175 | #define EOB_ACT_END_OF_FILE 1 | ||
176 | #define EOB_ACT_LAST_MATCH 2 | ||
177 | |||
178 | #define YY_LESS_LINENO(n) | ||
179 | |||
180 | /* Return all but the first "n" matched characters back to the input stream. */ | ||
181 | #define yyless(n) \ | ||
182 | do \ | ||
183 | { \ | ||
184 | /* Undo effects of setting up yytext. */ \ | ||
185 | int yyless_macro_arg = (n); \ | ||
186 | YY_LESS_LINENO(yyless_macro_arg);\ | ||
187 | *yy_cp = yyg->yy_hold_char; \ | ||
188 | YY_RESTORE_YY_MORE_OFFSET \ | ||
189 | yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ | ||
190 | YY_DO_BEFORE_ACTION; /* set up yytext again */ \ | ||
191 | } \ | ||
192 | while ( 0 ) | ||
193 | |||
194 | #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) | ||
195 | |||
196 | #ifndef YY_TYPEDEF_YY_SIZE_T | ||
197 | #define YY_TYPEDEF_YY_SIZE_T | ||
198 | typedef size_t yy_size_t; | ||
199 | #endif | ||
200 | |||
201 | #ifndef YY_STRUCT_YY_BUFFER_STATE | ||
202 | #define YY_STRUCT_YY_BUFFER_STATE | ||
203 | struct yy_buffer_state | ||
204 | { | ||
205 | FILE *yy_input_file; | ||
206 | |||
207 | char *yy_ch_buf; /* input buffer */ | ||
208 | char *yy_buf_pos; /* current position in input buffer */ | ||
209 | |||
210 | /* Size of input buffer in bytes, not including room for EOB | ||
211 | * characters. | ||
212 | */ | ||
213 | yy_size_t yy_buf_size; | ||
214 | |||
215 | /* Number of characters read into yy_ch_buf, not including EOB | ||
216 | * characters. | ||
217 | */ | ||
218 | int yy_n_chars; | ||
219 | |||
220 | /* Whether we "own" the buffer - i.e., we know we created it, | ||
221 | * and can realloc() it to grow it, and should free() it to | ||
222 | * delete it. | ||
223 | */ | ||
224 | int yy_is_our_buffer; | ||
225 | |||
226 | /* Whether this is an "interactive" input source; if so, and | ||
227 | * if we're using stdio for input, then we want to use getc() | ||
228 | * instead of fread(), to make sure we stop fetching input after | ||
229 | * each newline. | ||
230 | */ | ||
231 | int yy_is_interactive; | ||
232 | |||
233 | /* Whether we're considered to be at the beginning of a line. | ||
234 | * If so, '^' rules will be active on the next match, otherwise | ||
235 | * not. | ||
236 | */ | ||
237 | int yy_at_bol; | ||
238 | |||
239 | int yy_bs_lineno; /**< The line count. */ | ||
240 | int yy_bs_column; /**< The column count. */ | ||
241 | |||
242 | /* Whether to try to fill the input buffer when we reach the | ||
243 | * end of it. | ||
244 | */ | ||
245 | int yy_fill_buffer; | ||
246 | |||
247 | int yy_buffer_status; | ||
248 | |||
249 | #define YY_BUFFER_NEW 0 | ||
250 | #define YY_BUFFER_NORMAL 1 | ||
251 | /* When an EOF's been seen but there's still some text to process | ||
252 | * then we mark the buffer as YY_EOF_PENDING, to indicate that we | ||
253 | * shouldn't try reading from the input source any more. We might | ||
254 | * still have a bunch of tokens to match, though, because of | ||
255 | * possible backing-up. | ||
256 | * | ||
257 | * When we actually see the EOF, we change the status to "new" | ||
258 | * (via vrml_v1_yyrestart()), so that the user can continue scanning by | ||
259 | * just pointing yyin at a new input file. | ||
260 | */ | ||
261 | #define YY_BUFFER_EOF_PENDING 2 | ||
262 | |||
263 | }; | ||
264 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ | ||
265 | |||
266 | /* We provide macros for accessing buffer states in case in the | ||
267 | * future we want to put the buffer states in a more general | ||
268 | * "scanner state". | ||
269 | * | ||
270 | * Returns the top of the stack, or NULL. | ||
271 | */ | ||
272 | #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ | ||
273 | ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ | ||
274 | : NULL) | ||
275 | |||
276 | /* Same as previous macro, but useful when we know that the buffer stack is not | ||
277 | * NULL or when we need an lvalue. For internal use only. | ||
278 | */ | ||
279 | #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] | ||
280 | |||
281 | void vrml_v1_yyrestart (FILE *input_file ,yyscan_t yyscanner ); | ||
282 | void vrml_v1_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); | ||
283 | YY_BUFFER_STATE vrml_v1_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); | ||
284 | void vrml_v1_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); | ||
285 | void vrml_v1_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); | ||
286 | void vrml_v1_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); | ||
287 | void vrml_v1_yypop_buffer_state (yyscan_t yyscanner ); | ||
288 | |||
289 | static void vrml_v1_yyensure_buffer_stack (yyscan_t yyscanner ); | ||
290 | static void vrml_v1_yy_load_buffer_state (yyscan_t yyscanner ); | ||
291 | static void vrml_v1_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); | ||
292 | |||
293 | #define YY_FLUSH_BUFFER vrml_v1_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) | ||
294 | |||
295 | YY_BUFFER_STATE vrml_v1_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); | ||
296 | YY_BUFFER_STATE vrml_v1_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); | ||
297 | YY_BUFFER_STATE vrml_v1_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); | ||
298 | |||
299 | void *vrml_v1_yyalloc (yy_size_t ,yyscan_t yyscanner ); | ||
300 | void *vrml_v1_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); | ||
301 | void vrml_v1_yyfree (void * ,yyscan_t yyscanner ); | ||
302 | |||
303 | #define yy_new_buffer vrml_v1_yy_create_buffer | ||
304 | |||
305 | #define yy_set_interactive(is_interactive) \ | ||
306 | { \ | ||
307 | if ( ! YY_CURRENT_BUFFER ){ \ | ||
308 | vrml_v1_yyensure_buffer_stack (yyscanner); \ | ||
309 | YY_CURRENT_BUFFER_LVALUE = \ | ||
310 | vrml_v1_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ | ||
311 | } \ | ||
312 | YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ | ||
313 | } | ||
314 | |||
315 | #define yy_set_bol(at_bol) \ | ||
316 | { \ | ||
317 | if ( ! YY_CURRENT_BUFFER ){\ | ||
318 | vrml_v1_yyensure_buffer_stack (yyscanner); \ | ||
319 | YY_CURRENT_BUFFER_LVALUE = \ | ||
320 | vrml_v1_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ | ||
321 | } \ | ||
322 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ | ||
323 | } | ||
324 | |||
325 | #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) | ||
326 | |||
327 | /* Begin user sect3 */ | ||
328 | |||
329 | typedef unsigned char YY_CHAR; | ||
330 | |||
331 | typedef int yy_state_type; | ||
332 | |||
333 | #define yytext_ptr yytext_r | ||
334 | |||
335 | static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); | ||
336 | static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); | ||
337 | static int yy_get_next_buffer (yyscan_t yyscanner ); | ||
338 | static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); | ||
339 | |||
340 | /* Done after the current pattern has been matched and before the | ||
341 | * corresponding action - sets up yytext. | ||
342 | */ | ||
343 | #define YY_DO_BEFORE_ACTION \ | ||
344 | yyg->yytext_ptr = yy_bp; \ | ||
345 | yyleng = (size_t) (yy_cp - yy_bp); \ | ||
346 | yyg->yy_hold_char = *yy_cp; \ | ||
347 | *yy_cp = '\0'; \ | ||
348 | yyg->yy_c_buf_p = yy_cp; | ||
349 | |||
350 | #define YY_NUM_RULES 32 | ||
351 | #define YY_END_OF_BUFFER 33 | ||
352 | /* This struct is not used in this scanner, | ||
353 | but its presence is necessary. */ | ||
354 | struct yy_trans_info | ||
355 | { | ||
356 | flex_int32_t yy_verify; | ||
357 | flex_int32_t yy_nxt; | ||
358 | }; | ||
359 | static yyconst flex_int16_t yy_acclist[299] = | ||
360 | { 0, | ||
361 | 33, 30, 32, 31, 32, 30, 32, 15, 30, 32, | ||
362 | 30, 32,16411, 30, 32,16411, 30, 32,16411, 30, | ||
363 | 32,16411, 30, 32,16411, 30, 32,16411, 26, 30, | ||
364 | 32, 30, 32, 30, 32, 30, 32, 30, 32, 30, | ||
365 | 32, 30, 32, 30, 32, 30, 32, 28, 30, 32, | ||
366 | 29, 30, 32, 1, 30, 32, 30, 32, 4, 30, | ||
367 | 32, 5, 31, 32, 4, 30, 32, 4, 15, 30, | ||
368 | 32, 4, 30, 32,16411, 4, 30, 32,16411, 4, | ||
369 | 30, 32,16411, 4, 30, 32,16411, 4, 30, 32, | ||
370 | 16411, 4, 30, 32,16411, 4, 30, 32,16411, 4, | ||
371 | |||
372 | 26, 30, 32, 4, 30, 32, 4, 30, 32, 4, | ||
373 | 30, 32, 4, 30, 32, 4, 30, 32, 4, 30, | ||
374 | 32, 4, 30, 32, 4, 30, 32, 4, 28, 30, | ||
375 | 32, 4, 29, 30, 32, 6, 30, 32, 7, 31, | ||
376 | 32, 6, 30, 32, 6, 15, 30, 32, 6, 30, | ||
377 | 32,16411, 6, 30, 32,16411, 6, 30, 32,16411, | ||
378 | 6, 30, 32,16411, 6, 30, 32,16411, 6, 30, | ||
379 | 32,16411, 6, 26, 30, 32, 6, 30, 32, 6, | ||
380 | 30, 32, 6, 30, 32, 6, 30, 32, 6, 30, | ||
381 | 32, 6, 30, 32, 6, 30, 32, 6, 30, 32, | ||
382 | |||
383 | 6, 28, 30, 32, 6, 29, 30, 32, 15, 15, | ||
384 | 15, 14, 15,16411, 8219,16411,16411,16411,16411,16411, | ||
385 | 1, 3, 3,16411,16411,16411,16411,16411,16411,16411, | ||
386 | 16411,16411,16411,16411,16411,16411,16411,16411,16411,16411, | ||
387 | 16411,16411, 9, 8219,16411,16411,16411,16411, 25, 22, | ||
388 | 16411, 9,16411,16411,16411,16411, 2,16411,16411,16411, | ||
389 | 16411,16411,16411,16411, 10, 8219,16411,16411,16411,16411, | ||
390 | 16411, 8, 8219, 20,16411,16411,16411, 23, 12, 8219, | ||
391 | 16411,16411,16411,16411, 16, 17, 21,16411,16411, 19, | ||
392 | 24, 18, 13, 8219,16411, 11, 8219, 11 | ||
393 | |||
394 | } ; | ||
395 | |||
396 | static yyconst flex_int16_t yy_accept[276] = | ||
397 | { 0, | ||
398 | 1, 1, 1, 1, 1, 1, 1, 2, 4, 6, | ||
399 | 8, 11, 14, 17, 20, 23, 26, 29, 32, 34, | ||
400 | 36, 38, 40, 42, 44, 46, 48, 51, 54, 57, | ||
401 | 59, 62, 65, 68, 72, 76, 80, 84, 88, 92, | ||
402 | 96, 100, 104, 107, 110, 113, 116, 119, 122, 125, | ||
403 | 128, 132, 136, 139, 142, 145, 149, 153, 157, 161, | ||
404 | 165, 169, 173, 177, 180, 183, 186, 189, 192, 195, | ||
405 | 198, 201, 205, 209, 210, 211, 212, 213, 214, 214, | ||
406 | 214, 215, 216, 217, 218, 219, 220, 221, 221, 221, | ||
407 | 221, 221, 221, 221, 221, 221, 221, 221, 222, 222, | ||
408 | |||
409 | 223, 225, 226, 227, 228, 229, 230, 230, 230, 230, | ||
410 | 230, 230, 230, 230, 230, 230, 230, 231, 232, 233, | ||
411 | 234, 235, 236, 236, 236, 236, 236, 236, 236, 236, | ||
412 | 236, 236, 236, 236, 237, 238, 239, 240, 241, 242, | ||
413 | 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, | ||
414 | 242, 243, 243, 243, 245, 246, 247, 248, 249, 249, | ||
415 | 249, 249, 249, 249, 250, 250, 251, 251, 251, 251, | ||
416 | 251, 252, 253, 254, 255, 256, 257, 257, 257, 257, | ||
417 | 257, 257, 257, 257, 257, 258, 259, 260, 261, 262, | ||
418 | 263, 263, 263, 263, 263, 263, 263, 263, 263, 264, | ||
419 | |||
420 | 265, 265, 267, 268, 269, 269, 269, 269, 269, 269, | ||
421 | 269, 269, 269, 270, 271, 272, 272, 274, 274, 274, | ||
422 | 274, 274, 274, 274, 275, 275, 275, 276, 277, 278, | ||
423 | 278, 278, 279, 279, 279, 279, 279, 279, 279, 281, | ||
424 | 282, 283, 283, 283, 283, 283, 283, 283, 284, 285, | ||
425 | 285, 286, 286, 287, 287, 287, 287, 287, 288, 289, | ||
426 | 290, 290, 291, 291, 292, 292, 293, 293, 295, 296, | ||
427 | 296, 296, 298, 299, 299 | ||
428 | } ; | ||
429 | |||
430 | static yyconst flex_int32_t yy_ec[256] = | ||
431 | { 0, | ||
432 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, | ||
433 | 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, | ||
434 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
435 | 1, 4, 1, 1, 5, 1, 1, 1, 1, 1, | ||
436 | 1, 1, 1, 6, 7, 8, 1, 9, 9, 9, | ||
437 | 10, 9, 9, 9, 9, 9, 9, 1, 1, 1, | ||
438 | 1, 1, 1, 1, 11, 11, 12, 11, 11, 13, | ||
439 | 14, 11, 15, 11, 11, 16, 17, 11, 11, 11, | ||
440 | 11, 18, 19, 20, 11, 21, 11, 11, 11, 11, | ||
441 | 22, 1, 23, 1, 1, 1, 24, 25, 26, 27, | ||
442 | |||
443 | 28, 29, 30, 31, 32, 30, 30, 33, 34, 35, | ||
444 | 36, 37, 30, 38, 39, 40, 41, 42, 30, 43, | ||
445 | 44, 30, 45, 1, 46, 1, 1, 1, 1, 1, | ||
446 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
447 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
448 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
449 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
450 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
451 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
452 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
453 | |||
454 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
455 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
456 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
457 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
458 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
459 | 1, 1, 1, 1, 1 | ||
460 | } ; | ||
461 | |||
462 | static yyconst flex_int32_t yy_meta[47] = | ||
463 | { 0, | ||
464 | 1, 2, 2, 3, 1, 4, 5, 5, 3, 3, | ||
465 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | ||
466 | 6, 1, 4, 6, 6, 6, 6, 7, 6, 6, | ||
467 | 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, | ||
468 | 6, 6, 6, 6, 6, 1 | ||
469 | } ; | ||
470 | |||
471 | static yyconst flex_int16_t yy_base[278] = | ||
472 | { 0, | ||
473 | 0, 42, 81, 0, 127, 0, 619, 620, 620, 39, | ||
474 | 172, 173, 179, 181, 182, 180, 183, 620, 584, 581, | ||
475 | 584, 581, 590, 577, 19, 574, 620, 620, 590, 183, | ||
476 | 620, 620, 42, 0, 185, 187, 193, 194, 188, 206, | ||
477 | 197, 620, 576, 573, 576, 573, 582, 569, 22, 566, | ||
478 | 620, 620, 620, 620, 45, 0, 190, 204, 198, 209, | ||
479 | 192, 217, 620, 569, 566, 569, 566, 575, 562, 26, | ||
480 | 559, 620, 620, 0, 0, 51, 620, 0, 52, 205, | ||
481 | 237, 620, 242, 243, 244, 251, 248, 571, 559, 565, | ||
482 | 561, 552, 559, 558, 561, 564, 568, 620, 251, 56, | ||
483 | |||
484 | 249, 257, 256, 264, 270, 259, 549, 538, 546, 533, | ||
485 | 34, 536, 534, 542, 531, 548, 272, 266, 262, 268, | ||
486 | 280, 276, 536, 536, 521, 522, 522, 527, 518, 525, | ||
487 | 515, 516, 538, 296, 316, 282, 312, 319, 318, 518, | ||
488 | 537, 512, 518, 517, 505, 327, 512, 513, 508, 540, | ||
489 | 320, 330, 333, 620, 339, 322, 334, 336, 503, 507, | ||
490 | 512, 497, 513, 620, 348, 620, 508, 510, 509, 492, | ||
491 | 335, 620, 343, 341, 344, 349, 500, 482, 495, 476, | ||
492 | 470, 462, 459, 437, 620, 356, 367, 354, 368, 364, | ||
493 | 436, 439, 428, 435, 422, 390, 269, 249, 365, 369, | ||
494 | |||
495 | 373, 620, 386, 379, 242, 230, 236, 231, 230, 401, | ||
496 | 228, 168, 396, 383, 393, 394, 620, 163, 413, 157, | ||
497 | 157, 53, 423, 620, 46, 52, 403, 415, 404, 39, | ||
498 | 440, 620, 38, 38, 45, 35, 26, 416, 620, 418, | ||
499 | 432, 448, 451, 31, 25, 29, 454, 426, 436, 476, | ||
500 | 620, 480, 620, 483, 486, 489, 492, 620, 455, 465, | ||
501 | 513, 620, 516, 620, 519, 620, 461, 620, 522, 525, | ||
502 | 528, 620, 620, 620, 571, 577, 580 | ||
503 | } ; | ||
504 | |||
505 | static yyconst flex_int16_t yy_def[278] = | ||
506 | { 0, | ||
507 | 274, 1, 274, 3, 274, 5, 274, 274, 274, 274, | ||
508 | 274, 275, 275, 275, 275, 275, 275, 274, 274, 274, | ||
509 | 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, | ||
510 | 274, 274, 274, 11, 275, 275, 275, 275, 275, 275, | ||
511 | 275, 274, 274, 274, 274, 274, 274, 274, 274, 274, | ||
512 | 274, 274, 274, 274, 274, 11, 275, 275, 275, 275, | ||
513 | 275, 275, 274, 274, 274, 274, 274, 274, 274, 274, | ||
514 | 274, 274, 274, 11, 276, 11, 274, 11, 277, 274, | ||
515 | 275, 274, 275, 275, 275, 275, 275, 274, 274, 274, | ||
516 | 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, | ||
517 | |||
518 | 275, 275, 275, 275, 275, 275, 274, 274, 274, 274, | ||
519 | 274, 274, 274, 274, 274, 274, 275, 275, 275, 275, | ||
520 | 275, 275, 274, 274, 274, 274, 274, 274, 274, 274, | ||
521 | 274, 274, 274, 275, 275, 275, 275, 275, 275, 274, | ||
522 | 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, | ||
523 | 275, 274, 274, 274, 275, 275, 275, 275, 274, 274, | ||
524 | 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, | ||
525 | 275, 274, 275, 275, 275, 275, 274, 274, 274, 274, | ||
526 | 274, 274, 274, 274, 274, 275, 275, 275, 275, 275, | ||
527 | 274, 274, 274, 274, 274, 274, 274, 274, 275, 275, | ||
528 | |||
529 | 274, 274, 275, 275, 274, 274, 274, 274, 274, 274, | ||
530 | 274, 274, 275, 275, 275, 274, 274, 274, 274, 274, | ||
531 | 274, 274, 274, 274, 274, 274, 275, 275, 275, 274, | ||
532 | 274, 274, 274, 274, 274, 274, 274, 274, 274, 275, | ||
533 | 275, 274, 274, 274, 274, 274, 274, 275, 275, 274, | ||
534 | 274, 274, 274, 274, 274, 274, 274, 274, 275, 275, | ||
535 | 274, 274, 274, 274, 274, 274, 274, 274, 275, 274, | ||
536 | 274, 274, 274, 0, 274, 274, 274 | ||
537 | } ; | ||
538 | |||
539 | static yyconst flex_int16_t yy_nxt[667] = | ||
540 | { 0, | ||
541 | 8, 8, 9, 8, 8, 8, 10, 8, 11, 11, | ||
542 | 12, 13, 12, 14, 15, 12, 16, 12, 17, 12, | ||
543 | 12, 8, 18, 19, 8, 20, 21, 22, 8, 8, | ||
544 | 8, 8, 8, 23, 8, 8, 24, 8, 25, 26, | ||
545 | 8, 8, 8, 8, 27, 28, 29, 74, 74, 94, | ||
546 | 74, 74, 94, 74, 74, 95, 94, 77, 95, 76, | ||
547 | 76, 127, 95, 100, 100, 100, 256, 255, 254, 247, | ||
548 | 246, 128, 245, 244, 77, 243, 242, 237, 236, 235, | ||
549 | 30, 31, 31, 32, 31, 31, 31, 33, 31, 34, | ||
550 | 34, 35, 36, 35, 37, 38, 35, 39, 35, 40, | ||
551 | |||
552 | 35, 41, 31, 42, 43, 31, 44, 45, 46, 31, | ||
553 | 31, 31, 31, 31, 47, 31, 31, 48, 31, 49, | ||
554 | 50, 31, 31, 31, 31, 51, 52, 53, 53, 54, | ||
555 | 53, 53, 53, 55, 53, 56, 56, 57, 58, 57, | ||
556 | 59, 60, 57, 61, 57, 62, 57, 57, 53, 63, | ||
557 | 64, 53, 65, 66, 67, 53, 53, 53, 53, 53, | ||
558 | 68, 53, 53, 69, 53, 70, 71, 53, 53, 53, | ||
559 | 53, 72, 73, 75, 75, 76, 80, 77, 76, 76, | ||
560 | 78, 78, 80, 80, 80, 80, 80, 98, 80, 234, | ||
561 | 80, 80, 233, 80, 77, 80, 80, 80, 230, 79, | ||
562 | |||
563 | 80, 80, 226, 86, 100, 101, 101, 80, 80, 80, | ||
564 | 87, 86, 80, 94, 83, 86, 85, 82, 84, 95, | ||
565 | 80, 99, 83, 82, 82, 82, 82, 82, 85, 82, | ||
566 | 84, 82, 82, 87, 82, 84, 82, 82, 82, 83, | ||
567 | 80, 82, 82, 85, 87, 80, 80, 80, 82, 82, | ||
568 | 82, 80, 80, 82, 80, 98, 100, 101, 101, 80, | ||
569 | 80, 82, 80, 225, 222, 80, 221, 80, 220, 80, | ||
570 | 104, 80, 219, 80, 218, 80, 212, 102, 103, 80, | ||
571 | 211, 82, 122, 80, 106, 80, 82, 82, 82, 99, | ||
572 | 105, 119, 82, 82, 117, 82, 118, 120, 134, 80, | ||
573 | |||
574 | 82, 82, 135, 82, 136, 137, 82, 121, 82, 155, | ||
575 | 82, 138, 82, 139, 82, 80, 82, 152, 152, 153, | ||
576 | 82, 80, 80, 80, 82, 80, 82, 151, 165, 165, | ||
577 | 165, 152, 152, 152, 152, 152, 153, 80, 80, 80, | ||
578 | 82, 158, 80, 156, 80, 174, 80, 80, 166, 165, | ||
579 | 165, 165, 80, 175, 171, 187, 82, 201, 186, 80, | ||
580 | 154, 157, 82, 82, 82, 173, 82, 80, 80, 166, | ||
581 | 80, 80, 80, 188, 172, 176, 201, 154, 82, 82, | ||
582 | 82, 189, 216, 82, 190, 82, 80, 82, 82, 80, | ||
583 | 200, 203, 213, 82, 214, 199, 80, 216, 202, 80, | ||
584 | |||
585 | 82, 204, 223, 223, 223, 227, 238, 80, 82, 82, | ||
586 | 228, 82, 82, 82, 231, 231, 231, 202, 80, 238, | ||
587 | 215, 80, 224, 217, 223, 223, 223, 82, 210, 80, | ||
588 | 82, 229, 241, 240, 232, 80, 209, 82, 217, 80, | ||
589 | 82, 231, 231, 231, 224, 248, 208, 239, 82, 250, | ||
590 | 250, 250, 252, 252, 252, 257, 257, 257, 267, 82, | ||
591 | 239, 232, 82, 207, 267, 259, 206, 249, 80, 251, | ||
592 | 82, 205, 253, 260, 198, 258, 82, 250, 250, 250, | ||
593 | 82, 252, 252, 252, 261, 261, 261, 263, 263, 263, | ||
594 | 265, 265, 265, 257, 257, 257, 197, 251, 269, 268, | ||
595 | |||
596 | 196, 253, 195, 194, 262, 268, 193, 264, 192, 82, | ||
597 | 266, 191, 185, 258, 261, 261, 261, 263, 263, 263, | ||
598 | 265, 265, 265, 270, 270, 271, 270, 270, 270, 270, | ||
599 | 270, 271, 184, 183, 262, 182, 181, 264, 180, 179, | ||
600 | 266, 178, 177, 170, 169, 168, 167, 164, 163, 162, | ||
601 | 161, 160, 159, 150, 149, 148, 147, 146, 145, 144, | ||
602 | 143, 142, 141, 140, 133, 132, 272, 131, 130, 273, | ||
603 | 129, 126, 272, 81, 125, 124, 81, 81, 75, 75, | ||
604 | 123, 75, 79, 79, 79, 116, 79, 115, 114, 113, | ||
605 | 112, 111, 110, 109, 108, 107, 96, 93, 92, 91, | ||
606 | |||
607 | 90, 89, 88, 96, 93, 92, 91, 90, 89, 88, | ||
608 | 97, 96, 93, 92, 91, 90, 89, 88, 274, 7, | ||
609 | 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, | ||
610 | 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, | ||
611 | 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, | ||
612 | 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, | ||
613 | 274, 274, 274, 274, 274, 274 | ||
614 | } ; | ||
615 | |||
616 | static yyconst flex_int16_t yy_chk[667] = | ||
617 | { 0, | ||
618 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
619 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
620 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
621 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
622 | 1, 1, 1, 1, 1, 1, 2, 10, 10, 25, | ||
623 | 33, 33, 49, 55, 55, 25, 70, 79, 49, 76, | ||
624 | 76, 111, 70, 100, 100, 100, 246, 245, 244, 237, | ||
625 | 236, 111, 235, 234, 79, 233, 230, 226, 225, 222, | ||
626 | 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, | ||
627 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | ||
628 | |||
629 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | ||
630 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | ||
631 | 3, 3, 3, 3, 3, 3, 3, 5, 5, 5, | ||
632 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
633 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
634 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
635 | 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, | ||
636 | 5, 5, 5, 11, 11, 11, 12, 11, 11, 11, | ||
637 | 11, 11, 13, 16, 14, 15, 17, 30, 35, 221, | ||
638 | 36, 39, 220, 57, 11, 61, 37, 38, 218, 11, | ||
639 | |||
640 | 41, 59, 212, 16, 41, 41, 41, 58, 80, 40, | ||
641 | 17, 39, 60, 30, 13, 61, 15, 12, 14, 30, | ||
642 | 62, 30, 36, 13, 16, 14, 15, 17, 38, 35, | ||
643 | 37, 36, 39, 40, 57, 59, 61, 37, 38, 58, | ||
644 | 81, 41, 59, 60, 62, 83, 84, 85, 58, 80, | ||
645 | 40, 87, 101, 60, 86, 99, 101, 101, 101, 103, | ||
646 | 102, 62, 106, 211, 209, 119, 208, 104, 207, 118, | ||
647 | 85, 120, 206, 105, 205, 117, 198, 83, 84, 122, | ||
648 | 197, 81, 106, 121, 87, 136, 83, 84, 85, 99, | ||
649 | 86, 104, 87, 101, 102, 86, 103, 105, 117, 134, | ||
650 | |||
651 | 103, 102, 118, 106, 119, 120, 119, 105, 104, 136, | ||
652 | 118, 121, 120, 122, 105, 137, 117, 135, 135, 135, | ||
653 | 122, 139, 138, 151, 121, 156, 136, 134, 146, 146, | ||
654 | 146, 152, 152, 152, 153, 153, 153, 157, 171, 158, | ||
655 | 134, 139, 155, 137, 174, 156, 173, 175, 146, 165, | ||
656 | 165, 165, 176, 157, 151, 173, 137, 188, 171, 186, | ||
657 | 135, 138, 139, 138, 151, 155, 156, 190, 199, 165, | ||
658 | 187, 189, 200, 174, 152, 158, 201, 153, 157, 171, | ||
659 | 158, 175, 204, 155, 176, 174, 214, 173, 175, 203, | ||
660 | 187, 189, 199, 176, 200, 186, 215, 216, 188, 213, | ||
661 | |||
662 | 186, 190, 210, 210, 210, 213, 227, 229, 190, 199, | ||
663 | 214, 187, 189, 200, 219, 219, 219, 201, 228, 238, | ||
664 | 203, 240, 210, 204, 223, 223, 223, 214, 196, 248, | ||
665 | 203, 215, 229, 228, 219, 241, 195, 215, 216, 249, | ||
666 | 213, 231, 231, 231, 223, 240, 194, 227, 229, 242, | ||
667 | 242, 242, 243, 243, 243, 247, 247, 247, 259, 228, | ||
668 | 238, 231, 240, 193, 267, 248, 192, 241, 260, 242, | ||
669 | 248, 191, 243, 249, 184, 247, 241, 250, 250, 250, | ||
670 | 249, 252, 252, 252, 254, 254, 254, 255, 255, 255, | ||
671 | 256, 256, 256, 257, 257, 257, 183, 250, 260, 259, | ||
672 | |||
673 | 182, 252, 181, 180, 254, 267, 179, 255, 178, 260, | ||
674 | 256, 177, 170, 257, 261, 261, 261, 263, 263, 263, | ||
675 | 265, 265, 265, 269, 269, 269, 270, 270, 270, 271, | ||
676 | 271, 271, 169, 168, 261, 167, 163, 263, 162, 161, | ||
677 | 265, 160, 159, 150, 149, 148, 147, 145, 144, 143, | ||
678 | 142, 141, 140, 133, 132, 131, 130, 129, 128, 127, | ||
679 | 126, 125, 124, 123, 116, 115, 269, 114, 113, 270, | ||
680 | 112, 110, 271, 275, 109, 108, 275, 275, 276, 276, | ||
681 | 107, 276, 277, 277, 277, 97, 277, 96, 95, 94, | ||
682 | 93, 92, 91, 90, 89, 88, 71, 69, 68, 67, | ||
683 | |||
684 | 66, 65, 64, 50, 48, 47, 46, 45, 44, 43, | ||
685 | 29, 26, 24, 23, 22, 21, 20, 19, 7, 274, | ||
686 | 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, | ||
687 | 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, | ||
688 | 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, | ||
689 | 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, | ||
690 | 274, 274, 274, 274, 274, 274 | ||
691 | } ; | ||
692 | |||
693 | #define YY_TRAILING_MASK 0x2000 | ||
694 | #define YY_TRAILING_HEAD_MASK 0x4000 | ||
695 | #define REJECT \ | ||
696 | { \ | ||
697 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ \ | ||
698 | yy_cp = yyg->yy_full_match; /* restore poss. backed-over text */ \ | ||
699 | yyg->yy_lp = yyg->yy_full_lp; /* restore orig. accepting pos. */ \ | ||
700 | yyg->yy_state_ptr = yyg->yy_full_state; /* restore orig. state */ \ | ||
701 | yy_current_state = *yyg->yy_state_ptr; /* restore curr. state */ \ | ||
702 | ++yyg->yy_lp; \ | ||
703 | goto find_rule; \ | ||
704 | } | ||
705 | |||
706 | #define yymore() yymore_used_but_not_detected | ||
707 | #define YY_MORE_ADJ 0 | ||
708 | #define YY_RESTORE_YY_MORE_OFFSET | ||
709 | #line 1 "imp_vrml_v1.l" | ||
710 | /* $Id$ */ | ||
711 | /* | ||
712 | libg3d - 3D object loading library | ||
713 | |||
714 | Copyright (C) 2005-2009 Markus Dahms <mad@automagically.de> | ||
715 | |||
716 | This library is free software; you can redistribute it and/or | ||
717 | modify it under the terms of the GNU Lesser General Public | ||
718 | License as published by the Free Software Foundation; either | ||
719 | version 2.1 of the License, or (at your option) any later version. | ||
720 | |||
721 | This library is distributed in the hope that it will be useful, | ||
722 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
723 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
724 | Lesser General Public License for more details. | ||
725 | |||
726 | You should have received a copy of the GNU Lesser General Public | ||
727 | License along with this library; if not, write to the Free Software | ||
728 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
729 | */ | ||
730 | |||
731 | |||
732 | /* $Id$ */ | ||
733 | /* | ||
734 | libg3d - 3D object loading library | ||
735 | Copyright (C) 2005-2009 Markus Dahms <mad@automagically.de> | ||
736 | This library is free software; you can redistribute it and/or | ||
737 | modify it under the terms of the GNU Lesser General Public | ||
738 | License as published by the Free Software Foundation; either | ||
739 | version 2.1 of the License, or (at your option) any later version. | ||
740 | This library is distributed in the hope that it will be useful, | ||
741 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
742 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
743 | Lesser General Public License for more details. | ||
744 | You should have received a copy of the GNU Lesser General Public | ||
745 | License along with this library; if not, write to the Free Software | ||
746 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
747 | */ | ||
748 | #define __USE_POSIX 1 | ||
749 | #define _XOPEN_SOURCE 500 | ||
750 | #define _POSIX_C_SOURCE 200112L | ||
751 | #include <stdio.h> | ||
752 | #include <string.h> | ||
753 | #include <locale.h> | ||
754 | #include <g3d/types.h> | ||
755 | #include <g3d/material.h> | ||
756 | #include <g3d/vector.h> | ||
757 | #if DEBUG > 0 | ||
758 | # define vrml_dump_hier(level, section) g_debug("\\%.*s[%s]", \ | ||
759 | level, " ", section) | ||
760 | #else | ||
761 | # define vrml_dump_hier(level, section) /* */ | ||
762 | #endif | ||
763 | #define VRML_OTYPE_MAT 0x0100 | ||
764 | #define VRML_OTYPE_MAT_AMBIENTCOLOR 0x0101 | ||
765 | #define VRML_OTYPE_MAT_DIFFUSECOLOR 0x0102 | ||
766 | #define VRML_OTYPE_MAT_SPECULARCOLOR 0x0103 | ||
767 | #define VRML_OTYPE_MAT_EMISSIVECOLOR 0x0104 | ||
768 | #define VRML_OTYPE_MAT_SHININESS 0x0105 | ||
769 | #define VRML_OTYPE_MAT_TRANSPARENCY 0x0106 | ||
770 | #define VRML_OTYPE_COORD3 0x0200 | ||
771 | #define VRML_OTYPE_COORD3_POINT 0x0201 | ||
772 | #define VRML_OTYPE_IDXFACESET 0x0300 | ||
773 | #define VRML_OTYPE_IDXFACESET_COORDIDX 0x0301 | ||
774 | #define VRML_OTYPE_IDXFACESET_MATIDX 0x0302 | ||
775 | #define VRML_OTYPE_MTRANS 0x0400 | ||
776 | #define VRML_OTYPE_MTRANS_MATRIX 0x0401 | ||
777 | #line 778 "imp_vrml_v1.c" | ||
778 | |||
779 | #define INITIAL 0 | ||
780 | #define VRMLHEADER 1 | ||
781 | #define COMMENT 2 | ||
782 | |||
783 | #ifndef YY_NO_UNISTD_H | ||
784 | /* Special case for "unistd.h", since it is non-ANSI. We include it way | ||
785 | * down here because we want the user's section 1 to have been scanned first. | ||
786 | * The user has a chance to override it with an option. | ||
787 | */ | ||
788 | #include <unistd.h> | ||
789 | #endif | ||
790 | |||
791 | #ifndef YY_EXTRA_TYPE | ||
792 | #define YY_EXTRA_TYPE void * | ||
793 | #endif | ||
794 | |||
795 | /* Holds the entire state of the reentrant scanner. */ | ||
796 | struct yyguts_t | ||
797 | { | ||
798 | |||
799 | /* User-defined. Not touched by flex. */ | ||
800 | YY_EXTRA_TYPE yyextra_r; | ||
801 | |||
802 | /* The rest are the same as the globals declared in the non-reentrant scanner. */ | ||
803 | FILE *yyin_r, *yyout_r; | ||
804 | size_t yy_buffer_stack_top; /**< index of top of stack. */ | ||
805 | size_t yy_buffer_stack_max; /**< capacity of stack. */ | ||
806 | YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ | ||
807 | char yy_hold_char; | ||
808 | int yy_n_chars; | ||
809 | int yyleng_r; | ||
810 | char *yy_c_buf_p; | ||
811 | int yy_init; | ||
812 | int yy_start; | ||
813 | int yy_did_buffer_switch_on_eof; | ||
814 | int yy_start_stack_ptr; | ||
815 | int yy_start_stack_depth; | ||
816 | int *yy_start_stack; | ||
817 | yy_state_type yy_last_accepting_state; | ||
818 | char* yy_last_accepting_cpos; | ||
819 | |||
820 | int yylineno_r; | ||
821 | int yy_flex_debug_r; | ||
822 | |||
823 | yy_state_type *yy_state_buf; | ||
824 | yy_state_type *yy_state_ptr; | ||
825 | char *yy_full_match; | ||
826 | int yy_lp; | ||
827 | |||
828 | /* These are only needed for trailing context rules, | ||
829 | * but there's no conditional variable for that yet. */ | ||
830 | int yy_looking_for_trail_begin; | ||
831 | int yy_full_lp; | ||
832 | int *yy_full_state; | ||
833 | |||
834 | char *yytext_r; | ||
835 | int yy_more_flag; | ||
836 | int yy_more_len; | ||
837 | |||
838 | }; /* end struct yyguts_t */ | ||
839 | |||
840 | static int yy_init_globals (yyscan_t yyscanner ); | ||
841 | |||
842 | int vrml_v1_yylex_init (yyscan_t* scanner); | ||
843 | |||
844 | int vrml_v1_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); | ||
845 | |||
846 | /* Accessor methods to globals. | ||
847 | These are made visible to non-reentrant scanners for convenience. */ | ||
848 | |||
849 | int vrml_v1_yylex_destroy (yyscan_t yyscanner ); | ||
850 | |||
851 | int vrml_v1_yyget_debug (yyscan_t yyscanner ); | ||
852 | |||
853 | void vrml_v1_yyset_debug (int debug_flag ,yyscan_t yyscanner ); | ||
854 | |||
855 | YY_EXTRA_TYPE vrml_v1_yyget_extra (yyscan_t yyscanner ); | ||
856 | |||
857 | void vrml_v1_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); | ||
858 | |||
859 | FILE *vrml_v1_yyget_in (yyscan_t yyscanner ); | ||
860 | |||
861 | void vrml_v1_yyset_in (FILE * in_str ,yyscan_t yyscanner ); | ||
862 | |||
863 | FILE *vrml_v1_yyget_out (yyscan_t yyscanner ); | ||
864 | |||
865 | void vrml_v1_yyset_out (FILE * out_str ,yyscan_t yyscanner ); | ||
866 | |||
867 | int vrml_v1_yyget_leng (yyscan_t yyscanner ); | ||
868 | |||
869 | char *vrml_v1_yyget_text (yyscan_t yyscanner ); | ||
870 | |||
871 | int vrml_v1_yyget_lineno (yyscan_t yyscanner ); | ||
872 | |||
873 | void vrml_v1_yyset_lineno (int line_number ,yyscan_t yyscanner ); | ||
874 | |||
875 | /* Macros after this point can all be overridden by user definitions in | ||
876 | * section 1. | ||
877 | */ | ||
878 | |||
879 | #ifndef YY_SKIP_YYWRAP | ||
880 | #ifdef __cplusplus | ||
881 | extern "C" int vrml_v1_yywrap (yyscan_t yyscanner ); | ||
882 | #else | ||
883 | extern int vrml_v1_yywrap (yyscan_t yyscanner ); | ||
884 | #endif | ||
885 | #endif | ||
886 | |||
887 | static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner); | ||
888 | |||
889 | #ifndef yytext_ptr | ||
890 | static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); | ||
891 | #endif | ||
892 | |||
893 | #ifdef YY_NEED_STRLEN | ||
894 | static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); | ||
895 | #endif | ||
896 | |||
897 | #ifndef YY_NO_INPUT | ||
898 | |||
899 | #ifdef __cplusplus | ||
900 | static int yyinput (yyscan_t yyscanner ); | ||
901 | #else | ||
902 | static int input (yyscan_t yyscanner ); | ||
903 | #endif | ||
904 | |||
905 | #endif | ||
906 | |||
907 | /* Amount of stuff to slurp up with each read. */ | ||
908 | #ifndef YY_READ_BUF_SIZE | ||
909 | #define YY_READ_BUF_SIZE 8192 | ||
910 | #endif | ||
911 | |||
912 | /* Copy whatever the last rule matched to the standard output. */ | ||
913 | #ifndef ECHO | ||
914 | /* This used to be an fputs(), but since the string might contain NUL's, | ||
915 | * we now use fwrite(). | ||
916 | */ | ||
917 | #define ECHO fwrite( yytext, yyleng, 1, yyout ) | ||
918 | #endif | ||
919 | |||
920 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, | ||
921 | * is returned in "result". | ||
922 | */ | ||
923 | #ifndef YY_INPUT | ||
924 | #define YY_INPUT(buf,result,max_size) \ | ||
925 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ | ||
926 | { \ | ||
927 | int c = '*'; \ | ||
928 | size_t n; \ | ||
929 | for ( n = 0; n < max_size && \ | ||
930 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ | ||
931 | buf[n] = (char) c; \ | ||
932 | if ( c == '\n' ) \ | ||
933 | buf[n++] = (char) c; \ | ||
934 | if ( c == EOF && ferror( yyin ) ) \ | ||
935 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ | ||
936 | result = n; \ | ||
937 | } \ | ||
938 | else \ | ||
939 | { \ | ||
940 | errno=0; \ | ||
941 | while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ | ||
942 | { \ | ||
943 | if( errno != EINTR) \ | ||
944 | { \ | ||
945 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ | ||
946 | break; \ | ||
947 | } \ | ||
948 | errno=0; \ | ||
949 | clearerr(yyin); \ | ||
950 | } \ | ||
951 | }\ | ||
952 | \ | ||
953 | |||
954 | #endif | ||
955 | |||
956 | /* No semi-colon after return; correct usage is to write "yyterminate();" - | ||
957 | * we don't want an extra ';' after the "return" because that will cause | ||
958 | * some compilers to complain about unreachable statements. | ||
959 | */ | ||
960 | #ifndef yyterminate | ||
961 | #define yyterminate() return YY_NULL | ||
962 | #endif | ||
963 | |||
964 | /* Number of entries by which start-condition stack grows. */ | ||
965 | #ifndef YY_START_STACK_INCR | ||
966 | #define YY_START_STACK_INCR 25 | ||
967 | #endif | ||
968 | |||
969 | /* Report a fatal error. */ | ||
970 | #ifndef YY_FATAL_ERROR | ||
971 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) | ||
972 | #endif | ||
973 | |||
974 | /* end tables serialization structures and prototypes */ | ||
975 | |||
976 | /* Default declaration of generated scanner - a define so the user can | ||
977 | * easily add parameters. | ||
978 | */ | ||
979 | #ifndef YY_DECL | ||
980 | #define YY_DECL_IS_OURS 1 | ||
981 | |||
982 | extern int vrml_v1_yylex (yyscan_t yyscanner); | ||
983 | |||
984 | #define YY_DECL int vrml_v1_yylex (yyscan_t yyscanner) | ||
985 | #endif /* !YY_DECL */ | ||
986 | |||
987 | /* Code executed at the beginning of each rule, after yytext and yyleng | ||
988 | * have been set up. | ||
989 | */ | ||
990 | #ifndef YY_USER_ACTION | ||
991 | #define YY_USER_ACTION | ||
992 | #endif | ||
993 | |||
994 | /* Code executed at the end of each rule. */ | ||
995 | #ifndef YY_BREAK | ||
996 | #define YY_BREAK break; | ||
997 | #endif | ||
998 | |||
999 | #define YY_RULE_SETUP \ | ||
1000 | if ( yyleng > 0 ) \ | ||
1001 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ | ||
1002 | (yytext[yyleng - 1] == '\n'); \ | ||
1003 | YY_USER_ACTION | ||
1004 | |||
1005 | /** The main scanner function which does all the work. | ||
1006 | */ | ||
1007 | YY_DECL | ||
1008 | { | ||
1009 | register yy_state_type yy_current_state; | ||
1010 | register char *yy_cp, *yy_bp; | ||
1011 | register int yy_act; | ||
1012 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
1013 | |||
1014 | #line 86 "imp_vrml_v1.l" | ||
1015 | |||
1016 | G3DObject *object = NULL; | ||
1017 | G3DFace *face; | ||
1018 | G3DMaterial *material = NULL; | ||
1019 | guint32 level = 0, off, otype = 0, sep_level = 0; | ||
1020 | guint32 ohasmtrx = 0; | ||
1021 | guint32 faceidx = 0, faceidxbuf[128]; | ||
1022 | guint32 matidx = 0; | ||
1023 | gint32 tmps32, i; | ||
1024 | G3DFloat matrix[16]; | ||
1025 | |||
1026 | #line 1027 "imp_vrml_v1.c" | ||
1027 | |||
1028 | if ( !yyg->yy_init ) | ||
1029 | { | ||
1030 | yyg->yy_init = 1; | ||
1031 | |||
1032 | #ifdef YY_USER_INIT | ||
1033 | YY_USER_INIT; | ||
1034 | #endif | ||
1035 | |||
1036 | /* Create the reject buffer large enough to save one state per allowed character. */ | ||
1037 | if ( ! yyg->yy_state_buf ) | ||
1038 | yyg->yy_state_buf = (yy_state_type *)vrml_v1_yyalloc(YY_STATE_BUF_SIZE ,yyscanner); | ||
1039 | if ( ! yyg->yy_state_buf ) | ||
1040 | YY_FATAL_ERROR( "out of dynamic memory in vrml_v1_yylex()" ); | ||
1041 | |||
1042 | if ( ! yyg->yy_start ) | ||
1043 | yyg->yy_start = 1; /* first start state */ | ||
1044 | |||
1045 | if ( ! yyin ) | ||
1046 | yyin = stdin; | ||
1047 | |||
1048 | if ( ! yyout ) | ||
1049 | yyout = stdout; | ||
1050 | |||
1051 | if ( ! YY_CURRENT_BUFFER ) { | ||
1052 | vrml_v1_yyensure_buffer_stack (yyscanner); | ||
1053 | YY_CURRENT_BUFFER_LVALUE = | ||
1054 | vrml_v1_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); | ||
1055 | } | ||
1056 | |||
1057 | vrml_v1_yy_load_buffer_state(yyscanner ); | ||
1058 | } | ||
1059 | |||
1060 | while ( 1 ) /* loops until end-of-file is reached */ | ||
1061 | { | ||
1062 | yy_cp = yyg->yy_c_buf_p; | ||
1063 | |||
1064 | /* Support of yytext. */ | ||
1065 | *yy_cp = yyg->yy_hold_char; | ||
1066 | |||
1067 | /* yy_bp points to the position in yy_ch_buf of the start of | ||
1068 | * the current run. | ||
1069 | */ | ||
1070 | yy_bp = yy_cp; | ||
1071 | |||
1072 | yy_current_state = yyg->yy_start; | ||
1073 | yy_current_state += YY_AT_BOL(); | ||
1074 | |||
1075 | yyg->yy_state_ptr = yyg->yy_state_buf; | ||
1076 | *yyg->yy_state_ptr++ = yy_current_state; | ||
1077 | |||
1078 | yy_match: | ||
1079 | do | ||
1080 | { | ||
1081 | register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; | ||
1082 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | ||
1083 | { | ||
1084 | yy_current_state = (int) yy_def[yy_current_state]; | ||
1085 | if ( yy_current_state >= 275 ) | ||
1086 | yy_c = yy_meta[(unsigned int) yy_c]; | ||
1087 | } | ||
1088 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | ||
1089 | *yyg->yy_state_ptr++ = yy_current_state; | ||
1090 | ++yy_cp; | ||
1091 | } | ||
1092 | while ( yy_base[yy_current_state] != 620 ); | ||
1093 | |||
1094 | yy_find_action: | ||
1095 | yy_current_state = *--yyg->yy_state_ptr; | ||
1096 | yyg->yy_lp = yy_accept[yy_current_state]; | ||
1097 | find_rule: /* we branch to this label when backing up */ | ||
1098 | for ( ; ; ) /* until we find what rule we matched */ | ||
1099 | { | ||
1100 | if ( yyg->yy_lp && yyg->yy_lp < yy_accept[yy_current_state + 1] ) | ||
1101 | { | ||
1102 | yy_act = yy_acclist[yyg->yy_lp]; | ||
1103 | if ( yy_act & YY_TRAILING_HEAD_MASK || | ||
1104 | yyg->yy_looking_for_trail_begin ) | ||
1105 | { | ||
1106 | if ( yy_act == yyg->yy_looking_for_trail_begin ) | ||
1107 | { | ||
1108 | yyg->yy_looking_for_trail_begin = 0; | ||
1109 | yy_act &= ~YY_TRAILING_HEAD_MASK; | ||
1110 | break; | ||
1111 | } | ||
1112 | } | ||
1113 | else if ( yy_act & YY_TRAILING_MASK ) | ||
1114 | { | ||
1115 | yyg->yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK; | ||
1116 | yyg->yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK; | ||
1117 | } | ||
1118 | else | ||
1119 | { | ||
1120 | yyg->yy_full_match = yy_cp; | ||
1121 | yyg->yy_full_state = yyg->yy_state_ptr; | ||
1122 | yyg->yy_full_lp = yyg->yy_lp; | ||
1123 | break; | ||
1124 | } | ||
1125 | ++yyg->yy_lp; | ||
1126 | goto find_rule; | ||
1127 | } | ||
1128 | --yy_cp; | ||
1129 | yy_current_state = *--yyg->yy_state_ptr; | ||
1130 | yyg->yy_lp = yy_accept[yy_current_state]; | ||
1131 | } | ||
1132 | |||
1133 | YY_DO_BEFORE_ACTION; | ||
1134 | |||
1135 | do_action: /* This label is used only to access EOF actions. */ | ||
1136 | |||
1137 | switch ( yy_act ) | ||
1138 | { /* beginning of action switch */ | ||
1139 | case 1: | ||
1140 | YY_RULE_SETUP | ||
1141 | #line 97 "imp_vrml_v1.l" | ||
1142 | { | ||
1143 | BEGIN COMMENT; | ||
1144 | } | ||
1145 | YY_BREAK | ||
1146 | case 2: | ||
1147 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ | ||
1148 | yyg->yy_c_buf_p = yy_cp = yy_bp + 5; | ||
1149 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | ||
1150 | YY_RULE_SETUP | ||
1151 | #line 101 "imp_vrml_v1.l" | ||
1152 | { | ||
1153 | /* magic header */ | ||
1154 | #if DEBUG > 0 | ||
1155 | g_debug("VRML: got header"); | ||
1156 | #endif | ||
1157 | BEGIN VRMLHEADER; | ||
1158 | } | ||
1159 | YY_BREAK | ||
1160 | case 3: | ||
1161 | YY_RULE_SETUP | ||
1162 | #line 109 "imp_vrml_v1.l" | ||
1163 | { | ||
1164 | #if DEBUG > 0 | ||
1165 | g_debug("VRML: version %s", yytext + 1); | ||
1166 | #endif | ||
1167 | } | ||
1168 | YY_BREAK | ||
1169 | case 4: | ||
1170 | YY_RULE_SETUP | ||
1171 | #line 115 "imp_vrml_v1.l" | ||
1172 | /* */ | ||
1173 | YY_BREAK | ||
1174 | case 5: | ||
1175 | /* rule 5 can match eol */ | ||
1176 | YY_RULE_SETUP | ||
1177 | #line 117 "imp_vrml_v1.l" | ||
1178 | { | ||
1179 | BEGIN INITIAL; | ||
1180 | } | ||
1181 | YY_BREAK | ||
1182 | case 6: | ||
1183 | YY_RULE_SETUP | ||
1184 | #line 121 "imp_vrml_v1.l" | ||
1185 | { | ||
1186 | #if DEBUG > 0 | ||
1187 | g_debug("COMMENT: %s", yytext); | ||
1188 | #endif | ||
1189 | } | ||
1190 | YY_BREAK | ||
1191 | case 7: | ||
1192 | /* rule 7 can match eol */ | ||
1193 | YY_RULE_SETUP | ||
1194 | #line 127 "imp_vrml_v1.l" | ||
1195 | { | ||
1196 | BEGIN INITIAL; | ||
1197 | } | ||
1198 | YY_BREAK | ||
1199 | case 8: | ||
1200 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ | ||
1201 | yyg->yy_c_buf_p = yy_cp = yy_bp + 9; | ||
1202 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | ||
1203 | YY_RULE_SETUP | ||
1204 | #line 131 "imp_vrml_v1.l" | ||
1205 | { | ||
1206 | vrml_dump_hier(level, "Separator"); | ||
1207 | if((object == NULL) || (object->vertex_count == 0)) | ||
1208 | { | ||
1209 | object = g_new0(G3DObject, 1); | ||
1210 | ((G3DModel *)yyextra)->objects = g_slist_append( | ||
1211 | ((G3DModel *)yyextra)->objects, object); | ||
1212 | sep_level = level; | ||
1213 | ohasmtrx = 0; | ||
1214 | } | ||
1215 | } | ||
1216 | YY_BREAK | ||
1217 | case 9: | ||
1218 | /* rule 9 can match eol */ | ||
1219 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ | ||
1220 | yyg->yy_c_buf_p = yy_cp = yy_bp + 5; | ||
1221 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | ||
1222 | YY_RULE_SETUP | ||
1223 | #line 143 "imp_vrml_v1.l" | ||
1224 | { | ||
1225 | vrml_dump_hier(level, "Group"); | ||
1226 | } | ||
1227 | YY_BREAK | ||
1228 | case 10: | ||
1229 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ | ||
1230 | yyg->yy_c_buf_p = yy_cp = yy_bp + 8; | ||
1231 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | ||
1232 | YY_RULE_SETUP | ||
1233 | #line 147 "imp_vrml_v1.l" | ||
1234 | { | ||
1235 | vrml_dump_hier(level, "Material"); | ||
1236 | if(object) | ||
1237 | { | ||
1238 | material = g3d_material_new(); | ||
1239 | material->name = g_strdup("object material"); | ||
1240 | object->materials = g_slist_append(object->materials, material); | ||
1241 | } | ||
1242 | otype = VRML_OTYPE_MAT; | ||
1243 | } | ||
1244 | YY_BREAK | ||
1245 | case 11: | ||
1246 | /* rule 11 can match eol */ | ||
1247 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ | ||
1248 | yyg->yy_c_buf_p = yy_cp = yy_bp + 15; | ||
1249 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | ||
1250 | YY_RULE_SETUP | ||
1251 | #line 158 "imp_vrml_v1.l" | ||
1252 | { | ||
1253 | vrml_dump_hier(level, "MatrixTransform"); | ||
1254 | otype = VRML_OTYPE_MTRANS; | ||
1255 | } | ||
1256 | YY_BREAK | ||
1257 | case 12: | ||
1258 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ | ||
1259 | yyg->yy_c_buf_p = yy_cp = yy_bp + 11; | ||
1260 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | ||
1261 | YY_RULE_SETUP | ||
1262 | #line 163 "imp_vrml_v1.l" | ||
1263 | { | ||
1264 | vrml_dump_hier(level, "Coordinate3"); | ||
1265 | if(!object) | ||
1266 | { | ||
1267 | object = g_new0(G3DObject, 1); | ||
1268 | object->name = g_strdup("VRML 1 object"); | ||
1269 | ((G3DModel *)yyextra)->objects = g_slist_append( | ||
1270 | ((G3DModel *)yyextra)->objects, object); | ||
1271 | ohasmtrx = 0; | ||
1272 | } | ||
1273 | otype = VRML_OTYPE_COORD3; | ||
1274 | } | ||
1275 | YY_BREAK | ||
1276 | case 13: | ||
1277 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ | ||
1278 | yyg->yy_c_buf_p = yy_cp = yy_bp + 14; | ||
1279 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | ||
1280 | YY_RULE_SETUP | ||
1281 | #line 176 "imp_vrml_v1.l" | ||
1282 | { | ||
1283 | vrml_dump_hier(level, "IndexedFaceSet"); | ||
1284 | otype = VRML_OTYPE_IDXFACESET; | ||
1285 | } | ||
1286 | YY_BREAK | ||
1287 | case 14: | ||
1288 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ | ||
1289 | yyg->yy_c_buf_p = yy_cp -= 1; | ||
1290 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | ||
1291 | YY_RULE_SETUP | ||
1292 | #line 181 "imp_vrml_v1.l" | ||
1293 | { | ||
1294 | #if DEBUG > 3 | ||
1295 | g_debug("# (0x%04x) %s", otype, yytext); | ||
1296 | #endif | ||
1297 | if((otype & 0xFF00) == VRML_OTYPE_MAT) | ||
1298 | { | ||
1299 | if(object == NULL) continue; | ||
1300 | material = g_slist_nth_data(object->materials, matidx); | ||
1301 | if(material == NULL) | ||
1302 | { | ||
1303 | material = g3d_material_new(); | ||
1304 | material->name = g_strdup_printf("material #%d", matidx); | ||
1305 | object->materials = g_slist_append(object->materials, material); | ||
1306 | } | ||
1307 | matidx ++; | ||
1308 | switch(otype) | ||
1309 | { | ||
1310 | case VRML_OTYPE_MAT_DIFFUSECOLOR: | ||
1311 | if(sscanf(yytext, "%f%f%f", | ||
1312 | &(material->r), &(material->g), &(material->b)) != 3) | ||
1313 | { | ||
1314 | #if DEBUG > 0 | ||
1315 | g_debug("VRML1: failed to get ambient color"); | ||
1316 | #endif | ||
1317 | } | ||
1318 | break; | ||
1319 | |||
1320 | default: | ||
1321 | #if DEBUG > 0 | ||
1322 | g_debug("VRML: unhandled material property: 0x%02x (%s)", | ||
1323 | otype, yytext); | ||
1324 | #endif | ||
1325 | break; | ||
1326 | } | ||
1327 | } | ||
1328 | else if(otype == VRML_OTYPE_COORD3_POINT) | ||
1329 | { | ||
1330 | off = object->vertex_count; | ||
1331 | object->vertex_count ++; | ||
1332 | object->vertex_data = g_realloc(object->vertex_data, | ||
1333 | object->vertex_count * 3 * sizeof(G3DFloat)); | ||
1334 | |||
1335 | #if DEBUG > 3 | ||
1336 | g_debug("VRML: object vertex count: %d", object->vertex_count); | ||
1337 | #endif | ||
1338 | |||
1339 | if(sscanf(yytext, "%f%f%f", | ||
1340 | &(object->vertex_data[off * 3 + 0]), | ||
1341 | &(object->vertex_data[off * 3 + 1]), | ||
1342 | &(object->vertex_data[off * 3 + 2])) != 3) | ||
1343 | { | ||
1344 | g_warning("VRML: failed to read vertex (%s)\n", yytext); | ||
1345 | } | ||
1346 | else | ||
1347 | { | ||
1348 | #if DEBUG > 3 | ||
1349 | if((object->vertex_data[off * 3 + 0] == 0.0) || | ||
1350 | (object->vertex_data[off * 3 + 1] == 0.0) || | ||
1351 | (object->vertex_data[off * 3 + 2] == 0.0)) | ||
1352 | { | ||
1353 | g_debug("VRML1: 0.0: %+2.2f %+2.2f %+2.2f (%s)", | ||
1354 | object->vertex_data[off * 3 + 0], | ||
1355 | object->vertex_data[off * 3 + 1], | ||
1356 | object->vertex_data[off * 3 + 2], | ||
1357 | yytext); | ||
1358 | } | ||
1359 | #endif | ||
1360 | if(ohasmtrx) | ||
1361 | g3d_vector_transform( | ||
1362 | &(object->vertex_data[off * 3 + 0]), | ||
1363 | &(object->vertex_data[off * 3 + 1]), | ||
1364 | &(object->vertex_data[off * 3 + 2]), | ||
1365 | matrix); | ||
1366 | } | ||
1367 | } | ||
1368 | else if(otype == VRML_OTYPE_IDXFACESET_COORDIDX) | ||
1369 | { | ||
1370 | sscanf(yytext, "%i", &tmps32); | ||
1371 | if(tmps32 == -1) | ||
1372 | { | ||
1373 | if(object == NULL) continue; | ||
1374 | |||
1375 | face = g_new0(G3DFace, 1); | ||
1376 | face->material = material; | ||
1377 | if(face->material == NULL) | ||
1378 | face->material = g_slist_nth_data( | ||
1379 | object->materials, 0); | ||
1380 | if(face->material == NULL) | ||
1381 | face->material = g_slist_nth_data( | ||
1382 | ((G3DModel *)yyextra)->materials, 0); | ||
1383 | face->vertex_count = faceidx; | ||
1384 | face->vertex_indices = g_new0(guint32, face->vertex_count); | ||
1385 | for(i = 0; i < face->vertex_count; i ++) | ||
1386 | { | ||
1387 | if(faceidxbuf[i] >= object->vertex_count) | ||
1388 | { | ||
1389 | g_debug("VRML: Face: index %d >= vertex count (%d)", | ||
1390 | faceidxbuf[i], object->vertex_count); | ||
1391 | } | ||
1392 | else | ||
1393 | { | ||
1394 | face->vertex_indices[i] = faceidxbuf[i]; | ||
1395 | } | ||
1396 | } | ||
1397 | |||
1398 | if(face->vertex_count >= 3) | ||
1399 | object->faces = g_slist_prepend(object->faces, face); | ||
1400 | faceidx = 0; | ||
1401 | } | ||
1402 | else | ||
1403 | { | ||
1404 | #if DEBUG > 3 | ||
1405 | if(tmps32 == 0) | ||
1406 | g_debug("VRML1: faceidx 0: %s", yytext); | ||
1407 | #endif | ||
1408 | faceidxbuf[faceidx] = tmps32; | ||
1409 | faceidx ++; | ||
1410 | } | ||
1411 | } | ||
1412 | else if(otype == VRML_OTYPE_IDXFACESET_MATIDX) | ||
1413 | { | ||
1414 | i = atoi(yytext); | ||
1415 | #if DEBUG > 3 | ||
1416 | g_debug("VRML1: looking for object material #%d", i); | ||
1417 | #endif | ||
1418 | material = g_slist_nth_data(object->materials, i); | ||
1419 | if(material) | ||
1420 | { | ||
1421 | #if DEBUG > 3 | ||
1422 | g_debug("VRML1: got material to update"); | ||
1423 | #endif | ||
1424 | face = g_slist_nth_data(object->faces, faceidx); | ||
1425 | if(face) | ||
1426 | { | ||
1427 | face->material = material; | ||
1428 | #if DEBUG > 1 | ||
1429 | g_debug("VRML1: updating material of face #%d", faceidx); | ||
1430 | #endif | ||
1431 | } | ||
1432 | } | ||
1433 | faceidx ++; | ||
1434 | } | ||
1435 | } | ||
1436 | YY_BREAK | ||
1437 | case 15: | ||
1438 | /* rule 15 can match eol */ | ||
1439 | YY_RULE_SETUP | ||
1440 | #line 325 "imp_vrml_v1.l" | ||
1441 | { | ||
1442 | if(otype == VRML_OTYPE_MTRANS_MATRIX) | ||
1443 | { | ||
1444 | if(sscanf(yytext, "%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f", | ||
1445 | &matrix[0 * 4 + 0], | ||
1446 | &matrix[0 * 4 + 1], | ||
1447 | &matrix[0 * 4 + 2], | ||
1448 | &matrix[0 * 4 + 3], | ||
1449 | |||
1450 | &matrix[1 * 4 + 0], | ||
1451 | &matrix[1 * 4 + 1], | ||
1452 | &matrix[1 * 4 + 2], | ||
1453 | &matrix[1 * 4 + 3], | ||
1454 | |||
1455 | &matrix[2 * 4 + 0], | ||
1456 | &matrix[2 * 4 + 1], | ||
1457 | &matrix[2 * 4 + 2], | ||
1458 | &matrix[2 * 4 + 3], | ||
1459 | |||
1460 | &matrix[3 * 4 + 0], | ||
1461 | &matrix[3 * 4 + 1], | ||
1462 | &matrix[3 * 4 + 2], | ||
1463 | &matrix[3 * 4 + 3]) != 16) | ||
1464 | { | ||
1465 | g_warning("VRML: failed to read matrix line (%s)", yytext); | ||
1466 | } | ||
1467 | } | ||
1468 | } | ||
1469 | YY_BREAK | ||
1470 | case 16: | ||
1471 | /* rule 16 can match eol */ | ||
1472 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ | ||
1473 | yyg->yy_c_buf_p = yy_cp = yy_bp + 12; | ||
1474 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | ||
1475 | YY_RULE_SETUP | ||
1476 | #line 354 "imp_vrml_v1.l" | ||
1477 | { | ||
1478 | otype = VRML_OTYPE_MAT_AMBIENTCOLOR; | ||
1479 | } | ||
1480 | YY_BREAK | ||
1481 | case 17: | ||
1482 | /* rule 17 can match eol */ | ||
1483 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ | ||
1484 | yyg->yy_c_buf_p = yy_cp = yy_bp + 12; | ||
1485 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | ||
1486 | YY_RULE_SETUP | ||
1487 | #line 358 "imp_vrml_v1.l" | ||
1488 | { | ||
1489 | otype = VRML_OTYPE_MAT_DIFFUSECOLOR; | ||
1490 | } | ||
1491 | YY_BREAK | ||
1492 | case 18: | ||
1493 | /* rule 18 can match eol */ | ||
1494 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ | ||
1495 | yyg->yy_c_buf_p = yy_cp = yy_bp + 13; | ||
1496 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | ||
1497 | YY_RULE_SETUP | ||
1498 | #line 362 "imp_vrml_v1.l" | ||
1499 | { | ||
1500 | otype = VRML_OTYPE_MAT_SPECULARCOLOR; | ||
1501 | } | ||
1502 | YY_BREAK | ||
1503 | case 19: | ||
1504 | /* rule 19 can match eol */ | ||
1505 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ | ||
1506 | yyg->yy_c_buf_p = yy_cp = yy_bp + 13; | ||
1507 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | ||
1508 | YY_RULE_SETUP | ||
1509 | #line 366 "imp_vrml_v1.l" | ||
1510 | { | ||
1511 | otype = VRML_OTYPE_MAT_EMISSIVECOLOR; | ||
1512 | } | ||
1513 | YY_BREAK | ||
1514 | case 20: | ||
1515 | /* rule 20 can match eol */ | ||
1516 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ | ||
1517 | yyg->yy_c_buf_p = yy_cp = yy_bp + 9; | ||
1518 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | ||
1519 | YY_RULE_SETUP | ||
1520 | #line 370 "imp_vrml_v1.l" | ||
1521 | { | ||
1522 | otype = VRML_OTYPE_MAT_SHININESS; | ||
1523 | } | ||
1524 | YY_BREAK | ||
1525 | case 21: | ||
1526 | /* rule 21 can match eol */ | ||
1527 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ | ||
1528 | yyg->yy_c_buf_p = yy_cp = yy_bp + 12; | ||
1529 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | ||
1530 | YY_RULE_SETUP | ||
1531 | #line 374 "imp_vrml_v1.l" | ||
1532 | { | ||
1533 | otype = VRML_OTYPE_MAT_TRANSPARENCY; | ||
1534 | } | ||
1535 | YY_BREAK | ||
1536 | case 22: | ||
1537 | /* rule 22 can match eol */ | ||
1538 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ | ||
1539 | yyg->yy_c_buf_p = yy_cp = yy_bp + 5; | ||
1540 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | ||
1541 | YY_RULE_SETUP | ||
1542 | #line 378 "imp_vrml_v1.l" | ||
1543 | { | ||
1544 | otype = VRML_OTYPE_COORD3_POINT; | ||
1545 | } | ||
1546 | YY_BREAK | ||
1547 | case 23: | ||
1548 | /* rule 23 can match eol */ | ||
1549 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ | ||
1550 | yyg->yy_c_buf_p = yy_cp = yy_bp + 10; | ||
1551 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | ||
1552 | YY_RULE_SETUP | ||
1553 | #line 382 "imp_vrml_v1.l" | ||
1554 | { | ||
1555 | if(otype == VRML_OTYPE_IDXFACESET) | ||
1556 | otype = VRML_OTYPE_IDXFACESET_COORDIDX; | ||
1557 | } | ||
1558 | YY_BREAK | ||
1559 | case 24: | ||
1560 | /* rule 24 can match eol */ | ||
1561 | *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ | ||
1562 | yyg->yy_c_buf_p = yy_cp = yy_bp + 13; | ||
1563 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | ||
1564 | YY_RULE_SETUP | ||
1565 | #line 387 "imp_vrml_v1.l" | ||
1566 | { | ||
1567 | #if DEBUG > 0 | ||
1568 | g_debug("VRML1: materialIndex"); | ||
1569 | #endif | ||
1570 | /*if(otype == VRML_OTYPE_IDXFACESET)*/ | ||
1571 | otype = VRML_OTYPE_IDXFACESET_MATIDX; | ||
1572 | } | ||
1573 | YY_BREAK | ||
1574 | case 25: | ||
1575 | YY_RULE_SETUP | ||
1576 | #line 395 "imp_vrml_v1.l" | ||
1577 | { | ||
1578 | if(otype == VRML_OTYPE_MTRANS) | ||
1579 | { | ||
1580 | otype = VRML_OTYPE_MTRANS_MATRIX; | ||
1581 | ohasmtrx = 1; | ||
1582 | } | ||
1583 | } | ||
1584 | YY_BREAK | ||
1585 | case 26: | ||
1586 | YY_RULE_SETUP | ||
1587 | #line 403 "imp_vrml_v1.l" | ||
1588 | { | ||
1589 | /* set to parent object */ | ||
1590 | otype &= 0xFF00; | ||
1591 | matidx = 0; | ||
1592 | faceidx = 0; | ||
1593 | } | ||
1594 | YY_BREAK | ||
1595 | case 27: | ||
1596 | YY_RULE_SETUP | ||
1597 | #line 410 "imp_vrml_v1.l" | ||
1598 | { | ||
1599 | vrml_dump_hier(level, yytext); | ||
1600 | } | ||
1601 | YY_BREAK | ||
1602 | case 28: | ||
1603 | YY_RULE_SETUP | ||
1604 | #line 414 "imp_vrml_v1.l" | ||
1605 | { | ||
1606 | level ++; | ||
1607 | } | ||
1608 | YY_BREAK | ||
1609 | case 29: | ||
1610 | YY_RULE_SETUP | ||
1611 | #line 418 "imp_vrml_v1.l" | ||
1612 | { | ||
1613 | #if DEBUG > 3 | ||
1614 | g_debug("}"); | ||
1615 | #endif | ||
1616 | level --; | ||
1617 | |||
1618 | if(material) | ||
1619 | material = NULL; | ||
1620 | |||
1621 | if(object && (sep_level == level)) | ||
1622 | { | ||
1623 | object = NULL; | ||
1624 | } | ||
1625 | |||
1626 | /* reset object type */ | ||
1627 | otype = 0x0000; | ||
1628 | } | ||
1629 | YY_BREAK | ||
1630 | case 30: | ||
1631 | YY_RULE_SETUP | ||
1632 | #line 436 "imp_vrml_v1.l" | ||
1633 | /* */ | ||
1634 | YY_BREAK | ||
1635 | case 31: | ||
1636 | /* rule 31 can match eol */ | ||
1637 | YY_RULE_SETUP | ||
1638 | #line 437 "imp_vrml_v1.l" | ||
1639 | /* */ | ||
1640 | YY_BREAK | ||
1641 | case YY_STATE_EOF(INITIAL): | ||
1642 | case YY_STATE_EOF(VRMLHEADER): | ||
1643 | case YY_STATE_EOF(COMMENT): | ||
1644 | #line 439 "imp_vrml_v1.l" | ||
1645 | { | ||
1646 | yyterminate(); | ||
1647 | } | ||
1648 | YY_BREAK | ||
1649 | case 32: | ||
1650 | YY_RULE_SETUP | ||
1651 | #line 443 "imp_vrml_v1.l" | ||
1652 | YY_FATAL_ERROR( "flex scanner jammed" ); | ||
1653 | YY_BREAK | ||
1654 | #line 1655 "imp_vrml_v1.c" | ||
1655 | |||
1656 | case YY_END_OF_BUFFER: | ||
1657 | { | ||
1658 | /* Amount of text matched not including the EOB char. */ | ||
1659 | int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; | ||
1660 | |||
1661 | /* Undo the effects of YY_DO_BEFORE_ACTION. */ | ||
1662 | *yy_cp = yyg->yy_hold_char; | ||
1663 | YY_RESTORE_YY_MORE_OFFSET | ||
1664 | |||
1665 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) | ||
1666 | { | ||
1667 | /* We're scanning a new file or input source. It's | ||
1668 | * possible that this happened because the user | ||
1669 | * just pointed yyin at a new source and called | ||
1670 | * vrml_v1_yylex(). If so, then we have to assure | ||
1671 | * consistency between YY_CURRENT_BUFFER and our | ||
1672 | * globals. Here is the right place to do so, because | ||
1673 | * this is the first action (other than possibly a | ||
1674 | * back-up) that will match for the new input source. | ||
1675 | */ | ||
1676 | yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; | ||
1677 | YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; | ||
1678 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; | ||
1679 | } | ||
1680 | |||
1681 | /* Note that here we test for yy_c_buf_p "<=" to the position | ||
1682 | * of the first EOB in the buffer, since yy_c_buf_p will | ||
1683 | * already have been incremented past the NUL character | ||
1684 | * (since all states make transitions on EOB to the | ||
1685 | * end-of-buffer state). Contrast this with the test | ||
1686 | * in input(). | ||
1687 | */ | ||
1688 | if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) | ||
1689 | { /* This was really a NUL. */ | ||
1690 | yy_state_type yy_next_state; | ||
1691 | |||
1692 | yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; | ||
1693 | |||
1694 | yy_current_state = yy_get_previous_state( yyscanner ); | ||
1695 | |||
1696 | /* Okay, we're now positioned to make the NUL | ||
1697 | * transition. We couldn't have | ||
1698 | * yy_get_previous_state() go ahead and do it | ||
1699 | * for us because it doesn't know how to deal | ||
1700 | * with the possibility of jamming (and we don't | ||
1701 | * want to build jamming into it because then it | ||
1702 | * will run more slowly). | ||
1703 | */ | ||
1704 | |||
1705 | yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); | ||
1706 | |||
1707 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; | ||
1708 | |||
1709 | if ( yy_next_state ) | ||
1710 | { | ||
1711 | /* Consume the NUL. */ | ||
1712 | yy_cp = ++yyg->yy_c_buf_p; | ||
1713 | yy_current_state = yy_next_state; | ||
1714 | goto yy_match; | ||
1715 | } | ||
1716 | |||
1717 | else | ||
1718 | { | ||
1719 | yy_cp = yyg->yy_c_buf_p; | ||
1720 | goto yy_find_action; | ||
1721 | } | ||
1722 | } | ||
1723 | |||
1724 | else switch ( yy_get_next_buffer( yyscanner ) ) | ||
1725 | { | ||
1726 | case EOB_ACT_END_OF_FILE: | ||
1727 | { | ||
1728 | yyg->yy_did_buffer_switch_on_eof = 0; | ||
1729 | |||
1730 | if ( vrml_v1_yywrap(yyscanner ) ) | ||
1731 | { | ||
1732 | /* Note: because we've taken care in | ||
1733 | * yy_get_next_buffer() to have set up | ||
1734 | * yytext, we can now set up | ||
1735 | * yy_c_buf_p so that if some total | ||
1736 | * hoser (like flex itself) wants to | ||
1737 | * call the scanner after we return the | ||
1738 | * YY_NULL, it'll still work - another | ||
1739 | * YY_NULL will get returned. | ||
1740 | */ | ||
1741 | yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; | ||
1742 | |||
1743 | yy_act = YY_STATE_EOF(YY_START); | ||
1744 | goto do_action; | ||
1745 | } | ||
1746 | |||
1747 | else | ||
1748 | { | ||
1749 | if ( ! yyg->yy_did_buffer_switch_on_eof ) | ||
1750 | YY_NEW_FILE; | ||
1751 | } | ||
1752 | break; | ||
1753 | } | ||
1754 | |||
1755 | case EOB_ACT_CONTINUE_SCAN: | ||
1756 | yyg->yy_c_buf_p = | ||
1757 | yyg->yytext_ptr + yy_amount_of_matched_text; | ||
1758 | |||
1759 | yy_current_state = yy_get_previous_state( yyscanner ); | ||
1760 | |||
1761 | yy_cp = yyg->yy_c_buf_p; | ||
1762 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; | ||
1763 | goto yy_match; | ||
1764 | |||
1765 | case EOB_ACT_LAST_MATCH: | ||
1766 | yyg->yy_c_buf_p = | ||
1767 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; | ||
1768 | |||
1769 | yy_current_state = yy_get_previous_state( yyscanner ); | ||
1770 | |||
1771 | yy_cp = yyg->yy_c_buf_p; | ||
1772 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; | ||
1773 | goto yy_find_action; | ||
1774 | } | ||
1775 | break; | ||
1776 | } | ||
1777 | |||
1778 | default: | ||
1779 | YY_FATAL_ERROR( | ||
1780 | "fatal flex scanner internal error--no action found" ); | ||
1781 | } /* end of action switch */ | ||
1782 | } /* end of scanning one token */ | ||
1783 | } /* end of vrml_v1_yylex */ | ||
1784 | |||
1785 | /* yy_get_next_buffer - try to read in a new buffer | ||
1786 | * | ||
1787 | * Returns a code representing an action: | ||
1788 | * EOB_ACT_LAST_MATCH - | ||
1789 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position | ||
1790 | * EOB_ACT_END_OF_FILE - end of file | ||
1791 | */ | ||
1792 | static int yy_get_next_buffer (yyscan_t yyscanner) | ||
1793 | { | ||
1794 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
1795 | register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; | ||
1796 | register char *source = yyg->yytext_ptr; | ||
1797 | register int number_to_move, i; | ||
1798 | int ret_val; | ||
1799 | |||
1800 | if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) | ||
1801 | YY_FATAL_ERROR( | ||
1802 | "fatal flex scanner internal error--end of buffer missed" ); | ||
1803 | |||
1804 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) | ||
1805 | { /* Don't try to fill the buffer, so this is an EOF. */ | ||
1806 | if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) | ||
1807 | { | ||
1808 | /* We matched a single character, the EOB, so | ||
1809 | * treat this as a final EOF. | ||
1810 | */ | ||
1811 | return EOB_ACT_END_OF_FILE; | ||
1812 | } | ||
1813 | |||
1814 | else | ||
1815 | { | ||
1816 | /* We matched some text prior to the EOB, first | ||
1817 | * process it. | ||
1818 | */ | ||
1819 | return EOB_ACT_LAST_MATCH; | ||
1820 | } | ||
1821 | } | ||
1822 | |||
1823 | /* Try to read more data. */ | ||
1824 | |||
1825 | /* First move last chars to start of buffer. */ | ||
1826 | number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; | ||
1827 | |||
1828 | for ( i = 0; i < number_to_move; ++i ) | ||
1829 | *(dest++) = *(source++); | ||
1830 | |||
1831 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) | ||
1832 | /* don't do the read, it's not guaranteed to return an EOF, | ||
1833 | * just force an EOF | ||
1834 | */ | ||
1835 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; | ||
1836 | |||
1837 | else | ||
1838 | { | ||
1839 | int num_to_read = | ||
1840 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; | ||
1841 | |||
1842 | while ( num_to_read <= 0 ) | ||
1843 | { /* Not enough room in the buffer - grow it. */ | ||
1844 | |||
1845 | YY_FATAL_ERROR( | ||
1846 | "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); | ||
1847 | |||
1848 | } | ||
1849 | |||
1850 | if ( num_to_read > YY_READ_BUF_SIZE ) | ||
1851 | num_to_read = YY_READ_BUF_SIZE; | ||
1852 | |||
1853 | /* Read in more data. */ | ||
1854 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), | ||
1855 | yyg->yy_n_chars, (size_t) num_to_read ); | ||
1856 | |||
1857 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; | ||
1858 | } | ||
1859 | |||
1860 | if ( yyg->yy_n_chars == 0 ) | ||
1861 | { | ||
1862 | if ( number_to_move == YY_MORE_ADJ ) | ||
1863 | { | ||
1864 | ret_val = EOB_ACT_END_OF_FILE; | ||
1865 | vrml_v1_yyrestart(yyin ,yyscanner); | ||
1866 | } | ||
1867 | |||
1868 | else | ||
1869 | { | ||
1870 | ret_val = EOB_ACT_LAST_MATCH; | ||
1871 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = | ||
1872 | YY_BUFFER_EOF_PENDING; | ||
1873 | } | ||
1874 | } | ||
1875 | |||
1876 | else | ||
1877 | ret_val = EOB_ACT_CONTINUE_SCAN; | ||
1878 | |||
1879 | if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { | ||
1880 | /* Extend the array by 50%, plus the number we really need. */ | ||
1881 | yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); | ||
1882 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) vrml_v1_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); | ||
1883 | if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) | ||
1884 | YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); | ||
1885 | } | ||
1886 | |||
1887 | yyg->yy_n_chars += number_to_move; | ||
1888 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; | ||
1889 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; | ||
1890 | |||
1891 | yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; | ||
1892 | |||
1893 | return ret_val; | ||
1894 | } | ||
1895 | |||
1896 | /* yy_get_previous_state - get the state just before the EOB char was reached */ | ||
1897 | |||
1898 | static yy_state_type yy_get_previous_state (yyscan_t yyscanner) | ||
1899 | { | ||
1900 | register yy_state_type yy_current_state; | ||
1901 | register char *yy_cp; | ||
1902 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
1903 | |||
1904 | yy_current_state = yyg->yy_start; | ||
1905 | yy_current_state += YY_AT_BOL(); | ||
1906 | |||
1907 | yyg->yy_state_ptr = yyg->yy_state_buf; | ||
1908 | *yyg->yy_state_ptr++ = yy_current_state; | ||
1909 | |||
1910 | for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) | ||
1911 | { | ||
1912 | register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); | ||
1913 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | ||
1914 | { | ||
1915 | yy_current_state = (int) yy_def[yy_current_state]; | ||
1916 | if ( yy_current_state >= 275 ) | ||
1917 | yy_c = yy_meta[(unsigned int) yy_c]; | ||
1918 | } | ||
1919 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | ||
1920 | *yyg->yy_state_ptr++ = yy_current_state; | ||
1921 | } | ||
1922 | |||
1923 | return yy_current_state; | ||
1924 | } | ||
1925 | |||
1926 | /* yy_try_NUL_trans - try to make a transition on the NUL character | ||
1927 | * | ||
1928 | * synopsis | ||
1929 | * next_state = yy_try_NUL_trans( current_state ); | ||
1930 | */ | ||
1931 | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) | ||
1932 | { | ||
1933 | register int yy_is_jam; | ||
1934 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ | ||
1935 | |||
1936 | register YY_CHAR yy_c = 1; | ||
1937 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | ||
1938 | { | ||
1939 | yy_current_state = (int) yy_def[yy_current_state]; | ||
1940 | if ( yy_current_state >= 275 ) | ||
1941 | yy_c = yy_meta[(unsigned int) yy_c]; | ||
1942 | } | ||
1943 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | ||
1944 | yy_is_jam = (yy_current_state == 274); | ||
1945 | if ( ! yy_is_jam ) | ||
1946 | *yyg->yy_state_ptr++ = yy_current_state; | ||
1947 | |||
1948 | return yy_is_jam ? 0 : yy_current_state; | ||
1949 | } | ||
1950 | |||
1951 | static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner) | ||
1952 | { | ||
1953 | register char *yy_cp; | ||
1954 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
1955 | |||
1956 | yy_cp = yyg->yy_c_buf_p; | ||
1957 | |||
1958 | /* undo effects of setting up yytext */ | ||
1959 | *yy_cp = yyg->yy_hold_char; | ||
1960 | |||
1961 | if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) | ||
1962 | { /* need to shift things up to make room */ | ||
1963 | /* +2 for EOB chars. */ | ||
1964 | register int number_to_move = yyg->yy_n_chars + 2; | ||
1965 | register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ | ||
1966 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; | ||
1967 | register char *source = | ||
1968 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; | ||
1969 | |||
1970 | while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) | ||
1971 | *--dest = *--source; | ||
1972 | |||
1973 | yy_cp += (int) (dest - source); | ||
1974 | yy_bp += (int) (dest - source); | ||
1975 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = | ||
1976 | yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; | ||
1977 | |||
1978 | if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) | ||
1979 | YY_FATAL_ERROR( "flex scanner push-back overflow" ); | ||
1980 | } | ||
1981 | |||
1982 | *--yy_cp = (char) c; | ||
1983 | |||
1984 | yyg->yytext_ptr = yy_bp; | ||
1985 | yyg->yy_hold_char = *yy_cp; | ||
1986 | yyg->yy_c_buf_p = yy_cp; | ||
1987 | } | ||
1988 | |||
1989 | #ifndef YY_NO_INPUT | ||
1990 | #ifdef __cplusplus | ||
1991 | static int yyinput (yyscan_t yyscanner) | ||
1992 | #else | ||
1993 | static int input (yyscan_t yyscanner) | ||
1994 | #endif | ||
1995 | |||
1996 | { | ||
1997 | int c; | ||
1998 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
1999 | |||
2000 | *yyg->yy_c_buf_p = yyg->yy_hold_char; | ||
2001 | |||
2002 | if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) | ||
2003 | { | ||
2004 | /* yy_c_buf_p now points to the character we want to return. | ||
2005 | * If this occurs *before* the EOB characters, then it's a | ||
2006 | * valid NUL; if not, then we've hit the end of the buffer. | ||
2007 | */ | ||
2008 | if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) | ||
2009 | /* This was really a NUL. */ | ||
2010 | *yyg->yy_c_buf_p = '\0'; | ||
2011 | |||
2012 | else | ||
2013 | { /* need more input */ | ||
2014 | int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; | ||
2015 | ++yyg->yy_c_buf_p; | ||
2016 | |||
2017 | switch ( yy_get_next_buffer( yyscanner ) ) | ||
2018 | { | ||
2019 | case EOB_ACT_LAST_MATCH: | ||
2020 | /* This happens because yy_g_n_b() | ||
2021 | * sees that we've accumulated a | ||
2022 | * token and flags that we need to | ||
2023 | * try matching the token before | ||
2024 | * proceeding. But for input(), | ||
2025 | * there's no matching to consider. | ||
2026 | * So convert the EOB_ACT_LAST_MATCH | ||
2027 | * to EOB_ACT_END_OF_FILE. | ||
2028 | */ | ||
2029 | |||
2030 | /* Reset buffer status. */ | ||
2031 | vrml_v1_yyrestart(yyin ,yyscanner); | ||
2032 | |||
2033 | /*FALLTHROUGH*/ | ||
2034 | |||
2035 | case EOB_ACT_END_OF_FILE: | ||
2036 | { | ||
2037 | if ( vrml_v1_yywrap(yyscanner ) ) | ||
2038 | return EOF; | ||
2039 | |||
2040 | if ( ! yyg->yy_did_buffer_switch_on_eof ) | ||
2041 | YY_NEW_FILE; | ||
2042 | #ifdef __cplusplus | ||
2043 | return yyinput(yyscanner); | ||
2044 | #else | ||
2045 | return input(yyscanner); | ||
2046 | #endif | ||
2047 | } | ||
2048 | |||
2049 | case EOB_ACT_CONTINUE_SCAN: | ||
2050 | yyg->yy_c_buf_p = yyg->yytext_ptr + offset; | ||
2051 | break; | ||
2052 | } | ||
2053 | } | ||
2054 | } | ||
2055 | |||
2056 | c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ | ||
2057 | *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ | ||
2058 | yyg->yy_hold_char = *++yyg->yy_c_buf_p; | ||
2059 | |||
2060 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); | ||
2061 | |||
2062 | return c; | ||
2063 | } | ||
2064 | #endif /* ifndef YY_NO_INPUT */ | ||
2065 | |||
2066 | /** Immediately switch to a different input stream. | ||
2067 | * @param input_file A readable stream. | ||
2068 | * @param yyscanner The scanner object. | ||
2069 | * @note This function does not reset the start condition to @c INITIAL . | ||
2070 | */ | ||
2071 | void vrml_v1_yyrestart (FILE * input_file , yyscan_t yyscanner) | ||
2072 | { | ||
2073 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2074 | |||
2075 | if ( ! YY_CURRENT_BUFFER ){ | ||
2076 | vrml_v1_yyensure_buffer_stack (yyscanner); | ||
2077 | YY_CURRENT_BUFFER_LVALUE = | ||
2078 | vrml_v1_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); | ||
2079 | } | ||
2080 | |||
2081 | vrml_v1_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); | ||
2082 | vrml_v1_yy_load_buffer_state(yyscanner ); | ||
2083 | } | ||
2084 | |||
2085 | /** Switch to a different input buffer. | ||
2086 | * @param new_buffer The new input buffer. | ||
2087 | * @param yyscanner The scanner object. | ||
2088 | */ | ||
2089 | void vrml_v1_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) | ||
2090 | { | ||
2091 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2092 | |||
2093 | /* TODO. We should be able to replace this entire function body | ||
2094 | * with | ||
2095 | * vrml_v1_yypop_buffer_state(); | ||
2096 | * vrml_v1_yypush_buffer_state(new_buffer); | ||
2097 | */ | ||
2098 | vrml_v1_yyensure_buffer_stack (yyscanner); | ||
2099 | if ( YY_CURRENT_BUFFER == new_buffer ) | ||
2100 | return; | ||
2101 | |||
2102 | if ( YY_CURRENT_BUFFER ) | ||
2103 | { | ||
2104 | /* Flush out information for old buffer. */ | ||
2105 | *yyg->yy_c_buf_p = yyg->yy_hold_char; | ||
2106 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; | ||
2107 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; | ||
2108 | } | ||
2109 | |||
2110 | YY_CURRENT_BUFFER_LVALUE = new_buffer; | ||
2111 | vrml_v1_yy_load_buffer_state(yyscanner ); | ||
2112 | |||
2113 | /* We don't actually know whether we did this switch during | ||
2114 | * EOF (vrml_v1_yywrap()) processing, but the only time this flag | ||
2115 | * is looked at is after vrml_v1_yywrap() is called, so it's safe | ||
2116 | * to go ahead and always set it. | ||
2117 | */ | ||
2118 | yyg->yy_did_buffer_switch_on_eof = 1; | ||
2119 | } | ||
2120 | |||
2121 | static void vrml_v1_yy_load_buffer_state (yyscan_t yyscanner) | ||
2122 | { | ||
2123 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2124 | yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; | ||
2125 | yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; | ||
2126 | yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; | ||
2127 | yyg->yy_hold_char = *yyg->yy_c_buf_p; | ||
2128 | } | ||
2129 | |||
2130 | /** Allocate and initialize an input buffer state. | ||
2131 | * @param file A readable stream. | ||
2132 | * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. | ||
2133 | * @param yyscanner The scanner object. | ||
2134 | * @return the allocated buffer state. | ||
2135 | */ | ||
2136 | YY_BUFFER_STATE vrml_v1_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) | ||
2137 | { | ||
2138 | YY_BUFFER_STATE b; | ||
2139 | |||
2140 | b = (YY_BUFFER_STATE) vrml_v1_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); | ||
2141 | if ( ! b ) | ||
2142 | YY_FATAL_ERROR( "out of dynamic memory in vrml_v1_yy_create_buffer()" ); | ||
2143 | |||
2144 | b->yy_buf_size = size; | ||
2145 | |||
2146 | /* yy_ch_buf has to be 2 characters longer than the size given because | ||
2147 | * we need to put in 2 end-of-buffer characters. | ||
2148 | */ | ||
2149 | b->yy_ch_buf = (char *) vrml_v1_yyalloc(b->yy_buf_size + 2 ,yyscanner ); | ||
2150 | if ( ! b->yy_ch_buf ) | ||
2151 | YY_FATAL_ERROR( "out of dynamic memory in vrml_v1_yy_create_buffer()" ); | ||
2152 | |||
2153 | b->yy_is_our_buffer = 1; | ||
2154 | |||
2155 | vrml_v1_yy_init_buffer(b,file ,yyscanner); | ||
2156 | |||
2157 | return b; | ||
2158 | } | ||
2159 | |||
2160 | /** Destroy the buffer. | ||
2161 | * @param b a buffer created with vrml_v1_yy_create_buffer() | ||
2162 | * @param yyscanner The scanner object. | ||
2163 | */ | ||
2164 | void vrml_v1_yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) | ||
2165 | { | ||
2166 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2167 | |||
2168 | if ( ! b ) | ||
2169 | return; | ||
2170 | |||
2171 | if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ | ||
2172 | YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; | ||
2173 | |||
2174 | if ( b->yy_is_our_buffer ) | ||
2175 | vrml_v1_yyfree((void *) b->yy_ch_buf ,yyscanner ); | ||
2176 | |||
2177 | vrml_v1_yyfree((void *) b ,yyscanner ); | ||
2178 | } | ||
2179 | |||
2180 | #ifndef __cplusplus | ||
2181 | extern int isatty (int ); | ||
2182 | #endif /* __cplusplus */ | ||
2183 | |||
2184 | /* Initializes or reinitializes a buffer. | ||
2185 | * This function is sometimes called more than once on the same buffer, | ||
2186 | * such as during a vrml_v1_yyrestart() or at EOF. | ||
2187 | */ | ||
2188 | static void vrml_v1_yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) | ||
2189 | |||
2190 | { | ||
2191 | int oerrno = errno; | ||
2192 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2193 | |||
2194 | vrml_v1_yy_flush_buffer(b ,yyscanner); | ||
2195 | |||
2196 | b->yy_input_file = file; | ||
2197 | b->yy_fill_buffer = 1; | ||
2198 | |||
2199 | /* If b is the current buffer, then vrml_v1_yy_init_buffer was _probably_ | ||
2200 | * called from vrml_v1_yyrestart() or through yy_get_next_buffer. | ||
2201 | * In that case, we don't want to reset the lineno or column. | ||
2202 | */ | ||
2203 | if (b != YY_CURRENT_BUFFER){ | ||
2204 | b->yy_bs_lineno = 1; | ||
2205 | b->yy_bs_column = 0; | ||
2206 | } | ||
2207 | |||
2208 | b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; | ||
2209 | |||
2210 | errno = oerrno; | ||
2211 | } | ||
2212 | |||
2213 | /** Discard all buffered characters. On the next scan, YY_INPUT will be called. | ||
2214 | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. | ||
2215 | * @param yyscanner The scanner object. | ||
2216 | */ | ||
2217 | void vrml_v1_yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) | ||
2218 | { | ||
2219 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2220 | if ( ! b ) | ||
2221 | return; | ||
2222 | |||
2223 | b->yy_n_chars = 0; | ||
2224 | |||
2225 | /* We always need two end-of-buffer characters. The first causes | ||
2226 | * a transition to the end-of-buffer state. The second causes | ||
2227 | * a jam in that state. | ||
2228 | */ | ||
2229 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; | ||
2230 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; | ||
2231 | |||
2232 | b->yy_buf_pos = &b->yy_ch_buf[0]; | ||
2233 | |||
2234 | b->yy_at_bol = 1; | ||
2235 | b->yy_buffer_status = YY_BUFFER_NEW; | ||
2236 | |||
2237 | if ( b == YY_CURRENT_BUFFER ) | ||
2238 | vrml_v1_yy_load_buffer_state(yyscanner ); | ||
2239 | } | ||
2240 | |||
2241 | /** Pushes the new state onto the stack. The new state becomes | ||
2242 | * the current state. This function will allocate the stack | ||
2243 | * if necessary. | ||
2244 | * @param new_buffer The new state. | ||
2245 | * @param yyscanner The scanner object. | ||
2246 | */ | ||
2247 | void vrml_v1_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) | ||
2248 | { | ||
2249 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2250 | if (new_buffer == NULL) | ||
2251 | return; | ||
2252 | |||
2253 | vrml_v1_yyensure_buffer_stack(yyscanner); | ||
2254 | |||
2255 | /* This block is copied from vrml_v1_yy_switch_to_buffer. */ | ||
2256 | if ( YY_CURRENT_BUFFER ) | ||
2257 | { | ||
2258 | /* Flush out information for old buffer. */ | ||
2259 | *yyg->yy_c_buf_p = yyg->yy_hold_char; | ||
2260 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; | ||
2261 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; | ||
2262 | } | ||
2263 | |||
2264 | /* Only push if top exists. Otherwise, replace top. */ | ||
2265 | if (YY_CURRENT_BUFFER) | ||
2266 | yyg->yy_buffer_stack_top++; | ||
2267 | YY_CURRENT_BUFFER_LVALUE = new_buffer; | ||
2268 | |||
2269 | /* copied from vrml_v1_yy_switch_to_buffer. */ | ||
2270 | vrml_v1_yy_load_buffer_state(yyscanner ); | ||
2271 | yyg->yy_did_buffer_switch_on_eof = 1; | ||
2272 | } | ||
2273 | |||
2274 | /** Removes and deletes the top of the stack, if present. | ||
2275 | * The next element becomes the new top. | ||
2276 | * @param yyscanner The scanner object. | ||
2277 | */ | ||
2278 | void vrml_v1_yypop_buffer_state (yyscan_t yyscanner) | ||
2279 | { | ||
2280 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2281 | if (!YY_CURRENT_BUFFER) | ||
2282 | return; | ||
2283 | |||
2284 | vrml_v1_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); | ||
2285 | YY_CURRENT_BUFFER_LVALUE = NULL; | ||
2286 | if (yyg->yy_buffer_stack_top > 0) | ||
2287 | --yyg->yy_buffer_stack_top; | ||
2288 | |||
2289 | if (YY_CURRENT_BUFFER) { | ||
2290 | vrml_v1_yy_load_buffer_state(yyscanner ); | ||
2291 | yyg->yy_did_buffer_switch_on_eof = 1; | ||
2292 | } | ||
2293 | } | ||
2294 | |||
2295 | /* Allocates the stack if it does not exist. | ||
2296 | * Guarantees space for at least one push. | ||
2297 | */ | ||
2298 | static void vrml_v1_yyensure_buffer_stack (yyscan_t yyscanner) | ||
2299 | { | ||
2300 | int num_to_alloc; | ||
2301 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2302 | |||
2303 | if (!yyg->yy_buffer_stack) { | ||
2304 | |||
2305 | /* First allocation is just for 2 elements, since we don't know if this | ||
2306 | * scanner will even need a stack. We use 2 instead of 1 to avoid an | ||
2307 | * immediate realloc on the next call. | ||
2308 | */ | ||
2309 | num_to_alloc = 1; | ||
2310 | yyg->yy_buffer_stack = (struct yy_buffer_state**)vrml_v1_yyalloc | ||
2311 | (num_to_alloc * sizeof(struct yy_buffer_state*) | ||
2312 | , yyscanner); | ||
2313 | if ( ! yyg->yy_buffer_stack ) | ||
2314 | YY_FATAL_ERROR( "out of dynamic memory in vrml_v1_yyensure_buffer_stack()" ); | ||
2315 | |||
2316 | memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); | ||
2317 | |||
2318 | yyg->yy_buffer_stack_max = num_to_alloc; | ||
2319 | yyg->yy_buffer_stack_top = 0; | ||
2320 | return; | ||
2321 | } | ||
2322 | |||
2323 | if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ | ||
2324 | |||
2325 | /* Increase the buffer to prepare for a possible push. */ | ||
2326 | int grow_size = 8 /* arbitrary grow size */; | ||
2327 | |||
2328 | num_to_alloc = yyg->yy_buffer_stack_max + grow_size; | ||
2329 | yyg->yy_buffer_stack = (struct yy_buffer_state**)vrml_v1_yyrealloc | ||
2330 | (yyg->yy_buffer_stack, | ||
2331 | num_to_alloc * sizeof(struct yy_buffer_state*) | ||
2332 | , yyscanner); | ||
2333 | if ( ! yyg->yy_buffer_stack ) | ||
2334 | YY_FATAL_ERROR( "out of dynamic memory in vrml_v1_yyensure_buffer_stack()" ); | ||
2335 | |||
2336 | /* zero only the new slots.*/ | ||
2337 | memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); | ||
2338 | yyg->yy_buffer_stack_max = num_to_alloc; | ||
2339 | } | ||
2340 | } | ||
2341 | |||
2342 | /** Setup the input buffer state to scan directly from a user-specified character buffer. | ||
2343 | * @param base the character buffer | ||
2344 | * @param size the size in bytes of the character buffer | ||
2345 | * @param yyscanner The scanner object. | ||
2346 | * @return the newly allocated buffer state object. | ||
2347 | */ | ||
2348 | YY_BUFFER_STATE vrml_v1_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) | ||
2349 | { | ||
2350 | YY_BUFFER_STATE b; | ||
2351 | |||
2352 | if ( size < 2 || | ||
2353 | base[size-2] != YY_END_OF_BUFFER_CHAR || | ||
2354 | base[size-1] != YY_END_OF_BUFFER_CHAR ) | ||
2355 | /* They forgot to leave room for the EOB's. */ | ||
2356 | return 0; | ||
2357 | |||
2358 | b = (YY_BUFFER_STATE) vrml_v1_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); | ||
2359 | if ( ! b ) | ||
2360 | YY_FATAL_ERROR( "out of dynamic memory in vrml_v1_yy_scan_buffer()" ); | ||
2361 | |||
2362 | b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ | ||
2363 | b->yy_buf_pos = b->yy_ch_buf = base; | ||
2364 | b->yy_is_our_buffer = 0; | ||
2365 | b->yy_input_file = 0; | ||
2366 | b->yy_n_chars = b->yy_buf_size; | ||
2367 | b->yy_is_interactive = 0; | ||
2368 | b->yy_at_bol = 1; | ||
2369 | b->yy_fill_buffer = 0; | ||
2370 | b->yy_buffer_status = YY_BUFFER_NEW; | ||
2371 | |||
2372 | vrml_v1_yy_switch_to_buffer(b ,yyscanner ); | ||
2373 | |||
2374 | return b; | ||
2375 | } | ||
2376 | |||
2377 | /** Setup the input buffer state to scan a string. The next call to vrml_v1_yylex() will | ||
2378 | * scan from a @e copy of @a str. | ||
2379 | * @param yystr a NUL-terminated string to scan | ||
2380 | * @param yyscanner The scanner object. | ||
2381 | * @return the newly allocated buffer state object. | ||
2382 | * @note If you want to scan bytes that may contain NUL values, then use | ||
2383 | * vrml_v1_yy_scan_bytes() instead. | ||
2384 | */ | ||
2385 | YY_BUFFER_STATE vrml_v1_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) | ||
2386 | { | ||
2387 | |||
2388 | return vrml_v1_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); | ||
2389 | } | ||
2390 | |||
2391 | /** Setup the input buffer state to scan the given bytes. The next call to vrml_v1_yylex() will | ||
2392 | * scan from a @e copy of @a bytes. | ||
2393 | * @param bytes the byte buffer to scan | ||
2394 | * @param len the number of bytes in the buffer pointed to by @a bytes. | ||
2395 | * @param yyscanner The scanner object. | ||
2396 | * @return the newly allocated buffer state object. | ||
2397 | */ | ||
2398 | YY_BUFFER_STATE vrml_v1_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) | ||
2399 | { | ||
2400 | YY_BUFFER_STATE b; | ||
2401 | char *buf; | ||
2402 | yy_size_t n; | ||
2403 | int i; | ||
2404 | |||
2405 | /* Get memory for full buffer, including space for trailing EOB's. */ | ||
2406 | n = _yybytes_len + 2; | ||
2407 | buf = (char *) vrml_v1_yyalloc(n ,yyscanner ); | ||
2408 | if ( ! buf ) | ||
2409 | YY_FATAL_ERROR( "out of dynamic memory in vrml_v1_yy_scan_bytes()" ); | ||
2410 | |||
2411 | for ( i = 0; i < _yybytes_len; ++i ) | ||
2412 | buf[i] = yybytes[i]; | ||
2413 | |||
2414 | buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; | ||
2415 | |||
2416 | b = vrml_v1_yy_scan_buffer(buf,n ,yyscanner); | ||
2417 | if ( ! b ) | ||
2418 | YY_FATAL_ERROR( "bad buffer in vrml_v1_yy_scan_bytes()" ); | ||
2419 | |||
2420 | /* It's okay to grow etc. this buffer, and we should throw it | ||
2421 | * away when we're done. | ||
2422 | */ | ||
2423 | b->yy_is_our_buffer = 1; | ||
2424 | |||
2425 | return b; | ||
2426 | } | ||
2427 | |||
2428 | #ifndef YY_EXIT_FAILURE | ||
2429 | #define YY_EXIT_FAILURE 2 | ||
2430 | #endif | ||
2431 | |||
2432 | static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) | ||
2433 | { | ||
2434 | (void) fprintf( stderr, "%s\n", msg ); | ||
2435 | exit( YY_EXIT_FAILURE ); | ||
2436 | } | ||
2437 | |||
2438 | /* Redefine yyless() so it works in section 3 code. */ | ||
2439 | |||
2440 | #undef yyless | ||
2441 | #define yyless(n) \ | ||
2442 | do \ | ||
2443 | { \ | ||
2444 | /* Undo effects of setting up yytext. */ \ | ||
2445 | int yyless_macro_arg = (n); \ | ||
2446 | YY_LESS_LINENO(yyless_macro_arg);\ | ||
2447 | yytext[yyleng] = yyg->yy_hold_char; \ | ||
2448 | yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ | ||
2449 | yyg->yy_hold_char = *yyg->yy_c_buf_p; \ | ||
2450 | *yyg->yy_c_buf_p = '\0'; \ | ||
2451 | yyleng = yyless_macro_arg; \ | ||
2452 | } \ | ||
2453 | while ( 0 ) | ||
2454 | |||
2455 | /* Accessor methods (get/set functions) to struct members. */ | ||
2456 | |||
2457 | /** Get the user-defined data for this scanner. | ||
2458 | * @param yyscanner The scanner object. | ||
2459 | */ | ||
2460 | YY_EXTRA_TYPE vrml_v1_yyget_extra (yyscan_t yyscanner) | ||
2461 | { | ||
2462 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2463 | return yyextra; | ||
2464 | } | ||
2465 | |||
2466 | /** Get the current line number. | ||
2467 | * @param yyscanner The scanner object. | ||
2468 | */ | ||
2469 | int vrml_v1_yyget_lineno (yyscan_t yyscanner) | ||
2470 | { | ||
2471 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2472 | |||
2473 | if (! YY_CURRENT_BUFFER) | ||
2474 | return 0; | ||
2475 | |||
2476 | return yylineno; | ||
2477 | } | ||
2478 | |||
2479 | /** Get the current column number. | ||
2480 | * @param yyscanner The scanner object. | ||
2481 | */ | ||
2482 | int vrml_v1_yyget_column (yyscan_t yyscanner) | ||
2483 | { | ||
2484 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2485 | |||
2486 | if (! YY_CURRENT_BUFFER) | ||
2487 | return 0; | ||
2488 | |||
2489 | return yycolumn; | ||
2490 | } | ||
2491 | |||
2492 | /** Get the input stream. | ||
2493 | * @param yyscanner The scanner object. | ||
2494 | */ | ||
2495 | FILE *vrml_v1_yyget_in (yyscan_t yyscanner) | ||
2496 | { | ||
2497 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2498 | return yyin; | ||
2499 | } | ||
2500 | |||
2501 | /** Get the output stream. | ||
2502 | * @param yyscanner The scanner object. | ||
2503 | */ | ||
2504 | FILE *vrml_v1_yyget_out (yyscan_t yyscanner) | ||
2505 | { | ||
2506 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2507 | return yyout; | ||
2508 | } | ||
2509 | |||
2510 | /** Get the length of the current token. | ||
2511 | * @param yyscanner The scanner object. | ||
2512 | */ | ||
2513 | int vrml_v1_yyget_leng (yyscan_t yyscanner) | ||
2514 | { | ||
2515 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2516 | return yyleng; | ||
2517 | } | ||
2518 | |||
2519 | /** Get the current token. | ||
2520 | * @param yyscanner The scanner object. | ||
2521 | */ | ||
2522 | |||
2523 | char *vrml_v1_yyget_text (yyscan_t yyscanner) | ||
2524 | { | ||
2525 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2526 | return yytext; | ||
2527 | } | ||
2528 | |||
2529 | /** Set the user-defined data. This data is never touched by the scanner. | ||
2530 | * @param user_defined The data to be associated with this scanner. | ||
2531 | * @param yyscanner The scanner object. | ||
2532 | */ | ||
2533 | void vrml_v1_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) | ||
2534 | { | ||
2535 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2536 | yyextra = user_defined ; | ||
2537 | } | ||
2538 | |||
2539 | /** Set the current line number. | ||
2540 | * @param line_number | ||
2541 | * @param yyscanner The scanner object. | ||
2542 | */ | ||
2543 | void vrml_v1_yyset_lineno (int line_number , yyscan_t yyscanner) | ||
2544 | { | ||
2545 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2546 | |||
2547 | /* lineno is only valid if an input buffer exists. */ | ||
2548 | if (! YY_CURRENT_BUFFER ) | ||
2549 | yy_fatal_error( "vrml_v1_yyset_lineno called with no buffer" , yyscanner); | ||
2550 | |||
2551 | yylineno = line_number; | ||
2552 | } | ||
2553 | |||
2554 | /** Set the current column. | ||
2555 | * @param line_number | ||
2556 | * @param yyscanner The scanner object. | ||
2557 | */ | ||
2558 | void vrml_v1_yyset_column (int column_no , yyscan_t yyscanner) | ||
2559 | { | ||
2560 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2561 | |||
2562 | /* column is only valid if an input buffer exists. */ | ||
2563 | if (! YY_CURRENT_BUFFER ) | ||
2564 | yy_fatal_error( "vrml_v1_yyset_column called with no buffer" , yyscanner); | ||
2565 | |||
2566 | yycolumn = column_no; | ||
2567 | } | ||
2568 | |||
2569 | /** Set the input stream. This does not discard the current | ||
2570 | * input buffer. | ||
2571 | * @param in_str A readable stream. | ||
2572 | * @param yyscanner The scanner object. | ||
2573 | * @see vrml_v1_yy_switch_to_buffer | ||
2574 | */ | ||
2575 | void vrml_v1_yyset_in (FILE * in_str , yyscan_t yyscanner) | ||
2576 | { | ||
2577 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2578 | yyin = in_str ; | ||
2579 | } | ||
2580 | |||
2581 | void vrml_v1_yyset_out (FILE * out_str , yyscan_t yyscanner) | ||
2582 | { | ||
2583 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2584 | yyout = out_str ; | ||
2585 | } | ||
2586 | |||
2587 | int vrml_v1_yyget_debug (yyscan_t yyscanner) | ||
2588 | { | ||
2589 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2590 | return yy_flex_debug; | ||
2591 | } | ||
2592 | |||
2593 | void vrml_v1_yyset_debug (int bdebug , yyscan_t yyscanner) | ||
2594 | { | ||
2595 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2596 | yy_flex_debug = bdebug ; | ||
2597 | } | ||
2598 | |||
2599 | /* Accessor methods for yylval and yylloc */ | ||
2600 | |||
2601 | /* User-visible API */ | ||
2602 | |||
2603 | /* vrml_v1_yylex_init is special because it creates the scanner itself, so it is | ||
2604 | * the ONLY reentrant function that doesn't take the scanner as the last argument. | ||
2605 | * That's why we explicitly handle the declaration, instead of using our macros. | ||
2606 | */ | ||
2607 | |||
2608 | int vrml_v1_yylex_init(yyscan_t* ptr_yy_globals) | ||
2609 | |||
2610 | { | ||
2611 | if (ptr_yy_globals == NULL){ | ||
2612 | errno = EINVAL; | ||
2613 | return 1; | ||
2614 | } | ||
2615 | |||
2616 | *ptr_yy_globals = (yyscan_t) vrml_v1_yyalloc ( sizeof( struct yyguts_t ), NULL ); | ||
2617 | |||
2618 | if (*ptr_yy_globals == NULL){ | ||
2619 | errno = ENOMEM; | ||
2620 | return 1; | ||
2621 | } | ||
2622 | |||
2623 | /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ | ||
2624 | memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); | ||
2625 | |||
2626 | return yy_init_globals ( *ptr_yy_globals ); | ||
2627 | } | ||
2628 | |||
2629 | /* vrml_v1_yylex_init_extra has the same functionality as vrml_v1_yylex_init, but follows the | ||
2630 | * convention of taking the scanner as the last argument. Note however, that | ||
2631 | * this is a *pointer* to a scanner, as it will be allocated by this call (and | ||
2632 | * is the reason, too, why this function also must handle its own declaration). | ||
2633 | * The user defined value in the first argument will be available to vrml_v1_yyalloc in | ||
2634 | * the yyextra field. | ||
2635 | */ | ||
2636 | |||
2637 | int vrml_v1_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) | ||
2638 | |||
2639 | { | ||
2640 | struct yyguts_t dummy_yyguts; | ||
2641 | |||
2642 | vrml_v1_yyset_extra (yy_user_defined, &dummy_yyguts); | ||
2643 | |||
2644 | if (ptr_yy_globals == NULL){ | ||
2645 | errno = EINVAL; | ||
2646 | return 1; | ||
2647 | } | ||
2648 | |||
2649 | *ptr_yy_globals = (yyscan_t) vrml_v1_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); | ||
2650 | |||
2651 | if (*ptr_yy_globals == NULL){ | ||
2652 | errno = ENOMEM; | ||
2653 | return 1; | ||
2654 | } | ||
2655 | |||
2656 | /* By setting to 0xAA, we expose bugs in | ||
2657 | yy_init_globals. Leave at 0x00 for releases. */ | ||
2658 | memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); | ||
2659 | |||
2660 | vrml_v1_yyset_extra (yy_user_defined, *ptr_yy_globals); | ||
2661 | |||
2662 | return yy_init_globals ( *ptr_yy_globals ); | ||
2663 | } | ||
2664 | |||
2665 | static int yy_init_globals (yyscan_t yyscanner) | ||
2666 | { | ||
2667 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2668 | /* Initialization is the same as for the non-reentrant scanner. | ||
2669 | * This function is called from vrml_v1_yylex_destroy(), so don't allocate here. | ||
2670 | */ | ||
2671 | |||
2672 | yyg->yy_buffer_stack = 0; | ||
2673 | yyg->yy_buffer_stack_top = 0; | ||
2674 | yyg->yy_buffer_stack_max = 0; | ||
2675 | yyg->yy_c_buf_p = (char *) 0; | ||
2676 | yyg->yy_init = 0; | ||
2677 | yyg->yy_start = 0; | ||
2678 | |||
2679 | yyg->yy_start_stack_ptr = 0; | ||
2680 | yyg->yy_start_stack_depth = 0; | ||
2681 | yyg->yy_start_stack = NULL; | ||
2682 | |||
2683 | yyg->yy_state_buf = 0; | ||
2684 | yyg->yy_state_ptr = 0; | ||
2685 | yyg->yy_full_match = 0; | ||
2686 | yyg->yy_lp = 0; | ||
2687 | |||
2688 | /* Defined in main.c */ | ||
2689 | #ifdef YY_STDINIT | ||
2690 | yyin = stdin; | ||
2691 | yyout = stdout; | ||
2692 | #else | ||
2693 | yyin = (FILE *) 0; | ||
2694 | yyout = (FILE *) 0; | ||
2695 | #endif | ||
2696 | |||
2697 | /* For future reference: Set errno on error, since we are called by | ||
2698 | * vrml_v1_yylex_init() | ||
2699 | */ | ||
2700 | return 0; | ||
2701 | } | ||
2702 | |||
2703 | /* vrml_v1_yylex_destroy is for both reentrant and non-reentrant scanners. */ | ||
2704 | int vrml_v1_yylex_destroy (yyscan_t yyscanner) | ||
2705 | { | ||
2706 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; | ||
2707 | |||
2708 | /* Pop the buffer stack, destroying each element. */ | ||
2709 | while(YY_CURRENT_BUFFER){ | ||
2710 | vrml_v1_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); | ||
2711 | YY_CURRENT_BUFFER_LVALUE = NULL; | ||
2712 | vrml_v1_yypop_buffer_state(yyscanner); | ||
2713 | } | ||
2714 | |||
2715 | /* Destroy the stack itself. */ | ||
2716 | vrml_v1_yyfree(yyg->yy_buffer_stack ,yyscanner); | ||
2717 | yyg->yy_buffer_stack = NULL; | ||
2718 | |||
2719 | /* Destroy the start condition stack. */ | ||
2720 | vrml_v1_yyfree(yyg->yy_start_stack ,yyscanner ); | ||
2721 | yyg->yy_start_stack = NULL; | ||
2722 | |||
2723 | vrml_v1_yyfree ( yyg->yy_state_buf , yyscanner); | ||
2724 | yyg->yy_state_buf = NULL; | ||
2725 | |||
2726 | /* Reset the globals. This is important in a non-reentrant scanner so the next time | ||
2727 | * vrml_v1_yylex() is called, initialization will occur. */ | ||
2728 | yy_init_globals( yyscanner); | ||
2729 | |||
2730 | /* Destroy the main struct (reentrant only). */ | ||
2731 | vrml_v1_yyfree ( yyscanner , yyscanner ); | ||
2732 | yyscanner = NULL; | ||
2733 | return 0; | ||
2734 | } | ||
2735 | |||
2736 | /* | ||
2737 | * Internal utility routines. | ||
2738 | */ | ||
2739 | |||
2740 | #ifndef yytext_ptr | ||
2741 | static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) | ||
2742 | { | ||
2743 | register int i; | ||
2744 | for ( i = 0; i < n; ++i ) | ||
2745 | s1[i] = s2[i]; | ||
2746 | } | ||
2747 | #endif | ||
2748 | |||
2749 | #ifdef YY_NEED_STRLEN | ||
2750 | static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) | ||
2751 | { | ||
2752 | register int n; | ||
2753 | for ( n = 0; s[n]; ++n ) | ||
2754 | ; | ||
2755 | |||
2756 | return n; | ||
2757 | } | ||
2758 | #endif | ||
2759 | |||
2760 | void *vrml_v1_yyalloc (yy_size_t size , yyscan_t yyscanner) | ||
2761 | { | ||
2762 | return (void *) malloc( size ); | ||
2763 | } | ||
2764 | |||
2765 | void *vrml_v1_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) | ||
2766 | { | ||
2767 | /* The cast to (char *) in the following accommodates both | ||
2768 | * implementations that use char* generic pointers, and those | ||
2769 | * that use void* generic pointers. It works with the latter | ||
2770 | * because both ANSI C and C++ allow castless assignment from | ||
2771 | * any pointer type to void*, and deal with argument conversions | ||
2772 | * as though doing an assignment. | ||
2773 | */ | ||
2774 | return (void *) realloc( (char *) ptr, size ); | ||
2775 | } | ||
2776 | |||
2777 | void vrml_v1_yyfree (void * ptr , yyscan_t yyscanner) | ||
2778 | { | ||
2779 | free( (char *) ptr ); /* see vrml_v1_yyrealloc() for (char *) cast */ | ||
2780 | } | ||
2781 | |||
2782 | #define YYTABLES_NAME "yytables" | ||
2783 | |||
2784 | #line 443 "imp_vrml_v1.l" | ||
2785 | |||
2786 | |||
2787 | |||
2788 | |||