#! /bin/sh
#
#	This script lists the action table found within the specified file.
#	The output of this script is then parsed to determine what callbacks
#	exist for the specified subclass.
#
#	usage:
#		subclass_action_table filenam
#	input <...>:
#		< static OI_actions_rec	blah_action_tbl[] = {	/* binding table */
#			{"blah::aaa", NULL, NULL, (OI_translation_memfn*) &blah::aaa },
#			{"blah::bbb", NULL, NULL, (OI_translation_memfn*) &blah::bbb },
#			{"blah::ccc", NULL, NULL, (OI_translation_memfn*) &blah::ccc },
#			{"blah::ddd", NULL, NULL, (OI_translation_memfn*) &blah::ddd },
#		}; >
#	output <...>:
#		stdout
#		<aaa>
#		<bbb>
#		<ccc>
#		<ddd>
#
sed -n -e '/OI_actions_rec/,/};/p' $1 | sed -e '

#
# nuke starting and ending lines
#
/OI_actions_rec/d
/};/d

#
# concatenate lines
#
: appnd
/}/b cntu
/,$/{
	N
	s/ //g
	s/	//g
	s/,\n/,/
	/}/b cntu
	b appnd
}
: cntu

#
# nuke irrelevant information
#
s/,.*$//
s/"//g
s/{//
s/ //g
s/	//g
s/^.*://g
s/://g
/NULL/d
/^$/d
'
