summaryrefslogtreecommitdiffstats
path: root/src/tools/vppapigen/vppapigen_crc.py
blob: 791e347292eea1d3af417691d70a59a9cd01d9b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# CRC generation
import json

process_imports = True


#
# Plugin entry point
#
def run(args, input_filename, s):
    j = {}
    major = 0
    minor = 0
    patch = 0
    if 'version' in s['Option']:
        v = s['Option']['version']
        (major, minor, patch) = v.split('.')
    j['_version'] = {'major': major, 'minor': minor, 'patch': patch}
    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=(',', ': '))