summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-04-03 13:45:37 (UTC)
committer mickeyl <mickeyl>2004-04-03 13:45:37 (UTC)
commita8e37033a05dd7771cc1e73f387004f31683049d (patch) (side-by-side diff)
tree0791911c75cea495fd69b6ef13aef6430a8738ee
parente995afe17ead003dd0b4bc12604d7f8cb5cd4493 (diff)
downloadopie-a8e37033a05dd7771cc1e73f387004f31683049d.zip
opie-a8e37033a05dd7771cc1e73f387004f31683049d.tar.gz
opie-a8e37033a05dd7771cc1e73f387004f31683049d.tar.bz2
small fixes and add 'printf' to the number of substituted constructs
the script seems to work good, i converted the whole 'noncore' which will be commited in a few hours. basically the only amount of handwork after applying the script is adding #include <opie2/odebug.h> and using namespace Opie::Core - if it's not already there.
Diffstat (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
@@ -14,11 +14,13 @@ qWarningExpression = sre.compile( '(.*)(qWarning)\(\s*(.*)\s*\);(.*)' )
qErrorExpression = sre.compile( '(.*)(qError)\(\s*(.*)\s*\);(.*)' )
qFatalExpression = sre.compile( '(.*)(qFatal)\(\s*(.*)\s*\);(.*)' )
+printfExpression = sre.compile( '(.*)(printf)\(\s*(.*)\s*\);(.*)' )
debugTable = { "qDebug" : "odebug",
"qWarning" : "owarn",
"qError" : "oerr",
- "qFatal" : "ofatal" }
+ "qFatal" : "ofatal",
+ "printf" : "odebug" }
-allExpressions = ( qDebugExpression, qWarningExpression, qErrorExpression, qFatalExpression )
+allExpressions = ( qDebugExpression, qWarningExpression, qErrorExpression, qFatalExpression, printfExpression )
####################################################################################################
@@ -37,14 +39,15 @@ def convert( fname ):
head, debug, content, tail = m.groups()
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()] )
sys.stdout.write( " << " )
sys.stdout.write( transform( content ).strip() )
sys.stdout.write( " << oendl; " )
- sys.stdout.write( tail + "\n" )
+ sys.stdout.write( tail )
+ if not tail.endswith( "\n" ): sys.stdout.write( "\n" )
continue
# nothing applies
if not match:
- sys.stdout.write( line + "\n" )
+ sys.stdout.write( line )
####################################################################################################
@@ -98,5 +101,5 @@ def transform( s ):
result += "%"
else:
- result += '" << %s << "' % substitutions[0]
+ result += '" << %s << "' % substitutions[0].replace( "(const char*)", "" ).replace( ".latin1()", "" )
del substitutions[0]
indirective = False