2000-05-28 13:40:48 +00:00
|
|
|
/*
|
2014-06-30 09:10:35 +00:00
|
|
|
** expr.h
|
|
|
|
**
|
|
|
|
** Ullrich von Bassewitz, 21.06.1998
|
|
|
|
*/
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2013-05-09 11:56:54 +00:00
|
|
|
/* code */
|
2000-05-28 13:40:48 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-09-08 19:48:22 +00:00
|
|
|
void ExprWithCheck (void (*Func) (ExprDesc*), ExprDesc* Expr);
|
2004-06-05 11:35:53 +00:00
|
|
|
/* Call an expression function with checks. */
|
|
|
|
|
2009-09-08 19:48:22 +00:00
|
|
|
void MarkedExprWithCheck (void (*Func) (ExprDesc*), ExprDesc* Expr);
|
|
|
|
/* Call an expression function with checks and record start and end of the
|
2014-06-30 09:10:35 +00:00
|
|
|
** generated code.
|
|
|
|
*/
|
2009-09-08 19:48:22 +00:00
|
|
|
|
2004-06-05 11:35:53 +00:00
|
|
|
void PushAddr (const ExprDesc* Expr);
|
2002-11-01 21:27:31 +00:00
|
|
|
/* If the expression contains an address that was somehow evaluated,
|
2014-06-30 09:10:35 +00:00
|
|
|
** 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
|
|
|
|
2006-02-19 12:29:37 +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
|
2014-06-30 09:10:35 +00:00
|
|
|
** is given, use this type when storing instead of lval->Type. If StoreType
|
|
|
|
** is NULL, use lval->Type instead.
|
|
|
|
*/
|
2002-11-01 21:27:31 +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
|
2014-06-30 09:10:35 +00:00
|
|
|
** 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.
|
|
|
|
*/
|
2000-05-28 13:40:48 +00:00
|
|
|
|
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 BoolExpr (void (*Func) (ExprDesc*), ExprDesc* Expr);
|
|
|
|
/* Will evaluate an expression via the given function. If the result is not
|
2014-06-30 09:10:35 +00:00
|
|
|
** 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
|
|
|
|
2020-08-19 23:52:11 +00:00
|
|
|
ExprDesc StaticConstExpr (void (*Func) (ExprDesc*));
|
|
|
|
/* Get an expression evaluated via the given function. If the result is not a
|
|
|
|
** static constant expression, 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
ExprDesc StaticConstAbsIntExpr (void (*Func) (ExprDesc*));
|
|
|
|
/* Get an expression evaluate via the given function. If the result is not a
|
|
|
|
** static constant numeric integer value, a diagnostic will be printed, and the
|
2014-06-30 09:10:35 +00:00
|
|
|
** 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-06-29 20:26:27 +00:00
|
|
|
void hie8 (ExprDesc* Expr);
|
|
|
|
/* Process + and - binary operators. */
|
|
|
|
|
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. */
|
|
|
|
|
2004-06-29 20:26:27 +00:00
|
|
|
void hie0 (ExprDesc* Expr);
|
|
|
|
/* Parse comma operator. */
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* End of expr.h */
|
|
|
|
|
|
|
|
#endif
|