summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorVern Paxson <vern@ee.lbl.gov>1990-03-14 13:39:21 +0000
committerVern Paxson <vern@ee.lbl.gov>1990-03-14 13:39:21 +0000
commitf248f2d111793b35a158d9c52e5c9b892ce5a5bc (patch)
tree529b82614072eecf7da6dcc4d189dff637362cb1 /main.c
parent7768de78e642b90c06fbe5be6809663829169dd8 (diff)
Tweaks for NUL chars.
Diffstat (limited to 'main.c')
-rw-r--r--main.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/main.c b/main.c
index 81842f8..95a1751 100644
--- a/main.c
+++ b/main.c
@@ -60,7 +60,7 @@ int current_state_type;
int variable_trailing_context_rules;
int numtemps, numprots, protprev[MSP], protnext[MSP], prottbl[MSP];
int protcomst[MSP], firstprot, lastprot, protsave[PROT_SAVE_SIZE];
-int numecs, nextecm[CSIZE + 1], ecgroup[CSIZE + 1], nummecs, tecfwd[CSIZE + 1];
+int numecs, nextecm[CSIZE], ecgroup[CSIZE], nummecs, tecfwd[CSIZE + 1];
int tecbck[CSIZE + 1];
int *xlation = (int *) 0;
int num_xlations;
@@ -79,7 +79,7 @@ Char *ccltbl;
char *starttime, *endtime, nmstr[MAXLINE];
int sectnum, nummt, hshcol, dfaeql, numeps, eps2, num_reallocs;
int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave;
-int num_backtracking, bol_needed;
+int num_backtracking, bol_needed, uses_NUL;
FILE *temp_action_file;
FILE *backtrack_file;
int end_of_buffer_state;
@@ -96,12 +96,6 @@ static char *outfile = "lexyy.c";
static int outfile_created = 0;
-/* flex - main program
- *
- * synopsis (from the shell)
- * flex [-v] [file ...]
- */
-
main( argc, argv )
int argc;
char **argv;
@@ -206,7 +200,7 @@ int status;
(void) unlink( outfile );
}
- if ( backtrack_report )
+ if ( backtrack_report && backtrack_file )
{
if ( num_backtracking == 0 )
fprintf( backtrack_file, "No backtracking.\n" );
@@ -550,7 +544,7 @@ get_next_arg: /* used by -C and -S flags in lieu of a "continue 2" control */
numecs = numeps = eps2 = num_reallocs = hshcol = dfaeql = totnst = 0;
numuniq = numdup = hshsave = eofseen = datapos = dataline = 0;
num_backtracking = onesp = numprots = 0;
- variable_trailing_context_rules = bol_needed = false;
+ variable_trailing_context_rules = bol_needed = uses_NUL = false;
linenum = sectnum = 1;
firstprot = NIL;
@@ -565,9 +559,9 @@ get_next_arg: /* used by -C and -S flags in lieu of a "continue 2" control */
if ( useecs )
{
/* set up doubly-linked equivalence classes */
- ecgroup[1] = NIL;
+ ecgroup[0] = NIL;
- for ( i = 2; i <= csize; ++i )
+ for ( i = 1; i < csize; ++i )
{
ecgroup[i] = i - 1;
nextecm[i - 1] = i;
@@ -578,7 +572,7 @@ get_next_arg: /* used by -C and -S flags in lieu of a "continue 2" control */
else
{ /* put everything in its own equivalence class */
- for ( i = 1; i <= csize; ++i )
+ for ( i = 0; i < csize; ++i )
{
ecgroup[i] = i;
nextecm[i] = BAD_SUBSCRIPT; /* to catch errors */
@@ -627,7 +621,11 @@ readin()
else if ( useecs )
{
- numecs = cre8ecs( nextecm, ecgroup, csize );
+ if ( uses_NUL )
+ numecs = cre8ecs( nextecm, ecgroup, csize, 0 );
+ else
+ numecs = cre8ecs( nextecm, ecgroup, csize - 1, 1 );
+
ccl2ecl();
}