diff options
author | 2019-09-11 17:49:08 +0200 | |
---|---|---|
committer | 2019-09-12 13:17:40 +0200 | |
commit | e6a5712624186d4162cbba8e49ff15362aeda17d (patch) | |
tree | b5ced6fc0c1b5d635ce1cc6780d570ec91daa77c /src/tools/vppapigen/vppapigen_c.py | |
parent | 4b943d632864949310da4c88ea00e59f6043ae40 (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/vppapigen/vppapigen_c.py')
-rw-r--r-- | src/tools/vppapigen/vppapigen_c.py | 19 |
1 files changed, 8 insertions, 11 deletions
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) |