Commit c72d22c0 c72d22c010044a3c3ec2a48a6068ce4a04ceb4c6 by Sergey Poznyakoff

(sieve_value_create,sieve_type_str)

(sieve_print_value): Handle SVT_POINTER data type.
(sieve_print_value_list) tag member is now char *.
(_comp_action): Call cp->retr continuously until it returns
non-zero.
1 parent c0579714
...@@ -143,6 +143,10 @@ sieve_value_create (sieve_data_type type, void *data) ...@@ -143,6 +143,10 @@ sieve_value_create (sieve_data_type type, void *data)
143 val->v.string = data; 143 val->v.string = data;
144 break; 144 break;
145 145
146 case SVT_POINTER:
147 val->v.ptr = data;
148 break;
149
146 default: 150 default:
147 sieve_compile_error (sieve_filename, sieve_line_num, 151 sieve_compile_error (sieve_filename, sieve_line_num,
148 "Invalid data type"); 152 "Invalid data type");
...@@ -233,7 +237,7 @@ _sieve_default_parse_error (void *unused, const char *filename, int lineno, ...@@ -233,7 +237,7 @@ _sieve_default_parse_error (void *unused, const char *filename, int lineno,
233 return 0; 237 return 0;
234 } 238 }
235 239
236 char * 240 const char *
237 sieve_type_str (sieve_data_type type) 241 sieve_type_str (sieve_data_type type)
238 { 242 {
239 switch (type) 243 switch (type)
...@@ -258,6 +262,9 @@ sieve_type_str (sieve_data_type type) ...@@ -258,6 +262,9 @@ sieve_type_str (sieve_data_type type)
258 262
259 case SVT_VALUE_LIST: 263 case SVT_VALUE_LIST:
260 return "value-list"; 264 return "value-list";
265
266 case SVT_POINTER:
267 return "pointer";
261 } 268 }
262 269
263 return "unknown"; 270 return "unknown";
...@@ -313,6 +320,9 @@ sieve_print_value (sieve_value_t *val, sieve_printf_t printer, void *data) ...@@ -313,6 +320,9 @@ sieve_print_value (sieve_value_t *val, sieve_printf_t printer, void *data)
313 320
314 case SVT_VALUE_LIST: 321 case SVT_VALUE_LIST:
315 list_do (val->v.list, (list_action_t*) value_printer, &dbg); 322 list_do (val->v.list, (list_action_t*) value_printer, &dbg);
323
324 case SVT_POINTER:
325 sieve_debug_internal (printer, data, "%p", val->v.ptr);
316 } 326 }
317 sieve_debug_internal (printer, data, ")"); 327 sieve_debug_internal (printer, data, ")");
318 } 328 }
...@@ -330,7 +340,7 @@ sieve_print_value_list (list_t list, sieve_printf_t printer, void *data) ...@@ -330,7 +340,7 @@ sieve_print_value_list (list_t list, sieve_printf_t printer, void *data)
330 static int 340 static int
331 tag_printer (sieve_runtime_tag_t *val, struct debug_data *dbg) 341 tag_printer (sieve_runtime_tag_t *val, struct debug_data *dbg)
332 { 342 {
333 sieve_debug_internal (dbg->printer, dbg->data, "%d", val->tag); 343 sieve_debug_internal (dbg->printer, dbg->data, "%s", val->tag);
334 if (val->arg) 344 if (val->arg)
335 { 345 {
336 sieve_debug_internal (dbg->printer, dbg->data, "("); 346 sieve_debug_internal (dbg->printer, dbg->data, "(");
...@@ -409,13 +419,15 @@ _comp_action (void *item, void *data) ...@@ -409,13 +419,15 @@ _comp_action (void *item, void *data)
409 { 419 {
410 struct comp_data *cp = data; 420 struct comp_data *cp = data;
411 struct comp_data2 d; 421 struct comp_data2 d;
412 int rc; 422 int rc = 0;
413 423 int i;
414 if (cp->retr (item, cp->data, &d.sample)) 424
415 return 0;
416 d.comp = cp->comp; 425 d.comp = cp->comp;
417 rc = sieve_vlist_do (cp->val, _comp_action2, &d); 426 for (i = 0; cp->retr (item, cp->data, i, &d.sample) == 0; i++)
418 free (d.sample); 427 {
428 rc = sieve_vlist_do (cp->val, _comp_action2, &d);
429 free (d.sample);
430 }
419 return rc; 431 return rc;
420 } 432 }
421 433
......