-
Notifications
You must be signed in to change notification settings - Fork 84
/
tecord.1132
executable file
·5253 lines (4584 loc) · 220 KB
/
tecord.1132
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
LIST OF TECO COMMANDS, TECO VERSION 1132
Last updated 5 August 1981. Z=230457
(Note that a caret followed immediately by another character
signifies a control character, except inside FS flag names, where
that is not necessary because control characters are not allowed.)
^@:
<n>^@ for nonnegative <n>, is the same as ".,.+<n>".
For negative <n>, is the same as ".+<n>,.".
"10^@XA" puts the 10 characters after the pointer
in a string in qreg A.
<n>,0^@ returns -<n>; this is often useful.
<m>,<n>*0^@ returns -<m>; it undoes the ",<n>".
In other words, it extracts the first of two args.
If you want <m> instead of -<m>, use another ,0^@.
<m>,<n>^@
returns the value <n>-<m>.
<m>,<n>:^@
returns <n>,<m>.
^A inclusive-or (an arithmetic operator).
^A may be used in a file specification as the first or
the second filename to stand for the default first name.
^B is a command for cleaning up after failing searches.
If the last search was successful, ^B does nothing.
If the last search failed, ^B moves to the end of the
range searched if it was a forward search; to the beginning,
if it was a backward search. :^B does the same thing for
failing searches but does FKC after successful ones.
Note: ^B inside search string is a
special char which is matched by any
delimiter character. The set of delimiter chars is
specified by the contents of q-reg ..D; initially, the
delimiter characters are precisely the non-squoze
characters (that is, all except letters, digits, ".",
"%" and "$").
^B may be used in a file specification as the first
or second file name to stand for the default second name.
^C when typed in from console, terminates the
command string, and starts execution. If
the command executes without error, TECO
returns to its superior without flushing the type-in
buffer. When proceded, it will automatically
redisplay the buffer on display consoles.
When TECO returns, AC 2 will contain
the address of the 7-word "buffer block" describing the current
buffer - see the section "buffer block" at the end.
To type in a ^C in a TECO command string, use ^]^Q^C,
which is specially arranged to inhibit the normal
action of ^C at command string read-in time.
A ^C encountered as a command is an error.
^F inserts its string argument, after deleting the last
thing found with an S search or inserted with I or \
(won't work if pointer has moved since the S, I or \
was done). Precisely, ^F is the same as FKDI.
^G causes a "quit" by setting FS QUIT to nonzero.
The consequences of that depend on the value
FS NOQUIT. Normally, FS NOQUIT is 0; ^G will then
stop whatever TECO is doing and return to its top-level
loop, or to the innermost ^R invocation if any, to
read more commands (but first TECO will
redisplay the buffer). In particular, it will cancel a
partially typed-in command string.
All unread input except the ^G itself is flushed.
On printing terminals, output is also discarded.
(If FS NOQUIT is -2 or less, this is inhibited).
If FS NOQUIT is positive,
^G still sets FS QUIT but that has no effect. Thus,
a program can inhibit quitting temporarily, or quit
in its own manner by testing FS QUIT itself.
If FS NOQUIT is negative, setting FS QUIT nonzero
causes an ordinary error (whose error code is "QIT"),
which may be caught by an errset (:< - >). If FS NOQUIT
is less than -1, then in addition the input and output
on the terminal are not discarded.
^H backspace; it is illegal as a command.
^I tab; in bare TECO, it is a self-inserting character.
In EMACS, or whenever FS ^I DISABLE is appropriately set,
it is equivalent to a space. In bare TECO, it inserts itself
as well as the following string argument, so that Tab is
equivalent to I Tab. This was intended to be typed by the
user himself; using it in a macro is foolish.
Tab characters in the buffer or in typeout are displayed
using tab stops at a spacing controlled by FS Tab Width.
^J line feed; flushes current value.
^K<string>
valrets a string argument to DDT with
dollar signs replaced by altmodes.
(To cause a dollar sign to be valretted, use
"^]^Q$" (ctl-close ctl-Q dollar)).
If the command string contains an P
command, TECO command execution will
continue with the character after the
altmode ending the text string of the ^K.
^K causes TECO to believe that the screen has
been clobbered, so it will automatically clear the
screen and redisplay everything at the next
opportunity. To avoid this, use "@^K" (if for
example you know DDT will not type anything out,
and will P the TECO).
When TECO executes the .VALUE, AC 2 will contain
the address of the 7-word "buffer block" describing the
current buffer - see the section "buffer block" at the end.
^L form feed; clears screen on displays (when executed,
not when typed). See F+ for more details.
^M carriage return; flushes current value.
If FS STEP MACRO is a string, it is executed (if there is a
^J after the ^M, it is skipped over first). If FS STEP MACRO
is a nonzero number, ^M does these things designed to
step through the program a line at a time:
it displays the buffer unless there was typeout recently,
then reads in a character and acts according to it.
Most characters simply tell ^M to return so that more
commands will be executed. However, there are the
following special characters:
^F quit. Like ^G, but ignores the setting
of FS NOQUIT and does a real quit.
^P end stepping. Zeroes FS STEP MACRO and then
proceeds without stepping.
^R enter ^R mode. On return from ^R,
another character will be read and decoded.
^N:
<n>^N sets the FS LINES flag to <n>. Like "<n>FS LINES".
FS LINES controls the number of lines used for buffer
display and, on display terminals, for all other output.
:^N complements the FS TTMODE flag (initially 0).
TECO normally displays the buffer on printing terminals
only if this flag is set. User buffer display macros
should exhibit similar behavior.
:<n>^N like "<n>^N :^N"
Note: ^N in a search string is a special char which is
matched by any char other than the char after
the ^N in the search string.
^O<filename>
bigprints <filename> on the device open for output.
Note: ^O in a search string is a special character
signifying "OR" i.e., it divides the search string into
two strings either of which will satisfy the search.
Thus, SFOO^OBAR will find either FOO or BAR, whichever is
encountered first.
^P alphabetic (ASCII) or numeric sort command.
The entire buffer, or the part within the virtual boundaries,
is sorted, after being divided into sort records
(i.e., things to be sorted) on the basis of the arguments
given to the command in the form of
three TECO command strings following
the ^P, separated by altmodes
(Notes: (1) two successive null args
will result in a premature end of
command input, so use spaces where
needed; (2) a dollar sign in any
arg will be replaced by an altmode;
(3) the three args will be left in q-regs ..0, ..1, ..2).
The three expressions are used to divide the buffer into sort
records, each of which has a sort key.
A sort key may be any substring of the record, or it may
be a number. The records and keys are found as follows:
1. The pointer is moved to the
beginning of the buffer, which is the
beginning of the first sort record.
2. The first command string is executed.
If the key is to be a substring of the record,
this command string should leave point at the
beginning of the key. If the key is to be a number,
it does not matter what this command string does.
3. The second command string is executed.
If this command string returns a value, that value is the key.
Otherwise, this command string should leave point at the end
of the key.
4. The last command string is executed.
This should move the pointer to the end of the sort record,
which is also the beginning of the next record.
5. If step 3 or 4 leaves the pointer
at the end of the buffer, the creation of sort
records is complete, and the sort
takes place. Otherwise, go back
to step 2.
Sort records and keys may be variable length.
No character (i.e., a shorter key) sorts before ^@,
and keys are considered left-justified for the comparison.
Numeric keys are always "less" than any string keys.
Failing search commands are not errors while scanning for sort
records, unless the FS S ERROR flag is nonzero. It is
recommended that this flag be set, since code is easier to
debug if all searches which are supposed to be allowed to fail
have an explicit colon.
There is nothing to prevent overlapping records
from being specified; the sort will copy each record
so the overlap region will be duplicated.
Insertion and deletion are allowed but know that
TECO remembers the boundaries of records and keys as character
numbers, so deleting chars from a record already delimited
will shift chars from the next record into it, etc.
The sort is stable. :^P sorts in reverse order.
If FS ^P CASE is nonzero, ^P ignores case; that is,
it sorts lowercase letters as if they were the
corresponding uppercase letters.
^Q ^Q in a search string causes
the next char to be quoted, i.e.,
it is treated as an ordinary char
even if it normally has a special
meaning ("^Q^Q" is a normal ^Q;
^Q works only at execution time, not at command string
read-in time, so rubout cannot be ^Q'd).
This also works inside file name specifications.
^R MODE
^R real time edit feature, intended mainly for display terminals.
The position of the pointer is represented by the terminal's
hardware cursor, rather than by any printed characters (^R
ignores the contents of ..A, except on printing terminals).
All non-control-non-rubout characters
are normally self inserting; the others are normally
editing commands. The user may redefine any character
by means of the FS ^RCMAC flag.
In ^R mode echoing is turned off, so typed-in characters
manifest themselves only by their effect on the displayed
buffer contents (but see FS ^R ECHO).
Any command may be given a numeric argument, which most
commands (including all characters that insert themselves)
treat as a repetition count. If no argument is specified,
1 is the default, but commands can distinguish between
an explicit 1 and a defaulted 1. The argument is computed as
follows: <arg> = <basic arg> * (4 ** <exponent-of-4>)
where <basic arg> is the explicit argument, if any, or
1 otherwise. An explicit argument is given with ^V or
by control-digits. <expt-of-4> is initially 0
and incremented by ^U. All commands except argument-setting
commands discard their arguments even if they don't use
the arguments. Three flags contain the argument data:
FS ^R ARG contains the explicit argument, if any, else 0;
FS ^R EXPT contains the exponent of 4;
FS ^R ARGP, if zero, indicates that no arg has been
specified (neither the explicit arg nor the exponent of 4);
if 1, indicates that only an exponent of 4 has been
specified, and the basic arg is still 1;
if 3, indicates that an explicit arg has been specified.
The 4 bit, if set, indicates that the argument should
be negated (Control-Minus sets this bit)
All three are zeroed after any command that doesn't identify
itself as an argument setting command by clearing FS ^R LAST.
Any character may have a
program associated with it, using the FS ^RCMACRO command.
If that is done, when that character is typed, TECO
will execute the program instead of inserting the char
or using it as a built-in command. The definition of a
character may also be treated as a q-register in the
"Q", "U", "X", "G", "[", "]", "M" and "FQ" commands;
see "Q" for directions. When the program is executed,
q-reg ..0 will contain the character being handled.
When errors take place inside ^R, or in macros called
from ^R, after printing the error message TECO returns
control to the innermost invocation of ^R (unless
FS *RSET or ..P is nonzero). The same thing happens
for quits. See ..P.
One may wish to have
a mode in which most editing commands are disabled, and
most characters that are normally editing commands are
self-inserting instead. The FS ^RSUPPRESS flag, when
nonzero, suppresses all built-in commands except rubout
and all user defined commands whose definitions do not
begin with "W" (since "W" at the beginning of a macro
is a no-op, the only reason to have one there is to
prevent suppression). When a character is suppressed
as a command, it becomes self-inserting. An additional
feature is the FS CTL MTA flag; when it is negative,
all control-meta-letters (and ctl-meta-[, ], \, ^ and _)
have their definitions suppressed; this mode is useful
when editing TECO commands.
In "replace mode", printing characters overlay a
character instead of making the line longer.
Replace mode is controlled by FS ^R REPLACE, which
see for more details. A more general facility for changing
what ALL printing characters do is FS ^R NORMAL. If this is
nonzero, it counts as the definition of all "normal"
characters. That is, the definition which all printing
characters initially have says to do whatever FS ^R NORMAL
directs, and otherwise (if it is 0) insert or replace.
You can redefine all "normal" characters whose Lisp syntax in
..D is ")" by putting a function in FS ^R PAREN. This
function will be executed IN ADDITION to the actions for
handling all "normal" characters. This is good for something
to point out the location of the matching open-parenthesis.
Normal characters which you don't redefine in one of those
ways will sometimes be subject to system echoing, when that is
implemented. This improves efficiency so it is done whenever
it is safe. Characters which have been redefined and thus
made not normal cannot be echoed by the system. If you
redefine what "normal" means by making FS ^R NORMAL nonzero,
system echoing will be turned off entirely. Sometimes Space
is redefined with a definition which never does anything but
insert a space unless the horizontal position is beyond a
certain point (at which point it will typically break the
line). Then it is desirable to enable spaces to be echoed
when the cursor has not reached that column. This can be done
by means of the FS ^R EC SD flag. Set it to the definition
which Space has in that case, and set FS ADLINE to the column
up to which it is safe to echo Space. Then, when Space
actually has that definition, the system will be told to echo
spaces but only up to that column.
By setting FS ^R INHIBIT nonzero, you inhibit display
updating. But ^R still remembers what is necessary,
and as soon as FS ^R INHIBIT is zero again the
updating will be done.
Conversely, you may wish to inhibit the feature which causes
redisplay to be suspended when input is available. Setting FS
D FORCE nonzero does this.
The ^R-mode input dispatch table is actually indexed by
9-bit TV character code. Each 9-bit code can be redefined.
The list of ^R-mode initial definitions that follows
refers to the characters obtainable on non-TV's - in other
words, the 9-bit characters which are the results of
reading in the 14-bit codes 0000 through 0177, which are
precisely the 9-bit characters which are equivalent to
some 7-bit ASCII character.
A subsystem which is not TV oriented need not worry about
the 9-bit character set; by using FI, and FS ^RCMACRO
always without the atsign modifier, it can handle ASCII
characters throughout. TECO will automatically do the
conversion to and from 9-bit characters on TV's.
For those who wish to handle the 9-bit character set,
the definitions of all 9-bit characters
are listed in the section "TECO's character sets",
along with the appropriate conversions between character
sets.
One may wish to have some operation (such as filing
the buffer away) performed every so often while in ^R
mode. See "..F" for how to do this using the
"secretary macro" feature. FS ^R DISPLAY can be set
to a macro which will be run every time ^R is about
to do nontrivial redisplay.
Although ^R mode is intended for display terminals,
the creation of large macro-systems intended for use
with ^R mode has made it necessary for ^R to work
at least marginally on printing terminals.
Since the physical cursor is not suitable, the ordinary
TECO cursor is used (whatever is in ..A). The buffer
is displayed only when the screen is "cleared", such as by
giving the built-in ^L command.
Also, unless FS ^RECHO > 0, characters actually read
by the ^R-mode command loop are typed out, although
echoing is still turned off.
This echoing can be made to happen even on displays
by making FS ^RECHO negative (this is unwise to do
if there is no echo area).
Setting FS ^R SCAN to nonzero causes ^R commands to
try to imitate printing terminal line editors by
echoing the characters that they insert/delete/move over.
In this case, FS ^R ECHO should be set to 1.
FS ^R MAX is the maximum size deletion or insertion
which ^R will try to print in the fancy way.
If you define FS ^R TTM1, it gets to try to handle any
redisplay ^R does not have a way of handling. See its
definition.
Note that ^R recognizes insertion, deletion, and cursor
motion from the values returned by the user's command
definitions - see the following paragraph.
Macros and ^R - reducing redisplay:
Whenever control passes from normal TECO to ^R
(that is, when a ^R is executed, when a @V is executed
within a ^R-mode macro, or when a ^R-mode macro returns),
^R must be able to update the screen according
to the changes that have been made in the buffer
since the last time ^R mode lost control. ^R can
do that in a way that makes no assumptions, but
that way is slow. If information is still available on
what areas of the buffer were changed, that info
can be passed to ^R in the form of numeric args,
and ^R will save time by assuming the info to be
correct. If the info is not correct, the screen
will not be properly updated. The options are:
no args - the usual case - means assume nothing.
One arg means that the buffer has not changed,
although the pointer may have moved. The actual
value of the arg does not matter in this case.
Two args should specify a range of the buffer
outside of which nothing was changed. ^R will
limit redisplay to that range if possible.
^R also knows what to do about macros that type text
out; if Q..H is nonzero when ^R is entered or
returned to, ^R will not do any displaying until it
has read one character (and executed it, unless it
is a space). If the selected buffer when you return to ^R is
not the same one that was selected when ^R was previously in
control, then it doesn't matter what args you give.
If you like ^R mode, try:
:I..G EL 90^S ^R :I..B Q..H"N 90^S ' ^R
The commands are:
Control-Minus
negates the argument of the next command.
Control-digits
accumulate a numeric argument for the next
command. Thus, control-5 ^N will move down
five lines.
^A go to beginning of current line (0L).
With argument, <arg>-1 L.
^B go back over previous character (R)
^C complements the state of the comment mode switch.
Types "C" for comment or "T" for text at the bottom
of the screen, to say what mode you're in.
When in comment mode, the ^N and ^P
commands begin by going to the end of the line and
if the last character is a semicolon,
deleting it and any preceding tabs.
Then, after moving to the next or previous line,
if the line has a semicolon in it the pointer
will be left after the semicolon; otherwise
the pointer will move to the end of line,
and enough tabs will be inserted to move
the pointer at least to the specified comment column,
followed by a semicolon.
Numeric argument is ignored.
^D deletes the next character after . (D)
If FS RUBCRLF is nonzero, ^D before CRLF deletes
both the CR and the LF.
^E moves to end of line (:L). With argument, <arg>:L.
^F goes forward over the next character (C)
^G flushes any numeric argument or case-shift,
unsets the mark if it had been set,
and resets the case-lock.
When ^R is actually in control (as opposed to a
macro running inside ^R), ^G's quitting action
is suppressed, and ^G acts as a command instead.
Thus, it does not flush any type-in.
^H (backspace) inserts itself.
^J (linefeed) inserts itself.
^K kills to eol (K). With arg, <arg>K.
The text deleted is put in q-reg ..K.
^L redisplays the screen (used to recover from
datapoint lossage). Chooses a new window.
A numeric argument specifies the number of lines
of buffer to display - useful on printing terminals.
On displays, if only a part of the screen is being
used at the moment, only that part is cleared.
^M inserts a carrage return-line feed.
^N goes to next line (L). With argument, <arg>L.
^O inserts a CRLF, then backs over it.
"^Ofoo" is equivalent to "foo^M" but
often requires less redisplay.
With argument, inserts <arg> CRLFs
and backs over the last.
If you want to insert several lines in the
middle of a page, try doing ^U^U^O before
and ^U^U^K afterward.
^P goes to previous line (-L). More generally, -<arg>L.
^Q inserts the folling character directly,
regardless of its meaning as a command.
If the char isn't already in the input buffer,
^Q will prompt with a "Q" at the bottom of the screen.
An argument to ^Q causes it to insert the same
character <arg> times. ^Q is not affected by
replace mode; the quoted character is always
inserted.
^R causes the column the pointer is at to become
the comment column. Argument is ignored.
^S reads a character and searches for it.
"^SA" in ^R mode is the like "SA" in TECO.
^T sets the ^R-mode mark at the current pointer
position. The mark is really the value of
FS ^RMARK and is used by the ^X and ^W commands
in ^R mode. If FS ^R MARK holds -1 there is no
mark; that is the case initially and after any
insertion, deletion or quit in ^R mode.
Attempting to use the mark when there is none
rings the bell.
^U increments the exponent-of-4 for the next command.
This usually is the same as repeating it 4 times.
Does not use any previous argument, but leaves
it around for the next command.
^V sets the basic arg for the next command.
The argument is composed of digits optionally
preceded by a minus sign, echoed at the bottom
of the screen and turned into a number in the
current radix (FS IBASE). The first non-digit
terminates the arg and is treated as a command.
^G will flush the argument.
^W kills everything between the current pointer
position and the mark, putting the deleted text
in q-reg ..K. If there is no mark, nothing is
deleted and the bell is rung.
^X sets the mark at the current pointer position,
and moves the pointer to where the mark had
been; in other words, exchanges the mark and
the pointer. Does nothing if there is no mark.
Do this several times to see both ends of the
range that a ^W command would delete.
^[ (altmode) terminates edit
^] reads a q-reg name and executes that q-reg
as a macro. The q-reg should contain ordinary
TECO commands, not ^R mode commands. The numeric
arg to the ^] will be given to the macro which
will see it as the value of ^Y (If no argument is
specified, ^Y will be 1, but F^X will indicate that
the macro had no argument). The macro may
return values to ^R telling it which areas of
the buffer may need redisplay (see below).
If the macro is to return values, it should end
with a space - otherwise, the values might get
lost within TECO.
Example: " .,( G..K .) "
gets q-reg ..K and returns 2 values limiting
the range of the buffer in which changes took
place.
^? (rubout) deletes bacwards (-D). If FS RUBCRLF
is nonzero, rubout when the pointer is after a
CRLF deletes the whole CRLF.
ctl-rubout
deletes backwards like rubout, except that tabs
are converted to spaces and the spaces are deleted
one at a time.
^S:
<n>^S if <n> is positive, sleep for <n> 30ths of a
second. If <n> is negative, sleep until system
run time (what FS UPTIME gets) = -<n>.
Note: ^S in a search string is a special character
which should be followed by a Lisp-syntax value
and matches any character whose Lisp syntax in Q..D
matches the specifed syntax value.
For example, ^S( matches any character whose Lisp syntax
is "(".
<n>:^S sleep for at most <n> 30ths of a second, returning
immediately if there is any input available.
Returns the value of FS LISTEN (nonzero if
input is available).
^U display in the user-specified manner the directory of
the current default device. That is, invoke the user's
buffer display macro if any; otherwise on display consoles
display in the standard manner, but do
nothing on printing terminals. These are the same actions
TECO always takes at the end of any command string whose
last command was an E-command.
Note: if ^U is typed as the first character of a command
string, it is executed immediately when read.
^V pops the "ring buffer of the pointer". ^V when the
first character of a command string acts immediately,
resetting the pointer to the value it had before the
last time it was moved. Successive ^V's will undo
earlier changes of the pointer. Up to 8 changes are
remembered to be undone. Motion caused by the use of
^V in this manner does not get saved to be undone.
^V not the first character typed is slightly
different. It pops the ring buffer into the pointer,
and returns as its
value the number that then remains on the top. If that
returned value is put in Q..I (which is what gets
pushed on the ring buffer at the end of the command
string) you can fool TECO's top level into thinking
that the pointer was not moved by the command string
that just finished, so nothing will get pushed back on
the ring buffer (this is exactly what ^V as the first
character typed does). If TECO's top level is not in
use, the program that is running must be hacked up to
push explicitly on the ring buffer (using <n>^V)
in order for anything to appear on it.
If ^V attempts to jump out of the buffer, the pointer
is not moved, but the ring buffer is popped. A "NIB"
error happens.
:^V returns the value on the top of the ring buffer,
without popping it or changing the pointer.
<n>^V is equivalent to <n>FS PUSHPT. It pushes <n> onto
the ring buffer unless <n> equals whatever is at the
top of the ring buffer.
<n>:^V pushes <n> onto the ring buffer unconditionally.
^W pops all the way to top level,
exiting from any break-loops and not running the user
defined error handler in ..P.
^X only defined inside macro. Its value is the
first arg of the M command which called the macro.
See the F^X command for a more sophisticated
way for macros to examine their arguments.
Note: ^X typed as the first character of a command
tells TECO to type out the whole error message
associated with the most recent error. If the flag
FS VERBOSE is zero (normally true on printing terminals)
TECO normally types only the 3-letter code. Use ^X
to see the whole message if you don't recognize the code.
Note: ^X in search string is a
special char which is matched by any
character.
^X may be used in a file specification as the first or
the second filename to stand for the default first name.
^Y like ^X, only second or only arg of the M command.
If ^Y is the first char typed in in a command string,
the most recently typed command string longer
than 7 characters (not counting the 2 altmodes)
is inserted in the buffer. This is a loss
recovery procedure.
^Y may be used in a file specification as the first
or second file name to stand for the default second name.
^Z normally causes an interrupt to DDT when typed.
However, one can be given to TECO by quoting it
with ^_ , in which case it is a normal command:
with no arg, its value is a pseudo-random number.
<n>^Z inserts <n> random letters before the pointer.
Altmode terminates following text argument to
certain commands; two successive altmodes terminate a command
string in the bare TECO command loop, and begin execution of
the commands in the command string.
Execution of an altmode as a command depends on the
setting of FS NOOP ALTMODES. If the flag is >0
(old-fashioned mode), altmode acts like the ^_ command.
If the flag is negative (default mode), altmode is
a no-op. If the flag is zero (losing mode),
altmode is an error as a command.
^\ exits from the innermost macro invocation, unwinding
the q-register pdl to the level it had when the macro
was entered, and popping all iterations that started
inside that macro. Note that if Q..N is popped this
way, it's previous contents (before the pop) will be
macroed (after the pop is done). This enables macros
to arrange arbitrary actions to be performed whenever
the macro is exited, no matter for what reason.
See also FS BACK RETURN.
:^\ exits from the innermost macro invocation, without
unwinding the q-register pdl. It does pop iterations.
^] string substitution
^] is not really a command. It is a special character
that makes it possible to substitute the contents of
a q-reg into the TECO command stream at any point (such as,
inside an I or S command). ^] is processed when
TECO reads a character from the command buffer
(ie. Before anything like insertion or execution
is done to the character.). It gobbles the
next character and decodes it as follows:
^A sets the one-character flag (see below)
then reads another character and
interprets it as if it had been typed
after a ^].
^Q gobbles another character and returns
it to TECO superquoted (i.e. It will
not act as a text terminator, in a
search string, it will have no special
effect, etc.)
^R is the beginning of the name of a q-reg to
be substituted.
^S cause the superquote flag to be turned on
(see below) then read another character as in ^A
^T cause the delimiter flag to be turned off
(see below) then read another character as in ^A
^V followed by a q-register name, causes the char
whose ASCII value is in that q-register as a
number to be substituted in. That is, after
^^AU0, ^]^V0 will substitute an "A".
^X reads a string argument to the M command that
called the current macro, and substitutes it in.
^]^X pushes the current command buffer onto a
special pdl, then causes the normal macro pdl
to be popped one level (the macro pdl is
pushed onto each time an M command is executed.
It is also pushed onto by ^]<q-reg name> (see below)).
TECO will then proceed normally, reading from
what is essentially a string argument to the
current macro, until an altmode is encountered.
This altmode will not be passed to TECO, but will
instead cause the command buffer to be repushed
on the macro pdl and the special pdl to be
popped, thus restoring the state of the world.
If a real altmode is desired in a string
argument, ^]$ (dollar sign) should be used.
If TECO had been in any state other than reading
commands (i.e. Reading a string to be inserted)
then the characters read in the string argument
will be protected from being taken as text delimiters.
Thus I^]^X is guaranteed not to terminate somewhere
in the macro argument. If this is for some reason
undesirable, a ^T (see above) should be used between
the ^] and the ^X (^]^T^X). Characters are
not normally protected from being interpreted
specially in searches, etc. If this is desired,
use ^S (eg. ER^]^S^X bar will cause the file
<macro argument> bar to be selected for read,
even if the macro argument has spaces,
semicolons, etc. in it.).
If the one character flag had been on
only one character will be read as an argument
instead of an entire string.
^Y acts like ^]^X, but only one character is taken
from the previous command level. Has the same
effect as ^]^A^X. Additional ^] calls will be
chained through, with the final character com-
ming from the last command level not indirected.
(altmode) pass a superquoted altmode
back to TECO (same as ^]^Q )
^] pass an actual ^] to TECO
" pass a superquoted doublequote back to TECO.
$ (dollarsign) pass an ordinary
altmode back to TECO (see ^X above)
. is the beginning of a q-reg name.
Multi-character q-regs such as Q..A can be substituted
with ^] just like single-character q-regs.
0-9 the current command stream (executing macro) is saved
and TECO begins reading command characters from the
contents of the specifed q-register 0-9. After all of
the characters in that q-register, which must contain
a string or buffer, have been read, reading of the
macro which contained the ^] itself will resume.
Delimiter protection and superquoting are handled as
for ^]^X. For example, I^]1 is equivalent to G1
(Note: G1 is optimized to be much faster than I^]1),
because any altmodes in the string in q-register 1 will
be delimiter protected so that they do not terminate
the I command. S^]1 will search for whatever string
is in Q-register 1. Altmodes in the string will not
end it, but ^B, ^N, ^O, etc. will have their normal
special functions. S^]^S1 superquotes the string and
makes even those characters behave like ordinary ones.
The contents of the q-register are saved so that
storing into the q-register while they are being read
does no harm.
@ @ ("indirect") causes the characters substituted in
by the ^] to be treated as if they in turn had a ^]
in front of them. Thus, after :IA.B, ^]@A will
substitute q-reg .B. After :IA.Bfoo, ^]@A will
substitute the contents of .B, followed by "foo".
I may change that if I can see an easy way.
A-Z like 0-9 (insert q-reg)
^^<char>
(ctl caret) has the value of the 7-bit ASCII
code for <char>.
^_ (note that in order to type this character to a
program, it must be typed twice, due to ITS hackery)
ends execution of the command string "successfully";
the TECO will log out if disowned, or return to its
superior if a ^C ended the typed-in command string.
Otherwise, or after TECO is P'd, TECO will reset all
stacks (if FS *RSET is 0), then maybe display the
buffer or dircetory (using the user's supplied macros
in Q..B and Q..G if any), and go on to read another
command string.
It is not wise to use this as a nonlocal exit from
a macro; that is what F< is for. The main use is
to restart TECO's command reading loop at the current
stack levels - useful when a user-defined error handler
wants to transfer to a TECO break loop. TECO's command
loop puts a ^_ at the end of every command string to
make sure that it gets control back when the command
string terminates. Otherwise, in a break loop, control
would return right back to the suspended program.
(Space)
Spaces around arithmetic operators are ignored.
Spaces between two values in lieu of an arithmetic
operator count as a "+", except that spaces by themselves
before a command that can use an argument do not count
as an argument.
!<label>! defines <label> for use by
O command (q.v.).
This contruct is also the standard way of putting
comments in TECO macros. It is ignored in execution.
However, quotes and angle brackets inside the label
are counted when quotes are being balanced in a conditional or
angle brackets in an iteration. This is useful, because if
the commands in a conditional need to have unmatched quotes
you can put in matching quotes inside a label to make the
whole thing balance. The same is true for unmatched brackets
in an iteration. For example:
Q1"N !"! FTYou're losing' or < Q1; EDFOO < !>! >
" starts a conditional. The character after the " gives
the condition. It is followed by conditionalized
commands, up to a matching '. If an else-clause is
desired, the ' should be followed immediately by "#,
with perhaps CRLFs, spaces, or comments (see "!") in between,
followed by the contents of the else-clause, followed by
another '. A conditional may return a value.
The conditionalized commands must be balanced as to quotes.
If some commands contain unmatched quotes, place extra quotes
inside a label (see "!") to balance them out.
The argument to the conditional is normally gobbled up by
the conditional, and the first conditionalized command
receives no argument; see F" for a variant conditional
that passes the argument along instead.
FS STEPMAC will be processed on entry to a successful
conditional.
The conditions that now exist are:
Char: Condition succeeds if numeric arg to " is
A the ASCII code for an alphabetic character.
B the ASCII code for a delimiter character
C the ASCII code for a non-delimiter character.
D the ASCII code for a digit.
E zero.
G positive.
L negative.
N nonzero.
U the ASCII code for an "upper-case" character
(anything other than 140 through 176 octal).
Any condition can be reversed with a ":"; 0:"E fails.
The delimiter characters are those characters which
are specified as delimiters by the contents of q-reg
..D. Initially, q-reg ..D is set up to specify that all
non-squoze characters are delimiters, but the user can
change that by setting q-reg ..D.
Squoze characters are letters, digits, ".", "%" and "$".
Conditionals operate by skipping the text up to the
matching ' if they fail, and doing nothing if they
succeed. If the ' terminating a failing conditional is
followed by "#, they will be skipped as well. If the
conditional succeeded, they would be executed - and "#
is really a conditional that always fails.
A special kind of conditional that returns a success or
failure code can be obtained by putting a ' after the ",
as in "'E. This kind of conditional does not skip any code.
Instead, it just returns -1 for "success" and 0 for "failure".
Such conditionals are useful because it is easy to and or
or them together and then test the result.
For example, an expression whose value is the signum of
the number in q-reg 0 is: Q0"'L-(Q0"'G)
# exclusive or (an arithmetic operator).
$ (dollar sign) the old lower-case edit mode:
"-1$" is the same as "-1F$/" (first dollar, then altmode)
"0$" is the same as "0F$" (first dollar, then altmode).
"1$" is the same as "1F$". For more info, see the
"F$" command (that's dollarsign, not altmode).
%<q> increments the number in q-reg <q> by 1,
and returns the result as a numeric value.
Meaningless if the q-reg contains text.
& logical and (an arithmetic operator)
' terminates a conditional (see ").
This character is actually a no-op when executed.
It is for the " to search for if the condition fails.
(,) fill usual role of parentheses in arithmetic calculations.
However, they are more general in that not merely arithmetic
operations but arbitrary commands can be enclosed within them.
The value within the parentheses is simply the value returned
by the last command before the close. If the open was
preceded by an arithmetic operator, arithmetic is immediately
done on that value. Otherwise, the close merges the values
from inside the parentheses with the values saved by the open.
Thus, 1,(2) and 2(1,) are both equivalent to 1,2.
The colon and atsign modifier flags are also merged in that
the open saves them and clears them, and the close restores
and merges them: they will be on after the close if either
they were on before the close or they were on after the open.
Parentheses can also be used where a q-register name is called
for; the value returned by the last command before the close is
used as the "contents" of the q-register. This construct is
allowed only with commands that only examine the q-register,
not with commands that store into it (since there is no place
to store into). See the Q command for this.
See also F( and F) for variants of these commands.
* multiplication (an arithmetic operator).
Note that in TECO there is no operator precedence.
Evaluation of arithmetic operators is left-to-right.
+ addition (an arithmetic operator).
, separates arguments for commands taking two numeric arguments.
Doesn't affect the colon and atsign flags.
- subtraction (an arithmetic operator).
. equals the number of chars to left of the pointer.
..n Q-registers
..0,..1,..2
"^P" sort puts its 3 arguments into these q-regs.
These q-regs are also used by "F^A".
..A holds the string to be used to represent the cursor
in standard buffer display. Initially "/\" on displays,
"^A^B" on Imlacs (looks like an I-beam), and
"-!-" on printing terminals (of course, TECO's default is
not to display the buffer on printing terminals unless
FS TTMODE is set).
In the cursor, backspaces always really backspace
and all other control characters are treated as non-spacing
characters.
..B holds the user buffer display macro.
After each command string whose last command was not
an E-command, TECO does "normal buffer display", as follows:
if ..B is 0, as it initially is, the default is:
on graphics devices, do "standard buffer display";
on printing terminals, do so only if FS TTMODE is set;
otherwise do nothing. For details of standard buffer
display, see "@V".
If q-reg ..B is nonzero, TECO simply macroes it. Normal
buffer display in this case consists of whatever that
macro happens to do.
Q-reg ..H and flags FS ERRFLG and FS ERROR will contain
information about the command string that just ended.
If either Q..H or FS ERRFLG is nonzero, there is text
on the screen that should not be immediately covered over.
The buffer display macro should check ..H and not display
if it is nonzero. FS ERRFLG need not be checked, since
if -1, it will automatically cause all