N_PC stabs with subtypes
authorPeter B. Kessler <peter@ucbvax.Berkeley.EDU>
Fri, 5 Sep 1980 14:12:28 +0000 (06:12 -0800)
committerPeter B. Kessler <peter@ucbvax.Berkeley.EDU>
Fri, 5 Sep 1980 14:12:28 +0000 (06:12 -0800)
SCCS-vsn: usr.bin/pascal/src/const.c 1.4
SCCS-vsn: usr.bin/pascal/src/lab.c 1.4
SCCS-vsn: usr.bin/pascal/src/stab.c 1.3
SCCS-vsn: usr.bin/pascal/src/type.c 1.4
SCCS-vsn: usr.bin/pascal/pc3/pc3.h 1.3
SCCS-vsn: usr.bin/pascal/pc3/pc3.c 1.5

usr/src/usr.bin/pascal/pc3/pc3.c
usr/src/usr.bin/pascal/pc3/pc3.h
usr/src/usr.bin/pascal/src/const.c
usr/src/usr.bin/pascal/src/lab.c
usr/src/usr.bin/pascal/src/stab.c
usr/src/usr.bin/pascal/src/type.c

index 228fe87..2992939 100644 (file)
@@ -1,6 +1,6 @@
     /* Copyright (c) 1980 Regents of the University of California */
 
     /* Copyright (c) 1980 Regents of the University of California */
 
-static char sccsid[] = "@(#)pc3.c 1.4 %G%";
+static char sccsid[] = "@(#)pc3.c 1.5 %G%";
 
     /*
      *      Pc3 is a pass in the Berkeley Pascal compilation
 
     /*
      *      Pc3 is a pass in the Berkeley Pascal compilation
@@ -28,7 +28,7 @@ static        char sccsid[] = "@(#)pc3.c 1.4 %G%";
      * is:
      * 
      *    - the name of the symbol;
      * is:
      * 
      *    - the name of the symbol;
-     *    - a type specifier;
+     *    - a subtype descriptor;
      *    - for file symbols, their last modify time;
      *    - the file which logically contains the declaration of
      *      the symbol (not an include file);
      *    - for file symbols, their last modify time;
      *    - the file which logically contains the declaration of
      *      the symbol (not an include file);
@@ -71,7 +71,7 @@ char  program[] = "pc";
 #include <stab.h>
 #include <pagsiz.h>
 #include <stat.h>
 #include <stab.h>
 #include <pagsiz.h>
 #include <stat.h>
-#include "/usr/src/new/pc0/p.a.out.h"
+#include "/usr/src/new/pc0/pstab.h"
 #include "pc3.h"
 
 int    errors = 0;
 #include "pc3.h"
 
 int    errors = 0;
@@ -253,48 +253,36 @@ checksymbol( nlp , ofilep )
                fprintf( stderr , "[checksymbol] pfile %s ifile %s\n"
                        , pfilep -> name , ifilep -> name );
            }
                fprintf( stderr , "[checksymbol] pfile %s ifile %s\n"
                        , pfilep -> name , ifilep -> name );
            }
-           fprintf( stderr , "[checksymbol] ->name %s ->n_type %x (%s)\n"
-                   , nlp -> n_un.n_name , nlp -> n_type
-                   , classify( nlp -> n_type ) );
+           fprintf( stderr , "[checksymbol] ->name %s ->n_desc %x (%s)\n"
+                   , nlp -> n_un.n_name , nlp -> n_desc
+                   , classify( nlp -> n_desc ) );
 #      endif DEBUG
 #      endif DEBUG
-       switch ( nlp -> n_type ) {
-           case N_PGLAB:
-           case N_PGCON:
-           case N_PGTYP:
-           case N_PGVAR:
-           case N_PGFUN:
-           case N_PGPRC:
-           case N_PEFUN:
-           case N_PEPRC:
-           case N_PSO:
-           case N_PSOL:
-                   symbolp = entersymbol( nlp -> n_un.n_name );
-                   break;
-           default:
-                       /* don't care about the others */
-                   return;
+       if ( nlp -> n_type != N_PC ) {
+               /* don't care about the others */
+           return;
        }
        }
+       symbolp = entersymbol( nlp -> n_un.n_name );
        if ( symbolp -> lookup == NEW ) {
 #          ifdef DEBUG
                fprintf( stderr , "[checksymbol] ->name %s is NEW\n"
                        , symbolp -> name );
 #          endif DEBUG
        if ( symbolp -> lookup == NEW ) {
 #          ifdef DEBUG
                fprintf( stderr , "[checksymbol] ->name %s is NEW\n"
                        , symbolp -> name );
 #          endif DEBUG
-           symbolp -> type = nlp -> n_type;
-           switch ( symbolp -> type ) {
-               case N_PGLAB:
-               case N_PGCON:
-               case N_PGTYP:
+           symbolp -> desc = nlp -> n_desc;
+           switch ( symbolp -> desc ) {
+               case N_PGLABEL:
+               case N_PGCONST:
+               case N_PGTYPE:
                case N_PGVAR:
                case N_PGVAR:
-               case N_PGFUN:
-               case N_PGPRC:
+               case N_PGFUNC:
+               case N_PGPROC:
                        symbolp -> sym_un.sym_str.rfilep = ifilep;
                        symbolp -> sym_un.sym_str.rline = nlp -> n_value;
                        symbolp -> sym_un.sym_str.fromp = pfilep;
                        symbolp -> sym_un.sym_str.fromi = ifilep;
                        symbolp -> sym_un.sym_str.iline = nlp -> n_value;
                        return;
                        symbolp -> sym_un.sym_str.rfilep = ifilep;
                        symbolp -> sym_un.sym_str.rline = nlp -> n_value;
                        symbolp -> sym_un.sym_str.fromp = pfilep;
                        symbolp -> sym_un.sym_str.fromi = ifilep;
                        symbolp -> sym_un.sym_str.iline = nlp -> n_value;
                        return;
-               case N_PEFUN:
-               case N_PEPRC:
+               case N_PEFUNC:
+               case N_PEPROC:
                        symbolp -> sym_un.sym_str.rfilep = NIL;
                        symbolp -> sym_un.sym_str.rline = 0;
                            /*
                        symbolp -> sym_un.sym_str.rfilep = NIL;
                        symbolp -> sym_un.sym_str.rline = 0;
                            /*
@@ -305,7 +293,7 @@ checksymbol( nlp , ofilep )
                            error( WARNING
                                    , "%s, line %d: %s %s must be declared in included file"
                                    , pfilep -> name , nlp -> n_value
                            error( WARNING
                                    , "%s, line %d: %s %s must be declared in included file"
                                    , pfilep -> name , nlp -> n_value
-                                   , classify( symbolp -> type )
+                                   , classify( symbolp -> desc )
                                    , symbolp -> name );
                        }
                        symbolp -> sym_un.sym_str.fromp = pfilep;
                                    , symbolp -> name );
                        }
                        symbolp -> sym_un.sym_str.fromp = pfilep;
@@ -329,7 +317,7 @@ checksymbol( nlp , ofilep )
                fprintf( stderr , "[checksymbol] ->name %s is OLD\n"
                        , symbolp -> name );
 #          endif DEBUG
                fprintf( stderr , "[checksymbol] ->name %s is OLD\n"
                        , symbolp -> name );
 #          endif DEBUG
-           switch ( symbolp -> type ) {
+           switch ( symbolp -> desc ) {
                case N_PSO:
                            /*
                             *  finding a file again means you are back
                case N_PSO:
                            /*
                             *  finding a file again means you are back
@@ -351,15 +339,15 @@ checksymbol( nlp , ofilep )
                                    , ofilep -> name , symbolp -> name );
                        }
                        return;
                                    , ofilep -> name , symbolp -> name );
                        }
                        return;
-               case N_PEFUN:
-               case N_PEPRC:
+               case N_PEFUNC:
+               case N_PEPROC:
                            /*
                             *  we may see any number of external declarations,
                             *  but they all have to come
                             *  from the same include file.
                             */
                            /*
                             *  we may see any number of external declarations,
                             *  but they all have to come
                             *  from the same include file.
                             */
-                       if (   nlp -> n_type == N_PEFUN
-                           || nlp -> n_type == N_PEPRC ) {
+                       if (   nlp -> n_desc == N_PEFUNC
+                           || nlp -> n_desc == N_PEPROC ) {
                            goto included;
                        }
                            /*
                            goto included;
                        }
                            /*
@@ -368,10 +356,10 @@ checksymbol( nlp , ofilep )
                             *  if the resolving file
                             *  included the external declaration.
                             */
                             *  if the resolving file
                             *  included the external declaration.
                             */
-                       if (    (  symbolp -> type == N_PEFUN
-                               && nlp -> n_type != N_PGFUN )
-                           ||  (  symbolp -> type == N_PEPRC
-                               && nlp -> n_type != N_PGPRC )
+                       if (    (  symbolp -> desc == N_PEFUNC
+                               && nlp -> n_desc != N_PGFUNC )
+                           ||  (  symbolp -> desc == N_PEPROC
+                               && nlp -> n_desc != N_PGPROC )
                            || symbolp -> sym_un.sym_str.fromp != pfilep ) {
                            break;
                        }
                            || symbolp -> sym_un.sym_str.fromp != pfilep ) {
                            break;
                        }
@@ -384,17 +372,17 @@ checksymbol( nlp , ofilep )
                        symbolp -> sym_un.sym_str.rfilep = ifilep;
                        symbolp -> sym_un.sym_str.rline = nlp -> n_value;
                        return;
                        symbolp -> sym_un.sym_str.rfilep = ifilep;
                        symbolp -> sym_un.sym_str.rline = nlp -> n_value;
                        return;
-               case N_PGFUN:
-               case N_PGPRC:
+               case N_PGFUNC:
+               case N_PGPROC:
                            /*
                             *  functions may not be seen more than once.
                             *  the loader will complain about
                             *  `multiply defined', but we can, too.
                             */
                        break;
                            /*
                             *  functions may not be seen more than once.
                             *  the loader will complain about
                             *  `multiply defined', but we can, too.
                             */
                        break;
-               case N_PGLAB:
-               case N_PGCON:
-               case N_PGTYP:
+               case N_PGLABEL:
+               case N_PGCONST:
+               case N_PGTYPE:
                case N_PGVAR:
                            /*
                             *  labels, constants, types, variables
                case N_PGVAR:
                            /*
                             *  labels, constants, types, variables
@@ -404,7 +392,7 @@ checksymbol( nlp , ofilep )
                             *  make it look like they come from this .p file.
                             */
 included:
                             *  make it look like they come from this .p file.
                             */
 included:
-                       if (  nlp -> n_type != symbolp -> type
+                       if (  nlp -> n_desc != symbolp -> desc
                           || symbolp -> sym_un.sym_str.fromi != ifilep ) {
                            break;
                        }
                           || symbolp -> sym_un.sym_str.fromi != ifilep ) {
                            break;
                        }
@@ -728,21 +716,21 @@ classify( type )
                return "source file";
            case N_PSOL:
                return "include file";
                return "source file";
            case N_PSOL:
                return "include file";
-           case N_PGLAB:
+           case N_PGLABEL:
                return "label";
                return "label";
-           case N_PGCON:
+           case N_PGCONST:
                return "constant";
                return "constant";
-           case N_PGTYP:
+           case N_PGTYPE:
                return "type";
            case N_PGVAR:
                return "variable";
                return "type";
            case N_PGVAR:
                return "variable";
-           case N_PGFUN:
+           case N_PGFUNC:
                return "function";
                return "function";
-           case N_PGPRC:
+           case N_PGPROC:
                return "procedure";
                return "procedure";
-           case N_PEFUN:
+           case N_PEFUNC:
                return "external function";
                return "external function";
-           case N_PEPRC:
+           case N_PEPROC:
                return "external procedure";
            default:
                return "unknown symbol";
                return "external procedure";
            default:
                return "unknown symbol";
index 0070000..cd5dc37 100644 (file)
@@ -1,13 +1,13 @@
     /* Copyright (c) 1980 Regents of the University of California */
 
     /* Copyright (c) 1980 Regents of the University of California */
 
-    /* static  char sccsid[] = "@(#)pc3.h 1.2 %G%"; */
+    /* static  char sccsid[] = "@(#)pc3.h 1.3 %G%"; */
 
     /*
      * a symbol table entry.
      */
 struct symbol {
     char               *name;                  /* pointer to string table */
 
     /*
      * a symbol table entry.
      */
 struct symbol {
     char               *name;                  /* pointer to string table */
-    unsigned char      type;                   /* symbol type */
+    short              desc;                   /* symbol description */
     int                        lookup;                 /* whether new or old */
     union {                                    /* either */
        struct {                                /*   for a symbol, */
     int                        lookup;                 /* whether new or old */
     union {                                    /* either */
        struct {                                /*   for a symbol, */
@@ -16,7 +16,7 @@ struct symbol {
            long                iline;          /*     the .i file line */
            struct symbol       *rfilep;        /*     its resolving file */
            long                rline;          /*     resolving file line */
            long                iline;          /*     the .i file line */
            struct symbol       *rfilep;        /*     its resolving file */
            long                rline;          /*     resolving file line */
-       }                       sym_str;
+       }               sym_str;
        time_t          modtime;                /*   for a file, its st_mtime */
     }                  sym_un;
 };
        time_t          modtime;                /*   for a file, its st_mtime */
     }                  sym_un;
 };
index f346948..a91b8d5 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[] = "@(#)const.c 1.3 %G%";
+static char sccsid[] = "@(#)const.c 1.4 %G%";
 
 #include "whoami.h"
 #include "0.h"
 
 #include "whoami.h"
 #include "0.h"
@@ -64,7 +64,7 @@ const(cline, cid, cdecl)
 
 #ifdef PC
        if (cbn == 1) {
 
 #ifdef PC
        if (cbn == 1) {
-           stabcname( cid , line );
+           stabgconst( cid , line );
        }
 #endif PC
 
        }
 #endif PC
 
index 58528c8..4395839 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[] = "@(#)lab.c 1.3 %G%";
+static char sccsid[] = "@(#)lab.c 1.4 %G%";
 
 #include "whoami.h"
 #include "0.h"
 
 #include "whoami.h"
 #include "0.h"
@@ -85,7 +85,7 @@ label(r, l)
                                 *      stab the label for separate compilation.
                                 *      make label number = label name.
                                 */
                                 *      stab the label for separate compilation.
                                 *      make label number = label name.
                                 */
-                           stabglab( p -> symbol , line );
+                           stabglabel( p -> symbol , line );
                            p -> value[1] = atol( p -> symbol );
                            putprintf( "        .globl  " , 1 );
                            putprintf( PREFIXFORMAT , 0 , PLABELPREFIX
                            p -> value[1] = atol( p -> symbol );
                            putprintf( "        .globl  " , 1 );
                            putprintf( PREFIXFORMAT , 0 , PLABELPREFIX
index b3d3c84..0a0db00 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (c) 1980 Regents of the University of California */
 
 /* Copyright (c) 1980 Regents of the University of California */
 
-static char sccsid[] = "@(#)stab.c 1.2 %G%";
+static char sccsid[] = "@(#)stab.c 1.3 %G%";
 
     /*
      * procedures to put out sdb symbol table information.
 
     /*
      * procedures to put out sdb symbol table information.
@@ -14,13 +14,13 @@ static      char sccsid[] = "@(#)stab.c 1.2 %G%";
 #   include    "0.h"
 #   include    <stab.h>
 
 #   include    "0.h"
 #   include    <stab.h>
 
-/*
- *  the file "p.a.out" has an additional symbol definition for "a.out.h"
*     that is used by the separate compilation facility --
*     eventually, "a.out.h" must be updated to include this 
- */
+    /*
+     *  additional symbol definition for <stab.h>
    * that is used by the separate compilation facility --
    * eventually, <stab.h> should be updated to include this 
    */
 
 
-#   include    "p.a.out.h"
+#   include    "pstab.h"
 #   include    "pc.h"
 
     /*
 #   include    "pc.h"
 
     /*
@@ -44,9 +44,8 @@ stabvar( name , type , level , offset , length , line )
             *  for separate compilation
             */
        if ( level == 1 ) {
             *  for separate compilation
             */
        if ( level == 1 ) {
-           putprintf( "        .stabs  \"" , 1 );
-           putprintf( NAMEFORMAT , 1 , name );
-           putprintf( "\",0x%x,0,0,0x%x" , 0 , N_PGVAR , ABS( line ) );
+           putprintf( "        .stabs  \"%s\",0x%x,0,0x%x,0x%x" , 0 
+                       , name , N_PC , N_PGVAR , ABS( line ) );
        }
            /*
             *  for sdb
        }
            /*
             *  for sdb
@@ -153,13 +152,11 @@ stabfunc( name , class , line , level )
             */
        if ( level == 1 ) {
            if ( class == FUNC ) {
             */
        if ( level == 1 ) {
            if ( class == FUNC ) {
-               putprintf( "    .stabs  \"" , 1 );
-               putprintf( NAMEFORMAT , 1 , name );
-               putprintf( "\",0x%x,0,0,0x%x" , 0 , N_PGFUN , ABS( line ) );
+               putprintf( "    .stabs  \"%s\",0x%x,0,0x%x,0x%x" , 0 
+                           , name , N_PC , N_PGFUNC , ABS( line ) );
            } else if ( class == PROC ) {
            } else if ( class == PROC ) {
-               putprintf( "    .stabs  \"" , 1 );
-               putprintf( NAMEFORMAT , 1 , name );
-               putprintf( "\",0x%x,0,0,0x%x" , 0 , N_PGPRC , ABS( line ) );
+               putprintf( "    .stabs  \"%s\",0x%x,0,0x%x,0x%x" , 0 
+                           , name , N_PC , N_PGPROC , ABS( line ) );
            }
        }
            /*
            }
        }
            /*
@@ -200,9 +197,8 @@ stabsource( filename )
            /*
             *  for separate compilation
             */
            /*
             *  for separate compilation
             */
-       putprintf( "    .stabs  \"" , 1 );
-       putprintf( NAMEFORMAT , 1 , filename );
-       putprintf( "\",0x%x,0,0,0" , 0 , N_PSO );
+       putprintf( "    .stabs  \"%s\",0x%x,0,0x%x,0" , 0 
+                   , filename , N_PC , N_PSO );
            /*
             *  for sdb
             */
            /*
             *  for sdb
             */
@@ -228,9 +224,11 @@ stabinclude( filename )
     {
        int     label;
        
     {
        int     label;
        
-       putprintf( "    .stabs  \"" , 1 );
-       putprintf( NAMEFORMAT , 1 , filename );
-       putprintf( "\",0x%x,0,0,0" , 0 , N_PSOL );
+           /*
+            *  for separate compilation
+            */
+       putprintf( "    .stabs  \"%s\",0x%x,0,0x%x,0" , 0 
+                   , filename , N_PC , N_PSOL );
            /*
             *  for sdb
             */
            /*
             *  for sdb
             */
@@ -257,40 +255,37 @@ stabinclude( filename )
     /*
      * global labels
      */
     /*
      * global labels
      */
-stabglab( label , line )
+stabglabel( label , line )
     char       *label;
     int                line;
     {
 
     char       *label;
     int                line;
     {
 
-       putprintf( "    .stabs  \"" , 1 );
-       putprintf( PREFIXFORMAT , 1 , PLABELPREFIX , label );
-       putprintf( "\",0x%x,0,0,0x%x" , 0 , N_PGLAB , ABS( line ) );
+       putprintf( "    .stabs  \"%s\",0x%x,0,0x%x,0x%x" , 0 
+                   , label , N_PC , N_PGLABEL , ABS( line ) );
     }
 
     /*
      * global constants
      */
     }
 
     /*
      * global constants
      */
-stabcname( name , line )
-    char       *name;
+stabgconst( const , line )
+    char       *const;
     int                line;
     {
 
     int                line;
     {
 
-       putprintf( "    .stabs  \"" , 1 );
-       putprintf( NAMEFORMAT , 1 , name );
-       putprintf( "\",0x%x,0,0,0x%x" , 0 , N_PGCON , ABS( line ) );
+           putprintf( "        .stabs  \"%s\",0x%x,0,0x%x,0x%x" , 0 
+                       , const , N_PC , N_PGCONST , ABS( line ) );
     }
 
     /*
      * global types
      */
     }
 
     /*
      * global types
      */
-stabtname( name , line )
-    char       *name;
+stabgtype( type , line )
+    char       *type;
     int                line;
     {
 
     int                line;
     {
 
-       putprintf( "    .stabs  \"" , 1 );
-       putprintf( NAMEFORMAT , 1 , name );
-       putprintf( "\",0x%x,0,0,0x%x" , 0 , N_PGTYP , ABS( line ) );
+           putprintf( "        .stabs  \"%s\",0x%x,0,0x%x,0x%x" , 0 
+                       , type , N_PC , N_PGTYPE , ABS( line ) );
     }
 
 
     }
 
 
@@ -305,15 +300,14 @@ stabefunc( name , class , line )
        int     type;
 
        if ( class == FUNC ) {
        int     type;
 
        if ( class == FUNC ) {
-           type = N_PEFUN;
+           type = N_PEFUNC;
        } else if ( class == PROC ) {
        } else if ( class == PROC ) {
-           type = N_PEPRC;
+           type = N_PEPROC;
        } else {
            return;
        }
        } else {
            return;
        }
-       putprintf( "    .stabs  \"" , 1 );
-       putprintf( NAMEFORMAT , 1 , name );
-       putprintf( "\",0x%x,0,0,0x%x" , 0 , type , ABS( line ) );
+       putprintf( "    .stabs  \"%s\",0x%x,0,0x%x,0x%x" , 0 
+                   , name , N_PC , type , ABS( line ) );
     }
 
 #endif PC
     }
 
 #endif PC
index 2094cd1..6447577 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[] = "@(#)type.c 1.3 %G%";
+static char sccsid[] = "@(#)type.c 1.4 %G%";
 
 #include "whoami.h"
 #include "0.h"
 
 #include "whoami.h"
 #include "0.h"
@@ -72,7 +72,7 @@ type(tline, tid, tdecl)
 
 #ifdef PC
        if (cbn == 1) {
 
 #ifdef PC
        if (cbn == 1) {
-           stabtname( tid , line );
+           stabgtype( tid , line );
        }
 #endif PC
 
        }
 #endif PC