summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
c9957a9)
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
/* 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
* is:
*
* - the name of the symbol;
* is:
*
* - the name of the symbol;
+ * - 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);
#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;
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 ) );
- 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_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;
/*
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;
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
, 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 ) {
* 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;
}
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
* 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;
}
return "source file";
case N_PSOL:
return "include file";
return "source file";
case N_PSOL:
return "include file";
return "type";
case N_PGVAR:
return "variable";
return "type";
case N_PGVAR:
return "variable";
return "external function";
return "external function";
return "external procedure";
default:
return "unknown symbol";
return "external procedure";
default:
return "unknown symbol";
/* 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, */
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 */
time_t modtime; /* for a file, its st_mtime */
} sym_un;
};
time_t modtime; /* for a file, its st_mtime */
} sym_un;
};
/* 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"
#ifdef PC
if (cbn == 1) {
#ifdef PC
if (cbn == 1) {
- stabcname( cid , line );
+ stabgconst( cid , line );
/* 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"
* 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
/* 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.
# 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
+ */
* 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 ) );
*/
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 ) );
/*
* 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 );
- 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 );
-stabglab( label , line )
+stabglabel( label , 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;
- 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 ) );
-stabtname( name , line )
- char *name;
+stabgtype( type , line )
+ char *type;
- 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 ) );
int type;
if ( class == FUNC ) {
int type;
if ( class == FUNC ) {
} else if ( class == PROC ) {
} else if ( class == PROC ) {
- 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 ) );
/* 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"
#ifdef PC
if (cbn == 1) {
#ifdef PC
if (cbn == 1) {
- stabtname( tid , line );
+ stabgtype( tid , line );