]> mj.ucw.cz Git - umpf.git/blobdiff - umpf.h
rewrite struct code
[umpf.git] / umpf.h
diff --git a/umpf.h b/umpf.h
index 7cac96808f1d3ea6e58577af8c116ce250bab7d4..a2d45766a4b514c74a93b03d7e13bfb88e4511b3 100644 (file)
--- a/umpf.h
+++ b/umpf.h
@@ -78,13 +78,6 @@ int line;
 FILE* conf;
 
 /* int.c */
-struct variable {
-       struct node car;
-       char* name;
-       char* value;
-       int modified;
-};
-
 struct hlist {
        struct node car;
        char* name;
@@ -104,16 +97,9 @@ struct action {
        struct email e;
 };
 
-struct list* var_hash;
+/* ham.c */
 char* default_mailbox;
 
-void print_tree(struct tree* t, int ind);
-void interp(struct tree* t, struct list* hash);
-struct list* new_var_hash(void);
-void print_vars(struct list* hash);
-void save_current_headers(struct list* hash);
-
-/* ham.c */
 struct list* current_headers;
 struct email* current_body;
 struct list* make_hlist(void);
@@ -126,3 +112,42 @@ void save_gids(void);
 void close_mailbox(int fd, char* path, int is_default_mailbox);
 int open_mailbox(char* path, int is_default_mailbox);
 char* cat(char* l, char* r);
+
+/* code.c */
+
+struct code {
+       struct node car;
+       enum {
+               SET,
+               JUMP,
+               JUMP_IF,
+               JUMP_UNLESS,
+               DELIVER,
+               CALL_EXT,
+               NOP
+       } opcode;
+
+       union {
+               struct {
+                       int l;
+                       int r;
+               } set;
+       } u;
+};
+
+struct variable {
+       struct node car;
+       char* name;
+       int varcode;    
+};
+
+struct list input_code;
+struct list* var_hash;
+int current_varcode;
+char** var_tab; 
+char** const_tab;
+int cur_const_n, cur_const_s;
+
+void init(void);
+void compile(struct tree* t);
+void print_code(struct tree* t);