mirror of
https://github.com/PDP-10/its.git
synced 2026-05-02 06:25:59 +00:00
Except IVORY, there's also WORDAB and TMACS. IVORY needs go be generated with itself, so include the :EJ for bootstrapping.
968 lines
38 KiB
Plaintext
Executable File
968 lines
38 KiB
Plaintext
Executable File
!* -*-TECO-*- *!
|
||
!* This is the EMACS library TMACS. Note that it requires the purifier in
|
||
* EMACS;IVORY -- not the one in EMACS;PURIFY.
|
||
* Note too that when making EMACS;TMACS :EJ, you need to compress this
|
||
* source and also TMUCS >. You can use M-X Compile, since this file
|
||
* has a local Compile Command, which leaves the object in ECC;XTMACS :EJ.
|
||
* The documentation strings starting with "I" indicate internal subroutines
|
||
* not intended to be called from outside TMACS.
|
||
* In general, for easy abstracting (Abstract File), the most generally
|
||
* useful stuff should be at the top. And, documentation should be filled
|
||
* with a Fill Column of 70. You can use (local to this file) M-X Edit TMACS
|
||
* Documentation.
|
||
*!
|
||
!~FILENAME~:! !Random collection of useful functions.!
|
||
TMACS
|
||
|
||
!Type Mailing List:! !C Prints an entry in ITS mailing list file.
|
||
This works on any ITS machine. (.MAIL.;NAMES > has the ITS mailing
|
||
lists.)
|
||
For instance, M-X Type Mailing Listbug-random-program<cr> will show
|
||
you who is on the bug-random-program mailing list on your machine.
|
||
If string argument is of form <name>@<site>, <site>:.MAIL.;NAMES is
|
||
used. Only final @ indicates site, so you can do something like:
|
||
M-X Type Mailing List$BUG-@@AI$
|
||
A numeric argument limits depth of recursion on EQV-LIST members.
|
||
(Default depth is 3.)
|
||
<name>@<site> entries in EQV-LIST are not followed.
|
||
Prints "Done." when done, since it sometimes is slow. Giving a
|
||
pre-comma numeric argument inhibits done-printing, for use as a
|
||
subroutine.!
|
||
|
||
:i* [.1 !* .1: Stringarg, the mailing list.!
|
||
[f[.2[.3[.4[.5 [..o
|
||
m.m& Maybe Flush Outputuf !* F: Flusher.!
|
||
0fo..qTML Levelu.5 !* .5: Our current invocation level.!
|
||
|
||
q.5+1-(ff&1"E 3 '"# ')"G ' !* If recursed enuf, quit.!
|
||
|
||
mF !* If output flushed, quit.!
|
||
|
||
q.5"E !* At top level, initialize.!
|
||
m.m Kill Variable[K !* K: Kill Var.!
|
||
qBuffer Name[B !* B: Original Buffer name.!
|
||
[Previous Buffer !* Save default.!
|
||
FN 1:< mKTML So far >w !* Kill our recursion-helpers if quit.!
|
||
1:< mKTML NAMES >w !* ...!
|
||
1:< mKTML Level >w !* ...!
|
||
qBm(m.mSelect Buffer) !* Back to original buffer.!
|
||
!* End of FN.!
|
||
f[DFile !* Save filename defaults.!
|
||
q.1u.2 !* .2: Copy of mailing list name.!
|
||
< @f.2f(:;)+1,fq.2:g.2u.2 > !* .2: Stuff after final @.!
|
||
0,fq.1-fq.2-1:g.1u.1 !* .1: Stuff before final @.!
|
||
fq.1"E q.2u.1 !* .1: No @ present, is whole name.!
|
||
fsMachine :f6u.2' !* .2: No @, is machine name.!
|
||
!* .1: Name.!
|
||
q.2:fcu.2 !* .2: Site, uppercased.!
|
||
m(m.m Select Buffer)NAMES@.2 !* E.g. NAMES@ML.!
|
||
z"E @ftReading .2:.MAIL.;NAMES !* May take a while, tell user.!
|
||
-1,1m(m.mVisit File).2:.MAIL.;NAMES > !* Read names !
|
||
' !* file if not in.!
|
||
q..o m.vTML NAMESw !* Pass it on to recursive calls.!
|
||
fsBCons m.vTML So farw !* Buffer for entries traced so far, so!
|
||
!* dont run into ugly-looking loops.!
|
||
%.5 m.vTML Levelw !* Make recursion-level counter.!
|
||
' !* End top level init.!
|
||
|
||
"# %.5 uTML Levelw' !* Increment level count if not top level.!
|
||
|
||
q..o[.7 !* .7: Buffer to restore point in.!
|
||
.[.6 !* .6: Original point.!
|
||
|
||
qTML So faru..o !* Switch to buf with entries traced.!
|
||
bj :s
|
||
.1
|
||
"L oEXIT' !* Quit if weve traced it before.!
|
||
i
|
||
.1
|
||
!* If havent, add it to list now.!
|
||
|
||
qTML NAMESu..o !* Switch to buffer with NAMES.!
|
||
bj <:s
|
||
(.1"E oEXIT' !* Find the entry. ) !
|
||
0af
|
||
([;> !* Must end with Lisp atom break.!
|
||
-ful !* Back to beginning of entry.!
|
||
flu.4w !* .4: End of entry.!
|
||
.,q.4x.2 !* .2: The whole entry.!
|
||
ft.2
|
||
!* Type whole entry.!
|
||
.,q.4:fb(EQV-LIST"E oEXIT' !* Look for an eqv-list to expand. )!
|
||
fkc flu.4w !* .4: End of EQV-LIST.!
|
||
@ fwl !* Past the EQV-LIST atom.!
|
||
< .-q.4; !* Go thru EQV-LIST.!
|
||
mf1; !* Stop if output flushed.!
|
||
@:fll !* To next S-EXP.!
|
||
0,1a-("E @:fwl !* List: take first atom.!
|
||
@fwx.3 !* .3: atom to look up.!
|
||
fm(m.m Type Mailing List).3w !* Recurse.!
|
||
ful !<!>' !* Past end of list.!
|
||
0,1a-;"E l !<!>' !* Comment: skip it.!
|
||
0,1a-)"E q.4j !<!>' !* End of EQV-LIST, done.!
|
||
@fwx.3 @fwl !* .3: EQV-LIST member atom. !
|
||
fm(m.m Type Mailing List).3w !* Recurse.!
|
||
> !* Look up all members of EQV-LIST.!
|
||
|
||
!EXIT!
|
||
|
||
q.5-1u.5 !* .5: Decremented level count.!
|
||
q.5uTML Level
|
||
q.5"E !* At top level, cleanup.!
|
||
qTML So far fsBKill !* Kill the list of entries traced.!
|
||
mkTML So far !* Kill our recursion-helpers.!
|
||
mkTML NAMES !* ...!
|
||
mkTML Level !* ...!
|
||
ff&2"e fsListen"e ftDone.
|
||
' !* Type done only at top level.!
|
||
"# ftFlushed.
|
||
''' !* Done top-level cleanup.!
|
||
"# !* Not at top level, restore buffer.*!
|
||
q.7u..o !* Switch to original (+-) buffer.!
|
||
q.6j' !* Back to original point.!
|
||
w 1 !* Return.!
|
||
|
||
!^R Select Buffer:!!Buffer Menu:! !^R Display information about all buffers.
|
||
A recursive edit level is entered on a list of all buffers.
|
||
On exit the buffer on the current line is selected.
|
||
Point is initially on line of current buffer and space will exit (like
|
||
^R Exit), so this is very much like List Buffers but
|
||
combines listing with selecting in a way that does not involve
|
||
much typing or redisplay. * means modified, - means modified and not
|
||
auto-saved, and . means current buffer.
|
||
D will mark buffer for deletion on exit,
|
||
S will mark buffer for saving on exit,
|
||
U will unmark buffer, and
|
||
~ will clear modified flags of buffer.!
|
||
|
||
[0[1[2[3[4[5[6[7[8 !* save regs!
|
||
f[DFile !* save default filename!
|
||
fsQPPtru8 !* 8: point to unwind before!
|
||
!* selecting a different buffer!
|
||
fsBCons[..o !* get us a buffer!
|
||
i # Buffer (Mode) Filename
|
||
|
||
2u7 !* 7: line count!
|
||
0u4 fq.b/5u5 !* 4: .B index, 5: stopping point!
|
||
< q4-q5; !* Go thru buffer table; stop at end!
|
||
q:.b(q4+4!*bufbuf!)[..o !* make the buffer current so can!
|
||
!* check modified, readonly, etc.!
|
||
0u1 !* 1: flag bits!
|
||
fsModified"n q11u1' !* 1&1: nonzero if modified!
|
||
q:.b(q4+10!*bufsav!)"N !* Ignored unless auto save mode.!
|
||
fsXModified"N q12u1'' !* 1&2: nonzero if Xmodified!
|
||
fsZu3 !* 3: no. of characters in buffer!
|
||
]..o !* back to listing buffer!
|
||
.u0 4,32i !* 0: start address of this line!
|
||
q1&1"n .-2f*' !* indicate if modified!
|
||
q1&2"n .-1f-' !* indicate if not auto saved!
|
||
2,q:.b(q4+7!*bufnum!)\ !* Type the buffer's number!
|
||
i g:.b(q4+1!*bufnam!) !* Type buffer's name,!
|
||
17-(.-q0):f"gw 1',32i !* move to column 17!
|
||
q:.b(q4+3!*bufmod!)u1 !* 1: buffer's major mode!
|
||
qBuffer Index-q4"e !* if current buffer!
|
||
qModeu1 q0u6 !* then use current mode, and save .!
|
||
.( q0+3j 2a-32"e c' f. )j ' !* and put dot next to number!
|
||
i(1) !* Type major mode!
|
||
32-(.-q0):f"gw 1',32i !* move to column 32!
|
||
q:.b(q4+2!*bufvis!)u1 !* 1: visited filename!
|
||
q1"n g1 !* type filename if there is one!
|
||
et1 q:.b(q4+9!*bufver!)u2 !* get actual version number.!
|
||
fsDVersion:"g !* ...!
|
||
fsDVersion+1"n !* ...!
|
||
i ( g2 i)''' !* Print file version if valid.!
|
||
"# q3\ i Characters' !* No filename, type the size.!
|
||
q:.b(q4+12!*bufnwr!)u2 !* Say which if any read only modes.!
|
||
q2"g i File Read-Only' !* ...!
|
||
q2"l i Buffer Read-only' !* ...!
|
||
i
|
||
%7w !* add CRLF, increment line count!
|
||
q:.b(q4)+q4u4 !* advance past this buffer!
|
||
>
|
||
q6"n q6j' !* goto line with current buffer!
|
||
fsLinesu6 q6"e fsHeight-(fsEchoLines)-1u6' !* 6: current fsLines!
|
||
q7+1-q6"l q7+1f[Lines' !* set fsLines so that only the amount!
|
||
!* of screen needed is used, reducing!
|
||
!* redisplay of rest of buffer.!
|
||
0f[Window !* start display at top!
|
||
0fs^RInitf[^RNormal !* make normals undefined!
|
||
33.fs^Rinit[ w !* space exits ^R mode!
|
||
:i*Buffer Menu[..j !* use reasonable mode line!
|
||
0[..F !* dont let user screw himself!
|
||
!* Now bind some keys for editing the buffer menu!
|
||
|
||
@:i*| 0f[Lines m(m.mDescribe)Buffer Menu h|f[HelpMac !* HELP: describe us!
|
||
@:i*| 0l @f DS*-.l \[1 q1"e 0l fg 1' !* 1: buffer number!
|
||
q1m(m.m& Find Buffer)u1 !* 1: buffer index!
|
||
q:.b(q1+4!*bufbuf!)[..o 0fsModifiedw 0fsXModifiedw ]..o
|
||
0l .+2f .+2,.+4 |[~ !* ~: clear modified flag!
|
||
|
||
@:i*| 0l 0,1a-32"n fg 1' !* insure not already marked!
|
||
fD 1 |