/* A lexical scanner generated by flex */ /* Scanner skeleton version: * $Header: /home/daffy/u0/vern/flex/flex-2.4.7/RCS/flex.skl,v 1.2 94/08/03 11:13:24 vern Exp $ */ #define FLEX_SCANNER #include /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ #ifdef c_plusplus #ifndef __cplusplus #define __cplusplus #endif #endif #ifdef __cplusplus #include #include /* Use prototypes in function declarations. */ #define YY_USE_PROTOS /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ #ifdef __STDC__ #define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef __TURBOC__ #define YY_USE_CONST #endif #ifndef YY_USE_CONST #ifndef const #define const #endif #endif #ifdef YY_USE_PROTOS #define YY_PROTO(proto) proto #else #define YY_PROTO(proto) () #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN yy_start = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. */ #define YY_START ((yy_start - 1) / 2) /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". Now included * only for backward compatibility with previous versions of flex. */ #define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #define YY_BUF_SIZE 16384 typedef struct yy_buffer_state *YY_BUFFER_STATE; extern int yyleng; extern FILE *yyin, *yyout; #ifdef __cplusplus extern "C" { #endif extern int yywrap YY_PROTO(( void )); #ifdef __cplusplus } #endif #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* The funky do-while in the following #define is used to turn the definition * int a single C statement (which needs a semi-colon terminator). This * avoids problems with code like: * * if ( condition_holds ) * yyless( 5 ); * else * do_something_else(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all * done when it reached the ';' after the yyless() call. */ /* Return all but the first 'n' matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ *yy_cp = yy_hold_char; \ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, yytext_ptr ) struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; static YY_BUFFER_STATE yy_current_buffer = 0; /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". */ #define YY_CURRENT_BUFFER yy_current_buffer /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 1; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; static void yyunput YY_PROTO(( int c, char *buf_ptr )); void yyrestart YY_PROTO(( FILE *input_file )); void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); void yy_load_buffer_state YY_PROTO(( void )); YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); static int yy_start_stack_ptr = 0; static int yy_start_stack_depth = 0; static int *yy_start_stack = 0; static void yy_push_state YY_PROTO(( int new_state )); static void yy_pop_state YY_PROTO(( void )); static int yy_top_state YY_PROTO(( void )); static void *yy_flex_alloc YY_PROTO(( unsigned int )); static void *yy_flex_realloc YY_PROTO(( void *, unsigned int )); static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer #define INITIAL 0 #define STRING 1 #define BCOMMENT 2 #define INCLUDE 3 #define CPLUSPLUS 4 typedef unsigned char YY_CHAR; typedef int yy_state_type; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; extern char *yytext; #define yytext_ptr yytext #ifndef yytext_ptr static void yy_flex_strncpy YY_PROTO(( char *, const char *, int )); #endif #ifdef __cplusplus static int yyinput YY_PROTO(( void )); #else static int input YY_PROTO(( void )); #endif static yy_state_type yy_get_previous_state YY_PROTO(( void )); static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); static int yy_get_next_buffer YY_PROTO(( void )); static void yy_fatal_error YY_PROTO(( const char msg[] )); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yytext_ptr = yy_bp; \ yyleng = yy_cp - yy_bp; \ yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; #define YY_END_OF_BUFFER 140 static const short int yy_accept[537] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 140, 139, 136, 138, 137, 95, 116, 139, 86, 85, 139, 103, 104, 73, 97, 92, 96, 93, 77, 127, 127, 90, 94, 78, 91, 79, 89, 109, 109, 105, 139, 106, 74, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 83, 75, 84, 72, 135, 77, 122, 120, 119, 122, 121, 115, 113, 115, 114, 14, 12, 13, 14, 14, 108, 96, 93, 90, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 136, 137, 64, 0, 0, 0, 0, 0, 81, 80, 82, 0, 0, 67, 100, 101, 87, 102, 59, 0, 123, 111, 98, 124, 127, 127, 0, 127, 0, 60, 62, 99, 63, 61, 109, 116, 0, 134, 70, 109, 109, 109, 109, 109, 109, 43, 109, 109, 109, 109, 109, 109, 44, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 71, 65, 135, 110, 118, 117, 121, 112, 114, 12, 0, 11, 0, 10, 108, 59, 88, 107, 108, 108, 108, 108, 108, 108, 108, 108, 43, 108, 108, 108, 108, 108, 108, 108, 44, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 0, 0, 0, 4, 0, 0, 128, 0, 128, 0, 0, 66, 0, 123, 123, 0, 124, 127, 0, 125, 133, 68, 69, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 36, 109, 17, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 76, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 36, 108, 108, 108, 17, 108, 47, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 0, 0, 0, 0, 0, 0, 0, 0, 129, 130, 0, 0, 0, 125, 123, 0, 126, 133, 15, 109, 23, 27, 109, 109, 109, 109, 20, 24, 109, 109, 40, 21, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 38, 109, 109, 15, 108, 23, 27, 108, 108, 108, 108, 108, 108, 20, 24, 108, 108, 108, 40, 108, 21, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 49, 108, 108, 108, 108, 38, 108, 108, 0, 7, 8, 0, 0, 0, 0, 0, 0, 131, 0, 19, 31, 109, 109, 109, 109, 32, 109, 109, 33, 109, 109, 109, 109, 109, 109, 30, 109, 109, 46, 19, 51, 31, 108, 108, 108, 108, 108, 32, 108, 108, 108, 108, 108, 108, 108, 108, 108, 33, 108, 108, 108, 108, 108, 108, 30, 108, 108, 108, 46, 0, 9, 5, 0, 0, 3, 109, 109, 16, 28, 109, 29, 37, 41, 45, 18, 22, 109, 109, 109, 108, 108, 48, 16, 28, 56, 57, 108, 108, 108, 108, 52, 108, 29, 37, 41, 45, 18, 22, 108, 108, 108, 108, 2, 6, 0, 109, 39, 109, 26, 109, 109, 108, 39, 108, 108, 54, 108, 108, 26, 108, 55, 108, 1, 35, 25, 34, 42, 35, 50, 58, 108, 25, 34, 42, 53, 0 } ; static const int yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 22, 22, 22, 22, 22, 22, 23, 23, 24, 25, 26, 27, 28, 29, 30, 31, 31, 31, 31, 32, 33, 34, 34, 34, 34, 34, 35, 34, 34, 34, 34, 34, 34, 34, 34, 36, 34, 34, 34, 34, 34, 37, 38, 39, 40, 34, 30, 41, 42, 43, 44, 45, 46, 47, 48, 49, 34, 50, 51, 52, 53, 54, 55, 34, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static const int yy_meta[69] = { 0, 1, 1, 1, 1, 2, 2, 3, 2, 4, 2, 2, 5, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6, 7, 2, 2, 2, 2, 2, 3, 2, 7, 7, 7, 8, 8, 8, 2, 3, 2, 2, 6, 6, 7, 7, 7, 6, 8, 8, 8, 8, 8, 8, 9, 8, 8, 9, 8, 9, 8, 9, 8, 9, 8, 8, 2, 2, 2, 2 } ; static const short int yy_base[550] = { 0, 0, 67, 67, 73, 68, 79, 83, 90, 108, 94, 976, 977, 96, 977, 972, 947, 977, 129, 946, 62, 934, 977, 977, 944, 75, 977, 85, 85, 95, 170, 163, 977, 977, 92, 943, 93, 977, 0, 116, 977, 966, 977, 941, 908, 910, 142, 70, 84, 79, 911, 83, 910, 918, 152, 899, 908, 906, 911, 977, 111, 977, 977, 143, 160, 977, 977, 977, 197, 174, 977, 977, 938, 192, 977, 214, 977, 950, 928, 0, 199, 215, 931, 945, 211, 172, 91, 215, 216, 198, 224, 194, 219, 231, 202, 232, 203, 236, 235, 243, 233, 245, 249, 262, 977, 977, 266, 908, 26, 236, 899, 977, 977, 977, 939, 283, 977, 977, 977, 977, 977, 977, 931, 286, 977, 977, 301, 319, 337, 345, 977, 0, 922, 977, 977, 977, 921, 0, 977, 909, 977, 977, 888, 900, 887, 902, 889, 895, 881, 882, 879, 879, 882, 879, 876, 0, 875, 879, 230, 877, 226, 257, 881, 874, 263, 225, 879, 977, 977, 298, 977, 977, 977, 312, 977, 324, 325, 920, 977, 898, 977, 0, 910, 977, 977, 915, 270, 326, 292, 307, 334, 330, 335, 341, 344, 348, 353, 356, 365, 367, 368, 914, 371, 370, 375, 380, 382, 381, 376, 384, 378, 386, 383, 385, 388, 389, 394, 390, 396, 399, 876, 355, 877, 362, 877, 875, 977, 906, 905, 437, 0, 977, 439, 977, 431, 449, 977, 977, 452, 457, 433, 977, 977, 862, 874, 869, 857, 356, 871, 869, 865, 857, 863, 866, 0, 852, 0, 858, 855, 844, 846, 848, 855, 841, 839, 839, 851, 841, 845, 849, 851, 840, 977, 429, 400, 411, 431, 472, 476, 477, 479, 480, 481, 484, 482, 487, 881, 485, 486, 488, 880, 491, 879, 489, 490, 492, 493, 496, 494, 495, 497, 502, 499, 498, 500, 503, 501, 504, 506, 508, 505, 522, 507, 511, 838, 840, 840, 835, 838, 838, 830, 835, 977, 977, 520, 867, 546, 549, 977, 552, 555, 977, 0, 828, 0, 0, 819, 827, 816, 823, 0, 0, 817, 814, 0, 0, 814, 814, 811, 823, 813, 817, 822, 821, 819, 809, 814, 0, 802, 814, 849, 514, 848, 847, 526, 530, 516, 541, 570, 571, 846, 845, 573, 572, 578, 844, 580, 843, 575, 576, 577, 581, 583, 582, 584, 585, 589, 587, 586, 593, 594, 842, 598, 592, 597, 588, 841, 590, 601, 796, 977, 977, 802, 801, 801, 786, 798, 831, 977, 830, 0, 0, 788, 789, 794, 785, 0, 779, 783, 0, 791, 788, 790, 774, 783, 785, 0, 776, 779, 0, 818, 817, 816, 596, 599, 606, 608, 602, 815, 610, 611, 600, 603, 604, 595, 616, 605, 612, 814, 643, 614, 652, 615, 655, 657, 813, 658, 659, 660, 812, 775, 977, 977, 773, 774, 977, 758, 758, 0, 0, 762, 0, 0, 0, 0, 0, 0, 760, 758, 746, 661, 663, 782, 722, 721, 705, 701, 662, 665, 667, 666, 699, 668, 698, 696, 695, 692, 690, 689, 669, 672, 671, 674, 977, 977, 652, 651, 0, 637, 0, 646, 644, 673, 677, 670, 675, 512, 682, 676, 510, 679, 419, 683, 977, 0, 0, 0, 0, 410, 408, 393, 685, 293, 237, 171, 116, 977, 732, 741, 750, 758, 762, 771, 780, 786, 792, 799, 803, 805, 808 } ; static const short int yy_def[550] = { 0, 536, 1, 537, 537, 538, 538, 539, 539, 1, 9, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 540, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 541, 541, 536, 536, 536, 536, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 542, 543, 544, 536, 536, 536, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 546, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 547, 536, 536, 536, 536, 536, 541, 536, 540, 536, 536, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 542, 536, 543, 536, 544, 536, 536, 536, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 548, 536, 536, 536, 536, 536, 536, 536, 536, 536, 547, 536, 536, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 536, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 549, 536, 536, 536, 536, 536, 536, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 536, 536, 536, 536, 536, 536, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 541, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 536, 536, 536, 541, 541, 541, 541, 541, 541, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 536, 541, 541, 541, 541, 545, 545, 545, 545, 545, 545, 545, 545, 0, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536 } ; static const short int yy_nxt[1046] = { 0, 12, 13, 14, 15, 13, 16, 17, 18, 12, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 31, 32, 33, 34, 35, 36, 37, 12, 38, 38, 38, 38, 39, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 38, 51, 38, 52, 38, 38, 38, 38, 53, 54, 55, 56, 57, 58, 38, 38, 38, 59, 60, 61, 62, 63, 66, 71, 63, 112, 67, 69, 66, 221, 69, 222, 67, 73, 71, 72, 73, 75, 76, 64, 75, 113, 77, 117, 75, 76, 72, 75, 63, 77, 103, 63, 181, 103, 118, 119, 122, 68, 123, 123, 123, 78, 124, 68, 120, 121, 64, 147, 78, 79, 132, 133, 135, 136, 125, 138, 148, 181, 80, 81, 139, 155, 152, 106, 82, 153, 106, 149, 156, 150, 167, 83, 83, 83, 83, 84, 83, 169, 151, 187, 169, 85, 86, 87, 88, 89, 90, 91, 83, 92, 83, 93, 83, 94, 95, 96, 97, 98, 99, 100, 101, 102, 83, 83, 83, 107, 108, 170, 173, 168, 109, 173, 181, 181, 126, 144, 128, 128, 128, 125, 110, 126, 145, 127, 127, 128, 175, 129, 146, 175, 130, 130, 159, 160, 129, 181, 171, 130, 130, 181, 129, 171, 161, 181, 181, 162, 130, 129, 176, 119, 138, 176, 181, 130, 130, 139, 181, 181, 120, 182, 181, 130, 183, 186, 131, 181, 122, 172, 123, 123, 123, 171, 181, 181, 181, 171, 181, 181, 181, 204, 200, 194, 171, 195, 181, 171, 181, 171, 188, 171, 181, 207, 196, 192, 208, 189, 103, 201, 190, 103, 106, 191, 193, 106, 202, 261, 269, 197, 270, 258, 198, 181, 199, 209, 223, 210, 211, 203, 216, 205, 259, 224, 262, 214, 206, 212, 217, 228, 213, 219, 263, 218, 169, 181, 181, 169, 229, 229, 215, 123, 123, 123, 107, 108, 267, 264, 173, 109, 181, 173, 232, 233, 268, 233, 234, 234, 234, 110, 175, 176, 273, 175, 176, 232, 233, 235, 236, 181, 236, 233, 126, 181, 127, 127, 128, 181, 181, 230, 235, 236, 276, 275, 181, 129, 236, 181, 237, 237, 126, 181, 128, 128, 128, 238, 181, 238, 129, 181, 239, 239, 239, 129, 237, 274, 130, 130, 181, 277, 181, 181, 237, 181, 181, 279, 129, 278, 181, 181, 280, 181, 130, 181, 181, 181, 181, 181, 181, 181, 130, 181, 181, 181, 281, 282, 181, 181, 315, 181, 318, 283, 181, 181, 285, 284, 316, 336, 337, 319, 287, 181, 297, 181, 181, 286, 289, 291, 303, 293, 288, 294, 181, 290, 295, 298, 300, 301, 305, 296, 292, 306, 181, 304, 181, 361, 299, 308, 307, 311, 310, 312, 313, 323, 302, 309, 234, 234, 234, 326, 362, 326, 324, 324, 327, 327, 327, 129, 328, 329, 328, 329, 331, 331, 330, 330, 330, 239, 239, 239, 129, 328, 239, 239, 239, 181, 328, 360, 331, 181, 181, 363, 181, 181, 181, 181, 331, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 367, 181, 181, 181, 369, 181, 368, 181, 370, 372, 373, 364, 374, 181, 323, 365, 366, 181, 371, 376, 377, 181, 375, 407, 407, 383, 387, 378, 379, 382, 397, 392, 181, 381, 380, 385, 384, 386, 388, 394, 391, 389, 393, 390, 398, 395, 430, 433, 396, 327, 327, 327, 327, 327, 327, 330, 330, 330, 330, 330, 330, 181, 181, 181, 181, 431, 181, 181, 181, 181, 432, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 434, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 441, 181, 443, 181, 181, 181, 436, 181, 181, 181, 444, 442, 435, 437, 438, 439, 445, 440, 449, 451, 452, 453, 490, 446, 447, 450, 454, 448, 456, 455, 459, 457, 458, 480, 481, 482, 181, 483, 485, 484, 486, 488, 487, 491, 495, 181, 489, 492, 181, 493, 181, 181, 181, 181, 181, 181, 181, 497, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 181, 494, 181, 527, 526, 181, 181, 525, 181, 496, 524, 523, 181, 181, 501, 181, 499, 498, 181, 181, 515, 181, 181, 502, 181, 500, 516, 518, 181, 519, 514, 520, 528, 530, 512, 513, 521, 533, 517, 522, 529, 531, 534, 535, 181, 181, 532, 65, 65, 65, 65, 65, 65, 65, 65, 65, 70, 70, 70, 70, 70, 70, 70, 70, 70, 74, 74, 74, 74, 74, 74, 74, 74, 74, 114, 114, 114, 114, 114, 114, 114, 114, 137, 137, 137, 137, 177, 177, 177, 177, 177, 177, 177, 177, 177, 179, 179, 179, 179, 179, 179, 179, 179, 179, 181, 181, 181, 181, 181, 181, 185, 511, 185, 185, 185, 185, 227, 510, 227, 227, 509, 508, 227, 240, 240, 325, 325, 409, 409, 409, 507, 506, 505, 504, 503, 181, 181, 181, 181, 181, 181, 181, 479, 478, 477, 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, 466, 408, 323, 465, 464, 463, 462, 461, 460, 181, 181, 181, 181, 181, 181, 181, 181, 181, 429, 428, 427, 426, 425, 424, 423, 422, 421, 420, 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, 408, 406, 405, 404, 403, 402, 401, 400, 399, 181, 181, 181, 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 345, 344, 343, 342, 341, 340, 339, 338, 335, 334, 333, 332, 322, 322, 321, 320, 317, 314, 181, 181, 272, 180, 178, 271, 266, 265, 260, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 115, 242, 241, 231, 226, 225, 220, 181, 184, 180, 178, 174, 166, 165, 164, 163, 158, 157, 154, 143, 142, 141, 140, 134, 116, 115, 111, 105, 104, 536, 11, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536 } ; static const short int yy_chk[1046] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 5, 2, 20, 3, 4, 4, 108, 4, 108, 4, 6, 6, 5, 6, 7, 7, 2, 7, 20, 7, 25, 8, 8, 6, 8, 10, 8, 13, 10, 86, 13, 25, 27, 28, 3, 28, 28, 28, 7, 29, 4, 27, 27, 10, 47, 8, 9, 34, 34, 36, 36, 29, 39, 47, 535, 9, 9, 39, 51, 49, 18, 9, 49, 18, 48, 51, 48, 60, 9, 9, 9, 9, 9, 9, 63, 48, 86, 63, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 18, 18, 64, 69, 60, 18, 69, 534, 85, 31, 46, 31, 31, 31, 64, 18, 30, 46, 30, 30, 30, 73, 31, 46, 73, 31, 31, 54, 54, 30, 91, 68, 30, 30, 89, 31, 68, 54, 94, 96, 54, 31, 30, 75, 80, 84, 75, 84, 30, 31, 84, 87, 88, 80, 80, 92, 30, 81, 85, 30, 90, 81, 68, 81, 81, 81, 68, 93, 95, 100, 68, 98, 97, 533, 94, 91, 89, 68, 89, 99, 68, 101, 68, 87, 68, 102, 96, 89, 88, 96, 87, 103, 92, 87, 103, 106, 87, 88, 106, 92, 160, 165, 90, 165, 158, 90, 186, 90, 97, 109, 98, 98, 93, 100, 95, 158, 109, 160, 99, 95, 98, 101, 115, 98, 102, 161, 101, 169, 188, 532, 169, 115, 115, 99, 123, 123, 123, 106, 106, 164, 161, 173, 106, 189, 173, 123, 123, 164, 123, 126, 126, 126, 106, 175, 176, 186, 175, 176, 123, 123, 126, 126, 187, 126, 123, 127, 191, 127, 127, 127, 190, 192, 115, 126, 126, 189, 188, 193, 127, 126, 194, 127, 127, 128, 195, 128, 128, 128, 129, 196, 129, 127, 197, 129, 129, 129, 128, 127, 187, 128, 128, 198, 190, 199, 200, 127, 203, 202, 192, 128, 191, 204, 208, 192, 210, 128, 205, 207, 206, 212, 209, 213, 211, 128, 214, 215, 217, 193, 194, 530, 216, 221, 218, 223, 195, 219, 274, 197, 196, 221, 247, 247, 223, 199, 529, 208, 528, 275, 198, 202, 203, 212, 205, 200, 206, 521, 202, 207, 209, 210, 211, 213, 207, 204, 214, 273, 212, 276, 274, 209, 216, 215, 218, 217, 218, 219, 229, 211, 216, 234, 234, 234, 232, 275, 232, 229, 229, 232, 232, 232, 234, 234, 235, 234, 235, 240, 240, 235, 235, 235, 238, 238, 238, 234, 234, 239, 239, 239, 277, 234, 273, 240, 278, 279, 276, 280, 281, 282, 284, 240, 283, 287, 288, 285, 289, 293, 294, 291, 295, 296, 298, 299, 297, 300, 303, 302, 304, 306, 301, 305, 307, 310, 308, 312, 309, 279, 519, 313, 516, 281, 361, 280, 366, 282, 284, 285, 277, 287, 311, 324, 278, 278, 364, 283, 289, 291, 365, 288, 324, 324, 298, 302, 293, 294, 297, 312, 307, 367, 296, 295, 300, 299, 301, 303, 309, 306, 304, 308, 305, 313, 310, 361, 366, 311, 326, 326, 326, 327, 327, 327, 329, 329, 329, 330, 330, 330, 368, 369, 373, 372, 364, 378, 379, 380, 374, 365, 376, 381, 383, 382, 384, 385, 388, 387, 395, 386, 397, 367, 393, 389, 390, 444, 433, 394, 392, 434, 441, 398, 437, 442, 443, 446, 435, 378, 436, 380, 439, 440, 447, 369, 450, 452, 445, 381, 379, 368, 372, 373, 374, 382, 376, 386, 388, 389, 390, 444, 383, 384, 387, 392, 385, 394, 393, 398, 395, 397, 433, 434, 435, 449, 436, 439, 437, 440, 442, 441, 445, 450, 451, 443, 446, 453, 447, 454, 456, 457, 458, 480, 487, 481, 452, 488, 490, 489, 492, 499, 514, 501, 500, 512, 502, 515, 518, 513, 449, 520, 511, 510, 517, 522, 508, 531, 451, 506, 505, 498, 497, 457, 496, 454, 453, 495, 494, 488, 493, 491, 458, 486, 456, 489, 492, 485, 499, 487, 500, 512, 515, 480, 481, 501, 520, 490, 502, 514, 517, 522, 531, 484, 483, 518, 537, 537, 537, 537, 537, 537, 537, 537, 537, 538, 538, 538, 538, 538, 538, 538, 538, 538, 539, 539, 539, 539, 539, 539, 539, 539, 539, 540, 540, 540, 540, 540, 540, 540, 540, 541, 541, 541, 541, 542, 542, 542, 542, 542, 542, 542, 542, 542, 543, 543, 543, 543, 543, 543, 543, 543, 543, 544, 482, 544, 544, 544, 544, 545, 479, 545, 545, 545, 545, 546, 478, 546, 546, 477, 470, 546, 547, 547, 548, 548, 549, 549, 549, 467, 466, 464, 463, 460, 459, 455, 448, 438, 432, 431, 430, 428, 427, 425, 424, 423, 422, 421, 420, 418, 417, 415, 414, 413, 412, 409, 407, 406, 405, 404, 403, 402, 399, 396, 391, 377, 375, 371, 370, 363, 362, 360, 359, 358, 356, 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, 343, 342, 339, 338, 337, 336, 333, 325, 321, 320, 319, 318, 317, 316, 315, 314, 292, 290, 286, 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, 255, 253, 252, 251, 250, 249, 248, 246, 245, 244, 243, 228, 227, 225, 224, 222, 220, 201, 185, 182, 179, 177, 166, 163, 162, 159, 157, 156, 154, 153, 152, 151, 150, 149, 148, 147, 146, 145, 144, 143, 142, 139, 136, 132, 122, 114, 110, 107, 83, 82, 78, 77, 72, 58, 57, 56, 55, 53, 52, 50, 45, 44, 43, 41, 35, 24, 21, 19, 16, 15, 11, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536, 536 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 char *yytext; # line 1 "c++2latex.l" # line 6 "c++2latex.l" int hfillon = 0; #define KEY printf ("{\\%s %s}", keyword_font, yytext); hfillon = 1 #define CPP printf ("{\\%s \\%s}", cpp_font, yytext); hfillon = 1 #define SYM(x) printf ("$\\%s$", x); hfillon = 1 #define OUT(x) printf ("%s", x); hfillon = 1 #define SUB(x) substitute(x) #define IND indent(yytext); hfillon = 0 #include #ifdef ANSI_C #ifdef C_PLUSPLUS #error ANSI_C and C_PLUSPLUS are mutually exclusive #else int cplusplus_mode = 0; #endif #else /* CPLUSPLUS or default */ int cplusplus_mode = 1; #endif int complete_file = 0; int header = 0; int tabtotab = 8; int piped = 0; char * font_size = "11"; char * indentation = "0.5em"; char * comment_font = "it"; char * keyword_font = "bf"; char * header_font = "sl"; char * cpp_font = "tt"; char * string_font = "tt"; void substitute(const char *); void indent(const char *); void newpage(int); void usage(const char *); /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifdef YY_MALLOC_DECL YY_MALLOC_DECL #else #if __STDC__ #ifndef __cplusplus #include #endif #else /* Just try to get by without declaring the routines. This will fail * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) * or sizeof(void*) != sizeof(int). */ #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( yy_current_buffer->yy_is_interactive ) \ { \ int c = getc( yyin ); \ result = c == EOF ? 0 : 1; \ buf[0] = (char) c; \ } \ else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL int yylex YY_PROTO(( void )) #endif /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; # line 44 "c++2latex.l" if (cplusplus_mode) BEGIN (CPLUSPLUS); if ( yy_init ) { #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! yy_start ) yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( yy_current_buffer ) yy_init_buffer( yy_current_buffer, yyin ); else yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_load_buffer_state(); yy_init = 0; } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = yy_c_buf_p; /* Support of yytext. */ *yy_cp = yy_hold_char; /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = yy_start; if ( yy_bp[-1] == '\n' ) ++yy_current_state; yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 537 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 977 ); yy_find_action: yy_act = yy_accept[yy_current_state]; YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; goto yy_find_action; case 1: YY_USER_ACTION # line 49 "c++2latex.l" { CPP; BEGIN (INCLUDE); } YY_BREAK case 2: # line 51 "c++2latex.l" case 3: # line 52 "c++2latex.l" case 4: # line 53 "c++2latex.l" case 5: # line 54 "c++2latex.l" case 6: # line 55 "c++2latex.l" case 7: # line 56 "c++2latex.l" case 8: # line 57 "c++2latex.l" case 9: YY_USER_ACTION # line 57 "c++2latex.l" CPP; YY_BREAK case 10: *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_USER_ACTION # line 59 "c++2latex.l" { OUT ("$<${\\"); OUT (string_font); OUT ("{}"); SUB (yytext+1); OUT ("}$>$"); input(); BEGIN (INITIAL); } YY_BREAK case 11: *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_USER_ACTION # line 62 "c++2latex.l" { OUT ("\"{\\"); OUT (string_font); OUT ("{}"); SUB (yytext+1); OUT ("}\""); input(); BEGIN (INITIAL); } YY_BREAK case 12: YY_USER_ACTION # line 65 "c++2latex.l" ECHO; YY_BREAK case 13: YY_USER_ACTION # line 66 "c++2latex.l" OUT ("\\mbox{}\\\\\n"); YY_BREAK case 14: YY_USER_ACTION # line 67 "c++2latex.l" { yyless (0); BEGIN (INITIAL); } YY_BREAK case 15: # line 70 "c++2latex.l" case 16: # line 71 "c++2latex.l" case 17: # line 72 "c++2latex.l" case 18: # line 73 "c++2latex.l" case 19: # line 74 "c++2latex.l" case 20: # line 75 "c++2latex.l" case 21: # line 76 "c++2latex.l" case 22: # line 77 "c++2latex.l" case 23: # line 78 "c++2latex.l" case 24: # line 79 "c++2latex.l" case 25: # line 80 "c++2latex.l" case 26: # line 81 "c++2latex.l" case 27: # line 82 "c++2latex.l" case 28: # line 83 "c++2latex.l" case 29: # line 84 "c++2latex.l" case 30: # line 85 "c++2latex.l" case 31: # line 86 "c++2latex.l" case 32: # line 87 "c++2latex.l" case 33: # line 88 "c++2latex.l" case 34: # line 89 "c++2latex.l" case 35: # line 90 "c++2latex.l" case 36: # line 91 "c++2latex.l" case 37: # line 92 "c++2latex.l" case 38: # line 93 "c++2latex.l" case 39: # line 94 "c++2latex.l" case 40: # line 95 "c++2latex.l" case 41: # line 96 "c++2latex.l" case 42: # line 97 "c++2latex.l" case 43: # line 98 "c++2latex.l" case 44: # line 99 "c++2latex.l" case 45: # line 100 "c++2latex.l" case 46: # line 101 "c++2latex.l" case 47: # line 102 "c++2latex.l" case 48: # line 103 "c++2latex.l" case 49: # line 104 "c++2latex.l" case 50: # line 105 "c++2latex.l" case 51: # line 106 "c++2latex.l" case 52: # line 107 "c++2latex.l" case 53: # line 108 "c++2latex.l" case 54: # line 109 "c++2latex.l" case 55: # line 110 "c++2latex.l" case 56: # line 111 "c++2latex.l" case 57: # line 112 "c++2latex.l" case 58: YY_USER_ACTION # line 112 "c++2latex.l" KEY; YY_BREAK case 59: YY_USER_ACTION # line 113 "c++2latex.l" SYM ("rightarrow"); YY_BREAK case 60: YY_USER_ACTION # line 114 "c++2latex.l" SYM ("ll"); YY_BREAK case 61: YY_USER_ACTION # line 115 "c++2latex.l" SYM ("gg"); YY_BREAK case 62: YY_USER_ACTION # line 116 "c++2latex.l" SYM ("leq"); YY_BREAK case 63: YY_USER_ACTION # line 117 "c++2latex.l" SYM ("geq"); YY_BREAK case 64: YY_USER_ACTION # line 118 "c++2latex.l" SYM ("neq"); YY_BREAK case 65: YY_USER_ACTION # line 119 "c++2latex.l" SYM ("mid\\mid"); YY_BREAK case 66: YY_USER_ACTION # line 120 "c++2latex.l" SYM ("ldots"); YY_BREAK case 67: YY_USER_ACTION # line 121 "c++2latex.l" SYM ("ast="); YY_BREAK case 68: YY_USER_ACTION # line 122 "c++2latex.l" SYM ("ll="); YY_BREAK case 69: YY_USER_ACTION # line 123 "c++2latex.l" SYM ("gg="); YY_BREAK case 70: YY_USER_ACTION # line 124 "c++2latex.l" SYM ("vee="); YY_BREAK case 71: YY_USER_ACTION # line 125 "c++2latex.l" SYM ("mid="); YY_BREAK case 72: YY_USER_ACTION # line 126 "c++2latex.l" SYM ("sim"); YY_BREAK case 73: YY_USER_ACTION # line 127 "c++2latex.l" SYM ("ast"); YY_BREAK case 74: YY_USER_ACTION # line 128 "c++2latex.l" SYM ("wedge"); YY_BREAK case 75: YY_USER_ACTION # line 129 "c++2latex.l" SYM ("mid"); YY_BREAK case 76: YY_USER_ACTION # line 130 "c++2latex.l" SYM ("rightarrow\\ast"); YY_BREAK case 77: YY_USER_ACTION # line 131 "c++2latex.l" OUT ("$/$"); YY_BREAK case 78: YY_USER_ACTION # line 132 "c++2latex.l" OUT ("$<$"); YY_BREAK case 79: YY_USER_ACTION # line 133 "c++2latex.l" OUT ("$>$"); YY_BREAK case 80: YY_USER_ACTION # line 134 "c++2latex.l" OUT ("\\&\\&"); YY_BREAK case 81: YY_USER_ACTION # line 135 "c++2latex.l" OUT ("\\%="); YY_BREAK case 82: YY_USER_ACTION # line 136 "c++2latex.l" OUT ("\\&="); YY_BREAK case 83: YY_USER_ACTION # line 137 "c++2latex.l" OUT ("\\{"); YY_BREAK case 84: YY_USER_ACTION # line 138 "c++2latex.l" OUT ("\\}"); YY_BREAK case 85: YY_USER_ACTION # line 139 "c++2latex.l" OUT ("\\&"); YY_BREAK case 86: YY_USER_ACTION # line 140 "c++2latex.l" OUT ("\\%"); YY_BREAK case 87: YY_USER_ACTION # line 141 "c++2latex.l" OUT ("-{}-"); YY_BREAK case 88: YY_USER_ACTION # line 142 "c++2latex.l" OUT (".$\\ast$"); YY_BREAK case 89: # line 144 "c++2latex.l" case 90: # line 145 "c++2latex.l" case 91: # line 146 "c++2latex.l" case 92: # line 147 "c++2latex.l" case 93: # line 148 "c++2latex.l" case 94: # line 149 "c++2latex.l" case 95: # line 150 "c++2latex.l" case 96: # line 151 "c++2latex.l" case 97: # line 152 "c++2latex.l" case 98: # line 153 "c++2latex.l" case 99: # line 154 "c++2latex.l" case 100: # line 155 "c++2latex.l" case 101: # line 156 "c++2latex.l" case 102: # line 157 "c++2latex.l" case 103: # line 158 "c++2latex.l" case 104: # line 159 "c++2latex.l" case 105: # line 160 "c++2latex.l" case 106: # line 161 "c++2latex.l" case 107: YY_USER_ACTION # line 161 "c++2latex.l" ECHO; YY_BREAK case 108: # line 164 "c++2latex.l" case 109: YY_USER_ACTION # line 164 "c++2latex.l" SUB (yytext); YY_BREAK case 110: YY_USER_ACTION # line 166 "c++2latex.l" { BEGIN (BCOMMENT); OUT ("{$/\\ast$\\"); OUT (comment_font); OUT ("{}"); } YY_BREAK case 111: YY_USER_ACTION # line 169 "c++2latex.l" { BEGIN (BCOMMENT); if (hfillon==1) { OUT ("\\hfill"); } OUT ("{$/\\ast$\\"); OUT (comment_font); OUT ("{}"); } YY_BREAK case 112: YY_USER_ACTION # line 173 "c++2latex.l" { BEGIN (INITIAL); OUT ("$\\ast/$}"); } YY_BREAK case 113: YY_USER_ACTION # line 174 "c++2latex.l" OUT ("\\mbox{}\\\\\n"); YY_BREAK case 114: YY_USER_ACTION # line 175 "c++2latex.l" IND; YY_BREAK case 115: YY_USER_ACTION # line 176 "c++2latex.l" SUB (yytext); YY_BREAK case 116: YY_USER_ACTION # line 179 "c++2latex.l" { BEGIN (STRING); OUT ("{\\"); OUT (string_font); OUT ("\""); } YY_BREAK case 117: YY_USER_ACTION # line 181 "c++2latex.l" OUT ("$\\backslash\\backslash$"); YY_BREAK case 118: YY_USER_ACTION # line 182 "c++2latex.l" { OUT ("$\\backslash$"); SUB (yytext+1); } YY_BREAK case 119: YY_USER_ACTION # line 183 "c++2latex.l" { BEGIN (INITIAL); OUT ("\"}"); } YY_BREAK case 120: YY_USER_ACTION # line 184 "c++2latex.l" OUT ("\\mbox{}\\\\\n"); YY_BREAK case 121: YY_USER_ACTION # line 185 "c++2latex.l" IND; YY_BREAK case 122: YY_USER_ACTION # line 186 "c++2latex.l" SUB (yytext); YY_BREAK case 123: # line 189 "c++2latex.l" case 124: # line 190 "c++2latex.l" case 125: # line 191 "c++2latex.l" case 126: YY_USER_ACTION # line 191 "c++2latex.l" ECHO; YY_BREAK case 127: YY_USER_ACTION # line 193 "c++2latex.l" ECHO; YY_BREAK case 128: YY_USER_ACTION # line 195 "c++2latex.l" SUB (yytext); YY_BREAK case 129: # line 197 "c++2latex.l" case 130: # line 198 "c++2latex.l" case 131: YY_USER_ACTION # line 198 "c++2latex.l" ECHO; YY_BREAK case 132: YY_USER_ACTION # line 200 "c++2latex.l" ECHO; YY_BREAK case 133: YY_USER_ACTION # line 202 "c++2latex.l" ECHO; YY_BREAK case 134: YY_USER_ACTION # line 204 "c++2latex.l" OUT ("$\\backslash$\\\\\n"); YY_BREAK case 135: YY_USER_ACTION # line 205 "c++2latex.l" IND; YY_BREAK case 136: YY_USER_ACTION # line 206 "c++2latex.l" ECHO; YY_BREAK case 137: YY_USER_ACTION # line 207 "c++2latex.l" OUT ("\\newpage\n"); YY_BREAK case 138: YY_USER_ACTION # line 208 "c++2latex.l" OUT ("\\mbox{}\\\\\n"); YY_BREAK case 139: YY_USER_ACTION # line 210 "c++2latex.l" ECHO; YY_BREAK case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(STRING): case YY_STATE_EOF(BCOMMENT): case YY_STATE_EOF(INCLUDE): case YY_STATE_EOF(CPLUSPLUS): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = yy_cp - yytext_ptr - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = yy_hold_char; if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between yy_current_buffer and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ yy_n_chars = yy_current_buffer->yy_n_chars; yy_current_buffer->yy_input_file = yyin; yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) { /* This was really a NUL. */ yy_state_type yy_next_state; yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = yytext_ptr + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = yy_c_buf_p; goto yy_find_action; } } else switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { yy_did_buffer_switch_on_eof = 0; if ( yywrap() ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: yy_c_buf_p = &yy_current_buffer->yy_ch_buf[yy_n_chars]; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer() { register char *dest = yy_current_buffer->yy_ch_buf; register char *source = yytext_ptr - 1; /* copy prev. char, too */ register int number_to_move, i; int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( yy_current_buffer->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) { /* We matched a singled characater, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = yy_c_buf_p - yytext_ptr; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ yy_n_chars = 0; else { int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ #ifdef YY_USES_REJECT YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); #else /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = yy_current_buffer; int yy_c_buf_p_offset = yy_c_buf_p - b->yy_ch_buf; b->yy_buf_size *= 2; b->yy_ch_buf = (char *) yy_flex_realloc( (void *) b->yy_ch_buf, b->yy_buf_size ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; #endif } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), yy_n_chars, num_to_read ); } if ( yy_n_chars == 0 ) { if ( number_to_move - YY_MORE_ADJ == 1 ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart( yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; yy_current_buffer->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; yy_n_chars += number_to_move; yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; /* yytext begins at the second character in yy_ch_buf; the first * character is the one which preceded it before reading in the latest * buffer; it needs to be kept around in case it's a newline, so * yy_get_previous_state() will have with '^' rules active. */ yytext_ptr = &yy_current_buffer->yy_ch_buf[1]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state() { register yy_state_type yy_current_state; register char *yy_cp; register char *yy_bp = yytext_ptr; yy_current_state = yy_start; if ( yy_bp[-1] == '\n' ) ++yy_current_state; for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 537 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ #ifdef YY_USE_PROTOS static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) #else static yy_state_type yy_try_NUL_trans( yy_current_state ) yy_state_type yy_current_state; #endif { register int yy_is_jam; register char *yy_cp = yy_c_buf_p; register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 537 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 536); return yy_is_jam ? 0 : yy_current_state; } #ifdef YY_USE_PROTOS static void yyunput( int c, register char *yy_bp ) #else static void yyunput( c, yy_bp ) int c; register char *yy_bp; #endif { register char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ *yy_cp = yy_hold_char; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = yy_n_chars + 2; register char *dest = &yy_current_buffer->yy_ch_buf[ yy_current_buffer->yy_buf_size + 2]; register char *source = &yy_current_buffer->yy_ch_buf[number_to_move]; while ( source > yy_current_buffer->yy_ch_buf ) *--dest = *--source; yy_cp += dest - source; yy_bp += dest - source; yy_n_chars = yy_current_buffer->yy_buf_size; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } if ( yy_cp > yy_bp && yy_cp[-1] == '\n' ) yy_cp[-2] = '\n'; *--yy_cp = (char) c; /* Note: the formal parameter *must* be called "yy_bp" for this * macro to now work correctly. */ YY_DO_BEFORE_ACTION; /* set up yytext again */ } #ifdef __cplusplus static int yyinput() #else static int input() #endif { int c; *yy_c_buf_p = yy_hold_char; if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) /* This was really a NUL. */ *yy_c_buf_p = '\0'; else { /* need more input */ yytext_ptr = yy_c_buf_p; ++yy_c_buf_p; switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { if ( yywrap() ) { yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; return EOF; } YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; break; case EOB_ACT_LAST_MATCH: #ifdef __cplusplus YY_FATAL_ERROR( "unexpected last match in yyinput()" ); #else YY_FATAL_ERROR( "unexpected last match in input()" ); #endif } } } c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ *yy_c_buf_p = '\0'; /* preserve yytext */ yy_hold_char = *++yy_c_buf_p; return c; } #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) #else void yyrestart( input_file ) FILE *input_file; #endif { if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_init_buffer( yy_current_buffer, input_file ); yy_load_buffer_state(); } #ifdef YY_USE_PROTOS void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) #else void yy_switch_to_buffer( new_buffer ) YY_BUFFER_STATE new_buffer; #endif { if ( yy_current_buffer == new_buffer ) return; if ( yy_current_buffer ) { /* Flush out information for old buffer. */ *yy_c_buf_p = yy_hold_char; yy_current_buffer->yy_buf_pos = yy_c_buf_p; yy_current_buffer->yy_n_chars = yy_n_chars; } yy_current_buffer = new_buffer; yy_load_buffer_state(); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ yy_did_buffer_switch_on_eof = 1; } #ifdef YY_USE_PROTOS void yy_load_buffer_state( void ) #else void yy_load_buffer_state() #endif { yy_n_chars = yy_current_buffer->yy_n_chars; yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; yyin = yy_current_buffer->yy_input_file; yy_hold_char = *yy_c_buf_p; } #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) #else YY_BUFFER_STATE yy_create_buffer( file, size ) FILE *file; int size; #endif { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); yy_init_buffer( b, file ); return b; } #ifdef YY_USE_PROTOS void yy_delete_buffer( YY_BUFFER_STATE b ) #else void yy_delete_buffer( b ) YY_BUFFER_STATE b; #endif { if ( b == yy_current_buffer ) yy_current_buffer = (YY_BUFFER_STATE) 0; yy_flex_free( (void *) b->yy_ch_buf ); yy_flex_free( (void *) b ); } #ifdef YY_USE_PROTOS void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) #else void yy_init_buffer( b, file ) YY_BUFFER_STATE b; FILE *file; #endif { b->yy_input_file = file; /* We put in the '\n' and start reading from [1] so that an * initial match-at-newline will be true. */ b->yy_ch_buf[0] = '\n'; b->yy_n_chars = 1; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[1]; b->yy_is_interactive = file ? isatty( fileno(file) ) : 0; b->yy_fill_buffer = 1; b->yy_buffer_status = YY_BUFFER_NEW; } #ifdef YY_USE_PROTOS static void yy_push_state( int new_state ) #else static void yy_push_state( new_state ) int new_state; #endif { if ( yy_start_stack_ptr >= yy_start_stack_depth ) { int new_size; yy_start_stack_depth += YY_START_STACK_INCR; new_size = yy_start_stack_depth * sizeof( int ); if ( ! yy_start_stack ) yy_start_stack = (int *) yy_flex_alloc( new_size ); else yy_start_stack = (int *) yy_flex_realloc( (void *) yy_start_stack, new_size ); if ( ! yy_start_stack ) YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } yy_start_stack[yy_start_stack_ptr++] = YY_START; BEGIN(new_state); } static void yy_pop_state() { if ( --yy_start_stack_ptr < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); BEGIN(yy_start_stack[yy_start_stack_ptr]); } static int yy_top_state() { return yy_start_stack[yy_start_stack_ptr - 1]; } #ifdef YY_USE_PROTOS static void yy_fatal_error( const char msg[] ) #else static void yy_fatal_error( msg ) char msg[]; #endif { (void) fprintf( stderr, "%s\n", msg ); exit( 1 ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ yytext[yyleng] = yy_hold_char; \ yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ yy_hold_char = *yy_c_buf_p; \ *yy_c_buf_p = '\0'; \ yyleng = n; \ } \ while ( 0 ) /* Internal utility routines. */ #ifndef yytext_ptr #ifdef YY_USE_PROTOS static void yy_flex_strncpy( char *s1, const char *s2, int n ) #else static void yy_flex_strncpy( s1, s2, n ) char *s1; const char *s2; int n; #endif { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_USE_PROTOS static void *yy_flex_alloc( unsigned int size ) #else static void *yy_flex_alloc( size ) unsigned int size; #endif { return (void *) malloc( size ); } #ifdef YY_USE_PROTOS static void *yy_flex_realloc( void *ptr, unsigned int size ) #else static void *yy_flex_realloc( ptr, size ) void *ptr; unsigned int size; #endif { return (void *) realloc( ptr, size ); } #ifdef YY_USE_PROTOS static void yy_flex_free( void *ptr ) #else static void yy_flex_free( ptr ) void *ptr; #endif { free( ptr ); } # line 210 "c++2latex.l" void substitute (const char * input) { while (*input) { switch (*input) { case '_': case '&': case '#': case '$': case '%': case '{': case '}': printf ("\\%c", *input); break; case '+': case '=': case '<': case '>': printf ("$%c$", *input); break; case '*': printf ("$\\ast$"); break; case '|': printf ("$\\mid$"); break; case '\\': printf ("$\\backslash$"); break; case '^': printf ("$\\wedge$"); break; case '~': printf ("$\\sim$"); break; default: printf ("%c", *input); break; } input++; } } void indent(const char * blanks) { int i; i = 0; while (*blanks) { if (*blanks == ' ') { i++; } else /* *blanks == '\t' */ { while (++i % tabtotab) ; } blanks++; } printf ("\\hspace*{%d\\indentation}", i); } #include "getopt.h" #include #include #include extern char * version_string; static struct option opts[] = { {"ansi-c", 0, 0, 'a'}, {"c-plusplus", 0, 0, 'p'}, {"complete-file", 0, 0, 'c'}, {"font-size", 1, 0, 's'}, {"indentation", 1, 0, 'i'}, {"header", 0, 0, 'h'}, {"piped", 0, 0, 't'}, {"output", 1, 0, 'o'}, {"tabstop", 1, 0, 'T'}, {"comment-font", 1, 0, 'C'}, {"string-font", 1, 0, 'S'}, {"keyword-font", 1, 0, 'K'}, {"header-font", 1, 0, 'H'}, {"cpp-font", 1, 0, 'P'}, {"version", 0, 0, 'V'}, {0, 0, 0, 0} }; main (int argc, char** argv) { int c; int index; int i; int has_filename; char * input_name; char * output_name; char * program_name; input_name = "Standard Input"; output_name = 0; program_name = strrchr (argv[0], '/'); if (program_name == NULL) /* no pathname */ { program_name = argv[0]; } else { program_name++; } #ifdef USE_NAME #if defined(ANSI_C) || defined(C_PLUSPLUS) #error USE_NAME, ANSI_C and C_PLUSPLUS are mutually exclusive #else /* simple heuristic: '+' in name means C++ */ cplusplus_mode = (strchr (program_name, '+') != 0); #endif #endif while ((c = getopt_long (argc, argv, "acpo:s:i:thT:C:H:S:K:P:V", opts, &index)) != EOF) { if (c == 0) /* Long option */ { c = opts[index].val; } switch (c) { case 'a': cplusplus_mode = 0; break; case 'p': cplusplus_mode = 1; break; case 'c': complete_file = 1; break; case 'o': if (piped) { fprintf (stderr, "%s: Can't use {-t,+pipe} and {-o,+output} together\n", program_name); exit(5); } output_name = optarg; break; case 's': font_size = optarg; break; case 'i': indentation = optarg; break; case 'T': tabtotab = atoi(optarg); break; case 't': if (output_name != 0) { fprintf (stderr, "%s: Can't use {-t,+pipe} and {-o,+output} together\n", program_name); exit(5); } piped = 1; break; case 'h': header = 1; complete_file = 1; /* header implies complete-file */ break; case 'C': comment_font = optarg; break; case 'H': header_font = optarg; break; case 'P': cpp_font = optarg; break; case 'S': string_font = optarg; break; case 'K': keyword_font = optarg; break; case 'V': fprintf (stderr, "%s\n", version_string); break; default: usage(program_name); } } has_filename = (argc - optind == 1); if (has_filename) /* last argument is input file name */ { input_name = argv[optind]; if (freopen (input_name, "r", stdin) == NULL) { fprintf (stderr, "%s: Can't open `%s' for reading\n", program_name, input_name); exit (2); } } if ((output_name == 0) && !piped) { char * tmp; if (has_filename) { char * point; point = strrchr (input_name, '/'); if (point == 0) /* plain filename */ { point = input_name; } else { point++; } tmp = malloc (strlen (point) + 1); if (tmp == 0) { fprintf (stderr, "%s: Virtual memory exhausted\n", program_name); exit (3); } strcpy (tmp, point); point = strrchr (tmp, '.'); if (point != 0) { *point = '\0'; } } else { tmp = program_name; } output_name = malloc (strlen (tmp) + 4); if (output_name == 0) { fprintf (stderr, "%s: Virtual memory exhausted\n", program_name); exit (3); } strcpy (output_name, tmp); strcat (output_name, ".tex"); } if (!piped) { if (freopen (output_name, "w", stdout) == NULL) { fprintf (stderr, "%s: Can't open `%s' for writing\n", program_name, output_name); exit (4); } } printf ("\ %%\n\ %% This file was automatically produced at " __DATE__ ", " __TIME__" by\n\ %% %s", program_name); for (i = 1; i < argc; i++) { printf(" %s", argv[i]); } if (!has_filename) { printf(" (from Standard Input)"); } printf("\n%%\n"); if (complete_file) { if (header) { if (strcmp (font_size, "10") == 0) { printf ("\\documentstyle[fancyheadings]{article}\n"); } else { printf ("\\documentstyle[%spt,fancyheadings]{article}\n", font_size); } } else { if (strcmp (font_size, "10") == 0) { printf ("\\documentstyle{article}\n"); } else { printf ("\\documentstyle[%spt]{article}\n", font_size); } } printf ("\\setlength{\\textwidth}{15cm}\n"); printf ("\\setlength{\\textheight}{22.5cm}\n"); printf ("\\setlength{\\hoffset}{-2cm}\n"); printf ("\\setlength{\\voffset}{-2cm}\n"); if (header) { printf ("\\chead{\\%s Produced from ", header_font); substitute(input_name); printf (" at " __DATE__ ", " __TIME__"}\n"); printf ("\\cfoot{\\rm\\thepage}\n"); printf ("\\addtolength{\\headheight}{14pt}\n"); printf ("\\pagestyle{fancy}\n"); } printf ("\\begin{document}\n"); } printf ("\\expandafter\\ifx\\csname indentation\\endcsname\\relax%\n"); printf ("\\newlength{\\indentation}\\fi\n"); printf ("\\setlength{\\indentation}{%s}\n", indentation); printf ("\\begin{flushleft}\n"); yylex(); printf ("\\end{flushleft}\n"); if (complete_file) { printf ("\\end{document}\n"); } } void usage(const char * name) { fprintf (stderr, "%s\n", version_string); fprintf (stderr, "\ Usage: %s [-a] [-c] [-h] [-i length] [-o path] [-p] [-s size] [-t]\n\ [-C font][-H font] [-K font] [-P font] [-S font] [-T wide] [-V]\n\ [+ansi-c] [+complete-file] [+header] [+indentation length]\n\ [+output path] [+c-plusplus] [+font-size size] [+pipe]\n\ [+comment-font font] [+keyword-font font] [+cpp-font font]\n\ [+header-font font] [+string-font font] [+tabstop wide]\n\ [+version] [path]\n", name); exit (1); } yywrap(){}