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.
22 sys.stderr.write("Usage: %s <filename>\n" % (sys.argv[0]))
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"),
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>'),
40 # Since structs don't have params, replace @param with @tparam
41 ( re.compile("[\\@]param\\b"), "@tparam"),
44 with open(sys.argv[1]) as fd:
46 str = line[:-1] # strip \n
48 str = p[0].sub(p[1], str)
49 sys.stdout.write(str+"\n")