summaryrefslogtreecommitdiffstats
path: root/src/tools/vppapigen/vppapigen_json.py
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2019-04-24 14:31:18 +0200
committerPaul Vinciguerra <pvinci@vinciconsulting.com>2019-06-07 10:13:59 +0000
commit8dbfb433619011b649b1b511ad88969a7f909861 (patch)
tree40e9b9b19a3a0910c809a6053b61f4143f3fe0c9 /src/tools/vppapigen/vppapigen_json.py
parent8edca1361674ce116a3a02d3adbfe0a78a28a2ca (diff)
vppapigen: Fold up CRC from dependent types.
Change-Id: Id51f26f225cd567ca19efc2301e94fa88840ae8f Signed-off-by: Ole Troan <ot@cisco.com> Type: fix Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/tools/vppapigen/vppapigen_json.py')
-rw-r--r--src/tools/vppapigen/vppapigen_json.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/tools/vppapigen/vppapigen_json.py b/src/tools/vppapigen/vppapigen_json.py
index 94a9e19577e..124c0d3a0bd 100644
--- a/src/tools/vppapigen/vppapigen_json.py
+++ b/src/tools/vppapigen/vppapigen_json.py
@@ -26,7 +26,7 @@ def walk_services(s):
return r
-def walk_defs(s):
+def walk_defs(s, is_message = False):
r = []
for t in s:
d = []
@@ -47,7 +47,7 @@ def walk_defs(s):
else:
raise ValueError("Error in processing array type %s" % b)
- if t.crc:
+ if is_message and t.crc:
c = {}
c['crc'] = "{0:#0{1}x}".format(t.crc, 10)
d.append(c)
@@ -59,15 +59,15 @@ def walk_defs(s):
#
# Plugin entry point
#
-def run(filename, s, file_crc):
+def run(filename, s):
j = {}
j['types'] = walk_defs([o for o in s['types'] if o.__class__.__name__ == 'Typedef'])
- j['messages'] = walk_defs(s['Define'])
+ 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['services'] = walk_services(s['Service'])
j['options'] = s['Option']
j['aliases'] = s['Alias']
- j['vl_api_version'] = hex(file_crc)
+ j['vl_api_version'] = hex(s['file_crc'])
return json.dumps(j, indent=4, separators=(',', ': '))