mirror of
https://github.com/PDP-10/its.git
synced 2026-03-23 09:19:24 +00:00
189 lines
6.9 KiB
Plaintext
189 lines
6.9 KiB
Plaintext
|
||
!~Filename~:! !Commands for Interlisp interface!
|
||
INTERMACS
|
||
|
||
!Grind Sexp:! !C Grind the sexp after the pointer.
|
||
A modification of the MIT Grind Sexp that recognizes that
|
||
in Interlisp, % quotes a character, " starts a long
|
||
string, and ; has no significance.
|
||
Uses QMiser Column to decide where to start using "Miser" format,
|
||
and QFill Column as the page width to aim for.
|
||
Saves the old sexp on the kill ring.!
|
||
|
||
1:<
|
||
FDL R !* Find the next list.!
|
||
F[VB F[VZ FL FSBOUND !* Narrow bounds to that list.!
|
||
F=MODELISP"N OConfirm'
|
||
z-b-1000"g !Confirm! ^FTDo_you_really_want_to_Grind_this_s-expression?_(Y_or_N):
|
||
FI :FC - Y( FS Echo Display C FS Echo Display)"N ''
|
||
Z:
|
||
M(M.M &_Save_Region_and_Query) !* No arg so no query, just save region.!
|
||
W J
|
||
[2 [3
|
||
!*** Now normalize the expression; put it into the form PRIN1 would print.!
|
||
[D 128*5,32:ID !* In QD make a dispatch that!
|
||
11.*5:F D -D :M2 !* turns any whitespace into a single space,!
|
||
15.*5:F D RK :M2 !* deletes CRLFs and the indentation after them,!
|
||
12.*5:F D -D :M2
|
||
%*5:F D C !* Handle %'s and "'s right.!
|
||
"*5:F D R ^FLL
|
||
(*5:F D :M3 !* Make sure no whitespace follows ('s and ''s!
|
||
!"! '*5:F D :M3
|
||
)*5:F D R M3 C !* or precedes )'s.!
|
||
:I2 Z-.< 1A F_ :; D> 32I
|
||
:I3 Z-.< 1A F_ :; D>
|
||
HFD
|
||
J .( 0FS VBW 0L .FS VB )J !* Include all of line, up to (, after B,!
|
||
!* so that FS HPOS is accurate.!
|
||
!*** Now decode the grinding parameters.!
|
||
FS WIDTH-10[W !* Figure the width to aim at!
|
||
FS WIDTH*2/3[C !* and the comment column.!
|
||
0FO ..Q Fill_Column F"N UW
|
||
QWUC'
|
||
-1FO ..Q Comment_Column +1F"G -1UC'
|
||
QC[M !* Figure the place to switch to Miser fmt.!
|
||
-1FO ..Q Miser_Column +1F"G -1UM'
|
||
[R :IR /8+1*8
|
||
0FO ..Q Comment_Rounding F"N UR'
|
||
M.M &_Indent [I
|
||
!* G gets recursive macro to grind and pass 1 sexp.!
|
||
!* It expects numerc arg = depth in parens.!
|
||
[G ^:IG`
|
||
[2 S' R !* Pass by all leading quotes.!
|
||
1A-("N ^FWL ' !* Atoms, just skip over.!
|
||
FL-.-QW++(FS HPOSU2 Q2)"L FLL ' !* Lists that fit in line, skip over.!
|
||
C Q2-QM"L !* If not yet far enough for Miser fmt,!
|
||
!"! 1A F';()"L ^FWL 1A-32"E C''' !* Skip 1st element, so get 2 on 1st line.!
|
||
!* But if 1st element is a list, use miser fmt anyway.!
|
||
FS HPOS U2 !* Q2 gets column to put rest of elements at.!
|
||
!LP! 1a-32"E D O LP' !* Don't be confused by whitespace.!
|
||
1A-)"E C ' !* Until end of this list,!
|
||
FS HPOSU3
|
||
Q3-Q2"N 13I 10I !* and for lists, indent to right place!
|
||
Q2/8,9I Q2&7,32I'
|
||
+1MG O LP !* and recursively grind.!
|
||
`
|
||
0MG !* DO IT!
|
||
J 7F~ (DEFUN_"E !* Now, if list is (DEFUN FOO<cr>..., then!
|
||
^FLL 8F=
|
||
______"E
|
||
8D .U3 L !* Get the thing after FOO onto first line,!
|
||
Q3,. F~FEXPR
|
||
*(Q3,. F~MACRO
|
||
)"E !* and if it is a function property name,!
|
||
-2D 6D''' !* get it on that line too.!
|
||
J HU2U3
|
||
> !* end errset!
|
||
J Z: !* Leave region around the ground sexp.!
|
||
Q3,Q2
|
||
|
||
!& LISP SUPERIOR:! !S Insert as directed by call from LISP.!
|
||
[A
|
||
[B
|
||
[0
|
||
.U0 ZJ Z-3"G
|
||
0A-3"E -4D''
|
||
Q0J !* We delete the four characters at the!
|
||
!* end that are used to stop LISP from!
|
||
!* reading too far!
|
||
"N
|
||
FSIFILEUA !* The most recently opened input file!
|
||
QLISPFILEUB !* The EMACS.TEMP.FILE!
|
||
FS UREAD"N !* If anything is open,!
|
||
F~AB"N !* then if it's not EMACS.TEMP.FILE!
|
||
E[ !* push the input!
|
||
F[ D FILE !* push the default!
|
||
FN E] !* pop the input on exit from here!
|
||
ERB' !* and open up EMACS.TEMP.FILE!
|
||
0FSIFACCESS' !* start reading at the beginning!
|
||
FS UREAD"E !* if nothing is open!
|
||
ERB' !* read EMACS.TEMP.FILE!
|
||
U0
|
||
"L -Q0U0' !* The absolute value of the arg in 0!
|
||
"G MM^R_SET/POP_MARK
|
||
ZJ'
|
||
Q0FY
|
||
"L
|
||
.+,.FXA !* If the arg is negative we put!
|
||
MA' !* the stuff in A, delete and macro it.!
|
||
"G
|
||
R
|
||
.,ZFSBOUNDARIES'
|
||
' !* We do nothing on a zero arg!
|
||
+1"G F+ !* If arg nonnegative, clear screen and refresh.!
|
||
:F'
|
||
|
||
|
||
!^R UP EVAL:! !^R Return to LISP and evaluate sexp after point.!
|
||
|
||
1000MM^R_Exit_To_LISP
|
||
|
||
|
||
!^R ARGLIST:! !^R Write into lower buffer arglist atom after point.
|
||
Writes into lower buffer LISP arglist of function after point (or after
|
||
open parenthesis after point.)!
|
||
|
||
1001MM^R_Exit_To_LISP
|
||
|
||
|
||
!^R Pretty Print:! !^R Pretty print buffer (using LISP pretty printer).
|
||
Leaves point close to where it was, namely after the rightmost close
|
||
parenthesis before point.!
|
||
[0
|
||
0u0
|
||
<-:S(; %0>
|
||
1003MM^R_Exit_To_LISP
|
||
.-B"E Q0:S('
|
||
|
||
|
||
!^R Print to Level:! !^R Print sexp after point with PRINTLEVEL set.
|
||
Prints sexpression after point into lower buffer with PRINTLEVEL
|
||
set to EMACS.P.PRINT.LEVEL.!
|
||
|
||
1002MM^R_Exit_To_LISP
|
||
|
||
|
||
!^R Exit To LISP:! !^R Simply return to LISP.
|
||
Follows the protocol of closing the gap and
|
||
leaving at the end of the buffer a string
|
||
guaranteed to stop a LISP read.!
|
||
[0
|
||
.U0
|
||
ZJ
|
||
I_"
|
||
1F? !* Close the gap, so LISP can!
|
||
!* read from the buffer!
|
||
Q0J
|
||
FSEXIT
|
||
|
||
|
||
!& Setup INTERMACS Library:! !S SETUP!
|
||
[J
|
||
1M.VLISPFILE
|
||
FSJNAMEUJ
|
||
F~JLISP"E
|
||
FS MSNAME FS D SNAME
|
||
EREMACS.TEMP.FILE.0
|
||
FS I FILE ULISPFILE
|
||
F~Editor_NameEMACS/Datamedia"E
|
||
M.M^R_Pretty_PrintU...T
|
||
M.M^R_Pretty_PrintU:.X(T)
|
||
M.M^R_Print_To_Level U..T
|
||
M.M^R_Exit_To_LISPM.VMM_Quit
|
||
M.M^R_ARGLIST U.A
|
||
M.M^R_Up_EVAL U.Y'
|
||
"#M.M^R_Pretty_PrintU...P
|
||
M.M^R_Print_To_Level U..P
|
||
M.M^R_Exit_To_LISP U ..Z
|
||
M.M^R_Exit_To_LISP U...Z
|
||
M.M^R_ARGLIST U...?
|
||
M.M^R_Up_EVAL U...Y'
|
||
M.M&_LISP_SuperiorFSSUPERIOR'
|
||
1m.vLISP_)_HACK
|
||
mmLISP_MODE
|
||
MM&_Process_Options
|
||
:I..D_A____A____A____A____A____A____A____A____A______________A_________
|
||
____A____A____A____A____A____A____A____A____A____A____A____A____A____A____A____A____A____A_________A____|____A___AA___A/____A____'____(____)____A____A____A____A___AA____A___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA____A____A____A____A____A____A____A___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA____A____A____A____A____A____A___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA___AA____A____A____A____A________
|
||
|
||
|