Standard TECO Page 100 Programming Aids A question mark entered betweeen any two commands in a command string causes TECO to print all subsequent commands at the terminal as they are executed. Commands will be printed as they are executed until another question mark character is encountered or the command string terminates. 5.18.5 Convenience Characters In addition to the characters mentioned in Section 5.18.1, there are several characters which have no special meaning to TECO but which may be used to help format your TECO programs and command strings. Judicious use of these commands will make your program easier to read and maintain. These characters are described in the table below: TABLE 5-18A: CONVENIENCE CHARACTERS CHARACTER MEANING A null (ASCII 0) encountered as a TECO command will be ignored. Numeric values are not affected. A null read in from an input file will be discarded (except under RSX-11 and VAX/VMS). A null typed in from a terminal will be ignored. An ESCAPE that is executed as a TECO command (as distinct from an ESCAPE that is part of the syntax of some other TECO command) is ignored by TECO; however any pending numeric values are discarded. This command is useful for discarding the value returned from a command (such as n%q) when that value is not needed. ^[ Same as . Like any other TECO command that is a control character, it may be entered in up-arrow mode. In that mode, ^[ is useful on systems whose line-printer spoolers do not visibly print the ESCAPE character. On some older terminals, there is no ESCAPE key. Instead, there may be a key labelled ALTMODE or PREFIX which sends TECO a character whose ASCII value is 175 or 176. In such a case, TECO will treat these characters as if they were typed in as an ESCAPE (Octal 33), provided lower to upper case conversion is enabled. $ (dollar sign) Same as , but as a command only, not Standard TECO Page 101 Programming Aids as a string terminator. [TECO-10 only] Note that and
are valid TECO commands and must not be used as aids to formatting TECO programs. 5.18.6 Memory Expansion The nEC command can be used to make TECO reclaim lost space after it had expanded memory usage. nEC tells TECO to expand or contract until it uses nK words of memory. If this is not possible, then TECO's memory usage does not change. The 0EC command tells TECO to shrink back to its original size (use the least amount of memory possible). [TECO-10 only] 5.18.7 Case Control The and TECO commands are used to specify automatic case control for alphabetic characters typed into strings. TABLE 5-18B: CASE CONTROL CHARACTERS CHARACTER MEANING ^V puts TECO into lower case conversion mode. In this mode, all alphabetic characters in string arguments are automatically changed to lower case. This mode can be overridden by explicit case control within the search string. This command makes all strings behave as if they began with a ^V^V. [TECO-10 only] ^W puts TECO into upper case conversion mode. In this mode, all alphabetic characters in string arguments are automatically changed to upper case. This mode can be overriden by explicit case control within the search string. This command makes all strings behave as if they began with ^W^W. [TECO-10 only] 0^V Returns TECO to its original mode. No special case conversion occurs within strings except those case conversions that are explicitly specified by ^V and ^W string build constructs located within the string. [TECO-10 only] 0^W Same as ^V. [TECO-10 only] Standard TECO Page 102 Manipulating Large Pages 5.19 MANIPULATING LARGE PAGES TECO is designed to operate most efficiently when editing files that contain no more than several thousand characters per page. (TECO storage includes Q-register storage and buffer space. The size of the text storage area is dynamic and depends on the amount of available memory.) If any page of an input file is too large to fit in the text area, the TECO input commands will terminate reading that page into memory when the first line feed is encountered after a point that the buffer is 3/4 full. (See appendices for details.) You can make room by positioning the pointer past a section of text at the beginning of the buffer and moving that section out of the buffer with the commands: 0,.PW0,.K It is sometimes advantageous to restrict the amount of the file that is present in the buffer. For example, each insert and delete command must move the entire text that is beyond the point of insertion or deletion. An operation that does many small inserts or deletes may therefore run extremely slowly if the text buffer is large. Such an operation can be sped up substantially by reading the input file with n:A commands and explicitly writing the processed text. Standard TECO Page 103 Techniques 5.20 TECHNIQUES AND EXAMPLES The most elementary TECO application, described in Chapter 1 of this manual, is creating and editing ASCII files on-line. The user enters short command strings, often consisting of a single command, and proceeds from task to task until the file is completely edited. Since every editing job is simply a long sequence of TECO commands, you may accomplish an entire job with one long command string made up of all the short command strings placed end to end with the intervening double ESCAPE characters removed. A long command string that performs a certain editing task can be considered a TECO "editing program". Editing programs may be written (using TECO) and stored in the same manner as any other ASCII file. Whenever the program is needed, it may be read into the buffer as text, stored in a Q-register, and executed by an Mq command. For more complex editing jobs, you may want to write and maintain a collection of specialized "editing subroutines." TECO subroutines can perform such elementary functions as replacing every occurrence of two or more consecutive spaces with a tabulation character, for example, or ensuring that words are not hyphenated across a page boundary. When an editing problem arises, you can load the right combination of subroutines into various Q-registers, augment them with additional commands if necessary, and call them by a "mainline" command string. Editing subroutines are essentially macros; that is, sequences of commands which perform commonly required editing functions. The most powerful application of TECO is the creation and use of a macro library. As you perform an editing job, look for sequences of operations which might be required in future editing assignments. Load all of the TECO commands required to perform such an operation into a Q-register. When the job is finished, write the contents of the Q-register onto an output file (via the buffer) and save it in the macro library. The nMq and m,nMq commands, which were designed to facilitate use of macros, permit run-time numeric arguments to be passed to a macro. TECO macros can preserve the user's radix, flag values, etc. By using the Q-register push-down list, the macro can save and then restore values and/or text. For example: [0 [1 [2 ! Save contents of Q-registers 0, 1 and 2 ! +0U0 ! Put any calling argument into Q-register 0 ! 10U1 ! Put a 10 (if radix is decimal) or 8 (if radix is octal) into Q-register 1 ! ^D ! Ensure that the current radix is now decimal ! EUU2 ! Save the case flagging flag ! -1EU ! Ensure no case flagging ! Q0"E 3U0 ' ! Default calling argument to 3 ! ... Standard TECO Page 104 Techniques Q2EU ! Restore the case flagging flag ! 10-Q1"N ^O ' ! Restore radix as octal if needed ! ]2 ]1 ]0 ! Restore contents of Q-registers 2, 1, and 0 ! The EI command is particularly useful for executing macros from a library, since with it they may be read without disturbing the current input file. This makes it unnecessary to plan in advance which macros might be needed; it also saves Q-register storage space. You can retrieve two kinds of TECO command files with an EI command: a file containing a TECO command that loads the macro into a Q-register for later use, or a file containing just the macro (which must be retrieved with EI each time it is used). The following examples are intended to illustrate some of the techniques discussed above. It would not be practical to include examples of the use of every TECO command, since most of the commands apply to many diverse situations. Instead, you are encouraged to experiment with the individual commands on scratch files. EXAMPLE 1: SPLITTING, MERGING, AND REARRANGING FILES Assume that there is a file named PROG.DAT on the system disk and that this file contains data in the following form: AB CD EF GH IJ KL MN OP where each of the letters A, B, C etc., represents 20 lines of text and represents a form feed character. The user intends to rearrange the file so that it appears in the following format: AOB D MN EF ICJ KL P GH The following sequence of commands will achieve this rearrangement. (Search command arguments are not listed explicitly.) Start TECO. *2ED$$ Allow all Y commands. *EBPROG.DAT$Y$$ Specify input file and get first page. *NC$$ Search for a character string in C, writing A and B on the output file. *J20X1$$ Save all of C in Q-register 1. *20K$$ Delete C from the buffer. *NG$$ Search for a character string in G, writing D, E, and F on the output file. *HX2$$ Save G and H in Q-register 2. *Y$$ Delete GH from the buffer and read IJ. *20L$$ Move the pointer to the beginning of J. *G1$$ Insert C, which was stored in Q-register 1. *NM$$ Search for a character string in M, writing ICJ and KL on the output file. Standard TECO Page 105 Techniques *HX1$$ Save MN in Q-register 1 (the previous contents is overwritten). *Y$$ Delete MN and read OP *J20X3$$ Save all of O in Q-register 3. *20K$$ Delete O from the buffer. *PWHK$$ Write P onto the output file, appending a form feed, and clear the text buffer. *G2$$ Bring GH into the buffer from Q-register 2. *HPEF$$ Write GH on the output file and close it. *EBPROG.DAT$Y$$ Open the partially revised file. *20L$$ Move the pointer to the beginning of B. *G3$$ Insert all of O from Q-register 3. *ND$$ Search for a character string in D writing AOB on the output file. *PWHK$$ Write D on the output file and clear buffer. *G1$$ Bring all of MN from Q-register 1 into the buffer. *EX$$ Write MN onto the output file, then close the file and exit. At this point the file has been rearranged in the desired format. Of course, this rearrangement could have been accomplished in fewer steps if the commands listed above had been combined into longer command strings. Note that the asterisks shown at the left margin in this example are generated by TECO, and not typed by the user. Assume, now, that the same input file, containing data in the form: AB CD EF ... OP is to be split into two separate files, with the first file containing AB CD and the second file containing KL M, while the rest of the data is to be discarded. The following commands could be used to achieve this rearrangement: Start TECO. *2ED$$ Allow all Y commands. *ERFILE$EWFILE1$$ Open the input file and the first output file. *Y$$ Read AB into the buffer. *P$$ Write AB onto the output file and read CD into the buffer. *HPEF$$ Write CD onto the output file (without appending a form feed), and close the first output file. *_K$$ Search for a character string in K. After this command has been executed, the buffer will contain KL. No output is generated. *EWFILE2$P$$ Open the second output file and write KL onto it. Read MN into the buffer. *20L0,.P$$ Move the pointer to the end of M, then write Standard TECO Page 106 Techniques M onto the output file. *EF$$ Close the output file. *HKEX$$ Clear the buffer and exit. As a final example of file manipulation techniques, assume that there are two files. One file is MATH.ONE, which contains information in the form: AB CD EF GH IJ KL and the other is MATH.TWO, which contains: MN OP QR If both of these files are stored on DK1, the following sequence of commands may be used to merge the two files into a single file, MATH.NEW, which contains all of MATH.TWO followed by the latter half of file MATH.ONE in the following format: MN OP QR GH IJ KL Start TECO. *2ED$$ Allow all Y commands. *ERDK1:MATH.TWO$$ Open the first input file. *EWMATH.NEW$$ Open the output file on the default device. *Y$$ Read MN into the text buffer. *NR$$ Search for a character string in R, writing MN and OP onto the output file. *PW$$ Write QR onto the output file, appending a form feed. *ERDK1:MATH.ONE$$ Open the second input file. *HKY$$ Read AB into the buffer. QR is over-written. *_G$$ Search for a character string in G, deleting AB, CD, and EF, leaving GH in the buffer. *NK$$ Search for a character string in K, writing GH and IJ on the output file, leaving KL in the buffer. *HPEFHKEX$$ Write KL onto the output file (without appending a form feed) and close the file, then exit. EXAMPLE 2: ALPHABETIZING BY INTERCHANGE SORT Assume that TECO is running and that the buffer contains many short lines of text beginning with an alphabetic character at the left margin (i.e., immediately following a line feed). The lines might consist of names in a roster, for example, or entries in an index. The following command string will rearrange the lines into rough alphabetical order, grouping all lines which begin with the character "A" at the beginning of the page, followed by all lines with "B", and so on. Note that the algorithm could be extended to place the entries in strict alphabetical order by Standard TECO Page 107 Techniques having it loop back to perform the same sorting operation on successive characters in each line. !START! J 0AUA !Load first character of first line into Q-register A ! !CONT! L 0AUB !Load first character of next line into Q-register B ! QA-QB"G XA K -L GA 1UZ ' !If A>B, switch the lines and set a flag (Q-register Z) ! QBUA !Load B into A ! L Z-."G -L @O/CONT/ ' !Loop back if there is another line in the buffer ! QZ"G 0UZ @O/START/ ' !Repeat if a switch was made on the last pass ! The same algorithm can be coded in a more structured way as follows: 0UZ !clear repeat flag! B, switch the lines and set a flag ! QBUA !Load B into A ! L .-Z;> !Loop back if there is another line in the buffer ! QZ;> !Repeat if a switch was made on the last pass ! This example is a bit shorter and does not use any GOTOs. It will also run somewhat faster. Standard TECO Page 108 Appendix A APPENDIX A OCTAL & DECIMAL ASCII CHARACTER SET CHAR OCT DEC CHAR OCT DEC CHAR OCT DEC CHAR OCT DEC NUL 000 000 SP 040 032 @ 100 064 ` 140 096 ^A 001 001 ! 041 033 A 101 065 a 141 097 ^B 002 002 " 042 034 B 102 066 b 142 098 ^C 003 003 # 043 035 C 103 067 c 144 099 ^D 004 004 $ 044 036 D 104 068 d 144 100 ^E 005 005 % 045 037 E 105 069 e 145 101 ^F 006 006 & 046 038 F 106 070 f 146 102 ^G 007 007 ' 047 039 G 107 071 g 147 103 BS 010 008 ( 050 040 H 110 072 h 150 104 TAB 011 009 ) 051 041 I 111 073 i 151 105 LF 012 010 * 052 042 J 112 074 j 152 106 VT 013 011 + 053 043 K 113 075 k 153 107 FF 014 012 , 054 044 L 114 076 l 154 108 CR 015 013 - 055 045 M 115 077 m 155 109 ^N 016 014 . 056 046 N 116 078 n 156 110 ^O 017 015 / 057 047 O 117 079 o 157 111 ^P 020 016 0 060 048 P 120 080 p 160 112 ^Q 021 017 1 061 049 Q 121 081 q 161 113 ^R 022 018 2 062 050 R 122 082 r 162 114 ^S 023 019 3 063 051 S 123 083 s 163 115 ^T 024 020 4 064 052 T 124 084 t 164 116 ^U 025 021 5 065 053 U 125 085 u 165 117 ^V 026 022 6 066 054 V 126 086 v 166 118 ^W 027 023 7 067 055 W 127 087 w 167 119 ^X 030 024 8 070 056 X 130 088 x 170 120 ^Y 031 025 9 071 057 Y 131 089 y 171 121 ^Z 032 026 : 072 058 Z 132 090 z 172 122 ESC 033 027 ; 073 059 [ 133 091 { 173 123 FS 034 028 < 074 060 \ 134 092 | 174 124 GS 035 029 = 075 061 ] 135 093 } 175 125 RS 036 030 > 076 062 ^ 136 094 ~ 176 126 US 037 031 ? 077 063 _ 137 095 DEL 177 127 Standard TECO Page 109 Appendix B APPENDIX B ERROR MESSAGES TECO error messages consist of a three letter message preceded by a question mark (?) or preceeded by ?TEC. A short description of the error optionally follows (dependent on the current value of the EH flag). Typing ? (question mark) immediately after an error message printout causes the command string to be printed up to and including the character which causes the error message. Typing *q (asterisk, Q-register name) immediately after an error message printout saves the entire command string in the specified Q-register. This is especially useful for recovering mistyped insert commands. Both the ? and *q facilities may be used when an error occurs. TECO-11 also produces two warning messages. These messages do not abort the command and execution continues. %Superseding existing file Indicates that the file to be created as the result of an EW command already exists. If the output file is closed the old copy of the file will be deleted. The EK command may be used to "take back" the EW command. %Search fail in iter Indicates that a search command has failed inside iteration brackets. A ; (semi-colon) command immediately following the search command can typically be used to suppress this message. After printing the message, the iteration is terminated, i.e., TECO simulates a 0; command. These error messages are listed alphabetically by their three-letter code. In general, these three-letter codes have the same meaning on all implementations, although not all error messages are produced by each implementation. The one-line error message given here is a paraphrasing of the message given, which may differ slightly from system to system. Standard TECO Page 110 Appendix B ?ARG Improper Arguments Three arguments are given (a,b,c or H,c). ?BNI > not in iteration There is a close angle bracket not matched by an open angle bracket somewhere to its left. (Note: an iteration in a macro stored in a Q-register must be complete within the Q-register.) ?CCL CCL.SV not found or EG argument too long The EGcommand$ command on OS/8 was unable to locate SYS:CCL.SV or the specified command has more than 46 characters. ?CON Confused use of conditionals Conditionals, parenthesized arguments, and iterations must be properly nested. The user probably used some construct like: N"E...(...' where an iteration or parenthesized argument is begun in a conditional but not terminated in the same conditional. ?CPQ Can't pop into Q-register A ] command has been executed and there is nothing saved on the Q-register push down list. ?DEV Invalid device A file specification string in an E command contains an unknown device name. ?DTB Delete too big An nD command has been attempted which is not contained within the current page. ?ERR RSTS/E error message (RSTS/E only) Some RSTS/E monitor call failed. The error message text explains the error. ?FER File Error The file specified in an ER, EW or EB command was not found. ?FNF File not found "filespec" The requested input file could not be located. If this occurred within a macro the colon modified ER or EB command may be necessary. ?FUL Output Command would have overflowed output device The page of text currently in the text buffer will not fit in the open output file. Until enough free space can be obtained on the output device the file may have to be split. An EF command to close the current output file, followed by a new EW command to a temporary file may be used. The files should Standard TECO Page 111 Appendix B be concatenated when the space problem is alleviated. ?ICE Illegal ^E Command in Search Argument A search argument contains a ^E command that is either not defined or incomplete. The only valid ^E commands in search arguments are: ^EA, ^ED, ^EV, ^EW, ^EL, ^ES, ^E, and ^E[A,B,C,...]. ?IEC Illegal character "x" after E An invalid E command has been executed. The E character must be followed by an alphabetic to form a legal E command (i.e., ER or EX). ?IFC Illegal character "x" after F An invalid F command has been executed. ?IFN Illegal character "x" in filename The filespec as an argument to one of the E commands is unacceptable to the system. The file specification must be appropriate to the system in use. ?IIA Illegal insert arg A command of the form "nItext$" was attempted. This combination of character and text insertion is illegal. ?ILL Illegal command "x" An attempt has been made to execute an invalid TECO command. ?ILN Illegal number An 8 or 9 has been entered when the radix of TECO is set to octal. ?INP Input error The system has reported an error attempting to read the current input file. The text buffer may be corrupt. This operation may be retried, but if the error persists, you may have to return to a backup file. ?IPA Negative or 0 argument to P The argument preceding a P or PW command is negative or 0. ?IQC Illegal " character One of the valid " commands did not follow the ". Refer to Section 5.14 (conditional execution commands) for the legal set of commands. Standard TECO Page 112 Appendix B ?IQN Illegal Q-register name "x" An illegal Q-register name was specified in one of the Q-register commands. ?IRA Illegal radix argument to ^R The argument to a ^R radix command must be 8, 10, or 16. ?ISA Illegal search arg The argument preceding a search command is 0. This argument must not be 0. ?ISS Illegal search string One of the search string special characters (^Q, ^V, ^W, etc.) would have modified the search string delimiter (usually ESCAPE). ?IUC Illegal character "x" following ^ The character following an ^ must have ASCII value between 100 and 137 inclusive or between 141 and 172 inclusive. ?MAP Missing ' Every conditional (opened with the " command) must be closed with the ' command. ?MEM Memory overflow Insufficient memory available to complete the current command. Make sure the Q-register area does not contain much unnecessary text. Breaking up the text area into multiple pages might be useful. (See section 5.19.) ?MLA Missing Left Angle Bracket There is a right angle bracket that has no matching left angle bracket. An iteration must be complete within the macro or command. ?MLP Missing ( There is a right parenthesis that is not matched by a corresponding left parenthesis. ?MRA Missing Right Angle Bracket There is a left angle bracket that has no matching right angle bracket. An iteration must be complete within the macro or command. ?MRP Missing ) There is a right parenthesis that is not matched by a corresponding left parenthesis. ?MSC Missing Start of Conditional A ' command (end of conditional) was encountered. Every ' command must be matched by a preceding " Standard TECO Page 113 Appendix B (start of conditional) command. ?NAB No arg before ^_ The ^_ command must be preceded by either a specific numeric argument or a command that returns a numeric value. ?NAC No arg before , A command has been executed in which a , is not preceded by a numeric argument. ?NAE No arg before = The =, ==, or === command must be preceded by either a specific numeric argument or a command that returns a numeric value. ?NAP No arg before ) A ) parenthesis has been encountered and is not properly preceded by a specific numeric argument or a command that returns a numeric value. ?NAQ No arg before " The " commands must be preceded by a single numeric argument on which the decision to execute the following commands or skip to the matching ' is based. ?NAS No arg before ; The ; command must be preceded by a single numeric argument on which the decision to execute the following commands or skip to the matching > is based. ?NAU No arg before U The U command must be preceded by either a specific numeric argument or a command that returns a numeric value. ?NCA Negative argument to , A comma was preceded by a negative number. ?NYA Numeric argument with Y The Y command must not be preceded by either a numeric argument or a command that returns a numeric value. ?NFI No file for input Before issuing an input command, such as Y, it is necessary to open an input file by use of a command such as ER or EB. ?NFO No file for output Before issuing an output command such as N search or P it is necessary to open an output file by use Standard TECO Page 114 Appendix B of a command such as EW or EB. ?NPA Negative or 0 argument to P A P command was preceded by a negative or 0 argument. ?NRO No room for output The output device is too full to accept the requested output file. ?NYI Not Yet Implemented A command was issued that is not yet implemented in this version of TECO. ?OFO Output file already open A command has been executed which tried to create an output file, but an output file currently is open. It is typically appropriate to use the EC or EK command as the situation calls for to close the output file. ?OUT Output error The system has reported an error attempting to do output to the output file. Make sure that output device did not become write locked. Use of the EF command (or EK if necessary) and another EW can be considered until the condition is fixed. ?PES Attempt to Pop Empty Stack A ] command (pop off q-register stack into a q-register) was encountered when there was nothing on the q-register stack. ?PDO Push-down list overflow The command string has become too complex. Simplify it. ?POP Attempt to move Pointer Off Page with "x" A J, C or R command has been executed which attempted to move the pointer off the page. The result of executing one of these commands must leave the pointer between 0 and Z, inclusive. The characters referenced by a D or m,nX command must also be within the buffer boundary. ?SNI ; not in iteration A ; command has been executed outside of an open iteration bracket. This command may only be executed within iteration brackets. ?SRH Search failure "text" A search command not preceded by a colon modifier and not within an iteration has failed to find the specified "text". After an S search fails the Standard TECO Page 115 Appendix B pointer is left at the beginning of the buffer. After an N or _ search fails the last page of the input file has been input and, in the case of N, output, and the buffer is cleared. In the case of an N search it is usually necessary to close the output file and reopen it for continued editing. ?STL String too long A search or file name string is too long. This is most likely the result of a missing ESCAPE after the string. ?TAG Missing Tag !tag! The tag !tag! specified by an O command cannot be found. This tag must be in the same macro level as the O command referencing it. ?UTC Unterminated command "x" This is a general error which is usually caused by an unterminated insert, search, or filespec argument, an unterminated ^A message, an unterminated tag or comment (i.e., unterminated ! construct), or a missing ' character which closes a conditional execution command. ?UTM Unterminated macro This error is the same as the ?UTC error except that the unterminated command was executing from a Q-register (i.e., it was a macro). (Note: An entire command sequence stored in a Q-register must be complete within the Q-register.) ?XAB Execution aborted Execution of TECO was aborted. This is usually due to the typing of . ?WLO System Device Write-Locked TECO-8 needs to write on the system device when it is running in less than 16K (less than 20K if VT52 is present) so that it can later swap in overlays. ?YCA Y command aborted An attempt has been made to execute an Y or _ search command with an output file open, that would cause text in the text buffer to be erased without outputting it to the output file. The ED command (section 5.16) controls this check. ?nnn I/O Error or Directive Error (RSX-11 only) All errors from the executive and file system are reported in this format, where nnn is the decimal I/O or directive error status. The accompanying message is the corresponding message from the QIOSYM message file. A complete list of I/O and Standard TECO Page 116 Appendix B directive errors appears in appendices to the various Executive reference manuals and in the IAS/RSX-11 I/O Operations Reference Manual. Standard TECO Page 117 Appendix C APPENDIX C Incompatible, Obsolete, and System-Specific Commands This appendix describes commands that are peculiar to specific operating systems. These commands fall into many categories. Some are obsolete, and are kept around only as a convenience to the user. Others are so system specific or so obscure that it was felt best not to include them in the main body of the manual. Some are incompatible across operating systems. Some are new commands that have not become firmly established and may change in the future. In general, use these commands at your own risk and with the understanding that in future releases of TECO, these commands may change or go away completely. Implementors of TECO on other operating systems should contact the TECO SIG before implementing any of these features. C.1 SPECIFIC FEATURES OF TECO-11 C.1.1 TECO Commands Command Description m,nStext$ Performs the same function as the nS command, but m serves a bound limit for the search. If the search string can be found without moving the pointer more than ABS(m)-1 places, the search succeeds and the pointer is repositioned to immediately after the last character of the string. Otherwise, the pointer is left unchanged. The ^Q operator, described below, is useful in conjunction with this command. Note that m,Stext$ is identical to m,1Stext$ and m,-Stext$ is identical to m,-1Stext$. m,-nStext$ Performs the same function as the m,nS command, but searches in the reverse direction. 0,nStext$ Performs the same function as the nS command, except that the pointer position will remain unchanged on search string failure. (Essentially an unbounded search with no pointer movement on failure.) G* Get most recent filespec string. The asterisk represents TECO's filespec string area, which contains the fully expanded filespec of the last E command (see appendices). Copy the contents of the filespec string area into the buffer at the current position of the buffer pointer, leaving Standard TECO Page 118 Appendix C the pointer positioned after the last character copied. :G* Print the contents of the filespec buffer on the terminal. G_ Get most recent search string. The underscore (backarrow) represents TECO's search string area. Copy the contents of the search string area into the buffer at the current position of the buffer pointer, leaving the pointer positioned after the last character copied. :G_ Print the contents of the search string buffer on the terminal. n^Q n^QC is identical to nL. The n^Q command returns the number of characters between the buffer pointer and the nth line separator (both positive and negative). This command converts line oriented command argument values into character oriented argument values. Used after an expression. m,-256+n:W Inserts characters at "dot" until... Characters are read (echo off) from the terminal and inserted at "dot" until and according to the microcoded bits in n. The terminating character is not inserted. 128 => Return immediately if no typed characters 64 => Terminate on any character 32 => Don't keep screen updated (i.e., no -1W) 8 => Treat m as terminating character(s) 4 => Convert any alphabetic inserts to upper case 2 => Terminate on 1 => Screen is initially O.K. Control characters (octal 0 through 37 and 177 except ) are always terminating characters. The returned value has the terminating character code in low byte (octal 0 through 177 or 377 for returned immediately). The sign bit is set if one or more inserts were done. The return value may be a character code that normally would have been inserted, but could not be for some reason (e.g., convert alphabetic inserts to upper case requested, but not supported in this implementation). The m of m,-256+n:W is always optional. If bit value 8 of n is set, m contains up to two additional termination character codes, one in the Standard TECO Page 119 Appendix C low 8 bits (low byte) and another in the high 8 bits (high byte). If only one extra termination character is desired, it is placed simply placed in m thus setting the high 8 bits to zero (which is already a termination character). If bit value 8 of n is not set, passing the m argument is undefined... C.1.2 String Build Constructs Construct Description Q* Q* indicates that the string stored in the filespec buffer is to be used in the position occupied by the ^EQ* in the search string. Q_ Q_ indicates that the string stored in the search string buffer is to be used in the position occupied by the ^EQ_ in the search string. Standard TECO Page 120 Appendix C C.2 SPECIFIC FEATURES OF RT-11 C.3 SPECIFIC FEATURES OF RSTS/E TECO COMMANDS Command Description :EGRTS$ Switch to private default run-time-system. :EGRTS foo$ Switch to RTS "foo". :EGFSS string$ File string scan "string". :EGCCL cmd$ Try "cmd" as a CCL command. :EGRUN file$ Try to run "file". :EGRUN file=xx$ Try to run "file" with "xx" placed in core common. :EGEMT$ Issue a monitor directive. The FIRQB is loaded from Q-registers A through P and the XRB is loaded from Q-registers Q through W. The low byte of the value in Q-register A is the monitor EMT code to issue. If the high byte of the value in Q-register A is >0 then the text part of Q-register A is put into the XRB for a 'write' (XRLEN= size of A, XRBC=size of A, XRLOC->A); if Q-register A high byte is <0 then the text part of Q-register A is put into the XRB for a 'read' (XRLEN=size of A, XRBC=0, XRLOC->A). Returned value is -1 for success, 0 for unrecognized command, or >0 for the RSTS/E error code. The FIRQB is placed in the numeric part of Q-regs A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P. The XRB is placed in the numeric part of Q-regs Q, R, S, T, U, V, W. SWITCHES Switch Description / Same as /B+ Standard TECO Page 121 Appendix C C.4 SPECIFIC FEATURES OF RSX-11/M, RSX-11/D, and IAS Command Description Returns control to the operating system immediately. Equivalent to typing . C.5 SPECIFIC FEATURES OF VAX/VMS Command Description Returns control to VAX/VMS immediately. Equivalent to typing . EG$ Exit with special status TECO's normal exit status code (as reflected by the DCL symbols $STATUS and $SEVERITY) is 1 (success). If the exit was due to an EG$ command, the exit status code is 9 (also success). :EGSYM symbol_name symbol_value$ Defines the DCL local symbol "symbol_name" with a value string of "symbol_value". Useful for creating symbols that will be used by a command procedure upon TECO's exit. C.6 SPECIFIC FEATURES OF OS/8 Command Description If used as the first keystroke after TECO's prompt, this command is the same as *Z, that is, it saves the last command string in Q-register Z. This command echoes as *Z and does not have to be followed by an ESCAPE. C.7 SPECIFIC FEATURES OF TOPS-10 Command Description nEM Positions a magtape. You must open the magtape for input with an appropriate ER command before it can be positioned. Exact positioning depends on the value of n, as described below. You must reopen the magtape for output before you can output to it. [TECO-10 only] Standard TECO Page 122 Appendix C Value Action 1EM Rewind the currently-selected input magtape to load point. EM is identical to 1EM. 3EM Write an end-of-file record. 6EM Skip ahead one record. 7EM Back up one record. 8EM Skip ahead to logical end of tape (defined by two successive end-of-file marks). Leave the magtape positioned between the two end-of-file marks so that successive output correctly overwrites the second EOF. 9EM Rewind and unload. 11EM Write 3 inches of blank tape. 14EM Advance tape one file. This leaves the tape positioned so that the next item read will be the first record of the next file (or the second end-of-file mark at the logical end-of-tape). 15EM Backspace tape one file. This leaves the tape positioned so that the next item read will be the end-of-file mark preceding the file backspaced over (unless the file is the first file on the tape). n^Q n^QC is identical to nL. This command returns the number of characters between the buffer pointer and the nth line separator (both positive and negative). This command converts line oriented command argument values into character oriented argument values. Used after an expression. F0 Pointer position of start of window. Same as 6:W. FZ Pointer position of end of window. FH Same as F0,FZ. FX Software maintained horizontal coordinate of location of cursor on screen (0-origin). Updated by TECO on terminal output. If TECO cannot determine the updated location of the cursor, this value is set to -1. Standard TECO Page 123 Appendix C nFX Set value of FX register to n. FY Software maintained vertical coordinate of location of cursor on screen (0-origin). Updated by TECO on terminal output. If TECO cannot determine the updated location of the cursor, this value is set to -1. nFY Set value of FY register to n. FP Equivalent to FY,FX. m,nFP Equivalent to mFYnFX. m,nFF Updates FY and FX registers as if the m,nT command were executed. nFF Assumes that the scope cursor is pointing at the character that is just to the right of the text buffer pointer (the current character). Then this command advances n screen lines and goes to the end of that line and returns that pointer position. nFQq Compares characters beginning at dot with characters beginning at the nth character in Q-register q (0-origin). When a match fails or the match ends, this command moves the pointer to after the last character that matched and returns the index into the Q-register. E=filespec$ Renames the input file. E&filespec$ Run the specified program when TECO exits. Can take a numeric argument which is the run-offset. 0 is the default. m,nE* Does an arbitrary TRMOP to your terminal. [Not available on TOPS-20.] ::Gq Same as :Gq but types literally. ::ER Same as ER but no defaults are used. ^Z Closes output file and exits from TECO. ^P Returns current page number. n^P Executes P commands until page n has been reached. n^Y Executes Y commands until page n has been reached. n,m= Same as m=n^T. Standard TECO Page 124 Appendix C m,n:^T Does an arbitrary TTCALL. Standard TECO Page 125 Appendix D APPENDIX D RT-11 OPERATING CHARACERISTICS D.1 STARTUP TECO is started with the .R TECO command. TECO is now immediately ready to accept commands. The text buffer and Q-register areas are empty. The EDIT command .EDIT/TECO filespec is used to edit an already existing file. It is equivalent to .R TECO *EBfilespec$Y$$ For those RT-11 users that will use TECO as the primary editor, a monitor SET command is provided: .SET EDITOR TECO Once this command is issued, the /TECO option on the EDIT command is no longer necessary since the default editor is now TECO. Since this SET command only has affect between system bootstraps, it is recommended that the command be placed in the appropriate startup file (e.g., STARTS.COM). Now, assuming the SET command has been issued, the command .EDIT filespec can be used to edit an already existing file. The standard RT-11 EDIT command options are all available with TECO. .EDIT/CREATE filespec .EDIT/INSPECT filespec .EDIT/OUTPUT:filespec filespec Another option, /EXECUTE, is also available: .EDIT/EXECUTE[:string] filespec The /EXECUTE option causes TECO to process the filespec (assumed .TEC filetype) as a set of TECO commands. If "string" is used, Standard TECO Page 126 Appendix D the string is placed into TECO's text buffer. If "string" contains only alphanumeric characters, it does not have to be enclosed in quotes. If it is to contain blanks, it must be quoted with single quotes. The equivalent TECO commands would be .R TECO *ERfilespec$YHXZHKIstring$MZ$$ Note the input file remains open and can provide more input to the macro. D.2 FILE SPECIFICATION The file access commands ER, EB, EI, and EW accept a file specification in the standard RT-11 format: dev:filename.type in which dev: is a physical device name or a user assigned logical name; if dev: is not specified, the default DK: is assumed. The filename field must be specified in the commands ER, EB, EI, and EW and be a legal RT-11 filename. The type field is a file extension and must be explicitly given if used (there is no default). The EB and EW commands also accept the extended notation for an output file size dev:filename.type[n] The optional [n] specifies the output file size where n is the number of blocks to be allocated. D.3 BACKUP FILES The EB command maintains one level of file backup on RT-11. The pre-edited input file name is changed to filename.BAK before the new output file is closed with the original name. Only normal file closing commands (EC, EF, EG, and EX) cause this renaming to happen. If TECO is aborted or the output file is purged by the EK command, the input filename remains unchanged. Note only one .BAK file for a given name is kept; earlier .BAK backup files are deleted each time a new backup file is created. A good policy to follow when editing is to close the edited file frequently enough so that an unexpected incident would not cause a substantial loss of work. Files should be backed up regularly. TECO has the power to let an unsuspecting user alter a good file into a completely useless state. The SRCCOM program can be used to verify an editing session. Standard TECO Page 127 Appendix D D.4 EXIT AND GO If TECO is exited via the EGstring$ command, the string is passed to the system as the next command to execute. This string may be any valid command or an indirect command file specification. D.5 REENTER AND CLOSE The RT-11 REENTER command may always be used to continue TECO. Its primary differences from running TECO is that when REENTER is used, the text buffer and Q-register areas are unmodified, as opposed to when TECO is run the text buffer and Q-register areas are cleared. The input and output file are always lost upon reentering TECO. If an output file was open before reentering TECO, the file will have to be recreated with the appropriate E-command. (Note that the monitor commands GT ON, GT OFF, LOAD, and UNLOAD disallow a REENTER.) The output file is not closed if TECO is aborted. The RT-11 CLOSE command can be used to make the output file permanent, but be aware that the output file will not be complete because of internal buffers that TECO keeps. TECO may be reentered after a CLOSE command. D.6 FILE RECOVERY TECO can be a useful tool in recovering ASCII files lost on a block replaceable device. TECO allows block replaceable devices to be opened in a non-file structured mode. This gives the user the capability to open a disk and access ASCII data anywhere on it, independent of file boundaries. The command ERdev:$ is used to open the device at which point _ (underscore or backarrow) searches may be used to locate specific ASCII data and transfer it to new output files. Note that files tend to get reproduced, in whole or part, many places on a block replaceable device; be sure to verify that any given text is indeed complete and the correct version. D.7 SYSTEM CRASH RECOVERY TECO and RT-11 are highly reliable, but if during an important edit session a random system failure should occur, the following procedure may help save some or all of the editing. 1. Bootstrap the system Standard TECO Page 128 Appendix D 2. Immediately perform a SAVE command to save as much of memory as possible into a file on SY:. The address range form of the SAVE command must be used. The SAVE command will not allow any part of the monitor to be saved, e.g., if you have a 28K system and are running SJ you cannot save 28K but only 26.3K. 3. Perform standard startup procedures, e.g., DATE. 4. Use TECO on the SAVEd file to try and recover useful parts of the edit. D.8 VT11 GRAPHICS SUPPORT If the monitor supports the VT11 graphics processor (GT ON and GT OFF work) TECO will automatically start up in display mode, adjusting to both the size of the display screen and to the presence or absence of the scroller. If the display fails to start with a working VT11, TECO has decided that there is not enough free memory and will not allocate the display file buffer or start the display. See Section 5.17 for a description of the available commands to interact with the display. Various aspects of the display screen become immediately obvious upon seeing them; the text pointer, its position and shape and its position between lines; wrap around of more than 72 characters per line; the scroller interaction and so on. Experiment with a scratch file for more familiarity. Standard TECO Page 129 Appendix E APPENDIX E RSTS/E OPERATING CHARACERISTICS E.1 STARTUP RSTS supports all of the standard TECO invocation commands, namely TECO TECO filespec TECO filespec=filespec MAKE filespec MUNG filespec MUNG filespec,text The CCL command switches /DETACH and /SIZE:n (or /SIZE:+n) can be used with TECO. If /DETACH is used and the user is privileged, TECO will detach the job before any further processing. If /SIZE:n is used, TECO will pre-expand the text and Q-register storage area to nK. If /SIZE:+n is used, TECO will set the text storage and Q-register storage area to n+4K initially (TECO's default startup size is 4K). E.2 FILE SPECIFICATION The file access commands ER, EB, EW, and EI accept a file specification in the standard RSTS/E format: dev:[p,pn]filename.ext in which dev: is a physical device name or a logical device name; if dev: is not specified, the public structure is assumed. If [p,pn] is not specified, the user's current logged in account is assumed. The filename field must be specified whenever the device name references a file structured device. The .ext field is a file extension and must be explicitly given if used. There is no default extension except for EI commands which default the .ext field to .TEC. The file specification switches /RONLY, /MODE:n, and /CLUSTERSIZE:n can be included in a file specification. TECO automatically opens all disk input files in /RONLY mode. The file size switches /FILESIZE:n and /SIZE:n might leave an output file larger than the amount of data output by TECO. These file size switches are therefore illegal and produce an error if included in a file specification. The EB and EW commands also accept the extended notation for an output file protection code Standard TECO Page 130 Appendix E dev:[p,pn]filename.ext The optional specifies the output file protection code. E.3 BACKUP FILES The EB command maintains one level of file backup on RSTS/E. The pre-edited input file name is changed to filename.BAK before the new output file is closed with the original name. Only normal file closing commands (EC, EF, EG, and EX) cause this renaming to happen. If TECO is aborted or the output file is purged by the EK command, the input filename remains unchanged. Note only one .BAK file for a given name is kept; earlier .BAK backup files are deleted each time a new backup file is created. A good policy to follow when editing is to close the edited file frequently enough so that an unexpected incident would not cause a substantial loss of work. Files should be backed up regularly. TECO has the power to let an unsuspecting user alter a good file into a completely useless state. The FILCOM program can be used to verify an editing session. E.4 EXIT AND GO If TECO is exited via the EGstring$ command, the "string" is executed as a RSTS/E CCL command after the input and output file(s) are closed. E.5 ET FLAG HANDLING Bit 6 (detach) is handled specially by TECO. Every time the ET flag is read (used as a numeric value), TECO ensures that Bit 6 is on if the job is attached or off if the job is detached. This allows a TECO macro to check for "detachedness". If a non-privileged user attempts to set Bit 6, the request is ignored and Bit 6 will read back as a 0 (assuming the job is attached). When a privileged user sets Bit 6, the job will become detached. Further reading of Bit 6 will return a 1 to indicate the detached condition. Standard TECO Page 131 Appendix F APPENDIX F RSX-11 OPERATING CHARACERISTICS F.1 STARTUP RSX-11 systems support all of the standard TECO invocation commands, namely TECO TECO filespec TECO filespec=filespec MAKE filespec MUNG filespec MUNG filespec,text If any of these commands are not recognized by the system, check with your system manager to see that TECO is properly installed. TECO macros may also be invoked with the command TECO @filespec It is exactly equivalent to MUNG filespec In systems supporting dynamic task expansion, TECO will expand its buffer space as necessary. Also, TECO'S buffer space may be explicitly allocated in the startup command RUN $TEC/INC=n F.2 INITIALIZATION TECO searches for the TECO.INI startup file in the current default device and directory. TECO's memory, in which a plain TECO command edits the file last edited with a TECO filespec or a MAKE filespec command, is implemented with a file named TECF00.TMP, also stored in the current default device and directory. The initial value of the ED flag is always 1. When TECO is initially invoked it will automatically set the ET and EU flags according to the user's terminal characteristics. If the terminal supports CRT style rubouts, then bit 1 of the ET flag is set to do the same in TECO. If the terminal supports lower case type in, then bit 2 of the ET flag is set and the EU flag is set to -1 to turn off case flagging. If the terminal is a CRT type terminal and the version of TECO includes the screen Standard TECO Page 132 Appendix F support package, then bit 9 of the ET flag is set. While the command line is being processed, bit 7 of the ET flag is also set to cause TECO to exit should any errors occurr. ET bit 7 is cleared every time TECO reaches prompt (*) level. F.3 FILE SPECIFICATION The file access commands ER, EB, EW, and EI accept a file specification in the standard RSX-11 format: dev:[p,pn]filename.typ;version in which dev: is a physical device name or a logical device name; if dev: is not specified, SY: is assumed. If [p,pn] is not specified, the user's current default directory is assumed. The filename field must be specified whenever the device name references a file structured device. The typ field is a file type and must be explicitly given if used. There is no default type except for EI commands which default the .typ field to .TEC. The switch /RW may be applied to any file specification in an ER, EW, and EI command. If the file specification references a magtape, the tape is rewound before the file is opened. Note that for output files, this has the effect of zeroing the tape. The /RW switch is ignored for all other device types. The presence of version numbers in Files-11 causes file processing to behave slightly differently under RSX-11 than under other operating systems. For example, no .BAK files are used; each execution of an EB command simply produces a new version of the file. Thus a user may retain any level of backup he feels to be comfortable. It also means that one must occasionally delete obsolete files to avoid cluttering the disk. Thus the command EBname.typ;version$ is equivalent to the commands ERname.typ;version$EWname.typ;0$ The EW command also creates a new version (one higher than the current highest) if no version number is given. If an explicit version number is given, then that number is used, and if another file of the same name, type, and version previously existed, it is superseded without warning. (See use of the EP and EK commands below.) In reading files, version numbers behave the same as in other RSX-11 utilities: the default is the highest version. This leads to a problem in re-opening the input file while a file is being edited with EB. Since the output file is already created and in the directory, the input file is no longer the highest version. One may deduce the version number of the input file by Standard TECO Page 133 Appendix F doing a :G* (typing the file string of the output file) and subtracting one from that version number. In symmetry with the EB command, the EK command functions by simply deleting the current output file. Note, however, that a supersede (EW of same name, type, and version) is not undone - the file is already deleted! The EP and EA commands, while simulating two channels each with an open file for each of input and output, in fact only keep one file open for each to conserve buffer space. This means that they are only useful for disk files. Also, it means that if you open a file and then supersede it, you should not switch the input channel away from it with an EP or ER$ command, since it will not be possible to open the file again. F.4 WILD CARD LOOKUP The EN command will process wild card lookups on RSX-11. To preset the wild card lookup file specification, use the standard RSX-11 format dev:[p,pn]filename.typ;version The device name must reference a file structured disk device or magtape. All other fields of the file specification may be fully wild (*), including either or both halves of the directory. The version number may be explicit, wild, or default. As with the other file specification commands, there is no default file type. F.5 EXITING FROM TECO The normal method of exiting from TECO is with the EX command. This copies the remaining input file to the output file, closes all files and exits. The (or Caret-C) command is the "give up and get out" command. Executed from main command level, it will cause TECO to exit regardless of the state of the buffer. If there is an open output file, it is deleted. The command is roughly equivalent to EKHKEX. F.6 The action taken when the user types depends on what TECO is doing. If TECO is executing commands, or is awaiting type-in for the ^T command, the ?XAB error occurs. If TECO is at command level, typing cancels the command Standard TECO Page 134 Appendix F string currently being typed and returns TECO to its prompt. Two consecutive characters will cause an instant HKEKEX exit. Sometimes it is desireable for a TECO macro to detect when a was typed. By detecting the , the macro can exit cleanly back to command level (pop saved Q-registers, restore any flag values, etc.). To do this, the macro sets Bit 15 (Octal 100000, Decimal -32768) of the ET flag. When a is typed, TECO will automatically turn off Bit 15, but will continue execution of the macro. The macro periodically checks Bit 15 and exits cleanly if it ever goes off. For example: [0 [1 -32768#ETET < ... ET; > 32767&ETET ]1 ]0 Setting the intercept bit in the ET flag must be done with some care; if the bit is set inside a command loop which does not check it, it will be impossible for the user to abort the loop. The only remedy for this situation is to abort TECO from another terminal. F.7 EXIT AND GO If TECO is exited via the EGstring$ command, TECO closes its files and exits. It then causes "string" to be executed as an MCR command using the spawn system directive. This feature works only on RSX-11M V3.2 and RSX-11M+ V1 or later. F.8 ET FLAG HANDLING TECO will automatically turn off the following bits in the ET flag on every error: Bit 0 (image output), Bit 3 (no echo on ^T), Bit 4 (cancel ^O), Bit 5 (no stall on ^T), and Bit 15 (^C trap). In addition, TECO always turns off Bit 7 (exit on error, etc.) every time is reaches prompt (*) level. Bit 6 (the detach flag) controls TECO'S treatment of the terminal. Normally, TECO keeps the terminal attached to gain control of interrupts. Setting bit 6 of the ET flag causes TECO to run with the terminal detached. All commands function normally, except that typing causes the MCR to be activated, allowing other tasks to be run from the same terminal concurrently with TECO. It is, of course, the user's problem to sort out the confusion that will arise if both TECO and another task request input from the terminal at the same time. Standard TECO Page 135 Appendix F F.9 FILE RECORD FORMAT Files-11 files are record structured, while TECO'S text buffer is ASCII stream. Thus TECO must make format conversions when reading and writing files. The conversion depends on the record attributes of the file. While reading a file, the records are packed into the buffer. If the file is implied carriage control (the standard RSX-11 source format) or Fortran carriage control, TECO inserts a carriage return and line feed after each record to make each record appear as a line of text in the buffer, unless the record ends with ESCAPE, carriage return, line feed, vertical tab, or form feed. A record ending in form feed is interpreted as an end of page mark; it stops the read operation and the form feed is not entered in the buffer. If the file has print file carriage control, TECO interprets the carriage control bytes and inserts the resulting carriage return and line feed characters about the record. If the input file has no carriage control (also called internal carriage control), TECO simply packs the records together in the text buffer. On output, TECO scans the text buffer for carriage return, line feed, vertical tab, and form feed characters. Each such character delimits the end of an output record. If the output file is implied or Fortran carriage control, and the record ends with exactly carriage return / line feed, the carriage return and line feed are not output with the record; Otherwise, the record is output in its entirety. The carriage return and line feed are also output with the record if the record ends with ESCAPE / carriage return / line feed. Switches may be applied to the input and output files to control their carriage control attributes. The switch /CR forces implied carriage control; /-CR forces no (internal) carriage control; /FT forces Fortran carriage control. When a carriage control switch is applied to an input file, the file is read as if it had that attribute; when the switch is applied to an output file, the file is written with that attribute. Applying a switch to an EB file specification causes the switch to apply to both input and output files. When an output file is created, its carriage control attributes are defaulted to those of the currently open input file as follows: Input Output implied implied none implied Fortran Fortran print file implied Files read with the EI command have their record attributes interpreted in the same manner. This leads to an unexpected side effect with EI files containing an entire command. The last record of the file presumably contains as its last characters the two alt modes which initiate execution of the macro. If the file Standard TECO Page 136 Appendix F is implied carriage control, however, there are also the final carriage return / line feed belonging to the last record, which remain in the type in buffer while the macro executes. If the macro attempts to receive input with the command, the carriage return / line feed will be the first two characters read. Alternatively, if the macro does no type in, the carriage return / line feed will be read by TECO as the first two characters of the next command. Then no asterisk (*) will appear as the prompt for the next command. The remedy for both cases is for the macro to execute an EI$ command early on. This causes the remainder of the indirect file to be discarded and further input to be read from the terminal. F.10 COMMAND LINE PROCESSING The mechanism used to process the command line in RSX-11 TECO is designed to allow sophisticated TECO users the greatest flexibility in customizing TECO for their own use. It functions as follows: The initialization routine places the original MCR command line (if any) into the filename buffer. It copies into the text buffer the text of a TECO macro that will be used to interpret the command line. Then it starts up TECO with the command HXY HKG* HXZ HK :EITECO$$ in the type in buffer. This loads the command line into Q-register Z and the macro into Q-register Y. It then executes the file named TECO.TEC located in the user's default directory, if it exists. After the user's TECO.TEC, and any files it might link to with EI, have been executed, TECO executes the command MY$$, thus executing the macro to interpret the command line and open the files requested. The TECO.TEC mechanism should not be used for simple initialization; the standard TECO.INI facility should suffice for that. The alternate TECO.TEC facility is provided for the sophisticated user who wants his own command processing and thus wishes to usurp control from the normal initialization. If an EI$ command (to close the indirect command file) is executed during the processing of a user's TECO.TEC startup file, the final MY$$ which causes processing of the command line is not executed. This results from the fact that the MY$$ normally appears in TECO's type in after all command files have been processed. Executing the EI$ command causes all "type ahead" to be discarded to allow a TECO command file to prompt and read input from the terminal (and not read extraneous type ahead). It is assumed that a TECO startup file that executes EI$ and reads input from the terminal will want to manage the rest of TECO's startup. If it still wants to process the command line, it must issue the MY itself. Standard TECO Page 137 Appendix G APPENDIX G VAX/VMS OPERATING CHARACERISTICS TECO is implemented in VAX/VMS as a half-native, half-compatibility mode program. The command processor and editor proper is the same as TECO-11 and runs in compatibility mode. Operating system interface and file service logic run in native mode. G.1 STARTUP VAX/VMS supports all of the standard TECO invocation commands, namely TECO TECO filespec TECO filespec=filespec MAKE filespec MUNG filespec MUNG filespec,text If any of these commands are not recognized by the system, see the installation instructions (section G.13) in this appendix. TECO macros may also be invoked with the command TECO @filespec It is exactly equivalent to MUNG filespec G.2 INITIALIZATION TECO performs initialization by attempting to translate the logical name TEC$INIT. If this name does not translate, no special initialization is done. If it translates to a string of the form $filespec (where "$" is a dollar sign), TECO executes the TECO commands in the specified filespec during initialization. If TEC$INIT translates to any other string, TECO executes that string as TECO commands during initialization. The original command line is available in the text buffer when the user initialization commands execute. Generally, you would set user private modes and/or flags at this time. This is also the normal place to detect, strip off, and do something appropriate with user private qualifiers. TECO's memory is controlled by the logical name TEC$MEMORY. If Standard TECO Page 138 Appendix G this name translates to a string of the form $filespec, TECO uses the specified file for its memory. Otherwise, TECO uses the logical name itself as the memory. If TECO is requested to load VTEDIT at startup (e.g., via a TECO /VTEDIT command), it attempts to translate the logical name TEC$VTEDIT. If the name is defined, the resulting filespec is used as the file from which to load the scope editor. If TEC$VTEDIT is not defined, TECO attempts to translate the logical name TEC$LIBRARY. If that logical is defined, it is used as the (device and) directory name of where to find VTEDIT.TEC. Elsewise, TECO defaults to SYS$LIBRARY:VTEDIT.TEC. These four logical names (TEC$INIT, TEC$MEMORY, TEC$VTEDIT, and TEC$LIBRARY) are the information holders corresponding to the four standard :EG commands INI, MEM, VTE, and LIB respectively (see section 5.1.3). G.3 FILE SPECIFICATION All file specifiers are subject to the VAX/VMS file specifier rules; logical names and multi-level directories are properly handled, including transparent network file access. The filename field must be specified whenever the device name references a file structured device. The type field must be explicitly given if used. There is no default type except for EI commands which default the type field to .TEC. The switch /RW may be applied to any file specification in an ER, EW, and EI command. If the file specification references a magtape, the tape is rewound before the file is opened. Note that for output files, this has the effect of zeroing the tape. The /RW switch is ignored for all other device types. The presence of version numbers in Files-11 causes file processing to behave slightly differently under VMS than under other operating systems. For example, no .BAK files are used; each execution of an EB command simply produces a new version of the file. Thus a user may retain any level of backup he feels to be comfortable. It also means that one must occasionally delete obsolete files to avoid cluttering the disk. Thus the command EBname.typ;version$ is equivalent to the commands ERname.typ;version$EWname.typ;0$ The EW command also creates a new version (one higher than the current highest) if no version number is given. If an explicit version number is given, then that number is used, and if another file of the same name, type, and version previously existed, it is superseded without warning. (See use of the EK command Standard TECO Page 139 Appendix G below.) In reading files, version numbers behave the same as in other VMS utilities: the default is the highest version. This leads to a problem in re-opening the input file while a file is being edited with EB. Since the output file is already created and in the directory, the input file is no longer the highest version. One may deduce the version number of the input file by doing a ER$:G*$$ which types the file string of the current (primary) input file. In symmetry with the EB command, the EK command functions by simply deleting the current output file. Note, however, that a supersede (EW of same name, type, and version) is not undone - the file is already deleted! When files are processed concurrently on the primary and secondary channels, all files are kept open. Thus the problems that occur under RSX-11 do not exist under VMS. G.4 WILD CARD LOOKUP Wild card file name processing supports all of the wild carding facilities of RMS. For VMS V2 and later systems this includes embedded * and % and multi-level directory wildcarding. G.5 SYMBOL CONSTITUENTS The match control character ^EC and the conditional n"C accept the VAX/VMS symbol constituent character set, which consists of upper and lower case alphabetics, numerics, ., $, and _. G.6 EXITING FROM TECO The normal method of exiting from TECO is with the EX command. This copies the remaining input file to the output file, closes all files and exits. The (or Caret-C) command is the "give up and get out" command. Executed from main command level, it will cause TECO to exit regardless of the state of the buffer. If there is an open output file, it is deleted. The command is roughly equivalent to EKHKEX. TECO's normal exit status code (as reflected by the DCL symbols $STATUS and $SEVERITY) is 1 (success). An exit caused by an EG$ command sets the exit status code to 9 (also success). An error exit caused by an error or with the 128 bit set in ET sets the exit status code to hexidecimal 1000002C which is SS$_ABORT with the inhibit message bit set. All other exits are from fatal internal errors and the exit status code is the fatal Standard TECO Page 140 Appendix G error status code. G.7 The action taken when the user types depends on what TECO is doing. If TECO is executing commands, or is awaiting type-in for the ^T command, the ?XAB error occurs. If TECO is at command level, typing cancels the command string currently being typed and returns TECO to its prompt. Two consecutive characters will cause an instant HKEKEX exit. Sometimes it is desireable for a TECO macro to detect when a was typed. By detecting the , the macro can exit cleanly back to command level (pop saved Q-registers, restore any flag values, etc.). To do this, the macro sets Bit 15 (Octal 100000, Decimal -32768) of the ET flag. When a is typed, TECO will automatically turn off Bit 15, but will continue execution of the macro. The macro periodically checks Bit 15 and exits cleanly if it ever goes off. For example: [0 [1 -32768#ETET < ... ET; > 32767&ETET ]1 ]0 Setting the intercept bit in the ET flag must be done with some care; if the bit is set inside a command loop which does not check it, it will be impossible for the user to abort the loop. The only remedy for this situation is to abort TECO with , resulting in the loss of the edit. G.8 is not handled at all by TECO and will result in trapping to the command interpreter. Should you accidentally type , immediately type CONTINUE in response to the DCL prompt to resume editing. G.9 EXIT AND GO If TECO is exited with the EGstring$ command, the string is passed to the command interpreter as the next command to execute after TECO has closed its files and exited. This feature works only on VMS V2 and later systems. Standard TECO Page 141 Appendix G G.10 ET FLAG HANDLING TECO will automatically turn off the following bits in the ET flag on every error: Bit 0 (image output), Bit 3 (no echo on ^T), Bit 4 (cancel ^O), Bit 5 (no stall on ^T), and Bit 15 (^C trap). In addition, TECO always turns off Bit 7 (exit on error, etc.) every time is reaches prompt (*) level. Bit 6 (the detach flag) has no meaning in VMS. G.11 FILE RECORD FORMAT Files-11 files are record structured, while TECO'S text buffer is ASCII stream. Thus TECO must make format conversions when reading and writing files. The conversion depends on the record attributes of the file. While reading a file, the records are packed into the buffer. If the file is implied carriage control (the standard VMS source format) or Fortran carriage control, TECO inserts a carriage return and line feed after each record to make each record appear as a line of text in the buffer, unless the record ends with ESCAPE, carriage return, line feed, vertical tab, or form feed. A record containing a form feed is interpreted as an end of page mark; it stops the read operation and the form feed is not entered in the buffer. The portion of the record after the form feed, if any, is saved for the next input command. If the file has print file carriage control, TECO interprets the carriage control bytes and inserts the resulting carriage return and line feed characters about the record. If the input file has no carriage control (also called internal carriage control), TECO simply packs the records together in the text buffer. On output, TECO scans the text buffer for carriage return, line feed, vertical tab, and form feed characters. Each such character delimits the end of an output record. If the output file is implied or Fortran carriage control, and the record ends with exactly carriage return / line feed, the carriage return and line feed are not output with the record; Otherwise, the record is output in its entirety. The carriage return and line feed are also output with the record if the record ends with ESCAPE / carriage return / line feed. Switches may be applied to the input and output files to control their carriage control attributes. The switch /CR forces implied carriage control; /-CR forces no (internal) carriage control; /FT forces Fortran carriage control. When a carriage control switch is applied to an input file, the file is read as if it had that attribute; when the switch is applied to an output file, the file is written with that attribute. Applying a switch to an EB file specification causes the switch to apply to both input and output files. When an output file is created, its carriage Standard TECO Page 142 Appendix G control attributes are defaulted to those of the currently open input file as follows: Input Output implied implied none implied Fortran Fortran print file implied Files read with the EI command have their record attributes interpreted in the same manner. This leads to an unexpected side effect with EI files containing an entire command. The last record of the file presumably contains as its last characters the two alt modes which initiate execution of the macro. If the file is implied carriage control, however, there are also the final carriage return / line feed belonging to the last record, which remain in the type in buffer while the macro executes. If the macro attempts to receive input with the command, the carriage return / line feed will be the first two characters read. Alternatively, if the macro does no type in, the carriage return / line feed will be read by TECO as the first two characters of the next command. Then no asterisk (*) will appear as the prompt for the next command. The remedy for both cases is for the macro to execute an EI$ command early on. This causes the remainder of the indirect file to be discarded and further input to be read from the terminal. G.12 COMMAND LINE PROCESSING The mechanism used to process the command line in VMS TECO is designed to allow sophisticated TECO users the greatest flexibility in customizing TECO for their own use. It functions as follows: The initialization routine places a built-in command decoding TECO macro into Q-register Y and the original command line (including the keyword TECO, MAKE, or MUNG) into Q-register Z. It then looks for a user private command decoding TECO macro by attempting 1. an EITECO$$ if the logical name "TECO" exists, elsewise 2. an EISYS$LOGIN:TECO$$ if the logical name "SYS$LOGIN" exists, elsewise 3. an EITECO$$ If the EI succeeds, the found file is executed. The file may, or course, do anything it pleases. Generally, you would use a private command decoder to automate some sort of system specific editing package. For example, to implement an editing package Standard TECO Page 143 Appendix G called FOOBAR, you would define the logical TECO with $ DEFINE/SYSTEM TECO dev:[dir]FOOBAR define a DCL foreign command symbol with $ FOOBAR :== $SYS$SYSTEM:TECO FOOBAR and place the TECO macro the implements the FOOBAR editor in dev:[dir]FOOBAR.TEC. Now, whenever a TECO, MAKE, MUNG, or FOOBAR command is issued, the your macro will gain control. It should fetch Q-register Z (the original command line), check the command type, if it's FOOBAR then go do its thing, else it should terminate and execute TECO's built-in command decoder. GZ ! Put command into text buffer ! J ::@S/FOOBAR/"U ! Is the command for us? ! @EI// ! Not for us, turn us off ! HK ! Clear out text buffer ! MY ! Let the real TECO takeover ! ' ! It's for us, just flow on... ! $$ ! Double ESCAPE; 1st command's end ! ... ! Do your own thing here... ! This mechanism should not be used for simple initialization; the standard TEC$INIT facility should suffice for that. This facility is provided for the sophisticated user who wants his own command processing and thus wishes to usurp control. G.13 INSTALLING TECO TECO is distributed with VAX/VMS; the files are already in place. If TECO will receive heavy use, it should be installed /OPEN and /HEADER_RESIDENT. NOTE The half-native TECO is distributed with VAX/VMS V2. Previous versions of VAX/VMS were distributed with the compatibility mode RSX-11M TECO. Should you wish to run the half-native version on VAX/VMS V1 systems, you must install it with CMEXEC privilege to allow its handling of TEC$MEMORY. This privilege is NOT required on VAX/VMS V2 or later. Since the TECO commands are not part of the VAX/VMS command interpreter, each user must define the commands in his LOGIN.COM file. The following commands will define the three normal TECO invocation commands: $ TE*CO :== $SYS$SYSTEM:TECO TECO $ MAK*E :== $SYS$SYSTEM:TECO MAKE $ MU*NG :== $SYS$SYSTEM:TECO MUNG Standard TECO Page 144 Appendix G The asterisk allows for abbreviation of these commands. For example, the TE*CO definition permits TE, TEC, or TECO. One may include command switches in the command definitions. For example, one can define a command to invoke TECO with VTEDIT as follows: $ VTECO :== $SYS$SYSTEM:TECO TECO /VTEDIT Standard TECO Page 145 Appendix H APPENDIX H OS/8 OPERATING CHARACTERISTICS H.1 STARTUP TECO is started with the .R TECO command. TECO is now immediately ready to accept commands. The text buffer and Q-register areas are empty. The TECO command .TECO filespec is used to edit an already existing file. It is equivalent to .R TECO *EBfilespec$Y$$ OS/8 "remembers" the filespec as the name of the last file that has been edited. The MAKE command .MAKE filespec is used to create a new file. It is equivalent to .R TECO *EWfilespec$$ OS/8 "remembers" the filespec as the name of the last file that was edited. The command .TECO filespec1=filespec2 is used to edit filespec2 into filespec1. That is, filespec2 is opened as the input file, and filespec1 is created as the output file. It is equivalent to .R TECO *ERfilespec2$EWfilespec1$Y$$ OS/8 "remembers" the filespec1 as the name of the last file that was edited. The command Standard TECO Page 146 Appendix H .TECO with no arguments, causes CCL to execute the command .TECO filespec where filespec was the file that was previously remembered as the last file to be edited. The system purposely does not remember filenames from one day to the next, but it will remember names across bootstraps. The command .MUNG filespec executes the specified TECO program. The default extension is .TEC . This is equivalent to the sequence: .R TECO *ERfilespec$YHXYHKMY$$ Another format of this command is .MUNG filespec,argument which is used to pass an argument to the TECO program to control its action. This is equivalent to the sequence: .R TECO *ERfilespec$YHXYHKIargument$MY$$ The argument may be the name of a file that the TECO program is to mung, or it may be a command to the program to specify what action to take, or whatever. It is up to the TECO program to decode this argument (which is left in the text buffer) and take appropriate action. A TECO program executed via the MUNG command must never destroy the text storage area of Q-register Y and expect to ever see the light of day again. Note the input file remains open and can provide more input to the macro. H.2 STARTUP CONDITIONS The initial value of the EU flag is 0 if the CCL command SET TTY NO SCOPE had been previously issued, and is -1 if the CCL command SET TTY SCOPE had previously been issued. The initial value of the ET flag is as follows: Bit value Initial value Standard TECO Page 147 Appendix H 1 0 2 0 (1 if terminal is a scope) 4 0 8 0 16 0 32 0 64 0 128 1 (TECO's prompt sets this to 0) 256 0 512 0 (1 if VT support is present) 1024 0 (1 if VR12 support is present) 2048 0 The initial value of the ED flag is 1. H.3 FILE SPECIFICATION The file access commands ER, EB, and EW accept a file specification in the standard OS/8 format: dev:filename.type in which dev: is a physical device name or a user assigned logical name; if dev: is not specified, the default DSK: is assumed. The filename field must be specified in the commands ER, EB, and EW and be a legal OS/8 filename. The type field is a file extension and must be explicitly given if used (there is no default). Any characters after the second will be ignored, thus the filespecs FOO.TEC and FOO.TE are equivalent. The EB and EW commands do not accept the extended notation for an output file size dev:filename.type[n] specifying an output size allocation. H.5 BACKUP FILES The EB command maintains one level of file backup on OS/8. The pre-edited input file name is changed to filename.BK before the new output file is closed with the original name. Only normal file closing commands (EC, EF, EG, and EX) cause this renaming to happen. If TECO is aborted or the output file is purged by the EK command, the input filename remains unchanged. Note only one .BK file for a given name is kept; earlier .BK backup files are deleted each time a new backup file is created. A good policy to follow when editing is to close the edited file frequently enough so that an unexpected incident would not cause Standard TECO Page 148 Appendix H a substantial loss of work. Files should be backed up regularly. TECO has the power to let an unsuspecting user alter a good file into a completely useless state. The SRCCOM program can be used to verify an editing session. H.6 EXIT AND GO If TECO is exited via the EGstring$ command, the string is passed to the system as the next command to execute. This string may be any valid command or an indirect command file specification. The command may be either a KBM or a CCL command. This command is especially useful while running under BATCH. If TECO is exited via the EG$ command, then OS/8 will re-execute the last explicit compile-class command that was executed that day. The commands that are considered to be compile-class commands are: COMPILE file LOAD file EXECUTE file LINK file MACRO file. This feature, combined with OS/8's other remembering features, minimizes the number of keystrokes necessary to do normal program development. The programmer does not have to constantly type in the name of the file he is working with. A typical debugging session would look like this: .MAKE FOO.MAC *!type in assembly language file to be executed! *EX$$ .EXECUTE FOO (get error messages) .TECO *!fix bugs! *EG$$ !re-compile and execute program! (watch program work or repeat process) H.7 The action taken when the user types depends on what TECO is doing. At command level is an immediate action command. If typed as the very first character in a command string (not necessarily the first keystroke) it aborts TECO and returns to the keyboard monitor. If this was done accidentally, TECO may be restarted (at your own risk) by using ODT to branch to location 207 in your program's image. If is typed in the middle of entering a command string, then the ?XAB error message is given and TECO reprompts with its asterisk. Note that if TECO executes as a command from command level, TECO Standard TECO Page 149 Appendix H is aborted. If TECO executes a command from within a macro, TECO is also aborted. If a is typed while TECO is running, or while TECO is typing on the terminal, or while an error message is printing, then the ?XAB error message is given and TECO reprompts with its asterisk. TECO will abort similarly, if is typed while TECO is waiting for input because of a ^T command. Note that if TECO is performing I/O using non-system handlers, the non-system handler may intercept the and abort back to the keyboard monitor. In such a case, you may attempt to re-enter TECO. However, part of your file has been lost; good luck in attempting to issue an EF command. Manually resetting the value of Z might recover your data. If TECO is executing commands or doing I/O, a will stop the operation and generate the ?XAB error message. Sometimes it is desireable for a TECO macro to detect when a was typed. By detecting the , the macro can exit cleanly back to command level (restore any flag values, etc.). To do this, the macro sets Bit 0 (Octal 4000, Decimal 2048) of the ET flag. When a is typed, TECO will automatically turn off Bit 0, but will continue execution of the macro. The macro periodically checks Bit 0 and exits cleanly if it ever goes off. If the trap bit is on, then the ^T can read a typed at the terminal. It has an ASCII value of 3. H.8 FILE RECOVERY TECO can be a useful tool in recovering ASCII files lost on a block replaceable device. TECO allows non-file-structured devices to be opened in a non-file structured mode. This gives the user the capability to open a disk and access ASCII data anywhere on it, independent of file boundaries. To do this, you must issue a command of the form .SET dev: NOFILES to the monitor to make it think that your disk is non-file-structured. The command ERdev:$ is used to open the device at which point _ (underscore or backarrow) searches may be used to locate specific ASCII data and transfer it to new output files. Note that files tend to get reproduced, in whole or part, many places on a block replaceable device; be sure to verify that any given text is indeed complete and the correct version. If the disk's directory has not been clobbered (or if you are willing to create a new one), then it is not necessary to turn the disk into a non-file-structured device. Merely open up a Standard TECO Page 150 Appendix H file early on the disk for input and read through end-of-files until you locate the lost file. To read through end-of-files, you must use the /S switch on an ER, EB, or EW command. For example, the command ERFOO.MAC/S$ will open the file FOO.MA for input and put TECO into "SUPERTECO" mode. In this mode, TECO will not treat a found in a file as an end-of-file character. Instead, will be treated like any other character. It is not a line terminator or a page terminator. This mode continues until an ER, EW, or EB command is issued without a /S switch. H.9 VR12 GRAPHICS SUPPORT If TECO is run on a PDP-12, TECO will automatically start up in display mode, adjusting to both the size of the display screen and to the presence or absence of the scroller. On a PDP-12, TECO only permits one-page input and output handlers. See Section 5.17 for a description of the available commands to interact with the display. Various aspects of the display screen become immediately obvious upon seeing them; the text pointer, its position and shape and its position between lines; wrap around of more than 72 characters per line, and so on. Experiment with a scratch file for more familiarity. H.10 EXCEPTIONS TECO-8 does not support the following commands which are described in this manual: 1. Secondary streams (EP, EA, ER$, EW$) 2. Auxiliary command streams (EI) 3. Wildcards (EN) 4. Zeroing of directories (EZ) 5. Magtape commands (EM) 6. View command (nV) 7. Bounded searches Standard TECO Page 151 Appendix H 8. Anchored searches 9. Search verification (ES) 10. Command verification (EV) 11. Backward searches 12. Extended string build or match constructs (^Ex) The following incompatibilities exist between TECO-8 and Standard TECO: 1. In octal mode, the digits 8 and 9 are not treated as errors when occurring in a numeric string. 2. The *q immediate action command is not implemented. Instead, the immediate action command * has the same effect as *Z of the standard. (The immediate mode command ^S is still accepted for compatibility with OS/8 TECO V5.) H.11 CHAINING TO TECO A user program may chain to TECO passing it a command to be executed. There are two formats that such a command may take. Format 1 (the TECO command format) passes TECO a valid TECO command to be executed. This TECO command is placed in a buffer starting at location 17600, one 7-bit ASCII character per word. A negative word represents a pointer to a continuation buffer in field 1. There may be any number of continuation buffers, but they must all begin above location 4000 in field 1. Since TECO clobbers most of field 1, these buffers must in fact start above location 7400. TECO will never load into page 7400 of field 1. The buffer ends with a fullword 0. Format 2 (the CCL command format) passes TECO a CCL command to be parsed and executed. Such a command usually begins with the words TECO, MAKE, or MUNG, but is not limited to these words. Such a CCL command is placed in a buffer starting at location 17601, one 7-bit ASCII character per word. Location 17600 must be a fullword 0 to specify that this format is being used. A negative word in the buffer represents a pointer to a continuation buffer in field 1 as described above. The buffer ends with a fullword 0. If this format is used, the passed CCL command will be parsed and executed by TECO.TEC as described below. A user may write his own TECO.TEC, thus implementing his own CCL commands. There is no limit to the possiblities, other than the user's imagination. Standard TECO Page 152 Appendix H H.12 USER INITIALIZATION If a user has a file called TECO.INI on SYS:, then when TECO starts up (via a CCL command, it will execute the contents of this file (as a TECO macro). This file must contain a valid TECO program (which will execute out of Q-register W). God help you if you have any errors in this program. This start-up file must not modify itself (Q-register W) and must not modify the contents of Q-register V. It should not indiscriminately modify the contents of Q-register Z or the text buffer. TECO.INI will be executed before TECO opens any files. That is, if TECO was invoked via a MAKE command, TECO.INI will be executed before the EW command (for the MAKE) is executed. At this point, the text buffer will contain a copy of the CCL command that invoked TECO (assuming your monitor has TECO.TEC support). However, TECO has not as yet parsed this line. The user may examine this line for himself, and modify it, but you had better know what you are doing (and do it right!). TECO.TEC will parse the contents of the text buffer at the conclusion of execution of TECO.INI. If your monitor does not have TECO.TEC support, or if a user program chained to TECO passing it a TECO command (rather than a CCL command), then the initial TECO command will be in Q-register Z when TECO.INI gets control. That command has not as yet been executed. The initialization file may examine the contents of Q-register Z to determine what TECO command will be executed and proceed accordingly. It may also modify the contents of Q-register Z (but you better know what you are doing). In this case, TECO.INI is started up via the sequence @:ER/SYS:TECO.INI/"SYHXWHK @^UZ^@teco command^@ MW+0ES.,.XWMZES"N0ESMX'$$ which loads TECO.INI into Q-register W, loads the chain argument consisting of an appropriate teco command into Q-register Z, and temporarily stores the value returned by TECO.INI in the search verification flag (this feature may change in a subsequent release). Q-register W and ES are cleared before the post-processing command in Q-register X is executed. Note that the chain argument may not contain any embedded nulls. H.13 RETURNED VALUES FROM TECO.INI TECO.INI may also return a value. If your monitor does not support TECO.TEC, then only two values are permitted. Returning a 0 (or not returning anything) is the normal sequence of events. Returning a 1 means that TECO should execute the contents of Q-register X (via an MX command) after it executes the initial TECO command (in Q-register Z). TECO.INI may set up Q-register X with the appropriate post-processing commands. A typical use of this feature would be to have TECO.INI load up Q-register I with Standard TECO Page 153 Appendix H an editing macro and then put an "MI" command in Q-register X for subsequent execution. If your monitor does have TECO.TEC support, then TECO.TEC can support additional returned values. It is recommended that TECO.TEC support the returned values of 0 and 1 as above, but in addition, it may support additional values determined by the user. Note that TECO.INI is not invoked if TECO is started with a RUN or R command. H.14 TECO.TEC SUPPORT If the version of CCL you are using to invoke TECO supports TECO.TEC, then it will chain to TECO with a 0 at location 17600 and will pass TECO the invokig CCL command (beginning at location 17601). If TECO is invoked in this manner, it will parse this CCL command by executing the TECO command line parser macro stored in SYS:TECO.TEC. This macro can be modified by the user to parse switches or do any special processing that is desired. TECO.TEC is started up via the command @I^@ccl command^@:ER/SYS:TECO.TEC/"F^ACan't find SYS:TECO.TEC ^A^C^CA.,ZXV.,ZKMV.,.XV$$ which puts your CCL command in the text buffer and then loads (the first page of) TECO.TEC into Q-register V. TECO.TEC is then executed with the MV command and then Q-register V is cleared. It is the responsibility of TECO.TEC to parse the command line in the text buffer and do the appropriate processing and clean-up. It is also the responsibility of TECO.TEC to execute a user's start-up file (TECO.INI) if one is present. Note that TECO.TEC is not invoked if TECO is started via a RUN or R command. Also note, that the CCL command may not contain any embedded nulls. H.15 OVERLAYS The key to writing fast TECO programs lies in understanding TECO-8's overlay structure. If TECO-8 is run in 16K or more (20K or more if VT support is present), then the overlays will be memory-resident rather than disk-resident. Although this is much faster than swapping from the disk, swapping from memory still involves some overhead, so it would be wise to structure your TECO program to minimize the number of swaps necessary. The overlay structure is designed so that the minimal number of swaps will be required unless obscure TECO features are used. There are five overlays to TECO: 1. The I/O-overlay. This overlay handles file opening and is initially resident. Thus no swapping is necessary to do an initial ER, EW, or EB. Standard TECO Page 154 Appendix H 2. The Q-overlay. This overlay contains most of the frequently used conditional commands and branching commands. It is intended that this overlay swap in once and remain in memory until TECO is exited. 3. The X-overlay. This is the exit overlay and handles commands needed only when TECO is exiting, such as EX, EF, EC, and EG. It is intended that this overlay will swap in only once when you are ready to leave TECO. 4. The F-overlay. This overlay contains the flag commands and other little-used commands. It is intended that this overlay be not used at all, or if it is used, it will be used so infrequently that it will not slow down system performance. 5. The E-overlay. This is the error overlay. It is swapped in only when an error occurs. It is intended that this overlay never be swapped in. To write efficient TECO code, the user must know exactly which commands are handled by which overlay. This information is summarized below. Overlay Commands I-overlay ERfile$, EWfile$, EBfile$, :ERfile$, :EBfile$ Q-overlay Otag$, n"Xthen|else', n;, search;, n<...>, <...> X-overlay EC, EG$, EGcmd$, EF, EK, EX, *q, ?, nEJ, n^_, V, ^B, ^E, ^F, ^L, ^N, ^Uqtext$ F-overlay ED, EH, EO, ES, ET, EU, ^D, ^O, \, n\, n=, n==, n:=, n:==, | Several things are immediately obvious. The command 0TT should always be preferred to the V command. ELSE clauses should be avoided. (In future releases, we will try to move the processing of the | command into overlay Q.) The commands \ and = should be used as infrequently as possible from within long-running macros. Xq is preferred to ^Uq to load up a Q-register. -n-1 is preferred to n^_ to take a one's complement. Radix changes should be avoided. Flags, such as ET and ED, should be set once at the beginning of a macro, and then not fiddled with if at all possible. H.16 INSTALLATION INSTRUCTIONS The source of TECO consists of the following modules: TECO.MAC Main module TECINI.MAC Initialization module Standard TECO Page 155 Appendix H TECTBL.MAC Tables TECDEF.MAC Global definitions TECO12.MAC VR12 support TECOVT.MAC VT support TECOVI.MAC I/O-overlay TECOVQ.MAC Q-overlay TECOVX.MAC X-overlay TECOVF.MAC F-overlay TECERR.MAC E-overlay and error processor TECSRH.MAC Search processor TECNUM.MAC Arithmetic processor Each of these modules should be assembled (using MACREL V2 or later). This can be accomplished via the command .MAC TEC???.MAC if your monitor supports wildcards in compile-class commands. The resulting relocatable modules are then linked together (using LINK V2 or later) to produce the executable TECO.SV image which should be put on SYS: (but it may reside on any device). If your monitor supports TECO.TEC, then TECO.TEC must be placed on SYS:. H.17 ARITHMETIC PRECISION TECO-8 performs 13-bit arithmetic except that multiplication and division by negative numbers gives unpredictable results. All numbers stored in Q-registers are 13 bits long. Numbers stored in flags (such as ET, EU, etc.) are only 12-bits long. When storing a number into a flag, the high order (sign bit) is lost. When using the value of a flag in an arithmetic expression, the 12-bit value is sign extended first. H.18 ALTERNATE STARTING ADDRESS The normal starting address of TECO is location 00200. In this (normal) mode, TECO will simulate tabs by spaces on type out and will simulate vertical tabs and form feeds by line feeds. If your terminal has hardware tabs and vertical tabs (such as a KSR-35), then TECO can take advantage of these features. To enable this ability, you should change TECO's starting address to be 05200. This can be done by the monitor commands: .GET SYS:TECO .SAVE SYS:TECO;5200 H.19 VT05 SUPPORT TECO will automatically handle command string scope editing correctly on a VT05. The VT support (obtained via use of the -1W Standard TECO Page 156 Appendix H command) will handle VT05's correctly. The VTEDIT macro does not currently support the VT05 keypad. Standard TECO Page 157 Appendix I APPENDIX I TOPS-10 OPERATING CHARACTERISTICS I.1 STARTUP TECO is started with the .R TECO command. TECO is now immediately ready to accept commands. The text buffer and Q-register areas are empty. Initial commands may also be specifified by following the monitor command with a dollar sign ($) and then some TECO commands. For example, .R TECO $3EH starts TECO with the help level flag set to 3. The TECO command .TECO filespec is used to edit an already existing file. It is equivalent to .R TECO *EBfilespec$Y$$ TOPS-10 "remembers" the filespec as the name of the last file that has been edited. The MAKE command .MAKE filespec is used to create a new file. It is equivalent to .R TECO *EWfilespec$$ TOPS-10 "remembers" the filespec as the name of the last file that was edited. The command .MAKE filespec1=filespec2 is used to edit filespec2 into filespec1. That is, filespec2 is opened as the input file, and filespec1 is created as the output file. It is equivalent to .R TECO Standard TECO Page 158 Appendix I *ERfilespec2$EWfilespec1$Y$$ TOPS-10 "remembers" the filespec1 as the name of the last file that was edited. The command .TECO with no arguments, causes CCL to execute the command .TECO filespec where filespec was the file that was previously remembered as the last file to be edited. The system purposely does not remember filenames from one editing session to the next, that is, when you log out, the system "forgets" the name of the file you were editing. TECO-10 does not require the use of the MUNG command to execute TECO macros because runnable TECO programs can be created via use of the EE command and these can then be run with the standard R or RUN command. This TECO command has the format EEfilespec$ which saves away the current image of TECO in the filename specified. The default extension is .EXE. When the file is subsequently run (using the R or RUN monitor command), TECO resumes execution with the TECO command immediately following the EE command. I.2 STARTUP CONDITIONS The initial value of the EU flag is 0 if you are running on a terminal that does not support lower case, and is -1 if you are running on a terminal that does support lower case. The initial value of the ET flag is as follows: Bit value Initial value 1 0 2 0 (1 if terminal is a scope) 4 1 8 0 16 0 32 0 64 0 128 1 (TECO's prompt sets this to 0) 256 0 512 0 (1 if VT support is present) 1024 0 Standard TECO Page 159 Appendix I 2048 0 The initial value of the ED flag is 1. I.3 FILE SPECIFICATION The file access commands ER, EB, and EW accept a file specification in the standard TOPS-10 format: dev:filename.type[p,pn] in which dev: is a physical device name or a user assigned logical name; if dev: is not specified, the default DSK: is assumed. The filename field must be specified in the commands ER, EB, and EW and be a legal TOPS-10 filename. The type field is a file extension and must be explicitly given the first time. Thereafter, if a corresponding command is given with no extension specified, the system uses the previously specified extension as the default. The same defaulting rules hold for the dev: field. The construct is permitted on any output filespecification to allow setting the protection of the file being created. I.4 BACKUP FILES The EB command maintains one level of file backup on TOPS-10. The pre-edited input file name is changed to filename.BAK before the new output file is closed with the original name. Only normal file closing commands (EC, EF, EG, and EX) cause this renaming to happen. If TECO is aborted or the output file is purged by the EK command, the input filename remains unchanged. Note only one .BAK file for a given name is kept; earlier .BAK backup files are deleted each time a new backup file is created. A good policy to follow when editing is to close the edited file frequently enough so that an unexpected incident would not cause a substantial loss of work. Files should be backed up regularly. TECO has the power to let an unsuspecting user alter a good file into a completely useless state. The FILCOM program can be used to verify an editing session. I.5 EXIT AND GO If TECO is exited via the EG$ command, then TOPS-10 will re-execute the last explicit compile-class command that was executed during that session. Standard TECO Page 160 Appendix I I.6 The action taken when the user types depends on what TECO is doing. At command level is an immediate action command. If typed as the very first character in a command string (not necessarily the first keystroke) it aborts TECO and returns to the monitor. No Control-C trapping is available under TOPS-10. The ?XAB error message is not supported. If is typed in the middle of entering a command string, then TECO returns control to the monitor. Note that if TECO executes as a command from command level, TECO is aborted. If TECO executes a command from within a macro, TECO is also aborted. If two consecutive s are typed while TECO is running, or while TECO is typing on the terminal, or while an error message is printing, then control returns to the operating system. If one is typed to TECO while it is waiting for input, then control returns to the operating system. I.7 EXCEPTIONS TECO-10 does not support the following commands which are described in this manual: 1. Secondary streams (EP, EA, ER$, EW$) 2. Wildcards (EN) 3. Immediate aids LF and BS. The following incompatibilities exist between TECO-10 and DEC's TOPS-10 TECO V24: 1. The nA command under TOPS-10 TECO V24 always returned the value of the current character, regardless of the value of n. In TECO-10, 0A gives the value of the current character. I.8 USER INITIALIZATION If a user has a file called TECO.INI in his area, then when TECO starts up (via a CCL command), it will execute the contents of this file (as a TECO macro). This file must contain a valid TECO program. TECO.INI will be executed before TECO opens any files. That is, if TECO was invoked via a MAKE command, TECO.INI will be executed before the EW command (for the MAKE) is executed. I.9 INSTALLATION INSTRUCTIONS To create TECO for TOPS-10 from the sources, issue the following commands: Standard TECO Page 161 Appendix I .LOAD/MAC/COMPILE TECO10.T10+TECO10.MAC .SAVE TECO10 .LOAD/MAC/COMPILE TECERR.T10+TECO10.MAC .SAVE TECERR To create TECO for TOPS-20 from the sources, issue the following commands: @LOAD/MAC/COMPILE TECO10 @SAVE TECO20 This builds a raw TECO. This version of TECO does not contain any window support since the W and :W commands are implemented as macros. To load window support, issue the following commands: .RUN TECO10 (or TECO20) *EITECO10.TEC$$ *EETECO$$ You now have a runnable TECO image with window support. I.10 TMPCOR SUPPORT The EQ and E% commands support the pseudo-device TMP: for TMPCOR. Only the first three letters of the file name will be used, to try and access a TMPCOR file. If that fails, it will try nnnNAM.TMP where nnn is your job number and NAM is the three-character name. For example: for job 23, EQqTMP:FOOBAR$ will read TMPCOR file FOO or 023FOO.TMP. I.11 Q-REGISTER NAMES Any printable character (except open parenthesis) is valid as a Q-register name. A Q-register whose name is a lower case alphabetic character is the same as the Q-register whose name consists of the corresponding upper case letter. Thus Qa and QA are equivalent commands. Q-register names may also be up to 6 characters long, by enclosing the name in parentheses, for example, Q(FOOBAR). Q-register names may contain any printable characters, however all characters other than letters, digits, dollar-sign, space, and underline are reserved for special use by TECO. A Q-register name consisting entirely of zero or more spaces is the same as Q-register (), which is special and discussed below. Trailing spaces in Q-register names are discarded, and lower case is converted to upper case. I.12 REFERENCING THE TEXT BUFFER AS A Q-REGISTER The Q-register with the null name: () is the text buffer. The numeric part of this Q-register is the value of dot. The sequence [A ]() causes Q-register A to share with the text buffer. The old main text buffer is lost (unless it is also sharing with some Q-register or if it has been saved on the Q-register push-down list). The text in Q-register A becomes the Standard TECO Page 162 Appendix I text buffer and the numeric part of Q-register A is used for "." if it is in range, otherwise dot is set to 0. I.13 SHARING OF Q-REGISTER POINTERS Q-registers may share their text with each other and with the text buffer as a result of [ and ] commands. When a Q-register is pushed onto the Q-register pushdown list, all that is pushed is the numeric part of the Q-register and a pointer to the text part of the Q-register. Thus a command such as [A ]B would cause Q-registers A and B to share the same text. The commands X, ^U, and EQ could be applied to either Q-register without modifying the other, since the Q-register is unbound from its previous text first. However, the colon-modified forms of X and ^U append to the existing text, so a :X or :^U command for either of them would affect the other. I.14 EDITING LINE SEQUENCE NUMBERED FILES Some ASCII files have a special type of line number at the beginning of each line. These "line-sequence numbers" conform to certain rules so that they may be ignored or treated specially by compilers and other programs. The standards for line-sequence numbers are given in the LINED Program Reference Manual. TECO does not need line-sequence numbers for operation, but TECO can be used to edit files containing them. If such a file is edited with TECO-10, the line-sequence numbers are, in the normal case, simply preserved as additional text at the beginning of each line. The line-sequence numbers may be deleted, edited, and inserted exactly like any other text. On output, the line-sequence numbers are output according to the standard, except that the tab after the number is output only if it is already there. Leading zeros are added as necessary. If a line without a line-sequence number is encountered, a line-sequence number word of five spaces is placed at the beginning of the line. The following switches are available for use with line-sequence numebred files. These switches are merely added to the appropriate file selection command. ERfilespec/SUPLSN$ EBfilespec/SUPLSN$ causes line sequence numbers to be suppressed at input time. The numbers will not be read into the editing buffer. Also, the tabs following the line-sequence numbers, if they exist, will be suppressed. EWfilespec/SUPLSN$ causes the line-sequence numbers to be suppressed at output time. Tabs following the line-sequence numbers will also be suppressed Standard TECO Page 163 Appendix I if they exist. EWfilespec/GENLSN$ EBfilespec/GENLSN$ causes line sequence numbers to be generated for the output file if they did not already exist in the input file. Generated line-sequence numbers begin at 00010 and continue with increments of 10 for each line. Note that these switches are needed only if a change is to be made in the format of the file being edited. If no switches are specified, a file is output in the same form as it was input. I.15 COMPILER RESTRICTIONS TECO-10 is a compiler rather than an interpreter. This means, that before your command string is executed, TECO-10 compiles it into assembly language code. This makes it must faster than most other TECOs. Before executing a macro (with the Mq command) TECO compiles the program in the macro. The next time the macro is executed, TECO notes that the macro has already been compiled and merely branches to the compiled code. If the contents of the Q-register are changed (via an X or U command), then TECO notes that it must re-compile the commands should the Q-register be invoked as a macro. One consequence of this is that if a syntax error is detected in a command, no portion of that command will have been executed. For example, typing the command HK= will yield the ?NAE error message and the text buffer will NOT be cleared. Another consequence of this is that you must not invoke a macro two different times using two different numbers of arguments. If a macro gets initially invoked with two arguments, then all subsequent invocations must supply two arguments. Also, TECO cannot tell while compiling an Mq command whether or not the macro returns a value. Therefore it assumes that a value is always returned. This value can be explicitly removed by followed the Mq command with an . The MqA command will compile the A command as if it were an nA command rather than an APPEND. Standard TECO Page 164 Glossary GLOSSARY OF OBSCURE TECO TERMS Abort-on-error bit The 128's bit of the ET flag. If this bit is set, then TECO will abort execution on encountering an error (after printing the error message) and control returns to the operating system. This bit is initially set when TECO starts up, but is reset whenever TECO issues its prompt. One of several characters that TECO treats specially for use as a delimiter. Known as ESCAPE in more recent times, but traditional TECO users will still go on ending their command strings with "ALT" "ALT". Usually shown as $ in this manual. Anchored search A search (S) or search and replace (FS) command that is preceded by a ::. This indicates that the search must match the characters immediately following the current pointer position. If these characters do not match, no further searching is performed and the text buffer pointer does not move. Argument pair A command of the form m,n where m and n are numbers (or TECO commands that return numbers). When used before a command that normally acts on lines, the argument pair causes the command to work on characters. The characters specified by this argument pair is the set of characters between pointer positions m and n. The number m should normally be less than or equal to n. ASCII code The American Standard Code for Information Interchange. The code used by TECO to represent characters internally. Consult Appendix A for details. @-sign modified command A command that is preceded by an @-sign modifier. @-sign modifier An at-sign (@) that proceeds a command. It indicates to TECO that the string argument to the command is to delimited on both sides by a user-supplied delimiter rather than to be delimited only at the end by a TECO-designated delimiter (normally ). Automatic type out The feature of TECO that causes lines of text to be automatically typed out. The ES flag may be Standard TECO Page 165 Glossary used to control the automatic type out of lines after search commands, and the EV flag may be used to cause automatic type out of lines after command execution. Auto-trace mode A mode that TECO goes into when the 4's bit of the EH (Help-level) flag is set. In this mode, TECO will automatically print out the erroneous command string after an error occurs. Backup protection The process of preserving the user's original file (as a backup) when editing that file with the EB (Edit with Backup) command. Backwards searches A search that proceeds in the backwards direction. If the string being looked for does not occur at the current pointer position, the pointer position is moved back one character and the search is tried again. This continues until the string is found or until the boundary of the search has been reached or until the beginning of the current text buffer has been reached. Backward searches are initiated by using a negative argument to a search command or by using an argument pair m,n with m greater than n to an FB or FC command. Bounded searches A search command that requires searching only a portion of the text buffer. Of particular importance is the case where you only want to search the current line for a given string. Bounded searches are accomplished using the FB command. Case flagging A mode of TECO wherein, on type out, it will flag alphabetic characters (in either upper or lower case) by preceding them with a single quote. Lower case flagging is particularly useful on terminals that do not display lower case. Case flagging is controlled by EU, the case flag. Setting EU to 0 sets lower case flagging mode; setting EU to 1 sets upper case flagging mode, and setting EU to -1 removes all case flagging. Character-oriented editor An editor that allows modification of single characters, so that if just one character of a line is wrong, the entire line does not have to be retyped. TECO is a character-oriented editor. Standard TECO Page 166 Glossary Colon-modified command A command that is preceded by a colon (:) modifier. Colon-modifier A colon preceding a TECO command, used to indicate that the action of the command is to change. Frequently indicates that the command is to return a value (-1 if the command succeeded, 0 if the command failed). Command line The current line of the command string that is being typed into TECO. Command string scope editing The feature of TECO that is enabled when editing is performed on a CRT terminal. In this mode, typing the immediate action command causes the character deleted from the command string to physically disappear from the screen. Other commands, such as also behave differently, taking best advantage of the properties of a video terminal. Command string The string of TECO commands that is currently being typed into TECO, or is currently being executed by TECO. Comment An informative message used within a TECO program, to make the code more readable. The comment explains the meaning and purpose of the associated TECO commands. The comment is enclosed in exclamation marks. Compile-class command A set of operating systems commands (such as COMPILE) that causes compilation (translation) of a source file written in a computer language into machine instructions. The EG$ command is useful to finish an editing session and re-execute the last compile-class command (normally a command that compiles the file that was just edited). Conditional A TECO language construct used to specify code to be conditionally executed depending upon the results of some test. The most general form of the TECO conditional is n"X | ' which tests the number n using condition X (See section 5.13 for details). The commands specified by the are executed if the condition succeeds, otherwise the commands specified by the are executed. Standard TECO Page 167 Glossary Control-character An ASCII character whose octal code is in the range 0-37. Usually denoted in this manual by where X is the character whose ASCII code is 100 (octal) greater than the ASCII code for the control character being represented. TECO displays such a character as ^X (Caret-X) except for , , , , AND which have their normal display, and which is displayed as $ (dollar sign). Anytime a single control-character, is a valid TECO command, the two-character sequence, ^X, may be used instead. trapping A mode of operation wherein a TECO macro will regain control (rather than TECO) when or is typed on the user's terminal to abort execution of the current command string. trapping is enabled by setting the high-order bit of the ET flag. Current character The character immediately following the current text buffer pointer position. Cursor A visible pattern on a CRT terminal (usually blinking) that would specify to a true scope editor (like VTEDIT) the current location of the text buffer pointer, or which would specify the location where subsequently typed characters would be displayed. Destructive search A form of global search in which pages of text that are passed over (because they did not contain the string being searched for) are discarded rather than written to the output file. Destructive searches are initiated in TECO via use of the _ command. Display editor A true display editor is on which makes efficent use of a CRT terminal or display scope. Such an editor maintains a "window" into the text being edited. As characters are typed on the terminal, these characters immediately are entered into the text buffer and the window is immediately updated to reflect this change. With the help of some macro support, TECO can be made to be a true display editor. Standard TECO Page 168 Glossary Dot A mnemonic for "the current text buffer pointer position". Stems from the fact that the . (dot, or period) TECO command returns this number as its value. E command One of several two-character TECO commands that start with the letter 'E'. Echo mode A normal mode of operation in which TECO will automatically echo (display) each character that is typed in response to a ^T command. Opposite of no-echo mode. This mode is controlled by the 8's bit of the ET flag. (0 means no-echo mode.) ED flag The edit level flag. Edit-class command A type of operating system command (such as MAKE and TECO) that specifies that file editing is to occur. Many operating systems remember the argument specified with the last Edit-class command, so that the next time an edit-class command is used without an argument, the previous argument can be recalled. Edit level flag A bit-encoded flag, referenced by the ED command, that describes how TECO should behave with reference to certain features. See section 5.16 for more details. Edit verify flag A flag that describes how TECO should act after processing of a command string. This flag can be set so that TECO will display the line just edited on the terminal after each command. See section 5.16 for more details. EH flag The help level flag. Either-case search mode A standard mode of operation in which alphabetic characters specified within a search string are permitted to match a corresponding character of either upper or lower case. Else-clause The part of a conditional command that is executed if the condition is not satisfied. In TECO, these are the commands that occur between the | and the ' characters within the conditional construct. End-of-file flag A read-only flag, referenced by the ^N command that specifies whether or not end-of-file has been Standard TECO Page 169 Glossary seen on the currently selected input stream. A value of 0 means that end-of-file has not been seen; a value of -1 means that end-of-file has been reached. This flag is initially 0 and is reset to 0 each time a new file is selected for input. EO level The current version level of TECO-10. ES flag The search verification flag. The character whose ASCII code is 33 (octal). It is a general-purpose delimiter used by TECO. Traditionally known as an . ET flag The terminal characteristics flag EU flag The upper/lower case flag. EV flag The edit verify flag. Exact-case search mode A mode of operation in which alphabetic characters within a search string must match the exact case (upper case or lower case) of character specified. Exit Protection A protective feature of TECO that prevents a user from exiting TECO if a potential los of data is imminent. The EX and EG commands are aborted (with the ?NFO error message) if there is text in the text buffer, but no output file is open. F command One of several two-character TECO commands that start with the letter 'F'. Flag A data register used by TECO to control various modes of operation. The contents of the flag are set by specifying the new value before the flag name; and the contents are returned by using the flag name without a numeric argument. The TECO flags are: ^X, ^E, ^N, ED, EH, EO, ES, ET, EU, and EV. Flow command A TECO-11 command that is used to flow (branch) to a particular flow control character. The flow commands are F<, F>, F', and F|. Form feed flag A read-only flag, referenced by the ^E command that specifies whether the previous append from the input file terminated because of encountering a form feed character in the input file, or because the text buffer became nearly full. The Standard TECO Page 170 Glossary value of this flag is automatically set to -1 by TECO if input is terminated by the presence of a form feed character in the input file. Garbage collection A process used by TECO-10 to collect unused memory when more memory is required. Global search A type of search that continues through the entire input file until the specified characters are found. Successive pages of the file are read into the text buffer and then written out into the output file (if the string is not located). Global searches in TECO are initiated via the N command. Hard-copy editing mode A mode of operation that TECO uses when the user's terminal is not a CRT. In this mode, when a character is rubbed out using the key, the rubbed-out character is re-typed on the terminal as a visible indication that this character was rubbed out. Opposite of scope editing mode. This mode can be entered, even on a scope terminal, by turning off the 2's bit of the ET flag. Help level flag A bit-encoded flag, referenced by the EH command, that controls properties of TECO having to do with error messages and user assistance. Immediate action command A special command to TECO that takes immediate effect, requiring no s to begin its execution. Such commands are usually used to perform editing of the TECO command string currently being entered into TECO. For example, the commands and are immediate action commands. Immediate aid A type of immediate action command that must be typed as the first keystroke after TECO's prompt and provides assistance to the user. Examples of such aids are: ?, /, *q, , and . Iteration A language construct that permits a sequence of operations to be re-executed indefinitely or a given number of times. In TECO, this is accomplished by enclosing the commands in angle brackets. Standard TECO Page 171 Glossary Kernel The TECO-11 kernel refers to the TECO-11 module that implements all those features of TECO-11 that are common to all PDP-11 operating systems. Operating system specific features and the interface to the operating system is accomplished by linking an I/O module tailored for the desired operating system with the kernel. Keypad editor A true scope editor that uses special keys on the terminal (such as a VT52 or VT100) to control editing functions. VTEDIT is an example of a keypad editor. Line A portion of text delimited by , , , or the beginning or end of the text buffer. The final delimiter is considered to be part of the line. Line-numbered file In TOPS-10, an ASCII file that contains line numbers embedded in the start of each line. TECO does not require these line numbers, but can handle them if they are present. They can also be generated or suppressed via the /GENLSN and /SUPLSN switches respectively. Line-oriented editor An editor that primarily uses line numbers to direct editing, and most of whose commands are line-oriented. TECO is a character-oriented editor but also has many commands that work on lines. Line-wrap mode A standard mode of TECO's window support wherein lines that are too long to fit on a single physical line of the user's terminal are automatically continued on the next line. Opposite of truncate mode. Literal type out mode A mode that TECO can be put into by setting the 1's bit in the ET flag. In this mode, any characters typed by a TECO program via use of one of the commands T, V, ^A, or :G, will be displayed on the user's terminal without any modification. When not in this mode, TECO will convert characters that normally do not print to a form that can be displayed on the user's terminal (e.g. displays as ^X and displays as $). Literal type out mode is useful when trying to do real-time displays on a CRT terminal. Normal (up-arrow) mode is particularly useful to let you see what characters are really in your Standard TECO Page 172 Glossary file. Log file An audit trail that TECO-10 can keep showing all the commands that were typed to TECO and/or all the type out made by TECO. This is useful for reviewing what went wrong with a 'bad' edit. The log file is initiated with the EL command (see Appendix C). Macro A sequence of TECO commands intended to be loaded into a Q-register and executed as a TECO program. Macro level Two commands within the same TECO macro are said to be at the same macro level. Match control construct A command, consisting of certain special characters, used within a search string to indicate to TECO that special groups of characters are permitted to match at this point. Memory expansion TECO's act of acquiring additional storage from the operating system when the currently allocated storage is insufficient to handle the current TECO command. Typically, TECO will attempt to acquire this additional memory before it completely runs out of memory, so as to allow a 'buffer zone' for the user. This allows him to complete a few more commands even in the case where TECO is unable to get more memory. The informative message "[nK Bytes]" or its equivalent is printed on the terminal informing the user that memory usage has expanded. Mung A recursive acronym for "Mung Until No Good"; an act applied by novice TECO users to their source files. MUNG command An operating system command used to invoke a pre-written TECO program. The most general form of this command is "MUNG file,data" where "file" is the name of a TECO source program, and "data" is data to be passed to that program. No-echo mode A mode of operation in which TECO will not automatically echo (display) the character typed by the user in response to the ^T command. This mode is entered by setting the 8's bit of the ET flag. Opposite of echo mode. Page A portion of text delimited by form feeds. The form feeds are not considered to be part of the page. Sometimes the term 'page' is used to refer Standard TECO Page 173 Glossary to all the text currently in the text buffer. Panic Mode A condition that occurs (on small, single-user operating systems), when, in the middle of outputting during an edit, the output device fills up so that the I/O transfer cannot continue. TECO recovers gracefully from this condition by printing the ?FUL error message and returning control to TECO without any loss of data. At this point, the user closes the current output file and opens another one on another device (with more room) and resumes editing. At a subsequent time, the two parts of his file are concatenated back together. Pipeline editor An editor which only makes sequential edits to a file. The file to be edited is read into the text buffer one piece at a time. Each piece is edited and then written out. Once a piece has been written out, further editing to that piece is not possible unless the output file is re-opened in a later edit as a new file to be edited. TECO is a pipeline editor. Pointer preservation mode A mode of operation in which the text buffer pointer will not change after a failing search. This mode is controlled by the 16's bit of the ED flag. Primary input stream A term used by TECO-11 to refer to the main input file that TECO is using. Primary output stream A term used by TECO-11 to refer to the main output file that TECO is using. Prompt level A TECO command is said to be executed from prompt level if it was typed in directly in response to TECO's prompt, rather than being executed from a macro. Q-register One of 36 special-purpose registers used by TECO. Each register can hold both a number and a string of text. Of particular importance is the ability to store TECO command strings in Q-registers to be used as 'subroutines'. Q-register push down list A last-in first-out stack available to users for saving and restoring the contents of Q-registers. Standard TECO Page 174 Glossary Read-with-no-wait mode A mode of operation in which the ^T command will not hang until a key is typed on the user's terminal. In this mode, if no key has been struck, TECO returns a -1 as the value of the ^T command. This mode is entered by setting the 32's bit of te ET flag. Search verification flag A flag, referenced by the ES command, that controls the action of TECO subsequent to the execution of a command string containg a search command. Proper setting of this flag will enable the user to verify that the search located the correct string, by having the line containing the string found displayed on the terminal. See section 5.16 for more details. Search mode flag A flag, referenced by the ^X command, that controls how TECO treats alphabetical characters within search strings. This flag is used to put TECO into either exact-case mode, or either-case mode. If the ^X flag is set to 0, then either case matches in searches. If the ^X flag is set to 1, then exact case matches are required. Secondary input stream A term used by TECO-11 to refer to an auxiliary input "channel" that was formed by use of the EP command. Secondary output stream A term used by TECO-11 to refer to an auxiliary output "channel" that was formed by use of the EA command. See section 5.1.4 for details. Scope editing mode A mode of TECO in which command line scope editing (q.v.) algorithms are used. This mode is enabled by setting the 2's bit of the ET flag. It is usually automatically enabled by TECO if the operating system can detect that the user has invoked TECO from a scope terminal. Opposite of hard-copy editing mode. Split Q-registers The feature of TECO that permits storing of both a number and a string within a Q-register. Each Q-register can be considered to consist of two compartments. Standard TECO Page 175 Glossary String build construct A command, consisting of special characters, used within a text argument to build up the contents of the text argument from other components. SUPER TECO mode A mode of TECO-8 wherein TECO will read past the end-of-file mark (CTRL/Z) of a sequential ASCII file. This mode is enabled by using the /S switch on an ER or EB command and is terminated when an ER or EB command is issued with no /S switch. This mode is useful for scanning through mass storage devices in an attempt to recover data from files that had previously been deleted. Switch A construct of the form /SWITCH used within a command that takes a filespecification, to modify the action of the command or attributes of the file specified. Also known as a qualifier. Tag A label specified within exclamation marks to mark a point within a TECO program. Control can be transferred to this point by the use of a GOTO (Otag$) command. TECO Text Editor and COrrector program. TECO.INI A file containing TECO commands that is used as a user's private initialization file. When TECO starts up, it looks for such a file in the user's area, and if it finds one, the TECO commands in this file are executed before editing commences. TECO.TEC A TECO macro used by many operating systems to parse the user's edit-class commands. TECO I/O mode A mode of I/O operation under the RSTS/E and RSX-11 operating systems, in which the system buffers most characters and returns control to the caller (usually TECO) only when interesting characters (such as , , etc.) are typed. TECO's prompt refers to the asterisk (*) that TECO prints to indicate that it is ready to accept commands. TECO SIG A DECUS Special Interest Group, consisting of users who are dedicated to the spread of, improvement of, and standardization of TECO. Terminal characteristics flag A bit-encoded flag, referenced via the ET command, that contains information about the user's editing terminal and specifies in what modes TECO should Standard TECO Page 176 Glossary support it. Text buffer The main buffer used by TECO to hold the text to be edited. Text buffer pointer A pointer that marks the position within the text buffer where TECO is currently 'at'. This pointer always points to positions between characters; it never points at a character. The current character is considred to be the character immediately to the right of the current position of the text buffer pointer. Then-clause The set of commands within a conditional that are executed if the condition is satisfied. In TECO, these commands immediately follow the "X at the start of the conditional. They are terminated by a | or ' character. Tracing The act of watching the command-by-command execution of a TECO program. This is accomplished by putting TECO into trace mode, via use of the ? command. Trace mode A mode of TECO wherein each command that is executed by TECO is also displayed on the user's terminal as it is being executed. This mode is useful for debugging complicated TECO programs. TECO is toggled in and out of this mode via use of the ? command. See section 5.18.4 for more details. Truncate mode A mode of TECO's window support wherein lines that are too long to fit on a single physical line of the user's terminal are truncated when the right margin of the scope is encountered. This mode is entered by setting the 256's bit in the ET flag. Opposite of line-wrap mode. Type-out-time command A special command that makes sense only while TECO is typing out text on the terminal. These commands are , , and and affect the type out. Up-arrow mode A standard mode of operation wherein upon type out, TECO will display control characters by typing the visible two-character sequence ^X to represent the control character . On many older terminals, the caret character (^), whose octal ASCII code is 136, prints as an up-arrow. Some control characters are not printed in Standard TECO Page 177 Glossary up-arrow mode, notably , , , , and . Also, in this mode, the character is displayed as a dollar sign ($). Upper/lower case flag A flag, referenced by the EU command, that specifies whether or not case flagging is to occur. If set to -1, no case flagging occurs. If set to 0, lower case characters are flagged on type out. If set to +1, upper case characters are flagged on type out. View all mode A mode of window operation in which all characters have a distinctive visible display, including characters such as , , and , which normally do not display. War and Peace mode A mode of operation in which TECO outputs a large informative paragraph of information automatically upon encountering an error in a user's program. This paragraph of information describes the error in painstaking detail and tells the user how to recover. This mode is entered by setting the help level to 3. This mode is particularly useful to Novices and particularly obnoxious to experts. Window The portion of the text buffer that is currently being displayed on the user's terminal or auxiliary display device. Window support Assembly language code, built into TECO, that maintains a window into the text buffer on the user's terminal or auxiliary display device. Yank protection A feature of TECO wherein any Y, _, or F_ command that will potentially destroy valid data is aborted. This mode is normally enabled and will cause any of the aforementioned commands to abort with the ?YCA error message if there is text in the text buffer and an output file is open. This feature can be disabled by turning off the 2's bit in the ED flag. Standard TECO Page 178 Index INDEX TO TECO COMMANDS AND SPECIAL CHARACTERS NULL Discarded on input; Ignored in commands . 100 ^A Output message to terminal . . . . . . . 51 ^B Current date . . . . . . . . . . . . . . 76 ^C Stop execution . . . . . . . . . . . . . 33, 42, 84 ^D Set radix to decimal . . . . . . . . . . 73 ^E Form Feed flag . . . . . . . . . . . . . 76 ^E (Match char) Match ASCII code n . . . . . 66 ^E[] (Match char) Match one of list . . . . . 67 ^EA (Match char) Match alphabetics . . . . . 66 ^EB (Match char) Match separator char . . . . 66 ^EC (Match char) Match Symbol Constituent . . 66 ^ED (Match char) Match numerics . . . . . . . 66 ^EGq (Match char) Match contents of Q-reg q . 66 ^EL (Match char) Match line terminators . . . 66 ^EMx (Match char) Match any number of x . . . 66 ^EQq (String char) Use contents of Q-reg q . . 65 ^ER (Match char) Match alphanumerics . . . . 66 ^ES (Match char) Match non-null space/tab . . 66 ^EUq (String char) Use ASCII code in Q-reg q . 65 ^EV (Match char) Match lower case alphabetic 66 ^EW (Match char) Match upper case alphabetic 66 ^EX (Match char) Match any character . . . . 66 ^F Contents of console switch register . . . 76 n^F Return terminal number of job n . . . . . 76 ^G^G Kill command string . . . . . . . . . . . 34 ^G Retype current command line . . . . . . . 34 ^G* Retype current command input . . . . . . 34 ^H Current time of day . . . . . . . . . . . 76 BS Back up and type one line . . . . . . . . 35 TAB Insert tab and text . . . . . . . . . . . 57 LF Line terminator; Ignored in commands . . 5, 29, 98 LF Advance and type one line . . . . . . . . 35 VT Line terminator; Not a TECO command . . . 29 FF Page terminator; Output Form Feed . . . . 5, 29 CR End input line; Ignored in commands . . . 5, 34, 98 ^N End of file flag . . . . . . . . . . . . 77 ^Nx (Match char) Match all but x . . . . . . 65 ^O Set radix to octal . . . . . . . . . . . 73 ^O Kill terminal output . . . . . . . . . . 53 ^P Not a TECO command . . . . . . . . . . . 178 ^Q Resume terminal output . . . . . . . . . 53 ^Q Convert line arg into character arg . . . 118, 122 ^Qx (String char) Use x literally . . . . . . 64 ^R Value of current radix . . . . . . . . . 73 n^R Set radix to n . . . . . . . . . . . . . 73 ^Rx (String char) Use x literally . . . . . . 64 ^S -(length) of last referenced string . . . 77 ^S Suspend terminal output . . . . . . . . . 53 ^S Save last command string . . . . . . . . 121 ^S (Match char) Match separator char . . . . 65 Standard TECO Page 179 Index ^T ASCII value of next character typed . . . 77 n^T Output ASCII character of value n . . . . 51 ^U Kill command line . . . . . . . . . . . . 33 ^Uq Put string into Q-register q . . . . . . 68 :^Uq Append string to Q-register q . . . . . . 68 n^Uq Put ASCII char "n" into Q-register q . . 69 n:^Uq Append ASCII char "n" to Q-register q . . 69 ^V Enable lower case conversion . . . . . . 101 ^Vx (String char) Force x to lower case . . . 64 ^W Enable upper case conversion . . . . . . 101 ^Wx (String char) Force x to upper case . . . 64 ^X Search mode flag . . . . . . . . . . . . 94 ^X (Match char) Match any character . . . . 65 ^Y Equivalent to ".+^S,." . . . . . . . . . 77 ^Z Size of text in all Q-registers . . . . . 77 ^Z^Z^Z Immediate exit from TECO . . . . . . . . 34 ESC String and command terminator . . . . . . 3, 33, 84, 100 ^[ String and command terminator . . . . . . 100 ^\ Not a TECO command . . . . . . . . . . . 178 ^] Not a TECO command . . . . . . . . . . . 178 ^^x ASCII value of x . . . . . . . . . . . . 77 ^_ Ones complement (logical NOT) . . . . . . 72 SP Ignored in commands . . . . . . . . . . . 98 ! Define label . . . . . . . . . . . . . . 80 " Start conditional . . . . . . . . . . . . 85 n"< Test for less than zero . . . . . . . . . 86 n"= Test for equal to zero . . . . . . . . . 86 n"> Test for greater than zero . . . . . . . 86 n"A Test for alphabetic . . . . . . . . . . . 85 n"C Test for symbol constituent . . . . . . . 85 n"D Test for numeric . . . . . . . . . . . . 86 n"E Test for equal to zero . . . . . . . . . 86 n"F Test for false . . . . . . . . . . . . . 86 n"G Test for greater than zero . . . . . . . 86 n"L Test for less than zero . . . . . . . . . 86 n"N Test for not equal to zero . . . . . . . 86 n"R Test for alphanumeric . . . . . . . . . . 86 n"S Test for successful . . . . . . . . . . . 86 n"T Test for true . . . . . . . . . . . . . . 86 n"U Test for unsuccessful . . . . . . . . . . 86 n"V Test for lower case . . . . . . . . . . . 86 n"W Test for upper case . . . . . . . . . . . 86 # Logical OR . . . . . . . . . . . . . . . 72 $ Separate TECO commands . . . . . . . . . 100 n%q Add n to Q-register q and return result . 68 & Logical AND . . . . . . . . . . . . . . . 72 ' End conditional . . . . . . . . . . . . . 85 ( Expression grouping . . . . . . . . . . . 72 ) Expression grouping . . . . . . . . . . . 72 * Multiplication . . . . . . . . . . . . . 72 *q Save last command in Q-register q . . . . 35 + Addition . . . . . . . . . . . . . . . . 72 , Argument separator . . . . . . . . . . . 72 - Subtraction or negation . . . . . . . . . 72 Standard TECO Page 180 Index . Current pointer position . . . . . . . . 75 / Division . . . . . . . . . . . . . . . . 72 / Type detailed explanation of error . . . 35 0-9 Digit . . . . . . . . . . . . . . . . . . 178 : Modify next command . . . . . . . . . . . 28 ; Exit iteration on search failure . . . . 82 n; Exit iteration if n is positive . . . . . 82 :; Exit iteration on search success . . . . 82 n:; Exit iteration if n is negative . . . . . 82 n< Iterate n times . . . . . . . . . . . . . 79 = Type in decimal . . . . . . . . . . . . . 73 == Type in octal . . . . . . . . . . . . . . 73 === Type in hexadecimal . . . . . . . . . . . 73 := Type in decimal, no carriage return . . . 73 :== Type in octal, no carriage return . . . . 73 :=== Type in hexadecimal, no carriage return . 73 > End iteration . . . . . . . . . . . . . . 79 ? Toggle trace mode . . . . . . . . . . . . 100 ? Type out command string in error . . . . 35 @ Modify next text argument . . . . . . . . 28 A Append to buffer . . . . . . . . . . . . 47 nA ASCII value of char in buffer . . . . . . 75 n:A Append n lines to buffer . . . . . . . . 47 B 0 - beginning of buffer . . . . . . . . . 75 nC Advance n characters . . . . . . . . . . 49 nD Delete n characters . . . . . . . . . . . 54 m,nD Delete between m and n . . . . . . . . . 54 E%q Write Q-register q into a file . . . . . 46 nE_ Search without yank protection . . . . . 60 EA Select secondary output stream . . . . . 43 EB Open input and output . . . . . . . . . . 38 EC Close out (copy in to out and close) . . 40 ED Edit mode flag . . . . . . . . . . . . . 89 EF Close output file . . . . . . . . . . . . 41 EG Close out and exit with command . . . . . 41 :EG Execute operating system function . . . . 41, 120-121 EH Help level flag . . . . . . . . . . . . . 91 EI Open indirect command file . . . . . . . 43 m,nEJ Set environment characteristics . . . . . 88 nEJ Return environment characteristics . . . 87 EK Kill output file . . . . . . . . . . . . 42 EL Open log file . . . . . . . . . . . . . . 42 nEM Position magtape . . . . . . . . . . . . 121 EN Wildcard lookup . . . . . . . . . . . . . 45 EO Version of TECO . . . . . . . . . . . . . 78 nEO Set TECO to function as version n . . . . 91 EP Select secondary input stream . . . . . . 43 EQq Read file into Q-register q . . . . . . . 45 ER Open input file . . . . . . . . . . . . . 38, 43 ES Search verification flag . . . . . . . . 91 ET Type out control flag . . . . . . . . . . 92 EU Case flagging flag . . . . . . . . . . . 93 EV Edit verify flag . . . . . . . . . . . . 94 EW Open output file . . . . . . . . . . . . 39, 43 Standard TECO Page 181 Index EX Close out and exit . . . . . . . . . . . 42 EY Read without yank protection . . . . . . 48 EZ Zero output tape . . . . . . . . . . . . 42 nF_ Destructive search and replace . . . . . 61 F' Flow to end of conditional . . . . . . . 83 F< Flow to start of iteration . . . . . . . 83 F> Flow to end of iteration . . . . . . . . 83 F| Flow to ELSE part of conditional . . . . 83 m,nFB Search between locations m and n . . . . 60 nFB Search, bounded by n lines . . . . . . . 60 m,nFC Search and replace between m and n . . . 61 nFC Search and replace over n lines . . . . . 61 nFD Search and delete string . . . . . . . . 54, 62 nFK Search and delete intervening text . . . 55, 62 nFN Global string replace . . . . . . . . . . 61 FR Replace last string . . . . . . . . . . . 57 nFS Local string replace . . . . . . . . . . 61 Gq Get string from Q-register q into buffer 70 G* Get last filespec string into buffer . . 117 G_ Get last search string into buffer . . . 118 :Gq Type Q-register q on terminal . . . . . . 70 H Equivalent to "B,Z" . . . . . . . . . . . 75 I Insert text . . . . . . . . . . . . . . . 56 nI Insert ASCII character "n" . . . . . . . 56 nJ Move pointer to "n" . . . . . . . . . . . 49 nK Kill n lines . . . . . . . . . . . . . . 54 m,nK Delete between m and n . . . . . . . . . 55 nL Advance n lines . . . . . . . . . . . . . 50 Mq Execute string in Q-register q . . . . . 70, 76 nN Global search . . . . . . . . . . . . . . 59 O Go to label . . . . . . . . . . . . . . . 80 nO Computed goto . . . . . . . . . . . . . . 81 nP Advance n pages . . . . . . . . . . . . . 48 m,nP Write out chars m to n . . . . . . . . . 48 nPW Write buffer n times . . . . . . . . . . 48 m,nPW Write out chars m to n . . . . . . . . . 48 Qq Number in Q-register q . . . . . . . . . 70, 76 :Qq Size of text in Q-register q . . . . . . 70, 76 nR Back up n characters . . . . . . . . . . 50 nS Local search . . . . . . . . . . . . . . 59 m,nS Search for nth occurrence within m chars 117 ::S Compare string . . . . . . . . . . . . . 60 nT Type n lines . . . . . . . . . . . . . . 51 m,nT Type from m to n . . . . . . . . . . . . 51 nUq Put number n into Q-register q . . . . . 68 nV Type n current lines . . . . . . . . . . 51 m,nV Type m before & n after current line . . 51 W Scope "WATCH" . . . . . . . . . . . . . . 95 n:W Return scope characteristics . . . . . . 96, 118 m,n:W Set scope characteristics . . . . . . . . 97 nXq Put n lines into Q-register q . . . . . . 69 m,nXq Put characters m to n into Q-register q . 69 n:Xq Append n lines to Q-register q . . . . . 69 m,n:Xq Append characters m to n into Q-register q 69 Standard TECO Page 182 Index Y Read into buffer . . . . . . . . . . . . 48 Z End of buffer value . . . . . . . . . . . 75 [q Q-register push . . . . . . . . . . . . . 71 \ Value of digit string in buffer . . . . . 74, 76 n\ Convert n to digits in buffer . . . . . . 74 ]q Q-register pop . . . . . . . . . . . . . 69 n_ Global search without output . . . . . . 60 ` Not a TECO command . . . . . . . . . . . 178 a-z Treated the same as upper case A-Z . . . 178 { Not a TECO command . . . . . . . . . . . 178 | Start ELSE part of conditional . . . . . 85 } Not a TECO command . . . . . . . . . . . 178 ~ Not a TECO command . . . . . . . . . . . 178 DEL Delete last character typed in . . . . . 33