From: Eric S. Raymond Date: Wed, 18 Feb 2004 21:34:19 +0000 (+0000) Subject: Add various explanatory notes. X-Git-Tag: 1.0~74 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=4e47c6aa9179bcdeb980866bfb7e975c6a5d2510;p=mad.git Add various explanatory notes. --- diff --git a/doc/mad-manual.xml b/doc/mad-manual.xml index 08cd898..82440db 100644 --- a/doc/mad-manual.xml +++ b/doc/mad-manual.xml @@ -204,12 +204,14 @@ it could be the real thing. The Retrocomputing Museum implementation of MAD translates MAD code into compileable C. It has been tested on the examples in the -manual, which are included with the distribution. +manual, which are included with the distribution. This section is +a summary of differences: more details are given in notes attached +to the relevant sections. Card images are read from standard input and printing is to -standard output. Printer control codes +, 1, 2 and 4 are ignored -(treated as 0 or space). Tape and drum devices are not -supported. +standard output. Line printer control codes are partly but not exactly +simulated (see ). Tape and drum devices are +not supported. The 704 had 36-bit words; MAD floats are translated to C doubles, which on modern machines have 32 or 64 bits. Precision and @@ -263,6 +265,9 @@ velo-bound typed manual; Eric Raymond hand-corrected it, and moved the result into PIC and XML-DocBook markup so both HTML and PostScript can be generated from it. +Redactor's comments in the body of the text are +decorated like this. + Typewriter underlining in the original is expressed by DocBook <emphasis> tags in this version, which will probably render as italics. @@ -314,8 +319,13 @@ the original style in DocBook. hand-drawn across them). The original also some contained hand-drawn script characters: -Redactor's comments in the body of the text are -decorated like this. +The above notes fail to properly convey just how primitive the +original document looks to a modern eye, and this is worth noting +because this transcription into DocBook makes it look a lot less so. +Standards have risen in a world saturated with the Web and cheap page +printers. The original manual's monospace fonts on yellowing paper +with hand-drawn figures and special characters look quaint and +ugly by contrast. @@ -593,11 +603,11 @@ substitutions is the lack of characters such as >, ≤ as input to the computer. Such details are fully presented in Chapter II of this manual.) -The IBM 704 on which MAD was implemented had a +The IBM 704 on which MAD was implemented had a very primitive pre-ASCII character set. It did not even include lowercase letters, let alone fancy punctuation like < and >. ASCII still lacks ≤ and ≥, but writing these as <= and >= -became universal in later ASCII-based languages. +became universal in later ASCII-based languages. The flow diagram for our previous example, then, may be rewritten as follows: (In order to keep the notation familiar when @@ -984,7 +994,7 @@ F. --> The first statement, labelled GAMMA, would cause the program to read from the data card the numbers a, b, c, x0, -ε=1, ε2, and +ε1, ε2, and n0. The format of the input information is to be found in a block of storage labelled "CARD" whose values are set later in the program by a VECTOR VALUES statement. The vector CARD @@ -1039,6 +1049,12 @@ the "-" sign must be present if the number is negative (e.g., 2, -2, 0, +0, -0. 100 are all integers). Leading (but not following) zeros may be omitted (e.g., 5 and 005 represent the same integer, but 3 and 300 do not. + +There is a subtle difference from modern practice here. +In 2004, major contemporary languages (perhaps unfortunately) follow +C's lead and interpret leading 0 as a directive to evaluate the +following digits in octal. The Retrocomputing Museum implementation +of MAD implements the original MAD behavior. Floating Point Constants @@ -1083,6 +1099,11 @@ constant containing fewer than six characters will be extended to six characters by adding blanks on the right; thus $ABCD$ will appear internally as $ABCD□□$ + +The Retrocomputing Museum implementation neither enforces +the six-character limit nor blank-pads constants. These features were +an artifact of packing six-bit characters into the IBM 704's 36-bit +machine word. Boolean Constants @@ -1355,9 +1376,9 @@ GCD.(I, J)/I may be necessary before some of the operations can be performed. Thus, in the expression - + Y + 3 - + if Y is in the floating point mode it cannot be added directly to the integer 3. But for one precaution the user need not be @@ -1371,9 +1392,9 @@ improper conversion will take place. In some cases, however, the user must understand the sequence in which the conversions will be made. Consider the expression - + ( Y + 7/3) + (I * J/K) - + where Y is in the floating point mode, and I, J, and K are in the integer mode. According to the parenthesizing conventions, the @@ -1414,9 +1435,9 @@ different from the value one might expect from a different analysis. In the example above, the divisions would be performed in the floating point mode if the expression were written: - + (Y + 7./3) + (I * J)/(K + 0.) - + Of course, many times the expression will be written as originally stated just to achieve the "truncation" effect. @@ -1458,9 +1479,9 @@ MP(A, B + 6 * J, I * 6/TDX), MA(K(Z + 5) + T(1) + 6). This statement has the form illustrated by - + 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 @@ -1480,17 +1501,17 @@ variable on the left the value which results from steps (1) and (2)." Thus, if Y is a floating point variable, then the statement - + Y = 1 - + will cause the integer 1 to be converted to floating point and then stored in the location called "Y"; i.e., Y will now have the value 1. (as a floating point number). If the statement were written - + Y = 1. - + then the floating point number 1. would be stored in the location "Y"; i.e., Y would again have the floating point value 1., @@ -1502,15 +1523,15 @@ it is first expressed as a number with both an integer part and a fractional part, and then the fractional part is truncated. Thus, the following floating point numbers: - + 3E5, .3E0, .34568127E2, - .345681E10 - + would convert to the following integers, respectively: - + 300000, 0, 34, -3456810000. - + Transfer Statement @@ -1533,9 +1554,9 @@ is SWTCH(6)). (a) Simple Conditional - + WHENEVER B,Q - + Here B is a Boolean expression and Q any executable statement except the following: end of program, another conditional, iteration, @@ -1547,10 +1568,10 @@ statements containing punctuation, must be written. Examples: - + WHENEVER XM.LE.1, TRANSFER TO END WHENEVER I.GE.N.AND.J.NE.I-1, I=0 - + (b) Compound Conditional @@ -1903,6 +1924,10 @@ program. The number n is an octal integer containing up to 5 digits, which will be displayed on the computer console for the operator to note when the computer stops, thus indicating the point in the program at which the stop occurred. + +The Retrocomputing Museum implementation handles this by +generating code that prints the octal number to standard output, then +waits for the user to press Enter. Function Statement @@ -1946,6 +1971,10 @@ or a variable in statement label mode, whose value is the label of a statement to which a transfer is made in case the ERROR RETURN statement is executed. +This language is confusing, and doesn't seem to match the +actual uses of ERROR RETURN in the examples. The Retrocomputing +Museum implementation ignores it. + Even though an error return has been provided in the definition of a function, in the use of the function the last argument may be omitted. If it is omitted, execution of the ERROR RETURN statement @@ -1953,6 +1982,9 @@ will cause control to be transferred to the operating system in which the translated program is imbedded, with an error indication. +The Retrocomputing Museum implementation generates code +that prints ERROR RETURN and terminates the program. + End of program Statement @@ -1990,6 +2022,11 @@ ENTRY TO &scriptN; where &scriptN; is the name of this entry (see section 3.8). + +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 @@ -2292,6 +2329,27 @@ effective before the rest of the specification is carried out. + +These were the standard control codes for line printers, which +assumed they were printing to 132x66 fanfold paper. There isn't a lot +of point in simulating them on a modern page printer. The +Retrocomputing Museum implementation implements them by prefixing the +output string: + + + + +Blank No prefix +0 \n ++ Not supported, no prefix. +1 Form feed +2 Two vertical tabs +4 One vertical tab + + + + + As another example, the specification