1#line 2 "/workspace/graphviz/build/cmd/tools/gmlscan.c"
2
3#line 4 "/workspace/graphviz/build/cmd/tools/gmlscan.c"
4
5#define YY_INT_ALIGNED short int
6
7/* A lexical scanner generated by flex */
8
9#define FLEX_SCANNER
10#define YY_FLEX_MAJOR_VERSION 2
11#define YY_FLEX_MINOR_VERSION 6
12#define YY_FLEX_SUBMINOR_VERSION 4
13#if YY_FLEX_SUBMINOR_VERSION > 0
14#define FLEX_BETA
15#endif
16
17/* First, we deal with platform-specific or compiler-specific issues. */
18
19/* begin standard C headers. */
20#include <stdio.h>
21#include <string.h>
22#include <errno.h>
23#include <stdlib.h>
24
25/* end standard C headers. */
26
27/* flex integer type definitions */
28
29#ifndef FLEXINT_H
30#define FLEXINT_H
31
32/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33
34#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
35
36/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37 * if you want the limit (max/min) macros for int types.
38 */
39#ifndef __STDC_LIMIT_MACROS
40#define __STDC_LIMIT_MACROS 1
41#endif
42
43#include <inttypes.h>
44typedef int8_t flex_int8_t;
45typedef uint8_t flex_uint8_t;
46typedef int16_t flex_int16_t;
47typedef uint16_t flex_uint16_t;
48typedef int32_t flex_int32_t;
49typedef uint32_t flex_uint32_t;
50#else
51typedef signed char flex_int8_t;
52typedef short int flex_int16_t;
53typedef int flex_int32_t;
54typedef unsigned char flex_uint8_t;
55typedef unsigned short int flex_uint16_t;
56typedef unsigned int flex_uint32_t;
57
58/* Limits of integral types. */
59#ifndef INT8_MIN
60#define INT8_MIN (-128)
61#endif
62#ifndef INT16_MIN
63#define INT16_MIN (-32767-1)
64#endif
65#ifndef INT32_MIN
66#define INT32_MIN (-2147483647-1)
67#endif
68#ifndef INT8_MAX
69#define INT8_MAX (127)
70#endif
71#ifndef INT16_MAX
72#define INT16_MAX (32767)
73#endif
74#ifndef INT32_MAX
75#define INT32_MAX (2147483647)
76#endif
77#ifndef UINT8_MAX
78#define UINT8_MAX (255U)
79#endif
80#ifndef UINT16_MAX
81#define UINT16_MAX (65535U)
82#endif
83#ifndef UINT32_MAX
84#define UINT32_MAX (4294967295U)
85#endif
86
87#ifndef SIZE_MAX
88#define SIZE_MAX (~(size_t)0)
89#endif
90
91#endif /* ! C99 */
92
93#endif /* ! FLEXINT_H */
94
95/* begin standard C++ headers. */
96
97/* TODO: this is always defined, so inline it */
98#define gmlconst const
99
100#if defined(__GNUC__) && __GNUC__ >= 3
101#define gmlnoreturn __attribute__((__noreturn__))
102#else
103#define gmlnoreturn
104#endif
105
106/* Returned upon end-of-file. */
107#define YY_NULL 0
108
109/* Promotes a possibly negative, possibly signed char to an
110 * integer in range [0..255] for use as an array index.
111 */
112#define YY_SC_TO_UI(c) ((YY_CHAR) (c))
113
114/* Enter a start condition. This macro really ought to take a parameter,
115 * but we do it the disgusting crufty way forced on us by the ()-less
116 * definition of BEGIN.
117 */
118#define BEGIN (gml_start) = 1 + 2 *
119/* Translate the current start state into a value that can be later handed
120 * to BEGIN to return to the state. The YYSTATE alias is for lex
121 * compatibility.
122 */
123#define YY_START (((gml_start) - 1) / 2)
124#define YYSTATE YY_START
125/* Action number for EOF rule of a given start state. */
126#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
127/* Special action meaning "start processing a new file". */
128#define YY_NEW_FILE gmlrestart( gmlin )
129#define YY_END_OF_BUFFER_CHAR 0
130
131/* Size of default input buffer. */
132#ifndef YY_BUF_SIZE
133#ifdef __ia64__
134/* On IA-64, the buffer size is 16k, not 8k.
135 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
136 * Ditto for the __ia64__ case accordingly.
137 */
138#define YY_BUF_SIZE 32768
139#else
140#define YY_BUF_SIZE 16384
141#endif /* __ia64__ */
142#endif
143
144/* The state buf must be large enough to hold one state per character in the main buffer.
145 */
146#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(gml_state_type))
147
148#ifndef YY_TYPEDEF_YY_BUFFER_STATE
149#define YY_TYPEDEF_YY_BUFFER_STATE
150typedef struct gml_buffer_state *YY_BUFFER_STATE;
151#endif
152
153#ifndef YY_TYPEDEF_YY_SIZE_T
154#define YY_TYPEDEF_YY_SIZE_T
155typedef size_t gml_size_t;
156#endif
157
158extern int gmlleng;
159
160extern FILE *gmlin, *gmlout;
161
162#define EOB_ACT_CONTINUE_SCAN 0
163#define EOB_ACT_END_OF_FILE 1
164#define EOB_ACT_LAST_MATCH 2
165
166 #define YY_LESS_LINENO(n)
167 #define YY_LINENO_REWIND_TO(ptr)
168
169/* Return all but the first "n" matched characters back to the input stream. */
170#define gmlless(n) \
171 do \
172 { \
173 /* Undo effects of setting up gmltext. */ \
174 int gmlless_macro_arg = (n); \
175 YY_LESS_LINENO(gmlless_macro_arg);\
176 *gml_cp = (gml_hold_char); \
177 YY_RESTORE_YY_MORE_OFFSET \
178 (gml_c_buf_p) = gml_cp = gml_bp + gmlless_macro_arg - YY_MORE_ADJ; \
179 YY_DO_BEFORE_ACTION; /* set up gmltext again */ \
180 } \
181 while ( 0 )
182#define unput(c) gmlunput( c, (gmltext_ptr) )
183
184#ifndef YY_STRUCT_YY_BUFFER_STATE
185#define YY_STRUCT_YY_BUFFER_STATE
186struct gml_buffer_state
187 {
188 FILE *gml_input_file;
189
190 char *gml_ch_buf; /* input buffer */
191 char *gml_buf_pos; /* current position in input buffer */
192
193 /* Size of input buffer in bytes, not including room for EOB
194 * characters.
195 */
196 int gml_buf_size;
197
198 /* Number of characters read into gml_ch_buf, not including EOB
199 * characters.
200 */
201 int gml_n_chars;
202
203 /* Whether we "own" the buffer - i.e., we know we created it,
204 * and can realloc() it to grow it, and should free() it to
205 * delete it.
206 */
207 int gml_is_our_buffer;
208
209 /* Whether this is an "interactive" input source; if so, and
210 * if we're using stdio for input, then we want to use getc()
211 * instead of fread(), to make sure we stop fetching input after
212 * each newline.
213 */
214 int gml_is_interactive;
215
216 /* Whether we're considered to be at the beginning of a line.
217 * If so, '^' rules will be active on the next match, otherwise
218 * not.
219 */
220 int gml_at_bol;
221
222 int gml_bs_lineno; /**< The line count. */
223 int gml_bs_column; /**< The column count. */
224
225 /* Whether to try to fill the input buffer when we reach the
226 * end of it.
227 */
228 int gml_fill_buffer;
229
230 int gml_buffer_status;
231
232#define YY_BUFFER_NEW 0
233#define YY_BUFFER_NORMAL 1
234 /* When an EOF's been seen but there's still some text to process
235 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
236 * shouldn't try reading from the input source any more. We might
237 * still have a bunch of tokens to match, though, because of
238 * possible backing-up.
239 *
240 * When we actually see the EOF, we change the status to "new"
241 * (via gmlrestart()), so that the user can continue scanning by
242 * just pointing gmlin at a new input file.
243 */
244#define YY_BUFFER_EOF_PENDING 2
245
246 };
247#endif /* !YY_STRUCT_YY_BUFFER_STATE */
248
249/* Stack of input buffers. */
250static size_t gml_buffer_stack_top = 0; /**< index of top of stack. */
251static size_t gml_buffer_stack_max = 0; /**< capacity of stack. */
252static YY_BUFFER_STATE * gml_buffer_stack = NULL; /**< Stack as an array. */
253
254/* We provide macros for accessing buffer states in case in the
255 * future we want to put the buffer states in a more general
256 * "scanner state".
257 *
258 * Returns the top of the stack, or NULL.
259 */
260#define YY_CURRENT_BUFFER ( (gml_buffer_stack) \
261 ? (gml_buffer_stack)[(gml_buffer_stack_top)] \
262 : NULL)
263/* Same as previous macro, but useful when we know that the buffer stack is not
264 * NULL or when we need an lvalue. For internal use only.
265 */
266#define YY_CURRENT_BUFFER_LVALUE (gml_buffer_stack)[(gml_buffer_stack_top)]
267
268/* gml_hold_char holds the character lost when gmltext is formed. */
269static char gml_hold_char;
270static int gml_n_chars; /* number of characters read into gml_ch_buf */
271int gmlleng;
272
273/* Points to current character in buffer. */
274static char *gml_c_buf_p = NULL;
275static int gml_init = 0; /* whether we need to initialize */
276static int gml_start = 0; /* start state number */
277
278/* Flag which is used to allow gmlwrap()'s to do buffer switches
279 * instead of setting up a fresh gmlin. A bit of a hack ...
280 */
281static int gml_did_buffer_switch_on_eof;
282
283void gmlrestart ( FILE *input_file );
284void gml_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
285YY_BUFFER_STATE gml_create_buffer ( FILE *file, int size );
286void gml_delete_buffer ( YY_BUFFER_STATE b );
287void gml_flush_buffer ( YY_BUFFER_STATE b );
288void gmlpush_buffer_state ( YY_BUFFER_STATE new_buffer );
289void gmlpop_buffer_state ( void );
290
291static void gmlensure_buffer_stack ( void );
292static void gml_load_buffer_state ( void );
293static void gml_init_buffer ( YY_BUFFER_STATE b, FILE *file );
294#define YY_FLUSH_BUFFER gml_flush_buffer( YY_CURRENT_BUFFER )
295
296YY_BUFFER_STATE gml_scan_buffer ( char *base, gml_size_t size );
297YY_BUFFER_STATE gml_scan_string ( const char *gml_str );
298YY_BUFFER_STATE gml_scan_bytes ( const char *bytes, int len );
299
300void *gmlalloc ( gml_size_t );
301void *gmlrealloc ( void *, gml_size_t );
302void gmlfree ( void * );
303
304#define gml_new_buffer gml_create_buffer
305#define gml_set_interactive(is_interactive) \
306 { \
307 if ( ! YY_CURRENT_BUFFER ){ \
308 gmlensure_buffer_stack (); \
309 YY_CURRENT_BUFFER_LVALUE = \
310 gml_create_buffer( gmlin, YY_BUF_SIZE ); \
311 } \
312 YY_CURRENT_BUFFER_LVALUE->gml_is_interactive = is_interactive; \
313 }
314#define gml_set_bol(at_bol) \
315 { \
316 if ( ! YY_CURRENT_BUFFER ){\
317 gmlensure_buffer_stack (); \
318 YY_CURRENT_BUFFER_LVALUE = \
319 gml_create_buffer( gmlin, YY_BUF_SIZE ); \
320 } \
321 YY_CURRENT_BUFFER_LVALUE->gml_at_bol = at_bol; \
322 }
323#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->gml_at_bol)
324
325/* Begin user sect3 */
326typedef flex_uint8_t YY_CHAR;
327
328FILE *gmlin = NULL, *gmlout = NULL;
329
330typedef int gml_state_type;
331
332extern int gmllineno;
333int gmllineno = 1;
334
335extern char *gmltext;
336#ifdef gmltext_ptr
337#undef gmltext_ptr
338#endif
339#define gmltext_ptr gmltext
340
341static gml_state_type gml_get_previous_state ( void );
342static gml_state_type gml_try_NUL_trans ( gml_state_type current_state );
343static int gml_get_next_buffer ( void );
344static void gmlnoreturn gml_fatal_error ( const char* msg );
345
346/* Done after the current pattern has been matched and before the
347 * corresponding action - sets up gmltext.
348 */
349#define YY_DO_BEFORE_ACTION \
350 (gmltext_ptr) = gml_bp; \
351 gmlleng = (int) (gml_cp - gml_bp); \
352 (gml_hold_char) = *gml_cp; \
353 *gml_cp = '\0'; \
354 (gml_c_buf_p) = gml_cp;
355#define YY_NUM_RULES 39
356#define YY_END_OF_BUFFER 40
357/* This struct is not used in this scanner,
358 but its presence is necessary. */
359struct gml_trans_info
360 {
361 flex_int32_t gml_verify;
362 flex_int32_t gml_nxt;
363 };
364static const flex_int16_t gml_accept[148] =
365 { 0,
366 0, 0, 0, 0, 40, 38, 4, 2, 35, 38,
367 33, 32, 1, 34, 34, 34, 34, 34, 34, 34,
368 15, 34, 34, 34, 34, 34, 34, 34, 14, 12,
369 13, 3, 37, 2, 36, 33, 32, 33, 0, 34,
370 34, 34, 34, 34, 34, 34, 34, 34, 9, 34,
371 34, 34, 34, 34, 34, 34, 34, 34, 34, 3,
372 37, 0, 33, 34, 34, 34, 34, 34, 34, 34,
373 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
374 34, 34, 26, 34, 34, 7, 20, 34, 34, 34,
375 6, 34, 34, 34, 34, 34, 28, 19, 34, 34,
376
377 31, 34, 34, 34, 5, 16, 34, 27, 34, 25,
378 34, 24, 34, 34, 34, 34, 34, 34, 10, 11,
379 34, 34, 34, 34, 34, 21, 34, 8, 30, 29,
380 17, 34, 34, 34, 34, 34, 34, 34, 34, 34,
381 34, 34, 34, 22, 23, 18, 0
382 } ;
383
384static const YY_CHAR gml_ec[256] =
385 { 0,
386 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
387 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
388 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
389 1, 2, 1, 4, 5, 1, 1, 1, 1, 1,
390 1, 1, 6, 1, 6, 7, 1, 8, 8, 8,
391 8, 8, 8, 8, 8, 8, 8, 1, 1, 1,
392 1, 1, 1, 9, 10, 10, 10, 10, 11, 10,
393 12, 10, 10, 10, 10, 13, 10, 14, 10, 10,
394 10, 10, 15, 10, 10, 10, 16, 10, 10, 10,
395 1, 1, 1, 1, 10, 1, 17, 18, 19, 20,
396
397 21, 22, 23, 24, 25, 10, 10, 26, 27, 28,
398 29, 30, 10, 31, 32, 33, 34, 10, 35, 36,
399 37, 38, 1, 1, 1, 1, 1, 1, 1, 1,
400 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
401 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
402 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
403 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
404 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
405 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
406 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
407
408 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
409 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
410 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
411 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
412 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
413 1, 1, 1, 1, 1
414 } ;
415
416static const YY_CHAR gml_meta[39] =
417 { 0,
418 1, 1, 2, 3, 1, 1, 1, 4, 1, 4,
419 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
420 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
421 4, 4, 4, 4, 4, 4, 4, 4
422 } ;
423
424static const flex_int16_t gml_base[152] =
425 { 0,
426 0, 167, 36, 38, 171, 173, 173, 173, 173, 36,
427 37, 39, 173, 0, 32, 141, 144, 148, 25, 136,
428 0, 146, 148, 135, 129, 133, 22, 35, 136, 0,
429 0, 0, 0, 0, 173, 50, 52, 54, 58, 0,
430 142, 131, 132, 126, 133, 129, 126, 136, 0, 134,
431 131, 117, 124, 114, 110, 115, 109, 114, 123, 0,
432 0, 134, 173, 120, 119, 110, 117, 116, 110, 102,
433 104, 112, 111, 105, 102, 98, 102, 104, 93, 104,
434 91, 97, 0, 91, 102, 0, 0, 53, 96, 93,
435 0, 93, 84, 97, 94, 93, 0, 0, 89, 100,
436
437 0, 78, 93, 84, 83, 0, 79, 0, 85, 0,
438 72, 0, 73, 82, 75, 63, 81, 78, 0, 0,
439 81, 77, 75, 74, 62, 54, 63, 0, 0, 0,
440 0, 59, 66, 66, 52, 68, 62, 60, 52, 64,
441 57, 47, 31, 0, 0, 0, 173, 72, 49, 76,
442 80
443 } ;
444
445static const flex_int16_t gml_def[152] =
446 { 0,
447 147, 1, 148, 148, 147, 147, 147, 147, 147, 147,
448 147, 147, 147, 149, 149, 149, 149, 149, 149, 149,
449 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
450 149, 150, 151, 151, 147, 147, 147, 147, 147, 149,
451 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
452 149, 149, 149, 149, 149, 149, 149, 149, 149, 150,
453 151, 147, 147, 149, 149, 149, 149, 149, 149, 149,
454 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
455 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
456 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
457
458 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
459 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
460 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
461 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
462 149, 149, 149, 149, 149, 149, 0, 147, 147, 147,
463 147
464 } ;
465
466static const flex_int16_t gml_nxt[212] =
467 { 0,
468 6, 7, 8, 9, 6, 10, 11, 12, 13, 14,
469 14, 14, 15, 14, 14, 14, 14, 14, 16, 17,
470 18, 19, 20, 21, 22, 23, 14, 24, 25, 26,
471 14, 27, 28, 14, 29, 30, 31, 14, 34, 35,
472 34, 35, 36, 37, 38, 36, 37, 39, 41, 46,
473 54, 56, 40, 47, 55, 57, 42, 38, 36, 37,
474 39, 38, 146, 62, 39, 63, 103, 104, 132, 133,
475 145, 58, 33, 33, 33, 33, 60, 144, 60, 60,
476 61, 61, 143, 61, 142, 141, 140, 139, 138, 137,
477 136, 135, 134, 131, 130, 129, 128, 127, 126, 125,
478
479 124, 123, 122, 121, 120, 119, 118, 117, 116, 115,
480 114, 113, 112, 111, 110, 109, 108, 107, 106, 105,
481 102, 101, 100, 99, 98, 97, 96, 95, 94, 93,
482 92, 91, 90, 89, 88, 87, 86, 85, 84, 83,
483 82, 63, 81, 80, 79, 78, 77, 76, 75, 74,
484 73, 72, 71, 70, 69, 68, 67, 66, 65, 64,
485 59, 53, 52, 51, 50, 49, 48, 45, 44, 43,
486 147, 32, 5, 147, 147, 147, 147, 147, 147, 147,
487 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
488 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
489
490 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
491 147
492 } ;
493
494static const flex_int16_t gml_chk[212] =
495 { 0,
496 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
497 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
498 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
499 1, 1, 1, 1, 1, 1, 1, 1, 3, 3,
500 4, 4, 10, 10, 11, 12, 12, 11, 15, 19,
501 27, 28, 149, 19, 27, 28, 15, 36, 37, 37,
502 36, 38, 143, 39, 38, 39, 88, 88, 126, 126,
503 142, 28, 148, 148, 148, 148, 150, 141, 150, 150,
504 151, 151, 140, 151, 139, 138, 137, 136, 135, 134,
505 133, 132, 127, 125, 124, 123, 122, 121, 118, 117,
506
507 116, 115, 114, 113, 111, 109, 107, 105, 104, 103,
508 102, 100, 99, 96, 95, 94, 93, 92, 90, 89,
509 85, 84, 82, 81, 80, 79, 78, 77, 76, 75,
510 74, 73, 72, 71, 70, 69, 68, 67, 66, 65,
511 64, 62, 59, 58, 57, 56, 55, 54, 53, 52,
512 51, 50, 48, 47, 46, 45, 44, 43, 42, 41,
513 29, 26, 25, 24, 23, 22, 20, 18, 17, 16,
514 5, 2, 147, 147, 147, 147, 147, 147, 147, 147,
515 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
516 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
517
518 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
519 147
520 } ;
521
522static gml_state_type gml_last_accepting_state;
523static char *gml_last_accepting_cpos;
524
525extern int gml_flex_debug;
526int gml_flex_debug = 0;
527
528/* The intent behind this definition is that it'll catch
529 * any uses of REJECT which flex missed.
530 */
531#define REJECT reject_used_but_not_detected
532#define gmlmore() gmlmore_used_but_not_detected
533#define YY_MORE_ADJ 0
534#define YY_RESTORE_YY_MORE_OFFSET
535char *gmltext;
536#line 1 "gmlscan.l"
537/* vim:set shiftwidth=4 ts=8: */
538#line 4 "gmlscan.l"
539#include <stdlib.h>
540#include <gml2gv.h>
541#include <gmlparse.h>
542#include "config.h"
543
544#ifndef HAVE_UNISTD_H
545#define YY_NO_UNISTD_H
546#endif
547
548#define GRAPH_EOF_TOKEN '@' /* lex class must be defined below */
549
550static int line_num = 1;
551static int errors;
552static FILE* Ifile;
553
554void initgmlscan(FILE *ifile)
555{
556 if (ifile) {
557 Ifile = ifile;
558 line_num = 1;
559 }
560 errors = 0;
561}
562
563#ifndef YY_INPUT
564#define YY_INPUT(buf,result,max_size) \
565 if ((result = fread(buf, 1, max_size, Ifile)) < 0) \
566 YY_FATAL_ERROR( "input in flex scanner failed" )
567#endif
568
569/* buffer for arbitrary length strings (longer than BUFSIZ) */
570static char *Sbuf,*Sptr,*Send;
571static void beginstr(void)
572{
573 if (Sbuf == NULL) {
574 Sbuf = malloc(BUFSIZ);
575 Send = Sbuf + BUFSIZ;
576 }
577 Sptr = Sbuf;
578 *Sptr = 0;
579}
580
581static void addstr(char *src)
582{
583 char c;
584 if (Sptr > Sbuf) Sptr--;
585 do {
586 do {c = *Sptr++ = *src++;} while (c && (Sptr < Send));
587 if (c) {
588 long sz = Send - Sbuf;
589 long off = Sptr - Sbuf;
590 sz *= 2;
591 Sbuf = (char*)realloc(Sbuf,sz);
592 Send = Sbuf + sz;
593 Sptr = Sbuf + off;
594 }
595 } while (c);
596}
597
598static void endstr(void) {
599 gmllval.str = strdup(Sbuf);
600}
601
602#line 603 "/workspace/graphviz/build/cmd/tools/gmlscan.c"
603
604#line 605 "/workspace/graphviz/build/cmd/tools/gmlscan.c"
605
606#define INITIAL 0
607#define qstring 1
608
609#ifndef YY_NO_UNISTD_H
610/* Special case for "unistd.h", since it is non-ANSI. We include it way
611 * down here because we want the user's section 1 to have been scanned first.
612 * The user has a chance to override it with an option.
613 */
614#include <unistd.h>
615#endif
616
617#ifndef YY_EXTRA_TYPE
618#define YY_EXTRA_TYPE void *
619#endif
620
621static int gml_init_globals ( void );
622
623/* Accessor methods to globals.
624 These are made visible to non-reentrant scanners for convenience. */
625
626int gmllex_destroy ( void );
627
628int gmlget_debug ( void );
629
630void gmlset_debug ( int debug_flag );
631
632YY_EXTRA_TYPE gmlget_extra ( void );
633
634void gmlset_extra ( YY_EXTRA_TYPE user_defined );
635
636FILE *gmlget_in ( void );
637
638void gmlset_in ( FILE * _in_str );
639
640FILE *gmlget_out ( void );
641
642void gmlset_out ( FILE * _out_str );
643
644 int gmlget_leng ( void );
645
646char *gmlget_text ( void );
647
648int gmlget_lineno ( void );
649
650void gmlset_lineno ( int _line_number );
651
652/* Macros after this point can all be overridden by user definitions in
653 * section 1.
654 */
655
656#ifndef YY_SKIP_YYWRAP
657#ifdef __cplusplus
658extern "C" int gmlwrap ( void );
659#else
660extern int gmlwrap ( void );
661#endif
662#endif
663
664#ifndef YY_NO_UNPUT
665
666 static void gmlunput ( int c, char *buf_ptr );
667
668#endif
669
670#ifndef gmltext_ptr
671static void gml_flex_strncpy ( char *, const char *, int );
672#endif
673
674#ifdef YY_NEED_STRLEN
675static int gml_flex_strlen ( const char * );
676#endif
677
678#ifndef YY_NO_INPUT
679#ifdef __cplusplus
680static int gmlinput ( void );
681#else
682static int input ( void );
683#endif
684
685#endif
686
687/* Amount of stuff to slurp up with each read. */
688#ifndef YY_READ_BUF_SIZE
689#ifdef __ia64__
690/* On IA-64, the buffer size is 16k, not 8k */
691#define YY_READ_BUF_SIZE 16384
692#else
693#define YY_READ_BUF_SIZE 8192
694#endif /* __ia64__ */
695#endif
696
697/* Copy whatever the last rule matched to the standard output. */
698#ifndef ECHO
699/* This used to be an fputs(), but since the string might contain NUL's,
700 * we now use fwrite().
701 */
702#define ECHO do { if (fwrite( gmltext, (size_t) gmlleng, 1, gmlout )) {} } while (0)
703#endif
704
705/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
706 * is returned in "result".
707 */
708#ifndef YY_INPUT
709#define YY_INPUT(buf,result,max_size) \
710 if ( YY_CURRENT_BUFFER_LVALUE->gml_is_interactive ) \
711 { \
712 int c = '*'; \
713 int n; \
714 for ( n = 0; n < max_size && \
715 (c = getc( gmlin )) != EOF && c != '\n'; ++n ) \
716 buf[n] = (char) c; \
717 if ( c == '\n' ) \
718 buf[n++] = (char) c; \
719 if ( c == EOF && ferror( gmlin ) ) \
720 YY_FATAL_ERROR( "input in flex scanner failed" ); \
721 result = n; \
722 } \
723 else \
724 { \
725 errno=0; \
726 while ( (result = (int) fread(buf, 1, (gml_size_t) max_size, gmlin)) == 0 && ferror(gmlin)) \
727 { \
728 if( errno != EINTR) \
729 { \
730 YY_FATAL_ERROR( "input in flex scanner failed" ); \
731 break; \
732 } \
733 errno=0; \
734 clearerr(gmlin); \
735 } \
736 }\
737\
738
739#endif
740
741/* No semi-colon after return; correct usage is to write "gmlterminate();" -
742 * we don't want an extra ';' after the "return" because that will cause
743 * some compilers to complain about unreachable statements.
744 */
745#ifndef gmlterminate
746#define gmlterminate() return YY_NULL
747#endif
748
749/* Number of entries by which start-condition stack grows. */
750#ifndef YY_START_STACK_INCR
751#define YY_START_STACK_INCR 25
752#endif
753
754/* Report a fatal error. */
755#ifndef YY_FATAL_ERROR
756#define YY_FATAL_ERROR(msg) gml_fatal_error( msg )
757#endif
758
759/* end tables serialization structures and prototypes */
760
761/* Default declaration of generated scanner - a define so the user can
762 * easily add parameters.
763 */
764#ifndef YY_DECL
765#define YY_DECL_IS_OURS 1
766
767extern int gmllex (void);
768
769#define YY_DECL int gmllex (void)
770#endif /* !YY_DECL */
771
772/* Code executed at the beginning of each rule, after gmltext and gmlleng
773 * have been set up.
774 */
775#ifndef YY_USER_ACTION
776#define YY_USER_ACTION
777#endif
778
779/* Code executed at the end of each rule. */
780#ifndef YY_BREAK
781#define YY_BREAK /*LINTED*/break;
782#endif
783
784#define YY_RULE_SETUP \
785 if ( gmlleng > 0 ) \
786 YY_CURRENT_BUFFER_LVALUE->gml_at_bol = \
787 (gmltext[gmlleng - 1] == '\n'); \
788 YY_USER_ACTION
789
790/** The main scanner function which does all the work.
791 */
792YY_DECL
793{
794 gml_state_type gml_current_state;
795 char *gml_cp, *gml_bp;
796 int gml_act;
797
798 if ( !(gml_init) )
799 {
800 (gml_init) = 1;
801
802#ifdef YY_USER_INIT
803 YY_USER_INIT;
804#endif
805
806 if ( ! (gml_start) )
807 (gml_start) = 1; /* first start state */
808
809 if ( ! gmlin )
810 gmlin = stdin;
811
812 if ( ! gmlout )
813 gmlout = stdout;
814
815 if ( ! YY_CURRENT_BUFFER ) {
816 gmlensure_buffer_stack ();
817 YY_CURRENT_BUFFER_LVALUE =
818 gml_create_buffer( gmlin, YY_BUF_SIZE );
819 }
820
821 gml_load_buffer_state( );
822 }
823
824 {
825#line 76 "gmlscan.l"
826
827#line 828 "/workspace/graphviz/build/cmd/tools/gmlscan.c"
828
829 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
830 {
831 gml_cp = (gml_c_buf_p);
832
833 /* Support of gmltext. */
834 *gml_cp = (gml_hold_char);
835
836 /* gml_bp points to the position in gml_ch_buf of the start of
837 * the current run.
838 */
839 gml_bp = gml_cp;
840
841 gml_current_state = (gml_start);
842 gml_current_state += YY_AT_BOL();
843gml_match:
844 do
845 {
846 YY_CHAR gml_c = gml_ec[YY_SC_TO_UI(*gml_cp)] ;
847 if ( gml_accept[gml_current_state] )
848 {
849 (gml_last_accepting_state) = gml_current_state;
850 (gml_last_accepting_cpos) = gml_cp;
851 }
852 while ( gml_chk[gml_base[gml_current_state] + gml_c] != gml_current_state )
853 {
854 gml_current_state = (int) gml_def[gml_current_state];
855 if ( gml_current_state >= 148 )
856 gml_c = gml_meta[gml_c];
857 }
858 gml_current_state = gml_nxt[gml_base[gml_current_state] + gml_c];
859 ++gml_cp;
860 }
861 while ( gml_base[gml_current_state] != 173 );
862
863gml_find_action:
864 gml_act = gml_accept[gml_current_state];
865 if ( gml_act == 0 )
866 { /* have to back up */
867 gml_cp = (gml_last_accepting_cpos);
868 gml_current_state = (gml_last_accepting_state);
869 gml_act = gml_accept[gml_current_state];
870 }
871
872 YY_DO_BEFORE_ACTION;
873
874do_action: /* This label is used only to access EOF actions. */
875
876 switch ( gml_act )
877 { /* beginning of action switch */
878 case 0: /* must back up */
879 /* undo the effects of YY_DO_BEFORE_ACTION */
880 *gml_cp = (gml_hold_char);
881 gml_cp = (gml_last_accepting_cpos);
882 gml_current_state = (gml_last_accepting_state);
883 goto gml_find_action;
884
885case 1:
886YY_RULE_SETUP
887#line 77 "gmlscan.l"
888return(EOF);
889 YY_BREAK
890case 2:
891/* rule 2 can match eol */
892YY_RULE_SETUP
893#line 78 "gmlscan.l"
894line_num++;
895 YY_BREAK
896case 3:
897YY_RULE_SETUP
898#line 79 "gmlscan.l"
899/* ignore # line */
900 YY_BREAK
901case 4:
902YY_RULE_SETUP
903#line 80 "gmlscan.l"
904/* ignore whitespace */
905 YY_BREAK
906case 5:
907YY_RULE_SETUP
908#line 82 "gmlscan.l"
909return (GRAPH);
910 YY_BREAK
911case 6:
912YY_RULE_SETUP
913#line 83 "gmlscan.l"
914return (NODE);
915 YY_BREAK
916case 7:
917YY_RULE_SETUP
918#line 84 "gmlscan.l"
919return (EDGE);
920 YY_BREAK
921case 8:
922YY_RULE_SETUP
923#line 85 "gmlscan.l"
924return (DIRECTED);
925 YY_BREAK
926case 9:
927YY_RULE_SETUP
928#line 86 "gmlscan.l"
929return (ID);
930 YY_BREAK
931case 10:
932YY_RULE_SETUP
933#line 87 "gmlscan.l"
934return (SOURCE);
935 YY_BREAK
936case 11:
937YY_RULE_SETUP
938#line 88 "gmlscan.l"
939return (TARGET);
940 YY_BREAK
941case 12:
942YY_RULE_SETUP
943#line 89 "gmlscan.l"
944return (XVAL);
945 YY_BREAK
946case 13:
947YY_RULE_SETUP
948#line 90 "gmlscan.l"
949return (YVAL);
950 YY_BREAK
951case 14:
952YY_RULE_SETUP
953#line 91 "gmlscan.l"
954return (WVAL);
955 YY_BREAK
956case 15:
957YY_RULE_SETUP
958#line 92 "gmlscan.l"
959return (HVAL);
960 YY_BREAK
961case 16:
962YY_RULE_SETUP
963#line 93 "gmlscan.l"
964return (LABEL);
965 YY_BREAK
966case 17:
967YY_RULE_SETUP
968#line 94 "gmlscan.l"
969return (GRAPHICS);;
970 YY_BREAK
971case 18:
972YY_RULE_SETUP
973#line 95 "gmlscan.l"
974return (LABELGRAPHICS);
975 YY_BREAK
976case 19:
977YY_RULE_SETUP
978#line 96 "gmlscan.l"
979return (TYPE);
980 YY_BREAK
981case 20:
982YY_RULE_SETUP
983#line 97 "gmlscan.l"
984return (FILL);
985 YY_BREAK
986case 21:
987YY_RULE_SETUP
988#line 98 "gmlscan.l"
989return (OUTLINE);
990 YY_BREAK
991case 22:
992YY_RULE_SETUP
993#line 99 "gmlscan.l"
994return (OUTLINESTYLE);
995 YY_BREAK
996case 23:
997YY_RULE_SETUP
998#line 100 "gmlscan.l"
999return (OUTLINEWIDTH);
1000 YY_BREAK
1001case 24:
1002YY_RULE_SETUP
1003#line 101 "gmlscan.l"
1004return (WIDTH);
1005 YY_BREAK
1006case 25:
1007YY_RULE_SETUP
1008#line 102 "gmlscan.l"
1009return (STYLE);
1010 YY_BREAK
1011case 26:
1012YY_RULE_SETUP
1013#line 103 "gmlscan.l"
1014return (LINE);
1015 YY_BREAK
1016case 27:
1017YY_RULE_SETUP
1018#line 104 "gmlscan.l"
1019return (POINT);
1020 YY_BREAK
1021case 28:
1022YY_RULE_SETUP
1023#line 105 "gmlscan.l"
1024return (TEXT);
1025 YY_BREAK
1026case 29:
1027YY_RULE_SETUP
1028#line 106 "gmlscan.l"
1029return (FONTSIZE);
1030 YY_BREAK
1031case 30:
1032YY_RULE_SETUP
1033#line 107 "gmlscan.l"
1034return (FONTNAME);
1035 YY_BREAK
1036case 31:
1037YY_RULE_SETUP
1038#line 108 "gmlscan.l"
1039return (COLOR);
1040 YY_BREAK
1041case 32:
1042YY_RULE_SETUP
1043#line 109 "gmlscan.l"
1044{ gmllval.str = strdup(gmltext); return (INTEGER); }
1045 YY_BREAK
1046case 33:
1047YY_RULE_SETUP
1048#line 110 "gmlscan.l"
1049{ gmllval.str = strdup(gmltext); return (REAL); }
1050 YY_BREAK
1051case 34:
1052YY_RULE_SETUP
1053#line 111 "gmlscan.l"
1054{ gmllval.str = strdup(gmltext); return (NAME); }
1055 YY_BREAK
1056case 35:
1057YY_RULE_SETUP
1058#line 112 "gmlscan.l"
1059BEGIN(qstring); beginstr();
1060 YY_BREAK
1061case 36:
1062YY_RULE_SETUP
1063#line 114 "gmlscan.l"
1064BEGIN(INITIAL); endstr(); return (STRING);
1065 YY_BREAK
1066case 37:
1067/* rule 37 can match eol */
1068YY_RULE_SETUP
1069#line 115 "gmlscan.l"
1070addstr(gmltext);
1071 YY_BREAK
1072case 38:
1073YY_RULE_SETUP
1074#line 117 "gmlscan.l"
1075return (gmltext[0]);
1076 YY_BREAK
1077case 39:
1078YY_RULE_SETUP
1079#line 119 "gmlscan.l"
1080ECHO;
1081 YY_BREAK
1082#line 1083 "/workspace/graphviz/build/cmd/tools/gmlscan.c"
1083case YY_STATE_EOF(INITIAL):
1084case YY_STATE_EOF(qstring):
1085 gmlterminate();
1086
1087 case YY_END_OF_BUFFER:
1088 {
1089 /* Amount of text matched not including the EOB char. */
1090 int gml_amount_of_matched_text = (int) (gml_cp - (gmltext_ptr)) - 1;
1091
1092 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1093 *gml_cp = (gml_hold_char);
1094 YY_RESTORE_YY_MORE_OFFSET
1095
1096 if ( YY_CURRENT_BUFFER_LVALUE->gml_buffer_status == YY_BUFFER_NEW )
1097 {
1098 /* We're scanning a new file or input source. It's
1099 * possible that this happened because the user
1100 * just pointed gmlin at a new source and called
1101 * gmllex(). If so, then we have to assure
1102 * consistency between YY_CURRENT_BUFFER and our
1103 * globals. Here is the right place to do so, because
1104 * this is the first action (other than possibly a
1105 * back-up) that will match for the new input source.
1106 */
1107 (gml_n_chars) = YY_CURRENT_BUFFER_LVALUE->gml_n_chars;
1108 YY_CURRENT_BUFFER_LVALUE->gml_input_file = gmlin;
1109 YY_CURRENT_BUFFER_LVALUE->gml_buffer_status = YY_BUFFER_NORMAL;
1110 }
1111
1112 /* Note that here we test for gml_c_buf_p "<=" to the position
1113 * of the first EOB in the buffer, since gml_c_buf_p will
1114 * already have been incremented past the NUL character
1115 * (since all states make transitions on EOB to the
1116 * end-of-buffer state). Contrast this with the test
1117 * in input().
1118 */
1119 if ( (gml_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->gml_ch_buf[(gml_n_chars)] )
1120 { /* This was really a NUL. */
1121 gml_state_type gml_next_state;
1122
1123 (gml_c_buf_p) = (gmltext_ptr) + gml_amount_of_matched_text;
1124
1125 gml_current_state = gml_get_previous_state( );
1126
1127 /* Okay, we're now positioned to make the NUL
1128 * transition. We couldn't have
1129 * gml_get_previous_state() go ahead and do it
1130 * for us because it doesn't know how to deal
1131 * with the possibility of jamming (and we don't
1132 * want to build jamming into it because then it
1133 * will run more slowly).
1134 */
1135
1136 gml_next_state = gml_try_NUL_trans( gml_current_state );
1137
1138 gml_bp = (gmltext_ptr) + YY_MORE_ADJ;
1139
1140 if ( gml_next_state )
1141 {
1142 /* Consume the NUL. */
1143 gml_cp = ++(gml_c_buf_p);
1144 gml_current_state = gml_next_state;
1145 goto gml_match;
1146 }
1147
1148 else
1149 {
1150 gml_cp = (gml_c_buf_p);
1151 goto gml_find_action;
1152 }
1153 }
1154
1155 else switch ( gml_get_next_buffer( ) )
1156 {
1157 case EOB_ACT_END_OF_FILE:
1158 {
1159 (gml_did_buffer_switch_on_eof) = 0;
1160
1161 if ( gmlwrap( ) )
1162 {
1163 /* Note: because we've taken care in
1164 * gml_get_next_buffer() to have set up
1165 * gmltext, we can now set up
1166 * gml_c_buf_p so that if some total
1167 * hoser (like flex itself) wants to
1168 * call the scanner after we return the
1169 * YY_NULL, it'll still work - another
1170 * YY_NULL will get returned.
1171 */
1172 (gml_c_buf_p) = (gmltext_ptr) + YY_MORE_ADJ;
1173
1174 gml_act = YY_STATE_EOF(YY_START);
1175 goto do_action;
1176 }
1177
1178 else
1179 {
1180 if ( ! (gml_did_buffer_switch_on_eof) )
1181 YY_NEW_FILE;
1182 }
1183 break;
1184 }
1185
1186 case EOB_ACT_CONTINUE_SCAN:
1187 (gml_c_buf_p) =
1188 (gmltext_ptr) + gml_amount_of_matched_text;
1189
1190 gml_current_state = gml_get_previous_state( );
1191
1192 gml_cp = (gml_c_buf_p);
1193 gml_bp = (gmltext_ptr) + YY_MORE_ADJ;
1194 goto gml_match;
1195
1196 case EOB_ACT_LAST_MATCH:
1197 (gml_c_buf_p) =
1198 &YY_CURRENT_BUFFER_LVALUE->gml_ch_buf[(gml_n_chars)];
1199
1200 gml_current_state = gml_get_previous_state( );
1201
1202 gml_cp = (gml_c_buf_p);
1203 gml_bp = (gmltext_ptr) + YY_MORE_ADJ;
1204 goto gml_find_action;
1205 }
1206 break;
1207 }
1208
1209 default:
1210 YY_FATAL_ERROR(
1211 "fatal flex scanner internal error--no action found" );
1212 } /* end of action switch */
1213 } /* end of scanning one token */
1214 } /* end of user's declarations */
1215} /* end of gmllex */
1216
1217/* gml_get_next_buffer - try to read in a new buffer
1218 *
1219 * Returns a code representing an action:
1220 * EOB_ACT_LAST_MATCH -
1221 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1222 * EOB_ACT_END_OF_FILE - end of file
1223 */
1224static int gml_get_next_buffer (void)
1225{
1226 char *dest = YY_CURRENT_BUFFER_LVALUE->gml_ch_buf;
1227 char *source = (gmltext_ptr);
1228 int number_to_move, i;
1229 int ret_val;
1230
1231 if ( (gml_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->gml_ch_buf[(gml_n_chars) + 1] )
1232 YY_FATAL_ERROR(
1233 "fatal flex scanner internal error--end of buffer missed" );
1234
1235 if ( YY_CURRENT_BUFFER_LVALUE->gml_fill_buffer == 0 )
1236 { /* Don't try to fill the buffer, so this is an EOF. */
1237 if ( (gml_c_buf_p) - (gmltext_ptr) - YY_MORE_ADJ == 1 )
1238 {
1239 /* We matched a single character, the EOB, so
1240 * treat this as a final EOF.
1241 */
1242 return EOB_ACT_END_OF_FILE;
1243 }
1244
1245 else
1246 {
1247 /* We matched some text prior to the EOB, first
1248 * process it.
1249 */
1250 return EOB_ACT_LAST_MATCH;
1251 }
1252 }
1253
1254 /* Try to read more data. */
1255
1256 /* First move last chars to start of buffer. */
1257 number_to_move = (int) ((gml_c_buf_p) - (gmltext_ptr) - 1);
1258
1259 for ( i = 0; i < number_to_move; ++i )
1260 *(dest++) = *(source++);
1261
1262 if ( YY_CURRENT_BUFFER_LVALUE->gml_buffer_status == YY_BUFFER_EOF_PENDING )
1263 /* don't do the read, it's not guaranteed to return an EOF,
1264 * just force an EOF
1265 */
1266 YY_CURRENT_BUFFER_LVALUE->gml_n_chars = (gml_n_chars) = 0;
1267
1268 else
1269 {
1270 int num_to_read =
1271 YY_CURRENT_BUFFER_LVALUE->gml_buf_size - number_to_move - 1;
1272
1273 while ( num_to_read <= 0 )
1274 { /* Not enough room in the buffer - grow it. */
1275
1276 /* just a shorter name for the current buffer */
1277 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1278
1279 int gml_c_buf_p_offset =
1280 (int) ((gml_c_buf_p) - b->gml_ch_buf);
1281
1282 if ( b->gml_is_our_buffer )
1283 {
1284 int new_size = b->gml_buf_size * 2;
1285
1286 if ( new_size <= 0 )
1287 b->gml_buf_size += b->gml_buf_size / 8;
1288 else
1289 b->gml_buf_size *= 2;
1290
1291 b->gml_ch_buf = (char *)
1292 /* Include room in for 2 EOB chars. */
1293 gmlrealloc( (void *) b->gml_ch_buf,
1294 (gml_size_t) (b->gml_buf_size + 2) );
1295 }
1296 else
1297 /* Can't grow it, we don't own it. */
1298 b->gml_ch_buf = NULL;
1299
1300 if ( ! b->gml_ch_buf )
1301 YY_FATAL_ERROR(
1302 "fatal error - scanner input buffer overflow" );
1303
1304 (gml_c_buf_p) = &b->gml_ch_buf[gml_c_buf_p_offset];
1305
1306 num_to_read = YY_CURRENT_BUFFER_LVALUE->gml_buf_size -
1307 number_to_move - 1;
1308
1309 }
1310
1311 if ( num_to_read > YY_READ_BUF_SIZE )
1312 num_to_read = YY_READ_BUF_SIZE;
1313
1314 /* Read in more data. */
1315 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->gml_ch_buf[number_to_move]),
1316 (gml_n_chars), num_to_read );
1317
1318 YY_CURRENT_BUFFER_LVALUE->gml_n_chars = (gml_n_chars);
1319 }
1320
1321 if ( (gml_n_chars) == 0 )
1322 {
1323 if ( number_to_move == YY_MORE_ADJ )
1324 {
1325 ret_val = EOB_ACT_END_OF_FILE;
1326 gmlrestart( gmlin );
1327 }
1328
1329 else
1330 {
1331 ret_val = EOB_ACT_LAST_MATCH;
1332 YY_CURRENT_BUFFER_LVALUE->gml_buffer_status =
1333 YY_BUFFER_EOF_PENDING;
1334 }
1335 }
1336
1337 else
1338 ret_val = EOB_ACT_CONTINUE_SCAN;
1339
1340 if (((gml_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->gml_buf_size) {
1341 /* Extend the array by 50%, plus the number we really need. */
1342 int new_size = (gml_n_chars) + number_to_move + ((gml_n_chars) >> 1);
1343 YY_CURRENT_BUFFER_LVALUE->gml_ch_buf = (char *) gmlrealloc(
1344 (void *) YY_CURRENT_BUFFER_LVALUE->gml_ch_buf, (gml_size_t) new_size );
1345 if ( ! YY_CURRENT_BUFFER_LVALUE->gml_ch_buf )
1346 YY_FATAL_ERROR( "out of dynamic memory in gml_get_next_buffer()" );
1347 /* "- 2" to take care of EOB's */
1348 YY_CURRENT_BUFFER_LVALUE->gml_buf_size = (int) (new_size - 2);
1349 }
1350
1351 (gml_n_chars) += number_to_move;
1352 YY_CURRENT_BUFFER_LVALUE->gml_ch_buf[(gml_n_chars)] = YY_END_OF_BUFFER_CHAR;
1353 YY_CURRENT_BUFFER_LVALUE->gml_ch_buf[(gml_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1354
1355 (gmltext_ptr) = &YY_CURRENT_BUFFER_LVALUE->gml_ch_buf[0];
1356
1357 return ret_val;
1358}
1359
1360/* gml_get_previous_state - get the state just before the EOB char was reached */
1361
1362 static gml_state_type gml_get_previous_state (void)
1363{
1364 gml_state_type gml_current_state;
1365 char *gml_cp;
1366
1367 gml_current_state = (gml_start);
1368 gml_current_state += YY_AT_BOL();
1369
1370 for ( gml_cp = (gmltext_ptr) + YY_MORE_ADJ; gml_cp < (gml_c_buf_p); ++gml_cp )
1371 {
1372 YY_CHAR gml_c = (*gml_cp ? gml_ec[YY_SC_TO_UI(*gml_cp)] : 1);
1373 if ( gml_accept[gml_current_state] )
1374 {
1375 (gml_last_accepting_state) = gml_current_state;
1376 (gml_last_accepting_cpos) = gml_cp;
1377 }
1378 while ( gml_chk[gml_base[gml_current_state] + gml_c] != gml_current_state )
1379 {
1380 gml_current_state = (int) gml_def[gml_current_state];
1381 if ( gml_current_state >= 148 )
1382 gml_c = gml_meta[gml_c];
1383 }
1384 gml_current_state = gml_nxt[gml_base[gml_current_state] + gml_c];
1385 }
1386
1387 return gml_current_state;
1388}
1389
1390/* gml_try_NUL_trans - try to make a transition on the NUL character
1391 *
1392 * synopsis
1393 * next_state = gml_try_NUL_trans( current_state );
1394 */
1395 static gml_state_type gml_try_NUL_trans (gml_state_type gml_current_state )
1396{
1397 int gml_is_jam;
1398 char *gml_cp = (gml_c_buf_p);
1399
1400 YY_CHAR gml_c = 1;
1401 if ( gml_accept[gml_current_state] )
1402 {
1403 (gml_last_accepting_state) = gml_current_state;
1404 (gml_last_accepting_cpos) = gml_cp;
1405 }
1406 while ( gml_chk[gml_base[gml_current_state] + gml_c] != gml_current_state )
1407 {
1408 gml_current_state = (int) gml_def[gml_current_state];
1409 if ( gml_current_state >= 148 )
1410 gml_c = gml_meta[gml_c];
1411 }
1412 gml_current_state = gml_nxt[gml_base[gml_current_state] + gml_c];
1413 gml_is_jam = (gml_current_state == 147);
1414
1415 return gml_is_jam ? 0 : gml_current_state;
1416}
1417
1418#ifndef YY_NO_UNPUT
1419
1420 static void gmlunput (int c, char * gml_bp )
1421{
1422 char *gml_cp;
1423
1424 gml_cp = (gml_c_buf_p);
1425
1426 /* undo effects of setting up gmltext */
1427 *gml_cp = (gml_hold_char);
1428
1429 if ( gml_cp < YY_CURRENT_BUFFER_LVALUE->gml_ch_buf + 2 )
1430 { /* need to shift things up to make room */
1431 /* +2 for EOB chars. */
1432 int number_to_move = (gml_n_chars) + 2;
1433 char *dest = &YY_CURRENT_BUFFER_LVALUE->gml_ch_buf[
1434 YY_CURRENT_BUFFER_LVALUE->gml_buf_size + 2];
1435 char *source =
1436 &YY_CURRENT_BUFFER_LVALUE->gml_ch_buf[number_to_move];
1437
1438 while ( source > YY_CURRENT_BUFFER_LVALUE->gml_ch_buf )
1439 *--dest = *--source;
1440
1441 gml_cp += (int) (dest - source);
1442 gml_bp += (int) (dest - source);
1443 YY_CURRENT_BUFFER_LVALUE->gml_n_chars =
1444 (gml_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->gml_buf_size;
1445
1446 if ( gml_cp < YY_CURRENT_BUFFER_LVALUE->gml_ch_buf + 2 )
1447 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1448 }
1449
1450 *--gml_cp = (char) c;
1451
1452 (gmltext_ptr) = gml_bp;
1453 (gml_hold_char) = *gml_cp;
1454 (gml_c_buf_p) = gml_cp;
1455}
1456
1457#endif
1458
1459#ifndef YY_NO_INPUT
1460#ifdef __cplusplus
1461 static int gmlinput (void)
1462#else
1463 static int input (void)
1464#endif
1465
1466{
1467 int c;
1468
1469 *(gml_c_buf_p) = (gml_hold_char);
1470
1471 if ( *(gml_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1472 {
1473 /* gml_c_buf_p now points to the character we want to return.
1474 * If this occurs *before* the EOB characters, then it's a
1475 * valid NUL; if not, then we've hit the end of the buffer.
1476 */
1477 if ( (gml_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->gml_ch_buf[(gml_n_chars)] )
1478 /* This was really a NUL. */
1479 *(gml_c_buf_p) = '\0';
1480
1481 else
1482 { /* need more input */
1483 int offset = (int) ((gml_c_buf_p) - (gmltext_ptr));
1484 ++(gml_c_buf_p);
1485
1486 switch ( gml_get_next_buffer( ) )
1487 {
1488 case EOB_ACT_LAST_MATCH:
1489 /* This happens because gml_g_n_b()
1490 * sees that we've accumulated a
1491 * token and flags that we need to
1492 * try matching the token before
1493 * proceeding. But for input(),
1494 * there's no matching to consider.
1495 * So convert the EOB_ACT_LAST_MATCH
1496 * to EOB_ACT_END_OF_FILE.
1497 */
1498
1499 /* Reset buffer status. */
1500 gmlrestart( gmlin );
1501
1502 /*FALLTHROUGH*/
1503
1504 case EOB_ACT_END_OF_FILE:
1505 {
1506 if ( gmlwrap( ) )
1507 return 0;
1508
1509 if ( ! (gml_did_buffer_switch_on_eof) )
1510 YY_NEW_FILE;
1511#ifdef __cplusplus
1512 return gmlinput();
1513#else
1514 return input();
1515#endif
1516 }
1517
1518 case EOB_ACT_CONTINUE_SCAN:
1519 (gml_c_buf_p) = (gmltext_ptr) + offset;
1520 break;
1521 }
1522 }
1523 }
1524
1525 c = *(unsigned char *) (gml_c_buf_p); /* cast for 8-bit char's */
1526 *(gml_c_buf_p) = '\0'; /* preserve gmltext */
1527 (gml_hold_char) = *++(gml_c_buf_p);
1528
1529 YY_CURRENT_BUFFER_LVALUE->gml_at_bol = (c == '\n');
1530
1531 return c;
1532}
1533#endif /* ifndef YY_NO_INPUT */
1534
1535/** Immediately switch to a different input stream.
1536 * @param input_file A readable stream.
1537 *
1538 * @note This function does not reset the start condition to @c INITIAL .
1539 */
1540 void gmlrestart (FILE * input_file )
1541{
1542
1543 if ( ! YY_CURRENT_BUFFER ){
1544 gmlensure_buffer_stack ();
1545 YY_CURRENT_BUFFER_LVALUE =
1546 gml_create_buffer( gmlin, YY_BUF_SIZE );
1547 }
1548
1549 gml_init_buffer( YY_CURRENT_BUFFER, input_file );
1550 gml_load_buffer_state( );
1551}
1552
1553/** Switch to a different input buffer.
1554 * @param new_buffer The new input buffer.
1555 *
1556 */
1557 void gml_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1558{
1559
1560 /* TODO. We should be able to replace this entire function body
1561 * with
1562 * gmlpop_buffer_state();
1563 * gmlpush_buffer_state(new_buffer);
1564 */
1565 gmlensure_buffer_stack ();
1566 if ( YY_CURRENT_BUFFER == new_buffer )
1567 return;
1568
1569 if ( YY_CURRENT_BUFFER )
1570 {
1571 /* Flush out information for old buffer. */
1572 *(gml_c_buf_p) = (gml_hold_char);
1573 YY_CURRENT_BUFFER_LVALUE->gml_buf_pos = (gml_c_buf_p);
1574 YY_CURRENT_BUFFER_LVALUE->gml_n_chars = (gml_n_chars);
1575 }
1576
1577 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1578 gml_load_buffer_state( );
1579
1580 /* We don't actually know whether we did this switch during
1581 * EOF (gmlwrap()) processing, but the only time this flag
1582 * is looked at is after gmlwrap() is called, so it's safe
1583 * to go ahead and always set it.
1584 */
1585 (gml_did_buffer_switch_on_eof) = 1;
1586}
1587
1588static void gml_load_buffer_state (void)
1589{
1590 (gml_n_chars) = YY_CURRENT_BUFFER_LVALUE->gml_n_chars;
1591 (gmltext_ptr) = (gml_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->gml_buf_pos;
1592 gmlin = YY_CURRENT_BUFFER_LVALUE->gml_input_file;
1593 (gml_hold_char) = *(gml_c_buf_p);
1594}
1595
1596/** Allocate and initialize an input buffer state.
1597 * @param file A readable stream.
1598 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1599 *
1600 * @return the allocated buffer state.
1601 */
1602 YY_BUFFER_STATE gml_create_buffer (FILE * file, int size )
1603{
1604 YY_BUFFER_STATE b;
1605
1606 b = (YY_BUFFER_STATE) gmlalloc( sizeof( struct gml_buffer_state ) );
1607 if ( ! b )
1608 YY_FATAL_ERROR( "out of dynamic memory in gml_create_buffer()" );
1609
1610 b->gml_buf_size = size;
1611
1612 /* gml_ch_buf has to be 2 characters longer than the size given because
1613 * we need to put in 2 end-of-buffer characters.
1614 */
1615 b->gml_ch_buf = (char *) gmlalloc( (gml_size_t) (b->gml_buf_size + 2) );
1616 if ( ! b->gml_ch_buf )
1617 YY_FATAL_ERROR( "out of dynamic memory in gml_create_buffer()" );
1618
1619 b->gml_is_our_buffer = 1;
1620
1621 gml_init_buffer( b, file );
1622
1623 return b;
1624}
1625
1626/** Destroy the buffer.
1627 * @param b a buffer created with gml_create_buffer()
1628 *
1629 */
1630 void gml_delete_buffer (YY_BUFFER_STATE b )
1631{
1632
1633 if ( ! b )
1634 return;
1635
1636 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1637 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1638
1639 if ( b->gml_is_our_buffer )
1640 gmlfree( (void *) b->gml_ch_buf );
1641
1642 gmlfree( (void *) b );
1643}
1644
1645/* Initializes or reinitializes a buffer.
1646 * This function is sometimes called more than once on the same buffer,
1647 * such as during a gmlrestart() or at EOF.
1648 */
1649 static void gml_init_buffer (YY_BUFFER_STATE b, FILE * file )
1650
1651{
1652 int oerrno = errno;
1653
1654 gml_flush_buffer( b );
1655
1656 b->gml_input_file = file;
1657 b->gml_fill_buffer = 1;
1658
1659 /* If b is the current buffer, then gml_init_buffer was _probably_
1660 * called from gmlrestart() or through gml_get_next_buffer.
1661 * In that case, we don't want to reset the lineno or column.
1662 */
1663 if (b != YY_CURRENT_BUFFER){
1664 b->gml_bs_lineno = 1;
1665 b->gml_bs_column = 0;
1666 }
1667
1668 b->gml_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1669
1670 errno = oerrno;
1671}
1672
1673/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1674 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1675 *
1676 */
1677 void gml_flush_buffer (YY_BUFFER_STATE b )
1678{
1679 if ( ! b )
1680 return;
1681
1682 b->gml_n_chars = 0;
1683
1684 /* We always need two end-of-buffer characters. The first causes
1685 * a transition to the end-of-buffer state. The second causes
1686 * a jam in that state.
1687 */
1688 b->gml_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1689 b->gml_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1690
1691 b->gml_buf_pos = &b->gml_ch_buf[0];
1692
1693 b->gml_at_bol = 1;
1694 b->gml_buffer_status = YY_BUFFER_NEW;
1695
1696 if ( b == YY_CURRENT_BUFFER )
1697 gml_load_buffer_state( );
1698}
1699
1700/** Pushes the new state onto the stack. The new state becomes
1701 * the current state. This function will allocate the stack
1702 * if necessary.
1703 * @param new_buffer The new state.
1704 *
1705 */
1706void gmlpush_buffer_state (YY_BUFFER_STATE new_buffer )
1707{
1708 if (new_buffer == NULL)
1709 return;
1710
1711 gmlensure_buffer_stack();
1712
1713 /* This block is copied from gml_switch_to_buffer. */
1714 if ( YY_CURRENT_BUFFER )
1715 {
1716 /* Flush out information for old buffer. */
1717 *(gml_c_buf_p) = (gml_hold_char);
1718 YY_CURRENT_BUFFER_LVALUE->gml_buf_pos = (gml_c_buf_p);
1719 YY_CURRENT_BUFFER_LVALUE->gml_n_chars = (gml_n_chars);
1720 }
1721
1722 /* Only push if top exists. Otherwise, replace top. */
1723 if (YY_CURRENT_BUFFER)
1724 (gml_buffer_stack_top)++;
1725 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1726
1727 /* copied from gml_switch_to_buffer. */
1728 gml_load_buffer_state( );
1729 (gml_did_buffer_switch_on_eof) = 1;
1730}
1731
1732/** Removes and deletes the top of the stack, if present.
1733 * The next element becomes the new top.
1734 *
1735 */
1736void gmlpop_buffer_state (void)
1737{
1738 if (!YY_CURRENT_BUFFER)
1739 return;
1740
1741 gml_delete_buffer(YY_CURRENT_BUFFER );
1742 YY_CURRENT_BUFFER_LVALUE = NULL;
1743 if ((gml_buffer_stack_top) > 0)
1744 --(gml_buffer_stack_top);
1745
1746 if (YY_CURRENT_BUFFER) {
1747 gml_load_buffer_state( );
1748 (gml_did_buffer_switch_on_eof) = 1;
1749 }
1750}
1751
1752/* Allocates the stack if it does not exist.
1753 * Guarantees space for at least one push.
1754 */
1755static void gmlensure_buffer_stack (void)
1756{
1757 gml_size_t num_to_alloc;
1758
1759 if (!(gml_buffer_stack)) {
1760
1761 /* First allocation is just for 2 elements, since we don't know if this
1762 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1763 * immediate realloc on the next call.
1764 */
1765 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
1766 (gml_buffer_stack) = (struct gml_buffer_state**)gmlalloc
1767 (num_to_alloc * sizeof(struct gml_buffer_state*)
1768 );
1769 if ( ! (gml_buffer_stack) )
1770 YY_FATAL_ERROR( "out of dynamic memory in gmlensure_buffer_stack()" );
1771
1772 memset((gml_buffer_stack), 0, num_to_alloc * sizeof(struct gml_buffer_state*));
1773
1774 (gml_buffer_stack_max) = num_to_alloc;
1775 (gml_buffer_stack_top) = 0;
1776 return;
1777 }
1778
1779 if ((gml_buffer_stack_top) >= ((gml_buffer_stack_max)) - 1){
1780
1781 /* Increase the buffer to prepare for a possible push. */
1782 gml_size_t grow_size = 8 /* arbitrary grow size */;
1783
1784 num_to_alloc = (gml_buffer_stack_max) + grow_size;
1785 (gml_buffer_stack) = (struct gml_buffer_state**)gmlrealloc
1786 ((gml_buffer_stack),
1787 num_to_alloc * sizeof(struct gml_buffer_state*)
1788 );
1789 if ( ! (gml_buffer_stack) )
1790 YY_FATAL_ERROR( "out of dynamic memory in gmlensure_buffer_stack()" );
1791
1792 /* zero only the new slots.*/
1793 memset((gml_buffer_stack) + (gml_buffer_stack_max), 0, grow_size * sizeof(struct gml_buffer_state*));
1794 (gml_buffer_stack_max) = num_to_alloc;
1795 }
1796}
1797
1798/** Setup the input buffer state to scan directly from a user-specified character buffer.
1799 * @param base the character buffer
1800 * @param size the size in bytes of the character buffer
1801 *
1802 * @return the newly allocated buffer state object.
1803 */
1804YY_BUFFER_STATE gml_scan_buffer (char * base, gml_size_t size )
1805{
1806 YY_BUFFER_STATE b;
1807
1808 if ( size < 2 ||
1809 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1810 base[size-1] != YY_END_OF_BUFFER_CHAR )
1811 /* They forgot to leave room for the EOB's. */
1812 return NULL;
1813
1814 b = (YY_BUFFER_STATE) gmlalloc( sizeof( struct gml_buffer_state ) );
1815 if ( ! b )
1816 YY_FATAL_ERROR( "out of dynamic memory in gml_scan_buffer()" );
1817
1818 b->gml_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
1819 b->gml_buf_pos = b->gml_ch_buf = base;
1820 b->gml_is_our_buffer = 0;
1821 b->gml_input_file = NULL;
1822 b->gml_n_chars = b->gml_buf_size;
1823 b->gml_is_interactive = 0;
1824 b->gml_at_bol = 1;
1825 b->gml_fill_buffer = 0;
1826 b->gml_buffer_status = YY_BUFFER_NEW;
1827
1828 gml_switch_to_buffer( b );
1829
1830 return b;
1831}
1832
1833/** Setup the input buffer state to scan a string. The next call to gmllex() will
1834 * scan from a @e copy of @a str.
1835 * @param gmlstr a NUL-terminated string to scan
1836 *
1837 * @return the newly allocated buffer state object.
1838 * @note If you want to scan bytes that may contain NUL values, then use
1839 * gml_scan_bytes() instead.
1840 */
1841YY_BUFFER_STATE gml_scan_string (const char * gmlstr )
1842{
1843
1844 return gml_scan_bytes( gmlstr, (int) strlen(gmlstr) );
1845}
1846
1847/** Setup the input buffer state to scan the given bytes. The next call to gmllex() will
1848 * scan from a @e copy of @a bytes.
1849 * @param gmlbytes the byte buffer to scan
1850 * @param _gmlbytes_len the number of bytes in the buffer pointed to by @a bytes.
1851 *
1852 * @return the newly allocated buffer state object.
1853 */
1854YY_BUFFER_STATE gml_scan_bytes (const char * gmlbytes, int _gmlbytes_len )
1855{
1856 YY_BUFFER_STATE b;
1857 char *buf;
1858 gml_size_t n;
1859 int i;
1860
1861 /* Get memory for full buffer, including space for trailing EOB's. */
1862 n = (gml_size_t) (_gmlbytes_len + 2);
1863 buf = (char *) gmlalloc( n );
1864 if ( ! buf )
1865 YY_FATAL_ERROR( "out of dynamic memory in gml_scan_bytes()" );
1866
1867 for ( i = 0; i < _gmlbytes_len; ++i )
1868 buf[i] = gmlbytes[i];
1869
1870 buf[_gmlbytes_len] = buf[_gmlbytes_len+1] = YY_END_OF_BUFFER_CHAR;
1871
1872 b = gml_scan_buffer( buf, n );
1873 if ( ! b )
1874 YY_FATAL_ERROR( "bad buffer in gml_scan_bytes()" );
1875
1876 /* It's okay to grow etc. this buffer, and we should throw it
1877 * away when we're done.
1878 */
1879 b->gml_is_our_buffer = 1;
1880
1881 return b;
1882}
1883
1884#ifndef YY_EXIT_FAILURE
1885#define YY_EXIT_FAILURE 2
1886#endif
1887
1888static void gmlnoreturn gml_fatal_error (const char* msg )
1889{
1890 fprintf( stderr, "%s\n", msg );
1891 exit( YY_EXIT_FAILURE );
1892}
1893
1894/* Redefine gmlless() so it works in section 3 code. */
1895
1896#undef gmlless
1897#define gmlless(n) \
1898 do \
1899 { \
1900 /* Undo effects of setting up gmltext. */ \
1901 int gmlless_macro_arg = (n); \
1902 YY_LESS_LINENO(gmlless_macro_arg);\
1903 gmltext[gmlleng] = (gml_hold_char); \
1904 (gml_c_buf_p) = gmltext + gmlless_macro_arg; \
1905 (gml_hold_char) = *(gml_c_buf_p); \
1906 *(gml_c_buf_p) = '\0'; \
1907 gmlleng = gmlless_macro_arg; \
1908 } \
1909 while ( 0 )
1910
1911/* Accessor methods (get/set functions) to struct members. */
1912
1913/** Get the current line number.
1914 *
1915 */
1916int gmlget_lineno (void)
1917{
1918
1919 return gmllineno;
1920}
1921
1922/** Get the input stream.
1923 *
1924 */
1925FILE *gmlget_in (void)
1926{
1927 return gmlin;
1928}
1929
1930/** Get the output stream.
1931 *
1932 */
1933FILE *gmlget_out (void)
1934{
1935 return gmlout;
1936}
1937
1938/** Get the length of the current token.
1939 *
1940 */
1941int gmlget_leng (void)
1942{
1943 return gmlleng;
1944}
1945
1946/** Get the current token.
1947 *
1948 */
1949
1950char *gmlget_text (void)
1951{
1952 return gmltext;
1953}
1954
1955/** Set the current line number.
1956 * @param _line_number line number
1957 *
1958 */
1959void gmlset_lineno (int _line_number )
1960{
1961
1962 gmllineno = _line_number;
1963}
1964
1965/** Set the input stream. This does not discard the current
1966 * input buffer.
1967 * @param _in_str A readable stream.
1968 *
1969 * @see gml_switch_to_buffer
1970 */
1971void gmlset_in (FILE * _in_str )
1972{
1973 gmlin = _in_str ;
1974}
1975
1976void gmlset_out (FILE * _out_str )
1977{
1978 gmlout = _out_str ;
1979}
1980
1981int gmlget_debug (void)
1982{
1983 return gml_flex_debug;
1984}
1985
1986void gmlset_debug (int _bdebug )
1987{
1988 gml_flex_debug = _bdebug ;
1989}
1990
1991static int gml_init_globals (void)
1992{
1993 /* Initialization is the same as for the non-reentrant scanner.
1994 * This function is called from gmllex_destroy(), so don't allocate here.
1995 */
1996
1997 (gml_buffer_stack) = NULL;
1998 (gml_buffer_stack_top) = 0;
1999 (gml_buffer_stack_max) = 0;
2000 (gml_c_buf_p) = NULL;
2001 (gml_init) = 0;
2002 (gml_start) = 0;
2003
2004/* Defined in main.c */
2005#ifdef YY_STDINIT
2006 gmlin = stdin;
2007 gmlout = stdout;
2008#else
2009 gmlin = NULL;
2010 gmlout = NULL;
2011#endif
2012
2013 /* For future reference: Set errno on error, since we are called by
2014 * gmllex_init()
2015 */
2016 return 0;
2017}
2018
2019/* gmllex_destroy is for both reentrant and non-reentrant scanners. */
2020int gmllex_destroy (void)
2021{
2022
2023 /* Pop the buffer stack, destroying each element. */
2024 while(YY_CURRENT_BUFFER){
2025 gml_delete_buffer( YY_CURRENT_BUFFER );
2026 YY_CURRENT_BUFFER_LVALUE = NULL;
2027 gmlpop_buffer_state();
2028 }
2029
2030 /* Destroy the stack itself. */
2031 gmlfree((gml_buffer_stack) );
2032 (gml_buffer_stack) = NULL;
2033
2034 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2035 * gmllex() is called, initialization will occur. */
2036 gml_init_globals( );
2037
2038 return 0;
2039}
2040
2041/*
2042 * Internal utility routines.
2043 */
2044
2045#ifndef gmltext_ptr
2046static void gml_flex_strncpy (char* s1, const char * s2, int n )
2047{
2048
2049 int i;
2050 for ( i = 0; i < n; ++i )
2051 s1[i] = s2[i];
2052}
2053#endif
2054
2055#ifdef YY_NEED_STRLEN
2056static int gml_flex_strlen (const char * s )
2057{
2058 int n;
2059 for ( n = 0; s[n]; ++n )
2060 ;
2061
2062 return n;
2063}
2064#endif
2065
2066void *gmlalloc (gml_size_t size )
2067{
2068 return malloc(size);
2069}
2070
2071void *gmlrealloc (void * ptr, gml_size_t size )
2072{
2073
2074 /* The cast to (char *) in the following accommodates both
2075 * implementations that use char* generic pointers, and those
2076 * that use void* generic pointers. It works with the latter
2077 * because both ANSI C and C++ allow castless assignment from
2078 * any pointer type to void*, and deal with argument conversions
2079 * as though doing an assignment.
2080 */
2081 return realloc(ptr, size);
2082}
2083
2084void gmlfree (void * ptr )
2085{
2086 free( (char *) ptr ); /* see gmlrealloc() for (char *) cast */
2087}
2088
2089#define YYTABLES_NAME "gmltables"
2090
2091#line 119 "gmlscan.l"
2092
2093
2094void gmlerror(char *str)
2095{
2096 char buf[BUFSIZ];
2097 if (errors)
2098 return;
2099 errors = 1;
2100 sprintf(buf," %s in line %d near '%s'\n", str,line_num,gmltext);
2101 agerr(AGWARN, "%s", buf);
2102}
2103
2104int gmlerrors()
2105{
2106 return errors;
2107}
2108
2109void gmllexeof() { unput(GRAPH_EOF_TOKEN); }
2110
2111#ifndef YY_CALL_ONLY_ARG
2112# define YY_CALL_ONLY_ARG void
2113#endif
2114
2115int gmlwrap(YY_CALL_ONLY_ARG)
2116{
2117 return 1;
2118}
2119
2120
2121