aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/codegen/core/gen_static_metadata.py
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-03-31 07:49:58 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-03-31 07:49:58 -0700
commit64a12c55dfe4bdbdb65b2c508a06f4335f100a98 (patch)
tree27210a0df4e73a44487d89dc012502fa5d992ee4 /tools/codegen/core/gen_static_metadata.py
parent6169d5f7b002a68daa3eda36798cec34de11d57f (diff)
parent6fa2ce56f3600b044d9e27897823de736e948a73 (diff)
Merge github.com:grpc/grpc into copyright-fix
Diffstat (limited to 'tools/codegen/core/gen_static_metadata.py')
-rwxr-xr-xtools/codegen/core/gen_static_metadata.py29
1 files changed, 15 insertions, 14 deletions
diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py
index dd5632805a..b4ba02bbe5 100755
--- a/tools/codegen/core/gen_static_metadata.py
+++ b/tools/codegen/core/gen_static_metadata.py
@@ -69,6 +69,7 @@ CONFIG = [
(':scheme', 'grpc'),
(':authority', ''),
(':method', 'GET'),
+ (':method', 'PUT'),
(':path', '/'),
(':path', '/index.html'),
(':status', '204'),
@@ -232,20 +233,20 @@ with open(sys.argv[0]) as my_source:
if line[0] != '#':
break
copyright.append(line)
- put_banner([H,C], [line[1:].strip() for line in copyright])
+ put_banner([H,C], [line[2:].rstrip() for line in copyright])
put_banner([H,C],
"""WARNING: Auto-generated code.
-To make changes to this file, change tools/codegen/core/gen_static_metadata.py,
-and then re-run it.
+To make changes to this file, change
+tools/codegen/core/gen_static_metadata.py, and then re-run it.
-See metadata.h for an explanation of the interface here, and metadata.c for an
-explanation of what's going on.
+See metadata.h for an explanation of the interface here, and metadata.c for
+an explanation of what's going on.
""".splitlines())
-print >>H, '#ifndef GRPC_INTERNAL_CORE_TRANSPORT_STATIC_METADATA_H'
-print >>H, '#define GRPC_INTERNAL_CORE_TRANSPORT_STATIC_METADATA_H'
+print >>H, '#ifndef GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H'
+print >>H, '#define GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H'
print >>H
print >>H, '#include "src/core/lib/transport/metadata.h"'
print >>H
@@ -264,13 +265,13 @@ print >>C
print >>H, '#define GRPC_STATIC_MDELEM_COUNT %d' % len(all_elems)
print >>H, 'extern grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];'
-print >>H, 'extern gpr_uintptr grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];'
+print >>H, 'extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];'
for i, elem in enumerate(all_elems):
print >>H, '/* "%s": "%s" */' % elem
print >>H, '#define %s (&grpc_static_mdelem_table[%d])' % (mangle(elem).upper(), i)
print >>H
print >>C, 'grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];'
-print >>C, 'gpr_uintptr grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = {'
+print >>C, 'uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = {'
print >>C, ' %s' % ','.join('%d' % static_userdata.get(elem, 0) for elem in all_elems)
print >>C, '};'
print >>C
@@ -285,8 +286,8 @@ def md_idx(m):
if m == m2:
return i
-print >>H, 'extern const gpr_uint8 grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT*2];'
-print >>C, 'const gpr_uint8 grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT*2] = {'
+print >>H, 'extern const uint8_t grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT*2];'
+print >>C, 'const uint8_t grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT*2] = {'
print >>C, ','.join('%d' % str_idx(x) for x in itertools.chain.from_iterable([a,b] for a, b in all_elems))
print >>C, '};'
print >>C
@@ -297,15 +298,15 @@ print >>C, '%s' % ',\n'.join(' "%s"' % s for s in all_strs)
print >>C, '};'
print >>C
-print >>H, 'extern const gpr_uint8 grpc_static_accept_encoding_metadata[%d];' % (1 << len(COMPRESSION_ALGORITHMS))
-print >>C, 'const gpr_uint8 grpc_static_accept_encoding_metadata[%d] = {' % (1 << len(COMPRESSION_ALGORITHMS))
+print >>H, 'extern const uint8_t grpc_static_accept_encoding_metadata[%d];' % (1 << len(COMPRESSION_ALGORITHMS))
+print >>C, 'const uint8_t grpc_static_accept_encoding_metadata[%d] = {' % (1 << len(COMPRESSION_ALGORITHMS))
print >>C, '0,%s' % ','.join('%d' % md_idx(elem) for elem in compression_elems)
print >>C, '};'
print >>C
print >>H, '#define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(algs) (&grpc_static_mdelem_table[grpc_static_accept_encoding_metadata[(algs)]])'
-print >>H, '#endif /* GRPC_INTERNAL_CORE_TRANSPORT_STATIC_METADATA_H */'
+print >>H, '#endif /* GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H */'
H.close()
C.close()