From 9d2728a5605f651934fe67a6fe6986b3e4a2c011 Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Sun, 20 Nov 2022 00:07:22 -0500 Subject: add a bunch of code and a ton of stub files for later --- includes/compiler/CExpr.h | 135 ++++++++++++++++++++++++---------------------- 1 file changed, 71 insertions(+), 64 deletions(-) (limited to 'includes/compiler/CExpr.h') diff --git a/includes/compiler/CExpr.h b/includes/compiler/CExpr.h index a82e56e..24f0646 100644 --- a/includes/compiler/CExpr.h +++ b/includes/compiler/CExpr.h @@ -45,19 +45,26 @@ typedef struct Match5 { } Match5; typedef struct Match13 { - short x0; - short x2; - short x4; - short x6; - short x8; - short xA; - short xC; + Object *obj; + Match5 anotherm5; short xE; Match5 match5; + ObjectList *list; } Match13; +typedef struct FuncMatchArgs { + ENodeList *exprs; + FuncArg *args; +} FuncMatchArgs; + +typedef struct Conversion { + ENode *x0; + ENode *left; + ENode *right; +} Conversion; + // CExpr.c -extern Boolean (*name_obj_check)(void *, Object *); // TODO figure out the right type +extern Boolean (*name_obj_check)(HashNameNode *, Object *); extern Boolean disallowgreaterthan; // CExpr2.c @@ -65,63 +72,63 @@ extern ENode *assign_node; extern Boolean temp_reference_init; // CExpr.c -extern void CExpr_RewriteConst(); +extern ENode *CExpr_RewriteConst(ENode *expr); extern void optimizecomm(ENode *expr); extern short canadd(ENode *expr, SInt32 value); extern ENode *checkreference(ENode *expr); extern ENode *pointer_generation(ENode *expr); -extern void CExpr_PointerGeneration(); -extern void oldassignmentpromotion(); +extern ENode *CExpr_PointerGeneration(ENode *expr); +extern ENode *oldassignmentpromotion(ENode *expr, Type *type, short qual, Boolean flag); extern ENode *argumentpromotion(ENode *expr, Type *type, short qual, Boolean flag); extern ENode *classargument(ENode *expr); -extern ENodeList *CExpr_ScanExpressionList(Boolean flag); -extern void CExpr_DoExplicitConversion(); -extern void CExpr_MakeNameLookupResultExpr(); -extern void scansizeof(); -extern void scanalignof(); +extern ENodeList *CExpr_ScanExpressionList(Boolean is_parens); +extern ENode *CExpr_DoExplicitConversion(Type *type, UInt32 qual, ENodeList *list); +extern ENode *CExpr_MakeNameLookupResultExpr(CScopeParseResult *pr); +extern SInt32 scansizeof(void); +extern SInt32 scanalignof(void); extern ENode *getnodeaddress(ENode *expr, Boolean flag); -extern void getpointertomemberfunc(); -extern void CExpr_New_ELOGNOT_Node(); -extern void CExpr_New_EMONMIN_Node(); -extern void CExpr_New_EBINNOT_Node(); +extern ENode *getpointertomemberfunc(ENode *expr, Type *type, Boolean flag); +extern ENode *CExpr_New_ELOGNOT_Node(ENode *expr); +extern ENode *CExpr_New_EMONMIN_Node(ENode *expr); +extern ENode *CExpr_New_EBINNOT_Node(ENode *expr); extern ENode *unary_expression(void); -extern ENode *do_castnullcheck(ENode *a, ENode *b); -extern void CExpr_SafeClassPointerCast(); +extern ENode *do_castnullcheck(ENode *condexpr, ENode *nullcheckexpr); +extern ENode *CExpr_SafeClassPointerCast(ENode *expr, TypeClass *a, TypeClass *b, Boolean typconflag, Boolean pathcheckflag); extern ENode *PointerToMemberCast(ENode *expr, TypeMemberPointer *tm1, TypeMemberPointer *tm2, Boolean flag); -extern void CExpr_MemberPointerConversion(); +extern ENode *CExpr_MemberPointerConversion(ENode *expr, TypeMemberPointer *type, Boolean flag1); extern ENode *do_typecast(ENode *expr, Type *type, UInt32 qual); -extern void cast_expression(); -extern void CExpr_New_EMUL_Node(); -extern void CExpr_New_EDIV_Node(); -extern void CExpr_New_EMODULO_Node(); -extern void CExpr_New_EADD_Node(); -extern void CExpr_New_ESUB_Node(); -extern void CExpr_New_ESHL_Node(); -extern void CExpr_New_ESHR_Node(); -extern void CExpr_New_ELESS_Node(); -extern void CExpr_New_ELESSEQU_Node(); -extern void CExpr_New_EGREATER_Node(); -extern void CExpr_New_EGREATEREQU_Node(); +extern ENode *cast_expression(void); +extern ENode *CExpr_New_EMUL_Node(ENode *left, ENode *right); +extern ENode *CExpr_New_EDIV_Node(ENode *left, ENode *right, Boolean no_warning); +extern ENode *CExpr_New_EMODULO_Node(ENode *left, ENode *right, Boolean no_warning); +extern ENode *CExpr_New_EADD_Node(ENode *left, ENode *right); +extern ENode *CExpr_New_ESUB_Node(ENode *left, ENode *right); +extern ENode *CExpr_New_ESHL_Node(ENode *left, ENode *right); +extern ENode *CExpr_New_ESHR_Node(ENode *left, ENode *right); +extern ENode *CExpr_New_ELESS_Node(ENode *left, ENode *right); +extern ENode *CExpr_New_ELESSEQU_Node(ENode *left, ENode *right); +extern ENode *CExpr_New_EGREATER_Node(ENode *left, ENode *right); +extern ENode *CExpr_New_EGREATEREQU_Node(ENode *left, ENode *right); extern ENode *memberpointercompare(ENodeType t, ENode *left, ENode *right); -extern void CExpr_New_EEQU_Node(); -extern void CExpr_New_ENOTEQU_Node(); -extern void CExpr_New_EAND_Node(); -extern void CExpr_New_EXOR_Node(); -extern void CExpr_New_EOR_Node(); -extern void CExpr_New_ELAND_Node(); -extern void CExpr_New_ELOR_Node(); -extern void CExpr_NewDyadicNode(); -extern void CExpr_New_ECOND_Node(); +extern ENode *CExpr_New_EEQU_Node(ENode *left, ENode *right); +extern ENode *CExpr_New_ENOTEQU_Node(ENode *left, ENode *right); +extern ENode *CExpr_New_EAND_Node(ENode *left, ENode *right); +extern ENode *CExpr_New_EXOR_Node(ENode *left, ENode *right); +extern ENode *CExpr_New_EOR_Node(ENode *left, ENode *right); +extern ENode *CExpr_New_ELAND_Node(ENode *left, ENode *right); +extern ENode *CExpr_New_ELOR_Node(ENode *left, ENode *right); +extern ENode *CExpr_NewDyadicNode(ENode *left, ENodeType nt, ENode *right); +extern ENode *CExpr_New_ECOND_Node(ENode *cond, ENode *expr1, ENode *expr2); extern ENode *assignment_expression(void); extern ENode *conv_assignment_expression(void); -extern void CExpr_CheckUnusedExpression(); -extern void s_expression(); +extern void CExpr_CheckUnusedExpression(ENode *expr); +extern ENode *s_expression(void); extern ENode *expression(void); extern CInt64 CExpr_IntegralConstExprType(Type **tint); extern ENode *CExpr_IntegralConstOrDepExpr(void); extern CInt64 CExpr_IntegralConstExpr(void); -extern void CExpr_CheckUnwantedAssignment(); -extern void CExpr_ParseAsmExpr(); +extern void CExpr_CheckUnwantedAssignment(ENode *expr); +extern Boolean CExpr_ParseAsmExpr(Object **objptr, CInt64 *valptr); // CExpr2.c typedef void (*CExprSearchCB)(ENode *expr); @@ -170,24 +177,24 @@ extern ENode *CExpr_GetClassAccessNode(BClassList *a, BClassList *b, ENode *expr extern ENode *CExpr_ConvertToBool(ENode *expr, Boolean flag); extern void CExpr_ConversionIteratorInit(ConversionIterator *iter, TypeClass *tclass); extern Object *CExpr_ConversionIteratorNext(ConversionIterator *iter); -extern void user_assign_check(); +extern short user_assign_check(ENode *expr, Type *type, UInt32 qual, Boolean flag1, Boolean flag2, Boolean flag3); extern ENode *CExpr_ConvertToCondition(ENode *expr); -extern void CExpr_ConvertToIntegral(); -extern void CExpr_CheckArithmConversion(); -extern void get_address_of_temp_copy(); +extern ENode *CExpr_ConvertToIntegral(ENode *expr); +extern void CExpr_CheckArithmConversion(ENode *expr, Type *type); +extern ENode *get_address_of_temp_copy(ENode *expr, Boolean flag); extern short assign_check(ENode *expr, Type *type, UInt32 qual, Boolean flag1, Boolean flag2, Boolean flag3); -extern void CExpr_MatchCompare(); -extern void CExpr_GetFuncMatchArgs(); +extern Boolean CExpr_MatchCompare(Object *obj, Match13 *a, Match13 *b); +extern Boolean CExpr_GetFuncMatchArgs(Object *obj, ENodeList *argexprs, ENode *expr, FuncMatchArgs *result); extern ENode *CExpr_GetDefaultArgument(ENode *funcexpr, FuncArg *arg); extern ENode *CExpr_VarArgPromotion(ENode *expr, Boolean flag); -extern void CExpr_GenericFuncCall(); -extern void CExpr_GenericPtmfCall(); -extern void CExpr_MakeFunctionCall(); -extern void CExpr_CheckOperatorConversion(); -extern void CExpr_CheckOperator(); +extern ENode *CExpr_GenericFuncCall(BClassList *path, ENode *funcexpr, Boolean flag1, Object *obj, NameSpaceObjectList *nsol, TemplArg *templargs, ENodeList *nodes, Boolean flag2, Boolean flag3, Boolean flag4); +extern ENode *CExpr_GenericPtmfCall(Object *obj, TypeFunc *tfunc, ENodeList *arg_exprs); +extern ENode *CExpr_MakeFunctionCall(ENode *funcexpr, ENodeList *arg_exprs); +extern Boolean CExpr_CheckOperatorConversion(short token, ENode *left, ENode *right, ENodeList *list, Conversion *conv); +extern Boolean CExpr_CheckOperator(short token, ENode *left, ENode *right, Conversion *conv); extern ENode *CExpr_ConstructObject(TypeClass *tclass, ENode *addr_expr, ENodeList *args, Boolean flag1, Boolean flag2, Boolean flag3, Boolean flag4, Boolean flag5); -extern void scannew(); -extern void scandelete(); +extern ENode *scannew(Boolean flag); +extern ENode *scandelete(Boolean flag); // CExprConvMatch.c // static void CExpr_GetImplictObjectParamType(); @@ -216,7 +223,7 @@ extern ENode *CExpr_AssignmentPromotion(ENode *expr, Type *type, UInt32 qual, Bo // static void CExpr_MatchArgs(); // static void CExpr_GetMatchObject(); // static void CExpr_FindBestMatch(); -extern void CExpr_FuncArgMatch(); +extern void CExpr_FuncArgMatch(NameSpaceObjectList *nsol, TemplArg *templargs, ENodeList *argexprs, Match13 *match, ENode *expr, Boolean flag); // static void CExpr_BuildConversionTypeList(); // static void CExpr_NextPromotedIntegralType(); // static void CExpr_NextArithmeticType(); @@ -226,8 +233,8 @@ extern void CExpr_FuncArgMatch(); // static void CExpr_CheckUnaryBuiltin(); // static void CExpr_CheckBinaryBuiltin(); // static void CExpr_MatchOperands(); -extern void CExpr_CondOperatorMatch(); -extern void CExpr_OperatorMatch(); +extern Boolean CExpr_CondOperatorMatch(ENode *left, ENode *right, Conversion *conv); +extern Boolean CExpr_OperatorMatch(short token, ENode *left, ENode *right, Conversion *conv); // static void CExpr_ClassCopyInit(); #ifdef __MWERKS__ -- cgit v1.2.3