Debian Codegraph @

random_maps/reader.c

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