USG_PG3/usr/source/cref1/getfcref

cp /dev/null tmprhole
if $1x != x goto test
: bads
echo file of source files not given
goto out
: test
if ! -r $1 goto bads
if { cmp $1 /dev/null >tmprhole } goto bads
if $2x = x goto default
if -r $2 goto have2
: badf
echo file of functions is bad
goto out
: have2
cp $2 tmpfuns
goto cont1
: default
if ! -r functions goto badf
cp functions tmpfuns
: cont1
if { cmp tmpfuns /dev/null >tmprhole } goto badf
: at this point have a good source file and function file
grep "mch\.s" $1 >tmpmch
: now build a shell to cref the c source
ed - $1
v/mch\.s/s/^/cref -cot tmpfuns tmpcref /
v/mch\.s/s/$/ \/dev\/null;tr "[\\177-\\377]" "[\\011*]" <tmpcref >>tmpallcref/
g/mch\.s/s/^.*$/cmp & &/
w tmpsh
q
cp /dev/null tmpcref
cp /dev/null tmpallcref
sh tmpsh
rm tmpsh
cp /dev/null tmpcref
if { cmp tmpmch /dev/null >tmprhole } goto nomch
ed - tmpmch
g/^/s/^/cref -aot tmpfuns tmpcref /
g/$/s/$/ \/dev\/null/
w tmpmch
e tmpfuns
g/^/s/^/_/
w tmpfuns
q
sh tmpmch
if { cmp tmpcref /dev/null >tmprhole } goto nomch
ed - tmpcref
g/^_/s///
g/[^,]_/s/_//
w tmpcref
q
tr "[\177-\377]" "[\011*]" <tmpcref | grep "jsr.*pc,_" >>tmpallcref
: nomch
rm tmpmch tmpfuns
sort <tmpallcref >rawfcref
rm tmpcref tmpallcref
: out
rm tmprhole