#!/bin/sh
#
# jjoosc - compile JOOS source programs into class files and verify them
#        - assumes that the CLASSPATH is NOT set
#
# usage:  joosc f1.java f2.java ... fn.joos
#  
# note:  it is best to name each source file for ordinary classes with
#        .java extensions and all exteranal classes with .joos extensions

if [ "$JOOSBIN" = "" ]; then
  JOOSBIN="$JOOSDIR/Bin/joos"
fi

echo "---------------------------"
echo "Compiling with \"$JOOSBIN\""
echo "---------------------------"
echo "joosing $*"

$JOOSBIN $JOOSDIR/Extern/*.joos $*
echo "---------------------------"

for f in $*
do
  if [ "$f" != "-O" ]; then
	filename=`basename $f .java`
	echo "jjasmin of $filename.j"
	$JOOSDIR/Bin/jjasmin "$filename.j"
	echo ""
  fi
done;

echo "---------------------------"

for f in $*
do
  if [ "$f" != "-O" ]; then
	filename=`basename $f .java`
	echo "verifying $filename.class"
	$JOOSDIR/Bin/jjavap -verify "$filename"
	echo ""
  fi
done;

echo "---------------------------"

#if ( { echo ==== joosing $* && $JOOSBIN $JOOSDIR/Extern/*.joos $* } )
#then
#  foreach f ( $* )
#    if ( $f != "-O" ) then
#      echo ======== jjasmin of $f:r.j && $JOOSDIR/Bin/jjasmin $f:r.j 
#    endif
#  end
#  foreach f ( $* )
#    if ( $f != "-O" ) then
#      echo ======== verify $f:r.class && \
#      jjavap -verify $f:r 
#    endif
#  end
#endif

