use cgenflg consistently; take out )#'s on pi code.
authorPeter B. Kessler <peter@ucbvax.Berkeley.EDU>
Sat, 21 Mar 1981 06:27:08 +0000 (22:27 -0800)
committerPeter B. Kessler <peter@ucbvax.Berkeley.EDU>
Sat, 21 Mar 1981 06:27:08 +0000 (22:27 -0800)
SCCS-vsn: usr.bin/pascal/src/0.h 1.9
SCCS-vsn: usr.bin/pascal/src/cset.c 1.6
SCCS-vsn: usr.bin/pascal/src/p2put.c 1.6
SCCS-vsn: usr.bin/pascal/src/put.c 1.13

usr/src/usr.bin/pascal/src/0.h
usr/src/usr.bin/pascal/src/cset.c
usr/src/usr.bin/pascal/src/p2put.c
usr/src/usr.bin/pascal/src/put.c

index c0fc6eb..76b0fd0 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (c) 1979 Regents of the University of California */
 
 /* Copyright (c) 1979 Regents of the University of California */
 
-/* static char sccsid[] = "@(#)0.h 1.8 %G%"; */
+/* static char sccsid[] = "@(#)0.h 1.9 %G%"; */
 
 #define DEBUG
 #define CONSETS
 
 #define DEBUG
 #define CONSETS
@@ -431,6 +431,8 @@ char        **clnames;
 /*
  * NOCON and SAWCON are flags in the tree telling whether
  * a constant set is part of an expression.
 /*
  * NOCON and SAWCON are flags in the tree telling whether
  * a constant set is part of an expression.
+ *     these are no longer used,
+ *     since we now do constant sets at compile time.
  */
 #define NOCON  0
 #define SAWCON 1
  */
 #define NOCON  0
 #define SAWCON 1
@@ -673,6 +675,7 @@ struct      udinfo {
 
 #define        codeon()        cgenflg++
 #define        codeoff()       --cgenflg
 
 #define        codeon()        cgenflg++
 #define        codeoff()       --cgenflg
+#define        CGENNING        ( cgenflg >= 0 )
 
 /*
  * Codeline is the last lino output in the code generator.
 
 /*
  * Codeline is the last lino output in the code generator.
index 4a75291..cd6142b 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (c) 1979 Regents of the University of California */
 
 /* Copyright (c) 1979 Regents of the University of California */
 
-static char sccsid[] = "@(#)cset.c 1.5 %G%";
+static char sccsid[] = "@(#)cset.c 1.6 %G%";
 
 #include "whoami.h"
 #include "0.h"
 
 #include "whoami.h"
 #include "0.h"
@@ -395,7 +395,7 @@ postcset( r , csetp )
                    cp[temp >> LG2BITSBYTE] |= (1 << (temp & MSKBITSBYTE));
                }
            }
                    cp[temp >> LG2BITSBYTE] |= (1 << (temp & MSKBITSBYTE));
                }
            }
-           if ( cgenflg )
+           if ( !CGENNING )
                return;
 #          ifdef PC
                putprintf( "    .data" , 0 );
                return;
 #          ifdef PC
                putprintf( "    .data" , 0 );
index 2ed5b61..bd8c350 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (c) 1979 Regents of the University of California */
 
 /* Copyright (c) 1979 Regents of the University of California */
 
-static char sccsid[] = "@(#)p2put.c 1.5 %G%";
+static char sccsid[] = "@(#)p2put.c 1.6 %G%";
 
     /*
      * functions to help pi put out
 
     /*
      * functions to help pi put out
@@ -30,7 +30,7 @@ puttext( string )
     {
        int     length = str4len( string );
 
     {
        int     length = str4len( string );
 
-       if ( cgenflg )
+       if ( !CGENNING )
            return;
        p2word( TOF77( P2FTEXT , length , 0 ) );
 #      ifdef DEBUG
            return;
        p2word( TOF77( P2FTEXT , length , 0 ) );
 #      ifdef DEBUG
@@ -63,7 +63,7 @@ putprintf( format , incomplete , arg1 , arg2 , arg3 , arg4 , arg5 )
        static char     ppbuffer[ BUFSIZ ];
        static char     *ppbufp = ppbuffer;
 
        static char     ppbuffer[ BUFSIZ ];
        static char     *ppbufp = ppbuffer;
 
-       if ( cgenflg )
+       if ( !CGENNING )
            return;
        sprintf( ppbufp , format , arg1 , arg2 , arg3 , arg4 , arg5 );
        ppbufp = &( ppbuffer[ strlen( ppbuffer ) ] );
            return;
        sprintf( ppbufp , format , arg1 , arg2 , arg3 , arg4 , arg5 );
        ppbufp = &( ppbuffer[ strlen( ppbuffer ) ] );
@@ -163,7 +163,7 @@ putleaf( op , lval , rval , type , name )
     int                type;
     char       *name;
     {
     int                type;
     char       *name;
     {
-       if ( cgenflg )
+       if ( !CGENNING )
            return;
        switch ( op ) {
            default:
            return;
        switch ( op ) {
            default:
@@ -220,7 +220,7 @@ putRV( name , level , offset , type )
        char    extname[ BUFSIZ ];
        char    *printname;
 
        char    extname[ BUFSIZ ];
        char    *printname;
 
-       if ( cgenflg )
+       if ( !CGENNING )
            return;
        if (level == cbn && whereis(offset) == REGVAR) {
            putleaf( P2REG , 0 , (-offset) >> 1 , type , 0 );
            return;
        if (level == cbn && whereis(offset) == REGVAR) {
            putleaf( P2REG , 0 , (-offset) >> 1 , type , 0 );
@@ -258,7 +258,7 @@ putLV( name , level , offset , type )
     char               extname[ BUFSIZ ];
     char               *printname;
 
     char               extname[ BUFSIZ ];
     char               *printname;
 
-    if ( cgenflg )
+    if ( !CGENNING )
        return;
     if ( ( level <= 1 ) && ( name != 0 ) ) {
        if ( name[0] != '_' ) {
        return;
     if ( ( level <= 1 ) && ( name != 0 ) ) {
        if ( name[0] != '_' ) {
@@ -309,7 +309,7 @@ putCON8( value )
        int     label;
        char    name[ BUFSIZ ];
 
        int     label;
        char    name[ BUFSIZ ];
 
-       if ( cgenflg )
+       if ( !CGENNING )
            return;
        putprintf( "    .data" , 0 );
        putprintf( "    .align 2" , 0 );
            return;
        putprintf( "    .data" , 0 );
        putprintf( "    .align 2" , 0 );
@@ -337,7 +337,7 @@ putCONG( string , length , required )
        int     pad;
        int     others;
 
        int     pad;
        int     others;
 
-       if ( cgenflg )
+       if ( !CGENNING )
            return;
        putprintf( "    .data" , 0 );
        label = getlab();
            return;
        putprintf( "    .data" , 0 );
        label = getlab();
@@ -494,7 +494,7 @@ putop( op , type )
     {
        extern char     *p2opnames[];
        
     {
        extern char     *p2opnames[];
        
-       if ( cgenflg )
+       if ( !CGENNING )
            return;
        p2word( TOF77( op , 0 , type ) );
 #      ifdef DEBUG
            return;
        p2word( TOF77( op , 0 , type ) );
 #      ifdef DEBUG
@@ -518,7 +518,7 @@ putstrop( op , type , size , alignment )
     {
        extern char     *p2opnames[];
        
     {
        extern char     *p2opnames[];
        
-       if ( cgenflg )
+       if ( !CGENNING )
            return;
        p2word( TOF77( op , 0 , type ) );
        p2word( size );
            return;
        p2word( TOF77( op , 0 , type ) );
        p2word( size );
index c2f16d7..5836e54 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (c) 1979 Regents of the University of California */
 
 /* Copyright (c) 1979 Regents of the University of California */
 
-static char sccsid[] = "@(#)put.c 1.12 %G%";
+static char sccsid[] = "@(#)put.c 1.13 %G%";
 
 #include "whoami.h"
 #include "opcode.h"
 
 #include "whoami.h"
 #include "opcode.h"
@@ -45,7 +45,7 @@ put(a)
         * etc.
         */
        oldlc = lc;
         * etc.
         */
        oldlc = lc;
-       if (cgenflg < 0)
+       if ( !CGENNING )
                /*
                 * code disabled - do nothing
                 */
                /*
                 * code disabled - do nothing
                 */
@@ -148,7 +148,7 @@ put(a)
 
 #ifdef DEBUG
                        if ( opt( 'k' ) )
 
 #ifdef DEBUG
                        if ( opt( 'k' ) )
-                           printf ( ")#%5d\tCON8\t%22.14e\n" ,
+                           printf ( "%5d\tCON8\t%22.14e\n" ,
                                        lc - HEADER_BYTES ,
                                        * ( ( double * ) &p[1] ) );
 #endif
                                        lc - HEADER_BYTES ,
                                        * ( ( double * ) &p[1] ) );
 #endif
@@ -225,7 +225,7 @@ around:
                case O_CASE1:
 #ifdef DEBUG
                        if (opt('k'))
                case O_CASE1:
 #ifdef DEBUG
                        if (opt('k'))
-                               printf(")#%5d\tCASE1\t%d\n"
+                               printf("%5d\tCASE1\t%d\n"
                                        , lc - HEADER_BYTES, p[1]);
 #endif
                        /*
                                        , lc - HEADER_BYTES, p[1]);
 #endif
                        /*
@@ -252,7 +252,7 @@ around:
                case O_CASE2:
 #ifdef DEBUG
                        if (opt('k'))
                case O_CASE2:
 #ifdef DEBUG
                        if (opt('k'))
-                               printf(")#%5d\tCASE2\t%d\n"
+                               printf("%5d\tCASE2\t%d\n"
                                        , lc - HEADER_BYTES , p[1]);
 #endif
                        word(p[1]);
                                        , lc - HEADER_BYTES , p[1]);
 #endif
                        word(p[1]);
@@ -334,7 +334,7 @@ around:
                                n--;
 #ifdef DEBUG
                        if (opt('k')) {
                                n--;
 #ifdef DEBUG
                        if (opt('k')) {
-                               printf(")#%5d\t%s", lc - HEADER_BYTES, cp+1);
+                               printf("%5d\t%s", lc - HEADER_BYTES, cp+1);
                                if (suboppr)
                                        printf(":%d", suboppr);
                                for ( i = 2, lp = (long *)&p[1]; i < n 
                                if (suboppr)
                                        printf(":%d", suboppr);
                                for ( i = 2, lp = (long *)&p[1]; i < n 
@@ -357,7 +357,7 @@ around:
        }
 #ifdef DEBUG
        if (opt('k')) {
        }
 #ifdef DEBUG
        if (opt('k')) {
-               printf(")#%5d\t%s", lc - HEADER_BYTES, cp+1);
+               printf("%5d\t%s", lc - HEADER_BYTES, cp+1);
                if (suboppr)
                        printf(":%d", suboppr);
                if (string)
                if (suboppr)
                        printf(":%d", suboppr);
                if (string)
@@ -396,7 +396,7 @@ listnames(ap)
        register unsigned w;
        register char *strptr;
 
        register unsigned w;
        register char *strptr;
 
-       if (cgenflg < 0)
+       if ( !CGENNING )
                /* code is off - do nothing */
                return(NIL);
        if (ap->class != TYPE)
                /* code is off - do nothing */
                return(NIL);
        if (ap->class != TYPE)
@@ -496,8 +496,8 @@ getnext(next, new)
        if (next == NIL)
                return("");
 #ifdef OBJ
        if (next == NIL)
                return("");
 #ifdef OBJ
-       if (opt('k') && cgenflg >= 0)
-               printf(")#%5d\t\t\"%s\"\n", lc-HEADER_BYTES, next->symbol);
+       if (opt('k') && CGENNING )
+               printf("%5d\t\t\"%s\"\n", lc-HEADER_BYTES, next->symbol);
 #endif OBJ
        return(next->symbol);
 }
 #endif OBJ
        return(next->symbol);
 }
@@ -513,14 +513,14 @@ putspace(n)
 {
        register i;
 
 {
        register i;
 
-       if (cgenflg < 0)
+       if ( !CGENNING )
                /*
                 * code disabled - do nothing
                 */
                return(lc);
 #ifdef DEBUG
        if (opt('k'))
                /*
                 * code disabled - do nothing
                 */
                return(lc);
 #ifdef DEBUG
        if (opt('k'))
-               printf(")#%5d\t.=.+%d\n", lc - HEADER_BYTES, n);
+               printf("%5d\t.=.+%d\n", lc - HEADER_BYTES, n);
 #endif
        for (i = even(n); i > 0; i -= 2)
                word(0);
 #endif
        for (i = even(n); i > 0; i -= 2)
                word(0);
@@ -535,14 +535,14 @@ putstr(sptr, padding)
        register char *strptr = sptr;
        register int pad = padding;
 
        register char *strptr = sptr;
        register int pad = padding;
 
-       if (cgenflg < 0)
+       if ( !CGENNING )
                /*
                 * code disabled - do nothing
                 */
                return(lc);
 #ifdef DEBUG
        if (opt('k'))
                /*
                 * code disabled - do nothing
                 */
                return(lc);
 #ifdef DEBUG
        if (opt('k'))
-               printf(")#%5d\t\t\"%s\"\n", lc-HEADER_BYTES, strptr);
+               printf("%5d\t\t\"%s\"\n", lc-HEADER_BYTES, strptr);
 #endif
        if (pad == 0) {
                do      {
 #endif
        if (pad == 0) {
                do      {
@@ -656,13 +656,13 @@ patchfil(loc, value, words)
        register i;
        int val;
 
        register i;
        int val;
 
-       if (cgenflg < 0)
+       if ( !CGENNING )
                return;
        if (loc > (unsigned) lc)
                panic("patchfil");
 #ifdef DEBUG
        if (opt('k'))
                return;
        if (loc > (unsigned) lc)
                panic("patchfil");
 #ifdef DEBUG
        if (opt('k'))
-               printf(")#\tpatch %u %D\n", loc - HEADER_BYTES, value);
+               printf("\tpatch %u %D\n", loc - HEADER_BYTES, value);
 #endif
        val = value;
        do {
 #endif
        val = value;
        do {