quakeforge/tools/qfcc/include/expr.h

47 lines
908 B
C
Raw Normal View History

typedef enum {
ex_label,
ex_expr, // binary expression
ex_uexpr, // unary expression
ex_def,
ex_int,
ex_float,
ex_string,
ex_vector,
ex_quaternion,
} expr_type;
typedef struct {
statref_t *refs;
dstatement_t *statement;
char *name;
} label_t;
typedef struct expr_s {
struct expr_s *next;
expr_type type;
union {
label_t *label;
struct {
int op;
type_t *type;
struct expr_s *e1;
struct expr_s *e2;
} expr;
def_t *def;
int int_val;
float float_val;
char *string_val;
float vector_val[3];
float quaternion_val[4];
} e;
} expr_t;
expr_t *new_expr (void);
2001-06-26 02:46:02 +00:00
expr_t *new_label_expr (void);
expr_t *new_binary_expr (int op, expr_t *e1, expr_t *e2);
expr_t *new_unary_expr (int op, expr_t *e1);
void print_expr (expr_t *e);
expr_t *binary_expr (int op, expr_t *e1, expr_t *e2);
expr_t *unary_expr (int op, expr_t *e);
expr_t *function_expr (expr_t *e1, expr_t *e2);