1
0
mirror of synced 2026-01-13 23:47:27 +00:00

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:
Abe Jellinek 2020-11-23 18:43:58 -08:00
parent 065be116b6
commit 0704402930

View File

@ -2,160 +2,98 @@
#
# Run Medley
#
# Syntax: run-medley [-nogreet][-xns][-noxns] [-geometry pixelgeometry]
# [-display xdisplay-device] [-screensize pixelgeometry]
# [-raw] [-t xtimeout][-prog executable-program]
# [-vmem savevmemfilename] |
# [-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`
# Syntax: run-medley [--geometry WIDTHxHEIGHT] \
# [--display X_DISPLAY] \
# [--save FILE] \
# [--load URL_OR_FILE]
# Directory variables are accessible from Lisp via UNIX-GETENV
if [ -z "$MEDLEYDIR" ] ; then export MEDLEYDIR=`pwd`; fi
if [ ! -d $MEDLEYDIR/loadups ] ; then
echo MEDLEYDIR not found: "$MEDLEYDIR"
exit 1
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 [ -z "$MAIKODIR" ] ; then
export MAIKODIR="$MEDLEYDIR/../maiko"
if [ ! -d "$MAIKODIR"/bin ] ; then
echo "MAIKODIR not found: $MAIKODIR"
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
fi
export LDEINIT="$MEDLEYDIR/greetfiles/LOCAL-INIT"
passthrough_args=""
mem="-m 256" # Default, has to be set
#geometry="-g 1060x790"
# MBA screensize
geometry="-g 1440x900"
screensize="-sc 1440x900"
geometry="-g 1280x720"
# keyboard types: x, type2, type3, type4, jle, as3000j
export LDEKBDTYPE=x
ICONSPEC=" "
export LDEFILETIMEOUT=60
export TAKEXNSDOWN=0
export LDELISPXNS=0
#default is no lispxns
while [ "$#" -ne 0 ]; do
case "$1" in
"-m")
mem="-m $2"
"--geometry")
geometry="-g $2 -sc $2"
shift
;;
"-xlisp")
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")
"--display")
export DISPLAY=$2
shift
;;
"-t")
xtimeout=$2
shift
;;
"-prog")
progparam=$2
shift
;;
"-vmem")
"--save")
export LDEDESTSYSOUT=$2
shift
;;
"-kbd")
export LDEKBDTYPE=$2
"--load")
export LDESRCESYSOUT=$2
shift
;;
*)
# anything else is a public sysout name
case "$1" in
"-"*)
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
passthrough_args="$passthrough_args $1" # don't know what it means?
# just pass it through to lde
;;
esac
shift
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
export LDESRCESYSOUT="$LDEDESTSYSOUT"
export LDESRCESYSOUT="$MEDLEYDIR/loadups/xfull35.sysout"
fi
@ -163,19 +101,14 @@ fi
# # switch (`/usr/bin/hostinfo keyboardtype`)
# # endsw
# fi
echo "keyboard type is " $LDEKBDTYPE
echo "keyboard type is" $LDEKBDTYPE
export INMEDLEY=1
echo "sysout is " $LDESRCESYSOUT
echo "sysout is" $LDESRCESYSOUT
#version = `medley-lisp-version $LDESRCESYSOUT`
version="35010"
if [ "$LDELISPXNS" -ne "0" ] ; then
prog="ldeether"
else
prog="lde"
echo "running without xns protocols"
fi
prog="lde"
case "$version" in
"35000")
version="3.5"
@ -183,43 +116,14 @@ case "$version" in
"35010")
version="3.501"
;;
*)
version="3.5"
;;
esac
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