12 d.append({'enumtype': e.enumtype})
20 d = {'reply': e.reply}
24 d['events'] = e.events
37 f = [b.fieldtype, b.fieldname]
38 elif b.type == 'Array':
40 f = [b.fieldtype, b.fieldname, b.length, b.lengthfield]
42 f = [b.fieldtype, b.fieldname, b.length]
43 elif b.type == 'Union':
46 raise ValueError("Error in processing array type %s" % b)
50 c['crc'] = "{0:#0{1}x}".format(t.crc, 10)
60 def run(filename, s, file_crc):
63 j['types'] = walk_defs([o for o in s['types'] if o.__class__.__name__ == 'Typedef'])
64 j['messages'] = walk_defs(s['Define'])
65 j['unions'] = walk_defs([o for o in s['types'] if o.__class__.__name__ == 'Union'])
66 j['enums'] = walk_enums([o for o in s['types'] if o.__class__.__name__ == 'Enum'])
67 j['services'] = walk_services(s['Service'])
68 j['aliases'] = s['Alias']
69 j['vl_api_version'] = hex(file_crc)
70 return json.dumps(j, indent=4, separators=(',', ': '))