statement.h 1.41 KB
#ifndef _STMT_H_
#define _STMT_H_

#define STMT_CONST			0
#define STMT_BLOCK			1

#define STMT_PRINT			10
#define STMT_IF				11
#define STMT_FOREACH			12
#define STMT_REPEAT			13
#define STMT_ASSIGN			14
#define STMT_UNSET			15

#define STMT_EVAL_PLUS		20
#define STMT_EVAL_MINUS		21
#define STMT_EVAL_TIMES		22
#define STMT_EVAL_OVER		23
#define STMT_EVAL_MODULO	24
#define STMT_EVAL_NEG		25

#define STMT_IDENT_VAR		30
#define STMT_IDENT_ARRAY	31
#define STMT_IDENT_VAL		32

#define STMT_CAST_INT		40
#define STMT_CAST_FLOAT		41
#define STMT_CAST_STRING	42

#define STMT_COMP_EQ			50
#define STMT_COMP_NE			51
#define STMT_COMP_LT			52
#define STMT_COMP_GT			53
#define STMT_COMP_LE			54
#define STMT_COMP_GE			55

#define STMT_COND_EXPR		60
#define STMT_COND_AND		61
#define STMT_COND_OR			62
#define STMT_COND_NEG		63



#define STYP_NONE				0
#define STYP_COND				1
#define STYP_EVAL				2
#define STYP_IDVAL			3

/*
 * Deklaration und Definition
 */
union stmtType
{
	int             cond;
	struct expVal * eVal;
	struct ident *	 idVal;
};

typedef struct stmt s_stmt;
typedef union stmtType u_stmtType;

#include <stmtQueue.h>
#include <block.h>

/*
 * Interface
 */
s_stmt *			stmtNew				(int, s_stmtQueue *, int, u_stmtType);
void				stmtFree				(s_stmt *);
s_stmtQueue *	stmtGetArgs			(s_stmt *);
u_stmtType		stmtGetVal			(s_stmt *);
int				stmtGetConstTyp	(s_stmt *);
u_stmtType		stmtDo				(s_stmt *, s_block *);

#endif /* _STMT_H_ */