forked from thorfdbg/libjpeg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoxyfilter.py
executable file
·43 lines (39 loc) · 898 Bytes
/
doxyfilter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/python
import fileinput
import string
import re
commentblock = 0
emptycomment = re.compile("^//$")
fullcomment = re.compile("^//.")
foldmarker = re.compile("^///")
hppfile = re.compile("^.*\.hpp$")
for line in fileinput.input():
if hppfile.match(fileinput.filename()):
line = string.expandtabs(line)
token = string.strip(line)
indent = len(line) - len(string.lstrip(line))
if (indent > 0):
blanks = string.ljust("",indent-1)
else:
blanks = ""
if emptycomment.match(token):
continue
if fullcomment.match(token) and not foldmarker.match(token):
if commentblock:
print re.sub("//"," ",line),
else:
print
print blanks,
print "/*!"
print re.sub("//"," ",line),
commentblock = 1
else:
if commentblock:
print blanks,
print " */"
print line,
commentblock = 0
else:
print line,
else:
print line,