- for e in s['enums']:
- output += duplicate_wrapper_head(e.name)
- output += "typedef enum {\n"
- for b in e.block:
- output += " %s = %s,\n" % (b[0], b[1])
- output += '} vl_api_%s_t;\n' % e.name
- output += duplicate_wrapper_tail()
-
- for t in s['typedefs'] + s['defines']:
- output += duplicate_wrapper_head(t.name)
- output += "typedef VL_API_PACKED(struct _vl_api_%s {\n" % t.name
- for b in t.block:
- if b.type == 'Field':
- output += " %s %s;\n" % (b.fieldtype, b.fieldname)
- elif b.type == 'Array':
- if b.lengthfield:
- output += " %s %s[0];\n" % (b.fieldtype, b.fieldname)
- else:
- output += " %s %s[%s];\n" % (b.fieldtype, b.fieldname,
- b.length)
+ for o in objs:
+ tname = o.__class__.__name__
+ output += duplicate_wrapper_head(o.name)
+ if tname == 'Enum':
+ output += "typedef enum {\n"
+ for b in o.block:
+ output += " %s = %s,\n" % (b[0], b[1])
+ output += '} vl_api_%s_t;\n' % o.name
+ else:
+ if tname == 'Union':
+ output += "typedef VL_API_PACKED(union _vl_api_%s {\n" % o.name