r5007 - in trunk/varnish-cache: include lib/libvcl

phk at varnish-cache.org phk at varnish-cache.org
Mon Jul 5 11:37:53 CEST 2010


Author: phk
Date: 2010-07-05 11:37:53 +0200 (Mon, 05 Jul 2010)
New Revision: 5007

Modified:
   trunk/varnish-cache/include/vcl.h
   trunk/varnish-cache/lib/libvcl/generate.py
   trunk/varnish-cache/lib/libvcl/vcc_compile.c
   trunk/varnish-cache/lib/libvcl/vcc_compile.h
   trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c
Log:
Polishing



Modified: trunk/varnish-cache/include/vcl.h
===================================================================
--- trunk/varnish-cache/include/vcl.h	2010-07-05 08:27:30 UTC (rev 5006)
+++ trunk/varnish-cache/include/vcl.h	2010-07-05 09:37:53 UTC (rev 5007)
@@ -27,6 +27,8 @@
 
 #define VCL_MET_MAX		9
 
+#define VCL_MET_MASK		0x1ff
+
 /* VCL Returns */
 #define VCL_RET_DELIVER		0
 #define VCL_RET_ERROR		1

Modified: trunk/varnish-cache/lib/libvcl/generate.py
===================================================================
--- trunk/varnish-cache/lib/libvcl/generate.py	2010-07-05 08:27:30 UTC (rev 5006)
+++ trunk/varnish-cache/lib/libvcl/generate.py	2010-07-05 09:37:53 UTC (rev 5007)
@@ -650,6 +650,7 @@
 	n += 1
 
 fo.write("\n#define VCL_MET_MAX\t\t%d\n" % n)
+fo.write("\n#define VCL_MET_MASK\t\t0x%x\n" % ((1 << n) - 1))
 
 
 fo.write("\n/* VCL Returns */\n")

Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_compile.c	2010-07-05 08:27:30 UTC (rev 5006)
+++ trunk/varnish-cache/lib/libvcl/vcc_compile.c	2010-07-05 09:37:53 UTC (rev 5007)
@@ -114,6 +114,7 @@
 {
 	struct method *m;
 
+	assert(t->tok == ID);
 	for(m = method_tab; m->name != NULL; m++) {
 		if (vcc_IdIs(t, m->name))
 			return (m - method_tab);

Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.h
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_compile.h	2010-07-05 08:27:30 UTC (rev 5006)
+++ trunk/varnish-cache/lib/libvcl/vcc_compile.h	2010-07-05 09:37:53 UTC (rev 5007)
@@ -86,8 +86,15 @@
 	int			iindent;
 	int			findent;
 	unsigned		cnt;
-	struct vsb		*fc, *fh, *fi, *ff, *fb;
-	struct vsb		*fm[VCL_MET_MAX];
+
+	struct vsb		*fc;		/* C-code */
+	struct vsb		*fh;		/* H-code (before C-code) */
+	struct vsb		*fi;		/* Init func code */
+	struct vsb		*ff;		/* Finish func code */
+	struct vsb		*fb;		/* Body of current sub
+						 * NULL otherwise
+						 */
+	struct vsb		*fm[VCL_MET_MAX];	/* Method bodies */
 	VTAILQ_HEAD(, ref)	refs;
 	struct vsb		*sb;
 	int			err;

Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c	2010-07-05 08:27:30 UTC (rev 5006)
+++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c	2010-07-05 09:37:53 UTC (rev 5007)
@@ -171,14 +171,15 @@
 	    "#define VCL_MET_HIT\t\t(1U << 5)\n#define VCL_MET_FETCH\t\t"
 	    "(1U << 6)\n#define VCL_MET_DELIVER\t\t(1U << 7)\n"
 	    "#define VCL_MET_ERROR\t\t(1U << 8)\n\n#define VCL_MET_MAX\t"
-	    "\t9\n\n/* VCL Returns */\n#define VCL_RET_DELIVER\t\t0\n"
-	    "#define VCL_RET_ERROR\t\t1\n#define VCL_RET_FETCH\t\t2\n"
-	    "#define VCL_RET_HASH\t\t3\n#define VCL_RET_LOOKUP\t\t4\n"
-	    "#define VCL_RET_PASS\t\t5\n#define VCL_RET_PIPE\t\t6\n"
-	    "#define VCL_RET_RESTART\t\t7\n\n#define VCL_RET_MAX\t\t8\n"
-	    "\nstruct VCL_conf {\n\tunsigned\tmagic;\n#define VCL_CONF_MAGIC\t"
-	    "0x7406c509\t/* from /dev/random */\n\n\tstruct director\t**direc"
-	    "tor;\n\tunsigned\tndirector;\n\tstruct vrt_ref\t*ref;\n"
+	    "\t9\n\n#define VCL_MET_MASK\t\t0x1ff\n\n/* VCL Returns */\n"
+	    "#define VCL_RET_DELIVER\t\t0\n#define VCL_RET_ERROR\t\t1\n"
+	    "#define VCL_RET_FETCH\t\t2\n#define VCL_RET_HASH\t\t3\n"
+	    "#define VCL_RET_LOOKUP\t\t4\n#define VCL_RET_PASS\t\t5\n"
+	    "#define VCL_RET_PIPE\t\t6\n#define VCL_RET_RESTART\t\t7\n"
+	    "\n#define VCL_RET_MAX\t\t8\n\nstruct VCL_conf {\n"
+	    "\tunsigned\tmagic;\n#define VCL_CONF_MAGIC\t0x7406c509\t/* "
+	    "from /dev/random */\n\n\tstruct director\t**director;\n"
+	    "\tunsigned\tndirector;\n\tstruct vrt_ref\t*ref;\n"
 	    "\tunsigned\tnref;\n\tunsigned\tbusy;\n\tunsigned\tdiscard;\n"
 	    "\n\tunsigned\tnsrc;\n\tconst char\t**srcname;\n\tconst char\t"
 	    "**srcbody;\n\n\tvcl_init_f\t*init_func;\n\tvcl_fini_f\t*fini_fun"




More information about the varnish-commit mailing list