Commit 2588fc83 2588fc83c8dc3ab2047e38bc3cedbd120951436a by Sergey Poznyakoff

(sieve_op_t): New member `pc'.

(struct sieve_machine): New members: errbuf,mailbox,msgno,
msg,parse_error_printer.
(sieve_error,sieve_debug): Removed prototype.
(sieve_compile_error,instr_branch,instr_brz): New function.
1 parent 58ba5fa8
...@@ -29,26 +29,33 @@ typedef union { ...@@ -29,26 +29,33 @@ typedef union {
29 list_t list; 29 list_t list;
30 long number; 30 long number;
31 char *string; 31 char *string;
32 size_t pc;
32 } sieve_op_t; 33 } sieve_op_t;
33 34
34 struct sieve_machine { 35 struct sieve_machine {
36 /* Static data */
35 list_t memory_pool; /* Pool of allocated memory objects */ 37 list_t memory_pool; /* Pool of allocated memory objects */
36 38
37 size_t progsize; /* Number of allocated program cells */ 39 size_t progsize; /* Number of allocated program cells */
38 size_t pc; /* Current program counter */
39 sieve_op_t *prog; /* Compiled program */ 40 sieve_op_t *prog; /* Compiled program */
40 41
42 /* Runtime data */
43 size_t pc; /* Current program counter */
41 long reg; /* Numeric register */ 44 long reg; /* Numeric register */
42 list_t stack; /* Runtime stack */ 45 list_t stack; /* Runtime stack */
43 46
44 int debug_level; 47 int debug_level; /* Debugging level */
48 jmp_buf errbuf; /* Target location for non-local exits */
45 49
46 sieve_printf_t error_printer; 50 mailbox_t mailbox; /* Mailbox to operate upon */
47 sieve_printf_t debug_printer; 51 size_t msgno; /* Current message number */
52 message_t msg; /* Current message */
48 53
54 /* User supplied data */
55 sieve_parse_error_t parse_error_printer;
56 sieve_printf_t error_printer;
57 sieve_printf_t debug_printer;
49 void *data; 58 void *data;
50
51 jmp_buf errbuf;
52 }; 59 };
53 60
54 extern char *sieve_filename; 61 extern char *sieve_filename;
...@@ -57,10 +64,10 @@ extern int sieve_yydebug; ...@@ -57,10 +64,10 @@ extern int sieve_yydebug;
57 extern sieve_machine_t *sieve_machine; 64 extern sieve_machine_t *sieve_machine;
58 extern int sieve_error_count; 65 extern int sieve_error_count;
59 66
60 void sieve_error __P((const char *fmt, ...)); 67 void sieve_compile_error __P((const char *filename, int linenum,
68 const char *fmt, ...));
61 void sieve_debug_internal __P((sieve_printf_t printer, void *data, 69 void sieve_debug_internal __P((sieve_printf_t printer, void *data,
62 const char *fmt, ...)); 70 const char *fmt, ...));
63 void sieve_debug __P((sieve_machine_t *mach, const char *fmt, ...));
64 void sieve_print_value __P((sieve_value_t *val, sieve_printf_t printer, 71 void sieve_print_value __P((sieve_value_t *val, sieve_printf_t printer,
65 void *data)); 72 void *data));
66 void sieve_print_value_list __P((list_t list, sieve_printf_t printer, 73 void sieve_print_value_list __P((list_t list, sieve_printf_t printer,
...@@ -68,7 +75,11 @@ void sieve_print_value_list __P((list_t list, sieve_printf_t printer, ...@@ -68,7 +75,11 @@ void sieve_print_value_list __P((list_t list, sieve_printf_t printer,
68 void sieve_print_tag_list __P((list_t list, sieve_printf_t printer, 75 void sieve_print_tag_list __P((list_t list, sieve_printf_t printer,
69 void *data)); 76 void *data));
70 77
71 int _sieve_default_error_printer __P((void*data, const char *fmt, va_list ap)); 78 int _sieve_default_error_printer __P((void *data,
79 const char *fmt, va_list ap));
80 int _sieve_default_parse_error __P((void *unused,
81 const char *filename, int lineno,
82 const char *fmt, va_list ap));
72 83
73 int sieve_lex_begin __P((const char *name)); 84 int sieve_lex_begin __P((const char *name));
74 void sieve_lex_finish __P((void)); 85 void sieve_lex_finish __P((void));
...@@ -91,3 +102,5 @@ void instr_pop __P((sieve_machine_t *mach)); ...@@ -91,3 +102,5 @@ void instr_pop __P((sieve_machine_t *mach));
91 void instr_allof __P((sieve_machine_t *mach)); 102 void instr_allof __P((sieve_machine_t *mach));
92 void instr_anyof __P((sieve_machine_t *mach)); 103 void instr_anyof __P((sieve_machine_t *mach));
93 void instr_not __P((sieve_machine_t *mach)); 104 void instr_not __P((sieve_machine_t *mach));
105 void instr_branch __P((sieve_machine_t *mach));
106 void instr_brz __P((sieve_machine_t *mach));
......