diff options
Diffstat (limited to 'src/tools/vppapigen/vppapigen_json.py')
-rw-r--r-- | src/tools/vppapigen/vppapigen_json.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/tools/vppapigen/vppapigen_json.py b/src/tools/vppapigen/vppapigen_json.py index 124c0d3a0bd..ef1c9823c33 100644 --- a/src/tools/vppapigen/vppapigen_json.py +++ b/src/tools/vppapigen/vppapigen_json.py @@ -26,12 +26,14 @@ def walk_services(s): return r -def walk_defs(s, is_message = False): +def walk_defs(s, is_message=False): r = [] for t in s: d = [] d.append(t.name) for b in t.block: + if b.type == 'Option': + continue if b.type == 'Field': if b.limit: d.append([b.fieldtype, b.fieldname, b.limit]) @@ -39,7 +41,8 @@ def walk_defs(s, is_message = False): d.append([b.fieldtype, b.fieldname]) elif b.type == 'Array': if b.lengthfield: - d.append([b.fieldtype, b.fieldname, b.length, b.lengthfield]) + d.append([b.fieldtype, b.fieldname, + b.length, b.lengthfield]) else: d.append([b.fieldtype, b.fieldname, b.length]) elif b.type == 'Union': @@ -62,12 +65,15 @@ def walk_defs(s, is_message = False): def run(filename, s): j = {} - j['types'] = walk_defs([o for o in s['types'] if o.__class__.__name__ == 'Typedef']) + j['types'] = (walk_defs([o for o in s['types'] + if o.__class__.__name__ == 'Typedef'])) j['messages'] = walk_defs(s['Define'], True) - 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['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['options'] = s['Option'] - j['aliases'] = s['Alias'] + j['aliases'] = {k: v.alias for k, v in s['Alias'].items()} j['vl_api_version'] = hex(s['file_crc']) return json.dumps(j, indent=4, separators=(',', ': ')) |