Category : C Source Code
Archive   : CPPCOMBO.ZIP
Filename : COMLEX.CPP

 
Output of file : COMLEX.CPP contained in archive : CPPCOMBO.ZIP
#define YY_DEFAULT_ACTION ECHO;
#define FLEX_USE_ECS
#define FLEX_USE_MECS
#define FLEX_INTERACTIVE_SCANNER
/* A lexical scanner generated by flex */

#ifdef MSDOS
#include "\LIB\fskeldef.h"
#else
#include "\LIB\flexskeldef.h"
#endif

# line 1 "com.l"
#define INITIAL 0
# line 2 "com.l"

/***************/
/* Gloal stuff */
/***************/

extern "C" {
#include
#include
#include
#include
#include
}

#define STRMAX 255 /* Max length of strings */

#include "comgram.h" /* Get YACC token equates */

extern YYSTYPE yylval;
extern FILE * comIn;
extern FILE * comOut;

/* gets input and stuffs it into "buf". number of characters read, or YY_NULL,
* is returned in "result".
*
* We redefine Flex's routine so we can supply the text from a file.
*/
#undef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
if ( (result = read( fileno(comIn), buf, max_size )) < 0 ) \
YY_FATAL_ERROR( "read() in flex scanner failed" );

/* We don't want the default action to ECHO, so define it as nothing */
#undef YY_DEFAULT_ACTION
#define YY_DEFAULT_ACTION printf("Default action: %i\n",*yytext)

/*
* Local variables
*/

char *ptr; /* String pointer */
char *cp; /* Roving string pointer */
int scount; /* String length */
extern YYSTYPE yylval; /* For returning token values */
extern int lineCount; /* Our line counter */
int q; /* Work variable */

#define BYTEMASK 0x7F

/***********************/
/* Function prototypes */
/***********************/

int otoi(char *);
int htoi(char *);
char myesc(char *);

#define QUOTE 2
#define C_COMMENT 4
#define RECOVER 6
# line 79 "com.l"
#define YY_JAM 163
#define YY_JAM_BASE 271
#define YY_TEMPLATE 164
static char l[164] =
{ 0,
-2, -2, -2, -2, -2, -2, -2, -2, 65, 62,
63, 64, 49, 27, 58, 52, 65, 45, 46, 56,
55, 44, 47, 57, 26, 26, 60, 59, 54, 61,
53, 50, 65, 65, 65, 65, 65, 65, 65, 65,
65, 65, 42, 51, 43, 48, 29, 31, 30, 29,
3, 5, 4, 0, 66, 62, 36, 35, 0, 0,
1, 0, 26, 0, 32, 40, 41, 37, 39, 38,
33, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 16, 0, 0, 0, 0, 0, 34, 28, 28,
0, 2, 23, 0, 0, 6, 25, 0, 0, 0,

0, 15, 12, 0, 11, 0, 17, 0, 0, 0,
0, 0, 28, 0, 0, 0, 0, 0, 14, 0,
0, 8, 9, 10, 0, 0, 28, 0, 0, 0,
19, 0, 0, 0, 0, 0, 28, 24, 0, 0,
0, 18, 20, 7, 0, 0, 0, 13, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 22,
0, 21, 0
} ;

static char e[128] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 5, 6, 7, 1, 1, 8, 9, 10, 11,
12, 13, 14, 15, 16, 1, 17, 18, 19, 19,
19, 19, 19, 19, 19, 19, 19, 20, 21, 22,
23, 24, 1, 1, 27, 28, 29, 30, 31, 32,
33, 34, 35, 36, 36, 37, 38, 39, 40, 41,
36, 42, 43, 44, 45, 36, 46, 47, 48, 36,
1, 25, 1, 26, 1, 1, 27, 28, 29, 30,

31, 32, 33, 34, 35, 36, 36, 37, 38, 39,
40, 41, 36, 42, 43, 44, 45, 36, 46, 47,
48, 36, 49, 50, 51, 52, 1
} ;

static char m[53] =
{ 0,
1, 1, 2, 1, 1, 1, 1, 1, 1, 3,
1, 1, 1, 1, 1, 1, 1, 4, 4, 1,
1, 1, 1, 1, 1, 1, 5, 5, 5, 5,
5, 5, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 1, 1,
1, 1
} ;

static short int b[175] =
{ 0,
0, 0, 50, 51, 52, 53, 268, 267, 271, 57,
271, 271, 246, 271, 271, 259, 76, 271, 271, 271,
271, 271, 271, 47, 111, 49, 271, 271, 47, 49,
108, 271, 228, 229, 230, 96, 224, 223, 102, 106,
112, 232, 271, 211, 271, 271, 271, 271, 271, 122,
139, 271, 243, 256, 271, 144, 271, 271, 248, 247,
271, 253, 126, 0, 271, 271, 271, 271, 271, 271,
271, 207, 214, 210, 209, 221, 213, 222, 206, 203,
214, 271, 206, 204, 208, 203, 210, 271, 271, 132,
0, 271, 271, 0, 237, 271, 0, 195, 195, 196,

205, 271, 271, 192, 271, 199, 271, 203, 186, 187,
200, 201, 135, 0, 0, 194, 196, 189, 271, 194,
192, 271, 271, 271, 165, 154, 137, 0, 168, 142,
271, 149, 170, 126, 127, 139, 271, 271, 132, 122,
140, 271, 271, 271, 135, 162, 126, 271, 136, 126,
123, 124, 123, 129, 121, 118, 48, 30, 24, 271,
17, 271, 271, 179, 185, 191, 197, 201, 207, 210,
211, 214, 215, 218
} ;

static short int d[175] =
{ 0,
163, 1, 164, 164, 165, 165, 166, 166, 163, 163,
163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
163, 163, 163, 163, 163, 163, 163, 163, 163, 167,
165, 163, 163, 166, 163, 163, 163, 163, 163, 168,
163, 169, 163, 170, 163, 163, 163, 163, 163, 163,
163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
167, 163, 163, 171, 169, 163, 170, 163, 163, 163,

163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
163, 163, 163, 172, 173, 163, 163, 163, 163, 163,
163, 163, 163, 163, 163, 163, 163, 174, 163, 163,
163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
163, 163,-32767, 163, 163, 163, 163, 163, 163, 163,
163, 163, 163, 163
} ;

static short int n[324] =
{ 0,
9, 10, 11, 12, 10, 13, 14, 15, 16, 17,
18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 29, 30, 31, 9, 32, 33, 9, 34, 35,
36, 37, 9, 9, 9, 9, 9, 9, 38, 39,
9, 9, 40, 9, 9, 41, 9, 42, 43, 44,
45, 46, 48, 48, 52, 52, 49, 49, 56, 61,
162, 56, 161, 62, 53, 53, 63, 63, 65, 66,

67, 68, 69, 160, 50, 50, 59, 59, 159, 59,
59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
59, 59, 59, 59, 59, 59, 59, 59, 59, 59,

59, 59, 60, 60, 60, 60, 60, 60, 60, 60,
60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
60, 60, 60, 60, 59, 59, 59, 59, 63, 63,
70, 71, 75, 81, 76, 77, 83, 78, 85, 90,
82, 163, 84, 63, 63, 56, 86, 91, 56, 113,
113, 163, 127, 127, 137, 137, 158, 64, 157, 156,
155, 154, 153, 152, 151, 150, 149, 148, 147, 146,
145, 144, 143, 142, 141, 140, 139, 138, 114, 47,
47, 47, 47, 47, 47, 51, 51, 51, 51, 51,
51, 54, 54, 54, 54, 54, 54, 89, 136, 89,

89, 89, 89, 94, 135, 94, 94, 95, 95, 95,
95, 95, 95, 97, 97, 115, 115, 128, 128, 129,
129, 89, 89, 134, 133, 132, 131, 130, 126, 125,
124, 123, 122, 121, 120, 119, 118, 117, 116, 96,
112, 111, 110, 109, 108, 107, 106, 105, 104, 103,
102, 101, 100, 99, 98, 96, 93, 93, 55, 92,
88, 87, 80, 79, 74, 73, 72, 58, 57, 55,
55, 163, 163, 163, 163, 163, 163, 163, 163, 163,
163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
163, 163, 163, 163, 163, 163, 163, 163, 163, 163,

163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
163, 163, 163
} ;

static short int c[324] =
{ 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, 3, 4, 5, 6, 3, 4, 10, 24,
161, 10, 159, 24, 5, 6, 26, 26, 29, 29,
30, 30, 30, 158, 3, 4, 17, 17, 157, 17,
17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
17, 17, 17, 17, 17, 17, 17, 17, 17, 17,

17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
17, 17, 17, 17, 17, 17, 17, 17, 25, 25,
31, 31, 36, 39, 36, 36, 40, 36, 41, 50,
39, 51, 40, 63, 63, 56, 41, 50, 56, 90,
90, 51, 113, 113, 127, 127, 156, 25, 155, 154,
153, 152, 151, 150, 149, 147, 146, 145, 141, 140,
139, 136, 135, 134, 133, 132, 130, 129, 90, 164,
164, 164, 164, 164, 164, 165, 165, 165, 165, 165,
165, 166, 166, 166, 166, 166, 166, 167, 126, 167,

167, 167, 167, 168, 125, 168, 168, 169, 169, 169,
169, 169, 169, 170, 170, 171, 171, 172, 172, 173,
173, 174, 174, 121, 120, 118, 117, 116, 112, 111,
110, 109, 108, 106, 104, 101, 100, 99, 98, 95,
87, 86, 85, 84, 83, 81, 80, 79, 78, 77,
76, 75, 74, 73, 72, 62, 60, 59, 54, 53,
44, 42, 38, 37, 35, 34, 33, 16, 13, 8,
7, 163, 163, 163, 163, 163, 163, 163, 163, 163,
163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
163, 163, 163, 163, 163, 163, 163, 163, 163, 163,

163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
163, 163, 163
} ;


/* these declarations have to come after the section 1 code or lint gets
* confused about whether the variables are used
*/
FILE *yyin = stdin, *yyout = stdout;

/* these variables are all declared out here so that section 3 code can
* manipulate them
*/
static int yy_start, yy_b_buf_p, yy_c_buf_p, yy_e_buf_p;
static int yy_saw_eof, yy_init = 1;

/* yy_ch_buf has to be 1 character longer than YY_BUF_SIZE, since when
* setting up yytext we can try to put a '\0' just past the end of the
* matched text
*/
static char yy_ch_buf[YY_BUF_SIZE + 1];
static int yy_st_buf[YY_BUF_SIZE];
static char yy_hold_char;
char *yytext;
static int yyleng;

YY_DECL
{
int yy_n_chars, yy_lp, yy_iii, yy_buf_pos, yy_act;




if ( yy_init )
{
YY_INIT;
yy_start = 1;
yy_init = 0;
}

goto get_next_token;

do_action:
for ( ; ; )
{
YY_DO_BEFORE_ACTION

#ifdef FLEX_DEBUG
fprintf( stderr, "--accepting rule #%d\n", yy_act );
#endif
switch ( yy_act )
{
/************/
/* Comments */
/************/
case 1:
# line 85 "com.l"
BEGIN(C_COMMENT); /* Old style comments. */
YY_BREAK
case 2:
# line 87 "com.l"
BEGIN(0); /* Sub-scanner to handle comments. */
YY_BREAK
case 3:
# line 88 "com.l"
;
YY_BREAK
case 4:
# line 89 "com.l"
;
YY_BREAK
case 5:
# line 90 "com.l"
{
lineCount++;
}
YY_BREAK
case 6:
# line 94 "com.l"
{ /* New style comments */
lineCount++;
}
YY_BREAK
/************/
/* Commands */
/************/
case 7:
# line 102 "com.l"
return(YDEBUG);
YY_BREAK
case 8:
# line 104 "com.l"
return(SEND);
YY_BREAK
case 9:
# line 106 "com.l"
return(SLOW);
YY_BREAK
case 10:
# line 108 "com.l"
return(WAIT);
YY_BREAK
case 11:
# line 110 "com.l"
return(FOR);
YY_BREAK
case 12:
# line 112 "com.l"
return(EOL);
YY_BREAK
case 13:
# line 114 "com.l"
return(ANYTHING);
YY_BREAK
case 14:
# line 116 "com.l"
return(ELSE);
YY_BREAK
case 15:
# line 118 "com.l"
return(END);
YY_BREAK
case 16:
# line 120 "com.l"
return(ON);
YY_BREAK
case 17:
# line 122 "com.l"
return(OFF);
YY_BREAK
case 18:
# line 124 "com.l"
return(NOTIFY);
YY_BREAK
case 19:
# line 126 "com.l"
return(CLOSE);
YY_BREAK
case 20:
# line 128 "com.l"
return(WINDOW);
YY_BREAK
case 21:
# line 130 "com.l"
return(DISPLAYCOMMENT);
YY_BREAK
case 22:
# line 132 "com.l"
return(ERASECOMMENT);
YY_BREAK
/* Byte Literal constant */
case 23:
# line 135 "com.l"
{
yylval.ival= *(yytext+1);
return(BYTE_LITCONST);
}
YY_BREAK
/* Long Literal constant */
case 24:
# line 141 "com.l"
{
ptr=yytext+1;
yylval.lval=(*ptr);
yylval.lval<<=8;
yylval.lval+=(*(ptr+1));
yylval.lval<<=8;
yylval.lval+=(*(ptr+2));
yylval.lval<<=8;
yylval.lval+=(*(ptr+3));
return(LITCONST);
}
YY_BREAK
/* Hex constant */
case 25:
# line 155 "com.l"
{
yylval.ival=0;
for (q=2; q if (yytext[q]<'A') {
yylval.ival=(yylval.ival*16) + (yytext[q]-'0');
} else {
if (yytext[q]<'a')
yylval.ival=(yylval.ival*16)+(yytext[q]-'A'+10);
else
yylval.ival=(yylval.ival*16)+(yytext[q]-'a'+10);
}
}
return(CONSTANT);
}
YY_BREAK
/* Integer constant */
case 26:
# line 171 "com.l"
{
yylval.ival=0;
for (q=0; q yylval.ival=(yylval.ival*10) + (yytext[q]-'0');
}
return(CONSTANT);
}
YY_BREAK
/* String */
case 27:
# line 180 "com.l"
{
/* We need to accumulate all characters in the string */
/* To do this, we use a sub-analyzer. Let's get set! */
ptr=(char*)calloc(1,STRMAX+1); /* Get memory for the string */
cp=ptr; /* Make a roving pointer */
scount=0;
BEGIN(QUOTE); /* Start the analyzer */
}
YY_BREAK
/* Sub-analyzer to accumulate the contents of a string */
case 28:
# line 190 "com.l"
{
*cp++=(myesc(yytext) & BYTEMASK);
scount++;
if (scount>=STRMAX-1) {
printf("String too long!\n");
free(ptr); /* Give back our memory */
BEGIN(0);
}
}
YY_BREAK
case 29:
# line 200 "com.l"
{
*cp++=(yytext[0] & BYTEMASK); /* Still in string */
scount++;
if (scount>=STRMAX-1) {
printf("String too long!\n");
free(ptr); /* Give back our memory */
BEGIN(0);
}
}
YY_BREAK
case 30:
# line 210 "com.l"
{
/* End of the string */
*cp=0; /* Terminate the string */
scount++;
cp=(char*)realloc(ptr,scount); /* Give a bit of memory back */
if (cp)
yylval.ptr=cp; /* Pass pointer to string */
else
yylval.ptr=ptr; /* Realloc failed! (impossible) */
BEGIN(0); /* Turn off string processing */
return(STRING); /* Return our string token */
}
YY_BREAK
case 31:
# line 223 "com.l"
{
printf( "Missing quote\n" );
free(ptr); /* Give back our memory */
BEGIN(0);
}
YY_BREAK
/* Operators */
case 32:
# line 232 "com.l"
return(SHIFT_LEFT);
YY_BREAK
case 33:
# line 233 "com.l"
return(SHIFT_RIGHT);
YY_BREAK
case 34:
# line 234 "com.l"
return(LOGICAL_OR);
YY_BREAK
case 35:
# line 235 "com.l"
return(LOGICAL_AND);
YY_BREAK
case 36:
# line 236 "com.l"
return(NOT_EQ);
YY_BREAK
case 37:
# line 237 "com.l"
return(EQ);
YY_BREAK
case 38:
# line 238 "com.l"
return(GT_EQ);
YY_BREAK
case 39:
# line 239 "com.l"
return(GT_EQ);
YY_BREAK
case 40:
# line 240 "com.l"
return(LT_EQ);
YY_BREAK
case 41:
# line 241 "com.l"
return(LT_EQ);
YY_BREAK
/* Single character stuff */
case 42:
# line 245 "com.l"
return('{');
YY_BREAK
case 43:
# line 246 "com.l"
return('}');
YY_BREAK
case 44:
# line 247 "com.l"
return(',');
YY_BREAK
case 45:
# line 248 "com.l"
return('(');
YY_BREAK
case 46:
# line 249 "com.l"
return(')');
YY_BREAK
case 47:
# line 250 "com.l"
return('-');
YY_BREAK
case 48:
# line 251 "com.l"
return('~');
YY_BREAK
case 49:
# line 252 "com.l"
return('!');
YY_BREAK
case 50:
# line 253 "com.l"
return('^');
YY_BREAK
case 51:
# line 254 "com.l"
return('|');
YY_BREAK
case 52:
# line 255 "com.l"
return('&');
YY_BREAK
case 53:
# line 256 "com.l"
return('>');
YY_BREAK
case 54:
# line 257 "com.l"
return('<');
YY_BREAK
case 55:
# line 258 "com.l"
return('+');
YY_BREAK
case 56:
# line 259 "com.l"
return('*');
YY_BREAK
case 57:
# line 260 "com.l"
return('/');
YY_BREAK
case 58:
# line 261 "com.l"
return('%');
YY_BREAK
case 59:
# line 262 "com.l"
return(';');
YY_BREAK
case 60:
# line 263 "com.l"
return(':');
YY_BREAK
case 61:
# line 264 "com.l"
return('=');
YY_BREAK
case 62:
# line 266 "com.l"
; /* We don't care about whitespace, eat it. */
YY_BREAK
case 63:
# line 268 "com.l"
; /* Ignore CR */
YY_BREAK
case 64:
# line 269 "com.l"
{
lineCount++;
}
YY_BREAK
case 65:
# line 273 "com.l"
{
printf( "Illegal character '%c' (%i)\n", yytext[0],yytext[0]);
BEGIN(RECOVER);
}
YY_BREAK
case 66:
# line 278 "com.l"
{
lineCount++;
BEGIN(0);
}
YY_BREAK

case YY_NEW_FILE:
break; /* begin reading from new file */

case YY_DO_DEFAULT:
YY_DEFAULT_ACTION;
break;

case YY_END_TOK:
return ( YY_END_TOK );

default:
YY_FATAL_ERROR( "fatal flex scanner internal error" );
}

get_next_token:
{
register int yy_curst;
register char yy_sym;

YY_DO_BEFORE_SCAN

/* set up to begin running DFA */

yy_curst = yy_start;

if ( yy_ch_buf[yy_c_buf_p] == '\n' )
++yy_curst;

/* yy_b_buf_p points to the position in yy_ch_buf
* of the start of the current run.
*/

yy_b_buf_p = yy_c_buf_p + 1;

do /* until the machine jams */
{
if ( yy_c_buf_p == yy_e_buf_p )
{ /* need more input */
if ( yy_e_buf_p >= YY_BUF_LIM )
{ /* not enough room to do another read */
/* see if we can make some room for more chars */

yy_n_chars = yy_e_buf_p - yy_b_buf_p;

if ( yy_n_chars >= 0 )
/* shift down buffer to make room */
for ( yy_iii = 0; yy_iii <= yy_n_chars; ++yy_iii )
{
yy_buf_pos = yy_b_buf_p + yy_iii;
yy_ch_buf[yy_iii] = yy_ch_buf[yy_buf_pos];
yy_st_buf[yy_iii] = yy_st_buf[yy_buf_pos];
}

yy_b_buf_p = 0;
yy_e_buf_p = yy_n_chars;

if ( yy_e_buf_p >= YY_BUF_LIM )
YY_FATAL_ERROR( "flex input buffer overflowed" );

yy_c_buf_p = yy_e_buf_p;
}

else if ( yy_saw_eof )
{
saweof: if ( yy_b_buf_p > yy_e_buf_p )
{
if ( yywrap() )
{
yy_act = YY_END_TOK;
goto do_action;
}

else
{
YY_INIT;
yy_act = YY_NEW_FILE;
goto do_action;
}
}

else /* do a jam to eat up more input */
{
#ifndef FLEX_INTERACTIVE_SCANNER
/* we're going to decrement yy_c_buf_p upon doing
* the jam. In this case, that's wrong, since
* it points to the last non-jam character. So
* we increment it now to counter the decrement.
*/
++yy_c_buf_p;
#endif
break;
}
}

YY_INPUT( (yy_ch_buf + yy_c_buf_p + 1), yy_n_chars,
YY_MAX_LINE );

if ( yy_n_chars == YY_NULL )
{
if ( yy_saw_eof )
YY_FATAL_ERROR( "flex scanner saw EOF twice - shouldn't happen" );
yy_saw_eof = 1;
goto saweof;
}

yy_e_buf_p += yy_n_chars;
}

++yy_c_buf_p;

#ifdef FLEX_USE_ECS
yy_sym = e[yy_ch_buf[yy_c_buf_p]];
#else
yy_sym = yy_ch_buf[yy_c_buf_p];
#endif

#ifdef FLEX_FULL_TABLE
yy_curst = n[yy_curst][yy_sym];

#else /* get next state from compressed table */

while ( c[b[yy_curst] + yy_sym] != yy_curst )
{
yy_curst = d[yy_curst];

#ifdef FLEX_USE_MECS
/* we've arrange it so that templates are never chained
* to one another. This means we can afford make a
* very simple test to see if we need to convert to
* yy_sym's meta-equivalence class without worrying
* about erroneously looking up the meta-equivalence
* class twice
*/

if ( yy_curst >= YY_TEMPLATE )
yy_sym = m[yy_sym];
#endif
}

yy_curst = n[b[yy_curst] + yy_sym];

#endif

yy_st_buf[yy_c_buf_p] = yy_curst;

}
#ifdef FLEX_INTERACTIVE_SCANNER
while ( b[yy_curst] != YY_JAM_BASE );
#else
while ( yy_curst != YY_JAM );
--yy_c_buf_p; /* put back character we jammed on */

#endif

if ( yy_c_buf_p >= yy_b_buf_p )
{ /* we matched some text */
yy_curst = yy_st_buf[yy_c_buf_p];
yy_lp = l[yy_curst];

#ifdef FLEX_REJECT_ENABLED
find_rule: /* we branch to this label when doing a REJECT */
#endif

for ( ; ; ) /* until we find what rule we matched */
{
#ifdef FLEX_REJECT_ENABLED
if ( yy_lp && yy_lp < l[yy_curst + 1] )
{
yy_act = a[yy_lp];
goto do_action; /* "continue 2" */
}
#else
if ( yy_lp )
{
yy_act = yy_lp;
goto do_action; /* "continue 2" */
}
#endif

if ( --yy_c_buf_p < yy_b_buf_p )
break;

yy_curst = yy_st_buf[yy_c_buf_p];
yy_lp = l[yy_curst];
}
}

/* if we got this far, then we didn't find any accepting
* states
*/

/* so that the default applies to the first char read */
++yy_c_buf_p;

yy_act = YY_DO_DEFAULT;
}
}

/*NOTREACHED*/
}


/* static int unput( c ) */
void unput( c ) /* This seems more correct - Tim Capps */
char c;

{
YY_DO_BEFORE_SCAN; /* undo effects of setting up yytext */

if ( yy_c_buf_p == 0 )
{
register int i;
register int yy_buf_pos = YY_BUF_MAX;

for ( i = yy_e_buf_p; i >= yy_c_buf_p; --i )
{
yy_ch_buf[yy_buf_pos] = yy_ch_buf[i];
yy_st_buf[yy_buf_pos] = yy_st_buf[i];
--yy_buf_pos;
}

yy_c_buf_p = YY_BUF_MAX - yy_e_buf_p;
yy_e_buf_p = YY_BUF_MAX;
}

if ( yy_c_buf_p <= 0 )
YY_FATAL_ERROR( "flex scanner push-back overflow" );

if ( yy_c_buf_p >= yy_b_buf_p && yy_ch_buf[yy_c_buf_p] == '\n' )
yy_ch_buf[yy_c_buf_p - 1] = '\n';

yy_ch_buf[yy_c_buf_p--] = c;

YY_DO_BEFORE_ACTION; /* set up yytext again */
}


static int input()

{
int c;

YY_DO_BEFORE_SCAN

if ( yy_c_buf_p == yy_e_buf_p )
{ /* need more input */
int yy_n_chars;

/* we can throw away the entire current buffer */
if ( yy_saw_eof )
{
if ( yywrap() )
return ( EOF );

YY_INIT;
}

yy_b_buf_p = 0;
YY_INPUT( yy_ch_buf, yy_n_chars, YY_MAX_LINE );

if ( yy_n_chars == YY_NULL )
{
yy_saw_eof = 1;

if ( yywrap() )
return ( EOF );

YY_INIT;

return ( input() );
}

yy_c_buf_p = -1;
yy_e_buf_p = yy_n_chars - 1;
}

c = yy_ch_buf[++yy_c_buf_p];

YY_DO_BEFORE_ACTION;

return ( c );
}
# line 282 "com.l"


/* myesc - return character corresponding to escape sequence
*
* synopsis
* char array[], c, myesc();
* c = myesc( array );
*
*/

char
myesc(array)
char *array;
{
char c, esc_char;
register int sptr = 2;

switch (array[1]) {
case 'n': return ('\n');
case 't': return ('\t');
case 'f': return ('\f');
case 'r': return ('\r');
case 'b': return ('\b');

case '0':
if(isdigit(array[2])) { /* \0 */

/* don't increment inside loop control because the
* macro will expand it to two increments! (Not a
* problem with the C version of the macro)
*/
while(isdigit(array[sptr]))
++sptr;

c = array[sptr];
array[sptr] = '\0';

esc_char = otoi(array + 2);
array[sptr] = c;

return(esc_char);

} else if((array[2] == 'x') || (array[2] == 'X')) { /* hex */
/* do hex stuff. Format is ALWAYS 0x## */
sptr+=3;

c = array[sptr];
array[sptr] = '\0';

esc_char = htoi(array + 3);
array[sptr] = c;

return(esc_char);

} else {
return (0);
}
break;

case '^':
if (array[2]>='a')
return (array[2]-'a'+1);
else
return (array[2]-'A'+1);

break;
}
return(array[1]);
}

int
otoi(char *a)
{

int x=0;

while(*a) {
x <<= 3;
x += *a++ - '0';
}
return(x);
}

int
htoi(char *a)
{
int x=0;

while (*a) {
if (*a<'A') {
x=(x<<4) + (*a-'0');
} else {
if (*a<'a')
x=(x<<4)+(*a-'A'+10);
else
x=(x<<4)+(*a-'a'+10);
}
a++;
}
return(x);
}


  3 Responses to “Category : C Source Code
Archive   : CPPCOMBO.ZIP
Filename : COMLEX.CPP

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. 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/