Rename run-medley args, pass unknowns through.
This allows for a more consistent command-line interface that doesn't have to duplicate lde's argument parsing. We handle four arguments that are inconvenient when calling lde directly or that require setting environment variables, and then the rest is passed through. At this point, `run-medley-mac` shouldn't be necessary, but I haven't tested this revised script on a Mac yet, so I'm leaving it be for now.
This commit is contained in:
220
run-medley
220
run-medley
@@ -2,160 +2,98 @@
|
|||||||
#
|
#
|
||||||
# Run Medley
|
# Run Medley
|
||||||
#
|
#
|
||||||
# Syntax: run-medley [-nogreet][-xns][-noxns] [-geometry pixelgeometry]
|
# Syntax: run-medley [--geometry WIDTHxHEIGHT] \
|
||||||
# [-display xdisplay-device] [-screensize pixelgeometry]
|
# [--display X_DISPLAY] \
|
||||||
# [-raw] [-t xtimeout][-prog executable-program]
|
# [--save FILE] \
|
||||||
# [-vmem savevmemfilename] |
|
# [--load URL_OR_FILE]
|
||||||
# [-m memorylimit] [-kbd keyboardtype] [-key key]
|
|
||||||
# [sysoutfilename | -lfg | -lisp | -full |
|
|
||||||
# -{name of any in the sysouts} ]
|
|
||||||
#
|
|
||||||
# -xns means leave unix xns running
|
|
||||||
# -noxns means suppress Lisp xns.
|
|
||||||
|
|
||||||
# LDESRCESYSOUT
|
|
||||||
# LDESOURCESYSOUT SYSOUT full-file name you want to run
|
|
||||||
|
|
||||||
# LDEDESTSYSOUT SYSOUT name for destination of SAVEVM/LOGOUT
|
|
||||||
|
|
||||||
# LDEKBDTYPE
|
|
||||||
# type2
|
|
||||||
# type3
|
|
||||||
# type4
|
|
||||||
# jle
|
|
||||||
# as3000j
|
|
||||||
# LDEFILETIMEOUT
|
|
||||||
|
|
||||||
export HOSTNAME=`hostname`
|
|
||||||
export OSVERSION=`uname -r`
|
|
||||||
|
|
||||||
# Directory variables are accessible from Lisp via UNIX-GETENV
|
# Directory variables are accessible from Lisp via UNIX-GETENV
|
||||||
|
|
||||||
if [ -z "$MEDLEYDIR" ] ; then export MEDLEYDIR=`pwd`; fi
|
inferred_medleydir=false
|
||||||
if [ ! -d $MEDLEYDIR/loadups ] ; then
|
|
||||||
echo MEDLEYDIR not found: "$MEDLEYDIR"
|
if [ -z "$MEDLEYDIR" ] ; then
|
||||||
exit 1
|
# the user is usually running this script from medley/, so let's try that
|
||||||
|
export MEDLEYDIR=`pwd`
|
||||||
|
inferred_medleydir=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$MAIKODIR" ] ; then
|
if [ ! -d $MEDLEYDIR/loadups ] ; then
|
||||||
export MAIKODIR="$MEDLEYDIR/../maiko"
|
echo "MEDLEYDIR has no loadups: $MEDLEYDIR"
|
||||||
if [ ! -d "$MAIKODIR"/bin ] ; then
|
if [ inferred_medleydir = true ] ; then
|
||||||
echo "MAIKODIR not found: $MAIKODIR"
|
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
|
exit 1
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export LDEINIT="$MEDLEYDIR/greetfiles/LOCAL-INIT"
|
export LDEINIT="$MEDLEYDIR/greetfiles/LOCAL-INIT"
|
||||||
|
|
||||||
|
passthrough_args=""
|
||||||
mem="-m 256" # Default, has to be set
|
mem="-m 256" # Default, has to be set
|
||||||
#geometry="-g 1060x790"
|
|
||||||
# MBA screensize
|
# MBA screensize
|
||||||
geometry="-g 1440x900"
|
geometry="-g 1280x720"
|
||||||
screensize="-sc 1440x900"
|
|
||||||
|
|
||||||
|
# keyboard types: x, type2, type3, type4, jle, as3000j
|
||||||
|
|
||||||
export LDEKBDTYPE=x
|
export LDEKBDTYPE=x
|
||||||
ICONSPEC=" "
|
|
||||||
|
|
||||||
export LDEFILETIMEOUT=60
|
export LDEFILETIMEOUT=60
|
||||||
export TAKEXNSDOWN=0
|
export TAKEXNSDOWN=0
|
||||||
export LDELISPXNS=0
|
export LDELISPXNS=0
|
||||||
|
|
||||||
#default is no lispxns
|
#default is no lispxns
|
||||||
|
|
||||||
|
|
||||||
while [ "$#" -ne 0 ]; do
|
while [ "$#" -ne 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"-m")
|
"--geometry")
|
||||||
mem="-m $2"
|
geometry="-g $2 -sc $2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
"-xlisp")
|
"--display")
|
||||||
export LDESRCESYSOUT="$MEDLEYDIR/loadups/xlisp.sysout"
|
|
||||||
;;
|
|
||||||
"-lisp")
|
|
||||||
export LDESRCESYSOUT="$MEDLEYDIR/loadups/lisp.sysout"
|
|
||||||
;;
|
|
||||||
"-xfull35")
|
|
||||||
export LDESRCESYSOUT="$MEDLEYDIR/loadups/xfull35.sysout"
|
|
||||||
;;
|
|
||||||
"-full")
|
|
||||||
export LDESRCESYSOUT="$MEDLEYDIR/loadups/full.sysout"
|
|
||||||
;;
|
|
||||||
"-lfg" | "-lfg35" | "-xlfg35")
|
|
||||||
export LDESRCESYSOUT="$LFGPARSERDIR/release/lfg35.sysout"
|
|
||||||
ICONSPEC="-iconbitmap $LFGPARSERDIR/release/lfg.xbm -icontitle Xerox"
|
|
||||||
;;
|
|
||||||
"-nogreet")
|
|
||||||
export LDEINIT=""
|
|
||||||
;;
|
|
||||||
"-greet")
|
|
||||||
export LDEINIT="$2"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
"-xns")
|
|
||||||
export TAKEXNSDOWN=1
|
|
||||||
export LDELISPXNS=1
|
|
||||||
;;
|
|
||||||
"-noxns")
|
|
||||||
export TAKEXNSDOWN=0
|
|
||||||
export LDELISPXNS=0
|
|
||||||
;;
|
|
||||||
"-raw")
|
|
||||||
unset DISPLAY
|
|
||||||
;;
|
|
||||||
"-geometry")
|
|
||||||
geometry="-g $2"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
"-screensize")
|
|
||||||
screensize="-sc $2"
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
"-display")
|
|
||||||
export DISPLAY=$2
|
export DISPLAY=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
"-t")
|
"--save")
|
||||||
xtimeout=$2
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
"-prog")
|
|
||||||
progparam=$2
|
|
||||||
shift
|
|
||||||
;;
|
|
||||||
"-vmem")
|
|
||||||
export LDEDESTSYSOUT=$2
|
export LDEDESTSYSOUT=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
"-kbd")
|
"--load")
|
||||||
export LDEKBDTYPE=$2
|
export LDESRCESYSOUT=$2
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# anything else is a public sysout name
|
passthrough_args="$passthrough_args $1" # don't know what it means?
|
||||||
case "$1" in
|
# just pass it through to lde
|
||||||
"-"*)
|
|
||||||
name=`expr substr $1 2 999`
|
|
||||||
export LDESRCESYSOUT="$MEDLEYDIR/loadups/${name}.sysout"
|
|
||||||
;;
|
|
||||||
*) # not an option so must be a sysout name
|
|
||||||
export LDESRCESYSOUT=$1 ;;
|
|
||||||
esac
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -z "$LDEDESTSYSOUT" ] ; then
|
|
||||||
if [ -f /$HOSTNAME/$LOGNAME/lisp.virtualmem ]; then
|
|
||||||
export LDEDESTSYSOUT=/$HOSTNAME/$LOGNAME/lisp.virtualmem
|
|
||||||
elif [ -f ~/lisp.virtualmem ]; then
|
|
||||||
export LDEDESTSYSOUT=~/lisp.virtualmem
|
|
||||||
elif [ -d /$HOSTNAME/$LOGNAME ]; then
|
|
||||||
export LDEDESTSYSOUT=/$HOSTNAME/$LOGNAME/lisp.virtualmem
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$LDESRCESYSOUT" ] ; then
|
if [ -z "$LDESRCESYSOUT" ] ; then
|
||||||
export LDESRCESYSOUT="$LDEDESTSYSOUT"
|
export LDESRCESYSOUT="$MEDLEYDIR/loadups/xfull35.sysout"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@@ -163,19 +101,14 @@ fi
|
|||||||
# # switch (`/usr/bin/hostinfo keyboardtype`)
|
# # switch (`/usr/bin/hostinfo keyboardtype`)
|
||||||
# # endsw
|
# # endsw
|
||||||
# fi
|
# fi
|
||||||
echo "keyboard type is " $LDEKBDTYPE
|
echo "keyboard type is" $LDEKBDTYPE
|
||||||
|
|
||||||
export INMEDLEY=1
|
export INMEDLEY=1
|
||||||
echo "sysout is " $LDESRCESYSOUT
|
echo "sysout is" $LDESRCESYSOUT
|
||||||
#version = `medley-lisp-version $LDESRCESYSOUT`
|
#version = `medley-lisp-version $LDESRCESYSOUT`
|
||||||
version="35010"
|
version="35010"
|
||||||
|
|
||||||
if [ "$LDELISPXNS" -ne "0" ] ; then
|
prog="lde"
|
||||||
prog="ldeether"
|
|
||||||
else
|
|
||||||
prog="lde"
|
|
||||||
echo "running without xns protocols"
|
|
||||||
fi
|
|
||||||
case "$version" in
|
case "$version" in
|
||||||
"35000")
|
"35000")
|
||||||
version="3.5"
|
version="3.5"
|
||||||
@@ -183,43 +116,14 @@ case "$version" in
|
|||||||
"35010")
|
"35010")
|
||||||
version="3.501"
|
version="3.501"
|
||||||
;;
|
;;
|
||||||
*)
|
|
||||||
version="3.5"
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
echo "using emulator version $version"
|
echo "using emulator version $version"
|
||||||
|
|
||||||
case "$version" in
|
|
||||||
"3.5"|"3.501")
|
|
||||||
|
|
||||||
export PATH=.:"$PATH"
|
|
||||||
old_wd=`pwd`
|
|
||||||
cd "$MAIKODIR"/bin
|
|
||||||
export PATH=$MAIKODIR/`osversion`.`machinetype`:"$PATH"
|
|
||||||
cd $old_wd
|
|
||||||
|
|
||||||
# if ${?DISPLAY} then # we are running under X
|
|
||||||
$prog $mem $geometry $screensize $ICONSPEC
|
|
||||||
# else $prog $mem
|
|
||||||
# endif
|
|
||||||
;;
|
|
||||||
|
|
||||||
*) echo HMM
|
|
||||||
|
|
||||||
esac
|
|
||||||
|
|
||||||
#
|
|
||||||
# Now we are done, so clean up after ourselves
|
|
||||||
#
|
|
||||||
cleanup:
|
|
||||||
|
|
||||||
# if ${?DISPLAY} then
|
|
||||||
# # do X cleanup
|
|
||||||
# else
|
|
||||||
# # reset
|
|
||||||
# endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export PATH=.:"$PATH"
|
||||||
|
old_wd=`pwd`
|
||||||
|
cd "$MAIKODIR"/bin
|
||||||
|
export PATH=$MAIKODIR/`osversion`.`machinetype`:"$PATH"
|
||||||
|
cd $old_wd
|
||||||
|
|
||||||
|
$prog $mem $geometry $passthrough_args
|
||||||
|
|||||||
Reference in New Issue
Block a user