<!DOCTYPE book PUBLIC
"-//OASIS//DTD DocBook XML V4.1.2//EN"
"docbook/docbookxx.dtd" [
-<!ENTITY min SYSTEM "../madhouse/min.mad">
<!ENTITY maxfunc SYSTEM "../madhouse/maxfunc.mad">
<!ENTITY newton1 SYSTEM "../madhouse/newton1.mad">
<!ENTITY newton2 SYSTEM "../madhouse/newton2.mad">
<para>There are some significant respects in which MAD was actually
rather advanced for its period. The multiline WHENEVER statement
-anticipated the free-format syntax of ALGOL 60 and its descendants,
-including Pascal and C. The DEFINE statement, which supports
-syntactic extension of the language, was an interesting experiment
-not emulated in most later designs.</para>
+anticipated the free-format syntax of ALGOL 60's descendants,
+including Pascal and C. The DEFINE statement, which supports
+syntactic extension of the language, was an interesting experiment not
+emulated in most later designs.</para>
<para>In most of the respects we've described, however, MAD is very
typical of its time. This will become apparent from a look at the
limit of 6 characters on variable names, labels, and string constants
is not enforced.</para>
+<para>Character READ FORMATs into arrays cause their equivalents in the
+generated C code to be declared with a base char type as would
+be usual in C. Perfect fidelity to the MAD code would have required
+the data to be unpacked into int or double arrays, but that code
+would have been far more complicated to generate and hard to read.</para>
+
+<para>In original MAD all variables were global, and arguments were
+passed by reference. In the interests of generating reasonably clean
+C, this implementation makes variables local to the functions in which
+they occur and passes arguments by value. Exploiting the original MAD
+behaviors was considered bad style even then, and none of the examples
+given in the manual rely on them.</para>
+
<para>Label arrays, array-mode variables, and the associated
computed-transfer statement are not implemented. Neither are ERROR
RETURN, multiple ENTRY points, or TAPE and DRUM statements.</para>
-<para>All external function definitions must precede
-the program main line.</para>
+<para>On the other hand, some limits in original MAD are not present
+in this implementation, mainly because it would have required actual
+effort to enforce them. Names and string constants may be longer than
+6 characters, and may contain underscores and lowercase
+letters. Source lines are not limited to 72 chars long.</para>
+
+<para>All external function definitions must precede the program main
+line. It is unclear whether or not this was true in original
+MAD.</para>
<para>The generated C is self-contained and does not require any
dedicated runtime support, except that the stdio and math libraries
such as the loop, etc. The input form of our example would be:</para>
<programlisting>
-&min;
+ DIMENSION A(100)
+ Z = A (0)
+ THROUGH BACK, FOR J = 1, 1, J .G. N
+BACK WHENEVER Z .L. A(J), Z = A(J)
+ INTEGER J, N
+ END OF PROGRAM
</programlisting>
<para>The DIMENSION statement assigns a block of storage in the
to be performed by its presence or absence.</para>
</sect2>
-<sect2><title>THROUGH (Iteration) Statement</title>
+<sect2 id='THROUGH'><title>THROUGH (Iteration) Statement</title>
<para>The following program segment illustrates the use of this
statement.</para>
Instead, a large open-brace at the left of the diagram pointed at the word
"scope", indicating the body section filled with ellipses.
-->
-<para>As indicated in section 2.5, the "scope" of an iteration
-statement is the block of statements designated for repeated
+<para>As indicated in <xref linkend='THROUGH'/>, the "scope" of an
+iteration statement is the block of statements designated for repeated
execution, indicated by ... below:</para>
<programlisting>