File: doxyfilter.py

package info (click to toggle)
libjpeg 0.0~git20210129.91985dc-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,664 kB
  • sloc: cpp: 36,104; makefile: 613; ansic: 275; sh: 54; python: 38; perl: 11
file content (43 lines) | stat: -rwxr-xr-x 898 bytes parent folder | download
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
42
43
#!/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,