8 # The first argument is the directory in which the source files live.
14 # The second argument is either "plugin" or "dissectors"; if it's
15 # "plugin", we build a plugin.c for a plugin, and if it's
16 # "dissectors", we build a register.c for libethereal.
20 if [ "$registertype" = plugin ]
23 elif [ "$registertype" = dissectors ]
27 echo "Unknown output type '$registertype'" 1>&2
32 # All subsequent arguments are the files to scan.
35 echo '/* Do not modify this file. */' >${outfile}-tmp
36 echo '/* It is created automatically by the Makefile. */'>>${outfile}-tmp
37 if [ "$registertype" = plugin ]
39 cat <<"EOF" >>${outfile}-tmp
46 #include "moduleinfo.h"
49 G_MODULE_EXPORT const gchar version[] = VERSION;
51 /* Start the functions we need for the plugin stuff */
54 plugin_register (void)
58 cat <<"EOF" >>${outfile}-tmp
61 register_all_protocols(void)
67 # Build code to call all the protocol registration routines.
77 grep '^proto_register_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';'
78 done | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>${outfile}-tmp
87 grep '^void proto_register_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';'
88 done | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>${outfile}-tmp
89 echo '}' >>${outfile}-tmp
92 # Build code to call all the protocol handoff registration routines.
94 if [ "$registertype" = plugin ]
96 cat <<"EOF" >>${outfile}-tmp
98 plugin_reg_handoff(void)
102 cat <<"EOF" >>${outfile}-tmp
104 register_all_protocol_handoffs(void)
116 grep '^proto_reg_handoff_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';'
117 done | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>${outfile}-tmp
126 grep '^void proto_reg_handoff_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';'
127 done | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>${outfile}-tmp
128 echo '}' >>${outfile}-tmp
129 if [ "$registertype" = plugin ]
131 echo '#endif' >>${outfile}-tmp
133 mv ${outfile}-tmp ${outfile}