/[ascend]/trunk/tcltk/generic/interface/typelex_no_lex.c
ViewVC logotype

Contents of /trunk/tcltk/generic/interface/typelex_no_lex.c

Parent Directory Parent Directory | Revision Log Revision Log


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

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22