X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fcc65%2Fexpr.h;h=c98074356ef7ba55cc4c693417f6d090904e2eb4;hb=8dd3cc35dcbd7155812e6a7c01039573aff640cb;hp=f5ea0a34e521014dc137ab1f9763f6b485128a62;hpb=878e4f13524e91fbcdc8c97cc461724231339483;p=cc65 diff --git a/src/cc65/expr.h b/src/cc65/expr.h index f5ea0a34e..c98074356 100644 --- a/src/cc65/expr.h +++ b/src/cc65/expr.h @@ -18,77 +18,74 @@ /*****************************************************************************/ -/* code */ +/* code */ /*****************************************************************************/ -void PushAddr (ExprDesc* lval); +void ExprWithCheck (void (*Func) (ExprDesc*), ExprDesc* Expr); +/* Call an expression function with checks. */ + +void MarkedExprWithCheck (void (*Func) (ExprDesc*), ExprDesc* Expr); +/* Call an expression function with checks and record start and end of the + * generated code. + */ + +void PushAddr (const ExprDesc* Expr); /* If the expression contains an address that was somehow evaluated, * push this address on the stack. This is a helper function for all * sorts of implicit or explicit assignment functions where the lvalue * must be saved if it's not constant, before evaluating the rhs. */ -void ConstSubExpr (void (*F) (ExprDesc*), ExprDesc* Expr); -/* Will evaluate an expression via the given function. If the result is not - * a constant, a diagnostic will be printed, and the value is replaced by - * a constant one to make sure there are no internal errors that result - * from this input error. - */ - -void CheckBoolExpr (ExprDesc* lval); -/* Check if the given expression is a boolean expression, output a diagnostic - * if not. - */ - -void ExprLoad (unsigned flags, ExprDesc *lval); -/* Put the result of an expression into the primary register */ - -void Store (ExprDesc* lval, const type* StoreType); +void Store (ExprDesc* Expr, const Type* StoreType); /* Store the primary register into the location denoted by lval. If StoreType * is given, use this type when storing instead of lval->Type. If StoreType * is NULL, use lval->Type instead. */ -void hie0 (ExprDesc *lval); -/* Parse comma operator. */ - -int evalexpr (unsigned flags, void (*f) (ExprDesc*), ExprDesc* lval); +int evalexpr (unsigned flags, void (*Func) (ExprDesc*), ExprDesc* Expr); /* Will evaluate an expression via the given function. If the result is a - * constant, 0 is returned and the value is put in the lval struct. If the - * result is not constant, ExprLoad is called to bring the value into the + * constant, 0 is returned and the value is put in the Expr struct. If the + * result is not constant, LoadExpr is called to bring the value into the * primary register and 1 is returned. */ -void expr (void (*Func) (ExprDesc*), ExprDesc *Expr); -/* Expression parser; func is either hie0 or hie1. */ +void Expression0 (ExprDesc* Expr); +/* Evaluate an expression via hie0 and put the result into the primary register */ -void expression1 (ExprDesc* lval); -/* Evaluate an expression on level 1 (no comma operator) and put it into - * the primary register +void ConstExpr (void (*Func) (ExprDesc*), ExprDesc* Expr); +/* Will evaluate an expression via the given function. If the result is not + * a constant of some sort, a diagnostic will be printed, and the value is + * replaced by a constant one to make sure there are no internal errors that + * result from this input error. */ -void expression0 (ExprDesc* lval); -/* Evaluate an expression via hie0 and put it into the primary register */ - -void ConstExpr (ExprDesc* lval); -/* Get a constant value */ - -void ConstIntExpr (ExprDesc* Val); -/* Get a constant int value */ +void BoolExpr (void (*Func) (ExprDesc*), ExprDesc* Expr); +/* Will evaluate an expression via the given function. If the result is not + * something that may be evaluated in a boolean context, a diagnostic will be + * printed, and the value is replaced by a constant one to make sure there + * are no internal errors that result from this input error. + */ -void intexpr (ExprDesc* lval); -/* Get an integer expression */ +void ConstAbsIntExpr (void (*Func) (ExprDesc*), ExprDesc* Expr); +/* Will evaluate an expression via the given function. If the result is not + * a constant numeric integer value, a diagnostic will be printed, and the + * value is replaced by a constant one to make sure there are no internal + * errors that result from this input error. + */ void hie10 (ExprDesc* lval); /* Handle ++, --, !, unary - etc. */ +void hie8 (ExprDesc* Expr); +/* Process + and - binary operators. */ + void hie1 (ExprDesc* lval); /* Parse first level of expression hierarchy. */ -void DefineData (ExprDesc* lval); -/* Output a data definition for the given expression */ +void hie0 (ExprDesc* Expr); +/* Parse comma operator. */