% -*-LaTeX-*- % TECOVAR.LTX.7, 28-May-86 16:32:06, Edit by BEEBE % This is part of TECO.LTX It has been well understood since the earliest uses of computers that the key to code reusability is the possibility of run-time modification of processing through local variables and passed arguments. Also, repetition can sometimes be expressed more easily with recursion than with iteration. \TECO{} has all three of these features. Recursion\index{recursion} is easy---you just do it. Local and global variables are available in objects called \X{Q-registers}, which are simply places to store numbers and text. We shall have much more to say about these later. Because of the one-pass nature of the interpretation, arguments have to be available before a function code letter is recognized, so numeric arguments are given immediately before the function. There can be zero, one, or two of these. If there are two, they are separated by a comma, and the first is called the {\em \X{pre-comma argument}}, and the second, the {\em \X{post-comma argument}}, or just the {\em argument}, since that is the one used by functions which take a single argument. Each function can detect how many arguments it was called with, which of them were given, whether they are strings or numbers, and whether any modifier flags have been set. It is permissible, and common, to have omitted arguments, and for a function to perform differently, depending on the \X{modifier flags} and arguments set, as well as on the particular argument values. Examples are \T{T}, \T{1T}, and \T{1,20T}, which type out on the terminal portions of the edit buffer. A function which expects a string argument, such as the search command, generally reads it immediately following the invoking character. The end of the string\index{end of string} is determined either by finding a special terminator character, \A{ESC}\footnote{the ASCII escape character, control-[, decimal 27}, or in an alternate form, by finding a delimiter matching the character immediately following the invoking character. Examples are \T{Sfoo\A{ESC}} and \T{@S/foo/}, both of which search for the string \T{foo} in the edit buffer. A few functions, however, will also accept string values from the pre- and post-comma arguments, but this is uncommon enough that we shall delay describing how this is achieved. Both numeric and string arguments are possible with some functions. For example, \T{-3Sfoo\A{ESC}} searches backwards in the buffer for the third \T{foo} before the current position. Numeric arguments are not restricted to simple integer constants; they can be general numeric expressions involving integers, ASCII character values, buffer positions, and Q-registers, with operators for addition, subtraction, multiplication, and division, as well as bitwise operators for {\em and}\index{and}, {\em or}\index{or}, {\em exclusive-or}\index{exclusive or}, and {\em complement}\index{complement}.