From: Anicka Bernathova Date: Wed, 15 Jul 2009 13:25:51 +0000 (+0200) Subject: fix arrow X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=98d46a95ee04d0e7de9b24041b8fb6bfefeb9a91;p=umpf.git fix arrow --- diff --git a/code.c b/code.c index 7c22968..04b41b3 100644 --- a/code.c +++ b/code.c @@ -231,8 +231,6 @@ do_arrow(struct tree* t, struct list* where) int v; struct code ins; - v = evaluate(t->pt.arrow.s, -1, where); - ins.u.arrow.what = v; if (t->pt.arrow.left == K_COPY) ins.u.arrow.copy = 1; @@ -248,9 +246,18 @@ do_arrow(struct tree* t, struct list* where) case K_MAIL: ins.opcode = MAIL; break; + case K_DISCARD: + ins.opcode = DISCARD; + break; default: die("do_arrow: This cannot happen ;-)"); } + + if (t->pt.arrow.right != K_DISCARD) { + v = evaluate(t->pt.arrow.s, -1, where); + ins.u.arrow.what = v; + } + new_instr(ins, where); } @@ -291,8 +298,9 @@ compile(struct tree* t, struct list* where) eval_cond(t, -1, where); // warn? case ST_ARROW: do_arrow(t, where); + break; default: - die("compile: got to default"); + die("compile: got to default, type: %d", t->st); } } @@ -325,6 +333,18 @@ print_code(void) case NOP: puts("NOP"); break; + case PIPE: + printf("PIPE %d %d\n", p->u.arrow.what, p->u.arrow.copy); + break; + case STORE: + printf("STORE %d %d\n", p->u.arrow.what, p->u.arrow.copy); + break; + case MAIL: + printf("MAIL %d %d\n", p->u.arrow.what, p->u.arrow.copy); + break; + case DISCARD: + puts("DISCARD"); + break; default: printf("not implemented, opcode: %d\n", p->opcode);