#! /bin/sh
#    chkcomp
#    checks compilation and modification of a grammar or a dictionary.
# -- rewrite NTN 4/15/97
clear
echo "   M E D I C A L   L A N G U A G E   P R O C E S S I N G"
echo "   >>> Grammar/Dictionary Compilation Status Report <<<"
if test ! -f $1.lis
then
      echo "--- $1.lis not found!"
      echo "Usage: chkcomp <path/filename>"
      echo "       [no extension on filename]"
      echo "... exit error..."
      exit
fi
grlis=$1.lis
export grlis
grobj=$1.obg
export grobj
if test ! -f $grobj
then
   if test ! -f $1.wdo
   then
      echo "--- neither $1.obg nor $1.wdo found !"
      echo "Usage: chkcomp <path/filename>"
      echo "       [no extension on filename]"
      echo "... exit error..."
      exit
   else
      grobj=$1.wdo
      export grobj
   fi
else
   grsym=$1.sym
   export grsym
fi
echo "             >>> Compilation Status Report <<<"
echo "             for $grlis and $grobj"
echo
echo "+++ WARNING messages from parser:"
grep WARNING $grlis
echo
echo "+++ NO PARSE errors from parser:"
grep -i "no parses possible" $grlis
grep "Line limit exceed" $grlis
grep "Node limit exceed" $grlis
echo
echo "+++ Test for errors in record name:"
grep "Error in record name" $grlis
grep "error in symbol table" $grlis
echo
echo "+++ Test for Sequence Order Errors:"
grep "This record cannot be found" $grlis
echo
echo "+++ Look for SYMBOL TABLE from compiled grammar/dictionary:"
if test "$grsym" = ""
then
   grep -n "^SYMBOL TABLE" $grobj
else
   ls -al $grsym
   head $grsym
fi
echo
echo "+++ Completion Status of $grlis:"
tail $grlis
echo
echo "... Compilation Status Report completed ..."
