]> mj.ucw.cz Git - umpf.git/commitdiff
add nice conditions
authorAnicka Bernathova <anicka@anicka.net>
Tue, 14 Jul 2009 16:54:41 +0000 (18:54 +0200)
committerAnicka Bernathova <anicka@anicka.net>
Tue, 14 Jul 2009 16:54:41 +0000 (18:54 +0200)
cond.y
umpf.h

diff --git a/cond.y b/cond.y
index b5e4bf612749309e73b00acd123b4ccfe71a0606..f46afe528f7b6869f7521ac0f10d1e5375677761 100644 (file)
--- a/cond.y
+++ b/cond.y
@@ -128,6 +128,11 @@ cond:      '!' cond {
                                                $$->pt.cond.op = $2;    
                                                $$->pt.cond.type = OP_REL;      
                                        }
+       | ass_right {
+                               $$ = tree_malloc(ST_COND);
+                               $$->pt.cond.left = $1;  
+                               $$->pt.cond.type = JUST_BOOL;   
+               }
 ;
 
 rop:   '>'
diff --git a/umpf.h b/umpf.h
index 2da7f0019c3170fa2aafa2760a46f8c6bfe88f08..179229f0da7a105b86445320812e2d6a181fe2d6 100644 (file)
--- a/umpf.h
+++ b/umpf.h
@@ -23,11 +23,12 @@ struct tree {
                } tif;
 
                struct {
-                       int op;
                        enum {
                                OP_REL,
-                               OP_BOOL 
+                               OP_BOOL,
+                               JUST_BOOL /* value only in left */      
                        } type;
+                       int op;
                        struct tree* left;
                        struct tree* right;
                } cond; /* binary operator */
@@ -115,7 +116,7 @@ int open_mailbox(char* path, int is_default_mailbox);
 char* cat(char* l, char* r);
 
 /* code.c */
-#define BUFSIZE 1024
+#define BUFSIZE 4096 
 struct code {
        struct node car;
        enum {
@@ -130,17 +131,26 @@ struct code {
        } opcode;
 
        union {
+               struct {
+                       struct code* target;
+               } jump;
+               struct {
+                       struct code* target;
+                       int cond;
+               } jump_if;
+               struct {
+                       struct code* target;
+                       int cond;
+               } jump_unless;
                struct {
                        int l;
                        int r;
                } set;
-
                struct {
                        int l;
                        int r;
                        int res; /* result */
                } cat;
-
                struct {
                } nop;
        } u;