Commit ac81c9b3 authored by Sylvain Thery's avatar Sylvain Thery

script modif ( replace use of operator ^ on string by an awk script )

parent f5e5e901
......@@ -32,6 +32,32 @@ cd ..
app1=`basename $1`
app2=`basename $2`
app1_maj=`echo $app1 | awk '
BEGIN { upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
lower = "abcdefghijklmnopqrstuvwxyz"
}
{
FIRSTCHAR = substr($1, 1, 1)
if (CHAR = index(lower, FIRSTCHAR))
$1 = substr(upper, CHAR, 1) substr($1, 2)
print $0
}' `
app2_maj=`echo $app2 | awk '
BEGIN { upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
lower = "abcdefghijklmnopqrstuvwxyz"
}
{
FIRSTCHAR = substr($1, 1, 1)
if (CHAR = index(lower, FIRSTCHAR))
$1 = substr(upper, CHAR, 1) substr($1, 2)
print $0
}' `
echo remplace $app1 by $app2 in CMakeLists.txt ...
find . -name "CMakeLists.txt" -exec sed -i s/$app1/$app2/g {} \;
......@@ -55,9 +81,9 @@ for f in $list_of_files; do
done
echo Modify contents ...
find . -name "*.cpp" -o -name "*.hpp" -o -name "*.h" -exec sed -i s/${app1^}/${app2^}/g {} \;
find . -name "*.cpp" -exec sed -i s/${app1^}/${app2^}/g {} \;
find . -name "*.h" -exec sed -i s/${app1^}/${app2^}/g {} \;
find . -name "*.cpp" -o -name "*.hpp" -o -name "*.h" -exec sed -i s/${app1_maj}/${app2_maj}/g {} \;
find . -name "*.cpp" -exec sed -i s/${app1_maj}/${app2_maj}/g {} \;
find . -name "*.h" -exec sed -i s/${app1_maj}/${app2_maj}/g {} \;
echo finished
......
......@@ -14,6 +14,20 @@ echo "Warning do not forget to check the CGoGN_ROOT_DIR variable (ccmake)"
apps=$1
#create a string with first letter capitalize (${apps^} does not work on osX !
apps_maj=`echo $1 | awk '
BEGIN { upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
lower = "abcdefghijklmnopqrstuvwxyz"
}
{
FIRSTCHAR = substr($1, 1, 1)
if (CHAR = index(lower, FIRSTCHAR))
$1 = substr(upper, CHAR, 1) substr($1, 2)
print $0
}' `
mkdir $apps
cd $apps
......@@ -128,14 +142,14 @@ echo \#include \"Utils/Qt/qtui.h\" >> ${apps}.h
echo "" >> ${apps}.h
echo "using namespace CGoGN;" >> ${apps}.h
echo "" >> ${apps}.h
echo "class ${apps^}: public Utils::QT::SimpleQT" >> ${apps}.h
echo "class $apps_maj: public Utils::QT::SimpleQT" >> ${apps}.h
echo "{" >> ${apps}.h
echo " Q_OBJECT" >> ${apps}.h
echo "public:" >> ${apps}.h
echo "" >> ${apps}.h
echo " ${apps^}() {}" >> ${apps}.h
echo " $apps_maj() {}" >> ${apps}.h
echo "" >> ${apps}.h
echo " ~${apps^}() {}" >> ${apps}.h
echo " ~$apps_maj() {}" >> ${apps}.h
echo "" >> ${apps}.h
echo " void cb_redraw();" >> ${apps}.h
echo "" >> ${apps}.h
......@@ -188,10 +202,10 @@ echo "**************************************************************************
echo "" >> ${apps}.cpp
echo \#include \"${apps}.h\" >> ${apps}.cpp
echo "" >> ${apps}.cpp
echo "void ${apps^}::cb_initGL()" >> ${apps}.cpp
echo "void $apps_maj::cb_initGL()" >> ${apps}.cpp
echo "{}" >> ${apps}.cpp
echo "" >> ${apps}.cpp
echo "void ${apps^}::cb_redraw()" >> ${apps}.cpp
echo "void $apps_maj::cb_redraw()" >> ${apps}.cpp
echo "{}" >> ${apps}.cpp
echo "" >> ${apps}.cpp
......@@ -199,8 +213,8 @@ echo "int main(int argc, char **argv)" >> ${apps}.cpp
echo "{" >> ${apps}.cpp
echo "" >> ${apps}.cpp
echo " QApplication app(argc, argv);" >> ${apps}.cpp
echo " ${apps^} sqt;" >> ${apps}.cpp
echo " "sqt.setWindowTitle\(\"${apps^}\"\)\; >> ${apps}.cpp
echo " $apps_maj sqt;" >> ${apps}.cpp
echo " "sqt.setWindowTitle\(\"$apps_maj\"\)\; >> ${apps}.cpp
echo "" >> ${apps}.cpp
echo " Utils::QT::uiDockInterface dock;" >> ${apps}.cpp
echo " sqt.setDock(&dock);" >> ${apps}.cpp
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment