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
This commit is contained in:
lisa neigut
2019-04-09 15:25:29 -07:00
committed by Rusty Russell
parent 51438cef21
commit 88786b8f7a

View File

@@ -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 = []