summaryrefslogtreecommitdiffstats
path: root/src/tools/vppapigen/vppapigen.py
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2019-09-19 01:08:30 +0200
committerDave Barach <openvpp@barachs.net>2019-09-25 12:02:32 +0000
commit2a1ca787b9ca0021bd5da73450caedc2ff41c76d (patch)
treef9d879e07099f727ca565cfd8bc1624d3e7dc405 /src/tools/vppapigen/vppapigen.py
parent33af8c1ed89f15cf0601ee891e9603bef16f2c93 (diff)
api: split api generated files
Split generation of API message enum and the typedefs into separate files, so that the type file can be included from elsewhere. Generate a C file for VPP that contains the API registration, this was previously done via X macros by the C pre- processor. This allows deleting lots of skeleton/copy paste code for each feature. plugins/flowprobe plugins/map examples/sample-plugin vnet/ipip used as Guinea pigs. Generate a C Test file for VAT, that does the same for VAT plugins. Also add support for a per-message CLI option, that is currently limited to VAT help text. option vat_help = "<help text>"; Type: refactor Change-Id: I245e3104bb76f7e1fb69a59ab20cc7c8dfcdd460 Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'src/tools/vppapigen/vppapigen.py')
-rwxr-xr-xsrc/tools/vppapigen/vppapigen.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/tools/vppapigen/vppapigen.py b/src/tools/vppapigen/vppapigen.py
index 861b71ddf43..57a30fd3c29 100755
--- a/src/tools/vppapigen/vppapigen.py
+++ b/src/tools/vppapigen/vppapigen.py
@@ -259,12 +259,12 @@ class Define():
self.name = name
self.flags = flags
self.block = block
- self.crc = str(block).encode()
self.dont_trace = False
self.manual_print = False
self.manual_endian = False
self.autoreply = False
self.singular = False
+ self.options = {}
for f in flags:
if f == 'dont_trace':
self.dont_trace = True
@@ -279,8 +279,12 @@ class Define():
if isinstance(b, Option):
if b[1] == 'singular' and b[2] == 'true':
self.singular = True
+ else:
+ self.options[b.option] = b.value
block.remove(b)
+
self.vla = vla_is_last_check(name, block)
+ self.crc = str(block).encode()
def __repr__(self):
return self.name + str(self.flags) + str(self.block)
@@ -920,6 +924,7 @@ def main():
cliparser = argparse.ArgumentParser(description='VPP API generator')
cliparser.add_argument('--pluginpath', default=""),
cliparser.add_argument('--includedir', action='append'),
+ cliparser.add_argument('--outputdir', action='store'),
cliparser.add_argument('--input',
type=argparse.FileType('r', encoding='UTF-8'),
default=sys.stdin)
@@ -1011,7 +1016,7 @@ def main():
.format(module_path, err))
return 1
- result = plugin.run(filename, s)
+ result = plugin.run(args, filename, s)
if result:
print(result, file=args.output)
else: