Ansified lib/pcc
authorNick Downing <downing.nick@gmail.com>
Fri, 3 Feb 2017 12:58:00 +0000 (23:58 +1100)
committerNick Downing <downing.nick@gmail.com>
Fri, 3 Feb 2017 12:58:00 +0000 (23:58 +1100)
26 files changed:
lib/pcc/allo.c
lib/pcc/cgram.c
lib/pcc/code.c
lib/pcc/comm1.c
lib/pcc/config.h
lib/pcc/fort.c
lib/pcc/fort.h
lib/pcc/local.c
lib/pcc/local2.c
lib/pcc/mac2defs.h
lib/pcc/macdefs.h
lib/pcc/manifest.h
lib/pcc/match.c
lib/pcc/ndu.h
lib/pcc/optim.c
lib/pcc/order.c
lib/pcc/pass1.h
lib/pcc/pass2.h
lib/pcc/pcclocal.h
lib/pcc/pftn.c
lib/pcc/reader.c
lib/pcc/scan.c
lib/pcc/stab.c
lib/pcc/table.c
lib/pcc/trees.c
lib/pcc/xdefs.c

index 528d704..ced12b9 100644 (file)
@@ -1,8 +1,17 @@
-#ifndef lint
+/*#include <stdio.h> pass2.h*/
+/*#include "config.h" manifest.h*/
+/*#include "mac2defs.h" pass2.h*/
+/*#include "macdefs.h" manifest.h*/
+/*#include "manifest.h" pass2.h*/
+/*#include "ndu.h" manifest.h*/
+#include "pass2.h"
+/*#include "pcclocal.h" mac2defs.h*/
+
+#if defined(DOSCCS) && !defined(lint)
 static char *sccsid ="@(#)allo.c       4.8 (Berkeley) 1/8/86";
-#endif lint
+#endif
 
-# include "pass2.h"
+/*# include "pass2.h"*/
 
 NODE resc[3];
 
@@ -11,7 +20,7 @@ int busy[REGSZ];
 int maxa, mina, maxb, minb;
 
 # ifndef ALLO0
-allo0(){ /* free everything */
+int allo0() { /* free everything */
 
        register i;
 
@@ -33,7 +42,7 @@ allo0(){ /* free everything */
 # endif
 
 # ifndef ALLO
-allo( p, q ) NODE *p; struct optab *q; {
+int allo(p, q) NODE *p; struct optab *q; {
 
        register n, i, j;
        int either;
@@ -118,7 +127,7 @@ allo( p, q ) NODE *p; struct optab *q; {
 # endif
 
 extern unsigned int offsz;
-freetemp( k ){ /* allocate k integers worth of temp space */
+int freetemp(k) int k; { /* allocate k integers worth of temp space */
        /* we also make the convention that, if the number of words is more than 1,
        /* it must be aligned for storing doubles... */
 
@@ -150,7 +159,7 @@ freetemp( k ){ /* allocate k integers worth of temp space */
 # endif
        }
 
-freereg( p, n ) NODE *p; {
+int freereg(p, n) NODE *p; int n; {
        /* allocate a register of type n */
        /* p gives the type, if floating */
 
@@ -185,7 +194,7 @@ freereg( p, n ) NODE *p; {
        }
 
 # ifndef USABLE
-usable( p, n, r ) NODE *p; {
+int usable(p, n, r) NODE *p; int n; int r; {
        /* decide if register r is usable in tree p to satisfy need n */
 
        /* checks, for the moment */
@@ -237,7 +246,7 @@ usable( p, n, r ) NODE *p; {
        }
 # endif
 
-shareit( p, r, n ) NODE *p; {
+int shareit(p, r, n) NODE *p; int r; int n; {
        /* can we make register r available by sharing from p
           given that the need is n */
        if( (n&(NASL|NBSL)) && ushare( p, 'L', r ) ) return(1);
@@ -245,7 +254,7 @@ shareit( p, r, n ) NODE *p; {
        return(0);
        }
 
-ushare( p, f, r ) NODE *p; {
+int ushare(p, f, r) NODE *p; int f; int r; {
        /* can we find a register r to share on the left or right
                (as f=='L' or 'R', respectively) of p */
        p = getlr( p, f );
@@ -262,7 +271,7 @@ ushare( p, f, r ) NODE *p; {
        return(0);
        }
 
-recl2( p ) register NODE *p; {
+int recl2(p) register NODE *p; {
        register r = p->tn.rval;
 #ifndef OLD
        int op = p->in.op;
@@ -295,7 +304,7 @@ recl2( p ) register NODE *p; {
 int rdebug = 0;
 
 # ifndef RFREE
-rfree( r, t ) TWORD t; {
+int rfree(r, t) int r; TWORD t; {
        /* mark register r free, if it is legal to do so */
        /* t is the type */
 
@@ -320,7 +329,7 @@ rfree( r, t ) TWORD t; {
 # endif
 
 # ifndef RBUSY
-rbusy(r,t) TWORD t; {
+int rbusy(r, t) int r; TWORD t; {
        /* mark register r busy */
        /* t is the type */
 
@@ -343,7 +352,7 @@ rbusy(r,t) TWORD t; {
 # endif
 
 # ifndef BUG3
-rwprint( rw ){ /* print rewriting rule */
+int rwprint(rw) int rw; { /* print rewriting rule */
        register i, flag;
        static char * rwnames[] = {
 
@@ -376,7 +385,7 @@ rwprint( rw ){ /* print rewriting rule */
        }
 # endif
 
-reclaim( p, rw, cookie ) NODE *p; {
+int reclaim(p, rw, cookie) NODE *p; int rw; int cookie; {
        register NODE **qq;
        register NODE *q;
        register i;
@@ -515,7 +524,7 @@ reclaim( p, rw, cookie ) NODE *p; {
        }
 
 #ifndef ncopy
-XXXncopy( q, p ) NODE *p, *q; {
+int XXXncopy(q, p) NODE *q; NODE *p; {
        /* copy the contents of p into q, without any feeling for
           the contents */
        /* this code assume that copying rval and lval does the job;
@@ -540,8 +549,7 @@ XXXncopy( q, p ) NODE *p, *q; {
        }
 #endif
 
-NODE *
-tcopy( p ) register NODE *p; {
+NODE *tcopy(p) register NODE *p; {
        /* make a fresh copy of p */
 
        register NODE *q;
@@ -572,7 +580,7 @@ tcopy( p ) register NODE *p; {
        return(q);
        }
 
-allchk(){
+int allchk() {
        /* check to ensure that all register are free */
 
        register i;
index 2aad878..f977297 100644 (file)
@@ -1,3 +1,11 @@
+#include <stdio.h>
+/*#include "config.h" manifest.h*/
+/*#include "macdefs.h" manifest.h*/
+/*#include "manifest.h" pass1.h*/
+/*#include "ndu.h" manifest.h*/
+#include "pass1.h"
+/*#include "pcclocal.h" macdefs.h*/
+
 # define TOKENS 0
 # define ERROR 1
 # define FREE 2
 # define SM 125
 
 # line 146 "cgram.y"
-# include "pass1.h"
+/*# include "pass1.h"*/
 #define yyclearin yychar = -1
 #define yyerrok yyerrflag = 0
 extern int yychar;
@@ -132,14 +140,11 @@ YYSTYPE yylval, yyval;
 
 # line 899 "cgram.y"
 
-
-NODE *
-mkty( t, d, s ) unsigned t; {
+NODE *mkty(t, d, s) unsigned t; int d; int s; {
        return( block( TYPE, NIL, NIL, t, d, s ) );
        }
 
-NODE *
-bdty( op, p, v ) NODE *p; {
+NODE *bdty(op, p, v) int op; NODE *p; int v; {
        register NODE *q;
 
        q = block( op, p, NIL, INT, 0, INT );
@@ -165,14 +170,14 @@ bdty( op, p, v ) NODE *p; {
        return( q );
        }
 
-dstash( n ){ /* put n into the dimension table */
+int dstash(n) int n; { /* put n into the dimension table */
        if( curdim >= DIMTABSZ-1 ){
                cerror( "dimension table overflow");
                }
        dimtab[ curdim++ ] = n;
        }
 
-savebc() {
+int savebc() {
        if( psavbc > & asavbc[BCSZ-4 ] ){
                cerror( "whiles, fors, etc. too deeply nested");
                }
@@ -183,7 +188,7 @@ savebc() {
        flostat = 0;
        }
 
-resetbc(mask){
+int resetbc(mask) int mask; {
 
        swx = *--psavbc;
        flostat = *--psavbc | (flostat&mask);
@@ -192,7 +197,7 @@ resetbc(mask){
 
        }
 
-addcase(p) NODE *p; { /* add case to switch */
+int addcase(p) NODE *p; { /* add case to switch */
 
        p = optim( p );  /* change enum to ints */
        if( p->in.op != ICON ){
@@ -212,7 +217,7 @@ addcase(p) NODE *p; { /* add case to switch */
        tfree(p);
        }
 
-adddef(){ /* add default case to switch */
+int adddef() { /* add default case to switch */
        if( swtab[swx].slab >= 0 ){
                uerror( "duplicate default in switch");
                return;
@@ -224,7 +229,7 @@ adddef(){ /* add default case to switch */
        deflab( swtab[swx].slab = getlab() );
        }
 
-swstart(){
+int swstart() {
        /* begin a switch block */
        if( swp >= &swtab[SWITSZ] ){
                cerror( "switch table overflow");
@@ -234,7 +239,7 @@ swstart(){
        ++swp;
        }
 
-swend(){ /* end a switch block */
+int swend() { /* end a switch block */
 
        register struct sw *swbeg, *p, *q, *r, *r1;
        CONSZ temp;
@@ -730,7 +735,6 @@ int yyparse() {
        yyabort:
                        return(1);
 
-
                case 3:  /* no shift yet; clobber input char */
 
 #ifdef YYDEBUG
index dd43037..7c20410 100644 (file)
@@ -1,11 +1,20 @@
-#ifndef lint
+#include <stab.h>
+#include <stdio.h>
+/*#include "config.h" manifest.h*/
+/*#include "macdefs.h" manifest.h*/
+/*#include "manifest.h" pass1.h*/
+/*#include "ndu.h" manifest.h*/
+#include "pass1.h"
+/*#include "pcclocal.h" macdefs.h*/
+
+#if defined(DOSCCS) && !defined(lint)
 static char *sccsid ="@(#)code.c       1.5 (Berkeley) 8/23/85";
-#endif lint
+#endif
 
-# include "pass1.h"
-# include <sys/types.h>
-# include <a.out.h>
-# include <stab.h>
+/*# include "pass1.h"*/
+/*# include <sys/types.h>*/
+/*# include <a.out.h>*/
+/*# include <stab.h>*/
 
 int proflg = 0;        /* are we generating profiling code? */
 int strftn = 0;  /* is the current function one which returns a value */
@@ -16,7 +25,7 @@ int labelno;
 
 # define putstr(s)     fputs((s), stdout)
 
-branch( n ){
+int branch(n) int n; {
        /* output a branch to label n */
        /* exception is an ordinary function branching to retlab: then, return */
        if( n == retlab && !strftn ){
@@ -30,13 +39,13 @@ int lastloc = { -1 };
 short log2tab[] = {0, 0, 1, 2, 2, 3, 3, 3, 3};
 #define LOG2SZ 9
 
-defalign(n) {
+int defalign(n) int n; {
        /* cause the alignment to become a multiple of n */
        n /= SZCHAR;
        if( lastloc != PROG && n > 1 ) printf( "        .align  %d\n", n >= 0 && n < LOG2SZ ? log2tab[n] : 0 );
        }
 
-locctr( l ){
+int locctr(l) int l; {
        register temp;
        /* l is PROG, ADATA, DATA, STRNG, ISTRNG, or STAB */
 
@@ -74,25 +83,24 @@ locctr( l ){
        return( temp );
        }
 
-deflab( n ){
+int deflab(n) int n; {
        /* output something to define the current position as label n */
        printf( "L%d:\n", n );
        }
 
 int crslab = 10;
 
-getlab(){
+int getlab() {
        /* return a number usable for a label */
        return( ++crslab );
        }
 
-
 int ent_mask[] = {
        0,0,0,0,0, 0xfc0, 0xf80, 0xf00, 0xe00, 0xc00, 0x800, 0};
 
 int reg_use = 11;
 
-efcode(){
+int efcode() {
        /* code for the end of a function */
 
        if( strftn ){  /* copy output (in R2) to caller */
@@ -153,7 +161,7 @@ efcode(){
 
 int ftlab1, ftlab2;
 
-bfcode( a, n ) int a[]; {
+int bfcode(a, n) int a[]; int n; {
        /* code for the beginning of a function; a is an array of
                indices in stab for the arguments; n is the number */
        register i;
@@ -225,7 +233,7 @@ bfcode( a, n ) int a[]; {
        fdefflag = 1;
        }
 
-bccode(){ /* called just before the first executable statment */
+int bccode() { /* called just before the first executable statment */
                /* by now, the automatics and register variables are allocated */
        SETOFF( autooff, SZINT );
        /* set aside store area offset */
@@ -233,24 +241,24 @@ bccode(){ /* called just before the first executable statment */
        reg_use = (reg_use > regvar ? regvar : reg_use);
        }
 
-ejobcode( flag ){
+int ejobcode(flag) int flag; {
        /* called just before final exit */
        /* flag is 1 if errors, 0 if none */
        }
 
-aobeg(){
+int aobeg() {
        /* called before removing automatics from stab */
        }
 
-aocode(p) struct symtab *p; {
+int aocode(p) struct symtab *p; {
        /* called when automatic p removed from stab */
        }
 
-aoend(){
+int aoend() {
        /* called after removing all automatics from stab */
        }
 
-defnam( p ) register struct symtab *p; {
+int defnam(p) register struct symtab *p; {
        /* define the current location as the name p->sname */
 
        if( p->sclass == EXTDEF ){
@@ -261,7 +269,7 @@ defnam( p ) register struct symtab *p; {
 
        }
 
-bycode( t, i ){
+int bycode(t, i) int t; int i; {
 #ifdef ASSTRINGS
 static int     lastoctal = 0;
 #endif
@@ -297,8 +305,7 @@ static      int     lastoctal = 0;
                        lastoctal = 0;
                        printf("\"\n\t.ascii\t\"%c", t );
                }
-               else
-               {       
+               else {
                        lastoctal = 0;
                        putchar(t);
                }
@@ -320,7 +327,7 @@ static      int     lastoctal = 0;
 #endif
        }
 
-zecode( n ){
+int zecode(n) int n; {
        /* n integer words of zeros */
        OFFSZ temp;
        if( n <= 0 ) return;
@@ -329,27 +336,25 @@ zecode( n ){
        inoff += temp*SZINT;
        }
 
-fldal( t ) unsigned t; { /* return the alignment of field of type t */
+int fldal(t) unsigned t; { /* return the alignment of field of type t */
        uerror( "illegal field type" );
        return( ALINT );
        }
 
-fldty( p ) struct symtab *p; { /* fix up type of field p */
+int fldty(p) struct symtab *p; { /* fix up type of field p */
        ;
        }
 
-where(c){ /* print location of error  */
+int where(c) int c; { /* print location of error  */
        /* c is either 'u', 'c', or 'w' */
        /* GCOS version */
        fprintf( stderr, "%s, line %d: ", ftitle, lineno );
        }
 
-
 /* tbl - toreg() returns a pointer to a char string
                  which is the correct  "register move" for the passed type 
  */
-struct type_move {TWORD fromtype; char tostrng[8];} toreg_strs[] =
-       {
+struct type_move {TWORD fromtype; char tostrng[8];} toreg_strs[] = {
        CHAR, "cvtbl",
        SHORT, "cvtwl",
        INT, "movl",
@@ -363,10 +368,7 @@ struct type_move {TWORD fromtype; char tostrng[8];} toreg_strs[] =
        0, ""
        };
 
-char
-*toreg(type)
-       TWORD type;
-{
+char *toreg(type) TWORD type; {
        struct type_move *p;
 
        for ( p=toreg_strs; p->fromtype != 0; p++)
@@ -377,8 +379,7 @@ char
 }
 /* tbl */
 
-
-main( argc, argv ) char *argv[]; {
+int main(argc, argv) int argc; char *argv[]; {
 #ifdef BUFSTDERR
        char errbuf[BUFSIZ];
        setbuf(stderr, errbuf);
@@ -388,7 +389,7 @@ main( argc, argv ) char *argv[]; {
 
 struct sw heapsw[SWITSZ];      /* heap for switches */
 
-genswitch(p,n) register struct sw *p;{
+int genswitch(p, n) register struct sw *p; int n; {
        /*      p points to an array of structures, each consisting
                of a constant value and a label.
                The first is >=0 if there is a default label;
@@ -453,9 +454,7 @@ genswitch(p,n) register struct sw *p;{
        if( p->slab>=0 ) branch( p->slab );
        }
 
-makeheap(p, m, n)
-register struct sw *p;
-{
+int makeheap(p, m, n) register struct sw *p; int m; int n; {
        register int q;
 
        q = select(m);
@@ -464,7 +463,7 @@ register struct sw *p;
        if( q<m ) makeheap(p+q, m-q, 2*n+1);
 }
 
-select(m) {
+int select(m) int m; {
        register int l,i,k;
 
        for(i=1; ; i*=2)
@@ -473,11 +472,9 @@ select(m) {
        return( l + (m-k < l ? m-k : l));
 }
 
-walkheap(start, limit)
-{
+int walkheap(start, limit) int start; int limit; {
        int label;
 
-
        if( start > limit ) return;
        printf("        cmpl    r0,$%d\n",  heapsw[start].sval);
        printf("        jeql    L%d\n", heapsw[start].slab);
index 24ebd5d..a5f89ac 100644 (file)
@@ -1,8 +1,24 @@
+#include <gen.h>
+#include <stdio.h>
+/*#include <strings.h> gen.h*/
+#ifdef __STDC__
+#include <stdarg.h>
+#define _va_start(argp, arg) va_start(argp, arg)
+#else
+#include <varargs.h>
+#define _va_start(argp, arg) va_start(argp)
+#endif
+/*#include "config.h" manifest.h*/
+/*#include "manifest.h" pass1.h*/
+/*#include "ndu.h" manifest.h*/
+#include "pass1.h"
+/*#include "pcclocal.h" manifest.h*/
+
 /*     common.c        4.2     85/08/22        */
 
-#include <varargs.h>
+/*#include <varargs.h>*/
 /*#ifdef PASS1COMMON*/
-#include "pass1.h"
+/*#include "pass1.h"*/
 /*#else*/
 /*#ifdef PASS2COMMON*/
 /*#include "pass2.h"*/
@@ -20,7 +36,7 @@ int nerrors = 0;  /* number of errors */
 
 extern unsigned int offsz;
 
-unsigned caloff(){
+unsigned caloff() {
        register i;
        unsigned int temp;
        unsigned int off;
@@ -36,7 +52,12 @@ unsigned caloff(){
 
 NODE *lastfree;  /* pointer to last free node; (for allocator) */
 
-uerror( s, va_alist ) char *s; va_dcl { /* nonfatal error message */
+#ifdef __STDC__
+int uerror(char *s, ...)
+#else
+int uerror(s, va_alist) char *s; va_dcl
+#endif
+{ /* nonfatal error message */
        va_list argp;
 
        /* the routine where is different for pass 1 and pass 2;
@@ -44,7 +65,7 @@ uerror( s, va_alist ) char *s; va_dcl { /* nonfatal error message */
 
        ++nerrors;
        where('u');
-       va_start(argp);
+       _va_start(argp, fmt);
        vfprintf( stderr, s, argp );
        va_end(argp);
        fprintf( stderr, "\n" );
@@ -54,7 +75,12 @@ uerror( s, va_alist ) char *s; va_dcl { /* nonfatal error message */
        if( nerrors > 30 ) cerror( "too many errors");
        }
 
-cerror( s, va_alist ) char *s; va_dcl { /* compiler error: die */
+#ifdef __STDC__
+int cerror(char *s, ...)
+#else
+int cerror(s, va_alist) char *s; va_dcl
+#endif
+{ /* compiler error: die */
        va_list argp;
 
        where('c');
@@ -63,7 +89,7 @@ cerror( s, va_alist ) char *s; va_dcl { /* compiler error: die */
                }
        else {
                fprintf( stderr, "compiler error: " );
-               va_start(argp);
+               _va_start(argp, fmt);
                fprintf( stderr, s, argp );
                va_end(argp);
                fprintf( stderr, "\n" );
@@ -76,13 +102,18 @@ cerror( s, va_alist ) char *s; va_dcl { /* compiler error: die */
 
 int Wflag = 0; /* Non-zero means do not print warnings */
 
-werror( s, va_alist ) char *s; va_dcl {  /* warning */
+#ifdef __STDC__
+int werror(char *s, ...)
+#else
+int werror(s, va_alist) char *s; va_dcl
+#endif
+{  /* warning */
        va_list argp;
 
        if(Wflag) return;
        where('w');
        fprintf( stderr, "warning: " );
-       va_start(argp);
+       _va_start(argp, fmt);
        fprintf( stderr, s, argp );
        va_end(argp);
        fprintf( stderr, "\n" );
@@ -91,7 +122,7 @@ werror( s, va_alist ) char *s; va_dcl {  /* warning */
 #endif
        }
 
-tinit(){ /* initialize expression tree search */
+int tinit() { /* initialize expression tree search */
 
        register NODE *p;
 
@@ -102,8 +133,7 @@ tinit(){ /* initialize expression tree search */
 
 # define TNEXT(p) (p== &node[TREESZ-1]?node:p+1)
 
-NODE *
-talloc(){
+NODE *talloc() {
        register NODE *p, *q;
 
        q = lastfree;
@@ -114,7 +144,7 @@ talloc(){
        /* NOTREACHED */
        }
 
-tcheck(){ /* ensure that all nodes have been freed */
+int tcheck() { /* ensure that all nodes have been freed */
 
        register NODE *p;
 
@@ -126,7 +156,7 @@ tcheck(){ /* ensure that all nodes have been freed */
        freetstr();
 #endif
        }
-tfree( p )  NODE *p; {
+int tfree(p) NODE *p; {
        /* free the tree p */
        extern tfree1();
 
@@ -134,12 +164,12 @@ tfree( p )  NODE *p; {
 
        }
 
-tfree1(p)  NODE *p; {
+int tfree1(p) NODE *p; {
        if( p == 0 ) cerror( "freeing blank tree!");
        else p->in.op = FREE;
        }
 
-fwalk( t, f, down ) register NODE *t; int (*f)(); {
+int fwalk(t, f, down) register NODE *t; int (*f)(); int down; {
 
        int down1, down2;
 
@@ -165,7 +195,7 @@ fwalk( t, f, down ) register NODE *t; int (*f)(); {
        }
 
 #ifndef vax
-walkf( t, f ) register NODE *t;  int (*f)(); {
+int walkf(t, f) register NODE *t; int (*f)(); {
        register opty;
 
        opty = optype(t->in.op);
@@ -181,10 +211,7 @@ walkf( t, f ) register NODE *t;  int (*f)(); {
  * Deliberately avoids recursion -- use this version on machines with
  * expensive procedure calls.
  */
-walkf(t, f)
-       register NODE *t;
-       register int (*f)();
-{
+int walkf(t, f) register NODE *t; register int (*f)(); {
        register int i = 1;
        register int opty = optype(t->in.op);
        static NODE *at[NR];
@@ -215,8 +242,6 @@ walkf(t, f)
 #undef POP
 #endif
 
-
-
 int dope[ DSIZE ];
 char *opst[DSIZE];
 
@@ -303,7 +328,7 @@ struct dopest { int dopeop; char opst[8]; int dopeval; } indope[] = {
        -1,     "",     0
 };
 
-mkdope(){
+int mkdope() {
        register struct dopest *q;
 
        for( q = indope; q->dopeop >= 0; ++q ){
@@ -312,7 +337,7 @@ mkdope(){
                }
        }
 # ifndef BUG4
-tprint( t )  TWORD t; { /* output a nice description of the type of t */
+int tprint(t) TWORD t; { /* output a nice description of the type of t */
 
        static char * tnames[] = {
                "undef",
@@ -355,10 +380,7 @@ char       *tstrbuf[NTSTRBUF] = { itstrbuf };
 char   **curtstr = tstrbuf;
 int    tstrused;
 
-char *
-tstr(cp)
-       register char *cp;
-{
+char *tstr(cp) register char *cp; {
        register int i = strlen(cp);
        register char *dp;
        
index 0998167..5402969 100644 (file)
@@ -1,7 +1,10 @@
+#ifndef _CONFIG_H_
+#define _CONFIG_H_
+
 /*     config.h        4.3     85/08/22        */
 
-#ifndef _CONFIG_
-#define        _CONFIG_
+/*#ifndef _CONFIG_*/
+/*#define      _CONFIG_*/
 /*
  * Compiler configuration definitions.
  */
@@ -31,4 +34,6 @@
 #ifndef FLEXNAMES
 #define        NCHNAM          8               /* significant chars of identifier */
 #endif
+/*#endif*/
+
 #endif
index fb6f775..239367f 100644 (file)
@@ -1,13 +1,22 @@
-#ifndef lint
+/*#include <stdio.h> pass2.h*/
+/*#include "config.h" manifest.h*/
+/*#include "mac2defs.h" pass2.h*/
+/*#include "macdefs.h" manifest.h*/
+/*#include "manifest.h" pass2.h*/
+/*#include "ndu.h" manifest.h*/
+#include "pass2.h"
+/*#include "pcclocal.h" mac2defs.h*/
+
+#if defined(DOSCCS) && !defined(lint)
 static char *sccsid ="@(#)fort.c       4.7 (Berkeley) 8/22/85";
-#endif lint
+#endif
 
 # ifndef FORT
 # define FORT
 /* this may force larger trees, etc. */
 # endif
 
-# include "pass2.h"
+/*# include "pass2.h"*/
 # include "fort.h"
 
 /*     masks for unpacking longs */
@@ -40,9 +49,7 @@ FILE * lrd;  /* for default reading routines */
 
 # ifndef NOLNREAD
 #ifdef FLEXNAMES
-char *
-lnread()
-{
+char *lnread() {
        char buf[BUFSIZ];
        register char *cp = buf;
        register char *limit = &buf[BUFSIZ];
@@ -59,10 +66,10 @@ lnread()
        return (tstr(buf));
 }
 #endif
-# endif NOLNREAD
+# endif
 
 # ifndef NOLREAD
-long lread(){
+long lread() {
        static long x;
        if( fread( (char *) &x, 4, 1, lrd ) <= 0 ) cerror( "intermediate file read error" );
        return( x );
@@ -70,7 +77,7 @@ long lread(){
 # endif
 
 # ifndef NOLOPEN
-lopen( s ) char *s; {
+int lopen(s) char *s; {
        /* if null, opens the standard input */
        if( *s ){
                lrd = fopen( s, "r" );
@@ -81,7 +88,7 @@ lopen( s ) char *s; {
 # endif
 
 # ifndef NOLCREAD
-lcread( cp, n ) char *cp; {
+int lcread(cp, n) char *cp; int n; {
        if( n > 0 ){
                if( fread( cp, 4, n, lrd ) != n ) cerror( "intermediate file read error" );
                }
@@ -89,7 +96,7 @@ lcread( cp, n ) char *cp; {
 # endif
 
 # ifndef NOLCCOPY
-lccopy( n ) register n; {
+int lccopy(n) register n; {
        register i;
        static char fbuf[BUFSIZ];
        if( n > 0 ){
@@ -111,8 +118,8 @@ NODE * fstack[NSTACKSZ];
 NODE ** fsp;  /* points to next free position on the stack */
 
 unsigned int offsz;
-unsigned int caloff();
-mainp2( argc, argv ) char *argv[]; {
+/*unsigned int caloff();*/
+int mainp2(argc, argv) int argc; char *argv[]; {
        int files;
        register long x;
        register NODE *p;
index 39be2e4..dc587f4 100644 (file)
@@ -1,12 +1,20 @@
+#ifndef _FORT_H_
+#define _FORT_H_
+
+/*#include <stdio.h> pass2.h*/
+#include "pass2.h"
+
 /*     fort.h  4.1     85/03/19        */
 
 /*     machine dependent file  */
 
-label( n ){
+int label(n) int n; {
        printf( "L%d:\n", n );
        }
 
-tlabel(){
+int tlabel() {
        lccopy( 2 );
        printf( ":\n" );
        }
+
+#endif
index 5baebd1..8de87de 100644 (file)
@@ -1,13 +1,21 @@
-#ifndef lint
+#include <math.h>
+#include <stdio.h>
+/*#include "config.h" manifest.h*/
+/*#include "macdefs.h" manifest.h*/
+/*#include "manifest.h" pass1.h*/
+/*#include "ndu.h" manifest.h*/
+#include "pass1.h"
+/*#include "pcclocal.h" macdefs.h*/
+
+#if defined(DOSCCS) && !defined(lint)
 static char *sccsid ="@(#)local.c      1.8 (Berkeley) 8/23/85";
-#endif lint
+#endif
 
-# include "pass1.h"
+/*# include "pass1.h"*/
 
 /*     this file contains code which is dependent on the target machine */
 
-NODE *
-cast( p, t ) register NODE *p; TWORD t; {
+NODE *cast(p, t) register NODE *p; TWORD t; {
        /* cast node p to type t */
 
        p = buildtree( CAST, block( NAME, NIL, NIL, t, 0, (int)t ), p );
@@ -16,8 +24,7 @@ cast( p, t ) register NODE *p; TWORD t; {
        return( p->in.right );
        }
 
-NODE *
-clocal(p) NODE *p; {
+NODE *clocal(p) NODE *p; {
 
        /* this is called to do local transformations on
           an expression tree preparitory to its being
@@ -185,15 +192,15 @@ clocal(p) NODE *p; {
        return(p);
        }
 
-andable( p ) NODE *p; {
+int andable(p) NODE *p; {
        return(1);  /* all names can have & taken on them */
        }
 
-cendarg(){ /* at the end of the arguments of a ftn, set the automatic offset */
+int cendarg() { /* at the end of the arguments of a ftn, set the automatic offset */
        autooff = AUTOINIT;
        }
 
-cisreg( t ) TWORD t; { /* is an automatic variable of type t OK for a register variable */
+int cisreg(t) TWORD t; { /* is an automatic variable of type t OK for a register variable */
 
 #ifdef TRUST_REG_CHAR_AND_REG_SHORT
        if( t==INT || t==UNSIGNED || t==LONG || t==ULONG        /* tbl */
@@ -209,8 +216,7 @@ cisreg( t ) TWORD t; { /* is an automatic variable of type t OK for a register v
        return(0);
        }
 
-NODE *
-offcon( off, t, d, s ) OFFSZ off; TWORD t; {
+NODE *offcon(off, t, d, s) OFFSZ off; TWORD t; int d; int s; {
 
        /* return a node, for structure references, which is suitable for
           being added to a pointer of type t, in order to be off bits offset
@@ -227,11 +233,10 @@ offcon( off, t, d, s ) OFFSZ off; TWORD t; {
 
        }
 
-
 static inwd    /* current bit offsed in word */;
 static word    /* word being built from fields */;
 
-incode( p, sz ) register NODE *p; {
+int incode(p, sz) register NODE *p; int sz; {
 
        /* generate initialization code for assigning a constant c
                to a field of width sz */
@@ -249,19 +254,18 @@ incode( p, sz ) register NODE *p; {
                }
        }
 
-fincode( d, sz ) double d; {
+int fincode(d, sz) double d; int sz; {
        /* output code to initialize space of size sz to the value d */
        /* the proper alignment has been obtained */
        /* inoff is updated to have the proper final value */
        /* on the target machine, write it out in octal! */
 
-
        printf("        %s      0%c%.20e\n", sz == SZDOUBLE ? ".double" : ".float",
                sz == SZDOUBLE ? 'd' : 'f', d);
        inoff += sz;
        }
 
-cinit( p, sz ) NODE *p; {
+int cinit(p, sz) NODE *p; int sz; {
        NODE *l;
 
        /*
@@ -294,7 +298,7 @@ cinit( p, sz ) NODE *p; {
        inoff += sz;
        }
 
-vfdzero( n ){ /* define n bits of zeros in a vfd */
+int vfdzero(n) int n; { /* define n bits of zeros in a vfd */
 
        if( n <= 0 ) return;
 
@@ -306,8 +310,7 @@ vfdzero( n ){ /* define n bits of zeros in a vfd */
                }
        }
 
-char *
-exname( p ) char *p; {
+char *exname(p) char *p; {
        /* make a name look like an external name in the local machine */
 
 #ifndef FLEXNAMES
@@ -334,7 +337,7 @@ exname( p ) char *p; {
        return( text );
        }
 
-ctype( type ) TWORD type;
+int ctype(type) TWORD type;
        { /* map types which are not defined on the local machine */
        switch( BTYPE(type) ){
 
@@ -348,7 +351,7 @@ ctype( type ) TWORD type;
        return( type );
        }
 
-noinit() { /* curid is a variable which is defined but
+int noinit() { /* curid is a variable which is defined but
        is not initialized (and not a function );
        This routine returns the stroage class for an uninitialized declaration */
 
@@ -356,7 +359,7 @@ noinit() { /* curid is a variable which is defined but
 
        }
 
-commdec( id ){ /* make a common declaration for id, if reasonable */
+int commdec(id) int id; { /* make a common declaration for id, if reasonable */
        register struct symtab *q;
        OFFSZ off, tsize();
 
@@ -367,7 +370,7 @@ commdec( id ){ /* make a common declaration for id, if reasonable */
        printf( "\n" );
        }
 
-isitlong( cb, ce ){ /* is lastcon to be long or short */
+int isitlong(cb, ce) int cb; int ce; { /* is lastcon to be long or short */
        /* cb is the first character of the representation, ce the last */
 
        if( ce == 'l' || ce == 'L' ||
@@ -375,8 +378,7 @@ isitlong( cb, ce ){ /* is lastcon to be long or short */
        return(0);
        }
 
-
-isitfloat( s ) char *s; {
+int isitfloat(s) char *s; {
        union cvt {
                double  d;
                int     n[2];
@@ -392,7 +394,7 @@ isitfloat( s ) char *s; {
        return( DCON );
        }
 
-ecode( p ) NODE *p; {
+int ecode(p) NODE *p; {
 
        /* walk the tree and write out the nodes.. */
 
@@ -402,8 +404,7 @@ ecode( p ) NODE *p; {
        }
 
 #ifndef ONEPASS
-tlen(p) NODE *p; 
-{
+int tlen(p) NODE *p; {
        switch(p->in.type) {
                case CHAR:
                case UCHAR:
index dba226f..56025e2 100644 (file)
@@ -1,9 +1,20 @@
-# ifndef lint
+#include <ctype.h>
+/*#include <stdio.h> pass2.h*/
+#include <strings.h>
+/*#include "config.h" manifest.h*/
+/*#include "mac2defs.h" pass2.h*/
+/*#include "macdefs.h" manifest.h*/
+/*#include "manifest.h" pass2.h*/
+/*#include "ndu.h" manifest.h*/
+#include "pass2.h"
+/*#include "pcclocal.h" mac2defs.h*/
+
+# if defined(DOSCCS) && !defined(lint)
 static char *sccsid ="@(#)local2.c     1.14 (Berkeley) 4/23/86";
 # endif
 
-# include "pass2.h"
-# include "ctype.h"
+/*# include "pass2.h"*/
+/*# include "ctype.h"*/
 # ifdef FORT
 int ftlab1, ftlab2;
 # endif
@@ -13,17 +24,16 @@ int ftlab1, ftlab2;
 
 # define BITMASK(n) ((1L<<n)-1)
 
-where2(c){
+int where2(c) int c; {
        fprintf( stderr, "%s, line %d: ", ftitle, lineno );
        }
 
-lineid( l, fn ) char *fn; {
+int lineid(l, fn) int l; char *fn; {
        /* identify line l and file fn */
        printf( "#      line %d, file %s\n", l, fn );
        }
 
-
-eobl2(){
+int eobl2() {
        OFFSZ spoff;    /* offset from stack pointer */
 #ifdef FORT
        spoff = maxoff;
@@ -72,7 +82,7 @@ struct hoptab { int opmask; char * opstring; } ioptab[] = {
        AND,    "bic",
        -1, ""    };
 
-hopcode( f, o ){
+int hopcode(f, o) int f; int o; {
        /* output the appropriate string from the above table */
 
        register struct hoptab *q;
@@ -120,8 +130,7 @@ int rstatus[] = {
 
        };
 
-tlen(p) NODE *p;
-{
+int tlen(p) NODE *p; {
        switch(p->in.type) {
                case CHAR:
                case UCHAR:
@@ -139,8 +148,7 @@ tlen(p) NODE *p;
                }
 }
 
-mixtypes(p, q) NODE *p, *q;
-{
+int mixtypes(p, q) NODE *p; NODE *q; {
        register TWORD tp, tq;
 
        tp = p->in.type;
@@ -150,10 +158,8 @@ mixtypes(p, q) NODE *p, *q;
                (tq==FLOAT || tq==DOUBLE) );
 }
 
-prtype(n) NODE *n;
-{
-       switch (n->in.type)
-               {
+int prtype(n) NODE *n; {
+       switch (n->in.type) {
                case DOUBLE:
                        putchar('d');
                        return;
@@ -188,7 +194,7 @@ prtype(n) NODE *n;
                }
 }
 
-zzzcode( p, c ) register NODE *p; {
+int zzzcode(p, c) register NODE *p; int c; {
        register m;
        CONSZ val;
        switch( c ){
@@ -206,8 +212,7 @@ zzzcode( p, c ) register NODE *p; {
                cbgen( p->in.op, p->bn.label, c );
                return;
 
-       case 'A':
-               {
+       case 'A': {
                register NODE *l, *r;
 
                if (x2debug) e2print(p, 0, &val, &val);
@@ -360,7 +365,7 @@ zzzcode( p, c ) register NODE *p; {
                                        }
 #else
                                prtype(l);
-#endif FORT
+#endif
                                goto ops;
                                }
                        else if (tlen(l) > tlen(r) && ISUNSIGNED(r->in.type))
@@ -380,8 +385,7 @@ zzzcode( p, c ) register NODE *p; {
                return;
                }
 
-       case 'G':       /* i *= f; asgops with int lhs and float rhs */
-               {
+       case 'G':       /* i *= f; asgops with int lhs and float rhs */ {
                register NODE *l, *r, *s;
                int rt;
 
@@ -413,8 +417,7 @@ zzzcode( p, c ) register NODE *p; {
                return;
                }
 
-       case 'B':       /* get oreg value in temp register for left shift */
-               {
+       case 'B':       /* get oreg value in temp register for left shift */ {
                register NODE *r;
                if (x2debug) e2print(p, 0, &val, &val);
                r = p->in.right;
@@ -428,8 +431,7 @@ zzzcode( p, c ) register NODE *p; {
                return;
                }
 
-       case 'C':       /* num words pushed on arg stack */
-               {
+       case 'C':       /* num words pushed on arg stack */ {
                extern int gc_numbytes;
                extern int x2debug;
 
@@ -445,8 +447,7 @@ zzzcode( p, c ) register NODE *p; {
                putchar('\t');
 
        case 'E':       /* INCR and DECR, FOREFF */
-               if (p->in.right->tn.lval == 1)
-                       {
+               if (p->in.right->tn.lval == 1) {
                        putstr( p->in.op == INCR ? "inc" : "dec" );
                        prtype(p->in.left);
                        putchar('\t');
@@ -462,8 +463,7 @@ zzzcode( p, c ) register NODE *p; {
                adrput(p->in.left);
                return;
 
-       case 'F':       /* register type of right operand */
-               {
+       case 'F':       /* register type of right operand */ {
                register NODE *n;
                extern int x2debug;
                register int ty;
@@ -480,8 +480,7 @@ zzzcode( p, c ) register NODE *p; {
                }
 
        case 'L':       /* type of left operand */
-       case 'R':       /* type of right operand */
-               {
+       case 'R':       /* type of right operand */ {
                register NODE *n;
                extern int x2debug;
 
@@ -500,8 +499,7 @@ zzzcode( p, c ) register NODE *p; {
                printf("$%d", 32 - p->in.right->tn.lval );
                return;
 
-       case 'T':       /* rounded structure length for arguments */
-               {
+       case 'T':       /* rounded structure length for arguments */ {
                int size;
 
                size = p->stn.stsize;
@@ -510,8 +508,7 @@ zzzcode( p, c ) register NODE *p; {
                return;
                }
 
-       case 'S':  /* structure assignment */
-               {
+       case 'S':  /* structure assignment */ {
                        register NODE *l, *r;
                        register size;
 
@@ -577,10 +574,7 @@ zzzcode( p, c ) register NODE *p; {
  *     that will do the job correctly; otherwise return 0.  Note that
  *     a register must always end up having type INT or UNSIGNED.
  */
-int
-collapsible(dest, src)
-NODE *dest, *src;
-{
+int collapsible(dest, src) NODE *dest; NODE *src; {
        int st = src->in.type;
        int dt = dest->in.type;
        int newt = 0;
@@ -615,7 +609,7 @@ NODE *dest, *src;
        return (newt);
        }
 
-rmove( rt, rs, t ) TWORD t; {
+int rmove(rt, rs, t) int rt; int rs; TWORD t; {
        printf( "       %s      %s,%s\n",
 #ifdef FORT
                !Oflag ? (t==DOUBLE ? "movq" : "movl") :
@@ -633,20 +627,20 @@ respref[] = {
        INTEMP, INTAREG|INAREG|INTBREG|INBREG|SOREG|STARREG|STARNM,
        0,      0 };
 
-setregs(){ /* set up temporary registers */
+int setregs() { /* set up temporary registers */
        fregs = 6;      /* tbl- 6 free regs on VAX (0-5) */
        ;
        }
 
-rewfld( p ) NODE *p; {
+int rewfld(p) NODE *p; {
        return(1);
        }
 
-callreg(p) NODE *p; {
+int callreg(p) NODE *p; {
        return( R0 );
        }
 
-base( p ) register NODE *p; {
+int base(p) register NODE *p; {
        register int o = p->in.op;
 
        if( (o==ICON && p->in.name[0] != '\0')) return( 100 ); /* ie no base reg */
@@ -663,7 +657,7 @@ base( p ) register NODE *p; {
        return( -1 );
        }
 
-offset( p, tyl ) register NODE *p; int tyl; {
+int offset(p, tyl) register NODE *p; int tyl; {
 
        if( tyl==1 &&
            p->in.op==REG &&
@@ -686,7 +680,7 @@ offset( p, tyl ) register NODE *p; int tyl; {
        return( -1 );
        }
 
-makeor2( p, q, b, o) register NODE *p, *q; register int b, o; {
+int makeor2(p, q, b, o) register NODE *p; register NODE *q; register int b; register int o; {
        register NODE *t;
        register int i;
        NODE *f;
@@ -736,24 +730,24 @@ makeor2( p, q, b, o) register NODE *p, *q; register int b, o; {
        return;
        }
 
-canaddr( p ) NODE *p; {
+int canaddr(p) NODE *p; {
        register int o = p->in.op;
 
        if( o==NAME || o==REG || o==ICON || o==OREG || (o==UNARY MUL && shumul(p->in.left)) ) return(1);
        return(0);
        }
 
-flshape( p ) register NODE *p; {
+int flshape(p) register NODE *p; {
        return( p->in.op == REG || p->in.op == NAME || p->in.op == ICON ||
                (p->in.op == OREG && (!R2TEST(p->tn.rval) || tlen(p) == 1)) );
        }
 
-shtemp( p ) register NODE *p; {
+int shtemp(p) register NODE *p; {
        if( p->in.op == STARG ) p = p->in.left;
        return( p->in.op==NAME || p->in.op ==ICON || p->in.op == OREG || (p->in.op==UNARY MUL && shumul(p->in.left)) );
        }
 
-shumul( p ) register NODE *p; {
+int shumul(p) register NODE *p; {
        register o;
        extern int x2debug;
 
@@ -762,16 +756,13 @@ shumul( p ) register NODE *p; {
                printf(" prname=%s,plty=%d, prlval=%D\n", p->in.right->in.name, p->in.left->in.type, p->in.right->tn.lval);
                }
 
-
        o = p->in.op;
        if( o == NAME || (o == OREG && !R2TEST(p->tn.rval)) || o == ICON ) return( STARNM );
 
        if( ( o == INCR || o == ASG MINUS ) &&
            ( p->in.left->in.op == REG && p->in.right->in.op == ICON ) &&
-           p->in.right->in.name[0] == '\0' )
-               {
-               switch (p->in.type)
-                       {
+           p->in.right->in.name[0] == '\0' ) {
+               switch (p->in.type) {
                        case CHAR|PTR:
                        case UCHAR|PTR:
                                o = 1;
@@ -808,12 +799,12 @@ shumul( p ) register NODE *p; {
        return( 0 );
        }
 
-adrcon( val ) CONSZ val; {
+int adrcon(val) CONSZ val; {
        putchar( '$' );
        printf( CONFMT, val );
        }
 
-conput( p ) register NODE *p; {
+int conput(p) register NODE *p; {
        switch( p->in.op ){
 
        case ICON:
@@ -829,15 +820,15 @@ conput( p ) register NODE *p; {
                }
        }
 
-insput( p ) register NODE *p; {
+int insput(p) register NODE *p; {
        cerror( "insput" );
        }
 
-upput( p ) register NODE *p; {
+int upput(p) register NODE *p; {
        cerror( "upput" );
        }
 
-adrput( p ) register NODE *p; {
+int adrput(p) register NODE *p; {
        register int r;
        /* output an address, with offsets, from p */
 
@@ -931,7 +922,7 @@ adrput( p ) register NODE *p; {
 
        }
 
-acon( p ) register NODE *p; { /* print out a constant */
+int acon(p) register NODE *p; { /* print out a constant */
 
        if( p->in.name[0] == '\0' ){
                printf( CONFMT, p->tn.lval);
@@ -983,7 +974,7 @@ aacon( p ) register NODE *p; { /* print out a constant */
        }
  */
 
-genscall( p, cookie ) register NODE *p; {
+int genscall(p, cookie) register NODE *p; int cookie; {
        /* structure valued call */
        return( gencall( p, cookie ) );
        }
@@ -992,7 +983,7 @@ genscall( p, cookie ) register NODE *p; {
 int gc_numbytes;
 /* tbl */
 
-gencall( p, cookie ) register NODE *p; {
+int gencall(p, cookie) register NODE *p; int cookie; {
        /* generate the call given by p */
        register NODE *p1;
        register temp, temp1;
@@ -1078,7 +1069,7 @@ ccbranches[] = {
        };
 /* tbl */
 
-cbgen( o, lab, mode ) { /*   printf conditional and unconditional branches */
+int cbgen(o, lab, mode) int o; int lab; int mode; { /*   printf conditional and unconditional branches */
 
 /* tbl */
        if( o == 0 ) printf( "  jbr     L%d\n", lab );
@@ -1089,7 +1080,7 @@ cbgen( o, lab, mode ) { /*   printf conditional and unconditional branches */
                }
        }
 
-nextcook( p, cookie ) NODE *p; {
+int nextcook(p, cookie) NODE *p; int cookie; {
        /* we have failed to match p with cookie; try another */
        if( cookie == FORREW ) return( 0 );  /* hopeless! */
        if( !(cookie&(INTAREG|INTBREG)) ) return( INTAREG|INTBREG );
@@ -1097,12 +1088,12 @@ nextcook( p, cookie ) NODE *p; {
        return( FORREW );
        }
 
-lastchance( p, cook ) NODE *p; {
+int lastchance(p, cook) NODE *p; int cook; {
        /* forget it! */
        return(0);
        }
 
-optim2( p ) register NODE *p; {
+int optim2(p) register NODE *p; {
        /* do local tree transformations and optimizations */
 
        register NODE *l, *r;
@@ -1180,28 +1171,24 @@ optim2( p ) register NODE *p; {
                }
        }
 
-NODE * addroreg(l) NODE *l;
+NODE *addroreg(l) NODE *l;
                                /* OREG was built in clocal()
                                 * for an auto or formal parameter
                                 * now its address is being taken
                                 * local code must unwind it
                                 * back to PLUS/MINUS REG ICON
                                 * according to local conventions
-                                */
-{
+                                */ {
        cerror("address of OREG taken");
        /*NOTREACHED*/
 }
 
-
-
 # ifndef ONEPASS
-main( argc, argv ) char *argv[]; {
+int main(argc, argv) int argc; char *argv[]; {
        return( mainp2( argc, argv ) );
        }
 # endif
 
-
 /* added by jwf */
 struct functbl {
        int fop;
@@ -1214,7 +1201,7 @@ struct functbl {
        ASG MOD,        TANY,   "aurem",
        0,      0,      0 };
 
-hardops(p)  register NODE *p; {
+int hardops(p) register NODE *p; {
        /* change hard to do operators into function calls.  */
        register NODE *q;
        register struct functbl *f;
@@ -1329,7 +1316,7 @@ hardops(p)  register NODE *p; {
 
        }
 
-zappost(p) NODE *p; {
+int zappost(p) NODE *p; {
        /* look for ++ and -- operators and remove them */
 
        register o, ty;
@@ -1353,7 +1340,7 @@ zappost(p) NODE *p; {
        if( ty != LTYPE ) zappost( p->in.left );
 }
 
-fixpre(p) NODE *p; {
+int fixpre(p) NODE *p; {
 
        register o, ty;
        o = p->in.op;
@@ -1373,7 +1360,7 @@ fixpre(p) NODE *p; {
        if( ty != LTYPE ) fixpre( p->in.left );
 }
 
-strip(p) register NODE *p; {
+int strip(p) register NODE *p; {
        NODE *q;
 
        /* strip nodes off the top when no side effects occur */
@@ -1391,7 +1378,7 @@ strip(p) register NODE *p; {
                }
        }
 
-myreader(p) register NODE *p; {
+int myreader(p) register NODE *p; {
        strip( p );             /* strip off operations with no side effects */
        canon( p );             /* expands r-vals for fields */
        walkf( p, hardops );    /* convert ops to function calls */
index 9d592fd..c05966f 100644 (file)
@@ -1,3 +1,8 @@
+#ifndef _MAC2DEFS_H_
+#define _MAC2DEFS_H_
+
+#include "pcclocal.h"
+
 /*     mac2defs.h      4.2     85/08/23        */
 
 /*
@@ -67,7 +72,9 @@ extern        int maxargs;
 /*#define      ncopy(q, p)     ((q)->in = (p)->in)*/
 
 #define MYREADER(p) myreader(p)
-int    optim2();
+/*int  optim2();*/
 
 /* This indicates there are no additional special shapes, see match.c */
 #define special(a, b)  0
+
+#endif
index f14ea55..541feb1 100644 (file)
@@ -1,7 +1,12 @@
+#ifndef _MACDEFS_H_
+#define _MACDEFS_H_
+
+#include "pcclocal.h"
+
 /*     macdefs.h       4.2     85/08/23        */
 
-#ifndef _MACDEFS_
-#define        _MACDEFS_
+/*#ifndef _MACDEFS_*/
+/*#define      _MACDEFS_*/
 
 #define makecc(val,i)  lastcon = (lastcon<<8)|((val<<24)>>24);  
 
@@ -65,4 +70,6 @@ typedef       long    OFFSZ;          /* size in which offsets are kept */
 /*#ifndef ncopy*/
 #define        ncopy(q, p)     ((q)->in = (p)->in)
 /*#endif*/
+/*#endif*/
+
 #endif
index b5ee1b8..dc26659 100644 (file)
@@ -1,11 +1,18 @@
+#ifndef _MANIFEST_H_
+#define _MANIFEST_H_
+
+/*#include "config.h" ndu.h*/
+#include "ndu.h"
+/*#include "pcclocal.h" ndu.h*/
+
 /*     manifest.h      4.1     85/03/19        */
 
-#ifndef _MANIFEST_
-#define        _MANIFEST_
+/*#ifndef _MANIFEST_*/
+/*#define      _MANIFEST_*/
 
-#include <stdio.h>
-#include "pcclocal.h"
-#include "config.h"
+/*#include <stdio.h>*/
+/*#include "pcclocal.h"*/
+/*#include "config.h"*/
 
 #define DSIZE  (MAXOP+1)       /* DSIZE is the size of the dope array */
 
@@ -88,9 +95,9 @@
  * External declarations, typedefs and the like
  */
 #ifdef FLEXNAMES
-char   *hash();
-char   *savestr();
-char   *tstr();
+/*char *hash();*/
+/*char *savestr();*/
+/*char *tstr();*/
 extern int tstrused;
 extern char *tstrbuf[];
 extern char **curtstr;
@@ -101,4 +108,31 @@ extern     int nerrors;            /* number of errors seen so far */
 extern int dope[];             /* a vector containing operator information */
 extern char *opst[];           /* a vector containing names for ops */
 
+/*#endif*/
+
+#ifndef __P
+#ifdef __STDC__
+#define __P(args) args
+#else
+#define __P(args) ()
+#endif
+#endif
+
+/* comm1.c */
+unsigned caloff __P((void));
+int uerror __P((char *s, ...));
+int cerror __P((char *s, ...));
+int werror __P((char *s, ...));
+int tinit __P((void));
+NODE *talloc __P((void));
+int tcheck __P((void));
+int tfree __P((NODE *p));
+int tfree1 __P((NODE *p));
+int fwalk __P((register NODE *t, int (*f)(void), int down));
+int walkf __P((register NODE *t, int (*f)(void)));
+int walkf __P((register NODE *t, register int (*f)(void)));
+int mkdope __P((void));
+int tprint __P((TWORD t));
+char *tstr __P((register char *cp));
+
 #endif
index 0dbd817..9b06732 100644 (file)
@@ -1,8 +1,16 @@
-#ifndef lint
+/*#include <stdio.h> pass2.h*/
+/*#include "mac2defs.h" pass2.h*/
+/*#include "macdefs.h" manifest.h*/
+/*#include "manifest.h" pass2.h*/
+/*#include "ndu.h" manifest.h*/
+#include "pass2.h"
+/*#include "pcclocal.h" mac2defs.h*/
+
+#if defined(DOSCCS) && !defined(lint)
 static char *sccsid ="@(#)match.c      4.4 (Berkeley) 8/22/85";
-#endif lint
+#endif
 
-# include "pass2.h"
+/*# include "pass2.h"*/
 
 # ifdef WCARD1
 # ifdef WCARD2
@@ -41,7 +49,7 @@ static int mamask[] = { /* masks for matching dope with shapes */
 
 int sdebug = 0;
 
-tshape( p, shape ) NODE *p; {
+int tshape(p, shape) NODE *p; int shape; {
        /* return true if shape is appropriate for the node p
           side effect for SFLD is to set up fldsz,etc */
        register o, mask;
@@ -157,7 +165,7 @@ tshape( p, shape ) NODE *p; {
 
 int t2debug = 0;
 
-ttype( t, tword ) TWORD t; {
+int ttype(t, tword) TWORD t; int tword; {
        /* does the type t match tword */
 
        if( tword & TANY ) return(1);
@@ -213,7 +221,7 @@ struct optab *rwtable;
 
 struct optab *opptr[DSIZE];
 
-setrew(){
+int setrew() {
        /* set rwtable to first value which allows rewrite */
        register struct optab *q;
        register int i;
@@ -231,7 +239,6 @@ setrew(){
                }
        cerror( "bad setrew" );
 
-
        more:
        for( i=0; i<DSIZE; ++i ){
                if( dope[i] ){ /* there is an op... */
@@ -263,7 +270,7 @@ setrew(){
                }
        }
 
-match( p, cookie ) NODE *p; {
+int match(p, cookie) NODE *p; int cookie; {
        /* called by: order, gencall
           look for match in table and generate code if found unless
           entry specified REWRITE.
@@ -319,7 +326,7 @@ match( p, cookie ) NODE *p; {
 
 int rtyflg = 0;
 
-expand( p, cookie, cp ) NODE *p;  register char *cp; {
+int expand(p, cookie, cp) NODE *p; int cookie; register char *cp; {
        /* generate code by interpreting table entry */
 
 # ifdef NEWZZZ
@@ -418,8 +425,7 @@ expand( p, cookie, cp ) NODE *p;  register char *cp; {
 
        }
 
-NODE *
-getlr( p, c ) NODE *p; {
+NODE *getlr(p, c) NODE *p; int c; {
 
        /* return the pointer to the left or right side of p, or p itself,
           depending on the optype of p */
@@ -469,7 +475,7 @@ int *mlsp; /* pointing into mlstack */
 NODE * ststack[MLSZ];
 NODE **stp; /* pointing into ststack */
 
-mlinit(){
+int mlinit() {
        union mltemplate **lastlink;
        register union mltemplate *n;
        register mlop;
@@ -531,7 +537,7 @@ mlinit(){
 # endif
        }
 
-mlmatch( subtree, target, subtarget ) NODE * subtree; int target,subtarget;{
+int mlmatch(subtree, target, subtarget) NODE *subtree; int target; int subtarget; {
        /*
         * does subtree match a multi-level tree with
         * tag "target"?  Return zero on failure,
index 827f9ea..27f539b 100644 (file)
@@ -1,3 +1,9 @@
+#ifndef _NDU_H_
+#define _NDU_H_
+
+#include "config.h"
+#include "macdefs.h"
+
 /*     ndu.h   4.1     85/03/19        */
 
 /*
@@ -81,3 +87,5 @@ union ndu {
                float   fval;
        } fpn;
 };
+
+#endif
index 3a11fe6..f490a25 100644 (file)
@@ -1,8 +1,14 @@
-#ifndef lint
+/*#include "macdefs.h" manifest.h*/
+/*#include "manifest.h" pass1.h*/
+/*#include "ndu.h" manifest.h*/
+#include "pass1.h"
+/*#include "pcclocal.h" macdefs.h*/
+
+#if defined(DOSCCS) && !defined(lint)
 static char *sccsid ="@(#)optim.c      4.7 (Berkeley) 1/8/86";
-#endif lint
+#endif
 
-# include "pass1.h"
+/*# include "pass1.h"*/
 
 # define SWAP(p,q) {sp=p; p=q; q=sp;}
 # define RCON(p) (p->in.right->in.op==ICON)
@@ -17,8 +23,7 @@ static char *sccsid ="@(#)optim.c     4.7 (Berkeley) 1/8/86";
 
 int oflag = 0;
 
-NODE *
-fortarg( p ) NODE *p; {
+NODE *fortarg(p) NODE *p; {
        /* fortran function arguments */
 
        if( p->in.op == CM ){
@@ -35,8 +40,7 @@ fortarg( p ) NODE *p; {
 
        /* mapping relationals when the sides are reversed */
 short revrel[] ={ EQ, NE, GE, GT, LE, LT, UGE, UGT, ULE, ULT };
-NODE *
-optim(p) register NODE *p; {
+NODE *optim(p) register NODE *p; {
        /* local optimizations, most of which are probably machine independent */
 
        register o, ty;
@@ -268,7 +272,7 @@ optim(p) register NODE *p; {
        return(p);
        }
 
-ispow2( c ) CONSZ c; {
+int ispow2(c) CONSZ c; {
        register i;
        if( c <= 0 || (c&(c-1)) ) return(-1);
        for( i=0; c>1; ++i) c >>= 1;
index 11e4acb..e3bee68 100644 (file)
@@ -1,12 +1,20 @@
-#ifndef lint
+/*#include <stdio.h> pass2.h*/
+/*#include "mac2defs.h" pass2.h*/
+/*#include "macdefs.h" manifest.h*/
+/*#include "manifest.h" pass2.h*/
+/*#include "ndu.h" manifest.h*/
+#include "pass2.h"
+/*#include "pcclocal.h" mac2defs.h*/
+
+#if defined(DOSCCS) && !defined(lint)
 static char *sccsid ="@(#)order.c      1.7 (Berkeley) 1/8/86";
-#endif lint
+#endif
 
-# include "pass2.h"
+/*# include "pass2.h"*/
 
 int maxargs = { -1 };
 
-stoasg( p, o ) register NODE *p; {
+int stoasg(p, o) register NODE *p; int o; {
        /* should the assignment op p be stored,
           given that it lies as the right operand of o
           (or the left, if o==UNARY MUL) */
@@ -16,13 +24,13 @@ stoasg( p, o ) register NODE *p; {
  */
        }
 
-deltest( p ) register NODE *p; {
+int deltest(p) register NODE *p; {
        /* should we delay the INCR or DECR operation p */
        p = p->in.left;
        return( p->in.op == REG || p->in.op == NAME || p->in.op == OREG );
        }
 
-autoincr( p ) NODE *p; {
+int autoincr(p) NODE *p; {
        register NODE *q = p->in.left;
 
        if( q->in.op == INCR && q->in.left->in.op == REG &&
@@ -32,7 +40,7 @@ autoincr( p ) NODE *p; {
        return(0);
        }
 
-mkadrs(p) register NODE *p; {
+int mkadrs(p) register NODE *p; {
        register o;
 
        o = p->in.op;
@@ -61,7 +69,7 @@ mkadrs(p) register NODE *p; {
                }
        }
 
-notoff( t, r, off, cp) TWORD t; CONSZ off; char *cp; {
+int notoff(t, r, off, cp) TWORD t; int r; CONSZ off; char *cp; {
        /* is it legal to make an OREG or NAME entry which has an
        /* offset of off, (from a register of r), if the
        /* resulting thing had type t */
@@ -72,7 +80,7 @@ notoff( t, r, off, cp) TWORD t; CONSZ off; char *cp; {
 
 # define max(x,y) ((x)<(y)?(y):(x))
 
-sucomp( p ) register NODE *p; {
+int sucomp(p) register NODE *p; {
 
        /* set the su field in the node to the sethi-ullman
           number, or local equivalent */
@@ -124,7 +132,6 @@ sucomp( p ) register NODE *p; {
                        }
                }
 
-
        /* If rhs needs n, lhs needs m, regular su computation */
 
        sul = p->in.left->in.su;
@@ -203,7 +210,7 @@ sucomp( p ) register NODE *p; {
 
 int radebug = 0;
 
-rallo( p, down ) NODE *p; {
+int rallo(p, down) NODE *p; int down; {
        /* do register allocation */
        register o, type, down1, down2, ty;
 
@@ -216,7 +223,6 @@ rallo( p, down ) NODE *p; {
        ty = optype( o = p->in.op );
        type = p->in.type;
 
-
        if( type == DOUBLE || type == FLOAT ){
                if( o == FORCE ) down1 = R0|MUSTDO;
                }
@@ -251,7 +257,7 @@ rallo( p, down ) NODE *p; {
 
        }
 
-offstar( p ) register NODE *p; {
+int offstar(p) register NODE *p; {
        if( p->in.op == PLUS ) {
                if( p->in.left->in.su == fregs ) {
                        order( p->in.left, INTAREG|INAREG );
@@ -297,7 +303,7 @@ offstar( p ) register NODE *p; {
        order( p, INTAREG|INAREG );
        }
 
-setincr( p ) register NODE *p; {
+int setincr(p) register NODE *p; {
        p = p->in.left;
        if( p->in.op == UNARY MUL ){
                offstar( p );
@@ -306,7 +312,7 @@ setincr( p ) register NODE *p; {
        return( 0 );
        }
 
-setbin( p ) register NODE *p; {
+int setbin(p) register NODE *p; {
        register ro, rt;
 
        rt = p->in.right->in.type;
@@ -345,7 +351,7 @@ setbin( p ) register NODE *p; {
        return(0);
        }
 
-setstr( p ) register NODE *p; { /* structure assignment */
+int setstr(p) register NODE *p; { /* structure assignment */
        if( p->in.right->in.op != REG ){
                order( p->in.right, INTAREG );
                return(1);
@@ -359,7 +365,7 @@ setstr( p ) register NODE *p; { /* structure assignment */
        return( 0 );
        }
 
-setasg( p ) register NODE *p; {
+int setasg(p) register NODE *p; {
        /* setup for assignment operator */
 
        if( !canaddr(p->in.right) ) {
@@ -386,7 +392,7 @@ setasg( p ) register NODE *p; {
        return(0);
        }
 
-setasop( p ) register NODE *p; {
+int setasop(p) register NODE *p; {
        /* setup for =ops */
        register rt, ro;
 
@@ -412,7 +418,6 @@ setasop( p ) register NODE *p; {
                }
  */
 
-
        p = p->in.left;
        if( p->in.op == FLD ) p = p->in.left;
 
@@ -438,15 +443,15 @@ setasop( p ) register NODE *p; {
 
 int crs2lab = 99999;  /* VAX */
 
-get2lab(){
+int get2lab() {
        return( crs2lab-- );
        }
 
-def2lab( l ){
+int def2lab(l) int l; {
        printf( "L%d:\n", l );
        }
 
-genargs( p ) register NODE *p; {
+int genargs(p) register NODE *p; {
        register NODE *pasg;
        register align;
        register size;
@@ -496,7 +501,7 @@ genargs( p ) register NODE *p; {
        order( p, FORARG );
        }
 
-argsize( p ) register NODE *p; {
+int argsize(p) register NODE *p; {
        register t;
        t = 0;
        if( p->in.op == CM ){
index c4b2dc9..77ca2c3 100644 (file)
@@ -1,11 +1,19 @@
+#ifndef _PASS1_H_
+#define _PASS1_H_
+
+/*#include "config.h" manifest.h*/
+/*#include "macdefs.h" manifest.h*/
+#include "manifest.h"
+/*#include "ndu.h" manifest.h*/
+
 /*     pass1.h 4.2     85/08/22        */
 
-#ifndef _PASS1_
-#define        _PASS1_
+/*#ifndef _PASS1_*/
+/*#define      _PASS1_*/
 
-#include "macdefs.h"
-#include "manifest.h"
-#include "ndu.h"
+/*#include "macdefs.h"*/
+/*#include "manifest.h"*/
+/*#include "ndu.h"*/
 
 /*
  * Symbol table definition.
@@ -58,7 +66,7 @@ struct        symtab {
 #define FIELD          0100
 #define FLDSIZ         077
 #ifndef BUG1
-extern char *scnames();
+/*extern       char *scnames();*/
 #endif
 
 /*
@@ -187,9 +195,9 @@ extern      NODE
        *clocal();
 OFFSZ  tsize(),
        psize();
-TWORD  types();
-double atof();
-char   *exname(), *exdcon();
+/*TWORD        types();*/
+/*double       atof();*/
+/*char *exname(), *exdcon();*/
 
 #define checkst(x)
 
@@ -230,4 +238,178 @@ char      *exname(), *exdcon();
 /* see pass2.h for the complete set of bits that can be on in the same word */
 #define NOPREF 020000          /* no preference for register assignment */
 
+/*#endif*/
+
+#ifndef __P
+#ifdef __STDC__
+#define __P(args) args
+#else
+#define __P(args) ()
+#endif
+#endif
+
+/* cgram.c */
+NODE *mkty __P((unsigned t, int d, int s));
+NODE *bdty __P((int op, NODE *p, int v));
+int dstash __P((int n));
+int savebc __P((void));
+int resetbc __P((int mask));
+int addcase __P((NODE *p));
+int adddef __P((void));
+int swstart __P((void));
+int swend __P((void));
+int yyparse __P((void));
+
+/* code.c */
+int branch __P((int n));
+int defalign __P((int n));
+int locctr __P((int l));
+int deflab __P((int n));
+int getlab __P((void));
+int efcode __P((void));
+int bfcode __P((int a[], int n));
+int bccode __P((void));
+int ejobcode __P((int flag));
+int aobeg __P((void));
+int aocode __P((struct symtab *p));
+int aoend __P((void));
+int defnam __P((register struct symtab *p));
+int bycode __P((int t, int i));
+int zecode __P((int n));
+int fldal __P((unsigned t));
+int fldty __P((struct symtab *p));
+int where __P((int c));
+char *toreg __P((TWORD type));
+int main __P((int argc, char *argv[]));
+int genswitch __P((register struct sw *p, int n));
+int makeheap __P((register struct sw *p, int m, int n));
+int select __P((int m));
+int walkheap __P((int start, int limit));
+
+/* local.c */
+NODE *cast __P((register NODE *p, TWORD t));
+NODE *clocal __P((NODE *p));
+int andable __P((NODE *p));
+int cendarg __P((void));
+int cisreg __P((TWORD t));
+NODE *offcon __P((OFFSZ off, TWORD t, int d, int s));
+int incode __P((register NODE *p, int sz));
+int fincode __P((double d, int sz));
+int cinit __P((NODE *p, int sz));
+int vfdzero __P((int n));
+char *exname __P((char *p));
+int ctype __P((TWORD type));
+int noinit __P((void));
+int commdec __P((int id));
+int isitlong __P((int cb, int ce));
+int isitfloat __P((char *s));
+int ecode __P((NODE *p));
+int tlen __P((NODE *p));
+
+/* optim.c */
+NODE *fortarg __P((NODE *p));
+NODE *optim __P((register NODE *p));
+int ispow2 __P((CONSZ c));
+
+/* pftn.c */
+int defid __P((register NODE *q, register int class));
+int psave __P((int i));
+int ftnend __P((void));
+int dclargs __P((void));
+NODE *rstruct __P((int idn, int soru));
+int moedef __P((int idn));
+int bstruct __P((int idn, int soru));
+NODE *dclstruct __P((int oparam));
+int yyerror __P((char *s));
+int yyaccpt __P((void));
+int ftnarg __P((int idn));
+int talign __P((register unsigned ty, register s));
+OFFSZ tsize __P((TWORD ty, int d, int s));
+int inforce __P((OFFSZ n));
+int vfdalign __P((int n));
+int beginit __P((int curid));
+int instk __P((int id, TWORD t, int d, int s, OFFSZ off));
+NODE *getstr __P((void));
+int putbyte __P((int v));
+int endinit __P((void));
+int doinit __P((register NODE *p));
+int gotscal __P((void));
+int ilbrace __P((void));
+int irbrace __P((void));
+int upoff __P((int size, register alignment, register *poff));
+int oalloc __P((register struct symtab *p, register *poff));
+int falloc __P((register struct symtab *p, int w, int new, NODE *pty));
+int nidcl __P((NODE *p));
+TWORD types __P((TWORD t1, TWORD t2, TWORD t3));
+NODE *tymerge __P((NODE *typ, NODE *idp));
+int tyreduce __P((register NODE *p));
+int fixtype __P((register NODE *p, int class));
+int uclass __P((register class));
+int fixclass __P((int class, TWORD type));
+struct symtab *mknonuniq __P((int *idindex));
+int lookup __P((char *name, int s));
+int XXXcheckst __P((int lev));
+struct symtab *relook __P((register struct symtab *p));
+int clearst __P((register int lev));
+int hide __P((register struct symtab *p));
+int unhide __P((register struct symtab *p));
+
+/* scan.c */
+int mainp1 __P((int argc, char *argv[]));
+int lxenter __P((register char *s, int m));
+int lxmore __P((register c, register m));
+int lxinit __P((void));
+int lxstr __P((int ct));
+int lxcom __P((void));
+int yylex __P((void));
+int lxres __P((void));
+int lxtitle __P((void));
+char *savestr __P((register char *cp));
+char *hash __P((char *s));
+
+/* stab.c */
+int fixarg __P((struct symtab *p));
+int outstab __P((struct symtab *sym));
+int outstruct __P((int szindex, int paramindex));
+int pstab __P((char *name, int type));
+int pstabdot __P((int type, int value));
+int psline __P((void));
+int plcstab __P((int level));
+int prcstab __P((int level));
+int pfstab __P((char *sname));
+
+/* trees.c */
+int printact __P((NODE *t, int acts));
+NODE *buildtree __P((int o, register NODE *l, register NODE *r));
+int fpe __P((void));
+NODE *fixargs __P((register NODE *p));
+int chkstr __P((int i, int j, TWORD type));
+int conval __P((register NODE *p, int o, register NODE *q));
+int chkpun __P((register NODE *p));
+NODE *stref __P((register NODE *p));
+int notlval __P((register NODE *p));
+NODE *bcon __P((int i));
+NODE *bpsize __P((register NODE *p));
+OFFSZ psize __P((NODE *p));
+NODE *convert __P((register NODE *p, int f));
+int econvert __P((register NODE *p));
+NODE *pconvert __P((register NODE *p));
+NODE *oconvert __P((register NODE *p));
+NODE *ptmatch __P((register NODE *p));
+NODE *tymatch __P((register NODE *p));
+NODE *makety __P((register NODE *p, TWORD t, int d, int s));
+NODE *block __P((int o, register NODE *l, register NODE *r, TWORD t, int d, int s));
+int icons __P((register NODE *p));
+int opact __P((NODE *p));
+int moditype __P((TWORD ty));
+NODE *doszof __P((register NODE *p));
+int eprint __P((register NODE *p, int down, int *a, int *b));
+int prtdcon __P((register NODE *p));
+int ecomp __P((register NODE *p));
+int prtree __P((register NODE *p));
+int p2tree __P((register NODE *p));
+
+/* xdefs.c */
+char *scnames __P((register c));
+
 #endif
index d6e35ab..b39d768 100644 (file)
@@ -1,12 +1,23 @@
-/*     pass2.h 4.1     85/03/19        */
-
-#ifndef _PASS2_
-#define        _PASS2_
+#ifndef _PASS2_H_
+#define _PASS2_H_
 
-#include "macdefs.h"
+#include <stdio.h>
+/*#include "config.h" manifest.h*/
 #include "mac2defs.h"
+/*#include "macdefs.h" manifest.h*/
 #include "manifest.h"
-#include "ndu.h"
+/*#include "ndu.h" manifest.h*/
+/*#include "pcclocal.h" mac2defs.h*/
+
+/*     pass2.h 4.1     85/03/19        */
+
+/*#ifndef _PASS2_*/
+/*#define      _PASS2_*/
+
+/*#include "macdefs.h"*/
+/*#include "mac2defs.h"*/
+/*#include "manifest.h"*/
+/*#include "ndu.h"*/
 
 /* cookies, used as arguments to codgen */
 #define FOREFF 01              /* compute for effects only */
@@ -172,8 +183,8 @@ extern      NODE
        *tcopy(),
        *getlr();
 
-extern CONSZ rdin();
-extern int e2print();
+/*extern       CONSZ rdin();*/
+/*extern       int e2print();*/
 extern char *rnames[];
 
 extern int lineno;
@@ -222,4 +233,136 @@ union     mltemplate {
 extern union mltemplate mltree[];
 #endif
 
+/*#endif*/
+
+#ifndef __P
+#ifdef __STDC__
+#define __P(args) args
+#else
+#define __P(args) ()
+#endif
+#endif
+
+/* allo.c */
+int allo0 __P((void));
+int allo __P((NODE *p, struct optab *q));
+int freetemp __P((int k));
+int freereg __P((NODE *p, int n));
+int usable __P((NODE *p, int n, int r));
+int shareit __P((NODE *p, int r, int n));
+int ushare __P((NODE *p, int f, int r));
+int recl2 __P((register NODE *p));
+int rfree __P((int r, TWORD t));
+int rbusy __P((int r, TWORD t));
+int rwprint __P((int rw));
+int reclaim __P((NODE *p, int rw, int cookie));
+int XXXncopy __P((NODE *q, NODE *p));
+NODE *tcopy __P((register NODE *p));
+int allchk __P((void));
+
+/* fort.c */
+int label __P((int n));
+int tlabel __P((void));
+char *lnread __P((void));
+long lread __P((void));
+int lopen __P((char *s));
+int lcread __P((char *cp, int n));
+int lccopy __P((register n));
+int mainp2 __P((int argc, char *argv[]));
+
+/* local2.c */
+int where2 __P((int c));
+int lineid __P((int l, char *fn));
+int eobl2 __P((void));
+int hopcode __P((int f, int o));
+int tlen __P((NODE *p));
+int mixtypes __P((NODE *p, NODE *q));
+int prtype __P((NODE *n));
+int zzzcode __P((register NODE *p, int c));
+int collapsible __P((NODE *dest, NODE *src));
+int rmove __P((int rt, int rs, TWORD t));
+int setregs __P((void));
+int rewfld __P((NODE *p));
+int callreg __P((NODE *p));
+int base __P((register NODE *p));
+int offset __P((register NODE *p, int tyl));
+int makeor2 __P((register NODE *p, register NODE *q, register int b, register int o));
+int canaddr __P((NODE *p));
+int flshape __P((register NODE *p));
+int shtemp __P((register NODE *p));
+int shumul __P((register NODE *p));
+int adrcon __P((CONSZ val));
+int conput __P((register NODE *p));
+int insput __P((register NODE *p));
+int upput __P((register NODE *p));
+int adrput __P((register NODE *p));
+int acon __P((register NODE *p));
+int genscall __P((register NODE *p, int cookie));
+int gencall __P((register NODE *p, int cookie));
+int cbgen __P((int o, int lab, int mode));
+int nextcook __P((NODE *p, int cookie));
+int lastchance __P((NODE *p, int cook));
+int optim2 __P((register NODE *p));
+NODE *addroreg __P((NODE *l));
+int main __P((int argc, char *argv[]));
+int hardops __P((register NODE *p));
+int zappost __P((NODE *p));
+int fixpre __P((NODE *p));
+int strip __P((register NODE *p));
+int myreader __P((register NODE *p));
+
+/* match.c */
+int tshape __P((NODE *p, int shape));
+int ttype __P((TWORD t, int tword));
+int setrew __P((void));
+int match __P((NODE *p, int cookie));
+int expand __P((NODE *p, int cookie, register char *cp));
+NODE *getlr __P((NODE *p, int c));
+int mlinit __P((void));
+int mlmatch __P((NODE *subtree, int target, int subtarget));
+
+/* order.c */
+int stoasg __P((register NODE *p, int o));
+int deltest __P((register NODE *p));
+int autoincr __P((NODE *p));
+int mkadrs __P((register NODE *p));
+int notoff __P((TWORD t, int r, CONSZ off, char *cp));
+int sucomp __P((register NODE *p));
+int rallo __P((NODE *p, int down));
+int offstar __P((register NODE *p));
+int setincr __P((register NODE *p));
+int setbin __P((register NODE *p));
+int setstr __P((register NODE *p));
+int setasg __P((register NODE *p));
+int setasop __P((register NODE *p));
+int get2lab __P((void));
+int def2lab __P((int l));
+int genargs __P((register NODE *p));
+int argsize __P((register NODE *p));
+
+/* reader.c */
+int p2init __P((int argc, char *argv[]));
+int mainp2 __P((int argc, char *argv[]));
+int p2compile __P((NODE *p));
+int p2bbeg __P((int aoff, int myreg));
+int p2bend __P((void));
+int delay __P((register NODE *p));
+int delay1 __P((register NODE *p));
+int delay2 __P((register NODE *p));
+int codgen __P((NODE *p, int cookie));
+int prcook __P((int cookie));
+int order __P((NODE *p, int cook));
+int store __P((register NODE *p));
+int constore __P((register NODE *p));
+int markcall __P((register NODE *p));
+int stoarg __P((register NODE *p, int calltype));
+int cbranch __P((NODE *p, int true, int false));
+int rcount __P((void));
+int e2print __P((NODE *p, int down, int *a, int *b));
+NODE *eread __P((void));
+CONSZ rdin __P((int base));
+int ffld __P((NODE *p, int down, int *down1, int *down2));
+int oreg2 __P((register NODE *p));
+int canon __P((NODE *p));
+
 #endif
index 0e7ce72..2c37420 100644 (file)
@@ -1,3 +1,6 @@
+#ifndef _PCCLOCAL_H_
+#define _PCCLOCAL_H_
+
 /*#ifndef _H_*/
 /*# ifndef     TOKENS*/
 # define       TOKENS  0
 # define       ENUM    124
 # define       SM              125
 /*# endif      LOCALTOKENS*/
+
+#endif
index a3604d6..c522488 100644 (file)
@@ -1,8 +1,16 @@
-#ifndef lint
+#include <stdio.h>
+/*#include "config.h" manifest.h*/
+/*#include "macdefs.h" manifest.h*/
+/*#include "manifest.h" pass1.h*/
+/*#include "ndu.h" manifest.h*/
+#include "pass1.h"
+/*#include "pcclocal.h" macdefs.h*/
+
+#if defined(DOSCCS) && !defined(lint)
 static char *sccsid ="@(#)pftn.c       1.12 (Berkeley) 4/21/86";
-#endif lint
+#endif
 
-# include "pass1.h"
+/*# include "pass1.h"*/
 
 unsigned int offsz;
 
@@ -25,15 +33,13 @@ instack[10],
 
        /* defines used for getting things off of the initialization stack */
 
-
-struct symtab *relook();
-
+/*struct symtab *relook();*/
 
 int ddebug = 0;
 
-struct symtab * mknonuniq();
+/*struct symtab * mknonuniq();*/
 
-defid( q, class ) register NODE *q; register int class; {
+int defid(q, class) register NODE *q; register int class; {
        register struct symtab *p;
        int idp;
        register TWORD type;
@@ -372,8 +378,7 @@ defid( q, class ) register NODE *q; register int class; {
                if( regvar < minrvar ) minrvar = regvar;
                break;
                }
-
-       {
+ {
                register int l = p->slevel;
 
                if( l >= MAXSCOPES )
@@ -395,14 +400,14 @@ defid( q, class ) register NODE *q; register int class; {
 
        }
 
-psave( i ){
+int psave(i) int i; {
        if( paramno >= PARAMSZ ){
                cerror( "parameter stack overflow");
                }
        paramstk[ paramno++ ] = i;
        }
 
-ftnend(){ /* end of function */
+int ftnend() { /* end of function */
        if( retlab != NOLAB ){ /* inside a real function */
                efcode();
                }
@@ -427,7 +432,7 @@ ftnend(){ /* end of function */
        locctr(DATA);
        }
 
-dclargs(){
+int dclargs() {
        register i, j;
        register struct symtab *p;
        register NODE *q;
@@ -461,8 +466,7 @@ dclargs(){
        paramno = 0;
        }
 
-NODE *
-rstruct( idn, soru ){ /* reference to a structure or union, with no definition */
+NODE *rstruct(idn, soru) int idn; int soru; { /* reference to a structure or union, with no definition */
        register struct symtab *p;
        register NODE *q;
        p = &stab[idn];
@@ -493,7 +497,7 @@ rstruct( idn, soru ){ /* reference to a structure or union, with no definition *
        return( mkty( p->stype, 0, p->sizoff ) );
        }
 
-moedef( idn ){
+int moedef(idn) int idn; {
        register NODE *q;
 
        q = block( FREE, NIL, NIL, MOETY, 0, 0 );
@@ -501,7 +505,7 @@ moedef( idn ){
        if( idn>=0 ) defid( q, MOE );
        }
 
-bstruct( idn, soru ){ /* begining of structure or union declaration */
+int bstruct(idn, soru) int idn; int soru; { /* begining of structure or union declaration */
        register NODE *q;
 
        psave( instruct );
@@ -532,8 +536,7 @@ bstruct( idn, soru ){ /* begining of structure or union declaration */
        return( paramno-4 );
        }
 
-NODE *
-dclstruct( oparam ){
+NODE *dclstruct(oparam) int oparam; {
        register struct symtab *p;
        register i, al, sa, j, sz, szindex;
        register TWORD temp;
@@ -549,7 +552,6 @@ dclstruct( oparam ){
 
                */
 
-
        if( (i=paramstk[oparam+3]) < 0 ){
                szindex = curdim;
                dstash( 0 );  /* size */
@@ -650,17 +652,17 @@ dclstruct( oparam ){
        }
 
        /* VARARGS */
-yyerror( s ) char *s; { /* error printing routine in parser */
+int yyerror(s) char *s; { /* error printing routine in parser */
 
        uerror( s );
 
        }
 
-yyaccpt(){
+int yyaccpt() {
        ftnend();
        }
 
-ftnarg( idn ) {
+int ftnarg(idn) int idn; {
        switch( stab[idn].stype ){
 
        case UNDEF:
@@ -689,7 +691,7 @@ ftnarg( idn ) {
        psave( idn );
        }
 
-talign( ty, s) register unsigned ty; register s; {
+int talign(ty, s) register unsigned ty; register s; {
        /* compute the alignment of an object with type ty, sizeoff index s */
 
        register i;
@@ -739,8 +741,7 @@ talign( ty, s) register unsigned ty; register s; {
                }
        }
 
-OFFSZ
-tsize( ty, d, s )  TWORD ty; {
+OFFSZ tsize(ty, d, s) TWORD ty; int d; int s; {
        /* compute the size associated with type ty,
            dimoff d, and sizoff s */
        /* BETTER NOT BE CALLED WHEN t, d, and s REFER TO A BIT FIELD... */
@@ -776,7 +777,7 @@ tsize( ty, d, s )  TWORD ty; {
        return( (unsigned int) dimtab[ s ] * mult );
        }
 
-inforce( n ) OFFSZ n; {  /* force inoff to have the value n */
+int inforce(n) OFFSZ n; {  /* force inoff to have the value n */
        /* inoff is updated to have the value n */
        OFFSZ wb;
        register rest;
@@ -816,7 +817,7 @@ inforce( n ) OFFSZ n; {  /* force inoff to have the value n */
 
        }
 
-vfdalign( n ){ /* make inoff have the offset the next alignment of n */
+int vfdalign(n) int n; { /* make inoff have the offset the next alignment of n */
        OFFSZ m;
 
        m = inoff;
@@ -824,7 +825,6 @@ vfdalign( n ){ /* make inoff have the offset the next alignment of n */
        inforce( m );
        }
 
-
 int idebug = 0;
 
 int ibseen = 0;  /* the number of } constructions which have been filled */
@@ -835,7 +835,7 @@ int iclass;  /* storage class of thing being initialized */
 
 int ilocctr = 0;  /* location counter for current initialization */
 
-beginit(curid){
+int beginit(curid) int curid; {
        /* beginning of initilization; set location ctr and set type */
        register struct symtab *p;
 
@@ -874,7 +874,7 @@ beginit(curid){
 
        }
 
-instk( id, t, d, s, off ) OFFSZ off; TWORD t; {
+int instk(id, t, d, s, off) int id; TWORD t; int d; int s; OFFSZ off; {
        /* make a new entry on the parameter stack to initialize id */
 
        register struct symtab *p;
@@ -938,8 +938,7 @@ instk( id, t, d, s, off ) OFFSZ off; TWORD t; {
                }
        }
 
-NODE *
-getstr(){ /* decide if the string is external or an initializer, and get the contents accordingly */
+NODE *getstr() { /* decide if the string is external or an initializer, and get the contents accordingly */
 
        register l, temp;
        register NODE *p;
@@ -972,7 +971,7 @@ getstr(){ /* decide if the string is external or an initializer, and get the con
                }
        }
 
-putbyte( v ){ /* simulate byte v appearing in a list of integer values */
+int putbyte(v) int v; { /* simulate byte v appearing in a list of integer values */
        register NODE *p;
        p = bcon(v);
        incode( p, SZCHAR );
@@ -980,7 +979,7 @@ putbyte( v ){ /* simulate byte v appearing in a list of integer values */
        gotscal();
        }
 
-endinit(){
+int endinit() {
        register TWORD t;
        register d, s, n, d1;
 
@@ -1035,7 +1034,7 @@ endinit(){
 
        }
 
-doinit( p ) register NODE *p; {
+int doinit(p) register NODE *p; {
 
        /* take care of generating a value for the initializer p */
        /* inoff has the current offset (last bit written)
@@ -1126,7 +1125,7 @@ doinit( p ) register NODE *p; {
        tfree(p);
        }
 
-gotscal(){
+int gotscal() {
        register t, ix;
        register n, id;
        struct symtab *p;
@@ -1166,7 +1165,7 @@ gotscal(){
        ifull = 1;
        }
 
-ilbrace(){ /* process an initializer's left brace */
+int ilbrace() { /* process an initializer's left brace */
        register t;
        struct instk *temp;
 
@@ -1192,7 +1191,7 @@ ilbrace(){ /* process an initializer's left brace */
        pstk = temp;
        }
 
-irbrace(){
+int irbrace() {
        /* called when a '}' is seen */
 
 # ifndef BUG1
@@ -1219,7 +1218,7 @@ irbrace(){
 
        }
 
-upoff( size, alignment, poff ) register alignment, *poff; {
+int upoff(size, alignment, poff) int size; register alignment; register *poff; {
        /* update the offset pointed to by poff; return the
        /* offset of a value of size `size', alignment `alignment',
        /* given that off is increasing */
@@ -1236,7 +1235,7 @@ upoff( size, alignment, poff ) register alignment, *poff; {
        return( off );
        }
 
-oalloc( p, poff ) register struct symtab *p; register *poff; {
+int oalloc(p, poff) register struct symtab *p; register *poff; {
        /* allocate p with offset *poff, and update *poff */
        register al, off, tsz;
        int noff;
@@ -1259,8 +1258,7 @@ oalloc( p, poff ) register struct symtab *p; register *poff; {
                        off = noff - tsz;
 #endif
                        }
-               else
-               {
+               else {
                off = upoff( tsz, al, &noff );
                }
 
@@ -1273,7 +1271,7 @@ oalloc( p, poff ) register struct symtab *p; register *poff; {
        return(0);
        }
 
-falloc( p, w, new, pty )  register struct symtab *p; NODE *pty; {
+int falloc(p, w, new, pty) register struct symtab *p; int w; int new; NODE *pty; {
        /* allocate a field of width w */
        /* new is 0 if new entry, 1 if redefinition, -1 if alignment */
 
@@ -1284,8 +1282,7 @@ falloc( p, w, new, pty )  register struct symtab *p; NODE *pty; {
        /* this must be fixed to use the current type in alignments */
        switch( new<0?pty->in.type:p->stype ){
 
-       case ENUMTY:
-               {
+       case ENUMTY: {
                        int s;
                        s = new<0 ? pty->fn.csiz : p->sizoff;
                        al = dimtab[s+2];
@@ -1362,7 +1359,7 @@ falloc( p, w, new, pty )  register struct symtab *p; NODE *pty; {
        return(0);
        }
 
-nidcl( p ) NODE *p; { /* handle unitialized declarations */
+int nidcl(p) NODE *p; { /* handle unitialized declarations */
        /* assumed to be not functions */
        register class;
        register commflag;  /* flag for labelled common declarations */
@@ -1413,8 +1410,7 @@ nidcl( p ) NODE *p; { /* handle unitialized declarations */
        if( commflag ) commdec( p->tn.rval );
        }
 
-TWORD
-types( t1, t2, t3 ) TWORD t1, t2, t3; {
+TWORD types(t1, t2, t3) TWORD t1; TWORD t2; TWORD t3; {
        /* return a basic type from basic types t1, t2, and t3 */
 
        TWORD t[3], noun, adj, unsg;
@@ -1473,8 +1469,7 @@ types( t1, t2, t3 ) TWORD t1, t2, t3; {
        else return( noun );
        }
 
-NODE *
-tymerge( typ, idp ) NODE *typ, *idp; {
+NODE *tymerge(typ, idp) NODE *typ; NODE *idp; {
        /* merge type typ with identifier idp  */
 
        register unsigned t;
@@ -1508,7 +1503,7 @@ tymerge( typ, idp ) NODE *typ, *idp; {
        return( idp );
        }
 
-tyreduce( p ) register NODE *p; {
+int tyreduce(p) register NODE *p; {
 
        /* build a type, and stash away dimensions, from a parse tree of the declaration */
        /* the type is build top down, the dimensions bottom up */
@@ -1540,7 +1535,7 @@ tyreduce( p ) register NODE *p; {
 
        }
 
-fixtype( p, class ) register NODE *p; {
+int fixtype(p, class) register NODE *p; int class; {
        register unsigned t, type;
        register mod1, mod2;
        /* fix up the types, and check for legality */
@@ -1586,7 +1581,7 @@ fixtype( p, class ) register NODE *p; {
        p->in.type = type;
        }
 
-uclass( class ) register class; {
+int uclass(class) register class; {
        /* give undefined version of class */
        if( class == SNULL ) return( EXTERN );
        else if( class == STATIC ) return( USTATIC );
@@ -1594,7 +1589,7 @@ uclass( class ) register class; {
        else return( class );
        }
 
-fixclass( class, type ) TWORD type; {
+int fixclass(class, type) int class; TWORD type; {
 
        /* first, fix null class */
 
@@ -1694,8 +1689,7 @@ fixclass( class, type ) TWORD type; {
                }
        }
 
-struct symtab *
-mknonuniq(idindex) int *idindex; {/* locate a symbol table entry for */
+struct symtab *mknonuniq(idindex) int *idindex; {/* locate a symbol table entry for */
        /* an occurrence of a nonunique structure member name */
        /* or field */
        register i;
@@ -1732,7 +1726,7 @@ mknonuniq(idindex) int *idindex; {/* locate a symbol table entry for */
        return ( sp );
        }
 
-lookup( name, s) char *name; { 
+int lookup(name, s) char *name; int s; { 
        /* look up name: must agree with s w.r.t. STAG, SMOS and SHIDDEN */
 
        register char *p, *q;
@@ -1797,7 +1791,7 @@ lookup( name, s) char *name; {
 
 #ifndef checkst
 /* if not debugging, make checkst a macro */
-XXXcheckst(lev){
+int XXXcheckst(lev) int lev; {
        register int s, i, j;
        register struct symtab *p, *q;
 
@@ -1824,8 +1818,7 @@ XXXcheckst(lev){
        }
 #endif
 
-struct symtab *
-relook(p) register struct symtab *p; {  /* look up p again, and see where it lies */
+struct symtab *relook(p) register struct symtab *p; {  /* look up p again, and see where it lies */
 
        register struct symtab *q;
 
@@ -1843,7 +1836,7 @@ relook(p) register struct symtab *p; {  /* look up p again, and see where it lie
        return(q);
        }
 
-clearst( lev ) register int lev; {
+int clearst(lev) register int lev; {
        register struct symtab *p, *q;
        register int temp;
        struct symtab *clist = 0;
@@ -1912,7 +1905,7 @@ clearst( lev ) register int lev; {
        aoend();
        }
 
-hide( p ) register struct symtab *p; {
+int hide(p) register struct symtab *p; {
        register struct symtab *q;
        for( q=p+1; ; ++q ){
                if( q >= &stab[SYMTSZ] ) q = stab;
@@ -1933,7 +1926,7 @@ hide( p ) register struct symtab *p; {
        return( idname = q-stab );
        }
 
-unhide( p ) register struct symtab *p; {
+int unhide(p) register struct symtab *p; {
        register struct symtab *q;
        register s, j;
 
index fd9145c..b1e0e83 100644 (file)
@@ -1,8 +1,17 @@
-#ifndef lint
+/*#include <stdio.h> pass2.h*/
+/*#include "config.h" manifest.h*/
+/*#include "mac2defs.h" pass2.h*/
+/*#include "macdefs.h" manifest.h*/
+/*#include "manifest.h" pass2.h*/
+/*#include "ndu.h" manifest.h*/
+#include "pass2.h"
+/*#include "pcclocal.h" mac2defs.h*/
+
+#if defined(DOSCCS) && !defined(lint)
 static char *sccsid ="@(#)reader.c     4.4 (Berkeley) 8/22/85";
-#endif lint
+#endif
 
-# include "pass2.h"
+/*# include "pass2.h"*/
 
 /*     some storage declarations */
 
@@ -38,7 +47,7 @@ int stocook;
 OFFSZ baseoff = 0;
 OFFSZ maxtemp = 0;
 
-p2init( argc, argv ) char *argv[];{
+int p2init(argc, argv) int argc; char *argv[]; {
        /* set the values of the pass 2 arguments */
 
        register int c;
@@ -125,9 +134,9 @@ p2init( argc, argv ) char *argv[];{
        }
 
 # if !defined(FORT) && !defined(ONEPASS)
-unsigned int caloff();
+/*unsigned int caloff();*/
 unsigned int offsz;
-mainp2( argc, argv ) char *argv[]; {
+int mainp2(argc, argv) int argc; char *argv[]; {
        register files;
        register temp;
        register c;
@@ -226,7 +235,7 @@ mainp2( argc, argv ) char *argv[]; {
 # endif
 
 # ifdef ONEPASS
-p2compile( p ) NODE *p; {
+int p2compile(p) NODE *p; {
 
        if( lflag ) lineid( lineno, ftitle );
        tmpoff = baseoff;  /* expression at top level reuses temps */
@@ -246,7 +255,7 @@ p2compile( p ) NODE *p; {
        /* first pass will do it... */
        }
 
-p2bbeg( aoff, myreg ) {
+int p2bbeg(aoff, myreg) int aoff; int myreg; {
        static int myftn = -1;
 
        tmpoff = baseoff = (unsigned int) aoff;
@@ -263,7 +272,7 @@ p2bbeg( aoff, myreg ) {
        setregs();
        }
 
-p2bend(){
+int p2bend() {
        SETOFF( maxoff, ALSTACK );
        eobl2();
        }
@@ -272,7 +281,7 @@ p2bend(){
 NODE *deltrees[DELAYS];
 int deli;
 
-delay( p ) register NODE *p; {
+int delay(p) register NODE *p; {
        /* look in all legal places for COMOP's and ++ and -- ops to delay */
        /* note; don't delay ++ and -- within calls or things like
        /* getchar (in their macro forms) will start behaving strangely */
@@ -290,7 +299,7 @@ delay( p ) register NODE *p; {
        for( i = 0; i<deli; ++i ) codgen( deltrees[i], FOREFF );  /* do the rest */
        }
 
-delay1( p ) register NODE *p; {  /* look for COMOPS */
+int delay1(p) register NODE *p; {  /* look for COMOPS */
        register o, ty;
 
        o = p->in.op;
@@ -320,7 +329,7 @@ delay1( p ) register NODE *p; {  /* look for COMOPS */
        return( delay1(p->in.left) || delay1(p->in.right ) );
        }
 
-delay2( p ) register NODE *p; {
+int delay2(p) register NODE *p; {
 
        /* look for delayable ++ and -- operators */
 
@@ -371,7 +380,7 @@ delay2( p ) register NODE *p; {
        if( ty != LTYPE ) delay2( p->in.left );
        }
 
-codgen( p, cookie ) NODE *p; {
+int codgen(p, cookie) NODE *p; int cookie; {
 
        /* generate the code for p;
           order may call codgen recursively */
@@ -426,7 +435,7 @@ char *cnames[] = {
        0,
        };
 
-prcook( cookie ){
+int prcook(cookie) int cookie; {
 
        /* print a nice-looking description of cookie */
 
@@ -457,7 +466,7 @@ prcook( cookie ){
 
 int odebug = 0;
 
-order(p,cook) NODE *p; {
+int order(p, cook) NODE *p; int cook; {
 
        register o, ty, m;
        int m1;
@@ -708,7 +717,6 @@ order(p,cook) NODE *p; {
                if( setasg( p ) ) goto again;
                goto nomat;
 
-
        case BITYPE:
                if( setbin( p ) ) goto again;
                /* try to replace binary ops by =ops */
@@ -755,7 +763,7 @@ order(p,cook) NODE *p; {
 int callflag;
 int fregs;
 
-store( p ) register NODE *p; {
+int store(p) register NODE *p; {
 
        /* find a subtree of p which should be stored */
 
@@ -820,7 +828,7 @@ store( p ) register NODE *p; {
        store( p->in.left );
        }
 
-constore( p ) register NODE *p; {
+int constore(p) register NODE *p; {
 
        /* store conditional expressions */
        /* the point is, avoid storing expressions in conditional
@@ -841,7 +849,7 @@ constore( p ) register NODE *p; {
        store( p );
        }
 
-markcall( p ) register NODE *p; {  /* mark off calls below the current node */
+int markcall(p) register NODE *p; {  /* mark off calls below the current node */
 
        again:
        switch( p->in.op ){
@@ -871,7 +879,7 @@ markcall( p ) register NODE *p; {  /* mark off calls below the current node */
 
        }
 
-stoarg( p, calltype ) register NODE *p; {
+int stoarg(p, calltype) register NODE *p; int calltype; {
        /* arrange to store the args */
 
        if( p->in.op == CM ){
@@ -899,7 +907,7 @@ stoarg( p, calltype ) register NODE *p; {
 
 int negrel[] = { NE, EQ, GT, GE, LT, LE, UGT, UGE, ULT, ULE } ;  /* negatives of relationals */
 
-cbranch( p, true, false ) NODE *p; {
+int cbranch(p, true, false) NODE *p; int true; int false; {
        /* evaluate p for truth value, and branch to true or false
        /* accordingly: label <0 means fall through */
 
@@ -1030,7 +1038,7 @@ cbranch( p, true, false ) NODE *p; {
 
        }
 
-rcount(){ /* count recursions */
+int rcount() { /* count recursions */
        if( ++nrecur > NRECUR ){
                cerror( "expression causes compiler loop: try simplifying" );
                }
@@ -1038,7 +1046,7 @@ rcount(){ /* count recursions */
        }
 
 # ifndef BUG4
-e2print( p, down, a, b ) NODE *p; int *a, *b; {
+int e2print(p, down, a, b) NODE *p; int down; int *a; int *b; {
 
        *a = *b = down+1;
        while( down >= 2 ){
@@ -1047,7 +1055,6 @@ e2print( p, down, a, b ) NODE *p; int *a, *b; {
                }
        if( down-- ) printf( "    " );
 
-
        printf( "%o) %s", p, opst[p->in.op] );
        switch( p->in.op ) { /* special cases */
 
@@ -1086,8 +1093,7 @@ e2print( p, down, a, b ) NODE *p; int *a, *b; {
 # endif
 
 # if !defined(FORT) && !defined(ONEPASS)
-NODE *
-eread(){
+NODE *eread() {
 
        /* call eread recursively to get subtrees, if any */
 
@@ -1142,8 +1148,7 @@ eread(){
 
        }
 
-CONSZ
-rdin( base ){
+CONSZ rdin(base) int base; {
        register sign, c;
        CONSZ val;
 
@@ -1179,7 +1184,7 @@ rdin( base ){
 #ifndef FIELDOPS
        /* do this if there is no special hardware support for fields */
 
-ffld( p, down, down1, down2 ) NODE *p; int *down1, *down2; {
+int ffld(p, down, down1, down2) NODE *p; int down; int *down1; int *down2; {
         /* look for fields that are not in an lvalue context, and rewrite them... */
        register NODE *shp;
        register s, o, v, ty;
@@ -1245,7 +1250,7 @@ ffld( p, down, down1, down2 ) NODE *p; int *down1, *down2; {
        }
 #endif
 
-oreg2( p ) register NODE *p; {
+int oreg2(p) register NODE *p; {
 
        /* look for situations where2 we can turn * into OREG */
 
@@ -1283,7 +1288,6 @@ oreg2( p ) register NODE *p; {
                                }
                        }
 
-
 #endif
 
                if( (q->in.op==PLUS || q->in.op==MINUS) && qr->in.op == ICON &&
@@ -1314,7 +1318,7 @@ oreg2( p ) register NODE *p; {
 
        }
 
-canon(p) NODE *p; {
+int canon(p) NODE *p; {
        /* put p in canonical form */
        int oreg2(), sucomp();
 
@@ -1329,4 +1333,3 @@ canon(p) NODE *p; {
        walkf( p, sucomp );  /* do the Sethi-Ullman computation */
 
        }
-
index f08b68f..786e9d4 100644 (file)
@@ -1,12 +1,25 @@
-#ifndef lint
+/*#include <ctype.h> gen.h*/
+#include <gen.h>
+#include <stab.h>
+#include <stdio.h>
+/*#include <strings.h> gen.h*/
+/*#include <sys/signal.h> gen.h*/
+/*#include "config.h" manifest.h*/
+/*#include "macdefs.h" manifest.h*/
+/*#include "manifest.h" pass1.h*/
+/*#include "ndu.h" manifest.h*/
+#include "pass1.h"
+/*#include "pcclocal.h" macdefs.h*/
+
+#if defined(DOSCCS) && !defined(lint)
 static char *sccsid ="@(#)scan.c       2.1 (Berkeley) 4/23/86";
-#endif lint
+#endif
 
-# include "pass1.h"
-# include <a.out.h>
-# include <stab.h>
-# include <ctype.h>
-# include <signal.h>
+/*# include "pass1.h"*/
+/*# include <a.out.h>*/
+/*# include <stab.h>*/
+/*# include <ctype.h>*/
+/*# include <signal.h>*/
 
        /* temporarily */
 
@@ -63,16 +76,16 @@ char * lxgcp;
 
 extern int proflg;
 extern int gdebug;
-extern int fpe();
+/*extern int fpe();*/
 struct sigvec fpe_sigvec;
 int oldway;            /* allocate storage so lint will compile as well */
 #ifndef LINT
 extern int lastloc;
 #endif
 
-unsigned caloff();
+/*unsigned caloff();*/
        /* ARGSUSED */
-mainp1( argc, argv ) int argc; char *argv[]; {  /* control multiple files */
+int mainp1(argc, argv) int argc; char *argv[]; {  /* control multiple files */
 
        register i;
        register char *cp;
@@ -197,7 +210,7 @@ mainp1( argc, argv ) int argc; char *argv[]; {  /* control multiple files */
 
 short lxmask[CSSZ+1];
 
-lxenter( s, m ) register char *s; register short m; {
+int lxenter(s, m) register char *s; int m; {
        /* enter a mask into lxmask */
        register c;
 
@@ -205,10 +218,9 @@ lxenter( s, m ) register char *s; register short m; {
 
        }
 
-
 # define lxget(c,m) (lxgcp=yytext,lxmore(c,m))
 
-lxmore( c, m )  register c, m; {
+int lxmore(c, m) register c; register m; {
        register char *cp;
 
        *(cp = lxgcp) = c;
@@ -265,7 +277,7 @@ struct lxdope {
 
 struct lxdope *lxcp[CSSZ+1];
 
-lxinit(){
+int lxinit() {
        register struct lxdope *p;
        register i;
        register char *cp;
@@ -309,7 +321,7 @@ lxinit(){
 
 int lxmatch;  /* character to be matched in char or string constant */
 
-lxstr(ct){
+int lxstr(ct) int ct; {
        /* match a string or character constant, up to lxmatch */
 
        register c;
@@ -427,7 +439,7 @@ lxstr(ct){
                }
        }
 
-lxcom(){
+int lxcom() {
        register c;
        /* saw a /*: process a comment */
 
@@ -452,8 +464,7 @@ lxcom(){
 
 # ifdef LINT
                case 'V':
-                       lxget( c, LEXLET|LEXDIG );
-                       {
+                       lxget( c, LEXLET|LEXDIG ); {
                                extern int vaflag;
                                int i;
                                i = yytext[7]?yytext[7]-'0':0;
@@ -464,8 +475,7 @@ lxcom(){
                                }
                case 'L':
                        lxget( c, LEXLET );
-                       if( strcmp( yytext, "LINTLIBRARY" ) ) continue;
-                       {
+                       if( strcmp( yytext, "LINTLIBRARY" ) ) continue; {
                                extern int libflag;
                                libflag = 1;
                                }
@@ -473,8 +483,7 @@ lxcom(){
 
                case 'A':
                        lxget( c, LEXLET );
-                       if( strcmp( yytext, "ARGSUSED" ) ) continue;
-                       {
+                       if( strcmp( yytext, "ARGSUSED" ) ) continue; {
                                extern int argflag, vflag;
                                argflag = 1;
                                vflag = 0;
@@ -491,7 +500,7 @@ lxcom(){
                }
        }
 
-yylex(){
+int yylex() {
        for(;;){
 
                register lxchar;
@@ -548,8 +557,7 @@ yylex(){
                        case 'X':
                                if( yytext[0] != '0' && !yytext[1] ) uerror( "illegal hex constant" );
                                lxmore( lxchar, LEXHEX );
-                               /* convert the value */
-                               {
+                               /* convert the value */ {
                                        register char *cp;
                                        for( cp = yytext+2; *cp; ++cp ){
                                                /* this code won't work for all wild character sets,
@@ -654,8 +662,7 @@ yylex(){
                        yylval.intval = 0;
                        return( ICON );
 
-               case A_BCD:
-                       {
+               case A_BCD: {
                                register i;
                                int j;
                                for( i=0; i<LXTSZ; ++i ){
@@ -864,7 +871,7 @@ struct lxrdope {
        "",             0,      0,      /* to stop the search */
        };
 
-lxres() {
+int lxres() {
        /* check to see of yytext is reserved; if so,
        /* do the appropriate action and return */
        /* otherwise, return -1 */
@@ -988,7 +995,7 @@ lxres() {
 
 extern int     labelno;
 
-lxtitle(){
+int lxtitle() {
        /* called after a newline; set linenumber and file name */
 
        register c, val;
@@ -1054,10 +1061,7 @@ lxtitle(){
 char   *savetab;
 int    saveleft;
 
-char *
-savestr(cp)
-       register char *cp;
-{
+char *savestr(cp) register char *cp; {
        register int len;
 
        len = strlen(cp) + 1;
@@ -1087,10 +1091,7 @@ struct ht {
        int     ht_used;
 } htab[MAXHASH];
 
-char *
-hash(s)
-       char *s;
-{
+char *hash(s) char *s; {
        register char **h;
        register i;
        register char *cp;
index 312cb22..ca7ae3c 100644 (file)
@@ -1,4 +1,14 @@
-#ifndef lint
+#include <gen.h>
+#include <stab.h>
+#include <stdio.h>
+/*#include "config.h" manifest.h*/
+/*#include "macdefs.h" manifest.h*/
+/*#include "manifest.h" pass1.h*/
+/*#include "ndu.h" manifest.h*/
+#include "pass1.h"
+/*#include "pcclocal.h" macdefs.h*/
+
+#if defined(DOSCCS) && !defined(lint)
 static char *sccsid ="@(#)stab.c       1.12 (Berkeley) 3/27/86";
 #endif
 /*
@@ -8,11 +18,11 @@ static char *sccsid ="@(#)stab.c     1.12 (Berkeley) 3/27/86";
  * symbolic debugging information into the object file.
  */
 
-#include "pass1.h"
+/*#include "pass1.h"*/
 
-#include <sys/types.h>
-#include <a.out.h>
-#include <stab.h>
+/*#include <sys/types.h>*/
+/*#include <a.out.h>*/
+/*#include <stab.h>*/
 
 #define bytes(bits) ((bits) / SZCHAR)
 #define bsize(p) bytes(dimtab[p->sizoff])      /* size in bytes of a symbol */
@@ -27,7 +37,7 @@ typedef int bool;
 
 extern int ddebug;
 extern int gdebug;
-extern char *malloc();
+/*extern char *malloc();*/
 
 int stabLCSYM;
 
@@ -68,9 +78,26 @@ static Typeid typetable[TABLESIZE];
  * since the types are read later.
  */
 
-fixarg(p)
-struct symtab *p;
-{
+static bool zero_length_array __P((register struct symtab *p));
+static Typeid typelookup __P((TWORD type, int arrindex, int strindex, int strtag));
+static int entertype __P((TWORD type, int arrindex, int strindex, int strtag));
+static reentertype __P((Typeid typeid, TWORD type, int arrindex, int strindex, int strtag));
+static inittypes __P((void));
+static maketype __P((char *name, int tnum, int eqtnum, long lower, long upper));
+static gentype __P((struct symtab *sym));
+static genstruct __P((TWORD t, int structid, int index, char *name, int size));
+static geninfo __P((register struct symtab *p));
+static old_fixarg __P((struct symtab *p));
+static old_outstab __P((struct symtab *p));
+static old_pstab __P((char *name, int type));
+static old_pstabdot __P((int type, int value));
+static old_poffs __P((register struct symtab *p));
+static old_psline __P((void));
+static old_plcstab __P((int level));
+static old_prcstab __P((int level));
+static old_pfstab __P((char *sname));
+
+int fixarg(p) struct symtab *p; {
     if (oldway) {
        old_fixarg(p);
     } else if (gdebug) {
@@ -87,9 +114,7 @@ struct symtab *p;
  * such entries.
  */
 
-static bool zero_length_array(p)
-register struct symtab *p;
-{
+static bool zero_length_array(p) register struct symtab *p; {
     bool b;
     int t;
 
@@ -109,9 +134,7 @@ register struct symtab *p;
  * Generate debugging info for a given symbol.
  */
 
-outstab(sym)
-struct symtab *sym;
-{
+int outstab(sym) struct symtab *sym; {
     register struct symtab *p;
     char *classname;
     int offset;
@@ -197,12 +220,7 @@ struct symtab *sym;
  * Look for the given type word in the type table.
  */
 
-static Typeid typelookup(type, arrindex, strindex, strtag)
-TWORD type;
-int arrindex;
-int strindex;
-int strtag;
-{
+static Typeid typelookup(type, arrindex, strindex, strtag) TWORD type; int arrindex; int strindex; int strtag; {
     register TWORD tword;
     register int i1, i2;
     Typeid t;
@@ -236,12 +254,7 @@ int strtag;
  * Enter a type word && associated symtab indices into the type table.
  */
 
-static int entertype(type, arrindex, strindex, strtag)
-TWORD type;
-int arrindex;
-int strindex;
-int strtag;
-{
+static int entertype(type, arrindex, strindex, strtag) TWORD type; int arrindex; int strindex; int strtag; {
     register Typeid t;
     register int i;
 
@@ -264,13 +277,7 @@ int strtag;
  * as the old one.
  */
 
-static reentertype(typeid, type, arrindex, strindex, strtag)
-Typeid typeid;
-TWORD type;
-int arrindex;
-int strindex;
-int strtag;
-{
+static reentertype(typeid, type, arrindex, strindex, strtag) Typeid typeid; TWORD type; int arrindex; int strindex; int strtag; {
     register Typeid t;
     register int i;
 
@@ -291,8 +298,7 @@ int strtag;
 
 #define builtintype(type) entertype(type, NILINDEX, NILINDEX, NILINDEX)
 
-static inittypes()
-{
+static inittypes() {
     int t;
 
     t_int = builtintype(INT);
@@ -319,11 +325,7 @@ static inittypes()
  * Generate info for a new range type.
  */
 
-static maketype(name, tnum, eqtnum, lower, upper)
-char *name;
-int tnum, eqtnum;
-long lower, upper;
-{
+static maketype(name, tnum, eqtnum, lower, upper) char *name; int tnum; int eqtnum; long lower; long upper; {
     printf("\t.stabs\t\"%s:t%d=r%d;%d;%d;", name, tnum, eqtnum, lower, upper);
     geninfo(0);
 }
@@ -332,9 +334,7 @@ long lower, upper;
  * Generate debugging information for the given type of the given symbol.
  */
 
-static gentype(sym)
-struct symtab *sym;
-{
+static gentype(sym) struct symtab *sym; {
     register struct symtab *p;
     register TWORD t;
     register TWORD basictype;
@@ -410,13 +410,7 @@ struct symtab *sym;
  * Generate type information for structures, unions, && enumerations.
  */
 
-static genstruct(t, structid, index, name, size)
-TWORD t;
-int structid;
-int index;
-char *name;
-int size;
-{
+static genstruct(t, structid, index, name, size) TWORD t; int structid; int index; char *name; int size; {
     register int i;
     register struct symtab *field;
     int id;
@@ -467,9 +461,7 @@ int size;
  * Generate offset && size info.
  */
 
-static geninfo(p)
-register struct symtab *p;
-{
+static geninfo(p) register struct symtab *p; {
     int stabtype;
 
     if (p == 0) {
@@ -515,9 +507,7 @@ register struct symtab *p;
  * Generate information for a newly-defined structure.
  */
 
-outstruct(szindex, paramindex)
-int szindex, paramindex;
-{
+int outstruct(szindex, paramindex) int szindex; int paramindex; {
     register Typeid typeid;
     register struct symtab *p;
     register int i, t, strindex;
@@ -543,10 +533,7 @@ int szindex, paramindex;
     }
 }
 
-pstab(name, type)
-char *name;
-int type;
-{
+int pstab(name, type) char *name; int type; {
     register int i;
     register char c;
 
@@ -576,10 +563,7 @@ int type;
 }
 
 #ifdef STABDOT
-pstabdot(type, value)
-int type;
-int value;
-{
+int pstabdot(type, value) int type; int value; {
     if ( ! gdebug) {
        return;
     } else if (oldway) {
@@ -596,8 +580,7 @@ extern char NULLNAME[8];
 extern int  labelno;
 extern int  fdefflag;
 
-psline()
-{
+int psline() {
     static int lastlineno;
     register char *cp, *cq;
     register int i;
@@ -649,9 +632,7 @@ eq: if (lineno == lastlineno) return;
     }
 }
     
-plcstab(level)
-int level;
-{
+int plcstab(level) int level; {
     if (!gdebug) {
        return;
     } else if (oldway) {
@@ -667,9 +648,7 @@ int level;
 #endif
 }
     
-prcstab(level)
-int level;
-{
+int prcstab(level) int level; {
     if (!gdebug) {
        return;
     } else if (oldway) {
@@ -685,9 +664,7 @@ int level;
 #endif
 }
     
-pfstab(sname) 
-char *sname;
-{
+int pfstab(sname) char *sname; {
     register struct symtab *p;
 
     if (gdebug) {
@@ -707,8 +684,7 @@ char *sname;
  * Old way of doing things.
  */
 
-static old_fixarg(p)
-struct symtab *p; {
+static old_fixarg(p) struct symtab *p; {
        if (gdebug) {
                old_pstab(p->sname, N_PSYM);
                if (gdebug) printf("0,%d,%d\n", p->stype, argoff/SZCHAR);
@@ -716,8 +692,7 @@ struct symtab *p; {
        }
 }
 
-static old_outstab(p)
-struct symtab *p; {
+static old_outstab(p) struct symtab *p; {
        register TWORD ptype;
        register char *pname;
        register char pclass;
@@ -791,9 +766,7 @@ struct symtab *p; {
        }
 }
 
-static old_pstab(name, type)
-char *name;
-int type; {
+static old_pstab(name, type) char *name; int type; {
        register int i;
        register char c;
        if (!gdebug) return;
@@ -817,10 +790,7 @@ int type; {
 }
 
 #ifdef STABDOT
-static old_pstabdot(type, value)
-       int     type;
-       int     value;
-{
+static old_pstabdot(type, value) int type; int value; {
        if ( ! gdebug) return;
        /* locctr(PROG);  /* .stabs must appear in .text for c2 */
        printf("\t.stabd\t");
@@ -828,8 +798,7 @@ static old_pstabdot(type, value)
 }
 #endif
 
-static old_poffs(p)
-register struct symtab *p; {
+static old_poffs(p) register struct symtab *p; {
        int s;
        if (!gdebug) return;
        if ((s = dimtab[p->sizoff]/SZCHAR) > 1) {
@@ -885,7 +854,7 @@ eq: if (lineno == lastlineno) return;
                }
        }
        
-static old_plcstab(level) {
+static old_plcstab(level) int level; {
        if (!gdebug) return;
 #ifdef STABDOT
        old_pstabdot(N_LBRAC, level);
@@ -896,7 +865,7 @@ static old_plcstab(level) {
 #endif
        }
        
-static old_prcstab(level) {
+static old_prcstab(level) int level; {
        if (!gdebug) return;
 #ifdef STABDOT
        pstabdot(N_RBRAC, level);
@@ -907,8 +876,7 @@ static old_prcstab(level) {
 #endif
        }
        
-static old_pfstab(sname) 
-char *sname; {
+static old_pfstab(sname) char *sname; {
        if (!gdebug) return;
        pstab(sname, N_FUN);
 #ifndef FLEXNAMES
index 7f048f3..23f5060 100644 (file)
@@ -1,8 +1,13 @@
-#ifndef lint
+/*#include "manifest.h" pass2.h*/
+/*#include "ndu.h" manifest.h*/
+#include "pass2.h"
+/*#include "pcclocal.h" manifest.h*/
+
+#if defined(DOSCCS) && !defined(lint)
 static char *sccsid ="@(#)table.c      1.13 (Berkeley) 1/8/86";
-#endif lint
+#endif
 
-# include "pass2.h"
+/*# include "pass2.h"*/
 
 # define WPTR TPTRTO|TINT|TLONG|TFLOAT|TDOUBLE|TPOINT|TUNSIGNED|TULONG
 # define AWD SNAME|SOREG|SCON|STARNM|STARREG
@@ -76,7 +81,6 @@ SCONV,        INTAREG|FORCC,
                NAREG|NASL,     RESC1|RESCC,
                "       ZA\n",
 
-
 INIT,  FOREFF,
        SCON,   TANY,
        SANY,   TWORD,
@@ -831,7 +835,6 @@ INIT, DF(INIT),
 
 OPUNARY, DF(UNARY MINUS),
 
-
 ASG OPANY, DF(ASG PLUS),
 
 OPANY, DF(BITYPE),
index 122ec3f..0c561d0 100644 (file)
@@ -1,15 +1,24 @@
-#ifndef lint
+#include <setjmp.h>
+#include <stdio.h>
+/*#include "config.h" manifest.h*/
+/*#include "macdefs.h" manifest.h*/
+/*#include "manifest.h" pass1.h*/
+/*#include "ndu.h" manifest.h*/
+#include "pass1.h"
+/*#include "pcclocal.h" macdefs.h*/
+
+#if defined(DOSCCS) && !defined(lint)
 static char *sccsid ="@(#)trees.c      4.10 (Berkeley) 1/8/86";
 #endif
 
-# include "pass1.h"
+/*# include "pass1.h"*/
 
-# include <setjmp.h>
+/*# include <setjmp.h>*/
 
 int bdebug = 0;
 int adebug = 0;
 extern ddebug;
-extern eprint();
+/*extern eprint();*/
 
            /* corrections when in violation of lint */
 
@@ -28,10 +37,7 @@ extern eprint();
 # define NCVTR 010000
 
 #ifndef BUG1
-printact(t, acts)
-       NODE *t;
-       int acts;
-{
+int printact(t, acts) NODE *t; int acts; {
        static struct actions {
                int     a_bit;
                char    *a_name;
@@ -80,8 +86,7 @@ printact(t, acts)
 
        */
 
-NODE *
-buildtree( o, l, r ) register NODE *l, *r; {
+NODE *buildtree(o, l, r) int o; register NODE *l; register NODE *r; {
        register NODE *p, *q;
        register actions;
        register opty;
@@ -461,8 +466,7 @@ buildtree( o, l, r ) register NODE *l, *r; {
                                 * local code must unwind it
                                 * back to PLUS/MINUS REG ICON
                                 * according to local conventions
-                                */
-                               {
+                                */ {
                                extern NODE * addroreg();
                                p->in.op = FREE;
                                p = addroreg( l );
@@ -491,8 +495,7 @@ buildtree( o, l, r ) register NODE *l, *r; {
                        /* take the addresses of the two sides; then make an
                        /* operator using STASG and
                        /* the addresses of left and right */
-
-                       {
+ {
                                register TWORD t;
                                register d, s;
 
@@ -567,7 +570,7 @@ buildtree( o, l, r ) register NODE *l, *r; {
 int fpe_count = -1;
 jmp_buf gotfpe;
 
-fpe() {
+int fpe() {
        if (fpe_count < 0)
                cerror("floating point exception");
        ++fpe_count;
@@ -580,8 +583,7 @@ fpe() {
  * precision floating point constants are
  * cast to double (to eliminate convert code).
  */
-NODE *
-fixargs( p ) register NODE *p;  {
+NODE *fixargs(p) register NODE *p; {
        int o = p->in.op;
 
        if( o == CM ){
@@ -600,7 +602,7 @@ fixargs( p ) register NODE *p;  {
        return( p );
        }
 
-chkstr( i, j, type ) TWORD type; {
+int chkstr(i, j, type) int i; int j; TWORD type; {
        /* is the MOS or MOU at stab[i] OK for strict reference by a ptr */
        /* i has been checked to contain a MOS or MOU */
        /* j is the index in dimtab of the members... */
@@ -645,7 +647,7 @@ chkstr( i, j, type ) TWORD type; {
        return( 0 );
        }
 
-conval( p, o, q ) register NODE *p, *q; {
+int conval(p, o, q) register NODE *p; int o; register NODE *q; {
        /* apply the op o to the lval part of p; if binary, rhs is val */
        int i, u;
        CONSZ val;
@@ -747,7 +749,7 @@ conval( p, o, q ) register NODE *p, *q; {
        return(1);
        }
 
-chkpun(p) register NODE *p; {
+int chkpun(p) register NODE *p; {
 
        /* checks p for the existance of a pun */
 
@@ -814,8 +816,7 @@ chkpun(p) register NODE *p; {
 
        }
 
-NODE *
-stref( p ) register NODE *p; {
+NODE *stref(p) register NODE *p; {
 
        TWORD t;
        int d, s, dsc, align;
@@ -866,7 +867,7 @@ stref( p ) register NODE *p; {
        return( clocal(p) );
        }
 
-notlval(p) register NODE *p; {
+int notlval(p) register NODE *p; {
 
        /* return 0 if p an lvalue, 1 otherwise */
 
@@ -897,8 +898,7 @@ notlval(p) register NODE *p; {
 
        }
 
-NODE *
-bcon( i ){ /* make a constant node with value i */
+NODE *bcon(i) int i; { /* make a constant node with value i */
        register NODE *p;
 
        p = block( ICON, NIL, NIL, INT, 0, INT );
@@ -907,13 +907,11 @@ bcon( i ){ /* make a constant node with value i */
        return( clocal(p) );
        }
 
-NODE *
-bpsize(p) register NODE *p; {
+NODE *bpsize(p) register NODE *p; {
        return( offcon( psize(p), p->in.type, p->fn.cdim, p->fn.csiz ) );
        }
 
-OFFSZ
-psize( p ) NODE *p; {
+OFFSZ psize(p) NODE *p; {
        /* p is a node of type pointer; psize returns the
           size of the thing pointed to */
 
@@ -925,8 +923,7 @@ psize( p ) NODE *p; {
        return( tsize( DECREF(p->in.type), p->fn.cdim, p->fn.csiz ) );
        }
 
-NODE *
-convert( p, f )  register NODE *p; {
+NODE *convert(p, f) register NODE *p; int f; {
        /*  convert an operand of p
            f is either CVTL or CVTR
            operand has type int, and is converted by the size of the other side
@@ -948,7 +945,7 @@ convert( p, f )  register NODE *p; {
        }
 
 #ifndef econvert
-econvert( p ) register NODE *p; {
+int econvert(p) register NODE *p; {
 
        /* change enums to ints, or appropriate types */
 
@@ -967,8 +964,7 @@ econvert( p ) register NODE *p; {
        }
 #endif
 
-NODE *
-pconvert( p ) register NODE *p; {
+NODE *pconvert(p) register NODE *p; {
 
        /* if p should be changed into a pointer, do so */
 
@@ -983,8 +979,7 @@ pconvert( p ) register NODE *p; {
        return( p );
        }
 
-NODE *
-oconvert(p) register NODE *p; {
+NODE *oconvert(p) register NODE *p; {
        /* convert the result itself: used for pointer and unsigned */
 
        switch(p->in.op) {
@@ -1008,8 +1003,7 @@ oconvert(p) register NODE *p; {
        return(p);
        }
 
-NODE *
-ptmatch(p)  register NODE *p; {
+NODE *ptmatch(p) register NODE *p; {
 
        /* makes the operands of p agree; they are
           either pointers or integers, by this time */
@@ -1078,8 +1072,7 @@ ptmatch(p)  register NODE *p; {
 
 int tdebug = 0;
 
-NODE *
-tymatch(p)  register NODE *p; {
+NODE *tymatch(p) register NODE *p; {
 
        /* satisfy the types of various arithmetic binary ops */
 
@@ -1163,8 +1156,7 @@ tymatch(p)  register NODE *p; {
        return(p);
        }
 
-NODE *
-makety( p, t, d, s ) register NODE *p; TWORD t; {
+NODE *makety(p, t, d, s) register NODE *p; TWORD t; int d; int s; {
        /* make p into type t by inserting a conversion */
 
        if( p->in.type == ENUMTY && p->in.op == ICON ) econvert(p);
@@ -1228,8 +1220,7 @@ makety( p, t, d, s ) register NODE *p; TWORD t; {
 
        }
 
-NODE *
-block( o, l, r, t, d, s ) register NODE *l, *r; TWORD t; {
+NODE *block(o, l, r, t, d, s) int o; register NODE *l; register NODE *r; TWORD t; int d; int s; {
 
        register NODE *p;
 
@@ -1243,7 +1234,7 @@ block( o, l, r, t, d, s ) register NODE *l, *r; TWORD t; {
        return(p);
        }
 
-icons(p) register NODE *p; {
+int icons(p) register NODE *p; {
        /* if p is an integer constant, return its value */
        int val;
 
@@ -1294,7 +1285,7 @@ icons(p) register NODE *p; {
 # define MENU 040 /* enumeration variable or member */
 # define MVOID 0100000 /* void type */
 
-opact( p )  NODE *p; {
+int opact(p) NODE *p; {
 
        register mt12, mt1, mt2, o;
 
@@ -1461,7 +1452,7 @@ opact( p )  NODE *p; {
        return( NCVT );
        }
 
-moditype( ty ) TWORD ty; {
+int moditype(ty) TWORD ty; {
 
        switch( ty ){
 
@@ -1496,8 +1487,7 @@ moditype( ty ) TWORD ty; {
                }
        }
 
-NODE *
-doszof( p )  register NODE *p; {
+NODE *doszof(p) register NODE *p; {
        /* do sizeof p */
        int i;
 
@@ -1510,7 +1500,7 @@ doszof( p )  register NODE *p; {
        }
 
 # ifndef BUG2
-eprint( p, down, a, b ) register NODE *p; int *a, *b; {
+int eprint(p, down, a, b) register NODE *p; int down; int *a; int *b; {
        register ty;
 
        *a = *b = down+1;
@@ -1532,7 +1522,7 @@ eprint( p, down, a, b ) register NODE *p; int *a, *b; {
        }
 # endif
 
-prtdcon( p ) register NODE *p; {
+int prtdcon(p) register NODE *p; {
        int o = p->in.op, i;
 
        if( o == DCON || o == FCON ){
@@ -1550,9 +1540,8 @@ prtdcon( p ) register NODE *p; {
                }
        }
 
-
 int edebug = 0;
-ecomp( p ) register NODE *p; {
+int ecomp(p) register NODE *p; {
 # ifndef BUG2
        if( edebug ) fwalk( p, eprint, 0 );
 # endif
@@ -1570,7 +1559,7 @@ ecomp( p ) register NODE *p; {
 # ifdef STDPRTREE
 # ifndef ONEPASS
 
-prtree(p) register NODE *p; {
+int prtree(p) register NODE *p; {
 
        register struct symtab *q;
        register ty;
@@ -1634,7 +1623,7 @@ prtree(p) register NODE *p; {
 
 # else
 
-p2tree(p) register NODE *p; {
+int p2tree(p) register NODE *p; {
        register ty;
 
 # ifdef MYP2TREE
index 2f1047f..28fe52a 100644 (file)
@@ -1,8 +1,15 @@
-#ifndef lint
+#include <stdio.h>
+/*#include "config.h" manifest.h*/
+/*#include "macdefs.h" manifest.h*/
+/*#include "manifest.h" pass1.h*/
+/*#include "ndu.h" manifest.h*/
+#include "pass1.h"
+
+#if defined(DOSCCS) && !defined(lint)
 static char *sccsid ="@(#)xdefs.c      4.3 (Berkeley) 3/19/85";
-#endif lint
+#endif
 
-# include "pass1.h"
+/*# include "pass1.h"*/
 
 /*     communication between lexical routines  */
 
@@ -14,7 +21,6 @@ CONSZ lastcon;  /* the last constant read by the lexical analyzer */
 float fcon;   /* the last float read by the lexical analyzer */
 double dcon;   /* the last double read by the lexical analyzer */
 
-
 /*     symbol table maintainence */
 
 struct symtab stab[SYMTSZ+1];  /* one extra slot for scratch */
@@ -53,7 +59,6 @@ int reached;  /* true if statement can be reached... */
 
 int idname;    /* tunnel to buildtree for name id's */
 
-
 NODE node[TREESZ];
 
 int cflag = 0;  /* do we check for funny casts */
@@ -95,7 +100,7 @@ ccnames[] = { /* names of storage classes */
        "USTATIC",
        };
 
-char * scnames( c ) register c; {
+char *scnames(c) register c; {
        /* return the name for storage class c */
        static char buf[12];
        if( c&FIELD ){