/[ascend]/trunk/tcltk98/generic/interface/typelex_no_flex.c
ViewVC logotype

Contents of /trunk/tcltk98/generic/interface/typelex_no_flex.c

Parent Directory Parent Directory | Revision Log Revision Log


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

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