diff options
-rwxr-xr-x | Bin/kranc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Bin/kranc b/Bin/kranc new file mode 100755 index 0000000..9e39af0 --- /dev/null +++ b/Bin/kranc @@ -0,0 +1,32 @@ +#!/bin/bash + +# A shell script to run Kranc on a mathematica input file + +INFILE=$1 + +if ! which math >/dev/null +then + echo "Cannot find math executable. Is Mathematica on your path?" +fi + +LOCALKRANCPATH="Kranc/Tools/CodeGen:Kranc/Tools/MathematicaMisc:Kranc/Tools/External" + +if [ -z "$MATHPATH" ] +then + MATHPATH=$LOCALKRANCPATH +else + MATHPATH=$LOCALKRANCPATH:$MATHPATH +fi + +export MATHPATH + +math <<EOF + +Module[{mp, newPath}, + mp = StringToStream[Environment["MATHPATH"]]; + newPath = Map[ToString, ReadList[mp, Word, WordSeparators->{":"}]]; + \$Path = Join[newPath, \$Path]]; +Needs["Errors\`"]; +exception = Catch[Get["$INFILE"], KrancError]; +PrintError[exception]; +EOF |