-
Notifications
You must be signed in to change notification settings - Fork 32
/
scheme-script
executable file
·63 lines (54 loc) · 1.63 KB
/
scheme-script
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh
#
# Copyright 2007 William D Clinger
#
# $Id$
#
# Script for running R7RS/R6RS Scheme scripts.
#
# Please note that, as defined by R6RS non-normative appendix D,
# a Scheme script is unlikely to be a legal R6RS program because
# a Scheme script is likely to begin with an ignored first line
# of one of the forms
#
# #!/...
# #! ...
#
# Both of those lexical notations are illegal in R6RS top-level
# programs.
# This script tries to find the Larceny binaries and to select the correct
# pair. If LARCENY_ROOT is set, it looks there; otherwise, if the directory
# this script is in is named Scripts, it looks in the parent; otherwise, it
# looks in the same directory as itself.
# You can specify a particular LARCENY_ROOT here:
# LARCENY_ROOT=/usr/local/lib/larceny
if [ -z "$LARCENY_ROOT" ]; then
# To guess LARCENY_ROOT, we start with the directory containing this
# script. If it's a relative path, we make it absolute. Then, if it ends
# in Scripts, we chop off that component.
script=`readlink -f $0`
dir="`dirname "$script"`"
dir="`( cd $dir; pwd )`"
[ "`basename "$dir"`" = Scripts ] && dir="`dirname "$dir"`"
# Now we have LARCENY_ROOT.
LARCENY_ROOT="$dir"
fi
export LARCENY_ROOT
cmd=petit-larceny.bin
heap=petit-larceny.heap
if test -x $LARCENY_ROOT/$cmd; then
:
else
cmd=larceny.bin
heap=larceny.heap
fi
cmd="$LARCENY_ROOT/$cmd"
heap="$LARCENY_ROOT/$heap"
case "`head -n +1 $1 | sed -e 's/^[#][!][/ ].*/ignore/'`" in
ignore)
exec "$cmd" -heap "$heap" -r7rs -program "$1" -ignore1 -- "$@"
;;
*)
exec "$cmd" -heap "$heap" -r7rs -program "$1" -- "$@"
;;
esac