Skip to content
Open
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
26 changes: 12 additions & 14 deletions src/doxypy.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def addTransition(self, from_state, to_state, condition, callback):

def makeTransition(self, input):
"""Makes a transition based on the given input.

@param input input to parse by the FSM
"""
for transition in self.transitions:
Expand All @@ -86,7 +86,7 @@ def makeTransition(self, input):
self.current_input = input
self.current_transition = transition
if options.debug:
print >>sys.stderr, "# FSM: executing (%s -> %s) for line '%s'" % (from_state, to_state, input)
sys.stderr.write("# FSM: executing (%s -> %s) for line '%s'" % (from_state, to_state, input))
callback(match)
return

Expand Down Expand Up @@ -168,7 +168,6 @@ def __init__(self):
]

self.fsm = FSM("FILEHEAD", transitions)
self.outstream = sys.stdout

self.output = []
self.comment = []
Expand Down Expand Up @@ -208,9 +207,8 @@ def __flushBuffer(self):
if self.output:
try:
if options.debug:
print >>sys.stderr, "# OUTPUT: ", self.output
print >>self.outstream, "\n".join(self.output)
self.outstream.flush()
sys.stderr.write("# OUTPUT: ", self.output)
print("\n".join(self.output))
except IOError:
# Fix for FS#33. Catches "broken pipe" when doxygen closes
# stdout prematurely upon usage of INPUT_FILTER, INLINE_SOURCES
Expand All @@ -228,7 +226,7 @@ def resetCommentSearch(self, match):
Closes the current commentblock and starts a new comment search.
"""
if options.debug:
print >>sys.stderr, "# CALLBACK: resetCommentSearch"
sys.stderr.write("# CALLBACK: resetCommentSearch")
self.__closeComment()
self.startCommentSearch(match)

Expand All @@ -239,7 +237,7 @@ def startCommentSearch(self, match):
the current indentation.
"""
if options.debug:
print >>sys.stderr, "# CALLBACK: startCommentSearch"
sys.stderr.write(sys.stderr, "# CALLBACK: startCommentSearch")
self.defclass = [self.fsm.current_input]
self.comment = []
self.indent = match.group(1)
Expand All @@ -251,7 +249,7 @@ def stopCommentSearch(self, match):
appends the current line to the output.
"""
if options.debug:
print >>sys.stderr, "# CALLBACK: stopCommentSearch"
sys.stderr.write("# CALLBACK: stopCommentSearch")
self.__closeComment()

self.defclass = []
Expand All @@ -263,7 +261,7 @@ def appendFileheadLine(self, match):
Closes the open comment block, resets it and appends the current line.
"""
if options.debug:
print >>sys.stderr, "# CALLBACK: appendFileheadLine"
sys.stderr.write("# CALLBACK: appendFileheadLine")
self.__closeComment()
self.comment = []
self.output.append(self.fsm.current_input)
Expand All @@ -275,7 +273,7 @@ def appendCommentLine(self, match):
well as singleline comments.
"""
if options.debug:
print >>sys.stderr, "# CALLBACK: appendCommentLine"
sys.stderr.write("# CALLBACK: appendCommentLine")
(from_state, to_state, condition, callback) = self.fsm.current_transition

# single line comment
Expand Down Expand Up @@ -312,13 +310,13 @@ def appendCommentLine(self, match):
def appendNormalLine(self, match):
"""Appends a line to the output."""
if options.debug:
print >>sys.stderr, "# CALLBACK: appendNormalLine"
sys.stderr.write("# CALLBACK: appendNormalLine")
self.output.append(self.fsm.current_input)

def appendDefclassLine(self, match):
"""Appends a line to the triggering block."""
if options.debug:
print >>sys.stderr, "# CALLBACK: appendDefclassLine"
sys.stderr.write("# CALLBACK: appendDefclassLine")
self.defclass.append(self.fsm.current_input)

def makeCommentBlock(self):
Expand Down Expand Up @@ -397,7 +395,7 @@ def optParse():
(options, filename) = parser.parse_args()

if not filename:
print >>sys.stderr, "No filename given."
sys.stderr.write("No filename given.")
sys.exit(-1)

return filename[0]
Expand Down