diff --git a/src/lib-sieve/plugins/include/cmd-import.c b/src/lib-sieve/plugins/include/cmd-import.c index 00ff3a8a4a6180362e41cf84d2a3a152978cc521..cacab7da64f95298bd7920f28084c2745a55c48a 100644 --- a/src/lib-sieve/plugins/include/cmd-import.c +++ b/src/lib-sieve/plugins/include/cmd-import.c @@ -1,3 +1,6 @@ +/* Copyright (c) 2002-2008 Dovecot Sieve authors, see the included COPYING file + */ + #include "lib.h" #include "sieve-common.h" diff --git a/src/lib-sieve/plugins/include/cmd-include.c b/src/lib-sieve/plugins/include/cmd-include.c index 85ad0a5da96822b34497ecc65ced068f642a0ccc..e150a4422c6f7af90fa10cc27638078d4de168ea 100644 --- a/src/lib-sieve/plugins/include/cmd-include.c +++ b/src/lib-sieve/plugins/include/cmd-include.c @@ -1,3 +1,6 @@ +/* Copyright (c) 2002-2008 Dovecot Sieve authors, see the included COPYING file + */ + #include "lib.h" #include "str-sanitize.h" @@ -77,7 +80,7 @@ struct cmd_include_context_data { }; /* - * Tags + * Tagged arguments */ static bool cmd_include_validate_location_tag @@ -111,7 +114,8 @@ static bool cmd_include_validate_location_tag if ( ctx_data->location_assigned) { sieve_command_validate_error(validator, cmd, - "include: cannot use location tags ':personal' and ':global' multiple times"); + "include: cannot use location tags ':personal' and ':global' " + "multiple times"); return FALSE; } @@ -186,13 +190,13 @@ static bool cmd_include_validate(struct sieve_validator *validator, "include: '/' not allowed in script name (%s)", str_sanitize(script_name, 80)); return FALSE; - } + } script_dir = ext_include_get_script_directory (ctx_data->location, script_name); if ( script_dir == NULL ) { sieve_command_validate_error(validator, cmd, - "include: specified location for included script '%s' is unavailable " + "include: specified location for included script '%s' is unavailable " "(system logs should provide more information)", str_sanitize(script_name, 80)); return FALSE; diff --git a/src/lib-sieve/plugins/include/cmd-return.c b/src/lib-sieve/plugins/include/cmd-return.c index 37ebc4396792e9ac1f5060b5a8428d0bb9695efc..335d6d0a9e75e62c65438eade281e9d55c779a0b 100644 --- a/src/lib-sieve/plugins/include/cmd-return.c +++ b/src/lib-sieve/plugins/include/cmd-return.c @@ -1,3 +1,6 @@ +/* Copyright (c) 2002-2008 Dovecot Sieve authors, see the included COPYING file + */ + #include "lib.h" #include "sieve-code.h" diff --git a/src/lib-sieve/plugins/include/ext-include-binary.c b/src/lib-sieve/plugins/include/ext-include-binary.c index 8815f977acbe634abd21fe910099f68710fc587f..530243ac6367ede350b9dd98792559a606705945 100644 --- a/src/lib-sieve/plugins/include/ext-include-binary.c +++ b/src/lib-sieve/plugins/include/ext-include-binary.c @@ -1,3 +1,6 @@ +/* Copyright (c) 2002-2008 Dovecot Sieve authors, see the included COPYING file + */ + #include "lib.h" #include "str.h" @@ -16,20 +19,6 @@ #include "ext-include-variables.h" #include "ext-include-binary.h" -/* - * Types - */ - -struct ext_include_binary_context { - struct sieve_binary *binary; - unsigned int dependency_block; - - struct hash_table *included_scripts; - ARRAY_DEFINE(include_index, struct ext_include_script_info *); - - struct sieve_variable_scope *global_vars; -}; - /* * Forward declarations */ @@ -55,6 +44,17 @@ const struct sieve_binary_extension include_binary_ext = { * Binary context management */ +struct ext_include_binary_context { + struct sieve_binary *binary; + unsigned int dependency_block; + + struct hash_table *included_scripts; + ARRAY_DEFINE(include_index, struct ext_include_script_info *); + + struct sieve_variable_scope *global_vars; +}; + + static struct ext_include_binary_context *ext_include_binary_create_context (struct sieve_binary *sbin) { @@ -85,10 +85,6 @@ struct ext_include_binary_context *ext_include_binary_get_context return ctx; } - -/* - * Binary include implementation - */ struct ext_include_binary_context *ext_include_binary_init (struct sieve_binary *sbin, struct sieve_ast *ast) @@ -351,6 +347,10 @@ static void ext_include_binary_free(struct sieve_binary *sbin) } +/* + * Dumping the binary + */ + inline static const char *_script_location (enum ext_include_script_location loc) { diff --git a/src/lib-sieve/plugins/include/ext-include-binary.h b/src/lib-sieve/plugins/include/ext-include-binary.h index f50cbd032d4ab2e636f9c3bc772a57ed9a77a2a3..7f5988ff08b72b02c04618e97422cfdd9e06a039 100644 --- a/src/lib-sieve/plugins/include/ext-include-binary.h +++ b/src/lib-sieve/plugins/include/ext-include-binary.h @@ -1,3 +1,6 @@ +/* Copyright (c) 2002-2008 Dovecot Sieve authors, see the included COPYING file + */ + #ifndef __EXT_INCLUDE_BINARY_H #define __EXT_INCLUDE_BINARY_H @@ -48,6 +51,10 @@ const struct ext_include_script_info *ext_include_binary_script_get unsigned int ext_include_binary_script_get_count (struct ext_include_binary_context *binctx); +/* + * Dumping the binary + */ + bool ext_include_binary_dump(struct sieve_dumptime_env *denv); #endif /* __EXT_INCLUDE_BINARY_H */ diff --git a/src/lib-sieve/plugins/include/ext-include-common.c b/src/lib-sieve/plugins/include/ext-include-common.c index 4f685a2ab6a1c49b83163c4c624c238479b879d0..19538aad72ebbf814916ab4a8d3d5e8d3e698abf 100644 --- a/src/lib-sieve/plugins/include/ext-include-common.c +++ b/src/lib-sieve/plugins/include/ext-include-common.c @@ -1,3 +1,6 @@ +/* Copyright (c) 2002-2008 Dovecot Sieve authors, see the included COPYING file + */ + #include "lib.h" #include "str-sanitize.h" @@ -327,7 +330,7 @@ struct sieve_variable_storage *ext_include_interpreter_get_global_variables } /* - * Including a script during generation + * Including a script during code generation */ bool ext_include_generate_include diff --git a/src/lib-sieve/plugins/include/ext-include-common.h b/src/lib-sieve/plugins/include/ext-include-common.h index 018129b0a8c2d223608943e8f5f8b2bffa2ff27d..fa3426df4b2f88622e318705d465ce095e86418f 100644 --- a/src/lib-sieve/plugins/include/ext-include-common.h +++ b/src/lib-sieve/plugins/include/ext-include-common.h @@ -1,3 +1,6 @@ +/* Copyright (c) 2002-2008 Dovecot Sieve authors, see the included COPYING file + */ + #ifndef __EXT_INCLUDE_COMMON_H #define __EXT_INCLUDE_COMMON_H diff --git a/src/lib-sieve/plugins/include/ext-include-limits.h b/src/lib-sieve/plugins/include/ext-include-limits.h index eaa9c26a89ce8e5918e2e76a2244de2b3fba435a..b89ae27457dee8737cb0b447cc3f56ffbc2e28e8 100644 --- a/src/lib-sieve/plugins/include/ext-include-limits.h +++ b/src/lib-sieve/plugins/include/ext-include-limits.h @@ -1,3 +1,6 @@ +/* Copyright (c) 2002-2008 Dovecot Sieve authors, see the included COPYING file + */ + #ifndef __EXT_INCLUDE_LIMITS_H #define __EXT_INCLUDE_LIMITS_H diff --git a/src/lib-sieve/plugins/include/ext-include-variables.c b/src/lib-sieve/plugins/include/ext-include-variables.c index ae1ff529503a4bf5e7d63ff398c613dfbb0fe0eb..6726fc8130e4c48e50eb3ca9ff886cf2770c3b9f 100644 --- a/src/lib-sieve/plugins/include/ext-include-variables.c +++ b/src/lib-sieve/plugins/include/ext-include-variables.c @@ -1,3 +1,6 @@ +/* Copyright (c) 2002-2008 Dovecot Sieve authors, see the included COPYING file + */ + #include "sieve-common.h" #include "sieve-error.h" #include "sieve-script.h" @@ -106,14 +109,16 @@ struct sieve_variable *ext_include_variable_import_global varctx = p_new(pool, struct ext_include_variable, 1); varctx->type = EXT_INCLUDE_VAR_IMPORTED; - varctx->source_line = cmd->ast_node->source_line; impvar->context = varctx; } return var; } - +/* + * Binary symbol table + */ + bool ext_include_variables_save (struct sieve_binary *sbin, struct sieve_variable_scope *global_vars) { diff --git a/src/lib-sieve/plugins/include/ext-include-variables.h b/src/lib-sieve/plugins/include/ext-include-variables.h index 6458b8381bd7a040f60a0021da68405522d279ff..3a0e4185c2778a9c5fcc5be226145f73e591dc65 100644 --- a/src/lib-sieve/plugins/include/ext-include-variables.h +++ b/src/lib-sieve/plugins/include/ext-include-variables.h @@ -1,3 +1,6 @@ +/* Copyright (c) 2002-2008 Dovecot Sieve authors, see the included COPYING file + */ + #ifndef __EXT_INCLUDE_VARIABLES_H #define __EXT_INCLUDE_VARIABLES_H diff --git a/src/lib-sieve/plugins/include/ext-include.c b/src/lib-sieve/plugins/include/ext-include.c index b1b7b09518f22c68bf6d09c7f86312b9aba58c60..dabcf913cfd0a0b8166230c6dfbaf49843629820 100644 --- a/src/lib-sieve/plugins/include/ext-include.c +++ b/src/lib-sieve/plugins/include/ext-include.c @@ -1,3 +1,6 @@ +/* Copyright (c) 2002-2008 Dovecot Sieve authors, see the included COPYING file + */ + /* Extension include * ----------------- * @@ -27,15 +30,9 @@ #include "ext-include-common.h" #include "ext-include-binary.h" -/* Forward declarations */ - -static bool ext_include_load(int ext_id); -static bool ext_include_validator_load(struct sieve_validator *validator); -static bool ext_include_generator_load(const struct sieve_codegen_env *cgenv); -static bool ext_include_binary_load(struct sieve_binary *sbin); -static bool ext_include_interpreter_load(struct sieve_interpreter *interp); - -/* Operations */ +/* + * Operations + */ static const struct sieve_operation *ext_include_operations[] = { &include_operation, @@ -44,7 +41,19 @@ static const struct sieve_operation *ext_include_operations[] = { &export_operation }; -/* Extension definitions */ +/* + * Extension + */ + +/* Forward declaration */ + +static bool ext_include_load(int ext_id); +static bool ext_include_validator_load(struct sieve_validator *validator); +static bool ext_include_generator_load(const struct sieve_codegen_env *cgenv); +static bool ext_include_binary_load(struct sieve_binary *sbin); +static bool ext_include_interpreter_load(struct sieve_interpreter *interp); + +/* Extension objects */ static int ext_my_id; @@ -61,6 +70,8 @@ const struct sieve_extension include_extension = { SIEVE_EXT_DEFINE_NO_OPERANDS }; +/* Extension hooks */ + static bool ext_include_load(int ext_id) { ext_my_id = ext_id; @@ -68,8 +79,6 @@ static bool ext_include_load(int ext_id) return TRUE; } -/* Load extension into validator */ - static bool ext_include_validator_load(struct sieve_validator *validator) { /* Register new commands */ @@ -81,8 +90,6 @@ static bool ext_include_validator_load(struct sieve_validator *validator) return TRUE; } -/* Load extension into generator */ - static bool ext_include_generator_load(const struct sieve_codegen_env *cgenv) { ext_include_register_generator_context(cgenv); @@ -90,8 +97,6 @@ static bool ext_include_generator_load(const struct sieve_codegen_env *cgenv) return TRUE; } -/* Load extension into interpreter */ - static bool ext_include_interpreter_load (struct sieve_interpreter *interp) { @@ -100,8 +105,6 @@ static bool ext_include_interpreter_load return TRUE; } -/* Load extension into binary */ - static bool ext_include_binary_load(struct sieve_binary *sbin) { /* Register extension to the binary object to get notified of events like