usr.bin/tty
usr.bin/uniq
usr.bin/units
+usr.bin/yacc/yacc
xify/cc
xify/ld
xify/xify
mkdir -p lib/libc/sys/profiled
(cd lib/libc && make.sh clean && make.sh && make.sh install)
(cd bin && make.sh clean && make.sh SUBDIR="as csh diff sed sh tp" NSTD= KMEM= && make.sh SUBDIR="as csh diff sed sh tp" NSTD= KMEM= install)
-(cd usr.bin && make.sh clean && make.sh SUBDIR=find NSTD= KMEM= && make.sh SUBDIR=find NSTD= KMEM= install)
+(cd usr.bin && make.sh clean && make.sh SUBDIR="find yacc" NSTD= KMEM= && make.sh SUBDIR="find yacc" NSTD= KMEM= install)
#(cd test && make clean && make)
/* sizes and limits */
+/* Nick changed memory size to reflect that some words allocated are pointers */
# ifdef HUGE
# define ACTSIZE 12000
-# define MEMSIZE 24000
+# define MEMSIZE (24000 * sizeof(char *) / sizeof(int))
# define NSTATES 750
# define NTERMS 300
# define NPROD 600
# ifdef MEDIUM
# define ACTSIZE 4000
-# define MEMSIZE 5200
+# define MEMSIZE (5200 * sizeof(char *) / sizeof(int))
# define NSTATES 600
# define NTERMS 127
# define NPROD 400
/* y1.c */
int main __P((int argc, char *argv[]));
-int others __P((void));
+void others __P((void));
char *chcopy __P((char *p, char *q));
char *writem __P((int *pp));
char *symnam __P((int i));
-int summary __P((void));
-int error __P((char *s, ...));
-int aryfil __P((int *v, int n, int c));
+void summary __P((void));
+void error __P((char *s, ...));
+void aryfil __P((int *v, int n, int c));
int setunion __P((register *a, register *b));
-int prlook __P((struct looksets *p));
-int cpres __P((void));
-int cpfir __P((void));
+void prlook __P((struct looksets *p));
+void cpres __P((void));
+void cpfir __P((void));
int state __P((int c));
-int putitem __P((int *ptr, struct looksets *lptr));
-int cempty __P((void));
-int stagen __P((void));
-int closure __P((int i));
+void putitem __P((int *ptr, struct looksets *lptr));
+void cempty __P((void));
+void stagen __P((void));
+void closure __P((int i));
struct looksets *flset __P((struct looksets *p));
/* y2.c */
-int setup __P((int argc, char *argv[]));
-int finact __P((void));
+void setup __P((int argc, char *argv[]));
+void finact __P((void));
int defin __P((int t, register char *s));
-int defout __P((void));
+void defout __P((void));
char *cstash __P((register char *s));
int gettok __P((void));
int fdtype __P((int t));
int chfind __P((int t, register char *s));
-int cpyunion __P((void));
-int cpycode __P((void));
+void cpyunion __P((void));
+void cpycode __P((void));
int skipcom __P((void));
-int cpyact __P((int offset));
+void cpyact __P((int offset));
/* y3.c */
-int output __P((void));
+void output __P((void));
int apack __P((int *p, int n));
-int go2out __P((void));
-int go2gen __P((int c));
-int precftn __P((int r, int t, int s));
-int wract __P((int i));
-int wrstate __P((int i));
-int wdef __P((char *s, int n));
-int warray __P((char *s, int *v, int n));
-int hideprod __P((void));
+void go2out __P((void));
+void go2gen __P((int c));
+void precftn __P((int r, int t, int s));
+void wract __P((int i));
+void wrstate __P((int i));
+void wdef __P((char *s, int n));
+void warray __P((char *s, int *v, int n));
+void hideprod __P((void));
/* y4.c */
-int callopt __P((void));
-int gin __P((int i));
-int stin __P((int i));
+void callopt __P((void));
+void gin __P((int i));
+void stin __P((int i));
int nxti __P((void));
-int osummary __P((void));
-int aoutput __P((void));
-int arout __P((char *s, int *v, int n));
+void osummary __P((void));
+void aoutput __P((void));
+void arout __P((char *s, int *v, int n));
int gtnm __P((void));
#endif
*/
/* this file has the location of the parser, and the size of the progam desired */
/* It may also contain definitions to override various defaults: for example,
- /* WORD32 tells yacc that there are at least 32 bits per int */
+ * WORD32 tells yacc that there are at least 32 bits per int */
/* on some systems, notably IBM, the names for the output files and tempfiles must
- /* also be changed */
+ * also be changed */
#ifndef WORD32
#define WORD32
exit(0);
}
-int others() { /* put out other arrays, copy the parsers */
+void others() { /* put out other arrays, copy the parsers */
register c, i, j;
finput = fopen( PARSER, "r" );
int * zzmemsz = mem0;
int zzrrconf = 0;
-int summary() { /* output the summary on the tty */
+void summary() { /* output the summary on the tty */
if( foutput!=NULL ){
fprintf( foutput, "\n%d/%d terminals, %d/%d nonterminals\n", ntokens, NTERMS,
nnonter, NNONTERM );
fprintf( foutput, "%d/%d grammar rules, %d/%d states\n", nprod, NPROD, nstate, NSTATES );
fprintf( foutput, "%d shift/reduce, %d reduce/reduce conflicts reported\n", zzsrconf, zzrrconf );
- fprintf( foutput, "%d/%d working sets used\n", zzcwp-wsets, WSETSIZE );
- fprintf( foutput, "memory: states,etc. %d/%d, parser %d/%d\n", zzmemsz-mem0, MEMSIZE,
+ fprintf( foutput, "%d/%d working sets used\n", (int)(zzcwp-wsets), WSETSIZE );
+ fprintf( foutput, "memory: states,etc. %d/%d, parser %d/%d\n", (int)(zzmemsz-mem0), MEMSIZE,
memp-amem, ACTSIZE );
fprintf( foutput, "%d/%d distinct lookahead sets\n", nlset, LSETSIZE );
fprintf( foutput, "%d extra closures\n", zzclose - 2*nstate );
}
#ifdef __STDC__
-int error(char *s, ...)
+void error(char *s, ...)
#else
-int error(s, va_alist) char *s; va_dcl
+void error(s, va_alist) char *s; va_dcl
#endif
{ /* write out error comment */
va_list argp;
++nerrors;
fprintf( stderr, "\n fatal error: ");
- _va_start(argp, fmt);
+ _va_start(argp, s);
vfprintf( stderr, s, argp);
va_end(argp);
fprintf( stderr, ", line %d\n", lineno );
exit(1);
}
-int aryfil(v, n, c) int *v; int n; int c; { /* set elements 0 through n-1 to c */
+void aryfil(v, n, c) int *v; int n; int c; { /* set elements 0 through n-1 to c */
int i;
for( i=0; i<n; ++i ) v[i] = c;
}
return( sub );
}
-int prlook(p) struct looksets *p; {
+void prlook(p) struct looksets *p; {
register j, *pp;
pp = p->lset;
if( pp == 0 ) fprintf( foutput, "\tNULL");
}
}
-int cpres() { /* compute an array with the beginnings of productions yielding given nonterminals
+void cpres() { /* compute an array with the beginnings of productions yielding given nonterminals
The array pres points to these lists */
/* the array pyield has the lists: the total size is only NPROD+1 */
register **pmem;
}
int indebug = 0;
-int cpfir() {
+void cpfir() {
/* compute an array with the first of nonterminals */
register *p, **s, i, **t, ch, changes;
}
int pidebug = 0; /* debugging flag for putitem */
-int putitem(ptr, lptr) int *ptr; struct looksets *lptr; {
+void putitem(ptr, lptr) int *ptr; struct looksets *lptr; {
register struct item *j;
if( pidebug && (foutput!=NULL) ) {
}
}
-int cempty() { /* mark nonterminals which derive the empty string */
+void cempty() { /* mark nonterminals which derive the empty string */
/* also, look for nonterminals which don't derive any token strings */
# define EMPTY 1
}
int gsdebug = 0;
-int stagen() { /* generate the states */
+void stagen() { /* generate the states */
int i, j;
register c;
nstate = 0;
/* THIS IS FUNNY from the standpoint of portability */
/* it represents the magic moment when the mem0 array, which has
- /* been holding the productions, starts to hold item pointers, of a
- /* different type... */
+ * been holding the productions, starts to hold item pointers, of a
+ * different type... */
/* someday, alloc should be used to allocate all this stuff... for now, we
- /* accept that if pointers don't fit in integers, there is a problem... */
+ * accept that if pointers don't fit in integers, there is a problem... */
pstate[0] = pstate[1] = (struct item *)mem;
aryfil( clset.lset, tbitset, 0 );
}
int cldebug = 0; /* debugging flag for closure */
-int closure(i) int i; { /* generate the closure of state i */
+void closure(i) int i; { /* generate the closure of state i */
int c, ch, work, k;
register struct wset *u, *v;
int *prdptr[NPROD]; /* pointers to descriptions of productions */
int levprd[NPROD] ; /* precedence levels for the productions */
-int setup(argc, argv) int argc; char *argv[]; { int i,j,lev,t, ty;
+void setup(argc, argv) int argc; char *argv[]; { int i,j,lev,t, ty;
int c;
int *p;
char actname[8];
fclose( finput );
}
-int finact() {
+void finact() {
/* finish action routine */
fclose(faction);
return( ntokens );
}
-int defout() { /* write out the defines (at the end of the declaration section) */
+void defout() { /* write out the defines (at the end of the declaration section) */
register int i, c;
register char *cp;
return( defin( t, s ) );
}
-int cpyunion() {
+void cpyunion() {
/* copy the union declaration to the output, and the define file if present */
int level, c;
}
}
-int cpycode() { /* copies code between \{ and \} */
+void cpycode() { /* copies code between \{ and \} */
int c;
c = getc(finput);
}
error( "EOF inside comment" );
/* NOTREACHED */
+#ifdef __GNUC__
+ return 0;
+#endif
}
-int cpyact(offset) int offset; { /* copy C action to the next ; or closing } */
+void cpyact(offset) int offset; { /* copy C action to the next ; or closing } */
int brac, c, match, j, s, tok;
fprintf( faction, "\n# line %d \"%s\"\n", lineno, infile );
int lastred; /* the number of the last reduction of a state */
int defact[NSTATES]; /* the default actions of states */
-int output() { /* print the output for the states */
+void output() { /* print the output for the states */
int i, k, c;
register struct wset *u, *v;
}
error("no space in action table" );
/* NOTREACHED */
+#ifdef __GNUC__
+ return 0;
+#endif
}
-int go2out() { /* output the gotos for the nontermninals */
+void go2out() { /* output the gotos for the nontermninals */
int i, j, k, best, count, cbest, times;
fprintf( ftemp, "$\n" ); /* mark begining of gotos */
}
int g2debug = 0;
-int go2gen(c) int c; { /* output the gotos for nonterminal c */
+void go2gen(c) int c; { /* output the gotos for nonterminal c */
int i, work, cc;
struct item *p, *q;
}
}
-int precftn(r, t, s) int r; int t; int s; { /* decide a shift/reduce conflict by precedence.
- /* r is a rule number, t a token number */
+void precftn(r, t, s) int r; int t; int s; { /* decide a shift/reduce conflict by precedence.
+ * r is a rule number, t a token number */
/* the conflict is in state s */
/* temp1[t] is changed to reflect the action */
}
}
-int wract(i) int i; { /* output state i */
+void wract(i) int i; { /* output state i */
/* temp1 has the actions, lastred the default */
int p, p0, p1;
int ntimes, tred, count, j;
}
/* for error recovery, arrange that, if there is a shift on the
- /* error recovery token, `error', that the default be the error action */
+ * error recovery token, `error', that the default be the error action */
if( temp1[1] > 0 ) lastred = 0;
/* clear out entries in temp1 which equal lastred */
return;
}
-int wrstate(i) int i; { /* writes state i */
+void wrstate(i) int i; { /* writes state i */
register j0,j1;
register struct item *pp, *qq;
register struct wset *u;
}
-int wdef(s, n) char *s; int n; { /* output a definition of s to the value n */
+void wdef(s, n) char *s; int n; { /* output a definition of s to the value n */
fprintf( ftable, "# define %s %d\n", s, n );
}
-int warray(s, v, n) char *s; int *v; int n; {
+void warray(s, v, n) char *s; int *v; int n; {
register i;
}
}
-int hideprod() {
+void hideprod() {
/* in order to free up the mem and amem arrays for the optimizer,
- /* and still be able to output yyr1, etc., after the sizes of
- /* the action array is known, we hide the nonterminals
- /* derived by productions in levprd.
- */
+ * and still be able to output yyr1, etc., after the sizes of
+ * the action array is known, we hide the nonterminals
+ * derived by productions in levprd.
+ */
register i, j;
int nxdb = 0;
int adb = 0;
-int callopt() {
+void callopt() {
register i, *p, j, k, *q;
if( *p < k ) k = *p;
}
if( k <= j ){ /* nontrivial situation */
- /* temporarily, kill this for compatibility
- j -= k; /* j is now the range */
+ /* temporarily, kill this for compatibility */
+ /*j -= k;*/ /* j is now the range */
if( k > maxoff ) maxoff = k;
}
greed[i] = (yypact[i+1]-yypact[i]) + 2*j;
ZAPFILE(TEMPNAME);
}
-int gin(i) int i; {
+void gin(i) int i; {
register *p, *r, *s, *q1, *q2;
nextgi: ;
}
-int stin(i) int i; {
+void stin(i) int i; {
register *r, *s, n, flag, j, *q1, *q2;
greed[i] = 0;
else return( maxi );
}
-int osummary() {
+void osummary() {
/* write summary */
register i, *p;
}
-int aoutput() { /* this version is for C */
+void aoutput() { /* this version is for C */
/* write out the optimized parser */
}
-int arout(s, v, n) char *s; int *v; int n; {
+void arout(s, v, n) char *s; int *v; int n; {
register i;