2007-05-08 Paul Gilliam <pgilliam@us.ibm.com>
[deliverable/binutils-gdb.git] / gdb / observer.sh
index c67346fed3c6b70947d753da01b7d40e99c036b8..a32b38099f9899e4c81ae449d351c7ecad3c6c1e 100755 (executable)
@@ -1,5 +1,10 @@
 #!/bin/sh -e
 
+# Make certain that the script is not running in an internationalized
+# environment.
+LANG=c ; export LANG
+LC_ALL=c ; export LC_ALL
+
 if test $# -ne 3
 then
     echo "Usage: $0 <h|inc> <observer.texi> <observer.out>" 1>&2
@@ -8,18 +13,23 @@ fi
 
 lang=$1 ; shift
 texi=$1 ; shift
-o=$1 ; shift
-echo "Creating ${o}-tmp" 1>&2
-rm -f ${o}-tmp
+o=$1
+case $lang in
+  h) tmp=htmp ;;
+  inc) tmp=itmp ;;
+esac
+otmp="`echo $1 | sed -e 's,\.[^.]*$,,'`.$tmp"; shift
+echo "Creating ${otmp}" 1>&2
+rm -f ${otmp}
 
 # Can use any of the following: cat cmp cp diff echo egrep expr false
 # grep install-info ln ls mkdir mv pwd rm rmdir sed sleep sort tar
 # test touch true
 
-cat <<EOF >>${o}-tmp
+cat <<EOF >>${otmp}
 /* GDB Notifications to Observers.
 
-   Copyright 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -35,8 +45,8 @@ cat <<EOF >>${o}-tmp
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.
 
    --
 
@@ -46,38 +56,46 @@ EOF
 
 
 case $lang in
-    h) cat <<EOF >>${o}-tmp
+    h) cat <<EOF >>${otmp}
 #ifndef OBSERVER_H
 #define OBSERVER_H
 
 struct observer;
 struct bpstats;
+struct so_list;
 EOF
         ;;
 esac
 
+# We are about to set IFS=:, so DOS-style file names with a drive
+# letter and a colon will be in trouble.
+
+if test -n "$DJGPP"
+then
+     texi=`echo $texi | sed -e 's,^\([a-zA-Z]\):/,/dev/\1/,'`
+fi
 
 # generate a list of events that can be observed
 
 IFS=:
 sed -n '
 /@deftypefun void/{
-    # Save original line for later processing into the actual parameter
+# Save original line for later processing into the actual parameter
     h
-    # Convert from: @deftypefun void EVENT (TYPE @var{PARAM},...)
-    # to event and formals: EVENT:TYPE PARAM, ...:
+# Convert from: @deftypefun void EVENT (TYPE @var{PARAM},...)
+# to event and formals: EVENT:TYPE PARAM, ...:
     s/^.* void \([a-z_][a-z_]*\) (\(.*\))$/\1:\2/
     s/@var{//g
     s/}//g
-    # Switch to held
+# Switch to held
     x
-    # Convert from: @deftypefun void FUNC (TYPE @var{PARAM},...)
-    # to actuals: PARAM, ...
+# Convert from: @deftypefun void FUNC (TYPE @var{PARAM},...)
+# to actuals: PARAM, ...
     s/^[^{]*[{]*//
     s/[}]*[^}]*$//
     s/}[^{]*{/, /g
-    # Combine held (EVENT:TYPE PARAM, ...:) and pattern (PARAM, ...) into
-    # FUNC:TYPE PARAM, ...:PARAM, ...
+# Combine held (EVENT:TYPE PARAM, ...:) and pattern (PARAM, ...) into
+# FUNC:TYPE PARAM, ...:PARAM, ...
     H
     x
     s/\n/:/g
@@ -86,7 +104,7 @@ sed -n '
 ' $texi | while read event formal actual
 do
   case $lang in
-      h) cat <<EOF >>${o}-tmp
+      h) cat <<EOF >>${otmp}
 
 /* ${event} notifications.  */
 
@@ -99,7 +117,7 @@ EOF
        ;;
 
       inc)
-       cat <<EOF >>${o}-tmp
+       cat <<EOF >>${otmp}
 
 /* ${event} notifications.  */
 
@@ -134,6 +152,8 @@ observer_notify_${event} (${formal})
 {
   struct ${event}_args args;
   `echo ${actual} | sed -e 's/\([a-z0-9_][a-z0-9_]*\)/args.\1 = \1/g'`;
+  if (observer_debug)
+    fprintf_unfiltered (gdb_stdlog, "observer_notify_${event}() called\n");
   generic_observer_notify (${event}_subject, &args);
 }
 EOF
@@ -143,12 +163,12 @@ done
 
 
 case $lang in
-    h) cat <<EOF >>${o}-tmp
+    h) cat <<EOF >>${otmp}
 
 #endif /* OBSERVER_H */
 EOF
 esac
 
 
-echo Moving ${o}-tmp to ${o}
-mv ${o}-tmp ${o}
+echo Moving ${otmp} to ${o}
+mv ${otmp} ${o}
This page took 0.025095 seconds and 4 git commands to generate.