1/*
2 * Copyright (c) 2000-2002 Apple Computer, Inc. All Rights Reserved.
3 * The contents of this file constitute Original Code as defined in and are
4 * subject to the Apple Public Source License Version 1.2 (the 'License').
5 * You may not use this file except in compliance with the License. Please
6 * obtain a copy of the License at http://www.apple.com/publicsource and
7 * read it before using this file.
8 *
9 * This Original Code and all software distributed under the License are
10 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
11 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
12 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
13 * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please
14 * see the License for the specific language governing rights and
15 * limitations under the License.
16 */
17
18#ifdef WIN32
19#include <malloc.h>
20#include <stdlib.h>
21#endif
22
23#define yy_create_buffer tp_create_buffer
24#define yy_delete_buffer tp_delete_buffer
25#define yy_scan_buffer tp_scan_buffer
26#define yy_scan_string tp_scan_string
27#define yy_scan_bytes tp_scan_bytes
28#define yy_flex_debug tp_flex_debug
29#define yy_init_buffer tp_init_buffer
30#define yy_flush_buffer tp_flush_buffer
31#define yy_load_buffer_state tp_load_buffer_state
32#define yy_switch_to_buffer tp_switch_to_buffer
33#define yyin tpin
34#define yyleng tpleng
35#define yylex tplex
36#define yyout tpout
37#define yyrestart tprestart
38#define yytext tptext
39#define yywrap tpwrap
40
41/*
42 * A lexical scanner generated by flex
43 */
44
45/*
46 * Scanner skeleton version: $Header:
47 * /home/cvsroot/muscle/PCSC/src/tokenparser.c,v 1.2 2002/03/30 20:59:07
48 * corcoran Exp $
49 */
50
51#define FLEX_SCANNER
52#define YY_FLEX_MAJOR_VERSION 2
53#define YY_FLEX_MINOR_VERSION 5
54
55#include <stdio.h>
56
57/*
58 * cfront 1.2 defines "c_plusplus" instead of "__cplusplus"
59 */
60#ifdef c_plusplus
61#ifndef __cplusplus
62#define __cplusplus
63#endif
64#endif
65
66#ifdef __cplusplus
67
68#include <stdlib.h>
69#include <unistd.h>
70
71/*
72 * Use prototypes in function declarations.
73 */
74#define YY_USE_PROTOS
75
76/*
77 * The "const" storage-class-modifier is valid.
78 */
79#define YY_USE_CONST
80
81#else							/* ! __cplusplus */
82
83#if __STDC__
84
85#define YY_USE_PROTOS
86#define YY_USE_CONST
87
88#endif							/* __STDC__ */
89#endif							/* ! __cplusplus */
90
91#ifdef __TURBOC__
92#pragma warn -rch
93#pragma warn -use
94#include <io.h>
95#include <stdlib.h>
96#define YY_USE_CONST
97#define YY_USE_PROTOS
98#endif
99
100#ifdef YY_USE_CONST
101#define yyconst const
102#else
103#define yyconst
104#endif
105
106#ifdef YY_USE_PROTOS
107#define YY_PROTO(proto) proto
108#else
109#define YY_PROTO(proto) ()
110#endif
111
112/*
113 * Returned upon end-of-file.
114 */
115#define YY_NULL 0
116
117/*
118 * Promotes a possibly negative, possibly signed char to an unsigned
119 * integer for use as an array index.  If the signed char is negative, we
120 * want to instead treat it as an 8-bit unsigned char, hence the double
121 * cast.
122 */
123#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
124
125/*
126 * Enter a start condition.  This macro really ought to take a parameter,
127 * but we do it the disgusting crufty way forced on us by the ()-less
128 * definition of BEGIN.
129 */
130#define BEGIN yy_start = 1 + 2 *
131
132/*
133 * Translate the current start state into a value that can be later handed
134 * to BEGIN to return to the state.  The YYSTATE alias is for lex
135 * compatibility.
136 */
137#define YY_START ((yy_start - 1) / 2)
138#define YYSTATE YY_START
139
140/*
141 * Action number for EOF rule of a given start state.
142 */
143#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
144
145/*
146 * Special action meaning "start processing a new file".
147 */
148#define YY_NEW_FILE yyrestart( yyin )
149
150#define YY_END_OF_BUFFER_CHAR 0
151
152/*
153 * Size of default input buffer.
154 */
155#define YY_BUF_SIZE 16384
156
157typedef struct yy_buffer_state *YY_BUFFER_STATE;
158
159extern int yyleng;
160extern FILE *yyin, *yyout;
161
162#define EOB_ACT_CONTINUE_SCAN 0
163#define EOB_ACT_END_OF_FILE 1
164#define EOB_ACT_LAST_MATCH 2
165
166/*
167 * The funky do-while in the following #define is used to turn the
168 * definition int a single C statement (which needs a semi-colon
169 * terminator).  This avoids problems with code like: if (
170 * condition_holds ) yyless( 5 ); else do_something_else(); Prior to
171 * using the do-while the compiler would get upset at the "else" because
172 * it interpreted the "if" statement as being all done when it reached the
173 * ';' after the yyless() call.
174 */
175
176/*
177 * Return all but the first 'n' matched characters back to the input
178 * stream.
179 */
180
181#define yyless(n) \
182	do \
183		{ \
184		/* Undo effects of setting up yytext. */ \
185		*yy_cp = yy_hold_char; \
186		YY_RESTORE_YY_MORE_OFFSET \
187		yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
188		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
189		} \
190	while ( 0 )
191
192#define unput(c) yyunput( c, yytext_ptr )
193
194/*
195 * The following is because we cannot portably get our hands on size_t
196 * (without autoconf's help, which isn't available because we want
197 * flex-generated scanners to compile on their own).
198 */
199typedef unsigned int yy_size_t;
200
201struct yy_buffer_state
202{
203	FILE *yy_input_file;
204
205	char *yy_ch_buf;			/* input buffer */
206	char *yy_buf_pos;			/* current position in input buffer */
207
208	/*
209	 * Size of input buffer in bytes, not including room for EOB
210	 * characters.
211	 */
212	yy_size_t yy_buf_size;
213
214	/*
215	 * Number of characters read into yy_ch_buf, not including EOB
216	 * characters.
217	 */
218	int yy_n_chars;
219
220	/*
221	 * Whether we "own" the buffer - i.e., we know we created it, and can
222	 * realloc() it to grow it, and should free() it to delete it.
223	 */
224	int yy_is_our_buffer;
225
226	/*
227	 * Whether this is an "interactive" input source; if so, and if we're
228	 * using stdio for input, then we want to use getc() instead of
229	 * fread(), to make sure we stop fetching input after each newline.
230	 */
231	int yy_is_interactive;
232
233	/*
234	 * Whether we're considered to be at the beginning of a line. If so,
235	 * '^' rules will be active on the next match, otherwise not.
236	 */
237	int yy_at_bol;
238
239	/*
240	 * Whether to try to fill the input buffer when we reach the end of
241	 * it.
242	 */
243	int yy_fill_buffer;
244
245	int yy_buffer_status;
246#define YY_BUFFER_NEW 0
247#define YY_BUFFER_NORMAL 1
248	/*
249	 * When an EOF's been seen but there's still some text to process then
250	 * we mark the buffer as YY_EOF_PENDING, to indicate that we shouldn't
251	 * try reading from the input source any more.  We might still have a
252	 * bunch of tokens to match, though, because of possible backing-up.
253	 * When we actually see the EOF, we change the status to "new" (via
254	 * yyrestart()), so that the user can continue scanning by just
255	 * pointing yyin at a new input file.
256	 */
257#define YY_BUFFER_EOF_PENDING 2
258};
259
260static YY_BUFFER_STATE yy_current_buffer = 0;
261
262/*
263 * We provide macros for accessing buffer states in case in the future we
264 * want to put the buffer states in a more general "scanner state".
265 */
266#define YY_CURRENT_BUFFER yy_current_buffer
267
268/*
269 * yy_hold_char holds the character lost when yytext is formed.
270 */
271static char yy_hold_char;
272
273static int yy_n_chars;			/* number of characters read into
274								 * yy_ch_buf */
275
276int yyleng;
277
278/*
279 * Points to current character in buffer.
280 */
281static char *yy_c_buf_p = (char *) 0;
282static int yy_init = 1;			/* whether we need to initialize */
283static int yy_start = 0;		/* start state number */
284
285/*
286 * Flag which is used to allow yywrap()'s to do buffer switches instead of
287 * setting up a fresh yyin.  A bit of a hack ...
288 */
289static int yy_did_buffer_switch_on_eof;
290
291void yyrestart YY_PROTO((FILE * input_file));
292
293void yy_switch_to_buffer YY_PROTO((YY_BUFFER_STATE new_buffer));
294void yy_load_buffer_state YY_PROTO((void));
295YY_BUFFER_STATE yy_create_buffer YY_PROTO((FILE * file, int size));
296void yy_delete_buffer YY_PROTO((YY_BUFFER_STATE b));
297void yy_init_buffer YY_PROTO((YY_BUFFER_STATE b, FILE * file));
298void yy_flush_buffer YY_PROTO((YY_BUFFER_STATE b));
299#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
300
301YY_BUFFER_STATE yy_scan_buffer YY_PROTO((char *base, yy_size_t size));
302YY_BUFFER_STATE yy_scan_string YY_PROTO((yyconst char *yy_str));
303YY_BUFFER_STATE yy_scan_bytes YY_PROTO((yyconst char *bytes, int len));
304
305static void *yy_flex_alloc YY_PROTO((yy_size_t));
306static void *yy_flex_realloc YY_PROTO((void *, yy_size_t));
307static void yy_flex_free YY_PROTO((void *));
308
309#define yy_new_buffer yy_create_buffer
310
311#define yy_set_interactive(is_interactive) \
312	{ \
313	if ( ! yy_current_buffer ) \
314		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
315	yy_current_buffer->yy_is_interactive = is_interactive; \
316	}
317
318#define yy_set_bol(at_bol) \
319	{ \
320	if ( ! yy_current_buffer ) \
321		yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
322	yy_current_buffer->yy_at_bol = at_bol; \
323	}
324
325#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
326
327typedef unsigned char YY_CHAR;
328FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
329typedef int yy_state_type;
330extern char *yytext;
331#define yytext_ptr yytext
332
333static yy_state_type yy_get_previous_state YY_PROTO((void));
334static yy_state_type yy_try_NUL_trans YY_PROTO((yy_state_type
335		current_state));
336static int yy_get_next_buffer YY_PROTO((void));
337static void yy_fatal_error YY_PROTO((yyconst char msg[]));
338
339/*
340 * Done after the current pattern has been matched and before the
341 * corresponding action - sets up yytext.
342 */
343#define YY_DO_BEFORE_ACTION \
344	yytext_ptr = yy_bp; \
345	yyleng = (int) (yy_cp - yy_bp); \
346	yy_hold_char = *yy_cp; \
347	*yy_cp = '\0'; \
348	yy_c_buf_p = yy_cp;
349
350#define YY_NUM_RULES 7
351#define YY_END_OF_BUFFER 8
352static yyconst short int yy_accept[39] = { 0,
353	0, 0, 8, 6, 4, 2, 1, 6, 1, 0,
354	0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
355	0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
356	0, 0, 0, 0, 0, 0, 5, 0
357};
358
359static yyconst int yy_ec[256] = { 0,
360	1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
361	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
362	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
363	1, 2, 4, 4, 5, 4, 4, 4, 4, 4,
364	4, 4, 4, 4, 4, 4, 6, 7, 7, 7,
365	7, 7, 7, 7, 7, 7, 7, 4, 1, 8,
366	4, 9, 4, 4, 10, 10, 10, 10, 10, 10,
367	10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
368	10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
369	1, 1, 1, 4, 4, 1, 11, 11, 11, 11,
370
371	12, 11, 13, 11, 14, 11, 15, 11, 11, 16,
372	11, 11, 11, 17, 18, 19, 11, 11, 11, 11,
373	20, 11, 1, 1, 1, 4, 1, 1, 1, 1,
374	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
375	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
376	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
377	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
378	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
379	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
380	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
381
382	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
383	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
384	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
385	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
386	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
387	1, 1, 1, 1, 1
388};
389
390static yyconst int yy_meta[21] = { 0,
391	1, 2, 3, 4, 4, 4, 2, 1, 1, 2,
392	2, 2, 2, 2, 2, 2, 2, 2, 2, 2
393};
394
395static yyconst short int yy_base[43] = { 0,
396	0, 7, 49, 50, 50, 50, 0, 1, 0, 36,
397	28, 26, 28, 35, 29, 0, 26, 33, 27, 33,
398	29, 22, 0, 24, 27, 14, 27, 23, 13, 50,
399	10, 9, 4, 1, 0, 2, 50, 50, 19, 23,
400	2, 26
401};
402
403static yyconst short int yy_def[43] = { 0,
404	39, 39, 38, 38, 38, 38, 40, 38, 40, 38,
405	38, 38, 38, 38, 38, 41, 38, 41, 38, 38,
406	38, 38, 42, 38, 42, 38, 38, 38, 38, 38,
407	38, 38, 38, 38, 38, 38, 38, 0, 38, 38,
408	38, 38
409};
410
411static yyconst short int yy_nxt[71] = { 0,
412	38, 5, 6, 18, 7, 38, 38, 8, 5, 6,
413	37, 7, 36, 38, 8, 10, 35, 34, 11, 4,
414	4, 4, 4, 9, 9, 33, 9, 25, 32, 25,
415	31, 30, 29, 28, 27, 26, 24, 23, 22, 21,
416	20, 19, 17, 16, 15, 14, 13, 12, 38, 3,
417	38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
418	38, 38, 38, 38, 38, 38, 38, 38, 38, 38
419};
420
421static yyconst short int yy_chk[71] = { 0,
422	0, 1, 1, 41, 1, 0, 0, 1, 2, 2,
423	36, 2, 35, 0, 2, 8, 34, 33, 8, 39,
424	39, 39, 39, 40, 40, 32, 40, 42, 31, 42,
425	29, 28, 27, 26, 25, 24, 22, 21, 20, 19,
426	18, 17, 15, 14, 13, 12, 11, 10, 3, 38,
427	38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
428	38, 38, 38, 38, 38, 38, 38, 38, 38, 38
429};
430
431static yy_state_type yy_last_accepting_state;
432static char *yy_last_accepting_cpos;
433
434/*
435 * The intent behind this definition is that it'll catch any uses of
436 * REJECT which flex missed.
437 */
438#define REJECT reject_used_but_not_detected
439#define yymore() yymore_used_but_not_detected
440#define YY_MORE_ADJ 0
441#define YY_RESTORE_YY_MORE_OFFSET
442char *yytext;
443#line 1 "tokenparser.l"
444#define INITIAL 0
445/*****************************************************************
446
447  File   :   configfile.ll
448  Author :   David Corcoran
449  Date   :   February 12, 1999 modified 7/28/99
450  Purpose:   Reads lexical config files and updates database.
451             See http://www.linuxnet.com for more information.
452  License:   Copyright (C) 1999 David Corcoran
453             <corcoran@linuxnet.com>
454
455******************************************************************/
456#line 14 "tokenparser.l"
457
458void tpevalToken(char *pcToken, int tokType);
459
460static char *pcDesiredKey = 0;
461static char pcKey[200];
462static char pcValue[200];
463static char pcFinValue[200];
464static int valueIndex = 0;
465static int desiredIndex = 0;
466
467void tperrorCheck(char *pcToken_error);
468
469#line 429 "lex.tp.c"
470
471/*
472 * Macros after this point can all be overridden by user definitions in
473 * section 1.
474 */
475
476#ifndef YY_SKIP_YYWRAP
477#ifdef __cplusplus
478extern "C" int yywrap YY_PROTO((void));
479#else
480extern int yywrap YY_PROTO((void));
481#endif
482#endif
483
484#ifndef YY_NO_UNPUT
485static void yyunput YY_PROTO((int c, char *buf_ptr));
486#endif
487
488#ifndef yytext_ptr
489static void yy_flex_strncpy YY_PROTO((char *, yyconst char *, int));
490#endif
491
492#ifdef YY_NEED_STRLEN
493static int yy_flex_strlen YY_PROTO((yyconst char *));
494#endif
495
496#ifndef YY_NO_INPUT
497#ifdef __cplusplus
498static int yyinput YY_PROTO((void));
499#else
500static int input YY_PROTO((void));
501#endif
502#endif
503
504#if YY_STACK_USED
505static int yy_start_stack_ptr = 0;
506static int yy_start_stack_depth = 0;
507static int *yy_start_stack = 0;
508#ifndef YY_NO_PUSH_STATE
509static void yy_push_state YY_PROTO((int new_state));
510#endif
511#ifndef YY_NO_POP_STATE
512static void yy_pop_state YY_PROTO((void));
513#endif
514#ifndef YY_NO_TOP_STATE
515static int yy_top_state YY_PROTO((void));
516#endif
517
518#else
519#define YY_NO_PUSH_STATE 1
520#define YY_NO_POP_STATE 1
521#define YY_NO_TOP_STATE 1
522#endif
523
524#ifdef YY_MALLOC_DECL
525YY_MALLOC_DECL
526#else
527#if __STDC__
528#ifndef __cplusplus
529#include <stdlib.h>
530#endif
531#else
532/*
533 * Just try to get by without declaring the routines.  This will fail
534 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
535 * or sizeof(void*) != sizeof(int).
536 */
537#endif
538#endif
539
540/*
541 * Amount of stuff to slurp up with each read.
542 */
543#ifndef YY_READ_BUF_SIZE
544#define YY_READ_BUF_SIZE 8192
545#endif
546
547/*
548 * Copy whatever the last rule matched to the standard output.
549 */
550
551#ifndef ECHO
552/*
553 * This used to be an fputs(), but since the string might contain NUL's,
554 * we now use fwrite().
555 */
556#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
557#endif
558
559/*
560 * Gets input and stuffs it into "buf".  number of characters read, or
561 * YY_NULL, is returned in "result".
562 */
563#ifndef YY_INPUT
564#define YY_INPUT(buf,result,max_size) \
565	if ( yy_current_buffer->yy_is_interactive ) \
566		{ \
567		int c = '*', n; \
568		for ( n = 0; n < max_size && \
569			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
570			buf[n] = (char) c; \
571		if ( c == '\n' ) \
572			buf[n++] = (char) c; \
573		if ( c == EOF && ferror( yyin ) ) \
574			YY_FATAL_ERROR( "input in flex scanner failed" ); \
575		result = n; \
576		} \
577	else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
578		  && ferror( yyin ) ) \
579		YY_FATAL_ERROR( "input in flex scanner failed" );
580#endif
581
582/*
583 * No semi-colon after return; correct usage is to write "yyterminate();"
584 * - we don't want an extra ';' after the "return" because that will cause
585 * some compilers to complain about unreachable statements.
586 */
587#ifndef yyterminate
588#define yyterminate() return YY_NULL
589#endif
590
591/*
592 * Number of entries by which start-condition stack grows.
593 */
594#ifndef YY_START_STACK_INCR
595#define YY_START_STACK_INCR 25
596#endif
597
598/*
599 * Report a fatal error.
600 */
601#ifndef YY_FATAL_ERROR
602#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
603#endif
604
605/*
606 * Default declaration of generated scanner - a define so the user can
607 * easily add parameters.
608 */
609#ifndef YY_DECL
610#define YY_DECL int yylex YY_PROTO(( void ))
611#endif
612
613/*
614 * Code executed at the beginning of each rule, after yytext and yyleng
615 * have been set up.
616 */
617#ifndef YY_USER_ACTION
618#define YY_USER_ACTION
619#endif
620
621/*
622 * Code executed at the end of each rule.
623 */
624#ifndef YY_BREAK
625#define YY_BREAK break;
626#endif
627
628#define YY_RULE_SETUP \
629	YY_USER_ACTION
630
631YY_DECL
632{
633	register yy_state_type yy_current_state;
634	register char *yy_cp, *yy_bp;
635	register int yy_act;
636
637#line 28 "tokenparser.l"
638
639#line 583 "lex.tp.c"
640
641	if (yy_init)
642	{
643		yy_init = 0;
644
645#ifdef YY_USER_INIT
646		YY_USER_INIT;
647#endif
648
649		if (!yy_start)
650			yy_start = 1;	/* first start state */
651
652		if (!yyin)
653			yyin = stdin;
654
655		if (!yyout)
656			yyout = stdout;
657
658		if (!yy_current_buffer)
659			yy_current_buffer = yy_create_buffer(yyin, YY_BUF_SIZE);
660
661		yy_load_buffer_state();
662	}
663
664	while (1)	/* loops until end-of-file is reached */
665	{
666		yy_cp = yy_c_buf_p;
667
668		/*
669		 * Support of yytext.
670		 */
671		*yy_cp = yy_hold_char;
672
673		/*
674		 * yy_bp points to the position in yy_ch_buf of the start of the
675		 * current run.
676		 */
677		yy_bp = yy_cp;
678
679		yy_current_state = yy_start;
680	  yy_match:
681		do
682		{
683			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
684			if (yy_accept[yy_current_state])
685			{
686				yy_last_accepting_state = yy_current_state;
687				yy_last_accepting_cpos = yy_cp;
688			}
689			while (yy_chk[yy_base[yy_current_state] + yy_c] !=
690				yy_current_state)
691			{
692				yy_current_state = (int) yy_def[yy_current_state];
693				if (yy_current_state >= 39)
694					yy_c = yy_meta[(unsigned int) yy_c];
695			}
696			yy_current_state =
697				yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
698			++yy_cp;
699		}
700		while (yy_base[yy_current_state] != 50);
701
702	  yy_find_action:
703		yy_act = yy_accept[yy_current_state];
704		if (yy_act == 0)
705		{	/* have to back up */
706			yy_cp = yy_last_accepting_cpos;
707			yy_current_state = yy_last_accepting_state;
708			yy_act = yy_accept[yy_current_state];
709		}
710
711		YY_DO_BEFORE_ACTION;
712
713	  do_action:	/* This label is used only to access EOF actions. */
714
715		switch (yy_act)
716		{	/* beginning of action switch */
717		case 0:	/* must back up */
718			/*
719			 * undo the effects of YY_DO_BEFORE_ACTION
720			 */
721			*yy_cp = yy_hold_char;
722			yy_cp = yy_last_accepting_cpos;
723			yy_current_state = yy_last_accepting_state;
724			goto yy_find_action;
725
726		case 1:
727			YY_RULE_SETUP
728#line 30 "tokenparser.l"
729			{
730			}
731		YY_BREAK case 2:
732			YY_RULE_SETUP
733#line 31 "tokenparser.l"
734			{
735			}
736		YY_BREAK case 3:
737			YY_RULE_SETUP
738#line 32 "tokenparser.l"
739			{
740				valueIndex = 0;
741				tpevalToken(yytext, 1);
742			}
743		YY_BREAK case 4:
744			YY_RULE_SETUP
745#line 33 "tokenparser.l"
746			{
747			}
748		YY_BREAK case 5:
749			YY_RULE_SETUP
750#line 34 "tokenparser.l"
751			{
752				tpevalToken(yytext, 2);
753				valueIndex += 1;
754			}
755		YY_BREAK case 6:
756			YY_RULE_SETUP
757#line 35 "tokenparser.l"
758			{
759				tperrorCheck(yytext);
760			}
761		YY_BREAK case 7:
762			YY_RULE_SETUP
763#line 36 "tokenparser.l"
764				ECHO;
765			YY_BREAK
766#line 701 "lex.tp.c"
767		case YY_STATE_EOF(INITIAL):
768			yyterminate();
769
770		case YY_END_OF_BUFFER:
771			{
772				/*
773				 * Amount of text matched not including the EOB char.
774				 */
775				int yy_amount_of_matched_text =
776					(int) (yy_cp - yytext_ptr) - 1;
777
778				/*
779				 * Undo the effects of YY_DO_BEFORE_ACTION.
780				 */
781				*yy_cp = yy_hold_char;
782				YY_RESTORE_YY_MORE_OFFSET
783					if (yy_current_buffer->yy_buffer_status ==
784					YY_BUFFER_NEW)
785				{
786					/*
787					 * We're scanning a new file or input source.  It's
788					 * possible that this happened because the user just
789					 * pointed yyin at a new source and called yylex().
790					 * If so, then we have to assure consistency between
791					 * yy_current_buffer and our globals.  Here is the
792					 * right place to do so, because this is the first
793					 * action (other than possibly a back-up) that will
794					 * match for the new input source.
795					 */
796					yy_n_chars = yy_current_buffer->yy_n_chars;
797					yy_current_buffer->yy_input_file = yyin;
798					yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
799				}
800
801				/*
802				 * Note that here we test for yy_c_buf_p "<=" to the
803				 * position of the first EOB in the buffer, since
804				 * yy_c_buf_p will already have been incremented past the
805				 * NUL character (since all states make transitions on EOB
806				 * to the end-of-buffer state).  Contrast this with the
807				 * test in input().
808				 */
809				if (yy_c_buf_p <=
810					&yy_current_buffer->yy_ch_buf[yy_n_chars])
811				{	/* This was really a NUL. */
812					yy_state_type yy_next_state;
813
814					yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
815
816					yy_current_state = yy_get_previous_state();
817
818					/*
819					 * Okay, we're now positioned to make the NUL
820					 * transition.  We couldn't have
821					 * yy_get_previous_state() go ahead and do it for us
822					 * because it doesn't know how to deal with the
823					 * possibility of jamming (and we don't want to build
824					 * jamming into it because then it will run more
825					 * slowly).
826					 */
827
828					yy_next_state = yy_try_NUL_trans(yy_current_state);
829
830					yy_bp = yytext_ptr + YY_MORE_ADJ;
831
832					if (yy_next_state)
833					{
834						/*
835						 * Consume the NUL.
836						 */
837						yy_cp = ++yy_c_buf_p;
838						yy_current_state = yy_next_state;
839						goto yy_match;
840					}
841
842					else
843					{
844						yy_cp = yy_c_buf_p;
845						goto yy_find_action;
846					}
847				}
848
849				else
850					switch (yy_get_next_buffer())
851					{
852					case EOB_ACT_END_OF_FILE:
853						{
854							yy_did_buffer_switch_on_eof = 0;
855
856							if (yywrap())
857							{
858								/*
859								 * Note: because we've taken care in
860								 * yy_get_next_buffer() to have set up
861								 * yytext, we can now set up yy_c_buf_p so
862								 * that if some total hoser (like flex
863								 * itself) wants to call the scanner after
864								 * we return the YY_NULL, it'll still work
865								 * - another YY_NULL will get returned.
866								 */
867								yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
868
869								yy_act = YY_STATE_EOF(YY_START);
870								goto do_action;
871							}
872
873							else
874							{
875								if (!yy_did_buffer_switch_on_eof)
876									YY_NEW_FILE;
877							}
878							break;
879						}
880
881					case EOB_ACT_CONTINUE_SCAN:
882						yy_c_buf_p =
883							yytext_ptr + yy_amount_of_matched_text;
884
885						yy_current_state = yy_get_previous_state();
886
887						yy_cp = yy_c_buf_p;
888						yy_bp = yytext_ptr + YY_MORE_ADJ;
889						goto yy_match;
890
891					case EOB_ACT_LAST_MATCH:
892						yy_c_buf_p =
893							&yy_current_buffer->yy_ch_buf[yy_n_chars];
894
895						yy_current_state = yy_get_previous_state();
896
897						yy_cp = yy_c_buf_p;
898						yy_bp = yytext_ptr + YY_MORE_ADJ;
899						goto yy_find_action;
900					}
901				break;
902			}
903
904		default:
905			YY_FATAL_ERROR
906				("fatal flex scanner internal error--no action found");
907		}	/* end of action switch */
908	}	/* end of scanning one token */
909}	/* end of yylex */
910
911/*
912 * yy_get_next_buffer - try to read in a new buffer Returns a code
913 * representing an action: EOB_ACT_LAST_MATCH - EOB_ACT_CONTINUE_SCAN -
914 * continue scanning from current position EOB_ACT_END_OF_FILE - end of
915 * file
916 */
917
918static int yy_get_next_buffer()
919{
920	register char *dest = yy_current_buffer->yy_ch_buf;
921	register char *source = yytext_ptr;
922	register int number_to_move, i;
923	int ret_val;
924
925	if (yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1])
926		YY_FATAL_ERROR
927			("fatal flex scanner internal error--end of buffer missed");
928
929	if (yy_current_buffer->yy_fill_buffer == 0)
930	{	/* Don't try to fill the buffer, so this is an EOF. */
931		if (yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1)
932		{
933			/*
934			 * We matched a single character, the EOB, so treat this as a
935			 * final EOF.
936			 */
937			return EOB_ACT_END_OF_FILE;
938		}
939
940		else
941		{
942			/*
943			 * We matched some text prior to the EOB, first process it.
944			 */
945			return EOB_ACT_LAST_MATCH;
946		}
947	}
948
949	/*
950	 * Try to read more data.
951	 */
952
953	/*
954	 * First move last chars to start of buffer.
955	 */
956	number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
957
958	for (i = 0; i < number_to_move; ++i)
959		*(dest++) = *(source++);
960
961	if (yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING)
962		/*
963		 * don't do the read, it's not guaranteed to return an EOF, just
964		 * force an EOF
965		 */
966		yy_current_buffer->yy_n_chars = yy_n_chars = 0;
967
968	else
969	{
970		int num_to_read =
971			yy_current_buffer->yy_buf_size - number_to_move - 1;
972
973		while (num_to_read <= 0)
974		{	/* Not enough room in the buffer - grow it. */
975#ifdef YY_USES_REJECT
976			YY_FATAL_ERROR
977				("input buffer overflow, can't enlarge buffer because scanner uses REJECT");
978#else
979
980			/*
981			 * just a shorter name for the current buffer
982			 */
983			YY_BUFFER_STATE b = yy_current_buffer;
984
985			int yy_c_buf_p_offset = (int) (yy_c_buf_p - b->yy_ch_buf);
986
987			if (b->yy_is_our_buffer)
988			{
989				int new_size = b->yy_buf_size * 2;
990
991				if (new_size <= 0)
992					b->yy_buf_size += b->yy_buf_size / 8;
993				else
994					b->yy_buf_size *= 2;
995
996				b->yy_ch_buf = (char *)
997					/*
998					 * Include room in for 2 EOB chars.
999					 */
1000					yy_flex_realloc((void *) b->yy_ch_buf,
1001					b->yy_buf_size + 2);
1002			} else
1003				/*
1004				 * Can't grow it, we don't own it.
1005				 */
1006				b->yy_ch_buf = 0;
1007
1008			if (!b->yy_ch_buf)
1009				YY_FATAL_ERROR
1010					("fatal error - scanner input buffer overflow");
1011
1012			yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1013
1014			num_to_read = yy_current_buffer->yy_buf_size -
1015				number_to_move - 1;
1016#endif
1017		}
1018
1019		if (num_to_read > YY_READ_BUF_SIZE)
1020			num_to_read = YY_READ_BUF_SIZE;
1021
1022		/*
1023		 * Read in more data.
1024		 */
1025		YY_INPUT((&yy_current_buffer->yy_ch_buf[number_to_move]),
1026			yy_n_chars, num_to_read);
1027
1028		yy_current_buffer->yy_n_chars = yy_n_chars;
1029	}
1030
1031	if (yy_n_chars == 0)
1032	{
1033		if (number_to_move == YY_MORE_ADJ)
1034		{
1035			ret_val = EOB_ACT_END_OF_FILE;
1036			yyrestart(yyin);
1037		}
1038
1039		else
1040		{
1041			ret_val = EOB_ACT_LAST_MATCH;
1042			yy_current_buffer->yy_buffer_status = YY_BUFFER_EOF_PENDING;
1043		}
1044	}
1045
1046	else
1047		ret_val = EOB_ACT_CONTINUE_SCAN;
1048
1049	yy_n_chars += number_to_move;
1050	yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1051	yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1052
1053	yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1054
1055	return ret_val;
1056}
1057
1058/*
1059 * yy_get_previous_state - get the state just before the EOB char was
1060 * reached
1061 */
1062
1063static yy_state_type yy_get_previous_state()
1064{
1065	register yy_state_type yy_current_state;
1066	register char *yy_cp;
1067
1068	yy_current_state = yy_start;
1069
1070	for (yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp)
1071	{
1072		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1073		if (yy_accept[yy_current_state])
1074		{
1075			yy_last_accepting_state = yy_current_state;
1076			yy_last_accepting_cpos = yy_cp;
1077		}
1078		while (yy_chk[yy_base[yy_current_state] + yy_c] !=
1079			yy_current_state)
1080		{
1081			yy_current_state = (int) yy_def[yy_current_state];
1082			if (yy_current_state >= 39)
1083				yy_c = yy_meta[(unsigned int) yy_c];
1084		}
1085		yy_current_state =
1086			yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1087	}
1088
1089	return yy_current_state;
1090}
1091
1092/*
1093 * yy_try_NUL_trans - try to make a transition on the NUL character
1094 * synopsis next_state = yy_try_NUL_trans( current_state );
1095 */
1096
1097#ifdef YY_USE_PROTOS
1098static yy_state_type yy_try_NUL_trans(yy_state_type yy_current_state)
1099#else
1100static yy_state_type yy_try_NUL_trans(yy_current_state)
1101	yy_state_type yy_current_state;
1102#endif
1103{
1104	register int yy_is_jam;
1105	register char *yy_cp = yy_c_buf_p;
1106
1107	register YY_CHAR yy_c = 1;
1108	if (yy_accept[yy_current_state])
1109	{
1110		yy_last_accepting_state = yy_current_state;
1111		yy_last_accepting_cpos = yy_cp;
1112	}
1113	while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state)
1114	{
1115		yy_current_state = (int) yy_def[yy_current_state];
1116		if (yy_current_state >= 39)
1117			yy_c = yy_meta[(unsigned int) yy_c];
1118	}
1119	yy_current_state =
1120		yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1121	yy_is_jam = (yy_current_state == 38);
1122
1123	return yy_is_jam ? 0 : yy_current_state;
1124}
1125
1126#ifndef YY_NO_UNPUT
1127#ifdef YY_USE_PROTOS
1128static void yyunput(int c, register char *yy_bp)
1129#else
1130static void yyunput(c, yy_bp)
1131	int c;
1132	register char *yy_bp;
1133#endif
1134{
1135	register char *yy_cp = yy_c_buf_p;
1136
1137	/*
1138	 * undo effects of setting up yytext
1139	 */
1140	*yy_cp = yy_hold_char;
1141
1142	if (yy_cp < yy_current_buffer->yy_ch_buf + 2)
1143	{	/* need to shift things up to make room */
1144		/*
1145		 * +2 for EOB chars.
1146		 */
1147		register int number_to_move = yy_n_chars + 2;
1148		register char *dest =
1149			&yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size +
1150			2];
1151		register char *source =
1152			&yy_current_buffer->yy_ch_buf[number_to_move];
1153
1154		while (source > yy_current_buffer->yy_ch_buf)
1155			*--dest = *--source;
1156
1157		yy_cp += (int) (dest - source);
1158		yy_bp += (int) (dest - source);
1159		yy_current_buffer->yy_n_chars =
1160			yy_n_chars = yy_current_buffer->yy_buf_size;
1161
1162		if (yy_cp < yy_current_buffer->yy_ch_buf + 2)
1163			YY_FATAL_ERROR("flex scanner push-back overflow");
1164	}
1165
1166	*--yy_cp = (char) c;
1167
1168	yytext_ptr = yy_bp;
1169	yy_hold_char = *yy_cp;
1170	yy_c_buf_p = yy_cp;
1171}
1172#endif							/* ifndef YY_NO_UNPUT */
1173
1174#ifdef __cplusplus
1175static int yyinput()
1176#else
1177static int input()
1178#endif
1179{
1180	int c;
1181
1182	*yy_c_buf_p = yy_hold_char;
1183
1184	if (*yy_c_buf_p == YY_END_OF_BUFFER_CHAR)
1185	{
1186		/*
1187		 * yy_c_buf_p now points to the character we want to return. If
1188		 * this occurs *before* the EOB characters, then it's a valid NUL;
1189		 * if not, then we've hit the end of the buffer.
1190		 */
1191		if (yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars])
1192			/*
1193			 * This was really a NUL.
1194			 */
1195			*yy_c_buf_p = '\0';
1196
1197		else
1198		{	/* need more input */
1199			int offset = yy_c_buf_p - yytext_ptr;
1200			++yy_c_buf_p;
1201
1202			switch (yy_get_next_buffer())
1203			{
1204			case EOB_ACT_LAST_MATCH:
1205				/*
1206				 * This happens because yy_g_n_b() sees that we've
1207				 * accumulated a token and flags that we need to try
1208				 * matching the token before proceeding.  But for input(),
1209				 * there's no matching to consider. So convert the
1210				 * EOB_ACT_LAST_MATCH to EOB_ACT_END_OF_FILE.
1211				 */
1212
1213				/*
1214				 * Reset buffer status.
1215				 */
1216				yyrestart(yyin);
1217
1218				/*
1219				 * fall through
1220				 */
1221
1222			case EOB_ACT_END_OF_FILE:
1223				{
1224					if (yywrap())
1225						return EOF;
1226
1227					if (!yy_did_buffer_switch_on_eof)
1228						YY_NEW_FILE;
1229#ifdef __cplusplus
1230					return yyinput();
1231#else
1232					return input();
1233#endif
1234				}
1235
1236			case EOB_ACT_CONTINUE_SCAN:
1237				yy_c_buf_p = yytext_ptr + offset;
1238				break;
1239			}
1240		}
1241	}
1242
1243	c = *(unsigned char *) yy_c_buf_p;	/* cast for 8-bit char's */
1244	*yy_c_buf_p = '\0';	/* preserve yytext */
1245	yy_hold_char = *++yy_c_buf_p;
1246
1247	return c;
1248}
1249
1250#ifdef YY_USE_PROTOS
1251void yyrestart(FILE * input_file)
1252#else
1253void yyrestart(input_file)
1254	FILE *input_file;
1255#endif
1256{
1257	if (!yy_current_buffer)
1258		yy_current_buffer = yy_create_buffer(yyin, YY_BUF_SIZE);
1259
1260	yy_init_buffer(yy_current_buffer, input_file);
1261	yy_load_buffer_state();
1262}
1263
1264#ifdef YY_USE_PROTOS
1265void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer)
1266#else
1267void yy_switch_to_buffer(new_buffer)
1268	YY_BUFFER_STATE new_buffer;
1269#endif
1270{
1271	if (yy_current_buffer == new_buffer)
1272		return;
1273
1274	if (yy_current_buffer)
1275	{
1276		/*
1277		 * Flush out information for old buffer.
1278		 */
1279		*yy_c_buf_p = yy_hold_char;
1280		yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1281		yy_current_buffer->yy_n_chars = yy_n_chars;
1282	}
1283
1284	yy_current_buffer = new_buffer;
1285	yy_load_buffer_state();
1286
1287	/*
1288	 * We don't actually know whether we did this switch during EOF
1289	 * (yywrap()) processing, but the only time this flag is looked at is
1290	 * after yywrap() is called, so it's safe to go ahead and always set
1291	 * it.
1292	 */
1293	yy_did_buffer_switch_on_eof = 1;
1294}
1295
1296#ifdef YY_USE_PROTOS
1297void yy_load_buffer_state(void)
1298#else
1299void yy_load_buffer_state()
1300#endif
1301{
1302	yy_n_chars = yy_current_buffer->yy_n_chars;
1303	yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1304	yyin = yy_current_buffer->yy_input_file;
1305	yy_hold_char = *yy_c_buf_p;
1306}
1307
1308#ifdef YY_USE_PROTOS
1309YY_BUFFER_STATE yy_create_buffer(FILE * file, int size)
1310#else
1311YY_BUFFER_STATE yy_create_buffer(file, size)
1312	FILE *file;
1313	int size;
1314#endif
1315{
1316	YY_BUFFER_STATE b;
1317
1318	b = (YY_BUFFER_STATE) yy_flex_alloc(sizeof(struct yy_buffer_state));
1319	if (!b)
1320		YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()");
1321
1322	b->yy_buf_size = size;
1323
1324	/*
1325	 * yy_ch_buf has to be 2 characters longer than the size given because
1326	 * we need to put in 2 end-of-buffer characters.
1327	 */
1328	b->yy_ch_buf = (char *) yy_flex_alloc(b->yy_buf_size + 2);
1329	if (!b->yy_ch_buf)
1330		YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()");
1331
1332	b->yy_is_our_buffer = 1;
1333
1334	yy_init_buffer(b, file);
1335
1336	return b;
1337}
1338
1339#ifdef YY_USE_PROTOS
1340void yy_delete_buffer(YY_BUFFER_STATE b)
1341#else
1342void yy_delete_buffer(b)
1343	YY_BUFFER_STATE b;
1344#endif
1345{
1346	if (!b)
1347		return;
1348
1349	if (b == yy_current_buffer)
1350		yy_current_buffer = (YY_BUFFER_STATE) 0;
1351
1352	if (b->yy_is_our_buffer)
1353		yy_flex_free((void *) b->yy_ch_buf);
1354
1355	yy_flex_free((void *) b);
1356}
1357
1358#ifndef YY_ALWAYS_INTERACTIVE
1359#ifndef YY_NEVER_INTERACTIVE
1360extern int isatty YY_PROTO((int));
1361#endif
1362#endif
1363
1364#ifdef YY_USE_PROTOS
1365void yy_init_buffer(YY_BUFFER_STATE b, FILE * file)
1366#else
1367void yy_init_buffer(b, file)
1368	YY_BUFFER_STATE b;
1369	FILE *file;
1370#endif
1371
1372{
1373	yy_flush_buffer(b);
1374
1375	b->yy_input_file = file;
1376	b->yy_fill_buffer = 1;
1377
1378#if YY_ALWAYS_INTERACTIVE
1379	b->yy_is_interactive = 1;
1380#else
1381#if YY_NEVER_INTERACTIVE
1382	b->yy_is_interactive = 0;
1383#else
1384	b->yy_is_interactive = file ? (isatty(fileno(file)) > 0) : 0;
1385#endif
1386#endif
1387}
1388
1389#ifdef YY_USE_PROTOS
1390void yy_flush_buffer(YY_BUFFER_STATE b)
1391#else
1392void yy_flush_buffer(b)
1393	YY_BUFFER_STATE b;
1394#endif
1395
1396{
1397	if (!b)
1398		return;
1399
1400	b->yy_n_chars = 0;
1401
1402	/*
1403	 * We always need two end-of-buffer characters.  The first causes a
1404	 * transition to the end-of-buffer state.  The second causes a jam in
1405	 * that state.
1406	 */
1407	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1408	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1409
1410	b->yy_buf_pos = &b->yy_ch_buf[0];
1411
1412	b->yy_at_bol = 1;
1413	b->yy_buffer_status = YY_BUFFER_NEW;
1414
1415	if (b == yy_current_buffer)
1416		yy_load_buffer_state();
1417}
1418
1419#ifndef YY_NO_SCAN_BUFFER
1420#ifdef YY_USE_PROTOS
1421YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size)
1422#else
1423YY_BUFFER_STATE yy_scan_buffer(base, size)
1424	char *base;
1425	yy_size_t size;
1426#endif
1427{
1428	YY_BUFFER_STATE b;
1429
1430	if (size < 2 ||
1431		base[size - 2] != YY_END_OF_BUFFER_CHAR ||
1432		base[size - 1] != YY_END_OF_BUFFER_CHAR)
1433		/*
1434		 * They forgot to leave room for the EOB's.
1435		 */
1436		return 0;
1437
1438	b = (YY_BUFFER_STATE) yy_flex_alloc(sizeof(struct yy_buffer_state));
1439	if (!b)
1440		YY_FATAL_ERROR("out of dynamic memory in yy_scan_buffer()");
1441
1442	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
1443	b->yy_buf_pos = b->yy_ch_buf = base;
1444	b->yy_is_our_buffer = 0;
1445	b->yy_input_file = 0;
1446	b->yy_n_chars = b->yy_buf_size;
1447	b->yy_is_interactive = 0;
1448	b->yy_at_bol = 1;
1449	b->yy_fill_buffer = 0;
1450	b->yy_buffer_status = YY_BUFFER_NEW;
1451
1452	yy_switch_to_buffer(b);
1453
1454	return b;
1455}
1456#endif
1457
1458#ifndef YY_NO_SCAN_STRING
1459#ifdef YY_USE_PROTOS
1460YY_BUFFER_STATE yy_scan_string(yyconst char *yy_str)
1461#else
1462YY_BUFFER_STATE yy_scan_string(yy_str)
1463	yyconst char *yy_str;
1464#endif
1465{
1466	int len;
1467	for (len = 0; yy_str[len]; ++len)
1468		;
1469
1470	return yy_scan_bytes(yy_str, len);
1471}
1472#endif
1473
1474#ifndef YY_NO_SCAN_BYTES
1475#ifdef YY_USE_PROTOS
1476YY_BUFFER_STATE yy_scan_bytes(yyconst char *bytes, int len)
1477#else
1478YY_BUFFER_STATE yy_scan_bytes(bytes, len)
1479	yyconst char *bytes;
1480	int len;
1481#endif
1482{
1483	YY_BUFFER_STATE b;
1484	char *buf;
1485	yy_size_t n;
1486	int i;
1487
1488	/*
1489	 * Get memory for full buffer, including space for trailing EOB's.
1490	 */
1491	n = len + 2;
1492	buf = (char *) yy_flex_alloc(n);
1493	if (!buf)
1494		YY_FATAL_ERROR("out of dynamic memory in yy_scan_bytes()");
1495
1496	for (i = 0; i < len; ++i)
1497		buf[i] = bytes[i];
1498
1499	buf[len] = buf[len + 1] = YY_END_OF_BUFFER_CHAR;
1500
1501	b = yy_scan_buffer(buf, n);
1502	if (!b)
1503		YY_FATAL_ERROR("bad buffer in yy_scan_bytes()");
1504
1505	/*
1506	 * It's okay to grow etc. this buffer, and we should throw it away
1507	 * when we're done.
1508	 */
1509	b->yy_is_our_buffer = 1;
1510
1511	return b;
1512}
1513#endif
1514
1515#ifndef YY_NO_PUSH_STATE
1516#ifdef YY_USE_PROTOS
1517static void yy_push_state(int new_state)
1518#else
1519static void yy_push_state(new_state)
1520	int new_state;
1521#endif
1522{
1523	if (yy_start_stack_ptr >= yy_start_stack_depth)
1524	{
1525		yy_size_t new_size;
1526
1527		yy_start_stack_depth += YY_START_STACK_INCR;
1528		new_size = yy_start_stack_depth * sizeof(int);
1529
1530		if (!yy_start_stack)
1531			yy_start_stack = (int *) yy_flex_alloc(new_size);
1532
1533		else
1534			yy_start_stack = (int *) yy_flex_realloc(
1535				(void *) yy_start_stack, new_size);
1536
1537		if (!yy_start_stack)
1538			YY_FATAL_ERROR
1539				("out of memory expanding start-condition stack");
1540	}
1541
1542	yy_start_stack[yy_start_stack_ptr++] = YY_START;
1543
1544	BEGIN(new_state);
1545}
1546#endif
1547
1548#ifndef YY_NO_POP_STATE
1549static void yy_pop_state()
1550{
1551	if (--yy_start_stack_ptr < 0)
1552		YY_FATAL_ERROR("start-condition stack underflow");
1553
1554	BEGIN(yy_start_stack[yy_start_stack_ptr]);
1555}
1556#endif
1557
1558#ifndef YY_NO_TOP_STATE
1559static int yy_top_state()
1560{
1561	return yy_start_stack[yy_start_stack_ptr - 1];
1562}
1563#endif
1564
1565#ifndef YY_EXIT_FAILURE
1566#define YY_EXIT_FAILURE 2
1567#endif
1568
1569#ifdef YY_USE_PROTOS
1570static void yy_fatal_error(yyconst char msg[])
1571#else
1572static void yy_fatal_error(msg)
1573	char msg[];
1574#endif
1575{
1576	(void) fprintf(stderr, "%s\n", msg);
1577	exit(YY_EXIT_FAILURE);
1578}
1579
1580/*
1581 * Redefine yyless() so it works in section 3 code.
1582 */
1583
1584#undef yyless
1585#define yyless(n) \
1586	do \
1587		{ \
1588		/* Undo effects of setting up yytext. */ \
1589		yytext[yyleng] = yy_hold_char; \
1590		yy_c_buf_p = yytext + n; \
1591		yy_hold_char = *yy_c_buf_p; \
1592		*yy_c_buf_p = '\0'; \
1593		yyleng = n; \
1594		} \
1595	while ( 0 )
1596
1597/*
1598 * Internal utility routines.
1599 */
1600
1601#ifndef yytext_ptr
1602#ifdef YY_USE_PROTOS
1603static void yy_flex_strncpy(char *s1, yyconst char *s2, int n)
1604#else
1605static void yy_flex_strncpy(s1, s2, n)
1606	char *s1;
1607	yyconst char *s2;
1608	int n;
1609#endif
1610{
1611	register int i;
1612	for (i = 0; i < n; ++i)
1613		s1[i] = s2[i];
1614}
1615#endif
1616
1617#ifdef YY_NEED_STRLEN
1618#ifdef YY_USE_PROTOS
1619static int yy_flex_strlen(yyconst char *s)
1620#else
1621static int yy_flex_strlen(s)
1622	yyconst char *s;
1623#endif
1624{
1625	register int n;
1626	for (n = 0; s[n]; ++n)
1627		;
1628
1629	return n;
1630}
1631#endif
1632
1633#ifdef YY_USE_PROTOS
1634static void *yy_flex_alloc(yy_size_t size)
1635#else
1636static void *yy_flex_alloc(size)
1637	yy_size_t size;
1638#endif
1639{
1640	return (void *) malloc(size);
1641}
1642
1643#ifdef YY_USE_PROTOS
1644static void *yy_flex_realloc(void *ptr, yy_size_t size)
1645#else
1646static void *yy_flex_realloc(ptr, size)
1647	void *ptr;
1648	yy_size_t size;
1649#endif
1650{
1651	/*
1652	 * The cast to (char *) in the following accommodates both
1653	 * implementations that use char* generic pointers, and those that use
1654	 * void* generic pointers.  It works with the latter because both ANSI
1655	 * C and C++ allow castless assignment from any pointer type to void*,
1656	 * and deal with argument conversions as though doing an assignment.
1657	 */
1658	return (void *) realloc((char *) ptr, size);
1659}
1660
1661#ifdef YY_USE_PROTOS
1662static void yy_flex_free(void *ptr)
1663#else
1664static void yy_flex_free(ptr)
1665	void *ptr;
1666#endif
1667{
1668	free(ptr);
1669}
1670
1671#if YY_MAIN
1672int main()
1673{
1674	yylex();
1675	return 0;
1676}
1677#endif
1678#line 36 "tokenparser.l"
1679
1680#include <stdio.h>
1681#include <string.h>
1682#include "debuglog.h"
1683
1684#ifndef WIN32
1685#include "config.h"
1686#else
1687#include "../win32/win32_config.h"
1688#endif
1689
1690int yywrap()
1691{
1692	return 1;
1693}
1694
1695void tpevalToken(char *pcToken, int tokType)
1696{
1697
1698	int len;
1699	len = 0;
1700
1701	if (tokType == 1)
1702	{
1703		for (len = 5; pcToken[len] != '<'; len++) ;
1704		strncpy(pcKey, &pcToken[5], len - 5);
1705		pcKey[len - 5] = 0;
1706	}
1707
1708	if (tokType == 2)
1709	{
1710		for (len = 8; pcToken[len] != '<'; len++) ;
1711		strncpy(pcValue, &pcToken[8], len - 8);
1712		pcValue[len - 8] = 0;
1713		if (strcmp(pcKey, pcDesiredKey) == 0)
1714		{
1715			if (desiredIndex == valueIndex)
1716			{
1717				strcpy(pcFinValue, pcValue);
1718			}
1719		}
1720	}
1721
1722}
1723
1724void tperrorCheck(char *token_error)
1725{
1726}
1727
1728int LTPBundleFindValueWithKey(char *fileName, char *tokenKey,
1729	char *tokenValue, int tokenIndice)
1730{
1731
1732	FILE *file;
1733	file = 0;
1734
1735	desiredIndex = tokenIndice;
1736	pcDesiredKey = tokenKey;
1737	pcFinValue[0] = 0;
1738
1739	file = fopen(fileName, "r");
1740
1741	if (!file)
1742	{
1743		DebugLogB("Could not open bundle file : %s\n", fileName);
1744		return 1;
1745	}
1746
1747	yyin = file;
1748
1749	do
1750	{
1751		yylex();
1752	}
1753	while (!feof(file));
1754
1755	if (pcFinValue[0] == 0)
1756	{
1757		if (tokenIndice == 0)
1758		{
1759			/*
1760			 * Not defined at all
1761			 */
1762			DebugLogB("Value/Key not defined for: %s\n", tokenKey);
1763		}
1764		fclose(file);
1765		return -1;
1766	} else
1767	{
1768		strcpy(tokenValue, pcFinValue);
1769		fclose(file);
1770		return 0;
1771	}
1772
1773	fclose(file);
1774	return 0;
1775}
1776