]> thyrsus.com Git - mad.git/commitdiff
Add some more on differences.
authorEric S. Raymond <esr@thyrsus,com>
Fri, 13 Feb 2004 22:29:26 +0000 (22:29 +0000)
committerEric S. Raymond <esr@thyrsus,com>
Fri, 13 Feb 2004 22:29:26 +0000 (22:29 +0000)
doc/mad-manual.xml

index 743e591b1594e60d67b1257afd72a0adb94ce9df..147c5fc4bb7280194d8ff9afbeb1d93ef9d8df3a 100644 (file)
@@ -2,7 +2,6 @@
 <!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">
@@ -98,10 +97,10 @@ reasin that flowcharts were getting too large to draw and read!</para>
 
 <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
@@ -130,12 +129,32 @@ overflow of numeric results may therefore differ.  The original MAD
 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
@@ -520,7 +539,12 @@ reading Chapter II.</para></footnote></para>
 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
@@ -1516,7 +1540,7 @@ CONTINUE
 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>
@@ -1693,8 +1717,8 @@ In the original, the phrase ", indicated by ... below" was not present.
 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>