#ifndef COMPILER_CFUNC_H #define COMPILER_CFUNC_H #include "compiler/common.h" #include "compiler/CScope.h" #ifdef __MWERKS__ #pragma options align=mac68k #endif typedef struct DeclBlock { struct DeclBlock *next; ExceptionAction *dobjstack; // is type right? NameSpace *parent_nspace; short index; } DeclBlock; struct CLabel { CLabel *next; Statement *stmt; HashNameNode *uniquename; HashNameNode *name; PCodeLabel *pclabel; //void *sicg_label; }; typedef enum StatementType { ST_NOP = 1, ST_LABEL, ST_GOTO, ST_EXPRESSION, ST_SWITCH, ST_IFGOTO, ST_IFNGOTO, ST_RETURN, ST_OVF, ST_EXIT, ST_ENTRY, ST_BEGINCATCH, ST_ENDCATCH, ST_ENDCATCHDTOR, ST_GOTOEXPR, ST_ASM, ST_BEGINLOOP, ST_ENDLOOP, ST_ILLEGAL } StatementType; enum { StmtFlag_1 = 1, StmtFlag_2 = 2, StmtFlag_8 = 8, StmtFlag_10 = 0x10 }; // TODO: move me - ST_BEGINLOOP related? typedef struct LoopInfo { int x0; int x4; short x8; Statement *stmt; } LoopInfo; struct Statement { Statement *next; StatementType type; char marked; UInt8 flags; UInt16 value; ENode *expr; CLabel *label; ExceptionAction *dobjstack; SInt32 sourceoffset; HashNameNode *sourcefilepath; }; typedef struct InitExpr { struct InitExpr *next; ENode *expr; Object *object; } InitExpr; typedef struct CtorChain { struct CtorChain *next; UInt8 what; ENode *objexpr; union { ClassList *base; // 0 VClassList *vbase; // 1 ObjMemberVar *membervar; // 2 } u; } CtorChain; typedef struct CFuncSave { CScopeSave scope; // lots of fields } CFuncSave; struct DeclThing { Type *thetype; UInt32 qual; NameSpace *nspace; CLabel *xC; CLabel *x10; }; extern FuncArg elipsis; extern FuncArg oldstyle; extern ObjectList *arguments; extern ObjectList *locals; extern short localcount; extern SInt32 curstmtvalue; extern SInt32 sourceoffset; extern HashNameNode *sourcefilepath; extern SInt32 functionbodyoffset; extern HashNameNode *functionbodypath; extern InitExpr *init_expressions; extern CLabel *Labels; extern CtorChain *ctor_chain; extern Statement *curstmt; extern DeclBlock *CFunc_NewDeclBlock(void); extern void CFunc_RestoreBlock(DeclBlock *block); extern void CFunc_SetupLocalVarInfo(Object *obj); extern void CFunc_DefaultArg(Type *type, short qual, FuncArg *args); extern Boolean CFunc_ParseFakeArgList(Boolean flag); extern FuncArg *parameter_type_list(DeclInfo *declinfo); extern CLabel *findlabel(void); extern CLabel *newlabel(void); extern Statement *CFunc_AppendStatement(StatementType sttype); extern Statement *CFunc_InsertStatement(StatementType sttype, Statement *after); extern Statement *CFunc_InsertBeforeStatement(StatementType sttype, Statement *before); extern void CheckCLabels(void); extern Object *create_temp_object(Type *type); extern ENode *create_temp_node(Type *type); extern ENode *create_temp_node2(Type *type); extern void CFunc_WarnUnused(void); extern void CFunc_CodeCleanup(Statement *stmt); extern void CFunc_DestructorCleanup(Statement *stmt); extern Statement *CFunc_GenerateLoop(Statement *stmt, Type *type, ENode *expr1, ENode *expr2, ENode *expr3, ENode *expr4, ENode (*callback)(ENode *, ENode *)); extern void CFunc_CompoundStatement(DeclThing *thing); extern void CFunc_SetupNewFuncArgs(Object *obj, FuncArg *args); extern NameSpace *CFunc_FuncGenSetup(Statement *stmt, Object *func); extern void CFunc_GetGlobalCompilerState(CFuncSave *state); extern void CFunc_SetGlobalCompilerState(CFuncSave *state); extern void CFunc_Gen(Statement *stmt, Object *obj, UInt8 unk); extern void CFunc_CheckClassCtors(TypeClass *tclass); extern void CFunc_ParseFuncDef(Object *obj, DeclInfo *declinfo, TypeClass *tclass, Boolean is_method, Boolean is_static, NameSpace *nspace); extern void InitExpr_Register(ENode *expr, Object *object); extern void CFunc_GenerateDummyFunction(Object *a); extern void CFunc_GenerateSingleExprFunc(Object *a, ENode *expr); extern void CFunc_GenerateDummyCtorFunc(Object *a, Object *b); #ifdef __MWERKS__ #pragma options align=reset #endif #endif