summaryrefslogtreecommitdiff
path: root/scripts
Side-by-side diff
Diffstat (limited to 'scripts') (more/less context) (ignore whitespace changes)
-rwxr-xr-xscripts/qdebug-odebug.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/scripts/qdebug-odebug.py b/scripts/qdebug-odebug.py
index cc1b7ca..636c1b2 100755
--- a/scripts/qdebug-odebug.py
+++ b/scripts/qdebug-odebug.py
@@ -15,2 +15,3 @@ qErrorExpression = sre.compile( '(.*)(qError)\(\s*(.*)\s*\);(.*)' )
qFatalExpression = sre.compile( '(.*)(qFatal)\(\s*(.*)\s*\);(.*)' )
+printfExpression = sre.compile( '(.*)(printf)\(\s*(.*)\s*\);(.*)' )
@@ -19,5 +20,6 @@ debugTable = { "qDebug" : "odebug",
"qError" : "oerr",
- "qFatal" : "ofatal" }
+ "qFatal" : "ofatal",
+ "printf" : "odebug" }
-allExpressions = ( qDebugExpression, qWarningExpression, qErrorExpression, qFatalExpression )
+allExpressions = ( qDebugExpression, qWarningExpression, qErrorExpression, qFatalExpression, printfExpression )
@@ -38,3 +40,3 @@ def convert( fname ):
print >>sys.stderr, "<NOTE>: Groups = ", m.groups()
- sys.stdout.write( head.strip() )
+ sys.stdout.write( head ) # don't strip() here, because we want to keep indentation
sys.stdout.write( debugTable[debug.strip()] )
@@ -43,3 +45,4 @@ def convert( fname ):
sys.stdout.write( " << oendl; " )
- sys.stdout.write( tail + "\n" )
+ sys.stdout.write( tail )
+ if not tail.endswith( "\n" ): sys.stdout.write( "\n" )
continue
@@ -47,3 +50,3 @@ def convert( fname ):
if not match:
- sys.stdout.write( line + "\n" )
+ sys.stdout.write( line )
@@ -99,3 +102,3 @@ def transform( s ):
else:
- result += '" << %s << "' % substitutions[0]
+ result += '" << %s << "' % substitutions[0].replace( "(const char*)", "" ).replace( ".latin1()", "" )
del substitutions[0]