MWCC/includes/compiler/CDecl.h

136 lines
4.8 KiB
C
Raw Permalink Normal View History

2022-11-07 03:06:21 +00:00
#ifndef COMPILER_CDECL_H
#define COMPILER_CDECL_H
#include "compiler/common.h"
#include "compiler/tokens.h"
#include "compiler/types.h"
#ifdef __MWERKS__
#pragma options align=mac68k
#endif
// named because it's 0xE bytes big (hurr)
2023-01-20 11:56:38 +00:00
struct ClassLayout {
2022-11-07 03:06:21 +00:00
ObjBase **objlist;
2023-01-10 11:05:21 +00:00
ObjMemberVar *vtable_ivar;
2023-01-20 11:56:38 +00:00
UInt16 lex_order_count;
UInt16 xA;
Boolean has_vtable;
2022-12-29 12:32:55 +00:00
};
// what the fuck am I?
struct DeclFucker {
NameSpace *nspace;
void *mystery4;
};
2022-11-07 03:06:21 +00:00
struct DeclInfo {
Type *thetype;
UInt32 qual;
NameSpace *nspace;
HashNameNode *name;
Object *x10;
NameSpaceObjectList *x14;
2023-01-10 11:05:21 +00:00
FuncArg *x18;
NameSpace *x1C;
2022-11-07 03:06:21 +00:00
Type *x20;
ENode *x24;
TemplClass *x28;
TemplArg *expltargs;
2022-12-29 12:32:55 +00:00
TemplParam *x30;
DeclFucker *fucker34;
TemplateFunction *x38;
UInt8 x3C; // related to template nindex
2023-01-20 11:56:38 +00:00
short operator_token; // when an operator name like "operator +" is scanned, this is the token
2022-11-07 03:06:21 +00:00
short storageclass;
UInt8 section;
UInt8 exportflags;
2023-01-10 11:05:21 +00:00
Boolean x44; // has args in identifier list
Boolean x45; // has oldstyle args
2022-11-07 03:06:21 +00:00
Boolean x46;
Boolean x47;
Boolean x48;
Boolean x49;
2022-12-29 12:32:55 +00:00
Boolean x4A; // objc related
2022-11-07 03:06:21 +00:00
Boolean x4B;
2023-01-20 11:56:38 +00:00
Boolean in_friend_decl; // set to 1 when parsing a 'friend' declaration
2022-11-07 03:06:21 +00:00
Boolean x4D;
2023-01-20 11:56:38 +00:00
Boolean is_extern_c;
2022-11-07 03:06:21 +00:00
Boolean x4F;
Boolean x50;
Boolean x51;
Boolean has_expltargs;
Boolean x53;
Boolean x54;
Boolean x55;
Boolean x56;
Boolean x57;
2022-12-29 12:32:55 +00:00
CPrepFileInfo *file;
CPrepFileInfo *file2;
2023-01-20 11:56:38 +00:00
SInt32 sourceoffset;
2023-01-10 11:05:21 +00:00
Boolean x64;
2022-11-07 03:06:21 +00:00
};
typedef struct BigDeclInfo {
DeclInfo declinfo;
DeclInfo declinfo2;
Boolean xCC;
Boolean xCD;
} BigDeclInfo;
extern AccessType global_access;
extern FileOffsetInfo member_fileoffset;
extern Type *CDecl_NewStructType(SInt32 size, SInt16 align);
extern Type *CDecl_NewArrayType(Type *type, SInt32 size);
extern Type *CDecl_NewPointerType(Type *type);
extern Type *CDecl_NewRefPointerType(Type *type);
extern Type *CDecl_NewTemplDepType(TypeTemplDepType tdt);
extern void CDecl_SetResultReg(TypeFunc *tfunc);
extern void CDecl_SetFuncFlags(TypeFunc *tfunc, UInt32 flags);
extern void CDecl_NewConvFuncType(DeclInfo *declinfo);
extern void CDecl_CompleteType(Type *type);
extern Boolean IsCompleteType(Type *type);
extern Boolean CanAllocObject(Type *type);
extern Boolean CanCreateObject(Type *type);
extern void makethetypepointer(DeclInfo *declinfo, UInt32 qual);
extern void CDecl_AddThisPointerArgument(TypeFunc *tfunc, TypeClass *tclass);
extern void CDecl_MakePTMFuncType(TypeFunc *tfunc);
extern void CDecl_AddArgument(TypeFunc *tfunc, Type *argtype);
extern Boolean CDecl_CheckArrayIntegr(Type *type);
extern void CDecl_ParseDirectFuncDecl(DeclInfo *declinfo);
extern void makememberpointertype(DeclInfo *declinfo, TypeClass *tclass, UInt32 qual);
extern void CDecl_ScanPointer(DeclInfo *declinfo, NameSpace *nspace, Boolean flag);
extern void scandeclarator(DeclInfo *declinfo);
extern void conversion_type_name(DeclInfo *declinfo);
extern void MergeDefaultArgs(FuncArg *a, FuncArg *b);
extern void CheckDefaultArgs(FuncArg *args);
extern Object *CDecl_GetFunctionObject(DeclInfo *declinfo, NameSpace *nspace, Boolean *pflag, Boolean someotherflag);
extern void CDecl_TypedefDeclarator(DeclInfo *declinfo);
extern Boolean CDecl_FunctionDeclarator(DeclInfo *declinfo, NameSpace *nspace, Boolean flag, Boolean flag2);
extern void CDecl_ScanDeclarator(DeclInfo *declinfo);
extern void scandeclaratorlist(DeclInfo *declinfo);
extern void CDecl_ComputeUnderlyingEnumType(TypeEnum *tenum);
extern void scanenum(DeclInfo *declinfo);
extern void CDecl_ScanStructDeclarator(BigDeclInfo *bde);
extern void scanstruct(DeclInfo *declinfo, short structtype);
extern void CDecl_ExtractClassExportFlags(DeclInfo *declinfo, UInt8 flags);
extern TypeMemberFunc *CDecl_MakeTypeMemberFunc(TypeFunc *tfunc, TypeClass *tclass, Boolean flag);
2022-11-07 03:06:21 +00:00
extern void CDecl_PackDeclInfo(PackedDeclInfo *packed, DeclInfo *declinfo);
extern void CDecl_UnpackDeclInfo(DeclInfo *declinfo, PackedDeclInfo *packed);
extern void CDecl_AddFriend(TypeClass *tclass, Object *friendfunc, TypeClass *friendclass);
extern void CDecl_CheckCtorIntegrity(FuncArg *args, TypeClass *tclass);
extern void CDecl_MakeVBaseList(TypeClass *tclass);
2022-12-29 12:32:55 +00:00
extern Boolean CDecl_CheckNewBase(TypeClass *tclass, TypeClass *baseclass, Boolean is_virtual);
extern TypeMemberFunc *CDecl_MakeDefaultDtorType(TypeClass *tclass, Boolean is_virtual);
2023-01-20 11:56:38 +00:00
extern void CDecl_CompleteClass(ClassLayout *layout, TypeClass *tclass);
2022-11-07 03:06:21 +00:00
extern TypeClass *CDecl_DefineClass(NameSpace *nspace, HashNameNode *name, TypeClass *tclass, short mode, Boolean flag2, Boolean flag3);
extern void CDecl_ParseClassDeclSpec(UInt8 *declspec);
extern void CDecl_ParseClass(DeclInfo *declinfo, short mode, Boolean flag1, UInt8 class_declspec);
#ifdef __MWERKS__
#pragma options align=reset
#endif
#endif