From: Eric S. Raymond Date: Thu, 5 Feb 2004 22:22:22 +0000 (+0000) Subject: This version is good. X-Git-Tag: 1.0~150 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=1126e43fddd0edb212a5322d41fef53f90a6b87d;p=mad.git This version is good. --- diff --git a/doc/mad-manual.xml b/doc/mad-manual.xml index c5b2ae5..7f14057 100644 --- a/doc/mad-manual.xml +++ b/doc/mad-manual.xml @@ -11,7 +11,12 @@ - + + + + + + ]> Notes from the 21st century @@ -100,13 +105,18 @@ standard output. Printer control codes +, 1, 2 and 4 are ignored (treated as 0 or space). Tape and drum devices are not supported. -The 709 had 36-bit words; modern machines have 32 or 64. -Precision and overflow of numeric results may therefore differ. -The original MAD limit of 6 characters on variable names, labels, and -string constants is not enforced. +The 709 had 36-bit words; MAD floats are translated to C +doubles, which on modern machines have 32 or 64 bits. Precision and +overflow of numeric results may therefore differ. The original MAD +limit of 6 characters on variable names, labels, and string constants +is not enforced. Label arrays, array-mode variables, and the associated -computed-transfer statement are not implemented. +computed-transfer statement are not implemented. Neither are ERROR +RETURN, multiple ENTRY points, or TAPE and DRUM statements. + +All external function definition must precede +the program main line. The generated C is self-contained and does not require any dedicated runtime support, except that the stdio and math libraries @@ -147,7 +157,7 @@ the flowchart elements are slightly different. In the original, sections were numbered only down to three levels deep. No per-chapter tables of contents were present. -The item lists bulleted a., b., c... and 1., 2, 3... in this +The item lists bulleted a., b., c... and 1., 2., 3.... in this transcription were bulleted (a), (b), (c)... and (1), (2), (3)... in the original. There does not seem to be a good way to generate the original style in DocBook. @@ -155,10 +165,47 @@ the original style in DocBook. Special characters like white square (□), back arrow (←), and the Greek letters were hand-drawn in the original (except for the capital thetas, which were typed capital Os with bars -hand-drawn across them). The script-S used in the original as a base -for subscripted labels has no ISO equivalent and has been transcribed as -a Greek letter sigma (&statement;). The script-N used at some -places in the original has been replaced by a script M, ℳ. +hand-drawn across them). Several other special characters represent +hand-drawn script characters: + + + + + +in the original: +used for: +represented as: + + + + +script-A +address metavariables +&scriptA; + + +script-F +format metavariables +&scriptF; + + +script-L +list metavariables +&scriptL; + + +script-N +general metavariables +&scriptA; + + +script-S +statement metavariables +&scriptS; + + + + Footnotes were tagged with asterisks in the original rather than being numbered. Section references to section numbers have been @@ -521,7 +568,7 @@ function, and the other statements are as before. Any program using the function now need only call upon it by name, as in the statement: -LARGEQ = 1. + MAS. (6,Q)/3. +LARGEQ = 1. + MAX. (6,Q)/3. Note that the set (in this use of MAX.) hose largest element is @@ -1287,13 +1334,13 @@ following floating point numbers: Transfer Statement -This statement has the form: TRANSFER TO &statement; +This statement has the form: TRANSFER TO &scriptS; -Here &statement; may be any statement label or any expression in +Here &scriptS; may be any statement label or any expression in statement label mode which labels an executable statement. Execution of this statement causes the computation to continue from the -statement whose label is the value of &statement;. Examples: TRANSFER TO +statement whose label is the value of &scriptS;. Examples: TRANSFER TO SUMX, TRANSFER TO SWTCH (K + 2) (if K=4 then the value of SWTCH(K+2) is SWTCH(6)). @@ -1330,20 +1377,20 @@ statements containing punctuation, must be written. - &statement;1 WHENEVER B1 + &scriptS;1 WHENEVER B1 ... ... &THgr;1 - &statement;2 OR WHENEVER B2 + &scriptS;2 OR WHENEVER B2 ... ... &THgr;2 ... ... - &statement;k OR WHENEVER Bk + &scriptS;k OR WHENEVER Bk ... ... &THgr;k - &statement;k+1 END OF CONDITIONAL + &scriptS;k+1 END OF CONDITIONAL Often the last condition Bk is always @@ -1360,7 +1407,7 @@ true. This may be expressed by the statement OTHERWISE -The &statement;i are statement labels which +The &scriptS;i are statement labels which need not be used unless desired. k may equal one (if no "OR WHENEVER..." statements are used). Here B1, ..., Bk are Boolean expressions, and the @@ -1371,12 +1418,12 @@ B1. It B1 has the value 0B, then B2 is tested, etc. As soon as some expression, say Bj, has the value 1B, then the statements between (but not including) -&statement;j and -&statement;j+1 +&scriptS;j and +&scriptS;j+1 (i.e. &THgr;j) are executed. At this point the execution of the entire block is considered ended, and computation continues from the first statement after the declaration labelled -&statement;k+1. In other words, at most one of +&scriptS;k+1. In other words, at most one of the alternative computations is performed; e.g., that one which immediately follows the first expression B1 which has the value 1B. If none of the Bi has @@ -1458,13 +1505,13 @@ that variable is exhausted, or until some specified condition is satisfied. The THROUGH statement may take either of the following two forms. -(a) THROUGH &statement;, FOR VALUES OF V = +(a) THROUGH &scriptS;, FOR VALUES OF V = E1, E2, ..., -Em Here &statement; is the statement +Em Here &scriptS; is the statement label of the last executable statement in the block to be repeated. The block of statements following (and not including) the THROUGH statement, up to and including the statement -whose label is &statement;, will be called the "scope" of the THROUGH +whose label is &scriptS;, will be called the "scope" of the THROUGH statement. Following the word OF appears the name of the iteration variable (in the illustration: V), which may be either an individual variable or subscripted array variable of any @@ -1478,7 +1525,7 @@ E1 (see ). "scope" to be executed, first with V = E1, then again with V = E2, and so on, until the list of expressions is exhausted. Computation then proceeds with the -statement immediately following statement &statement;. At this time the +statement immediately following statement &scriptS;. At this time the iteration variable will have the value of the expression Em unless its value was changed during the final iteration. An example of this type of @@ -1491,11 +1538,11 @@ statement is: A X(BETA) = J1 * COS.(2. * THETA) -(b) THROUGH &statement;, FOR V = E1, +(b) THROUGH &scriptS;, FOR V = E1, E2, B -Here &statement; is a statement which defines the "scope" exactly -as in (a) above (with the exception: If &statement; is the label of the +Here &scriptS; is a statement which defines the "scope" exactly +as in (a) above (with the exception: If &scriptS; is the label of the THROUGH statement itself, the iteration will proceed as described below, but the scope will be empty, and the iteration will consist only of the incrementing of V by E2 and the @@ -1513,7 +1560,7 @@ the scope of the THROUGH statement is not executed. If the value of B = 0B, the scope is executed. V is then incremented by E2, and B is tested again. In general, as soon as B = 1B, the scope is not executed, and the computation proceeds -from the statement immediately following statement &statement;. Each +from the statement immediately following statement &scriptS;!. Each time B = 0B, the statements in the scope are executed, then V is incremented by E2, and B is tested again. Thus, when the iteration is finished and B = 1B, V has the value used @@ -1762,7 +1809,211 @@ ENTRY TO ℳ where ℳ is the name of this entry (see section 3.8). +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). + + + + +SET LIST TO &scriptL; + +&scriptL; is the name of an array element designated as the initial +location to be used for temporary storage. Consecutive elements will +be used as required by the following statements. + + +SAVE DATA &scriptL; + +&scriptL; is a list of: 1) single or subscripted variable names, 2) array +segments of the form A(i1, ..., +in) ... A(j1, ..., +jn) where the i, j subscripts may be any valid +subscript expression and n ≥ 1, 3) constants, or 4) +expressions—separated by commas. This statement causes the current +values of the elements of the list as consecutive elements of the +currently designated temporary storage vector—starting with the first +currently available element. &scriptL; is the same as any input-output list +(see sec. 2.14). + + +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. + + +RESTORE DATA &scriptL; + +&scriptL; is a list of single or subscripted variable names or +array segments of the type described in (b). If the list designates n +names (not necessarily n items in the list) the values of the last n +elements of the currently designated temporary storage vector become +the values of the list variables. The order of this value assignment +assuming k used locations in temporary storage vector, left to right +in the list correspond to k, k-1, ... k - n + 1 elements of the +temporary storage vector are then made available for use by successive +SAVE statements. + + +RESTORE RETURN +This statement will appear in this scope of a function definition and +causes the current last element in the currently designated temporary +storage vector to be used as the reentry point to the program calling +the function. The last element of temporary storage is then made +available for use by successive SAVE statements. + + + +Input-Output Statements + +In this section the follwing definition the following +definitions will hold. &scriptF; is the location of a format +specification vector (see section 2.15) which must be an integer +variable name. &scriptN; is an expression whose value is to be either +a tape number or a drum number. &scriptL; is an input-output list. +Elements of &scriptL; may be: 1) single variable names or array names +with subscripts;, 2) blocks of the form A(i;i;, +..., i;n;) ... A(j;i;, +...j;n;) where the i's and j's may be any +subscript ;expression and n # 1. In addition, when &scriptL; +designates an output list, the elements of &scriptL; may be: 3) +constants or 4) expressions. Elements of a list are separated by +commas. Example of an output list: AB, D, 2.5, MTX(1) ... MTX(N), +P(14), J(I, K). Example of a list which may be ysed either for input +or output: A, B, K(3), J(25*I - L), A(K+1)... A(L*2). To completely +understand the operation of statements which make an explicit +reference to "TAPE" or "DRUM" it is advisable to read the sections of +the IBM 704 Reference Manual which describes the operation of these +units (See Restrictions below). + + + +(a) PRINT FORMAT &scriptF;, &scriptL; + +Prints &scriptL; according to format &scriptF; on the off-line +printer. + + + +(b) PRINT ON LINE FORMAT &scriptF;, &scriptL; + +Prints &scriptL; according to format &scriptF; on the on-lin +printer. This statement is used for comments to the operator. After +&scriptL; has been printed a skip of 1/6 page is automatically +produced, allowing the operator to read the comment. + + + +(c) PUNCH FORMAT &scriptF;, &scriptL; + +Punches &scriptL; on cards according to format &scriptF;. + + + +(d) READ FORMAT &scriptF;, &scriptL; + +Reads cards into &scriptL; according to format &scriptF;. + + + +(e) READ BCD TAPE &scriptN;, &scriptF;, &scriptL; +WRITE BCD TAPE &scriptN;, &scriptF;, &scriptL; + +Transmits &scriptL; to or from tape &scriptN; in BCD form +according to format &scriptF;. + + + + +(f) READ BINARY TAPE &scriptN;, &scriptL; + +Transmit to &scriptL; from tape &scriptN; until &scriptL; is exhausted or a complete type record has been read. + + + +WRITE BINARY TAPE &scriptN;, &scriptL; + +Transmits &scriptL; to tape &scriptN; in binary form as one +record. + + + +(g) READ DRUM &scriptN;, &scriptA;, &scriptL; +WRITE DRUM &scriptN;, &scriptA;, &scriptL; + +Transmits &scriptL; to or from drum &scriptN; starting with drum +address &scriptA; (where &scriptA; is an integer expression). + + + +(h) REWIND TAPE &scriptN; + +Rewinds tape &scriptN;. + + + +(i) END OF FILE TAPE &scriptN; + +Writes an end of file mark on tape &scriptN;. + + + + +(j) BACKSPACE RECORD OF TAPE &scriptN; + +Move tape &scriptN; back to beginning of last record. + + + +(k) BACKSPACE FILE OF TAPE &scriptN;, IF LOAD POINT TRANSFER TO &scriptS; + +Tape &scriptN; is moved backward until an en-of-file mark, the +load point gap, or the load point is encountered. If an end-of-file +mark has been written previously, executing this statement backspaces +over the end-of-file mark and stops just in front of it (since the +end-of-file mark must be passed over to be recognized). If the tape is +already at the load point, the program goes to the executable +statement labelled &scriptS; (where &scriptS; is a statement label or +variable of statement label mode.) If the phrase ", IF LOAD POINT +TRANSFER TO &scriptS;" (including the comma) is omitted no transfer is +made even if at load point. + + + + +End of File and End of Tape + +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. +The subroutine ERROR. sets an error flag and returns control to the +system in which the translated program is imbedded. + +If an end-of-file is encountered while executed a READ FORMAT, +READ BCD TAPE, or READ BINARY TAPE statement the subroutine SYSTEM. (a +subroutine which returns control to the system in which the translated +program is imbedded) is automatically entered. This action can be +changed by executing the statement EXECUTE SETEOF. (&scriptS;). The +subroutine SETEOF. sets the read routines to transfer to the +executable statement labelled &scriptS; when an end-of-file is +encountered. If the statement EXECUTED SETEOF. (0) is executed the +read routines will be reset to enter SYSTEM. when an end-of-file is +encountered. + + + +