26
26
/* Test_binary_load command
29
29
* test_binary_load <binary-name: string>
32
const struct sieve_command_def cmd_test_binary_load = {
32
const struct sieve_command_def cmd_test_binary_load = {
35
35
1, 0, FALSE, FALSE,
38
38
cmd_test_binary_validate,
40
cmd_test_binary_generate,
40
cmd_test_binary_generate,
44
44
/* Test_binary_save command
47
47
* test_binary_save <binary-name: string>
50
const struct sieve_command_def cmd_test_binary_save = {
50
const struct sieve_command_def cmd_test_binary_save = {
53
53
1, 0, FALSE, FALSE,
56
56
cmd_test_binary_validate,
58
cmd_test_binary_generate,
58
cmd_test_binary_generate,
66
66
static bool cmd_test_binary_operation_dump
67
67
(const struct sieve_dumptime_env *denv, sieve_size_t *address);
68
68
static int cmd_test_binary_operation_execute
69
69
(const struct sieve_runtime_env *renv, sieve_size_t *address);
71
71
/* test_binary_create operation */
73
const struct sieve_operation_def test_binary_load_operation = {
73
const struct sieve_operation_def test_binary_load_operation = {
74
74
"TEST_BINARY_LOAD",
76
76
TESTSUITE_OPERATION_TEST_BINARY_LOAD,
77
cmd_test_binary_operation_dump,
78
cmd_test_binary_operation_execute
77
cmd_test_binary_operation_dump,
78
cmd_test_binary_operation_execute
81
81
/* test_binary_delete operation */
83
const struct sieve_operation_def test_binary_save_operation = {
83
const struct sieve_operation_def test_binary_save_operation = {
84
84
"TEST_BINARY_SAVE",
86
86
TESTSUITE_OPERATION_TEST_BINARY_SAVE,
87
cmd_test_binary_operation_dump,
88
cmd_test_binary_operation_execute
87
cmd_test_binary_operation_dump,
88
cmd_test_binary_operation_execute
95
95
static bool cmd_test_binary_validate
96
(struct sieve_validator *valdtr, struct sieve_command *cmd)
96
(struct sieve_validator *valdtr, struct sieve_command *cmd)
98
98
struct sieve_ast_argument *arg = cmd->first_positional;
100
100
if ( !sieve_validate_positional_argument
101
101
(valdtr, cmd, arg, "binary-name", 1, SAAT_STRING) ) {
105
105
return sieve_validator_argument_activate(valdtr, cmd, arg, FALSE);
112
112
static bool cmd_test_binary_generate
134
134
static bool cmd_test_binary_operation_dump
135
135
(const struct sieve_dumptime_env *denv, sieve_size_t *address)
137
137
sieve_code_dumpf(denv, "%s:", sieve_operation_mnemonic(denv->oprtn));
139
139
sieve_code_descend(denv);
141
141
return sieve_opr_string_dump(denv, address, "binary-name");
148
148
static int cmd_test_binary_operation_execute
149
149
(const struct sieve_runtime_env *renv, sieve_size_t *address)
188
188
} else if ( sieve_operation_is(oprtn, test_binary_save_operation) ) {
189
struct sieve_binary *sbin = testsuite_script_get_binary();
189
struct sieve_binary *sbin = testsuite_script_get_binary(renv);
191
191
if ( sieve_runtime_trace_active(renv, SIEVE_TRLVL_COMMANDS) ) {
192
192
sieve_runtime_trace(renv, 0, "testsuite: test_binary_save command");