diff options
author | ianhin <ianhin> | 2006-06-19 22:30:11 +0000 |
---|---|---|
committer | ianhin <ianhin> | 2006-06-19 22:30:11 +0000 |
commit | 4570a63853c137c64310832b7238e7a2221a9afe (patch) | |
tree | e9f4ef81e06de5ff403073558d356e831476b785 /Bin | |
parent | 2f0a7770eaeae3fda5cd0d890fbed519c2b3002d (diff) |
A script for invoking Kranc on a .m file passed as an argument. Looks in the current directory for Kranc, which can be a symlink.
Diffstat (limited to 'Bin')
-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 |