1 #line 2 "gnvcal.c"
2 
3 #line 4 "gnvcal.c"
4 
5 #define  YY_INT_ALIGNED short int
6 
7 /* A lexical scanner generated by flex */
8 
9 #define FLEX_SCANNER
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 5
12 #define YY_FLEX_SUBMINOR_VERSION 35
13 #if YY_FLEX_SUBMINOR_VERSION > 0
14 #define FLEX_BETA
15 #endif
16 
17 /* First, we deal with  platform-specific or compiler-specific issues. */
18 
19 /* begin standard C headers. */
20 #include <stdio.h>
21 #include <string.h>
22 #include <errno.h>
23 #include <stdlib.h>
24 
25 /* end standard C headers. */
26 
27 /* flex integer type definitions */
28 
29 #ifndef FLEXINT_H
30 #define FLEXINT_H
31 
32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33 
34 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
35 
36 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37  * if you want the limit (max/min) macros for int types.
38  */
39 #ifndef __STDC_LIMIT_MACROS
40 #define __STDC_LIMIT_MACROS 1
41 #endif
42 
43 #include <inttypes.h>
44 typedef int8_t flex_int8_t;
45 typedef uint8_t flex_uint8_t;
46 typedef int16_t flex_int16_t;
47 typedef uint16_t flex_uint16_t;
48 typedef int32_t flex_int32_t;
49 typedef uint32_t flex_uint32_t;
50 #else
51 typedef signed char flex_int8_t;
52 typedef short int flex_int16_t;
53 typedef int flex_int32_t;
54 typedef unsigned char flex_uint8_t;
55 typedef unsigned short int flex_uint16_t;
56 typedef unsigned int flex_uint32_t;
57 
58 /* Limits of integral types. */
59 #ifndef INT8_MIN
60 #define INT8_MIN               (-128)
61 #endif
62 #ifndef INT16_MIN
63 #define INT16_MIN              (-32767-1)
64 #endif
65 #ifndef INT32_MIN
66 #define INT32_MIN              (-2147483647-1)
67 #endif
68 #ifndef INT8_MAX
69 #define INT8_MAX               (127)
70 #endif
71 #ifndef INT16_MAX
72 #define INT16_MAX              (32767)
73 #endif
74 #ifndef INT32_MAX
75 #define INT32_MAX              (2147483647)
76 #endif
77 #ifndef UINT8_MAX
78 #define UINT8_MAX              (255U)
79 #endif
80 #ifndef UINT16_MAX
81 #define UINT16_MAX             (65535U)
82 #endif
83 #ifndef UINT32_MAX
84 #define UINT32_MAX             (4294967295U)
85 #endif
86 
87 #endif /* ! C99 */
88 
89 #endif /* ! FLEXINT_H */
90 
91 #ifdef __cplusplus
92 
93 /* The "const" storage-class-modifier is valid. */
94 #define YY_USE_CONST
95 
96 #else	/* ! __cplusplus */
97 
98 /* C99 requires __STDC__ to be defined as 1. */
99 #if defined (__STDC__)
100 
101 #define YY_USE_CONST
102 
103 #endif	/* defined (__STDC__) */
104 #endif	/* ! __cplusplus */
105 
106 #ifdef YY_USE_CONST
107 #define yyconst const
108 #else
109 #define yyconst
110 #endif
111 
112 /* Returned upon end-of-file. */
113 #define YY_NULL 0
114 
115 /* Promotes a possibly negative, possibly signed char to an unsigned
116  * integer for use as an array index.  If the signed char is negative,
117  * we want to instead treat it as an 8-bit unsigned char, hence the
118  * double cast.
119  */
120 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
121 
122 /* Enter a start condition.  This macro really ought to take a parameter,
123  * but we do it the disgusting crufty way forced on us by the ()-less
124  * definition of BEGIN.
125  */
126 #define BEGIN (yy_start) = 1 + 2 *
127 
128 /* Translate the current start state into a value that can be later handed
129  * to BEGIN to return to the state.  The YYSTATE alias is for lex
130  * compatibility.
131  */
132 #define YY_START (((yy_start) - 1) / 2)
133 #define YYSTATE YY_START
134 
135 /* Action number for EOF rule of a given start state. */
136 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
137 
138 /* Special action meaning "start processing a new file". */
139 #define YY_NEW_FILE yyrestart(yyin  )
140 
141 #define YY_END_OF_BUFFER_CHAR 0
142 
143 /* Size of default input buffer. */
144 #ifndef YY_BUF_SIZE
145 #ifdef __ia64__
146 /* On IA-64, the buffer size is 16k, not 8k.
147  * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
148  * Ditto for the __ia64__ case accordingly.
149  */
150 #define YY_BUF_SIZE 32768
151 #else
152 #define YY_BUF_SIZE 16384
153 #endif /* __ia64__ */
154 #endif
155 
156 /* The state buf must be large enough to hold one state per character in the main buffer.
157  */
158 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
159 
160 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
161 #define YY_TYPEDEF_YY_BUFFER_STATE
162 typedef struct yy_buffer_state *YY_BUFFER_STATE;
163 #endif
164 
165 extern int yyleng;
166 
167 extern FILE *yyin, *yyout;
168 
169 #define EOB_ACT_CONTINUE_SCAN 0
170 #define EOB_ACT_END_OF_FILE 1
171 #define EOB_ACT_LAST_MATCH 2
172 
173     #define YY_LESS_LINENO(n)
174 
175 /* Return all but the first "n" matched characters back to the input stream. */
176 #define yyless(n) \
177 	do \
178 		{ \
179 		/* Undo effects of setting up yytext. */ \
180         int yyless_macro_arg = (n); \
181         YY_LESS_LINENO(yyless_macro_arg);\
182 		*yy_cp = (yy_hold_char); \
183 		YY_RESTORE_YY_MORE_OFFSET \
184 		(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
185 		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
186 		} \
187 	while ( 0 )
188 
189 #define unput(c) yyunput( c, (yytext_ptr)  )
190 
191 #ifndef YY_TYPEDEF_YY_SIZE_T
192 #define YY_TYPEDEF_YY_SIZE_T
193 typedef size_t yy_size_t;
194 #endif
195 
196 #ifndef YY_STRUCT_YY_BUFFER_STATE
197 #define YY_STRUCT_YY_BUFFER_STATE
198 struct yy_buffer_state
199 	{
200 	FILE *yy_input_file;
201 
202 	char *yy_ch_buf;		/* input buffer */
203 	char *yy_buf_pos;		/* current position in input buffer */
204 
205 	/* Size of input buffer in bytes, not including room for EOB
206 	 * characters.
207 	 */
208 	yy_size_t yy_buf_size;
209 
210 	/* Number of characters read into yy_ch_buf, not including EOB
211 	 * characters.
212 	 */
213 	int yy_n_chars;
214 
215 	/* Whether we "own" the buffer - i.e., we know we created it,
216 	 * and can realloc() it to grow it, and should free() it to
217 	 * delete it.
218 	 */
219 	int yy_is_our_buffer;
220 
221 	/* Whether this is an "interactive" input source; if so, and
222 	 * if we're using stdio for input, then we want to use getc()
223 	 * instead of fread(), to make sure we stop fetching input after
224 	 * each newline.
225 	 */
226 	int yy_is_interactive;
227 
228 	/* Whether we're considered to be at the beginning of a line.
229 	 * If so, '^' rules will be active on the next match, otherwise
230 	 * not.
231 	 */
232 	int yy_at_bol;
233 
234     int yy_bs_lineno; /**< The line count. */
235     int yy_bs_column; /**< The column count. */
236 
237 	/* Whether to try to fill the input buffer when we reach the
238 	 * end of it.
239 	 */
240 	int yy_fill_buffer;
241 
242 	int yy_buffer_status;
243 
244 #define YY_BUFFER_NEW 0
245 #define YY_BUFFER_NORMAL 1
246 	/* When an EOF's been seen but there's still some text to process
247 	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
248 	 * shouldn't try reading from the input source any more.  We might
249 	 * still have a bunch of tokens to match, though, because of
250 	 * possible backing-up.
251 	 *
252 	 * When we actually see the EOF, we change the status to "new"
253 	 * (via yyrestart()), so that the user can continue scanning by
254 	 * just pointing yyin at a new input file.
255 	 */
256 #define YY_BUFFER_EOF_PENDING 2
257 
258 	};
259 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
260 
261 /* Stack of input buffers. */
262 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
263 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
264 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
265 
266 /* We provide macros for accessing buffer states in case in the
267  * future we want to put the buffer states in a more general
268  * "scanner state".
269  *
270  * Returns the top of the stack, or NULL.
271  */
272 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
273                           ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
274                           : NULL)
275 
276 /* Same as previous macro, but useful when we know that the buffer stack is not
277  * NULL or when we need an lvalue. For internal use only.
278  */
279 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
280 
281 /* yy_hold_char holds the character lost when yytext is formed. */
282 static char yy_hold_char;
283 static int yy_n_chars;		/* number of characters read into yy_ch_buf */
284 int yyleng;
285 
286 /* Points to current character in buffer. */
287 static char *yy_c_buf_p = (char *) 0;
288 static int yy_init = 0;		/* whether we need to initialize */
289 static int yy_start = 0;	/* start state number */
290 
291 /* Flag which is used to allow yywrap()'s to do buffer switches
292  * instead of setting up a fresh yyin.  A bit of a hack ...
293  */
294 static int yy_did_buffer_switch_on_eof;
295 
296 void yyrestart (FILE *input_file  );
297 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
298 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size  );
299 void yy_delete_buffer (YY_BUFFER_STATE b  );
300 void yy_flush_buffer (YY_BUFFER_STATE b  );
301 void yypush_buffer_state (YY_BUFFER_STATE new_buffer  );
302 void yypop_buffer_state (void );
303 
304 static void yyensure_buffer_stack (void );
305 static void yy_load_buffer_state (void );
306 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file  );
307 
308 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
309 
310 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size  );
311 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str  );
312 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len  );
313 
314 void *yyalloc (yy_size_t  );
315 void *yyrealloc (void *,yy_size_t  );
316 void yyfree (void *  );
317 
318 #define yy_new_buffer yy_create_buffer
319 
320 #define yy_set_interactive(is_interactive) \
321 	{ \
322 	if ( ! YY_CURRENT_BUFFER ){ \
323         yyensure_buffer_stack (); \
324 		YY_CURRENT_BUFFER_LVALUE =    \
325             yy_create_buffer(yyin,YY_BUF_SIZE ); \
326 	} \
327 	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
328 	}
329 
330 #define yy_set_bol(at_bol) \
331 	{ \
332 	if ( ! YY_CURRENT_BUFFER ){\
333         yyensure_buffer_stack (); \
334 		YY_CURRENT_BUFFER_LVALUE =    \
335             yy_create_buffer(yyin,YY_BUF_SIZE ); \
336 	} \
337 	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
338 	}
339 
340 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
341 
342 /* Begin user sect3 */
343 
344 #define yywrap(n) 1
345 #define YY_SKIP_YYWRAP
346 
347 typedef unsigned char YY_CHAR;
348 
349 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
350 
351 typedef int yy_state_type;
352 
353 extern int yylineno;
354 
355 int yylineno = 1;
356 
357 extern char *yytext;
358 #define yytext_ptr yytext
359 
360 static yy_state_type yy_get_previous_state (void );
361 static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
362 static int yy_get_next_buffer (void );
363 static void yy_fatal_error (yyconst char msg[]  );
364 
365 /* Done after the current pattern has been matched and before the
366  * corresponding action - sets up yytext.
367  */
368 #define YY_DO_BEFORE_ACTION \
369 	(yytext_ptr) = yy_bp; \
370 	yyleng = (size_t) (yy_cp - yy_bp); \
371 	(yy_hold_char) = *yy_cp; \
372 	*yy_cp = '\0'; \
373 	(yy_c_buf_p) = yy_cp;
374 
375 #define YY_NUM_RULES 26
376 #define YY_END_OF_BUFFER 27
377 /* This struct is not used in this scanner,
378    but its presence is necessary. */
379 struct yy_trans_info
380 	{
381 	flex_int32_t yy_verify;
382 	flex_int32_t yy_nxt;
383 	};
384 static yyconst flex_int16_t yy_accept[231] =
385     {   0,
386         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
387         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
388         0,    0,    0,    0,    0,    0,   27,   25,   25,   25,
389        25,   25,   25,   25,   25,   25,   25,   25,   25,    9,
390        11,    5,   13,   25,   25,   25,   22,    7,    0,    0,
391         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
392         0,    9,   11,    5,   13,    0,    0,    0,   22,    0,
393         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
394         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
395         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
396 
397         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
398         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
399         0,    0,    0,    0,    0,    0,    0,    0,   16,    0,
400         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
401         0,    0,   18,    0,    0,   19,    0,    0,    0,    0,
402         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
403         0,    0,    0,   14,    0,    0,    0,   10,    0,    0,
404         4,    0,    0,    0,    0,    0,    0,    0,    0,    0,
405         0,    0,   21,    0,    6,    0,    0,    0,    0,    0,
406         0,    0,    0,    0,   23,    0,    0,    0,    0,    0,
407 
408         3,    0,    0,    8,    0,    0,    0,    0,    0,    2,
409         0,    0,   12,    0,    0,    0,    0,   24,    0,    0,
410         0,    0,    0,    0,    0,    1,   15,   17,   20,    0
411     } ;
412 
413 static yyconst flex_int32_t yy_ec[256] =
414     {   0,
415         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
416         1,    1,    2,    1,    1,    1,    1,    1,    1,    1,
417         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
418         1,    4,    5,    5,    5,    5,    5,    5,    5,    5,
419         5,    5,    5,    5,    5,    5,    5,    6,    6,    6,
420         6,    6,    6,    6,    6,    6,    6,    7,    5,    5,
421         5,    5,    5,    5,    8,    9,   10,   11,   12,    5,
422        13,    5,   14,    5,    5,   15,   16,   17,   18,   19,
423         5,   20,   21,   22,   23,   24,    5,    5,   25,    5,
424         5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
425 
426         5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
427         5,    5,    5,    5,    5,   26,    5,    5,    5,    5,
428         5,    5,    5,    5,    5,    5,    1,    1,    1,    1,
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,    1,    1,    1,    1,    1,
435         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
436 
437         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
438         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
439         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
440         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
441         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
442         1,    1,    1,    1,    1
443     } ;
444 
445 static yyconst flex_int32_t yy_meta[27] =
446     {   0,
447         1,    2,    2,    3,    4,    4,    3,    4,    4,    4,
448         4,    4,    4,    4,    4,    4,    4,    4,    4,    4,
449         4,    4,    4,    4,    4,    4
450     } ;
451 
452 static yyconst flex_int16_t yy_base[252] =
453     {   0,
454       280,  279,    0,    1,    6,    0,    1,    4,    0,    3,
455        27,   30,   33,   36,   39,   42,  281,  280,  279,  278,
456       277,  276,   45,   48,  275,  274,  279,  290,  266,  265,
457       259,  267,  266,   44,  256,  254,  248,  250,  246,    0,
458         0,    0,    0,  262,  261,  260,    0,  290,  252,  251,
459       252,  247,  239,  245,  238,    3,  247,  247,  240,  241,
460       238,    0,    0,    0,    0,  247,  246,  245,    0,  236,
461       235,  241,  239,  234,  237,  234,  226,  220,  234,  232,
462       223,  220,  221,  230,  229,  228,  216,  215,  207,  210,
463       216,  208,  207,  215,  217,  200,  201,  214,  201,  212,
464 
465       213,  212,  211,  209,  208,  204,  197,  194,  195,  196,
466       202,  188,  195,  192,  185,  190,  183,  196,  195,  194,
467       175,  174,  189,  189,  175,  187,  174,  185,  290,  169,
468       166,  171,  163,  165,  161,  179,  178,  177,  172,   41,
469       166,  173,  290,  165,  171,  290,  155,  169,  163,  157,
470       166,  147,  164,  164,  163,  162,  159,  142,  147,  152,
471       151,  148,  154,  290,  143,  152,  151,  290,  150,  149,
472       290,   32,   33,   35,  140,  142,  142,  135,  130,  132,
473       127,  141,  290,  140,  290,  140,  139,  138,  131,  125,
474       123,  129,  132,  121,  290,  131,  130,  129,  117,  111,
475 
476       290,  124,  124,  290,  123,  123,  122,  121,  115,  290,
477       105,  117,  290,  117,  116,  115,   57,  290,   58,   56,
478        54,    6,    5,    2,    1,  290,  290,  290,  290,  290,
479        66,   70,   74,   78,   82,   86,   88,   90,   92,   94,
480        96,   99,  101,  103,  105,  107,  109,  111,  113,  115,
481       117
482     } ;
483 
484 static yyconst flex_int16_t yy_def[252] =
485     {   0,
486       231,  231,  231,  231,  231,    5,  231,  231,  232,  232,
487       233,  233,  234,  234,  235,  235,  231,  231,  231,  231,
488       231,  231,  236,  236,  231,  231,  230,  230,  230,  230,
489       230,  230,  230,  230,  230,  230,  230,  230,  230,  237,
490       238,  239,  240,  230,  230,  230,  241,  230,  230,  230,
491       230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
492       230,  237,  238,  239,  240,  230,  230,  230,  241,  230,
493       230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
494       230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
495       230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
496 
497       230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
498       242,  230,  230,  230,  230,  230,  230,  230,  230,  230,
499       230,  230,  230,  243,  230,  244,  230,  242,  230,  230,
500       230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
501       230,  243,  230,  230,  244,  230,  230,  245,  230,  230,
502       246,  230,  247,  230,  230,  230,  230,  230,  230,  230,
503       230,  230,  245,  230,  230,  248,  246,  230,  249,  247,
504       230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
505       230,  248,  230,  249,  230,  230,  230,  230,  230,  230,
506       230,  230,  250,  230,  230,  230,  230,  230,  230,  230,
507 
508       230,  230,  250,  230,  251,  230,  230,  230,  230,  230,
509       230,  251,  230,  230,  230,  230,  230,  230,  230,  230,
510       230,  230,  230,  230,  230,  230,  230,  230,  230,    0,
511       230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
512       230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
513       230
514     } ;
515 
516 static yyconst flex_int16_t yy_nxt[317] =
517     {   0,
518        28,   28,   28,   28,   28,   28,  229,  228,   30,   30,
519       227,   31,   31,   32,   77,   33,   34,   35,  230,   38,
520        36,   39,   38,   78,   39,  226,   37,   28,   28,   28,
521        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
522        28,   28,   28,   28,   28,   28,   28,   28,   28,   28,
523        28,   54,  158,  186,  187,   55,  188,  186,  187,  225,
524       188,  224,  159,  223,  222,   56,   28,   28,   28,   28,
525        40,   40,   40,   40,   41,   41,   41,   41,   42,   42,
526        42,   42,   43,   43,   43,   43,   47,   47,   47,   47,
527        62,   62,   63,   63,   64,   64,   65,   65,   69,   69,
528 
529       128,  128,  142,  142,  145,  145,  163,  163,  167,  167,
530       170,  170,  182,  182,  184,  184,  203,  203,  212,  212,
531       221,  220,  219,  213,  218,  217,  216,  215,  214,  213,
532       204,  211,  210,  209,  208,  207,  206,  205,  204,  202,
533       201,  200,  199,  198,  197,  196,  185,  183,  195,  194,
534       193,  192,  191,  190,  189,  171,  185,  168,  183,  181,
535       164,  180,  179,  178,  177,  176,  175,  174,  173,  172,
536       171,  169,  168,  166,  165,  164,  162,  146,  161,  143,
537       160,  157,  156,  155,  154,  153,  152,  151,  150,  149,
538       148,  129,  147,  146,  144,  143,  141,  140,  139,  138,
539 
540       137,  136,  135,  134,  133,  132,  131,  130,  129,  127,
541       126,  125,  124,  123,  122,  121,  120,  119,  118,  117,
542       116,  115,  114,  113,  112,  111,  110,  109,  108,  107,
543       106,  105,  104,  103,  102,  101,  100,   99,   98,   97,
544        96,   95,   94,   93,   92,   91,   90,   89,   88,   87,
545        86,   85,   84,   83,   82,   81,   80,   79,   76,   75,
546        74,   73,   72,   71,   70,   68,   67,   66,   61,   60,
547        59,   58,   57,   53,   52,   51,   50,   49,  230,   48,
548        48,   46,   46,   45,   45,   44,   44,   29,   29,   27,
549       230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
550 
551       230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
552       230,  230,  230,  230,  230,  230
553     } ;
554 
555 static yyconst flex_int16_t yy_chk[317] =
556     {   0,
557         9,    9,    9,   10,   10,   10,  225,  224,    3,    4,
558       223,    3,    4,    5,   56,    5,    5,    5,    0,    7,
559         5,    7,    8,   56,    8,  222,    5,   11,   11,   11,
560        12,   12,   12,   13,   13,   13,   14,   14,   14,   15,
561        15,   15,   16,   16,   16,   23,   23,   23,   24,   24,
562        24,   34,  140,  172,  173,   34,  174,  172,  173,  221,
563       174,  220,  140,  219,  217,   34,  231,  231,  231,  231,
564       232,  232,  232,  232,  233,  233,  233,  233,  234,  234,
565       234,  234,  235,  235,  235,  235,  236,  236,  236,  236,
566       237,  237,  238,  238,  239,  239,  240,  240,  241,  241,
567 
568       242,  242,  243,  243,  244,  244,  245,  245,  246,  246,
569       247,  247,  248,  248,  249,  249,  250,  250,  251,  251,
570       216,  215,  214,  212,  211,  209,  208,  207,  206,  205,
571       203,  202,  200,  199,  198,  197,  196,  194,  193,  192,
572       191,  190,  189,  188,  187,  186,  184,  182,  181,  180,
573       179,  178,  177,  176,  175,  170,  169,  167,  166,  165,
574       163,  162,  161,  160,  159,  158,  157,  156,  155,  154,
575       153,  152,  151,  150,  149,  148,  147,  145,  144,  142,
576       141,  139,  138,  137,  136,  135,  134,  133,  132,  131,
577       130,  128,  127,  126,  125,  124,  123,  122,  121,  120,
578 
579       119,  118,  117,  116,  115,  114,  113,  112,  111,  110,
580       109,  108,  107,  106,  105,  104,  103,  102,  101,  100,
581        99,   98,   97,   96,   95,   94,   93,   92,   91,   90,
582        89,   88,   87,   86,   85,   84,   83,   82,   81,   80,
583        79,   78,   77,   76,   75,   74,   73,   72,   71,   70,
584        68,   67,   66,   61,   60,   59,   58,   57,   55,   54,
585        53,   52,   51,   50,   49,   46,   45,   44,   39,   38,
586        37,   36,   35,   33,   32,   31,   30,   29,   27,   26,
587        25,   22,   21,   20,   19,   18,   17,    2,    1,  230,
588       230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
589 
590       230,  230,  230,  230,  230,  230,  230,  230,  230,  230,
591       230,  230,  230,  230,  230,  230
592     } ;
593 
594 static yy_state_type yy_last_accepting_state;
595 static char *yy_last_accepting_cpos;
596 
597 extern int yy_flex_debug;
598 int yy_flex_debug = 0;
599 
600 /* The intent behind this definition is that it'll catch
601  * any uses of REJECT which flex missed.
602  */
603 #define REJECT reject_used_but_not_detected
604 #define yymore() yymore_used_but_not_detected
605 #define YY_MORE_ADJ 0
606 #define YY_RESTORE_YY_MORE_OFFSET
607 char *yytext;
608 #line 1 "./vcal.lx"
609 /*
610 
611   $Id$
612 
613   G N O K I I
614 
615   A Linux/Unix toolset and driver for Nokia mobile phones.
616 
617   This file is part of gnokii.
618 
619   Gnokii is free software; you can redistribute it and/or modify
620   it under the terms of the GNU General Public License as published by
621   the Free Software Foundation; either version 2 of the License, or
622   (at your option) any later version.
623 
624   Gnokii is distributed in the hope that it will be useful,
625   but WITHOUT ANY WARRANTY; without even the implied warranty of
626   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
627   GNU General Public License for more details.
628 
629   You should have received a copy of the GNU General Public License
630   along with gnokii; if not, write to the Free Software
631   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
632 
633   Copyright (C) 1999-2000  Hugh Blemings & Pavel Janik ml.
634 
635 */
636 #line 30 "./vcal.lx"
637 #include "config.h"
638 
639 #include <string.h>
640 
641 #include "config.h"
642 #include "compat.h"
643 #include "misc.h"
644 #include "gnokii.h"
645 #include "gsm-filetypes.h"
646 
647 #define YY_DECL int yylex(char *type,char *text,char *meeting_location,char *desc,char *time,char *endtime,char *alarm,char *todo_priority,int lexnumber)
648 int veventcounter = 0, vtodocounter = 0, alarmtone = 0;
649 
650 
651 
652 
653 
654 
655 
656 
657 
658 
659 
660 
661 
662 #line 663 "gnvcal.c"
663 
664 #define INITIAL 0
665 #define vcalendar 1
666 #define vevent 2
667 #define vtodo 3
668 #define category 4
669 #define summary 5
670 #define todosummary 6
671 #define description 7
672 #define ttime 8
673 #define etime 9
674 #define aalarm 10
675 #define loc 11
676 #define tpriority 12
677 
678 #ifndef YY_NO_UNISTD_H
679 /* Special case for "unistd.h", since it is non-ANSI. We include it way
680  * down here because we want the user's section 1 to have been scanned first.
681  * The user has a chance to override it with an option.
682  */
683 #include <unistd.h>
684 #endif
685 
686 #ifndef YY_EXTRA_TYPE
687 #define YY_EXTRA_TYPE void *
688 #endif
689 
690 static int yy_init_globals (void );
691 
692 /* Accessor methods to globals.
693    These are made visible to non-reentrant scanners for convenience. */
694 
695 int yylex_destroy (void );
696 
697 int yyget_debug (void );
698 
699 void yyset_debug (int debug_flag  );
700 
701 YY_EXTRA_TYPE yyget_extra (void );
702 
703 void yyset_extra (YY_EXTRA_TYPE user_defined  );
704 
705 FILE *yyget_in (void );
706 
707 void yyset_in  (FILE * in_str  );
708 
709 FILE *yyget_out (void );
710 
711 void yyset_out  (FILE * out_str  );
712 
713 int yyget_leng (void );
714 
715 char *yyget_text (void );
716 
717 int yyget_lineno (void );
718 
719 void yyset_lineno (int line_number  );
720 
721 /* Macros after this point can all be overridden by user definitions in
722  * section 1.
723  */
724 
725 #ifndef YY_SKIP_YYWRAP
726 #ifdef __cplusplus
727 extern "C" int yywrap (void );
728 #else
729 extern int yywrap (void );
730 #endif
731 #endif
732 
733 #ifndef yytext_ptr
734 static void yy_flex_strncpy (char *,yyconst char *,int );
735 #endif
736 
737 #ifdef YY_NEED_STRLEN
738 static int yy_flex_strlen (yyconst char * );
739 #endif
740 
741 #ifndef YY_NO_INPUT
742 
743 #ifdef __cplusplus
744 static int yyinput (void );
745 #else
746 static int input (void );
747 #endif
748 
749 #endif
750 
751 /* Amount of stuff to slurp up with each read. */
752 #ifndef YY_READ_BUF_SIZE
753 #ifdef __ia64__
754 /* On IA-64, the buffer size is 16k, not 8k */
755 #define YY_READ_BUF_SIZE 16384
756 #else
757 #define YY_READ_BUF_SIZE 8192
758 #endif /* __ia64__ */
759 #endif
760 
761 /* Copy whatever the last rule matched to the standard output. */
762 #ifndef ECHO
763 /* This used to be an fputs(), but since the string might contain NUL's,
764  * we now use fwrite().
765  */
766 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
767 #endif
768 
769 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
770  * is returned in "result".
771  */
772 #ifndef YY_INPUT
773 #define YY_INPUT(buf,result,max_size) \
774 	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
775 		{ \
776 		int c = '*'; \
777 		size_t n; \
778 		for ( n = 0; n < max_size && \
779 			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
780 			buf[n] = (char) c; \
781 		if ( c == '\n' ) \
782 			buf[n++] = (char) c; \
783 		if ( c == EOF && ferror( yyin ) ) \
784 			YY_FATAL_ERROR( "input in flex scanner failed" ); \
785 		result = n; \
786 		} \
787 	else \
788 		{ \
789 		errno=0; \
790 		while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
791 			{ \
792 			if( errno != EINTR) \
793 				{ \
794 				YY_FATAL_ERROR( "input in flex scanner failed" ); \
795 				break; \
796 				} \
797 			errno=0; \
798 			clearerr(yyin); \
799 			} \
800 		}\
801 \
802 
803 #endif
804 
805 /* No semi-colon after return; correct usage is to write "yyterminate();" -
806  * we don't want an extra ';' after the "return" because that will cause
807  * some compilers to complain about unreachable statements.
808  */
809 #ifndef yyterminate
810 #define yyterminate() return YY_NULL
811 #endif
812 
813 /* Number of entries by which start-condition stack grows. */
814 #ifndef YY_START_STACK_INCR
815 #define YY_START_STACK_INCR 25
816 #endif
817 
818 /* Report a fatal error. */
819 #ifndef YY_FATAL_ERROR
820 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
821 #endif
822 
823 /* end tables serialization structures and prototypes */
824 
825 /* Default declaration of generated scanner - a define so the user can
826  * easily add parameters.
827  */
828 #ifndef YY_DECL
829 #define YY_DECL_IS_OURS 1
830 
831 extern int yylex (void);
832 
833 #define YY_DECL int yylex (void)
834 #endif /* !YY_DECL */
835 
836 /* Code executed at the beginning of each rule, after yytext and yyleng
837  * have been set up.
838  */
839 #ifndef YY_USER_ACTION
840 #define YY_USER_ACTION
841 #endif
842 
843 /* Code executed at the end of each rule. */
844 #ifndef YY_BREAK
845 #define YY_BREAK break;
846 #endif
847 
848 #define YY_RULE_SETUP \
849 	YY_USER_ACTION
850 
851 /** The main scanner function which does all the work.
852  */
853 YY_DECL
854 {
855 	register yy_state_type yy_current_state;
856 	register char *yy_cp, *yy_bp;
857 	register int yy_act;
858 
859 #line 60 "./vcal.lx"
860 
861 
862 #line 863 "gnvcal.c"
863 
864 	if ( !(yy_init) )
865 		{
866 		(yy_init) = 1;
867 
868 #ifdef YY_USER_INIT
869 		YY_USER_INIT;
870 #endif
871 
872 		if ( ! (yy_start) )
873 			(yy_start) = 1;	/* first start state */
874 
875 		if ( ! yyin )
876 			yyin = stdin;
877 
878 		if ( ! yyout )
879 			yyout = stdout;
880 
881 		if ( ! YY_CURRENT_BUFFER ) {
882 			yyensure_buffer_stack ();
883 			YY_CURRENT_BUFFER_LVALUE =
884 				yy_create_buffer(yyin,YY_BUF_SIZE );
885 		}
886 
887 		yy_load_buffer_state( );
888 		}
889 
890 	while ( 1 )		/* loops until end-of-file is reached */
891 		{
892 		yy_cp = (yy_c_buf_p);
893 
894 		/* Support of yytext. */
895 		*yy_cp = (yy_hold_char);
896 
897 		/* yy_bp points to the position in yy_ch_buf of the start of
898 		 * the current run.
899 		 */
900 		yy_bp = yy_cp;
901 
902 		yy_current_state = (yy_start);
903 yy_match:
904 		do
905 			{
906 			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
907 			if ( yy_accept[yy_current_state] )
908 				{
909 				(yy_last_accepting_state) = yy_current_state;
910 				(yy_last_accepting_cpos) = yy_cp;
911 				}
912 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
913 				{
914 				yy_current_state = (int) yy_def[yy_current_state];
915 				if ( yy_current_state >= 231 )
916 					yy_c = yy_meta[(unsigned int) yy_c];
917 				}
918 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
919 			++yy_cp;
920 			}
921 		while ( yy_base[yy_current_state] != 290 );
922 
923 yy_find_action:
924 		yy_act = yy_accept[yy_current_state];
925 		if ( yy_act == 0 )
926 			{ /* have to back up */
927 			yy_cp = (yy_last_accepting_cpos);
928 			yy_current_state = (yy_last_accepting_state);
929 			yy_act = yy_accept[yy_current_state];
930 			}
931 
932 		YY_DO_BEFORE_ACTION;
933 
934 do_action:	/* This label is used only to access EOF actions. */
935 
936 		switch ( yy_act )
937 	{ /* beginning of action switch */
938 			case 0: /* must back up */
939 			/* undo the effects of YY_DO_BEFORE_ACTION */
940 			*yy_cp = (yy_hold_char);
941 			yy_cp = (yy_last_accepting_cpos);
942 			yy_current_state = (yy_last_accepting_state);
943 			goto yy_find_action;
944 
945 case 1:
946 YY_RULE_SETUP
947 #line 62 "./vcal.lx"
948 BEGIN(vcalendar);
949 	YY_BREAK
950 case 2:
951 YY_RULE_SETUP
952 #line 64 "./vcal.lx"
953 ++veventcounter; BEGIN(vevent);
954 	YY_BREAK
955 case 3:
956 YY_RULE_SETUP
957 #line 66 "./vcal.lx"
958 ++vtodocounter; BEGIN(vtodo);
959 	YY_BREAK
960 case 4:
961 /* rule 4 can match eol */
962 YY_RULE_SETUP
963 #line 68 "./vcal.lx"
964 BEGIN(todosummary);
965 	YY_BREAK
966 case 5:
967 YY_RULE_SETUP
968 #line 70 "./vcal.lx"
969 {
970 						if (vtodocounter == lexnumber)
971 							snprintf(text, 256, "%s", yytext);
972 						BEGIN(vtodo);
973 					}
974 	YY_BREAK
975 case 6:
976 /* rule 6 can match eol */
977 YY_RULE_SETUP
978 #line 76 "./vcal.lx"
979 BEGIN(tpriority);
980 	YY_BREAK
981 case 7:
982 YY_RULE_SETUP
983 #line 78 "./vcal.lx"
984 {
985 						if (vtodocounter == lexnumber)
986 							snprintf(todo_priority, 1, "%s", yytext);
987 						BEGIN(vtodo);
988 					}
989 	YY_BREAK
990 case 8:
991 /* rule 8 can match eol */
992 YY_RULE_SETUP
993 #line 84 "./vcal.lx"
994 BEGIN(category);
995 	YY_BREAK
996 case 9:
997 YY_RULE_SETUP
998 #line 86 "./vcal.lx"
999 {
1000 						if (veventcounter == lexnumber)
1001 							snprintf(type, 21, "%s", yytext);
1002 						BEGIN(vevent);
1003 					}
1004 	YY_BREAK
1005 case 10:
1006 /* rule 10 can match eol */
1007 YY_RULE_SETUP
1008 #line 92 "./vcal.lx"
1009 BEGIN(summary);
1010 	YY_BREAK
1011 case 11:
1012 YY_RULE_SETUP
1013 #line 94 "./vcal.lx"
1014 {
1015 						if (veventcounter == lexnumber)
1016 							snprintf(text, 256, "%s", yytext);
1017 						BEGIN(vevent);
1018 					}
1019 	YY_BREAK
1020 case 12:
1021 /* rule 12 can match eol */
1022 YY_RULE_SETUP
1023 #line 100 "./vcal.lx"
1024 BEGIN(description);
1025 	YY_BREAK
1026 case 13:
1027 YY_RULE_SETUP
1028 #line 102 "./vcal.lx"
1029 {
1030 						if (veventcounter == lexnumber)
1031 							snprintf(desc, 256, "%s", yytext);
1032 						BEGIN(vevent);
1033 					}
1034 	YY_BREAK
1035 case 14:
1036 /* rule 14 can match eol */
1037 YY_RULE_SETUP
1038 #line 108 "./vcal.lx"
1039 BEGIN(ttime);
1040 	YY_BREAK
1041 case 15:
1042 YY_RULE_SETUP
1043 #line 110 "./vcal.lx"
1044 {
1045 						if (veventcounter == lexnumber)
1046 							snprintf(time, 16, "%s", yytext);
1047 						BEGIN(vevent);
1048 					}
1049 	YY_BREAK
1050 case 16:
1051 /* rule 16 can match eol */
1052 YY_RULE_SETUP
1053 #line 116 "./vcal.lx"
1054 BEGIN(etime);
1055 	YY_BREAK
1056 case 17:
1057 YY_RULE_SETUP
1058 #line 118 "./vcal.lx"
1059 {
1060 						if (veventcounter == lexnumber)
1061 							snprintf(endtime, 16, "%s", yytext);
1062 						BEGIN(vevent);
1063 					}
1064 	YY_BREAK
1065 case 18:
1066 /* rule 18 can match eol */
1067 YY_RULE_SETUP
1068 #line 124 "./vcal.lx"
1069 {
1070 						BEGIN(aalarm);
1071 						dprintf("Alarm tone enabled\n");
1072 						alarmtone = 1;
1073 					}
1074 	YY_BREAK
1075 case 19:
1076 /* rule 19 can match eol */
1077 YY_RULE_SETUP
1078 #line 130 "./vcal.lx"
1079 {
1080 						BEGIN(aalarm);
1081 						dprintf("Alarm tone disabled\n");
1082 						alarmtone = 0;
1083 					}
1084 	YY_BREAK
1085 case 20:
1086 YY_RULE_SETUP
1087 #line 136 "./vcal.lx"
1088 {
1089 						if (veventcounter == lexnumber)
1090 							strncpy(alarm, yytext, 16);
1091 						BEGIN(vevent);
1092 					}
1093 	YY_BREAK
1094 case 21:
1095 /* rule 21 can match eol */
1096 YY_RULE_SETUP
1097 #line 143 "./vcal.lx"
1098 BEGIN(loc);
1099 	YY_BREAK
1100 case 22:
1101 YY_RULE_SETUP
1102 #line 145 "./vcal.lx"
1103 {
1104 						if (veventcounter == lexnumber)
1105 							snprintf(meeting_location, 64, "%s", yytext);
1106 						BEGIN(vevent);
1107 					}
1108 	YY_BREAK
1109 case 23:
1110 YY_RULE_SETUP
1111 #line 151 "./vcal.lx"
1112 BEGIN(vcalendar);
1113 	YY_BREAK
1114 case 24:
1115 YY_RULE_SETUP
1116 #line 153 "./vcal.lx"
1117 BEGIN(0);
1118 	YY_BREAK
1119 case 25:
1120 /* rule 25 can match eol */
1121 YY_RULE_SETUP
1122 #line 154 "./vcal.lx"
1123 
1124 	YY_BREAK
1125 case YY_STATE_EOF(INITIAL):
1126 case YY_STATE_EOF(vcalendar):
1127 case YY_STATE_EOF(vevent):
1128 case YY_STATE_EOF(vtodo):
1129 case YY_STATE_EOF(category):
1130 case YY_STATE_EOF(summary):
1131 case YY_STATE_EOF(todosummary):
1132 case YY_STATE_EOF(description):
1133 case YY_STATE_EOF(ttime):
1134 case YY_STATE_EOF(etime):
1135 case YY_STATE_EOF(aalarm):
1136 case YY_STATE_EOF(loc):
1137 case YY_STATE_EOF(tpriority):
1138 #line 155 "./vcal.lx"
1139 {
1140 	                                        if (((lexnumber > 0) && (lexnumber < veventcounter + 1)) ||
1141 						    ((lexnumber > 0) && (lexnumber < vtodocounter + 1)))
1142 						{
1143 							return 0;
1144 						}
1145 						fprintf(stderr, _("Error: Invalid calendar note number!\n"));
1146 						return -1;
1147 					}
1148 	YY_BREAK
1149 case 26:
1150 YY_RULE_SETUP
1151 #line 165 "./vcal.lx"
1152 ECHO;
1153 	YY_BREAK
1154 #line 1155 "gnvcal.c"
1155 
1156 	case YY_END_OF_BUFFER:
1157 		{
1158 		/* Amount of text matched not including the EOB char. */
1159 		int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1160 
1161 		/* Undo the effects of YY_DO_BEFORE_ACTION. */
1162 		*yy_cp = (yy_hold_char);
1163 		YY_RESTORE_YY_MORE_OFFSET
1164 
1165 		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1166 			{
1167 			/* We're scanning a new file or input source.  It's
1168 			 * possible that this happened because the user
1169 			 * just pointed yyin at a new source and called
1170 			 * yylex().  If so, then we have to assure
1171 			 * consistency between YY_CURRENT_BUFFER and our
1172 			 * globals.  Here is the right place to do so, because
1173 			 * this is the first action (other than possibly a
1174 			 * back-up) that will match for the new input source.
1175 			 */
1176 			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1177 			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1178 			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1179 			}
1180 
1181 		/* Note that here we test for yy_c_buf_p "<=" to the position
1182 		 * of the first EOB in the buffer, since yy_c_buf_p will
1183 		 * already have been incremented past the NUL character
1184 		 * (since all states make transitions on EOB to the
1185 		 * end-of-buffer state).  Contrast this with the test
1186 		 * in input().
1187 		 */
1188 		if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1189 			{ /* This was really a NUL. */
1190 			yy_state_type yy_next_state;
1191 
1192 			(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1193 
1194 			yy_current_state = yy_get_previous_state(  );
1195 
1196 			/* Okay, we're now positioned to make the NUL
1197 			 * transition.  We couldn't have
1198 			 * yy_get_previous_state() go ahead and do it
1199 			 * for us because it doesn't know how to deal
1200 			 * with the possibility of jamming (and we don't
1201 			 * want to build jamming into it because then it
1202 			 * will run more slowly).
1203 			 */
1204 
1205 			yy_next_state = yy_try_NUL_trans( yy_current_state );
1206 
1207 			yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1208 
1209 			if ( yy_next_state )
1210 				{
1211 				/* Consume the NUL. */
1212 				yy_cp = ++(yy_c_buf_p);
1213 				yy_current_state = yy_next_state;
1214 				goto yy_match;
1215 				}
1216 
1217 			else
1218 				{
1219 				yy_cp = (yy_c_buf_p);
1220 				goto yy_find_action;
1221 				}
1222 			}
1223 
1224 		else switch ( yy_get_next_buffer(  ) )
1225 			{
1226 			case EOB_ACT_END_OF_FILE:
1227 				{
1228 				(yy_did_buffer_switch_on_eof) = 0;
1229 
1230 				if ( yywrap( ) )
1231 					{
1232 					/* Note: because we've taken care in
1233 					 * yy_get_next_buffer() to have set up
1234 					 * yytext, we can now set up
1235 					 * yy_c_buf_p so that if some total
1236 					 * hoser (like flex itself) wants to
1237 					 * call the scanner after we return the
1238 					 * YY_NULL, it'll still work - another
1239 					 * YY_NULL will get returned.
1240 					 */
1241 					(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1242 
1243 					yy_act = YY_STATE_EOF(YY_START);
1244 					goto do_action;
1245 					}
1246 
1247 				else
1248 					{
1249 					if ( ! (yy_did_buffer_switch_on_eof) )
1250 						YY_NEW_FILE;
1251 					}
1252 				break;
1253 				}
1254 
1255 			case EOB_ACT_CONTINUE_SCAN:
1256 				(yy_c_buf_p) =
1257 					(yytext_ptr) + yy_amount_of_matched_text;
1258 
1259 				yy_current_state = yy_get_previous_state(  );
1260 
1261 				yy_cp = (yy_c_buf_p);
1262 				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1263 				goto yy_match;
1264 
1265 			case EOB_ACT_LAST_MATCH:
1266 				(yy_c_buf_p) =
1267 				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1268 
1269 				yy_current_state = yy_get_previous_state(  );
1270 
1271 				yy_cp = (yy_c_buf_p);
1272 				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1273 				goto yy_find_action;
1274 			}
1275 		break;
1276 		}
1277 
1278 	default:
1279 		YY_FATAL_ERROR(
1280 			"fatal flex scanner internal error--no action found" );
1281 	} /* end of action switch */
1282 		} /* end of scanning one token */
1283 } /* end of yylex */
1284 
1285 /* yy_get_next_buffer - try to read in a new buffer
1286  *
1287  * Returns a code representing an action:
1288  *	EOB_ACT_LAST_MATCH -
1289  *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1290  *	EOB_ACT_END_OF_FILE - end of file
1291  */
yy_get_next_buffer(void)1292 static int yy_get_next_buffer (void)
1293 {
1294     	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1295 	register char *source = (yytext_ptr);
1296 	register int number_to_move, i;
1297 	int ret_val;
1298 
1299 	if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1300 		YY_FATAL_ERROR(
1301 		"fatal flex scanner internal error--end of buffer missed" );
1302 
1303 	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1304 		{ /* Don't try to fill the buffer, so this is an EOF. */
1305 		if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1306 			{
1307 			/* We matched a single character, the EOB, so
1308 			 * treat this as a final EOF.
1309 			 */
1310 			return EOB_ACT_END_OF_FILE;
1311 			}
1312 
1313 		else
1314 			{
1315 			/* We matched some text prior to the EOB, first
1316 			 * process it.
1317 			 */
1318 			return EOB_ACT_LAST_MATCH;
1319 			}
1320 		}
1321 
1322 	/* Try to read more data. */
1323 
1324 	/* First move last chars to start of buffer. */
1325 	number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1326 
1327 	for ( i = 0; i < number_to_move; ++i )
1328 		*(dest++) = *(source++);
1329 
1330 	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1331 		/* don't do the read, it's not guaranteed to return an EOF,
1332 		 * just force an EOF
1333 		 */
1334 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1335 
1336 	else
1337 		{
1338 			int num_to_read =
1339 			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1340 
1341 		while ( num_to_read <= 0 )
1342 			{ /* Not enough room in the buffer - grow it. */
1343 
1344 			/* just a shorter name for the current buffer */
1345 			YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1346 
1347 			int yy_c_buf_p_offset =
1348 				(int) ((yy_c_buf_p) - b->yy_ch_buf);
1349 
1350 			if ( b->yy_is_our_buffer )
1351 				{
1352 				int new_size = b->yy_buf_size * 2;
1353 
1354 				if ( new_size <= 0 )
1355 					b->yy_buf_size += b->yy_buf_size / 8;
1356 				else
1357 					b->yy_buf_size *= 2;
1358 
1359 				b->yy_ch_buf = (char *)
1360 					/* Include room in for 2 EOB chars. */
1361 					yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
1362 				}
1363 			else
1364 				/* Can't grow it, we don't own it. */
1365 				b->yy_ch_buf = 0;
1366 
1367 			if ( ! b->yy_ch_buf )
1368 				YY_FATAL_ERROR(
1369 				"fatal error - scanner input buffer overflow" );
1370 
1371 			(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1372 
1373 			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1374 						number_to_move - 1;
1375 
1376 			}
1377 
1378 		if ( num_to_read > YY_READ_BUF_SIZE )
1379 			num_to_read = YY_READ_BUF_SIZE;
1380 
1381 		/* Read in more data. */
1382 		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1383 			(yy_n_chars), (size_t) num_to_read );
1384 
1385 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1386 		}
1387 
1388 	if ( (yy_n_chars) == 0 )
1389 		{
1390 		if ( number_to_move == YY_MORE_ADJ )
1391 			{
1392 			ret_val = EOB_ACT_END_OF_FILE;
1393 			yyrestart(yyin  );
1394 			}
1395 
1396 		else
1397 			{
1398 			ret_val = EOB_ACT_LAST_MATCH;
1399 			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1400 				YY_BUFFER_EOF_PENDING;
1401 			}
1402 		}
1403 
1404 	else
1405 		ret_val = EOB_ACT_CONTINUE_SCAN;
1406 
1407 	if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1408 		/* Extend the array by 50%, plus the number we really need. */
1409 		yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1410 		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
1411 		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1412 			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1413 	}
1414 
1415 	(yy_n_chars) += number_to_move;
1416 	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1417 	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1418 
1419 	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1420 
1421 	return ret_val;
1422 }
1423 
1424 /* yy_get_previous_state - get the state just before the EOB char was reached */
1425 
yy_get_previous_state(void)1426     static yy_state_type yy_get_previous_state (void)
1427 {
1428 	register yy_state_type yy_current_state;
1429 	register char *yy_cp;
1430 
1431 	yy_current_state = (yy_start);
1432 
1433 	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1434 		{
1435 		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1436 		if ( yy_accept[yy_current_state] )
1437 			{
1438 			(yy_last_accepting_state) = yy_current_state;
1439 			(yy_last_accepting_cpos) = yy_cp;
1440 			}
1441 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1442 			{
1443 			yy_current_state = (int) yy_def[yy_current_state];
1444 			if ( yy_current_state >= 231 )
1445 				yy_c = yy_meta[(unsigned int) yy_c];
1446 			}
1447 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1448 		}
1449 
1450 	return yy_current_state;
1451 }
1452 
1453 /* yy_try_NUL_trans - try to make a transition on the NUL character
1454  *
1455  * synopsis
1456  *	next_state = yy_try_NUL_trans( current_state );
1457  */
yy_try_NUL_trans(yy_state_type yy_current_state)1458     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
1459 {
1460 	register int yy_is_jam;
1461     	register char *yy_cp = (yy_c_buf_p);
1462 
1463 	register YY_CHAR yy_c = 1;
1464 	if ( yy_accept[yy_current_state] )
1465 		{
1466 		(yy_last_accepting_state) = yy_current_state;
1467 		(yy_last_accepting_cpos) = yy_cp;
1468 		}
1469 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1470 		{
1471 		yy_current_state = (int) yy_def[yy_current_state];
1472 		if ( yy_current_state >= 231 )
1473 			yy_c = yy_meta[(unsigned int) yy_c];
1474 		}
1475 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1476 	yy_is_jam = (yy_current_state == 230);
1477 
1478 	return yy_is_jam ? 0 : yy_current_state;
1479 }
1480 
1481 #ifndef YY_NO_INPUT
1482 #ifdef __cplusplus
yyinput(void)1483     static int yyinput (void)
1484 #else
1485     static int input  (void)
1486 #endif
1487 
1488 {
1489 	int c;
1490 
1491 	*(yy_c_buf_p) = (yy_hold_char);
1492 
1493 	if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1494 		{
1495 		/* yy_c_buf_p now points to the character we want to return.
1496 		 * If this occurs *before* the EOB characters, then it's a
1497 		 * valid NUL; if not, then we've hit the end of the buffer.
1498 		 */
1499 		if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1500 			/* This was really a NUL. */
1501 			*(yy_c_buf_p) = '\0';
1502 
1503 		else
1504 			{ /* need more input */
1505 			int offset = (yy_c_buf_p) - (yytext_ptr);
1506 			++(yy_c_buf_p);
1507 
1508 			switch ( yy_get_next_buffer(  ) )
1509 				{
1510 				case EOB_ACT_LAST_MATCH:
1511 					/* This happens because yy_g_n_b()
1512 					 * sees that we've accumulated a
1513 					 * token and flags that we need to
1514 					 * try matching the token before
1515 					 * proceeding.  But for input(),
1516 					 * there's no matching to consider.
1517 					 * So convert the EOB_ACT_LAST_MATCH
1518 					 * to EOB_ACT_END_OF_FILE.
1519 					 */
1520 
1521 					/* Reset buffer status. */
1522 					yyrestart(yyin );
1523 
1524 					/*FALLTHROUGH*/
1525 
1526 				case EOB_ACT_END_OF_FILE:
1527 					{
1528 					if ( yywrap( ) )
1529 						return EOF;
1530 
1531 					if ( ! (yy_did_buffer_switch_on_eof) )
1532 						YY_NEW_FILE;
1533 #ifdef __cplusplus
1534 					return yyinput();
1535 #else
1536 					return input();
1537 #endif
1538 					}
1539 
1540 				case EOB_ACT_CONTINUE_SCAN:
1541 					(yy_c_buf_p) = (yytext_ptr) + offset;
1542 					break;
1543 				}
1544 			}
1545 		}
1546 
1547 	c = *(unsigned char *) (yy_c_buf_p);	/* cast for 8-bit char's */
1548 	*(yy_c_buf_p) = '\0';	/* preserve yytext */
1549 	(yy_hold_char) = *++(yy_c_buf_p);
1550 
1551 	return c;
1552 }
1553 #endif	/* ifndef YY_NO_INPUT */
1554 
1555 /** Immediately switch to a different input stream.
1556  * @param input_file A readable stream.
1557  *
1558  * @note This function does not reset the start condition to @c INITIAL .
1559  */
yyrestart(FILE * input_file)1560     void yyrestart  (FILE * input_file )
1561 {
1562 
1563 	if ( ! YY_CURRENT_BUFFER ){
1564         yyensure_buffer_stack ();
1565 		YY_CURRENT_BUFFER_LVALUE =
1566             yy_create_buffer(yyin,YY_BUF_SIZE );
1567 	}
1568 
1569 	yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1570 	yy_load_buffer_state( );
1571 }
1572 
1573 /** Switch to a different input buffer.
1574  * @param new_buffer The new input buffer.
1575  *
1576  */
yy_switch_to_buffer(YY_BUFFER_STATE new_buffer)1577     void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
1578 {
1579 
1580 	/* TODO. We should be able to replace this entire function body
1581 	 * with
1582 	 *		yypop_buffer_state();
1583 	 *		yypush_buffer_state(new_buffer);
1584      */
1585 	yyensure_buffer_stack ();
1586 	if ( YY_CURRENT_BUFFER == new_buffer )
1587 		return;
1588 
1589 	if ( YY_CURRENT_BUFFER )
1590 		{
1591 		/* Flush out information for old buffer. */
1592 		*(yy_c_buf_p) = (yy_hold_char);
1593 		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1594 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1595 		}
1596 
1597 	YY_CURRENT_BUFFER_LVALUE = new_buffer;
1598 	yy_load_buffer_state( );
1599 
1600 	/* We don't actually know whether we did this switch during
1601 	 * EOF (yywrap()) processing, but the only time this flag
1602 	 * is looked at is after yywrap() is called, so it's safe
1603 	 * to go ahead and always set it.
1604 	 */
1605 	(yy_did_buffer_switch_on_eof) = 1;
1606 }
1607 
yy_load_buffer_state(void)1608 static void yy_load_buffer_state  (void)
1609 {
1610     	(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1611 	(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1612 	yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1613 	(yy_hold_char) = *(yy_c_buf_p);
1614 }
1615 
1616 /** Allocate and initialize an input buffer state.
1617  * @param file A readable stream.
1618  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1619  *
1620  * @return the allocated buffer state.
1621  */
yy_create_buffer(FILE * file,int size)1622     YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
1623 {
1624 	YY_BUFFER_STATE b;
1625 
1626 	b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
1627 	if ( ! b )
1628 		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1629 
1630 	b->yy_buf_size = size;
1631 
1632 	/* yy_ch_buf has to be 2 characters longer than the size given because
1633 	 * we need to put in 2 end-of-buffer characters.
1634 	 */
1635 	b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2  );
1636 	if ( ! b->yy_ch_buf )
1637 		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1638 
1639 	b->yy_is_our_buffer = 1;
1640 
1641 	yy_init_buffer(b,file );
1642 
1643 	return b;
1644 }
1645 
1646 /** Destroy the buffer.
1647  * @param b a buffer created with yy_create_buffer()
1648  *
1649  */
yy_delete_buffer(YY_BUFFER_STATE b)1650     void yy_delete_buffer (YY_BUFFER_STATE  b )
1651 {
1652 
1653 	if ( ! b )
1654 		return;
1655 
1656 	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1657 		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1658 
1659 	if ( b->yy_is_our_buffer )
1660 		yyfree((void *) b->yy_ch_buf  );
1661 
1662 	yyfree((void *) b  );
1663 }
1664 
1665 #ifndef __cplusplus
1666 extern int isatty (int );
1667 #endif /* __cplusplus */
1668 
1669 /* Initializes or reinitializes a buffer.
1670  * This function is sometimes called more than once on the same buffer,
1671  * such as during a yyrestart() or at EOF.
1672  */
yy_init_buffer(YY_BUFFER_STATE b,FILE * file)1673     static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
1674 
1675 {
1676 	int oerrno = errno;
1677 
1678 	yy_flush_buffer(b );
1679 
1680 	b->yy_input_file = file;
1681 	b->yy_fill_buffer = 1;
1682 
1683     /* If b is the current buffer, then yy_init_buffer was _probably_
1684      * called from yyrestart() or through yy_get_next_buffer.
1685      * In that case, we don't want to reset the lineno or column.
1686      */
1687     if (b != YY_CURRENT_BUFFER){
1688         b->yy_bs_lineno = 1;
1689         b->yy_bs_column = 0;
1690     }
1691 
1692         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1693 
1694 	errno = oerrno;
1695 }
1696 
1697 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1698  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1699  *
1700  */
yy_flush_buffer(YY_BUFFER_STATE b)1701     void yy_flush_buffer (YY_BUFFER_STATE  b )
1702 {
1703     	if ( ! b )
1704 		return;
1705 
1706 	b->yy_n_chars = 0;
1707 
1708 	/* We always need two end-of-buffer characters.  The first causes
1709 	 * a transition to the end-of-buffer state.  The second causes
1710 	 * a jam in that state.
1711 	 */
1712 	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1713 	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1714 
1715 	b->yy_buf_pos = &b->yy_ch_buf[0];
1716 
1717 	b->yy_at_bol = 1;
1718 	b->yy_buffer_status = YY_BUFFER_NEW;
1719 
1720 	if ( b == YY_CURRENT_BUFFER )
1721 		yy_load_buffer_state( );
1722 }
1723 
1724 /** Pushes the new state onto the stack. The new state becomes
1725  *  the current state. This function will allocate the stack
1726  *  if necessary.
1727  *  @param new_buffer The new state.
1728  *
1729  */
yypush_buffer_state(YY_BUFFER_STATE new_buffer)1730 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1731 {
1732     	if (new_buffer == NULL)
1733 		return;
1734 
1735 	yyensure_buffer_stack();
1736 
1737 	/* This block is copied from yy_switch_to_buffer. */
1738 	if ( YY_CURRENT_BUFFER )
1739 		{
1740 		/* Flush out information for old buffer. */
1741 		*(yy_c_buf_p) = (yy_hold_char);
1742 		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1743 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1744 		}
1745 
1746 	/* Only push if top exists. Otherwise, replace top. */
1747 	if (YY_CURRENT_BUFFER)
1748 		(yy_buffer_stack_top)++;
1749 	YY_CURRENT_BUFFER_LVALUE = new_buffer;
1750 
1751 	/* copied from yy_switch_to_buffer. */
1752 	yy_load_buffer_state( );
1753 	(yy_did_buffer_switch_on_eof) = 1;
1754 }
1755 
1756 /** Removes and deletes the top of the stack, if present.
1757  *  The next element becomes the new top.
1758  *
1759  */
yypop_buffer_state(void)1760 void yypop_buffer_state (void)
1761 {
1762     	if (!YY_CURRENT_BUFFER)
1763 		return;
1764 
1765 	yy_delete_buffer(YY_CURRENT_BUFFER );
1766 	YY_CURRENT_BUFFER_LVALUE = NULL;
1767 	if ((yy_buffer_stack_top) > 0)
1768 		--(yy_buffer_stack_top);
1769 
1770 	if (YY_CURRENT_BUFFER) {
1771 		yy_load_buffer_state( );
1772 		(yy_did_buffer_switch_on_eof) = 1;
1773 	}
1774 }
1775 
1776 /* Allocates the stack if it does not exist.
1777  *  Guarantees space for at least one push.
1778  */
yyensure_buffer_stack(void)1779 static void yyensure_buffer_stack (void)
1780 {
1781 	int num_to_alloc;
1782 
1783 	if (!(yy_buffer_stack)) {
1784 
1785 		/* First allocation is just for 2 elements, since we don't know if this
1786 		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1787 		 * immediate realloc on the next call.
1788          */
1789 		num_to_alloc = 1;
1790 		(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1791 								(num_to_alloc * sizeof(struct yy_buffer_state*)
1792 								);
1793 		if ( ! (yy_buffer_stack) )
1794 			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1795 
1796 		memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1797 
1798 		(yy_buffer_stack_max) = num_to_alloc;
1799 		(yy_buffer_stack_top) = 0;
1800 		return;
1801 	}
1802 
1803 	if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1804 
1805 		/* Increase the buffer to prepare for a possible push. */
1806 		int grow_size = 8 /* arbitrary grow size */;
1807 
1808 		num_to_alloc = (yy_buffer_stack_max) + grow_size;
1809 		(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1810 								((yy_buffer_stack),
1811 								num_to_alloc * sizeof(struct yy_buffer_state*)
1812 								);
1813 		if ( ! (yy_buffer_stack) )
1814 			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1815 
1816 		/* zero only the new slots.*/
1817 		memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1818 		(yy_buffer_stack_max) = num_to_alloc;
1819 	}
1820 }
1821 
1822 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1823  * @param base the character buffer
1824  * @param size the size in bytes of the character buffer
1825  *
1826  * @return the newly allocated buffer state object.
1827  */
yy_scan_buffer(char * base,yy_size_t size)1828 YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
1829 {
1830 	YY_BUFFER_STATE b;
1831 
1832 	if ( size < 2 ||
1833 	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
1834 	     base[size-1] != YY_END_OF_BUFFER_CHAR )
1835 		/* They forgot to leave room for the EOB's. */
1836 		return 0;
1837 
1838 	b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
1839 	if ( ! b )
1840 		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1841 
1842 	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
1843 	b->yy_buf_pos = b->yy_ch_buf = base;
1844 	b->yy_is_our_buffer = 0;
1845 	b->yy_input_file = 0;
1846 	b->yy_n_chars = b->yy_buf_size;
1847 	b->yy_is_interactive = 0;
1848 	b->yy_at_bol = 1;
1849 	b->yy_fill_buffer = 0;
1850 	b->yy_buffer_status = YY_BUFFER_NEW;
1851 
1852 	yy_switch_to_buffer(b  );
1853 
1854 	return b;
1855 }
1856 
1857 /** Setup the input buffer state to scan a string. The next call to yylex() will
1858  * scan from a @e copy of @a str.
1859  * @param yystr a NUL-terminated string to scan
1860  *
1861  * @return the newly allocated buffer state object.
1862  * @note If you want to scan bytes that may contain NUL values, then use
1863  *       yy_scan_bytes() instead.
1864  */
yy_scan_string(yyconst char * yystr)1865 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1866 {
1867 
1868 	return yy_scan_bytes(yystr,strlen(yystr) );
1869 }
1870 
1871 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1872  * scan from a @e copy of @a bytes.
1873  * @param yybytes the byte buffer to scan
1874  * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1875  *
1876  * @return the newly allocated buffer state object.
1877  */
yy_scan_bytes(yyconst char * yybytes,int _yybytes_len)1878 YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
1879 {
1880 	YY_BUFFER_STATE b;
1881 	char *buf;
1882 	yy_size_t n;
1883 	int i;
1884 
1885 	/* Get memory for full buffer, including space for trailing EOB's. */
1886 	n = _yybytes_len + 2;
1887 	buf = (char *) yyalloc(n  );
1888 	if ( ! buf )
1889 		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1890 
1891 	for ( i = 0; i < _yybytes_len; ++i )
1892 		buf[i] = yybytes[i];
1893 
1894 	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1895 
1896 	b = yy_scan_buffer(buf,n );
1897 	if ( ! b )
1898 		YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1899 
1900 	/* It's okay to grow etc. this buffer, and we should throw it
1901 	 * away when we're done.
1902 	 */
1903 	b->yy_is_our_buffer = 1;
1904 
1905 	return b;
1906 }
1907 
1908 #ifndef YY_EXIT_FAILURE
1909 #define YY_EXIT_FAILURE 2
1910 #endif
1911 
yy_fatal_error(yyconst char * msg)1912 static void yy_fatal_error (yyconst char* msg )
1913 {
1914     	(void) fprintf( stderr, "%s\n", msg );
1915 	exit( YY_EXIT_FAILURE );
1916 }
1917 
1918 /* Redefine yyless() so it works in section 3 code. */
1919 
1920 #undef yyless
1921 #define yyless(n) \
1922 	do \
1923 		{ \
1924 		/* Undo effects of setting up yytext. */ \
1925         int yyless_macro_arg = (n); \
1926         YY_LESS_LINENO(yyless_macro_arg);\
1927 		yytext[yyleng] = (yy_hold_char); \
1928 		(yy_c_buf_p) = yytext + yyless_macro_arg; \
1929 		(yy_hold_char) = *(yy_c_buf_p); \
1930 		*(yy_c_buf_p) = '\0'; \
1931 		yyleng = yyless_macro_arg; \
1932 		} \
1933 	while ( 0 )
1934 
1935 /* Accessor  methods (get/set functions) to struct members. */
1936 
1937 /** Get the current line number.
1938  *
1939  */
yyget_lineno(void)1940 int yyget_lineno  (void)
1941 {
1942 
1943     return yylineno;
1944 }
1945 
1946 /** Get the input stream.
1947  *
1948  */
yyget_in(void)1949 FILE *yyget_in  (void)
1950 {
1951         return yyin;
1952 }
1953 
1954 /** Get the output stream.
1955  *
1956  */
yyget_out(void)1957 FILE *yyget_out  (void)
1958 {
1959         return yyout;
1960 }
1961 
1962 /** Get the length of the current token.
1963  *
1964  */
yyget_leng(void)1965 int yyget_leng  (void)
1966 {
1967         return yyleng;
1968 }
1969 
1970 /** Get the current token.
1971  *
1972  */
1973 
yyget_text(void)1974 char *yyget_text  (void)
1975 {
1976         return yytext;
1977 }
1978 
1979 /** Set the current line number.
1980  * @param line_number
1981  *
1982  */
yyset_lineno(int line_number)1983 void yyset_lineno (int  line_number )
1984 {
1985 
1986     yylineno = line_number;
1987 }
1988 
1989 /** Set the input stream. This does not discard the current
1990  * input buffer.
1991  * @param in_str A readable stream.
1992  *
1993  * @see yy_switch_to_buffer
1994  */
yyset_in(FILE * in_str)1995 void yyset_in (FILE *  in_str )
1996 {
1997         yyin = in_str ;
1998 }
1999 
yyset_out(FILE * out_str)2000 void yyset_out (FILE *  out_str )
2001 {
2002         yyout = out_str ;
2003 }
2004 
yyget_debug(void)2005 int yyget_debug  (void)
2006 {
2007         return yy_flex_debug;
2008 }
2009 
yyset_debug(int bdebug)2010 void yyset_debug (int  bdebug )
2011 {
2012         yy_flex_debug = bdebug ;
2013 }
2014 
yy_init_globals(void)2015 static int yy_init_globals (void)
2016 {
2017         /* Initialization is the same as for the non-reentrant scanner.
2018      * This function is called from yylex_destroy(), so don't allocate here.
2019      */
2020 
2021     (yy_buffer_stack) = 0;
2022     (yy_buffer_stack_top) = 0;
2023     (yy_buffer_stack_max) = 0;
2024     (yy_c_buf_p) = (char *) 0;
2025     (yy_init) = 0;
2026     (yy_start) = 0;
2027 
2028 /* Defined in main.c */
2029 #ifdef YY_STDINIT
2030     yyin = stdin;
2031     yyout = stdout;
2032 #else
2033     yyin = (FILE *) 0;
2034     yyout = (FILE *) 0;
2035 #endif
2036 
2037     /* For future reference: Set errno on error, since we are called by
2038      * yylex_init()
2039      */
2040     return 0;
2041 }
2042 
2043 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
yylex_destroy(void)2044 int yylex_destroy  (void)
2045 {
2046 
2047     /* Pop the buffer stack, destroying each element. */
2048 	while(YY_CURRENT_BUFFER){
2049 		yy_delete_buffer(YY_CURRENT_BUFFER  );
2050 		YY_CURRENT_BUFFER_LVALUE = NULL;
2051 		yypop_buffer_state();
2052 	}
2053 
2054 	/* Destroy the stack itself. */
2055 	yyfree((yy_buffer_stack) );
2056 	(yy_buffer_stack) = NULL;
2057 
2058     /* Reset the globals. This is important in a non-reentrant scanner so the next time
2059      * yylex() is called, initialization will occur. */
2060     yy_init_globals( );
2061 
2062     return 0;
2063 }
2064 
2065 /*
2066  * Internal utility routines.
2067  */
2068 
2069 #ifndef yytext_ptr
yy_flex_strncpy(char * s1,yyconst char * s2,int n)2070 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2071 {
2072 	register int i;
2073 	for ( i = 0; i < n; ++i )
2074 		s1[i] = s2[i];
2075 }
2076 #endif
2077 
2078 #ifdef YY_NEED_STRLEN
yy_flex_strlen(yyconst char * s)2079 static int yy_flex_strlen (yyconst char * s )
2080 {
2081 	register int n;
2082 	for ( n = 0; s[n]; ++n )
2083 		;
2084 
2085 	return n;
2086 }
2087 #endif
2088 
yyalloc(yy_size_t size)2089 void *yyalloc (yy_size_t  size )
2090 {
2091 	return (void *) malloc( size );
2092 }
2093 
yyrealloc(void * ptr,yy_size_t size)2094 void *yyrealloc  (void * ptr, yy_size_t  size )
2095 {
2096 	/* The cast to (char *) in the following accommodates both
2097 	 * implementations that use char* generic pointers, and those
2098 	 * that use void* generic pointers.  It works with the latter
2099 	 * because both ANSI C and C++ allow castless assignment from
2100 	 * any pointer type to void*, and deal with argument conversions
2101 	 * as though doing an assignment.
2102 	 */
2103 	return (void *) realloc( (char *) ptr, size );
2104 }
2105 
yyfree(void * ptr)2106 void yyfree (void * ptr )
2107 {
2108 	free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
2109 }
2110 
2111 #define YYTABLES_NAME "yytables"
2112 
2113 #line 165 "./vcal.lx"
2114 
2115 
2116 
2117 /**
2118 * vcal_time_get
2119 *
2120 * Fills vCalendar time string into gn_timestamp structure
2121 *
2122 * in:
2123 *   dt:  datetime structure
2124 *   time:  string in format yyyymmddThhmmss
2125 * out:
2126 *   <>0 if error
2127 */
vcal_time_get(gn_timestamp * dt,char * time)2128 int vcal_time_get(gn_timestamp *dt, char *time)
2129 {
2130 	char year[5] = "", month[3] = "", day[3] = "", hour[3] = "", minute[3] = "", second[3] = "";
2131 	dt->year = dt->month = dt->day = dt->hour = dt->minute = dt->second = dt->timezone = 0;
2132 
2133 	snprintf(year, 5, "%s", time);
2134 	snprintf(month, 3, "%s", time + 4);
2135 	snprintf(day, 3, "%s", time + 6);
2136 	snprintf(hour, 3, "%s", time + 9);
2137 	snprintf(minute, 3, "%s", time + 11);
2138 	snprintf(second, 3, "%s", time + 13);
2139 
2140 	dprintf("\t%s-%s-%s %s:%s:%s\n", year, month, day, hour, minute, second);
2141 
2142 	/* FIXME: Should check ranges... */
2143 	dt->year = atoi(year);
2144 	dt->month = atoi(month);
2145 	dt->day = atoi(day);
2146 	dt->hour = atoi(hour);
2147 	dt->minute = atoi(minute);
2148 	dt->second = atoi(second);
2149 	/* FIXME */
2150 	dt->timezone = 0;
2151 
2152 	return 0;
2153 }
2154 
2155 /**
2156 * gn_calnote_fill
2157 *
2158 * Fills calendar data from strings into calendar note
2159 *
2160 * in:
2161 *   note:  calendar note structure
2162 *   type:  type of calendar note
2163 *   text:  text or phonenumber
2164 *   time:  string in format yyyymmddThhmmss
2165 *   alarm: dito
2166 * out:
2167 *   <>0 if error
2168 */
gn_calnote_fill(gn_calnote * note,char * type,char * text,char * meeting_location,char * desc,char * time,char * endtime,char * alarm)2169 static int gn_calnote_fill(gn_calnote *note, char *type, char *text, char *meeting_location,
2170 		    char *desc, char *time, char *endtime, char *alarm)
2171 {
2172 	dprintf("Start time (YYYY-MM-DD HH:MM:SS):\n");
2173 	vcal_time_get(&note->time, time);
2174 	dprintf("End time (YYYY-MM-DD HH:MM:SS):\n");
2175 	vcal_time_get(&note->end_time, endtime);
2176 	dprintf("Alarm time (YYYY-MM-DD HH:MM:SS):\n");
2177 	vcal_time_get(&note->alarm.timestamp, alarm);
2178 	if (note->alarm.timestamp.year) {
2179 		note->alarm.enabled = 1;
2180 		note->alarm.tone = alarmtone;
2181 	}
2182 
2183 	snprintf(note->text, 256, "%s", text);
2184 	note->phone_number[0] = 0;
2185 	dprintf("Text: %s\n", note->text);
2186 
2187 	/* FIXME: Handle additional strings, maybe from configuration file */
2188 	if (!strcmp(type, "PHONE CALL")) {
2189 		snprintf(note->phone_number, 48, "%s", text);
2190 		dprintf("Phone: %s\n", note->phone_number);
2191 		if (desc[0] != 0) {
2192 			snprintf(note->text, 256, "%s", desc);
2193 			dprintf("Desc: %s\n", note->text);
2194 		}
2195 		note->type = GN_CALNOTE_CALL;
2196 	} else if (!strcmp(type, "MEETING")) {
2197 		note->type = GN_CALNOTE_MEETING;
2198 		if (meeting_location[0] != 0) {
2199 			snprintf(note->mlocation, 64, "%s", meeting_location);
2200 			dprintf("Location: %s\n", note->mlocation);
2201 		}
2202 	} else if (!strcmp(type, "SPECIAL OCCASION"))
2203 		note->type = GN_CALNOTE_BIRTHDAY;
2204 	else if (!strcmp(type, "REMINDER"))
2205 		note->type = GN_CALNOTE_REMINDER;
2206 	else
2207 		note->type = GN_CALNOTE_MEMO;
2208 
2209 	return 0;
2210 }
2211 
2212 /**
2213 * gn_vcal_file_event_read
2214 *
2215 * Reads vCalendar file and parses VEVENT entries
2216 *
2217 * in:
2218 *   FileName: name of vCalendar file
2219 *   cnote:  pointer to calendar note
2220 *   number:  number in file of calendar note to read
2221 * out:
2222 *   <>0 if error
2223 */
gn_vcal_file_event_read(char * filename,gn_calnote * cnote,int number)2224 int gn_vcal_file_event_read(char *filename, gn_calnote *cnote, int number)
2225 {
2226 	FILE *file;
2227 	char type[21] = "", text[257] = "", desc[257] = "", meeting_location[64] = "";
2228 	char time[16] = "", endtime[16] = "", alarm[16] = "";
2229 	char todo_priority[2] = "";
2230 
2231 	/* translators: %s are replaced by function names */
2232 	fprintf(stderr, _("Function %s() is deprecated. Use %s() instead.\n"), __FUNCTION__, "gn_ical2calnote");
2233 	file = fopen(filename, "r");
2234 	if (!file) {
2235 		fprintf(stderr, _("Can't open file %s for reading!\n"), filename);
2236 		return -1;
2237 	}
2238 
2239 	yyin = file;
2240 
2241 	memset(cnote, 0, sizeof(gn_calnote));
2242 
2243 	if (yylex(type,text,meeting_location,desc,time,endtime,alarm,todo_priority,number)) {
2244 		fprintf(stderr, _("Error parsing vCalendar file!\n"));
2245 		fclose(file);
2246 		return -1;
2247 	}
2248 	gn_calnote_fill(cnote, type, text, meeting_location, desc, time, endtime, alarm);
2249 
2250 	fclose(file);
2251 	return 0;
2252 }
2253 
2254 /**
2255 * gn_todo_fill
2256 *
2257 * Fills todo data from strings into ToDo
2258 *
2259 * in:
2260 *   note:  todo structure
2261 *   text:  text or phonenumber
2262 *   priority:  GN_TODO_HIGH (highest), GN_TODO_MEDIUM, GN_TODO_LOW (lowest)
2263 * out:
2264 *   <>0 if error
2265 */
gn_todo_fill(gn_todo * todonote,char * text,char * todo_priority)2266 static int gn_todo_fill(gn_todo *todonote, char *text, char *todo_priority)
2267 {
2268 	snprintf(todonote->text, GN_TODO_MAX_LENGTH, "%s", text);
2269 	todonote->priority = GN_TODO_MEDIUM;
2270 	if (todo_priority) todonote->priority = atoi(todo_priority);
2271 	return 0;
2272 }
2273 
2274 /**
2275 * gn_vcal_file_todo_read
2276 *
2277 * Reads vCalendar file and parses VTODO entries
2278 *
2279 * in:
2280 *   FileName: name of vCalendar file
2281 *   ctodo:  pointer to calendar note
2282 *   number:  number in file of calendar note to read
2283 * out:
2284 *   <>0 if error
2285 */
gn_vcal_file_todo_read(char * filename,gn_todo * ctodo,int number)2286 int gn_vcal_file_todo_read(char *filename, gn_todo *ctodo, int number)
2287 {
2288 	FILE *file;
2289 	char type[21] = "", text[258] = "", desc[258] = "";
2290 	char time[16] = "", endtime[16] = "", alarm[16] = "";
2291 	char todo_priority[3] = "", meeting_location[64] = "";
2292 
2293 	/* translators: %s are replaced by function names */
2294 	fprintf(stderr, _("Function %s() is deprecated. Use %s() instead.\n"), __FUNCTION__, "gn_ical2todo");
2295 	file = fopen(filename, "r");
2296 	if (!file) {
2297 		fprintf(stderr, _("Can't open file %s for reading!\n"), filename);
2298 		return -1;
2299 	}
2300 
2301 	yyin = file;
2302 
2303 	memset(ctodo, 0, sizeof(gn_todo));
2304 
2305 	if (yylex(type,text,meeting_location,desc,time,endtime,alarm,todo_priority,number)) {
2306 		fprintf(stderr, _("Error parsing vCalendar file!\n"));
2307 		fclose(file);
2308 		return -1;
2309 	}
2310 	gn_todo_fill(ctodo, text, todo_priority);
2311 
2312 	fclose(file);
2313 	return 0;
2314 }
2315 
2316