#MAKE-HPF-REPORT
#!/bin/csh

#Version of April 5, 1993 - David Loveman, Digital Equipment Corporation

#set TEXroot=/usr/local/bin
#alias latex $TEXroot/latex
#alias dvips $TEXroot/dvips
#alias xdvi $TEXroot/xdvi

set thedate = `date`
echo "  "
echo BEGIN JOB ON: $thedate

echo "This script assumes that latex, dvips, and xdvi"
echo "are on your search path."
echo "  "

echo "This script assumes that cc is your C compiler and is on"
echo "your search path.  If not, you'll have to fix the script."
echo "  "

which latex

##################################################
#   Compile glombnf.c and construct syntax crossreference
##################################################
echo "  "
echo "compile and run glombnf to construct bnf cross reference"
rm bnf.tex >& /dev/null
rm glombnf >& /dev/null

cc -o glombnf glombnf.c
glombnf -crossref overview.tex terms.tex distribution.tex statements.tex intrinsics.tex foreign.tex sequence.tex >bnf.tex


##################################################
#        Run LATEX the first time
##################################################
echo "  "
echo "latex hpf-report the first time"
latex hpf-report < /dev/null
if($status != 0) then
   echo "first LATEX run fails, quit"
   exit(1)
endif

##################################################
#        Run LATEX the second time
##################################################
echo "  "
echo "latex hpf-report the second time"
latex hpf-report < /dev/null
if($status != 0) then
   echo "second LATEX run fails, quit"
   exit(1)
endif

##################################################
#        Run LATEX the third time
##################################################
echo "  "
echo "latex hpf-report the third time"
latex hpf-report < /dev/null
if($status != 0) then
   echo "third LATEX run fails, quit"
   exit(1)
endif

##################################################
#        Run dvips to produce a ps file
##################################################
echo "  "
echo "dvips hpf-report -o hpf-report.ps"
dvips hpf-report -o hpf-report.ps
if($status != 0) then
   echo "DVIPS fails, quit"
   exit(1)
endif

##################################################
#        Run xdvi to view the ps file
##################################################
echo "  "
echo "xdvi hpf-report"
xdvi hpf-report &

##################################################
#        Print the ps file
##################################################
echo "  "
echo "now print the postscript file (this script doesn't)"
echo "the HPF Report is meant to be two-sided"
echo "the following command works on a Digital PrintServer"
echo "lpr -Oportrait -Dpostscript -K2 -s hpf-report.ps"
echo "you may not need the -Oportrait -Dpostscript -K2 -s options"
echo "CAUTION: with "-s" do not change or delete hpf-report.ps"
echo "or run CLEANUP until printing has completed"
#lpr -Oportrait -Dpostscript -K2 -s hpf-report.ps

echo "  "
echo "done"
echo "  "

