Commit 51a5d553 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Beautify the compiled VCL a bit

parent 5f67a2e4
...@@ -726,7 +726,7 @@ def emit_file(fo, fd, bn): ...@@ -726,7 +726,7 @@ def emit_file(fo, fd, bn):
x = 0 x = 0
l = 0 l = 0
fo.write("\n\t/* %s */\n\n" % fn) 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: for c in fc:
if l == 0: if l == 0:
fo.write("\tVSB_cat(sb, \"") fo.write("\tVSB_cat(sb, \"")
...@@ -764,9 +764,10 @@ def emit_file(fo, fd, bn): ...@@ -764,9 +764,10 @@ def emit_file(fo, fd, bn):
fo.write("\"\n") fo.write("\"\n")
x = 0 x = 0
if x != 0: if x != 0:
fo.write("\"") fo.write("\"\n")
if l != 0: if l != 0:
fo.write("\t);\n") fo.write("\t);\n")
fo.write('\tVSB_cat(sb, "\\n");\n')
####################################################################### #######################################################################
......
...@@ -597,7 +597,7 @@ vcc_CompileSource(const struct vcc *tl0, struct vsb *sb, struct source *sp) ...@@ -597,7 +597,7 @@ vcc_CompileSource(const struct vcc *tl0, struct vsb *sb, struct source *sp)
sym->wildcard = vcc_Stv_Wildcard; sym->wildcard = vcc_Stv_Wildcard;
vcl_output_lang_h(tl->fh); 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"); Fh(tl, 0, "\nextern const struct VCL_conf VCL_conf;\n");
/* Macro for accessing directors */ /* Macro for accessing directors */
......
...@@ -104,8 +104,6 @@ vcc_ParseImport(struct vcc *tl) ...@@ -104,8 +104,6 @@ vcc_ParseImport(struct vcc *tl)
bprintf(fn, "%s/libvmod_%.*s.so", tl->vmod_dir, PF(mod)); 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); ifp = New_IniFin(tl);
VSB_printf(ifp->ini, "\tif (VRT_Vmod_Init(&VGC_vmod_%.*s,\n", PF(mod)); VSB_printf(ifp->ini, "\tif (VRT_Vmod_Init(&VGC_vmod_%.*s,\n", PF(mod));
...@@ -177,7 +175,6 @@ vcc_ParseImport(struct vcc *tl) ...@@ -177,7 +175,6 @@ vcc_ParseImport(struct vcc *tl)
vcc_ErrWhere(tl, mod); vcc_ErrWhere(tl, mod);
return; return;
} }
Fh(tl, 0, "static struct vmod_priv vmod_priv_%.*s;\n", PF(mod));
for (; *spec != NULL; spec++) { for (; *spec != NULL; spec++) {
p = *spec; p = *spec;
if (!strcmp(p, "OBJ")) { if (!strcmp(p, "OBJ")) {
...@@ -207,5 +204,10 @@ vcc_ParseImport(struct vcc *tl) ...@@ -207,5 +204,10 @@ vcc_ParseImport(struct vcc *tl)
sym->kind = SYM_PROC; 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%s\n", proto);
Fh(tl, 0, "\n/* --- END VMOD %.*s --- */\n\n", PF(mod));
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment