summaryrefslogtreecommitdiff
path: root/dfa.c
diff options
context:
space:
mode:
Diffstat (limited to 'dfa.c')
-rw-r--r--dfa.c74
1 files changed, 30 insertions, 44 deletions
diff --git a/dfa.c b/dfa.c
index b8b68eb..5961713 100644
--- a/dfa.c
+++ b/dfa.c
@@ -34,10 +34,10 @@
/* declare functions that have forward references */
-void dump_associated_rules PROTO ((FILE *, int));
-void dump_transitions PROTO ((FILE *, int[]));
-void sympartition PROTO ((int[], int, int[], int[]));
-int symfollowset PROTO ((int[], int, int, int[]));
+void dump_associated_rules (FILE *, int);
+void dump_transitions (FILE *, int[]);
+void sympartition (int[], int, int[], int[]);
+int symfollowset (int[], int, int, int[]);
/* check_for_backing_up - check a DFA state for backing up
@@ -49,9 +49,7 @@ int symfollowset PROTO ((int[], int, int, int[]));
* indexed by equivalence class.
*/
-void check_for_backing_up (ds, state)
- int ds;
- int state[];
+void check_for_backing_up (int ds, int state[])
{
if ((reject && !dfaacc[ds].dfaacc_set) || (!reject && !dfaacc[ds].dfaacc_state)) { /* state is non-accepting */
++num_backing_up;
@@ -96,10 +94,8 @@ void check_for_backing_up (ds, state)
* accset[1 .. nacc] is the list of accepting numbers for the DFA state.
*/
-void check_trailing_context (nfa_states, num_states, accset, nacc)
- int *nfa_states, num_states;
- int *accset;
- int nacc;
+void check_trailing_context (int *nfa_states, int num_states,
+ int *accset, int nacc)
{
register int i, j;
@@ -137,9 +133,7 @@ void check_trailing_context (nfa_states, num_states, accset, nacc)
* and writes a report to the given file.
*/
-void dump_associated_rules (file, ds)
- FILE *file;
- int ds;
+void dump_associated_rules (FILE *file, int ds)
{
register int i, j;
register int num_associated_rules = 0;
@@ -187,9 +181,7 @@ void dump_associated_rules (file, ds)
* is done to the given file.
*/
-void dump_transitions (file, state)
- FILE *file;
- int state[];
+void dump_transitions (FILE *file, int state[])
{
register int i, ec;
int out_char_set[CSIZE];
@@ -235,8 +227,8 @@ void dump_transitions (file, state)
* hashval is the hash value for the dfa corresponding to the state set.
*/
-int *epsclosure (t, ns_addr, accset, nacc_addr, hv_addr)
- int *t, *ns_addr, accset[], *nacc_addr, *hv_addr;
+int *epsclosure (int *t, int *ns_addr, int accset[],
+ int *nacc_addr, int *hv_addr)
{
register int stkpos, ns, tsp;
int numstates = *ns_addr, nacc, hashval, transsym, nfaccnum;
@@ -351,7 +343,7 @@ ADD_STATE(state); \
/* increase_max_dfas - increase the maximum number of DFAs */
-void increase_max_dfas ()
+void increase_max_dfas (void)
{
current_max_dfas += MAX_DFAS_INCREMENT;
@@ -378,7 +370,7 @@ void increase_max_dfas ()
* dfa starts out in state #1.
*/
-void ntod ()
+void ntod (void)
{
int *accset, ds, nacc, newds;
int sym, hashval, numstates, dsize;
@@ -541,20 +533,13 @@ void ntod ()
/* Unless -Ca, declare it "short" because it's a real
* long-shot that that won't be large enough.
*/
- if (gentables)
- out_str_dec
- ("static yyconst %s yy_nxt[][%d] =\n {\n",
- long_align ? "flex_int32_t" : "flex_int16_t",
- num_full_table_rows);
- else {
- out_dec ("#undef YY_NXT_LOLEN\n#define YY_NXT_LOLEN (%d)\n", num_full_table_rows);
- out_str ("static yyconst %s *yy_nxt =0;\n",
- long_align ? "flex_int32_t" : "flex_int16_t");
- }
-
+ if (long_align)
+ out ("m4_define([[M4_YY_NXT_TABLE_32BIT]],1)\n");
+ out_dec ("m4_define([[M4_YY_NXT_TABLE_LOLEN]],[[%d]])\n",
+ num_full_table_rows);
if (gentables)
- outn (" {");
+ out ("m4_define([[M4_YY_NXT_TABLE_DATA]],[[\n/*{*/");
/* Generate 0 entries for state #0. */
for (i = 0; i < num_full_table_rows; ++i) {
@@ -563,8 +548,9 @@ void ntod ()
}
dataflush ();
+
if (gentables)
- outn (" },\n");
+ outn ("/* }*/,");
}
/* Create the first states. */
@@ -720,7 +706,7 @@ void ntod ()
if (gentables)
- outn (" {");
+ outn ("/* {*/");
/* Supply array's 0-element. */
if (ds == end_of_buffer_state) {
@@ -745,7 +731,7 @@ void ntod ()
dataflush ();
if (gentables)
- outn (" },\n");
+ outn ("/* }*/,\n");
}
else if (fullspd)
@@ -778,11 +764,14 @@ void ntod ()
if (fulltbl) {
dataend ();
+ out_dec ("m4_define([[M4_YY_NXT_TABLE_SIZE]],[[/*%d*/]])\n",
+ yynxt_tbl->td_hilen * num_full_table_rows);
+
if (tablesext) {
yytbl_data_compress (yynxt_tbl);
if (yytbl_data_fwrite (&tableswr, yynxt_tbl) < 0)
flexerror (_
- ("Could not write yynxt_tbl[][]"));
+ ("Could not write yynxt_tbl"));
}
if (yynxt_tbl) {
yytbl_data_destroy (yynxt_tbl);
@@ -820,8 +809,8 @@ void ntod ()
* On return, the dfa state number is in newds.
*/
-int snstods (sns, numstates, accset, nacc, hashval, newds_addr)
- int sns[], numstates, accset[], nacc, hashval, *newds_addr;
+int snstods (int sns[], int numstates, int accset[], int nacc,
+ int hashval, int *newds_addr)
{
int didsort = 0;
register int i, j;
@@ -942,8 +931,7 @@ int snstods (sns, numstates, accset, nacc, hashval, newds_addr)
* int transsym, int nset[current_max_dfa_size] );
*/
-int symfollowset (ds, dsize, transsym, nset)
- int ds[], dsize, transsym, nset[];
+int symfollowset (int ds[], int dsize, int transsym, int nset[])
{
int ns, tsp, sym, i, j, lenccl, ch, numstates, ccllist;
@@ -1020,9 +1008,7 @@ int symfollowset (ds, dsize, transsym, nset)
* int symlist[numecs], int duplist[numecs] );
*/
-void sympartition (ds, numstates, symlist, duplist)
- int ds[], numstates;
- int symlist[], duplist[];
+void sympartition (int ds[], int numstates, int symlist[], int duplist[])
{
int tch, i, j, k, ns, dupfwd[CSIZE + 1], lenccl, cclp, ich;