summaryrefslogtreecommitdiff
path: root/bin/ACE-casts-convert
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2005-01-20 09:22:35 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2005-01-20 09:22:35 +0000
commit040143529528f5cb4e583bcfc97e90dc6a6c7559 (patch)
treea1f9e614073c477e2d58e76741432c50b0d46b56 /bin/ACE-casts-convert
parentcab40107f50233d89157981dbbb58f8111fa05a7 (diff)
downloadATCD-040143529528f5cb4e583bcfc97e90dc6a6c7559.tar.gz
ChangeLogTag:Thu Jan 20 01:16:21 2005 Ossama Othman <ossama@dre.vanderbilt.edu>
Diffstat (limited to 'bin/ACE-casts-convert')
-rwxr-xr-xbin/ACE-casts-convert40
1 files changed, 40 insertions, 0 deletions
diff --git a/bin/ACE-casts-convert b/bin/ACE-casts-convert
new file mode 100755
index 00000000000..09a623675c0
--- /dev/null
+++ b/bin/ACE-casts-convert
@@ -0,0 +1,40 @@
+#! /bin/sh
+
+# =============================================================================
+#
+# @file ACE-casts-convert
+#
+# $Id$
+#
+# Script to convert all ACE cast macro calls (e.g.
+# ACE_static_cast (foo, bar)) to their standard C++ counterparts (e.g.
+# static_cast<foo> (bar)).
+#
+# Use this script at your own risk. It appears to work correctly for
+# all cases, but verify the results "just in case".
+#
+# @author Ossama Othman
+#
+# =============================================================================
+
+
+if test "$#" -eq 0; then
+ echo "Usage: $0 FILE [FILE2] ..."
+ echo ""
+ exit 1
+fi
+
+echo ""
+echo "Converting ACE cast macro calls to standard C++ syntax in:"
+
+while test "$#" -gt 0
+do
+ arg="$1"
+ shift
+
+ if grep "ACE_\(static\|dynamic\|const\|reinterpret\)_cast" $arg > /dev/null 2>&1; then
+ echo $arg
+ sed -e :a -e 's/ACE_\(const\|static\|reinterpret\|dynamic\)_cast[ \t]*([ \t]*\([^,]*\)[ \t]*,[ \t]*\([^ \t].*\)/\1_cast<\2> (\3/g; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast[ \t]*([ \t]*\([^,]*\)[ \t]*,[ \t]*$/{N;s/\n//;ba;}; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast[ \t]*(/ba' $arg > ${arg}.new
+ mv ${arg}.new $arg
+ fi
+done