diff options
author | Ash Wolf <ninji@wuffs.org> | 2022-10-25 20:30:28 +0100 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2022-10-25 20:30:28 +0100 |
commit | d0b9848c54e6f85ab713f059dcd1ddef7e57caa6 (patch) | |
tree | 5bdb9dbf6c853780bc444dc92bf6f9fa3a95742a /includes/compiler/common.h | |
parent | 685f22a6a0a5403c76316a2390c021a7b0f7597d (diff) | |
download | MWCC-d0b9848c54e6f85ab713f059dcd1ddef7e57caa6.tar.gz MWCC-d0b9848c54e6f85ab713f059dcd1ddef7e57caa6.zip |
a bunch of compiler stuff
Diffstat (limited to 'includes/compiler/common.h')
-rw-r--r-- | includes/compiler/common.h | 283 |
1 files changed, 283 insertions, 0 deletions
diff --git a/includes/compiler/common.h b/includes/compiler/common.h new file mode 100644 index 0000000..b5909e2 --- /dev/null +++ b/includes/compiler/common.h @@ -0,0 +1,283 @@ +#ifndef COMPILER_COMMON_H +#define COMPILER_COMMON_H + +#include "cw_common.h" + +typedef struct HashNameNode { + struct HashNameNode *next; + SInt32 id; + SInt16 hashval; + char name[1]; +} HashNameNode; + +typedef struct CPrepFileInfo CPrepFileInfo; + +#ifdef __MWERKS__ +#pragma options align=mac68k +#endif +// TODO move me into CPrep.h or something? +struct CPrepFileInfo { + FSSpec textfile; + HashNameNode *nameNode; + SInt32 fileModDate; + char *textbuffer; + SInt32 textlength; + SInt32 linenumber; + SInt32 pos; + Boolean hasprepline; + SInt16 fileID; + Boolean recordbrowseinfo; + Boolean unkfield123; + Boolean unkfield124; + Boolean unkfield125; + Boolean unkfield126; +}; +#ifdef __MWERKS__ +#pragma options align=reset +#endif + +typedef struct CInt64 { + SInt32 hi; + UInt32 lo; +} CInt64; + +typedef struct Float { + double value; +} Float; + +typedef union MWVector128 { + UInt8 uc[16]; + UInt16 us[8]; + UInt32 ul[4]; + float f[4]; +} MWVector128; + +typedef enum AccessType { + ACCESSPUBLIC, + ACCESSPRIVATE, + ACCESSPROTECTED, + ACCESSNONE +} AccessType; + +typedef enum Section { + SECT_DEFAULT = 0, + SECT_TEXT = 1, + SECT_DATA = 2, + SECT_UDATA = 3, + SECT_DATA_FAR = 4, + SECT_DATA_NEAR = 5, + SECT_INIT = 6, + SECT_OBJC_CAT_CLS_METH = 7, + SECT_OBJC_CAT_INST_METH = 8, + SECT_OBJC_STRING_OBJECT = 9, + SECT_OBJC_CSTRING_OBJECT = 10, + SECT_OBJC_MESSAGE_REFS = 11, + SECT_OBJC_SEL_FIXUP = 12, + SECT_OBJC_CLS_REFS = 13, + SECT_OBJC_CLASS = 14, + SECT_OBJC_META_CLASS = 15, + SECT_OBJC_CLS_METH = 16, + SECT_OBJC_INST_METH = 17, + SECT_OBJC_PROTOCOL = 18, + SECT_OBJC_CLASS_NAMES = 19, + SECT_OBJC_METH_VAR_TYPES = 20, + SECT_OBJC_METH_VAR_NAMES = 21, + SECT_OBJC_CATEGORY = 22, + SECT_OBJC_CLASS_VARS = 23, + SECT_OBJC_INSTANCE_VARS = 24, + SECT_OBJC_MODULE_INFO = 25, + SECT_OBJC_MSYMBOLS = 26, + SECT_TEXT_CSTRING = 27, + SECT_BACKEND_SPECIFIC = 28, + SECT_MW_EX_TABLE = 28, + SECT_MW_EX_TABLE_INDEX = 29, + SECT_MW_SWITCH = 30, + SECT_8BYTE_LITERALS = 31, + SECT_4BYTE_LITERALS = 32, + SECT_MOD_INIT_FUNC = 33, + SECT_MOD_TERM_FUNC = 34, + SECT_CONST = 35, + SECT_CONST_PTR = 36, + SECT_NONLAZY_PTRS = 37, + SECT_COMMON_VARS = 38, + SECT_16BYTE_LITERALS = 39, + SECT_TEXT_COALESCE = 40, + SECT_DATA_COALESCE = 41, + SECT_UDATA_COALESCE = 42, + SECT_CONST_COALESCE = 43, + SECT_CONST_PTR_COALESCE = 44, + SECT_CSTR_COALESCE = 45, + N_SECTIONS = 46 +} Section; + +typedef struct BClassList BClassList; +typedef struct CI_FuncData CI_FuncData; +typedef struct CLabel CLabel; +typedef struct DefArgCtorInfo DefArgCtorInfo; +typedef struct DepName DepName; +typedef struct ENode ENode; +typedef struct ENodeList ENodeList; +typedef struct ExceptionAction ExceptionAction; +typedef struct ExtendedParam ExtendedParam; +typedef struct FuncArg FuncArg; +typedef struct Initializer Initializer; +typedef struct InlineXRef InlineXRef; +typedef struct MemInitializer MemInitializer; +typedef struct NameSpace NameSpace; +typedef struct NameSpaceName NameSpaceName; +typedef struct NameSpaceList NameSpaceList; +typedef struct NameSpaceLookupList NameSpaceLookupList; +typedef struct NameSpaceObjectList NameSpaceObjectList; +typedef struct ObjBase ObjBase; +typedef struct ObjEnumConst ObjEnumConst; +typedef struct ObjMemberVar ObjMemberVar; +typedef struct ObjMemberVarPath ObjMemberVarPath; +typedef struct ObjNameSpace ObjNameSpace; +typedef struct ObjType ObjType; +typedef struct ObjTypeTag ObjTypeTag; +typedef struct Object Object; +typedef struct ObjectList ObjectList; +typedef struct ObjCInfo ObjCInfo; +typedef struct ObjCMethod ObjCMethod; +typedef struct PCodeLabel PCodeLabel; +typedef struct PointsToFunction PointsToFunction; +typedef struct PTFList PTFList; +typedef struct SOMInfo SOMInfo; +typedef struct Statement Statement; +typedef struct StructMember StructMember; +typedef struct Template Template; +typedef struct TemplateAction TemplateAction; +typedef struct TemplateFriend TemplateFriend; +typedef struct TemplateMember TemplateMember; +typedef struct TemplArg TemplArg; +typedef struct TemplClass TemplClass; +typedef struct TemplClassInst TemplClassInst; +typedef struct TemplateFunction TemplateFunction; +typedef struct TemplFuncInstance TemplFuncInstance; +typedef struct TemplInstance TemplInstance; +typedef struct TemplParam TemplParam; +typedef struct TemplPartialSpec TemplPartialSpec; +typedef struct TemplStack TemplStack; +typedef struct TStream TStream; +typedef struct TStreamElement TStreamElement; +typedef struct Type Type; +typedef struct TypeBitfield TypeBitfield; +typedef struct TypeClass TypeClass; +typedef struct TypeEnum TypeEnum; +typedef struct TypeFunc TypeFunc; +typedef struct TypeIntegral TypeIntegral; +typedef struct TypeMemberPointer TypeMemberPointer; +typedef struct TypeMethod TypeMethod; +typedef struct TypePointer TypePointer; +typedef struct TypeStruct TypeStruct; +typedef struct TypeTemplDep TypeTemplDep; +typedef struct VarInfo VarInfo; +typedef struct VarRecord VarRecord; + +// Common bits for templates +typedef enum TemplParamType { + TPT_TYPE = 0, + TPT_NONTYPE, + TPT_TEMPLATE +} TemplParamType; + +typedef struct TemplParamID { + UInt16 index; + UInt8 nindex; + TemplParamType type; +} TemplParamID; + +typedef enum TemplDepSubType { + TDE_PARAM, + TDE_TYPEEXPR, + TDE_CAST, + TDE_QUALNAME, + TDE_QUALTEMPL, + TDE_OBJACCESS, + TDE_SOURCEREF, + TDE_FUNCCALL, + TDE_LOCAL, + TDE_MONAND, + TDE_MONPLUS, + TDE_MONMUL, + TDE_NEW, + TDE_DELETE, + TDE_ARRAY, + TDE_DYNAMIC_CAST, + TDE_STATIC_CAST, + TDE_REINTERPRET_CAST, + TDE_CONST_CAST, + TDE_TYPEID, + TDE_MEMBERACCESS, + TDE_THROW, + TDE_EXCEPTIONINIT, + TDE_LOCALINIT, + TDE_STATICINIT, + TDE_LOCALDESTROY, + TDE_ILLEGAL +} TemplDepSubType; + +/// Things that can be applied to a type expression +typedef enum TEFuncSel { + TEFS_SIZEOF, + TEFS_ALIGNOF, + TEFS_UUIDOF, + TEFS_BI_ALIGN, + TEFS_BI_TYPE, + TEFS_BI_VTYPE, + TEFS_BI_CTYPE +} TEFuncSel; + +/// How to access an object +/// this might not actually be in Pro7 lol +typedef struct ObjAccess { + NameSpaceObjectList *list; + TypeClass *naming; + TypeClass *member; + TemplArg *targs; + HashNameNode *name; + ENode *expr; + Boolean is_qualified; + Boolean is_member; + Boolean is_ambig : 1; + Boolean is_ptm : 1; + Boolean ext_only : 1; +} ObjAccess; + +/// Qualifiers +enum { + Q_CONST = 1, + Q_VOLATILE = 2, + Q_ASM = 4, + Q_PASCAL = 8, + Q_INLINE = 0x10, + Q_REFERENCE = 0x20, + Q_EXPLICIT = 0x40, + Q_MUTABLE = 0x80, + Q_VIRTUAL = 0x100, + Q_FRIEND = 0x200, + Q_IN = 0x400, + Q_OUT = 0x800, + Q_INOUT = 0x1000, + Q_BYCOPY = 0x2000, + Q_BYREF = 0x4000, + Q_ONEWAY = 0x8000, + Q_RESTRICT = 0x200000, + Q_ALIGNED_1 = 0x2000000, + Q_ALIGNED_2 = 0x4000000, + Q_ALIGNED_4 = 0x6000000, + Q_ALIGNED_8 = 0x8000000, + Q_ALIGNED_16 = 0xA000000, + Q_ALIGNED_32 = 0xC000000, + Q_ALIGNED_64 = 0x10000000, + Q_ALIGNED_128 = 0x12000000, + Q_ALIGNED_256 = 0x14000000, + Q_ALIGNED_512 = 0x16000000, + Q_ALIGNED_1024 = 0x18000000, + Q_ALIGNED_2048 = 0x1A000000, + Q_ALIGNED_4096 = 0x1C000000, + Q_ALIGNED_8192 = 0x1E000000, + Q_ALIGNED_MASK = 0x1E000000 +}; + +#endif |