FILE* conf;
/* int.c */
-struct variable {
- struct node car;
- char* name;
- char* value;
- int modified;
-};
-
struct hlist {
struct node car;
char* name;
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);
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);