[master] 51a5d55 Beautify the compiled VCL a bit

Poul-Henning Kamp phk at FreeBSD.org
Mon Jun 2 11:35:38 CEST 2014


commit 51a5d55314401d142ccd5c1cae0a9262d4dabefa
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jun 2 08:56:55 2014 +0000

    Beautify the compiled VCL a bit

diff --git a/lib/libvcc/generate.py b/lib/libvcc/generate.py
index c3b51ff..75649db 100755
--- a/lib/libvcc/generate.py
+++ b/lib/libvcc/generate.py
@@ -726,7 +726,7 @@ def emit_file(fo, fd, bn):
 	x = 0
 	l = 0
 	fo.write("\n\t/* %s */\n\n" % fn)
-	fo.write('\tVSB_cat(sb, "/* ---===### %s ###===--- */\\n");\n' % bn)
+	fo.write('\tVSB_cat(sb, "/* ---===### %s ###===--- */\\n\\n");\n' % bn)
 	for c in fc:
 		if l == 0:
 			fo.write("\tVSB_cat(sb, \"")
@@ -764,9 +764,10 @@ def emit_file(fo, fd, bn):
 			fo.write("\"\n")
 			x = 0
 	if x != 0:
-		fo.write("\"")
+		fo.write("\"\n")
 	if l != 0:
 		fo.write("\t);\n")
+	fo.write('\tVSB_cat(sb, "\\n");\n')
 
 #######################################################################
 
diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c
index 81a7620..31212aa 100644
--- a/lib/libvcc/vcc_compile.c
+++ b/lib/libvcc/vcc_compile.c
@@ -597,7 +597,7 @@ vcc_CompileSource(const struct vcc *tl0, struct vsb *sb, struct source *sp)
 	sym->wildcard = vcc_Stv_Wildcard;
 
 	vcl_output_lang_h(tl->fh);
-	Fh(tl, 0, "\n/* ---===### VCC generated code ###===---*/\n");
+	Fh(tl, 0, "/* ---===### VCC generated code ###===---*/\n");
 	Fh(tl, 0, "\nextern const struct VCL_conf VCL_conf;\n");
 
 	/* Macro for accessing directors */
diff --git a/lib/libvcc/vcc_vmod.c b/lib/libvcc/vcc_vmod.c
index 044cd24..1723007 100644
--- a/lib/libvcc/vcc_vmod.c
+++ b/lib/libvcc/vcc_vmod.c
@@ -104,8 +104,6 @@ vcc_ParseImport(struct vcc *tl)
 		bprintf(fn, "%s/libvmod_%.*s.so", tl->vmod_dir, PF(mod));
 	}
 
-	Fh(tl, 0, "static void *VGC_vmod_%.*s;\n", PF(mod));
-
 	ifp = New_IniFin(tl);
 
 	VSB_printf(ifp->ini, "\tif (VRT_Vmod_Init(&VGC_vmod_%.*s,\n", PF(mod));
@@ -177,7 +175,6 @@ vcc_ParseImport(struct vcc *tl)
 		vcc_ErrWhere(tl, mod);
 		return;
 	}
-	Fh(tl, 0, "static struct vmod_priv vmod_priv_%.*s;\n", PF(mod));
 	for (; *spec != NULL; spec++) {
 		p = *spec;
 		if (!strcmp(p, "OBJ")) {
@@ -207,5 +204,10 @@ vcc_ParseImport(struct vcc *tl)
 				sym->kind = SYM_PROC;
 		}
 	}
+
+	Fh(tl, 0, "\n/* --- BEGIN VMOD %.*s --- */\n\n", PF(mod));
+	Fh(tl, 0, "static void *VGC_vmod_%.*s;\n", PF(mod));
+	Fh(tl, 0, "static struct vmod_priv vmod_priv_%.*s;\n", PF(mod));
 	Fh(tl, 0, "\n%s\n", proto);
+	Fh(tl, 0, "\n/* --- END VMOD %.*s --- */\n\n", PF(mod));
 }



More information about the varnish-commit mailing list