home *** CD-ROM | disk | FTP | other *** search
- /*
- * @(#)nodes.h 1.9 1/20/89
- */
- #ifndef nodes_h
- #define nodes_h
-
- #ifndef ident_h
- #include "ident.h"
- #endif
- #ifndef symbols_h
- #include "symbols.h"
- #endif
- #ifndef tags_h
- #include "tags.h"
- #endif
- #ifndef tokens_h
- #include "tokens.h"
- #endif
- #ifndef types_h
- #include "types.h"
- #endif
- #ifndef set_h
- #include "set.h"
- #endif
-
- #define LASTZEROLOCALS P_SETQ
- #define LASTONELOCAL P_OPSIG
- #define LASTTWOLOCALS P_INVOC
-
- typedef struct sObjectFlags {
- Boolean immutable :1;
- Boolean isManifest :1;
- Boolean writeSeparately :1;
- Boolean cannotBeConformedTo :1;
- Boolean isVector :1;
- Boolean isTypeVariable :1;
- Boolean resultsDependOnlyOnArgs:1;
- Boolean inExecutableConstruct :1;
- Boolean dependsOnTypeVariable :1;
- Boolean typesAreAssigned :1;
- Boolean typesHaveBeenChecked :1;
- Boolean doesNotDuplicateSelf :1;
- Boolean doesNotMoveArguments :1;
- Boolean doLocalCreate :1;
- Boolean typeDependsOnTypeVariable:1;
- Boolean doesNotMoveSelf :1;
- unsigned unused :16;
- } ObjectFlags;
-
- #define BIGNUMBER 20
- typedef struct sNode {
- Tag tag :8;
- unsigned int firstChild :8;
- short lineNumber;
- short nChildren, maxChildren;
- union {
- /* Three local variables */
- struct {
- ObjectFlags f;
- OID codeOID;
- OID id;
- struct sNode *name, *fields;
- } recordlit,
- unionlit;
- struct {
- ObjectFlags f;
- OID codeOID;
- OID id;
- struct sNode *syms;
- } enumlit;
- struct {
- ObjectFlags f;
- OID unused1;
- OID unused2;
- struct sNode *type, *exp, *vectorType;
- } vectorlit;
- struct {
- Boolean isDone :1;
- Boolean isOK :1;
- Boolean marked :1;
- Boolean onStack :1;
- Boolean isTypeVariable :1;
- Boolean dependsOnTypeVariable :1;
- Boolean isImport :1;
- Boolean unused :17;
- Tag tag :8;
- unsigned number :16;
- unsigned lowLink :16;
- struct sNode *dependsOn;
- struct sNode *answer;
- struct sNode *definingThing;
- } knowct;
- struct {
- Boolean isDone :1;
- Boolean isOK :1;
- Boolean marked :1;
- Boolean onStack :1;
- Boolean isTypeVariable :1;
- Boolean dependsOnTypeVariable :1;
- Boolean isImport :1;
- Boolean unused :17;
- Tag tag :8;
- unsigned number :16;
- unsigned lowLink :16;
- Set dependsOn;
- struct sNode *answer;
- struct sNode *definingThing;
- } knowlocal, knowmanifest;
- struct {
- ObjectFlags f;
- OID codeOID;
- OID id;
- struct sNode *sfname, *setq, *name, *ops;
- } atlit;
- struct {
- ObjectFlags f;
- unsigned codeOID;
- OID id;
- struct sNode *sfname, *setq, *name, *myat, *instat, *export,
- *decls, *monitor, *ops, *process;
- } oblit;
- /* Two local variables */
- struct {
- OID id;
- struct sNode *value;
- } globalref;
- struct { /* since in doSymbols we change a selflit to a symref. */
- int unused1, unused2;
- } selflit;
- struct {
- Ident ident;
- short int unused;
- Symbol symbol;
- } symref,
- symdef;
- struct {
- Ident ident;
- short int unused;
- OID id;
- } opname;
- struct {
- Boolean isInlineable :1;
- Boolean isExported :1;
- Boolean isUniversal :1;
- Boolean isMonitored :1;
- Boolean isPrivate :1;
- unsigned int unused :27;
- int opNumber;
- struct sNode *sig, *body;
- } opdef;
- struct {
- short int opNumber;
- Boolean isLocal :1;
- Boolean unused :15;
- OID resultTypeOID;
- struct sNode *target, *opname, *args;
- } invoc;
- /* One local variable */
- struct {
- Ident ident;
- short int unused;
- } ident;
- struct { char *string; } string,
- charlit,
- intlit,
- reallit,
- stringlit;
- struct { Boolean value; } boollit;
- struct { int whichType; } builtinlit;
- struct {
- Boolean mayBeElided :1;
- unsigned int unused :31;
- struct sNode *decls, *ops, *init, *recovery;
- } monitor;
- struct {
- Boolean move:1;
- Boolean visit:1;
- Boolean isAttached:1;
- unsigned unused:29;
- struct sNode *sym, *type, *constraint;
- } param;
- struct {
- Boolean move:1;
- Boolean visit:1;
- unsigned unused:30;
- struct sNode *exp;
- } arg;
- struct { Ident ident; } fieldref;
- struct {
- Boolean needsNoInvokeQueue:1;
- unsigned unused:31;
- struct sNode *stats, *unavailablehandler, *failurehandler;
- } block;
- struct {
- Boolean useSignalAndExit:1;
- unsigned unused:31;
- struct sNode *exp;
- } signalstat;
- struct {
- Boolean confirm:1;
- unsigned unused:31;
- Token verb;
- struct sNode *loc;
- } checkpointstat;
- struct {
- Boolean isAttached :1;
- unsigned int unused :31;
- struct sNode *sym, *type, *value;
- } constdecl,
- vardecl;
- struct {
- Boolean isRedundant:1;
- Boolean unused:31;
- struct sNode *exp, *type;
- } view;
- struct {
- int whichResult;
- } nthresult;
- struct {
- Boolean isFunction :1;
- Boolean mustBeCompilerExecuted :1;
- unsigned int unused :30;
- struct sNode *name, *params, *results, *where;
- } opsig;
- /* No locals */
- struct {
- struct sNode *import, *export, *consts;
- } comp;
- struct {
- struct sNode *syms, *path;
- } import,
- export;
- struct {
- Token implementation;
- struct sNode *ctype;
- } pragma;
- struct {
- struct sNode *body;
- } processdef,
- initdef,
- recoverydef,
- failurehandler;
- struct {
- struct sNode *decl, *body;
- } unavailablehandler;
- struct {
- struct sNode *ifclauses, *elseclause;
- } ifstat;
- struct {
- struct sNode *exp, *stats;
- } ifclause;
- struct {
- struct sNode *stats;
- } elseclause,
- loopstat;
- struct {
- struct sNode *exp;
- } exitstat,
- assertstat,
- unfixstat,
- waitstat;
- struct {
- struct sNode *left;
- Token op;
- struct sNode *right;
- } assignstat,
- exp;
- struct {
- struct sNode *exp, *loc;
- } fixstat,
- refixstat,
- movestat;
- /* return statement */
- /* returnAndFail statement */
- struct {
- struct sNode *target, *fieldref;
- } fieldsel;
- struct {
- struct sNode *target, *exp;
- } subscript;
- struct {
- struct sNode *target, *opname, *args;
- } selection;
- struct {
- struct sNode *sym;
- Token op;
- struct sNode *type;
- } wherewidgit;
- struct {
- struct sNode *number, *vars, *vals;
- } primstat;
- struct {
- Token op;
- struct sNode *exp;
- } unaryexp;
- struct {
- struct sNode *exp, *type;
- } restrict;
- struct {
- struct sNode *inner, *param, *outer;
- } setq;
- struct sNode *children[BIGNUMBER];
- } b;
- } Node, *NodePtr;
-
- NodePtr F_NewNode();
-
- extern char *tagNames[];
-
- #define NewNode(T) F_NewNode(T, 0)
-
- extern void Sequence_Free();
-
- #define FreeNode(N) \
- if ((int) (N) <= 0x200) ; \
- else { \
- if ((N)->nChildren > 0) Sequence_Free(N); \
- free((char *)(N)); \
- }
- #define BODYSIZE 8
- #define NodeSize(N) (BODYSIZE + ((N)->maxChildren) * sizeof(NodePtr))
- #define UsedNodeSize(N) (BODYSIZE + ((N)->nChildren) * sizeof(NodePtr))
- #define NN ((NodePtr) NULL)
- #define ISTOKEN(n) ((int)(n) <= 0x200)
- #define ChildIndex(p, child) ((NodePtr)&(child) - &(p)->b.children[0])
- #define setCodeOID(p, id) (p)->b.oblit.codeOID = (id)
- #define getCodeOID(p) ((OID) (p)->b.oblit.codeOID)
- #define GETVALUE(p) ((p) == NN ? (p) : (p)->tag == P_GLOBALREF ? getValue(p) : (p))
- extern NodePtr getValue();
- #endif
-