Commit beea043b beea043b3f9bd8b60f77cd1ff795c77ddafbcbee by Sergey Poznyakoff

(sieve_code_anyof, sieve_code_allof): New functions.

(struct check_arg): Minor change
1 parent dfbcd782
...@@ -119,7 +119,7 @@ _compare_ptr (void *item, void *data) ...@@ -119,7 +119,7 @@ _compare_ptr (void *item, void *data)
119 } 119 }
120 120
121 struct check_arg { 121 struct check_arg {
122 char *name; 122 const char *name;
123 list_t args; 123 list_t args;
124 list_t tags; 124 list_t tags;
125 }; 125 };
...@@ -317,3 +317,33 @@ sieve_code_test (sieve_register_t *reg, list_t arglist) ...@@ -317,3 +317,33 @@ sieve_code_test (sieve_register_t *reg, list_t arglist)
317 || sieve_code_command (reg, arglist); 317 || sieve_code_command (reg, arglist);
318 } 318 }
319 319
320 void
321 sieve_code_anyof (size_t start)
322 {
323 size_t end = sieve_machine->pc;
324 while (sieve_machine->prog[start+1].pc != 0)
325 {
326 size_t next = sieve_machine->prog[start+1].pc;
327 sieve_machine->prog[start].instr = instr_brnz;
328 sieve_machine->prog[start+1].pc = end - start - 2;
329 start = next;
330 }
331 sieve_machine->prog[start].instr = instr_nop;
332 sieve_machine->prog[start+1].instr = instr_nop;
333 }
334
335 void
336 sieve_code_allof (size_t start)
337 {
338 size_t end = sieve_machine->pc;
339
340 while (sieve_machine->prog[start+1].pc != 0)
341 {
342 size_t next = sieve_machine->prog[start+1].pc;
343 sieve_machine->prog[start+1].pc = end - start - 2;
344 start = next;
345 }
346 sieve_machine->prog[start].instr = instr_nop;
347 sieve_machine->prog[start+1].instr = instr_nop;
348 }
349
......