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