wireshark/make-tapreg-dotc
Guy Harris 4cfd8b0f36 Allow taps to have menu item registration routines; the menu item
registration routines, for taps with menu items (taps that can be run
from the "Tools->Statistics" menu), create the menu item for the tap.
"make-tapreg-dotc" constructs a "register_all_tap_menus()" function that
calls all the tap menu item registration routines it finds, and Ethereal
calls that routine after the main window has been constructed (so that
the main menu exists, as the menu items are added to it).  (Tethereal
doesn't call it.)

Get rid of the "menu" and "menu_init" arguments to
"register_ethereal_tap"; the menu item is registered in the tap's menu
item registration routine, not in its main registration routine.

Have the RTP GUI tap register its menu item that way, rather than by
having it compiled into "gtk/menu.c".  (We're not ready yet to have taps
whose menu items are under a submenu register themselves in that
fashion, as "register_tap_menu_item()" can't yet create submenus.)

svn path=/trunk/; revision=7540
2003-04-23 03:51:03 +00:00

62 lines
1.3 KiB
Bash
Executable file

#! /bin/sh
#
# The first argument is the output filename.
#
outfile="$1"
shift
#
# The second argument is the directory in which the source files live.
#
srcdir="$1"
shift
#
# All subsequent arguments are the files to scan.
#
rm -f ${outfile}-tmp
echo '/* Do not modify this file. */' >${outfile}-tmp
echo '/* It is created automatically by the Makefile. */'>>${outfile}-tmp
#
# Build code to call all the tap listener registration routines.
#
echo 'void register_all_tap_listeners(void) {' >>${outfile}-tmp
for f in "$@"
do
if [ -f $f ]
then
srcfile=$f
else
srcfile=$srcdir/$f
fi
grep '^register_tap_listener_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';' | sed -e 's/(.*//'
done | while read func; do
echo " { extern void $func (void);" >>${outfile}-tmp
echo " $func ();}" >>${outfile}-tmp
done
echo '}' >>${outfile}-tmp
#
# Build code to call all the tap listener menu item registration routines.
#
echo 'void register_all_tap_menus(void) {' >>${outfile}-tmp
for f in "$@"
do
if [ -f $f ]
then
srcfile=$f
else
srcfile=$srcdir/$f
fi
grep '^register_tap_menu_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';' | sed -e 's/(.*//'
done | while read func; do
echo " { extern void $func (void);" >>${outfile}-tmp
echo " $func ();}" >>${outfile}-tmp
done
echo '}' >>${outfile}-tmp
mv ${outfile}-tmp ${outfile}