Commit 3f9ca3fc authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Assign VMODS unique numbers, and make the count part of the VGC metadata

parent b5aaa542
......@@ -666,6 +666,8 @@ struct VCL_conf {
const char **srcname;
const char **srcbody;
unsigned nvmod;
vcl_event_f *event_vcl;
""")
......
......@@ -424,6 +424,7 @@ EmitStruct(const struct vcc *tl)
Fc(tl, 0, "\t.nsrc = VGC_NSRCS,\n");
Fc(tl, 0, "\t.srcname = srcname,\n");
Fc(tl, 0, "\t.srcbody = srcbody,\n");
Fc(tl, 0, "\t.nvmod = %u,\n", tl->vmod_count);
#define VCL_MET_MAC(l,u,t,b) \
Fc(tl, 0, "\t." #l "_func = VGC_function_vcl_" #l ",\n");
#include "tbl/vcl_returns.h"
......
......@@ -252,7 +252,7 @@ struct vcc {
const char *default_probe;
unsigned unique;
unsigned vmod_count;
};
struct method {
......
......@@ -336,6 +336,7 @@ vcc_ParseImport(struct vcc *tl)
vcc_json_always(tl, msym);
Fh(tl, 0, "\n/* --- BEGIN VMOD %.*s --- */\n\n", PF(mod));
Fh(tl, 0, "#define VMOD_NUMBER_%.*s %u\n", PF(mod), tl->vmod_count++);
Fh(tl, 0, "static struct vmod *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", vmd->proto);
......
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