From aeb84af2815cf731e64b2be73746efaed33eed2b Mon Sep 17 00:00:00 2001 From: Lars Brinkhoff Date: Thu, 3 Nov 2016 07:59:01 +0100 Subject: [PATCH] TECO documentation. --- doc/README.md | 2 + doc/_teco_/teco.primer | 344 +++ doc/_teco_/tecord.1132 | 5253 +++++++++++++++++++++++++++++++++++++++ doc/info/tecman.20 | 5310 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 10909 insertions(+) create mode 100755 doc/_teco_/teco.primer create mode 100755 doc/_teco_/tecord.1132 create mode 100755 doc/info/tecman.20 diff --git a/doc/README.md b/doc/README.md index c1d1a739..07207960 100644 --- a/doc/README.md +++ b/doc/README.md @@ -6,6 +6,8 @@ [colon commands](_info_/ddt.:cmnds) - MIDAS: [manual](info/midas.25) - DUMP: [manual](_info_/dump.info), [format](sysdoc/dump.format) +- TECO: [primer](_teco_/teco.primer), [manual](info/tecman.20), + [commands](_teco_/tecord.1132) ### DDT cheat sheet for Unix users diff --git a/doc/_teco_/teco.primer b/doc/_teco_/teco.primer new file mode 100755 index 00000000..4256fa29 --- /dev/null +++ b/doc/_teco_/teco.primer @@ -0,0 +1,344 @@ + AN ANNOTATED OUTLINE OF TECO COMMANDS + ************************************* + + +META-NOTATION +============= +|x Denotes the single character, control-x. +| Used alone to denote alternation. +m | n | arg Integer arguments. +string String argument. +cmd A command string. +$ Denotes the character altmode unless mentioned otherwise. +k Denotes either "m,n", or "n"; a text range of characters m through + n, or n lines. +file Denotes a file name pair, e.g., "FOO BAR". +dir Denotes a device and directory specification, e.g., "DSK: USERS;". + + +SPECIAL CHARACTERS +================== +|G Quit to TECO top-level; cancels partial command line. +|Z Interrupt to DDT. +altmode Terminates text argument; two successive altmodes terminate + command string. +rubout Deletes last character typed in. + + QUOTE + ----- +|Q Quote next character. + + MODIFIERS + --------- +: | ^ Prefix to certain commands, modifies them. + + LOGICAL CONNECTIVES + ------------------- +& Logical and, an arithmetic operator. +# Inclusive or, an arithmetic operator. +|A Exclusive or, an arithmetic operator. + + ARITHMETIC + ---------- +0-9 Digits: xxxx is interpreted in base FS IBASE$ (10) + xxxx. is interpreted in base FS I.BASE$ (8) ++ Addition, an arithmetic operator. +space Same as "+", except that space, by itself, is not a non-null arg. +- Subtraction, an arithmetic operator. +* Multiplication, an arithmetic operator(with no operator precedence). +/ Division, an arithmetic operator(with no operator precedence). +( | ) Parentheses, grouping in arithmetic expressions. + + ARGUMENT SEPARATOR + ------------------ +, Separates numerical arguments. + + +THE BUFFER +========== +. Value is number of char to left of pointer. +Z Value is number of char in buffer*. +H Equivalent to "B,Z", i.e., specifies whole buffer*. +B Value is 0, i.e., beginning of buffer*. + *Meaning is modified by use of virtual boundaries. + + INSERTING + --------- +Istring$ Insert string in buffer to left of pointer. +^Ixstringx Insert string delimited by char x to left of pointer. +nI Insert the char with ASCII code n. +m,nI Insert m copies of the char with code n. +tab Horizontal tab, self-inserting character. +backspace Backspace, self-inserting character. +n\ Insert printed representation of n (in base ..E). +|^ Value = ASCII code of next char in cmd. +FI Read one char from TTY and return its ASCII code as value. + + ASCII + ----- +mA Value = ASCII code of char m positions to right of ptr. + 0A => char to immediate left of ptr. + + UPPER-CASE/LOWER-CASE + --------------------- +F$ Controls case conversion on input/output ($ => dollar). +kFC Convert text range k to lower-case. + + MOVING AROUND + ------------- + + ABSOLUTE POSITION + ----------------- +mJ Position ptr to after m-th char in buffer. + + RELATIVE CHARACTER POSITION + --------------------------- +mR Move ptr left m char; R => 1R, -mR => mC. +m:R Same as mR but returns -1(move OK) or 0(if move would cause an error). +mC Move ptr right m char; C => 1C. +m:C Returns value like m:R. +\ Move ptr right over number, return number's value. + + LINE POSITION + ------------- +mL Move ptr to beginning of m-th line after current position; + 0L => beginning of current line. +m,nL Same as m+n-.J, used by FW, etc. +m:L Do mL, then backup over CR-LF; :l => end of current line. + + WORD POSITION + ------------- +nFW Returns ".,m", a buffer range where m is the position immediately after + the n-th word(contiguous string of non-delimiters; see ..D, the delimiter + dispatch table). +-nFW Returns "m,.", the range to the left. +n:FW Same as FW, but stops before the n-th word; i.e., n:FWL = nFWL-FWL. +n^FW Same as FW, but finds LISP atoms, not words. +nFWL Do an nFW, yielding ".,m", move to m (=m+.-.J). +nFWR Same as nFWL. + + LIST POSITION + ------------- +nFL Returns ".,m", where m is the position immediately after the + n-th list to the right. +-nFL Returns "m,.", the range to the left. +n^FL Same as nFL, but finds S-expressions, not lists. +nFU Returns ".,m", where m is the position immediately after the n-th + level up in parentheses to the right. +-nFU Same as nFU, but returns "m,.", and works to the left. +nFD Returns ".,m", where m is the position immediately after the n-th + level down in parentheses to the right. +-nFD Same as nFD, but returns "m,.", and works to the left. +nFLL Does nFL, yielding ".,m", moves to m. +nFLR Same as nFLL. + + DELETING + -------- + + ABSOLUTE POSITION + ----------------- +m,nK Kill chars in the range m,n. Move ptr there. + + CHARACTER + --------- +nD Delete n chars to right of ptr. +-nD Delete n chars to left of ptr. + + LINE + ---- +nK Kill chars from . to position nL would have moved to. + K => 1K, kill to beginning of next line. +n:K Kill chars from . to position n:L would have moved to. + :K => 1:K, kill to end of current line. + + WORD + ---- +nFWK Do an nFW returning ".,m"; kill chars in this range. +nFWD Same as nFWK. + + LIST + ---- +nFLK Do an nFL returning ".,m"; kill chars in this range. +nFLD Same as nFLK. + + +TYPE-OUT +======== +kT Type out text in range k (n lines or m,n chars). +kV Display text in range k on CRT. +FTstring$ Types its string argument. +FVstring$ Displays its string argument. +kVW Does kV, then waits for TTY input of one char whose ASCII code + is returned as value. +k= Types out k ("n" or "m,n") in current output radix(in ..E). + + +SEARCH +====== +nSstring$ Find n-th occurrence of string searching forward and position ptr after it. +-nSstring$ Same as nSstring$, but search backward and position ptr before n-th string. +n^Sxstringx Same as nSstring, where string is delimited by any char x. +n:Sstring$ Same as nSstring$, but returns value = -n if successful, 0 if not. + Special chars in string: + |B Matches any delimiter(see ..D). + |Nx Matches any char but x. + |O Divides string into alternate patterns. + |Qx Quotes x. + |X Matches any char. +nNstring$ Same as nSstring$, but does P if end of buffer is reached. +n_string$ Same as nSstring$, but does Y if end of buffer is reached. +kFBstring$ Same as Sstring$ in the search domain defined by k; for k = m,n where + m>n, search backwards; ":" and "^" modifiers work. +FK Returns value = - FS INSLEN$ = - length of last string inserted, or found + by search or FW. FK < 0 except for backward search or FW. + + +SORT +==== +|Pcmd0$cmd1$cmd2$ ASCII sort command, with the following algorithm: + Move ptr to start of buffer; + ..0 := cmd0; ..1 := cmd1; ..2 := cmd2; + Iterate: + Ptr is at start of next record; + Cmd0 moves ptr to start of key; + Cmd1 moves ptr to end of key; + Cmd2 moves ptr to end of record; + Do a sort of records based on keys; + Notes: Dollar signs in the cmdi are replaced by altmodes. + If FS ^P CASE$ .NEQ. 0, then |P ignores case. + + +FILES +===== + + DIRECTORIES + ----------- +ETfile$ Set default filenames to file. +EL Type out listing of default directory. +EYdir$ Same as EL, but with specified device and sname. +EM Insert listing of default directory in buffer. +EZdir$ Same as EM, but with specified device and sname. + + OPEN READ + --------- +ERfile$ Opens file for input. +EPfile$ Does ERfile$, then bigprints filename twice on device open for writing. + + OPEN WRITE + ---------- +EI Open a file "_TECO_ OUTPUT" for writing on default device and sname. +0EI Same as EI, but sets default device to DSK:. +:EI Same as EI, but uses current filename defaults rather than "_TECO_ OUTPUT". +EWdir$ Same as EI, but with specified device and sname. +:EW dir file$ Same as EW, but also with specified filenames. + + INPUT + ----- +Y Kills the buffer; inserts one page from current input file into buffer. +^Y Kills the buffer; yanks the entire input file into buffer. +A Append next page of input file to buffer (no arg allowed). +n:A Append n lines or up to page boundary of input file to buffer. +^A Append all of input file, and close file. +nP Output buffer and "|L", kill buffer, read one page from input file; + all done n times. + + OUTPUT + ------ +nP See description above under input. +m,nP Output specified range of buffer, but do not clear it or input. +nPW Output buffer and "|L", but do not clear it or input; done n times. +EEfile$ Same as "infinityP EFfile$ EC". + + CLOSE + ----- +EFfile$ Close the output file and change its name to "file". +EC Close the input file. + + DELETE + ------ +EDfile$ Delete the file. + + COPY + ---- +E_old$new$ Make a copy of file "old" and name it "new". + + LINK + ---- +EQfrom$to$ Create a link named "from" pointing to the file "to". + + RENAME + ------ +ENold$new$ Rename the file "old" to have name "new". + + +Q-REGISTERS +=========== +:Iqstring$ Insert string into Q-reg q, replacing prior contents. +n:Iq Insert char with ASCII code n into Q-reg q, replacing prior contents. +^:Iqxstringx Same as :Iqstring$, where string is delimited by any char x. +m,n:Iq Same as n:Iq, but inserts m copies of char. +nUq Inserts number n in Q-reg q; returns no value. +m,nUq Inserts number n in Q-reg q; returns m. +kXq Inserts text range k into Q-reg q, replacing prior contents. +k^Xq Same as kXq, but appends text to q's contents. +kFXq Same as X and K combined, i.e., "kXq kK". +nFWXq Combines nFW with Xq. +nFLXq Combines nFL with Xq. +Gq Inserts text (or decimal representation of number) from Q-reg q into buffer. + FS INSLEN$ is set to length of inserted string. +%q Increments numeric contents of Q-reg q and returns result. +[q Push text or number from Q-reg q onto Q-reg push-down list. +]q Pop text or number from Q-reg push-down list into Q-reg q. +FQq Value = number of char in Q-reg q or -1 if a number. + + +MACROS +====== + + EXECUTE + ------- +m,nMqstring$ Execute string or buffer contents of Q-reg q as a TECO command. If q + contains a number, execute the corresponding |R-mode character. + + ARGUMENTS + --------- +|X Value is m, first arg to m,nMq. Only used inside macros. +|Y Value is n, second arg to m,nMq (or only arg to nMq). +F|X Value is all args to kMq. +F|Y Value is number of args to kMq. +|]|X Reads and returns string arg which follows kMq. + + ITERATION + --------- +n< cmd > Command is executed n times, or indefinitely if n is null. +n; Does nothing if n<0, otherwise passes control to char after next ">", + i.e., terminates iteration. Null n => use value of last search. + + TEST AND BRANCH + --------------- +arg"x then-cmd '"# else-cmd ' + Conditional which checks arg according to condition x; discards arg; + executes then-cmd if condition was true, else-cmd if false. +arg"x then-cmd ' + Conditional without else-cmd. +argF"x Same as arg"x, but passes first arg to then-cmd or else-cmd. + Note: The conditions x are: + B Arg is ASCII code for a delimiter(see ..D). + C Arg is ASCII code for a non-delimiter. + E Arg = 0. + G Arg > 0. + L Arg < 0. + N Arg .NEQ. 0. + + TAG + --- +!label! Defines label, or brackets comments. + + GOTO + ---- +Olabel$ Sends command execution to character after !label!. + + +Compiled by: Mike Wirth (MCW@MIT-MC) + Oct. 29, 1976 + \ No newline at end of file diff --git a/doc/_teco_/tecord.1132 b/doc/_teco_/tecord.1132 new file mode 100755 index 00000000..d995bae0 --- /dev/null +++ b/doc/_teco_/tecord.1132 @@ -0,0 +1,5253 @@ + 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.) + +^@: +^@ for nonnegative , is the same as ".,.+". + For negative , is the same as ".+,.". + "10^@XA" puts the 10 characters after the pointer + in a string in qreg A. + ,0^@ returns -; this is often useful. + ,*0^@ returns -; it undoes the ",". + In other words, it extracts the first of two args. + If you want instead of -, use another ,0^@. +,^@ + returns the value -. +,:^@ + returns ,. + +^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 + 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 sets the FS LINES flag to . Like "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 like "^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 + bigprints 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: = * (4 ** ) + where is the explicit argument, if any, or + 1 otherwise. An explicit argument is given with ^V or + by control-digits. 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, -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, :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, 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, L. + + ^O inserts a CRLF, then backs over it. + "^Ofoo" is equivalent to "foo^M" but + often requires less redisplay. + With argument, inserts 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, -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 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: +^S if is positive, sleep for 30ths of a + second. If is negative, sleep until system + run time (what FS UPTIME gets) = -. + + 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 "(". + +:^S sleep for at most 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 ^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. +^V is equivalent to FS PUSHPT. It pushes onto + the ring buffer unless equals whatever is at the + top of the ring buffer. +:^V pushes 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. +^Z inserts 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 ^] (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 + 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) + +^^ + (ctl caret) has the value of the 7-bit ASCII + code for . + +^_ (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. + +!