From: Eric S. Raymond Date: Tue, 24 Feb 2004 06:05:55 +0000 (+0000) Subject: Added hyperlinks. X-Git-Tag: 1.0~51 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=cca16e52855140b00fec2e5fdd4f8748ad8cfec7;p=mad.git Added hyperlinks. --- diff --git a/doc/mad-manual.xml b/doc/mad-manual.xml index 075fd86..cd166e2 100644 --- a/doc/mad-manual.xml +++ b/doc/mad-manual.xml @@ -1178,16 +1178,17 @@ digit punched in col. 11) the statement label need not be punched on the additional cards. -Functions +Functions + The name of a function consists of one to six letters or digits followed by a period "." which must be written. The first character of a function name must be a letter. If the function is single-valued, then the value of the function is represented by following the function name by the proper number of arguments (see -section 3.8 for the definition of function) separated by commas and -enclosed in parentheses. Thus, ADD51., COS., POLY., and FUNCT3. are -function names, while ADD51. (X,Y,ADD.), POLY. (N, VJ, 7) and COS. (X) -are values of functions. + for the definition of function) separated +by commas and enclosed in parentheses. Thus, ADD51., COS., POLY., and +FUNCT3. are function names, while ADD51. (X,Y,ADD.), POLY. (N, VJ, 7) +and COS. (X) are values of functions. Arithmetic Operations @@ -1476,16 +1477,17 @@ floating point mode if the expression were written: Of course, many times the expression will be written as originally stated just to achieve the "truncation" effect. -A statement label (appearing in the label field of a statement) is a -constant of statement label mode. A function name with no arguments -(e.g. SIN.) is a constant of a function name mode. A single constant, -variable, or function value of statement label (function name) mode is -an expression of statement label (function name) mode. There are no -other expressions of statement label (function name) mode. If A and B -are both statement label (function name) expressions then A.E.B. and -A.NE.B are Boolean expressions except when A or B are elements of a -vactor which has been preset by a VECTOR VALUES statement (see section -3.7). In this exceptional case A.E.B. and A.NE.B are not expressions. +A statement label (appearing in the label field of a statement) +is a constant of statement label mode. A function name with no +arguments (e.g. SIN.) is a constant of a function name mode. A single +constant, variable, or function value of statement label (function +name) mode is an expression of statement label (function name) mode. +There are no other expressions of statement label (function name) +mode. If A and B are both statement label (function name) expressions +then A.E.B. and A.NE.B are Boolean expressions except when A or B are +elements of a vactor which has been preset by a VECTOR VALUES +statement (see ). In this exceptional +case A.E.B. and A.NE.B are not expressions. Subscript Expressions @@ -1980,24 +1982,23 @@ This would appear as: EXECUTE LSORT.(ARRAY, MAP, N) -(See section 3.8 for definition of functions). Here ARRAY, MAP, -N are the "arguments" of the function (subroutine) LSORT. Arguments -and parentheses may be omitted in an EXECUTE statement if the function -has no arguments. +(See for definition of functions). +Here ARRAY, MAP, N are the "arguments" of the function (subroutine) +LSORT. Arguments and parentheses may be omitted in an EXECUTE +statement if the function has no arguments. Error Return Statement Provision is made for including an error return in function -definition programs (see section 3.8). The form of the statement is -simply: +definition programs (see ). The form of the +statement is simply: ERROR RETURN -(An example of its use is shown near the end of subsection -3.8.3). +(An example of its use is shown near the end of subsection 3.8.3). In order to use it in a function evaluation, the last (right-most) argument of the function must be the label of a statement @@ -2044,7 +2045,7 @@ FUNCTION RETURN &scriptN; return to the calling program. &scriptN; is an expression whose value is to be the output of this function considered as a single valued function. &scriptN; need not be specified if outputs are specified in the argument list -(see section 3.8). +(see ). Entry to a function @@ -2055,19 +2056,20 @@ be the output of this function considered as a single valued function. ENTRY TO &scriptN; -where &scriptN; is the name of this entry (see section 3.8). +where &scriptN; is the name of this entry (see ). The Retrocomputing Museum implementation supports only one entry point per function. Attempting to specify more than one will raise a compile-time error. -List Manipulation Statements +List Manipulation Statements -These statements facilitate the writing of recursive internal and -external functions. (see section 3.8) They cause the designation and -use of a vector for the temporary storage of data and action transfer -instructions. (i.e. function returns). +These statements facilitate the writing of recursive internal +and external functions. (see ) They cause +the designation and use of a vector for the temporary storage of data +and action transfer instructions. (i.e. function returns). @@ -2097,9 +2099,9 @@ currently available element. &scriptL; is the same as any input-output list SAVE RETURN This statement will appear in the scope of the definition of a -function (see section 3.8) and cause the reentry point to the calling -program to be stored as the next available element of the currently -designated temporary storage vector. +function (see ) and cause the reentry point +to the calling program to be stored as the next available element of +the currently designated temporary storage vector. RESTORE DATA &scriptL; @@ -2305,8 +2307,8 @@ format specification, so the list may be empty.) A format specification is a string of alphabetic characters (as described below) terminated by an "*". This string is stored six characters per computer word in a vector with integer mode. This -vector may be preset (see section 3.7), computed, or read in as -data. +vector may be preset (see ), computed, +or read in as data. Carriage Control @@ -2867,15 +2869,15 @@ assigned statement label mode (see ). A function name constant is assigned function name mode (see -). +). A vector appearing as the dimension vector of some array in a dimension declaration is assigned integer mode (see ). -A vector which is preset by a vector values declaration is -assigned a mode consistent with the assigned values (see section 3.7). - +A vector which is preset by a vector values +declaration is assigned a mode consistent with the assigned values +(see ). @@ -2930,10 +2932,10 @@ is the name of the first element in the "dimension vector" for this array. If this name is D(k) (k must be an integer constant), the vactor D is automatically assigned integer mode. D may not be declared to be other than integer. In addition, D must itself be -dimensioned, either by declaration or by presetting its values -(section 3.7) to have its largest linear subscript ≤ k+n. Assuming -that elements of the array to be dimensioned are to be referred to as -A(I1, I2, +dimensioned, either by declaration or by presetting its values () to have its largest linear subscript ≤ +k+n. Assuming that elements of the array to be dimensioned are to be +referred to as A(I1, I2, In), the elements of the linear array D, i.e. D(k), D(k + 1), ...D(k + n), must be preset (or set during computation) to the values @@ -3012,11 +3014,13 @@ EQUIVALENCE (A,B), (MATRIX, XARRAY), (C, D(3)) and implies that the variables A and B are to represent the same storage location throughout the program, that MATRIX and XARRAY are to represent the same storage location through the program, etc. (Two -variables which represent the same location always have the same value -at any given time.) Thus, any number of equivalences may be -established by one EQUIVALENCE declaration, and any number of such -declarations may occur (at any place) in a program. They will be -treated as one combined declaration, however. +variables which + +represent the same location always have the same value at any given +time.) Thus, any number of equivalences may be established by one +EQUIVALENCE declaration, and any number of such declarations may occur +(at any place) in a program. They will be treated as one combined +declaration, however. Variables whose names appear within the same set of parentheses need not have the same mode. The mode must be established by the @@ -3035,7 +3039,7 @@ implies equating the entire arrays accordingly. implement EQUIVALENCE. -ERASABLE Declaration +ERASABLE Declaration This declaration has the form @@ -3047,11 +3051,13 @@ ERASABLE MATRIX, XARRAY, YARRAY word ERASABLE (which need not have the same number of dimensions) are disjoint (i.e., non-overlapping in storage), but are assigned to a special section of storage which is separate from the usual storage of -variables and arrays. Each ERASABLE declaration eliminates the effect -of previous assignments to this special section of storage, thus -allowing several arrays to occupy the same storage at different times. -It should be understood that this storage is accessible to, andmay be -used by, subroutines. +variables and + +arrays. Each ERASABLE declaration eliminates the effect of previous +assignments to this special section of storage, thus allowing several +arrays to occupy the same storage at different times. It should be +understood that this storage is accessible to, andmay be used by, +subroutines. This declaration is a memory-footprint optimization hack. The Retrocomputing Museum implementation does not implement @@ -3071,7 +3077,7 @@ words PROGRAM COMMON (which ned not have the same number of dimensions) are disjoint (i.e., non-overlapping in storage), but are assigned to a special section of storage which is separate from the usual storage of variables and arrays, and separate from ERASABLE -storage (see section 3.5). +storage (see ). One use of this statement provides for several sections or a program to refer to variables and arrays by the same names, while being @@ -3114,7 +3120,7 @@ is used at all. implement COMMON. -Presetting Vectors +Presetting Vectors Any vector or portion of a vector (or array when considered as a @@ -3166,36 +3172,41 @@ program, the PROGRAM COMMON region is identical in all sections of the program. -Function Definitions +Function Definitions + + There are two main types of functions: The internal function and the external function. Since these are quite similar in many ways, that part of the -description which is specific to external functions will be given in -subsection 3.8.1, that which is specific to internal functions in -subsection 3.8.2, and that which is common to both types will follow -in subsection 3.8.3. Throughout this section a single-valued function -will be called a "function", and a function with multiple outputs -and/or multiple exits will be called a "procedure". For the purposes -of this manual a recursive function is one whose definition contains -calls for the function being defined -- or calls for functions which -ultimately call the one being defined. Recursive functions have the -same structure as other functions although, in general, they will -include statements of the type described in section 2.13, and certain +description which is specific to external functions + +will be given in , that which is +specific to internal functions in , and that which is common to both types +will follow in subsection 3.8.3. Throughout this section a +single-valued function will be called a "function", and a function +with multiple outputs and/or multiple exits will be called a +"procedure". For the purposes of this manual a recursive function is +one whose definition contains calls for the function being defined -- +or calls for functions which ultimately call the one being defined. +Recursive functions have the same structure as other functions +although, in general, they will include statements of the type +described in , and certain considerations should be borne in mind when constructing such functions. These considerations arise from the fact that names , instead of values, are used as function arguments. The problem is considered in more detail in the examples in Chapter III. -External Function Definitions +External Function Definitions -These statements define functions not yet available in the language or -as standard package programs ("subroutines"). The designatyion -"EXTERNAL" implies that the statements which follow are to be -translated indpendently of the main program in which they are to be -used. (Because of this independence this block of statements is to be -considered an entirely separate program, and must have its own +These statements define functions not yet available in the +language or as standard package programs ("subroutines"). The +designatyion "EXTERNAL" implies that the statements which follow are +to be translated indpendently of the main program in which they are to +be used. (Because of this independence this block of statements is to +be considered an entirely separate program, and must have its own DIMENSION and MODE declaration, etc.) The word "EXTERNAL" also implies that occurrences of variables and functions in the current function definition program have no relation whatever with occurrences @@ -3203,25 +3214,27 @@ of similarly named variables and function [typo] in the main program (or other definition programs), and no difficulties will be encountered because of the use of similar names. The modes of the arguments (if other than the normal mode), must be declared in the -usual way (see Section 3.2), but arrays which are arguments need not -be dimensioned. +usual way (see ), but arrays which +are arguments need not be dimensioned. -Internal Function Definitions +Internal Function Definitions These statements define functions not yet available in the language or as standard package programs ("subroutines"). The designation "INTERNAL" implies that the definition program which follows is to be translated as part of the main program. The word "INTERNAL" also implies that any variables or functions not listed as arguments in the -definition of the function (but used in its evaluation), are -understood to be the same as elsewhere in the main program, and the -current values of these variables and functions will be used. Names -of variables and functions which occur as arguments of the function -being defined are designated "dummy arguments" (or "bound variables"). -They must be distinct from those appearing elsewhere in the program. -The modes of dummy arguments (if other than normal mode) must de -declared in the usual way, but arrays which are arguments need not be +definition of the + +function (but used in its evaluation), are understood to be the same +as elsewhere in the main program, and the current values of these +variables and functions will be used. Names of variables and +functions which occur as arguments of the function being defined are +designated "dummy arguments" (or "bound variables"). They must be +distinct from those appearing elsewhere in the program. The modes of +dummy arguments (if other than normal mode) must de declared in the +usual way, but arrays which are arguments need not be dimensioned. One form of internal function definition (not available as an external @@ -3232,7 +3245,9 @@ program) is the one sentence definition, which has the form: INTERNAL FUNCTION SUMSQ.(X,Y,Z) = X * X + Y + Z * Z - T * T -As indicated above, X, Y, and Z, as they occur here, are dummy variables, and (X, Y, Z) is the dummy variable list. +As indicated above, X, Y, and Z, as they occur here, are dummy + +variables, and (X, Y, Z) is the dummy variable list.