aboutsummaryrefslogtreecommitdiffstats
path: root/src/tools/vppapigen/vppapigen_crc.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/vppapigen/vppapigen_crc.py')
-rw-r--r--src/tools/vppapigen/vppapigen_crc.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tools/vppapigen/vppapigen_crc.py b/src/tools/vppapigen/vppapigen_crc.py
new file mode 100644
index 00000000000..b3cb5855c9d
--- /dev/null
+++ b/src/tools/vppapigen/vppapigen_crc.py
@@ -0,0 +1,16 @@
+# CRC generation
+import json
+
+#
+# Plugin entry point
+#
+def run(args, input_filename, s):
+ j = {}
+ major = 0
+ if 'version' in s['Option']:
+ v = s['Option']['version']
+ (major, minor, patch) = v.split('.')
+ for t in s['Define']:
+ j[t.name] = {'crc': f'{t.crc:#08x}', 'version': major,
+ 'options': t.options}
+ return json.dumps(j, indent=4, separators=(',', ': '))