Debian Codegraph @

bin/ACE-casts-convert

raw symbols SCIP
1 #! /bin/shscip-shell filesystem . . `/bin/sh`.
2
3 # =============================================================================
4 #
5 # @file ACE-casts-convert
6 #
7 # Script to convert all ACE cast macro calls (e.g.
8 # ACE_static_cast (foo, bar)) to their standard C++ counterparts (e.g.
9 # static_cast<foo> (bar)).
10 #
11 # Use this script at your own risk. It appears to work correctly for
12 # most cases, but verify the results "just in case".
13 #
14 # @note Wildcards may be supplied as the "FILE" arguments to this
15 # script since the shell should expand the wildcards before
16 # executing the script.
17 #
18 # @bug The sed program used in this script may loop indefinitely on
19 # ACE casts with arguments split across multiple lines
20 # containing patterns it doesn't recognize.
21 #
22 # @author Ossama Othman
23 #
24 # =============================================================================
25
26
27 if testscip-shell system . . test. "$#" -eq 0; then
28 echoscip-shell system . . echo. "Usage: $0 FILE [FILE2] ..."
29 echoscip-shell system . . echo. ""
30 exit 1
31 fi
32
33 echoscip-shell system . . echo. ""
34 echoscip-shell system . . echo. "Converting ACE cast macro calls to standard C++ syntax in:"
35
36 while testscip-shell system . . test. "$#" -gt 0
37 do
38 arg="$1"
39 shift
40
41 if grepscip-shell system . . grep. "ACE_\(static\|dynamic\|const\|reinterpret\)_cast" $arg > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1; then
42 echoscip-shell system . . echo. " $arg"
43 sedscip-shell system . . 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]*([ \t]*$/{N;s/\n//;ba;}; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast[ \t]*$/{N;s/\n//;ba;}; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast[ \t]*(/ba' \
44 -e :aa -e 's/ACE_\(const\|static\|reinterpret\|dynamic\)_cast_[1-5]_ref[ \t]*([ \t]*\([^,]*\)[ \t]*,\(.*\),[ \t]*\([^,]*\)/\1_cast<\2<\3> \&> (\4/g; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast_[1-5]_ref[ \t]*([ \t]*\([^,]*\)[ \t]*,[ \t]*$/{N;s/\n//;baa;}; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast_[1-5]_ref[ \t]*([ \t]*$/{N;s/\n//;baa;}; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast_[1-5]_ref[ \t]*$/{N;s/\n//;baa;}; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast_[1-5]_ref[ \t]*(/baa' \
45 -e :aaa -e 's/ACE_\(const\|static\|reinterpret\|dynamic\)_cast_[1-5]_ptr[ \t]*([ \t]*\([^,]*\)[ \t]*,\(.*\),[ \t]*\([^,]*\)/\1_cast<\2<\3> \*> (\4/g; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast_[1-5]_ptr[ \t]*([ \t]*\([^,]*\)[ \t]*,[ \t]*$/{N;s/\n//;baaa;}; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast_[1-5]_ptr[ \t]*([ \t]*$/{N;s/\n//;baaa;}; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast_[1-5]_ptr[ \t]*$/{N;s/\n//;baaa;}; /ACE_\(const\|static\|reinterpret\|dynamic\)_cast_[1-5]_ptr[ \t]*(/baaa' $arg > ${arg}.new
46 mvscip-shell system . . mv. ${arg}.new $arg
47 fi
48 done