4b15a76ece
routines, throw out lines containing semicolons, so that we don't see *declarations* of those routines. svn path=/trunk/; revision=2530
69 lines
1.7 KiB
Bash
Executable file
69 lines
1.7 KiB
Bash
Executable file
#! /bin/sh
|
|
|
|
#
|
|
# The first argument is the directory in which the source files live.
|
|
#
|
|
srcdir="$1"
|
|
shift
|
|
|
|
#
|
|
# All subsequent arguments are the files to scan.
|
|
#
|
|
rm -f register.c-tmp
|
|
echo '/* Do not modify this file. */' >register.c-tmp
|
|
echo '/* It is created automatically by the Makefile. */'>>register.c-tmp
|
|
echo '#include "register.h"' >>register.c-tmp
|
|
|
|
#
|
|
# Build code to call all the protocol registration routines.
|
|
#
|
|
echo 'void register_all_protocols(void) {' >>register.c-tmp
|
|
for f in "$@"
|
|
do
|
|
if [ -f $f ]
|
|
then
|
|
srcfile=$f
|
|
else
|
|
srcfile=$srcdir/$f
|
|
fi
|
|
grep '^proto_register_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';'
|
|
done | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>register.c-tmp
|
|
for f in "$@"
|
|
do
|
|
if [ -f $f ]
|
|
then
|
|
srcfile=$f
|
|
else
|
|
srcfile=$srcdir/$f
|
|
fi
|
|
grep '^void proto_register_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';'
|
|
done | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>register.c-tmp
|
|
echo '}' >>register.c-tmp
|
|
|
|
#
|
|
# Build code to call all the protocol handoff registration routines.
|
|
#
|
|
echo 'void register_all_protocol_handoffs(void) {' >>register.c-tmp
|
|
for f in "$@"
|
|
do
|
|
if [ -f $f ]
|
|
then
|
|
srcfile=$f
|
|
else
|
|
srcfile=$srcdir/$f
|
|
fi
|
|
grep '^proto_reg_handoff_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';'
|
|
done | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>register.c-tmp
|
|
for f in "$@"
|
|
do
|
|
if [ -f $f ]
|
|
then
|
|
srcfile=$f
|
|
else
|
|
srcfile=$srcdir/$f
|
|
fi
|
|
grep '^void proto_reg_handoff_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';'
|
|
done | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>register.c-tmp
|
|
echo '}' >>register.c-tmp
|
|
mv register.c-tmp register.c
|