comparison src/ploki/op.h @ 4223:ac0403686959

<oerjan> rm -rf src/ploki; mv ploki src
author HackBot
date Fri, 20 Dec 2013 22:18:50 +0000
parents
children
comparison
equal deleted inserted replaced
4222:b0f3e267bb1e 4223:ac0403686959
1 #ifndef OP_H_
2 #define OP_H_
3
4 #include "IO.h"
5 #include "Str.h"
6 #include "expr.h"
7
8 #include <stddef.h>
9
10 enum t_op {
11 OP_NOP,
12 OP_ASSIGN,
13 OP_CALL,
14 OP_CALL_BACK,
15 OP_CALL_DYN,
16 OP_CLOSE,
17 OP_ELSE,
18 OP_EXIT,
19 OP_FI,
20 OP_FLUSH,
21 OP_GOBACK,
22 OP_GOTO,
23 OP_HANG,
24 OP_IF,
25 OP_MODIFY,
26 OP_PRINT,
27 OP_PUTC,
28 OP_RESET,
29 OP_RETURN,
30 OP_SET_VAL,
31 OP_SYSTEM,
32 OP_TEMP,
33 OP_THROW
34 };
35
36 struct op {
37 enum t_op type;
38 struct expr *arg;
39 union {
40 struct expr *expr;
41 struct op *op;
42 } arh;
43 struct op *next;
44 String txt;
45 size_t line;
46 };
47
48 void op_init(struct op *);
49 void op_end(struct op *);
50 void op_getop(struct op *);
51
52 #define OP_1ARG_P(op) \
53 ( \
54 (op) == OP_CALL || (op) == OP_CALL_DYN || (op) == OP_CLOSE || \
55 (op) == OP_EXIT || (op) == OP_FLUSH || (op) == OP_GOTO || \
56 (op) == OP_IF || (op) == OP_RESET || (op) == OP_RETURN || \
57 (op) == OP_SYSTEM || (op) == OP_THROW \
58 )
59
60 #define OP_2ARG_P(op) \
61 ( \
62 (op) == OP_ASSIGN || (op) == OP_CALL_BACK || (op) == OP_MODIFY || \
63 (op) == OP_PRINT || (op) == OP_PUTC || (op) == OP_SET_VAL || \
64 (op) == OP_TEMP \
65 )
66
67 #endif /* OP_H_ */