1#include <setjmp.h>
2
3#define yyFlexLexer fmdfFlexLexer
4#define yy_create_buffer fmdf_create_buffer
5#define yy_delete_buffer fmdf_delete_buffer
6#define yy_flex_debug fmdf_flex_debug
7#define yy_init_buffer fmdf_init_buffer
8#define yy_load_buffer_state fmdf_load_buffer_state
9#define yy_switch_to_buffer fmdf_switch_to_buffer
10#define yyin fmdfin
11#define yyleng fmdfleng
12#define yylex fmdflex
13#define yyout fmdfout
14#define yyrestart fmdfrestart
15#define yytext fmdftext
16#define yywrap fmdfwrap
17
18/* A lexical scanner generated by flex */
19
20/* Scanner skeleton version:
21 * $Header: /home/daffy/u0/vern/flex/flex-2.4.7/RCS/flex.skl,v 1.2 94/08/03 11:13:24 vern Exp $
22 */
23
24#define FLEX_SCANNER
25#ifdef __WIN__
26#define __STDC__ 1
27#define isatty _isatty
28#endif
29#include <stdio.h>
30#ifndef __WIN__
31#include <unistd.h>
32#endif
33
34
35/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
36#ifdef c_plusplus
37#ifndef __cplusplus
38#define __cplusplus
39#endif
40#endif
41
42
43#ifdef __cplusplus
44
45#include <stdlib.h>
46#include <unistd.h>
47
48/* Use prototypes in function declarations. */
49#define YY_USE_PROTOS
50
51/* The "const" storage-class-modifier is valid. */
52#define YY_USE_CONST
53
54#else /* ! __cplusplus */
55
56#ifdef __STDC__
57
58#define YY_USE_PROTOS
59#define YY_USE_CONST
60
61#endif /* __STDC__ */
62#endif /* ! __cplusplus */
63
64
65#ifdef __TURBOC__
66#define YY_USE_CONST
67#endif
68
69
70#ifndef YY_USE_CONST
71#ifndef const
72#define const
73#endif
74#endif
75
76
77#ifdef YY_USE_PROTOS
78#define YY_PROTO(proto) proto
79#else
80#define YY_PROTO(proto) ()
81#endif
82
83/* Returned upon end-of-file. */
84#define YY_NULL 0
85
86/* Promotes a possibly negative, possibly signed char to an unsigned
87 * integer for use as an array index. If the signed char is negative,
88 * we want to instead treat it as an 8-bit unsigned char, hence the
89 * double cast.
90 */
91#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
92
93/* Enter a start condition. This macro really ought to take a parameter,
94 * but we do it the disgusting crufty way forced on us by the ()-less
95 * definition of BEGIN.
96 */
97#define BEGIN yy_start = 1 + 2 *
98
99/* Translate the current start state into a value that can be later handed
100 * to BEGIN to return to the state.
101 */
102#define YY_START ((yy_start - 1) / 2)
103
104/* Action number for EOF rule of a given start state. */
105#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
106
107/* Special action meaning "start processing a new file". Now included
108 * only for backward compatibility with previous versions of flex.
109 */
110#define YY_NEW_FILE yyrestart( yyin )
111
112#define YY_END_OF_BUFFER_CHAR 0
113
114/* Size of default input buffer. */
115#define YY_BUF_SIZE 16384
116
117typedef struct yy_buffer_state *YY_BUFFER_STATE;
118
119extern int yyleng;
120extern FILE *yyin, *yyout;
121
122#ifdef __cplusplus
123extern "C" {
124#endif
125 extern int yywrap YY_PROTO(( void ));
126#ifdef __cplusplus
127 }
128#endif
129
130#define EOB_ACT_CONTINUE_SCAN 0
131#define EOB_ACT_END_OF_FILE 1
132#define EOB_ACT_LAST_MATCH 2
133
134/* The funky do-while in the following #define is used to turn the definition
135 * int a single C statement (which needs a semi-colon terminator). This
136 * avoids problems with code like:
137 *
138 * if ( condition_holds )
139 * yyless( 5 );
140 * else
141 * do_something_else();
142 *
143 * Prior to using the do-while the compiler would get upset at the
144 * "else" because it interpreted the "if" statement as being all
145 * done when it reached the ';' after the yyless() call.
146 */
147
148/* Return all but the first 'n' matched characters back to the input stream. */
149
150#define yyless(n) \
151 do \
152 { \
153 /* Undo effects of setting up yytext. */ \
154 *yy_cp = yy_hold_char; \
155 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
156 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
157 } \
158 while ( 0 )
159
160#define unput(c) yyunput( c, yytext_ptr )
161
162
163struct yy_buffer_state
164 {
165 FILE *yy_input_file;
166
167 char *yy_ch_buf; /* input buffer */
168 char *yy_buf_pos; /* current position in input buffer */
169
170 /* Size of input buffer in bytes, not including room for EOB
171 * characters.
172 */
173 int yy_buf_size;
174
175 /* Number of characters read into yy_ch_buf, not including EOB
176 * characters.
177 */
178 int yy_n_chars;
179
180 /* Whether this is an "interactive" input source; if so, and
181 * if we're using stdio for input, then we want to use getc()
182 * instead of fread(), to make sure we stop fetching input after
183 * each newline.
184 */
185 int yy_is_interactive;
186
187 /* Whether to try to fill the input buffer when we reach the
188 * end of it.
189 */
190 int yy_fill_buffer;
191
192 int yy_buffer_status;
193#define YY_BUFFER_NEW 0
194#define YY_BUFFER_NORMAL 1
195 /* When an EOF's been seen but there's still some text to process
196 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
197 * shouldn't try reading from the input source any more. We might
198 * still have a bunch of tokens to match, though, because of
199 * possible backing-up.
200 *
201 * When we actually see the EOF, we change the status to "new"
202 * (via yyrestart()), so that the user can continue scanning by
203 * just pointing yyin at a new input file.
204 */
205#define YY_BUFFER_EOF_PENDING 2
206 };
207
208static YY_BUFFER_STATE yy_current_buffer = 0;
209
210/* We provide macros for accessing buffer states in case in the
211 * future we want to put the buffer states in a more general
212 * "scanner state".
213 */
214#define YY_CURRENT_BUFFER yy_current_buffer
215
216
217/* yy_hold_char holds the character lost when yytext is formed. */
218static char yy_hold_char;
219
220static int yy_n_chars; /* number of characters read into yy_ch_buf */
221
222
223int yyleng;
224
225/* Points to current character in buffer. */
226static char *yy_c_buf_p = (char *) 0;
227static int yy_init = 1; /* whether we need to initialize */
228static int yy_start = 0; /* start state number */
229
230/* Flag which is used to allow yywrap()'s to do buffer switches
231 * instead of setting up a fresh yyin. A bit of a hack ...
232 */
233static int yy_did_buffer_switch_on_eof;
234
235static void yyunput YY_PROTO(( int c, char *buf_ptr ));
236void yyrestart YY_PROTO(( FILE *input_file ));
237void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
238void yy_load_buffer_state YY_PROTO(( void ));
239YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
240void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
241void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
242
243static int yy_start_stack_ptr = 0;
244static int yy_start_stack_depth = 0;
245static int *yy_start_stack = 0;
246static void yy_push_state YY_PROTO(( int new_state ));
247static void yy_pop_state YY_PROTO(( void ));
248static int yy_top_state YY_PROTO(( void ));
249
250static void *yy_flex_alloc YY_PROTO(( unsigned int ));
251static void *yy_flex_realloc YY_PROTO(( void *, unsigned int ));
252static void yy_flex_free YY_PROTO(( void * ));
253
254#define yy_new_buffer yy_create_buffer
255
256#define INITIAL 0
257#define txt 1
258#define sqt 2
259#define dqt 3
260typedef unsigned char YY_CHAR;
261typedef int yy_state_type;
262FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
263extern char *yytext;
264#define yytext_ptr yytext
265
266#ifndef yytext_ptr
267static void yy_flex_strncpy YY_PROTO(( char *, const char *, int ));
268#endif
269
270#ifdef __cplusplus
271static int yyinput YY_PROTO(( void ));
272#else
273static int input YY_PROTO(( void ));
274#endif
275
276static yy_state_type yy_get_previous_state YY_PROTO(( void ));
277static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
278static int yy_get_next_buffer YY_PROTO(( void ));
279static void yy_fatal_error YY_PROTO(( const char msg[] ));
280
281/* Done after the current pattern has been matched and before the
282 * corresponding action - sets up yytext.
283 */
284#define YY_DO_BEFORE_ACTION \
285 yytext_ptr = yy_bp; \
286 yyleng = (int)(yy_cp - yy_bp); \
287 yy_hold_char = *yy_cp; \
288 *yy_cp = '\0'; \
289 yy_c_buf_p = yy_cp;
290
291#define YY_END_OF_BUFFER 17
292static const short int yy_accept[45] =
293 { 0,
294 0, 0, 0, 0, 0, 0, 0, 0, 17, 15,
295 16, 14, 1, 13, 2, 3, 8, 7, 6, 9,
296 10, 11, 12, 15, 16, 5, 15, 16, 4, 1,
297 8, 8, 7, 7, 6, 9, 10, 11, 12, 0,
298 5, 0, 4, 0
299 } ;
300
301static const int yy_ec[256] =
302 { 0,
303 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
304 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
305 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
306 1, 2, 1, 4, 1, 1, 1, 1, 5, 1,
307 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
308 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
309 1, 1, 1, 1, 1, 1, 1, 6, 1, 1,
310 1, 1, 1, 1, 1, 1, 7, 1, 1, 1,
311 1, 1, 1, 1, 1, 1, 1, 1, 8, 1,
312 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
313
314 1, 1, 1, 9, 1, 1, 1, 1, 10, 1,
315 1, 1, 1, 1, 11, 12, 1, 1, 1, 1,
316 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
317 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
318 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
319 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
320 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
321 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
322 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
323 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
324
325 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
326 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
327 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
328 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
329 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
330 1, 1, 1, 1, 1
331 } ;
332
333static const int yy_meta[13] =
334 { 0,
335 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
336 1, 1
337 } ;
338
339static const short int yy_base[52] =
340 { 0,
341 49, 48, 0, 0, 10, 13, 16, 18, 50, 53,
342 53, 53, 47, 53, 53, 53, 42, 40, 38, 36,
343 34, 32, 30, 36, 35, 53, 35, 34, 53, 35,
344 53, 30, 53, 28, 26, 24, 22, 20, 18, 24,
345 53, 24, 53, 53, 26, 25, 24, 23, 22, 16,
346 13
347 } ;
348
349static const short int yy_def[52] =
350 { 0,
351 45, 45, 44, 3, 46, 46, 47, 47, 44, 44,
352 44, 44, 44, 44, 44, 44, 48, 49, 44, 44,
353 44, 44, 44, 50, 50, 44, 51, 51, 44, 44,
354 44, 48, 44, 49, 44, 44, 44, 44, 44, 50,
355 44, 51, 44, 0, 44, 44, 44, 44, 44, 44,
356 44
357 } ;
358
359static const short int yy_nxt[66] =
360 { 0,
361 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
362 22, 23, 25, 42, 26, 25, 40, 26, 28, 29,
363 28, 29, 33, 31, 27, 24, 10, 43, 41, 39,
364 38, 37, 36, 35, 34, 32, 30, 43, 43, 41,
365 41, 39, 38, 37, 36, 35, 34, 32, 30, 44,
366 11, 11, 9, 44, 44, 44, 44, 44, 44, 44,
367 44, 44, 44, 44, 44
368 } ;
369
370static const short int yy_chk[66] =
371 { 0,
372 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
373 3, 3, 5, 51, 5, 6, 50, 6, 7, 7,
374 8, 8, 49, 48, 47, 46, 45, 42, 40, 39,
375 38, 37, 36, 35, 34, 32, 30, 28, 27, 25,
376 24, 23, 22, 21, 20, 19, 18, 17, 13, 9,
377 2, 1, 44, 44, 44, 44, 44, 44, 44, 44,
378 44, 44, 44, 44, 44
379 } ;
380
381static yy_state_type yy_last_accepting_state;
382static char *yy_last_accepting_cpos;
383
384/* The intent behind this definition is that it'll catch
385 * any uses of REJECT which flex missed.
386 */
387#define REJECT reject_used_but_not_detected
388#define yymore() yymore_used_but_not_detected
389#define YY_MORE_ADJ 0
390char *yytext;
391#if defined(UNIX)
392#define _fileno fileno
393#define istty _istty
394#else
395#include <stdlib.h>
396#include <io.h>
397#endif /* UNIX */
398#include <string.h>
399#include "preparse.h"
400
401#ifndef fileno
402#define fileno _fileno
403#endif
404#undef YY_DECL
405#define YY_DECL int yylex YY_PROTO((PDTP ppp))
406#define YYSTATE ((yy_start-1)/2)
407#undef YY_INPUT
408#define YY_INPUT(buf,n,m) \
409 {n=((int) m< (int) strlen(pp->Curp))? (int) m: (int) strlen(pp->Curp);strncpy(buf,pp->Curp,n);pp->Curp+=n;}
410#if defined(UNIX)
411#undef yywrap
412#define yywrap ddwrap
413#endif /* UNIX */
414int yywrap(void);
415
416static PDTP pp;
417static void MakeParm(int n);
418static void MakeMMDD(int n);
419static void MakeAMPM(int n);
420static void MakeIn(const char *);
421static void MakeOut(const char *);
422static void Quotin(const char *);
423static void Quotout(const char *);
424
425/* Macros after this point can all be overridden by user definitions in
426 * section 1.
427 */
428
429#ifdef YY_MALLOC_DECL
430YY_MALLOC_DECL
431#else
432#if __STDC__
433#ifndef __cplusplus
434#include <stdlib.h>
435#endif
436#else
437/* Just try to get by without declaring the routines. This will fail
438 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
439 * or sizeof(void*) != sizeof(int).
440 */
441#endif
442#endif
443
444/* Amount of stuff to slurp up with each read. */
445#ifndef YY_READ_BUF_SIZE
446#define YY_READ_BUF_SIZE 8192
447#endif
448
449/* Copy whatever the last rule matched to the standard output. */
450
451#ifndef ECHO
452/* This used to be an fputs(), but since the string might contain NUL's,
453 * we now use fwrite().
454 */
455#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
456#endif
457
458/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
459 * is returned in "result".
460 */
461#ifndef YY_INPUT
462#define YY_INPUT(buf,result,max_size) \
463 if ( yy_current_buffer->yy_is_interactive ) \
464 { \
465 int c = getc( yyin ); \
466 result = c == (int) EOF ? 0 : 1; \
467 buf[0] = (char) c; \
468 } \
469 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
470 && ferror( yyin ) ) \
471 YY_FATAL_ERROR( "input in flex scanner failed" );
472#endif
473
474/* No semi-colon after return; correct usage is to write "yyterminate();" -
475 * we don't want an extra ';' after the "return" because that will cause
476 * some compilers to complain about unreachable statements.
477 */
478#ifndef yyterminate
479#define yyterminate() return YY_NULL
480#endif
481
482/* Number of entries by which start-condition stack grows. */
483#ifndef YY_START_STACK_INCR
484#define YY_START_STACK_INCR 25
485#endif
486
487/* Report a fatal error. */
488#ifndef YY_FATAL_ERROR
489#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
490#endif
491
492/* Default declaration of generated scanner - a define so the user can
493 * easily add parameters.
494 */
495#ifndef YY_DECL
496#define YY_DECL int yylex YY_PROTO(( void ))
497#endif
498
499/* Code executed at the beginning of each rule, after yytext and yyleng
500 * have been set up.
501 */
502#ifndef YY_USER_ACTION
503#define YY_USER_ACTION
504#endif
505
506/* Code executed at the end of each rule. */
507#ifndef YY_BREAK
508#define YY_BREAK break;
509#endif
510
511static jmp_buf env;
512
513YY_DECL
514 {
515 register yy_state_type yy_current_state;
516 register char *yy_cp, *yy_bp;
517 register int yy_act;
518
519 if (setjmp(env))
520 return -1;
521
522 /*************************************************************************/
523 /* Flex parser to analyze date format and produce input and/or output */
524 /* formats. Non quoted blanks are significant (put in the output format) */
525 /* unless the Flag is not null, then there are ignored for output fmt. */
526 /*************************************************************************/
527 BEGIN txt;
528 pp = ppp;
529 pp->Num = 0;
530 if (pp->InFmt) {*pp->InFmt = '\0'; pp->InFmt[pp->Outsize -1] = '\0'; }
531 if (pp->OutFmt) {*pp->OutFmt = '\0'; pp->OutFmt[pp->Outsize -1] = '\0'; }
532 pp->Curp = (char*) pp->Format;
533 yy_init = 1; /* This is a new input */
534
535
536 if ( yy_init )
537 {
538#ifdef YY_USER_INIT
539 YY_USER_INIT;
540#endif
541
542 if ( ! yy_start )
543 yy_start = 1; /* first start state */
544
545 if ( ! yyin )
546 yyin = stdin;
547
548 if ( ! yyout )
549 yyout = stdout;
550
551 if ( yy_current_buffer )
552 yy_init_buffer( yy_current_buffer, yyin );
553 else
554 yy_current_buffer =
555 yy_create_buffer( yyin, YY_BUF_SIZE );
556
557 yy_load_buffer_state();
558
559 yy_init = 0;
560 }
561
562 while ( 1 ) /* loops until end-of-file is reached */
563 {
564 yy_cp = yy_c_buf_p;
565
566 /* Support of yytext. */
567 *yy_cp = yy_hold_char;
568
569 /* yy_bp points to the position in yy_ch_buf of the start of
570 * the current run.
571 */
572 yy_bp = yy_cp;
573
574 yy_current_state = yy_start;
575yy_match:
576 do
577 {
578 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
579 if ( yy_accept[yy_current_state] )
580 {
581 yy_last_accepting_state = yy_current_state;
582 yy_last_accepting_cpos = yy_cp;
583 }
584 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
585 {
586 yy_current_state = (int) yy_def[yy_current_state];
587 if ( yy_current_state >= 45 )
588 yy_c = yy_meta[(unsigned int) yy_c];
589 }
590 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
591 ++yy_cp;
592 }
593 while ( yy_base[yy_current_state] != 53 );
594
595yy_find_action:
596 yy_act = yy_accept[yy_current_state];
597
598 YY_DO_BEFORE_ACTION;
599
600
601do_action: /* This label is used only to access EOF actions. */
602
603
604 switch ( yy_act )
605 { /* beginning of action switch */
606 case 0: /* must back up */
607 /* undo the effects of YY_DO_BEFORE_ACTION */
608 *yy_cp = yy_hold_char;
609 yy_cp = yy_last_accepting_cpos;
610 yy_current_state = yy_last_accepting_state;
611 goto yy_find_action;
612
613case 1:
614YY_USER_ACTION
615{MakeIn(" "); if (!pp->Flag) MakeOut(" ");}
616 YY_BREAK
617case 2:
618YY_USER_ACTION
619{BEGIN dqt;}
620 YY_BREAK
621case 3:
622YY_USER_ACTION
623{BEGIN sqt;}
624 YY_BREAK
625case 4:
626YY_USER_ACTION
627{Quotin(yytext); Quotout(yytext);
628#ifdef DEBUG
629 fprintf(stderr, "In double quote yytext=>>%s<<\n", yytext);
630#endif
631 BEGIN txt;}
632 YY_BREAK
633case 5:
634YY_USER_ACTION
635{Quotin(yytext); Quotout(yytext);
636#ifdef DEBUG
637 fprintf(stderr, "In simple quote yytext=>>%s<<\n", yytext);
638#endif
639 BEGIN txt;}
640 YY_BREAK
641case 6:
642YY_USER_ACTION
643MakeParm(0);
644 YY_BREAK
645case 7:
646YY_USER_ACTION
647MakeMMDD(1);
648 YY_BREAK
649case 8:
650YY_USER_ACTION
651MakeMMDD(2);
652 YY_BREAK
653case 9:
654YY_USER_ACTION
655MakeParm(3);
656 YY_BREAK
657case 10:
658YY_USER_ACTION
659MakeParm(4);
660 YY_BREAK
661case 11:
662YY_USER_ACTION
663MakeParm(5);
664 YY_BREAK
665case 12:
666YY_USER_ACTION
667MakeAMPM(6);
668 YY_BREAK
669case 13:
670YY_USER_ACTION
671
672 YY_BREAK
673case 14:
674YY_USER_ACTION
675{MakeIn(yytext); MakeOut(yytext);
676#ifdef DEBUG
677 fprintf(stderr, "No quote char=>>%s<<\n", yytext);
678#endif
679 }
680 YY_BREAK
681case 15:
682YY_USER_ACTION
683{pp->Flag = -1; yyterminate();}
684 YY_BREAK
685case 16:
686YY_USER_ACTION
687YY_FATAL_ERROR( "flex scanner jammed" );
688 YY_BREAK
689case YY_STATE_EOF(INITIAL):
690case YY_STATE_EOF(txt):
691case YY_STATE_EOF(sqt):
692case YY_STATE_EOF(dqt):
693 yyterminate();
694
695 case YY_END_OF_BUFFER:
696 {
697 /* Amount of text matched not including the EOB char. */
698 int yy_amount_of_matched_text = (int)(yy_cp - yytext_ptr - 1);
699
700 /* Undo the effects of YY_DO_BEFORE_ACTION. */
701 *yy_cp = yy_hold_char;
702
703 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
704 {
705 /* We're scanning a new file or input source. It's
706 * possible that this happened because the user
707 * just pointed yyin at a new source and called
708 * yylex(). If so, then we have to assure
709 * consistency between yy_current_buffer and our
710 * globals. Here is the right place to do so, because
711 * this is the first action (other than possibly a
712 * back-up) that will match for the new input source.
713 */
714 yy_n_chars = yy_current_buffer->yy_n_chars;
715 yy_current_buffer->yy_input_file = yyin;
716 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
717 }
718
719 /* Note that here we test for yy_c_buf_p "<=" to the position
720 * of the first EOB in the buffer, since yy_c_buf_p will
721 * already have been incremented past the NUL character
722 * (since all states make transitions on EOB to the
723 * end-of-buffer state). Contrast this with the test
724 * in input().
725 */
726 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
727 { /* This was really a NUL. */
728 yy_state_type yy_next_state;
729
730 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
731
732 yy_current_state = yy_get_previous_state();
733
734 /* Okay, we're now positioned to make the NUL
735 * transition. We couldn't have
736 * yy_get_previous_state() go ahead and do it
737 * for us because it doesn't know how to deal
738 * with the possibility of jamming (and we don't
739 * want to build jamming into it because then it
740 * will run more slowly).
741 */
742
743 yy_next_state = yy_try_NUL_trans( yy_current_state );
744
745 yy_bp = yytext_ptr + YY_MORE_ADJ;
746
747 if ( yy_next_state )
748 {
749 /* Consume the NUL. */
750 yy_cp = ++yy_c_buf_p;
751 yy_current_state = yy_next_state;
752 goto yy_match;
753 }
754
755 else
756 {
757 yy_cp = yy_c_buf_p;
758 goto yy_find_action;
759 }
760 }
761
762 else switch ( yy_get_next_buffer() )
763 {
764 case EOB_ACT_END_OF_FILE:
765 {
766 yy_did_buffer_switch_on_eof = 0;
767
768 if ( yywrap() )
769 {
770 /* Note: because we've taken care in
771 * yy_get_next_buffer() to have set up
772 * yytext, we can now set up
773 * yy_c_buf_p so that if some total
774 * hoser (like flex itself) wants to
775 * call the scanner after we return the
776 * YY_NULL, it'll still work - another
777 * YY_NULL will get returned.
778 */
779 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
780
781 yy_act = YY_STATE_EOF(YY_START);
782 goto do_action;
783 }
784
785 else
786 {
787 if ( ! yy_did_buffer_switch_on_eof )
788 YY_NEW_FILE;
789 }
790 break;
791 }
792
793 case EOB_ACT_CONTINUE_SCAN:
794 yy_c_buf_p =
795 yytext_ptr + yy_amount_of_matched_text;
796
797 yy_current_state = yy_get_previous_state();
798
799 yy_cp = yy_c_buf_p;
800 yy_bp = yytext_ptr + YY_MORE_ADJ;
801 goto yy_match;
802
803 case EOB_ACT_LAST_MATCH:
804 yy_c_buf_p =
805 &yy_current_buffer->yy_ch_buf[yy_n_chars];
806
807 yy_current_state = yy_get_previous_state();
808
809 yy_cp = yy_c_buf_p;
810 yy_bp = yytext_ptr + YY_MORE_ADJ;
811 goto yy_find_action;
812 }
813 break;
814 }
815
816 default:
817 YY_FATAL_ERROR(
818 "fatal flex scanner internal error--no action found" );
819 } /* end of action switch */
820 } /* end of scanning one token */
821 } /* end of yylex */
822
823
824/* yy_get_next_buffer - try to read in a new buffer
825 *
826 * Returns a code representing an action:
827 * EOB_ACT_LAST_MATCH -
828 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
829 * EOB_ACT_END_OF_FILE - end of file
830 */
831
832static int yy_get_next_buffer()
833 {
834 register char *dest = yy_current_buffer->yy_ch_buf;
835 register char *source = yytext_ptr - 1; /* copy prev. char, too */
836 register int number_to_move, i;
837 int ret_val;
838
839 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
840 YY_FATAL_ERROR(
841 "fatal flex scanner internal error--end of buffer missed" );
842
843 if ( yy_current_buffer->yy_fill_buffer == 0 )
844 { /* Don't try to fill the buffer, so this is an EOF. */
845 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
846 {
847 /* We matched a singled characater, the EOB, so
848 * treat this as a final EOF.
849 */
850 return EOB_ACT_END_OF_FILE;
851 }
852
853 else
854 {
855 /* We matched some text prior to the EOB, first
856 * process it.
857 */
858 return EOB_ACT_LAST_MATCH;
859 }
860 }
861
862 /* Try to read more data. */
863
864 /* First move last chars to start of buffer. */
865 number_to_move = (int)(yy_c_buf_p - yytext_ptr);
866
867 for ( i = 0; i < number_to_move; ++i )
868 *(dest++) = *(source++);
869
870 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
871 /* don't do the read, it's not guaranteed to return an EOF,
872 * just force an EOF
873 */
874 yy_n_chars = 0;
875
876 else
877 {
878 int num_to_read =
879 yy_current_buffer->yy_buf_size - number_to_move - 1;
880
881 while ( num_to_read <= 0 )
882 { /* Not enough room in the buffer - grow it. */
883#ifdef YY_USES_REJECT
884 YY_FATAL_ERROR(
885"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
886#else
887
888 /* just a shorter name for the current buffer */
889 YY_BUFFER_STATE b = yy_current_buffer;
890
891 int yy_c_buf_p_offset = (int)(yy_c_buf_p - b->yy_ch_buf);
892
893 b->yy_buf_size *= 2;
894 b->yy_ch_buf = (char *)
895 yy_flex_realloc( (void *) b->yy_ch_buf,
896 b->yy_buf_size );
897
898 if ( ! b->yy_ch_buf )
899 YY_FATAL_ERROR(
900 "fatal error - scanner input buffer overflow" );
901
902 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
903
904 num_to_read = yy_current_buffer->yy_buf_size -
905 number_to_move - 1;
906#endif
907 }
908
909 if ( num_to_read > YY_READ_BUF_SIZE )
910 num_to_read = YY_READ_BUF_SIZE;
911
912 /* Read in more data. */
913 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
914 yy_n_chars, num_to_read );
915 }
916
917 if ( yy_n_chars == 0 )
918 {
919 if ( number_to_move - YY_MORE_ADJ == 1 )
920 {
921 ret_val = EOB_ACT_END_OF_FILE;
922 yyrestart( yyin );
923 }
924
925 else
926 {
927 ret_val = EOB_ACT_LAST_MATCH;
928 yy_current_buffer->yy_buffer_status =
929 YY_BUFFER_EOF_PENDING;
930 }
931 }
932
933 else
934 ret_val = EOB_ACT_CONTINUE_SCAN;
935
936 yy_n_chars += number_to_move;
937 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
938 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
939
940 /* yytext begins at the second character in yy_ch_buf; the first
941 * character is the one which preceded it before reading in the latest
942 * buffer; it needs to be kept around in case it's a newline, so
943 * yy_get_previous_state() will have with '^' rules active.
944 */
945
946 yytext_ptr = &yy_current_buffer->yy_ch_buf[1];
947
948 return ret_val;
949 }
950
951
952/* yy_get_previous_state - get the state just before the EOB char was reached */
953
954static yy_state_type yy_get_previous_state()
955 {
956 register yy_state_type yy_current_state;
957 register char *yy_cp;
958
959 yy_current_state = yy_start;
960
961 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
962 {
963 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
964 if ( yy_accept[yy_current_state] )
965 {
966 yy_last_accepting_state = yy_current_state;
967 yy_last_accepting_cpos = yy_cp;
968 }
969 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
970 {
971 yy_current_state = (int) yy_def[yy_current_state];
972 if ( yy_current_state >= 45 )
973 yy_c = yy_meta[(unsigned int) yy_c];
974 }
975 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
976 }
977
978 return yy_current_state;
979 }
980
981
982/* yy_try_NUL_trans - try to make a transition on the NUL character
983 *
984 * synopsis
985 * next_state = yy_try_NUL_trans( current_state );
986 */
987
988#ifdef YY_USE_PROTOS
989static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
990#else
991static yy_state_type yy_try_NUL_trans( yy_current_state )
992yy_state_type yy_current_state;
993#endif
994 {
995 register int yy_is_jam;
996 register char *yy_cp = yy_c_buf_p;
997
998 register YY_CHAR yy_c = 1;
999 if ( yy_accept[yy_current_state] )
1000 {
1001 yy_last_accepting_state = yy_current_state;
1002 yy_last_accepting_cpos = yy_cp;
1003 }
1004 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1005 {
1006 yy_current_state = (int) yy_def[yy_current_state];
1007 if ( yy_current_state >= 45 )
1008 yy_c = yy_meta[(unsigned int) yy_c];
1009 }
1010 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1011 yy_is_jam = (yy_current_state == 44);
1012
1013 return yy_is_jam ? 0 : yy_current_state;
1014 }
1015
1016
1017#ifdef YY_USE_PROTOS
1018static void yyunput( int c, register char *yy_bp )
1019#else
1020static void yyunput( c, yy_bp )
1021int c;
1022register char *yy_bp;
1023#endif
1024 {
1025 register char *yy_cp = yy_c_buf_p;
1026
1027 /* undo effects of setting up yytext */
1028 *yy_cp = yy_hold_char;
1029
1030 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1031 { /* need to shift things up to make room */
1032 /* +2 for EOB chars. */
1033 register int number_to_move = yy_n_chars + 2;
1034 register char *dest = &yy_current_buffer->yy_ch_buf[
1035 yy_current_buffer->yy_buf_size + 2];
1036 register char *source =
1037 &yy_current_buffer->yy_ch_buf[number_to_move];
1038
1039 while ( source > yy_current_buffer->yy_ch_buf )
1040 *--dest = *--source;
1041
1042 yy_cp += dest - source;
1043 yy_bp += dest - source;
1044 yy_n_chars = yy_current_buffer->yy_buf_size;
1045
1046 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1047 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1048 }
1049
1050 if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
1051 yy_cp[-2] = '\n';
1052
1053 *--yy_cp = (char) c;
1054
1055
1056 /* Note: the formal parameter *must* be called "yy_bp" for this
1057 * macro to now work correctly.
1058 */
1059 YY_DO_BEFORE_ACTION; /* set up yytext again */
1060 }
1061
1062
1063#ifdef __cplusplus
1064static int yyinput()
1065#else
1066static int input()
1067#endif
1068 {
1069 int c;
1070
1071 *yy_c_buf_p = yy_hold_char;
1072
1073 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1074 {
1075 /* yy_c_buf_p now points to the character we want to return.
1076 * If this occurs *before* the EOB characters, then it's a
1077 * valid NUL; if not, then we've hit the end of the buffer.
1078 */
1079 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1080 /* This was really a NUL. */
1081 *yy_c_buf_p = '\0';
1082
1083 else
1084 { /* need more input */
1085 yytext_ptr = yy_c_buf_p;
1086 ++yy_c_buf_p;
1087
1088 switch ( yy_get_next_buffer() )
1089 {
1090 case EOB_ACT_END_OF_FILE:
1091 {
1092 if ( yywrap() )
1093 {
1094 yy_c_buf_p =
1095 yytext_ptr + YY_MORE_ADJ;
1096 return EOF;
1097 }
1098
1099 YY_NEW_FILE;
1100#ifdef __cplusplus
1101 return yyinput();
1102#else
1103 return input();
1104#endif
1105 }
1106
1107 case EOB_ACT_CONTINUE_SCAN:
1108 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1109 break;
1110
1111 case EOB_ACT_LAST_MATCH:
1112#ifdef __cplusplus
1113 YY_FATAL_ERROR(
1114 "unexpected last match in yyinput()" );
1115#else
1116 YY_FATAL_ERROR(
1117 "unexpected last match in input()" );
1118#endif
1119 }
1120 }
1121 }
1122
1123 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1124 *yy_c_buf_p = '\0'; /* preserve yytext */
1125 yy_hold_char = *++yy_c_buf_p;
1126
1127 return c;
1128 }
1129
1130
1131#ifdef YY_USE_PROTOS
1132void yyrestart( FILE *input_file )
1133#else
1134void yyrestart( input_file )
1135FILE *input_file;
1136#endif
1137 {
1138 if ( ! yy_current_buffer )
1139 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1140
1141 yy_init_buffer( yy_current_buffer, input_file );
1142 yy_load_buffer_state();
1143 }
1144
1145
1146#ifdef YY_USE_PROTOS
1147void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1148#else
1149void yy_switch_to_buffer( new_buffer )
1150YY_BUFFER_STATE new_buffer;
1151#endif
1152 {
1153 if ( yy_current_buffer == new_buffer )
1154 return;
1155
1156 if ( yy_current_buffer )
1157 {
1158 /* Flush out information for old buffer. */
1159 *yy_c_buf_p = yy_hold_char;
1160 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1161 yy_current_buffer->yy_n_chars = yy_n_chars;
1162 }
1163
1164 yy_current_buffer = new_buffer;
1165 yy_load_buffer_state();
1166
1167 /* We don't actually know whether we did this switch during
1168 * EOF (yywrap()) processing, but the only time this flag
1169 * is looked at is after yywrap() is called, so it's safe
1170 * to go ahead and always set it.
1171 */
1172 yy_did_buffer_switch_on_eof = 1;
1173 }
1174
1175
1176#ifdef YY_USE_PROTOS
1177void yy_load_buffer_state( void )
1178#else
1179void yy_load_buffer_state()
1180#endif
1181 {
1182 yy_n_chars = yy_current_buffer->yy_n_chars;
1183 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1184 yyin = yy_current_buffer->yy_input_file;
1185 yy_hold_char = *yy_c_buf_p;
1186 }
1187
1188
1189#ifdef YY_USE_PROTOS
1190YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1191#else
1192YY_BUFFER_STATE yy_create_buffer( file, size )
1193FILE *file;
1194int size;
1195#endif
1196 {
1197 YY_BUFFER_STATE b;
1198
1199 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1200
1201 if ( ! b )
1202 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1203
1204 b->yy_buf_size = size;
1205
1206 /* yy_ch_buf has to be 2 characters longer than the size given because
1207 * we need to put in 2 end-of-buffer characters.
1208 */
1209 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1210
1211 if ( ! b->yy_ch_buf )
1212 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1213
1214 yy_init_buffer( b, file );
1215
1216 return b;
1217 }
1218
1219
1220#ifdef YY_USE_PROTOS
1221void yy_delete_buffer( YY_BUFFER_STATE b )
1222#else
1223void yy_delete_buffer( b )
1224YY_BUFFER_STATE b;
1225#endif
1226 {
1227 if ( b == yy_current_buffer )
1228 yy_current_buffer = (YY_BUFFER_STATE) 0;
1229
1230 yy_flex_free( (void *) b->yy_ch_buf );
1231 yy_flex_free( (void *) b );
1232 }
1233
1234
1235#ifdef YY_USE_PROTOS
1236void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1237#else
1238void yy_init_buffer( b, file )
1239YY_BUFFER_STATE b;
1240FILE *file;
1241#endif
1242 {
1243 b->yy_input_file = file;
1244
1245 /* We put in the '\n' and start reading from [1] so that an
1246 * initial match-at-newline will be true.
1247 */
1248
1249 b->yy_ch_buf[0] = '\n';
1250 b->yy_n_chars = 1;
1251
1252 /* We always need two end-of-buffer characters. The first causes
1253 * a transition to the end-of-buffer state. The second causes
1254 * a jam in that state.
1255 */
1256 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1257 b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
1258
1259 b->yy_buf_pos = &b->yy_ch_buf[1];
1260
1261 b->yy_is_interactive = file ? isatty( fileno(file) ) : 0;
1262
1263 b->yy_fill_buffer = 1;
1264
1265 b->yy_buffer_status = YY_BUFFER_NEW;
1266 }
1267
1268
1269#ifdef YY_USE_PROTOS
1270static void yy_push_state( int new_state )
1271#else
1272static void yy_push_state( new_state )
1273int new_state;
1274#endif
1275 {
1276 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1277 {
1278 int new_size;
1279
1280 yy_start_stack_depth += YY_START_STACK_INCR;
1281 new_size = yy_start_stack_depth * sizeof( int );
1282
1283 if ( ! yy_start_stack )
1284 yy_start_stack = (int *) yy_flex_alloc( new_size );
1285
1286 else
1287 yy_start_stack = (int *) yy_flex_realloc(
1288 (void *) yy_start_stack, new_size );
1289
1290 if ( ! yy_start_stack )
1291 YY_FATAL_ERROR(
1292 "out of memory expanding start-condition stack" );
1293 }
1294
1295 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1296
1297 BEGIN(new_state);
1298 }
1299
1300
1301static void yy_pop_state()
1302 {
1303 if ( --yy_start_stack_ptr < 0 )
1304 YY_FATAL_ERROR( "start-condition stack underflow" );
1305
1306 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1307 }
1308
1309
1310static int yy_top_state()
1311 {
1312 return yy_start_stack[yy_start_stack_ptr - 1];
1313 }
1314
1315
1316#ifdef YY_USE_PROTOS
1317static void yy_fatal_error( const char msg[] )
1318#else
1319static void yy_fatal_error( msg )
1320char msg[];
1321#endif
1322 {
1323 (void) fprintf( stderr, "%s\n", msg );
1324 longjmp(env, 1 );
1325 }
1326
1327
1328
1329/* Redefine yyless() so it works in section 3 code. */
1330
1331#undef yyless
1332#define yyless(n) \
1333 do \
1334 { \
1335 /* Undo effects of setting up yytext. */ \
1336 yytext[yyleng] = yy_hold_char; \
1337 yy_c_buf_p = yytext + n - YY_MORE_ADJ; \
1338 yy_hold_char = *yy_c_buf_p; \
1339 *yy_c_buf_p = '\0'; \
1340 yyleng = n; \
1341 } \
1342 while ( 0 )
1343
1344
1345/* Internal utility routines. */
1346
1347#ifndef yytext_ptr
1348#ifdef YY_USE_PROTOS
1349static void yy_flex_strncpy( char *s1, const char *s2, int n )
1350#else
1351static void yy_flex_strncpy( s1, s2, n )
1352char *s1;
1353const char *s2;
1354int n;
1355#endif
1356 {
1357 register int i;
1358 for ( i = 0; i < n; ++i )
1359 s1[i] = s2[i];
1360 }
1361#endif
1362
1363
1364#ifdef YY_USE_PROTOS
1365static void *yy_flex_alloc( unsigned int size )
1366#else
1367static void *yy_flex_alloc( size )
1368unsigned int size;
1369#endif
1370 {
1371 return (void *) malloc( size );
1372 }
1373
1374#ifdef YY_USE_PROTOS
1375static void *yy_flex_realloc( void *ptr, unsigned int size )
1376#else
1377static void *yy_flex_realloc( ptr, size )
1378void *ptr;
1379unsigned int size;
1380#endif
1381 {
1382 return (void *) realloc( ptr, size );
1383 }
1384
1385#ifdef YY_USE_PROTOS
1386static void yy_flex_free( void *ptr )
1387#else
1388static void yy_flex_free( ptr )
1389void *ptr;
1390#endif
1391 {
1392 free( ptr );
1393 }
1394
1395
1396void MakeMMDD(int n)
1397 {
1398 int m = strlen(yytext) - 1;
1399 char c = yytext[m];
1400
1401 if ((c == 'M' && n == 1) || (c == 'D' && n == 2)) {
1402 m++;
1403 c = 0;
1404 } /* endif c */
1405
1406#ifdef DEBUG
1407 fprintf(stderr, "MM: n=%d num=%d InFmt=%s OutFmt=%s;\n",
1408 n, pp->Num, pp->InFmt, pp->OutFmt);
1409#endif
1410 pp->Index[pp->Num++] = (m < 3) ? n : (-n);
1411
1412 switch (m) {
1413 case 1:
1414 MakeIn("%2d");
1415 MakeOut((n == 1) ? "%#m" : "%#d");
1416 break;
1417 case 2:
1418 MakeIn("%2d");
1419 MakeOut((n == 1) ? "%m" : "%d");
1420 break;
1421 case 3:
1422 MakeIn("%3s");
1423 MakeOut((n == 1) ? "%b" : "%a");
1424 break;
1425 default:
1426 if (c && c != ' ') {
1427 char fm[] = "%[^x]";
1428 fm[3] = c;
1429 MakeIn(fm);
1430 } else
1431 MakeIn("%s");
1432
1433 MakeOut((n == 1) ? "%B" : "%A");
1434 } /* endswitch m */
1435
1436 if (c)
1437 unput(c);
1438
1439 } /* end of MakeMMDD */
1440
1441void MakeParm(int n)
1442 {
1443 int m = strlen(yytext);
1444
1445#ifdef DEBUG
1446 fprintf(stderr, "MP: n=%d num=%d InFmt=%s OutFmt=%s;\n",
1447 n, pp->Num, pp->InFmt, pp->OutFmt);
1448#endif
1449 pp->Index[pp->Num++] = n;
1450
1451 switch (m) {
1452 case 1:
1453 MakeIn("%2d");
1454 MakeOut((n == 0) ? "%#y" : (n == 3) ? "%#H"
1455 : (n == 4) ? "%#M" : "%#S");
1456 break;
1457 case 2:
1458 MakeIn("%2d");
1459 MakeOut((n == 0) ? "%y" : (n == 3) ? "%H"
1460 : (n == 4) ? "%M" : "%S");
1461 break;
1462 default:
1463 MakeIn("%4d");
1464 MakeOut("%Y");
1465 } /* endswitch m */
1466
1467 } /* end of MakeParm */
1468
1469void MakeAMPM(int n)
1470 {
1471 char buf[8];
1472 int m = strlen(yytext);
1473
1474#ifdef DEBUG
1475 fprintf(stderr, "AM: n=%d num=%d InFmt=%s OutFmt=%s;\n",
1476 n, pp->Num, pp->InFmt, pp->OutFmt);
1477#endif
1478 pp->Index[pp->Num++] = -n;
1479 sprintf(buf, "%%%ds", m);
1480 MakeIn(buf);
1481
1482 if (pp->OutFmt) {
1483 char *p;
1484
1485 if ((p = strstr(pp->OutFmt, "%H")))
1486 *(p + 1) = 'I'; // 12-hour format
1487 else if ((p = strstr(pp->OutFmt, "%#H")))
1488 *(p + 2) = 'I'; // 12-hour format
1489
1490 MakeOut("%p");
1491 } /* endif Flag */
1492
1493 } /* end of MakeAMPM */
1494
1495void MakeIn(const char *text)
1496 {
1497 if (!pp->InFmt)
1498 return;
1499
1500 strncat(pp->InFmt, text, (pp->Outsize - 1) - strlen(pp->InFmt));
1501 } /* end of MakeIn */
1502
1503void MakeOut(const char *text)
1504 {
1505 if (!pp->OutFmt) return;
1506
1507 strncat(pp->OutFmt, text, (pp->Outsize - 1) - strlen(pp->OutFmt));
1508 } /* end of MakeOut */
1509
1510void Quotin(const char *text)
1511 {
1512 if (!pp->InFmt)
1513 return;
1514
1515 MakeIn(text);
1516 pp->InFmt[strlen(pp->InFmt)-1] = '\0';
1517 } /* end of Quotin */
1518
1519void Quotout(const char *text)
1520 {
1521 if (!pp->OutFmt)
1522 return;
1523
1524 MakeOut(text);
1525 pp->OutFmt[strlen(pp->OutFmt)-1] = '\0';
1526 } /* end of Quotout */
1527
1528int yywrap(void)
1529 {
1530 /* Avoid memory leak */
1531 if (yy_current_buffer)
1532 yy_delete_buffer(yy_current_buffer);
1533
1534 return 1;
1535 } /* end of yywrap */
1536
1537