2 # Copyright (c) 2016 Comcast Cable Communications Management, LLC.
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:
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 # Filter for vpe.api to make it Doxygenish.
21 sys.stderr.write("Usage: %s <filename>\n" % (sys.argv[0]))
25 # Search for "define" blocks and treat them as structs
26 ( re.compile(r"^.*(manual_.[^\s]+\s+)?define\s+(?P<name>[^\s]+)"), r"typedef struct vl_api_\g<name>_t"),
28 # For every "brief" statement at the start of a comment block, add an
29 # xref with whatever is on the same line. This gives us an index page
30 # with all the API methods in one place.
31 # XXX Commented out for now; works but duplicates the brief text in the
32 # struct documentation
33 #( re.compile(r"/\*\*\s*(?P<b>[\\@]brief)\s+(?P<c>.+)(\*/)$"), r'/** @xrefitem api "" "VPP API" \g<c> \g<b> \g<c>'), # capture inline comment close
34 #( re.compile(r"/\*\*\s*(?P<b>[\\@]brief)\s+(?P<c>.+)$"), r'/** @xrefitem api "" "VPP API" \g<c> \g<b> \g<c>'),
36 # Since structs don't have params, replace @param with @tparam
37 ( re.compile("[\\@]param\\b"), "@tparam"),
40 with open(sys.argv[1]) as fd:
42 str = line[:-1] # strip \n
44 str = p[0].sub(p[1], str)
45 sys.stdout.write(str+"\n")