-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexpression.h
More file actions
44 lines (33 loc) · 1.34 KB
/
expression.h
File metadata and controls
44 lines (33 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef EXPRESSION_H_
#define EXPRESSION_H_
#include "interp_types.h"
#include "tree_printer.h"
#define EXPRESSION_H__UNPACK(...) __VA_ARGS__
struct expression_node;
#define BITSTREAMOP_EXPRNODE(name, elements, co_locals_def, self, co_locals_var, ctx, result, evalimpl, printer, printimpl) typedef struct { EXPRESSION_H__UNPACK elements } name##ExprNode;
#include "expression.cc"
#undef BITSTREAMOP_EXPRNODE
typedef struct expression_node {
enum expr_node_type {
#define BITSTREAMOP_EXPRNODE(name, elements, co_locals_def, self, co_locals_var, ctx, result, evalimpl, printer, printimpl) EXPRNODE_##name,
#include "expression.cc"
#undef BITSTREAMOP_EXPRNODE
} node_type;
void (*destructor)(struct expression_node * self);
union {
#define BITSTREAMOP_EXPRNODE(name, elements, co_locals_def, self, co_locals_var, ctx, result, evalimpl, printer, printimpl) name##ExprNode as_##name;
#include "expression.cc"
#undef BITSTREAMOP_EXPRNODE
};
} ExprNode;
WidthInteger evaluate_expression(InterpContext * context, const ExprNode * expr);
void print_expression(TreePrinter * printer, const ExprNode * expr);
__attribute__((unused)) inline static void
destruct_expression(struct expression_node * self)
{
if (self->destructor)
self->destructor(self);
}
extern char *expr_node_types[];
#undef EXPRESSION_H__UNPACK
#endif /* end of include guard: EXPRESSION_H_ */