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