#! /bin/sh
#   Decompilation of grammar and dictionary
#   NTN -- April 11, 1991
#   NTN -- November 25, 1996: change to /usr/bin/sh
echo "          >>> LSP Grammar/Dictionary Decompilation <<<"
echo
if test ! -f $1.obg -a ! -f $1.wdo
then
   echo -n "Grammar/Dictionary to decompile (.OBG or .WDO assumed): "
   read gram
else
   gram=$1
fi
if test -f $gram.obg
then
   suf="obg"
else
   if test -f $gram.wdo
   then
      suf="wdo"
   else 
      echo "--- Neither $gram.obg nor $gram.wdo found ---"
      echo "    Usage: decompile <gram> [* no extension *]"
      echo "    decompile: ends, no argument"
      exit
   fi
fi
if test -f $gram.lis
then
   \rm $gram.lis
fi
echo "                Decompile      $gram.$suf"
echo "                Listing in     $gram.lis"
echo " "
echo "... in processing ..."
echo "* --- LSP SYSTEM: Decompilation of $gram.$suf -- `date`" > $gram.lis
awk '$1 ~ /^\*/ { print substr($0,2) }' $gram.$suf >> $gram.lis
echo "--- Decompilation completed ---" 
