34 lines
1.6 KiB
Python
34 lines
1.6 KiB
Python
import os
|
|
import re
|
|
|
|
def clean_doxygen_stubs(directory):
|
|
for root, _, files in os.walk(directory):
|
|
for file in files:
|
|
if file.endswith(('.h', '.cpp', '.c')):
|
|
filepath = os.path.join(root, file)
|
|
process_file(filepath)
|
|
|
|
def process_file(filepath):
|
|
with open(filepath, 'r') as f:
|
|
content = f.read()
|
|
|
|
# Match the exact pattern generated by add_doxygen.py
|
|
# /**\n * @brief <name>\n[ * @param ...\n]*[ * @return ...\n]* */\n
|
|
pattern = re.compile(r'\/\*\*\n \* @brief [^\n]+\n(?: \* @param [^\n]+\n)*(?: \* @return [^\n]+\n)* \*\/\n')
|
|
|
|
new_content, count = pattern.subn('', content)
|
|
|
|
if count > 0:
|
|
with open(filepath, 'w') as f:
|
|
f.write(new_content)
|
|
print(f"Cleaned {count} blocks from {filepath}")
|
|
|
|
if __name__ == '__main__':
|
|
clean_doxygen_stubs('/home/fabiorafaelcoutada/portugalfuturista/universalisos/kernel/src/core/adt')
|
|
clean_doxygen_stubs('/home/fabiorafaelcoutada/portugalfuturista/universalisos/kernel/src/core/posix')
|
|
clean_doxygen_stubs('/home/fabiorafaelcoutada/portugalfuturista/universalisos/kernel/src/core/j_space')
|
|
clean_doxygen_stubs('/home/fabiorafaelcoutada/portugalfuturista/universalisos/kernel/src/core/virtio')
|
|
clean_doxygen_stubs('/home/fabiorafaelcoutada/portugalfuturista/universalisos/kernel/src/core/abi')
|
|
clean_doxygen_stubs('/home/fabiorafaelcoutada/portugalfuturista/universalisos/kernel/src/core/migration')
|
|
|
|
clean_doxygen_stubs('/home/fabiorafaelcoutada/portugalfuturista/universalisos/kernel/src/arch/armv7')
|