ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/reader.c
Revision: 1.2
Committed: Sun Jul 2 15:11:45 2006 UTC (17 years, 11 months ago) by pippijn
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
State: FILE REMOVED
Log Message:
Removed autogenerated file

File Contents

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