]> SALOME platform Git repositories - tools/hxx2salome.git/commitdiff
Salome HOME
tools for creating a c++ component tree for compilation
authorcrouzet <crouzet>
Tue, 25 Oct 2005 14:12:14 +0000 (14:12 +0000)
committercrouzet <crouzet>
Tue, 25 Oct 2005 14:12:14 +0000 (14:12 +0000)
scripts/SA_new_cpp_component [new file with mode: 0755]
scripts/cpp_compo_template.tgz [new file with mode: 0644]

diff --git a/scripts/SA_new_cpp_component b/scripts/SA_new_cpp_component
new file mode 100755 (executable)
index 0000000..e59c54c
--- /dev/null
@@ -0,0 +1,85 @@
+#!/bin/bash
+
+usage()
+{
+    echo
+    echo Usage :
+    echo
+    echo "  SA_new_cpp_component  Name"
+    echo
+    echo "  -> create the tree to compile a new C++ component linked with MED libs"
+    echo 
+    exit 1
+}
+
+rename_dir()
+{
+    # Rename the first directory containing $oldName in their file name
+    liste=`find . -type d -name "*${oldName}*"`
+    for file in $liste
+    do
+       newFile=`echo $file | sed "s/${oldName}/${newName}/g"`
+       echo "mv -f $file $newFile"
+       mv -f $file $newFile
+       return 1
+    done
+    return 0
+}
+
+if [ $# -ne 1 ]
+then
+   usage
+fi
+
+tar xvfz ${HXX2SALOME_ROOT_DIR}/cpp_compo_template.tgz
+moduleName=${1}_CPP_SRC
+mv template_SRC ${moduleName}
+
+oldName=template
+newName=$1
+
+today=`date +%d%m%y`
+cd ${moduleName}
+echo
+echo Renamed Directories:
+echo
+
+# rename directories one by one
+rename_dir
+while [ $? -eq 1 ]
+do
+    rename_dir
+done
+
+# rename files containing ${oldName} in their name
+echo
+echo Renamed Files:
+echo
+liste=`find . -name "*${oldName}*"`
+for file in $liste
+do
+    newFile=`echo $file | sed "s/${oldName}/${newName}/g"`
+    echo "mv -f $file $newFile"
+    mv -f $file $newFile
+done
+
+echo
+echo Modified Files:
+echo
+# modify all files containing $oldName, replace occurences by $newName
+liste=`find -name "*"`
+for file in $liste
+do
+    if [ -f $file ]
+    then
+       grep $oldName $file > /dev/null 2>&1
+       if [ $? -eq 0 ]
+       then
+           echo $file
+           cat $file | sed "s/${oldName}/${newName}/g" > fic_temp_${today}
+           cp -f fic_temp_${today} $file
+       fi
+    fi
+done
+rm -f fic_temp_${today}
+cd -
diff --git a/scripts/cpp_compo_template.tgz b/scripts/cpp_compo_template.tgz
new file mode 100644 (file)
index 0000000..86bdd4d
Binary files /dev/null and b/scripts/cpp_compo_template.tgz differ