aboutsummaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2019-09-11 17:49:08 +0200
committerOle Troan <ot@cisco.com>2019-09-12 13:17:40 +0200
commite6a5712624186d4162cbba8e49ff15362aeda17d (patch)
treeb5ced6fc0c1b5d635ce1cc6780d570ec91daa77c /src/tools
parent4b943d632864949310da4c88ea00e59f6043ae40 (diff)
api: split vl_api_prefix into two
One type for address with prefix and one type for prefix. Ticket: VPP-1769 Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: Icfec51d9b7d5cde1d69fbecdd97498688ab7b295 Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'src/tools')
-rwxr-xr-xsrc/tools/vppapigen/vppapigen.py7
-rw-r--r--src/tools/vppapigen/vppapigen_c.py19
-rw-r--r--src/tools/vppapigen/vppapigen_json.py3
3 files changed, 13 insertions, 16 deletions
diff --git a/src/tools/vppapigen/vppapigen.py b/src/tools/vppapigen/vppapigen.py
index 22c80e900b9..c5304db834c 100755
--- a/src/tools/vppapigen/vppapigen.py
+++ b/src/tools/vppapigen/vppapigen.py
@@ -177,6 +177,9 @@ class Using():
def __init__(self, name, alias):
self.name = name
self.vla = False
+ self.block = []
+ self.manual_print = True
+ self.manual_endian = True
if isinstance(alias, Array):
a = {'type': alias.fieldtype,
@@ -689,7 +692,6 @@ class VPPAPI(object):
s['Service'] = []
s['types'] = []
s['Import'] = []
- s['Alias'] = {}
crc = 0
for o in objs:
tname = o.__class__.__name__
@@ -709,10 +711,9 @@ class VPPAPI(object):
s['Service'].append(o2)
elif (isinstance(o, Enum) or
isinstance(o, Typedef) or
+ isinstance(o, Using) or
isinstance(o, Union)):
s['types'].append(o)
- elif isinstance(o, Using):
- s['Alias'][o.name] = o.alias
else:
if tname not in s:
raise ValueError('Unknown class type: {} {}'
diff --git a/src/tools/vppapigen/vppapigen_c.py b/src/tools/vppapigen/vppapigen_c.py
index c1bc11d4a12..a97d01b6805 100644
--- a/src/tools/vppapigen/vppapigen_c.py
+++ b/src/tools/vppapigen/vppapigen_c.py
@@ -103,7 +103,7 @@ def api2c(fieldtype):
return fieldtype
-def typedefs(objs, aliases, filename):
+def typedefs(objs, filename):
name = filename.replace('.', '_')
output = '''\
@@ -116,18 +116,15 @@ def typedefs(objs, aliases, filename):
'''
output = output.format(module=name)
- for k, v in aliases.items():
- output += duplicate_wrapper_head(k)
- if 'length' in v:
- output += 'typedef %s vl_api_%s_t[%s];\n' % (v['type'], k, v['length'])
- else:
- output += 'typedef %s vl_api_%s_t;\n' % (v['type'], k)
- output += duplicate_wrapper_tail()
-
for o in objs:
tname = o.__class__.__name__
output += duplicate_wrapper_head(o.name)
- if tname == 'Enum':
+ if tname == 'Using':
+ if 'length' in o.alias:
+ output += 'typedef %s vl_api_%s_t[%s];\n' % (o.alias['type'], o.name, o.alias['length'])
+ else:
+ output += 'typedef %s vl_api_%s_t;\n' % (o.alias['type'], o.name)
+ elif tname == 'Enum':
if o.enumtype == 'u32':
output += "typedef enum {\n"
else:
@@ -311,7 +308,7 @@ def run(input_filename, s):
output += msg_ids(s)
output += msg_names(s)
output += msg_name_crc_list(s, filename)
- output += typedefs(s['types'] + s['Define'], s['Alias'], filename + file_extension)
+ output += typedefs(s['types'] + s['Define'], filename + file_extension)
output += printfun(s['types'] + s['Define'])
output += endianfun(s['types'] + s['Define'])
output += version_tuple(s, basename)
diff --git a/src/tools/vppapigen/vppapigen_json.py b/src/tools/vppapigen/vppapigen_json.py
index 124c0d3a0bd..95f9e5e63ce 100644
--- a/src/tools/vppapigen/vppapigen_json.py
+++ b/src/tools/vppapigen/vppapigen_json.py
@@ -55,7 +55,6 @@ def walk_defs(s, is_message = False):
r.append(d)
return r
-
#
# Plugin entry point
#
@@ -68,6 +67,6 @@ def run(filename, s):
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'] = {o.name:o.alias for o in s['types'] if o.__class__.__name__ == 'Using'}
j['vl_api_version'] = hex(s['file_crc'])
return json.dumps(j, indent=4, separators=(',', ': '))