#! /bin/tcsh -f

# USAGE: ./f77proto_dcl.csh dcldir
# Here, dcldir is the root directory of dcl source programs (dcl-5.1/src)

if ($#argv != 1) then
    echo " "
    echo " USAGE: ./f77proto_dcl.csh dcldir"
    echo "   where dcldir is the root directory of dcl source programs"
    echo " "
    exit
endif

set srcdir = $argv[1]

set dirs = ( grph1 grph2 math1 math2 misc1 )
#set dirs = ( grph1 )
set progdir = `pwd`
set outdir = `pwd`
cd $srcdir

foreach dir ( $dirs )
    set files = `find $dir -name '*.f' -o -name '*.f.other' -o -name '*.f.dummy'`
    set ofile = $outdir/$dir.f77proto
    rm -f $ofile
    touch $ofile
    foreach file ( $files )
        echo "$file"
        echo '/*****************************************************' >> $ofile
        echo ' * '$file >> $ofile
        echo ' ****************************************************/' >> $ofile
        ruby -v $progdir/f77proto.rb $file | tail +2 >> $ofile
    end
end
