5 echo "Usage: $0 <h|inc> <observer.texi> <observer.out>" 1>&2
16 otmp
="`echo $1 | sed -e 's,\.[^.]*$,,'`.$tmp"; shift
17 echo "Creating ${otmp}" 1>&2
20 # Can use any of the following: cat cmp cp diff echo egrep expr false
21 # grep install-info ln ls mkdir mv pwd rm rmdir sed sleep sort tar
25 /* GDB Notifications to Observers.
27 Copyright (C) 2004, 2005 Free Software Foundation, Inc.
29 This file is part of GDB.
31 This program is free software; you can redistribute it and/or modify
32 it under the terms of the GNU General Public License as published by
33 the Free Software Foundation; either version 2 of the License, or
34 (at your option) any later version.
36 This program is distributed in the hope that it will be useful,
37 but WITHOUT ANY WARRANTY; without even the implied warranty of
38 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39 GNU General Public License for more details.
41 You should have received a copy of the GNU General Public License
42 along with this program; if not, write to the Free Software
43 Foundation, Inc., 51 Franklin Street, Fifth Floor,
44 Boston, MA 02110-1301, USA.
48 This file was generated using observer.sh and observer.texi. */
54 h
) cat <<EOF >>${otmp}
65 # We are about to set IFS=:, so DOS-style file names with a drive
66 # letter and a colon will be in trouble.
70 texi
=`echo $texi | sed -e 's,^\([a-zA-Z]\):/,/dev/\1/,'`
73 # generate a list of events that can be observed
78 # Save original line for later processing into the actual parameter
80 # Convert from: @deftypefun void EVENT (TYPE @var{PARAM},...)
81 # to event and formals: EVENT:TYPE PARAM, ...:
82 s/^.* void \([a-z_][a-z_]*\) (\(.*\))$/\1:\2/
87 # Convert from: @deftypefun void FUNC (TYPE @var{PARAM},...)
88 # to actuals: PARAM, ...
92 # Combine held (EVENT:TYPE PARAM, ...:) and pattern (PARAM, ...) into
93 # FUNC:TYPE PARAM, ...:PARAM, ...
99 ' $texi |
while read event formal actual
102 h
) cat <<EOF >>${otmp}
104 /* ${event} notifications. */
106 typedef void (observer_${event}_ftype) (${formal});
108 extern struct observer *observer_attach_${event} (observer_${event}_ftype *f);
109 extern void observer_detach_${event} (struct observer *observer);
110 extern void observer_notify_${event} (${formal});
117 /* ${event} notifications. */
119 static struct observer_list *${event}_subject = NULL;
121 struct ${event}_args { `echo "${formal}" | sed -e 's/,/;/g'`; };
124 observer_${event}_notification_stub (const void *data, const void *args_data)
126 observer_${event}_ftype *notify = (observer_${event}_ftype *) data;
127 const struct ${event}_args *args = args_data;
128 notify (`echo ${actual} | sed -e 's/\([a-z0-9_][a-z0-9_]*\)/args->\1/g'`);
132 observer_attach_${event} (observer_${event}_ftype *f)
134 return generic_observer_attach (&${event}_subject,
135 &observer_${event}_notification_stub,
140 observer_detach_${event} (struct observer *observer)
142 generic_observer_detach (&${event}_subject, observer);
146 observer_notify_${event} (${formal})
148 struct ${event}_args args;
149 `echo ${actual} | sed -e 's/\([a-z0-9_][a-z0-9_]*\)/args.\1 = \1/g'`;
151 fprintf_unfiltered (gdb_stdlog, "observer_notify_${event}() called\n");
152 generic_observer_notify (${event}_subject, &args);
161 h
) cat <<EOF >>${otmp}
163 #endif /* OBSERVER_H */
168 echo Moving
${otmp} to
${o}
This page took 0.032269 seconds and 4 git commands to generate.