/
itstty.41
executable file
·3574 lines (3096 loc) · 154 KB
/
itstty.41
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
-*-TEXT-*-
Copyright (c) 1999 Massachusetts Institute of Technology
See the COPYING file at the top-level directory of this project.
------------------------------
File: ITSTTY Node: Top Next: A Up: (DIR)
This file describes just about all there is to know about using and
programming TTYs (abbreviation for "Teletypes", for which read "consoles")
on the ITS operating system.
* Menu:
* Special: A Characters specially interpreted when typed on the tty.
* Control: B "Control of the tty".
* Opening: C Opening tty channels.
* Input: D Input from terminals.
* Output: E Output to terminals.
* More: F **MORE** processing.
* Vars: G Per-tty/per-job variables.
* Perm: H Permanent and semipermanent tty information.
* STYs: I Pseudo-teletypes (STYs).
* Smart: J The intelligent terminal protocol.
* SofTTYs: K Software ttys and ITS output buffer codes.
This is the complete table of contents for this file:
A. CHARACTERS SPECIALLY INTERPRETED WHEN TYPED ON THE TTY.
1. INTERRUPTING THE PROGRAM - THE CALL FUNCTION.
a. Deferred CALL.
2. ENTERING STRANGE CHARACTERS - THE ESCAPE FUNCTION.
a. Quoting the Characters Used for CALL and ESCAPE.
b. "^_<number>".
c. Supplying Meta-Bits on Non-TV's.
3. MODE SETTING USING ESCAPE.
a. "^_M" - Complement **MORE** Processing (%TSMOR).
b. "^_^" - Complement Scroll-mode (%TSROL).
c. "^_""" - Complement Use of SAIL Character Set (%TSSAI).
d. "^_U" - Complement conversion to upper case (%TOCLC)
4. COMMUNICATE MODE.
a. Entering a Com Link.
b. Querying.
c. Leaving a Com Link.
d. When the System Prints "^_N".
e. Input and Output Overrides.
f. Slaving Another Terminal.
g. Telling the System How to Respond to "^_C" Requests.
5. LIST OF ESCAPE CODES.
B. "CONTROL OF THE TTY".
1. WHAT DETERMINES WHO HAS THE TTY.
2. .ATTY AND .DTTY.
3. PERMISSION TO TYPE OUT.
4. THE .TTY VARIABLE.
5. THE .CNSL VARIABLE.
C. OPENING TTY CHANNELS.
1. OPENING "TTY".
2. OPENING "Tnm".
3. DEVICE-DEPENDENT BITS IN THE OPEN MODE.
a. Per-channel Bits.
b. Other Per-channel Bits on Input.
c. Other Per-channel Bits on Output.
d. First-time Bits on Output.
e. First-time Bits on Input.
D. INPUT FROM TERMINALS.
1. ECHO.
2. MAIN-PROGRAM INPUT.
3. ACTIVATION.
4. INPUT INTERRUPTS.
5. THROWING AWAY TYPE-IN.
6. TESTING FOR THE AVAILABILITY OF INPUT.
7. .STATUS ON TTY INPUT CHANNELS.
8. THE CHARACTER SET
E. OUTPUT TO TERMINALS.
1. HOW TO CAUSE CHARACTERS TO BE OUTPUT.
2. NORMAL OUTPUT (SEQUENTIAL ACCESS).
a. How the System Goes about Outputting.
1: ASCII Graphic Characters.
2: "^G".
3: Carriage-return.
4: Linefeed.
5: Tab.
6: Control-L (Formfeed).
7: Altmode.
8: Control-P.
9: Backspace.
10: Random Control Characters, and Rubout.
b. Continuation - the Result of Line-overflow.
c. Wraparound and Scrolling - the Results of Page-overflow.
1: Scrolling.
2: Wraparound.
3. DISPLAY-MODE CHANNELS. ^P-CODES.
4. THE ECHO AREA.
a. How the Echo Area Works.
b. Creating an Echo Area.
5. READING THE CURSOR POSITION.
6. SUPERIMAGE OUTPUT.
7. RELEVANT TTYOPT BITS.
8. THROWING AWAY TYPEOUT.
9. WAITING FOR OUTPUT TO BE SENT TO THE TERMINAL.
10. .STATUS ON TTY OUTPUT CHANNELS.
F. **MORE** PROCESSING.
1. WHEN **MORE** PROCESSING IS TRIGGERED.
2. HOW **MORE** PROCESSING OPERATES.
a. Stupid Programs.
b. Smart Programs.
3. PROGRAMMED INVOCATION OF **MORE** PROCESSING.
4. INHIBITION OF **MORE** PROCESSING BY INPUT.
G. PER-TTY/PER-JOB VARIABLES.
1. THE VARIABLES.
a. the TTYST1 and TTYST2 variables.
b. The TTYSTS variable.
c. The Size of the Echo Area.
2. SYMBOLIC SYSTEM CALLS.
a. TTYGET - read TTYST1, TTYST2, TTYSTS.
b. TTYSET - set TTYST1, TTYST2, TTYSTS.
c. SCML - Set Number of Command Lines.
H. PERMANENT AND SEMIPERMANENT TTY INFORMATION.
1. THE VARIABLES.
a. The Screen Size.
b. The TTYOPT variable.
c. The TCTYP variable.
d. The TTYTYP variable.
e. The TTYCOM variable.
f. The TTYROL variable or "Scroll Count".
g. The TTYSMT variable.
2. SYSTEM CALLS.
a. RSSIZE.
b. CNSGET.
c. CNSSET.
d. TTYVAR.
I. PSEUDO-TELETYPES (STY'S).
1. OPENING STY'S.
2. OUTPUT TO STY'S.
a. What happens when the buffer is empty.
b. Interrupts.
c. RESET on sty output channels.
d. STATUS on sty output channels.
3. INPUT FROM STY'S.
a. What happens when the buffer is empty.
b. Interrupts.
c. .STATUS on sty input channels.
d. .RESET on sty input channels.
4. CLOSING STY'S.
5. CONTROLLING THE TTY ASSOCIATED WITH A STY.
6. DIRECT CONNECTIONS TO NETWORK CHANNELS: STYNET.
7. STYGET.
J. THE INTELLIGENT TERMINAL PROTOCOL.
1. ESCAPE SEQUENCES.
2. ALLOCATION.
3. OUTPUT-RESET.
K. SOFTWARE TTYS AND ITS OUTPUT BUFFER CODES.
1. ITS OUTPUT BUFFER CODES.
2. HANDLING %TDORS.
3. THE SCPOS SYSTEM CALL.
File: ITSTTY, Node: A, Previous: Top, Up: Top, Next: B
A. CHARACTERS SPECIALLY INTERPRETED WHEN TYPED ON THE TTY.
Normally, characters type on terminal keyboards have effect only
by being read and acted on by user programs. There are, however,
a few important exceptions.
* Menu:
* Interrupting: A/1 Interrupting the program - the CALL function
* Strange: A/2 Entering strange characters - the ESCAPE function
* Mode Setting: A/3 Mode setting using ESACPE
* Communicate: A/4 Communicate mode
* Escape Codes: A/5 List of ESCAPE codes
File: ITSTTY, Node: A/1, Previous: A, Up: A, Next: A/2
1. INTERRUPTING THE PROGRAM - THE CALL FUNCTION.
A function available on all terminals that are in use as
consoles is to stop the current program and interrupt its
superior. On TV's, this function is requested by hitting the
"CALL" key; on other terminals, which have no "CALL" key, the
character "^Z" is used. This makes the character "^Z" difficult
to type in as a normal characters on such terminals, requiring
quoting (*Note Quoting: A/2.).
In detail, the CALL function gives the job which owns the tty
(*Note TTY-owning: B.) a fatal interrupt, causing its superior in the
tree to be interrupted. The superior will usually react by retrieving
the terminal from the job that had posessed it. Thus, CALL makes it
possible to regain control when the program that has the terminal is
out of control.
When the terminal is in super-image input mode (%TSSII is 1),
the CALL function is disabled - attempts to use it merely
generate input to the program. Programs should not lightly enter
this mode.
a. Deferred CALL
If you want to return from a program to DDT after the program is
finished, if you use ordinary CALL you must not type it until then.
And since DDT will flush all input when it sees the CALL, you can't
type anything else until you have seen DDT respond.
The "deferred CALL", which you can type as Control-CALL on a TV or as
^_D on any terminal, does about the same thing that ordinary CALL does
except that it does not take effect until the program tries to read
it. It thus acts like an "exit" command in all programs. DDT
distinguishes deferred CALLs from ordinary ones (deferred ones give the
program a %PIDCL interrupt instead of a %PIC.Z), and does not throw
away input. Thus, you can type the deferred CALL ahead, and also some
DDT commands to follow it.
File: ITSTTY, Node: A/2, Previous: A/1, Up: A, Next: A/3
2. ENTERING STRANGE CHARACTERS - THE ESCAPE FUNCTION.
The ESCAPE function is requested by typing "BACK-NEXT" on TV's.
This character is available as "^_" (control-underscore) on most
terminals which have no "BACK-NEXT" key; on Lisp Machine keyboards it
is labeled SCROLL or MACRO.
The character used for the ESCAPE function is hard to type in, just as
the character used for the CALL function is. However, it provides a
mechanism that solves those problems. Note that the ITS ESCAPE
terminal function should not be confused with the "ESCAPE" key on TV
keyboards, which escapes all the way to the PDP-11 which handles the TV's.
In the following, "^_" will designate the ESCAPE function, unless
otherwise stated, regardless of whether it is actually obtained by
the character "^_".
* Menu:
* Quoting: A/2/a Quoting the chars used for CALL and ESCAPE
* ^_<number>: A/2/b
* Meta-bits: A/2/c Supplying Meta-Bits on Non-TV's
File: ITSTTY, Node: A/2/a, Previous: A/2, Up: A/2, Next: A/2/b
a. Quoting the Characters Used for CALL and ESCAPE.
One of the uses of the ESCAPE function is to enter characters
that are not on the keyboard or otherwise hard to type in. The
characters used for the CALL and ESCAPE functions may be entered
as normal input by preceding them with an ESCAPE, which "quotes"
them. For example, on a non-TV, typing "^_^_" causes a single
"^_" to be read by the program, to interrupt if the program has
enabled interrupts, etc., and "^_^Z" does the same thing for
"^Z".
File: ITSTTY, Node: A/2/b, Previous: A/2/a, Up: A/2, Next: A/2/c
b. "^_<number>".
If the terminal's keyboard is missing a character, that
character may be entered by typing ESCAPE followed by the octal
numerical code for the character. The number may have any number
of digits, and is terminated by the first non-digit. If that
non-digit is a space, it is discarded; otherwise, it is taken
normally as input. The character entered as digits will be echoed
(if echoing of that character is turned on). Thus, "^_001 "
inputs a "^A" and echoes as "^_001^A", and "^_1q" enters "^Aq"
and echoes as "^_1^Aq".
File: ITSTTY, Node: A/2/c, Previous: A/2/b, Up: A/2, Next: A/3
c. Supplying Meta-Bits on Non-TV's.
It is possible to enter characters in the TV character set that are not in
ASCII, using the ESCAPE function followed by ^B, ^C, ^D, or ^F, followed by
the basic ASCII character. ^B means "set the CONTROL bit"; ^C, the META
bit; ^F, the SUPER bit; ^D, the TOP bit. Any combination of those four
characters should be followed by the basic ASCII character with which those
bits will be OR'ed. To specify one of those four control characters, or
^Q, as the basic ASCII character, quote it with ^Q. For example, "^_^B^C1"
specifies CONTROL-META-1. "^_^BA" is CONTROL-A, which has the code 301,
and is not the same as ^A (code 001). The TOP bit is useful for programs
(such as TECO) which distinuish SAIL graphics characters from CONTROL
characters. TECO treats an ASCII ^K as an alias for CONTROL-K, but ^_^D^K
(TOP-^K) is believed to be the SAIL character Uparrow.
The reason that ^B and ^C stand for CONTROL and META is that
they correspond to the SAIL characters Alpha and Beta, which
are traditionally used for this purpose.
File: ITSTTY, Node: A/3, Previous: A/2, Up: A, Next: A/4
3. MODE SETTING USING ESCAPE.
Most of the switches that are associated with each terminal are
intended to be set or cleared by means of the TCTYP program.
However, there are two switches for which each job that can use the
terminal has its own setting. The TCTYP program may be used to set the
default values of the switches, which are used to initialize new jobs.
ESCAPE codes are provided for complementing the switch associated with
the job that the terminal belongs to at the moment.
a. "^_M" - Complement **MORE** Processing (%TSMOR).
When **MORE** processing is enabled, the system causes output to
pause at the bottom of the screen, until a space is typed.
b. "^_^" - Complement Scroll-mode (%TSROL).
When a terminal is in scroll mode, linefeeding past the bottom
of the screen causes everything on the screen to move up,
instead of wrapping around to write at the top of the screen.
c. "^_""" - Complement Use of SAIL Character Set (%TSSAI).
When %TSSAI is set, ascii mode and echo mode output of
non-formatting control characters will send the character
unmodified, assuming it to be a graphic character. Thus, "^B"
will echo as an alpha, etc., on terminals that can handle the
SAIL character set.
d. "^_U" - Complement conversion to upper case (%TOCLC)
When %TOCLC is set, characters typed at the terminal are converted
to uppercase.
File: ITSTTY, Node: A/4, Previous: A/3, Up: A, Next: A/5
4. COMMUNICATE MODE.
It is possible for a group of terminals to be put in a "com
link". When that is done, anything typed on any one of the
terminals echoes on all of them. Normally, what is typed on a
terminal that is in a com link is ignored except for that
echoing, however the user may cause it to be treated as normal
input (see "^_I"). Also, programs are usually prohibited from
typing out while the tty is in a com link, but that may be
changed by the user (see "^_O"). It is also possible to cause
one of the terminals in a com link to supply input for and view
the output from another (see "^_S" and "^_E").
* Menu:
* Entering: A/4/a Entering a COM link
* Querying: A/4/b
* Leaving: A/4/c Leaving a COM link
* ^_N: A/4/d When the system prints "^_N"
* Overrides: A/4/e Input and output overrides. "^_I" and "^_O".
* Slaving: A/4/f Slaving another terminal. "^_S" and "^_E".
* Respond: A/4/g Telling the system how to respond to "^_C" requests
File: ITSTTY, Node: A/4/a, Previous: A/4, Up: A/4, Next: A/4/b
a. Entering a Com Link.
From any terminal, a com link with any other terminal may be
requested by means of "^_C", which should be followed by the
number of the terminal to be linked to, or by the uname of the
user logged in on that terminal. The name or number is terminated
by the first space or CR, except that any number of spaces or
CR's may follow right after the "C" and will be ignored.
It is allowed for either the terminal on which "^_C" is typed or
the terminal to which a link is requested to be in a com link
already; in either case, if the request succeeds both of the
terminals and all the other terminals that had been linked to
either of them will form one com link. If there is no terminal
with the specified number, or no one is logged in with the
specified uname, the "^_C" will have no effect, and a "?" will
be typed. The same thing will happen if the specified terminal
is already in a com link with the requesting terminal. If the
specified terminal is in the middle of typing in an ESCAPE code,
or has characters unprocessed in its input buffer, the "^_C"
fails, typing "Busy". When that happens, it is reasonable to
try again in a few seconds. If the specified terminal's user
has ordered it ro refuse com links, with "^_R"
(it is in "refuse mode"), then "Refused" will be typed, and the
request will fail. If these conditions for "^_C" are met, the
request is basically acceptible, and what happens to it depends
on whether the specified terminal is in "accept mode" (the usual
case) or in "query mode". In accept mode, the two terminals will
be linked right away. If the target terminal is already in a com
link, a list of the terminals in that com link will be typed out
and the user will be asked whether he wants to "break in". An
answer other than "Y" or "y" will abort the request. In query
mode, the specified terminal must be asked whether the link
should be made - that process will be described later.
Assuming that the specified terminal is in accept mode, and that
if necessary the user has decided to break in, then, the link
will be created, and the requesting terminal will be informed
that the request has succeeded by a "OK". "F" will be typed in
addition if the specified terminal is free. The "OK" tells the
requesting user that he is linked to the specified terminal, but
he may also be linked without knowing to other terminals already
linked to the specified terminal. Also, the other terminals in
the link at this point know nothing. Therefore, messages are
typed on the terminals as follows: on the specified terminal and
all terminals linked to it, the message "LINK FROM <list of
terminals and users>" will be typed, where the <list> includes
the requesting terminal and all terminals linked to it, and a
terminal is referred to by its uname if it is a logged in
console, and as "Tnn" otherwise. Also, if there are other
terminals already linked to the requesting terminal, the message
"LINK TO <list>" will be typed, naming the specified terminal
and any other terminals linked to it. Also, if the specified
terminal is already linked to others, the message
"LINK TO <list>" naming only those others, and not the specified
terminal, will appear on the requesting terminal. The result of
all of those messages is that each terminal that ends up in the
new com link is informed of all the other terminals that it is
becoming linked to.
File: ITSTTY, Node: A/4/b, Previous: A/4/a, Up: A/4, Next: A/4/c
b. Querying.
When the specified terminal is in query mode (*Note ^_Q: A/4/g.),
"QUERYING" is typed on the requesting terminal, and the "LINK FROM ..."
message is typed on the specified terminal only (NOT on the
terminals linked to it already), followed by "QUERYING", which
informs its user that he is being queried. He need not
pay immediate attention to the query, and his commands will
continue to go to his program. When he wishes to respond,
he may do "^_Y" to accept the link, "^_Z" to to refuse it,
"^_Q" to list the people querying, or "^_C" to a specific
user querying him. Such a "^_C" will always succeed
immediately, even if the target is in refuse mode or query mode,
as long as he is querying the "^_C"'er. This is how to
accept some but not all of several simultaneous queries.
When a query is accepted or rejected, "OK" or "REFUSED" will be
typed on the requesting terminal. Until that happens,
the requesting terminal may not do anything but "^_N" to give up
waiting, aborting the request, or ^G, which echoes on the terminal
being queried, to attract its user's attention. If "^_N" is
used to abort the request, the queried terminal is not informed.
If the request is accepted, "OK", the "LINK TO ..." messages and
the remaining "LINK FROM ..." messages are typed as they would
have been for accept mode.
File: ITSTTY, Node: A/4/c, Previous: A/4/b, Up: A/4, Next: A/4/d
c. Leaving a Com Link.
Any terminal may be removed from a com link by typing "^_N" on it.
Also, any terminal in a com link may remove any of the other
terminals from that link by typing "^_K" followed by the uname or
number of the terminal to be unlinked (using the same syntax as
"^_C"). If there is only one terminal left in the com link, the link
is destroyed, and that terminal also returns to normal. Otherwise
the terminals remaining in the link continue to be linked, and
"BYE FROM <unlinking terminal>" is typed on each of them.
File: ITSTTY, Node: A/4/d, Previous: A/4/c, Up: A/4, Next: A/4/e
d. When the System Prints "^_N".
Whenever a terminal enters a com link, or makes a "^_C" request,
it is said to enter "com mode". That causes input not to be passed
to the program, and prevents programs from typing out (but see "^_I"
and "^_O"). This state persists until the terminal is no longer in
com mode. Therefore, the system informs the user that the terminal
has left com mode by typing "^_N" on the terminal, unless the
terminal has left com mode because the user has just typed "^_N"
on it (the idea is that if a "^_N" has just echoed there is no need
to supply another).
File: ITSTTY, Node: A/4/e, Previous: A/4/d, Up: A/4, Next: A/4/f
e. Input and Output Overrides.
Normally, on a terminal in com mode input is not passed to the
program and programs may not type out (.IOT's hang). That can be
explicitly changed with "^_I" and "^_O". "^_O" complements the
%TCOCO switch which, if on, allows programs to output to the terminal
even when it is in com mode. %TCOCO is initialized to 0 whenever
a terminal is initialized (when it starts to be used after being
free for a while). DDT turns %TCOCO on temporarily when printing
unsolicited messages such as "ITS GOING DOWN". %TCOCO can be set
with :TCTYP OCO and cleared with :TCTYP NO OCO.
"^_I" complements the %TCICO switch which, if on, causes input to
be passed to the program even when in com mode, and also allows
programs to type out (just like %TCOCO). %TCICO is initialized
to 0 at the same time as %TCOCO, and may also be set with :TCTYP.
Note that when the switch is off all characters echo regardless of
what the program has requested, but when the switch is on, characters
echo or not just as they would when not in com mode, according to
the program's setting of the TTYST1 and TTYST2 variables.
File: ITSTTY, Node: A/4/f, Previous: A/4/e, Up: A/4, Next: A/4/g
f. Slaving Another Terminal.
In any com link at any time one terminal may be slaved. That means
that those other terminals that wish to may supply input to the
program using the slaved terminal, and see the output typed on it.
(Actually, it isn't too hard to cause there to be two slaved
terminals in a link). Any terminal that is slaved will always see
program output, regardless of the setting of the "^_O" switch.
The "^_I" switch functions normally on slaved terminals.
Any terminal may explicitly slave any other terminal
linked to it, by means of "^_S", which has the same syntax as "^_C".
This automatically unslaves all terminals in the link other than
the one requested to be slaved.
Each terminal has a switch that determines whether input typed on
it should be sent to the slaved terminal in the link, if there is
one. This switch is complemented by "^_E", and initialized off when
com mode is entered. If there are exactly two terminals in the link,
typing "^_E" on one automatically does a "^_S" to the other.
Otherwise, both the "^_E" and the "^_S" must be done to get any
effect. If a terminal's "^_I" switch and its "^_E" switch are both
set, input from it will be fed to both its own programs and those of
the slaved terminal. That is, the two switches are independent.
Similarly, the "^_O" switch does not interact with the "^_E" switch.
File: ITSTTY, Node: A/4/g, Previous: A/4/f, Up: A/4, Next: A/5
g. Telling the System How to Respond to "^_C" Requests.
Any terminal may be in any one of three modes: accept mode, refuse
mode, and query mode. Accept mode is the default, and causes "^_C"
requests to succeed; refuse mode causes them to fail; query mode
causes them to query as described in section b. Accept mode may be
entered by typing "^_A"; refuse mode, by "^_R"; query mode, by "^_Q".
In addition, "^_A" accepts all pending queries, and "^_R" refuses them.
The program TCTYP also has the capability of changing the mode, using
the CNSSET system call. The information is stored in the bits %TCRFS
and %TCQRY in the TTYCOM variable (*Note Combits: H/1/e.).
File: ITSTTY, Node: A/5, Previous: A/4, Up: A
5. LIST OF ESCAPE CODES.
In most cases, the escape code name is also the name of a footnote
leading to a node containing more details on the specific code.
^_^Z Program receives "^Z". No quitting action, etc.
^_^_ " " "^_". No special action
^_" Complement %TSSAI for the job which has the tty.
That flag, if 1, says that the SAIL character set should be
used for echo mode and ascii mode output. *Note ": E/2/a.
^_<number>
Enter the character whose ASCII code is <number>.
*Note nnn: A/2/b.
^_A Set "accept mode". *Note A: A/4/g.
^_B Cause typeout to pause. *Note B: F/1.
^_C Communicate with another terminal. *Note C: A/4/a.
^_D Deferred Call. *Note D: A/1/a.
^_E Start or stop sending input to a slaved terminal.
*Note E: A/4/f.
^_I Complement the input override flag (%TCICO). *Note I: A/4/e.
^_J Give a %PIJST interrupt to the job that has the tty, or the closest
superior that has the interrupt enabled.
^_K Take some other terminal out of com link. *Note K: A/4/c.
^_L Clears the screen (echoes "^PC").
^_M Complement **MORE** processing for job that has the tty.
*Note M: F/2.
^_N Leave com link or quit waiting for answer to query.
*Note N: A/4/c.
^_O Complement the output override flag (%TCOCO). *Note O: A/4/e.
^_Q Set "query mode" (%TCQRY). *Note Q: A/4/g.
^_R Set "refuse mode" (%TCRFS). *Note R: A/4/g.
^_S Slave a specified terminal. *Note S: A/4/f.
^_U Complement conversion of to upper case (%TOCLC).
*Note U: A/3/d.
^_Y Say yes to a query. *Note Y: A/4/b.
^_Z Say no to a query. *Note Z: A/4/b.
^_^ Complement scroll mode for job that has the tty.
*Note ^: A/3/b.
^_^U Clear input for this TTY. This completely flushes what
is in the input buffer and is useful for getting rid of
unwanted typeahead.
File: ITSTTY, Node: B, Previous: A, Up: Top, Next: C
B. "CONTROL OF THE TTY".
A terminal that is a console may be used by any of the jobs in
its tree, but not all at once. At any time, the terminal belongs
to a particular job, and for the most part only that job can use it.
Also, all input and output interrupts go to that job only. If
any other job in the tree tries to use the tty for anything except
to type out, it will not
succeed (it may wait until it is allowed to use the tty, it may
get an interrupt, or its system call may simply fail, depending
on what the job is doing and on the setting of some bits in .TTY,
described below). Permission to type out is controlled by a
separate mechanism.
The job that is allowed to use the tty is said to "have control
of the tty", or to "have the tty". The .ATTY and .DTTY UUO's
allow control of the tty to be passed between the jobs in a
tree.
* Menu:
* Who Has: B/1 What determines who has the TTY
* ATTY: B/2 .ATTY and .DTTY
* Permission: B/3 Permission to type out
* .TTY: B/4 The .TTY variable
* .CNSL: B/5 The .CNSL variable
File: ITSTTY, Node: B/1, Previous: B, Up: B, Next: B/2
1. WHAT DETERMINES WHO HAS THE TTY.
Each job has a variable - called .TTY, readable with a .SUSET or
.USET - that says, among other things, whether it wishes to retain
the tty or to pass it on to a particular one of its inferiors.
Each job can alter that setting at any time. The instantaneous
values of the .TTY variables of all the jobs in a tree determine
which of them has the tty, as follows: If the top level job wishes
to retain the tty, then it owns the tty; otherwise, if the one
inferior which it wishes to pass the tty on to wishes to retain
the tty, then that job owns the tty; otherwise the job that job
wishes to pass the tty on to has its chance, etc. In other words,
at any instant the tty is as far down as it can get before being
blocked from further descent by a job that wishes to retain it.
File: ITSTTY, Node: B/2, Previous: B/1, Up: B, Next: B/3
2. .ATTY AND .DTTY.
.DTTY is used when a job decides that it wishes to retain the
tty. It skips if it succeeds; it fails if the job was already in
the state of wishing to retain the tty,
If the tty had actually belonged to some (possibly
indirect) inferior, it will belong after the .DTTY to the job
that executed it.
The ATTY operation puts the job in the state of wishing to pass
control of the tty to one of its direct inferiors. This is known
as an "ATTY'ing state". If a job which is in an ATTY'ing state
is allowed ownership of the TTY by its superiors (ie, they too are
in ATTY'ing states pointing down to this job), then ownership
passes yet another level to the ATTY'd inferior.
Whenever an ATTY is done, the %TSATY bit will be set to 1 in TTYSTS,
and the inferior receiving the tty will be given a %PIATY
interrupt if it is enabled.
The ATTY operation can be done with either the .ATTY UUO or the ATTY
symbolic system call. .ATTY <chn>, specifies the inferior open on
channel <chn>. The ATTY symbolic system call takes one argument,
a job spec, to specify the inferior to ATTY to.
ATTY'ing is illegal for the job which has the tty, when the %TSLCZ
bit is set (meaning that the last char typed on the tty was "^Z").
This is a half-hearted attempt to make it possible to "^Z" up
several levels past programs that are trying to prevent that.
Since super-image input mode now exists, such an attempt is futile.
This "feature" can probably be flushed if anyone wishes.
The "P" command causes DDT to do an .ATTY, among other things.
"^P" does not. DDT does a .DTTY when an "P"'ed job returns to DDT.
A job need not have the tty to do an .ATTY or .DTTY. In fact, they
are the only operations on ttys that work as well without the tty
as with it.
File: ITSTTY, Node: B/3, Previous: B/2, Up: B, Next: B/4
3. PERMISSION TO TYPE OUT.
The job that owns the TTY, and the job at the top of the tree,
can always type out on the TTY. Those jobs can also grant
permission to some of their inferiors, which can in turn grant
it to their inferiors, and so on. Such indirect permission
is controlled by two bits in the .TTY variable of each job.
One bit, %TBOUT, is set by the superior to 1 to grant permission, or
to 0 to deny it, to the job whose %TBOUT bit it is. The other,
%TBINF, if set to 0, denies all inferiors permission to type out
without forgetting the states of their %TBOUT's. A job inherits
type-out permission from its superior only if its own %TBOUT and the
superior's %TBINF are both 1. A job has type-out permission iff a
chain of inheritance reaches up from it to the top of the tree or to
the job which owns the TTY.
The DDT command ^P works by means of this feature.
File: ITSTTY, Node: B/4, Previous: B/3, Up: B, Next: B/5
4. THE .TTY VARIABLE.
This variable is actually called TTYTBL in the system.
"%TB" and "$TB" identify bits and fields in the TTYTBL variable,
which contains the information on the status of a job
with respect to its console tty (if any). Note that it is not
necessary for a job to belong to a tree that has a tty for these
bits to make sense. The $TBECL field is actually a shadow location
for a per-tty/per-job variable; it only contains real information
when the job does NOT have the tty.
Most of the fields are set only by the system, but %TBNVR and
%TBINT are user options, settable by .SUSET or .USET. They
decide what the job will do when it tries to use the tty, but
doesn't have it.
%TBNOT==400000 ;4.9 1 iff the job does not have the tty.
%TBNVR==200000 ;4.8 1 => opens of TTY: should fail when
;the job does not have the tty.
%TBINT==100000 ;4.7 1 => all attempts to use the tty when
;the job doesn't have the tty, should cause class 2
;interrupts on bit 4.2 (%PJTTY) of the first interrupt word.
;0 => such attempts wait until the job gets the tty.
%TBWAT==040000 ;4.6 1 => override the settings of %TBNVR and
;%TBINT, and always wait for the TTY. This bit can
;be set only by the job's superior, and means "you
;are supposed to have the TTY, even though for a
;short interval you may not really have it".
%TBDTY==010000 ;4.4 1 iff job doesn't have tty, but wishes
;to retain it. Set by .DTTY, cleared by .ATTY.
%TBOUT==004000 ;4.3 1 => this job can inherit type-out permission
;from its superior (can be altered only by superior).
%TBINF==002000 ;4.2 1 => inferiors are allowed to inherit type-out
;permission from this job.
$TBECL==220600 ;3.1 - 3.6 the job's setting of the number of
;lines in the echo area, if the job doesn't have
;the tty.
RH: ;If the job has the tty, this is the tty number.
;If the job is in an .ATTY'ed state, this has the
;internal user index of the inferior the tty
;should be passed on to.
;Otherwise, 0.
File: ITSTTY, Node: B/5, Previous: B/4, Up: B
5. THE .CNSL VARIABLE.
If a program needs to know the number of its tree's tty (or of
some other job's tree's tty), it can get that information
without actually possessing the tty by reading the .CNSL
user variable. That variable contains the number of the
tree's tty if there is one; -1 for a job scheduled as part
of the system; -2 for a job scheduled as a disowned job.
for a job device or its inferior, .CNSL will be the same as
for the creator of the job device.
File: ITSTTY, Node: C, Previous: B, Up: Top, Next: D
C. OPENING TTY CHANNELS.
Terminals may be opened for I-O using either device TTY: or device
Tnm:. TTY should be used by a job in a console-controlled tree to
open the console. Tnm should be used to open a terminal "as a
device" - that is, to open a tty that is not the console of the
job doing the opening.
* Menu:
* Opening: C/1 Opening "TTY:" and "Tmn:"
* Bits: C/3 Device-dependent bits in the OPEN mode
File: ITSTTY, Node: C/1, Previous: C, Up: C, Next: C/3
1. OPENING "TTY".
Device TTY may only be successfully opened by a job in a console-
-controlled tree which is in posession of the tty. If a job which
does not meet that criterion tries to open the tty, the open may
hang, fail, or generate a fatal interrupt, depending on the setting
of the %TBNVR and %TBINT bits of the job (*Note NoTTY: B/3.).
What such an open will definitely not do is succeed.
2. OPENING "Tnm".
Opening device Tnm is the way for a program to make use of a tty
other than its console (in fact, it need not have a console).
"nm" should be replaced by the two-digit octal number of the terminal
to be used. In order for the opening of device Tnm to succeed,
the specified terminal must not be in use by any other job.
An attempt to open by number a tty which happens to be the console
of the job doing the open will succeed iff the job has the tty at
the time. This is to make it possible to specify one's own tty when
asked to specify a tty by number.
File: ITSTTY, Node: C/3, Previous: C/1, Up: C, Next: D
3. DEVICE-DEPENDENT BITS IN THE OPEN MODE.
Many of the bits in the mode specified in a .OPEN have special
meanings for devices TTY and Tnm. Some of them affect only the
channel being opened; others merely initialize some of the per-tty/
per-job information, but those bits are
effective only if the terminal is not open in the same direction on
any other channel (those bits exist for historical reasons only,
since the variables they set may be set explicitly at any time
using the TTYSET and SCML symbolic system calls (*Note vars: G.)).
The per-channel bits which have names are used only to initialize
the IOCHNM word of the channel - thus, mode bit 4.6 (%TIECH) is
copied into bit 4.6 of the IOCHNM word. Various I-O operations
examine the IOCHNM word to decide what to do. With symbolic system
call IOT's, the user may temporarily alter the settings of those
bits, so the values supplied in the open are merely the defaults
for the channel.
The per-channel bits that are not named are
interpreted by the OPEN routine, and act by setting some of the
named bits, as described below. They exist for historical reasons.
(that does not include bits 3.1 and 3.2, which are special).
* Menu:
* Bits: C/3/a Per-channel bits
* Other: C/3/b Other Per-channel bits on input and output
* First: C/3/d First-time bits on output and input
File: ITSTTY, Node: C/3/a, Previous: C/3, Up: C/3, Next: C/3/b
a. Per-channel Bits.
3.1 1 => output; 0 => input. Affects the interpretation of the
other bits.
3.2 1 => block mode; 0 => unit mode. In block mode, each
character is treated as in unit mode, except that on output,
"^C" is ignored, and on input, "^C" typed in will act like
end-of-file (that is, the .IOT will return with the last
word padded out with "^C"'s and the pointer not fully
counted out). "^C" also terminates SIOT's on unit input
channels, but it is not ignored by output SIOT's.
File: ITSTTY, Node: C/3/b, Previous: C/3/a, Up: C/3, Next: C/3/d
b. Other Per-channel Bits on Input.
%TIECH==40000 ;1 => can read even if char needs pi echoing.
%TIPEK==20000 ;1 => don't remove char from buffer.
%TIACT==4000 ;1 => don't wait for activation character.
%TIINT==2000 ;1 => can read a char even if it is supposed to interrupt & hasn't yet.
%TINWT==1000 ;1 => do not wait for input. If no input is available,
;unit mode IOT's return -1; unit mode SIOT's and block mode
;IOT's return without filling up the space available to them.
%TIFUL==400 ;1 => use the full TV character set if possible.
;suppresses the conversion, which is normally
;performed on TV's, from the TV character set
;to ascii. See ITS TV.
c. Other Per-channel Bits on Output.
3.4 1 => turn on %TJECH, %TJPP2, and %TJMOR.
3.5 1 => turn on %TJDIS.
3.6 1 => turn on %TJSIO.
%TJECH==40000 ;1 => echo mode output (all chars output the
;way they would be echoed)
%TJCTN==20000 ;1 => don't do line-continuation.
%TJSTP==10000 ;1 => this channel is hung in **more**.
;this bit is unusual in that the system changes it
%TJDIS==4000 ;1 => recognize "^P" as an escape for display commands
%TJSIO==2000 ;1 => superimage output, no padding or cursor control.
%TJMOR==1000 ;1 => don't do **MORE** processing.
%TJPP2==400 ;1 => output in the echo area if there is one.
File: ITSTTY, Node: C/3/d, Previous: C/3/b, Up: C/3
d. First-time Bits on Output.
3.3 1 => image mode (set all %TGIMG bits in TTYST1 and TTYST2)
If you think you want to do this, you probably
really want to use %TJSIO.
e. First-time Bits on Input.
3.3 1 => image mode (clear all %TGPIE and %TGMPE bits in TTYST1, TTYST2).
It is UNWISE TO USE THIS FEATURE, because it will prevent the
user from translating TTY: to a file of commands for your
program. You should use a TTYGET and TTYSET to change these
bits, and you should not complain if they fail.
3.4 1 => "DDT" (clear %TGPIE and %TGMPE bits for CR, LF and TAB)
3.6 1 => want 3 lines in echo area.
(that is, the OPEN should do a SCML with argument 3.
*Note SCML: E/4.).
File: ITSTTY, Node: D, Previous: C, Up: Top, Next: E
D. INPUT FROM TERMINALS.
Characters typed on a terminal, aside from those that invoke the
CALL and ESCAPE functions, go into an input buffer from which
they may eventually be read by the program (if the buffer is
full, they are discarded, and a "^G" is output). Before being
read, they may be echoed (and usually will be). A character may
also cause an input interrupt - this allows specific characters
to signal a program to perform some action immediately, at any
time, without waiting for the program to get around to looking
for input.
If %TOALT is set, and %TSALT is not, characters 175 and 176 will
be turned into 33 (this is "standardization of altmodes").
* Menu:
* Echo: D/1 Echo
* MP Input: D/2 Main-program input.
* Activation: D/3 Activation.
* Interrupts: D/4 Input interrupts.
* Throw: D/5 Throwing away type-in.
* Avail: D/6 Testing for the availability of input.
* .STATUS: D/7 .STATUS on tty input channels.
* Char Set: D/8 The character set
File: ITSTTY, Node: D/1, Previous: D, Up: D, Next: D/2
1. ECHO.
"Echoing" is the act of typing out whatever the user types in.
Its purpose is to give the user positive verification of his
type-in. On ITS, echoing works by taking the typed-in characters
and outputting them in echo mode, in the echo area if there is
one (that is, outputting with %TIECH and %TIPP2 set). There are
two types of echoing: PI echoing, and MP (main program) echoing.
PI echoing happens as soon as possible after the character is
typed in. MP echoing happens when the character is read in by
the program. Each program may specify which characters ought to
be PI echoed, and which ought to be MP echoed, using the
per-tty/per-job variables TTYST1 and TTYST2 (specifically, the
%TGPIE and %TGMPE bits, of each of which there is one for each
group). It is permitted to specify that a character not be echoed
at all, or that it be echoed in both ways (PI and MP). Most
programs specify that all characters be PI echoed, and none MP
echoed; DDT choses to have LF and TAB not echoed at all; some
programs such as TELNET and PDP11 in certain modes turn off all
echoing. MP echoing is not used much if at all, and is not
clearly useful, so it may be flushed in the future, although if
an important use is found it will stay. Therefore, new programs
should avoid using MP echo if possible. If use of it is
very desirable, please :BUG ITS the application.
Normally, a character cannot be read in until any necessary
echoing has taken place. However, if reading is done with the
%TIECH bit set, any echoing (of the characters thus read) not
yet performed will be skipped entirely. This does not guarantee
that such characters will not be PI echoed; it just means that
the system will not regard the PI echoing as essential, and will
forgo it rather than wait for it. MP echoing will certainly not
be done for characters read with %TIECH set. Extra bits will be
returned with such characters saying what kinds of echoing were
appropriate but were not yet done, to enable the program to echo
the character itself if that is right. The bits are
%TXPIE=200000 saying PI echo was desired, and %TXMPE=400000
saying MP echo was desired.
The bit %TSNOE in the TTYSTS variable (*Note TTYSTS: G/1/b.), when set
to 1, causes echoing to be deferred; that is, echoing will not be
performed while the bit is set, but the system still remembers what
echoing is pending, and will again start doing it when %TSNOE becomes
0. However, if a character with pending echoing is read in while
%TSNOE is 1, the pending echoing will of necessity be forgotten. When
%TSNOE is 1, the system acts as if %TIECH were 1 on all input IOT's
from that tty, since otherwise such IOT's wuld simply wait forever.
In particular, the %TXPIE and %TXMPE bits in the character read will
tell the user what sorts of echoing were still pending.
File: ITSTTY, Node: D/2, Previous: D/1, Up: D, Next: D/3
2. MAIN-PROGRAM INPUT.
Characters are read from the tty using the .IOT UUO or the
symbolic system calls IOT or SIOT.
.IOT has slightly less overhead, but the symbolic system calls
allow the channel's characteristics to be temporarily altered.
Unit mode IOT's read a single character and return it. SIOT's and
block mode IOT's try to read enough characters to fill the block
supplied, but the character "^C" will cause them to return what
has been read so far, with pointers and counts not fully advanced.
SIOT and block mode IOT input from ttys is relatively useless;
it is provided for the sake of device-independence. Programs
should normally read from the tty in unit mode.
IOT'ing on the job's console cannot actually be done unless the
job has control of the console (*Note Owner: B.). If it does not,
either the IOT will wait until the job gets the tty, or a class 2
interrupt will result, depending on the %TBINT and %TBWAT
bits in .TTY (*Note NoTTY: B/3.).
Also, on any tty, IOT's will wait until either the tty is
not in a com link, or the tty is slaved, or %TCICO is set
(*Note Com: A/4/e.).
Input IOT's executed when the input buffer is empty will
normally wait until input is available (*Note Wait: D/3.). However,
if %TINWT is set, the IOT will not wait at all. Instead, unit mode
IOT's will immediately return -1; SIOT's and block mode IOT's
will return with the supplied block not completely filled
and the pointer and count advanced to point to the first
unfilled character or word.
When an IOT attempts to read a character, if PI echoing is
necessary for the character and has not been performed, the IOT
waits until it has been (unless %TIECH is set, or %TSNOE is
set). Also, if the character is supposed to cause an input
interrupt, the IOT waits until the character has been processed