USG_PG3/usr/source/cref1/getvcref

cp /dev/null tmmprhole
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 >tmmprhole } goto bads
if $2x = x goto default
if -r $2 goto have2
: badf
echo file of variables is bad
goto out
: have2
cp $2 tmmpfuns
goto cont1
: default
if ! -r variables goto badf
cp variables tmmpfuns
: cont1
if { cmp tmmpfuns /dev/null >tmmprhole } goto badf
: at this point have a good source file and function file
grep "mch\.s" $1 >tmmpmch
: now build a shell to cref the c source
ed - $1
v/mch\.s/s/^/cref -cot tmmpfuns tmmpcref /
v/mch\.s/s/$/ \/dev\/null; tr "[\\177-\\377]" "[\\011*]" <tmmpcref >>tmmpallcref/
g/mch\.s/s/^.*$/cmp & &/
w tmmpsh
q
cp /dev/null tmmpcref
cp /dev/null tmmpallcref
sh tmmpsh
rm tmmpsh
cp /dev/null tmmpcref
if { cmp tmmpmch /dev/null >tmmprhole } goto nomch
ed - tmmpmch
g/^/s/^.*$/cref -aot tmmpfuns tmmpcref & \/dev\/null/
w tmmpmch
e tmmpfuns
g/^/s/^/_/
w tmmpfuns
q
sh tmmpmch
if { cmp tmmpcref /dev/null >tmmprhole } goto nomch
ed - tmmpcref
g/^_/s///
g/mch\.s._/s/_//
g/\.globl/d
w tmmpcref
q
tr "[\177-\377]" "[\011*]" <tmmpcref >>tmmpallcref
: nomch
rm tmmpmch tmmpfuns
sort <tmmpallcref >rawvcref
rm tmmpcref tmmpallcref
: out
rm tmmprhole