Skip to content

Commit 58f8fbd

Browse files
authored
Restore REM.CM to be separate file from greet file; Enable chaining of medley runs using REM.CM file (#2027)
- Fixed INTERPRET.REM.CM so that it no longer tries to load the file pointed to by LDEINIT and instead loads the file pointed to by LDEREMCM. LDEINIT remains the file used by greet. - Adjusted the medley script to have a new argument -cm (or --rem.cm) which sets LDEREMCM as appropriate before launching lde. - Updated the loadup scripts as required to use this new -cm argument when calling medley. Finally, added a new feature to the medley script -cc (or --repeat) whereby which when medley finishes it checks for a nonzero file given as the argument to -cc. If that file exists, medley is run again (i.e., repeated) with LDEREMCM set to that file. This repeats until this file no longer exists or is zero-length. The file can be found as the vale of LDEREPEATCM so that each invocation of medley can modify (or delete) this file so as to change the subsequent run of medley.
1 parent 3aa58b6 commit 58f8fbd

18 files changed

+493
-134
lines changed

docs/man-page/man_medley.html

Lines changed: 264 additions & 76 deletions
Large diffs are not rendered by default.

docs/man-page/medley.1

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
1-
.\" Automatically generated by Pandoc 2.9.2.1
1+
.\" Automatically generated by Pandoc 3.1.3
22
.\"
3+
.\" Define V font for inline verbatim, using C font in formats
4+
.\" that render this, and otherwise B font.
5+
.ie "\f[CB]x\f[]"x" \{\
6+
. ftr V B
7+
. ftr VI BI
8+
. ftr VB B
9+
. ftr VBI BI
10+
.\}
11+
.el \{\
12+
. ftr V CR
13+
. ftr VI CI
14+
. ftr VB CB
15+
. ftr VBI CBI
16+
.\}
317
.ad l
418
.TH "MEDLEY" "1" "" "" "Start Medley Interlisp"
519
.nh
@@ -8,8 +22,8 @@
822
\f[B]medley\f[R] \[em] starts up Medley Interlisp
923
.SH SYNOPSIS
1024
.PP
11-
\f[B]medley\f[R] [ flags \&... ] [ \f[I]SYSOUT_FILE\f[R] ] [ --
12-
\f[I]PASS_ON_ARGS\f[R] ]
25+
\f[B]medley\f[R] [ flags \&...
26+
] [ \f[I]SYSOUT_FILE\f[R] ] [ -- \f[I]PASS_ON_ARGS\f[R] ]
1327
.SH DESCRIPTION
1428
.PP
1529
Starts Medley Interlisp in a window.
@@ -291,6 +305,21 @@ On Windows/Cygwin installations, \f[I]FILE\f[R] is specified in the
291305
Medley file system, not the host Windows file system.
292306
.RE
293307
.TP
308+
-cm [\f[I]FILE\f[R] | -], --rem.cm [\f[I]FILE\f[R] | -]
309+
Use \f[I]FILE\f[R] as the REM.CM file that Medley reads and executes at
310+
startup - after any greet files.
311+
Usually used only for loadups and other maintenance operations .
312+
.RS
313+
.PP
314+
If the given value is \[lq]-\[rq], Medley will start up without using
315+
REM.CM file.
316+
.PP
317+
There is no default Medley REM.CM file.
318+
.PP
319+
On Windows/Cygwin installations, \f[I]FILE\f[R] is specified in the
320+
Medley file system, not the host Windows file system.
321+
.RE
322+
.TP
294323
-x [\f[I]DIR\f[R] | - | \[en]], --logindir [\f[I]DIR\f[R] | - | \[en]]
295324
Use \f[I]DIR\f[R] as LOGINDIR in Medley.
296325
\f[I]DIR\f[R] must be writeable by the current user.
@@ -341,6 +370,22 @@ Relevant only to the Medley loadup workflow.
341370
\[en]maikodir \f[I]DIR\f[R]
342371
Use \f[I]DIR\f[R] as the directory containing the Maiko emulator.
343372
For testing purposes only.
373+
.TP
374+
-cc [\f[I]FILE\f[R] | -], --repeat [\f[I]FILE\f[R] | -]
375+
Run Medley once.
376+
And then as long as \f[I]FILE\f[R] exists and is greater then zero
377+
length, repeatedly run Medley using \f[I]FILE\f[R] as the REM.CM file
378+
that Medley reads and executes at startup.
379+
Each run of Medley can change the contents of \f[I]FILE\f[R] to effect
380+
the subsequent run of Medley.
381+
To end the cycle, Medley needs to delete \f[I]FILE\f[R].
382+
WIthin Medley, \f[I]FILE\f[R] can be found as the value of the
383+
environment variable LDEREPEATCM.
384+
.RS
385+
.PP
386+
On Windows/Cygwin installations, \f[I]FILE\f[R] is specified in the
387+
Medley file system, not the host Windows file system.
388+
.RE
344389
.SS Other Options
345390
.PP
346391
\

docs/man-page/medley.1.gz

391 Bytes
Binary file not shown.

docs/man-page/medley.1.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
% MEDLEY(1) | Start Medley Interlisp
1+
% MEDLEY(1) | Start Medley Interlisp
22

33
---
44
adjusting: l
@@ -210,6 +210,16 @@ in which case it is $MEDLEYDIR/greetfiles/APPS-INIT.
210210
On Windows/Cygwin installations, *FILE* is
211211
specified in the Medley file system, not the host Windows file system.
212212

213+
-cm \[*FILE* | -], \-\-rem.cm \[*FILE* | -]
214+
: Use *FILE* as the REM.CM file that Medley reads and executes at startup - after any greet files. Usually used only for loadups and other maintenance operations .
215+
216+
If the given value is "-", Medley will start up without using REM.CM file.
217+
218+
There is no default Medley REM.CM file.
219+
220+
On Windows/Cygwin installations, *FILE* is
221+
specified in the Medley file system, not the host Windows file system.
222+
213223
-x \[*DIR* | - | --], \-\-logindir \[*DIR* | - | --]
214224
: Use *DIR* as LOGINDIR in Medley. *DIR* must be writeable by the current user.
215225

@@ -242,6 +252,12 @@ for the parameter will be reset to the default value - which in the case of *Hos
242252
--maikodir *DIR*
243253
: Use *DIR* as the directory containing the Maiko emulator. For testing purposes only.
244254

255+
-cc \[*FILE* | -], \-\-repeat \[*FILE* | -]
256+
: Run Medley once. And then as long as *FILE* exists and is greater then zero length, repeatedly run Medley using *FILE* as the REM.CM file that Medley reads and executes at startup. Each run of Medley can change the contents of *FILE* to effect the subsequent run of Medley. To end the cycle, Medley needs to delete *FILE*. WIthin Medley, *FILE* can be found as the value of the environment variable LDEREPEATCM.
257+
258+
On Windows/Cygwin installations, *FILE* is
259+
specified in the Medley file system, not the host Windows file system.
260+
245261

246262
Other Options
247263
-------------

scripts/loadup-apps-from-full.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ main() {
3232
exit 1
3333
fi
3434

35-
git_commit_ID "${NOTECARDSDIR}"
36-
NOTECARDS_COMMIT_ID="${COMMIT_ID}"
37-
export NOTECARDS_COMMIT_ID
35+
git_commit_ID "${NOTECARDSDIR}"
36+
NOTECARDS_COMMIT_ID="${COMMIT_ID}"
37+
export NOTECARDS_COMMIT_ID
3838

39+
initfile="-"
3940
cat >"${cmfile}" <<-"EOF"
4041
"
4142

scripts/loadup-aux.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ main() {
88

99
loadup_start
1010

11+
initfile="-"
1112
cat >"${cmfile}" <<-"EOF"
1213
"
1314
(PROG

scripts/loadup-db-from-full.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ main() {
1313
exit 1
1414
fi
1515

16+
initfile="-"
1617
cat >"${cmfile}" <<-"EOF"
1718
"
1819

scripts/loadup-full-from-lisp.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ main() {
66

77
loadup_start
88

9+
initfile="-"
910
cat >"${cmfile}" <<-"EOF"
1011
"
1112

scripts/loadup-init.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ main() {
66

77
loadup_start
88

9-
cat >"${cmfile}" <<-"EOF"
9+
cmfile="-"
10+
cat >"${initfile}" <<-"EOF"
1011
(* "make init files; this file is loaded as a 'greet' file by scripts/loadup-init.sh")
1112
1213
(SETQ MEDLEYDIR NIL)
@@ -40,7 +41,7 @@ main() {
4041
(LOGOUT T)
4142
STOP
4243
EOF
43-
44+
4445
run_medley "${LOADUP_SOURCEDIR}/starter.sysout"
4546

4647
loadup_finish "init.dlinit" "init.*" "RDSYS*" "I-NEW*"

scripts/loadup-lisp-from-mid.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ main() {
55
. "${LOADUP_SCRIPTDIR}/loadup-setup.sh"
66

77
loadup_start
8-
8+
9+
initfile="-"
910
cat >"${cmfile}" <<-"EOF"
1011
"
1112

scripts/loadup-mid-from-init.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ main() {
66

77
loadup_start
88

9+
initfile="-"
910
cat >"${cmfile}" <<-"EOF"
1011
"
1112
(MOVD? (QUOTE NILL) (QUOTE PROMPTPRINT))

scripts/loadup-setup.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ touch "${LOADUP_WORKDIR}"/loadup.timestamp
7272

7373
script_name=$(basename "$0" ".sh")
7474
cmfile="${LOADUP_WORKDIR}/${script_name}.cm"
75+
initfile="${LOADUP_WORKDIR}/${script_name}.init"
7576

7677
# look thru args looking to see if oldschool was specified in args
7778
j=1
@@ -153,13 +154,14 @@ loadup_finish () {
153154
run_medley () {
154155
if [ ! "${LOADUP_OLDSCHOOL}" = true ]
155156
then
156-
/bin/sh "${MEDLEYDIR}/scripts/medley/medley.command" \
157+
/bin/sh "${MEDLEYDIR}/scripts/medley/medley.command" \
157158
--config - \
158159
--id loadup_+ \
159160
--geometry "${geometry}" \
160161
--noscroll \
161162
--logindir "${LOADUP_LOGINDIR}" \
162-
--greet "${cmfile}" \
163+
--rem.cm "${cmfile}" \
164+
--greet "${initfile}" \
163165
--sysout "$1" \
164166
"$2" "$3" "$4" "$5" "$6" "$7" ;
165167
exit_code=$?

scripts/medley/medley.command

Lines changed: 64 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,13 @@ flags:
586586
587587
-x - | --logindir - : use MEDLEYDIR/logindir as LOGINDIR in Medley
588588
589+
-cm FILE | --rem.cm FILE : use FILE as the REM.CM when starting up Medley. FILE must be absolute pathname.
590+
591+
-cm - | --rem.cm - : do not use an REM.CM. Negate any prior setting, e.g., from config file.
592+
593+
-cc FILE | --repeat FILE : as long as FILE exists and is greater than 0 length, repeat Medley run
594+
using FILE as REM.CM
595+
589596
sysout:
590597
The pathname of the file to use as a sysout for Medley to start from.
591598
If sysout is not provided and none of the flags [-a, -f & -l] is used, then Medley will start from
@@ -629,7 +636,8 @@ nh_mac_arg=""
629636
nh_debug_arg=""
630637
pixelscale_arg=""
631638
borderwidth_arg=""
632-
639+
remcm_arg="${LDEREMCM}"
640+
repeat_cm=""
633641
634642
# Add marker at end of args so we can accumulate pass-on args in args array
635643
set -- "$@" "--start_of_pass_args"
@@ -648,6 +656,28 @@ do
648656
# already handled so just skip both flag and value
649657
shift;
650658
;;
659+
-cm | --rem.cm | --remcm)
660+
if [ "$2" = "-" ] || [ "$2" = "--" ]
661+
then
662+
remcm_arg=""
663+
else
664+
check_for_dash_or_end "$1" "$2"
665+
check_file_readable "$1" "$2"
666+
remcm_arg="$2"
667+
fi
668+
shift
669+
;;
670+
-cc | --repeat.cm | --repeat)
671+
if [ "$2" = "-" ] || [ "$2" = "--" ]
672+
then
673+
repeat_cm=""
674+
else
675+
check_for_dash_or_end "$1" "$2"
676+
# check_file_readable "$1" "$2"
677+
repeat_cm="$2"
678+
fi
679+
shift
680+
;;
651681
-d | --display)
652682
if [ "$2" = "-" ]
653683
then
@@ -1219,6 +1249,10 @@ else
12191249
fi
12201250
export LDEINIT
12211251
1252+
# figure out rem.cm and repeat.cm situation
1253+
export LDEREMCM="${remcm_arg}"
1254+
export LDEREPEATCM="${repeat_cm}"
1255+
12221256
# figure out noscroll situation
12231257
noscroll_arg=""
12241258
if [ "${noscroll}" = true ]
@@ -1415,12 +1449,24 @@ then
14151449
fi
14161450
14171451
1418-
# Run maiko either directly or with vnc
1419-
if [ "${use_vnc}" = true ]
1420-
then
1421-
# do the vnc thing - if called for
1422-
# shellcheck source=./medley_vnc.sh
1423-
# . "${SCRIPTDIR}/medley_vnc.sh"
1452+
# Repeatedly run medley as long as there is a repeat_cm file called for and it exists and is not zero length
1453+
# In most cases, there will be no repeat_cm and hence medley will only run once
1454+
1455+
loop_ctr=0
1456+
while [ ${loop_ctr} -eq 0 ] || { [ -n "${repeat_cm}" ] && [ -f "${repeat_cm}" ] && [ -s "${repeat_cm}" ] ; }
1457+
do
1458+
if [ ${loop_ctr} -eq 1 ]
1459+
then
1460+
LDEREMCM="${repeat_cm}"
1461+
fi
1462+
loop_ctr=1
1463+
1464+
# Run maiko either directly or with vnc
1465+
if [ "${use_vnc}" = true ]
1466+
then
1467+
# do the vnc thing - if called for
1468+
# shellcheck source=./medley_vnc.sh
1469+
# . "${SCRIPTDIR}/medley_vnc.sh"
14241470
# shellcheck shell=sh
14251471
# shellcheck disable=SC2154,SC2162
14261472
###############################################################################
@@ -1658,9 +1704,15 @@ then
16581704
true
16591705
16601706
#######################################
1661-
else
1662-
# If not using vnc, just exec maiko directly
1663-
# handing over the pass-on args which are all thats left in the main args array
1664-
start_maiko "$@"
1665-
fi
1707+
else
1708+
# If not using vnc, just exec maiko directly
1709+
# handing over the pass-on args which are all thats left in the main args array
1710+
start_maiko "$@"
1711+
fi
1712+
if [ -n "${exit_code}" ] && [ ${exit_code} -ne 0 ]
1713+
then
1714+
exit ${exit_code}
1715+
fi
1716+
1717+
done
16661718
exit ${exit_code}

scripts/medley/medley_args.sh

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ nh_mac_arg=""
4646
nh_debug_arg=""
4747
pixelscale_arg=""
4848
borderwidth_arg=""
49-
49+
remcm_arg="${LDEREMCM}"
50+
repeat_cm=""
5051

5152
# Add marker at end of args so we can accumulate pass-on args in args array
5253
set -- "$@" "--start_of_pass_args"
@@ -65,6 +66,28 @@ do
6566
# already handled so just skip both flag and value
6667
shift;
6768
;;
69+
-cm | --rem.cm | --remcm)
70+
if [ "$2" = "-" ] || [ "$2" = "--" ]
71+
then
72+
remcm_arg=""
73+
else
74+
check_for_dash_or_end "$1" "$2"
75+
check_file_readable "$1" "$2"
76+
remcm_arg="$2"
77+
fi
78+
shift
79+
;;
80+
-cc | --repeat.cm | --repeat)
81+
if [ "$2" = "-" ] || [ "$2" = "--" ]
82+
then
83+
repeat_cm=""
84+
else
85+
check_for_dash_or_end "$1" "$2"
86+
# check_file_readable "$1" "$2"
87+
repeat_cm="$2"
88+
fi
89+
shift
90+
;;
6891
-d | --display)
6992
if [ "$2" = "-" ]
7093
then

0 commit comments

Comments
 (0)