-rwxr-xr-x | scripts/qdebug-odebug.py | 15 |
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*\);(.*)' ) | |||
15 | qFatalExpression = sre.compile( '(.*)(qFatal)\(\s*(.*)\s*\);(.*)' ) | 15 | qFatalExpression = sre.compile( '(.*)(qFatal)\(\s*(.*)\s*\);(.*)' ) |
16 | printfExpression = sre.compile( '(.*)(printf)\(\s*(.*)\s*\);(.*)' ) | ||
16 | 17 | ||
@@ -19,5 +20,6 @@ debugTable = { "qDebug" : "odebug", | |||
19 | "qError" : "oerr", | 20 | "qError" : "oerr", |
20 | "qFatal" : "ofatal" } | 21 | "qFatal" : "ofatal", |
22 | "printf" : "odebug" } | ||
21 | 23 | ||
22 | allExpressions = ( qDebugExpression, qWarningExpression, qErrorExpression, qFatalExpression ) | 24 | allExpressions = ( qDebugExpression, qWarningExpression, qErrorExpression, qFatalExpression, printfExpression ) |
23 | 25 | ||
@@ -38,3 +40,3 @@ def convert( fname ): | |||
38 | print >>sys.stderr, "<NOTE>: Groups = ", m.groups() | 40 | print >>sys.stderr, "<NOTE>: Groups = ", m.groups() |
39 | sys.stdout.write( head.strip() ) | 41 | sys.stdout.write( head ) # don't strip() here, because we want to keep indentation |
40 | sys.stdout.write( debugTable[debug.strip()] ) | 42 | sys.stdout.write( debugTable[debug.strip()] ) |
@@ -43,3 +45,4 @@ def convert( fname ): | |||
43 | sys.stdout.write( " << oendl; " ) | 45 | sys.stdout.write( " << oendl; " ) |
44 | sys.stdout.write( tail + "\n" ) | 46 | sys.stdout.write( tail ) |
47 | if not tail.endswith( "\n" ): sys.stdout.write( "\n" ) | ||
45 | continue | 48 | continue |
@@ -47,3 +50,3 @@ def convert( fname ): | |||
47 | if not match: | 50 | if not match: |
48 | sys.stdout.write( line + "\n" ) | 51 | sys.stdout.write( line ) |
49 | 52 | ||
@@ -99,3 +102,3 @@ def transform( s ): | |||
99 | else: | 102 | else: |
100 | result += '" << %s << "' % substitutions[0] | 103 | result += '" << %s << "' % substitutions[0].replace( "(const char*)", "" ).replace( ".latin1()", "" ) |
101 | del substitutions[0] | 104 | del substitutions[0] |