Commit 0b877e6a authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Introduce a bunch of canonical typedefs to map VCL types to C

types.  Have the python code learn the mapping from them.
parent 32d5bc32
......@@ -38,6 +38,26 @@ struct director;
struct VCL_conf;
struct sockaddr_storage;
/***********************************************************************
* This is the central definition of the mapping from VCL types to
* C-types. The python scripts read these from here.
*/
typedef struct director * VCL_BACKEND;
typedef unsigned VCL_BOOL;
typedef double VCL_BYTES;
typedef double VCL_DURATION;
typedef const char * VCL_ENUM;
typedef const char * VCL_HEADER;
typedef long VCL_INT;
typedef struct sockaddr_storage * VCL_IP;
typedef double VCL_REAL;
typedef const char * VCL_STRING;
typedef double VCL_TIME;
typedef void VCL_VOID;
/***********************************************************************/
enum gethdr_e { HDR_REQ, HDR_RESP, HDR_OBJ, HDR_BEREQ, HDR_BERESP };
struct gethdr_s {
......
......@@ -475,21 +475,25 @@ stv_variables = (
# VCL to C type conversion
vcltypes = {
'IP': "struct sockaddr_storage *",
'STRING': "const char *",
'BOOL': "unsigned",
'BACKEND': "struct director *",
'TIME': "double",
'DURATION': "double",
'BYTES': "double",
'INT': "long",
'HEADER': "const char *",
'VOID': "void",
'REAL': "double",
'STRING_LIST': "void*",
'ENUM': "const char *",
}
fi = open(buildroot + "/include/vrt.h")
for i in fi:
j = i.split();
if len(j) < 3:
continue
if j[0] != "typedef":
continue
if j[-1][-1] != ";":
continue
if j[-1][:4] != "VCL_":
continue
d = " ".join(j[1:-1])
vcltypes[j[-1][4:-1]] = d
fi.close()
#######################################################################
# Nothing is easily configurable below this line.
#######################################################################
......
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