From 30c80502be6ccc5895d9c2ed492bf83e036b4d33 Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan@rename-it.nl>
Date: Sat, 17 Nov 2007 11:50:15 +0100
Subject: [PATCH] Updated README and a few minor cosmetic changes to the code.

---
 README                                        | 48 ++++++++++++-------
 .../ext-cmp-i-ascii-numeric.c                 |  2 +-
 src/lib-sieve/plugins/vacation/ext-vacation.c | 14 +++++-
 src/lib-sieve/sieve-comparators.c             | 10 ++--
 4 files changed, 48 insertions(+), 26 deletions(-)

diff --git a/README b/README
index 09d3c7a63..605c65ed5 100644
--- a/README
+++ b/README
@@ -5,37 +5,47 @@ This package is currently not built for installation. To test the sieve
 engine it is currently only useful to execute the binaries in the 
 src/sieve-bin/ directory:
 
-sievec <sieve-file>:
+sievec <sieve-file>
 
 Compiles the script and produces various dumps of intermittent compilation
 results. This already works pretty good for all supported features.
 
-sieve_test <sieve-file>:
+sieve_test <sieve-file>
 
 Reads mail message from standard input and executes the sieve script to
 produce a verdict. Currently only prints an execution dump with the 
 instructions encountered during execution.
 
-In the directory ./sieve various example are test scripts are bundled. 
+In the directory ./sieve various example scripts are bundled. 
 
-FEATURES
+Features
 --------
 
 * Well-structured 3-stage compiler; uses dovecot framework and avoids using
-  lex/yucc. 
+  lex/yucc. Parser doesn't bail on first error, but tries to find more.
 * Highly extendable with new sieve capabilities. This keeps the possibility
-  of plugins in mind. Should provide the necessary infrastructure for at least
-  all currently known (proposed) extensions. 
+  of plugins in mind. Should eventually provide the necessary infrastructure for 
+  at least all currently known (proposed) extensions.  
 
 What works:
-* Scripts can be parsed.
+* Scripts can be parsed, the grammar is fully supported. 
 * Script validation (contextual analysis) works almost completely.
 * Script code generation works for most core commands with exception
-  of match-related arguments. Comparators already work somewhat though
-* Interpreter runs and dumps core commands and tests. It is not possible
-  to specify alternative addr-parts or match-types yet though
-
-DESIGN
+  of match-type arguments. Comparators and address-part modifiers already work.
+* Interpreter runs and dumps core commands and tests. Comparators and 
+  address-part modifiers have the desired effect. Match types other than :is are
+  not supported yet. Action commands have no effect. 
+ 
+Implemented extensions:
+	subaddress: full
+	comparator-i;ascii-numeric: full, but fails to handle leading zeros
+	vacation: validation and generation only. Execution is broken.
+	
+Other extensionsions will be added a soon as the necessary infrastructure is 
+available. Extensions supported by cmu-sieve have priority, although variables 
+might be implemented somewhere in between. 
+
+Design
 ------
 
 The compiler consists of the following stages:
@@ -62,14 +72,16 @@ INTERPRETER: sieve-interpreter.c
 TODO
 ----
 
-* Implement address-part execution
 * Implement match-type execution
-* Produce a fully working interpreter that actually executes actions
+* Produce a fully working interpreter that actually executes actions, currently
+  tests are evaluated and actions just print their occurence.
 * Give the binary format some more thought, it is currently quite rough and
   to the point. 
-* Produce a substitute sieve plugin for deliver (currently a stub)
-* Automate script tests
+* Produce a substitute sieve plugin for deliver (currently a stub and not 
+  part of the make process)
+* Automate script tests; i.e. build a test suite.
 * Use mmap for the binary script representation. 
 * Allow the currently in-memory byte-code to be stored as a script binary
-* Use dovecot streams for code dump
+* Use dovecot streams for code dump (debugging), currently the code is riddled 
+  with printf()s. 
 
diff --git a/src/lib-sieve/plugins/comparator-i-ascii-numeric/ext-cmp-i-ascii-numeric.c b/src/lib-sieve/plugins/comparator-i-ascii-numeric/ext-cmp-i-ascii-numeric.c
index 6ecb10294..69d79a1f0 100644
--- a/src/lib-sieve/plugins/comparator-i-ascii-numeric/ext-cmp-i-ascii-numeric.c
+++ b/src/lib-sieve/plugins/comparator-i-ascii-numeric/ext-cmp-i-ascii-numeric.c
@@ -3,7 +3,7 @@
  *
  * Author: Stephan Bosch
  * Specification: RFC 2244
- * Implementation: 
+ * Implementation: full, but fails to handle leading zeros.
  * Status: experimental, largely untested
  * 
  */
diff --git a/src/lib-sieve/plugins/vacation/ext-vacation.c b/src/lib-sieve/plugins/vacation/ext-vacation.c
index 616c2652f..085a1c5d1 100644
--- a/src/lib-sieve/plugins/vacation/ext-vacation.c
+++ b/src/lib-sieve/plugins/vacation/ext-vacation.c
@@ -1,3 +1,13 @@
+/* Extension vacation
+ * ------------------
+ *
+ * Author: Stephan Bosch
+ * Specification: draft-ietf-sieve-vacation-07
+ * Implementation: validation and generation work, no interpretation/execution.
+ * Status: under development
+ * 
+ */
+
 #include <stdio.h>
 
 #include "sieve-common.h"
@@ -274,8 +284,8 @@ static bool cmd_vacation_generate
 	sieve_generator_emit_opcode_ext(generator, ext_my_id);
 
 	/* Generate arguments */
-    if ( !sieve_generate_arguments(generator, ctx, NULL) )
-        return FALSE;	
+	if ( !sieve_generate_arguments(generator, ctx, NULL) )
+		return FALSE;	
 
 	return TRUE;
 }
diff --git a/src/lib-sieve/sieve-comparators.c b/src/lib-sieve/sieve-comparators.c
index c79f3bec7..c153243f2 100644
--- a/src/lib-sieve/sieve-comparators.c
+++ b/src/lib-sieve/sieve-comparators.c
@@ -61,7 +61,7 @@ static bool cmp_extension_load(int ext_id)
 
 /* 
  * Validator context:
- *   name-based address-part registry. 
+ *   name-based comparator registry. 
  *
  * FIXME: This code will be duplicated across all extensions that introduce 
  * a registry of some kind in the validator. 
@@ -69,7 +69,7 @@ static bool cmp_extension_load(int ext_id)
  
 struct cmp_validator_registration {
 	int ext_id;
-	const struct sieve_comparator *address_part;
+	const struct sieve_comparator *comparator;
 };
  
 struct cmp_validator_context {
@@ -90,7 +90,7 @@ static void _sieve_comparator_register
 	struct cmp_validator_registration *reg;
 	
 	reg = p_new(pool, struct cmp_validator_registration, 1);
-	reg->address_part = cmp;
+	reg->comparator = cmp;
 	reg->ext_id = ext_id;
 	
 	hash_insert(ctx->registrations, (void *) cmp->identifier, (void *) reg);
@@ -130,11 +130,11 @@ bool cmp_validator_load(struct sieve_validator *validator)
 	struct cmp_validator_context *ctx = 
 		p_new(pool, struct cmp_validator_context, 1);
 	
-	/* Setup address-part registry */
+	/* Setup comparator registry */
 	ctx->registrations = hash_create
 		(pool, pool, 0, str_hash, (hash_cmp_callback_t *)strcmp);
 
-	/* Register core address-parts */
+	/* Register core comparators */
 	for ( i = 0; i < sieve_core_comparators_count; i++ ) {
 		const struct sieve_comparator *cmp = sieve_core_comparators[i];
 		
-- 
GitLab