r5000 - in trunk/varnish-cache: include lib/libvcl
phk at varnish-cache.org
phk at varnish-cache.org
Sun Jul 4 16:15:29 CEST 2010
Author: phk
Date: 2010-07-04 16:15:28 +0200 (Sun, 04 Jul 2010)
New Revision: 5000
Modified:
trunk/varnish-cache/include/vrt_obj.h
trunk/varnish-cache/lib/libvcl/generate.py
trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c
Log:
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
Modified: trunk/varnish-cache/include/vrt_obj.h
===================================================================
--- trunk/varnish-cache/include/vrt_obj.h 2010-07-04 12:49:35 UTC (rev 4999)
+++ trunk/varnish-cache/include/vrt_obj.h 2010-07-04 14:15:28 UTC (rev 5000)
@@ -1,3 +1,4 @@
+
/*
* $Id$
*
@@ -3,7 +4,6 @@
* 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 *);
Modified: trunk/varnish-cache/lib/libvcl/generate.py
===================================================================
--- trunk/varnish-cache/lib/libvcl/generate.py 2010-07-04 12:49:35 UTC (rev 4999)
+++ trunk/varnish-cache/lib/libvcl/generate.py 2010-07-04 14:15:28 UTC (rev 5000)
@@ -167,7 +167,7 @@
'const struct sess *'
),
('req.grace',
- 'RTIME',
+ 'DURATION',
( 'all',),
( 'all',),
'struct sess *'
@@ -215,19 +215,19 @@
'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 @@
'const struct sess *'
),
('beresp.saintmode',
- 'RTIME',
+ 'DURATION',
( ),
( 'fetch',),
'const struct sess *'
@@ -269,13 +269,13 @@
'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 @@
'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 @@
'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 @@
#######################################################################
+fh=open("../../include/vrt_obj.h", "w")
+file_header(fh)
+
fo=open("vcc_obj.c", "w")
file_header(fo)
@@ -742,16 +739,28 @@
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 @@
fo.write("\t{ NULL }\n};\n")
fo.close()
+fh.close()
Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2010-07-04 12:49:35 UTC (rev 4999)
+++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2010-07-04 14:15:28 UTC (rev 5000)
@@ -315,11 +315,10 @@
/* ../../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"
More information about the varnish-commit
mailing list