2000-05-28 13:40:48 +00:00
|
|
|
/*
|
|
|
|
* expr.h
|
|
|
|
*
|
|
|
|
* Ullrich von Bassewitz, 21.06.1998
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef EXPR_H
|
|
|
|
#define EXPR_H
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-11-01 21:27:31 +00:00
|
|
|
/* cc65 */
|
2000-05-28 13:40:48 +00:00
|
|
|
#include "datatype.h"
|
2002-11-01 21:27:31 +00:00
|
|
|
#include "exprdesc.h"
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2004-05-31 15:27:33 +00:00
|
|
|
/* code */
|
2000-05-28 13:40:48 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-06-05 11:35:53 +00:00
|
|
|
void ExprWithCheck (void (*Func) (ExprDesc*), ExprDesc *Expr);
|
|
|
|
/* Call an expression function with checks. */
|
|
|
|
|
|
|
|
void PushAddr (const ExprDesc* Expr);
|
2002-11-01 21:27:31 +00:00
|
|
|
/* 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.
|
|
|
|
*/
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2004-05-31 15:27:33 +00:00
|
|
|
void Store (ExprDesc* Expr, const type* StoreType);
|
2002-11-01 21:27:31 +00:00
|
|
|
/* 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.
|
|
|
|
*/
|
|
|
|
|
2004-05-31 15:27:33 +00:00
|
|
|
void hie0 (ExprDesc* Expr);
|
2003-08-11 20:18:30 +00:00
|
|
|
/* Parse comma operator. */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2004-05-31 15:27:33 +00:00
|
|
|
int evalexpr (unsigned flags, void (*Func) (ExprDesc*), ExprDesc* Expr);
|
2000-05-28 13:40:48 +00:00
|
|
|
/* 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
|
2004-06-09 14:12:57 +00:00
|
|
|
* result is not constant, LoadExpr is called to bring the value into the
|
2000-05-28 13:40:48 +00:00
|
|
|
* primary register and 1 is returned.
|
|
|
|
*/
|
|
|
|
|
2004-05-31 15:27:33 +00:00
|
|
|
void Expression0 (ExprDesc* Expr);
|
|
|
|
/* Evaluate an expression via hie0 and put the result into the primary register */
|
2004-03-02 18:00:08 +00:00
|
|
|
|
2004-05-31 15:27:33 +00:00
|
|
|
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.
|
2003-08-11 20:18:30 +00:00
|
|
|
*/
|
|
|
|
|
2004-05-31 15:27:33 +00:00
|
|
|
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.
|
|
|
|
*/
|
2002-02-18 08:40:11 +00:00
|
|
|
|
2004-05-31 15:27:33 +00:00
|
|
|
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.
|
|
|
|
*/
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2004-05-25 20:59:38 +00:00
|
|
|
void hie10 (ExprDesc* lval);
|
2002-11-01 15:16:16 +00:00
|
|
|
/* Handle ++, --, !, unary - etc. */
|
|
|
|
|
2004-05-25 20:59:38 +00:00
|
|
|
void hie1 (ExprDesc* lval);
|
2000-05-28 13:40:48 +00:00
|
|
|
/* Parse first level of expression hierarchy. */
|
|
|
|
|
2001-07-17 21:24:19 +00:00
|
|
|
void DefineData (ExprDesc* lval);
|
2000-05-28 13:40:48 +00:00
|
|
|
/* Output a data definition for the given expression */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* End of expr.h */
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|