nat: use correct data types for memory sizes
[vpp.git] / doxygen / filter_api.py
1 #!/usr/bin/env python3
2 # Copyright (c) 2016 Comcast Cable Communications Management, LLC.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 # Filter for vpe.api to make it Doxygenish.
17
18 import re
19 import sys
20
21 if len(sys.argv) < 2:
22     sys.stderr.write("Usage: %s <filename>\n" % (sys.argv[0]))
23     sys.exit(1)
24
25 patterns = [
26     # Search for "define" blocks and treat them as structs
27     (re.compile(r"^.*(manual_.[^\s]+\s+)?define\s+(?P<name>[^\s]+)"),
28      r"typedef struct vl_api_\g<name>_t"),
29
30     # For every "brief" statement at the start of a comment block, add an
31     # xref with whatever is on the same line. This gives us an index page
32     # with all the API methods in one place.
33     # XXX Commented out for now; works but duplicates the brief text in the
34     # struct documentation
35     # (re.compile(r"/\*\*\s*(?P<b>[\\@]brief)\s+(?P<c>.+)(\*/)$"),
36     #  r'/** @xrefitem api "" "VPP API" \g<c> \g<b> \g<c>'),  # capture inline comment close
37     # (re.compile(r"/\*\*\s*(?P<b>[\\@]brief)\s+(?P<c>.+)$"),
38     #  r'/** @xrefitem api "" "VPP API" \g<c> \g<b> \g<c>'),
39
40     # Since structs don't have params, replace @param with @tparam
41     ( re.compile("[\\@]param\\b"), "@tparam"),
42 ]
43
44 with open(sys.argv[1]) as fd:
45     for line in fd:
46         str = line[:-1] # strip \n
47         for p in patterns:
48             str = p[0].sub(p[1], str)
49         sys.stdout.write(str+"\n")