summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rwxr-xr-xscripts/qdebug-odebug.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/scripts/qdebug-odebug.py b/scripts/qdebug-odebug.py
index 636c1b2..7a417e1 100755
--- a/scripts/qdebug-odebug.py
+++ b/scripts/qdebug-odebug.py
@@ -9,11 +9,11 @@ manual work may be needed after applying the script.
9 9
10import sys, sre 10import sys, sre
11 11
12qDebugExpression = sre.compile( '(.*)(qDebug)\(\s*(.*)\s*\);(.*)' ) 12qDebugExpression = sre.compile( '(?P<head>.*)(?P<statement>qDebug)\(\s*(?P<content>.*)\s*\);(?P<tail>.*)' )
13qWarningExpression = sre.compile( '(.*)(qWarning)\(\s*(.*)\s*\);(.*)' ) 13qWarningExpression = sre.compile( '(?P<head>.*)(?P<statement>qWarning)\(\s*(?P<content>.*)\s*\);(?P<tail>.*)' )
14qErrorExpression = sre.compile( '(.*)(qError)\(\s*(.*)\s*\);(.*)' ) 14qErrorExpression = sre.compile( '(?P<head>.*)(?P<statement>qError)\(\s*(?P<content>.*)\s*\);(?P<tail>.*)' )
15qFatalExpression = sre.compile( '(.*)(qFatal)\(\s*(.*)\s*\);(.*)' ) 15qFatalExpression = sre.compile( '(?P<head>.*)(?P<statement>qFatal)\(\s*(?P<content>.*)\s*\);(?P<tail>.*)' )
16printfExpression = sre.compile( '(.*)(printf)\(\s*(.*)\s*\);(.*)' ) 16#printfExpression = sre.compile( '(?P<head>.*)(?![s\.])(?P<statement>printf)\(\s*(?P<content>.*)\s*\);(?P<tail>.*)' )
17 17
18debugTable = { "qDebug" : "odebug", 18debugTable = { "qDebug" : "odebug",
19 "qWarning" : "owarn", 19 "qWarning" : "owarn",
@@ -21,7 +21,7 @@ debugTable = { "qDebug" : "odebug",
21 "qFatal" : "ofatal", 21 "qFatal" : "ofatal",
22 "printf" : "odebug" } 22 "printf" : "odebug" }
23 23
24allExpressions = ( qDebugExpression, qWarningExpression, qErrorExpression, qFatalExpression, printfExpression ) 24allExpressions = ( qDebugExpression, qWarningExpression, qErrorExpression, qFatalExpression ) #, printfExpression )
25 25
26#################################################################################################### 26####################################################################################################
27 27
@@ -36,7 +36,12 @@ def convert( fname ):
36 continue 36 continue
37 else: 37 else:
38 match = True 38 match = True
39 head, debug, content, tail = m.groups() 39
40 head = m.groupdict()["head"]
41 debug = m.groupdict()["statement"]
42 content = m.groupdict()["content"]
43 tail = m.groupdict()["tail"]
44
40 print >>sys.stderr, "<NOTE>: Groups = ", m.groups() 45 print >>sys.stderr, "<NOTE>: Groups = ", m.groups()
41 sys.stdout.write( head ) # don't strip() here, because we want to keep indentation 46 sys.stdout.write( head ) # don't strip() here, because we want to keep indentation
42 sys.stdout.write( debugTable[debug.strip()] ) 47 sys.stdout.write( debugTable[debug.strip()] )
@@ -95,7 +100,7 @@ def transform( s ):
95 else: # % in formatstring 100 else: # % in formatstring
96 indirective = True 101 indirective = True
97 i += 1 102 i += 1
98 while i < len( formatstring ) and formatstring[i] not in "%dDiouxXfegEscpn": 103 while i < len( formatstring ) and formatstring[i] not in "%dDiouxXfFegEscpn":
99 i += 1 104 i += 1
100 if formatstring[i] == "%": 105 if formatstring[i] == "%":
101 result += "%" 106 result += "%"