X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Ftools%2Fvppapigen%2Fvppapigen_json.py;h=a4707c0cd6053c42f2d1055deb19c99c133955af;hb=413f4a5b2123c1625d615315db293a080078482b;hp=2991bec57ac3fa2eb4f9d8614d3baea41284b004;hpb=9ce6a21aaa76cd40c95ebbcb5fc6e48a8f5dfdb9;p=vpp.git diff --git a/src/tools/vppapigen/vppapigen_json.py b/src/tools/vppapigen/vppapigen_json.py index 2991bec57ac..a4707c0cd60 100644 --- a/src/tools/vppapigen/vppapigen_json.py +++ b/src/tools/vppapigen/vppapigen_json.py @@ -32,19 +32,18 @@ def walk_defs(s): d = [] d.append(t.name) for b in t.block: - f = [] if b.type == 'Field': - f = [b.fieldtype, b.fieldname] + d.append([b.fieldtype, b.fieldname]) elif b.type == 'Array': if b.lengthfield: - f = [b.fieldtype, b.fieldname, b.length, b.lengthfield] + d.append([b.fieldtype, b.fieldname, b.length, b.lengthfield]) else: - f = [b.fieldtype, b.fieldname, b.length] + d.append([b.fieldtype, b.fieldname, b.length]) elif b.type == 'Union': - print('UNION') + pass else: raise ValueError("Error in processing array type %s" % b) - d.append(f) + if t.crc: c = {} c['crc'] = "{0:#0{1}x}".format(t.crc, 10) @@ -65,5 +64,6 @@ def run(filename, s, file_crc): j['unions'] = walk_defs([o for o in s['types'] if o.__class__.__name__ == 'Union']) j['enums'] = walk_enums([o for o in s['types'] if o.__class__.__name__ == 'Enum']) j['services'] = walk_services(s['Service']) + j['aliases'] = s['Alias'] j['vl_api_version'] = hex(file_crc) return json.dumps(j, indent=4, separators=(',', ': '))