TECO Initialization for RSTS and VMS Kelvin Smith, Financial Computer Systems, Inc., Stamford, Connecticut Note: This article is specifically oriented to RSTS and VMS systems; much of it may apply to other TECO versions, particularly on other PDP-11 operating systems, but I can make no assurances since I do not have access to such systems. Since I no longer have access to a VMS system either, I cannot assure the accuracy of all VMS information, although it is based on previous VMS use and statements in DEC's TECO User's Guide. The start of a TECO editing session is for many people shrouded in mystery. It may come as a surprise to many readers, for example, that the CCL (under RSTS) or DCL (under VMS) command to start TECO is handled by a TECO program, rather than the MACRO-written TECO run-time system or image. Decoding the command, with the associated memory logical or file and any switches, is the work of a magical TECO macro called TECO.TEC. (Exception: The TECO run-time system directly handles the /B, /B+, and /B2 filespec switches.) Under RSTS, the macro resides in a separate file in account TECO$: ([1,2] before V9.0). Under VMS, these operations are stored in the TECO image, but are handled by the same TECO macro. TECO.TEC - The system initializer An "expanded" copy (commented and reasonably readable, as TECO macros go) is available on RSTS distribution media, under the name TECO.TES (I don't know if other operating system kits include it). For those unable or unwilling to peruse the macro, here is some information you may find useful. I am describing here the TECO.TEC which DEC distributes; some systems have versions made to fit their own needs, which means that some of the features described may not work on your system (for example, some installations delete references to TECO.INI and some of the checking for switches in order to speed up initialization a bit). For this article, I will refer to the system's initializer under both RSTS and VMS as TECO.TEC. When TECO starts, the entire command line is made accessible to the user, as well as to the initializer. Under RSTS, the CCL command is placed immediately in the buffer. Remember that RSTS expands any CCL command to its full length: The abbreviation "TE" which is allowed on most systems becomes a full "TECO". Under VMS, TECO initially puts the command line (expanded as appropriate under DCL) in q-register Z, but it is moved from there to the buffer before TECO.TEC executes the user's initialization routines. TECO.INI - The private initializer RSTS TECO allows any user to operate on the CCL command in the same way that TECO.TEC does by use of a file in your own account named TECO.INI, which is executed every time you start TECO (unless you specifically disable it with the switch /NOINI). VMS has three options for start-up. Two are of the same form as the TECO.INI file: giving Page 2 either a short list of commands or a file to execute. In either case, use the logical TEC$INIT, such as "ASSIGN "94EV" TEC$INIT" to automatically print out the current line before each prompt with a caret marking the pointer position, or "ASSIGN $TECO.INI TEC$INIT" to execute a file of TECO instructions. (Any file name is legal; note the dollar sign before the file name to indicate it is a file name and not a series of commands.) Since the list of commands cannot include any escapes and must be completely re-entered any time a change is desired, anyone doing more than the smallest amount of environment set-up will want to put the commands in a file. While INI files are most often used for loading q-registers with useful "library" macros and for setting up the TECO environment, operating on the command string is often also useful. In this article, TECO.INI means any personal initialization file, even though its name can be different under VMS. For real VMS TECO enthusiasts, TECO allows you to bypass its initializer entirely. To do this, you need a file named TECO.TEC in your account, or a file defined by the logical "TECO" (this can be either a user or a system logical). If TECO finds this, it stuffs its own TECO.TEC into q-register Y and disables its execution. Thus, you can do your own initialization totally unhindered by considerations of what TECO might do afterwards, since it will simply go to "*" prompt level. If you want to use your own TECO.TEC but still want the system's TECO.TEC to execute, you must give an MY command at the appropriate point. If you use your own TECO.TEC, you must call in any INI file yourself; additionally, the DCL command string is left in q-register Z and not parsed by the system. For most people, the capability of redefining TECO.TEC is unnecessary; you can do almost anything you want through TECO.INI. Parsing the command and switches The normal method of determining whether the command string contains a switch is the following set of commands: J :@FS%/SW%% "S ...' With this method, you start at the beginning of the buffer (since a previous search may have left you elsewhere), search for switch "/SW" and if you find it, delete it and execute a list of commands. In this way, you can include in your TECO.INI file the necessary code to check for switches which you define yourself. As long as you delete them, they will cause no problem for TECO.TEC in interpreting any DEC-defined switches you may also wish to use. The sample INI file at the end of this article includes two switches which I have defined. After your INI file completes, TECO.TEC searches for its own switches: /VTEDIT and /GTEDIT for screen mode editing, /SCROLL to enter scrolling mode, /FIND to go directly to the first occurrence of ~~/~~ in the file (which is left by VTEDIT via the ESC 0 ESC F command to exit and mark position), /INSPECT for read-only editing, /NOCREATE to inhibit automatic creation of the file named if it does not previously exist, and /NOMEMORY to inhibit the "memory" feature (see below). Of course, TECO's /NOINI switch must be parsed before executing TECO.INI. Page 3 You can also act on the file name itself; the sample TECO.INI file that DEC sends out on the distribution media automatically enables certain switches based on what file type the edited file has. In my sample INI file below, I add a .BAS file type and use /B2 ampersand continuation procedures on any file name which has no file type specified (i.e., which does not have a dot in the name). Loading q-registers As mentioned above, another use of initialization files is to initialize q-registers, often setting them to certain useful command strings (macros). To load them system-wide, RSTS systems can modify TECO.TEC with an EI command at its end which will call in the file containing the desired commands (it is probably wiser not to put the commands themselves into TECO.TEC, especially since TECO.TEC might change with new releases of the operating system and TECO). Since TECO.TEC is not separate from the VMS image, VAX systems do not allow this option--any changes must be made by each account owner, or else by installing a new TECO.TEC using the "TECO" logical as described above. If you have your own private set of macros (under either RSTS or VMS), put them into your own TECO.INI file. The sample TECO.INI file below includes examples of loading q-registers. An important note must be mentioned here: do n_o_t_ attempt to alter q-registers 9 or 0 (zero) in your TECO.INI file. These are the q-registers used by TECO.TEC while executing your INI file. Since they have been pushed on the q-register push-down list, anything stored will be lost as TECO.TEC ends. Worse, q-register 0 is used to store your INI file, at which point an M0 command is executed; changing that register causes execution immediately to abort, since you are writing over the current command stream. Another important note: you cannot have any form feed characters in the INI file, since TECO.TEC performs only a single Yank operation to read it. These dangers are not mentioned anywhere in the documentation, so make a note of them. These restrictions, of course, do not apply to VMS users who create their own TECO.TEC. Altering the text file TECO.INI, as mentioned before, executes before the CCL/DCL command string has been interpreted and executed; at this point, only the command string is in the buffer. Not until after TECO.INI finishes does TECO.TEC open any input and output files specified. Thus, your INI file cannot directly act on the text in the file you will be editing. If that is your interest, you can get around this restriction by placing the commands you want to perform into another file and then giving an EI command in TECO.INI. Any file called in with an EI command will not actually execute until after TECO.TEC has finished and any files specified in the DCL/CCL command (or loaded due to the memory feature--see below) have been opened. This is also the way to place things in q-registers 9 and 0: Put the load command for them in the other file, too. The sample INI file below includes an example of Page 4 delayed execution. TECO's memory feature TECO.TEC makes a note of what file you open for output through the CCL/DCL command. If you re-enter TECO without logging out, simply typing "TECO" (or the appropriate abbreviation on your system) with no file name will cause a backup-style edit of the file used last time. Thus, if your previous edit was of either the form TECO FILE1.DAT=FILE2.DAT or the form TECO FILE1.DAT, giving the command TECO is equivalent to TECO FILE1.DAT. RSTS stores this information in a temporary file; under VMS, the memory operation is handled through the logical TEC$MEMORY, but the effect is the same. I have attempted to write the TECO.INI file following this article generally using "structured TECO" principles. You'll certainly want to compress it before use, particularly since this is executed every time you enter TECO. The format is compatible with "automatic mode" squishing using the SQU macro sent out by DEC on RSTS distribution media. As always with TECO, experimentation and customization is encouraged. I welcome any comments or questions. Please contact me at: Kelvin Smith Financial Computer Systems, Inc. 1 Strawberry Hill Ct. Stamford, CT 06902 (203) 357-0504