mirror of
https://github.com/PDP-10/its.git
synced 2026-03-20 16:38:16 +00:00
415 lines
17 KiB
Plaintext
Executable File
415 lines
17 KiB
Plaintext
Executable File
!* -*-TECO-*-!
|
||
!^R Extended Command:! !^R Read an extended command from the terminal with completion.
|
||
This command reads the name of a function, with completion,
|
||
followed by the string arguments for the function. Then the
|
||
function is called. Completion is done as the function name is typed
|
||
(for more information type the HELP key while entering the name).
|
||
Follow the function name with a and then the arguments; end with <cr>.
|
||
For customization info see the source code.!
|
||
|
||
!* Internals:
|
||
Uses & Read Command Name and & Read Line to echo at bottom of screen.
|
||
If the variable Read Command Prompt exists it specifies the prompt string;
|
||
otherwise "MM " is used. A numeric argument is passed along to the M-X
|
||
command. The command string is saved on the minibuffer ring
|
||
so that ^R Re-execute Mini will redo it, and ^R Execute Mini
|
||
with argument will get it back for editing.!
|
||
|
||
fsQPPtr[7 !* Save PDL ptr so cleanup before execute!
|
||
[0[1[2[5[6 !* save regs!
|
||
|
||
:i0 ff"n !* 0: Start with null string!
|
||
ff&1"N :\u0' !* 0: Post-comma argument!
|
||
ff&2"N :\u1 :i01,0' !* 0: Pre-comma arg too!
|
||
:i00_' !* 0: Argument(s) and space!
|
||
|
||
:i*M-X_fo..qRead_Command_Promptu2 !* get prompt string in q2!
|
||
:i1
|
||
< 4,q1m(m.m&_Read_Command_Name)02u1u6
|
||
fq1-1"l ' !* if empty arg or rubbed out then return!
|
||
q6&2"n :i6 1;' !* ended with CR, make null arglist.!
|
||
@:i*| :ft m(m.mDescribe)1 |f[HelpMac
|
||
!* set help macro to do describe!
|
||
q6"n @ft' !* If command name already printed, add Altmode.!
|
||
1#q6&1,m(m.m&_Read_Line)021u6 !* read arguments!
|
||
-1fsQPUnwind !* restore help macro!
|
||
fq6; !* exit unless empty or rubbed out!
|
||
> !* keep trying!
|
||
:i10M(M.M_1)6 !* Stick <n>MM ... around typed command!
|
||
f1:"l !* If there is a ^] in the string,!
|
||
1fo..qQuote_Execute_Command"n !* user want ^] quoting?!
|
||
f[BBind g1 !* yes!
|
||
j <:s; i> !* replace each one by two of them.!
|
||
hx1 f]BBind''
|
||
f=(q:.n(0)f"e w :i*')1"n !* If this command not same as previous command,!
|
||
q.n[..o zj -5d !* push this command onto ring buffer of!
|
||
j 5,0i ]..o !* minibuffer commands.!
|
||
q1u:.n(0)' !* made room, now store it!
|
||
:m( q1(q7fs qp unwind)) !* Now execute command after restoring outer environment.!
|
||
|
||
!^R Instant Extended Command:! !^R Run extended command; let it read its own arguments.
|
||
This command is the same as ^R Extended Command except that
|
||
it does not read any string arguments; the function itself does so.
|
||
This allows special processing such as completion to be done
|
||
on arguments which are function names or filenames.!
|
||
|
||
!*
|
||
Internals:
|
||
Uses & Read Command Name to echo at bottom of screen.
|
||
If the variable Instant Command Prompt exists it specifies the prompt string;
|
||
otherwise "C-M-X " is used. A numeric argument is passed along to the MM
|
||
command.!
|
||
|
||
fsQPPtr[7 [0[1 !* Save PDL ptr so cleanup before execute!
|
||
|
||
:i0 ff"n !* 0: Start with null string!
|
||
ff&1"N :\u0' !* 0: Post-comma argument!
|
||
ff&2"N :\u1 :i01,0' !* 0: Pre-comma arg too!
|
||
:i00_' !* 0: Argument(s) and space!
|
||
|
||
:i*C-M-X_fo..qInstant_Command_Promptu1 !* get prompt string in q1!
|
||
9,f01u1
|
||
fq1:"g 0' !* if empty arg or rubbed out then return!
|
||
f:m(m.m1(q7fsQPUnwind)) !* Goto MM command!
|
||
|
||
!& Read Command Name:! !S Read in an command name, with completion.
|
||
Rubout, ^D, ^U and ^L perform editing. Space, Altmode, and Tab do completion.
|
||
? lists choices.
|
||
|
||
Takes a prompt-string as a following string argument.
|
||
A numeric argument is the initial contents of the string to be accumulated.
|
||
A pre-comma arg containing the "4" bit means don't wait for a confirming CR;
|
||
the "2" bit means complete over the symbol table in CRL List using the prefix
|
||
string in CRL Prefix. The "8" bit is deliberately ignored.
|
||
The "16" bit permits names that don't match.
|
||
The "32" bit means CR is allowed with an empty name.
|
||
|
||
The F^K command with the "8" bit set in its precomma arg
|
||
calls & Read Command Name, passing along its arguments.
|
||
|
||
Two values are returned, the second being the completed string
|
||
(or 0 if exit was due to over-rubout).
|
||
The first is bit-decoded; 1 means we displayed the string,
|
||
2 means the terminating character was Return, 4 means we terminated
|
||
without doing completion so the string might not match any alternative.
|
||
|
||
See Source code for more info.!
|
||
|
||
!* If the 16 bit is set in the pre-comma arg, then names
|
||
which don't match are permitted. How to specify one is
|
||
controlled by the value of CRL Non-Match Method:
|
||
2 bit: CR will terminate without performing completion
|
||
4 bit: LF will terminate without performing completion
|
||
8 bit: if user types CR and completion is not possible,
|
||
typing another CR will terminate without performing completion
|
||
(this overrides the presence of the 2 bit); also, typing
|
||
C-CR will terminate without performing completion (if your
|
||
terminal cannot generate the 9-bit character set, then you
|
||
may want to set the 4 bit also, so the you can use LF)
|
||
The default value is 2. (A value of 1 will prohibit non-matches
|
||
in ALL cases.)
|
||
|
||
CRL Name Lister can (if not zero) contain a function for use
|
||
in assembling the list of matching items, for "?".
|
||
This function is used as follows:
|
||
|
||
(1) For each name to display, the function is called with no
|
||
pre-comma arg, and a post-comma arg which is an index into CRL
|
||
List (which can be found in Q.1). The function should insert
|
||
information about that name into the buffer beginning at
|
||
point, and include a CRLF at the end.
|
||
|
||
(2) The function is called with a pre-comma arg of 1, with the
|
||
buffer containing all the names. The entire buffer will be
|
||
displayed after the function returns. (Some things it can do:
|
||
sort the names, insert a heading, etc.)
|
||
|
||
If the variable CRL Name Type is nonzero, it should contain
|
||
a string such as "buffer" which fits in the slot:
|
||
"You are entering a <name type> name..."
|
||
It is used in help messages.
|
||
|
||
If the variable CRL Help is nonzero, it is printed
|
||
after the regular help message is given.
|
||
*!
|
||
|
||
[0[1[2[3[4[5[6[7 !* save regs!
|
||
1F[^P CASE !* Ignore case when sorting!
|
||
:I6 !* Read prompt string argument!
|
||
0[8 !* Q8 is nonzero if we are echoing.!
|
||
0[9 !* Q9 is nonzero => type altmode after completed name.!
|
||
q..q[.1 :i*MM_[.2 !* Q.1 and Q.2 for normal case of MM-command completion --!
|
||
!* use standard symbol table and "MM " prefix to select!
|
||
!* only the MM-variables.!
|
||
|
||
0[.0 !* Q.0 contains whether and how to allow non-matches.!
|
||
&20."n 2fo..Q CRL_Non-match_Methodu.0
|
||
q.0&8 "n q.0&777777777775.u.0 ''
|
||
|
||
&2"n qCRL_Listu.1 !* Q.1 has the symbol table to complete over.!
|
||
0fo..qCRL_Prefixu.2 !* Q.2 has the prefix string -- only variables starting!
|
||
q.2"e :i.2'' !* with that are considered, and the returned name does!
|
||
!* not include the prefix string.!
|
||
|
||
0[.3 !* Q.3 = number of chars not to erase & reprint!
|
||
!* when completion occurs (already complete & verified)!
|
||
0[.4 !* Number of chars of name printed.!
|
||
0f[HelpMacro !* Help character should be seen be FI!
|
||
f[BBind fq()"g g()' !* Make temp buffer to accumulate command name in.!
|
||
q..ou5
|
||
o Read
|
||
|
||
!Redisp!
|
||
1u8
|
||
:i*CfsEchoDis !* Clear echo area!
|
||
fs rgetty"e @ft
|
||
'
|
||
@ft6 @ht !* Retype prompt string and input!
|
||
zu.4
|
||
o Read
|
||
|
||
!BarfCR! !* Here if cannot complete and user!
|
||
!* typed CR!
|
||
fg !* Type bell.!
|
||
fs rgetty"n @ft_' !* Force cursor back to echo area on ITS.!
|
||
q8"n @ft' !* type altmode to inform user!
|
||
Q.0&8 "N !* if 8-bit of CRL Non-Match Method is set!
|
||
:FI-î "E FIW !* and user types another CR,!
|
||
q8 "N @FT
|
||
'
|
||
q8+6,(hx*) '' !* returns with what user typed!
|
||
o Redisp !* otherwise flush altmode!
|
||
|
||
!Barf! !* Here if tried to complete and no match!
|
||
fg !* and that is not allowed. Type bell.!
|
||
fs rgetty"n @ft_' !* Force cursor back to echo area on ITS.!
|
||
o Read
|
||
|
||
!Changed! !* Come here when completion augments the string.!
|
||
q8"n !* If we have started printing,!
|
||
fs rgetty"n
|
||
q.4-q.3< :i*X fs echo dis > !* Reprint any chars that weren'r verified!
|
||
q.3,z@t' !* and print new ones.!
|
||
"# q.4,z@t' !* On printing tty, just print new ones.!
|
||
zu.4'
|
||
zu.3 !* All chars we have are verified, even if not printed.!
|
||
!* If name is fully complete, think about exiting.!
|
||
q9"n &4"n !* If pre-comma arg has the 4 bit, return completed name.!
|
||
q8,q3'
|
||
q8"n @ft 0u9 !* If waiting for CR with completed string, type an!
|
||
:fi-13"n o Redisp''' !* altmode, but if next char isn't cr, flush the Alt.!
|
||
!Read!
|
||
q8"e 0:"e o Redisp''
|
||
@:fiu0 q0-4110."e oHELP' !* Handle HELP!
|
||
q0-(200.+î) "e fiw !* Handle C-CR!
|
||
q.0&8 "n !* return immediately!
|
||
q8 "n @FT !* echo return!
|
||
'
|
||
q8+4,(HX*)''
|
||
fiu0
|
||
q0-32"e ."e o Read'' !* Ignore initial spaces.!
|
||
q0fŠ_? "l !* Not a special character!
|
||
q0-
|
||
"e Q.0&4 "n !* LF typed so return immediately!
|
||
q8+4,(HX*) ''
|
||
q0-"e fiu0' !* quotes the next character!
|
||
q0i !* Add char to buffer.!
|
||
q8"n fs^RMode"n -1 |