Category : C Source Code
Archive   : CPAREN.ZIP
Filename : LEX.C
/* A lexical scanner generated by flex */
/* scanner skeleton version:
* $Header: flex.skel,v 2.0 89/06/20 15:49:46 vern Locked $
*/
#include
#define FLEX_SCANNER
/* amount of stuff to slurp up with each read */
#ifndef YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#endif
#ifndef YY_BUF_SIZE
#define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of input buffer */
#endif
/* returned upon end-of-file */
#define YY_END_TOK 0
/* copy whatever the last rule matched to the standard output */
#define ECHO fputs( yytext, yyout )
/* gets input and stuffs it into "buf". number of characters read, or YY_NULL,
* is returned in "result".
*/
#define YY_INPUT(buf,result,max_size) \
if ( (result = read( fileno(yyin), buf, max_size )) < 0 ) \
YY_FATAL_ERROR( "read() in flex scanner failed" );
#define YY_NULL 0
#define yyterminate() return ( YY_NULL )
/* report a fatal error */
#define YY_FATAL_ERROR(msg) \
{ \
fputs( msg, stderr ); \
putc( '\n', stderr ); \
exit( 1 ); \
}
/* default yywrap function - always treat EOF as an EOF */
#define yywrap() 1
/* 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 *
/* 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" */
#define YY_NEW_FILE goto new_file
/* default declaration of generated scanner - a define so the user can
* easily add parameters
*/
#ifdef __STDC__
#define YY_DECL int yylex( void )
#else
#define YY_DECL int yylex()
#endif
/* code executed at the end of each rule */
#define YY_BREAK break;
#define YY_END_OF_BUFFER_CHAR 0
/* done after the current pattern has been matched and before the
* corresponding action - sets up yytext
*/
#define YY_DO_BEFORE_ACTION \
yytext = yy_bp; \
yy_hold_char = *yy_cp; \
*yy_cp = '\0'; \
yy_c_buf_p = yy_cp;
/* returns the length of the matched text */
#define yyleng (yy_cp - yy_bp)
#define EOB_ACT_RESTART_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
/* return all but the first 'n' matched characters back to the input stream */
#define yyless(n) \
{ \
*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \
yy_c_buf_p = yy_cp = yy_bp + n; \
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
}
#define unput(c) yyunput( c, yy_bp )
#define YY_USER_ACTION
FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
char *yytext;
#ifndef __STDC__
#define const
#endif
# line 1 "lex.l"
#define INITIAL 0
# line 2 "lex.l"
/*
* Copyright (c) 1984 by
* Tektronix, Incorporated Beaverton, Oregon 97077
* All rights reserved.
*
* Permission is hereby granted for personal, non-commercial
* reproduction and use of this program, provided that this
* notice is included in any copy.
*/
# include "stdio.h"
# ifdef MSDOS
# include "y_tab.h"
# else
# include "y.tab.h"
# endif
# include "cparen.h"
static char *rcsid = "$Header: lex.l,v 1.12 84/07/17 09:45:18 bradn Stable $";
#define MAXTYPES 100
char *typnam[MAXTYPES] = { /* 'type' identifiers */
"char",
"double",
"float",
"int",
"long",
"short",
"unsigned",
"void",
0 /* command-line types go here */
};
char **typend; /* first free spot in typnam[] */
struct spec { /* special keywords */
char *s_name; /* keyword text */
int s_tok; /* token to return */
int s_val; /* value to return */
};
struct spec specnam[] = {
{"sizeof", SIZEOF, SIZEOF},
{"struct", STRUCT, ISSTRUCT},
{"union", STRUCT, ISUNION},
{"enum", ENUM, ENUM},
{"goto", KEYWORD, KEYWORD},
{"return", KEYWORD, KEYWORD},
{"if", KEYWORD, KEYWORD},
{"else", KEYWORD, KEYWORD},
{"while", KEYWORD, KEYWORD},
{"do", KEYWORD, KEYWORD},
{"for", KEYWORD, KEYWORD},
{"switch", KEYWORD, KEYWORD},
{"case", KEYWORD, KEYWORD},
{0,0,0}
};
int tok; /* a temp */
# line 55 "lex.l"
#define YY_END_OF_BUFFER 58
typedef int yy_state_type;
static const short int yy_accept[96] =
{ 0,
0, 0, 58, 56, 54, 54, 35, 56, 53, 7,
15, 56, 37, 38, 12, 8, 5, 9, 42, 6,
47, 47, 22, 43, 1, 20, 3, 21, 39, 40,
17, 44, 16, 45, 36, 54, 14, 0, 52, 0,
53, 18, 0, 0, 33, 34, 41, 49, 0, 50,
47, 48, 47, 0, 10, 2, 24, 30, 29, 25,
26, 23, 0, 13, 0, 32, 31, 4, 11, 19,
52, 51, 51, 49, 0, 0, 50, 50, 0, 48,
46, 27, 28, 0, 49, 0, 55, 0, 50, 48,
46, 49, 55, 50, 0
} ;
static const char yy_ec[128] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 4, 5, 1, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 19,
19, 19, 19, 19, 19, 19, 19, 20, 21, 22,
23, 24, 25, 1, 26, 26, 26, 26, 27, 26,
26, 26, 26, 26, 26, 28, 26, 26, 26, 26,
26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
29, 30, 31, 32, 6, 1, 26, 26, 26, 26,
27, 26, 26, 26, 26, 26, 26, 28, 26, 26,
26, 26, 26, 26, 26, 26, 26, 26, 26, 33,
26, 26, 34, 35, 36, 37, 1
} ;
static const char yy_meta[38] =
{ 0,
1, 1, 2, 1, 1, 3, 1, 1, 4, 1,
1, 1, 1, 1, 1, 1, 1, 5, 5, 1,
1, 1, 1, 1, 1, 5, 5, 5, 1, 1,
1, 1, 5, 1, 1, 1, 1
} ;
static const short int yy_base[101] =
{ 0,
0, 0, 166, 167, 36, 38, 136, 37, 0, 167,
149, 124, 167, 167, 167, 136, 167, 28, 26, 116,
52, 30, 167, 167, 28, 79, 30, 167, 167, 167,
167, 167, 91, 167, 167, 53, 167, 42, 167, 58,
0, 167, 51, 74, 167, 167, 167, 46, 112, 57,
79, 97, 167, 0, 167, 167, 167, 167, 167, 167,
167, 167, 71, 167, 65, 167, 167, 167, 167, 167,
69, 167, 60, 104, 70, 88, 102, 112, 90, 114,
50, 167, 167, 116, 118, 101, 167, 120, 122, 124,
38, 126, 50, 128, 167, 147, 150, 155, 160, 54
} ;
static const short int yy_def[101] =
{ 0,
95, 1, 95, 95, 95, 95, 95, 96, 97, 95,
95, 98, 95, 95, 95, 95, 95, 95, 95, 95,
95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
95, 95, 95, 95, 95, 95, 95, 96, 95, 96,
97, 95, 98, 98, 95, 95, 95, 95, 99, 95,
95, 95, 95, 100, 95, 95, 95, 95, 95, 95,
95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
96, 95, 98, 95, 99, 99, 95, 95, 95, 95,
100, 95, 95, 95, 95, 99, 95, 95, 95, 95,
100, 95, 99, 95, 0, 95, 95, 95, 95, 95
} ;
static const short int yy_nxt[205] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 9, 9, 9, 29, 4,
30, 31, 9, 32, 33, 34, 35, 36, 36, 36,
36, 39, 46, 48, 48, 50, 39, 51, 51, 55,
56, 47, 68, 69, 36, 36, 52, 53, 81, 72,
38, 76, 71, 48, 48, 91, 40, 50, 72, 51,
51, 40, 74, 39, 77, 77, 43, 91, 52, 53,
44, 76, 73, 78, 54, 57, 58, 40, 83, 44,
59, 60, 82, 61, 50, 62, 51, 51, 40, 86,
63, 64, 65, 44, 87, 52, 53, 90, 90, 79,
66, 79, 76, 67, 80, 80, 84, 93, 84, 77,
77, 85, 85, 76, 88, 70, 88, 49, 78, 89,
89, 80, 80, 92, 92, 85, 85, 94, 94, 89,
89, 80, 80, 85, 85, 89, 89, 38, 45, 38,
38, 38, 41, 44, 41, 43, 42, 43, 37, 43,
75, 75, 75, 75, 75, 95, 3, 95, 95, 95,
95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
95, 95, 95, 95
} ;
static const short int yy_chk[205] =
{ 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, 5, 5, 6,
6, 8, 18, 19, 19, 22, 38, 22, 22, 25,
25, 18, 27, 27, 36, 36, 22, 22, 100, 43,
40, 93, 40, 48, 48, 91, 8, 21, 73, 21,
21, 38, 48, 71, 50, 50, 44, 81, 21, 21,
43, 75, 44, 50, 21, 26, 26, 40, 65, 73,
26, 26, 63, 26, 51, 26, 51, 51, 71, 76,
26, 26, 26, 44, 76, 51, 51, 79, 79, 52,
26, 52, 86, 26, 52, 52, 74, 86, 74, 77,
77, 74, 74, 49, 78, 33, 78, 20, 77, 78,
78, 80, 80, 84, 84, 85, 85, 88, 88, 89,
89, 90, 90, 92, 92, 94, 94, 96, 16, 96,
96, 96, 97, 12, 97, 98, 11, 98, 7, 98,
99, 99, 99, 99, 99, 3, 95, 95, 95, 95,
95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
95, 95, 95, 95
} ;
/* 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
/* these variables are all declared out here so that section 3 code can
* manipulate them
*/
static char *yy_c_buf_p; /* points to current character in buffer */
static int yy_init = 1; /* whether we need to initialize */
static int yy_start = 0; /* start state number */
/* true when we've seen an EOF for the current input file */
static int yy_eof_has_been_seen;
static int yy_n_chars; /* number of characters read into yy_ch_buf */
/* yy_ch_buf has to be 2 characters longer than YY_BUF_SIZE because we need
* to put in 2 end-of-buffer characters (this is explained where it is
* done) at the end of yy_ch_buf
*/
static char yy_ch_buf[YY_BUF_SIZE + 2];
/* yy_hold_char holds the character lost when yytext is formed */
static char yy_hold_char;
static yy_state_type yy_last_accepting_state;
static char *yy_last_accepting_cpos;
#ifdef __STDC__
static yy_state_type yy_get_previous_state( void );
static int yy_get_next_buffer( void );
static void yyunput( int c, char *buf_ptr );
static int input( void );
static void yyrestart( FILE *input_file );
#else
static yy_state_type yy_get_previous_state();
static int yy_get_next_buffer();
static void yyunput();
static int input();
static void yyrestart();
#endif
YY_DECL
{
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
if ( yy_init )
{
if ( ! yy_start )
yy_start = 1; /* first start state */
if ( ! yyin )
yyin = stdin;
if ( ! yyout )
yyout = stdout;
new_file:
/* this is where we enter upon encountering an end-of-file and
* yywrap() indicating that we should continue processing
*/
/* we put in the '\n' and start reading from [1] so that an
* initial match-at-newline will be true.
*/
yy_ch_buf[0] = '\n';
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.
*/
yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
yy_eof_has_been_seen = 0;
yytext = yy_c_buf_p = &yy_ch_buf[1];
yy_hold_char = *yy_c_buf_p;
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;
do
{
register char yy_c = yy_ec[*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 = yy_def[yy_current_state];
if ( yy_current_state >= 96 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
++yy_cp;
}
while ( yy_current_state != 95 );
yy_cp = yy_last_accepting_cpos;
yy_current_state = yy_last_accepting_state;
/* bogus while loop to let YY_BACK_TRACK, EOB_ACT_LAST_MATCH,
* and EOF actions branch here without introducing an optimizer-
* daunting goto
*/
while ( 1 )
{
yy_act = yy_accept[yy_current_state];
YY_DO_BEFORE_ACTION;
YY_USER_ACTION;
#ifdef FLEX_DEBUG
fprintf( stderr, "--accepting rule #%d (\"%s\")\n",
yy_act, yytext );
#endif
do_action: /* this label is used only to access EOF actions */
switch ( yy_act )
{
case 0: /* must backtrack */
/* 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;
continue; /* go to "YY_DO_BEFORE_ACTION" */
case 1:
# line 57 "lex.l"
{yylval.lexval = nxttok(LT); return(RELOP);}
YY_BREAK
case 2:
# line 58 "lex.l"
{yylval.lexval = nxttok(LE); return(RELOP);}
YY_BREAK
case 3:
# line 59 "lex.l"
{yylval.lexval = nxttok(GT); return(RELOP);}
YY_BREAK
case 4:
# line 60 "lex.l"
{yylval.lexval = nxttok(GE); return(RELOP);}
YY_BREAK
case 5:
# line 61 "lex.l"
{yylval.lexval = nxttok(CM); return(CM);}
YY_BREAK
case 6:
# line 62 "lex.l"
{yylval.lexval = nxttok(DIV); return(DIVOP);}
YY_BREAK
case 7:
# line 63 "lex.l"
{yylval.lexval = nxttok(MOD); return(DIVOP);}
YY_BREAK
case 8:
# line 64 "lex.l"
{yylval.lexval = nxttok(PLUS); return(PLUS);}
YY_BREAK
case 9:
# line 65 "lex.l"
{yylval.lexval = nxttok(MINUS); return(MINUS);}
YY_BREAK
case 10:
# line 66 "lex.l"
{yylval.lexval = nxttok(LS); return(SHIFTOP);}
YY_BREAK
case 11:
# line 67 "lex.l"
{yylval.lexval = nxttok(RS); return(SHIFTOP);}
YY_BREAK
case 12:
# line 68 "lex.l"
{yylval.lexval = nxttok(MUL); return(MUL);}
YY_BREAK
case 13:
# line 69 "lex.l"
{yylval.lexval = nxttok(EQ); return(EQUOP);}
YY_BREAK
case 14:
# line 70 "lex.l"
{yylval.lexval = nxttok(NE); return(EQUOP);}
YY_BREAK
case 15:
# line 71 "lex.l"
{yylval.lexval = nxttok(AND); return(AND);}
YY_BREAK
case 16:
# line 72 "lex.l"
{yylval.lexval = nxttok(OR); return(OR);}
YY_BREAK
case 17:
# line 73 "lex.l"
{yylval.lexval = nxttok(ER); return(ER);}
YY_BREAK
case 18:
# line 74 "lex.l"
{yylval.lexval = nxttok(ANDAND); return(ANDAND);}
YY_BREAK
case 19:
# line 75 "lex.l"
{yylval.lexval = nxttok(OROR); return(OROR);}
YY_BREAK
case 20:
# line 76 "lex.l"
{yylval.lexval = nxttok(ASSIGN); return(ASSIGN);}
YY_BREAK
case 21:
# line 77 "lex.l"
{yylval.lexval = nxttok(QUEST); return(QUEST);}
YY_BREAK
case 22:
# line 78 "lex.l"
{yylval.lexval = nxttok(COLON); return(COLON);}
YY_BREAK
case 23:
# line 79 "lex.l"
{yylval.lexval = nxttok(DIV); return(ASOP);}
YY_BREAK
case 24:
# line 80 "lex.l"
{yylval.lexval = nxttok(MOD); return(ASOP);}
YY_BREAK
case 25:
# line 81 "lex.l"
{yylval.lexval = nxttok(PLUS); return(ASOP);}
YY_BREAK
case 26:
# line 82 "lex.l"
{yylval.lexval = nxttok(MINUS); return(ASOP);}
YY_BREAK
case 27:
# line 83 "lex.l"
{yylval.lexval = nxttok(LS); return(ASOP);}
YY_BREAK
case 28:
# line 84 "lex.l"
{yylval.lexval = nxttok(RS); return(ASOP);}
YY_BREAK
case 29:
# line 85 "lex.l"
{yylval.lexval = nxttok(MUL); return(ASOP);}
YY_BREAK
case 30:
# line 86 "lex.l"
{yylval.lexval = nxttok(AND); return(ASOP);}
YY_BREAK
case 31:
# line 87 "lex.l"
{yylval.lexval = nxttok(OR); return(ASOP);}
YY_BREAK
case 32:
# line 88 "lex.l"
{yylval.lexval = nxttok(ER); return(ASOP);}
YY_BREAK
case 33:
# line 89 "lex.l"
{yylval.lexval = nxttok(INCR); return(INCOP);}
YY_BREAK
case 34:
# line 90 "lex.l"
{yylval.lexval = nxttok(DECR); return(INCOP);}
YY_BREAK
case 35:
# line 91 "lex.l"
{yylval.lexval = nxttok(NOT); return(UNOP);}
YY_BREAK
case 36:
# line 92 "lex.l"
{yylval.lexval = nxttok(COMPL); return(UNOP);}
YY_BREAK
case 37:
# line 93 "lex.l"
{yylval.lexval = nxttok(LP); return(LP);}
YY_BREAK
case 38:
# line 94 "lex.l"
{yylval.lexval = nxttok(RP); return(RP);}
YY_BREAK
case 39:
# line 95 "lex.l"
{yylval.lexval = nxttok(LB); return(LB);}
YY_BREAK
case 40:
# line 96 "lex.l"
{yylval.lexval = nxttok(RB); return(RB);}
YY_BREAK
case 41:
# line 97 "lex.l"
{yylval.lexval = nxttok(STREF); return(STROP);}
YY_BREAK
case 42:
# line 98 "lex.l"
{yylval.lexval = nxttok(DOT); return(STROP);}
YY_BREAK
case 43:
# line 99 "lex.l"
{yylval.lexval = nxttok(SM); return(SM);}
YY_BREAK
case 44:
# line 100 "lex.l"
{/* ignore curly-braces */ (void) nxttok(LC);}
YY_BREAK
case 45:
# line 101 "lex.l"
{/* ignore curly-braces */ (void) nxttok(RC);}
YY_BREAK
case 46:
# line 102 "lex.l"
{/* hex constant */
yylval.lexval = nxttok(NAME); return(NAME);
}
YY_BREAK
case 47:
# line 105 "lex.l"
{/* decimal or octal constant */
yylval.lexval = nxttok(NAME); return(NAME);
}
YY_BREAK
case 48:
# line 109 "lex.l"
case 49:
# line 110 "lex.l"
case 50:
# line 110 "lex.l"
{/* floating constant */
yylval.lexval = nxttok(NAME); return(NAME);
}
YY_BREAK
case 51:
# line 113 "lex.l"
{/* char constant */
yylval.lexval = nxttok(NAME); return(NAME);
}
YY_BREAK
case 52:
# line 116 "lex.l"
{/* string constant */
yylval.lexval = nxttok(NAME); return(NAME);
}
YY_BREAK
case 53:
# line 119 "lex.l"
{/* identifier, type, or keyword */
yylval.lexval = nxttok(NAME);
/* take care of magic keywords */
if ((tok =
specof(yytext, &yylval.lexval->l_val))) {
return(tok);
}
/* take care of types and identifiers */
if (istype(yytext)) {
return(TYPE);
} else {
return(NAME);
}
}
YY_BREAK
case 54:
# line 137 "lex.l"
{/* whitespace */ (void) nxttok(FLUFF);}
YY_BREAK
case 55:
# line 138 "lex.l"
{/* comment */ (void) nxttok(FLUFF);}
YY_BREAK
case 56:
# line 139 "lex.l"
{fprintf(stderr, "%s: unknown character `%c'\n", cmd, yytext[0]);}
YY_BREAK
case 57:
# line 141 "lex.l"
ECHO;
YY_BREAK
case YY_STATE_EOF(INITIAL):
yyterminate();
case YY_END_OF_BUFFER:
/* undo the effects of YY_DO_BEFORE_ACTION */
*yy_cp = yy_hold_char;
yytext = yy_bp;
switch ( yy_get_next_buffer() )
{
case EOB_ACT_END_OF_FILE:
{
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;
yy_act = YY_STATE_EOF((yy_start - 1) / 2);
goto do_action;
}
else
YY_NEW_FILE;
}
break;
case EOB_ACT_RESTART_SCAN:
yy_c_buf_p = yytext;
yy_hold_char = *yy_c_buf_p;
break;
case EOB_ACT_LAST_MATCH:
yy_c_buf_p = &yy_ch_buf[yy_n_chars];
yy_current_state = yy_get_previous_state();
yy_cp = yy_c_buf_p;
yy_bp = yytext;
continue; /* go to "YY_DO_BEFORE_ACTION" */
}
break;
default:
printf( "action # %d\n", yy_act );
YY_FATAL_ERROR( "fatal flex scanner internal error" );
}
break; /* exit bogus while loop */
}
}
}
/* yy_get_next_buffer - try to read in new buffer
*
* synopsis
* int yy_get_next_buffer();
*
* returns a code representing an action
* EOB_ACT_LAST_MATCH -
* EOB_ACT_RESTART_SCAN - restart the scanner
* EOB_ACT_END_OF_FILE - end of file
*/
static int yy_get_next_buffer()
{
register char *dest = yy_ch_buf;
register char *source = yytext - 1; /* copy prev. char, too */
register int number_to_move, i;
int ret_val;
if ( yy_c_buf_p != &yy_ch_buf[yy_n_chars + 1] )
{
YY_FATAL_ERROR( "NULL in input" );
/*NOTREACHED*/
}
/* try to read more data */
/* first move last chars to start of buffer */
number_to_move = yy_c_buf_p - yytext;
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
if ( yy_eof_has_been_seen )
/* 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_BUF_SIZE - number_to_move - 1;
if ( num_to_read > YY_READ_BUF_SIZE )
num_to_read = YY_READ_BUF_SIZE;
/* read in more data */
YY_INPUT( (&yy_ch_buf[number_to_move]), yy_n_chars, num_to_read );
}
if ( yy_n_chars == 0 )
{
if ( number_to_move == 1 )
ret_val = EOB_ACT_END_OF_FILE;
else
ret_val = EOB_ACT_LAST_MATCH;
yy_eof_has_been_seen = 1;
}
else
ret_val = EOB_ACT_RESTART_SCAN;
yy_n_chars += number_to_move;
yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
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 = &yy_ch_buf[1];
return ( ret_val );
}
/* yy_get_previous_state - get the state just before the EOB char was reached
*
* synopsis
* yy_state_type yy_get_previous_state();
*/
static yy_state_type yy_get_previous_state()
{
register yy_state_type yy_current_state;
register char *yy_cp;
yy_current_state = yy_start;
for ( yy_cp = yytext; yy_cp < yy_c_buf_p; ++yy_cp )
{
register char yy_c = yy_ec[*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 = yy_def[yy_current_state];
if ( yy_current_state >= 96 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
}
return ( yy_current_state );
}
#ifdef __STDC__
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;
*yy_cp = yy_hold_char; /* undo effects of setting up yytext */
if ( yy_cp < yy_ch_buf + 2 )
{ /* need to shift things up to make room */
register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
register char *dest = &yy_ch_buf[YY_BUF_SIZE + 2];
register char *source = &yy_ch_buf[number_to_move];
while ( source > yy_ch_buf )
*--dest = *--source;
yy_cp += dest - source;
yy_bp += dest - source;
if ( yy_cp < 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 = c;
YY_DO_BEFORE_ACTION; /* set up yytext again */
}
static int input()
{
int c;
char *yy_cp = yy_c_buf_p;
*yy_cp = yy_hold_char;
if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
{ /* need more input */
yytext = yy_c_buf_p;
++yy_c_buf_p;
switch ( yy_get_next_buffer() )
{
/* this code, unfortunately, is somewhat redundant with
* that above
*/
case EOB_ACT_END_OF_FILE:
{
if ( yywrap() )
{
yy_c_buf_p = yytext;
return ( EOF );
}
yy_ch_buf[0] = '\n';
yy_n_chars = 1;
yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
yy_eof_has_been_seen = 0;
yytext = yy_c_buf_p = &yy_ch_buf[1];
yy_hold_char = *yy_c_buf_p;
return ( input() );
}
break;
case EOB_ACT_RESTART_SCAN:
yy_c_buf_p = yytext;
break;
case EOB_ACT_LAST_MATCH:
YY_FATAL_ERROR( "unexpected last match in input()" );
}
}
c = *yy_c_buf_p;
yy_hold_char = *++yy_c_buf_p;
return ( c );
}
#ifdef __STDC__
static void yyrestart( FILE *input_file )
#else
static void yyrestart( input_file )
FILE *input_file;
#endif
{
if ( yyin != stdin )
fclose( yyin );
yyin = input_file;
yy_init = 1;
}
# line 141 "lex.l"
static
initype() /* init the type list */
{
if (typend) {
return;
}
for (typend = &typnam[0]; *typend; typend++)
;
}
newtype(s) /* insert this string into the list of type strings */
char *s;
{
char **t;
initype();
for (t = &typnam[0]; t < typend && strcmp(s, *t) != 0; t++)
;
if (t
return;
}
if (typend >= &typnam[MAXTYPES]) {
fprintf(stderr, "%s: out of memory\n", cmd);
exit(1);
}
*typend++ = s;
}
static int
istype(s) /* returns 'this string is a TYPE name' */
char *s;
{
char **t;
initype();
for (t = &typnam[0]; t < typend && strcmp(s, *t) != 0; t++)
;
return(t < typend);
}
static int /* token to return (or zero, if not a special keyword) */
specof(t, vp)
char *t; /* possible keyword text */
int *vp; /* where to put value */
{
struct spec *sp;
for (sp = &specnam[0]; sp->s_name && strcmp(t, sp->s_name) != 0;
sp++)
;
if (sp->s_name) {
*vp = sp->s_val;
return(sp->s_tok);
}
return(0);
}
struct lexed *
nxttok(val) /* insert the val at the end of the list */
int val;
{
/* curtok: current token in the input list */
static struct lexed *curtok = &firsttok;
curtok = instok(val, yytext, curtok);
return(curtok);
}
struct lexed *
instok(val, text, after) /* insert token into input list */
int val; /* token value (yylval'ish) */
char *text; /* associated text (to be copied) */
struct lexed *after; /* node to insert after */
{
char *malloc();
struct lexed *node;
if (!(node = (struct lexed *) malloc(sizeof(struct lexed)))) {
fprintf(stderr, "%s: out of memory.\n", cmd);
exit(1);
}
if (!(node->l_text = malloc(strlen(text) + 1))) {
fprintf(stderr, "%s: out of memory.\n", cmd);
exit(1);
}
(void) strcpy(node->l_text, text);
node->l_val = val;
/* insert into the list after the node 'after' */
after->l_next->l_prev = node;
node->l_next = after->l_next;
node->l_prev = after;
after->l_next = node;
return(node);
}
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/