struct VCL_conf *VCL_Get(void);
int VCL_Load(const char *fn, const char *name, struct cli *cli);
-#define VCL_RET_MAC(l,u,b)
+#define VCL_RET_MAC(l,u,b,n)
#define VCL_MET_MAC(l,u,b) void VCL_##l##_method(struct sess *);
#include "vcl_returns.h"
#undef VCL_MET_MAC
{
switch (u) {
-#define VCL_RET_MAC(a, b, c) case VCL_RET_##b: return(#a);
-#define VCL_RET_MAC_E(a, b, c) case VCL_RET_##b: return(#a);
+#define VCL_RET_MAC(a, b, c,d) case VCL_RET_##b: return(#a);
+#define VCL_RET_MAC_E(a, b, c,d) case VCL_RET_##b: return(#a);
#include "vcl_returns.h"
#undef VCL_RET_MAC
#undef VCL_RET_MAC_E
}
}
-#define VCL_RET_MAC(l,u,b)
+#define VCL_RET_MAC(l,u,b,n)
#define VCL_MET_MAC(func, xxx, bitmap) \
void \
/*
- * $Id$
+ * $Id: vcc_gen_fixed_token.tcl 545 2006-07-21 20:43:56Z phk $
*
* NB: This file is machine generated, DO NOT EDIT!
*
#ifdef VCL_RET_MAC
#ifdef VCL_RET_MAC_E
-VCL_RET_MAC_E(error, ERROR, 0)
+VCL_RET_MAC_E(error, ERROR, (1 << 0), 0)
#endif
-VCL_RET_MAC(lookup, LOOKUP, (1 << 1))
-VCL_RET_MAC(pipe, PIPE, (1 << 2))
-VCL_RET_MAC(pass, PASS, (1 << 3))
-VCL_RET_MAC(insert_pass, INSERT_PASS, (1 << 4))
-VCL_RET_MAC(fetch, FETCH, (1 << 5))
-VCL_RET_MAC(insert, INSERT, (1 << 6))
-VCL_RET_MAC(deliver, DELIVER, (1 << 7))
-VCL_RET_MAC(discard, DISCARD, (1 << 8))
+VCL_RET_MAC(lookup, LOOKUP, (1 << 1), 1)
+VCL_RET_MAC(pipe, PIPE, (1 << 2), 2)
+VCL_RET_MAC(pass, PASS, (1 << 3), 3)
+VCL_RET_MAC(insert_pass, INSERT_PASS, (1 << 4), 4)
+VCL_RET_MAC(fetch, FETCH, (1 << 5), 5)
+VCL_RET_MAC(insert, INSERT, (1 << 6), 6)
+VCL_RET_MAC(deliver, DELIVER, (1 << 7), 7)
+VCL_RET_MAC(discard, DISCARD, (1 << 8), 8)
#else
#define VCL_RET_ERROR (1 << 0)
#define VCL_RET_LOOKUP (1 << 1)
#define ERRCHK(tl) do { if ((tl)->err) return; } while (0)
+static struct method method_tab[] = {
+#define VCL_RET_MAC(a,b,c,d)
+#define VCL_MET_MAC(a,b,c) { "vcl_"#a, "default_vcl_"#a, c },
+#include "vcl_returns.h"
+#undef VCL_MET_MAC
+#undef VCL_RET_MAC
+ { NULL, 0U }
+};
+
/*--------------------------------------------------------------------*/
static void Compound(struct tokenlist *tl);
struct token *t;
t = calloc(sizeof *t, 1);
+ assert(t != NULL);
t->b = s;
t->e = strchr(s, '\0');
t->tok = METHOD;
case T_NO_CACHE:
Fc(tl, 1, "VCL_no_cache(sp);\n");
return;
-#define VCL_RET_MAC(a,b,c) case T_##b: \
+#define VCL_RET_MAC(a,b,c,d) case T_##b: \
Fc(tl, 1, "VRT_done(sp, VCL_RET_%s);\n", #b); \
tl->curproc->returns |= VCL_RET_##b; \
- tl->curproc->returnt[c] = at; \
+ tl->curproc->returnt[d] = at; \
return;
#include "vcl_returns.h"
#undef VCL_RET_MAC
}
u = p->returns & ~returns;
if (u) {
-#define VCL_RET_MAC(a, b, c) \
+#define VCL_RET_MAC(a, b, c, d) \
if (u & VCL_RET_##b) { \
sbuf_printf(tl->sb, "Illegal return for method\n"); \
- vcc_ErrWhere(tl, p->returnt[c]); \
+ vcc_ErrWhere(tl, p->returnt[d]); \
}
#include "vcl_returns.h"
#undef VCL_RET_MAC
Fc(tl, 0, "\t.nbackend = %d,\n", tl->nbackend);
Fc(tl, 0, "\t.ref = VGC_ref,\n");
Fc(tl, 0, "\t.nref = VGC_NREFS,\n");
-#define VCL_RET_MAC(l,u,b)
+#define VCL_RET_MAC(l,u,b,n)
#define VCL_MET_MAC(l,u,b) \
if (FindRefStr(tl, "vcl_" #l, R_FUNC)) { \
Fc(tl, 0, "\t." #l "_func = VGC_function_vcl_" #l ",\n"); \
const char *lname;
};
-static struct method {
+struct method {
const char *name;
const char *defname;
unsigned returns;
-} method_tab[] = {
-#define VCL_RET_MAC(a,b,c)
-#define VCL_MET_MAC(a,b,c) { "vcl_"#a, "default_vcl_"#a, c },
-#include "vcl_returns.h"
-#undef VCL_MET_MAC
-#undef VCL_RET_MAC
- { NULL, 0U }
};
struct proccall {
/* vcc_obj.c */
extern struct var vcc_be_vars[];
extern struct var vcc_vars[];
-const char *vrt_obj_h;
+extern const char *vrt_obj_h;
/* vcc_token.c */
void vcc_ErrToken(struct tokenlist *tl, struct token *t);
fputs("};\n", f);
fputs("\n", f);
fputs("void VRT_count(struct sess *, unsigned);\n", f);
- fputs("void VRT_no_cache(struct sess *);\n", f);
- fputs("void VRT_no_new_cache(struct sess *);\n", f);
fputs("#if 0\n", f);
fputs("int ip_match(unsigned, struct vcl_acl *);\n", f);
fputs("int string_match(const char *, const char *);\n", f);
fputs("int VRT_switch_config(const char *);\n", f);
fputs("\n", f);
fputs("char *VRT_GetHdr(struct sess *, const char *);\n", f);
- fputs("char *VRT_GetReq(struct sess *);\n", f);
fputs("void VRT_handling(struct sess *sp, unsigned hand);\n", f);
- fputs("int VRT_obj_valid(struct sess *);\n", f);
- fputs("int VRT_obj_cacheable(struct sess *);\n", f);
fputs("\n", f);
fputs("void VRT_set_backend_name(struct backend *, const char *);\n", f);
- fputs("void VRT_set_backend_hostname(struct backend *, const char *);\n", f);
- fputs("void VRT_set_backend_portname(struct backend *, const char *);\n", f);
fputs("\n", f);
fputs("void VRT_alloc_backends(struct VCL_conf *cp);\n", f);
fputs("\n", f);
foreach k $returns {
if {$k == "error"} {
puts $for "#ifdef VCL_RET_MAC_E"
- puts $for "VCL_RET_MAC_E($k, [string toupper $k], $i)"
+ puts $for "VCL_RET_MAC_E($k, [string toupper $k], (1 << $i), $i)"
puts $for "#endif"
} else {
- puts $for "VCL_RET_MAC($k, [string toupper $k], (1 << $i))"
+ puts $for "VCL_RET_MAC($k, [string toupper $k], (1 << $i), $i)"
}
incr i
}
#include "libvcl.h"
-#define ERRCHK(tl) do { if ((tl)->err) return; } while (0)
-
-#define INDENT 2
-
/*--------------------------------------------------------------------*/
void
vcc_ErrWhere(tl, tl->t);
}
-#define Expect(a, b) _Expect(a, b, __LINE__)
-#define ExpectErr(a, b) do { _Expect(a, b, __LINE__); ERRCHK(a);} while (0)
-
-#define L(tl, foo) do { \
- tl->indent += INDENT; \
- foo; \
- tl->indent -= INDENT; \
-} while (0)
-
-#define C(tl, sep) do { \
- Fc(tl, 1, "VRT_count(sp, %u)%s\n", ++tl->cnt, sep); \
- tl->t->cnt = tl->cnt; \
-} while (0)
-
-
/*--------------------------------------------------------------------
* Compare token to token
*/