9
9
#include "sieve-code.h"
10
10
#include "sieve-binary.h"
16
* allof <tests: test-list>
16
* allof <tests: test-list>
19
19
static bool tst_allof_generate
20
20
(const struct sieve_codegen_env *cgenv, struct sieve_command *ctx,
21
21
struct sieve_jumplist *jumps, bool jump_true);
23
const struct sieve_command_def tst_allof = {
23
const struct sieve_command_def tst_allof = {
26
26
0, 2, FALSE, FALSE,
27
NULL, NULL, NULL, NULL,
27
NULL, NULL, NULL, NULL,
35
35
static bool tst_allof_generate
40
40
struct sieve_ast_node *test;
41
41
struct sieve_jumplist false_jumps;
43
if ( sieve_ast_test_count(ctx->ast_node) > 1 ) {
43
if ( sieve_ast_test_count(ctx->ast_node) > 1 ) {
45
45
/* Prepare jumplist */
46
46
sieve_jumplist_init_temp(&false_jumps, sbin);
49
49
test = sieve_ast_test_first(ctx->ast_node);
50
while ( test != NULL ) {
50
while ( test != NULL ) {
53
53
/* If this test list must jump on false, all sub-tests can simply add their jumps
54
* to the caller's jump list, otherwise this test redirects all false jumps to the
54
* to the caller's jump list, otherwise this test redirects all false jumps to the
55
55
* end of the currently generated code. This is just after a final jump to the true
59
59
result = sieve_generate_test(cgenv, test, &false_jumps, FALSE);
61
61
result = sieve_generate_test(cgenv, test, jumps, FALSE);
63
63
if ( !result ) return FALSE;
65
65
test = sieve_ast_test_next(test);
69
69
/* All tests succeeded, jump to case TRUE */
70
70
sieve_operation_emit(cgenv->sbin, NULL, &sieve_jmp_operation);
71
71
sieve_jumplist_add(jumps, sieve_binary_emit_offset(sbin, 0));
73
73
/* All false exits jump here */
74
74
sieve_jumplist_resolve(&false_jumps);