1
0
mirror of synced 2026-04-16 00:50:53 +00:00
Files
Interlisp.medley/run-medley
2020-11-23 18:52:31 -08:00

119 lines
2.9 KiB
Bash
Executable File

#!/bin/sh
#
# Run Medley
#
# Syntax: run-medley [--geometry WIDTHxHEIGHT] \
# [--display X_DISPLAY] \
# [--save FILE] \
# [--load URL_OR_FILE]
# Directory variables are accessible from Lisp via UNIX-GETENV
inferred_medleydir=false
if [ -z "$MEDLEYDIR" ] ; then
# the user is usually running this script from medley/, so let's try that
export MEDLEYDIR=`pwd`
inferred_medleydir=true
fi
if [ ! -d $MEDLEYDIR/loadups ] ; then
echo "MEDLEYDIR has no loadups: $MEDLEYDIR"
if [ inferred_medleydir = true ] ; then
echo "I tried to infer it based on your working directory, but that didn't work."
echo "Try setting the MEDLEYDIR environment variable to the right location."
fi
exit 1
fi
inferred_maikodir=false
if [ -z "$MAIKODIR" ] ; then
# here we try two options relative to MEDLEYDIR: ./maiko and ../maiko
# this is highly imperfect, but the user can always set the env variables
export MAIKODIR="$MEDLEYDIR/../maiko"
if [ ! -d "$MAIKODIR" ] ; then
export MAIKODIR="$MEDLEYDIR/maiko"
fi
inferred_maikodir=true
fi
if [ ! -d "$MAIKODIR"/bin ] ; then
echo "MAIKODIR has no bin: $MAIKODIR"
if [ inferred_maikodir = true ] ; then
echo "I tried to infer it based on your working directory, but that didn't work."
echo "Try setting the MAIKODIR environment variable to the right location."
fi
exit 1
fi
export LDEINIT="$MEDLEYDIR/greetfiles/LOCAL-INIT"
passthrough_args=""
mem="-m 256" # Default, has to be set
geometry="-g 1280x720"
# keyboard types: x, type2, type3, type4, jle, as3000j
export LDEKBDTYPE=x
export LDEFILETIMEOUT=60
export TAKEXNSDOWN=0
export LDELISPXNS=0
while [ "$#" -ne 0 ]; do
case "$1" in
"--geometry")
geometry="-g $2 -sc $2"
shift
;;
"--display")
export DISPLAY=$2
shift
;;
"--save")
export LDEDESTSYSOUT=$2
shift
;;
"--load")
export LDESRCESYSOUT=$2
shift
;;
*)
passthrough_args="$passthrough_args $1" # don't know what it means?
# just pass it through to lde
;;
esac
shift
done
if [ -z "$LDESRCESYSOUT" ] ; then
export LDESRCESYSOUT="$MEDLEYDIR/loadups/xfull35.sysout"
fi
echo "keyboard type is" $LDEKBDTYPE
export INMEDLEY=1
echo "sysout is" $LDESRCESYSOUT
#version = `medley-lisp-version $LDESRCESYSOUT`
version="35010"
prog="lde"
case "$version" in
"35000")
version="3.5"
;;
"35010")
version="3.501"
;;
esac
echo "using emulator version $version"
export PATH=.:"$PATH"
old_wd=`pwd`
cd "$MAIKODIR"/bin
export PATH=$MAIKODIR/`osversion`.`machinetype`:"$PATH"
cd $old_wd
$prog $mem $geometry $passthrough_args