Files
PolyORB/support/enable-conditional-debug
Thomas Quinot 36702604f0 Perform substitution only on the src subdirectory.
For EB18-013

[Imported from Perforce change 9799 at 2006-12-01 22:15:35]

Subversion-branch: /trunk/polyorb
Subversion-revision: 37266
2005-12-21 14:35:10 +00:00

49 lines
1.1 KiB
Bash
Executable File

#! /bin/sh
# $Id$
set -e
if [ $# -gt 1 ]; then
echo "Usage: $0 [<file>]"
exit 1
fi
if [ $# = 0 ]; then
marker="CONDITIONAL_PRAGMA_DEBUG_ENABLED"
if [ ! -f MANIFEST ]; then
echo "This script must be run from the top level source directory"
exit 1
fi
if [ -f "$marker" ]; then
echo "Conditional pragma Debug is already enabled"
exit 1
fi
DOLIST='find src -type f -name "*.adb"'
else
DOLIST='echo "$1"'
fi
eval "$DOLIST" | while read f; do
rm -f "$f.new"
awk '
/pragma Debug/ { pragma_debug_seen = 1; }
pragma_debug_seen && /pragma Unreferenced/ {
sub (/pragma Unreferenced.*--/, "--");
pragma_debug_seen = 0;
}
pragma_debug_seen && /\(O1/ { sub (/\(O1/, "(C1, O1"); pragma_debug_seen = 0; }
pragma_debug_seen && /\(O2/ { sub (/\(O2/, "(C2, O2"); pragma_debug_seen = 0; }
pragma_debug_seen && /\(O/ { sub (/\(O/, "(C, O"); pragma_debug_seen = 0; }
pragma_debug_seen && /;/ { pragma_debug_seen = 0; }
{print}' < "$f" > "$f.new"
#awk '{if (length($0) > 79) { print NR; }}' < $f.new | sed "s,^,$f:,"
mv -f "$f.new" "$f"
done
if [ $# = 0 ]; then
echo "Conditional pragma Debug is now enabled"
touch $marker
fi