#!/bin/csh -f

cat > /tmp/updateclass.$$.sed << EOF
/METHOD([A-Za-z0-9_]*,className,(void),const char\*)/,/\/\/className/{
s/METHOD(\([A-Za-z0-9_]*\),className,(void),const char\*)/METHOD(\1,makeBrother,(void),BpObject*)/
s/return("\([A-Za-z0-9_]*\)");/return(NEW(\1));/
s/\/\/className/\/\/makeBrother/
}
/BcImplementation/i\
#include BpClass_hh
/CONSTRUCTOR(\([A-Za-z0-9_]*\)/{
h
n
G
s/CONSTRUCTOR(\([A-Za-z0-9_]*\))/\	BpClass_PLUG(\1);/
}
EOF


if ( "$1" == "interface" ) then
	shift
	foreach f ( $* )
		mv $f $f~
		sed \
			-e 's/METHOD(\([A-Za-z0-9_]*\),className,(void),const char\*)/METHOD(\1,makeBrother,(void),BpObject*)/' \
			< $f~ > $f
	end
else if ( "$1" == "implementation" ) then
	shift
	foreach f ( $* )
		mv $f $f~
		sed -f /tmp/updateclass.$$.sed < $f~ > $f
	end
else
	echo "$0 usage:"
	echo "	$0 interface|implementation files..."
	exit 1
endif

rm 	/tmp/updateclass.$$.sed
ViewGit