#!/bin/bash
# A loader to enable easy running of the Vector Pascal Compiler
# If you want to set the path to mmpcdir in this file, uncomment the line below
# mmpcdir=/path/to/mmpcdir
if [ $# == 0 ]; then
echo -e "Usage: vpc [SOURCE] [OPTIONS...]\nPlease specify a source file or -h for help"
exit 1
fi
# Try to cope with $mmpcdir not being set
if [ -z $mmpcdir ]; then
if [ -f $MMPCDIR/mmpc.jar ]; then
mmpcdir=$MMPCDIR
elif [ -f `dirname $0`/mmpc.jar ]; then
if ! [ $OSTYPE == "cygwin" ]; then
# Cygwin will use a little weird paths (/cygdrive/c/path/to/mmpc) which java
# can't understand
mmpcdir=`dirname $0`
fi
elif [ -f `pwd`/mmpc.jar ]; then
mmpcdir=`pwd`
else
echo -e "ERROR: Environment variable \"\$mmpcdir\" is not defined and couldn't be found.\nTo define it use \"export mmpcdir=/path/to/mmpc\""
exit 2;
fi
elif ! [ -f $mmpcdir/mmpc.jar ]; then
echo -e "ERROR: \"\$mmpcdir\" does not contain the file mmpc.jar, required for execution\n\$mmpcdir is currently \"$mmpcdir\"\n Possibly try reinstalling to fix the problem"
exit 2
fi
if [ $OSTYPE == "linux-gnu" ]
then
echo java -Xss60m -Xmx950m -Dmmpcdir=$mmpcdir -cp $mmpcdir/mmpc.jar ilcg.Pascal.GPUPascal $1 -felf -o$1 -cpuAMD64 -opt0 $2 $3 $4 $5 $6
java -Xss60m -Xmx950m -Dmmpcdir=$mmpcdir -cp $mmpcdir/mmpc.jar ilcg.Pascal.GPUPascal $1 -felf -o$1 -cpuAMD64 -opt0 $2 $3 $4 $5 $6
else
echo java -Xmx250m -jar $mmpcdir/mmpc.jar $1 -felf -U -o$1 -opt1 -cpugnuAMD64 $2 $3 $4 $5
java -Xmx950m -Dmmpcdir=$mmpcdir -jar $mmpcdir/mmpc.jar $1 -felf -U -o$1 -opt1 -DPTW32 -cpugnuP4 $2 $3 $4 $5 $6
fi