Browse Source

tools/generate-wire.py: handle marshal/unmarshal of enum types.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 8 years ago
parent
commit
9868e896d9
  1. 8
      tools/generate-wire.py

8
tools/generate-wire.py

@ -47,8 +47,8 @@ class FieldType(object):
def _typesize(typename):
if typename in type2size:
return type2size[typename]
elif typename.startswith('struct '):
# We allow unknown structures, for extensiblity (can only happen
elif typename.startswith('struct ') or typename.startswith('enum '):
# We allow unknown structures/enums, for extensiblity (can only happen
# if explicitly specified in csv)
return 0
else:
@ -275,6 +275,8 @@ class Message(object):
basetype=f.fieldtype.name
if f.fieldtype.name.startswith('struct '):
basetype=f.fieldtype.name[7:]
elif f.fieldtype.name.startswith('enum '):
basetype=f.fieldtype.name[5:]
for c in f.comments:
subcalls.append('\t/*{} */'.format(c))
@ -353,6 +355,8 @@ class Message(object):
basetype=f.fieldtype.name
if basetype.startswith('struct '):
basetype=basetype[7:]
elif basetype.startswith('enum '):
basetype=basetype[5:]
for c in f.comments:
subcalls.append('\t/*{} */'.format(c))

Loading…
Cancel
Save