mirror of
https://github.com/PDP-10/its.git
synced 2026-02-14 20:06:27 +00:00
148 lines
5.3 KiB
Groff
Executable File
148 lines
5.3 KiB
Groff
Executable File
!* -*-TECO-*- *!
|
||
|
||
!~Filename~:! !Lisp Utilities!
|
||
LSPUTL
|
||
|
||
!Find Pat:! !C Searches for an sexpression containing some character sequences.
|
||
Supply a sequence of string args and a numeric arg, e.g.,
|
||
C-U 1 M-X Find PatFOOBAR1BAR2<cr>.
|
||
Searches for FOO. At each occurrence of FOO,
|
||
if the list up <numeric arg> levels of list structure from the FOO
|
||
also contains the other string args (BAR1 and BAR2 in this example),
|
||
moves point there and queries:
|
||
|
||
Altmode or Period stops
|
||
C-L Refreshes
|
||
C-R Enters a recursive edit
|
||
Space and Rubout resume searching for another such sexpression
|
||
Everything else stops search and is reread as a command.!
|
||
|
||
[A[Z[Q[J[S[T[R[N[0[1
|
||
|
||
10 F[ % CENTER !* Puts start of sexprs found near screen top!
|
||
|
||
[..J :I..J Find_Pat
|
||
|
||
:IA !* Read first string arg into A!
|
||
|
||
!* Build (and place in QT) a string of!
|
||
!* the form 1:<QJ,QZFBpat2$QJ,QZFBpat3$...>!
|
||
!* (QJ will hold the start and QZ the end of the sexpression!
|
||
!* under consideration.)!
|
||
!* When executed, QT will return 0 iff one of the searches fail!
|
||
|
||
:IT >
|
||
|
||
!READ! !* Loop to read args!
|
||
:IR !* Get next string arg!
|
||
FQR"N :IT QJ,QZFBRT OREAD'
|
||
!* If not empty, splice it in and loop!
|
||
:IT 1:<T !* Close it off!
|
||
|
||
!TOP! !* Loop to find sexpressions!
|
||
|
||
|
||
:SA"E ' !* Find first string or quit!
|
||
|
||
FKC !* Move to start of string!
|
||
.+1UN !* Setup position for next try in N!
|
||
-FU UQ UJ !* Write sexp start into J!
|
||
!* Q is ignored!
|
||
FU UZ !* Write sexp end into Z!
|
||
MT"N !* Macro the search command!
|
||
QNJ !* Start over if it fails!
|
||
OTOP'
|
||
|
||
QJJ !* We have a candidate sexpression!
|
||
|
||
!* Show the buffer with point at J, then query!
|
||
|
||
!CHAR! !* Character reading loop!
|
||
2,M.I @:FIU1 FIU0 !* Get character from tty in two ways!
|
||
Q0-"E ' !* Altmode or Period stops!
|
||
q0-."E '
|
||
Q0-"E 0 OCHAR' !* ^R enters a recursive edit!
|
||
Q0-12"E F+ OCHAR' !* ^L refreshes the screen!
|
||
q0-32"E QZ,QN F |