home *** CD-ROM | disk | FTP | other *** search
- /*
- * @(#)symbols.h 1.3 7/9/87
- */
- #ifndef symbols_h
- #define symbols_h
- #ifndef tags_h
- #include "tags.h"
- #endif
-
- #ifndef ident_h
- #include "ident.h"
- #endif
-
- #ifndef addresses_h
- #include "addresses.h"
- #endif
-
- typedef struct Value {
- struct sNode *ATinfo;
- struct sNode *CTinfo;
- struct sNode *value;
- } Value, *ValuePtr;
-
- #define FIRSTSYMBOL 1025
- typedef enum {ST_Unknown, ST_Const, ST_Var,
- ST_Param, ST_Result, ST_OpName} ST_Kinds;
- extern char *ST_KindName[];
-
- typedef enum {C_ATLit, C_ObLit,
- C_OpSig, C_OpDef,
- C_UnavailableHandler, C_Comp,
- C_Block, C_Monitor} ST_Contexts;
-
- typedef enum { T_NotStarted, T_EvaluatingType,
- T_EvaluatingValue, T_EvaluationDone, T_AllocationStarted,
- T_AllocationDone } EvaluationStage;
-
- typedef short int SymbolNumber;
- extern SymbolNumber nextSymbolToAllocate;
-
- typedef struct sSTEntry {
- Tag tag :8;
- unsigned int nestingDepth :8;
- ST_Kinds itsKind :4;
-
- unsigned int isManifest :1;
- unsigned int hasValue :1;
- unsigned int isSelf :1;
- unsigned int isImport :1;
- unsigned int usedOutsideInitially:1;
- unsigned int isAttached :1;
- unsigned int isMove :1;
- unsigned int isSingleReference:1;
- unsigned int isLocal :1;
- unsigned int unused :3;
- SymbolNumber itsSymbolNumber;
- Ident itsIdent;
- Value value;
- union {
- struct sSTEntry *next;
- Address address;
- } v;
- char *itsName;
- } STEntry, *Symbol;
-
- #define STENTRIESPERBLOCK 60
- typedef struct sSymbolBlock {
- Symbol symbols[STENTRIESPERBLOCK];
- } SymbolBlock, *SymbolBlockPtr;
-
- typedef struct sScope {
- ST_Contexts itsContext;
- struct sScope *enclosing;
- Symbol first;
- struct sNode *itsNode;
- short nestingDepth;
- } Scope, *ScopePtr;
-
- #define ST_Fetch(S) (S)
-
- #define ST_SymbolName(s) ((s)->itsName == NULL ? Ident_Name((s)->itsIdent) : (s)->itsName)
-
- extern void ST_EnterNewScope(/* fNodePtr, c */);
- /* ST_Contexts c; NodePtr fNodePtr; */
-
- extern void ST_EnterOldScope();
-
- extern void ST_ExitScope();
-
- Symbol ST_Lookup(/* fIdent, depth */);
- /* Ident fIdent;
- int depth;
- = 1 means only check in the smallest scope
- = 2 means all, importing it into the object if necessary
- = 3 means object */
-
- Symbol ST_Define(/* fIdent, kind, depth */);
- /* Ident fIdent; ST_Kinds kind; int depth; same as in lookup */
-
- int getNestingDepth(/* fNodePtr */);
- /* NodePtr fNodePtr ; */
- int Symbol_IsImport(/* sym */);
- /* Symbol sym; */
- Symbol ST_Create(/* fNodePtr, fIdent */);
- /* NodePtr fNodePtr; Ident fIdent; */
- #endif
-