SCCS-vsn: usr.bin/pascal/src/0.h 1.15
SCCS-vsn: usr.bin/pascal/src/call.c 1.19
SCCS-vsn: usr.bin/pascal/src/fend.c 1.12
SCCS-vsn: usr.bin/pascal/src/fhdr.c 1.5
SCCS-vsn: usr.bin/pascal/src/flvalue.c 1.12
SCCS-vsn: usr.bin/pascal/src/lab.c 1.12
SCCS-vsn: usr.bin/pascal/src/savenl.c 1.5
SCCS-vsn: usr.bin/pascal/src/clas.c 1.5
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-/* static char sccsid[] = "@(#)0.h 1.14 %G%"; */
+/* static char sccsid[] = "@(#)0.h 1.15 %G%"; */
#define DEBUG
#define CONSETS
#define DEBUG
#define CONSETS
/*
* The basic namelist structure.
/*
* The basic namelist structure.
- * There are also two other variants, defining the real
- * field as longs or integers given below.
+ * There is a union of data types defining the stored information
+ * as pointers, integers, longs, or a double.
*
* The array disptab defines the hash header for the symbol table.
* Symbols are hashed based on the low 6 bits of their pointer into
* the string table; see the routines in the file "lookup.c" and also "fdec.c"
* especially "funcend".
*/
*
* The array disptab defines the hash header for the symbol table.
* Symbols are hashed based on the low 6 bits of their pointer into
* the string table; see the routines in the file "lookup.c" and also "fdec.c"
* especially "funcend".
*/
extern int pnumcnt;
#ifdef PTREE
extern int pnumcnt;
#ifdef PTREE
#endif PTREE
struct nl {
char *symbol;
#endif PTREE
struct nl {
char *symbol;
- char class, nl_flags;
-#ifdef PC
- char extra_flags; /* for where things are */
-#endif PC
struct nl *type;
struct nl *chain, *nl_next;
struct nl *type;
struct nl *chain, *nl_next;
+ union {
+ int *un_ptr[5];
+ int un_value[5];
+ long un_range[2];
+ double un_real;
+ } nl_un;
# ifdef PTREE
pPointer inTree;
# endif PTREE
# ifdef PTREE
pPointer inTree;
# endif PTREE
-} *nlp, *disptab[077+1];
-extern struct nl nl[INL];
+#define class info[0]
+#define nl_flags info[1]
+#define nl_block info[1]
+#define extra_flags info[2]
-struct {
- char *symbol;
- char class, nl_flags;
-#ifdef PC
- char extra_flags;
-#endif
- struct nl *type;
- struct nl *chain, *nl_next;
- double real;
-};
+#define range nl_un.un_range
+#define value nl_un.un_value
+#define ptr nl_un.un_ptr
+#define real nl_un.un_real
-struct {
- char *symbol;
- char class, nl_block;
-#ifdef PC
- char extra_flags;
-#endif
- struct nl *type;
- struct nl *chain, *nl_next;
- long range[2];
-};
+extern struct nl *nlp, *disptab[077+1], *Fp;
+extern struct nl nl[INL];
-struct {
- char *symbol;
- char class, nl_flags;
-#ifdef PC
- char extra_flags;
-#endif
- struct nl *type;
- struct nl *chain, *nl_next;
- int *ptr[4];
-#ifdef PI
- int entloc;
-#endif PI
-};
#define NL_NLSTRT 2
#define NL_LINENO 3
#define NL_FVAR 3
#define NL_NLSTRT 2
#define NL_LINENO 3
#define NL_FVAR 3
+#define NL_ENTLOC 4 /* FUNC, PROC - entry point */
+#define NL_FCHAIN 4 /* FFUNC, FPROC - ptr to formals */
#define NL_GOLEV 2
#define NL_GOLINE 3
#define NL_GOLEV 2
#define NL_GOLINE 3
#define NL_VTOREC 2
#define NL_TAG 3
#define NL_VTOREC 2
#define NL_TAG 3
+#define NL_ELABEL 4 /* SCAL - ptr to definition of enums */
/*
* For BADUSE nl structures, NL_KINDS is a bit vector
/*
* For BADUSE nl structures, NL_KINDS is a bit vector
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)call.c 1.18 %G%";
+static char sccsid[] = "@(#)call.c 1.19 %G%";
#include "whoami.h"
#include "0.h"
#include "whoami.h"
#include "0.h"
put(1, O_FCALL);
put(2, O_FRTN, even(width(p->type)));
} else {
put(1, O_FCALL);
put(2, O_FRTN, even(width(p->type)));
} else {
- put(2, O_CALL | psbn << 8, (long)p->entloc);
+ put(2, O_CALL | psbn << 8, (long)p->value[NL_ENTLOC]);
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)clas.c 1.4 %G%";
+static char sccsid[] = "@(#)clas.c 1.5 %G%";
#include "whoami.h"
#include "0.h"
#include "whoami.h"
#include "0.h"
* positives are parameters
* negative evens are locals
*/
* positives are parameters
* negative evens are locals
*/
-whereis( level , offset , extra_flags )
+whereis( level , offset , other_flags )
{
# ifdef OBJ
return ( offset >= 0 ? PARAMVAR : LOCALVAR );
# endif OBJ
# ifdef PC
{
# ifdef OBJ
return ( offset >= 0 ? PARAMVAR : LOCALVAR );
# endif OBJ
# ifdef PC
- switch ( extra_flags & ( NGLOBAL | NPARAM | NLOCAL ) ) {
+ switch ( other_flags & ( NGLOBAL | NPARAM | NLOCAL ) ) {
case NGLOBAL:
return GLOBALVAR;
case NPARAM:
case NGLOBAL:
return GLOBALVAR;
case NPARAM:
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)fend.c 1.11 %G%";
+static char sccsid[] = "@(#)fend.c 1.12 %G%";
#include "whoami.h"
#include "0.h"
#include "whoami.h"
#include "0.h"
* Patch the branch to the
* entry point of the function
*/
* Patch the branch to the
* entry point of the function
*/
+ patch4(fp->value[NL_ENTLOC]);
/*
* Put out the block entrance code and the block name.
* HDRSZE is the number of bytes of info in the static
/*
* Put out the block entrance code and the block name.
* HDRSZE is the number of bytes of info in the static
putprintf( " calls $0,_program" , 0 );
putprintf( " pushl $0" , 0 );
putprintf( " calls $1,_PCEXIT" , 0 );
putprintf( " calls $0,_program" , 0 );
putprintf( " pushl $0" , 0 );
putprintf( " calls $1,_PCEXIT" , 0 );
+ ftnno = fp -> value[NL_ENTLOC];
putprintf( " .text" , 0 );
putprintf( " .align 1" , 0 );
putprintf( " .globl _program" , 0 );
putprintf( "_program:" , 0 );
stabfunc( "program" , fp -> class , bundle[1] , 0 );
} else {
putprintf( " .text" , 0 );
putprintf( " .align 1" , 0 );
putprintf( " .globl _program" , 0 );
putprintf( "_program:" , 0 );
stabfunc( "program" , fp -> class , bundle[1] , 0 );
} else {
+ ftnno = fp -> value[NL_ENTLOC];
putprintf( " .text" , 0 );
putprintf( " .align 1" , 0 );
sextname( extname , fp -> symbol , cbn - 1 );
putprintf( " .text" , 0 );
putprintf( " .align 1" , 0 );
sextname( extname , fp -> symbol , cbn - 1 );
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)fhdr.c 1.4 %G%";
+static char sccsid[] = "@(#)fhdr.c 1.5 %G%";
#include "whoami.h"
#include "0.h"
#include "whoami.h"
#include "0.h"
* the "entry point" of
* the prog/proc/func.
*/
* the "entry point" of
* the prog/proc/func.
*/
+ p->value[NL_ENTLOC] = getlab();
if (monflg) {
bodycnts[ cbn ] = getcnt();
p->value[ NL_CNTR ] = 0;
}
# ifdef OBJ
if (monflg) {
bodycnts[ cbn ] = getcnt();
p->value[ NL_CNTR ] = 0;
}
# ifdef OBJ
- put(2, O_TRA4, (long)p->entloc);
+ put(2, O_TRA4, (long)p->value[NL_ENTLOC]);
# endif OBJ
# ifdef PTREE
{
# endif OBJ
# ifdef PTREE
{
/* Copyright (c) 1980 Regents of the University of California */
/* Copyright (c) 1980 Regents of the University of California */
-static char sccsid[] = "@(#)flvalue.c 1.11 %G%";
+static char sccsid[] = "@(#)flvalue.c 1.12 %G%";
#include "whoami.h"
#include "0.h"
#include "whoami.h"
#include "0.h"
# ifdef OBJ
put(2 , O_LV | cbn << 8 + INDX ,
(int)tempnlp -> value[ NL_OFFS ] );
# ifdef OBJ
put(2 , O_LV | cbn << 8 + INDX ,
(int)tempnlp -> value[ NL_OFFS ] );
- put(2, O_FSAV | bn << 8, (long)p->entloc);
+ put(2, O_FSAV | bn << 8, (long)p->value[NL_ENTLOC]);
# endif OBJ
# ifdef PC
putleaf( P2ICON , 0 , 0 ,
# endif OBJ
# ifdef PC
putleaf( P2ICON , 0 , 0 ,
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)lab.c 1.11 %G%";
+static char sccsid[] = "@(#)lab.c 1.12 %G%";
#include "whoami.h"
#include "0.h"
#include "whoami.h"
#include "0.h"
p->chain = lp;
p->nl_flags |= (NFORWD|NMOD);
p->value[NL_GOLEV] = NOTYET;
p->chain = lp;
p->nl_flags |= (NFORWD|NMOD);
p->value[NL_GOLEV] = NOTYET;
+ p->value[NL_ENTLOC] = l;
if (p == NIL)
return (NIL);
# ifdef OBJ
if (p == NIL)
return (NIL);
# ifdef OBJ
- put(2, O_TRA4, (long)p->entloc);
+ put(2, O_TRA4, (long)p->value[NL_ENTLOC]);
# endif OBJ
# ifdef PC
if ( cbn != bn ) {
# endif OBJ
# ifdef PC
if ( cbn != bn ) {
}
p->nl_flags &= ~NFORWD;
# ifdef OBJ
}
p->nl_flags &= ~NFORWD;
# ifdef OBJ
+ patch4(p->value[NL_ENTLOC]);
# endif OBJ
# ifdef PC
extlabname( extname , p -> symbol , bn );
# endif OBJ
# ifdef PC
extlabname( extname , p -> symbol , bn );
/* Copyright (c) 1982 Regents of the University of California */
/* Copyright (c) 1982 Regents of the University of California */
-static char sccsid[] = "@(#)savenl.c 1.4 %G%";
+static char sccsid[] = "@(#)savenl.c 1.5 %G%";
/*
* savenl - routines for saving namelist and line number information
/*
* savenl - routines for saving namelist and line number information
s->osymvalue.orangev.lower = p->range[0];
s->osymvalue.orangev.upper = p->range[1];
if (isblock(p)) {
s->osymvalue.orangev.lower = p->range[0];
s->osymvalue.orangev.upper = p->range[1];
if (isblock(p)) {
- s->osymvalue.ofuncv.codeloc = p->entloc;
+ s->osymvalue.ofuncv.codeloc = p->value[NL_ENTLOC];
} else if (p->class == RECORD || p->class == VARNT) {
s->osymvalue.ovarnt.vtorecno = symno(p->ptr[2]);
s->osymvalue.ovarnt.vtagno = symno(p->ptr[3]);
} else if (p->class == RECORD || p->class == VARNT) {
s->osymvalue.ovarnt.vtorecno = symno(p->ptr[2]);
s->osymvalue.ovarnt.vtagno = symno(p->ptr[3]);