Browse Source

wire gen: add subtypes to printwires

now we print the subtypes out when you call printwire

note that we have to reverse the order the subtypes appear in
because
  1) they're static and,
  2) a few of them are nested
pr-2587
lisa neigut 6 years ago
committed by Rusty Russell
parent
commit
88786b8f7a
  1. 6
      tools/generate-wire.py

6
tools/generate-wire.py

@ -1480,12 +1480,16 @@ includes = '\n'.join(includes)
printcases = ['case {enum.name}: printf("{enum.name}:\\n"); printwire_{name}("{name}", msg); return;'.format(enum=m.enum, name=m.name) for m in toplevel_messages]
if options.printwire:
decls = [m.print_printwire(options.header) for m in toplevel_messages + messages_with_option]
decls = []
if not options.header:
subtype_decls = [m.print_printwire(options.header, is_embedded=True) for m in subtypes]
subtype_decls.reverse()
decls += subtype_decls
if len(tlv_fields):
decls += print_tlv_printwires(options.enumname, tlv_fields)
else:
decls += [print_tlv_message_printwire_empty.format(enumname=options.enumname)]
decls += [m.print_printwire(options.header) for m in toplevel_messages + messages_with_option]
else:
towire_decls = []
fromwire_decls = []

Loading…
Cancel
Save