Commit 9b858291 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

The Tcl-Py conversion left out code to generate vrt_obj.h, add that.

Rename RTIME->DURATION in the python code and regenerate output.

Remove fluff from python script



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5000 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent e9e69b61
/*
* $Id$
*
* NB: This file is machine generated, DO NOT EDIT!
*
* Edit and run vcc_gen_fixed_token.tcl instead
* Edit and run generate.py instead
*/
struct sockaddr * VRT_r_client_ip(const struct sess *);
struct sockaddr * VRT_r_server_ip(struct sess *);
const char * VRT_r_server_hostname(struct sess *);
......
......@@ -167,7 +167,7 @@ sp_variables = (
'const struct sess *'
),
('req.grace',
'RTIME',
'DURATION',
( 'all',),
( 'all',),
'struct sess *'
......@@ -215,19 +215,19 @@ sp_variables = (
'const struct sess *'
),
('bereq.connect_timeout',
'RTIME',
'DURATION',
( 'pipe', 'pass', 'miss',),
( 'pipe', 'pass', 'miss',),
'struct sess *'
),
('bereq.first_byte_timeout',
'RTIME',
'DURATION',
( 'pass', 'miss',),
( 'pass', 'miss',),
'struct sess *'
),
('bereq.between_bytes_timeout',
'RTIME',
'DURATION',
( 'pass', 'miss',),
( 'pass', 'miss',),
'struct sess *'
......@@ -239,7 +239,7 @@ sp_variables = (
'const struct sess *'
),
('beresp.saintmode',
'RTIME',
'DURATION',
( ),
( 'fetch',),
'const struct sess *'
......@@ -269,13 +269,13 @@ sp_variables = (
'const struct sess *'
),
('beresp.ttl',
'RTIME',
'DURATION',
( 'fetch',),
( 'fetch',),
'const struct sess *'
),
('beresp.grace',
'RTIME',
'DURATION',
( 'fetch',),
( 'fetch',),
'const struct sess *'
......@@ -317,19 +317,19 @@ sp_variables = (
'const struct sess *'
),
('obj.ttl',
'RTIME',
'DURATION',
( 'hit', 'error',),
( 'hit', 'error',),
'const struct sess *'
),
('obj.grace',
'RTIME',
'DURATION',
( 'hit', 'error',),
( 'hit', 'error',),
'const struct sess *'
),
('obj.lastuse',
'RTIME',
'DURATION',
( 'hit', 'deliver', 'error',),
( ),
'const struct sess *'
......@@ -375,16 +375,10 @@ vcltypes = {
'BOOL': "unsigned",
'BACKEND': "struct director *",
'TIME': "double",
'RTIME': "double",
'DURATION': "double",
'INT': "int",
'HDR_RESP': "const char *",
'HDR_OBJ': "const char *",
'HDR_REQ': "const char *",
'HDR_BEREQ': "const char *",
'HOSTNAME': "const char *",
'PORTNAME': "const char *",
'HEADER': "const char *",
'HASH': "const char *",
'SET': "struct vrt_backend_entry *",
}
#######################################################################
......@@ -727,6 +721,9 @@ def restrict(fo, spec):
#######################################################################
fh=open("../../include/vrt_obj.h", "w")
file_header(fh)
fo=open("vcc_obj.c", "w")
file_header(fo)
......@@ -742,16 +739,28 @@ for i in sp_variables:
typ = i[1]
if typ[:4] == "HDR_":
typ = "HEADER"
cnam = i[0].replace(".", "_")
ctyp = vcltypes[typ]
fo.write("\t{ \"%s\", %s, %d,\n" % (i[0], typ, len(i[0])))
if len(i[2]) > 0:
fo.write('\t "VRT_r_%s(sp)",\n' % i[0].replace(".", "_"))
fo.write('\t "VRT_r_%s(sp)",\n' % cnam)
if typ != "HEADER":
fh.write(ctyp + " VRT_r_%s(%s);\n" % (cnam, i[4]))
else:
fo.write('\t NULL,\t/* No reads allowed */\n')
restrict(fo, i[2])
if len(i[3]) > 0:
fo.write('\t "VRT_l_%s(sp, ",\n' % i[0].replace(".", "_"))
fo.write('\t "VRT_l_%s(sp, ",\n' % cnam)
if typ != "HEADER":
fh.write("void VRT_l_%s(%s, " % (cnam, i[4]))
if typ != "STRING":
fh.write(ctyp + ");\n")
else:
fh.write(ctyp + ", ...);\n")
else:
fo.write('\t NULL,\t/* No writes allowed */\n')
restrict(fo, i[3])
......@@ -765,3 +774,4 @@ for i in sp_variables:
fo.write("\t{ NULL }\n};\n")
fo.close()
fh.close()
......@@ -315,11 +315,10 @@ vcl_output_lang_h(struct vsb *sb)
/* ../../include/vrt_obj.h */
vsb_cat(sb, "/*\n * $Id: vcc_gen_fixed_token.tcl 4428 2010-01-06 "
"17:38:59Z tfheen $\n *\n * NB: This file is machine generated, "
"DO NOT EDIT!\n *\n * Edit and run vcc_gen_fixed_token.tcl "
"instead\n */\n\nstruct sockaddr * VRT_r_client_ip(const struct "
"sess *);\nstruct sockaddr * VRT_r_server_ip(struct sess *);\n"
vsb_cat(sb, "\n/*\n * $Id$\n *\n * NB: This file is machine "
"generated, DO NOT EDIT!\n *\n * Edit and run generate.py instead"
"\n */\nstruct sockaddr * VRT_r_client_ip(const struct sess "
"*);\nstruct sockaddr * VRT_r_server_ip(struct sess *);\n"
"const char * VRT_r_server_hostname(struct sess *);\n"
"const char * VRT_r_server_identity(struct sess *);\n"
"int VRT_r_server_port(struct sess *);\nconst char * VRT_r_req_re"
......
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