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