aboutsummaryrefslogtreecommitdiff
path: root/Bin/kranc
blob: 9e39af01efc151c09a4647b397668ac2faf2b2ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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