summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Estes <wlestes@users.sourceforge.net>2002-02-06 21:41:52 +0000
committerWill Estes <wlestes@users.sourceforge.net>2002-02-06 21:41:52 +0000
commit27598b73c0a62a2132e71c7a61d61acb6619390e (patch)
tree690a9798326b1a3aa6c2e2c8f2658e05dfffa62c
parentcb4534f04781e46765889d1b7fedf28db37d0d2d (diff)
support large flex tables; from debian package maintainer
-rw-r--r--flex.texi2
-rw-r--r--flexdef.h6
-rw-r--r--main.c3
-rw-r--r--nfa.c2
4 files changed, 8 insertions, 5 deletions
diff --git a/flex.texi b/flex.texi
index 366ecce..0edee4d 100644
--- a/flex.texi
+++ b/flex.texi
@@ -2171,7 +2171,7 @@ generated scanner for faster performance because the elements of
the tables are better aligned for memory access and computation. On some
RISC architectures, fetching and manipulating longwords is more efficient
than with smaller-sized units such as shortwords. This option can
-double the size of the tables used by your scanner.
+quadruple the size of the tables used by your scanner.
@item -Ce, --ecs
directs @code{flex} to construct @dfn{equivalence classes}, i.e., sets
diff --git a/flexdef.h b/flexdef.h
index 3ec4909..2b8feb9 100644
--- a/flexdef.h
+++ b/flexdef.h
@@ -221,11 +221,12 @@
/* Maximum number of NFA states. */
#define MAXIMUM_MNS 31999
+#define MAXIMUM_MNS_LONG 1999999999
/* Enough so that if it's subtracted from an NFA state number, the result
* is guaranteed to be negative.
*/
-#define MARKER_DIFFERENCE (MAXIMUM_MNS+2)
+#define MARKER_DIFFERENCE (maximum_mns+2)
/* Maximum number of nxt/chk pairs for non-templates. */
#define INITIAL_MAX_XPAIRS 2000
@@ -444,6 +445,7 @@ extern int onenext[ONE_STACK_SIZE], onedef[ONE_STACK_SIZE], onesp;
/* Variables for nfa machine data:
+ * maximum_mns - maximal number of NFA states supported by tables
* current_mns - current maximum on number of NFA states
* num_rules - number of the last accepting state; also is number of
* rules created so far
@@ -472,7 +474,7 @@ extern int onenext[ONE_STACK_SIZE], onedef[ONE_STACK_SIZE], onesp;
* rule_useful - true if we've determined that the rule can be matched
*/
-extern int current_mns, current_max_rules;
+extern int maximum_mns, current_mns, current_max_rules;
extern int num_rules, num_eof_rules, default_rule, lastnfa;
extern int *firstst, *lastst, *finalst, *transchar, *trans1, *trans2;
extern int *accptnum, *assoc_rule, *state_type;
diff --git a/main.c b/main.c
index 8d5cc56..a8d49a3 100644
--- a/main.c
+++ b/main.c
@@ -71,7 +71,7 @@ char *prefix, *yyclass;
int do_stdinit, use_stdout;
int onestate[ONE_STACK_SIZE], onesym[ONE_STACK_SIZE];
int onenext[ONE_STACK_SIZE], onedef[ONE_STACK_SIZE], onesp;
-int current_mns, current_max_rules;
+int maximum_mns, current_mns, current_max_rules;
int num_rules, num_eof_rules, default_rule, lastnfa;
int *firstst, *lastst, *finalst, *transchar, *trans1, *trans2;
int *accptnum, *assoc_rule, *state_type;
@@ -1581,6 +1581,7 @@ _( "Variable trailing context rules entail a large performance penalty\n" ) );
void set_up_initial_allocations()
{
+ maximum_mns = (long_align ? MAXIMUM_MNS_LONG : MAXIMUM_MNS);
current_mns = INITIAL_MNS;
firstst = allocate_integer_array( current_mns );
lastst = allocate_integer_array( current_mns );
diff --git a/nfa.c b/nfa.c
index bcebbdc..65634e1 100644
--- a/nfa.c
+++ b/nfa.c
@@ -598,7 +598,7 @@ int sym;
{
if ( ++lastnfa >= current_mns )
{
- if ( (current_mns += MNS_INCREMENT) >= MAXIMUM_MNS )
+ if ( (current_mns += MNS_INCREMENT) >= maximum_mns )
lerrif(
_( "input rules are too complicated (>= %d NFA states)" ),
current_mns );