OSDN Git Service

Initial Import
[nethackexpress/trunk.git] / sys / share / dgn_lex.c
1 /* A lexical scanner for NetHack generated by flex */
2
3 /* Scanner skeleton version:
4  * flexhack.skl 3.3.0 (from .../flex/RCS/flex.skl,v 2.85 95/04/24 10:48:47)
5  */
6 #define FLEXHACK_SCANNER
7 #define YY_FLEX_MAJOR_VERSION 2
8 #define YY_FLEX_MINOR_VERSION 5
9
10 #include "config.h"
11 #define yyconst const   /* some code inserted by flex will refer to yyconst */
12
13 /* Returned upon end-of-file. */
14 #define YY_NULL 0
15
16 /* Promotes a possibly negative, possibly signed char to an unsigned
17  * integer for use as an array index.  If the signed char is negative,
18  * we want to instead treat it as an 8-bit unsigned char, hence the
19  * double cast.
20  */
21 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
22
23 /* Enter a start condition.  This macro really ought to take a parameter,
24  * but we do it the disgusting crufty way forced on us by the ()-less
25  * definition of BEGIN.
26  */
27 #define BEGIN yy_start = 1 + 2 *
28
29 /* Translate the current start state into a value that can be later handed
30  * to BEGIN to return to the state.  The YYSTATE alias is for lex
31  * compatibility.
32  */
33 #define YY_START ((yy_start - 1) / 2)
34 #define YYSTATE YY_START
35
36 /* Action number for EOF rule of a given start state. */
37 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
38
39 /* Special action meaning "start processing a new file". */
40 #define YY_NEW_FILE yyrestart( yyin )
41
42 #define YY_END_OF_BUFFER_CHAR 0
43
44 /* Size of default input buffer. */
45 #define YY_BUF_SIZE 16384
46
47 typedef struct yy_buffer_state *YY_BUFFER_STATE;
48
49 extern int yyleng;
50 extern FILE *yyin, *yyout;
51
52 #define EOB_ACT_CONTINUE_SCAN 0
53 #define EOB_ACT_END_OF_FILE 1
54 #define EOB_ACT_LAST_MATCH 2
55
56 /* Return all but the first 'n' matched characters back to the input stream. */
57 #define yyless(n) \
58         do \
59                 { \
60                 /* Undo effects of setting up yytext. */ \
61                 *yy_cp = yy_hold_char; \
62                 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
63                 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
64                 } \
65         while ( 0 )
66
67 #define unput(c) yyunput( c, yytext_ptr )
68
69 /* The following is because we cannot portably get our hands on size_t
70  * (without autoconf's help, which isn't available because we want
71  * flex-generated scanners to compile on their own).
72  */
73 typedef unsigned int yy_size_t;
74
75
76 struct yy_buffer_state
77         {
78         FILE *yy_input_file;
79
80         char *yy_ch_buf;                /* input buffer */
81         char *yy_buf_pos;               /* current position in input buffer */
82
83         /* Size of input buffer in bytes, not including room for EOB
84          * characters.
85          */
86         yy_size_t yy_buf_size;
87
88         /* Number of characters read into yy_ch_buf, not including EOB
89          * characters.
90          */
91         int yy_n_chars;
92
93         /* Whether we "own" the buffer - i.e., we know we created it,
94          * and can realloc() it to grow it, and should free() it to
95          * delete it.
96          */
97         int yy_is_our_buffer;
98
99         /* Whether this is an "interactive" input source; if so, and
100          * if we're using stdio for input, then we want to use getc()
101          * instead of fread(), to make sure we stop fetching input after
102          * each newline.
103          */
104         int yy_is_interactive;
105
106         /* Whether we're considered to be at the beginning of a line.
107          * If so, '^' rules will be active on the next match, otherwise
108          * not.
109          */
110         int yy_at_bol;
111
112         /* Whether to try to fill the input buffer when we reach the
113          * end of it.
114          */
115         int yy_fill_buffer;
116
117         int yy_buffer_status;
118 #define YY_BUFFER_NEW 0
119 #define YY_BUFFER_NORMAL 1
120         /* When an EOF's been seen but there's still some text to process
121          * then we mark the buffer as YY_EOF_PENDING, to indicate that we
122          * shouldn't try reading from the input source any more.  We might
123          * still have a bunch of tokens to match, though, because of
124          * possible backing-up.
125          *
126          * When we actually see the EOF, we change the status to "new"
127          * (via yyrestart()), so that the user can continue scanning by
128          * just pointing yyin at a new input file.
129          */
130 #define YY_BUFFER_EOF_PENDING 2
131         };
132
133 static YY_BUFFER_STATE yy_current_buffer = 0;
134
135 /* We provide macros for accessing buffer states in case in the
136  * future we want to put the buffer states in a more general
137  * "scanner state".
138  */
139 #define YY_CURRENT_BUFFER yy_current_buffer
140
141 /* yy_hold_char holds the character lost when yytext is formed. */
142 static char yy_hold_char;
143
144 static int yy_n_chars;          /* number of characters read into yy_ch_buf */
145
146 int yyleng;
147
148 /* Points to current character in buffer. */
149 static char *yy_c_buf_p = (char *) 0;
150 static int yy_init = 1;         /* whether we need to initialize */
151 static int yy_start = 0;        /* start state number */
152
153 /* Flag which is used to allow yywrap()'s to do buffer switches
154  * instead of setting up a fresh yyin.  A bit of a hack ...
155  */
156 static int yy_did_buffer_switch_on_eof;
157
158 void FDECL(yyrestart, (FILE *));
159
160 void FDECL(yy_switch_to_buffer, (YY_BUFFER_STATE));
161 void NDECL(yy_load_buffer_state);
162 YY_BUFFER_STATE FDECL(yy_create_buffer, (FILE *,int));
163 void FDECL(yy_delete_buffer, (YY_BUFFER_STATE));
164 void FDECL(yy_init_buffer, (YY_BUFFER_STATE,FILE *));
165 void FDECL(yy_flush_buffer, (YY_BUFFER_STATE));
166 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
167
168 static genericptr_t FDECL(yy_flex_alloc, (yy_size_t));
169 static genericptr_t FDECL(yy_flex_realloc2, (genericptr_t,yy_size_t,int));
170 static void FDECL(yy_flex_free, (genericptr_t));
171
172 #define yy_new_buffer yy_create_buffer
173
174 #define yy_set_interactive(is_interactive) \
175         { \
176         if ( ! yy_current_buffer ) \
177                 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
178         yy_current_buffer->yy_is_interactive = is_interactive; \
179         }
180
181 #define yy_set_bol(at_bol) \
182         { \
183         if ( ! yy_current_buffer ) \
184                 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
185         yy_current_buffer->yy_at_bol = at_bol; \
186         }
187
188 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
189
190 typedef unsigned char YY_CHAR;
191 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
192 typedef int yy_state_type;
193 extern char *yytext;
194 #define yytext_ptr yytext
195
196 static yy_state_type NDECL(yy_get_previous_state);
197 static yy_state_type FDECL(yy_try_NUL_trans, (yy_state_type));
198 static int NDECL(yy_get_next_buffer);
199 static void FDECL(yy_fatal_error, (const char *));
200
201 /* Done after the current pattern has been matched and before the
202  * corresponding action - sets up yytext.
203  */
204 #define YY_DO_BEFORE_ACTION \
205         yytext_ptr = yy_bp; \
206         yyleng = (int) (yy_cp - yy_bp); \
207         yy_hold_char = *yy_cp; \
208         *yy_cp = '\0'; \
209         yy_c_buf_p = yy_cp;
210
211 #define YY_NUM_RULES 35
212 #define YY_END_OF_BUFFER 36
213 static yyconst short int yy_accept[196] =
214     {   0,
215         0,    0,   36,   34,   33,   32,   34,   34,   29,   34,
216        34,   34,   34,   34,   34,   34,   34,   34,   34,   34,
217        34,   34,   34,   34,   34,   34,   34,   34,   34,   33,
218        32,    0,   30,   29,    0,    0,    0,    0,    0,    0,
219         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
220         0,    0,    0,    0,    0,    2,    0,   31,    0,    0,
221         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
222         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
223         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
224         0,    0,    3,    0,    0,    0,    0,    0,    0,    0,
225
226         0,    0,    0,   14,    0,    0,    0,    0,    0,    0,
227         4,    0,   25,    0,    0,    0,    0,    0,    0,    0,
228         0,    0,    6,    0,    0,    0,    5,    0,    0,   23,
229         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
230         0,   20,    0,    0,    0,    0,    8,    0,    0,    0,
231         0,    0,    0,    1,    0,    0,    0,    0,    0,   22,
232        15,    0,   21,    7,   19,    0,    0,    0,    0,    0,
233         0,   13,    0,    0,    0,   26,   16,    0,    0,   12,
234         0,    0,    0,   11,    9,    0,   17,   18,    0,   27,
235         0,   28,   24,   10,    0
236
237     } ;
238
239 static yyconst int yy_ec[256] =
240     {   0,
241         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
242         1,    1,    4,    1,    1,    1,    1,    1,    1,    1,
243         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
244         1,    2,    1,    5,    6,    1,    1,    1,    1,    1,
245         1,    1,    1,    1,    7,    1,    1,    7,    7,    7,
246         7,    7,    7,    7,    7,    7,    7,    1,    1,    1,
247         1,    1,    1,    1,    8,    9,   10,   11,   12,   13,
248        14,   15,   16,    1,    1,   17,   18,   19,   20,   21,
249         1,   22,   23,   24,   25,   26,    1,    1,   27,    1,
250         1,    1,    1,    1,   28,    1,   29,    1,   30,   31,
251
252        32,   33,   34,   35,   36,    1,   37,   38,   39,   40,
253        41,   42,    1,   43,   44,   45,   46,    1,   47,    1,
254         1,   48,    1,    1,    1,    1,    1,    1,    1,    1,
255         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
256         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
257         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
258         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
259         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
260         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
261         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
262
263         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
264         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
265         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
266         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
267         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
268         1,    1,    1,    1,    1
269     } ;
270
271 static yyconst int yy_meta[49] =
272     {   0,
273         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
274         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
275         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
276         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
277         1,    1,    1,    1,    1,    1,    1,    1
278     } ;
279
280 static yyconst short int yy_base[198] =
281     {   0,
282         0,  213,  218,  220,  215,  220,  213,  210,  207,  196,
283       190,  196,   37,  191,  197,  186,  188,  171,  164,  172,
284       174,  173,   18,  160,  159,  154,  157,   11,  194,  194,
285       220,  190,  220,  187,  177,  184,  183,  167,  170,  164,
286       161,  166,  174,  155,  136,  144,  134,  132,  133,   26,
287       135,  143,  147,  128,  145,  220,  170,  220,  158,  152,
288       154,  159,  154,  145,   44,  142,   47,  124,  124,  125,
289       129,  129,  115,   27,  121,  113,  111,  120,  115,  116,
290       134,  142,  132,  128,  137,  121,  130,  129,  125,  129,
291       131,   97,  220,  105,   94,  101,   95,   96,   94,   99,
292
293       105,  101,   89,  220,   95,  112,  114,   51,  112,  107,
294       220,  110,  114,  111,  106,   96,   85,   76,   81,   82,
295        88,   69,  220,   81,   76,   75,  220,   78,   99,  220,
296        88,   97,   87,   88,   92,   93,   88,   91,   90,   71,
297        65,  220,   62,   60,   57,   56,  220,   59,   54,   74,
298        84,   65,   66,  220,   70,   65,   70,   60,   68,  220,
299       220,   52,  220,  220,  220,   46,   50,   57,   61,   67,
300        62,  220,   67,   64,   63,  220,  220,   42,   41,  220,
301        61,   53,   49,  220,  220,   50,  220,  220,   51,  220,
302        46,  220,  220,  220,  220,   62,   60
303
304     } ;
305
306 static yyconst short int yy_def[198] =
307     {   0,
308       195,    1,  195,  195,  195,  195,  195,  196,  195,  195,
309       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
310       195,  195,  195,  195,  195,  195,  195,  195,  197,  195,
311       195,  196,  195,  195,  195,  195,  195,  195,  195,  195,
312       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
313       195,  195,  195,  195,  195,  195,  197,  195,  195,  195,
314       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
315       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
316       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
317       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
318
319       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
320       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
321       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
322       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
323       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
324       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
325       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
326       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
327       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
328       195,  195,  195,  195,    0,  195,  195
329
330     } ;
331
332 static yyconst short int yy_nxt[269] =
333     {   0,
334         4,    5,    6,    7,    8,    4,    9,   10,   11,   12,
335        13,   14,    4,    4,    4,    4,   15,    4,    4,    4,
336        16,   17,    4,    4,    4,    4,    4,    4,    4,   18,
337        19,    4,    4,    4,   20,    4,    4,   21,   22,   23,
338         4,   24,   25,   26,   27,   28,    4,    4,   38,   49,
339        55,   87,   56,   74,   75,   88,   90,   98,   50,  131,
340        57,   39,   32,   91,  194,  193,  192,  132,  191,  190,
341       189,  188,   99,  187,  186,  185,  184,  183,  182,  181,
342       180,  179,  178,  177,  176,  175,  174,  173,  172,  171,
343       170,  169,  168,  167,  166,  165,  164,  163,  162,  161,
344
345       160,  159,  158,  157,  156,  155,  154,  153,  152,  151,
346       150,  149,  148,  147,  146,  145,  144,  143,  142,  141,
347       140,  139,  138,  137,  136,  135,  134,  133,  130,  129,
348       128,  127,  126,  125,  124,  123,  122,  121,  120,  119,
349       118,  117,  116,  115,  114,  113,  112,  111,  110,  109,
350       108,  107,  106,  105,  104,  103,  102,  101,  100,   97,
351        96,   95,   94,   93,   92,   89,   86,   85,   84,   83,
352        82,   81,   58,   80,   79,   78,   77,   76,   73,   72,
353        71,   70,   69,   68,   67,   66,   65,   64,   63,   62,
354        61,   60,   59,   34,   33,   30,   58,   54,   53,   52,
355
356        51,   48,   47,   46,   45,   44,   43,   42,   41,   40,
357        37,   36,   35,   34,   33,   31,   30,  195,   29,    3,
358       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
359       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
360       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
361       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
362       195,  195,  195,  195,  195,  195,  195,  195
363     } ;
364
365 static yyconst short int yy_chk[269] =
366     {   0,
367         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
368         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
369         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
370         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
371         1,    1,    1,    1,    1,    1,    1,    1,   13,   23,
372        28,   65,   28,   50,   50,   65,   67,   74,   23,  108,
373       197,   13,  196,   67,  191,  189,  186,  108,  183,  182,
374       181,  179,   74,  178,  175,  174,  173,  171,  170,  169,
375       168,  167,  166,  162,  159,  158,  157,  156,  155,  153,
376       152,  151,  150,  149,  148,  146,  145,  144,  143,  141,
377
378       140,  139,  138,  137,  136,  135,  134,  133,  132,  131,
379       129,  128,  126,  125,  124,  122,  121,  120,  119,  118,
380       117,  116,  115,  114,  113,  112,  110,  109,  107,  106,
381       105,  103,  102,  101,  100,   99,   98,   97,   96,   95,
382        94,   92,   91,   90,   89,   88,   87,   86,   85,   84,
383        83,   82,   81,   80,   79,   78,   77,   76,   75,   73,
384        72,   71,   70,   69,   68,   66,   64,   63,   62,   61,
385        60,   59,   57,   55,   54,   53,   52,   51,   49,   48,
386        47,   46,   45,   44,   43,   42,   41,   40,   39,   38,
387        37,   36,   35,   34,   32,   30,   29,   27,   26,   25,
388
389        24,   22,   21,   20,   19,   18,   17,   16,   15,   14,
390        12,   11,   10,    9,    8,    7,    5,    3,    2,  195,
391       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
392       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
393       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
394       195,  195,  195,  195,  195,  195,  195,  195,  195,  195,
395       195,  195,  195,  195,  195,  195,  195,  195
396     } ;
397
398 static yy_state_type yy_last_accepting_state;
399 static char *yy_last_accepting_cpos;
400
401 /* The intent behind this definition is that it'll catch
402  * any uses of REJECT which flex missed.
403  */
404 #define REJECT reject_used_but_not_detected
405 #define yymore() yymore_used_but_not_detected
406 #define YY_MORE_ADJ 0
407 char *yytext;
408 #define INITIAL 0
409 /*      SCCS Id: @(#)dgn_lex.c  3.4     2002/03/27      */
410 /*      Copyright (c) 1989 by Jean-Christophe Collet */
411 /*      Copyright (c) 1990 by M. Stephenson          */
412 /* NetHack may be freely redistributed.  See license for details. */
413
414 #define DGN_COMP
415
416 #include "config.h"
417 #include "dgn_comp.h"
418 #include "dgn_file.h"
419
420 /*
421  * Most of these don't exist in flex, yywrap is macro and
422  * yyunput is properly declared in flex.skel.
423  */
424 #if !defined(FLEX_SCANNER) && !defined(FLEXHACK_SCANNER)
425 int FDECL(yyback, (int *,int));
426 int NDECL(yylook);
427 int NDECL(yyinput);
428 int NDECL(yywrap);
429 int NDECL(yylex);
430         /* Traditional lexes let yyunput() and yyoutput() default to int;
431          * newer ones may declare them as void since they don't return
432          * values.  For even more fun, the lex supplied as part of the
433          * newer unbundled compiler for SunOS 4.x adds the void declarations
434          * (under __STDC__ or _cplusplus ifdefs -- otherwise they remain
435          * int) while the bundled lex and the one with the older unbundled
436          * compiler do not.  To detect this, we need help from outside --
437          * sys/unix/Makefile.utl.
438          *
439          * Digital UNIX is difficult and still has int in spite of all
440          * other signs.
441          */
442 # if defined(NeXT) || defined(SVR4) || defined(_AIX32)
443 #  define VOIDYYPUT
444 # endif
445 # if !defined(VOIDYYPUT) && defined(POSIX_TYPES)
446 #  if !defined(BOS) && !defined(HISX) && !defined(_M_UNIX) && !defined(VMS)
447 #   define VOIDYYPUT
448 #  endif
449 # endif
450 # if !defined(VOIDYYPUT) && defined(WEIRD_LEX)
451 #  if defined(SUNOS4) && defined(__STDC__) && (WEIRD_LEX > 1)
452 #   define VOIDYYPUT
453 #  endif
454 # endif
455 # if defined(VOIDYYPUT) && defined(__osf__)
456 #  undef VOIDYYPUT
457 # endif
458 # ifdef VOIDYYPUT
459 void FDECL(yyunput, (int));
460 void FDECL(yyoutput, (int));
461 # else
462 int FDECL(yyunput, (int));
463 int FDECL(yyoutput, (int));
464 # endif
465 #endif  /* !FLEX_SCANNER && !FLEXHACK_SCANNER */
466
467 #ifdef FLEX_SCANNER
468 #define YY_MALLOC_DECL \
469                genericptr_t FDECL(malloc, (size_t)); \
470                genericptr_t FDECL(realloc, (genericptr_t,size_t));
471 #endif
472
473
474 void FDECL(init_yyin, (FILE *));
475 void FDECL(init_yyout, (FILE *));
476
477 /* this doesn't always get put in dgn_comp.h
478  * (esp. when using older versions of bison)
479  */
480
481 extern YYSTYPE yylval;
482
483 int line_number = 1;
484
485
486 /* Macros after this point can all be overridden by user definitions in
487  * section 1.
488  */
489
490 #ifndef YY_SKIP_YYWRAP
491 extern int NDECL(yywrap);
492 #endif
493
494 #ifndef YY_NO_UNPUT
495 static void FDECL(yyunput, (int,char *));
496 #endif
497
498 #ifndef yytext_ptr
499 static void FDECL(yy_flex_strncpy, (char *,const char *,int));
500 #endif
501
502 #ifndef YY_NO_INPUT
503 static int NDECL(input);
504 #endif
505
506 /* Amount of stuff to slurp up with each read. */
507 #ifndef YY_READ_BUF_SIZE
508 #define YY_READ_BUF_SIZE 8192
509 #endif
510
511 /* Copy whatever the last rule matched to the standard output. */
512
513 #ifndef ECHO
514 /* This used to be an fputs(), but since the string might contain NUL's,
515  * we now use fwrite().
516  */
517 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
518 #endif
519
520 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
521  * is returned in "result".
522  */
523 #ifndef YY_INPUT
524 #define YY_INPUT(buf,result,max_size) \
525         if ( yy_current_buffer->yy_is_interactive ) \
526                 { \
527                 int c = '*', n; \
528                 for ( n = 0; n < max_size && \
529                              (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
530                         buf[n] = (char) c; \
531                 if ( c == '\n' ) \
532                         buf[n++] = (char) c; \
533                 if ( c == EOF && ferror( yyin ) ) \
534                         YY_FATAL_ERROR( "input in flex scanner failed" ); \
535                 result = n; \
536                 } \
537         else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
538                   && ferror( yyin ) ) \
539                 YY_FATAL_ERROR( "input in flex scanner failed" );
540 #endif
541
542 /* No semi-colon after return; correct usage is to write "yyterminate();" -
543  * we don't want an extra ';' after the "return" because that will cause
544  * some compilers to complain about unreachable statements.
545  */
546 #ifndef yyterminate
547 #define yyterminate() return YY_NULL
548 #endif
549
550 /* Number of entries by which start-condition stack grows. */
551 #ifndef YY_START_STACK_INCR
552 #define YY_START_STACK_INCR 25
553 #endif
554
555 /* Report a fatal error. */
556 #ifndef YY_FATAL_ERROR
557 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
558 #endif
559
560 /* Code executed at the beginning of each rule, after yytext and yyleng
561  * have been set up.
562  */
563 #ifndef YY_USER_ACTION
564 #define YY_USER_ACTION
565 #endif
566
567 /* Code executed at the end of each rule. */
568 #ifndef YY_BREAK
569 #define YY_BREAK break;
570 #endif
571
572 #define YY_RULE_SETUP \
573         if ( yyleng > 0 ) \
574                 yy_current_buffer->yy_at_bol = \
575                                 (yytext[yyleng - 1] == '\n'); \
576         YY_USER_ACTION
577
578 int NDECL(yylex);
579 int yylex()
580         {
581         register yy_state_type yy_current_state;
582         register char *yy_cp, *yy_bp;
583         register int yy_act;
584
585
586
587         if ( yy_init )
588                 {
589                 yy_init = 0;
590
591 #ifdef YY_USER_INIT
592                 YY_USER_INIT;
593 #endif
594
595                 if ( ! yy_start )
596                         yy_start = 1;   /* first start state */
597
598                 if ( ! yyin )
599                         yyin = stdin;
600
601                 if ( ! yyout )
602                         yyout = stdout;
603
604                 if ( ! yy_current_buffer )
605                         yy_current_buffer =
606                                 yy_create_buffer( yyin, YY_BUF_SIZE );
607
608                 yy_load_buffer_state();
609                 }
610
611         while ( 1 )             /* loops until end-of-file is reached */
612                 {
613                 yy_cp = yy_c_buf_p;
614
615                 /* Support of yytext. */
616                 *yy_cp = yy_hold_char;
617
618                 /* yy_bp points to the position in yy_ch_buf of the start of
619                  * the current run.
620                  */
621                 yy_bp = yy_cp;
622
623                 yy_current_state = yy_start;
624                 yy_current_state += YY_AT_BOL();
625 yy_match:
626                 do
627                         {
628                         register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
629                         if ( yy_accept[yy_current_state] )
630                                 {
631                                 yy_last_accepting_state = yy_current_state;
632                                 yy_last_accepting_cpos = yy_cp;
633                                 }
634                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
635                                 {
636                                 yy_current_state = (int) yy_def[yy_current_state];
637                                 if ( yy_current_state >= 196 )
638                                         yy_c = yy_meta[(unsigned int) yy_c];
639                                 }
640                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
641                         ++yy_cp;
642                         }
643                 while ( yy_base[yy_current_state] != 220 );
644
645 yy_find_action:
646                 yy_act = yy_accept[yy_current_state];
647                 if ( yy_act == 0 )
648                         { /* have to back up */
649                         yy_cp = yy_last_accepting_cpos;
650                         yy_current_state = yy_last_accepting_state;
651                         yy_act = yy_accept[yy_current_state];
652                         }
653
654                 YY_DO_BEFORE_ACTION;
655
656
657 do_action:      /* This label is used only to access EOF actions. */
658
659
660                 switch ( yy_act )
661         { /* beginning of action switch */
662                         case 0: /* must back up */
663                         /* undo the effects of YY_DO_BEFORE_ACTION */
664                         *yy_cp = yy_hold_char;
665                         yy_cp = yy_last_accepting_cpos;
666                         yy_current_state = yy_last_accepting_state;
667                         goto yy_find_action;
668
669 case 1:
670 YY_RULE_SETUP
671 return(A_DUNGEON);
672         YY_BREAK
673 case 2:
674 YY_RULE_SETUP
675 { yylval.i=1; return(UP_OR_DOWN); }
676         YY_BREAK
677 case 3:
678 YY_RULE_SETUP
679 { yylval.i=0; return(UP_OR_DOWN); }
680         YY_BREAK
681 case 4:
682 YY_RULE_SETUP
683 return(ENTRY);
684         YY_BREAK
685 case 5:
686 YY_RULE_SETUP
687 return(STAIR);
688         YY_BREAK
689 case 6:
690 YY_RULE_SETUP
691 return(NO_UP);
692         YY_BREAK
693 case 7:
694 YY_RULE_SETUP
695 return(NO_DOWN);
696         YY_BREAK
697 case 8:
698 YY_RULE_SETUP
699 return(PORTAL);
700         YY_BREAK
701 case 9:
702 YY_RULE_SETUP
703 return(PROTOFILE);
704         YY_BREAK
705 case 10:
706 YY_RULE_SETUP
707 return(DESCRIPTION);
708         YY_BREAK
709 case 11:
710 YY_RULE_SETUP
711 return(LEVELDESC);
712         YY_BREAK
713 case 12:
714 YY_RULE_SETUP
715 return(ALIGNMENT);
716         YY_BREAK
717 case 13:
718 YY_RULE_SETUP
719 return(LEVALIGN);
720         YY_BREAK
721 case 14:
722 YY_RULE_SETUP
723 { yylval.i=TOWN ; return(DESCRIPTOR); }
724         YY_BREAK
725 case 15:
726 YY_RULE_SETUP
727 { yylval.i=HELLISH ; return(DESCRIPTOR); }
728         YY_BREAK
729 case 16:
730 YY_RULE_SETUP
731 { yylval.i=MAZELIKE ; return(DESCRIPTOR); }
732         YY_BREAK
733 case 17:
734 YY_RULE_SETUP
735 { yylval.i=ROGUELIKE ; return(DESCRIPTOR); }
736         YY_BREAK
737 case 18:
738 YY_RULE_SETUP
739 { yylval.i=D_ALIGN_NONE ; return(DESCRIPTOR); }
740         YY_BREAK
741 case 19:
742 YY_RULE_SETUP
743 { yylval.i=D_ALIGN_NONE ; return(DESCRIPTOR); }
744         YY_BREAK
745 case 20:
746 YY_RULE_SETUP
747 { yylval.i=D_ALIGN_LAWFUL ; return(DESCRIPTOR); }
748         YY_BREAK
749 case 21:
750 YY_RULE_SETUP
751 { yylval.i=D_ALIGN_NEUTRAL ; return(DESCRIPTOR); }
752         YY_BREAK
753 case 22:
754 YY_RULE_SETUP
755 { yylval.i=D_ALIGN_CHAOTIC ; return(DESCRIPTOR); }
756         YY_BREAK
757 case 23:
758 YY_RULE_SETUP
759 return(BRANCH);
760         YY_BREAK
761 case 24:
762 YY_RULE_SETUP
763 return(CHBRANCH);
764         YY_BREAK
765 case 25:
766 YY_RULE_SETUP
767 return(LEVEL);
768         YY_BREAK
769 case 26:
770 YY_RULE_SETUP
771 return(RNDLEVEL);
772         YY_BREAK
773 case 27:
774 YY_RULE_SETUP
775 return(CHLEVEL);
776         YY_BREAK
777 case 28:
778 YY_RULE_SETUP
779 return(RNDCHLEVEL);
780         YY_BREAK
781 case 29:
782 YY_RULE_SETUP
783 { yylval.i=atoi(yytext); return(INTEGER); }
784         YY_BREAK
785 case 30:
786 YY_RULE_SETUP
787 { yytext[yyleng-1] = 0; /* Discard the trailing \" */
788                   yylval.str = (char *) alloc(strlen(yytext+1)+1);
789                   Strcpy(yylval.str, yytext+1); /* Discard the first \" */
790                   return(STRING); }
791         YY_BREAK
792 case 31:
793 YY_RULE_SETUP
794 { line_number++; }
795         YY_BREAK
796 case 32:
797 YY_RULE_SETUP
798 { line_number++; }
799         YY_BREAK
800 case 33:
801 YY_RULE_SETUP
802 ;       /* skip trailing tabs & spaces */
803         YY_BREAK
804 case 34:
805 YY_RULE_SETUP
806 { return yytext[0]; }
807         YY_BREAK
808 case 35:
809 YY_RULE_SETUP
810 ECHO;
811         YY_BREAK
812 case YY_STATE_EOF(INITIAL):
813         yyterminate();
814
815         case YY_END_OF_BUFFER:
816                 {
817                 /* Amount of text matched not including the EOB char. */
818                 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
819
820                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
821                 *yy_cp = yy_hold_char;
822
823                 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
824                         {
825                         /* We're scanning a new file or input source.  It's
826                          * possible that this happened because the user
827                          * just pointed yyin at a new source and called
828                          * yylex().  If so, then we have to assure
829                          * consistency between yy_current_buffer and our
830                          * globals.  Here is the right place to do so, because
831                          * this is the first action (other than possibly a
832                          * back-up) that will match for the new input source.
833                          */
834                         yy_n_chars = yy_current_buffer->yy_n_chars;
835                         yy_current_buffer->yy_input_file = yyin;
836                         yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
837                         }
838
839                 /* Note that here we test for yy_c_buf_p "<=" to the position
840                  * of the first EOB in the buffer, since yy_c_buf_p will
841                  * already have been incremented past the NUL character
842                  * (since all states make transitions on EOB to the
843                  * end-of-buffer state).  Contrast this with the test
844                  * in input().
845                  */
846                 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
847                         { /* This was really a NUL. */
848                         yy_state_type yy_next_state;
849
850                         yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
851
852                         yy_current_state = yy_get_previous_state();
853
854                         /* Okay, we're now positioned to make the NUL
855                          * transition.  We couldn't have
856                          * yy_get_previous_state() go ahead and do it
857                          * for us because it doesn't know how to deal
858                          * with the possibility of jamming (and we don't
859                          * want to build jamming into it because then it
860                          * will run more slowly).
861                          */
862
863                         yy_next_state = yy_try_NUL_trans( yy_current_state );
864
865                         yy_bp = yytext_ptr + YY_MORE_ADJ;
866
867                         if ( yy_next_state )
868                                 {
869                                 /* Consume the NUL. */
870                                 yy_cp = ++yy_c_buf_p;
871                                 yy_current_state = yy_next_state;
872                                 goto yy_match;
873                                 }
874
875                         else
876                                 {
877                                 yy_cp = yy_c_buf_p;
878                                 goto yy_find_action;
879                                 }
880                         }
881
882                 else switch ( yy_get_next_buffer() )
883                         {
884                         case EOB_ACT_END_OF_FILE:
885                                 {
886                                 yy_did_buffer_switch_on_eof = 0;
887
888                                 if ( yywrap() )
889                                         {
890                                         /* Note: because we've taken care in
891                                          * yy_get_next_buffer() to have set up
892                                          * yytext, we can now set up
893                                          * yy_c_buf_p so that if some total
894                                          * hoser (like flex itself) wants to
895                                          * call the scanner after we return the
896                                          * YY_NULL, it'll still work - another
897                                          * YY_NULL will get returned.
898                                          */
899                                         yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
900
901                                         yy_act = YY_STATE_EOF(YY_START);
902                                         goto do_action;
903                                         }
904
905                                 else
906                                         {
907                                         if ( ! yy_did_buffer_switch_on_eof )
908                                                 YY_NEW_FILE;
909                                         }
910                                 break;
911                                 }
912
913                         case EOB_ACT_CONTINUE_SCAN:
914                                 yy_c_buf_p =
915                                         yytext_ptr + yy_amount_of_matched_text;
916
917                                 yy_current_state = yy_get_previous_state();
918
919                                 yy_cp = yy_c_buf_p;
920                                 yy_bp = yytext_ptr + YY_MORE_ADJ;
921                                 goto yy_match;
922
923                         case EOB_ACT_LAST_MATCH:
924                                 yy_c_buf_p =
925                                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
926
927                                 yy_current_state = yy_get_previous_state();
928
929                                 yy_cp = yy_c_buf_p;
930                                 yy_bp = yytext_ptr + YY_MORE_ADJ;
931                                 goto yy_find_action;
932                         }
933                 break;
934                 }
935
936         default:
937                 YY_FATAL_ERROR(
938                         "fatal flex scanner internal error--no action found" );
939         } /* end of action switch */
940                 } /* end of scanning one token */
941         } /* end of yylex */
942
943
944 /* yy_get_next_buffer - try to read in a new buffer
945  *
946  * Returns a code representing an action:
947  *      EOB_ACT_LAST_MATCH -
948  *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
949  *      EOB_ACT_END_OF_FILE - end of file
950  */
951
952 static int yy_get_next_buffer()
953         {
954         register char *dest = yy_current_buffer->yy_ch_buf;
955         register char *source = yytext_ptr;
956         register int number_to_move, i;
957         int ret_val;
958
959         if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
960                 YY_FATAL_ERROR(
961                 "fatal flex scanner internal error--end of buffer missed" );
962
963         if ( yy_current_buffer->yy_fill_buffer == 0 )
964                 { /* Don't try to fill the buffer, so this is an EOF. */
965                 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
966                         {
967                         /* We matched a singled characater, the EOB, so
968                          * treat this as a final EOF.
969                          */
970                         return EOB_ACT_END_OF_FILE;
971                         }
972
973                 else
974                         {
975                         /* We matched some text prior to the EOB, first
976                          * process it.
977                          */
978                         return EOB_ACT_LAST_MATCH;
979                         }
980                 }
981
982         /* Try to read more data. */
983
984         /* First move last chars to start of buffer. */
985         number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
986
987         for ( i = 0; i < number_to_move; ++i )
988                 *(dest++) = *(source++);
989
990         if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
991                 /* don't do the read, it's not guaranteed to return an EOF,
992                  * just force an EOF
993                  */
994                 yy_n_chars = 0;
995
996         else
997                 {
998                 int num_to_read =
999                         yy_current_buffer->yy_buf_size - number_to_move - 1;
1000
1001                 while ( num_to_read <= 0 )
1002                         { /* Not enough room in the buffer - grow it. */
1003 #ifdef YY_USES_REJECT
1004                         YY_FATAL_ERROR(
1005 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1006 #else
1007
1008                         /* just a shorter name for the current buffer */
1009                         YY_BUFFER_STATE b = yy_current_buffer;
1010
1011                         int yy_c_buf_p_offset =
1012                                 (int) (yy_c_buf_p - b->yy_ch_buf);
1013
1014                         if ( b->yy_is_our_buffer )
1015                                 {
1016                                 int old_size = b->yy_buf_size + 2;
1017                                 int new_size = b->yy_buf_size * 2;
1018
1019                                 if ( new_size <= 0 )
1020                                         b->yy_buf_size += b->yy_buf_size / 8;
1021                                 else
1022                                         b->yy_buf_size *= 2;
1023
1024                                 b->yy_ch_buf = (char *)
1025                                         /* Include room in for 2 EOB chars. */
1026                                         yy_flex_realloc2( (genericptr_t) b->yy_ch_buf,
1027                                                          b->yy_buf_size + 2, old_size );
1028                                 }
1029                         else
1030                                 /* Can't grow it, we don't own it. */
1031                                 b->yy_ch_buf = 0;
1032
1033                         if ( ! b->yy_ch_buf )
1034                                 YY_FATAL_ERROR(
1035                                 "fatal error - scanner input buffer overflow" );
1036
1037                         yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1038
1039                         num_to_read = yy_current_buffer->yy_buf_size -
1040                                                 number_to_move - 1;
1041 #endif
1042                         }
1043
1044                 if ( num_to_read > YY_READ_BUF_SIZE )
1045                         num_to_read = YY_READ_BUF_SIZE;
1046
1047                 /* Read in more data. */
1048                 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1049                         yy_n_chars, num_to_read );
1050                 }
1051
1052         if ( yy_n_chars == 0 )
1053                 {
1054                 if ( number_to_move == YY_MORE_ADJ )
1055                         {
1056                         ret_val = EOB_ACT_END_OF_FILE;
1057                         yyrestart( yyin );
1058                         }
1059
1060                 else
1061                         {
1062                         ret_val = EOB_ACT_LAST_MATCH;
1063                         yy_current_buffer->yy_buffer_status =
1064                                 YY_BUFFER_EOF_PENDING;
1065                         }
1066                 }
1067
1068         else
1069                 ret_val = EOB_ACT_CONTINUE_SCAN;
1070
1071         yy_n_chars += number_to_move;
1072         yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1073         yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1074
1075         yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1076
1077         return ret_val;
1078         }
1079
1080
1081 /* yy_get_previous_state - get the state just before the EOB char was reached */
1082
1083 static yy_state_type yy_get_previous_state()
1084         {
1085         register yy_state_type yy_current_state;
1086         register char *yy_cp;
1087
1088         yy_current_state = yy_start;
1089         yy_current_state += YY_AT_BOL();
1090
1091         for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1092                 {
1093                 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1094                 if ( yy_accept[yy_current_state] )
1095                         {
1096                         yy_last_accepting_state = yy_current_state;
1097                         yy_last_accepting_cpos = yy_cp;
1098                         }
1099                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1100                         {
1101                         yy_current_state = (int) yy_def[yy_current_state];
1102                         if ( yy_current_state >= 196 )
1103                                 yy_c = yy_meta[(unsigned int) yy_c];
1104                         }
1105                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1106                 }
1107
1108         return yy_current_state;
1109         }
1110
1111
1112 /* yy_try_NUL_trans - try to make a transition on the NUL character
1113  *
1114  * synopsis
1115  *      next_state = yy_try_NUL_trans( current_state );
1116  */
1117
1118 static yy_state_type yy_try_NUL_trans( yy_current_state )
1119 yy_state_type yy_current_state;
1120         {
1121         register int yy_is_jam;
1122         register char *yy_cp = yy_c_buf_p;
1123
1124         register YY_CHAR yy_c = 1;
1125         if ( yy_accept[yy_current_state] )
1126                 {
1127                 yy_last_accepting_state = yy_current_state;
1128                 yy_last_accepting_cpos = yy_cp;
1129                 }
1130         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1131                 {
1132                 yy_current_state = (int) yy_def[yy_current_state];
1133                 if ( yy_current_state >= 196 )
1134                         yy_c = yy_meta[(unsigned int) yy_c];
1135                 }
1136         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1137         yy_is_jam = (yy_current_state == 195);
1138
1139         return yy_is_jam ? 0 : yy_current_state;
1140         }
1141
1142
1143 #ifndef YY_NO_UNPUT
1144 static void yyunput( c, yy_bp )
1145 int c;
1146 register char *yy_bp;
1147         {
1148         register char *yy_cp = yy_c_buf_p;
1149
1150         /* undo effects of setting up yytext */
1151         *yy_cp = yy_hold_char;
1152
1153         if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1154                 { /* need to shift things up to make room */
1155                 /* +2 for EOB chars. */
1156                 register int number_to_move = yy_n_chars + 2;
1157                 register char *dest = &yy_current_buffer->yy_ch_buf[
1158                                         yy_current_buffer->yy_buf_size + 2];
1159                 register char *source =
1160                                 &yy_current_buffer->yy_ch_buf[number_to_move];
1161
1162                 while ( source > yy_current_buffer->yy_ch_buf )
1163                         *--dest = *--source;
1164
1165                 yy_cp += (int) (dest - source);
1166                 yy_bp += (int) (dest - source);
1167                 yy_n_chars = yy_current_buffer->yy_buf_size;
1168
1169                 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1170                         YY_FATAL_ERROR( "flex scanner push-back overflow" );
1171                 }
1172
1173         *--yy_cp = (char) c;
1174
1175
1176         yytext_ptr = yy_bp;
1177         yy_hold_char = *yy_cp;
1178         yy_c_buf_p = yy_cp;
1179         }
1180 #endif  /* ifndef YY_NO_UNPUT */
1181
1182
1183 static int input()
1184         {
1185         int c;
1186
1187         *yy_c_buf_p = yy_hold_char;
1188
1189         if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1190                 {
1191                 /* yy_c_buf_p now points to the character we want to return.
1192                  * If this occurs *before* the EOB characters, then it's a
1193                  * valid NUL; if not, then we've hit the end of the buffer.
1194                  */
1195                 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1196                         /* This was really a NUL. */
1197                         *yy_c_buf_p = '\0';
1198
1199                 else
1200                         { /* need more input */
1201                         yytext_ptr = yy_c_buf_p;
1202                         ++yy_c_buf_p;
1203
1204                         switch ( yy_get_next_buffer() )
1205                                 {
1206                                 case EOB_ACT_END_OF_FILE:
1207                                         {
1208                                         if ( yywrap() )
1209                                                 {
1210                                                 yy_c_buf_p =
1211                                                 yytext_ptr + YY_MORE_ADJ;
1212                                                 return EOF;
1213                                                 }
1214
1215                                         if ( ! yy_did_buffer_switch_on_eof )
1216                                                 YY_NEW_FILE;
1217                                         return input();
1218                                         }
1219
1220                                 case EOB_ACT_CONTINUE_SCAN:
1221                                         yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1222                                         break;
1223
1224                                 case EOB_ACT_LAST_MATCH:
1225                                         YY_FATAL_ERROR(
1226                                         "unexpected last match in input()" );
1227                                 }
1228                         }
1229                 }
1230
1231         c = *(unsigned char *) yy_c_buf_p;      /* cast for 8-bit char's */
1232         *yy_c_buf_p = '\0';     /* preserve yytext */
1233         yy_hold_char = *++yy_c_buf_p;
1234
1235         yy_current_buffer->yy_at_bol = (c == '\n');
1236
1237         return c;
1238         }
1239
1240
1241 void yyrestart( input_file )
1242 FILE *input_file;
1243         {
1244         if ( ! yy_current_buffer )
1245                 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1246
1247         yy_init_buffer( yy_current_buffer, input_file );
1248         yy_load_buffer_state();
1249         }
1250
1251
1252 void yy_switch_to_buffer( new_buffer )
1253 YY_BUFFER_STATE new_buffer;
1254         {
1255         if ( yy_current_buffer == new_buffer )
1256                 return;
1257
1258         if ( yy_current_buffer )
1259                 {
1260                 /* Flush out information for old buffer. */
1261                 *yy_c_buf_p = yy_hold_char;
1262                 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1263                 yy_current_buffer->yy_n_chars = yy_n_chars;
1264                 }
1265
1266         yy_current_buffer = new_buffer;
1267         yy_load_buffer_state();
1268
1269         /* We don't actually know whether we did this switch during
1270          * EOF (yywrap()) processing, but the only time this flag
1271          * is looked at is after yywrap() is called, so it's safe
1272          * to go ahead and always set it.
1273          */
1274         yy_did_buffer_switch_on_eof = 1;
1275         }
1276
1277
1278 void yy_load_buffer_state()
1279         {
1280         yy_n_chars = yy_current_buffer->yy_n_chars;
1281         yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1282         yyin = yy_current_buffer->yy_input_file;
1283         yy_hold_char = *yy_c_buf_p;
1284         }
1285
1286
1287 YY_BUFFER_STATE yy_create_buffer( file, size )
1288 FILE *file;
1289 int size;
1290         {
1291         YY_BUFFER_STATE b;
1292
1293         b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1294         if ( ! b )
1295                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1296
1297         b->yy_buf_size = size;
1298
1299         /* yy_ch_buf has to be 2 characters longer than the size given because
1300          * we need to put in 2 end-of-buffer characters.
1301          */
1302         b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1303         if ( ! b->yy_ch_buf )
1304                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1305
1306         b->yy_is_our_buffer = 1;
1307
1308         yy_init_buffer( b, file );
1309
1310         return b;
1311         }
1312
1313
1314 void yy_delete_buffer( b )
1315 YY_BUFFER_STATE b;
1316         {
1317         if ( ! b )
1318                 return;
1319
1320         if ( b == yy_current_buffer )
1321                 yy_current_buffer = (YY_BUFFER_STATE) 0;
1322
1323         if ( b->yy_is_our_buffer )
1324                 yy_flex_free( (genericptr_t) b->yy_ch_buf );
1325
1326         yy_flex_free( (genericptr_t) b );
1327         }
1328
1329
1330 #ifndef YY_ALWAYS_INTERACTIVE
1331 #ifndef YY_NEVER_INTERACTIVE
1332 extern int FDECL(isatty, (int));
1333 #endif
1334 #endif
1335
1336 void yy_init_buffer( b, file )
1337 YY_BUFFER_STATE b;
1338 FILE *file;
1339         {
1340         yy_flush_buffer( b );
1341
1342         b->yy_input_file = file;
1343         b->yy_fill_buffer = 1;
1344
1345 #ifdef YY_ALWAYS_INTERACTIVE
1346         b->yy_is_interactive = 1;
1347 #else
1348 #ifdef YY_NEVER_INTERACTIVE
1349         b->yy_is_interactive = 0;
1350 #else
1351         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1352 #endif
1353 #endif
1354         }
1355
1356
1357 void yy_flush_buffer( b )
1358 YY_BUFFER_STATE b;
1359         {
1360         b->yy_n_chars = 0;
1361
1362         /* We always need two end-of-buffer characters.  The first causes
1363          * a transition to the end-of-buffer state.  The second causes
1364          * a jam in that state.
1365          */
1366         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1367         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1368
1369         b->yy_buf_pos = &b->yy_ch_buf[0];
1370
1371         b->yy_at_bol = 1;
1372         b->yy_buffer_status = YY_BUFFER_NEW;
1373
1374         if ( b == yy_current_buffer )
1375                 yy_load_buffer_state();
1376         }
1377
1378
1379
1380 #ifndef YY_EXIT_FAILURE
1381 #define YY_EXIT_FAILURE 2
1382 #endif
1383
1384 static void yy_fatal_error( msg )
1385 const char msg[];
1386         {
1387         (void) fprintf( stderr, "%s\n", msg );
1388         exit( YY_EXIT_FAILURE );
1389         }
1390
1391
1392
1393 /* Redefine yyless() so it works in section 3 code. */
1394
1395 #undef yyless
1396 #define yyless(n) \
1397         do \
1398                 { \
1399                 /* Undo effects of setting up yytext. */ \
1400                 yytext[yyleng] = yy_hold_char; \
1401                 yy_c_buf_p = yytext + n - YY_MORE_ADJ; \
1402                 yy_hold_char = *yy_c_buf_p; \
1403                 *yy_c_buf_p = '\0'; \
1404                 yyleng = n; \
1405                 } \
1406         while ( 0 )
1407
1408
1409 /* Internal utility routines. */
1410
1411 #ifndef yytext_ptr
1412 static void yy_flex_strncpy( s1, s2, n )
1413 char *s1;
1414 const char *s2;
1415 int n;
1416         {
1417         register int i;
1418         for ( i = 0; i < n; ++i )
1419                 s1[i] = s2[i];
1420         }
1421 #endif
1422
1423
1424 static genericptr_t yy_flex_alloc( size )
1425 yy_size_t size;
1426         {
1427         return (genericptr_t) alloc((unsigned)size);
1428         }
1429
1430 /* we want to avoid use of realloc(), so we require that caller supply the
1431    size of the old block of memory */
1432 static genericptr_t yy_flex_realloc2( ptr, size, old_size )
1433 genericptr_t ptr;
1434 yy_size_t size;
1435 int old_size;
1436         {
1437         genericptr_t outptr = yy_flex_alloc(size);
1438
1439         if (ptr) {
1440             char *p = (char *) outptr, *q = (char *) ptr;
1441
1442             while (--old_size >= 0) *p++ = *q++;
1443             yy_flex_free(ptr);
1444         }
1445         return outptr;
1446         }
1447
1448 static void yy_flex_free( ptr )
1449 genericptr_t ptr;
1450         {
1451         free( ptr );
1452         }
1453
1454 /*flexhack.skl*/
1455
1456
1457 /* routine to switch to another input file; needed for flex */
1458 void init_yyin( input_f )
1459 FILE *input_f;
1460 {
1461 #if defined(FLEX_SCANNER) || defined(FLEXHACK_SCANNER)
1462         if (yyin)
1463             yyrestart(input_f);
1464         else
1465 #endif
1466             yyin = input_f;
1467 }
1468 /* analogous routine (for completeness) */
1469 void init_yyout( output_f )
1470 FILE *output_f;
1471 {
1472         yyout = output_f;
1473 }
1474
1475 /*dgn_comp.l*/