#!/bin/csh
#                      ---diagramh.sh---
#Unix csh procedure to diagram an HTML language program.

#On some unix systems $1 should be replaced by %1.

# by Mitchell R Grunes.
# for his own use, in his own time

#I assume that the executable and this procedure are in the search path,
#  and that this procedure has execute permission.

#Syntax:
#    diagramh.sh
#to be prompted for input parameters.

#Alternate Syntax:
#    diagramh.sh filename(s)
#to append diagram of file(s) into diagram.out

  if  (${?noclobber}) then
    unset noclobber
    set   noclobbersave
  endif

  if $1a == a  then
    diagramh
    goto quit
  endif

loop:
  echo ========================-- $1 --========================
  #Prompt answers: input from $1, output to diagram2.sc (for now),
  # Don't place numbers in column 67, don't use IBM PC graphics,
  # warn if 'end' ends if, for, etc.

  echo $1          >  diagram.sc
  echo diagram2.sc >> diagram.sc
  echo 0           >> diagram.sc
  echo 1           >> diagram.sc
  echo 0           >> diagram.sc
  echo 0           >> diagram.sc

  diagramh < diagram.sc
  cat diagram2.sc >> diagram.out
  rm -f diagram.sc
  rm -f diagram2.sc
  shift
  if ! ($1a == a) then
    goto loop
  endif
quit:
  echo Note--This does not delete diagram.out before appending to it.
  if  (${?noclobbersave}) then
    set   noclobber
    unset noclobbersave
  endif