Mercurial > repo
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/ploki/op.h Fri Dec 20 22:18:50 2013 +0000 @@ -0,0 +1,67 @@ +#ifndef OP_H_ +#define OP_H_ + +#include "IO.h" +#include "Str.h" +#include "expr.h" + +#include <stddef.h> + +enum t_op { + OP_NOP, + OP_ASSIGN, + OP_CALL, + OP_CALL_BACK, + OP_CALL_DYN, + OP_CLOSE, + OP_ELSE, + OP_EXIT, + OP_FI, + OP_FLUSH, + OP_GOBACK, + OP_GOTO, + OP_HANG, + OP_IF, + OP_MODIFY, + OP_PRINT, + OP_PUTC, + OP_RESET, + OP_RETURN, + OP_SET_VAL, + OP_SYSTEM, + OP_TEMP, + OP_THROW +}; + +struct op { + enum t_op type; + struct expr *arg; + union { + struct expr *expr; + struct op *op; + } arh; + struct op *next; + String txt; + size_t line; +}; + +void op_init(struct op *); +void op_end(struct op *); +void op_getop(struct op *); + +#define OP_1ARG_P(op) \ +( \ + (op) == OP_CALL || (op) == OP_CALL_DYN || (op) == OP_CLOSE || \ + (op) == OP_EXIT || (op) == OP_FLUSH || (op) == OP_GOTO || \ + (op) == OP_IF || (op) == OP_RESET || (op) == OP_RETURN || \ + (op) == OP_SYSTEM || (op) == OP_THROW \ +) + +#define OP_2ARG_P(op) \ +( \ + (op) == OP_ASSIGN || (op) == OP_CALL_BACK || (op) == OP_MODIFY || \ + (op) == OP_PRINT || (op) == OP_PUTC || (op) == OP_SET_VAL || \ + (op) == OP_TEMP \ +) + +#endif /* OP_H_ */