File: EnlargeFlex.patch%2Cv

package info (click to toggle)
flexml 1-5
  • links: PTS
  • area: main
  • in suites: potato, woody
  • size: 884 kB
  • ctags: 203
  • sloc: perl: 2,016; makefile: 160; ansic: 56; xml: 28
file content (165 lines) | stat: -rw-r--r-- 5,335 bytes parent folder | download
1
2
3
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
head	1.2;
access;
symbols;
locks; strict;
comment	@# @;


1.2
date	99.12.13.15.57.18;	author krisrose;	state Exp;
branches;
next	1.1;

1.1
date	99.12.09.15.25.39;	author krisrose;	state Exp;
branches;
next	;


desc
@@


1.2
log
@Now applied in Debian.
@
text
@This patch, relative to the flex-2.5.4a sources, permits really large
NFA and DFAs when flex is passed the -Ca option (since in that case it
does not affect performance in any way).

Note: The patch is ALREADY applied in the Debian GNU/Linux package
since flex-2.5.4a-6.

$Id: EnlargeFlex.patch,v 1.1 1999/12/09 15:25:39 krisrose Exp krisrose $
Copyright  1999 Kristoffer Rose; placed in the public domain.

diff -ur flex-2.5.4a/MISC/texinfo/flex.texi.orig flex-2.5.4a/MISC/texinfo/flex.texi
--- flex-2.5.4a/MISC/texinfo/flex.texi.orig	Sun Jul 27 04:47:21 1997
+++ flex-2.5.4a/MISC/texinfo/flex.texi	Fri Dec  3 18:59:51 1999
@@@@ -2152,8 +2152,10 @@@@
 aligned for memory access and computation.  On some
 RISC architectures, fetching and manipulating
 long-words is more efficient than with smaller-sized
-units such as shortwords.  This option can double
-the size of the tables used by your scanner.
+units such as shortwords.  This option can quadruple
+the size of the tables used by your scanner.  It has the
+side effect of permitting much larger scanners, however,
+if you need this.
 
 @@samp{-Ce} directs @@code{flex} to construct @@dfn{equivalence classes},
 i.e., sets of characters which have identical
diff -ur flex-2.5.4a/flexdef.h.orig flex-2.5.4a/flexdef.h
--- flex-2.5.4a/flexdef.h.orig	Sun Jul 27 04:42:50 1997
+++ flex-2.5.4a/flexdef.h	Fri Dec  3 18:46:36 1999
@@@@ -214,11 +214,12 @@@@
 
 /* Maximum number of NFA states. */
 #define MAXIMUM_MNS 31999
+#define MAXIMUM_MNS_LONG 3999999
 
 /* 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
@@@@ -457,6 +458,7 @@@@
 
 
 /* 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
@@@@ -485,7 +487,7 @@@@
  * 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 -ur flex-2.5.4a/main.c.orig flex-2.5.4a/main.c
--- flex-2.5.4a/main.c.orig	Sun Jul 27 04:32:19 1997
+++ flex-2.5.4a/main.c	Fri Dec  3 18:57:27 1999
@@@@ -70,7 +70,7 @@@@
 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;
@@@@ -1056,6 +1056,7 @@@@
 
 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 -ur flex-2.5.4a/nfa.c.orig flex-2.5.4a/nfa.c
--- flex-2.5.4a/nfa.c.orig	Sun Jul 27 04:32:19 1997
+++ flex-2.5.4a/nfa.c	Fri Dec  3 18:44:33 1999
@@@@ -595,7 +595,7 @@@@
 	{
 	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 );
@


1.1
log
@Initial revision
@
text
@d1 3
a3 3
This patch, relative to the Debian GNU/Linux flex-2.5.4a sources,
permits really large NFA and DFAs when flex is passed the -Ca option
(since in that case it does not affect performance in any way).
d5 4
a8 1
$Id$
d11 2
a12 2
diff -ur flex-2.5.4a-original/MISC/texinfo/flex.texi flex-2.5.4a/MISC/texinfo/flex.texi
--- flex-2.5.4a-original/MISC/texinfo/flex.texi	Sun Jul 27 04:47:21 1997
d27 2
a28 15
diff -ur flex-2.5.4a-original/debian/changelog flex-2.5.4a/debian/changelog
--- flex-2.5.4a-original/debian/changelog	Fri Dec  3 18:38:31 1999
+++ flex-2.5.4a/debian/changelog	Fri Dec  3 18:42:16 1999
@@@@ -1,3 +1,9 @@@@
+flex (2.5.4a-5.1) unstable; urgency=low
+
+  * Patch to permit larger NFAs with -Ca (needed by flexml for large DTDs).
+
+ -- Kristoffer H. Rose <Kristoffer.Rose@@ens-lyon.fr>  Fri,  3 Dec 1999 18:42:14 +0100
+
 flex (2.5.4a-5) unstable; urgency=low
 
   * Fixed Bug #47860: flex segfaults. Patch by the author.
diff -ur flex-2.5.4a-original/flexdef.h flex-2.5.4a/flexdef.h
--- flex-2.5.4a-original/flexdef.h	Sun Jul 27 04:42:50 1997
d61 2
a62 2
diff -ur flex-2.5.4a-original/main.c flex-2.5.4a/main.c
--- flex-2.5.4a-original/main.c	Sun Jul 27 04:32:19 1997
d81 2
a82 2
diff -ur flex-2.5.4a-original/nfa.c flex-2.5.4a/nfa.c
--- flex-2.5.4a-original/nfa.c	Sun Jul 27 04:32:19 1997
@