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