From 7bb4259779332cc76ed4a2d05e1c8bcb1c5ab9d7 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 24 Aug 2011 12:21:55 -0500 Subject: [PATCH] Add scripts to autogenerate a "real" TQt3 from the Qt3 sources in GIT --- qt3-tqt3/README | 2 + qt3-tqt3/convert_qt_itself_qt3 | 139 ++++++++++++++++++++++++++ qt3-tqt3/convert_qt_itself_qt3_helper | 5 + qt3-tqt3/convert_qt_itself_qt3_rename | 13 +++ qt3-tqt3/create_tqt3_from_qt3 | 5 + qt3-tqt3/tqt3_fixups.diff | 28 ++++++ 6 files changed, 192 insertions(+) create mode 100644 qt3-tqt3/README create mode 100755 qt3-tqt3/convert_qt_itself_qt3 create mode 100755 qt3-tqt3/convert_qt_itself_qt3_helper create mode 100755 qt3-tqt3/convert_qt_itself_qt3_rename create mode 100755 qt3-tqt3/create_tqt3_from_qt3 create mode 100644 qt3-tqt3/tqt3_fixups.diff diff --git a/qt3-tqt3/README b/qt3-tqt3/README new file mode 100644 index 0000000..152b71c --- /dev/null +++ b/qt3-tqt3/README @@ -0,0 +1,2 @@ +Run create_tqt3_from_qt3 within this directory to create a version of Qt3 that uses TQ* objects +This is somewhat experimental so please be careful! diff --git a/qt3-tqt3/convert_qt_itself_qt3 b/qt3-tqt3/convert_qt_itself_qt3 new file mode 100755 index 0000000..8f0b8b6 --- /dev/null +++ b/qt3-tqt3/convert_qt_itself_qt3 @@ -0,0 +1,139 @@ +#!/bin/bash + +#find ./ -type f -iname "*.c*" -exec sed -i 's/Q\([ABCDEFGHIJKLMNOPQRSTUVWXYZ]\)\([_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]\)\([_abcdefghijklmnopqrstuvwxyzDE]\)/TQ\1\2\3/g' {} \; +#find ./ -type f -iname "*.h*" -exec sed -i 's/Q\([ABCDEFGHIJKLMNOPQRSTUVWXYZ]\)\([_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]\)\([_abcdefghijklmnopqrstuvwxyzDE]\)/TQ\1\2\3/g' {} \; + +find ./ -type f -iname "*.c*" -exec sed -i 's/^Q\([ABCDEFGHIJKLMNOPQRSTUVWXYZ]\)\([_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]\)/TQ\1\2/g' {} \; +find ./ -type f -iname "*.h*" -exec sed -i 's/^Q\([ABCDEFGHIJKLMNOPQRSTUVWXYZ]\)\([_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]\)/TQ\1\2/g' {} \; + +find ./ -type f -iname "*.c*" -exec sed -i 's/\([^_]\)Q\([ABCDEFGHIJKLMNOPQRSTUVWXYZ]\)\([_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]\)/\1TQ\2\3/g' {} \; +find ./ -type f -iname "*.h*" -exec sed -i 's/\([^_]\)Q\([ABCDEFGHIJKLMNOPQRSTUVWXYZ]\)\([_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]\)/\1TQ\2\3/g' {} \; + +find ./ -type f -iname "*.c*" -exec sed -i 's/Qt/TQt/g' {} \; +find ./ -type f -iname "*.h*" -exec sed -i 's/Qt/TQt/g' {} \; + +find ./ -type f -iname "*.h*" -exec sed -i 's/TTQ/TQ/g' {} \; +find ./ -type f -iname "*.h*" -exec sed -i 's/TTQ/TQ/g' {} \; +find ./ -type f -iname "*.h*" -exec sed -i 's/TTQ/TQ/g' {} \; +find ./ -type f -iname "*.h*" -exec sed -i 's/TTQ/TQ/g' {} \; +find ./ -type f -iname "*.c*" -exec sed -i 's/TTQ/TQ/g' {} \; +find ./ -type f -iname "*.c*" -exec sed -i 's/TTQ/TQ/g' {} \; +find ./ -type f -iname "*.c*" -exec sed -i 's/TTQ/TQ/g' {} \; +find ./ -type f -iname "*.c*" -exec sed -i 's/TTQ/TQ/g' {} \; + +sed -i 's/^Q\([ABCDEFGHIJKLMNOPQRSTUVWXYZ]\)\([_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]\)/TQ\1\2/g' src/moc/moc.l +sed -i 's/^Q\([ABCDEFGHIJKLMNOPQRSTUVWXYZ]\)\([_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]\)/TQ\1\2/g' src/moc/moc.y +sed -i 's/\([^_]\)Q\([ABCDEFGHIJKLMNOPQRSTUVWXYZ]\)\([_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]\)/\1TQ\2\3/g' src/moc/moc.l +sed -i 's/\([^_]\)Q\([ABCDEFGHIJKLMNOPQRSTUVWXYZ]\)\([_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]\)/\1TQ\2\3/g' src/moc/moc.y +sed -i 's/Qt/TQt/g' src/moc/moc.l +sed -i 's/Qt/TQt/g' src/moc/moc.y +sed -i 's/TTQ/TQ/g' src/moc/moc.l +sed -i 's/TTQ/TQ/g' src/moc/moc.y +sed -i 's/TTQ/TQ/g' src/moc/moc.l +sed -i 's/TTQ/TQ/g' src/moc/moc.y +sed -i 's/TTQ/TQ/g' src/moc/moc.l +sed -i 's/TTQ/TQ/g' src/moc/moc.y +sed -i 's/TTQ/TQ/g' src/moc/moc.l +sed -i 's/TTQ/TQ/g' src/moc/moc.y + +if [[ 0 == 1 ]]; then + +find ./ -type f -iname "*.c*" -exec sed -i 's/\([^_]\)METHOD\([( ]\)/\1TQT_METHOD\2/g' {} \; +find ./ -type f -iname "*.h*" -exec sed -i 's/\([^_]\)METHOD\([( ]\)/\1TQT_METHOD\2/g' {} \; +find ./ -type f -iname "*.c*" -exec sed -i 's/\([^_]\)SLOT\([( ]\)/\1TQT_SLOT\2/g' {} \; +find ./ -type f -iname "*.h*" -exec sed -i 's/\([^_]\)SLOT\([( ]\)/\1TQT_SLOT\2/g' {} \; +find ./ -type f -iname "*.c*" -exec sed -i 's/\([^_]\)SIGNAL\([( ]\)/\1TQT_SIGNAL\2/g' {} \; +find ./ -type f -iname "*.h*" -exec sed -i 's/\([^_]\)SIGNAL\([( ]\)/\1TQT_SIGNAL\2/g' {} \; + +find ./ -type f -iname "*.h*" -exec sed -i 's/TQT_TQT_/TQT_/g' {} \; +find ./ -type f -iname "*.h*" -exec sed -i 's/TQT_TQT_/TQT_/g' {} \; +find ./ -type f -iname "*.h*" -exec sed -i 's/TQT_TQT_/TQT_/g' {} \; +find ./ -type f -iname "*.h*" -exec sed -i 's/TQT_TQT_/TQT_/g' {} \; +find ./ -type f -iname "*.c*" -exec sed -i 's/TQT_TQT_/TQT_/g' {} \; +find ./ -type f -iname "*.c*" -exec sed -i 's/TQT_TQT_/TQT_/g' {} \; +find ./ -type f -iname "*.c*" -exec sed -i 's/TQT_TQT_/TQT_/g' {} \; +find ./ -type f -iname "*.c*" -exec sed -i 's/TQT_TQT_/TQT_/g' {} \; + +find ./ -type f -iname "*" -exec sed -i 's/MOC/TQMOC/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/TQTQMOC/TQMOC/g' {} \; + +find ./ -type f -iname "*" -exec sed -i 's/RGB_MASK/TQRGB_MASK/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/TQTQRGB_MASK/TQRGB_MASK/g' {} \; + +find ./ -type f -iname "*" -exec sed -i 's/tqslots/Q_SLOTS/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/tqsignals/Q_SIGNALS/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/Q_SIGNALSlotimp\.h/tqsignalslotimp\.h/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/TQ_SLOTS/Q_SLOTS/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/TQ_SIGNALS/Q_SIGNALS/g' {} \; + +find ./ -type f -iname "*.c*" -exec sed -i 's/Q_/TQ_/g' {} \; +find ./ -type f -iname "*.h*" -exec sed -i 's/Q_/TQ_/g' {} \; + +# Certain Things Are Sacred +cd src/ + +# Rename headers +../../convert_qt_itself_qt3_rename + +# Move files +find . -type d -exec ../../convert_qt_itself_qt3_helper "{}" \; + +cd ../ + +cd qmake/ + +# Rename headers +../../convert_qt_itself_qt3_rename + +cd ../ + +cd tools/ + +# Rename headers +../../convert_qt_itself_qt3_rename + +cd ../ + +cd qmake/ + +find . -type d -exec ../../convert_qt_itself_qt3_helper "{}" \; +../../convert_qt_itself_qt3_rename + +cd ../ + +cd include +ls -l | awk '{print "ln -s", $10, " ", $8, " && rm ", $8}' | sed 's/\(.*\) q\(.*\)\.h/\1 tq\2\.h/g' | sed 's/\(.*\)\/q\(.*\)\.h/\1\/tq\2\.h/g' | sh +cd .. + +for i in {1..50} +do + find ./ -type f -iname "*.pro" -exec sed -i 's/\(.*\)\/q\(.*\)\.c\(.*\)/\1\/tq\2\.c\3/g' {} \; + find ./ -type f -iname "*.pro" -exec sed -i 's/\(.*\)\/q\(.*\)\.h\(.*\)/\1\/tq\2\.h\3/g' {} \; + + find ./ -type f -iname "*.pri" -exec sed -i 's/\(.*\)\/q\(.*\)\.c\(.*\)/\1\/tq\2\.c\3/g' {} \; + find ./ -type f -iname "*.pri" -exec sed -i 's/\(.*\)\/q\(.*\)\.h\(.*\)/\1\/tq\2\.h\3/g' {} \; +done + +fi + +# Back out changes we did not want to make +find ./ -type f -iname "*" -exec sed -i 's/TQT_/QT_/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/TQMAKE/QMAKE/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/TQTDIR/QTDIR/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/OBLITQUE/OBLIQUE/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/ATQUA/AQUA/g' {} \; + +find ./ -type f -iname "*" -exec sed -i 's/QUType_Q/QUType_TQ/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/\([ (]\)Q\#\#/\1TQ\#\#/g' {} \; +find ./ -type f -iname "*" -exec sed -i 's/STQL/SQL/g' {} \; + +# Apply patches +patch -p0 < ../tqt3_fixups.diff + +exit 0 + +# Fix up configure +sed -i 's/qconfig\./tqconfig\./g' configure +sed -i 's/qmodules\./tqmodules\./g' configure +#sed -i 's/qtmd5/tqtmd5/g' ./qmake/Makefile.unix +sed -i 's/\([ =/]\)q/\1tq/g' ./qmake/Makefile.unix diff --git a/qt3-tqt3/convert_qt_itself_qt3_helper b/qt3-tqt3/convert_qt_itself_qt3_helper new file mode 100755 index 0000000..2e8c97d --- /dev/null +++ b/qt3-tqt3/convert_qt_itself_qt3_helper @@ -0,0 +1,5 @@ +#!/bin/bash + +cd $1 +ls -d * | sed 's/^q\(.*\)\.h\(.*\)$/mv "&" "tq\1\.h\2"/' | grep mv | sh +ls -d * | sed 's/^q\(.*\)\.c\(.*\)$/mv "&" "tq\1\.c\2"/' | grep mv | sh diff --git a/qt3-tqt3/convert_qt_itself_qt3_rename b/qt3-tqt3/convert_qt_itself_qt3_rename new file mode 100755 index 0000000..d78be6f --- /dev/null +++ b/qt3-tqt3/convert_qt_itself_qt3_rename @@ -0,0 +1,13 @@ +#!/bin/bash + +find ./ -type f -iname "*.c*" -exec sed -i 's/\(["<]\)q\(.*\)\.h\([">]\)/\1tq\2\.h\3/g' {} \; +find ./ -type f -iname "*.h*" -exec sed -i 's/\(["<]\)q\(.*\)\.h\([">]\)/\1tq\2\.h\3/g' {} \; + +find ./ -type f -iname "*.c*" -exec sed -i 's/\/q\(.*\)\.h\([">]\)/\/tq\1\.h\2/g' {} \; +find ./ -type f -iname "*.h*" -exec sed -i 's/\/q\(.*\)\.h\([">]\)/\/tq\1\.h\2/g' {} \; + +find ./ -type f -iname "*.c*" -exec sed -i 's/\(["<]\)q\(.*\)\.moc\([">]\)/\1tq\2\.moc\3/g' {} \; +find ./ -type f -iname "*.h*" -exec sed -i 's/\(["<]\)q\(.*\)\.moc\([">]\)/\1tq\2\.moc\3/g' {} \; + +find ./ -type f -iname "*.c*" -exec sed -i 's/\(["<]\)q\(.*\)\.cpp\([">]\)/\1tq\2\.cpp\3/g' {} \; +find ./ -type f -iname "*.h*" -exec sed -i 's/\(["<]\)q\(.*\)\.cpp\([">]\)/\1tq\2\.cpp\3/g' {} \; diff --git a/qt3-tqt3/create_tqt3_from_qt3 b/qt3-tqt3/create_tqt3_from_qt3 new file mode 100755 index 0000000..bbde8ec --- /dev/null +++ b/qt3-tqt3/create_tqt3_from_qt3 @@ -0,0 +1,5 @@ +#!/bin/bash + +cp -Rp ../../main/dependencies/qt3/ tqt3 +cd tqt3 +../convert_qt_itself_qt3 diff --git a/qt3-tqt3/tqt3_fixups.diff b/qt3-tqt3/tqt3_fixups.diff new file mode 100644 index 0000000..2f12550 --- /dev/null +++ b/qt3-tqt3/tqt3_fixups.diff @@ -0,0 +1,28 @@ +diff -ur src/moc/moc.y src/moc/moc.y +--- src/moc/moc.y 2011-08-23 02:50:57.000000000 -0500 ++++ src/moc/moc.y 2011-08-24 01:46:17.000000000 -0500 +@@ -3422,8 +3422,8 @@ + else if ( type == "Q_ULLONG" ) + fprintf( out, "v->asULongLong()" ); + else if ( isVariantType( type ) ) { +- if ( type[0] == 'Q' ) +- type = type.mid(1); ++ if (( type[0] == 'T' ) && ( type[1] == 'Q' )) ++ type = type.mid(2); + else + type[0] = toupper( type[0] ); + fprintf( out, "v->as%s()", type.data() ); +diff -ur src/moc/moc_yacc.cpp src/moc/moc_yacc.cpp +--- src/moc/moc_yacc.cpp 2011-08-23 02:03:46.000000000 -0500 ++++ src/moc/moc_yacc.cpp 2011-08-24 01:46:45.000000000 -0500 +@@ -3462,8 +3462,8 @@ + else if ( type == "Q_ULLONG" ) + fprintf( out, "v->asULongLong()" ); + else if ( isVariantType( type ) ) { +- if ( type[0] == 'Q' ) +- type = type.mid(1); ++ if (( type[0] == 'T' ) && ( type[1] == 'Q' )) ++ type = type.mid(2); + else + type[0] = toupper( type[0] ); + fprintf( out, "v->as%s()", type.data() );