X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=umpf.h;h=41cea0ca5a821c09104af5ba4cdca6174c53e080;hb=d354d049c4067efb4611a3d466e447bb2aceb85b;hp=2fd1a04aef2a0e43310e50e199f709500450c4cc;hpb=86856673ebee4258124c2ef19c7a0de1421f784d;p=umpf.git diff --git a/umpf.h b/umpf.h index 2fd1a04..41cea0c 100644 --- a/umpf.h +++ b/umpf.h @@ -1,5 +1,14 @@ +#include #include "lists.h" +/* definitions of internal variables */ +#define INT_VAR_MAIL_LEN "MAIL_LEN" +#define INT_VAR_LAST_EXIT "LAST_EXIT_CODE" +#define INT_VAR_PIPE_RES "LAST_OUTPUT" + +/* umpf.c */ +jmp_buf env; + /* cond.h */ int yylex (void); void yyerror (char const *); @@ -9,7 +18,14 @@ enum keyword { K_COPY, K_MAIL, K_PIPE, - K_EMPTY + K_EMPTY, + K_FILTER +}; + +enum var_type { + VAR_HEADER, + VAR_INTERN, + VAR_USER }; struct tree { @@ -81,7 +97,7 @@ struct tree* input_tree; #define CC(a,b) ((a<<8)|b) void* xmalloc(size_t size); void* xrealloc(void* buf, size_t size); -char* xstrdup(char* s); +char* xstrdup(const char* s); void __attribute__ ((noreturn)) die(char* msg, ...); void read_conf(char* filename); int line; @@ -100,7 +116,6 @@ struct code { OPC_JUMP_IF, OPC_JUMP_UNLESS, OPC_DELIVER, - OPC_CALL_EXT, OPC_NOP, OPC_CAT, OPC_GT, @@ -121,6 +136,7 @@ struct code { OPC_DIV, OPC_PIPE, OPC_MAIL, + OPC_FILTER, OPC_DISCARD } opcode; @@ -163,6 +179,7 @@ struct variable { char* name; int varcode; int modified; + enum var_type type; }; struct list input_code; @@ -174,10 +191,12 @@ char** var_tab; char** const_tab; int cur_const_n; int cur_const_s; +char* empty; void init(void); void compile(struct tree* t, struct list* where); -int find_var(char* name, struct list* hash); +int find_var(char* name, enum var_type type, struct list* hash); +struct variable* get_var_struct(char* name, enum var_type type, struct list* hash); int store_const(char* c); struct list* new_var_hash(void); int get_bucket_number(char* name); @@ -202,16 +221,25 @@ struct email { void save_current_headers(struct list* hash); void print_vars(struct list* hash); void interp(struct list* ins, struct list* hash); +void free_string(char* c); +void __attribute__ ((noreturn)) bye(int code, char* msg, ...); +void set_cur_mail_length_var(int len, struct list* hash); /* ham.c */ char* default_mailbox; +int chars_written; +int curr_email_len; struct list* current_headers; struct email* current_body; -struct list* make_hlist(void); +struct list* make_hlist(int fd); +void new_header(char* buf, struct list* h); void print_headers(struct list* l); -struct email* get_body(void); +struct email* get_body(int fd); int deliver_local_email(char* folder, struct email* email); +int write_email_to_fd(int fd, struct email* email); +char* read_email(struct email* em); +void open_email(void); /* lock.c */ void save_gids(void);