]> thyrsus.com Git - mad.git/commitdiff
Started Chapter IV.
authorEric S. Raymond <esr@thyrsus,com>
Fri, 9 Apr 2004 16:43:07 +0000 (16:43 +0000)
committerEric S. Raymond <esr@thyrsus,com>
Fri, 9 Apr 2004 16:43:07 +0000 (16:43 +0000)
doc/mad-manual.xml

index 9cf04fac3563bd0389574fe88a230d6e6ef4ab09..30aeb4b7a6318cbb7e68781f2e3438b534d0f39c 100644 (file)
@@ -4632,8 +4632,219 @@ arguments of recursive functions.</para>
 </sect2>
 </sect1>
 </chapter>
-<!-- beginpage III.58 -->
+<!-- beginpage IV.1 -->
+<chapter><title>Mechanics of Using MAD</title>
 
+<sect1><title>Card Format</title>
+
+<para>MAD Statements are punched according to the following card format:</para>
+
+<mediaobject>
+  <imageobject>
+    <imagedata fileref='fig20.png'/>
+  </imageobject>
+</mediaobject>
+
+<para>1.1 Statement labels may be punched anywhere in cols. 1-10.
+Spaces are not relevant.</para>
+
+<para>1.2 Column 11 is used to designate a remark (R) or, alternatively, a
+continuation of a statement (0, 1, 2, ..., 9).  The digits used to
+indicate continuation cards need not be in any particular order but
+there may be at most 10 cards in a statement.</para>
+
+<para>1.3 The statement may start anywhere in cols. 12-72.  With the
+exception of characters enclosed between "$" spaces are not relevant.
+(Spaces may not be relevant even if they are so enclosed (see section
+2.15) on format specifications).</para>
+
+<para>1.4 The identification information in cols. 73-80 is not used by the
+computer for any purpose but printing during translation and is
+arbitrary.  Actually, it is good practice to use the first four of the
+available eight columns for the first four digits of the project
+number (i.e., for R10AN use R10A).  Presumably, the last four would
+contain some sequence code.</para>
+
+</sect1>
+<sect1><title>Diagnostics</title>
+
+<para>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
+printing of diagnostic 
+<!-- beginpage IV.2 -->
+comments some knowledge of the structure of the
+translator is helpful.  The translation from statements to machine
+code is accomplished in three major sections:</para>
+
+<orderedlist>
+<listitem><para>The decomposition of the original statements into
+arrays of binary operations and pseudo-operations.</para></listitem>
+
+<listitem><para>The analysis of all of the declarative information in
+order to allocate variable storage and identify the arithmetic types
+(i.e. modes) of variables.</para></listitem>
+
+<listitem><para>The combination of the information produced from (1)
+and (2) to translate the arrays to relocatable binary
+programs.</para></listitem>
+</orderedlist>
+
+<para>When an error is encountered in one of these sections the
+translation does not proceed to the next section.  However, insofar as
+possible, the entire set of statements is processed through the
+section in which the error is detected and therefore more than one
+error may be detected.  It should be understood, then, that not all
+detectable errors may be found because:</para>
+
+<orderedlist  numeration='loweralpha'>
+<listitem><para>They are detectable only in a later stage of the
+translation.</para></listitem>
+
+<listitem><para>Some types of errors make it impossible to attempt
+further detection within the section in which it
+occurs.</para></listitem>
+
+<listitem><para>One error may actually obscure another error.</para></listitem>
+</orderedlist>
+
+<para>Occasionally, an error in one statement may be such that it causes the translator to misinterpret a second statement, thus giving an error indication
+even though no error exists in the later statement.</para>
+
+<para>The printed diagnostic comment may very often have an alternative or
+ambiguous form.  This results from the fact that it is frequently not
+possible to determine what form was intended--merely that the present
+structure is not admissible--and therefore some of the alternative
+possibilities are suggested by the comment.</para>
+
+</sect1>
+<sect1><title>Structure of Subroutines</title>
+
+<para>The information in this and the following sections of Chapter IV are
+in much greater detail in other Computing Center write-ups.  However,
+the following sections should be sufficient for the general use of
+MAD.</para>
+<!-- beiginpage IV.3 -->
+
+<!-- the original had a tyo, "Probram" for "Program" -->
+<para>Subroutines which are written for use by MAD programs--whether
+written in MAD as functions or in SAP<footnote><para>SAP is the SHARE
+Assembly Program [typo] which permits the writing of actual machine
+instructions in symbolic form.</para></footnote>--must be relocatable
+and must operate from the calling sequences the translator produces.
+Consider, for example the function call --FN. (A,B,C)--which might
+appear in the body of a statement. Assume that B is an array which has
+an associated dimension vector BDIM.  Using SAP notation for
+illustrative purposes, the calling sequence produced would be</para>
+
+<programlisting>
+               TSX     FN,4
+               TXH     A
+               TXH     B,0, BDIM
+               TXH     C
+</programlisting>
+
+<para>Input-output routines utilize two types of parameters--the
+regional and single variable types.  In addition an error return is
+given as well as a format specification location.  The parameter
+operation code used is TXI and the end of the parameter list is
+indicated by a TXI operation with a blank address.  Thus the
+statement</para>
+
+<programlisting>
+       READ FORMAT FMT, BETA, X(1) ... X(100), K
+</programlisting>
+
+<para>would produce the calling sequence</para>
+
+<programlisting>
+               TSX     READ,4
+               TXI     ERROR
+               TXI     FMT
+               TXI     BETA
+               TXI     X-1, 0, X-100
+               TXI     K
+               TXI
+</programlisting>
+
+<para>On occasion it is useful to use the regional notation in subroutines
+which are not in the input-output category, for example, G. (GAMMA,
+DELTA, Z(10)...Z(20)).  The calling sequence would be</para>
+
+<programlisting>
+               TSX     G, 4
+               TXH     GAMMA
+               TXH     DELTA
+               TIX     Z-10, 0, Z-20
+</programlisting>
+<!-- beginpage IV.4 -->
+
+<para>It is important to notice that in this example, as well as in the
+first, the parameters--if executed as instructions--would produce no
+operation.</para>
+
+<para>It is beyond the scope of this manual to discuss the structure of
+relocatble programs (see IBM FORTRAN II Manual).  It is suficient to
+say that a relocatable program must contain--in adidtion to the actual
+instructions in the program--information as to which addresses must be
+relocated at the time of loading for execution and which addresses
+must not.  In addition, the first card (or record) of such programs
+must contain information about the size of the program, the number of
+subroutines it calls on, the amount of stroage it will share with
+other subroutines, the location of the list of subroutines it calls
+on, and the names by which the routine itself is referred to.  The
+symbolic names of the subroutines called on must appear as the first
+words after this information.</para>
+
+<para>The execution of MAD programs requires the use of a loading routine to
+relocate and store the program and subroutines.  A slightly modified
+BSS FORTRAN loader is automatically produced by the University of
+Michigan executive routine.  Also there are certain subroutines which
+may be automatically called for by a MAD program without an explicit
+reference to them in the source program.</para>
+
+</sect1>
+<sect1><title>Systems Subroutines</title>
+
+<para>The use of the following names for functions (subroutines)
+should be avoided except where the operation is the one indicated
+here.</para>
+
+<variablelist>
+<varlistentry>
+<term>SYSTEM</term>
+<listitem><para>Entry to this routine causes a
+return to the operating system.  The END OF PROGRAM statement produces
+a call for this routine.</para></listitem>
+</varlistentry>
+
+<varlistentry>
+<term>ERROR</term> 
+<listitem><para>Entry to this routine also causes a return to the
+operating system.  However, if a dump of storage was requested of the
+operating system such a print of storage will be produced before the
+return to the system.  The ERROR RETURN statement may produce a call
+for this routine.</para></listitem>
+</varlistentry>
+
+<varlistentry>
+<term>TAPEWR </term> <listitem><para>Entry to this subroutine causes
+BCD information to be written on tape.  The arguments are: (1)
+location of the format specification, (2) tape number, and (3) a list of
+<!-- beginpage IV.5 -->
+variables to be written.  The WRITE BCD TAPE ... statement produces
+a call for this subroutine.</para></listitem>
+</varlistentry>
+
+<varlistentry>
+<term>PRINT</term> <listitem><para>Similar to TAPEWR above except that
+the use of tape 6 (the output tape) is implied.  The PRINT FORMAT
+... statement produces a call for this subroutine.</para></listitem>
+</varlistentry>
+
+</variablelist>
+</sect1>
+</chapter>
 </book>
 <!--
 Local Variables: