37 #define ENQUOTE(path) #path 41 "@(#) Copyright (c) 1990 The Regents of the University of California.\n\ 42 All rights reserved.\n";
46 #ifdef EPICS_BUILD_DLL 47 # undef EPICS_BUILD_DLL 50 # undef EPICS_CALL_DLL 53 #include "epicsTempFile.c" 55 static char flex_version[] =
"2.3";
110 #ifndef SHORT_FILE_NAMES 111 static char *outfile =
"lex.yy.c";
113 static char *outfile =
"lexyy.c";
115 static int outfile_created = 0;
116 static int use_stdout;
117 static char *skelname =
NULL;
120 int main(
int argc,
char *argv[])
143 "-I (interactive) entails a minor performance penalty\n" );
146 fprintf(
stderr,
"yymore() entails a minor performance penalty\n" );
149 fprintf(
stderr,
"REJECT entails a large performance penalty\n" );
153 "Variable trailing context rules entail a large performance penalty\n" );
165 flexerror(
"REJECT cannot be used with -f or -F" );
168 "variable trailing context rules cannot be used with -f or -F" );
204 flexfatal(
"error occurred when writing skeleton file" );
207 flexfatal(
"error occurred when closing skeleton file" );
213 flexfatal(
"error occurred when writing temporary action file" );
216 flexfatal(
"error occurred when closing temporary action file" );
219 if ( status != 0 && outfile_created )
222 flexfatal(
"error occurred when writing output file" );
224 else if ( fclose(
stdout ) )
225 flexfatal(
"error occurred when closing output file" );
227 else if ( unlink( outfile ) )
228 flexfatal(
"error occurred when deleting output file" );
237 "%d backtracking (non-accepting) states.\n",
240 fprintf(
backtrack_file,
"Compressed tables always backtrack.\n" );
243 flexfatal(
"error occurred when writing backtracking file" );
246 flexfatal(
"error occurred when closing backtracking file" );
255 fprintf(
stderr,
" started at %s, finished at %s\n",
258 fprintf(
stderr,
" scanner options: -" );
295 fprintf(
stderr,
" -S%s", skelname );
306 fprintf(
stderr,
" No backtracking\n" );
308 fprintf(
stderr,
" %d backtracking (non-accepting) states\n",
311 fprintf(
stderr,
" compressed tables always backtrack\n" );
314 fprintf(
stderr,
" Beginning-of-line patterns used\n" );
318 fprintf(
stderr,
" %d epsilon states, %d double epsilon states\n",
322 fprintf(
stderr,
" no character classes\n" );
325 " %d/%d character classes needed %d/%d words of storage, %d reused\n",
331 fprintf(
stderr,
" %d/%d unique/duplicate transitions\n",
337 fprintf(
stderr,
" %d table entries\n", tblsiz );
344 fprintf(
stderr,
" %d/%d base-def entries created\n",
346 fprintf(
stderr,
" %d/%d (peak %d) nxt-chk entries created\n",
349 " %d/%d (peak %d) template nxt-chk entries created\n",
352 fprintf(
stderr,
" %d empty table entries\n",
nummt );
354 fprintf(
stderr,
" %d templates created, %d uses\n",
360 tblsiz = tblsiz +
csize;
361 fprintf(
stderr,
" %d/%d equivalence classes created\n",
368 fprintf(
stderr,
" %d/%d meta-equivalence classes created\n",
372 fprintf(
stderr,
" %d (%d saved) hash collisions, %d DFAs equal\n",
375 fprintf(
stderr,
" %d total table entries needed\n", tblsiz );
409 for ( --argc, ++argv; argc ; --argc, ++argv )
411 if ( argv[0][0] !=
'-' || argv[0][1] ==
'\0' )
416 for ( i = 1; arg[
i] !=
'\0'; ++
i )
425 "%s: Assuming use of deprecated -c flag is really intended to be -C\n",
432 flexerror(
"-C flag must be given separately" );
442 for ( ++i; arg[
i] !=
'\0'; ++
i )
462 lerrif(
"unknown -C option '%c'",
501 flexerror(
"-o flag must be given separately" );
503 outfile = arg + i + 1;
512 flexerror(
"-S flag must be given separately" );
514 skelname = arg + i + 1;
538 lerrif(
"unknown flag '%c'", (
int) arg[i] );
547 flexerror(
"full table and -Cm don't make sense together" );
550 flexerror(
"full table and -I are (currently) incompatible" );
553 flexerror(
"full table and -F are mutually exclusive" );
557 static char skeleton_name_storage[400];
559 skelname = skeleton_name_storage;
565 FILE *prev_stdout = freopen( outfile,
"w",
stdout );
567 if ( prev_stdout ==
NULL )
568 lerrsf(
"could not create %s", outfile );
579 #ifndef SHORT_FILE_NAMES 586 flexerror(
"could not create lex.backtrack" );
599 if ( (
skelfile = fopen( skelname,
"r" )) == NULL )
600 lerrsf(
"can't open skeleton file %s", skelname );
604 lerrsf(
"can't create temporary action file",
"" );
628 for ( i = 2; i <=
csize; ++
i )
639 for ( i = 1; i <=
csize; ++
i )
661 puts(
"#define FLEX_DEBUG" );
664 puts(
"#define YY_CHAR unsigned char" );
666 puts(
"#define YY_CHAR char" );
#define INITIAL_MAX_TEMPLATE_XPAIRS
void set_up_initial_allocations(void)
int cre8ecs(int fwd[], int bck[], int num)
LIBCOM_API FILE *epicsStdCall epicsTempFile(void)
Create and open a temporary file.
int variable_trailing_context_rules
int protsave[PROT_SAVE_SIZE]
union dfaacc_union * dfaacc
int ecs_from_xlation(int ecmap[])
#define allocate_int_ptr_array(size)
void flexinit(int, char **)
int onestate[ONE_STACK_SIZE]
char * flex_gettime(void)
#define allocate_integer_array(size)
void set_input_file(char *)
void lerrsf(char[], char[])
#define INITIAL_MAX_DFA_SIZE
#define DEFAULT_SKELETON_FILE
int current_max_template_xpairs
void flexerror(char[]) NORETURN
int onesym[ONE_STACK_SIZE]
#define allocate_dfaacc_union(size)
#define INITIAL_MAX_CCL_TBL_SIZE
#define allocate_character_array(size)
#define INITIAL_MAX_RULES
int onedef[ONE_STACK_SIZE]
void line_directive_out(FILE *)
#define allocate_char_ptr_array(size)
int onenext[ONE_STACK_SIZE]
void pinpoint_message(char[])
int main(int argc, char *argv[])
int current_max_ccl_tbl_size
#define INITIAL_MAX_XPAIRS