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