Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions Utilities/Doxygen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ if(ITK_BUILD_DOCUMENTATION)
find_package(Doxygen)
find_package(Gnuplot)
find_package(HTMLHelp)
find_package(Perl)
find_package(Wget)
endif()

Expand Down Expand Up @@ -109,12 +108,9 @@ mark_as_advanced(
ITK_DOXYGEN_XML
ITK_DOXYGEN_SERVER_BASED_SEARCH)

find_package(Perl)
if(Python3_EXECUTABLE)
set(ITK_DOXYGEN_INPUT_FILTER "${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/itkgroup.py")

if(PERL_FOUND)
set(ITK_DOXYGEN_INPUT_FILTER "${PERL_EXECUTABLE} ${ITK_BINARY_DIR}/Utilities/Doxygen/itkdoxygen.pl")

configure_file(${ITK_SOURCE_DIR}/Utilities/Doxygen/itkdoxygen.pl.in ${ITK_BINARY_DIR}/Utilities/Doxygen/itkdoxygen.pl)
else()
set(ITK_DOXYGEN_INPUT_FILTER)
endif()
Expand Down
9 changes: 0 additions & 9 deletions Utilities/Doxygen/itkdoxygen.pl.in

This file was deleted.

89 changes: 89 additions & 0 deletions Utilities/Doxygen/itkgroup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/usr/bin/env python
#
# Copyright NumFOCUS
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Usage: itkgroup.py <filename>"

Processes the input filename and prints to stdout.

The file has additional Doxygen grouping markers to doxygen comment blocks, where the block does not contain an empty
line. This groups multiple functions or variables not separated by a newline, into a single doxygen group allowing
the same doxyen comment to apply to all of them.

"""


import re
import sys

ingroup = False
semicount = 0
endbracecount = 0
endparencount = 0
leading_space = " "
savebuffer = ""


def process_line(line: str):
global ingroup, semicount, endbracecount, endparencount, leading_space, savebuffer

line = line.rstrip()
if re.search(r"\S+", line):
match = re.search(r"/\*\*(.*)", line)
if match:
if ingroup:
print(f"{leading_space}/**{savebuffer}")
if re.search(r"(\\class|\\brief)", line):
print(line)
else:
savebuffer = f"{match.group(1)}\n"
ingroup = True
semicount = 0
endbracecount = 0
endparencount = 0
leading_space = re.match(r"(^\s*)", line).group(1)
else:
if ingroup:
savebuffer += f"{line}\n"
else:
print(line)
if re.search(r";", line):
semicount += 1
if re.search(r"\}", line):
endbracecount += 1
if re.search(r"\)", line):
endparencount += 1
else:
if ingroup:
if endparencount > 1 and (semicount > 1 or endbracecount > 1):
print(f"{leading_space}/**@{{{savebuffer}{leading_space}/**@}}*/\n")
else:
print(f"{leading_space}/**{savebuffer}")
savebuffer = ""
ingroup = False
else:
print(line)


if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python itkgroup.py <filename>")
sys.exit(1)

filename = sys.argv[1]
with open(filename) as file:
for line in file:
process_line(line)
127 changes: 0 additions & 127 deletions Utilities/Doxygen/vxl_doxy.pl

This file was deleted.

Loading