Watt-32 tcp/ip  2.2 dev-rel.10
lang.c
1 
2 #line 3 "<stdout>"
3 
4 #define YY_INT_ALIGNED short int
5 
6 /* A lexical scanner generated by flex */
7 
8 #define yy_create_buffer _w32__create_buffer
9 #define yy_delete_buffer _w32__delete_buffer
10 #define yy_flex_debug _w32__flex_debug
11 #define yy_init_buffer _w32__init_buffer
12 #define yy_flush_buffer _w32__flush_buffer
13 #define yy_load_buffer_state _w32__load_buffer_state
14 #define yy_switch_to_buffer _w32__switch_to_buffer
15 #define yyin _w32_in
16 #define yyleng _w32_leng
17 #define yylex _w32_lex
18 #define yylineno _w32_lineno
19 #define yyout _w32_out
20 #define yyrestart _w32_restart
21 #define yytext _w32_text
22 #define yywrap _w32_wrap
23 #define yyalloc _w32_alloc
24 #define yyrealloc _w32_realloc
25 #define yyfree _w32_free
26 
27 #define FLEX_SCANNER
28 #define YY_FLEX_MAJOR_VERSION 2
29 #define YY_FLEX_MINOR_VERSION 5
30 #define YY_FLEX_SUBMINOR_VERSION 35
31 #if YY_FLEX_SUBMINOR_VERSION > 0
32 #define FLEX_BETA
33 #endif
34 
35 /* First, we deal with platform-specific or compiler-specific issues. */
36 
37 /* begin standard C headers. */
38 #include <stdio.h>
39 #include <string.h>
40 #include <errno.h>
41 #include <stdlib.h>
42 
43 /* end standard C headers. */
44 
45 /* flex integer type definitions */
46 
47 #ifndef FLEXINT_H
48 #define FLEXINT_H
49 
50 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
51 
52 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
53 
54 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
55  * if you want the limit (max/min) macros for int types.
56  */
57 #ifndef __STDC_LIMIT_MACROS
58 #define __STDC_LIMIT_MACROS 1
59 #endif
60 
61 #include <inttypes.h>
62 typedef int8_t flex_int8_t;
63 typedef uint8_t flex_uint8_t;
64 typedef int16_t flex_int16_t;
65 typedef uint16_t flex_uint16_t;
66 typedef int32_t flex_int32_t;
67 typedef uint32_t flex_uint32_t;
68 #else
69 typedef signed char flex_int8_t;
70 typedef short int flex_int16_t;
71 typedef int flex_int32_t;
72 typedef unsigned char flex_uint8_t;
73 typedef unsigned short int flex_uint16_t;
74 typedef unsigned int flex_uint32_t;
75 
76 /* Limits of integral types. */
77 #ifndef INT8_MIN
78 #define INT8_MIN (-128)
79 #endif
80 #ifndef INT16_MIN
81 #define INT16_MIN (-32767-1)
82 #endif
83 #ifndef INT32_MIN
84 #define INT32_MIN (-2147483647-1)
85 #endif
86 #ifndef INT8_MAX
87 #define INT8_MAX (127)
88 #endif
89 #ifndef INT16_MAX
90 #define INT16_MAX (32767)
91 #endif
92 #ifndef INT32_MAX
93 #define INT32_MAX (2147483647)
94 #endif
95 #ifndef UINT8_MAX
96 #define UINT8_MAX (255U)
97 #endif
98 #ifndef UINT16_MAX
99 #define UINT16_MAX (65535U)
100 #endif
101 #ifndef UINT32_MAX
102 #define UINT32_MAX (4294967295U)
103 #endif
104 
105 #endif /* ! C99 */
106 
107 #endif /* ! FLEXINT_H */
108 
109 #ifdef __cplusplus
110 
111 /* The "const" storage-class-modifier is valid. */
112 #define YY_USE_CONST
113 
114 #else /* ! __cplusplus */
115 
116 /* C99 requires __STDC__ to be defined as 1. */
117 #if defined (__STDC__)
118 
119 #define YY_USE_CONST
120 
121 #endif /* defined (__STDC__) */
122 #endif /* ! __cplusplus */
123 
124 #ifdef YY_USE_CONST
125 #define yyconst const
126 #else
127 #define yyconst
128 #endif
129 
130 /* Returned upon end-of-file. */
131 #define YY_NULL 0
132 
133 /* Promotes a possibly negative, possibly signed char to an unsigned
134  * integer for use as an array index. If the signed char is negative,
135  * we want to instead treat it as an 8-bit unsigned char, hence the
136  * double cast.
137  */
138 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
139 
140 /* Enter a start condition. This macro really ought to take a parameter,
141  * but we do it the disgusting crufty way forced on us by the ()-less
142  * definition of BEGIN.
143  */
144 #define BEGIN (yy_start) = 1 + 2 *
145 
146 /* Translate the current start state into a value that can be later handed
147  * to BEGIN to return to the state. The YYSTATE alias is for lex
148  * compatibility.
149  */
150 #define YY_START (((yy_start) - 1) / 2)
151 #define YYSTATE YY_START
152 
153 /* Action number for EOF rule of a given start state. */
154 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
155 
156 /* Special action meaning "start processing a new file". */
157 #define YY_NEW_FILE _w32_restart(_w32_in )
158 
159 #define YY_END_OF_BUFFER_CHAR 0
160 
161 /* Size of default input buffer. */
162 #ifndef YY_BUF_SIZE
163 #ifdef __ia64__
164 /* On IA-64, the buffer size is 16k, not 8k.
165  * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
166  * Ditto for the __ia64__ case accordingly.
167  */
168 #define YY_BUF_SIZE 32768
169 #else
170 #define YY_BUF_SIZE 16384
171 #endif /* __ia64__ */
172 #endif
173 
174 /* The state buf must be large enough to hold one state per character in the main buffer.
175  */
176 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
177 
178 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
179 #define YY_TYPEDEF_YY_BUFFER_STATE
180 typedef struct yy_buffer_state *YY_BUFFER_STATE;
181 #endif
182 
183 extern int _w32_leng;
184 
185 extern FILE *_w32_in, *_w32_out;
186 
187 #define EOB_ACT_CONTINUE_SCAN 0
188 #define EOB_ACT_END_OF_FILE 1
189 #define EOB_ACT_LAST_MATCH 2
190 
191  /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
192  * access to the local variable yy_act. Since yyless() is a macro, it would break
193  * existing scanners that call yyless() from OUTSIDE _w32_lex.
194  * One obvious solution it to make yy_act a global. I tried that, and saw
195  * a 5% performance hit in a non-_w32_lineno scanner, because yy_act is
196  * normally declared as a register variable-- so it is not worth it.
197  */
198  #define YY_LESS_LINENO(n) \
199  do { \
200  int yyl;\
201  for ( yyl = n; yyl < _w32_leng; ++yyl )\
202  if ( _w32_text[yyl] == '\n' )\
203  --_w32_lineno;\
204  }while(0)
205 
206 /* Return all but the first "n" matched characters back to the input stream. */
207 #define yyless(n) \
208  do \
209  { \
210  /* Undo effects of setting up _w32_text. */ \
211  int yyless_macro_arg = (n); \
212  YY_LESS_LINENO(yyless_macro_arg);\
213  *yy_cp = (yy_hold_char); \
214  YY_RESTORE_YY_MORE_OFFSET \
215  (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
216  YY_DO_BEFORE_ACTION; /* set up _w32_text again */ \
217  } \
218  while ( 0 )
219 
220 #define unput(c) yyunput( c, (yytext_ptr) )
221 
222 #ifndef YY_TYPEDEF_YY_SIZE_T
223 #define YY_TYPEDEF_YY_SIZE_T
224 typedef size_t yy_size_t;
225 #endif
226 
227 #ifndef YY_STRUCT_YY_BUFFER_STATE
228 #define YY_STRUCT_YY_BUFFER_STATE
230  {
231  FILE *yy_input_file;
232 
233  char *yy_ch_buf; /* input buffer */
234  char *yy_buf_pos; /* current position in input buffer */
235 
236  /* Size of input buffer in bytes, not including room for EOB
237  * characters.
238  */
239  yy_size_t yy_buf_size;
240 
241  /* Number of characters read into yy_ch_buf, not including EOB
242  * characters.
243  */
244  int yy_n_chars;
245 
246  /* Whether we "own" the buffer - i.e., we know we created it,
247  * and can realloc() it to grow it, and should free() it to
248  * delete it.
249  */
250  int yy_is_our_buffer;
251 
252  /* Whether this is an "interactive" input source; if so, and
253  * if we're using stdio for input, then we want to use getc()
254  * instead of fread(), to make sure we stop fetching input after
255  * each newline.
256  */
257  int yy_is_interactive;
258 
259  /* Whether we're considered to be at the beginning of a line.
260  * If so, '^' rules will be active on the next match, otherwise
261  * not.
262  */
263  int yy_at_bol;
264 
268  /* Whether to try to fill the input buffer when we reach the
269  * end of it.
270  */
271  int yy_fill_buffer;
272 
273  int yy_buffer_status;
274 
275 #define YY_BUFFER_NEW 0
276 #define YY_BUFFER_NORMAL 1
277  /* When an EOF's been seen but there's still some text to process
278  * then we mark the buffer as YY_EOF_PENDING, to indicate that we
279  * shouldn't try reading from the input source any more. We might
280  * still have a bunch of tokens to match, though, because of
281  * possible backing-up.
282  *
283  * When we actually see the EOF, we change the status to "new"
284  * (via _w32_restart()), so that the user can continue scanning by
285  * just pointing _w32_in at a new input file.
286  */
287 #define YY_BUFFER_EOF_PENDING 2
288 
289  };
290 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
291 
292 /* Stack of input buffers. */
293 static size_t yy_buffer_stack_top = 0;
294 static size_t yy_buffer_stack_max = 0;
295 static YY_BUFFER_STATE * yy_buffer_stack = 0;
297 /* We provide macros for accessing buffer states in case in the
298  * future we want to put the buffer states in a more general
299  * "scanner state".
300  *
301  * Returns the top of the stack, or NULL.
302  */
303 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
304  ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
305  : NULL)
306 
307 /* Same as previous macro, but useful when we know that the buffer stack is not
308  * NULL or when we need an lvalue. For internal use only.
309  */
310 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
311 
312 /* yy_hold_char holds the character lost when _w32_text is formed. */
313 static char yy_hold_char;
314 static int yy_n_chars; /* number of characters read into yy_ch_buf */
315 int _w32_leng;
316 
317 /* Points to current character in buffer. */
318 static char *yy_c_buf_p = (char *) 0;
319 static int yy_init = 0; /* whether we need to initialize */
320 static int yy_start = 0; /* start state number */
321 
322 /* Flag which is used to allow _w32_wrap()'s to do buffer switches
323  * instead of setting up a fresh _w32_in. A bit of a hack ...
324  */
325 static int yy_did_buffer_switch_on_eof;
326 
327 void _w32_restart (FILE *input_file );
328 void _w32__switch_to_buffer (YY_BUFFER_STATE new_buffer );
329 YY_BUFFER_STATE _w32__create_buffer (FILE *file,int size );
330 void _w32__delete_buffer (YY_BUFFER_STATE b );
331 void _w32__flush_buffer (YY_BUFFER_STATE b );
332 void _w32_push_buffer_state (YY_BUFFER_STATE new_buffer );
333 void _w32_pop_buffer_state (void );
334 
335 static void _w32_ensure_buffer_stack (void );
336 static void _w32__load_buffer_state (void );
337 static void _w32__init_buffer (YY_BUFFER_STATE b,FILE *file );
338 
339 #define YY_FLUSH_BUFFER _w32__flush_buffer(YY_CURRENT_BUFFER )
340 
341 YY_BUFFER_STATE _w32__scan_buffer (char *base,yy_size_t size );
342 YY_BUFFER_STATE _w32__scan_string (yyconst char *yy_str );
343 YY_BUFFER_STATE _w32__scan_bytes (yyconst char *bytes,int len );
344 
345 void *_w32_alloc (yy_size_t );
346 void *_w32_realloc (void *,yy_size_t );
347 void _w32_free (void * );
348 
349 #define yy_new_buffer _w32__create_buffer
350 
351 #define yy_set_interactive(is_interactive) \
352  { \
353  if ( ! YY_CURRENT_BUFFER ){ \
354  _w32_ensure_buffer_stack (); \
355  YY_CURRENT_BUFFER_LVALUE = \
356  _w32__create_buffer(_w32_in,YY_BUF_SIZE ); \
357  } \
358  YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
359  }
360 
361 #define yy_set_bol(at_bol) \
362  { \
363  if ( ! YY_CURRENT_BUFFER ){\
364  _w32_ensure_buffer_stack (); \
365  YY_CURRENT_BUFFER_LVALUE = \
366  _w32__create_buffer(_w32_in,YY_BUF_SIZE ); \
367  } \
368  YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
369  }
370 
371 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
372 
373 /* Begin user sect3 */
374 
375 typedef unsigned char YY_CHAR;
376 
377 FILE *_w32_in = (FILE *) 0, *_w32_out = (FILE *) 0;
378 
379 typedef int yy_state_type;
380 
381 extern int _w32_lineno;
382 
383 int _w32_lineno = 1;
384 
385 extern char *_w32_text;
386 #define yytext_ptr _w32_text
387 
388 static yy_state_type yy_get_previous_state (void );
389 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
390 static int yy_get_next_buffer (void );
391 static void yy_fatal_error (yyconst char msg[] );
392 
393 /* Done after the current pattern has been matched and before the
394  * corresponding action - sets up _w32_text.
395  */
396 #define YY_DO_BEFORE_ACTION \
397  (yytext_ptr) = yy_bp; \
398  _w32_leng = (size_t) (yy_cp - yy_bp); \
399  (yy_hold_char) = *yy_cp; \
400  *yy_cp = '\0'; \
401  (yy_c_buf_p) = yy_cp;
402 
403 #define YY_NUM_RULES 29
404 #define YY_END_OF_BUFFER 30
405 /* This struct is not used in this scanner,
406  but its presence is necessary. */
408  {
409  flex_int32_t yy_verify;
410  flex_int32_t yy_nxt;
411  };
412 static yyconst flex_int16_t yy_accept[69] =
413  { 0,
414  0, 0, 0, 0, 0, 0, 0, 0, 30, 5,
415  1, 3, 5, 4, 5, 21, 20, 21, 6, 21,
416  24, 23, 24, 24, 28, 27, 28, 28, 28, 28,
417  28, 1, 3, 0, 2, 0, 20, 19, 15, 18,
418  18, 7, 8, 11, 10, 13, 12, 9, 19, 14,
419  23, 22, 27, 0, 26, 0, 0, 0, 0, 17,
420  18, 16, 25, 17, 18, 16, 17, 0
421  } ;
422 
423 static yyconst flex_int32_t yy_ec[256] =
424  { 0,
425  1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
426  1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
427  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428  1, 2, 1, 5, 6, 1, 1, 1, 1, 1,
429  1, 1, 1, 1, 1, 1, 1, 7, 8, 8,
430  8, 8, 8, 8, 8, 9, 9, 10, 6, 1,
431  1, 1, 1, 1, 11, 12, 13, 14, 15, 16,
432  1, 1, 1, 1, 1, 1, 1, 17, 18, 1,
433  1, 19, 20, 21, 1, 22, 1, 23, 1, 1,
434  1, 24, 1, 1, 1, 1, 25, 26, 13, 27,
435 
436  28, 29, 1, 1, 1, 1, 1, 1, 1, 30,
437  31, 1, 1, 32, 33, 34, 1, 35, 1, 36,
438  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
439  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
440  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
441  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
442  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
443  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
444  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
445  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
446 
447  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
448  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
449  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
450  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
451  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
452  1, 1, 1, 1, 1
453  } ;
454 
455 static yyconst flex_int32_t yy_meta[37] =
456  { 0,
457  1, 1, 1, 1, 1, 1, 2, 2, 2, 1,
458  2, 2, 2, 2, 2, 2, 1, 1, 1, 1,
459  1, 1, 1, 1, 2, 2, 2, 2, 2, 1,
460  1, 1, 1, 1, 1, 1
461  } ;
462 
463 static yyconst flex_int16_t yy_base[77] =
464  { 0,
465  0, 5, 9, 12, 15, 17, 39, 70, 82, 152,
466  79, 152, 77, 152, 19, 152, 152, 72, 152, 103,
467  152, 152, 68, 46, 152, 152, 65, 21, 12, 13,
468  12, 65, 152, 25, 152, 34, 152, 152, 152, 41,
469  53, 152, 152, 152, 152, 152, 152, 152, 0, 152,
470  152, 152, 152, 48, 152, 51, 36, 25, 22, 56,
471  70, 0, 152, 50, 152, 152, 152, 152, 139, 141,
472  143, 145, 147, 149, 28, 24
473  } ;
474 
475 static yyconst flex_int16_t yy_def[77] =
476  { 0,
477  69, 69, 70, 70, 71, 71, 72, 72, 68, 68,
478  68, 68, 68, 68, 73, 68, 68, 68, 68, 68,
479  68, 68, 68, 68, 68, 68, 68, 74, 68, 68,
480  68, 68, 68, 73, 68, 73, 68, 68, 68, 68,
481  68, 68, 68, 68, 68, 68, 68, 68, 75, 68,
482  68, 68, 68, 74, 68, 74, 68, 68, 68, 68,
483  68, 76, 68, 68, 68, 68, 68, 0, 68, 68,
484  68, 68, 68, 68, 68, 68
485  } ;
486 
487 static yyconst flex_int16_t yy_nxt[189] =
488  { 0,
489  68, 11, 12, 13, 14, 15, 11, 12, 13, 14,
490  15, 17, 18, 19, 17, 18, 19, 22, 23, 22,
491  23, 35, 36, 55, 56, 66, 57, 35, 36, 62,
492  58, 63, 20, 59, 63, 20, 35, 36, 24, 57,
493  24, 26, 27, 58, 28, 63, 59, 60, 60, 61,
494  55, 56, 29, 55, 56, 30, 67, 67, 31, 61,
495  61, 61, 64, 64, 65, 29, 32, 53, 30, 52,
496  51, 31, 26, 27, 37, 28, 65, 65, 65, 33,
497  32, 68, 68, 29, 68, 68, 30, 68, 68, 31,
498  68, 68, 68, 68, 68, 68, 29, 68, 68, 30,
499 
500  68, 68, 31, 38, 38, 68, 38, 39, 38, 40,
501  41, 41, 38, 42, 43, 38, 38, 44, 45, 46,
502  38, 47, 38, 48, 38, 49, 50, 42, 43, 38,
503  44, 45, 46, 38, 47, 38, 48, 38, 49, 10,
504  10, 16, 16, 21, 21, 25, 25, 34, 34, 54,
505  54, 9, 68, 68, 68, 68, 68, 68, 68, 68,
506  68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
507  68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
508  68, 68, 68, 68, 68, 68, 68, 68
509  } ;
510 
511 static yyconst flex_int16_t yy_chk[189] =
512  { 0,
513  0, 1, 1, 1, 1, 1, 2, 2, 2, 2,
514  2, 3, 3, 3, 4, 4, 4, 5, 5, 6,
515  6, 15, 15, 28, 28, 76, 29, 34, 34, 75,
516  30, 59, 3, 31, 58, 4, 36, 36, 5, 29,
517  6, 7, 7, 30, 7, 57, 31, 40, 40, 40,
518  54, 54, 7, 56, 56, 7, 64, 64, 7, 41,
519  41, 41, 60, 60, 60, 7, 32, 27, 7, 24,
520  23, 7, 8, 8, 18, 8, 61, 61, 61, 13,
521  11, 9, 0, 8, 0, 0, 8, 0, 0, 8,
522  0, 0, 0, 0, 0, 0, 8, 0, 0, 8,
523 
524  0, 0, 8, 20, 20, 0, 20, 20, 20, 20,
525  20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
526  20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
527  20, 20, 20, 20, 20, 20, 20, 20, 20, 69,
528  69, 70, 70, 71, 71, 72, 72, 73, 73, 74,
529  74, 68, 68, 68, 68, 68, 68, 68, 68, 68,
530  68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
531  68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
532  68, 68, 68, 68, 68, 68, 68, 68
533  } ;
534 
535 /* Table of booleans, true if rule could match eol. */
536 static yyconst flex_int32_t yy_rule_can_match_eol[30] =
537  { 0,
538 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
539  1, 0, 0, 1, 0, 0, 1, 1, 0, 0, };
540 
541 static yy_state_type yy_last_accepting_state;
542 static char *yy_last_accepting_cpos;
543 
544 extern int _w32__flex_debug;
545 int _w32__flex_debug = 0;
546 
547 /* The intent behind this definition is that it'll catch
548  * any uses of REJECT which flex missed.
549  */
550 #define REJECT reject_used_but_not_detected
551 #define yymore() yymore_used_but_not_detected
552 #define YY_MORE_ADJ 0
553 #define YY_RESTORE_YY_MORE_OFFSET
554 char *_w32_text;
555 #line 1 "lang.l"
556 
565 #line 12 "lang.l"
566 
567 #if !defined(WATT32_COMPILE_LANG_C)
568 #error Include lang.c inside language.c only.
569 #endif
570 
571 #if defined(USE_LANGUAGE)
572 
573 #if defined(TEST_PROG)
574  #ifndef __CYGWIN__
575  #include <conio.h>
576  #endif
577  #define INCLINE() fprintf (stderr, " <line %lu>\n", lang.line++)
578  #define DEBUG(str,arg) fprintf (stderr, str, arg)
579 #else
580  #define INCLINE() lang.line++
581  #define DEBUG(str,arg) ((void)0)
582 #endif
583 
584 #define BUF_SIZE 500
585 
586 static int _w32_lex (void);
587 static void AddChar (int ch);
588 static void AddDecimal (const char *buf);
589 static void AddHexcode (const char *buf);
590 static void AddOctal (const char *buf);
591 static void AddEntry (void);
592 static void Fatal (const char *s1, const char *s2);
593 static void Error (const char *err);
594 
595 static char buf [BUF_SIZE];
596 static char *ptr = NULL;
597 static char *end = buf+BUF_SIZE;
598 static int line_cont = 0;
599 static DWORD crc_ref = 0;
600 static BOOL do_ref = TRUE;
601 static jmp_buf bail_out;
602 
603 struct Node {
604  DWORD crc;
605  const char *string;
606  struct Node *next;
607  };
608 
609 struct Elem {
610  DWORD crc;
611  const char *string;
612  };
613 
614 static struct Language {
615  struct Node *list;
616  struct Elem *array;
617  char prefix[4]; /* "en:" etc. */
618  size_t entries;
619  unsigned line;
620  } lang = {
621  NULL, NULL, "en", 0L, 0L
622  };
623 
624 /*---------------------------------------------------------------------*/
625 
708 #line 711 "<stdout>"
709 
710 #define INITIAL 0
711 #define STRING 1
712 #define EO_LINE 2
713 #define PREFIX 3
714 
715 #ifndef YY_NO_UNISTD_H
716 /* Special case for "unistd.h", since it is non-ANSI. We include it way
717  * down here because we want the user's section 1 to have been scanned first.
718  * The user has a chance to override it with an option.
719  */
720 #include <unistd.h>
721 #endif
722 
723 #ifndef YY_EXTRA_TYPE
724 #define YY_EXTRA_TYPE void *
725 #endif
726 
727 static int yy_init_globals (void );
728 
729 /* Accessor methods to globals.
730  These are made visible to non-reentrant scanners for convenience. */
731 
732 int _w32_lex_destroy (void );
733 
734 int _w32_get_debug (void );
735 
736 void _w32_set_debug (int debug_flag );
737 
738 YY_EXTRA_TYPE _w32_get_extra (void );
739 
740 void _w32_set_extra (YY_EXTRA_TYPE user_defined );
741 
742 FILE *_w32_get_in (void );
743 
744 void _w32_set_in (FILE * in_str );
745 
746 FILE *_w32_get_out (void );
747 
748 void _w32_set_out (FILE * out_str );
749 
750 int _w32_get_leng (void );
751 
752 char *_w32_get_text (void );
753 
754 int _w32_get_lineno (void );
755 
756 void _w32_set_lineno (int line_number );
757 
758 /* Macros after this point can all be overridden by user definitions in
759  * section 1.
760  */
761 
762 #ifndef YY_SKIP_YYWRAP
763 #ifdef __cplusplus
764 extern "C" int _w32_wrap (void );
765 #else
766 extern int _w32_wrap (void );
767 #endif
768 #endif
769 
770  static void yyunput (int c,char *buf_ptr );
771 
772 #ifndef yytext_ptr
773 static void yy_flex_strncpy (char *,yyconst char *,int );
774 #endif
775 
776 #ifdef YY_NEED_STRLEN
777 static int yy_flex_strlen (yyconst char * );
778 #endif
779 
780 #ifndef YY_NO_INPUT
781 
782 #ifdef __cplusplus
783 static int yyinput (void );
784 #else
785 static int input (void );
786 #endif
787 
788 #endif
789 
790 /* Amount of stuff to slurp up with each read. */
791 #ifndef YY_READ_BUF_SIZE
792 #ifdef __ia64__
793 /* On IA-64, the buffer size is 16k, not 8k */
794 #define YY_READ_BUF_SIZE 16384
795 #else
796 #define YY_READ_BUF_SIZE 8192
797 #endif /* __ia64__ */
798 #endif
799 
800 /* Copy whatever the last rule matched to the standard output. */
801 #ifndef ECHO
802 /* This used to be an fputs(), but since the string might contain NUL's,
803  * we now use fwrite().
804  */
805 #define ECHO do { if (fwrite( _w32_text, _w32_leng, 1, _w32_out )) {} } while (0)
806 #endif
807 
808 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
809  * is returned in "result".
810  */
811 #ifndef YY_INPUT
812 #define YY_INPUT(buf,result,max_size) \
813  if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
814  { \
815  int c = '*'; \
816  size_t n; \
817  for ( n = 0; n < max_size && \
818  (c = getc( _w32_in )) != EOF && c != '\n'; ++n ) \
819  buf[n] = (char) c; \
820  if ( c == '\n' ) \
821  buf[n++] = (char) c; \
822  if ( c == EOF && ferror( _w32_in ) ) \
823  YY_FATAL_ERROR( "input in flex scanner failed" ); \
824  result = n; \
825  } \
826  else \
827  { \
828  errno=0; \
829  while ( (result = fread(buf, 1, max_size, _w32_in))==0 && ferror(_w32_in)) \
830  { \
831  if( errno != EINTR) \
832  { \
833  YY_FATAL_ERROR( "input in flex scanner failed" ); \
834  break; \
835  } \
836  errno=0; \
837  clearerr(_w32_in); \
838  } \
839  }\
840 \
841 
842 #endif
843 
844 /* No semi-colon after return; correct usage is to write "yyterminate();" -
845  * we don't want an extra ';' after the "return" because that will cause
846  * some compilers to complain about unreachable statements.
847  */
848 #ifndef yyterminate
849 #define yyterminate() return YY_NULL
850 #endif
851 
852 /* Number of entries by which start-condition stack grows. */
853 #ifndef YY_START_STACK_INCR
854 #define YY_START_STACK_INCR 25
855 #endif
856 
857 /* Report a fatal error. */
858 #ifndef YY_FATAL_ERROR
859 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
860 #endif
861 
862 /* end tables serialization structures and prototypes */
863 
864 /* Default declaration of generated scanner - a define so the user can
865  * easily add parameters.
866  */
867 #ifndef YY_DECL
868 #define YY_DECL_IS_OURS 1
869 
870 extern int _w32_lex (void);
871 
872 #define YY_DECL int _w32_lex (void)
873 #endif /* !YY_DECL */
874 
875 /* Code executed at the beginning of each rule, after _w32_text and _w32_leng
876  * have been set up.
877  */
878 #ifndef YY_USER_ACTION
879 #define YY_USER_ACTION
880 #endif
881 
882 /* Code executed at the end of each rule. */
883 #ifndef YY_BREAK
884 #define YY_BREAK break;
885 #endif
886 
887 #define YY_RULE_SETUP \
888  YY_USER_ACTION
889 
892 YY_DECL
893 {
894  register yy_state_type yy_current_state;
895  register char *yy_cp, *yy_bp;
896  register int yy_act;
897 
898 #line 173 "lang.l"
899 
900 
901 #line 904 "<stdout>"
902 
903  if ( !(yy_init) )
904  {
905  (yy_init) = 1;
906 
907 #ifdef YY_USER_INIT
908  YY_USER_INIT;
909 #endif
910 
911  if ( ! (yy_start) )
912  (yy_start) = 1; /* first start state */
913 
914  if ( ! _w32_in )
915  _w32_in = stdin;
916 
917  if ( ! _w32_out )
918  _w32_out = stdout;
919 
920  if ( ! YY_CURRENT_BUFFER ) {
921  _w32_ensure_buffer_stack ();
922  YY_CURRENT_BUFFER_LVALUE =
923  _w32__create_buffer(_w32_in,YY_BUF_SIZE );
924  }
925 
926  _w32__load_buffer_state( );
927  }
928 
929  while ( 1 ) /* loops until end-of-file is reached */
930  {
931  yy_cp = (yy_c_buf_p);
932 
933  /* Support of _w32_text. */
934  *yy_cp = (yy_hold_char);
935 
936  /* yy_bp points to the position in yy_ch_buf of the start of
937  * the current run.
938  */
939  yy_bp = yy_cp;
940 
941  yy_current_state = (yy_start);
942 yy_match:
943  do
944  {
945  register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
946  if ( yy_accept[yy_current_state] )
947  {
948  (yy_last_accepting_state) = yy_current_state;
949  (yy_last_accepting_cpos) = yy_cp;
950  }
951  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
952  {
953  yy_current_state = (int) yy_def[yy_current_state];
954  if ( yy_current_state >= 69 )
955  yy_c = yy_meta[(unsigned int) yy_c];
956  }
957  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
958  ++yy_cp;
959  }
960  while ( yy_current_state != 68 );
961  yy_cp = (yy_last_accepting_cpos);
962  yy_current_state = (yy_last_accepting_state);
963 
964 yy_find_action:
965  yy_act = yy_accept[yy_current_state];
966 
967  YY_DO_BEFORE_ACTION;
968 
969  if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
970  {
971  int yyl;
972  for ( yyl = 0; yyl < _w32_leng; ++yyl )
973  if ( _w32_text[yyl] == '\n' )
974 
975  _w32_lineno++;
976 ;
977  }
978 
979 do_action: /* This label is used only to access EOF actions. */
980 
981  switch ( yy_act )
982  { /* beginning of action switch */
983  case 0: /* must back up */
984  /* undo the effects of YY_DO_BEFORE_ACTION */
985  *yy_cp = (yy_hold_char);
986  yy_cp = (yy_last_accepting_cpos);
987  yy_current_state = (yy_last_accepting_state);
988  goto yy_find_action;
989 
990 /* get reference string */
991 case 1:
992 YY_RULE_SETUP
993 #line 176 "lang.l"
994 /* discard */
995  YY_BREAK
996 case 2:
997 /* rule 2 can match eol */
998 YY_RULE_SETUP
999 #line 177 "lang.l"
1000 INCLINE();
1001  YY_BREAK
1002 case 3:
1003 /* rule 3 can match eol */
1004 YY_RULE_SETUP
1005 #line 178 "lang.l"
1006 INCLINE();
1007  YY_BREAK
1008 case 4:
1009 YY_RULE_SETUP
1010 #line 179 "lang.l"
1011 {
1012  if (!line_cont)
1013  ptr = buf;
1014  BEGIN (STRING);
1015  }
1016  YY_BREAK
1017 case 5:
1018 YY_RULE_SETUP
1019 #line 184 "lang.l"
1020 {
1021  unput (_w32_text[0]);
1022  BEGIN (PREFIX);
1023  }
1024  YY_BREAK
1025 
1026 
1027 case 6:
1028 YY_RULE_SETUP
1029 #line 191 "lang.l"
1030 line_cont = 0; BEGIN (EO_LINE);
1031  YY_BREAK
1032 case 7:
1033 YY_RULE_SETUP
1034 #line 192 "lang.l"
1035 AddChar ('\7');
1036  YY_BREAK
1037 case 8:
1038 YY_RULE_SETUP
1039 #line 193 "lang.l"
1040 AddChar ('\b');
1041  YY_BREAK
1042 case 9:
1043 YY_RULE_SETUP
1044 #line 194 "lang.l"
1045 AddChar ('\t');
1046  YY_BREAK
1047 case 10:
1048 YY_RULE_SETUP
1049 #line 195 "lang.l"
1050 AddChar ('\f');
1051  YY_BREAK
1052 case 11:
1053 YY_RULE_SETUP
1054 #line 196 "lang.l"
1055 AddChar (27);
1056  YY_BREAK
1057 case 12:
1058 YY_RULE_SETUP
1059 #line 197 "lang.l"
1060 AddChar ('\r');
1061  YY_BREAK
1062 case 13:
1063 YY_RULE_SETUP
1064 #line 198 "lang.l"
1065 AddChar ('\n');
1066  YY_BREAK
1067 case 14:
1068 YY_RULE_SETUP
1069 #line 199 "lang.l"
1070 AddChar ('\\');
1071  YY_BREAK
1072 case 15:
1073 YY_RULE_SETUP
1074 #line 200 "lang.l"
1075 AddChar ('\"');
1076  YY_BREAK
1077 case 16:
1078 YY_RULE_SETUP
1079 #line 201 "lang.l"
1080 AddHexcode (_w32_text+2);
1081  YY_BREAK
1082 case 17:
1083 YY_RULE_SETUP
1084 #line 202 "lang.l"
1085 AddOctal (_w32_text+1);
1086  YY_BREAK
1087 case 18:
1088 YY_RULE_SETUP
1089 #line 203 "lang.l"
1090 AddDecimal (_w32_text+1);
1091  YY_BREAK
1092 case 19:
1093 YY_RULE_SETUP
1094 #line 204 "lang.l"
1095 Fatal ("Unknown ESC code: ", _w32_text);
1096  YY_BREAK
1097 case 20:
1098 /* rule 20 can match eol */
1099 YY_RULE_SETUP
1100 #line 205 "lang.l"
1101 Fatal ("Unterminated line", NULL);
1102  YY_BREAK
1103 case 21:
1104 YY_RULE_SETUP
1105 #line 206 "lang.l"
1106 AddChar (_w32_text[0]);
1107  YY_BREAK
1108 case YY_STATE_EOF(STRING):
1109 #line 207 "lang.l"
1110 Fatal ("Unexpected end-of-file", NULL);
1111  YY_BREAK
1112 
1113 
1114 case 22:
1115 YY_RULE_SETUP
1116 #line 211 "lang.l"
1117 {
1118  line_cont = 1;
1119  BEGIN (INITIAL);
1120  }
1121  YY_BREAK
1122 case 23:
1123 /* rule 23 can match eol */
1124 YY_RULE_SETUP
1125 #line 215 "lang.l"
1126 {
1127  *ptr = '\0';
1128  ptr = NULL;
1129  if (do_ref)
1130  crc_ref = crc_bytes (buf, strlen(buf));
1131  else AddEntry();
1132  INCLINE();
1133  BEGIN (INITIAL);
1134  }
1135  YY_BREAK
1136 case 24:
1137 YY_RULE_SETUP
1138 #line 224 "lang.l"
1139 /* discard */
1140  YY_BREAK
1141 case YY_STATE_EOF(EO_LINE):
1142 #line 225 "lang.l"
1143 Fatal ("Unexpected end-of-string", NULL);
1144  YY_BREAK
1145 
1146 
1147 case 25:
1148 YY_RULE_SETUP
1149 #line 229 "lang.l"
1150 {
1151  DEBUG ("lang `%s',\n", _w32_text);
1152  if (!strncmp(_w32_text,lang.prefix,3))
1153  {
1154  ptr = buf;
1155  do_ref = FALSE;
1156  }
1157  else
1158  {
1159  ptr = NULL;
1160  do_ref = TRUE;
1161  }
1162  BEGIN (INITIAL);
1163  }
1164  YY_BREAK
1165 case 26:
1166 /* rule 26 can match eol */
1167 YY_RULE_SETUP
1168 #line 243 "lang.l"
1169 INCLINE();
1170  YY_BREAK
1171 case 27:
1172 /* rule 27 can match eol */
1173 YY_RULE_SETUP
1174 #line 244 "lang.l"
1175 INCLINE();
1176  YY_BREAK
1177 case 28:
1178 YY_RULE_SETUP
1179 #line 245 "lang.l"
1180 Fatal ("Unknown language prefix: ", _w32_text);
1181  YY_BREAK
1182 
1183 case 29:
1184 YY_RULE_SETUP
1185 #line 248 "lang.l"
1186 ECHO;
1187  YY_BREAK
1188 #line 1191 "<stdout>"
1189 case YY_STATE_EOF(INITIAL):
1190 case YY_STATE_EOF(PREFIX):
1191  yyterminate();
1192 
1193  case YY_END_OF_BUFFER:
1194  {
1195  /* Amount of text matched not including the EOB char. */
1196  int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1197 
1198  /* Undo the effects of YY_DO_BEFORE_ACTION. */
1199  *yy_cp = (yy_hold_char);
1200  YY_RESTORE_YY_MORE_OFFSET
1201 
1202  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1203  {
1204  /* We're scanning a new file or input source. It's
1205  * possible that this happened because the user
1206  * just pointed _w32_in at a new source and called
1207  * _w32_lex(). If so, then we have to assure
1208  * consistency between YY_CURRENT_BUFFER and our
1209  * globals. Here is the right place to do so, because
1210  * this is the first action (other than possibly a
1211  * back-up) that will match for the new input source.
1212  */
1213  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1214  YY_CURRENT_BUFFER_LVALUE->yy_input_file = _w32_in;
1215  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1216  }
1217 
1218  /* Note that here we test for yy_c_buf_p "<=" to the position
1219  * of the first EOB in the buffer, since yy_c_buf_p will
1220  * already have been incremented past the NUL character
1221  * (since all states make transitions on EOB to the
1222  * end-of-buffer state). Contrast this with the test
1223  * in input().
1224  */
1225  if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1226  { /* This was really a NUL. */
1227  yy_state_type yy_next_state;
1228 
1229  (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1230 
1231  yy_current_state = yy_get_previous_state( );
1232 
1233  /* Okay, we're now positioned to make the NUL
1234  * transition. We couldn't have
1235  * yy_get_previous_state() go ahead and do it
1236  * for us because it doesn't know how to deal
1237  * with the possibility of jamming (and we don't
1238  * want to build jamming into it because then it
1239  * will run more slowly).
1240  */
1241 
1242  yy_next_state = yy_try_NUL_trans( yy_current_state );
1243 
1244  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1245 
1246  if ( yy_next_state )
1247  {
1248  /* Consume the NUL. */
1249  yy_cp = ++(yy_c_buf_p);
1250  yy_current_state = yy_next_state;
1251  goto yy_match;
1252  }
1253 
1254  else
1255  {
1256  yy_cp = (yy_last_accepting_cpos);
1257  yy_current_state = (yy_last_accepting_state);
1258  goto yy_find_action;
1259  }
1260  }
1261 
1262  else switch ( yy_get_next_buffer( ) )
1263  {
1264  case EOB_ACT_END_OF_FILE:
1265  {
1266  (yy_did_buffer_switch_on_eof) = 0;
1267 
1268  if ( _w32_wrap( ) )
1269  {
1270  /* Note: because we've taken care in
1271  * yy_get_next_buffer() to have set up
1272  * _w32_text, we can now set up
1273  * yy_c_buf_p so that if some total
1274  * hoser (like flex itself) wants to
1275  * call the scanner after we return the
1276  * YY_NULL, it'll still work - another
1277  * YY_NULL will get returned.
1278  */
1279  (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1280 
1281  yy_act = YY_STATE_EOF(YY_START);
1282  goto do_action;
1283  }
1284 
1285  else
1286  {
1287  if ( ! (yy_did_buffer_switch_on_eof) )
1288  YY_NEW_FILE;
1289  }
1290  break;
1291  }
1292 
1293  case EOB_ACT_CONTINUE_SCAN:
1294  (yy_c_buf_p) =
1295  (yytext_ptr) + yy_amount_of_matched_text;
1296 
1297  yy_current_state = yy_get_previous_state( );
1298 
1299  yy_cp = (yy_c_buf_p);
1300  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1301  goto yy_match;
1302 
1303  case EOB_ACT_LAST_MATCH:
1304  (yy_c_buf_p) =
1305  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1306 
1307  yy_current_state = yy_get_previous_state( );
1308 
1309  yy_cp = (yy_c_buf_p);
1310  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1311  goto yy_find_action;
1312  }
1313  break;
1314  }
1315 
1316  default:
1317  YY_FATAL_ERROR(
1318  "fatal flex scanner internal error--no action found" );
1319  } /* end of action switch */
1320  } /* end of scanning one token */
1321 } /* end of _w32_lex */
1322 
1323 /* yy_get_next_buffer - try to read in a new buffer
1324  *
1325  * Returns a code representing an action:
1326  * EOB_ACT_LAST_MATCH -
1327  * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1328  * EOB_ACT_END_OF_FILE - end of file
1329  */
1330 static int yy_get_next_buffer (void)
1331 {
1332  register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1333  register char *source = (yytext_ptr);
1334  register int number_to_move, i;
1335  int ret_val;
1336 
1337  if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1338  YY_FATAL_ERROR(
1339  "fatal flex scanner internal error--end of buffer missed" );
1340 
1341  if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1342  { /* Don't try to fill the buffer, so this is an EOF. */
1343  if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1344  {
1345  /* We matched a single character, the EOB, so
1346  * treat this as a final EOF.
1347  */
1348  return EOB_ACT_END_OF_FILE;
1349  }
1350 
1351  else
1352  {
1353  /* We matched some text prior to the EOB, first
1354  * process it.
1355  */
1356  return EOB_ACT_LAST_MATCH;
1357  }
1358  }
1359 
1360  /* Try to read more data. */
1361 
1362  /* First move last chars to start of buffer. */
1363  number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1364 
1365  for ( i = 0; i < number_to_move; ++i )
1366  *(dest++) = *(source++);
1367 
1368  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1369  /* don't do the read, it's not guaranteed to return an EOF,
1370  * just force an EOF
1371  */
1372  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1373 
1374  else
1375  {
1376  int num_to_read =
1377  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1378 
1379  while ( num_to_read <= 0 )
1380  { /* Not enough room in the buffer - grow it. */
1381 
1382  /* just a shorter name for the current buffer */
1383  YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1384 
1385  int yy_c_buf_p_offset =
1386  (int) ((yy_c_buf_p) - b->yy_ch_buf);
1387 
1388  if ( b->yy_is_our_buffer )
1389  {
1390  int new_size = b->yy_buf_size * 2;
1391 
1392  if ( new_size <= 0 )
1393  b->yy_buf_size += b->yy_buf_size / 8;
1394  else
1395  b->yy_buf_size *= 2;
1396 
1397  b->yy_ch_buf = (char *)
1398  /* Include room in for 2 EOB chars. */
1399  _w32_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1400  }
1401  else
1402  /* Can't grow it, we don't own it. */
1403  b->yy_ch_buf = 0;
1404 
1405  if ( ! b->yy_ch_buf )
1406  YY_FATAL_ERROR(
1407  "fatal error - scanner input buffer overflow" );
1408 
1409  (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1410 
1411  num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1412  number_to_move - 1;
1413 
1414  }
1415 
1416  if ( num_to_read > YY_READ_BUF_SIZE )
1417  num_to_read = YY_READ_BUF_SIZE;
1418 
1419  /* Read in more data. */
1420  YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1421  (yy_n_chars), (size_t) num_to_read );
1422 
1423  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1424  }
1425 
1426  if ( (yy_n_chars) == 0 )
1427  {
1428  if ( number_to_move == YY_MORE_ADJ )
1429  {
1430  ret_val = EOB_ACT_END_OF_FILE;
1431  _w32_restart(_w32_in );
1432  }
1433 
1434  else
1435  {
1436  ret_val = EOB_ACT_LAST_MATCH;
1437  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1438  YY_BUFFER_EOF_PENDING;
1439  }
1440  }
1441 
1442  else
1443  ret_val = EOB_ACT_CONTINUE_SCAN;
1444 
1445  if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1446  /* Extend the array by 50%, plus the number we really need. */
1447  yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1448  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) _w32_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1449  if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1450  YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1451  }
1452 
1453  (yy_n_chars) += number_to_move;
1454  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1455  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1456 
1457  (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1458 
1459  return ret_val;
1460 }
1461 
1462 /* yy_get_previous_state - get the state just before the EOB char was reached */
1463 
1464  static yy_state_type yy_get_previous_state (void)
1465 {
1466  register yy_state_type yy_current_state;
1467  register char *yy_cp;
1468 
1469  yy_current_state = (yy_start);
1470 
1471  for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1472  {
1473  register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1474  if ( yy_accept[yy_current_state] )
1475  {
1476  (yy_last_accepting_state) = yy_current_state;
1477  (yy_last_accepting_cpos) = yy_cp;
1478  }
1479  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1480  {
1481  yy_current_state = (int) yy_def[yy_current_state];
1482  if ( yy_current_state >= 69 )
1483  yy_c = yy_meta[(unsigned int) yy_c];
1484  }
1485  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1486  }
1487 
1488  return yy_current_state;
1489 }
1490 
1491 /* yy_try_NUL_trans - try to make a transition on the NUL character
1492  *
1493  * synopsis
1494  * next_state = yy_try_NUL_trans( current_state );
1495  */
1496  static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1497 {
1498  register int yy_is_jam;
1499  register char *yy_cp = (yy_c_buf_p);
1500 
1501  register YY_CHAR yy_c = 1;
1502  if ( yy_accept[yy_current_state] )
1503  {
1504  (yy_last_accepting_state) = yy_current_state;
1505  (yy_last_accepting_cpos) = yy_cp;
1506  }
1507  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1508  {
1509  yy_current_state = (int) yy_def[yy_current_state];
1510  if ( yy_current_state >= 69 )
1511  yy_c = yy_meta[(unsigned int) yy_c];
1512  }
1513  yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1514  yy_is_jam = (yy_current_state == 68);
1515 
1516  return yy_is_jam ? 0 : yy_current_state;
1517 }
1518 
1519  static void yyunput (int c, register char * yy_bp )
1520 {
1521  register char *yy_cp;
1522 
1523  yy_cp = (yy_c_buf_p);
1524 
1525  /* undo effects of setting up _w32_text */
1526  *yy_cp = (yy_hold_char);
1527 
1528  if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1529  { /* need to shift things up to make room */
1530  /* +2 for EOB chars. */
1531  register int number_to_move = (yy_n_chars) + 2;
1532  register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1533  YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1534  register char *source =
1535  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1536 
1537  while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1538  *--dest = *--source;
1539 
1540  yy_cp += (int) (dest - source);
1541  yy_bp += (int) (dest - source);
1542  YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1543  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1544 
1545  if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1546  YY_FATAL_ERROR( "flex scanner push-back overflow" );
1547  }
1548 
1549  *--yy_cp = (char) c;
1550 
1551  if ( c == '\n' ){
1552  --_w32_lineno;
1553  }
1554 
1555  (yytext_ptr) = yy_bp;
1556  (yy_hold_char) = *yy_cp;
1557  (yy_c_buf_p) = yy_cp;
1558 }
1559 
1560 #ifndef YY_NO_INPUT
1561 #ifdef __cplusplus
1562  static int yyinput (void)
1563 #else
1564  static int input (void)
1565 #endif
1566 
1567 {
1568  int c;
1569 
1570  *(yy_c_buf_p) = (yy_hold_char);
1571 
1572  if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1573  {
1574  /* yy_c_buf_p now points to the character we want to return.
1575  * If this occurs *before* the EOB characters, then it's a
1576  * valid NUL; if not, then we've hit the end of the buffer.
1577  */
1578  if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1579  /* This was really a NUL. */
1580  *(yy_c_buf_p) = '\0';
1581 
1582  else
1583  { /* need more input */
1584  int offset = (yy_c_buf_p) - (yytext_ptr);
1585  ++(yy_c_buf_p);
1586 
1587  switch ( yy_get_next_buffer( ) )
1588  {
1589  case EOB_ACT_LAST_MATCH:
1590  /* This happens because yy_g_n_b()
1591  * sees that we've accumulated a
1592  * token and flags that we need to
1593  * try matching the token before
1594  * proceeding. But for input(),
1595  * there's no matching to consider.
1596  * So convert the EOB_ACT_LAST_MATCH
1597  * to EOB_ACT_END_OF_FILE.
1598  */
1599 
1600  /* Reset buffer status. */
1601  _w32_restart(_w32_in );
1602 
1603  /*FALLTHROUGH*/
1604 
1605  case EOB_ACT_END_OF_FILE:
1606  {
1607  if ( _w32_wrap( ) )
1608  return EOF;
1609 
1610  if ( ! (yy_did_buffer_switch_on_eof) )
1611  YY_NEW_FILE;
1612 #ifdef __cplusplus
1613  return yyinput();
1614 #else
1615  return input();
1616 #endif
1617  }
1618 
1619  case EOB_ACT_CONTINUE_SCAN:
1620  (yy_c_buf_p) = (yytext_ptr) + offset;
1621  break;
1622  }
1623  }
1624  }
1625 
1626  c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1627  *(yy_c_buf_p) = '\0'; /* preserve _w32_text */
1628  (yy_hold_char) = *++(yy_c_buf_p);
1629 
1630  if ( c == '\n' )
1631 
1632  _w32_lineno++;
1633 ;
1634 
1635  return c;
1636 }
1637 #endif /* ifndef YY_NO_INPUT */
1638 
1644  void _w32_restart (FILE * input_file )
1645 {
1646 
1647  if ( ! YY_CURRENT_BUFFER ){
1648  _w32_ensure_buffer_stack ();
1649  YY_CURRENT_BUFFER_LVALUE =
1650  _w32__create_buffer(_w32_in,YY_BUF_SIZE );
1651  }
1652 
1653  _w32__init_buffer(YY_CURRENT_BUFFER,input_file );
1654  _w32__load_buffer_state( );
1655 }
1656 
1661  void _w32__switch_to_buffer (YY_BUFFER_STATE new_buffer )
1662 {
1663 
1664  /* TODO. We should be able to replace this entire function body
1665  * with
1666  * _w32_pop_buffer_state();
1667  * _w32_push_buffer_state(new_buffer);
1668  */
1669  _w32_ensure_buffer_stack ();
1670  if ( YY_CURRENT_BUFFER == new_buffer )
1671  return;
1672 
1673  if ( YY_CURRENT_BUFFER )
1674  {
1675  /* Flush out information for old buffer. */
1676  *(yy_c_buf_p) = (yy_hold_char);
1677  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1678  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1679  }
1680 
1681  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1682  _w32__load_buffer_state( );
1683 
1684  /* We don't actually know whether we did this switch during
1685  * EOF (_w32_wrap()) processing, but the only time this flag
1686  * is looked at is after _w32_wrap() is called, so it's safe
1687  * to go ahead and always set it.
1688  */
1689  (yy_did_buffer_switch_on_eof) = 1;
1690 }
1691 
1692 static void _w32__load_buffer_state (void)
1693 {
1694  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1695  (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1696  _w32_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1697  (yy_hold_char) = *(yy_c_buf_p);
1698 }
1699 
1706  YY_BUFFER_STATE _w32__create_buffer (FILE * file, int size )
1707 {
1708  YY_BUFFER_STATE b;
1709 
1710  b = (YY_BUFFER_STATE) _w32_alloc(sizeof( struct yy_buffer_state ) );
1711  if ( ! b )
1712  YY_FATAL_ERROR( "out of dynamic memory in _w32__create_buffer()" );
1713 
1714  b->yy_buf_size = size;
1715 
1716  /* yy_ch_buf has to be 2 characters longer than the size given because
1717  * we need to put in 2 end-of-buffer characters.
1718  */
1719  b->yy_ch_buf = (char *) _w32_alloc(b->yy_buf_size + 2 );
1720  if ( ! b->yy_ch_buf )
1721  YY_FATAL_ERROR( "out of dynamic memory in _w32__create_buffer()" );
1722 
1723  b->yy_is_our_buffer = 1;
1724 
1725  _w32__init_buffer(b,file );
1726 
1727  return b;
1728 }
1729 
1734  void _w32__delete_buffer (YY_BUFFER_STATE b )
1735 {
1736 
1737  if ( ! b )
1738  return;
1739 
1740  if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1741  YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1742 
1743  if ( b->yy_is_our_buffer )
1744  _w32_free((void *) b->yy_ch_buf );
1745 
1746  _w32_free((void *) b );
1747 }
1748 
1749 /* Initializes or reinitializes a buffer.
1750  * This function is sometimes called more than once on the same buffer,
1751  * such as during a _w32_restart() or at EOF.
1752  */
1753  static void _w32__init_buffer (YY_BUFFER_STATE b, FILE * file )
1754 
1755 {
1756  int oerrno = errno;
1757 
1758  _w32__flush_buffer(b );
1759 
1760  b->yy_input_file = file;
1761  b->yy_fill_buffer = 1;
1762 
1763  /* If b is the current buffer, then _w32__init_buffer was _probably_
1764  * called from _w32_restart() or through yy_get_next_buffer.
1765  * In that case, we don't want to reset the lineno or column.
1766  */
1767  if (b != YY_CURRENT_BUFFER){
1768  b->yy_bs_lineno = 1;
1769  b->yy_bs_column = 0;
1770  }
1771 
1772  b->yy_is_interactive = 0;
1773 
1774  errno = oerrno;
1775 }
1776 
1781  void _w32__flush_buffer (YY_BUFFER_STATE b )
1782 {
1783  if ( ! b )
1784  return;
1785 
1786  b->yy_n_chars = 0;
1787 
1788  /* We always need two end-of-buffer characters. The first causes
1789  * a transition to the end-of-buffer state. The second causes
1790  * a jam in that state.
1791  */
1792  b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1793  b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1794 
1795  b->yy_buf_pos = &b->yy_ch_buf[0];
1796 
1797  b->yy_at_bol = 1;
1798  b->yy_buffer_status = YY_BUFFER_NEW;
1799 
1800  if ( b == YY_CURRENT_BUFFER )
1801  _w32__load_buffer_state( );
1802 }
1803 
1810 void _w32_push_buffer_state (YY_BUFFER_STATE new_buffer )
1811 {
1812  if (new_buffer == NULL)
1813  return;
1814 
1815  _w32_ensure_buffer_stack();
1816 
1817  /* This block is copied from _w32__switch_to_buffer. */
1818  if ( YY_CURRENT_BUFFER )
1819  {
1820  /* Flush out information for old buffer. */
1821  *(yy_c_buf_p) = (yy_hold_char);
1822  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1823  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1824  }
1825 
1826  /* Only push if top exists. Otherwise, replace top. */
1827  if (YY_CURRENT_BUFFER)
1828  (yy_buffer_stack_top)++;
1829  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1830 
1831  /* copied from _w32__switch_to_buffer. */
1832  _w32__load_buffer_state( );
1833  (yy_did_buffer_switch_on_eof) = 1;
1834 }
1835 
1840 void _w32_pop_buffer_state (void)
1841 {
1842  if (!YY_CURRENT_BUFFER)
1843  return;
1844 
1845  _w32__delete_buffer(YY_CURRENT_BUFFER );
1846  YY_CURRENT_BUFFER_LVALUE = NULL;
1847  if ((yy_buffer_stack_top) > 0)
1848  --(yy_buffer_stack_top);
1849 
1850  if (YY_CURRENT_BUFFER) {
1851  _w32__load_buffer_state( );
1852  (yy_did_buffer_switch_on_eof) = 1;
1853  }
1854 }
1855 
1856 /* Allocates the stack if it does not exist.
1857  * Guarantees space for at least one push.
1858  */
1859 static void _w32_ensure_buffer_stack (void)
1860 {
1861  int num_to_alloc;
1862 
1863  if (!(yy_buffer_stack)) {
1864 
1865  /* First allocation is just for 2 elements, since we don't know if this
1866  * scanner will even need a stack. We use 2 instead of 1 to avoid an
1867  * immediate realloc on the next call.
1868  */
1869  num_to_alloc = 1;
1870  (yy_buffer_stack) = (struct yy_buffer_state**)_w32_alloc
1871  (num_to_alloc * sizeof(struct yy_buffer_state*)
1872  );
1873  if ( ! (yy_buffer_stack) )
1874  YY_FATAL_ERROR( "out of dynamic memory in _w32_ensure_buffer_stack()" );
1875 
1876  memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1877 
1878  (yy_buffer_stack_max) = num_to_alloc;
1879  (yy_buffer_stack_top) = 0;
1880  return;
1881  }
1882 
1883  if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1884 
1885  /* Increase the buffer to prepare for a possible push. */
1886  int grow_size = 8 /* arbitrary grow size */;
1887 
1888  num_to_alloc = (yy_buffer_stack_max) + grow_size;
1889  (yy_buffer_stack) = (struct yy_buffer_state**)_w32_realloc
1890  ((yy_buffer_stack),
1891  num_to_alloc * sizeof(struct yy_buffer_state*)
1892  );
1893  if ( ! (yy_buffer_stack) )
1894  YY_FATAL_ERROR( "out of dynamic memory in _w32_ensure_buffer_stack()" );
1895 
1896  /* zero only the new slots.*/
1897  memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1898  (yy_buffer_stack_max) = num_to_alloc;
1899  }
1900 }
1901 
1908 YY_BUFFER_STATE _w32__scan_buffer (char * base, yy_size_t size )
1909 {
1910  YY_BUFFER_STATE b;
1911 
1912  if ( size < 2 ||
1913  base[size-2] != YY_END_OF_BUFFER_CHAR ||
1914  base[size-1] != YY_END_OF_BUFFER_CHAR )
1915  /* They forgot to leave room for the EOB's. */
1916  return 0;
1917 
1918  b = (YY_BUFFER_STATE) _w32_alloc(sizeof( struct yy_buffer_state ) );
1919  if ( ! b )
1920  YY_FATAL_ERROR( "out of dynamic memory in _w32__scan_buffer()" );
1921 
1922  b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1923  b->yy_buf_pos = b->yy_ch_buf = base;
1924  b->yy_is_our_buffer = 0;
1925  b->yy_input_file = 0;
1926  b->yy_n_chars = b->yy_buf_size;
1927  b->yy_is_interactive = 0;
1928  b->yy_at_bol = 1;
1929  b->yy_fill_buffer = 0;
1930  b->yy_buffer_status = YY_BUFFER_NEW;
1931 
1932  _w32__switch_to_buffer(b );
1933 
1934  return b;
1935 }
1936 
1945 YY_BUFFER_STATE _w32__scan_string (yyconst char * yystr )
1946 {
1947 
1948  return _w32__scan_bytes(yystr,strlen(yystr) );
1949 }
1950 
1958 YY_BUFFER_STATE _w32__scan_bytes (yyconst char * yybytes, int _yybytes_len )
1959 {
1960  YY_BUFFER_STATE b;
1961  char *buf;
1962  yy_size_t n;
1963  int i;
1964 
1965  /* Get memory for full buffer, including space for trailing EOB's. */
1966  n = _yybytes_len + 2;
1967  buf = (char *) _w32_alloc(n );
1968  if ( ! buf )
1969  YY_FATAL_ERROR( "out of dynamic memory in _w32__scan_bytes()" );
1970 
1971  for ( i = 0; i < _yybytes_len; ++i )
1972  buf[i] = yybytes[i];
1973 
1974  buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1975 
1976  b = _w32__scan_buffer(buf,n );
1977  if ( ! b )
1978  YY_FATAL_ERROR( "bad buffer in _w32__scan_bytes()" );
1979 
1980  /* It's okay to grow etc. this buffer, and we should throw it
1981  * away when we're done.
1982  */
1983  b->yy_is_our_buffer = 1;
1984 
1985  return b;
1986 }
1987 
1988 #ifndef YY_EXIT_FAILURE
1989 #define YY_EXIT_FAILURE 2
1990 #endif
1991 
1992 static void yy_fatal_error (yyconst char* msg )
1993 {
1994  (void) fprintf( stderr, "%s\n", msg );
1995  exit( YY_EXIT_FAILURE );
1996 }
1997 
1998 /* Redefine yyless() so it works in section 3 code. */
1999 
2000 #undef yyless
2001 #define yyless(n) \
2002  do \
2003  { \
2004  /* Undo effects of setting up _w32_text. */ \
2005  int yyless_macro_arg = (n); \
2006  YY_LESS_LINENO(yyless_macro_arg);\
2007  _w32_text[_w32_leng] = (yy_hold_char); \
2008  (yy_c_buf_p) = _w32_text + yyless_macro_arg; \
2009  (yy_hold_char) = *(yy_c_buf_p); \
2010  *(yy_c_buf_p) = '\0'; \
2011  _w32_leng = yyless_macro_arg; \
2012  } \
2013  while ( 0 )
2014 
2015 /* Accessor methods (get/set functions) to struct members. */
2016 
2020 int _w32_get_lineno (void)
2021 {
2022 
2023  return _w32_lineno;
2024 }
2025 
2029 FILE *_w32_get_in (void)
2030 {
2031  return _w32_in;
2032 }
2033 
2037 FILE *_w32_get_out (void)
2038 {
2039  return _w32_out;
2040 }
2041 
2045 int _w32_get_leng (void)
2046 {
2047  return _w32_leng;
2048 }
2049 
2054 char *_w32_get_text (void)
2055 {
2056  return _w32_text;
2057 }
2058 
2063 void _w32_set_lineno (int line_number )
2064 {
2065 
2066  _w32_lineno = line_number;
2067 }
2068 
2075 void _w32_set_in (FILE * in_str )
2076 {
2077  _w32_in = in_str ;
2078 }
2079 
2080 void _w32_set_out (FILE * out_str )
2081 {
2082  _w32_out = out_str ;
2083 }
2084 
2085 int _w32_get_debug (void)
2086 {
2087  return _w32__flex_debug;
2088 }
2089 
2090 void _w32_set_debug (int bdebug )
2091 {
2092  _w32__flex_debug = bdebug ;
2093 }
2094 
2095 static int yy_init_globals (void)
2096 {
2097  /* Initialization is the same as for the non-reentrant scanner.
2098  * This function is called from _w32_lex_destroy(), so don't allocate here.
2099  */
2100 
2101  /* We do not touch _w32_lineno unless the option is enabled. */
2102  _w32_lineno = 1;
2103 
2104  (yy_buffer_stack) = 0;
2105  (yy_buffer_stack_top) = 0;
2106  (yy_buffer_stack_max) = 0;
2107  (yy_c_buf_p) = (char *) 0;
2108  (yy_init) = 0;
2109  (yy_start) = 0;
2110 
2111 /* Defined in main.c */
2112 #ifdef YY_STDINIT
2113  _w32_in = stdin;
2114  _w32_out = stdout;
2115 #else
2116  _w32_in = (FILE *) 0;
2117  _w32_out = (FILE *) 0;
2118 #endif
2119 
2120  /* For future reference: Set errno on error, since we are called by
2121  * _w32_lex_init()
2122  */
2123  return 0;
2124 }
2125 
2126 /* _w32_lex_destroy is for both reentrant and non-reentrant scanners. */
2127 int _w32_lex_destroy (void)
2128 {
2129 
2130  /* Pop the buffer stack, destroying each element. */
2131  while(YY_CURRENT_BUFFER){
2132  _w32__delete_buffer(YY_CURRENT_BUFFER );
2133  YY_CURRENT_BUFFER_LVALUE = NULL;
2134  _w32_pop_buffer_state();
2135  }
2136 
2137  /* Destroy the stack itself. */
2138  _w32_free((yy_buffer_stack) );
2139  (yy_buffer_stack) = NULL;
2140 
2141  /* Reset the globals. This is important in a non-reentrant scanner so the next time
2142  * _w32_lex() is called, initialization will occur. */
2143  yy_init_globals( );
2144 
2145  return 0;
2146 }
2147 
2148 /*
2149  * Internal utility routines.
2150  */
2151 
2152 #ifndef yytext_ptr
2153 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2154 {
2155  register int i;
2156  for ( i = 0; i < n; ++i )
2157  s1[i] = s2[i];
2158 }
2159 #endif
2160 
2161 #ifdef YY_NEED_STRLEN
2162 static int yy_flex_strlen (yyconst char * s )
2163 {
2164  register int n;
2165  for ( n = 0; s[n]; ++n )
2166  ;
2167 
2168  return n;
2169 }
2170 #endif
2171 
2172 void *_w32_alloc (yy_size_t size )
2173 {
2174  return (void *) malloc( size );
2175 }
2176 
2177 void *_w32_realloc (void * ptr, yy_size_t size )
2178 {
2179  /* The cast to (char *) in the following accommodates both
2180  * implementations that use char* generic pointers, and those
2181  * that use void* generic pointers. It works with the latter
2182  * because both ANSI C and C++ allow castless assignment from
2183  * any pointer type to void*, and deal with argument conversions
2184  * as though doing an assignment.
2185  */
2186  return (void *) realloc( (char *) ptr, size );
2187 }
2188 
2189 void _w32_free (void * ptr )
2190 {
2191  free( (char *) ptr ); /* see _w32_realloc() for (char *) cast */
2192 }
2193 
2194 #define YYTABLES_NAME "yytables"
2195 
2196 #line 248 "lang.l"
2197 
2198 
2199 
2200 /*---------------------------------------------------------------------*/
2201 
2205 int _w32_wrap (void)
2206 {
2207  return (1);
2208 }
2209 
2213 static void AddChar (int ch)
2214 {
2215  if (ptr)
2216  {
2217  DEBUG ("'%c'", ch);
2218  *ptr++ = ch;
2219  if (ptr >= end)
2220  Error ("string too large");
2221  }
2222 }
2223 
2227 static void AddDecimal (const char *buf)
2228 {
2229  if (ptr)
2230  {
2231  int dec;
2232  sscanf (buf, "%3d", &dec);
2233  DEBUG ("'dec <%d>'", dec);
2234  *ptr++ = dec;
2235  if (dec > 255)
2236  Fatal ("Illegal decimal", NULL);
2237  if (ptr >= end)
2238  Error ("String too large");
2239  }
2240 }
2241 
2245 static void AddHexcode (const char *buf)
2246 {
2247  if (ptr)
2248  {
2249  WORD hex;
2250  sscanf (buf, "%2hx", &hex);
2251  DEBUG ("'hex <%X>'", hex);
2252  *ptr++ = loBYTE (hex);
2253  if (ptr >= end)
2254  Error ("string too large");
2255  }
2256 }
2257 
2261 static void AddOctal (const char *buf)
2262 {
2263  if (ptr)
2264  {
2265  unsigned oct;
2266  sscanf (buf, "%3o", &oct);
2267  DEBUG ("'oct <%o>'", oct);
2268  *ptr++ = loBYTE (oct);
2269  if (ptr >= end)
2270  Error ("string too large");
2271  }
2272 }
2273 
2277 static void AddEntry (void)
2278 {
2279  const char *str;
2280  struct Node *list = NULL;
2281 
2282  if ((str = strdup(buf)) == NULL ||
2283  (list = calloc(sizeof(*list),1)) == NULL)
2284  {
2285  (*_printf) ("Language file too big!\n");
2286  longjmp (bail_out, 1);
2287  }
2288 
2289  list->next = lang.list;
2290  list->crc = crc_ref;
2291  list->string = str;
2292  lang.list = list;
2293  lang.entries++;
2294  do_ref = TRUE;
2295 }
2296 
2301 static int MS_CDECL Compare (const struct Elem *a, const struct Elem *b)
2302 {
2303  return ((long)a->crc - (long)b->crc);
2304 }
2305 
2309 static int SortLanguageEntries (size_t num)
2310 {
2311  struct Node *lng, *next;
2312  struct Elem *array = (struct Elem*) calloc (num, sizeof(*array));
2313 
2314  lang.array = array;
2315  if (!array)
2316  return (0);
2317 
2318  for (lng = lang.list; lng; lng = next, array++)
2319  {
2320  array->crc = lng->crc;
2321  array->string = lng->string;
2322  next = lng->next;
2323  free (lng);
2324  }
2325  lang.list = NULL;
2326  qsort (lang.array, num, sizeof(*array), (CmpFunc)Compare);
2327  return (1);
2328 }
2329 
2330 /*
2331  * _w32_lex_destroy() isn't generated in all Flex'es. So make our own.
2332  */
2333 static void __lex_destroy (void)
2334 {
2335  /* Old Flex doesn't have this. But probably only on MSDOS where
2336  * freeing memory isn't so imporant.
2337  */
2338 #if defined(YY_CURRENT_BUFFER_LVALUE)
2339  /* Pop the buffer stack, destroying each element. */
2340  while (YY_CURRENT_BUFFER)
2341  {
2342  _w32__delete_buffer (YY_CURRENT_BUFFER);
2343  YY_CURRENT_BUFFER_LVALUE = NULL;
2344  _w32_pop_buffer_state();
2345  }
2346 
2347  /* Destroy the stack itself. */
2348  free (yy_buffer_stack);
2349  yy_buffer_stack = NULL;
2350 #else
2351  _w32__delete_buffer (YY_CURRENT_BUFFER);
2352 #endif
2353 }
2354 
2355 /*
2356  * Free memory allocated above.
2357  */
2358 static void lang_exit (void)
2359 {
2360  struct Elem *elem;
2361  size_t i;
2362 
2363  if (crc_table)
2364  free (crc_table);
2365  crc_table = NULL;
2366 
2367  if (!lang.array)
2368  return;
2369 
2370  for (i = 0, elem = lang.array; i < lang.entries; i++, elem++)
2371  free ((void*)elem->string);
2372  free (lang.array);
2373  lang.array = NULL;
2374  lang.entries = 0;
2375  __lex_destroy();
2376 }
2377 
2389 void lang_init (const char *value)
2390 {
2391  FILE *langf;
2392  char *s, *fname;
2393 
2394  if (!value)
2395  return;
2396 
2397  s = strchr (value, ',');
2398  if (!s || (s - value) != 2)
2399  {
2400  Fatal ("Illegal LANGUAGE syntax", NULL);
2401  return;
2402  }
2403 
2404  lang.line = 1;
2405  lang.prefix[0] = value[0];
2406  lang.prefix[1] = value[1];
2407  lang.prefix[2] = ':';
2408  lang.prefix[3] = '\0';
2409  strlwr (lang.prefix);
2410 
2411  if (!strnicmp(lang.prefix,"en",2)) /* english is default language */
2412  return;
2413 
2414  if (!crc_init())
2415  {
2416  Fatal ("CRC init failed", NULL);
2417  return;
2418  }
2419 
2420  fname = ++s;
2421  if (!FOPEN_BIN(langf,fname))
2422  {
2423  Fatal ("Cannot open language file ", fname);
2424  return;
2425  }
2426 
2427  if (!setjmp(bail_out))
2428  {
2429  _w32_in = langf;
2430  _w32_lex();
2431 
2432  if (!SortLanguageEntries(lang.entries))
2433  {
2434  FCLOSE (langf);
2435  Fatal ("Could not sort LANGUAGE entries", NULL);
2436  return;
2437  }
2438 #if defined(TEST_PROG)
2439  printf ("file-name = `%s'\n", fname);
2440  printf ("lang.prefix = `%s'\n", lang.prefix);
2441  printf ("lang.entries = %u\n", lang.entries);
2442  printf ("lang.lines = %u\n", lang.line);
2443  printf ("lang.list = %08lX\n", (DWORD)lang.list);
2444  printf ("lang.array = %08lX\n\n",(DWORD)lang.array);
2445  {
2446  const struct Elem *elem;
2447  size_t i;
2448 
2449  for (i = 0, elem = lang.array; i < lang.entries; i++, elem++)
2450  printf ("CRC = %08lX, <%s>\n", elem->crc, elem->string);
2451  }
2452 #endif
2453  }
2454  FCLOSE (langf);
2455  RUNDOWN_ADD (lang_exit, 302);
2456 }
2457 
2461 const char *lang_xlate (const char *str)
2462 {
2463  const struct Elem *elem;
2464  DWORD hash;
2465  size_t len;
2466 
2467  if (!lang.entries || !str)
2468  return (str);
2469 
2470  len = strlen (str);
2471  if (len == 0)
2472  return (str);
2473 
2474  hash = crc_bytes (str, len);
2475 
2476  elem = (const struct Elem*) bsearch (&hash, lang.array, lang.entries,
2477  sizeof(*elem), (CmpFunc)Compare);
2478 
2479  if (!elem || !elem->string || !elem->string[0])
2480  return (str);
2481 
2482  return (elem->string);
2483 }
2484 
2488 static void Fatal (const char *s1, const char *s2)
2489 {
2490  (*_printf) ("\n");
2491  if (lang.line > 0)
2492  (*_printf) ("line %u: ", lang.line);
2493  (*_printf) ("%s%s\n", s1, s2 ? s2 : "");
2494  lang_exit();
2495 }
2496 
2500 static void Error (const char *err)
2501 {
2502  (*_printf) ("%s at line %u\n", err, lang.line);
2503 }
2504 
2505 #if defined(TEST_PROG)
2506 int main (void)
2507 {
2508  puts ("You must define a non-english language to parse language-file.\n"
2509  "Use e.g: \"language = no,$(ETC)\\watlang.txt\" in WATTCP.CFG\n"
2510  "Press any key to initialise Watt-32.");
2511  getch();
2512  sock_init();
2513  return (0);
2514 }
2515 #endif /* TEST_PROG */
2516 #endif /* USE_LANGUAGE */
2517 
void lang_init(const char *value)
Initialize the linked list for language.
Definition: lang.c:2389
int yy_bs_lineno
The line count.
Definition: lang.c:265
Definition: lang.c:609
const char * lang_xlate(const char *str)
Return foreign translation of string `str'.
Definition: lang.c:2461
int yy_bs_column
The column count.
Definition: lang.c:266
Definition: lang.c:614
Definition: lang.c:603
int main(int argc, char **argv)
Definition: echo.c:223