From 9d4d2957ccec3cb28c5f928195e67790f6548df0 Mon Sep 17 00:00:00 2001 From: Anicka Bernathova Date: Wed, 8 Apr 2009 22:17:34 +0200 Subject: [PATCH] rewrite struct code --- code.c | 6 +++--- umpf.h | 35 ++++++++++++++++------------------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/code.c b/code.c index fbddbe1..7aff3de 100644 --- 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 c12492f..a2d4576 100644 --- 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 { -- 2.39.2