.tty1 .vs .ps53 .hm12 .ff1 .c TEDI--a Text EDItor .s .c VAX/VMS Version .s2 .c Clair W. Nielson .c80 Los Alamos National Laboratory .c80 Los Alamos, New Mexico 87545 .s2 TEDI is a general purpose text editor designed to be used in a variety of applications including program development and word processing. It is a line-oriented editor with implicit line numbers. This means that a line number represents the ordinal position of the line in the file and not a fixed flag on the line itself. Many experienced computer users prefer this type of editor because it avoids both the vagueness of editors without line numbers and the renumbering problems associated with editors using explicit line numbers. To provide intra~line editing capability comparable to that of character editors, a large number of pattern recognition and replacement commands are provided. In addition, an integral screen editor for VT-~100 compatible terminals is provided to supplement the line editing commands. Users with an appropriate terminal will probably find the screen editor most convenient for text entry and local changes, but will find the line referencing commands more powerful for global changes and changes requiring sophisticated logic. Among the advanced features in TEDI are string and numeric registers and iteration commands. When used in the context of command files, these features make possible editing programs which can perform complex editing operations. A powerful metacharacter manipulation capability is also provided. A text formatter is included in TEDI which is described in a separate document "The TEDI FORMATTER". .s3 .ts10 .c80 GETTING STARTED .s Assuming that TEDI has been properly installed on your computer system and that you have the monitor prompt, execution is begun with either .s !TEDI filename @ .s !or .s !TEDI @ The symbol "@" means carriage return. .s In the latter case, the behavior depends on whether a recognizable working file is found by TEDI in your present directory, left from a previous execution of TEDI. If a working file is found, editing starts immediately with the previous file you were working on. If not, you will be asked for a filename with a prompt. Even if you put the filename on the execute line, if a suitable working file is found, all of your previous switch settings will be renewed. On large files use of the second form without the filename can be a very substantial time saver since it eliminates making a new working copy of your file. .s Successful opening of a file will be evidenced by a message giving the fully expanded filename and a report of the number of lines found in the file. For a new file, the number of lines will be zero. All filenames follow the standard VAX/VMS usage. If no directory is specified, your default directory is assumed. However, if you wish to edit a file in another directory, the directory name in brackets should be the first part of the filename. If no version number is specified, the latest version will be used. Since TEDI does not use explicit line numbers of the form used by other VAX editors, the editor will report the existence of such line numbers and terminate if you attempt to edit a file with those line numbers present. To make a file suitable for TEDI, use the editor that added the line numbers to remove them before attempting to edit the file with TEDI. Any time that TEDI has typed out the commmand prompt "*" (asterisk) you may give any command, including one of the termination commands "END" or "QUIT". If you have made no changes to the file (for example, you have just typed out selected lines) these two commands are identical. However, if you made changes, "END" causes a new version of the file to be written into your filespace, whereas "QUIT" does not. (All the changes during your editing are kept in a scratch file; this scratch file is discarded if the "END" command successfully writes out a new version and is always discarded in response to the "QUIT" command.) The END command leaves the working file in a form for reuse whereas the QUIT command deletes it. CTRL-C or CTRL-Y doesn't delete the working file but leaves it in a form unsuitable for reuse. .s3 .tp10 .c80 COMMAND FORMAT .s Commands consist of a string of letters followed by numeric arguments. Most of the time the letters are abbreviations for the command name. The "END" and "QUIT" commands are exceptional in that the entire command word is typed in. Examples of command abbreviations are "T" for Type, "IAL" for Insert After Line, "RP" for Replace Pattern, and "DL" for Delete Lines. The numeric arguments may in general represent a variety of things, but most often the first two numbers represent the first and last line numbers of a range of lines to which the operation is to be applied. The punctuation for the numeric arguments is flexible. The first number may come immediately after the command abbreviation without a space, or it may be separated from the abbreviation by one space. The subsequent numbers may be separated by either spaces or commas. .f The following represent examples of commands using these abbreviations. Remember that these commands must be typed in immediately after an asterisk "*" prompt. If any other prompt is given, something other than a command is called for as will be described shortly. The examples show the variation in punctuation possible for numeric line~-number arguments. The examples also reveal that commands may be entered in either upper or lower case. .ts10 25 .nf .s .tp5 !<*>T 1 5 @!(Type out lines 1 through 5) .s !<*>DL10,11 @!(Delete lines 10 and 11) .s !<*>t10 @!(Type line 10) .s !<*>IAL 3 @!(Enter text mode to insert new text after line 3) .s !<*>RL3,5 @!(Enter text mode to replace lines 3 though 5) .s !<*>END @!(Terminate making a new version of the file) .s !<*>quit @!(Terminate discarding any changes) .s3 .tp10 .c80 LINE NUMBERS .f .s As was stated in the introductory remarks, TEDI uses implicit line numbers which denote the current position of a line in the file. These numbers run 1, 2, 3, ..., @], where "@]" is a symbol representing the last line in the file. (This symbol, the right square bracket, may be used in place of a number in a line number position in a command.) One of the properties of such a line number is that it changes if any lines before it are inserted or deleted. These line numbers, therefore, do not acquire permanent significance in the way that line numbers do in some line~-oriented editors. While the constant changing of the line numbers may be inconvenient in some instances, it is simpler not to be concerned about whether the increment is suitable, and it completely avoids difficulties associated with copying or moving blocks of lines with fixed line numbers. One trick to keep in mind is that if a sequence of changes is being made from a single reference listing, when the changes are made in order from the largest line number to the smallest, the line numbers remain valid until all the changes are complete. However, usually this is not a significant issue since context related information will be used as the principal means of location. .s3 .tp10 .c80 SPECIAL INPUT CHARACTERS .s The usual VMS character erase "DEL" and line erase "CTRL-U" are used by TEDI. In addition, the "ESC" functions as a line erase for non-~empty lines, and functions as a command erase (or abort) if given immediately after the prompt in a multiple-~line command. A single carriage return when in command mode causes the next line to be typed. An isolated "ESC" when in command mode types the previous line. A blank followed by a carriage return types the next ten lines, two blanks followed by a carraige return types the next twenty lines, and three blanks followed by a carriage return types the next thirty lines. In any line number argument, a negative number is interpreted relative to the current line. In place of numeric arguments, one may use "." to reference the current line, "@]" to reference the last line in the file, and "*" to represent "a very large number". These symbols and numeric arguments may be joined by plus and minus signs. Thus T.-5,.+5 .s types from five lines before the current line to five lines after the current line, TA,* .s types the rest of the file starting with the next line, and T@]-15,@] .s types the last sixteen lines in the file. A command (including its numeric arguments) and any associated strings must be separated from each other by either carriage returns, in which case TEDI will prompt for the string arguments, or by a dynamically determined logical line feed character, in which case the entire sequence may be entered on one line. The logical line feed is a separator such as ";", "/", or "@\" which is given immediately after the first command on a line and then applies for the duration of that command (perhaps over many lines for multiple line commands). For example, the mutliple line version for a "Type Pattern" is <*>TP @ .i5 Hello @ .s whereas the single line version is <*>TP/Hello @ .s The in the first case is a prompt given by TEDI. Any non-~alphanumeric except *, ., @], +, -, or blank may be used as the logical line feed character. One may wish to input the logical line feed character itself. To make this possible, the force literal character, the grave accent "@`", is used. If it precedes a special character, the special character is input into the text or string regardless of whether or not it is currently the logical line feed (or the tab character, see the STC command). To input the grave accent itself, type two of them "@`@`". In addition to its force literal function, the grave accent is used to input control charcters. The grave accent followed by an upper-~case alphabetic character inputs the associated control character. For example, "@`C" inputs "Control-~C" into the text or string. .s3 .tp10 .c80 TEXT INPUT MODE .s Two of the examples above, IAL, Insert After Line, and RL, Replace Lines, cause entry into text entry mode. This means that the editor is prepared to accept lines of text to be entered into the file. A prompt of the ampersand "@&" is given for each line, but the ampersand does not go into the line. (The prompt may be turned of--~see the section called switch settings--~but it is helpful as a reminder of the fact that the editor is in text entry mode.) When you have entered all of the lines you wish, enter one line with only a period "." at the beginning of the line and then type a carriage return. The period terminates text mode and returns the editor to command mode. (Although it will be rare to wish to enter a line with only a period in the first position, it can be done by typing one or more blanks after it. Since before writing the line to disk TEDI removes all trailing blanks, the line that enters the file contains only the period in the first position. The extra blanks on type-in tell the editor that you do not wish to terminate text mode.) To enter text mode for a new file, the line number is simply omitted from the insert command "IAL". When you leave text mode by this means, the editor will immediately begin typing out the consequences of the change. This is called verification. (Verification may be turned off--~see section called "Settings".) Example with multiple line input: .s .nf _____<*>IAL @ _____<@&>Now is the time @ _____<@&>for all good men. @ _____<@&>. .s _____Example with single line input: .s _____<*>IAL/Now is the time/for all good men/. @ .s3 .tp10 .c80 FILE TYPES .f .s1 TEDI distinguishes two FILES-11 file types. In either type, each record may be a maximum of 254 characters long. Normally each record of a file implies a carriage return and line feed without actually including the characters for them. However a special type of file does include the ASCII characters for all carriage control functions. TEDI reports the size of the first type as "xxxx LINES" while it reports the size of the second as "xxxx RECORDS". Normally the NN (No Numbers) switch must be set to cause proper listing of the second type of file. Moreover, when adding text lines to this latter type of file, a carriage return causes entry of a new record, but not necessarily of a new line. To enter a new line in this second type of file, use the force literal character and explicitly type "`M" and "`J". TEDI writes a file of this latter type if the file it opened was of this type. The FPF (Format Pages to File) command also generates a file of this type. File types must not be mixed with the file copy commands since no conversion capability is provided. .s3 .tp10 .C80 COLUMN REFERENCING .s Column referencing is possibly through the third and fourth arguments of ordinary string matching commands, or though explicit column referencing commands. An example of the former is "TS*,,1,7/10" which will find the symbol "10" only if it occurs in columns one through seven. An example of the latter is "RC,,6;2" which places the digit "2" in column 6. Tabs are not expanded so that "character number" is more accurate than "column number". Default cases of the column referencing commands are of frequent use. The AC "After Columns" command with no explicit column number puts the string after the last nonblank character in the line. The BC "Before Columns" command with no explicit column number places the string before column one, i.e., at the beginning of the line. The DAC "Delete After Columns" command with no explicit column reference deletes all trailing blanks. (TEDI always deletes trailing blanks when creating text; however, files converted from some other origin sometimes have wasteful trailing blanks.) .s3 .PG .c80 PATTERNS, SYMBOLS, AND METATEXT .s Certain commands search for the occurrence of specified strings of characters. These strings are limited to 64 characters, although the lines that result from changes using the strings may be up to 254 characters long. A pattern is any string of legal characters. A symbol is a pattern that is delimited in the text by special characters or blanks. This distinction is useful as a means of changing variables in a source program or full words in a text file. For example, it allows finding all occurrences of the FORTRAN variable "I" without interference from occurrences of the letter "I" in the symbol "PI" or the word "IF". Pattern commands use the letter "P" to denote pattern, i.e., "TP" for Type Pattern, while symbol commands use the letter "S", i.e., "RS" for Replace Symbol. For more powerful string matching and replacement, TEDI defines several metatext (wild card) constructs. A metatext string is a string taken to stand for more than the literal sequence of characters constituting it by defining some special characters to be given generalized meanings. To indicate the referenced strings are to be so interpreted, the letter "X" is used in the commands; in the command descriptions the abbreviation "mtext" is used for metatext in a matching context while "rtext" is used for metatext in a replacement context. For metatext matching purposes, the case is not considered. Thus one use of metatext is to search for strings whose case is unknown. If one of the special characters introduced below is desired literally, it should be preceded in the mtext or rtext string by the AT sign "@@". The AT sign itself may be specified in a metatext string as "@@@@". Finally, note that metatext searching is much slower than either pattern or symbol searching, so such a search should be used only when its generality is needed. (1) Single Wild Characters: "?" matches any character, "@&" matches any alpha~numeric, and "@!" matches any non-alphanumeric. Single wild characters are not interpreted in replacement strings. (2) Character Classes: Brackets enclosing a string of characters matches any one of the enclosed characters. For example @[xyz@] matches a single x, a single y, or a single z. @[@&$@_@] matches any single alphanumeric, dollar, or underline. The minus sign between two characters indicates a range of characters. For example @[I-N@] matches any character in the range from I to N inclusive. In replacement strings, use @[@] without any enclosed characters to obtain whatever was matched in the same character class, same meaning ordinal position from left to right. To change the order, enclose the ordinal in the brackets in the replacement string. For example, @[3@] enters into the replacement string whatever was matched by the third character class in the match string. (3) Ellipses: For matching variable length strings, the dot-dot-dot notation is used. "..." matches anything. For example "m...e" matches both "message" and "mad ape". "..@&" matches any number of contiguous alpha~numeric characters. "..@!" matches any number of contiguous non-~alpha~numeric characters. "..a" matches any number of contiguous a's. "..@[xyz@]" matches any strings composed solely of x, y, and z. Note that zero occurrences is acceptable, so without the presence of something else an isolated ellipsis will match every line, using zero of the quantities as a successful match. In replacement strings the simple ellipsis is used to represent any of the special forms. The correspondence is made in an ordinal manner from left to right. To change the order, use the form "..n" where n is the ordinal. For example, in a replacement text string, "..3" invokes whatever was matched by the third ellipsis in the match string, regardless of the type of that ellipsis. In all cases, the shortest possible ellipsis match is taken. (4) Symbols: Metatext strings enclosed in angle brackets match only if preceded and followed by either a separator or by the beginning or the end of the line. Thus @ matches all symbols begining with x. A single angle bracket may be used to obtain a one-~sided symbol. Examples: TX*,,72,80;@? .s types all lines containing anything in columns 72 through 80. RX*;@<5@[0-9@]@>;8@[@] .s replaces each two digit number beginning with 5 by a two digit number beginning with 8 and ending in the same digit as the original. RX*;PRINT...,;WRITE (5,...) .s replaces all FORTRAN PRINT statements with WRITE statements with logical unit 5 and the same format number while RX*;WRITE...(5,...);PRINT ..2, .S reverses the change. .s3 .tp10 .c80 REGISTERS .s Ten numeric registers, R0, R1, ..., R9, may be used for temporary storage of integer data. The command Set Register, "SRn,k", sets register n to value k. The register may then be used in place of a numeric argument in a command. For example, "SR3,5" followed by "T R3" types line 5. Note that the Set Register command is a single mnemonic so there is no space between the "S" and the "R" whereas when the register is used to represent a number in the Type command there is a space between the "T" and the "R". The greatest utility of these registers is in DO loops and command files, but explicit use is helpful when doing copies or moves in long files as a means of recording line numbers. As a DO~-LOOP example, .br "SR1,1/DOP*/_____END/SR2,./TD R1,R2/SR1,R2+1/NDO" .s .br will type out all FORTRAN program units in a delimited form. Future versions of TEDI will set R0, R8, and R9 after every string match command, so only registers R1 through R7 are recommended for general use in command files. Type commands useful with registers are "TI", Type Immediate, and "TSI", Type String Immediate. The following example counts the number of lines in which the symbol X1 occurs. "SR1,0;DOS*;X1;SR1,R1+1;NDO;TSI;Number of X1's =;TI R1" .s3 .tp10 .c80 REMEMBERED STRINGS .s Three different strings are remembered. They are respectively the match string, the replacement string, and the DO string. These strings contain the string most recently used to reference them. If in any command the null string is input for one of the string arguments, the remembered value is invoked. For example, the command sequence TPA;Hello;RP;;Goodbye .s will replace the next "Hello" found with "Goodbye" without the need to type "Hello" twice. One of the consequences of remembered strings is that the replace commands may not be used with null input to delete strings--~the delete commands must be used instead. In order to set the MATCH, REPLACEMENT, and DO string buffers from the contents of a line, the set string commands are used. They are SSMm,,c1,c2", "SSRm,,c1,c2", and SSDm,,c1,c2. These set the appropriate string with the contents of line m, columns c1 through c2. Trailing blanks will be supplied if necessary. As an example, to interchange columns 1-10 with columns 21-30 in lines 100 to 200, use the following command: .br DO100,200/SSR,,21,30/DC,,21,30/BC//NDO .s3 .tp10 .c80 COMMAND FILES .s Files containing sequences of commands may be executed. The file is invoked with the Use command, "Um1,m2,...,mk/filename". The numeric arguments are optional and cause setting of the registers R1, R2, ..., Rk before beginning execution of the command file. For example, if a sequence of commands is prepared in the file "COMFIL", the commands will be executed as a consequence of the command "U/COMFIL". Command files may also be invoked using the indirect notation "@@" either on the initial execute line or in any of the Open commands. For example, "TEDI_@@COMFIL" or "O;@@COMFIL". Lines beginning with an exclamation point "@!" in column one are considered comment lines. Leading blanks in commands (although not in strings) are ignored, so that commands may be indented for readability. Command files may not be nested or included in the range of a "DO". .tp10 .s3 .c80 FILE HANDLING COMMANDS .s2 .lm10 .p-5,0,6 .ts30 O;filename!Open .s Open an existing filename or, if filename does not yet exist, start a new file of that name. If another file is already open when this command is given, and if any changes have been made in it, a new version is written before proceeding with the new filename. .s OD;filename!Open Discarding .s Open an existing or new file as in the Open command. In this case, however, a previously opened file is not updated, even if changes have been made. This is a useful command when erroneous changes have been made and a new copy of the original file is desired. .s W!Write .s Write out a new version of the working file. This command should be used frequently to provide "snapshots" of the editing process and to provide a recovery file to use to recover from editing or hardware failures. The equivalent of a Write is automatic when an End command is given or a new file is opened with the Open command. .s WFm,n;filename!Write File .s Write lines m through n of the working file into a file of the name filename. No change of the name of the working file takes place. The default range is the entire working file. .s WFNm,n;filename!Write File Numbered .s Write lines m through n of the working file into a file of the name filename. Include the line numbers in the file at the beginning of each line. No change to the name of the working file takes place. The default range is the entire working file. .s WR;filename!Write Renaming .s The present working file is written out to filename. Moreover, the name associated with the working file (the name used when a file write is necessary for the End or Open commands) is changed to filename. .s Um1,...,mk;filename!Use .s Use the contents of filename as a source of commands. The file should be created to contain commands identical to those that would otherwise be typed in at the terminal. At the end of reading through filename and executing its commands, TEDI returns to the terminal for additional commands. The numeric arguments m1,...,mk are optional and cause setting of the registers R1, R2, ...., Rk before beginning execution of the command file. This allows passing "arguments" to the command file in the manner of a subroutine or macro. Command files may not be nested or included in the range of DO commands. .tp10 .s3 .c80 KEY-EDIT SCREEN EDITING .s .p5,1,6 .lm5 A screen editor for the VT-100 terminal or its emulators is invoked with the "K", Key-edit command. This command works only on VMS Version 2.0 or later. The command "K", "Km", or "Km,n" invokes the screen editor with the initial window determined by the line number arguments. The default is ten lines starting at the current line. The window may be extended upward ten lines at a time with the BACK-SPACE key and may be extended downward ten lines at a time with the LINE-FEED key. The Key-edit command is terminated and normal editing resumed with the CTRL-Z key. .tp13 Two special sets of keys are used in Key-edit mode. The first set is the cursor control keys, whose function is obvious, and the second set is the PF1-PF4 keys that are designated from left to right as .nf .s IL Insert Line .----. .----. .----. .----. DL Delete Line @| IL @| @| DL @| @| IC @| @| DC @| IC Insert Character `----' `----' `----' `----' DC Delete Character .f .s Placing a marked card with these designations immediately above the PF keys is recommmended before attempting to use the Key-edit command. Normally Key-edit is in replace mode in which anything typed replaces what is under the cursor. Two other modes, insert line and insert character, are toggled on and off by the keys of the same name. When in insert line mode (which is flagged by LED_@#1 lighting up on the terminal) new lines are entered before the line under the cursor when insert line mode is entered. Successive carriage returns cause additional lines to be entered until insert line mode is terminated by another IL key stroke, or any other cursor control key. When in insert character mode (which is flagged by LED @#3 lighting up on the terminal) characters are inserted before the character under the cursor. DL, delete line, behaves differently depending on whether the cursor is at the left margin or not. If it is at the left margin, the entire line is deleted and the space closed up. If it is not at the left margin, the line is erased to the end of line. DC, delete character, deletes only the character under the cursor. Six additional special functions are provided with control keys. They are: .s .nf CTRL-A Move After CTRL-B Move Before CTRL-V Divide Line at Cursor CTRL-N Join Line to next line CTRL-L Put cursor at top of window CTRL-K Move cursor down five lines .f .s3 .tp10 .c80 EXCHANGE CURSOR EDIT .s .lm10 .p-5,0,6 .ts30 .s Xm,n!Exchange .s Exchange types out lines m through n one at a time, prompting with a colon beneath the line for the user to specify the exchange of characters desired in the line above. .s .p-8,0,5 .lm19 .ts19 !BLANK -- replicate the character above. .s @\!BACKSLASH -- delete the character above. .s @_!UNDERSCORE -- replace the character above with a blank. .s @^...@^!CARET string CARET -- insert the string before the character above the first caret. The ellipsis stands for any character(s) except carets. .s @|!VERTICAL BAR -- split the line before the character above the bar. .s3 .tp10 .c80 .lm5 .p5,1,6 TYPE, PRINT, and LOCATE COMMANDS .s The type commands cause type out of the selected lines at the controlling terminal. The print commands cause output to go to the logical device TEDI$PRINT, which must be assigned either to a disk file or to a spooled device. For example, to make such output go to the spooled line printer, before entering TEDI give the monitor command "ASSIGN LPA0: TEDI$PRINT". The locate commands cause no actual output. They do, however, carry out the same search procedures as the type and print commands and affect the current line number in the same way. They are useful for locating desired lines in command files, particularly within the range of "DO" iteration loops. .lm10 .p-5,0,6 .ts 30 .s1 Tm,n!Type Pm,n!Print Lm,n!Locate .s Type, print, or locate lines m through n. .s1 TAm,k!Type After PAm,k!Print After LAm,n!Locate After .s Type, print, or locate the k lines after line m. .s1 TBm,k!Type Before PBm,k!Print Before LBm,k!Locate Before .s Type, print, or locate the k lines before line m. .s TPm,n,c,d;pat!Type Pattern PPm,n,c,d;pat!Print Pattern LPm,n,c,d;pat!Locate Pattern .s Type, print, or locate all lines from m through n which contain pat in columns c through d. .s .s TPAm,k,c,d;pat!Type Pattern After PPAm,k,c,d;pat!Print Pattern After LPAm,k,c,d;pat!Locate Pattern After .s Type the next k lines containing sym in columns c through d. If m is present, start the search after line m. .s TPBm,k,c,d;pat!Type Pattern Before PPBm,k,c,d;pat!Print Pattern Before LPBm,k,c,d;pat!Locate Pattern Before .s Type the previous k lines containing pat in columns c thorugh d. If m is present, start the search before m. .s TSm,n,c,d;sym!Type Symbol PSm,n,c,d;sym!Print Symbol LSm,n,c,d;sym!Locate Symbol .s Type, print, or locate all lines from m through n which contain sym in columns c through d. .s TSAm,k,c,d;sym!Type Symbol After PSAm,k,c,d;sym!Print Symbol After LSAm,k,c,d;sym!Locate Symbol After .s Type, print, or locate the next k lines containing sym in columns c through d. If m is present, start the search after line m. .s TSBm,k,c,d;sym!Type Symbol Before PSBm,k,c,d;sym!Print Symbol Before LSBm,k,c,d;sym!Locate Symbol Before .s Type, print, or locate the previous k lines contain sym in columns c through d. If m is present, start the search before line m. .s TXm,n,c,d;mtext!Type TeXt PXm,n,c,d;mtext!Print TeXt LXm,n,c,d;mtext!Locate TeXt .s Type, print, or locate all lines from m through n which contain mtext in columns c through d. .s TXAm,k,c,d;mtext!Type TeXt After PXAm,k,c,d;mtext!Print TeXt After LXAm,k,c,d;mtext!Locate Text After .s Type, print, or locate the next k lines containing mtext in columns c through d. If m is present, start the search after line m. .s TXBm,k,c,d;mtext!Type TeXt Before PXBm,k,c,d;mtext!Print TeXt Before LXBm,k,c,d;mtext!Locate TeXt Before .s Type, print, or locate the previous k lines containing mtext in columns c through d. If m is present, start the search before line m. .s TOm,n!Type Octal POm,n!Print Octal .s Type or print lines m through n displaying each character in its octal representation. .s TDm,n,k,i!Type Delimited PDm,n,k,i!Print Delimited .s Type or print lines m through n in blocks of k lines separated by i skips. The defaults are k = 60 and i = 6, values that break DTC and DECWRITER output at page boundaries. .s TCm,n!Type Columns PCm,n!Print Columns .s Type or print lines m through n preceded by a list of column numbers. .s TIk!Type Immediate PIk!Print Immediate .s Type or print the numerical values k. In practice k is usually a register (see discussion of registers above). .s TSI;string!Type String Immediate PSI;string!Print String Immediate .s Type or print "string". Useful in command files to send messages. .s3 .tp10 .c80 SWITCH SETTINGS .s2 S!Settings .s Report the value of all switch settings. .s SIi,j!Set Indentation .s This command initiates a special mode for the text input commands IAL, IBL, and RL to cause systematically indented text so as to emphasize program structure. If i is present and not zero, it establishes the initial indent level and j establishes the increment. When this has been done, any lines entered in text mode will receive the distinctive prompt "@>" and will be indented to the current level with the following exceptions. If a line begins with a period, the text following will begin in column one. If a line begins with a plus sign, the indent level will be incremented by j before beginning the following line, and a minus will similarly decrement the indent level. A zero will reset the indent level to i. A colon as the first character will cause all characters through the first blank to be placed starting at column two, and then the remainder starting at the current indent level (this is for statement labels in many languages) while a comma behaves similarly except the first string starts at column i as is appropriate for a FORTRAN continuation. The indent function may be disabled by an SI command with no arguments. The indent parameters i and j are saved across executions in the working file, but the current indent level is not and is restarted at the beginning of each execution. As an example of using the Set Indent command to input RATFOR text, the input string .s .nf SI3,3;IAL;while (getlin(buffer,STDIN) @^= EOF);+@[ if (buffer(1) == EOS);+next;-else;+call putlin(buffer,STDOUT);-@];. .s causes the text to be entered as .s while (getlin(buffer,STDIN) @^= EOF) @[ if (buffer(1) == EOS) next else call putlin(buffer,STDOUT) @] .s .f Multiple occurrences of the plus or minus indicators are properly interpreted. .s STC;char!Set Tab Character .s Sets the tab character to char. Subsequent occurrences of char in text input mode (in response to the IAL, IBL, and RL commands) will be expanded to blanks in accordance with the column numbers set in the STS, Set Tab Stops, command. The blank, the initial setting, has a special interpretation when it is the tab character--an even number of blanks is interpreted as half that many tabs while an odd number of blanks is taken literally. .s STSc,...,d!Set Tab Stops .s Set the tab stops to c,...,d up to a maximum of 20. There are no initial settings. .s SCC!Set Control Characters .s This switch causes control characters, other than the final carriage-~return line-~feed, to be printed in the "caret" notation, i.e., a caret followed by an upper case alphabetic character. This switch combined with the force literal character allows fairly complete manipulation of non~printing control charcters in the text. .s NCC!No Control Characters .s This switch disables the "caret" mode of printing control characters and instead transmits them literally to the terminal. This is the initial setting. .s SN!Set Numbers .s Precede each line of terminal output with its implicit line number. This is the initial setting. .s NN!No Numbers .s Do not precede lines with their line numbers. .s SV!Set Verification .s Type out all changes that occur as a result of line or pattern replacement commands. This is the initial setting. .s NV!No Verification .s Do not type out verification of changes as they are made. .s SCTc,d!Set Columns Typed .s Type out only columns c through d in subsequent type and print commands. A SCT command with no arguments restores the normal situation wherein all columns present are typed. .s SXP;char!Set TeXt Prompt .s When in text entry mode, i.e., when using the IAL, IBL, or RL commands, the input lines are normally prompted with the ampersand. This command allows setting the prompt to some alternative character. .s NXP!No Text Prompt .s This disables the text prompt altogether. .s SRi,k!Set Register .s Set register i to the integer value k. .s SSMm,,c,d!Set String Match .s Set the match string to the contents of line m columns c through d. .s SSRm,,c,d!Set String Replace .s Set the replace string to the contents of line m columns c through d. .s SSDm,,c,d!Set String Do .s Set the DO string to the contents of line m columns c through d. .s3 .tp10 .c80 INSERT COMMANDS .s2 .lm5 .p5,0,6 Insert is the default command in the sense that the initial "I" in any of the insert commands may be omitted. For example, "AP", After Pattern, is identical to "IAP", Insert After Pattern. .lm10 .ts 30 .p-5,0,6 .s IALm;text;...;text;.!Insert After Line .s Insert new lines after line m. Text input is terminated by a line containing only a period in column one. To enter a line containing only a period, enter a blank after the period. .s IBLm;text;...;text;.!Insert Before Line .s Insert new lines before line m. Text input is terminated by a line containing only a period in column one. To enter a line containing only a period, enter a blank after the period. .s IAPm,n,c,d;pat;newpat!Insert After Pattern .s Insert newpat after each occurrence of pat in columns c through d of lines m through n. .s IBPm,n,c,d;pat;newpat!Insert Before Pattern .s Insert newpat before each occurrence of pat in columns c through d of lines m through n. .s IASm,n,c,d;sym;newpat!Insert After Symbol .s Insert newpat after each occurrence of sym in columns c through d of lines m through n. .s IBSm,n,c,d;sym;newpat!Insert Before Symbol .s Insert newpat before each occurrence of sym in columns c through d of lines m through n. .s IAXm,n,c,d;mtext;rtext!Insert After TeXt .s Insert rtext after each occurrence of mtext in columns c through d of lines m through n. .s IBXm,n,c,d;mtext;rtext!Insert Before TeXt .s Insert rtext before each occurrence of mtext in columns c through d of lines m through n. .s IACm,n,c;newpat!Insert After Column .s Insert newpat after column c in lines m through n. If c is absent, after the last non~blank character. .s IBCm,n,c;newpat!Insert Before Column .s Insert newpat before column c in lines m through n. If c is absent, insert before column one. .s2 .tp10 .c80 REPLACE COMMANDS .s2 RL;text;...;text;.!Replace Lines .s Replace lines m throuh n with new lines. Text input is terminated by a line containing only a period in column one. To enter a line containing only a period, enter a blank after the period. .s RPm,n,c,d;pat;newpat!Replace Pattern .s Replace each occurrence of pat in columns c through d of lines m through n with newpat. .s RSm,n,c,d;sym;newpat!Replace Symbol .s Replace each occurrence of sym in columns c through d of lines m through n with newpat. .s RXm,n,c,d;mtext;rtext!Replace TeXt .s Replace each occurrence of mtext in columns c through d of lines m through n with rtext. .s RCm,n,c,d;newpat!Replace Columns .s Replace columns c through d of lines m through n with newpat. .s RAPm,n,c,d;pat;newpat!Replace After Pattern .s Replace everything after the first occurrence of pat in columns c through d of lines m through n with newpat. .s RASm,n,c,d;sym;newpat!Replace After Symbol .s Replace everything after the first occurrence of sym in columns c through d of lines m through n with newpat. .s RAXm,n,c,d;mtext;rtext!Replace After TeXt .s Replace each occurrence of mtext in columns c through d of lines m through n with rtext. .s RACm,n,c;newpat!Replace After Column .s Replace everything after column c in lines m through n with newpat. .s RBPm,n,c,d;pat;newpat!Replace Before Pattern .s Replace everything before the first occurrence of pat in columns c through d of lines m through n with newpat. .s RBSm,n,c,d;sym;newpat!Replace Before Symbol .s Replace everything before the first occurrence of sym in columns c through d of lines m through n with newpat. .s RBXm,n,c,d;mtext;rtext!Replace Before TeXt .s Replace everything before the first occurrence of mtext in columns c through d of lines m through n with rtext. .s RBCm,n,c;newpat!Replace Before Column .s Replace everything before column c in lines m through n with newpat. .s2 .tp10 .c DELETE COMMANDS .s2 DLm,n!Delete Lines .s Delete lines m through n. .s DPm,n,c,d;pat!Delete Pattern .s Delete each occurrence of pat in columns c through d of lines m through n. .s DSm,n,c,d;sym!Delete Symbol .s Delete each occurrence of sym in columns c through d of lines m through n. .s DXm,n,c,d;mtext!Delete TeXt .s Delete each occurrence of mtext in columns c through d of lines m through n. .s DCm,n,c,d!Delete Columns .s Delete columns c through d in each of lines m through n. .s DAPm,n,c,d;pat!Delete After Pattern .s Delete everything after the first occurrence of pat in columns c through d of lines m through n. .s DASm,n,c,d;sym!Delete After Symbol .s Delete everything after the first occurrence of sym in columns c through d of lines m through n. .s DACm,n,c!Delete After Column .s Delete everything after column c in lines m through n. This command also removes trailing blanks. .s DBPm,n,c,d;pat!Delete Before Pattern .s Delete everything before the first occurrence of pat in columns c through d of lines m through n. .s DBSm,n,c,d;sym!Delete Before Symbol .s Delete everything before the first occurrence of sym in columns c through d of lines m through n. .s DBXm,n,c,d;mtext!Delete Before TeXt .s Delete everything before the first occurrence of mtext in columns c through d of lines m through n. .s DBCm,n,c!Delete Before Column .s Delete everything before column c in each of lines m through n. .s3 .tp10 .c80 MOVE and COPY COMMANDS .s2 MAm,n,s!Move After .s Move lines m through n after line s. .s MBm,n,s!Move Before .s Move lines m through n before line s. .s CAm,n,s!Copy After .s Copy lines m through n after line s. .s CBm,n,s!Copy Before .s Copy lines m through n before line s. .s CFAm,n,s;filename!Copy File After .s Copy lines m through n of filename after line s of the working file. A nonstandard default of 1 for m and the last line of filename for n is used for this command. .s CFBm,n,s;filename!Copy File Before .s Copy lines m through n of filename before line s of the working file. A nonstandard default of 1 for m and the last line of filename for n is used for this command. .s3 .tp10 .c80 DIVIDE and JOIN COMMANDS .s2 VAPm,n,c,d;pat!DiVide After Pattern .s Divide line into new lines after each occurrence of pat in columns c through d of lines m through n. .s VASm,n,c,d;sym!DiVide After Symbol .s Divide line into new lines after each occurrence of sym in columns c through d of lines m through n. .s VAXm,n,c,d;mtext!DiVide After TeXt .s Divide line into new lines after each occurrence of mtext in columns c through d of lines m through n. .s VACm,n,c!DiVide After Column .s Divide line into new lines after column c in each of lines m through n. .s VBPm,n,c,d;pat!DiVide Before Pattern .s Divide line into new lines before each occurrence of pat in columns c through d of lines m through n. .s VBSm,n,c,d;sym!DiVide Before Symbol .s Divide line into new lines before each occurrence of sym in columns c through d of lines m through n. .s VBXm,n,c,d;mtext!DiVide Before TeXt .s Divide line into new lines before each occurrence of mtext in columns c through d of lines m through n. .s VBCm,n,c!DiVide Before Column .s Divide line into new lines before column c in each of lines m through n. .s JLm,n!Join Lines .s Join lines m through n into one line. .s3 .tp10 .c ITERATION COMMANDS .s .lm5 .p5,1,5 It is often desirable to execute a command for those lines in a range of lines which satisfy some pattern matching conditions. For simple cases, the "RP", Replace Pattern, command is adequate. However, if the conditional pattern and the pattern to be altered are different, a more general construct is required. TEDI provides "DO" commands for this purpose. A "DO" command is followed by a sequence of additional commands which are to be executed for those lines implied by the "DO". The sequence must be terminated with an "NDO", End Do command. The separate elements of the command sequence may be separated by either logical line-~feed characters or with actual carriage returns. For example, to delete the symbol "X" in every line which also contains the pattern "ABC" one would use the sequence, .s DOP*;ABC;DS;X;NDO .s DO's may be nested up to five deep. For example, to delete all lines which contain the symbol "PI" but do not contain the pattern "RADIUS", one would use the sequence, .s DOS*;PI;DNP;RADIUS;DL;NDO;NDO .s It is important to note that the first DO has the asterisk following it, indicating "all lines", whereas the second DO does not, indicating its execution only for the "current line", i.e., the line in which a "PI" has been found. The total character count of a nested sequence of DO commands must be less than or equal to 512, which includes all characters from the outermost DO to the outermost NDO. .lm10 .p-5,0,6 .s DOm,n!Do .s Repeat the following commands up until the next matching NDO for all lines in the range m through n. .s DOPm,n,c,d;pat!Do On Pattern .s Repeat the following commands up until the next matching NDO for those lines in the range m through n which contain pat in columns c through d. .s DOSm,n,c,d;sym!Do On Symbol .s Repeat the following commands up until the next matching NDO for those lines in the range m through n which contain pat in columns c through d. .s DOXm,n,c,d;mtext!Do On TeXt .s Repeat the following commands up until the next matching NDO for those lines in the range m through n which contain mtext in columns c through d. .s DNPm,n,c,d;pat!Do No Pattern .s Repeat the following commands up until the next matching NDO for those lines in the range m through n which do not contain pat in columns c through d. .s DNSm,n,c,d;sym!Do No Symbol .s Repeat the following commands up until the next matching NDO for those lines in the range m through n which do not contain sym in columns c through d. .s DNXm,n,c,d;mtext!Do No TeXt .s Repeat the following commands up until the next matching NDO for those lines in the range m through n which do not contain mtext in column c through d. .s NDO!End DO .s Terminate a DO sequence. DO's and NDO's must be matched. .s3 .tp10 .c80 TAPE COMMANDS .s .lm5 .p5,1,6 The Texas Instruments terminal cassette tapes or the Tektronix cartridge tapes may be used to transfer and store files using special TEDI commands. The TI cassettes may be used only at 300 baud while the Tektronix cartridges may be used at many baud rates, up to and including 9600 baud. .p-5,0,6 .lm10 .s WTm,n!Write Tape .s Write a standard tape record from lines m through n of the working file. .s CTAm!Copy Tape After .s Read a standard tape record into the working file after line m. .s CTBm!Copy Tape Before .s Read a standard tape record into the working file before line m. .s3 .tp10 .c80 FORMATTING COMMANDS .s2 .p5,0,5 .lm5 The TEDI formatter is an integral part of the TEDI editor-~formatter. The format commands transform a file of source text to a formatted form, either directly to a terminal or device, or to a disk file. The contents of the source file include various formatting codes and characters to indicate the desired format. These formatting instructions are described in a separate document, "The TEDI Formatter, VAX/VMS Version". The formatting commands which invoke the formatting process are listed here for the sake of completeness. .lm10 .p-5,0,6 .s Fm,n!Format .s Format lines m through n to the terminal. .s FPGp,q!Format Pages .s Format pages p through q to the terminal. .s FPFp,q;filename!Format Pages to File .s Format pages p through q to filename. .s FPPp,q!Format Pages to Printer .s Format pages p through q to logical device TEDI$PRINT. .s3 .c80 TERMINATION COMMANDS .s2 END!End .s Updates the source file, saving the working file with all switch settings and file contents, and terminates the editor. .s QUIT!Quit .s Terminates the editor, discarding the working file without making any changes to the source file. .pg .c ALPHABETICAL COMMAND SUMMARY .s .nf .ts35,70 .s Abbreviation!Command!Page .s CAm,n,s!Copy After!22 CBm,n,s!Copy Before!22 CFAm,n,s;filename!Copy File After!23 CFBm,n,s;filename!Copy File Before!23 CTAm!Copy Tape After!26 CTBm!Copy Tape Before!26 DACm,n,c!Delete After Column!22 DAPm,n,c,d;pat!Delete After Pattern!22 DASm,n,c,d;sym!Delete After Symbol!22 DAXm,n,c,d;mtext!Delete After TeXt!21 DBCm,n,c!Delete Before Column!22 DBPm,n,c,d;pat!Delete Before Pattern!22 DBSm,n,c,d;sym!Delete Before Symbol!21 DBXm,n,c,d;mtext!Delete Before TeXt!22 DCm,n,c,d!Delete Columns!21 DLm,n!Delete Lines!21 DNPm,n,c,d;pat!Do No Pattern!25 DNSm,n,c,d;sym!Do No Symbol!25 DNXm,n,c,d;mtext!Do No TeXt!25 DOm,n!Do!25 DOPm,n,c,d;pat!Do On Pattern!25 DOSm,n,c,d;sym!Do On Symbol!25 DOXm,n,c,d;mtext!Do On TeXt!25 DPm,n,c,d;pat!Delete Pattern!21 DSm,n,c,d;sym!Delete Symbol!21 DXm,n,c,d;mtext!Delete TeXt!21 END!End!27 Fm,n!Format!26 FPFp,q;filename!Format Pages to File!26 FPGp,q!Format Pages!26 FPPp,q!Format Pages to Printer!27 IACm,n,c;newpat!Insert After Column!19 IALm;text;...;text;.!Insert After Line!18 IAPm,n,c,d;pat;newpat!Insert After Pattern!19 IASm,n,c,d;sym;newpat!Insert After Symbol!19 IAXm,n,c,d;mtext;rtext!Insert After TeXt!19 IBCm,n,c;newpat!Insert Before Column!19 IBLm;text;...;text;.!Insert Before Line!19 IBPm,n,c,d;pat;newpat!Insert Before Pattern!19 IBSm,n,c,d;sym;newpat!Insert Before Symbol!19 JLm,n!Join Lines!24 Km,n!Key Edit!11 Lm,n!Locate!13 LAm,k!Locate After!13 LBm,k!Locate Before!13 LPm,n,c,d;pat!Locate Pattern!13 LPAm,k,c,d;pat!Locate Pattern After!14 LPBm,k,c,d;pat!Locate Pattern Before!14 LSm,n,c,d;sym!Locate Symbol!14 LSAm,k,c,d;sym!Locate Symbol After!14 LXm,n,c,d;mtext!Locate TeXt!14 LXAm,k,c,d;mtext!Locate TeXt After!15 LXBm,k,c,d;mtext!Locate TeXt Before!15 MAm,n,s!Move After!22 MBm,n,s!Move Before!22 NCC!No Control Characters!17 NDO!ENd Do!25 NN!No Numbers!17 NV!No Verification!17 NXP!No TeXt Prompt!18 O;filename!Open!10 OD;filename!Open Discarding!10 Pm,n!Print!13 PAm,k!Print After!13 PBm,k!Print Before!13 PCm,n!Print with Columns!15 PDm,n,k,s!Print Delimited!15 PIk!Print Immediate!15 POm,n!Print Octal!15 PPm,n,c,d;pat!Print Pattern!13 PPAm,k,c,d;pat!Print Pattern After!14 PPBm,k,c,d;pat!Print Pattern Before!14 PSm,n,c,d;sym!Print Symbol!14 PSAm,k,c,d;sym!Print Symbol After!14 PSBm,k,c,d;sym!Print Symbol Before!14 PSI;string!Print String Immediate!15 PXm,n,c,d;mtext!Print TeXt!14 PXAm,k,c,d;mtext!Print TeXt After!15 PXBm,k,c,d;mtext!Print TeXt Before!14 QUIT!Quit!27 RACm,n,c;newpat!Replace After Column!20 RAPm,n,c,d;pat;newpat!Replace After Pattern!20 RASm,n,c,d;sym;newpat!Replace After Symbol!20 RAXm,n,c,d;mtext;rtext!Replace After TeXt!20 RBCm,n,c;newpat!Replace Before Column!21 RBPm,n,c,d;pat;newpat!Replace Before Pattern!21 RBSm,n,c,d;sym;newpat!Replace Before Symbol!21 RBXm,n,c,d;mtext;rtext!Replace Before TeXt!21 RCm,n,c,d;newpat!Replace Columns!20 RLm,n!Replace Lines!20 RPm,n,c,d;pat;newpat!Replace Pattern!20 RSm,n,c,d;sym;newpat!Replace Symbol!20 RXm,n,c,d;mtextm;rtext!Replace TeXt!20 S!Settings!16 SCC!Set Control Characters!17 SCTc,d!Set Columns Typed!18 SIi,j!Set Indentation!16 SN!Set Numbers!17 SRk!Set Register!18 SSDm,,c,d!Set String Do!18 SSMm,,c,d!Set String Match!18 SSRm,,c,d!Set String Replace!18 STC;char!Set Tab Character!17 STSc,,,d!Set Tab Stops!17 SV!Set Verify!17 SXP;char!Set TeXt Prompt!18 Tm,n!Type!13 TAm,k!Type After!13 TBm,k!Type Before!13 TCm,n!Type with Columns!15 TDm,n,k,s!Type Delimited!15 TIk!Type Immediate!15 TOm,n!Type Octal!15 TPm,n,c,d;pat!Type Pattern!13 TPAm,k,c,d;pat!Type Pattern After!14 TPBm,k,c,d;pat!Type Pattern Before!14 TSm,n,c,d;sym!Type Symbol!14 TSAm,k,c,d;sym!Type Symbol After!14 TSBm,k,c,d;sym!Type Symbol Before!14 TSI;string!Type String Immediate!15 TXm,n,c,d;mtext!Type TeXt!14 TXAm,k,c,d;mtext!Type TeXt After!15 TXBm,k,c,d;mtext!Type TeXt Before!15 Um1,...,mk;filename!Use!11 VACm,n,c!Divide After Column!23 VAPm,n,c,d;pat!Divide After Pattern!23 VASm,n,c,d;sym!Divide After Symbol!23 VAXm,n,c,d;mtext!Divide After TeXt!23 VBCm,n,c!Divide Before Column!24 VBPm,n,c,d;pat!Divide Before Pattern!23 VBSm,n,c,d;sym!Divide Before Symbol!23 VBXm,n,c,d;mtext!Divide Before TeXt!23 W!Write!10 WFm,n;filename!Write File!11 WFNm,n;filename!Write File Numbered!11 WR;filename!Write Renaming!11 WTm,n!Write Tape!26 Xm,n!Exchange!12 .s5 May 13, 1981