From 607ceb4f7a2f3aaf20075565fb3e42c6626cd2d4 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 24 Jun 2004 18:52:55 +0000 Subject: [PATCH] Index up to Error Detection. --- doc/mad-manual.xml | 264 ++++++++++++++++++++++++++++----------------- 1 file changed, 164 insertions(+), 100 deletions(-) diff --git a/doc/mad-manual.xml b/doc/mad-manual.xml index f3c675b..c4eee65 100644 --- a/doc/mad-manual.xml +++ b/doc/mad-manual.xml @@ -444,9 +444,12 @@ the original. Notably, "section 1.1" becomes "Section 1.1" "Section 1.1.4 and Section 3.2". The reference structure of the index has been faithfully -reproduced, but DocBook renders it differently. The original lacked -the canned section headings, and references were by page number -rather than section name. +reproduced; that is, for each index reference a DocBook +<indexterm> tag was placed within the span of text defined by +the original page numbering. However, DocBook renders the index +differently from the original. The original lacked the canned section +headings, and references were by page number rather than section +name. EPSLON and COMPLX and the like are not typos. As pointed out earlier, MAD variable names are limited to the 6 characters in a @@ -752,7 +755,8 @@ BACK WHENEVER Z .L. A(J), Z = A(J) END OF PROGRAM -The DIMENSION statement assigns a block of storage in the +The DIMENSION statement DIMENSION +Statement assigns a block of storage in the computer large enough to handle a0, a1, a2, ... a100, if necessary. The INTEGER statement @@ -762,10 +766,9 @@ modification and counting. The reason for this is that integer arithmetic can be done more simply and efficiently, usually with less round-off error, than arithmetic on non-integers. [Numbers which may have fractional parts are usually written in the so-called "scientific -notation", such as 3.1 × 10-6 are called -floating point numbers.] -Constants, Floating Point -Numbers are assumed to be in the +notation", such as 3.1 × 10-6 are +called floating point numbers.] Constants, +Floating Point Numbers are assumed to be in the floating-point mode unless otherwise declared, as in the INTEGER statement in the example. The WHENEVER statement above is to be interpreted in the sense: Whenever the following condition (in this @@ -845,7 +848,7 @@ needed for A is the EXTERNAL FUNCTION definition program above, since A is there only as a "dummy variable", anyway. When used, with a concrete set Q, we would expect a DIMENSION statement for Q in the program that calls on MAX. for a -value. +value.DIMENSION Statement For a second example consider the problem of repeatedly solving, by Newton's method, of the equation f(x) - @@ -885,7 +888,7 @@ x is replaced by x - f(x)/f'(x) in the actual statements produced for the computer the "=" symbol conventionally has -this meaning. +this meaning.Equals Sign It is important to realize what the "=" means in this context; it is different from the usual use of the symbol where it indicated a @@ -1279,11 +1282,11 @@ both the minus sign and the dash are accepted.) would be impossible to distinguish such a product from the variable Z5D.) -Division, written as "/"; e.g., Z5/D. If both Z5 and D -are integers, the result is again an integer; e.g., the -"fractional part" of the true quotient is truncated (not -rounded). For example, if Z5 = 7, and D = 3, the Z5 = D will -have the value 2. +Division, written as "/"; e.g., Z5/D. If both Z5 and +D are integers, the result is again an integer; e.g., the "fractional +part" of the true quotient is truncated (not rounded). For example, +if Z5 = 7, and D = 3, the Z5 = D will have the value 2. +Division Exponentiation, written as ".P.", e.g., Z5.P.D, and @@ -1384,12 +1387,13 @@ M.THEN.P, and M.EQV.P. Parentheses Conventions -Parentheses are used in the same way as in ordinary algebra and logic -to specify the order of the computation. Also, certain conventions -are used to allow deletion of parentheses. The conventions used here -are the same as in ordinary algebra and logic, namely: Parentheses may -be omitted, subject to the rules (A) and (B) below, but redundant -parentheses are allowed. +Parentheses are used in the same way as in ordinary algebra and +logic to specify the order of the computation. Also, certain +conventions are used to allow deletion of parentheses. +Deletion of Parentheses The +conventions used here are the same as in ordinary algebra and logic, +namely: Parentheses may be omitted, subject to the rules (A) and (B) +below, but redundant parentheses are allowed. (A) Within any expression the sequence of computation, unless otherwise indicated by parentheses, is: @@ -1501,7 +1505,9 @@ to the integer 3. But for one precaution the user need not be concerned with this since the instructions necessary for the conversion of the integer to floating point form before adding are automatically inserted by the translator during the translation -process. The precaution is that if the integer being converted is +process. +Conversion, Integer to Floating Point +The precaution is that if the integer being converted is greater than 134,217,728 (i.e. 227) then an improper conversion will take place. @@ -1601,15 +1607,21 @@ MP(A, B + 6 * J, I * 6/TDX), MA(K(Z + 5) + T(1) + 6). ALPHA = Y + Z + F.(X, Y, Z) -That is, the left side of the "=" sign consists of the name of a -variable (either an individual variable or a subscripted array -variable), and the right side consists of any expression of the same -mode. The only exceptions to this mode requirement are the cases: (1) -If the variable on the left is of integer mode then the value of a -floating point expression of the right will be converted to integer -mode. (2) if the variable on the left is of floating point mode then -the value of an integer expression on the right will be converted to -floating point mode. +That is, the left side of the "=" sign +Equals Sign consists +of the name of a variable (either an individual variable or a +subscripted array variable), and the right side consists of any +expression of the same mode. The only exceptions to this mode +requirement are the cases: (1) If the variable on the left is of +integer mode then the value of a floating point expression of the +right will be converted to integer mode. +Conversion, Floating Point to +Integer (2) if the variable on the left is of +floating point mode then the value of an integer expression on the +right will be converted to floating point mode. +Conversion, Integer to Floating +Point + The substitution statement is to be interpreted as "(1) Compute the value of the expression on the right, (2) convert it, if necessary, to @@ -1716,7 +1728,9 @@ WHENEVER I.GE.N.AND.J.NE.I-1, I=0 ... &THgr;k &scriptS;k+1 END OF CONDITIONAL - + +END OF CONDITIONAL Statement + Often the last condition Bk is always true. This may be expressed by the statement @@ -2018,12 +2032,13 @@ iteration b is completed before iteration &scope3; - + When iteration statements occur in the scope of other iteration statements, they are said to be "nested". The "nesting depth" of an iteration statement is the number of iteration statements in whose scope it appears. The nesting depth of an iteration may not exceed -50. For example: +50. Depth, Nesting, of +Iteration For example: &scope4; @@ -2117,6 +2132,8 @@ that prints ERROR RETURN and terminates the program. End of program Statement +END OF PROGRAM Statement + This statement has the form: END OF PROGRAM. @@ -2151,7 +2168,9 @@ ENTRY TO &scriptN; where &scriptN; is the name of this entry (see ). +linkend='funcdefs'/>).RNTRY TO +Statement + The Retrocomputing Museum implementation supports only one entry point per function. Attempting to specify more than one @@ -2316,7 +2335,9 @@ address &scriptA; (where &scriptA; is an integer expression). -(i) END OF FILE TAPE &scriptN; +(i) END OF FILE TAPE &scriptN; +END OF FILE TAPE Statement + Writes an end of file mark on tape &scriptN;. @@ -2351,6 +2372,8 @@ made even if at load point. End of File and End of Tape +End of File Condition + If an error (improperly formed format specifications, invalid data, a tape check, etc.) occurs during any input-output statement except READ DRUM or WRITE DRUM, the subroutine ERROR. is automatically entered. @@ -2378,10 +2401,12 @@ information is lost and the new tape is a continuation of the old one. This action can be changed by executing the statement EXECUTE SETETT. (&scriptS;). The subroutine SETETT. sets the write tape routines to transfer to the executable statement labelled &scriptS; -when an end-of-tape is encountered. The tape is not rewound nor is -any comment printed for the operator and the computer does not stop -before this transfer occurs. Executing EXECUTE SETETT.(0) will reset -the write tape routines to the normal action. +when an end-of-tape End Of Tape +Condition is encountered. The tape is not +rewound nor is any comment printed for the operator and the computer +does not stop before this transfer occurs. Executing EXECUTE +SETETT.(0) will reset the write tape routines to the normal +action. The subroutines SETEOF. and SETETT. may be executed as many times as desired. Only one setting is in effect for end-of-file (that @@ -2523,13 +2548,20 @@ linkend='ERROR_RETURN'/>) will result. integer. The letter indicates the form of the information in the external medium as follows: +Field Description (Format) + S Skip (or blank information) I Integer F Fixed point number (Internally floating point) -E Floating point number + + E + E Field (Format) + + Floating point number + K Octal number C @@ -2552,12 +2584,13 @@ andf S31 indicates a blank field of 31 columns. For F and E fields, i.e., fixed and floating point numbers, there is always the question of the placement of the decimal point, the form of -the numbers, etc. in addition to the field size. +the numbers, etc. in addition to the field size. +Decimal Point in Format For this reason, the basic field description for E and F fields requires an additional integer giving the number of places after the decimal point that are to be rounded and printed (or read, or -punched). This integer is always taken mod 10 . +punched). This integer is always taken mod 10. For example, the specificaiton (F20.3) and the specification (F20.13) both describe a twenty column fixed point field in which a number will occur with three digits to the right of the decimal point. The @@ -2929,6 +2962,8 @@ read and stored until needed. Declarations (Non-executable statements) +Declarations + Declarations are non-executable statements, and, except for function declarations, they may occur anywhere in the program. Their purpose is to furnish information to the translator program or to the reader @@ -2994,12 +3029,15 @@ linkend='dimension_declaration'/>). A vector which is preset by a vector values declaration is assigned a mode consistent with the assigned values -(see ). +(see ).Dimension +Vector Dimension Declaration +DIMENSION Statement + Variables may be declared to be array variables, such as vectors or matrices of various dimensions, rather than individual variables. @@ -3122,6 +3160,8 @@ sufficiently high. Equivalence Declaration +EQUIVALENCE Declaration + This declaration has the form @@ -3159,6 +3199,8 @@ implement EQUIVALENCE. ERASABLE Declaration +ERASABLE + This declaration has the form @@ -3190,12 +3232,13 @@ it. PROGRAM COMMON MATRIX, X, Y1, BC -and implies that the arrays and individual variables listed after the -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 ). +and implies that the arrays and individual variables listed +after the words PROGRAM COMMON (which ned not have the same number of +dimensions)DIMENSION +Statement 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 ). One use of this statement provides for several sections or a program to refer to variables and arrays by the same names, while being @@ -3280,15 +3323,16 @@ produces no computation at execution time. However, the values of &scriptV; may be modified by other statements in the program during execution. -Vectors which have been assigned to ERASABLE storage (see seciton 3.5) -may not be preset by a VECTOR VALUES statement. Vectors which have -been assigned to the PROGRAM COMMON section of storage (see section -3.6) can be preset with numerical or alphabetical - information only (not statement labels or function names) -and then only if it is a single section program (i.e., storage is -loaded with instructions only once) or, if it is a multiple section -program, the PROGRAM COMMON region is identical in all sections of the -program. +Vectors which have been assigned to ERASABLE storage (see +section ) +ERASABLE may not be preset +by a VECTOR VALUES statement. Vectors which have been assigned to the +PROGRAM COMMON section of storage (see section 3.6) can be preset with +numerical or alphabetical information only (not +statement labels or function names) and then only if it is a single +section program (i.e., storage is loaded with instructions only once) +or, if it is a multiple section program, the PROGRAM COMMON region is +identical in all sections of the program. Function Definitions @@ -3322,46 +3366,50 @@ III. These statements define functions not yet -available in the language or as standard package programs -("subroutines"). The designation "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 of similarly named variables and functions -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 ), -but arraysArray Variables -which are arguments need not be +singular). --> +These statements define functions not yet available in the +language or as standard package programs ("subroutines"). The +designation "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 +DIMENSIONDIMENSION Statement +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 of +similarly named variables and functions 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 ), but arraysArray +Variables which are arguments need not be dimensioned.Arguments of Functions 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 - +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")Bound Variables. +variables")Bound Variables +Dummy Arguments. They must be distinct from those appearing elsewhere in the program. The modes of dummy arguments (if other than normal mode) must be declared in the usual way, but arraysArray Variables which are arguments need not be -dimensioned. +dimensioned.DIMENSION +Statement One form of internal function definition (not available as an external function definition because the latter must be a complete, independent @@ -3373,10 +3421,12 @@ 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. The current value -of T, however, will be obtained and used each time the value of the -function is needed. An example of theuse of the function so defined -would be: + +variables, and (X, Y, Z) is the dummy + variableDummy Arguments + list. The current value of T, however, will be obtained and used each + time the value of the function is needed. An example of theuse of + the function so defined would be: A = 1.-SUMSQ. (U, V + 3, W) .P..5 @@ -3436,7 +3486,8 @@ separate declarations. In the use of a function (i.e., the call for it) the arguments may be constants, variables, or expressions. However, if one of the arguments appears -to the left of an "=" sign in a substitution statement in the defining +to the left of an "=" sign Equals +Sign in a substitution statement in the defining program it is not meaningful to use a constant or an expression for that argument in the call. As mentioned earlier, the arguments in the call for a function cannot be checked for correspondence in mode and @@ -3464,6 +3515,10 @@ FUNCTION RETURN BETA/K5 - 4 * D END OF FUNCTION +ENTRY TO Statement + +END OF FUNCTION Statement + The first statement (INTERNAL FUNCTION (X)) is a function declaration (i.e., declares that the following statements define a function). If this is defining an external @@ -3531,7 +3586,8 @@ error return (see ). (Here the statments are all labelled only for reference in what follows.) -The list of dummy variables in the declaration statement itself +The list of dummy variablesDummy +Arguments in the declaration statement itself (statement A in the preceding paragraph) may contain only nonsubscripted variable names (either individual or array)Array Variables or @@ -3581,18 +3637,22 @@ statement is executed control transfers to statement ER (then goes on to L), instead of finishing the execution of statement F (and then going on to S). Note that the END OF FUNCTION statement will never be executed, but must be present in the definition. +END OF FUNCTION Statement Restrictions -Variable names appearing as dummy arguments in -any function declaration may not appear in a PROGRAM COMMON, ERASABLE, -or EQUIVALENCE declaration. +Variable names appearing as dummy arguments +in any function declaration may not appear in a PROGRAM COMMON, +ERASABLEERASABLE, or +EQUIVALENCE declaration.Dummy +ArgumentsEQUIVALENCE +Declaration -The name of a function with the period deleted must not be used as the -name of a variable or as a statement label. A statement label must -not be identical with any variable name. +The name of a function with the period deleted must not be used +as the name of a variable or as a statement label. A statement label +must not be identical with any variable name. The translator automatically calls on some subroutines, hence the following names may not be used as variable names or statement labels @@ -4775,6 +4835,8 @@ contain some sequence code. Diagnostics +Diagnostics + During the process of translation many kinds of errors in the formation of statements and the allocation of storage can be detected. To understand this error detection and the subsequent @@ -4921,9 +4983,10 @@ here. SYSTEM -Entry to this routine causes a -return to the operating system. The END OF PROGRAM statement produces -a call for this routine. +Entry to this routine causes a return to the operating +system. The END OF PROGRAM statement produces a call for this +routine. END OF PROGRAM Statement + @@ -5975,7 +6038,8 @@ example, if A is a 4 x 3 matrix (m = 4, n = 3) and b = 1, then V(1) = Characters, AdmissibleAdmissible Characters Conditional, CompoundCompoound Conditional Conditional, SimpleSimple Conditional - +Dummy VariablesDummy Arguments +Error DetectionDiagnostics -- 2.43.0