You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1530 lines
38 KiB

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