Turned on warnings, fixed all issues (adding prototypes etc.)
Fixed memory leak in reader.c
This commit is contained in:
@@ -3,14 +3,11 @@
|
||||
# National Laboratory.
|
||||
# Copyright (c) 2002 The Regents of the University of California, as
|
||||
# Operator of Los Alamos National Laboratory.
|
||||
# EPICS BASE Versions 3.13.7
|
||||
# and higher are distributed subject to a Software License Agreement found
|
||||
# EPICS BASE is distributed subject to a Software License Agreement found
|
||||
# in file LICENSE that is included with this distribution.
|
||||
#*************************************************************************
|
||||
TOP=../../..
|
||||
include $(TOP)/configure/CONFIG
|
||||
HOST_WARN=NO
|
||||
USR_CFLAGS = -D_NO_PROTO
|
||||
|
||||
SRCS += closure.c
|
||||
SRCS += error.c
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
short *itemset;
|
||||
@@ -16,15 +16,22 @@ unsigned *ruleset;
|
||||
static unsigned *first_derives;
|
||||
static unsigned *EFF;
|
||||
|
||||
#ifdef DEBUG
|
||||
static void print_closure(int n);
|
||||
static void print_EFF(void);
|
||||
static void print_first_derives(void);
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
set_EFF(void)
|
||||
{
|
||||
register unsigned *row;
|
||||
register int symbol;
|
||||
register short *sp;
|
||||
register int rowsize;
|
||||
register int i;
|
||||
register int rule;
|
||||
unsigned *row;
|
||||
int symbol;
|
||||
short *sp;
|
||||
int rowsize;
|
||||
int i;
|
||||
int rule;
|
||||
|
||||
rowsize = WORDSIZE(nvars);
|
||||
EFF = NEW2(nvars * rowsize, unsigned);
|
||||
@@ -53,14 +60,15 @@ set_EFF(void)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
set_first_derives(void)
|
||||
{
|
||||
register unsigned *rrow;
|
||||
register unsigned *vrow;
|
||||
register int j;
|
||||
register unsigned k;
|
||||
register unsigned cword;
|
||||
register short *rp;
|
||||
unsigned *rrow;
|
||||
unsigned *vrow;
|
||||
int j;
|
||||
unsigned k;
|
||||
unsigned cword = 0;
|
||||
short *rp;
|
||||
|
||||
int rule;
|
||||
int i;
|
||||
@@ -108,15 +116,16 @@ set_first_derives(void)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
closure(short int *nucleus, int n)
|
||||
{
|
||||
register int ruleno;
|
||||
register unsigned word;
|
||||
register unsigned i;
|
||||
register short *csp;
|
||||
register unsigned *dsp;
|
||||
register unsigned *rsp;
|
||||
register int rulesetsize;
|
||||
int ruleno;
|
||||
unsigned word;
|
||||
unsigned i;
|
||||
short *csp;
|
||||
unsigned *dsp;
|
||||
unsigned *rsp;
|
||||
int rulesetsize;
|
||||
|
||||
short *csend;
|
||||
unsigned *rsend;
|
||||
@@ -176,6 +185,7 @@ closure(short int *nucleus, int n)
|
||||
|
||||
|
||||
|
||||
void
|
||||
finalize_closure(void)
|
||||
{
|
||||
FREE(itemset);
|
||||
@@ -184,12 +194,12 @@ finalize_closure(void)
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG
|
||||
|
||||
print_closure(n)
|
||||
int n;
|
||||
static void
|
||||
print_closure(int n)
|
||||
{
|
||||
register short *isp;
|
||||
short *isp;
|
||||
|
||||
printf("\n\nn = %d\n\n", n);
|
||||
for (isp = itemset; isp < itemsetend; isp++)
|
||||
@@ -197,12 +207,13 @@ int n;
|
||||
}
|
||||
|
||||
|
||||
print_EFF()
|
||||
static void
|
||||
print_EFF(void)
|
||||
{
|
||||
register int i, j;
|
||||
register unsigned *rowp;
|
||||
register unsigned word;
|
||||
register unsigned k;
|
||||
int i, j;
|
||||
unsigned *rowp;
|
||||
unsigned word;
|
||||
unsigned k;
|
||||
|
||||
printf("\n\nEpsilon Free Firsts\n");
|
||||
|
||||
@@ -228,13 +239,14 @@ print_EFF()
|
||||
}
|
||||
|
||||
|
||||
print_first_derives()
|
||||
static void
|
||||
print_first_derives(void)
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
register unsigned *rp;
|
||||
register unsigned cword;
|
||||
register unsigned k;
|
||||
int i;
|
||||
int j;
|
||||
unsigned *rp;
|
||||
unsigned cword;
|
||||
unsigned k;
|
||||
|
||||
printf("\n\n\nFirst Derives\n");
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
#include <assert.h>
|
||||
@@ -274,22 +273,95 @@ extern short *rules_used;
|
||||
extern short nunused;
|
||||
extern short final_state;
|
||||
|
||||
/* global functions */
|
||||
/*
|
||||
* global functions
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define NORETURN __attribute__((noreturn))
|
||||
#else
|
||||
#define NORETURN
|
||||
#endif
|
||||
|
||||
/* main.c */
|
||||
extern void done(int k) NORETURN;
|
||||
extern char *allocate(unsigned int n);
|
||||
extern bucket *lookup(char *name);
|
||||
|
||||
/* error.c */
|
||||
extern void no_space(void) NORETURN;
|
||||
extern void fatal(char *msg) NORETURN;
|
||||
extern void open_error(char *filename) NORETURN;
|
||||
extern void unexpected_EOF(void) NORETURN;
|
||||
extern void syntax_error(int st_lineno, char *st_line, char *st_cptr) NORETURN;
|
||||
extern void unterminated_comment(int c_lineno, char *c_line, char *c_cptr) NORETURN;
|
||||
extern void unterminated_string(int s_lineno, char *s_line, char *s_cptr) NORETURN;
|
||||
extern void unterminated_text(int t_lineno, char *t_line, char *t_cptr) NORETURN;
|
||||
extern void unterminated_union(int u_lineno, char *u_line, char *u_cptr) NORETURN;
|
||||
extern void over_unionized(char *u_cptr) NORETURN;
|
||||
extern void illegal_tag(int t_lineno, char *t_line, char *t_cptr) NORETURN;
|
||||
extern void illegal_character(char *c_cptr) NORETURN;
|
||||
extern void used_reserved(char *s) NORETURN;
|
||||
extern void tokenized_start(char *s) NORETURN;
|
||||
extern void retyped_warning(char *s);
|
||||
extern void reprec_warning(char *s);
|
||||
extern void revalued_warning(char *s);
|
||||
extern void terminal_start(char *s);
|
||||
extern void restarted_warning(void);
|
||||
extern void no_grammar(void) NORETURN;
|
||||
extern void terminal_lhs(int s_lineno) NORETURN;
|
||||
extern void prec_redeclared(void);
|
||||
extern void unterminated_action(int a_lineno, char *a_line, char *a_cptr) NORETURN;
|
||||
extern void dollar_warning(int a_lineno, int i);
|
||||
extern void dollar_error(int a_lineno, char *a_line, char *a_cptr) NORETURN;
|
||||
extern void untyped_lhs(void) NORETURN;
|
||||
extern void untyped_rhs(int i, char *s) NORETURN;
|
||||
extern void unknown_rhs(int i) NORETURN;
|
||||
extern void default_action_warning(void);
|
||||
extern void undefined_goal(char *s) NORETURN;
|
||||
extern void undefined_symbol_warning(char *s);
|
||||
|
||||
/* symtab.c */
|
||||
extern bucket *make_bucket(char *name);
|
||||
extern bucket *lookup(char *name);
|
||||
extern void create_symbol_table(void);
|
||||
extern void free_symbol_table(void);
|
||||
extern void free_symbols(void);
|
||||
|
||||
/* closure.c */
|
||||
extern void set_first_derives(void);
|
||||
extern void closure(short int *nucleus, int n);
|
||||
extern void finalize_closure(void);
|
||||
|
||||
/* system variables */
|
||||
/* reader.c */
|
||||
extern void reader(void);
|
||||
|
||||
extern int errno;
|
||||
/* lr0.c */
|
||||
extern void lr0(void);
|
||||
|
||||
/* lalr.c */
|
||||
extern void lalr(void);
|
||||
|
||||
/* system functions */
|
||||
/* mkpar.c */
|
||||
extern void make_parser(void);
|
||||
extern void free_parser(void);
|
||||
|
||||
extern void free(void *);
|
||||
extern char *calloc(size_t, size_t);
|
||||
extern char *malloc(size_t);
|
||||
extern char *realloc(void *, size_t);
|
||||
extern char *strcpy(char *, const char *);
|
||||
/* warshall.c */
|
||||
extern void reflexive_transitive_closure(unsigned int *R, int n);
|
||||
|
||||
/* output.c */
|
||||
extern void output(void);
|
||||
extern int default_goto(int symbol);
|
||||
extern int matching_vector(int vector);
|
||||
extern int pack_vector(int vector);
|
||||
|
||||
/* skeleton.c */
|
||||
extern void write_section(char *section[]);
|
||||
|
||||
/* verbose.c */
|
||||
extern void verbose(void);
|
||||
|
||||
/* system includes */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
/* routines for printing error messages */
|
||||
@@ -12,6 +11,7 @@
|
||||
#include "defs.h"
|
||||
|
||||
|
||||
void
|
||||
fatal(char *msg)
|
||||
{
|
||||
fprintf(stderr, "%s: f - %s\n", myname, msg);
|
||||
@@ -19,6 +19,7 @@ fatal(char *msg)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
no_space(void)
|
||||
{
|
||||
fprintf(stderr, "%s: f - out of space\n", myname);
|
||||
@@ -26,6 +27,7 @@ no_space(void)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
open_error(char *filename)
|
||||
{
|
||||
fprintf(stderr, "%s: f - cannot open \"%s\"\n", myname, filename);
|
||||
@@ -33,6 +35,7 @@ open_error(char *filename)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
unexpected_EOF(void)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", unexpected end-of-file\n",
|
||||
@@ -41,9 +44,10 @@ unexpected_EOF(void)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
print_pos(char *st_line, char *st_cptr)
|
||||
{
|
||||
register char *s;
|
||||
char *s;
|
||||
|
||||
if (st_line == 0) return(0);
|
||||
for (s = st_line; *s != '\n'; ++s)
|
||||
@@ -67,6 +71,7 @@ print_pos(char *st_line, char *st_cptr)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
syntax_error(int st_lineno, char *st_line, char *st_cptr)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", syntax error\n",
|
||||
@@ -76,6 +81,7 @@ syntax_error(int st_lineno, char *st_line, char *st_cptr)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
unterminated_comment(int c_lineno, char *c_line, char *c_cptr)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", unmatched /*\n",
|
||||
@@ -85,6 +91,7 @@ unterminated_comment(int c_lineno, char *c_line, char *c_cptr)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
unterminated_string(int s_lineno, char *s_line, char *s_cptr)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", unterminated string\n",
|
||||
@@ -94,6 +101,7 @@ unterminated_string(int s_lineno, char *s_line, char *s_cptr)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
unterminated_text(int t_lineno, char *t_line, char *t_cptr)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", unmatched %%{\n",
|
||||
@@ -103,6 +111,7 @@ unterminated_text(int t_lineno, char *t_line, char *t_cptr)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
unterminated_union(int u_lineno, char *u_line, char *u_cptr)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", unterminated %%union \
|
||||
@@ -112,6 +121,7 @@ declaration\n", myname, u_lineno, input_file_name);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
over_unionized(char *u_cptr)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", too many %%union \
|
||||
@@ -121,6 +131,7 @@ declarations\n", myname, lineno, input_file_name);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
illegal_tag(int t_lineno, char *t_line, char *t_cptr)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", illegal tag\n",
|
||||
@@ -130,6 +141,7 @@ illegal_tag(int t_lineno, char *t_line, char *t_cptr)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
illegal_character(char *c_cptr)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", illegal character\n",
|
||||
@@ -139,6 +151,7 @@ illegal_character(char *c_cptr)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
used_reserved(char *s)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", illegal use of reserved symbol \
|
||||
@@ -147,6 +160,7 @@ used_reserved(char *s)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
tokenized_start(char *s)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", the start symbol %s cannot be \
|
||||
@@ -155,6 +169,7 @@ declared to be a token\n", myname, lineno, input_file_name, s);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
retyped_warning(char *s)
|
||||
{
|
||||
fprintf(stderr, "%s: w - line %d of \"%s\", the type of %s has been \
|
||||
@@ -162,6 +177,7 @@ redeclared\n", myname, lineno, input_file_name, s);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
reprec_warning(char *s)
|
||||
{
|
||||
fprintf(stderr, "%s: w - line %d of \"%s\", the precedence of %s has been \
|
||||
@@ -169,6 +185,7 @@ redeclared\n", myname, lineno, input_file_name, s);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
revalued_warning(char *s)
|
||||
{
|
||||
fprintf(stderr, "%s: w - line %d of \"%s\", the value of %s has been \
|
||||
@@ -176,6 +193,7 @@ redeclared\n", myname, lineno, input_file_name, s);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
terminal_start(char *s)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", the start symbol %s is a \
|
||||
@@ -184,6 +202,7 @@ token\n", myname, lineno, input_file_name, s);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
restarted_warning(void)
|
||||
{
|
||||
fprintf(stderr, "%s: w - line %d of \"%s\", the start symbol has been \
|
||||
@@ -191,6 +210,7 @@ redeclared\n", myname, lineno, input_file_name);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
no_grammar(void)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", no grammar has been \
|
||||
@@ -199,6 +219,7 @@ specified\n", myname, lineno, input_file_name);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
terminal_lhs(int s_lineno)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", a token appears on the lhs \
|
||||
@@ -207,6 +228,7 @@ of a production\n", myname, s_lineno, input_file_name);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
prec_redeclared(void)
|
||||
{
|
||||
fprintf(stderr, "%s: w - line %d of \"%s\", conflicting %%prec \
|
||||
@@ -214,6 +236,7 @@ specifiers\n", myname, lineno, input_file_name);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
unterminated_action(int a_lineno, char *a_line, char *a_cptr)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", unterminated action\n",
|
||||
@@ -223,6 +246,7 @@ unterminated_action(int a_lineno, char *a_line, char *a_cptr)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dollar_warning(int a_lineno, int i)
|
||||
{
|
||||
fprintf(stderr, "%s: w - line %d of \"%s\", $%d references beyond the \
|
||||
@@ -230,6 +254,7 @@ end of the current rule\n", myname, a_lineno, input_file_name, i);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
dollar_error(int a_lineno, char *a_line, char *a_cptr)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", illegal $-name\n",
|
||||
@@ -239,6 +264,7 @@ dollar_error(int a_lineno, char *a_line, char *a_cptr)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
untyped_lhs(void)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", $$ is untyped\n",
|
||||
@@ -247,6 +273,7 @@ untyped_lhs(void)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
untyped_rhs(int i, char *s)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", $%d (%s) is untyped\n",
|
||||
@@ -255,6 +282,7 @@ untyped_rhs(int i, char *s)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
unknown_rhs(int i)
|
||||
{
|
||||
fprintf(stderr, "%s: e - line %d of \"%s\", $%d is untyped\n",
|
||||
@@ -263,6 +291,7 @@ unknown_rhs(int i)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
default_action_warning(void)
|
||||
{
|
||||
fprintf(stderr, "%s: w - line %d of \"%s\", the default action assigns an \
|
||||
@@ -270,6 +299,7 @@ undefined value to $$\n", myname, lineno, input_file_name);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
undefined_goal(char *s)
|
||||
{
|
||||
fprintf(stderr, "%s: e - the start symbol %s is undefined\n", myname, s);
|
||||
@@ -277,6 +307,7 @@ undefined_goal(char *s)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
undefined_symbol_warning(char *s)
|
||||
{
|
||||
fprintf(stderr, "%s: w - the symbol %s is undefined\n", myname, s);
|
||||
|
||||
+102
-74
@@ -3,8 +3,7 @@
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
#include "defs.h"
|
||||
@@ -29,7 +28,21 @@ short *goto_map;
|
||||
short *from_state;
|
||||
short *to_state;
|
||||
|
||||
short **transpose(short int **R, int n);
|
||||
static void set_state_table(void);
|
||||
static void set_accessing_symbol(void);
|
||||
static void set_shift_table(void);
|
||||
static void set_reduction_table(void);
|
||||
static void set_maxrhs(void);
|
||||
static void initialize_LA(void);
|
||||
static void set_goto_map(void);
|
||||
static void initialize_F(void);
|
||||
static void build_relations(void);
|
||||
static void add_lookback_edge(int stateno, int ruleno, int gotono);
|
||||
static short **transpose(short int **R, int n);
|
||||
static void compute_FOLLOWS(void);
|
||||
static void compute_lookaheads(void);
|
||||
static void digraph(short **relation);
|
||||
static void traverse(int i);
|
||||
|
||||
static int infinity;
|
||||
static int maxrhs;
|
||||
@@ -43,6 +56,7 @@ static short *VERTICES;
|
||||
static int top;
|
||||
|
||||
|
||||
void
|
||||
lalr(void)
|
||||
{
|
||||
tokensetsize = WORDSIZE(ntokens);
|
||||
@@ -62,9 +76,10 @@ lalr(void)
|
||||
|
||||
|
||||
|
||||
static void
|
||||
set_state_table(void)
|
||||
{
|
||||
register core *sp;
|
||||
core *sp;
|
||||
|
||||
state_table = NEW2(nstates, core *);
|
||||
for (sp = first_state; sp; sp = sp->next)
|
||||
@@ -73,9 +88,10 @@ set_state_table(void)
|
||||
|
||||
|
||||
|
||||
static void
|
||||
set_accessing_symbol(void)
|
||||
{
|
||||
register core *sp;
|
||||
core *sp;
|
||||
|
||||
accessing_symbol = NEW2(nstates, short);
|
||||
for (sp = first_state; sp; sp = sp->next)
|
||||
@@ -84,9 +100,10 @@ set_accessing_symbol(void)
|
||||
|
||||
|
||||
|
||||
static void
|
||||
set_shift_table(void)
|
||||
{
|
||||
register shifts *sp;
|
||||
shifts *sp;
|
||||
|
||||
shift_table = NEW2(nstates, shifts *);
|
||||
for (sp = first_shift; sp; sp = sp->next)
|
||||
@@ -95,9 +112,10 @@ set_shift_table(void)
|
||||
|
||||
|
||||
|
||||
static void
|
||||
set_reduction_table(void)
|
||||
{
|
||||
register reductions *rp;
|
||||
reductions *rp;
|
||||
|
||||
reduction_table = NEW2(nstates, reductions *);
|
||||
for (rp = first_reduction; rp; rp = rp->next)
|
||||
@@ -106,12 +124,13 @@ set_reduction_table(void)
|
||||
|
||||
|
||||
|
||||
static void
|
||||
set_maxrhs(void)
|
||||
{
|
||||
register short *itemp;
|
||||
register short *item_end;
|
||||
register int length;
|
||||
register int max;
|
||||
short *itemp;
|
||||
short *item_end;
|
||||
int length;
|
||||
int max;
|
||||
|
||||
length = 0;
|
||||
max = 0;
|
||||
@@ -134,10 +153,11 @@ set_maxrhs(void)
|
||||
|
||||
|
||||
|
||||
static void
|
||||
initialize_LA(void)
|
||||
{
|
||||
register int i, j, k;
|
||||
register reductions *rp;
|
||||
int i, j, k;
|
||||
reductions *rp;
|
||||
|
||||
lookaheads = NEW2(nstates + 1, short);
|
||||
|
||||
@@ -171,15 +191,16 @@ initialize_LA(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_goto_map(void)
|
||||
{
|
||||
register shifts *sp;
|
||||
register int i;
|
||||
register int symbol;
|
||||
register int k;
|
||||
register short *temp_map;
|
||||
register int state2;
|
||||
register int state1;
|
||||
shifts *sp;
|
||||
int i;
|
||||
int symbol;
|
||||
int k;
|
||||
short *temp_map;
|
||||
int state2;
|
||||
int state1;
|
||||
|
||||
goto_map = NEW2(nvars + 1, short) - ntokens;
|
||||
temp_map = NEW2(nvars + 1, short) - ntokens;
|
||||
@@ -243,10 +264,10 @@ set_goto_map(void)
|
||||
int
|
||||
map_goto(int state, int symbol)
|
||||
{
|
||||
register int high;
|
||||
register int low;
|
||||
register int middle;
|
||||
register int s;
|
||||
int high;
|
||||
int low;
|
||||
int middle;
|
||||
int s;
|
||||
|
||||
low = goto_map[symbol];
|
||||
high = goto_map[symbol + 1];
|
||||
@@ -267,20 +288,21 @@ map_goto(int state, int symbol)
|
||||
|
||||
|
||||
|
||||
static void
|
||||
initialize_F(void)
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
register int k;
|
||||
register shifts *sp;
|
||||
register short *edge;
|
||||
register unsigned *rowp;
|
||||
register short *rp;
|
||||
register short **reads;
|
||||
register int nedges;
|
||||
register int stateno;
|
||||
register int symbol;
|
||||
register int nwords;
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
shifts *sp;
|
||||
short *edge;
|
||||
unsigned *rowp;
|
||||
short *rp;
|
||||
short **reads;
|
||||
int nedges;
|
||||
int stateno;
|
||||
int symbol;
|
||||
int nwords;
|
||||
|
||||
nwords = ngotos * tokensetsize;
|
||||
F = NEW2(nwords, unsigned);
|
||||
@@ -344,25 +366,26 @@ initialize_F(void)
|
||||
|
||||
|
||||
|
||||
static void
|
||||
build_relations(void)
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
register int k;
|
||||
register short *rulep;
|
||||
register short *rp;
|
||||
register shifts *sp;
|
||||
register int length;
|
||||
register int nedges;
|
||||
register int done;
|
||||
register int state1;
|
||||
register int stateno;
|
||||
register int symbol1;
|
||||
register int symbol2;
|
||||
register short *shortp;
|
||||
register short *edge;
|
||||
register short *states;
|
||||
register short **new_includes;
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
short *rulep;
|
||||
short *rp;
|
||||
shifts *sp;
|
||||
int length;
|
||||
int nedges;
|
||||
int done;
|
||||
int state1;
|
||||
int stateno;
|
||||
int symbol1;
|
||||
int symbol2;
|
||||
short *shortp;
|
||||
short *edge;
|
||||
short *states;
|
||||
short **new_includes;
|
||||
|
||||
includes = NEW2(ngotos, short *);
|
||||
edge = NEW2(ngotos + 1, short);
|
||||
@@ -436,11 +459,12 @@ build_relations(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
add_lookback_edge(int stateno, int ruleno, int gotono)
|
||||
{
|
||||
register int i, k;
|
||||
register int found;
|
||||
register shorts *sp;
|
||||
int i, k;
|
||||
int found;
|
||||
shorts *sp;
|
||||
|
||||
i = lookaheads[stateno];
|
||||
k = lookaheads[stateno + 1];
|
||||
@@ -465,12 +489,12 @@ add_lookback_edge(int stateno, int ruleno, int gotono)
|
||||
short **
|
||||
transpose(short int **R, int n)
|
||||
{
|
||||
register short **new_R;
|
||||
register short **temp_R;
|
||||
register short *nedges;
|
||||
register short *sp;
|
||||
register int i;
|
||||
register int k;
|
||||
short **new_R;
|
||||
short **temp_R;
|
||||
short *nedges;
|
||||
short *sp;
|
||||
int i;
|
||||
int k;
|
||||
|
||||
nedges = NEW2(n, short);
|
||||
|
||||
@@ -518,18 +542,20 @@ transpose(short int **R, int n)
|
||||
|
||||
|
||||
|
||||
static void
|
||||
compute_FOLLOWS(void)
|
||||
{
|
||||
digraph(includes);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
compute_lookaheads(void)
|
||||
{
|
||||
register int i, n;
|
||||
register unsigned *fp1, *fp2, *fp3;
|
||||
register shorts *sp, *next;
|
||||
register unsigned *rowp;
|
||||
int i, n;
|
||||
unsigned *fp1, *fp2, *fp3;
|
||||
shorts *sp, *next;
|
||||
unsigned *rowp;
|
||||
|
||||
rowp = LA;
|
||||
n = lookaheads[nstates];
|
||||
@@ -558,9 +584,10 @@ compute_lookaheads(void)
|
||||
}
|
||||
|
||||
|
||||
digraph(short int **relation)
|
||||
static void
|
||||
digraph(short **relation)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
infinity = ngotos + 2;
|
||||
INDEX = NEW2(ngotos + 1, short);
|
||||
@@ -584,13 +611,14 @@ digraph(short int **relation)
|
||||
|
||||
|
||||
|
||||
traverse(register int i)
|
||||
static void
|
||||
traverse(int i)
|
||||
{
|
||||
register unsigned *fp1;
|
||||
register unsigned *fp2;
|
||||
register unsigned *fp3;
|
||||
register int j;
|
||||
register short *rp;
|
||||
unsigned *fp1;
|
||||
unsigned *fp2;
|
||||
unsigned *fp3;
|
||||
int j;
|
||||
short *rp;
|
||||
|
||||
int height;
|
||||
unsigned *base;
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
@@ -19,9 +18,6 @@ core *first_state;
|
||||
shifts *first_shift;
|
||||
reductions *first_reduction;
|
||||
|
||||
int get_state(int symbol);
|
||||
core *new_state(int symbol);
|
||||
|
||||
static core **state_set;
|
||||
static core *this_state;
|
||||
static core *last_state;
|
||||
@@ -38,16 +34,27 @@ static short **kernel_base;
|
||||
static short **kernel_end;
|
||||
static short *kernel_items;
|
||||
|
||||
void
|
||||
static int get_state(int symbol);
|
||||
static void initialize_states(void);
|
||||
static void new_itemsets(void);
|
||||
static core *new_state(int symbol);
|
||||
static void save_shifts(void);
|
||||
static void save_reductions(void);
|
||||
#ifdef DEBUG
|
||||
static void print_derives(void);
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
allocate_itemsets(void)
|
||||
{
|
||||
register short *itemp;
|
||||
register short *item_end;
|
||||
register int symbol;
|
||||
register int i;
|
||||
register int count;
|
||||
register int max;
|
||||
register short *symbol_count;
|
||||
short *itemp;
|
||||
short *item_end;
|
||||
int symbol;
|
||||
int i;
|
||||
int count;
|
||||
int max;
|
||||
short *symbol_count;
|
||||
|
||||
count = 0;
|
||||
symbol_count = NEW2(nsyms, short);
|
||||
@@ -80,7 +87,7 @@ allocate_itemsets(void)
|
||||
kernel_end = NEW2(nsyms, short *);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
allocate_storage(void)
|
||||
{
|
||||
allocate_itemsets();
|
||||
@@ -89,12 +96,12 @@ allocate_storage(void)
|
||||
state_set = NEW2(nitems, core *);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
append_states(void)
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
register int symbol;
|
||||
int i;
|
||||
int j;
|
||||
int symbol;
|
||||
|
||||
#ifdef TRACE
|
||||
fprintf(stderr, "Entering append_states()\n");
|
||||
@@ -118,7 +125,7 @@ append_states(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
free_storage(void)
|
||||
{
|
||||
FREE(shift_symbol);
|
||||
@@ -131,7 +138,7 @@ free_storage(void)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
generate_states(void)
|
||||
{
|
||||
allocate_storage();
|
||||
@@ -159,16 +166,16 @@ generate_states(void)
|
||||
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
get_state(int symbol)
|
||||
{
|
||||
register int key;
|
||||
register short *isp1;
|
||||
register short *isp2;
|
||||
register short *iend;
|
||||
register core *sp;
|
||||
register int found;
|
||||
register int n;
|
||||
int key;
|
||||
short *isp1;
|
||||
short *isp2;
|
||||
short *iend;
|
||||
core *sp;
|
||||
int found;
|
||||
int n;
|
||||
|
||||
#ifdef TRACE
|
||||
fprintf(stderr, "Entering get_state(%d)\n", symbol);
|
||||
@@ -222,12 +229,12 @@ get_state(int symbol)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
initialize_states(void)
|
||||
{
|
||||
register int i;
|
||||
register short *start_derives;
|
||||
register core *p;
|
||||
int i;
|
||||
short *start_derives;
|
||||
core *p;
|
||||
|
||||
start_derives = derives[start_symbol];
|
||||
for (i = 0; start_derives[i] >= 0; ++i)
|
||||
@@ -249,14 +256,14 @@ initialize_states(void)
|
||||
nstates = 1;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
new_itemsets(void)
|
||||
{
|
||||
register int i;
|
||||
register int shiftcount;
|
||||
register short *isp;
|
||||
register short *ksp;
|
||||
register int symbol;
|
||||
int i;
|
||||
int shiftcount;
|
||||
short *isp;
|
||||
short *ksp;
|
||||
int symbol;
|
||||
|
||||
for (i = 0; i < nsyms; i++)
|
||||
kernel_end[i] = 0;
|
||||
@@ -286,14 +293,14 @@ new_itemsets(void)
|
||||
|
||||
|
||||
|
||||
core *
|
||||
static core *
|
||||
new_state(int symbol)
|
||||
{
|
||||
register int n;
|
||||
register core *p;
|
||||
register short *isp1;
|
||||
register short *isp2;
|
||||
register short *iend;
|
||||
int n;
|
||||
core *p;
|
||||
short *isp1;
|
||||
short *isp2;
|
||||
short *iend;
|
||||
|
||||
#ifdef TRACE
|
||||
fprintf(stderr, "Entering new_state(%d)\n", symbol);
|
||||
@@ -324,8 +331,8 @@ new_state(int symbol)
|
||||
}
|
||||
|
||||
|
||||
/* show_cores is used for debugging */
|
||||
void
|
||||
#ifdef DEBUG
|
||||
static void
|
||||
show_cores(void)
|
||||
{
|
||||
core *p;
|
||||
@@ -359,8 +366,7 @@ show_cores(void)
|
||||
}
|
||||
|
||||
|
||||
/* show_ritems is used for debugging */
|
||||
void
|
||||
static void
|
||||
show_ritems(void)
|
||||
{
|
||||
int i;
|
||||
@@ -370,8 +376,7 @@ show_ritems(void)
|
||||
}
|
||||
|
||||
|
||||
/* show_rrhs is used for debugging */
|
||||
void
|
||||
static void
|
||||
show_rrhs(void)
|
||||
{
|
||||
int i;
|
||||
@@ -381,8 +386,7 @@ show_rrhs(void)
|
||||
}
|
||||
|
||||
|
||||
/* show_shifts is used for debugging */
|
||||
void
|
||||
static void
|
||||
show_shifts(void)
|
||||
{
|
||||
shifts *p;
|
||||
@@ -399,14 +403,15 @@ show_shifts(void)
|
||||
printf("\t%d\n", p->shift[i]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
static void
|
||||
save_shifts(void)
|
||||
{
|
||||
register shifts *p;
|
||||
register short *sp1;
|
||||
register short *sp2;
|
||||
register short *send;
|
||||
shifts *p;
|
||||
short *sp1;
|
||||
short *sp2;
|
||||
short *send;
|
||||
|
||||
p = (shifts *) allocate((unsigned) (sizeof(shifts) +
|
||||
(nshifts - 1) * sizeof(short)));
|
||||
@@ -434,16 +439,16 @@ save_shifts(void)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
save_reductions(void)
|
||||
{
|
||||
register short *isp;
|
||||
register short *rp1;
|
||||
register short *rp2;
|
||||
register int item;
|
||||
register int count;
|
||||
register reductions *p;
|
||||
register short *rend;
|
||||
short *isp;
|
||||
short *rp1;
|
||||
short *rp2;
|
||||
int item;
|
||||
int count;
|
||||
reductions *p;
|
||||
short *rend;
|
||||
|
||||
count = 0;
|
||||
for (isp = itemset; isp < itemsetend; isp++)
|
||||
@@ -483,12 +488,12 @@ save_reductions(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
set_derives(void)
|
||||
{
|
||||
register int i, k;
|
||||
register int lhs;
|
||||
register short *rules;
|
||||
int i, k;
|
||||
int lhs;
|
||||
short *rules;
|
||||
|
||||
derives = NEW2(nsyms, short *);
|
||||
rules = NEW2(nvars + nrules, short);
|
||||
@@ -514,7 +519,7 @@ set_derives(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
free_derives(void)
|
||||
{
|
||||
FREE(derives[start_symbol]);
|
||||
@@ -522,11 +527,11 @@ free_derives(void)
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
static void
|
||||
print_derives(void)
|
||||
{
|
||||
register int i;
|
||||
register short *sp;
|
||||
int i;
|
||||
short *sp;
|
||||
|
||||
printf("\nDERIVES\n\n");
|
||||
|
||||
@@ -544,11 +549,11 @@ print_derives(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
static void
|
||||
set_nullable(void)
|
||||
{
|
||||
register int i, j;
|
||||
register int empty;
|
||||
int i, j;
|
||||
int empty;
|
||||
int done;
|
||||
|
||||
nullable = MALLOC(nsyms);
|
||||
@@ -593,7 +598,7 @@ set_nullable(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
free_nullable(void)
|
||||
{
|
||||
FREE(nullable);
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
#include <signal.h>
|
||||
@@ -64,10 +63,8 @@ char *rassoc;
|
||||
short **derives;
|
||||
char *nullable;
|
||||
|
||||
extern char *mktemp(char *);
|
||||
extern char *getenv(const char *);
|
||||
|
||||
|
||||
void
|
||||
done(int k)
|
||||
{
|
||||
if (action_file) { fclose(action_file); }
|
||||
@@ -77,12 +74,14 @@ done(int k)
|
||||
}
|
||||
|
||||
|
||||
void onintr(int StupidInconsistantSignalTypes)
|
||||
static void
|
||||
onintr(int StupidInconsistantSignalTypes)
|
||||
{
|
||||
done(1);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
set_signals(void)
|
||||
{
|
||||
#ifdef SIGINT
|
||||
@@ -100,6 +99,7 @@ set_signals(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr, "usage: %s [-dlrtv] [-b file_prefix] [-p symbol_prefix] filename\n", myname);
|
||||
@@ -107,10 +107,11 @@ usage(void)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
getargs(int argc, char *argv[])
|
||||
{
|
||||
register int i;
|
||||
register char *s;
|
||||
int i;
|
||||
char *s;
|
||||
|
||||
if (argc > 0) myname = argv[0];
|
||||
for (i = 1; i < argc; ++i)
|
||||
@@ -215,7 +216,7 @@ no_more_options:;
|
||||
char *
|
||||
allocate(unsigned int n)
|
||||
{
|
||||
register char *p;
|
||||
char *p;
|
||||
|
||||
p = NULL;
|
||||
if (n)
|
||||
@@ -227,9 +228,7 @@ allocate(unsigned int n)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* joh - removed use TMPDIR variable by WIN32 here
|
||||
*/
|
||||
static void
|
||||
create_file_names(void)
|
||||
{
|
||||
int len;
|
||||
@@ -273,6 +272,7 @@ create_file_names(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
open_files(void)
|
||||
{
|
||||
create_file_names();
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
@@ -23,15 +22,21 @@ short final_state;
|
||||
static int SRcount;
|
||||
static int RRcount;
|
||||
|
||||
extern action *parse_actions(register int stateno);
|
||||
extern action *get_shifts(int stateno);
|
||||
extern action *add_reductions(int stateno, register action *actions);
|
||||
extern action *add_reduce(register action *actions, register int ruleno, register int symbol);
|
||||
|
||||
static action *parse_actions(int stateno);
|
||||
static action *get_shifts(int stateno);
|
||||
static action *add_reductions(int stateno, action *actions);
|
||||
static action *add_reduce(action *actions, int ruleno, int symbol);
|
||||
static void find_final_state(void);
|
||||
static void unused_rules(void);
|
||||
static void remove_conflicts(void);
|
||||
static void total_conflicts(void);
|
||||
static void defreds(void);
|
||||
|
||||
void
|
||||
make_parser(void)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
parser = NEW2(nstates, action *);
|
||||
for (i = 0; i < nstates; i++)
|
||||
@@ -45,10 +50,10 @@ make_parser(void)
|
||||
}
|
||||
|
||||
|
||||
action *
|
||||
parse_actions(register int stateno)
|
||||
static action *
|
||||
parse_actions(int stateno)
|
||||
{
|
||||
register action *actions;
|
||||
action *actions;
|
||||
|
||||
actions = get_shifts(stateno);
|
||||
actions = add_reductions(stateno, actions);
|
||||
@@ -56,14 +61,14 @@ parse_actions(register int stateno)
|
||||
}
|
||||
|
||||
|
||||
action *
|
||||
static action *
|
||||
get_shifts(int stateno)
|
||||
{
|
||||
register action *actions, *temp;
|
||||
register shifts *sp;
|
||||
register short *to_state;
|
||||
register int i, k;
|
||||
register int symbol;
|
||||
action *actions, *temp;
|
||||
shifts *sp;
|
||||
short *to_state;
|
||||
int i, k;
|
||||
int symbol;
|
||||
|
||||
actions = 0;
|
||||
sp = shift_table[stateno];
|
||||
@@ -90,12 +95,12 @@ get_shifts(int stateno)
|
||||
return (actions);
|
||||
}
|
||||
|
||||
action *
|
||||
add_reductions(int stateno, register action *actions)
|
||||
static action *
|
||||
add_reductions(int stateno, action *actions)
|
||||
{
|
||||
register int i, j, m, n;
|
||||
register int ruleno, tokensetsize;
|
||||
register unsigned *rowp;
|
||||
int i, j, m, n;
|
||||
int ruleno, tokensetsize;
|
||||
unsigned *rowp;
|
||||
|
||||
tokensetsize = WORDSIZE(ntokens);
|
||||
m = lookaheads[stateno];
|
||||
@@ -114,10 +119,10 @@ add_reductions(int stateno, register action *actions)
|
||||
}
|
||||
|
||||
|
||||
action *
|
||||
add_reduce(register action *actions, register int ruleno, register int symbol)
|
||||
static action *
|
||||
add_reduce(action *actions, int ruleno, int symbol)
|
||||
{
|
||||
register action *temp, *prev, *next;
|
||||
action *temp, *prev, *next;
|
||||
|
||||
prev = 0;
|
||||
for (next = actions; next && next->symbol < symbol; next = next->next)
|
||||
@@ -153,11 +158,12 @@ add_reduce(register action *actions, register int ruleno, register int symbol)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
find_final_state(void)
|
||||
{
|
||||
register int goal, i;
|
||||
register short *to_state;
|
||||
register shifts *p;
|
||||
int goal, i;
|
||||
short *to_state;
|
||||
shifts *p;
|
||||
|
||||
p = shift_table[0];
|
||||
to_state = p->shift;
|
||||
@@ -170,10 +176,11 @@ find_final_state(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
unused_rules(void)
|
||||
{
|
||||
register int i;
|
||||
register action *p;
|
||||
int i;
|
||||
action *p;
|
||||
|
||||
rules_used = (short *) MALLOC(nrules*sizeof(short));
|
||||
if (rules_used == 0) no_space();
|
||||
@@ -195,18 +202,21 @@ unused_rules(void)
|
||||
if (!rules_used[i]) ++nunused;
|
||||
|
||||
if (nunused)
|
||||
{
|
||||
if (nunused == 1)
|
||||
fprintf(stderr, "%s: 1 rule never reduced\n", myname);
|
||||
else
|
||||
fprintf(stderr, "%s: %d rules never reduced\n", myname, nunused);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
remove_conflicts(void)
|
||||
{
|
||||
register int i;
|
||||
register int symbol;
|
||||
register action *p, *pref;
|
||||
int i;
|
||||
int symbol;
|
||||
action *p, *pref = NULL;
|
||||
|
||||
SRtotal = 0;
|
||||
RRtotal = 0;
|
||||
@@ -229,7 +239,7 @@ remove_conflicts(void)
|
||||
SRcount++;
|
||||
p->suppressed = 1;
|
||||
}
|
||||
else if (pref->action_code == SHIFT)
|
||||
else if (pref && pref->action_code == SHIFT)
|
||||
{
|
||||
if (pref->prec > 0 && p->prec > 0)
|
||||
{
|
||||
@@ -277,6 +287,7 @@ remove_conflicts(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
total_conflicts(void)
|
||||
{
|
||||
fprintf(stderr, "%s: ", myname);
|
||||
@@ -297,22 +308,22 @@ total_conflicts(void)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
sole_reduction(int stateno)
|
||||
{
|
||||
register int count, ruleno;
|
||||
register action *p;
|
||||
int count, ruleno;
|
||||
action *p;
|
||||
|
||||
count = 0;
|
||||
ruleno = 0;
|
||||
for (p = parser[stateno]; p; p = p->next)
|
||||
{
|
||||
if (p->action_code == SHIFT && p->suppressed == 0)
|
||||
return (0);
|
||||
return 0;
|
||||
else if (p->action_code == REDUCE && p->suppressed == 0)
|
||||
{
|
||||
if (ruleno > 0 && p->number != ruleno)
|
||||
return (0);
|
||||
return 0;
|
||||
if (p->symbol != 1)
|
||||
++count;
|
||||
ruleno = p->number;
|
||||
@@ -320,39 +331,42 @@ sole_reduction(int stateno)
|
||||
}
|
||||
|
||||
if (count == 0)
|
||||
return (0);
|
||||
return (ruleno);
|
||||
return 0;
|
||||
return ruleno;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
defreds(void)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
defred = NEW2(nstates, short);
|
||||
for (i = 0; i < nstates; i++)
|
||||
defred[i] = sole_reduction(i);
|
||||
}
|
||||
|
||||
free_action_row(register action *p)
|
||||
{
|
||||
register action *q;
|
||||
|
||||
while (p)
|
||||
static void
|
||||
free_action_row(action *p)
|
||||
{
|
||||
action *q;
|
||||
|
||||
while (p)
|
||||
{
|
||||
q = p->next;
|
||||
FREE(p);
|
||||
p = q;
|
||||
q = p->next;
|
||||
FREE(p);
|
||||
p = q;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
free_parser(void)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nstates; i++)
|
||||
free_action_row(parser[i]);
|
||||
for (i = 0; i < nstates; i++)
|
||||
free_action_row(parser[i]);
|
||||
|
||||
FREE(parser);
|
||||
FREE(parser);
|
||||
}
|
||||
|
||||
|
||||
+117
-82
@@ -3,8 +3,7 @@
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
#include "defs.h"
|
||||
@@ -25,7 +24,30 @@ static short *check;
|
||||
static int lowzero;
|
||||
static int high;
|
||||
|
||||
static void output_prefix(void);
|
||||
static void output_rule_data(void);
|
||||
static void output_yydefred(void);
|
||||
static void output_actions(void);
|
||||
static void token_actions(void);
|
||||
static void goto_actions(void);
|
||||
static void save_column(int symbol, int default_state);
|
||||
static void sort_actions(void);
|
||||
static void pack_table(void);
|
||||
static void output_base(void);
|
||||
static void output_table(void);
|
||||
static void output_check(void);
|
||||
static void output_defines(void);
|
||||
static void output_stored_text(void);
|
||||
static void output_debug(void);
|
||||
static void output_stype(void);
|
||||
static void output_trailing_text(void);
|
||||
static void output_semantic_actions(void);
|
||||
static void free_itemsets(void);
|
||||
static void free_shifts(void);
|
||||
static void free_reductions(void);
|
||||
|
||||
|
||||
void
|
||||
output(void)
|
||||
{
|
||||
free_itemsets();
|
||||
@@ -49,6 +71,7 @@ output(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
output_prefix(void)
|
||||
{
|
||||
if (symbol_prefix == NULL)
|
||||
@@ -109,12 +132,12 @@ output_prefix(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
output_rule_data(void)
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
|
||||
fprintf(output_file, "static short %slhs[] = {%42d,", symbol_prefix,
|
||||
symbol_value[start_symbol]);
|
||||
|
||||
@@ -156,9 +179,10 @@ output_rule_data(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
output_yydefred(void)
|
||||
{
|
||||
register int i, j;
|
||||
int i, j;
|
||||
|
||||
fprintf(output_file, "static short %sdefred[] = {%39d,", symbol_prefix,
|
||||
(defred[0] ? defred[0] - 2 : 0));
|
||||
@@ -183,6 +207,7 @@ output_yydefred(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
output_actions(void)
|
||||
{
|
||||
nvectors = 2*nstates + nvars;
|
||||
@@ -211,13 +236,14 @@ output_actions(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
token_actions(void)
|
||||
{
|
||||
register int i, j;
|
||||
register int shiftcount, reducecount;
|
||||
register int max, min;
|
||||
register short *actionrow, *r, *s;
|
||||
register action *p;
|
||||
int i, j;
|
||||
int shiftcount, reducecount;
|
||||
int max, min;
|
||||
short *actionrow, *r, *s;
|
||||
action *p;
|
||||
|
||||
actionrow = NEW2(2*ntokens, short);
|
||||
for (i = 0; i < nstates; ++i)
|
||||
@@ -295,9 +321,10 @@ token_actions(void)
|
||||
FREE(actionrow);
|
||||
}
|
||||
|
||||
static void
|
||||
goto_actions(void)
|
||||
{
|
||||
register int i, j, k;
|
||||
int i, j, k;
|
||||
|
||||
state_count = NEW2(nstates, short);
|
||||
|
||||
@@ -330,11 +357,11 @@ goto_actions(void)
|
||||
int
|
||||
default_goto(int symbol)
|
||||
{
|
||||
register int i;
|
||||
register int m;
|
||||
register int n;
|
||||
register int default_state;
|
||||
register int max;
|
||||
int i;
|
||||
int m;
|
||||
int n;
|
||||
int default_state;
|
||||
int max;
|
||||
|
||||
m = goto_map[symbol];
|
||||
n = goto_map[symbol + 1];
|
||||
@@ -363,16 +390,18 @@ default_goto(int symbol)
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
save_column(int symbol, int default_state)
|
||||
{
|
||||
register int i;
|
||||
register int m;
|
||||
register int n;
|
||||
register short *sp;
|
||||
register short *sp1;
|
||||
register short *sp2;
|
||||
register int count;
|
||||
register int symno;
|
||||
int i;
|
||||
int m;
|
||||
int n;
|
||||
short *sp;
|
||||
short *sp1;
|
||||
short *sp2;
|
||||
int count;
|
||||
int symno;
|
||||
|
||||
m = goto_map[symbol];
|
||||
n = goto_map[symbol + 1];
|
||||
@@ -383,7 +412,7 @@ save_column(int symbol, int default_state)
|
||||
if (to_state[i] != default_state)
|
||||
++count;
|
||||
}
|
||||
if (count == 0) return(0);
|
||||
if (count == 0) return;
|
||||
|
||||
symno = symbol_value[symbol] + 2*nstates;
|
||||
|
||||
@@ -401,16 +430,16 @@ save_column(int symbol, int default_state)
|
||||
|
||||
tally[symno] = count;
|
||||
width[symno] = sp1[-1] - sp[0] + 1;
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void
|
||||
sort_actions(void)
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
register int k;
|
||||
register int t;
|
||||
register int w;
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
int t;
|
||||
int w;
|
||||
|
||||
order = NEW2(nvectors, short);
|
||||
nentries = 0;
|
||||
@@ -439,11 +468,12 @@ sort_actions(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pack_table(void)
|
||||
{
|
||||
register int i;
|
||||
register int place;
|
||||
register int state;
|
||||
int i;
|
||||
int place;
|
||||
int state;
|
||||
|
||||
base = NEW2(nvectors, short);
|
||||
pos = NEW2(nentries, short);
|
||||
@@ -504,13 +534,13 @@ pack_table(void)
|
||||
int
|
||||
matching_vector(int vector)
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
register int k;
|
||||
register int t;
|
||||
register int w;
|
||||
register int match;
|
||||
register int prev;
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
int t;
|
||||
int w;
|
||||
int match;
|
||||
int prev;
|
||||
|
||||
i = order[vector];
|
||||
if (i >= 2*nstates)
|
||||
@@ -544,12 +574,12 @@ matching_vector(int vector)
|
||||
int
|
||||
pack_vector(int vector)
|
||||
{
|
||||
register int i, j, k, l;
|
||||
register int t;
|
||||
register int loc;
|
||||
register int ok;
|
||||
register short *from;
|
||||
register short *to;
|
||||
int i, j, k, l;
|
||||
int t;
|
||||
int loc;
|
||||
int ok;
|
||||
short *from;
|
||||
short *to;
|
||||
int newmax;
|
||||
|
||||
i = order[vector];
|
||||
@@ -618,9 +648,10 @@ pack_vector(int vector)
|
||||
|
||||
|
||||
|
||||
static void
|
||||
output_base(void)
|
||||
{
|
||||
register int i, j;
|
||||
int i, j;
|
||||
|
||||
fprintf(output_file, "static short %ssindex[] = {%39d,", symbol_prefix, base[0]);
|
||||
|
||||
@@ -684,10 +715,11 @@ output_base(void)
|
||||
|
||||
|
||||
|
||||
static void
|
||||
output_table(void)
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
++outline;
|
||||
fprintf(code_file, "#define YYTABLESIZE %d\n", high);
|
||||
@@ -716,10 +748,11 @@ output_table(void)
|
||||
|
||||
|
||||
|
||||
static void
|
||||
output_check(void)
|
||||
{
|
||||
register int i;
|
||||
register int j;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
fprintf(output_file, "static short %scheck[] = {%40d,", symbol_prefix,
|
||||
check[0]);
|
||||
@@ -745,11 +778,11 @@ output_check(void)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
is_C_identifier(char *name)
|
||||
{
|
||||
register char *s;
|
||||
register int c;
|
||||
char *s;
|
||||
int c;
|
||||
|
||||
s = name;
|
||||
c = *s;
|
||||
@@ -768,7 +801,7 @@ is_C_identifier(char *name)
|
||||
|
||||
if (!isalpha(c) && c != '_' && c != '$')
|
||||
return (0);
|
||||
while (c = *++s)
|
||||
while ((c = *++s))
|
||||
{
|
||||
if (!isalnum(c) && c != '_' && c != '$')
|
||||
return (0);
|
||||
@@ -777,10 +810,11 @@ is_C_identifier(char *name)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
output_defines(void)
|
||||
{
|
||||
register int c, i;
|
||||
register char *s;
|
||||
int c, i;
|
||||
char *s;
|
||||
|
||||
for (i = 2; i < ntokens; ++i)
|
||||
{
|
||||
@@ -805,7 +839,7 @@ output_defines(void)
|
||||
putc(c, code_file);
|
||||
if (dflag) putc(c, defines_file);
|
||||
}
|
||||
while (c = *++s);
|
||||
while ((c = *++s));
|
||||
}
|
||||
++outline;
|
||||
fprintf(code_file, " %d\n", symbol_value[i]);
|
||||
@@ -827,15 +861,16 @@ output_defines(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
output_stored_text(void)
|
||||
{
|
||||
register int c;
|
||||
register FILE *in, *out;
|
||||
int c;
|
||||
FILE *in, *out;
|
||||
|
||||
rewind(text_file);
|
||||
in = text_file;
|
||||
if ((c = getc(in)) == EOF)
|
||||
return(0);
|
||||
return;
|
||||
out = code_file;
|
||||
if (c == '\n')
|
||||
++outline;
|
||||
@@ -848,14 +883,13 @@ output_stored_text(void)
|
||||
}
|
||||
if (!lflag)
|
||||
fprintf(out, line_format, ++outline + 1, code_file_name);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
output_debug(void)
|
||||
{
|
||||
register int i, j, k, max;
|
||||
int i, j, k, max;
|
||||
char **symnam, *s;
|
||||
|
||||
++outline;
|
||||
@@ -890,7 +924,7 @@ output_debug(void)
|
||||
j = 80;
|
||||
for (i = 0; i <= max; ++i)
|
||||
{
|
||||
if (s = symnam[i])
|
||||
if ((s = symnam[i]))
|
||||
{
|
||||
if (s[0] == '"')
|
||||
{
|
||||
@@ -1067,6 +1101,7 @@ output_debug(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
output_stype(void)
|
||||
{
|
||||
if (!unionized && ntags == 0)
|
||||
@@ -1077,13 +1112,14 @@ output_stype(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
output_trailing_text(void)
|
||||
{
|
||||
register int c, last;
|
||||
register FILE *in, *out;
|
||||
int c, last;
|
||||
FILE *in, *out;
|
||||
|
||||
if (line == 0)
|
||||
return(0);
|
||||
return;
|
||||
|
||||
in = input_file;
|
||||
out = code_file;
|
||||
@@ -1092,7 +1128,7 @@ output_trailing_text(void)
|
||||
{
|
||||
++lineno;
|
||||
if ((c = getc(in)) == EOF)
|
||||
return(0);
|
||||
return;
|
||||
if (!lflag)
|
||||
{
|
||||
++outline;
|
||||
@@ -1131,20 +1167,19 @@ output_trailing_text(void)
|
||||
}
|
||||
if (!lflag)
|
||||
fprintf(out, line_format, ++outline + 1, code_file_name);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
output_semantic_actions(void)
|
||||
{
|
||||
register int c, last;
|
||||
register FILE *out;
|
||||
int c, last;
|
||||
FILE *out;
|
||||
|
||||
rewind(action_file);
|
||||
|
||||
if ((c = getc(action_file)) == EOF)
|
||||
return(0);
|
||||
return;
|
||||
|
||||
out = code_file;
|
||||
last = c;
|
||||
@@ -1167,14 +1202,13 @@ output_semantic_actions(void)
|
||||
|
||||
if (!lflag)
|
||||
fprintf(out, line_format, ++outline + 1, code_file_name);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
free_itemsets(void)
|
||||
{
|
||||
register core *cp, *next;
|
||||
core *cp, *next;
|
||||
|
||||
FREE(state_table);
|
||||
for (cp = first_state; cp; cp = next)
|
||||
@@ -1185,9 +1219,10 @@ free_itemsets(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
free_shifts(void)
|
||||
{
|
||||
register shifts *sp, *next;
|
||||
shifts *sp, *next;
|
||||
|
||||
FREE(shift_table);
|
||||
for (sp = first_shift; sp; sp = next)
|
||||
@@ -1198,10 +1233,10 @@ free_shifts(void)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
free_reductions(void)
|
||||
{
|
||||
register reductions *rp, *next;
|
||||
reductions *rp, *next;
|
||||
|
||||
FREE(reduction_table);
|
||||
for (rp = first_reduction; rp; rp = next)
|
||||
|
||||
+116
-86
@@ -3,8 +3,7 @@
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
#include "defs.h"
|
||||
@@ -42,7 +41,12 @@ char *name_pool;
|
||||
|
||||
char line_format[] = "#line %d \"%s\"\n";
|
||||
|
||||
#define static
|
||||
|
||||
static void start_rule(bucket *bp, int s_lineno);
|
||||
|
||||
|
||||
static void
|
||||
cachec(int c)
|
||||
{
|
||||
assert(cinc >= 0);
|
||||
@@ -57,18 +61,19 @@ cachec(int c)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
get_line(void)
|
||||
{
|
||||
register FILE *f = input_file;
|
||||
register int c;
|
||||
register int i;
|
||||
FILE *f = input_file;
|
||||
int c;
|
||||
int i;
|
||||
|
||||
if (saw_eof || (c = getc(f)) == EOF)
|
||||
{
|
||||
if (line) { FREE(line); line = 0; }
|
||||
cptr = 0;
|
||||
saw_eof = 1;
|
||||
return(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (line == 0 || linesize != (LINESIZE + 1))
|
||||
@@ -84,7 +89,7 @@ get_line(void)
|
||||
for (;;)
|
||||
{
|
||||
line[i] = c;
|
||||
if (c == '\n') { cptr = line; return(0); }
|
||||
if (c == '\n') { cptr = line; return; }
|
||||
if (++i >= linesize)
|
||||
{
|
||||
linesize += LINESIZE;
|
||||
@@ -97,16 +102,16 @@ get_line(void)
|
||||
line[i] = '\n';
|
||||
saw_eof = 1;
|
||||
cptr = line;
|
||||
return(0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
static char *
|
||||
dup_line(void)
|
||||
{
|
||||
register char *p, *s, *t;
|
||||
char *p, *s, *t;
|
||||
|
||||
if (line == 0) return (0);
|
||||
s = line;
|
||||
@@ -121,9 +126,10 @@ dup_line(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
skip_comment(void)
|
||||
{
|
||||
register char *s;
|
||||
char *s;
|
||||
|
||||
int st_lineno = lineno;
|
||||
char *st_line = dup_line();
|
||||
@@ -136,7 +142,7 @@ skip_comment(void)
|
||||
{
|
||||
cptr = s + 2;
|
||||
FREE(st_line);
|
||||
return(0);
|
||||
return;
|
||||
}
|
||||
if (*s == '\n')
|
||||
{
|
||||
@@ -151,10 +157,10 @@ skip_comment(void)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
nextc(void)
|
||||
{
|
||||
register char *s;
|
||||
char *s;
|
||||
|
||||
if (line == 0)
|
||||
{
|
||||
@@ -213,10 +219,10 @@ nextc(void)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
keyword(void)
|
||||
{
|
||||
register int c;
|
||||
int c;
|
||||
char *t_cptr = cptr;
|
||||
|
||||
c = *++cptr;
|
||||
@@ -276,10 +282,11 @@ keyword(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
copy_ident(void)
|
||||
{
|
||||
register int c;
|
||||
register FILE *f = output_file;
|
||||
int c;
|
||||
FILE *f = output_file;
|
||||
|
||||
c = nextc();
|
||||
if (c == EOF) unexpected_EOF();
|
||||
@@ -292,24 +299,25 @@ copy_ident(void)
|
||||
if (c == '\n')
|
||||
{
|
||||
fprintf(f, "\"\n");
|
||||
return(0);
|
||||
return;
|
||||
}
|
||||
putc(c, f);
|
||||
if (c == '"')
|
||||
{
|
||||
putc('\n', f);
|
||||
++cptr;
|
||||
return(0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
copy_text(void)
|
||||
{
|
||||
register int c;
|
||||
int c;
|
||||
int quote;
|
||||
register FILE *f = text_file;
|
||||
FILE *f = text_file;
|
||||
int need_newline = 0;
|
||||
int t_lineno = lineno;
|
||||
char *t_line = dup_line();
|
||||
@@ -424,7 +432,7 @@ loop:
|
||||
if (need_newline) putc('\n', f);
|
||||
++cptr;
|
||||
FREE(t_line);
|
||||
return(0);
|
||||
return;
|
||||
}
|
||||
/* fall through */
|
||||
|
||||
@@ -436,9 +444,10 @@ loop:
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
copy_union(void)
|
||||
{
|
||||
register int c;
|
||||
int c;
|
||||
int quote;
|
||||
int depth;
|
||||
int u_lineno = lineno;
|
||||
@@ -476,7 +485,7 @@ loop:
|
||||
{
|
||||
fprintf(text_file, " YYSTYPE;\n");
|
||||
FREE(u_line);
|
||||
return(0);
|
||||
return;
|
||||
}
|
||||
goto loop;
|
||||
|
||||
@@ -576,7 +585,7 @@ loop:
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
hexval(int c)
|
||||
{
|
||||
if (c >= '0' && c <= '9')
|
||||
@@ -589,14 +598,14 @@ hexval(int c)
|
||||
}
|
||||
|
||||
|
||||
bucket *
|
||||
static bucket *
|
||||
get_literal(void)
|
||||
{
|
||||
register int c, quote;
|
||||
register int i;
|
||||
register int n;
|
||||
register char *s;
|
||||
register bucket *bp;
|
||||
int c, quote;
|
||||
int i;
|
||||
int n;
|
||||
char *s;
|
||||
bucket *bp;
|
||||
int s_lineno = lineno;
|
||||
char *s_line = dup_line();
|
||||
char *s_cptr = s_line + (cptr - line);
|
||||
@@ -728,7 +737,7 @@ get_literal(void)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
is_reserved(char *name)
|
||||
{
|
||||
char *s;
|
||||
@@ -749,10 +758,10 @@ is_reserved(char *name)
|
||||
}
|
||||
|
||||
|
||||
bucket *
|
||||
static bucket *
|
||||
get_name(void)
|
||||
{
|
||||
register int c;
|
||||
int c;
|
||||
|
||||
cinc = 0;
|
||||
for (c = *cptr; IS_IDENT(c); c = *++cptr)
|
||||
@@ -765,11 +774,11 @@ get_name(void)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
get_number(void)
|
||||
{
|
||||
register int c;
|
||||
register int n;
|
||||
int c;
|
||||
int n;
|
||||
|
||||
n = 0;
|
||||
for (c = *cptr; isdigit(c); c = *++cptr)
|
||||
@@ -779,12 +788,12 @@ get_number(void)
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
static char *
|
||||
get_tag(void)
|
||||
{
|
||||
register int c;
|
||||
register int i;
|
||||
register char *s;
|
||||
int c;
|
||||
int i;
|
||||
char *s;
|
||||
int t_lineno = lineno;
|
||||
char *t_line = dup_line();
|
||||
char *t_cptr = t_line + (cptr - line);
|
||||
@@ -830,10 +839,11 @@ get_tag(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
declare_tokens(int assoc)
|
||||
{
|
||||
register int c;
|
||||
register bucket *bp;
|
||||
int c;
|
||||
bucket *bp;
|
||||
int value;
|
||||
char *tag = 0;
|
||||
|
||||
@@ -855,7 +865,7 @@ declare_tokens(int assoc)
|
||||
else if (c == '\'' || c == '"')
|
||||
bp = get_literal();
|
||||
else
|
||||
return(0);
|
||||
return;
|
||||
|
||||
if (bp == goal) tokenized_start(bp->name);
|
||||
bp->class = TERM;
|
||||
@@ -891,10 +901,11 @@ declare_tokens(int assoc)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
declare_types(void)
|
||||
{
|
||||
register int c;
|
||||
register bucket *bp;
|
||||
int c;
|
||||
bucket *bp;
|
||||
char *tag;
|
||||
|
||||
c = nextc();
|
||||
@@ -910,7 +921,7 @@ declare_types(void)
|
||||
else if (c == '\'' || c == '"')
|
||||
bp = get_literal();
|
||||
else
|
||||
return(0);
|
||||
return;
|
||||
|
||||
if (bp->tag && tag != bp->tag)
|
||||
retyped_warning(bp->name);
|
||||
@@ -919,10 +930,11 @@ declare_types(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
declare_start(void)
|
||||
{
|
||||
register int c;
|
||||
register bucket *bp;
|
||||
int c;
|
||||
bucket *bp;
|
||||
|
||||
c = nextc();
|
||||
if (c == EOF) unexpected_EOF();
|
||||
@@ -937,9 +949,10 @@ declare_start(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
read_declarations(void)
|
||||
{
|
||||
register int c, k;
|
||||
int c, k;
|
||||
|
||||
cache_size = 256;
|
||||
cache = MALLOC(cache_size);
|
||||
@@ -953,7 +966,7 @@ read_declarations(void)
|
||||
switch (k = keyword())
|
||||
{
|
||||
case MARK:
|
||||
return(0);
|
||||
return;
|
||||
|
||||
case IDENT:
|
||||
copy_ident();
|
||||
@@ -986,6 +999,7 @@ read_declarations(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
initialize_grammar(void)
|
||||
{
|
||||
nitems = 4;
|
||||
@@ -1017,6 +1031,7 @@ initialize_grammar(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
expand_items(void)
|
||||
{
|
||||
maxitems += 300;
|
||||
@@ -1025,6 +1040,7 @@ expand_items(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
expand_rules(void)
|
||||
{
|
||||
maxrules += 100;
|
||||
@@ -1037,10 +1053,11 @@ expand_rules(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
advance_to_start(void)
|
||||
{
|
||||
register int c;
|
||||
register bucket *bp;
|
||||
int c;
|
||||
bucket *bp;
|
||||
char *s_cptr;
|
||||
int s_lineno;
|
||||
|
||||
@@ -1087,7 +1104,8 @@ advance_to_start(void)
|
||||
}
|
||||
|
||||
|
||||
start_rule(register bucket *bp, int s_lineno)
|
||||
static void
|
||||
start_rule(bucket *bp, int s_lineno)
|
||||
{
|
||||
if (bp->class == TERM)
|
||||
terminal_lhs(s_lineno);
|
||||
@@ -1100,9 +1118,10 @@ start_rule(register bucket *bp, int s_lineno)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
end_rule(void)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
if (!last_was_action && plhs[nrules]->tag)
|
||||
{
|
||||
@@ -1119,9 +1138,10 @@ end_rule(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
insert_empty_rule(void)
|
||||
{
|
||||
register bucket *bp, **bpp;
|
||||
bucket *bp, **bpp;
|
||||
|
||||
assert(cache);
|
||||
sprintf(cache, "$$%d", ++gensym);
|
||||
@@ -1135,7 +1155,7 @@ insert_empty_rule(void)
|
||||
expand_items();
|
||||
bpp = pitem + nitems - 1;
|
||||
*bpp-- = bp;
|
||||
while (bpp[0] = bpp[-1]) --bpp;
|
||||
while ((bpp[0] = bpp[-1])) --bpp;
|
||||
|
||||
if (++nrules >= maxrules)
|
||||
expand_rules();
|
||||
@@ -1148,10 +1168,11 @@ insert_empty_rule(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
add_symbol(void)
|
||||
{
|
||||
register int c;
|
||||
register bucket *bp;
|
||||
int c;
|
||||
bucket *bp;
|
||||
int s_lineno = lineno;
|
||||
|
||||
c = *cptr;
|
||||
@@ -1166,7 +1187,7 @@ add_symbol(void)
|
||||
end_rule();
|
||||
start_rule(bp, s_lineno);
|
||||
++cptr;
|
||||
return(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (last_was_action)
|
||||
@@ -1179,14 +1200,15 @@ add_symbol(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
copy_action(void)
|
||||
{
|
||||
register int c;
|
||||
register int i, n;
|
||||
int c;
|
||||
int i, n;
|
||||
int depth;
|
||||
int quote;
|
||||
char *tag;
|
||||
register FILE *f = action_file;
|
||||
FILE *f = action_file;
|
||||
int a_lineno = lineno;
|
||||
char *a_line = dup_line();
|
||||
char *a_cptr = a_line + (cptr - line);
|
||||
@@ -1308,7 +1330,8 @@ loop:
|
||||
case ';':
|
||||
if (depth > 0) goto loop;
|
||||
fprintf(f, "\nbreak;\n");
|
||||
return(0);
|
||||
FREE(a_line);
|
||||
return;
|
||||
|
||||
case '{':
|
||||
++depth;
|
||||
@@ -1317,7 +1340,8 @@ loop:
|
||||
case '}':
|
||||
if (--depth > 0) goto loop;
|
||||
fprintf(f, "\nbreak;\n");
|
||||
return(0);
|
||||
FREE(a_line);
|
||||
return;
|
||||
|
||||
case '\'':
|
||||
case '"':
|
||||
@@ -1402,11 +1426,11 @@ loop:
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
mark_symbol(void)
|
||||
{
|
||||
register int c;
|
||||
register bucket *bp;
|
||||
int c;
|
||||
bucket *bp;
|
||||
|
||||
c = cptr[1];
|
||||
if (c == '%' || c == '\\')
|
||||
@@ -1446,9 +1470,10 @@ mark_symbol(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
read_grammar(void)
|
||||
{
|
||||
register int c;
|
||||
int c;
|
||||
|
||||
initialize_grammar();
|
||||
advance_to_start();
|
||||
@@ -1479,11 +1504,12 @@ read_grammar(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
free_tags(void)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
if (tag_table == 0) return(0);
|
||||
if (tag_table == 0) return;
|
||||
|
||||
for (i = 0; i < ntags; ++i)
|
||||
{
|
||||
@@ -1491,14 +1517,14 @@ free_tags(void)
|
||||
FREE(tag_table[i]);
|
||||
}
|
||||
FREE(tag_table);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pack_names(void)
|
||||
{
|
||||
register bucket *bp;
|
||||
register char *p, *s, *t;
|
||||
bucket *bp;
|
||||
char *p, *s, *t;
|
||||
|
||||
name_pool_size = 13; /* 13 == sizeof("$end") + sizeof("$accept") */
|
||||
for (bp = first_symbol; bp; bp = bp->next)
|
||||
@@ -1513,16 +1539,17 @@ pack_names(void)
|
||||
{
|
||||
p = t;
|
||||
s = bp->name;
|
||||
while (*t++ = *s++) continue;
|
||||
while ((*t++ = *s++)) continue;
|
||||
FREE(bp->name);
|
||||
bp->name = p;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
check_symbols(void)
|
||||
{
|
||||
register bucket *bp;
|
||||
bucket *bp;
|
||||
|
||||
if (goal->class == UNKNOWN)
|
||||
undefined_goal(goal->name);
|
||||
@@ -1538,11 +1565,12 @@ check_symbols(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pack_symbols(void)
|
||||
{
|
||||
register bucket *bp;
|
||||
register bucket **v;
|
||||
register int i, j, k, n;
|
||||
bucket *bp;
|
||||
bucket **v;
|
||||
int i, j, k, n;
|
||||
|
||||
nsyms = 2;
|
||||
ntokens = 1;
|
||||
@@ -1662,9 +1690,10 @@ pack_symbols(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pack_grammar(void)
|
||||
{
|
||||
register int i, j;
|
||||
int i, j;
|
||||
int assoc, prec;
|
||||
|
||||
ritem = (short *) MALLOC(nitems*sizeof(short));
|
||||
@@ -1721,13 +1750,14 @@ pack_grammar(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
print_grammar(void)
|
||||
{
|
||||
register int i, j, k;
|
||||
int spacing;
|
||||
register FILE *f = verbose_file;
|
||||
int i, j, k;
|
||||
int spacing = 0;
|
||||
FILE *f = verbose_file;
|
||||
|
||||
if (!vflag) return(0);
|
||||
if (!vflag) return;
|
||||
|
||||
k = 1;
|
||||
for (i = 2; i < nrules; ++i)
|
||||
@@ -1754,10 +1784,10 @@ print_grammar(void)
|
||||
++k;
|
||||
putc('\n', f);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
reader(void)
|
||||
{
|
||||
write_section(banner);
|
||||
|
||||
@@ -3,16 +3,11 @@
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
#include "defs.h"
|
||||
|
||||
/* The definition of yysccsid in the banner should be replaced with */
|
||||
/* a #pragma ident directive if the target C compiler supports */
|
||||
/* #pragma ident directives. */
|
||||
/* */
|
||||
/* If the skeleton is changed, the banner should be changed so that */
|
||||
/* the altered version can be easily distinguished from the original. */
|
||||
/* */
|
||||
@@ -68,7 +63,7 @@ char *header[] =
|
||||
"#endif",
|
||||
"#if YYDEBUG", /* MRK */
|
||||
"static int yydebug;", /* JRW */
|
||||
"#endif", /* MRK */
|
||||
"#endif", /* MRK */
|
||||
"static int yynerrs;", /* JRW */
|
||||
"static int yyerrflag;", /* JRW */
|
||||
"static int yychar;", /* JRW */
|
||||
@@ -92,9 +87,9 @@ char *body[] =
|
||||
"static int", /* JRW */
|
||||
"yyparse(void)", /* JRW */
|
||||
"{",
|
||||
" register int yym, yyn, yystate;",
|
||||
" int yym, yyn, yystate;",
|
||||
"#if YYDEBUG",
|
||||
" register char *yys;",
|
||||
" char *yys;",
|
||||
" extern char *getenv();",
|
||||
"",
|
||||
" if ((yys = getenv(\"YYDEBUG\")))",
|
||||
@@ -285,18 +280,19 @@ char *trailer[] =
|
||||
};
|
||||
|
||||
|
||||
void
|
||||
write_section(char *section[])
|
||||
{
|
||||
register int c;
|
||||
register int i;
|
||||
register char *s;
|
||||
register FILE *f;
|
||||
int c;
|
||||
int i;
|
||||
char *s;
|
||||
FILE *f;
|
||||
|
||||
f = code_file;
|
||||
for (i = 0; s = section[i]; ++i)
|
||||
for (i = 0; (s = section[i]); ++i)
|
||||
{
|
||||
++outline;
|
||||
while (c = *s)
|
||||
while ((c = *s))
|
||||
{
|
||||
putc(c, f);
|
||||
++s;
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
#include "defs.h"
|
||||
@@ -21,16 +20,16 @@ bucket *first_symbol;
|
||||
bucket *last_symbol;
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
hash(char *name)
|
||||
{
|
||||
register char *s;
|
||||
register int c, k;
|
||||
char *s;
|
||||
int c, k;
|
||||
|
||||
assert(name && *name);
|
||||
s = name;
|
||||
k = *s;
|
||||
while (c = *++s)
|
||||
while ((c = *++s))
|
||||
k = (31*k + c) & (TABLE_SIZE - 1);
|
||||
|
||||
return (k);
|
||||
@@ -40,7 +39,7 @@ hash(char *name)
|
||||
bucket *
|
||||
make_bucket(char *name)
|
||||
{
|
||||
register bucket *bp;
|
||||
bucket *bp;
|
||||
|
||||
assert(name);
|
||||
bp = (bucket *) MALLOC(sizeof(bucket));
|
||||
@@ -66,7 +65,7 @@ make_bucket(char *name)
|
||||
bucket *
|
||||
lookup(char *name)
|
||||
{
|
||||
register bucket *bp, **bpp;
|
||||
bucket *bp, **bpp;
|
||||
|
||||
bpp = symbol_table + hash(name);
|
||||
bp = *bpp;
|
||||
@@ -85,11 +84,11 @@ lookup(char *name)
|
||||
return (bp);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
create_symbol_table(void)
|
||||
{
|
||||
register int i;
|
||||
register bucket *bp;
|
||||
int i;
|
||||
bucket *bp;
|
||||
|
||||
symbol_table = (bucket **) MALLOC(TABLE_SIZE*sizeof(bucket *));
|
||||
if (symbol_table == 0) no_space();
|
||||
@@ -106,6 +105,7 @@ create_symbol_table(void)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
free_symbol_table(void)
|
||||
{
|
||||
FREE(symbol_table);
|
||||
@@ -113,9 +113,10 @@ free_symbol_table(void)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
free_symbols(void)
|
||||
{
|
||||
register bucket *p, *q;
|
||||
bucket *p, *q;
|
||||
|
||||
for (p = first_symbol; p; p = q)
|
||||
{
|
||||
|
||||
@@ -3,21 +3,32 @@
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
|
||||
static short *null_rules;
|
||||
|
||||
static void log_unused(void);
|
||||
static void log_conflicts(void);
|
||||
static void print_state(int state);
|
||||
static void print_conflicts(int state);
|
||||
static void print_core(int state);
|
||||
static void print_nulls(int state);
|
||||
static void print_actions(int state);
|
||||
static void print_shifts(action *p);
|
||||
static void print_reductions(action *p, int defred);
|
||||
static void print_gotos(int stateno);
|
||||
|
||||
|
||||
void
|
||||
verbose(void)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
if (!vflag) return(0);
|
||||
if (!vflag) return;
|
||||
|
||||
null_rules = (short *) MALLOC(nrules*sizeof(short));
|
||||
if (null_rules == 0) no_space();
|
||||
@@ -33,15 +44,14 @@ verbose(void)
|
||||
|
||||
fprintf(verbose_file, "\n\n%d terminals, %d nonterminals\n", ntokens, nvars);
|
||||
fprintf(verbose_file, "%d grammar rules, %d states\n", nrules - 2, nstates);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
log_unused(void)
|
||||
{
|
||||
register int i;
|
||||
register short *p;
|
||||
int i;
|
||||
short *p;
|
||||
|
||||
fprintf(verbose_file, "\n\nRules never reduced:\n");
|
||||
for (i = 3; i < nrules; ++i)
|
||||
@@ -57,9 +67,10 @@ log_unused(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
log_conflicts(void)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
fprintf(verbose_file, "\n\n");
|
||||
for (i = 0; i < nstates; i++)
|
||||
@@ -85,6 +96,7 @@ log_conflicts(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
print_state(int state)
|
||||
{
|
||||
if (state)
|
||||
@@ -98,10 +110,11 @@ print_state(int state)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
print_conflicts(int state)
|
||||
{
|
||||
register int symbol, act, number;
|
||||
register action *p;
|
||||
int symbol, act = 0, number = 0;
|
||||
action *p;
|
||||
|
||||
symbol = -1;
|
||||
for (p = parser[state]; p; p = p->next)
|
||||
@@ -145,14 +158,15 @@ print_conflicts(int state)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
print_core(int state)
|
||||
{
|
||||
register int i;
|
||||
register int k;
|
||||
register int rule;
|
||||
register core *statep;
|
||||
register short *sp;
|
||||
register short *sp1;
|
||||
int i;
|
||||
int k;
|
||||
int rule;
|
||||
core *statep;
|
||||
short *sp;
|
||||
short *sp1;
|
||||
|
||||
statep = state_table[state];
|
||||
k = statep->nitems;
|
||||
@@ -180,10 +194,11 @@ print_core(int state)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
print_nulls(int state)
|
||||
{
|
||||
register action *p;
|
||||
register int i, j, k, nnulls;
|
||||
action *p;
|
||||
int i, j, k, nnulls;
|
||||
|
||||
nnulls = 0;
|
||||
for (p = parser[state]; p; p = p->next)
|
||||
@@ -223,11 +238,12 @@ print_nulls(int state)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
print_actions(int stateno)
|
||||
{
|
||||
register action *p;
|
||||
register shifts *sp;
|
||||
register int as;
|
||||
action *p;
|
||||
shifts *sp;
|
||||
int as;
|
||||
|
||||
if (stateno == final_state)
|
||||
fprintf(verbose_file, "\t$end accept\n");
|
||||
@@ -249,10 +265,11 @@ print_actions(int stateno)
|
||||
}
|
||||
|
||||
|
||||
print_shifts(register action *p)
|
||||
static void
|
||||
print_shifts(action *p)
|
||||
{
|
||||
register int count;
|
||||
register action *q;
|
||||
int count;
|
||||
action *q;
|
||||
|
||||
count = 0;
|
||||
for (q = p; q; q = q->next)
|
||||
@@ -273,10 +290,11 @@ print_shifts(register action *p)
|
||||
}
|
||||
|
||||
|
||||
print_reductions(register action *p, register int defred)
|
||||
static void
|
||||
print_reductions(action *p, int defred)
|
||||
{
|
||||
register int k, anyreds;
|
||||
register action *q;
|
||||
int k, anyreds;
|
||||
action *q;
|
||||
|
||||
anyreds = 0;
|
||||
for (q = p; q ; q = q->next)
|
||||
@@ -309,12 +327,13 @@ print_reductions(register action *p, register int defred)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
print_gotos(int stateno)
|
||||
{
|
||||
register int i, k;
|
||||
register int as;
|
||||
register short *to_state;
|
||||
register shifts *sp;
|
||||
int i, k;
|
||||
int as;
|
||||
short *to_state;
|
||||
shifts *sp;
|
||||
|
||||
putc('\n', verbose_file);
|
||||
sp = shift_table[stateno];
|
||||
|
||||
@@ -3,23 +3,23 @@
|
||||
* National Laboratory.
|
||||
* Copyright (c) 2002 The Regents of the University of California, as
|
||||
* Operator of Los Alamos National Laboratory.
|
||||
* EPICS BASE Versions 3.13.7
|
||||
* and higher are distributed subject to a Software License Agreement found
|
||||
* EPICS BASE is distributed subject to a Software License Agreement found
|
||||
* in file LICENSE that is included with this distribution.
|
||||
\*************************************************************************/
|
||||
#include "defs.h"
|
||||
|
||||
static void
|
||||
transitive_closure(unsigned int *R, int n)
|
||||
{
|
||||
register int rowsize;
|
||||
register unsigned i;
|
||||
register unsigned *rowj;
|
||||
register unsigned *rp;
|
||||
register unsigned *rend;
|
||||
register unsigned *ccol;
|
||||
register unsigned *relend;
|
||||
register unsigned *cword;
|
||||
register unsigned *rowi;
|
||||
int rowsize;
|
||||
unsigned i;
|
||||
unsigned *rowj;
|
||||
unsigned *rp;
|
||||
unsigned *rend;
|
||||
unsigned *ccol;
|
||||
unsigned *relend;
|
||||
unsigned *cword;
|
||||
unsigned *rowi;
|
||||
|
||||
rowsize = WORDSIZE(n);
|
||||
relend = R + n*rowsize;
|
||||
@@ -59,12 +59,13 @@ transitive_closure(unsigned int *R, int n)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
reflexive_transitive_closure(unsigned int *R, int n)
|
||||
{
|
||||
register int rowsize;
|
||||
register unsigned i;
|
||||
register unsigned *rp;
|
||||
register unsigned *relend;
|
||||
int rowsize;
|
||||
unsigned i;
|
||||
unsigned *rp;
|
||||
unsigned *relend;
|
||||
|
||||
transitive_closure(R, n);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user