]> mj.ucw.cz Git - umpf.git/commitdiff
rewrite struct code
authorAnicka Bernathova <anicka@anicka.net>
Wed, 8 Apr 2009 20:17:34 +0000 (22:17 +0200)
committerAnicka Bernathova <anicka@anicka.net>
Wed, 8 Apr 2009 20:17:34 +0000 (22:17 +0200)
code.c
umpf.h

diff --git a/code.c b/code.c
index fbddbe101f74e40e1818ee9fffd4ba63aec65e29..7aff3defed7f79567fd5c22a7950014d31b58d74 100644 (file)
--- a/code.c
+++ b/code.c
@@ -98,9 +98,9 @@ do_ass(struct tree* t)
                        var_r = find_var(t->pt.leaf.value, var_hash);
                else
                        var_r = store_const(t->pt.leaf.value);
-               ins.opc = SET;
-               ins.op1.i = var_l;
-               ins.op2.i = var_r;
+               ins.opcode = SET;
+               ins.u.set.l = var_l;
+               ins.u.set.r = var_r;
                new_instr(ins);
        }
 }
diff --git a/umpf.h b/umpf.h
index c12492fc2418150d29b0f93c2a2792c60c4f401d..a2d45766a4b514c74a93b03d7e13bfb88e4511b3 100644 (file)
--- a/umpf.h
+++ b/umpf.h
@@ -114,28 +114,25 @@ int open_mailbox(char* path, int is_default_mailbox);
 char* cat(char* l, char* r);
 
 /* code.c */
-enum opcode {
-       SET,
-       JUMP,
-       JUMP_IF,
-       JUMP_UNLESS,
-       DELIVER,
-       CALL_EXT,
-       NOP
-};
-
-union op {
-       int i;
-       char* s;
-       struct code* c;
-};     
 
 struct code {
        struct node car;
-       enum opcode opc;
-       union op op1;
-       union op op2;
-       union op op3;
+       enum {
+               SET,
+               JUMP,
+               JUMP_IF,
+               JUMP_UNLESS,
+               DELIVER,
+               CALL_EXT,
+               NOP
+       } opcode;
+
+       union {
+               struct {
+                       int l;
+                       int r;
+               } set;
+       } u;
 };
 
 struct variable {