MWCC/includes/compiler/CScope.h

109 lines
5.0 KiB
C
Raw Normal View History

2022-11-07 03:06:21 +00:00
#ifndef COMPILER_CSCOPE_H
#define COMPILER_CSCOPE_H
#include "compiler/common.h"
#ifdef __MWERKS__
#pragma options align=mac68k
#endif
extern Boolean cscope_is_member_func;
extern Object *cscope_currentfunc;
extern TypeClass *cscope_currentclass;
extern NameSpace *cscope_current;
extern NameSpace *cscope_root;
2022-12-29 12:32:55 +00:00
struct CScopeSave {
2022-11-07 03:06:21 +00:00
NameSpace *current;
TypeClass *currentclass;
Object *currentfunc;
Boolean is_member_func;
2022-12-29 12:32:55 +00:00
}; // assumed name
2022-11-07 03:06:21 +00:00
// this might be called NameResult
2022-11-07 03:06:21 +00:00
typedef struct CScopeParseResult {
NameSpace *nspace_0;
HashNameNode *name_4;
Type *x8;
UInt32 xC; // qual
ObjBase *obj_10;
NameSpaceObjectList *nsol_14;
BClassList *bcl_18;
Boolean x1C;
Boolean x1D;
Boolean isambig;
Boolean x1F;
Boolean x20;
Boolean x21;
} CScopeParseResult;
typedef struct CScopeNSIterator {
NameSpace *nspace;
NameSpaceLookupList *lookup;
CScopeParseResult *result;
} CScopeNSIterator;
typedef struct CScopeObjectIterator {
NameSpace *nspace;
NameSpaceName *nextname;
NameSpaceObjectList *currlist;
int hashindex;
} CScopeObjectIterator;
extern void CScope_Setup(void);
extern void CScope_Cleanup(void);
extern void CScope_GetScope(CScopeSave *save);
extern void CScope_SetNameSpaceScope(NameSpace *nspace, CScopeSave *save);
extern void CScope_SetClassScope(TypeClass *cls, CScopeSave *save);
extern void CScope_SetClassDefScope(TypeClass *cls, CScopeSave *save);
extern void CScope_SetFunctionScope(Object *function, CScopeSave *save);
2023-01-10 11:05:21 +00:00
extern void CScope_SetMethodScope(Object *function, TypeClass *cls, Boolean is_static, CScopeSave *save);
2022-11-07 03:06:21 +00:00
extern void CScope_RestoreScope(CScopeSave *saved);
extern Boolean CScope_IsEmptySymTable(void);
extern Boolean CScope_IsInLocalNameSpace(NameSpace *nspace);
extern NameSpaceObjectList *CScope_FindName(NameSpace *nspace, HashNameNode *name);
extern NameSpaceName *CScope_FindNameSpaceName(NameSpace *nspace, HashNameNode *name);
extern NameSpaceObjectList *CScope_InsertName(NameSpace *nspace, HashNameNode *name);
extern NameSpaceObjectList *CScope_ArgumentDependentNameLookup(NameSpaceObjectList *list, HashNameNode *name, ENodeList *argNodes, Boolean flag);
extern NameSpace *CScope_NewHashNameSpace(HashNameNode *name);
extern NameSpace *CScope_NewListNameSpace(HashNameNode *name, Boolean is_global);
extern NameSpace *CScope_FindNonClassNonFunctionNS(NameSpace *nspace);
extern NameSpace *CScope_FindGlobalNS(NameSpace *nspoce);
extern Boolean CScope_IsStdNameSpace(NameSpace *nspace);
extern Boolean CScope_IsEmptyNameSpace(NameSpace *nspace);
extern void CScope_MergeNameSpace(NameSpace *dst, NameSpace *src);
extern void CScope_AddObject(NameSpace *nspace, HashNameNode *name, ObjBase *obj);
extern void CScope_AddGlobalObject(Object *obj);
extern NameSpaceLookupList *CScope_BuildNameSpaceLookupList(NameSpace *nspace);
extern Boolean CScope_FindQualifiedClassMember(CScopeParseResult *result, TypeClass *tclass, HashNameNode *name);
extern Type *CScope_GetType(NameSpace *nspace, HashNameNode *name, UInt32 *qual);
extern Type *CScope_GetTagType(NameSpace *nspace, HashNameNode *name);
extern Boolean CScope_ParseExprName(CScopeParseResult *result);
extern Boolean CScope_ParseDeclName(CScopeParseResult *result);
extern Boolean CScope_ParseQualifiedNameSpace(CScopeParseResult *result, Boolean flag1, Boolean flag2);
extern Boolean CScope_ParseElaborateName(CScopeParseResult *result);
extern Boolean CScope_FindObject(NameSpace *nspace, CScopeParseResult *result, HashNameNode *name);
extern Boolean CScope_FindNonClassObject(NameSpace *nspace, CScopeParseResult *result, HashNameNode *name);
extern NameSpaceObjectList *CScope_FindObjectList(CScopeParseResult *result, HashNameNode *name);
extern Boolean CScope_PossibleTypeName(HashNameNode *name);
extern Boolean CScope_FindClassMemberObject(TypeClass *tclass, CScopeParseResult *result, HashNameNode *name);
extern void CScope_InitObjectIterator(CScopeObjectIterator *iterator, NameSpace *nspace);
extern ObjBase *CScope_NextObjectIteratorObject(CScopeObjectIterator *iterator);
extern NameSpaceObjectList *CScope_NextObjectIteratorObjectList(CScopeObjectIterator *iterator);
extern void CScope_DefineTypeTag(NameSpace *nspace, HashNameNode *name, Type *type);
extern Type *CScope_GetLocalTagType(NameSpace *nspace, HashNameNode *name);
extern Boolean CScope_FindTypeName(NameSpace *nspace, HashNameNode *name, CScopeParseResult *result);
extern NameSpaceObjectList *CScope_GetLocalObject(NameSpace *nspace, HashNameNode *name);
extern BClassList *CScope_GetClassAccessPath(BClassList *list, TypeClass *tclass);
extern Boolean CScope_ParseMemberName(TypeClass *tclass, CScopeParseResult *result, Boolean flag);
extern void CScope_AddClassUsingDeclaration(TypeClass *tclass, TypeClass *tclass2, HashNameNode *name, AccessType access);
2023-01-11 22:29:53 +00:00
extern void CScope_ParseUsingDeclaration(NameSpace *nspace, AccessType access, Boolean flag);
2022-11-07 03:06:21 +00:00
extern void CScope_ParseNameSpaceAlias(HashNameNode *name);
extern void CScope_ParseUsingDirective(NameSpace *nspace);
#ifdef __MWERKS__
#pragma options align=reset
#endif
#endif