Ansification (Michael Davidsaver)
This commit is contained in:
@@ -50,11 +50,8 @@ static char rcsid[] =
|
||||
* ccladd( cclp, ch );
|
||||
*/
|
||||
|
||||
void ccladd( cclp, ch )
|
||||
int cclp;
|
||||
int ch;
|
||||
|
||||
{
|
||||
void ccladd(int cclp, int ch)
|
||||
{
|
||||
int ind, len, newpos, i;
|
||||
|
||||
len = ccllen[cclp];
|
||||
@@ -89,9 +86,8 @@ int ch;
|
||||
* new_ccl = cclinit();
|
||||
*/
|
||||
|
||||
int cclinit()
|
||||
|
||||
{
|
||||
int cclinit(void)
|
||||
{
|
||||
if ( ++lastccl >= current_maxccls )
|
||||
{
|
||||
current_maxccls += MAX_CCLS_INCREMENT;
|
||||
@@ -129,10 +125,8 @@ int cclinit()
|
||||
* cclnegate( ccl );
|
||||
*/
|
||||
|
||||
void cclnegate( cclp )
|
||||
int cclp;
|
||||
|
||||
{
|
||||
void cclnegate(int cclp)
|
||||
{
|
||||
cclng[cclp] = 1;
|
||||
}
|
||||
|
||||
@@ -149,11 +143,8 @@ int cclp;
|
||||
* has a non-zero value in the set array.
|
||||
*/
|
||||
|
||||
void list_character_set( file, cset )
|
||||
FILE *file;
|
||||
int cset[];
|
||||
|
||||
{
|
||||
void list_character_set(FILE *file, int cset[])
|
||||
{
|
||||
register int i;
|
||||
char *readable_form();
|
||||
|
||||
|
||||
+27
-49
@@ -45,10 +45,10 @@ static char rcsid[] =
|
||||
|
||||
/* 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_backtracking - check a DFA state for backtracking
|
||||
@@ -62,11 +62,8 @@ int symfollowset PROTO((int[], int, int, int[]));
|
||||
* associated with this state
|
||||
*/
|
||||
|
||||
void check_for_backtracking( ds, state )
|
||||
int ds;
|
||||
int state[];
|
||||
|
||||
{
|
||||
void check_for_backtracking(int ds, int state[])
|
||||
{
|
||||
if ( (reject && ! dfaacc[ds].dfaacc_set) || ! dfaacc[ds].dfaacc_state )
|
||||
{ /* state is non-accepting */
|
||||
++num_backtracking;
|
||||
@@ -109,12 +106,8 @@ int 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;
|
||||
register int nacc;
|
||||
|
||||
{
|
||||
void check_trailing_context(int *nfa_states, int num_states, int *accset, register int nacc)
|
||||
{
|
||||
register int i, j;
|
||||
|
||||
for ( i = 1; i <= num_states; ++i )
|
||||
@@ -159,11 +152,8 @@ register int 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;
|
||||
int rule_set[MAX_ASSOC_RULES + 1];
|
||||
@@ -214,11 +204,8 @@ int 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];
|
||||
|
||||
@@ -265,10 +252,8 @@ int 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;
|
||||
int stkend, nstate;
|
||||
@@ -388,9 +373,8 @@ int *t, *ns_addr, accset[], *nacc_addr, *hv_addr;
|
||||
|
||||
/* increase_max_dfas - increase the maximum number of DFAs */
|
||||
|
||||
void increase_max_dfas()
|
||||
|
||||
{
|
||||
void increase_max_dfas(void)
|
||||
{
|
||||
current_max_dfas += MAX_DFAS_INCREMENT;
|
||||
|
||||
++num_reallocs;
|
||||
@@ -417,15 +401,16 @@ 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;
|
||||
int num_full_table_rows; /* used only for -f */
|
||||
int *nset, *dset;
|
||||
int targptr, totaltrans, i, comstate, comfreq, targ;
|
||||
int *epsclosure(), snstods(), symlist[CSIZE + 1];
|
||||
int *epsclosure(int *t, int *ns_addr, int *accset, int *nacc_addr, int *hv_addr);
|
||||
int snstods(int *sns, int numstates, int *accset, int nacc, int hashval, int *newds_addr);
|
||||
int symlist[CSIZE + 1];
|
||||
int num_start_states;
|
||||
int todo_head, todo_next;
|
||||
|
||||
@@ -781,10 +766,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;
|
||||
int newds, *oldsns;
|
||||
@@ -907,10 +890,8 @@ int sns[], numstates, accset[], nacc, hashval, *newds_addr;
|
||||
* numstates = symfollowset( ds, dsize, transsym, nset );
|
||||
*/
|
||||
|
||||
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;
|
||||
int ccllist;
|
||||
|
||||
@@ -993,11 +974,8 @@ bottom:
|
||||
* sympartition( ds, numstates, symlist, duplist );
|
||||
*/
|
||||
|
||||
void sympartition( ds, numstates, symlist, duplist )
|
||||
int ds[], numstates, duplist[];
|
||||
int symlist[];
|
||||
|
||||
{
|
||||
void sympartition(int ds[], int numstates, int symlist[], int duplist[])
|
||||
{
|
||||
int tch, i, j, k, ns, dupfwd[CSIZE + 1], lenccl, cclp, ich;
|
||||
|
||||
/* partitioning is done by creating equivalence classes for those
|
||||
|
||||
+10
-20
@@ -48,9 +48,8 @@ static char rcsid[] =
|
||||
* ccl2ecl();
|
||||
*/
|
||||
|
||||
void ccl2ecl()
|
||||
|
||||
{
|
||||
void ccl2ecl(void)
|
||||
{
|
||||
int i, ich, newlen, cclp, ccls, cclmec;
|
||||
|
||||
for ( i = 1; i <= lastccl; ++i )
|
||||
@@ -119,10 +118,8 @@ void ccl2ecl()
|
||||
* Returned is the number of classes.
|
||||
*/
|
||||
|
||||
int cre8ecs( fwd, bck, num )
|
||||
int fwd[], bck[], num;
|
||||
|
||||
{
|
||||
int cre8ecs(int fwd[], int bck[], int num)
|
||||
{
|
||||
int i, j, numcl;
|
||||
|
||||
numcl = 0;
|
||||
@@ -156,10 +153,8 @@ int fwd[], bck[], num;
|
||||
* Returns the number of equivalence classes used.
|
||||
*/
|
||||
|
||||
int ecs_from_xlation( ecmap )
|
||||
int ecmap[];
|
||||
|
||||
{
|
||||
int ecs_from_xlation(int ecmap[])
|
||||
{
|
||||
int i;
|
||||
int nul_is_alone = false;
|
||||
int did_default_xlation_class = false;
|
||||
@@ -240,11 +235,8 @@ int ecmap[];
|
||||
* NUL_mapping is the value which NUL (0) should be mapped to.
|
||||
*/
|
||||
|
||||
void mkeccl( ccls, lenccl, fwd, bck, llsiz, NUL_mapping )
|
||||
Char ccls[];
|
||||
int lenccl, fwd[], bck[], llsiz, NUL_mapping;
|
||||
|
||||
{
|
||||
void mkeccl(unsigned char ccls[], int lenccl, int fwd[], int bck[], int llsiz, int NUL_mapping)
|
||||
{
|
||||
int cclp, oldec, newec;
|
||||
int cclm, i, j;
|
||||
static unsigned char cclflags[CSIZE]; /* initialized to all '\0' */
|
||||
@@ -339,10 +331,8 @@ next_pt:
|
||||
* mkechar( tch, fwd, bck );
|
||||
*/
|
||||
|
||||
void mkechar( tch, fwd, bck )
|
||||
int tch, fwd[], bck[];
|
||||
|
||||
{
|
||||
void mkechar(int tch, int fwd[], int bck[])
|
||||
{
|
||||
/* if until now the character has been a proper subset of
|
||||
* an equivalence class, break it away to create a new ec
|
||||
*/
|
||||
|
||||
@@ -22,9 +22,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <osfcn.h>
|
||||
|
||||
/* use prototypes in function declarations */
|
||||
#define YY_USE_PROTOS
|
||||
|
||||
/* the "const" storage-class-modifier is valid */
|
||||
#define YY_USE_CONST
|
||||
|
||||
@@ -40,7 +37,6 @@ void free( void* );
|
||||
#include <stdlib.h>
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#define YY_USE_PROTOS
|
||||
#define YY_USE_CONST
|
||||
|
||||
#endif /* __STDC__ */
|
||||
@@ -57,20 +53,6 @@ void free( void* );
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
#define YY_PROTO(proto) proto
|
||||
#else
|
||||
#define YY_PROTO(proto) ()
|
||||
/* we can't get here if it's an ANSI C compiler, or a C++ compiler,
|
||||
* so it's got to be a K&R compiler, and therefore there's no standard
|
||||
* place from which to include these definitions
|
||||
*/
|
||||
char *malloc();
|
||||
int free();
|
||||
int read();
|
||||
#endif
|
||||
|
||||
|
||||
/* amount of stuff to slurp up with each read */
|
||||
#ifndef YY_READ_BUF_SIZE
|
||||
#define YY_READ_BUF_SIZE 8192
|
||||
@@ -150,7 +132,7 @@ int read();
|
||||
/* default declaration of generated scanner - a define so the user can
|
||||
* easily add parameters
|
||||
*/
|
||||
#define YY_DECL int yylex YY_PROTO(( void ))
|
||||
#define YY_DECL int yylex ( void )
|
||||
|
||||
/* code executed at the end of each rule */
|
||||
#define YY_BREAK break;
|
||||
@@ -263,23 +245,23 @@ static int yy_start = 0; /* start state number */
|
||||
*/
|
||||
static int yy_did_buffer_switch_on_eof;
|
||||
|
||||
static yy_state_type yy_get_previous_state YY_PROTO(( void ));
|
||||
static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
|
||||
static int yy_get_next_buffer YY_PROTO(( void ));
|
||||
static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr ));
|
||||
void yyrestart YY_PROTO(( FILE *input_file ));
|
||||
void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
|
||||
void yy_load_buffer_state YY_PROTO(( void ));
|
||||
YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
|
||||
void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
|
||||
void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
|
||||
static yy_state_type yy_get_previous_state ( void );
|
||||
static yy_state_type yy_try_NUL_trans ( yy_state_type current_state );
|
||||
static int yy_get_next_buffer ( void );
|
||||
static void yyunput ( YY_CHAR c, YY_CHAR *buf_ptr );
|
||||
void yyrestart ( FILE *input_file );
|
||||
void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
|
||||
void yy_load_buffer_state ( void );
|
||||
YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
|
||||
void yy_delete_buffer ( YY_BUFFER_STATE b );
|
||||
void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file );
|
||||
|
||||
#define yy_new_buffer yy_create_buffer
|
||||
|
||||
#ifdef __cplusplus
|
||||
static int yyinput YY_PROTO(( void ));
|
||||
static int yyinput ( void );
|
||||
#else
|
||||
static int input YY_PROTO(( void ));
|
||||
static int input ( void );
|
||||
#endif
|
||||
|
||||
YY_DECL
|
||||
@@ -571,13 +553,7 @@ static yy_state_type yy_get_previous_state()
|
||||
* next_state = yy_try_NUL_trans( current_state );
|
||||
*/
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state )
|
||||
#else
|
||||
static yy_state_type yy_try_NUL_trans( yy_current_state )
|
||||
register yy_state_type yy_current_state;
|
||||
#endif
|
||||
|
||||
{
|
||||
register int yy_is_jam;
|
||||
%% code to find the next state, and perhaps do backtracking, goes here
|
||||
@@ -586,14 +562,7 @@ register yy_state_type yy_current_state;
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
|
||||
#else
|
||||
static void yyunput( c, yy_bp )
|
||||
YY_CHAR c;
|
||||
register YY_CHAR *yy_bp;
|
||||
#endif
|
||||
|
||||
{
|
||||
register YY_CHAR *yy_cp = yy_c_buf_p;
|
||||
|
||||
@@ -634,7 +603,7 @@ register YY_CHAR *yy_bp;
|
||||
#ifdef __cplusplus
|
||||
static int yyinput()
|
||||
#else
|
||||
static int input()
|
||||
static int input(void)
|
||||
#endif
|
||||
|
||||
{
|
||||
@@ -699,26 +668,14 @@ static int input()
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yyrestart( FILE *input_file )
|
||||
#else
|
||||
void yyrestart( input_file )
|
||||
FILE *input_file;
|
||||
#endif
|
||||
|
||||
{
|
||||
yy_init_buffer( yy_current_buffer, input_file );
|
||||
yy_load_buffer_state();
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
|
||||
#else
|
||||
void yy_switch_to_buffer( new_buffer )
|
||||
YY_BUFFER_STATE new_buffer;
|
||||
#endif
|
||||
|
||||
{
|
||||
if ( yy_current_buffer == new_buffer )
|
||||
return;
|
||||
@@ -743,12 +700,7 @@ YY_BUFFER_STATE new_buffer;
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yy_load_buffer_state( void )
|
||||
#else
|
||||
void yy_load_buffer_state()
|
||||
#endif
|
||||
|
||||
{
|
||||
yy_n_chars = yy_current_buffer->yy_n_chars;
|
||||
yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
|
||||
@@ -757,14 +709,7 @@ void yy_load_buffer_state()
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
|
||||
#else
|
||||
YY_BUFFER_STATE yy_create_buffer( file, size )
|
||||
FILE *file;
|
||||
int size;
|
||||
#endif
|
||||
|
||||
{
|
||||
YY_BUFFER_STATE b;
|
||||
|
||||
@@ -789,13 +734,7 @@ int size;
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yy_delete_buffer( YY_BUFFER_STATE b )
|
||||
#else
|
||||
void yy_delete_buffer( b )
|
||||
YY_BUFFER_STATE b;
|
||||
#endif
|
||||
|
||||
{
|
||||
if ( b == yy_current_buffer )
|
||||
yy_current_buffer = (YY_BUFFER_STATE) 0;
|
||||
@@ -805,14 +744,7 @@ YY_BUFFER_STATE b;
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
|
||||
#else
|
||||
void yy_init_buffer( b, file )
|
||||
YY_BUFFER_STATE b;
|
||||
FILE *file;
|
||||
#endif
|
||||
|
||||
{
|
||||
b->yy_input_file = file;
|
||||
|
||||
|
||||
@@ -11,9 +11,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* use prototypes in function declarations */
|
||||
#define YY_USE_PROTOS
|
||||
|
||||
/* the "const" storage-class-modifier is valid */
|
||||
#define YY_USE_CONST
|
||||
|
||||
@@ -23,13 +20,6 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
#define YY_PROTO(proto) proto
|
||||
#else
|
||||
#define YY_PROTO(proto) ()
|
||||
#endif
|
||||
|
||||
|
||||
/* amount of stuff to slurp up with each read */
|
||||
#ifndef YY_READ_BUF_SIZE
|
||||
#define YY_READ_BUF_SIZE 8192
|
||||
@@ -60,7 +50,7 @@
|
||||
*/
|
||||
|
||||
/* #define yyterminate() return ( YY_NULL ) replaced by jbk */
|
||||
static int yyterminate_internal( YY_PROTO(void) );
|
||||
static int yyterminate_internal( void );
|
||||
#define yyterminate() return yyterminate_internal()
|
||||
|
||||
/* report a fatal error */
|
||||
@@ -112,7 +102,7 @@ static int yyterminate_internal( YY_PROTO(void) );
|
||||
/* default declaration of generated scanner - a define so the user can
|
||||
* easily add parameters - jbk added the static to YY_DECL
|
||||
*/
|
||||
#define YY_DECL static int yylex YY_PROTO(( void ))
|
||||
#define YY_DECL static int yylex ( void )
|
||||
|
||||
/* code executed at the end of each rule */
|
||||
#define YY_BREAK break;
|
||||
@@ -227,25 +217,25 @@ static int yy_start = 0; /* start state number */
|
||||
*/
|
||||
static int yy_did_buffer_switch_on_eof;
|
||||
|
||||
static yy_state_type yy_get_previous_state YY_PROTO(( void ));
|
||||
static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
|
||||
static int yy_get_next_buffer YY_PROTO(( void ));
|
||||
static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr ));
|
||||
static yy_state_type yy_get_previous_state ( void );
|
||||
static yy_state_type yy_try_NUL_trans ( yy_state_type current_state );
|
||||
static int yy_get_next_buffer ( void );
|
||||
static void yyunput ( YY_CHAR c, YY_CHAR *buf_ptr );
|
||||
|
||||
/* jbk added static in front all these */
|
||||
static void yyrestart YY_PROTO(( FILE *input_file ));
|
||||
static void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
|
||||
static void yy_load_buffer_state YY_PROTO(( void ));
|
||||
static YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
|
||||
static void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
|
||||
static void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
|
||||
static void yyrestart ( FILE *input_file );
|
||||
static void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
|
||||
static void yy_load_buffer_state ( void );
|
||||
static YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
|
||||
static void yy_delete_buffer ( YY_BUFFER_STATE b );
|
||||
static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file );
|
||||
|
||||
#define yy_new_buffer yy_create_buffer
|
||||
|
||||
#ifdef __cplusplus
|
||||
static int yyinput YY_PROTO(( void ));
|
||||
static int yyinput ( void );
|
||||
#else
|
||||
static int input YY_PROTO(( void ));
|
||||
static int input ( void );
|
||||
#endif
|
||||
|
||||
YY_DECL
|
||||
@@ -433,7 +423,7 @@ do_action: /* this label is used only to access EOF actions */
|
||||
* EOB_ACT_END_OF_FILE - end of file
|
||||
*/
|
||||
|
||||
static int yy_get_next_buffer( YY_PROTO(void) )
|
||||
static int yy_get_next_buffer( void )
|
||||
|
||||
{
|
||||
register YY_CHAR *dest = yy_current_buffer->yy_ch_buf;
|
||||
@@ -514,7 +504,7 @@ static int yy_get_next_buffer( YY_PROTO(void) )
|
||||
* yy_state_type yy_get_previous_state();
|
||||
*/
|
||||
|
||||
static yy_state_type yy_get_previous_state( YY_PROTO(void) )
|
||||
static yy_state_type yy_get_previous_state( void )
|
||||
|
||||
{
|
||||
register yy_state_type yy_current_state;
|
||||
@@ -537,13 +527,7 @@ static yy_state_type yy_get_previous_state( YY_PROTO(void) )
|
||||
* next_state = yy_try_NUL_trans( current_state );
|
||||
*/
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state )
|
||||
#else
|
||||
static yy_state_type yy_try_NUL_trans( yy_current_state )
|
||||
register yy_state_type yy_current_state;
|
||||
#endif
|
||||
|
||||
{
|
||||
register int yy_is_jam;
|
||||
%% code to find the next state, and perhaps do backtracking, goes here
|
||||
@@ -552,14 +536,7 @@ register yy_state_type yy_current_state;
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
|
||||
#else
|
||||
static void yyunput( c, yy_bp )
|
||||
YY_CHAR c;
|
||||
register YY_CHAR *yy_bp;
|
||||
#endif
|
||||
|
||||
{
|
||||
register YY_CHAR *yy_cp = yy_c_buf_p;
|
||||
|
||||
@@ -598,9 +575,9 @@ register YY_CHAR *yy_bp;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
static int yyinput( YY_PROTO(void) )
|
||||
static int yyinput( void )
|
||||
#else
|
||||
static int input( YY_PROTO(void) )
|
||||
static int input( void )
|
||||
#endif
|
||||
|
||||
{
|
||||
@@ -666,13 +643,7 @@ static int input( YY_PROTO(void) )
|
||||
|
||||
|
||||
/* jbk added static in front of func */
|
||||
#ifdef YY_USE_PROTOS
|
||||
static void yyrestart( FILE *input_file )
|
||||
#else
|
||||
static void yyrestart( input_file )
|
||||
FILE *input_file;
|
||||
#endif
|
||||
|
||||
{
|
||||
if ( yy_current_buffer )
|
||||
yy_init_buffer( yy_current_buffer, input_file );
|
||||
@@ -684,13 +655,7 @@ FILE *input_file;
|
||||
|
||||
|
||||
/* jbk added static in front of func */
|
||||
#ifdef YY_USE_PROTOS
|
||||
static void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
|
||||
#else
|
||||
static void yy_switch_to_buffer( new_buffer )
|
||||
YY_BUFFER_STATE new_buffer;
|
||||
#endif
|
||||
|
||||
{
|
||||
if ( yy_current_buffer == new_buffer )
|
||||
return;
|
||||
@@ -716,12 +681,7 @@ YY_BUFFER_STATE new_buffer;
|
||||
|
||||
|
||||
/* jbk added static in front of func */
|
||||
#ifdef YY_USE_PROTOS
|
||||
static void yy_load_buffer_state( void )
|
||||
#else
|
||||
static void yy_load_buffer_state()
|
||||
#endif
|
||||
|
||||
{
|
||||
yy_n_chars = yy_current_buffer->yy_n_chars;
|
||||
yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
|
||||
@@ -731,14 +691,7 @@ static void yy_load_buffer_state()
|
||||
|
||||
|
||||
/* jbk added static in front of func */
|
||||
#ifdef YY_USE_PROTOS
|
||||
static YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
|
||||
#else
|
||||
static YY_BUFFER_STATE yy_create_buffer( file, size )
|
||||
FILE *file;
|
||||
int size;
|
||||
#endif
|
||||
|
||||
{
|
||||
YY_BUFFER_STATE b;
|
||||
|
||||
@@ -764,13 +717,7 @@ int size;
|
||||
|
||||
|
||||
/* jbk added static in front of func */
|
||||
#ifdef YY_USE_PROTOS
|
||||
static void yy_delete_buffer( YY_BUFFER_STATE b )
|
||||
#else
|
||||
static void yy_delete_buffer( b )
|
||||
YY_BUFFER_STATE b;
|
||||
#endif
|
||||
|
||||
{
|
||||
if ( b == yy_current_buffer )
|
||||
yy_current_buffer = (YY_BUFFER_STATE) 0;
|
||||
@@ -781,14 +728,7 @@ YY_BUFFER_STATE b;
|
||||
|
||||
|
||||
/* jbk added static in front of func */
|
||||
#ifdef YY_USE_PROTOS
|
||||
static void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
|
||||
#else
|
||||
static void yy_init_buffer( b, file )
|
||||
YY_BUFFER_STATE b;
|
||||
FILE *file;
|
||||
#endif
|
||||
|
||||
{
|
||||
b->yy_input_file = file;
|
||||
|
||||
@@ -811,7 +751,7 @@ FILE *file;
|
||||
b->yy_eof_status = EOF_NOT_SEEN;
|
||||
}
|
||||
|
||||
static int yyterminate_internal( YY_PROTO(void) )
|
||||
static int yyterminate_internal( void )
|
||||
{
|
||||
/* jbk fix - buffer created by yy_create_buffer needs to be freed */
|
||||
yy_delete_buffer(yy_current_buffer);
|
||||
|
||||
@@ -57,15 +57,6 @@
|
||||
#define DEFAULT_CSIZE 128
|
||||
#endif
|
||||
|
||||
#ifndef PROTO
|
||||
#ifdef __STDC__
|
||||
#define PROTO(proto) proto
|
||||
#else
|
||||
#define PROTO(proto) ()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USG
|
||||
#define SYS_V
|
||||
#endif
|
||||
@@ -634,7 +625,8 @@ extern int sectnum, nummt, hshcol, dfaeql, numeps, eps2, num_reallocs;
|
||||
extern int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave;
|
||||
extern int num_backtracking, bol_needed;
|
||||
|
||||
void *allocate_array(), *reallocate_array();
|
||||
void *allocate_array(int size, int element_size);
|
||||
void *reallocate_array(void *array, int size, int element_size);
|
||||
|
||||
#define allocate_integer_array(size) \
|
||||
(int *) allocate_array( size, sizeof( int ) )
|
||||
@@ -685,207 +677,207 @@ extern int yylval;
|
||||
|
||||
/* from file ccl.c */
|
||||
|
||||
extern void ccladd PROTO((int, int)); /* Add a single character to a ccl */
|
||||
extern int cclinit PROTO(()); /* make an empty ccl */
|
||||
extern void cclnegate PROTO((int)); /* negate a ccl */
|
||||
extern void ccladd (int, int); /* Add a single character to a ccl */
|
||||
extern int cclinit (void); /* make an empty ccl */
|
||||
extern void cclnegate (int); /* negate a ccl */
|
||||
|
||||
/* list the members of a set of characters in CCL form */
|
||||
extern void list_character_set PROTO((FILE*, int[]));
|
||||
extern void list_character_set (FILE*, int[]);
|
||||
|
||||
|
||||
/* from file dfa.c */
|
||||
|
||||
/* increase the maximum number of dfas */
|
||||
extern void increase_max_dfas PROTO(());
|
||||
extern void increase_max_dfas (void);
|
||||
|
||||
extern void ntod PROTO(()); /* convert a ndfa to a dfa */
|
||||
extern void ntod (void); /* convert a ndfa to a dfa */
|
||||
|
||||
|
||||
/* from file ecs.c */
|
||||
|
||||
/* convert character classes to set of equivalence classes */
|
||||
extern void ccl2ecl PROTO(());
|
||||
extern void ccl2ecl (void);
|
||||
|
||||
/* associate equivalence class numbers with class members */
|
||||
extern int cre8ecs PROTO((int[], int[], int));
|
||||
extern int cre8ecs (int[], int[], int);
|
||||
|
||||
/* associate equivalence class numbers using %t table */
|
||||
extern int ecs_from_xlation PROTO((int[]));
|
||||
extern int ecs_from_xlation (int[]);
|
||||
|
||||
/* update equivalence classes based on character class transitions */
|
||||
extern void mkeccl PROTO((Char[], int, int[], int[], int, int));
|
||||
extern void mkeccl (Char[], int, int[], int[], int, int);
|
||||
|
||||
/* create equivalence class for single character */
|
||||
extern void mkechar PROTO((int, int[], int[]));
|
||||
extern void mkechar (int, int[], int[]);
|
||||
|
||||
|
||||
/* from file gen.c */
|
||||
|
||||
extern void make_tables PROTO(()); /* generate transition tables */
|
||||
extern void make_tables (void); /* generate transition tables */
|
||||
|
||||
|
||||
/* from file main.c */
|
||||
|
||||
extern void flexend PROTO((int));
|
||||
extern void flexend (int);
|
||||
|
||||
|
||||
/* from file misc.c */
|
||||
|
||||
/* write out the actions from the temporary file to lex.yy.c */
|
||||
extern void action_out PROTO(());
|
||||
extern void action_out (void);
|
||||
|
||||
/* true if a string is all lower case */
|
||||
extern int all_lower PROTO((register Char *));
|
||||
extern int all_lower (register Char *);
|
||||
|
||||
/* true if a string is all upper case */
|
||||
extern int all_upper PROTO((register Char *));
|
||||
extern int all_upper (register Char *);
|
||||
|
||||
/* bubble sort an integer array */
|
||||
extern void bubble PROTO((int [], int));
|
||||
extern void bubble (int [], int);
|
||||
|
||||
/* shell sort a character array */
|
||||
extern void cshell PROTO((Char [], int, int));
|
||||
extern void cshell (Char [], int, int);
|
||||
|
||||
extern void dataend PROTO(()); /* finish up a block of data declarations */
|
||||
extern void dataend (void); /* finish up a block of data declarations */
|
||||
|
||||
/* report an error message and terminate */
|
||||
extern void flexerror PROTO((char[]));
|
||||
extern void flexerror (char[]);
|
||||
|
||||
/* report a fatal error message and terminate */
|
||||
extern void flexfatal PROTO((char[]));
|
||||
extern void flexfatal (char[]);
|
||||
|
||||
/* report an error message formatted with one integer argument */
|
||||
extern void lerrif PROTO((char[], int));
|
||||
extern void lerrif (char[], int);
|
||||
|
||||
/* report an error message formatted with one string argument */
|
||||
extern void lerrsf PROTO((char[], char[]));
|
||||
extern void lerrsf (char[], char[]);
|
||||
|
||||
/* spit out a "# line" statement */
|
||||
extern void line_directive_out PROTO((FILE*));
|
||||
extern void line_directive_out (FILE*);
|
||||
|
||||
/* generate a data statment for a two-dimensional array */
|
||||
extern void mk2data PROTO((int));
|
||||
extern void mk2data (int);
|
||||
|
||||
extern void mkdata PROTO((int)); /* generate a data statement */
|
||||
extern void mkdata (int); /* generate a data statement */
|
||||
|
||||
/* return the integer represented by a string of digits */
|
||||
extern int myctoi PROTO((Char []));
|
||||
extern int myctoi (Char []);
|
||||
|
||||
/* write out one section of the skeleton file */
|
||||
extern void skelout PROTO(());
|
||||
extern void skelout (void);
|
||||
|
||||
/* output a yy_trans_info structure */
|
||||
extern void transition_struct_out PROTO((int, int));
|
||||
extern void transition_struct_out (int, int);
|
||||
|
||||
|
||||
/* from file nfa.c */
|
||||
|
||||
/* add an accepting state to a machine */
|
||||
extern void add_accept PROTO((int, int));
|
||||
extern void add_accept (int, int);
|
||||
|
||||
/* make a given number of copies of a singleton machine */
|
||||
extern int copysingl PROTO((int, int));
|
||||
extern int copysingl (int, int);
|
||||
|
||||
/* debugging routine to write out an nfa */
|
||||
extern void dumpnfa PROTO((int));
|
||||
extern void dumpnfa (int);
|
||||
|
||||
/* finish up the processing for a rule */
|
||||
extern void finish_rule PROTO((int, int, int, int));
|
||||
extern void finish_rule (int, int, int, int);
|
||||
|
||||
/* connect two machines together */
|
||||
extern int link_machines PROTO((int, int));
|
||||
extern int link_machines (int, int);
|
||||
|
||||
/* mark each "beginning" state in a machine as being a "normal" (i.e.,
|
||||
* not trailing context associated) state
|
||||
*/
|
||||
extern void mark_beginning_as_normal PROTO((register int));
|
||||
extern void mark_beginning_as_normal (register int);
|
||||
|
||||
/* make a machine that branches to two machines */
|
||||
extern int mkbranch PROTO((int, int));
|
||||
extern int mkbranch (int, int);
|
||||
|
||||
extern int mkclos PROTO((int)); /* convert a machine into a closure */
|
||||
extern int mkopt PROTO((int)); /* make a machine optional */
|
||||
extern int mkclos (int); /* convert a machine into a closure */
|
||||
extern int mkopt (int); /* make a machine optional */
|
||||
|
||||
/* make a machine that matches either one of two machines */
|
||||
extern int mkor PROTO((int, int));
|
||||
extern int mkor (int, int);
|
||||
|
||||
/* convert a machine into a positive closure */
|
||||
extern int mkposcl PROTO((int));
|
||||
extern int mkposcl (int);
|
||||
|
||||
extern int mkrep PROTO((int, int, int)); /* make a replicated machine */
|
||||
extern int mkrep (int, int, int); /* make a replicated machine */
|
||||
|
||||
/* create a state with a transition on a given symbol */
|
||||
extern int mkstate PROTO((int));
|
||||
extern int mkstate (int);
|
||||
|
||||
extern void new_rule PROTO(()); /* initialize for a new rule */
|
||||
extern void new_rule (void); /* initialize for a new rule */
|
||||
|
||||
|
||||
/* from file parse.y */
|
||||
|
||||
/* write out a message formatted with one string, pinpointing its location */
|
||||
extern void format_pinpoint_message PROTO((char[], char[]));
|
||||
extern void format_pinpoint_message (char[], char[]);
|
||||
|
||||
/* write out a message, pinpointing its location */
|
||||
extern void pinpoint_message PROTO((char[]));
|
||||
extern void pinpoint_message (char[]);
|
||||
|
||||
extern void synerr PROTO((char [])); /* report a syntax error */
|
||||
/* extern int yyparse PROTO(());*/ /* the YACC parser */
|
||||
extern void synerr (char []); /* report a syntax error */
|
||||
/* extern int yyparse ();*/ /* the YACC parser */
|
||||
|
||||
|
||||
/* from file scan.l */
|
||||
|
||||
extern int flexscan PROTO(()); /* the Flex-generated scanner for flex */
|
||||
extern int flexscan (); /* the Flex-generated scanner for flex */
|
||||
|
||||
/* open the given file (if NULL, stdin) for scanning */
|
||||
extern void set_input_file PROTO((char*));
|
||||
extern void set_input_file (char*);
|
||||
|
||||
extern int yywrap PROTO(()); /* wrapup a file in the lexical analyzer */
|
||||
extern int yywrap (); /* wrapup a file in the lexical analyzer */
|
||||
|
||||
|
||||
/* from file sym.c */
|
||||
|
||||
/* save the text of a character class */
|
||||
extern void cclinstal PROTO ((Char [], int));
|
||||
extern void cclinstal (Char [], int);
|
||||
|
||||
/* lookup the number associated with character class */
|
||||
extern int ccllookup PROTO((Char []));
|
||||
extern int ccllookup (Char []);
|
||||
|
||||
extern void ndinstal PROTO((char[], Char[])); /* install a name definition */
|
||||
extern void scinstal PROTO((char[], int)); /* make a start condition */
|
||||
extern void ndinstal (char[], Char[]); /* install a name definition */
|
||||
extern void scinstal (char[], int); /* make a start condition */
|
||||
|
||||
/* lookup the number associated with a start condition */
|
||||
extern int sclookup PROTO((char[]));
|
||||
extern int sclookup (char[]);
|
||||
|
||||
|
||||
/* from file tblcmp.c */
|
||||
|
||||
/* build table entries for dfa state */
|
||||
extern void bldtbl PROTO((int[], int, int, int, int));
|
||||
extern void bldtbl (int[], int, int, int, int);
|
||||
|
||||
extern void cmptmps PROTO(()); /* compress template table entries */
|
||||
extern void inittbl PROTO(()); /* initialize transition tables */
|
||||
extern void mkdeftbl PROTO(()); /* make the default, "jam" table entries */
|
||||
extern void cmptmps (void); /* compress template table entries */
|
||||
extern void inittbl (void); /* initialize transition tables */
|
||||
extern void mkdeftbl (void); /* make the default, "jam" table entries */
|
||||
|
||||
/* create table entries for a state (or state fragment) which has
|
||||
* only one out-transition */
|
||||
extern void mk1tbl PROTO((int, int, int, int));
|
||||
extern void mk1tbl (int, int, int, int);
|
||||
|
||||
/* place a state into full speed transition table */
|
||||
extern void place_state PROTO((int*, int, int));
|
||||
extern void place_state (int*, int, int);
|
||||
|
||||
/* save states with only one out-transition to be processed later */
|
||||
extern void stack1 PROTO((int, int, int, int));
|
||||
extern void stack1 (int, int, int, int);
|
||||
|
||||
|
||||
/* from file yylex.c */
|
||||
|
||||
extern int yylex PROTO(());
|
||||
extern int yylex ();
|
||||
|
||||
|
||||
/* The Unix kernel calls used here */
|
||||
|
||||
extern int read PROTO((int, char*, int));
|
||||
extern int read (int, char*, int);
|
||||
#ifndef _WIN32
|
||||
extern int unlink PROTO((char*));
|
||||
extern int unlink (char*);
|
||||
#endif
|
||||
extern int write PROTO((int, char*, int));
|
||||
extern int write (int, char*, int);
|
||||
|
||||
+36
-56
@@ -45,10 +45,10 @@ static char rcsid[] =
|
||||
|
||||
/* declare functions that have forward references */
|
||||
|
||||
void gen_next_state PROTO((int));
|
||||
void genecs PROTO(());
|
||||
void indent_put2s PROTO((char [], char []));
|
||||
void indent_puts PROTO((char []));
|
||||
void gen_next_state (int);
|
||||
void genecs (void);
|
||||
void indent_put2s (char [], char []);
|
||||
void indent_puts (char []);
|
||||
|
||||
|
||||
static int indent_level = 0; /* each level is 4 spaces */
|
||||
@@ -68,9 +68,8 @@ static char C_state_decl[] =
|
||||
|
||||
/* indent to the current level */
|
||||
|
||||
void do_indent()
|
||||
|
||||
{
|
||||
void do_indent(void)
|
||||
{
|
||||
register int i = indent_level * 4;
|
||||
|
||||
while ( i >= 8 )
|
||||
@@ -89,9 +88,8 @@ void do_indent()
|
||||
|
||||
/* generate the code to keep backtracking information */
|
||||
|
||||
void gen_backtracking()
|
||||
|
||||
{
|
||||
void gen_backtracking(void)
|
||||
{
|
||||
if ( reject || num_backtracking == 0 )
|
||||
return;
|
||||
|
||||
@@ -111,9 +109,8 @@ void gen_backtracking()
|
||||
|
||||
/* generate the code to perform the backtrack */
|
||||
|
||||
void gen_bt_action()
|
||||
|
||||
{
|
||||
void gen_bt_action(void)
|
||||
{
|
||||
if ( reject || num_backtracking == 0 )
|
||||
return;
|
||||
|
||||
@@ -145,9 +142,8 @@ void gen_bt_action()
|
||||
* genctbl();
|
||||
*/
|
||||
|
||||
void genctbl()
|
||||
|
||||
{
|
||||
void genctbl(void)
|
||||
{
|
||||
register int i;
|
||||
int end_of_buffer_action = num_rules + 1;
|
||||
|
||||
@@ -230,9 +226,8 @@ void genctbl()
|
||||
|
||||
/* generate equivalence-class tables */
|
||||
|
||||
void genecs()
|
||||
|
||||
{
|
||||
void genecs(void)
|
||||
{
|
||||
register int i, j;
|
||||
static char C_char_decl[] = "static const %s %s[%d] =\n { 0,\n";
|
||||
int numrows;
|
||||
@@ -279,9 +274,8 @@ void genecs()
|
||||
|
||||
/* generate the code to find the action number */
|
||||
|
||||
void gen_find_action()
|
||||
|
||||
{
|
||||
void gen_find_action(void)
|
||||
{
|
||||
if ( fullspd )
|
||||
indent_puts( "yy_act = yy_current_state[-1].yy_nxt;" );
|
||||
|
||||
@@ -400,9 +394,8 @@ void gen_find_action()
|
||||
* genftbl();
|
||||
*/
|
||||
|
||||
void genftbl()
|
||||
|
||||
{
|
||||
void genftbl(void)
|
||||
{
|
||||
register int i;
|
||||
int end_of_buffer_action = num_rules + 1;
|
||||
|
||||
@@ -434,10 +427,8 @@ void genftbl()
|
||||
|
||||
/* generate the code to find the next compressed-table state */
|
||||
|
||||
void gen_next_compressed_state( char_map )
|
||||
char *char_map;
|
||||
|
||||
{
|
||||
void gen_next_compressed_state(char *char_map)
|
||||
{
|
||||
indent_put2s( "register YY_CHAR yy_c = %s;", char_map );
|
||||
|
||||
/* save the backtracking info \before/ computing the next state
|
||||
@@ -480,9 +471,8 @@ char *char_map;
|
||||
|
||||
/* generate the code to find the next match */
|
||||
|
||||
void gen_next_match()
|
||||
|
||||
{
|
||||
void gen_next_match(void)
|
||||
{
|
||||
/* NOTE - changes in here should be reflected in gen_next_state() and
|
||||
* gen_NUL_trans()
|
||||
*/
|
||||
@@ -576,10 +566,8 @@ void gen_next_match()
|
||||
|
||||
/* generate the code to find the next state */
|
||||
|
||||
void gen_next_state( worry_about_NULs )
|
||||
int worry_about_NULs;
|
||||
|
||||
{ /* NOTE - changes in here should be reflected in get_next_match() */
|
||||
void gen_next_state(int worry_about_NULs)
|
||||
{ /* NOTE - changes in here should be reflected in get_next_match() */
|
||||
char char_map[256];
|
||||
|
||||
if ( worry_about_NULs && ! nultrans )
|
||||
@@ -635,9 +623,8 @@ int worry_about_NULs;
|
||||
|
||||
/* generate the code to make a NUL transition */
|
||||
|
||||
void gen_NUL_trans()
|
||||
|
||||
{ /* NOTE - changes in here should be reflected in get_next_match() */
|
||||
void gen_NUL_trans(void)
|
||||
{ /* NOTE - changes in here should be reflected in get_next_match() */
|
||||
int need_backtracking = (num_backtracking > 0 && ! reject);
|
||||
|
||||
if ( need_backtracking )
|
||||
@@ -711,9 +698,8 @@ void gen_NUL_trans()
|
||||
|
||||
/* generate the code to find the start state */
|
||||
|
||||
void gen_start_state()
|
||||
|
||||
{
|
||||
void gen_start_state(void)
|
||||
{
|
||||
if ( fullspd )
|
||||
indent_put2s( "yy_current_state = yy_start_state_list[yy_start%s];",
|
||||
bol_needed ? " + (yy_bp[-1] == '\\n' ? 1 : 0)" : "" );
|
||||
@@ -746,9 +732,8 @@ void gen_start_state()
|
||||
* gentabs();
|
||||
*/
|
||||
|
||||
void gentabs()
|
||||
|
||||
{
|
||||
void gentabs(void)
|
||||
{
|
||||
int i, j, k, *accset, nacc, *acc_array, total_states;
|
||||
int end_of_buffer_action = num_rules + 1;
|
||||
|
||||
@@ -985,10 +970,8 @@ void gentabs()
|
||||
* current indentation level, adding a final newline
|
||||
*/
|
||||
|
||||
void indent_put2s( fmt, arg )
|
||||
char fmt[], arg[];
|
||||
|
||||
{
|
||||
void indent_put2s(char *fmt, char *arg)
|
||||
{
|
||||
do_indent();
|
||||
printf( fmt, arg );
|
||||
putchar( '\n' );
|
||||
@@ -999,10 +982,8 @@ char fmt[], arg[];
|
||||
* newline
|
||||
*/
|
||||
|
||||
void indent_puts( str )
|
||||
char str[];
|
||||
|
||||
{
|
||||
void indent_puts(char *str)
|
||||
{
|
||||
do_indent();
|
||||
puts( str );
|
||||
}
|
||||
@@ -1016,9 +997,8 @@ char str[];
|
||||
* Generates transition tables and finishes generating output file
|
||||
*/
|
||||
|
||||
void make_tables()
|
||||
|
||||
{
|
||||
void make_tables(void)
|
||||
{
|
||||
register int i;
|
||||
int did_eof_rule = false;
|
||||
|
||||
|
||||
@@ -57,9 +57,9 @@ static char flex_version[] = "2.3";
|
||||
|
||||
/* declare functions that have forward references */
|
||||
|
||||
void flexinit PROTO((int, char**));
|
||||
void readin PROTO(());
|
||||
void set_up_initial_allocations PROTO(());
|
||||
void flexinit (int, char**);
|
||||
void readin ();
|
||||
void set_up_initial_allocations ();
|
||||
|
||||
|
||||
/* these globals are all defined and commented in flexdef.h */
|
||||
|
||||
+60
-114
@@ -53,8 +53,8 @@ static char rcsid[] =
|
||||
|
||||
/* declare functions that have forward references */
|
||||
|
||||
void dataflush PROTO(());
|
||||
int otoi PROTO((Char []));
|
||||
void dataflush (void);
|
||||
int otoi (Char []);
|
||||
|
||||
|
||||
/* action_out - write the actions from the temporary file to lex.yy.c
|
||||
@@ -65,9 +65,8 @@ int otoi PROTO((Char []));
|
||||
* Copies the action file up to %% (or end-of-file) to lex.yy.c
|
||||
*/
|
||||
|
||||
void action_out()
|
||||
|
||||
{
|
||||
void action_out(void)
|
||||
{
|
||||
char buf[MAXLINE];
|
||||
|
||||
while ( fgets( buf, MAXLINE, temp_action_file ) != NULL )
|
||||
@@ -80,10 +79,8 @@ void action_out()
|
||||
|
||||
/* allocate_array - allocate memory for an integer array of the given size */
|
||||
|
||||
void *allocate_array( size, element_size )
|
||||
int size, element_size;
|
||||
|
||||
{
|
||||
void *allocate_array(int size, int element_size)
|
||||
{
|
||||
register void *mem;
|
||||
|
||||
/* on 16-bit int machines (e.g., 80286) we might be trying to
|
||||
@@ -110,10 +107,8 @@ int size, element_size;
|
||||
* true/false = all_lower( str );
|
||||
*/
|
||||
|
||||
int all_lower( str )
|
||||
register Char *str;
|
||||
|
||||
{
|
||||
int all_lower(register Char *str)
|
||||
{
|
||||
while ( *str )
|
||||
{
|
||||
if ( ! isascii( *str ) || ! islower( *str ) )
|
||||
@@ -133,10 +128,8 @@ register Char *str;
|
||||
* true/false = all_upper( str );
|
||||
*/
|
||||
|
||||
int all_upper( str )
|
||||
register Char *str;
|
||||
|
||||
{
|
||||
int all_upper(register Char *str)
|
||||
{
|
||||
while ( *str )
|
||||
{
|
||||
if ( ! isascii( *str ) || ! isupper( (char) *str ) )
|
||||
@@ -162,10 +155,8 @@ register Char *str;
|
||||
* v - the array to be sorted
|
||||
* n - the number of elements of 'v' to be sorted */
|
||||
|
||||
void bubble( v, n )
|
||||
int v[], n;
|
||||
|
||||
{
|
||||
void bubble(int v[], int n)
|
||||
{
|
||||
register int i, j, k;
|
||||
|
||||
for ( i = n; i > 1; --i )
|
||||
@@ -187,10 +178,8 @@ int v[], n;
|
||||
* c = clower( c );
|
||||
*/
|
||||
|
||||
Char clower( c )
|
||||
register int c;
|
||||
|
||||
{
|
||||
Char clower(register int c)
|
||||
{
|
||||
return ( (isascii( c ) && isupper( c )) ? tolower( c ) : c );
|
||||
}
|
||||
|
||||
@@ -202,10 +191,8 @@ register int c;
|
||||
* copy = copy_string( str );
|
||||
*/
|
||||
|
||||
char *copy_string( str )
|
||||
register char *str;
|
||||
|
||||
{
|
||||
char *copy_string(register char *str)
|
||||
{
|
||||
register char *c;
|
||||
char *copy;
|
||||
|
||||
@@ -233,10 +220,8 @@ register char *str;
|
||||
* copy = copy_unsigned_string( str );
|
||||
*/
|
||||
|
||||
Char *copy_unsigned_string( str )
|
||||
register Char *str;
|
||||
|
||||
{
|
||||
Char *copy_unsigned_string(register Char *str)
|
||||
{
|
||||
register Char *c;
|
||||
Char *copy;
|
||||
|
||||
@@ -274,11 +259,8 @@ register Char *str;
|
||||
* n - number of elements of v to be sorted
|
||||
*/
|
||||
|
||||
void cshell( v, n, special_case_0 )
|
||||
Char v[];
|
||||
int n, special_case_0;
|
||||
|
||||
{
|
||||
void cshell(Char *v, int n, int special_case_0)
|
||||
{
|
||||
int gap, i, j, jg;
|
||||
Char k;
|
||||
|
||||
@@ -313,9 +295,8 @@ int n, special_case_0;
|
||||
* dataend();
|
||||
*/
|
||||
|
||||
void dataend()
|
||||
|
||||
{
|
||||
void dataend(void)
|
||||
{
|
||||
if ( datapos > 0 )
|
||||
dataflush();
|
||||
|
||||
@@ -334,9 +315,8 @@ void dataend()
|
||||
* dataflush();
|
||||
*/
|
||||
|
||||
void dataflush()
|
||||
|
||||
{
|
||||
void dataflush(void)
|
||||
{
|
||||
putchar( '\n' );
|
||||
|
||||
if ( ++dataline >= NUMDATALINES )
|
||||
@@ -360,10 +340,8 @@ void dataflush()
|
||||
* flexerror( msg );
|
||||
*/
|
||||
|
||||
void flexerror( msg )
|
||||
char msg[];
|
||||
|
||||
{
|
||||
void flexerror(char *msg)
|
||||
{
|
||||
fprintf( stderr, "%s: %s\n", program_name, msg );
|
||||
|
||||
flexend( 1 );
|
||||
@@ -377,10 +355,8 @@ char msg[];
|
||||
* flexfatal( msg );
|
||||
*/
|
||||
|
||||
void flexfatal( msg )
|
||||
char msg[];
|
||||
|
||||
{
|
||||
void flexfatal(char *msg)
|
||||
{
|
||||
fprintf( stderr, "%s: fatal internal error, %s\n", program_name, msg );
|
||||
flexend( 1 );
|
||||
}
|
||||
@@ -412,11 +388,10 @@ char msg[];
|
||||
typedef long time_t;
|
||||
#endif
|
||||
|
||||
char *flex_gettime()
|
||||
|
||||
{
|
||||
time_t t, time();
|
||||
char *result, *ctime(), *copy_string();
|
||||
char *flex_gettime(void)
|
||||
{
|
||||
time_t t, time(time_t *);
|
||||
char *result, *ctime(const time_t *), *copy_string(register char *str);
|
||||
|
||||
t = time( (long *) 0 );
|
||||
|
||||
@@ -437,11 +412,8 @@ char *flex_gettime()
|
||||
* lerrif( msg, arg );
|
||||
*/
|
||||
|
||||
void lerrif( msg, arg )
|
||||
char msg[];
|
||||
int arg;
|
||||
|
||||
{
|
||||
void lerrif(char *msg, int arg)
|
||||
{
|
||||
char errmsg[MAXLINE];
|
||||
(void) sprintf( errmsg, msg, arg );
|
||||
flexerror( errmsg );
|
||||
@@ -455,10 +427,8 @@ int arg;
|
||||
* lerrsf( msg, arg );
|
||||
*/
|
||||
|
||||
void lerrsf( msg, arg )
|
||||
char msg[], arg[];
|
||||
|
||||
{
|
||||
void lerrsf(char *msg, char *arg)
|
||||
{
|
||||
char errmsg[MAXLINE];
|
||||
|
||||
(void) sprintf( errmsg, msg, arg );
|
||||
@@ -474,10 +444,8 @@ char msg[], arg[];
|
||||
* val = htoi( str );
|
||||
*/
|
||||
|
||||
int htoi( str )
|
||||
Char str[];
|
||||
|
||||
{
|
||||
int htoi(unsigned char *str)
|
||||
{
|
||||
int result;
|
||||
|
||||
(void) sscanf( (char *) str, "%x", &result );
|
||||
@@ -495,10 +463,8 @@ Char str[];
|
||||
* val = is_hex_digit( ch );
|
||||
*/
|
||||
|
||||
int is_hex_digit( ch )
|
||||
int ch;
|
||||
|
||||
{
|
||||
int is_hex_digit(int ch)
|
||||
{
|
||||
if ( isdigit( ch ) )
|
||||
return ( 1 );
|
||||
|
||||
@@ -520,10 +486,8 @@ int ch;
|
||||
|
||||
/* line_directive_out - spit out a "# line" statement */
|
||||
|
||||
void line_directive_out( output_file_name )
|
||||
FILE *output_file_name;
|
||||
|
||||
{
|
||||
void line_directive_out(FILE *output_file_name)
|
||||
{
|
||||
if ( infilename && gen_line_dirs )
|
||||
fprintf( output_file_name, "# line %d \"%s\"\n", linenum, infilename );
|
||||
}
|
||||
@@ -537,10 +501,8 @@ FILE *output_file_name;
|
||||
*
|
||||
* generates a data statement initializing the current 2-D array to "value"
|
||||
*/
|
||||
void mk2data( value )
|
||||
int value;
|
||||
|
||||
{
|
||||
void mk2data(int value)
|
||||
{
|
||||
if ( datapos >= NUMDATAITEMS )
|
||||
{
|
||||
putchar( ',' );
|
||||
@@ -569,10 +531,8 @@ int value;
|
||||
* generates a data statement initializing the current array element to
|
||||
* "value"
|
||||
*/
|
||||
void mkdata( value )
|
||||
int value;
|
||||
|
||||
{
|
||||
void mkdata(int value)
|
||||
{
|
||||
if ( datapos >= NUMDATAITEMS )
|
||||
{
|
||||
putchar( ',' );
|
||||
@@ -601,10 +561,8 @@ int value;
|
||||
*
|
||||
*/
|
||||
|
||||
int myctoi( array )
|
||||
Char array[];
|
||||
|
||||
{
|
||||
int myctoi(Char *array)
|
||||
{
|
||||
int val = 0;
|
||||
|
||||
(void) sscanf( (char *) array, "%d", &val );
|
||||
@@ -621,10 +579,8 @@ Char array[];
|
||||
*
|
||||
*/
|
||||
|
||||
Char myesc( array )
|
||||
Char array[];
|
||||
|
||||
{
|
||||
Char myesc(Char *array)
|
||||
{
|
||||
Char c, esc_char;
|
||||
register int sptr;
|
||||
|
||||
@@ -710,10 +666,8 @@ Char array[];
|
||||
* val = otoi( str );
|
||||
*/
|
||||
|
||||
int otoi( str )
|
||||
Char str[];
|
||||
|
||||
{
|
||||
int otoi(Char *str)
|
||||
{
|
||||
int result;
|
||||
|
||||
(void) sscanf( (char *) str, "%o", &result );
|
||||
@@ -732,10 +686,8 @@ Char str[];
|
||||
* The returned string is in static storage.
|
||||
*/
|
||||
|
||||
char *readable_form( c )
|
||||
register int c;
|
||||
|
||||
{
|
||||
char *readable_form(register int c)
|
||||
{
|
||||
static char rform[10];
|
||||
|
||||
if ( (c >= 0 && c < 32) || c >= 127 )
|
||||
@@ -769,11 +721,8 @@ register int c;
|
||||
|
||||
/* reallocate_array - increase the size of a dynamic array */
|
||||
|
||||
void *reallocate_array( array, size, element_size )
|
||||
void *array;
|
||||
int size, element_size;
|
||||
|
||||
{
|
||||
void *reallocate_array(void *array, int size, int element_size)
|
||||
{
|
||||
register void *new_array;
|
||||
|
||||
/* same worry as in allocate_array(): */
|
||||
@@ -799,9 +748,8 @@ int size, element_size;
|
||||
* Copies from skelfile to stdout until a line beginning with "%%" or
|
||||
* EOF is found.
|
||||
*/
|
||||
void skelout()
|
||||
|
||||
{
|
||||
void skelout(void)
|
||||
{
|
||||
char buf[MAXLINE];
|
||||
|
||||
while ( fgets( buf, MAXLINE, skelfile ) != NULL )
|
||||
@@ -822,10 +770,8 @@ void skelout()
|
||||
* element_n. Formats the output with spaces and carriage returns.
|
||||
*/
|
||||
|
||||
void transition_struct_out( element_v, element_n )
|
||||
int element_v, element_n;
|
||||
|
||||
{
|
||||
void transition_struct_out(int element_v, int element_n)
|
||||
{
|
||||
printf( "%7d, %5d,", element_v, element_n );
|
||||
|
||||
datapos += TRANS_STRUCT_PRINT_LENGTH;
|
||||
|
||||
+34
-65
@@ -45,8 +45,8 @@ static char rcsid[] =
|
||||
|
||||
/* declare functions that have forward references */
|
||||
|
||||
int dupmachine PROTO((int));
|
||||
void mkxtion PROTO((int, int));
|
||||
int dupmachine (int);
|
||||
void mkxtion (int, int);
|
||||
|
||||
|
||||
/* add_accept - add an accepting state to a machine
|
||||
@@ -58,10 +58,8 @@ void mkxtion PROTO((int, int));
|
||||
* accepting_number becomes mach's accepting number.
|
||||
*/
|
||||
|
||||
void add_accept( mach, accepting_number )
|
||||
int mach, accepting_number;
|
||||
|
||||
{
|
||||
void add_accept(int mach, int accepting_number)
|
||||
{
|
||||
/* hang the accepting number off an epsilon state. if it is associated
|
||||
* with a state that has a non-epsilon out-transition, then the state
|
||||
* will accept BEFORE it makes that transition, i.e., one character
|
||||
@@ -91,10 +89,8 @@ int mach, accepting_number;
|
||||
* num - the number of copies of singl to be present in newsng
|
||||
*/
|
||||
|
||||
int copysingl( singl, num )
|
||||
int singl, num;
|
||||
|
||||
{
|
||||
int copysingl(int singl, int num)
|
||||
{
|
||||
int copy, i;
|
||||
|
||||
copy = mkstate( SYM_EPSILON );
|
||||
@@ -113,10 +109,8 @@ int singl, num;
|
||||
* dumpnfa( state1 );
|
||||
*/
|
||||
|
||||
void dumpnfa( state1 )
|
||||
int state1;
|
||||
|
||||
{
|
||||
void dumpnfa(int state1)
|
||||
{
|
||||
int sym, tsp1, tsp2, anum, ns;
|
||||
|
||||
fprintf( stderr, "\n\n********** beginning dump of nfa with start state %d\n",
|
||||
@@ -167,10 +161,8 @@ int state1;
|
||||
* states accessible by the arrays firstst and lastst
|
||||
*/
|
||||
|
||||
int dupmachine( mach )
|
||||
int mach;
|
||||
|
||||
{
|
||||
int dupmachine(int mach)
|
||||
{
|
||||
int i, init, state_offset;
|
||||
int state = 0;
|
||||
int last = lastst[mach];
|
||||
@@ -220,10 +212,8 @@ int mach;
|
||||
* context has variable length.
|
||||
*/
|
||||
|
||||
void finish_rule( mach, variable_trail_rule, headcnt, trailcnt )
|
||||
int mach, variable_trail_rule, headcnt, trailcnt;
|
||||
|
||||
{
|
||||
void finish_rule(int mach, int variable_trail_rule, int headcnt, int trailcnt)
|
||||
{
|
||||
add_accept( mach, num_rules );
|
||||
|
||||
/* we did this in new_rule(), but it often gets the wrong
|
||||
@@ -296,10 +286,8 @@ int mach, variable_trail_rule, headcnt, trailcnt;
|
||||
* FIRST is set to new by the operation. last is unmolested.
|
||||
*/
|
||||
|
||||
int link_machines( first, last )
|
||||
int first, last;
|
||||
|
||||
{
|
||||
int link_machines(int first, int last)
|
||||
{
|
||||
if ( first == NIL )
|
||||
return ( last );
|
||||
|
||||
@@ -331,10 +319,8 @@ int first, last;
|
||||
* The "beginning" states are the epsilon closure of the first state
|
||||
*/
|
||||
|
||||
void mark_beginning_as_normal( mach )
|
||||
register int mach;
|
||||
|
||||
{
|
||||
void mark_beginning_as_normal(register int mach)
|
||||
{
|
||||
switch ( state_type[mach] )
|
||||
{
|
||||
case STATE_NORMAL:
|
||||
@@ -375,10 +361,8 @@ register int mach;
|
||||
* more mkbranch's. Compare with mkor()
|
||||
*/
|
||||
|
||||
int mkbranch( first, second )
|
||||
int first, second;
|
||||
|
||||
{
|
||||
int mkbranch(int first, int second)
|
||||
{
|
||||
int eps;
|
||||
|
||||
if ( first == NO_TRANSITION )
|
||||
@@ -404,10 +388,8 @@ int first, second;
|
||||
* new - a new state which matches the closure of "state"
|
||||
*/
|
||||
|
||||
int mkclos( state )
|
||||
int state;
|
||||
|
||||
{
|
||||
int mkclos(int state)
|
||||
{
|
||||
return ( mkopt( mkposcl( state ) ) );
|
||||
}
|
||||
|
||||
@@ -426,10 +408,8 @@ int state;
|
||||
* 2. mach is destroyed by the call
|
||||
*/
|
||||
|
||||
int mkopt( mach )
|
||||
int mach;
|
||||
|
||||
{
|
||||
int mkopt(int mach)
|
||||
{
|
||||
int eps;
|
||||
|
||||
if ( ! SUPER_FREE_EPSILON(finalst[mach]) )
|
||||
@@ -465,10 +445,8 @@ int mach;
|
||||
* the number of epsilon states needed
|
||||
*/
|
||||
|
||||
int mkor( first, second )
|
||||
int first, second;
|
||||
|
||||
{
|
||||
int mkor(int first, int second)
|
||||
{
|
||||
int eps, orend;
|
||||
|
||||
if ( first == NIL )
|
||||
@@ -526,10 +504,8 @@ int first, second;
|
||||
* new - a machine matching the positive closure of "state"
|
||||
*/
|
||||
|
||||
int mkposcl( state )
|
||||
int state;
|
||||
|
||||
{
|
||||
int mkposcl(int state)
|
||||
{
|
||||
int eps;
|
||||
|
||||
if ( SUPER_FREE_EPSILON(finalst[state]) )
|
||||
@@ -559,10 +535,8 @@ int state;
|
||||
* if "ub" is INFINITY then "new" matches "lb" or more occurrences of "mach"
|
||||
*/
|
||||
|
||||
int mkrep( mach, lb, ub )
|
||||
int mach, lb, ub;
|
||||
|
||||
{
|
||||
int mkrep(int mach, int lb, int ub)
|
||||
{
|
||||
int base_mach, tail, copy, i;
|
||||
|
||||
base_mach = copysingl( mach, lb - 1 );
|
||||
@@ -607,10 +581,8 @@ int mach, lb, ub;
|
||||
* that it admittedly is)
|
||||
*/
|
||||
|
||||
int mkstate( sym )
|
||||
int sym;
|
||||
|
||||
{
|
||||
int mkstate(int sym)
|
||||
{
|
||||
if ( ++lastnfa >= current_mns )
|
||||
{
|
||||
if ( (current_mns += MNS_INCREMENT) >= MAXIMUM_MNS )
|
||||
@@ -679,10 +651,8 @@ int sym;
|
||||
* stateto - the state to which the transition is to be made
|
||||
*/
|
||||
|
||||
void mkxtion( statefrom, stateto )
|
||||
int statefrom, stateto;
|
||||
|
||||
{
|
||||
void mkxtion(int statefrom, int stateto)
|
||||
{
|
||||
if ( trans1[statefrom] == NO_TRANSITION )
|
||||
trans1[statefrom] = stateto;
|
||||
|
||||
@@ -707,9 +677,8 @@ int statefrom, stateto;
|
||||
* arrays (such as rule_type[]) are grown as needed.
|
||||
*/
|
||||
|
||||
void new_rule()
|
||||
|
||||
{
|
||||
void new_rule(void)
|
||||
{
|
||||
if ( ++num_rules >= current_max_rules )
|
||||
{
|
||||
++num_reallocs;
|
||||
|
||||
+14
-82
@@ -22,9 +22,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <osfcn.h>
|
||||
|
||||
/* use prototypes in function declarations */
|
||||
#define YY_USE_PROTOS
|
||||
|
||||
/* the "const" storage-class-modifier is valid */
|
||||
#define YY_USE_CONST
|
||||
|
||||
@@ -40,7 +37,6 @@ void free( void* );
|
||||
#include <stdlib.h>
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#define YY_USE_PROTOS
|
||||
#define YY_USE_CONST
|
||||
|
||||
#endif /* __STDC__ */
|
||||
@@ -57,20 +53,6 @@ void free( void* );
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
#define YY_PROTO(proto) proto
|
||||
#else
|
||||
#define YY_PROTO(proto) ()
|
||||
/* we can't get here if it's an ANSI C compiler, or a C++ compiler,
|
||||
* so it's got to be a K&R compiler, and therefore there's no standard
|
||||
* place from which to include these definitions
|
||||
*/
|
||||
char *malloc();
|
||||
int free();
|
||||
int read();
|
||||
#endif
|
||||
|
||||
|
||||
/* amount of stuff to slurp up with each read */
|
||||
#ifndef YY_READ_BUF_SIZE
|
||||
#define YY_READ_BUF_SIZE 8192
|
||||
@@ -150,7 +132,7 @@ int read();
|
||||
/* default declaration of generated scanner - a define so the user can
|
||||
* easily add parameters
|
||||
*/
|
||||
#define YY_DECL int yylex YY_PROTO(( void ))
|
||||
#define YY_DECL int yylex ( void )
|
||||
|
||||
/* code executed at the end of each rule */
|
||||
#define YY_BREAK break;
|
||||
@@ -985,23 +967,23 @@ static int yy_start = 0; /* start state number */
|
||||
*/
|
||||
static int yy_did_buffer_switch_on_eof;
|
||||
|
||||
static yy_state_type yy_get_previous_state YY_PROTO(( void ));
|
||||
static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
|
||||
static int yy_get_next_buffer YY_PROTO(( void ));
|
||||
static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr ));
|
||||
void yyrestart YY_PROTO(( FILE *input_file ));
|
||||
void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
|
||||
void yy_load_buffer_state YY_PROTO(( void ));
|
||||
YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
|
||||
void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
|
||||
void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
|
||||
static yy_state_type yy_get_previous_state ( void );
|
||||
static yy_state_type yy_try_NUL_trans ( yy_state_type current_state );
|
||||
static int yy_get_next_buffer ( void );
|
||||
static void yyunput ( YY_CHAR c, YY_CHAR *buf_ptr );
|
||||
void yyrestart ( FILE *input_file );
|
||||
void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
|
||||
void yy_load_buffer_state ( void );
|
||||
YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
|
||||
void yy_delete_buffer ( YY_BUFFER_STATE b );
|
||||
void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file );
|
||||
|
||||
#define yy_new_buffer yy_create_buffer
|
||||
|
||||
#ifdef __cplusplus
|
||||
static int yyinput YY_PROTO(( void ));
|
||||
static int yyinput ( void );
|
||||
#else
|
||||
static int input YY_PROTO(( void ));
|
||||
static int input ( void );
|
||||
#endif
|
||||
|
||||
YY_DECL
|
||||
@@ -2103,13 +2085,7 @@ static yy_state_type yy_get_previous_state()
|
||||
* next_state = yy_try_NUL_trans( current_state );
|
||||
*/
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state )
|
||||
#else
|
||||
static yy_state_type yy_try_NUL_trans( yy_current_state )
|
||||
register yy_state_type yy_current_state;
|
||||
#endif
|
||||
|
||||
{
|
||||
register int yy_is_jam;
|
||||
|
||||
@@ -2128,14 +2104,7 @@ register yy_state_type yy_current_state;
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp )
|
||||
#else
|
||||
static void yyunput( c, yy_bp )
|
||||
YY_CHAR c;
|
||||
register YY_CHAR *yy_bp;
|
||||
#endif
|
||||
|
||||
{
|
||||
register YY_CHAR *yy_cp = yy_c_buf_p;
|
||||
|
||||
@@ -2176,7 +2145,7 @@ register YY_CHAR *yy_bp;
|
||||
#ifdef __cplusplus
|
||||
static int yyinput()
|
||||
#else
|
||||
static int input()
|
||||
static int input(void)
|
||||
#endif
|
||||
|
||||
{
|
||||
@@ -2241,26 +2210,14 @@ static int input()
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yyrestart( FILE *input_file )
|
||||
#else
|
||||
void yyrestart( input_file )
|
||||
FILE *input_file;
|
||||
#endif
|
||||
|
||||
{
|
||||
yy_init_buffer( yy_current_buffer, input_file );
|
||||
yy_load_buffer_state();
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
|
||||
#else
|
||||
void yy_switch_to_buffer( new_buffer )
|
||||
YY_BUFFER_STATE new_buffer;
|
||||
#endif
|
||||
|
||||
{
|
||||
if ( yy_current_buffer == new_buffer )
|
||||
return;
|
||||
@@ -2285,12 +2242,7 @@ YY_BUFFER_STATE new_buffer;
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yy_load_buffer_state( void )
|
||||
#else
|
||||
void yy_load_buffer_state()
|
||||
#endif
|
||||
|
||||
{
|
||||
yy_n_chars = yy_current_buffer->yy_n_chars;
|
||||
yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
|
||||
@@ -2299,14 +2251,7 @@ void yy_load_buffer_state()
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
|
||||
#else
|
||||
YY_BUFFER_STATE yy_create_buffer( file, size )
|
||||
FILE *file;
|
||||
int size;
|
||||
#endif
|
||||
|
||||
{
|
||||
YY_BUFFER_STATE b;
|
||||
|
||||
@@ -2331,13 +2276,7 @@ int size;
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yy_delete_buffer( YY_BUFFER_STATE b )
|
||||
#else
|
||||
void yy_delete_buffer( b )
|
||||
YY_BUFFER_STATE b;
|
||||
#endif
|
||||
|
||||
{
|
||||
if ( b == yy_current_buffer )
|
||||
yy_current_buffer = (YY_BUFFER_STATE) 0;
|
||||
@@ -2347,14 +2286,7 @@ YY_BUFFER_STATE b;
|
||||
}
|
||||
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
|
||||
#else
|
||||
void yy_init_buffer( b, file )
|
||||
YY_BUFFER_STATE b;
|
||||
FILE *file;
|
||||
#endif
|
||||
|
||||
{
|
||||
b->yy_input_file = file;
|
||||
|
||||
|
||||
+20
-48
@@ -45,14 +45,14 @@ static char rcsid[] =
|
||||
|
||||
/* declare functions that have forward references */
|
||||
|
||||
int hashfunct PROTO((register char[], int));
|
||||
int hashfunct (register char[], int);
|
||||
|
||||
|
||||
struct hash_entry *ndtbl[NAME_TABLE_HASH_SIZE];
|
||||
struct hash_entry *sctbl[START_COND_HASH_SIZE];
|
||||
struct hash_entry *ccltab[CCL_HASH_SIZE];
|
||||
|
||||
struct hash_entry *findsym();
|
||||
struct hash_entry *findsym(register char *sym, struct hash_entry **table, int table_size);
|
||||
|
||||
|
||||
/* addsym - add symbol and definitions to symbol table
|
||||
@@ -67,14 +67,8 @@ struct hash_entry *findsym();
|
||||
* -1 is returned if the symbol already exists, and the change not made.
|
||||
*/
|
||||
|
||||
int addsym( sym, str_def, int_def, table, table_size )
|
||||
register char sym[];
|
||||
char *str_def;
|
||||
int int_def;
|
||||
hash_table table;
|
||||
int table_size;
|
||||
|
||||
{
|
||||
int addsym(register char *sym, char *str_def, int int_def, struct hash_entry **table, int table_size)
|
||||
{
|
||||
int hash_val = hashfunct( sym, table_size );
|
||||
register struct hash_entry *sym_entry = table[hash_val];
|
||||
register struct hash_entry *new_entry;
|
||||
@@ -123,11 +117,8 @@ int table_size;
|
||||
* cclinstal( ccltxt, cclnum );
|
||||
*/
|
||||
|
||||
void cclinstal( ccltxt, cclnum )
|
||||
Char ccltxt[];
|
||||
int cclnum;
|
||||
|
||||
{
|
||||
void cclinstal(Char *ccltxt, int cclnum)
|
||||
{
|
||||
/* we don't bother checking the return status because we are not called
|
||||
* unless the symbol is new
|
||||
*/
|
||||
@@ -146,10 +137,8 @@ int cclnum;
|
||||
* cclval/0 = ccllookup( ccltxt );
|
||||
*/
|
||||
|
||||
int ccllookup( ccltxt )
|
||||
Char ccltxt[];
|
||||
|
||||
{
|
||||
int ccllookup(Char *ccltxt)
|
||||
{
|
||||
return ( findsym( (char *) ccltxt, ccltab, CCL_HASH_SIZE )->int_val );
|
||||
}
|
||||
|
||||
@@ -164,12 +153,8 @@ Char ccltxt[];
|
||||
* sym_entry = findsym( sym, table, table_size );
|
||||
*/
|
||||
|
||||
struct hash_entry *findsym( sym, table, table_size )
|
||||
register char sym[];
|
||||
hash_table table;
|
||||
int table_size;
|
||||
|
||||
{
|
||||
struct hash_entry *findsym(register char *sym, struct hash_entry **table, int table_size)
|
||||
{
|
||||
register struct hash_entry *sym_entry = table[hashfunct( sym, table_size )];
|
||||
static struct hash_entry empty_entry =
|
||||
{
|
||||
@@ -195,11 +180,8 @@ int table_size;
|
||||
* hash_val = hashfunct( str, hash_size );
|
||||
*/
|
||||
|
||||
int hashfunct( str, hash_size )
|
||||
register char str[];
|
||||
int hash_size;
|
||||
|
||||
{
|
||||
int hashfunct(register char *str, int hash_size)
|
||||
{
|
||||
register int hashval;
|
||||
register int locstr;
|
||||
|
||||
@@ -221,11 +203,8 @@ int hash_size;
|
||||
* ndinstal( nd, def );
|
||||
*/
|
||||
|
||||
void ndinstal( nd, def )
|
||||
char nd[];
|
||||
Char def[];
|
||||
|
||||
{
|
||||
void ndinstal(char *nd, Char *def)
|
||||
{
|
||||
char *copy_string();
|
||||
Char *copy_unsigned_string();
|
||||
|
||||
@@ -243,10 +222,8 @@ Char def[];
|
||||
* def/NULL = ndlookup( nd );
|
||||
*/
|
||||
|
||||
Char *ndlookup( nd )
|
||||
char nd[];
|
||||
|
||||
{
|
||||
Char *ndlookup(char *nd)
|
||||
{
|
||||
return ( (Char *) findsym( nd, ndtbl, NAME_TABLE_HASH_SIZE )->str_val );
|
||||
}
|
||||
|
||||
@@ -262,11 +239,8 @@ char nd[];
|
||||
* the start condition is Exclusive if xcluflg is true
|
||||
*/
|
||||
|
||||
void scinstal( str, xcluflg )
|
||||
char str[];
|
||||
int xcluflg;
|
||||
|
||||
{
|
||||
void scinstal(char *str, int xcluflg)
|
||||
{
|
||||
char *copy_string();
|
||||
|
||||
/* bit of a hack. We know how the default start-condition is
|
||||
@@ -316,9 +290,7 @@ int xcluflg;
|
||||
* scnum/0 = sclookup( str );
|
||||
*/
|
||||
|
||||
int sclookup( str )
|
||||
char str[];
|
||||
|
||||
{
|
||||
int sclookup(char *str)
|
||||
{
|
||||
return ( findsym( str, sctbl, START_COND_HASH_SIZE )->int_val );
|
||||
}
|
||||
|
||||
+33
-58
@@ -45,11 +45,11 @@ static char rcsid[] =
|
||||
|
||||
/* declarations for functions that have forward references */
|
||||
|
||||
void mkentry PROTO((register int*, int, int, int, int));
|
||||
void mkprot PROTO((int[], int, int));
|
||||
void mktemplate PROTO((int[], int, int));
|
||||
void mv2front PROTO((int));
|
||||
int tbldiff PROTO((int[], int, int[]));
|
||||
void mkentry (register int*, int, int, int, int);
|
||||
void mkprot (int[], int, int);
|
||||
void mktemplate (int[], int, int);
|
||||
void mv2front (int);
|
||||
int tbldiff (int[], int, int[]);
|
||||
|
||||
|
||||
/* bldtbl - build table entries for dfa state
|
||||
@@ -87,10 +87,8 @@ int tbldiff PROTO((int[], int, int[]));
|
||||
* cost only one difference.
|
||||
*/
|
||||
|
||||
void bldtbl( state, statenum, totaltrans, comstate, comfreq )
|
||||
int state[], statenum, totaltrans, comstate, comfreq;
|
||||
|
||||
{
|
||||
void bldtbl(int *state, int statenum, int totaltrans, int comstate, int comfreq)
|
||||
{
|
||||
int extptr, extrct[2][CSIZE + 1];
|
||||
int mindiff, minprot, i, d;
|
||||
int checkcom;
|
||||
@@ -233,9 +231,8 @@ int state[], statenum, totaltrans, comstate, comfreq;
|
||||
* table entries made for them.
|
||||
*/
|
||||
|
||||
void cmptmps()
|
||||
|
||||
{
|
||||
void cmptmps(void)
|
||||
{
|
||||
int tmpstorage[CSIZE + 1];
|
||||
register int *tmp = tmpstorage, i, j;
|
||||
int totaltrans, trans;
|
||||
@@ -305,9 +302,8 @@ void cmptmps()
|
||||
|
||||
/* expand_nxt_chk - expand the next check arrays */
|
||||
|
||||
void expand_nxt_chk()
|
||||
|
||||
{
|
||||
void expand_nxt_chk(void)
|
||||
{
|
||||
register int old_max = current_max_xpairs;
|
||||
|
||||
current_max_xpairs += MAX_XPAIRS_INCREMENT;
|
||||
@@ -341,10 +337,8 @@ void expand_nxt_chk()
|
||||
* and an action number will be added in [-1].
|
||||
*/
|
||||
|
||||
int find_table_space( state, numtrans )
|
||||
int *state, numtrans;
|
||||
|
||||
{
|
||||
int find_table_space(int *state, int numtrans)
|
||||
{
|
||||
/* firstfree is the position of the first possible occurrence of two
|
||||
* consecutive unused records in the chk and nxt arrays
|
||||
*/
|
||||
@@ -439,9 +433,8 @@ int *state, numtrans;
|
||||
* own tbase/tdef tables. They are shifted down to be contiguous
|
||||
* with the non-template entries during table generation.
|
||||
*/
|
||||
void inittbl()
|
||||
|
||||
{
|
||||
void inittbl(void)
|
||||
{
|
||||
register int i;
|
||||
|
||||
bzero( (char *) chk, current_max_xpairs * sizeof( int ) / sizeof( char ) );
|
||||
@@ -476,9 +469,8 @@ void inittbl()
|
||||
* mkdeftbl();
|
||||
*/
|
||||
|
||||
void mkdeftbl()
|
||||
|
||||
{
|
||||
void mkdeftbl(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
jamstate = lastdfa + 1;
|
||||
@@ -527,11 +519,8 @@ void mkdeftbl()
|
||||
* state array.
|
||||
*/
|
||||
|
||||
void mkentry( state, numchars, statenum, deflink, totaltrans )
|
||||
register int *state;
|
||||
int numchars, statenum, deflink, totaltrans;
|
||||
|
||||
{
|
||||
void mkentry(register int *state, int numchars, int statenum, int deflink, int totaltrans)
|
||||
{
|
||||
register int minec, maxec, i, baseaddr;
|
||||
int tblbase, tbllast;
|
||||
|
||||
@@ -660,10 +649,8 @@ int numchars, statenum, deflink, totaltrans;
|
||||
* mk1tbl( state, sym, onenxt, onedef );
|
||||
*/
|
||||
|
||||
void mk1tbl( state, sym, onenxt, onedef )
|
||||
int state, sym, onenxt, onedef;
|
||||
|
||||
{
|
||||
void mk1tbl(int state, int sym, int onenxt, int onedef)
|
||||
{
|
||||
if ( firstfree < sym )
|
||||
firstfree = sym;
|
||||
|
||||
@@ -693,10 +680,8 @@ int state, sym, onenxt, onedef;
|
||||
* mkprot( state, statenum, comstate );
|
||||
*/
|
||||
|
||||
void mkprot( state, statenum, comstate )
|
||||
int state[], statenum, comstate;
|
||||
|
||||
{
|
||||
void mkprot(int *state, int statenum, int comstate)
|
||||
{
|
||||
int i, slot, tblbase;
|
||||
|
||||
if ( ++numprots >= MSP || numecs * numprots >= PROT_SAVE_SIZE )
|
||||
@@ -737,10 +722,8 @@ int state[], statenum, comstate;
|
||||
* mktemplate( state, statenum, comstate, totaltrans );
|
||||
*/
|
||||
|
||||
void mktemplate( state, statenum, comstate )
|
||||
int state[], statenum, comstate;
|
||||
|
||||
{
|
||||
void mktemplate(int *state, int statenum, int comstate)
|
||||
{
|
||||
int i, numdiff, tmpbase, tmp[CSIZE + 1];
|
||||
Char transset[CSIZE + 1];
|
||||
int tsptr;
|
||||
@@ -795,10 +778,8 @@ int state[], statenum, comstate;
|
||||
* mv2front( qelm );
|
||||
*/
|
||||
|
||||
void mv2front( qelm )
|
||||
int qelm;
|
||||
|
||||
{
|
||||
void mv2front(int qelm)
|
||||
{
|
||||
if ( firstprot != qelm )
|
||||
{
|
||||
if ( qelm == lastprot )
|
||||
@@ -828,10 +809,8 @@ int qelm;
|
||||
* Transnum is the number of out-transitions for the state.
|
||||
*/
|
||||
|
||||
void place_state( state, statenum, transnum )
|
||||
int *state, statenum, transnum;
|
||||
|
||||
{
|
||||
void place_state(int *state, int statenum, int transnum)
|
||||
{
|
||||
register int i;
|
||||
register int *state_ptr;
|
||||
int position = find_table_space( state, transnum );
|
||||
@@ -874,10 +853,8 @@ int *state, statenum, transnum;
|
||||
* no room, we process the sucker right now.
|
||||
*/
|
||||
|
||||
void stack1( statenum, sym, nextstate, deflink )
|
||||
int statenum, sym, nextstate, deflink;
|
||||
|
||||
{
|
||||
void stack1(int statenum, int sym, int nextstate, int deflink)
|
||||
{
|
||||
if ( onesp >= ONE_STACK_SIZE - 1 )
|
||||
mk1tbl( statenum, sym, nextstate, deflink );
|
||||
|
||||
@@ -910,10 +887,8 @@ int statenum, sym, nextstate, deflink;
|
||||
* number is "numecs" minus the number of "SAME_TRANS" entries in "ext".
|
||||
*/
|
||||
|
||||
int tbldiff( state, pr, ext )
|
||||
int state[], pr, ext[];
|
||||
|
||||
{
|
||||
int tbldiff(int *state, int pr, int *ext)
|
||||
{
|
||||
register int i, *sp = state, *ep = ext, *protp;
|
||||
register int numdiff = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user