3 # Make certain that the script is not running in an internationalized
6 LC_ALL
=C
; export LC_ALL
10 echo "Usage: $0 <h|inc> <observer.texi> <observer.out>" 1>&2
21 otmp
="`echo $1 | sed -e 's,\.[^.]*$,,'`.$tmp"; shift
22 echo "Creating ${otmp}" 1>&2
25 # Can use any of the following: cat cmp cp diff echo egrep expr false
26 # grep install-info ln ls mkdir mv pwd rm rmdir sed sleep sort tar
30 /* GDB Notifications to Observers.
32 Copyright (C) 2004, 2005, 2007, 2008, 2009, 2010, 2011
33 Free Software Foundation, Inc.
35 This file is part of GDB.
37 This program is free software; you can redistribute it and/or modify
38 it under the terms of the GNU General Public License as published by
39 the Free Software Foundation; either version 3 of the License, or
40 (at your option) any later version.
42 This program is distributed in the hope that it will be useful,
43 but WITHOUT ANY WARRANTY; without even the implied warranty of
44 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45 GNU General Public License for more details.
47 You should have received a copy of the GNU General Public License
48 along with this program. If not, see <http://www.gnu.org/licenses/>.
52 This file was generated using observer.sh and observer.texi. */
58 h
) cat <<EOF >>${otmp}
72 # We are about to set IFS=:, so DOS-style file names with a drive
73 # letter and a colon will be in trouble.
77 texi
=`echo $texi | sed -e 's,^\([a-zA-Z]\):/,/dev/\1/,'`
80 # generate a list of events that can be observed
85 # Save original line for later processing into the actual parameter
87 # Convert from: @deftypefun void EVENT (TYPE @var{PARAM},...)
88 # to event and formals: EVENT:TYPE PARAM, ...:
89 s/^.* void \([a-z_][a-z_]*\) (\(.*\))$/\1:\2/
94 # Convert from: @deftypefun void FUNC (TYPE @var{PARAM},...)
95 # to actuals: PARAM, ...
99 # Combine held (EVENT:TYPE PARAM, ...:) and pattern (PARAM, ...) into
100 # FUNC:TYPE PARAM, ...:PARAM, ...
106 ' $texi |
while read event formal actual
109 h
) cat <<EOF >>${otmp}
111 /* ${event} notifications. */
113 typedef void (observer_${event}_ftype) (${formal});
115 extern struct observer *observer_attach_${event} (observer_${event}_ftype *f);
116 extern void observer_detach_${event} (struct observer *observer);
117 extern void observer_notify_${event} (${formal});
124 /* ${event} notifications. */
126 static struct observer_list *${event}_subject = NULL;
129 if test "$formal" != "void"; then
131 struct ${event}_args { `echo "${formal}" | sed -e 's/,/;/g'`; };
137 observer_${event}_notification_stub (const void *data, const void *args_data)
139 observer_${event}_ftype *notify = (observer_${event}_ftype *) data;
140 const struct ${event}_args *args = args_data;
141 notify (`echo ${actual} | sed -e 's/\([a-z0-9_][a-z0-9_]*\)/args->\1/g'`);
145 observer_attach_${event} (observer_${event}_ftype *f)
147 return generic_observer_attach (&${event}_subject,
148 &observer_${event}_notification_stub,
153 observer_detach_${event} (struct observer *observer)
155 generic_observer_detach (&${event}_subject, observer);
159 observer_notify_${event} (${formal})
162 if test "$formal" != "void"; then
164 struct ${event}_args args;
165 `echo ${actual} | sed -e 's/\([a-z0-9_][a-z0-9_]*\)/args.\1 = \1/g'`;
169 echo "char *args = NULL;" >> ${otmp}
173 fprintf_unfiltered (gdb_stdlog, "observer_notify_${event}() called\n");
174 generic_observer_notify (${event}_subject, &args);
183 h
) cat <<EOF >>${otmp}
185 #endif /* OBSERVER_H */
190 echo Moving
${otmp} to
${o}
This page took 0.032597 seconds and 4 git commands to generate.