dovecot-2.0-pigeonhole: Restructured binary implementation and a...
pigeonhole at rename-it.nl
pigeonhole at rename-it.nl
Fri May 14 14:09:58 EEST 2010
details: http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/c932b2d80dd8
changeset: 1282:c932b2d80dd8
user: Stephan Bosch <stephan at rename-it.nl>
date: Fri May 14 13:08:14 2010 +0200
description:
Restructured binary implementation and added lineinfo debug blocks to the binary.
diffstat:
src/lib-sieve-tool/sieve-tool.c | 2 +-
src/lib-sieve/Makefile.am | 4 +
src/lib-sieve/cmd-discard.c | 4 +-
src/lib-sieve/cmd-if.c | 16 +-
src/lib-sieve/cmd-keep.c | 4 +-
src/lib-sieve/cmd-redirect.c | 4 +-
src/lib-sieve/cmd-stop.c | 2 +-
src/lib-sieve/ext-envelope.c | 2 +-
src/lib-sieve/ext-fileinto.c | 4 +-
src/lib-sieve/ext-reject.c | 6 +-
src/lib-sieve/plugins/body/tst-body.c | 8 +-
src/lib-sieve/plugins/copy/ext-copy.c | 2 +-
src/lib-sieve/plugins/date/tst-date.c | 10 +-
src/lib-sieve/plugins/enotify/cmd-notify.c | 12 +-
src/lib-sieve/plugins/enotify/tst-notify-method-capability.c | 2 +-
src/lib-sieve/plugins/enotify/tst-valid-notify-method.c | 2 +-
src/lib-sieve/plugins/environment/tst-environment.c | 2 +-
src/lib-sieve/plugins/imap4flags/cmd-flag.c | 10 +-
src/lib-sieve/plugins/imap4flags/tag-flags.c | 8 +-
src/lib-sieve/plugins/imap4flags/tst-hasflag.c | 2 +-
src/lib-sieve/plugins/include/cmd-global.c | 19 +-
src/lib-sieve/plugins/include/cmd-include.c | 16 +-
src/lib-sieve/plugins/include/cmd-return.c | 2 +-
src/lib-sieve/plugins/include/ext-include-binary.c | 97 +-
src/lib-sieve/plugins/include/ext-include-binary.h | 5 +-
src/lib-sieve/plugins/include/ext-include-common.c | 78 +-
src/lib-sieve/plugins/include/ext-include-variables.c | 28 +-
src/lib-sieve/plugins/include/ext-include-variables.h | 7 +-
src/lib-sieve/plugins/mailbox/tag-mailbox-create.c | 2 +-
src/lib-sieve/plugins/mailbox/tst-mailboxexists.c | 2 +-
src/lib-sieve/plugins/notify/cmd-denotify.c | 12 +-
src/lib-sieve/plugins/notify/cmd-notify.c | 12 +-
src/lib-sieve/plugins/spamvirustest/tst-spamvirustest.c | 4 +-
src/lib-sieve/plugins/vacation/cmd-vacation.c | 14 +-
src/lib-sieve/plugins/variables/cmd-set.c | 12 +-
src/lib-sieve/plugins/variables/ext-variables-arguments.c | 4 +-
src/lib-sieve/plugins/variables/ext-variables-common.c | 12 +-
src/lib-sieve/plugins/variables/ext-variables-dump.c | 6 +-
src/lib-sieve/plugins/variables/ext-variables-modifiers.h | 4 +-
src/lib-sieve/plugins/variables/ext-variables-namespaces.c | 11 +-
src/lib-sieve/plugins/variables/ext-variables-namespaces.h | 5 -
src/lib-sieve/plugins/variables/ext-variables-operands.c | 38 +-
src/lib-sieve/plugins/variables/sieve-ext-variables.h | 6 +-
src/lib-sieve/plugins/variables/tst-string.c | 2 +-
src/lib-sieve/sieve-actions.h | 4 +-
src/lib-sieve/sieve-address-parts.c | 10 +-
src/lib-sieve/sieve-address-parts.h | 4 +-
src/lib-sieve/sieve-binary-code.c | 386 ++++
src/lib-sieve/sieve-binary-debug.c | 256 ++
src/lib-sieve/sieve-binary-dumper.c | 46 +-
src/lib-sieve/sieve-binary-dumper.h | 2 +-
src/lib-sieve/sieve-binary-file.c | 839 ++++++++
src/lib-sieve/sieve-binary-private.h | 208 ++
src/lib-sieve/sieve-binary.c | 1536 +---------------
src/lib-sieve/sieve-binary.h | 127 +-
src/lib-sieve/sieve-code-dumper.c | 74 +-
src/lib-sieve/sieve-code.c | 135 +-
src/lib-sieve/sieve-code.h | 33 +-
src/lib-sieve/sieve-commands.c | 11 +-
src/lib-sieve/sieve-common.h | 3 +
src/lib-sieve/sieve-comparators.c | 2 +-
src/lib-sieve/sieve-comparators.h | 4 +-
src/lib-sieve/sieve-dump.h | 1 +
src/lib-sieve/sieve-generator.c | 157 +-
src/lib-sieve/sieve-generator.h | 14 +-
src/lib-sieve/sieve-interpreter.c | 59 +-
src/lib-sieve/sieve-interpreter.h | 3 +
src/lib-sieve/sieve-match-types.c | 2 +-
src/lib-sieve/sieve-match-types.h | 4 +-
src/lib-sieve/sieve-match.c | 8 +-
src/lib-sieve/sieve-objects.c | 18 +-
src/lib-sieve/sieve-objects.h | 4 +-
src/lib-sieve/sieve.c | 6 +-
src/lib-sieve/sieve.h | 2 +-
src/lib-sieve/tst-address.c | 2 +-
src/lib-sieve/tst-allof.c | 8 +-
src/lib-sieve/tst-anyof.c | 8 +-
src/lib-sieve/tst-exists.c | 2 +-
src/lib-sieve/tst-header.c | 2 +-
src/lib-sieve/tst-size.c | 4 +-
src/lib-sieve/tst-truefalse.c | 8 +-
src/sieve-tools/debug/cmd-debug-print.c | 2 +-
src/testsuite/cmd-test-binary.c | 4 +-
src/testsuite/cmd-test-config.c | 2 +-
src/testsuite/cmd-test-fail.c | 6 +-
src/testsuite/cmd-test-mailbox.c | 2 +-
src/testsuite/cmd-test-message.c | 12 +-
src/testsuite/cmd-test-result-print.c | 2 +-
src/testsuite/cmd-test-result-reset.c | 2 +-
src/testsuite/cmd-test-set.c | 4 +-
src/testsuite/cmd-test.c | 4 +-
src/testsuite/testsuite-common.c | 4 +-
src/testsuite/testsuite-objects.c | 24 +-
src/testsuite/testsuite-objects.h | 4 +-
src/testsuite/testsuite-substitutions.c | 22 +-
src/testsuite/tst-test-error.c | 2 +-
src/testsuite/tst-test-multiscript.c | 2 +-
src/testsuite/tst-test-result-execute.c | 2 +-
src/testsuite/tst-test-result.c | 2 +-
src/testsuite/tst-test-script-compile.c | 2 +-
src/testsuite/tst-test-script-run.c | 10 +-
101 files changed, 2577 insertions(+), 2033 deletions(-)
diffs (truncated from 7602 to 300 lines):
diff -r 5a83e796ec4c -r c932b2d80dd8 src/lib-sieve-tool/sieve-tool.c
--- a/src/lib-sieve-tool/sieve-tool.c Fri May 14 12:34:59 2010 +0200
+++ b/src/lib-sieve-tool/sieve-tool.c Fri May 14 13:08:14 2010 +0200
@@ -244,7 +244,7 @@
}
if ( dumpstream != NULL ) {
- (void) sieve_dump(sbin, dumpstream);
+ (void) sieve_dump(sbin, dumpstream, FALSE);
o_stream_destroy(&dumpstream);
} else {
i_fatal("Failed to create stream for sieve code dump.");
diff -r 5a83e796ec4c -r c932b2d80dd8 src/lib-sieve/Makefile.am
--- a/src/lib-sieve/Makefile.am Fri May 14 12:34:59 2010 +0200
+++ b/src/lib-sieve/Makefile.am Fri May 14 13:08:14 2010 +0200
@@ -76,6 +76,9 @@
sieve-script.c \
sieve-ast.c \
sieve-binary.c \
+ sieve-binary-file.c \
+ sieve-binary-code.c \
+ sieve-binary-debug.c \
sieve-parser.c \
sieve-address.c \
sieve-validator.c \
@@ -116,6 +119,7 @@
sieve-script-private.h \
sieve-ast.h \
sieve-binary.h \
+ sieve-binary-private.h \
sieve-parser.h \
sieve-address.h \
sieve-validator.h \
diff -r 5a83e796ec4c -r c932b2d80dd8 src/lib-sieve/cmd-discard.c
--- a/src/lib-sieve/cmd-discard.c Fri May 14 12:34:59 2010 +0200
+++ b/src/lib-sieve/cmd-discard.c Fri May 14 13:08:14 2010 +0200
@@ -79,10 +79,10 @@
static bool cmd_discard_generate
(const struct sieve_codegen_env *cgenv, struct sieve_command *cmd)
{
- sieve_operation_emit(cgenv->sbin, NULL, &cmd_discard_operation);
+ sieve_operation_emit(cgenv->sblock, NULL, &cmd_discard_operation);
/* Emit line number */
- sieve_code_source_line_emit(cgenv->sbin, sieve_command_source_line(cmd));
+ sieve_code_source_line_emit(cgenv->sblock, sieve_command_source_line(cmd));
return TRUE;
}
diff -r 5a83e796ec4c -r c932b2d80dd8 src/lib-sieve/cmd-if.c
--- a/src/lib-sieve/cmd-if.c Fri May 14 12:34:59 2010 +0200
+++ b/src/lib-sieve/cmd-if.c Fri May 14 13:08:14 2010 +0200
@@ -149,7 +149,7 @@
*/
static void cmd_if_resolve_exit_jumps
-(struct sieve_binary *sbin, struct cmd_if_context_data *cmd_data)
+(struct sieve_binary_block *sblock, struct cmd_if_context_data *cmd_data)
{
struct cmd_if_context_data *if_ctx = cmd_data->previous;
@@ -158,7 +158,7 @@
*/
while ( if_ctx != NULL ) {
if ( if_ctx->jump_generated )
- sieve_binary_resolve_offset(sbin, if_ctx->exit_jump);
+ sieve_binary_resolve_offset(sblock, if_ctx->exit_jump);
if_ctx = if_ctx->previous;
}
}
@@ -166,14 +166,14 @@
static bool cmd_if_generate
(const struct sieve_codegen_env *cgenv, struct sieve_command *cmd)
{
- struct sieve_binary *sbin = cgenv->sbin;
+ struct sieve_binary_block *sblock = cgenv->sblock;
struct cmd_if_context_data *cmd_data =
(struct cmd_if_context_data *) cmd->data;
struct sieve_ast_node *test;
struct sieve_jumplist jmplist;
/* Prepare jumplist */
- sieve_jumplist_init_temp(&jmplist, sbin);
+ sieve_jumplist_init_temp(&jmplist, sblock);
/* Generate test condition */
test = sieve_ast_test_first(cmd->ast_node);
@@ -192,13 +192,13 @@
* anyway.
*/
if ( !sieve_command_block_exits_unconditionally(cmd) ) {
- sieve_operation_emit(sbin, NULL, &sieve_jmp_operation);
- cmd_data->exit_jump = sieve_binary_emit_offset(sbin, 0);
+ sieve_operation_emit(sblock, NULL, &sieve_jmp_operation);
+ cmd_data->exit_jump = sieve_binary_emit_offset(sblock, 0);
cmd_data->jump_generated = TRUE;
}
} else {
/* Yes, Resolve previous exit jumps to this point */
- cmd_if_resolve_exit_jumps(sbin, cmd_data);
+ cmd_if_resolve_exit_jumps(sblock, cmd_data);
}
/* Case false ... (subsequent elsif/else commands might generate more) */
@@ -218,7 +218,7 @@
return FALSE;
/* } End: resolve all exit blocks */
- cmd_if_resolve_exit_jumps(cgenv->sbin, cmd_data);
+ cmd_if_resolve_exit_jumps(cgenv->sblock, cmd_data);
return TRUE;
}
diff -r 5a83e796ec4c -r c932b2d80dd8 src/lib-sieve/cmd-keep.c
--- a/src/lib-sieve/cmd-keep.c Fri May 14 12:34:59 2010 +0200
+++ b/src/lib-sieve/cmd-keep.c Fri May 14 13:08:14 2010 +0200
@@ -57,10 +57,10 @@
(const struct sieve_codegen_env *cgenv, struct sieve_command *cmd)
{
/* Emit opcode */
- sieve_operation_emit(cgenv->sbin, NULL, &cmd_keep_operation);
+ sieve_operation_emit(cgenv->sblock, NULL, &cmd_keep_operation);
/* Emit line number */
- sieve_code_source_line_emit(cgenv->sbin, sieve_command_source_line(cmd));
+ sieve_code_source_line_emit(cgenv->sblock, sieve_command_source_line(cmd));
/* Generate arguments */
return sieve_generate_arguments(cgenv, cmd, NULL);
diff -r 5a83e796ec4c -r c932b2d80dd8 src/lib-sieve/cmd-redirect.c
--- a/src/lib-sieve/cmd-redirect.c Fri May 14 12:34:59 2010 +0200
+++ b/src/lib-sieve/cmd-redirect.c Fri May 14 13:08:14 2010 +0200
@@ -160,10 +160,10 @@
static bool cmd_redirect_generate
(const struct sieve_codegen_env *cgenv, struct sieve_command *cmd)
{
- sieve_operation_emit(cgenv->sbin, NULL, &cmd_redirect_operation);
+ sieve_operation_emit(cgenv->sblock, NULL, &cmd_redirect_operation);
/* Emit line number */
- sieve_code_source_line_emit(cgenv->sbin, sieve_command_source_line(cmd));
+ sieve_code_source_line_emit(cgenv->sblock, sieve_command_source_line(cmd));
/* Generate arguments */
return sieve_generate_arguments(cgenv, cmd, NULL);
diff -r 5a83e796ec4c -r c932b2d80dd8 src/lib-sieve/cmd-stop.c
--- a/src/lib-sieve/cmd-stop.c Fri May 14 12:34:59 2010 +0200
+++ b/src/lib-sieve/cmd-stop.c Fri May 14 13:08:14 2010 +0200
@@ -65,7 +65,7 @@
(const struct sieve_codegen_env *cgenv,
struct sieve_command *cmd ATTR_UNUSED)
{
- sieve_operation_emit(cgenv->sbin, NULL, &cmd_stop_operation);
+ sieve_operation_emit(cgenv->sblock, NULL, &cmd_stop_operation);
return TRUE;
}
diff -r 5a83e796ec4c -r c932b2d80dd8 src/lib-sieve/ext-envelope.c
--- a/src/lib-sieve/ext-envelope.c Fri May 14 12:34:59 2010 +0200
+++ b/src/lib-sieve/ext-envelope.c Fri May 14 13:08:14 2010 +0200
@@ -288,7 +288,7 @@
static bool tst_envelope_generate
(const struct sieve_codegen_env *cgenv, struct sieve_command *cmd)
{
- (void)sieve_operation_emit(cgenv->sbin, cmd->ext, &envelope_operation);
+ (void)sieve_operation_emit(cgenv->sblock, cmd->ext, &envelope_operation);
/* Generate arguments */
if ( !sieve_generate_arguments(cgenv, cmd, NULL) )
diff -r 5a83e796ec4c -r c932b2d80dd8 src/lib-sieve/ext-fileinto.c
--- a/src/lib-sieve/ext-fileinto.c Fri May 14 12:34:59 2010 +0200
+++ b/src/lib-sieve/ext-fileinto.c Fri May 14 13:08:14 2010 +0200
@@ -123,10 +123,10 @@
static bool cmd_fileinto_generate
(const struct sieve_codegen_env *cgenv, struct sieve_command *cmd)
{
- sieve_operation_emit(cgenv->sbin, cmd->ext, &fileinto_operation);
+ sieve_operation_emit(cgenv->sblock, cmd->ext, &fileinto_operation);
/* Emit line number */
- sieve_code_source_line_emit(cgenv->sbin, sieve_command_source_line(cmd));
+ sieve_code_source_line_emit(cgenv->sblock, sieve_command_source_line(cmd));
/* Generate arguments */
return sieve_generate_arguments(cgenv, cmd, NULL);
diff -r 5a83e796ec4c -r c932b2d80dd8 src/lib-sieve/ext-reject.c
--- a/src/lib-sieve/ext-reject.c Fri May 14 12:34:59 2010 +0200
+++ b/src/lib-sieve/ext-reject.c Fri May 14 13:08:14 2010 +0200
@@ -231,12 +231,12 @@
(const struct sieve_codegen_env *cgenv, struct sieve_command *cmd)
{
if ( sieve_command_is(cmd, reject_command) )
- sieve_operation_emit(cgenv->sbin, cmd->ext, &reject_operation);
+ sieve_operation_emit(cgenv->sblock, cmd->ext, &reject_operation);
else
- sieve_operation_emit(cgenv->sbin, cmd->ext, &ereject_operation);
+ sieve_operation_emit(cgenv->sblock, cmd->ext, &ereject_operation);
/* Emit line number */
- sieve_code_source_line_emit(cgenv->sbin, sieve_command_source_line(cmd));
+ sieve_code_source_line_emit(cgenv->sblock, sieve_command_source_line(cmd));
/* Generate arguments */
return sieve_generate_arguments(cgenv, cmd, NULL);
diff -r 5a83e796ec4c -r c932b2d80dd8 src/lib-sieve/plugins/body/tst-body.c
--- a/src/lib-sieve/plugins/body/tst-body.c Fri May 14 12:34:59 2010 +0200
+++ b/src/lib-sieve/plugins/body/tst-body.c Fri May 14 13:08:14 2010 +0200
@@ -230,7 +230,7 @@
static bool tst_body_generate
(const struct sieve_codegen_env *cgenv, struct sieve_command *cmd)
{
- (void)sieve_operation_emit(cgenv->sbin, cmd->ext, &body_operation);
+ (void)sieve_operation_emit(cgenv->sblock, cmd->ext, &body_operation);
/* Generate arguments */
return sieve_generate_arguments(cgenv, cmd, NULL);
@@ -243,7 +243,7 @@
enum tst_body_transform transform =
(enum tst_body_transform) arg->argument->data;
- sieve_binary_emit_byte(cgenv->sbin, transform);
+ sieve_binary_emit_byte(cgenv->sblock, transform);
sieve_generate_argument_parameters(cgenv, cmd, arg);
return TRUE;
@@ -272,7 +272,7 @@
case SIEVE_MATCH_OPT_END:
break;
case OPT_BODY_TRANSFORM:
- if ( !sieve_binary_read_byte(denv->sbin, address, &transform) )
+ if ( !sieve_binary_read_byte(denv->sblock, address, &transform) )
return FALSE;
switch ( transform ) {
@@ -339,7 +339,7 @@
case SIEVE_MATCH_OPT_END:
break;
case OPT_BODY_TRANSFORM:
- if ( !sieve_binary_read_byte(renv->sbin, address, &transform) ||
+ if ( !sieve_binary_read_byte(renv->sblock, address, &transform) ||
transform > TST_BODY_TRANSFORM_TEXT ) {
sieve_runtime_trace_error(renv, "invalid body transform type");
return SIEVE_EXEC_BIN_CORRUPT;
diff -r 5a83e796ec4c -r c932b2d80dd8 src/lib-sieve/plugins/copy/ext-copy.c
--- a/src/lib-sieve/plugins/copy/ext-copy.c Fri May 14 12:34:59 2010 +0200
+++ b/src/lib-sieve/plugins/copy/ext-copy.c Fri May 14 13:08:14 2010 +0200
@@ -144,7 +144,7 @@
}
sieve_opr_side_effect_emit
- (cgenv->sbin, sieve_argument_ext(arg), ©_side_effect);
+ (cgenv->sblock, sieve_argument_ext(arg), ©_side_effect);
return TRUE;
}
diff -r 5a83e796ec4c -r c932b2d80dd8 src/lib-sieve/plugins/date/tst-date.c
--- a/src/lib-sieve/plugins/date/tst-date.c Fri May 14 12:34:59 2010 +0200
+++ b/src/lib-sieve/plugins/date/tst-date.c Fri May 14 13:08:14 2010 +0200
@@ -298,9 +298,9 @@
(const struct sieve_codegen_env *cgenv, struct sieve_command *tst)
{
if ( sieve_command_is(tst, date_test) )
- sieve_operation_emit(cgenv->sbin, tst->ext, &date_operation);
+ sieve_operation_emit(cgenv->sblock, tst->ext, &date_operation);
else if ( sieve_command_is(tst, currentdate_test) )
- sieve_operation_emit(cgenv->sbin, tst->ext, ¤tdate_operation);
+ sieve_operation_emit(cgenv->sblock, tst->ext, ¤tdate_operation);
else
i_unreached();
@@ -313,7 +313,7 @@
struct sieve_command *cmd)
{
if ( arg->parameters == NULL ) {
- sieve_opr_omitted_emit(cgenv->sbin);
+ sieve_opr_omitted_emit(cgenv->sblock);
return TRUE;
}
@@ -343,7 +343,7 @@
case SIEVE_MATCH_OPT_END:
break;
case OPT_DATE_ZONE:
- if ( !sieve_operand_read(denv->sbin, address, &operand) ) {
+ if ( !sieve_operand_read(denv->sblock, address, &operand) ) {
sieve_code_dumpf(denv, "ERROR: INVALID OPERAND");
return FALSE;
}
@@ -405,7 +405,7 @@
case SIEVE_MATCH_OPT_END:
break;
case OPT_DATE_ZONE:
- if ( !sieve_operand_read(renv->sbin, address, &operand) ) {
+ if ( !sieve_operand_read(renv->sblock, address, &operand) ) {
sieve_runtime_trace_error(renv, "invalid operand");
return SIEVE_EXEC_BIN_CORRUPT;
}
diff -r 5a83e796ec4c -r c932b2d80dd8 src/lib-sieve/plugins/enotify/cmd-notify.c
--- a/src/lib-sieve/plugins/enotify/cmd-notify.c Fri May 14 12:34:59 2010 +0200
+++ b/src/lib-sieve/plugins/enotify/cmd-notify.c Fri May 14 13:08:14 2010 +0200
More information about the dovecot-cvs
mailing list