@V7 54 2 -5
@L3 COUK1247
80
@V9 0
@YCHAPTER 10 - MUSS USER MANUAL
@G@RCHAPTER 10 - FORTRAN 77@G
@V10 1 9 184
@T% 10
@S210.1 INTRODUCTION
@T% 10
@BThe MUSS @JFORTRAN compiler implements Fortran 77 as defined
in the document 'BSR X3.9 FORTRAN 77 dpANS FORTRAN Language
X353/90' of the American National Standards. The compiler attempts
to remain close to the standards defined, any deviations from standard
are described in Section 10.3.
@S210.2 COMPILER ORGANISATION
@S210.3 NON-STANDARD FEATURES
@BMUSS Fortran includes extensions to the standard which improve
the compatibility with ANSI-66 Fortran, improve efficiency on small
machines by allowing a wider range of data types, and to assist
in the transfer of Fortran software, albeit nonstandard, to MUSS.
Thus the more common extensions available in many of the other present
day Fortran 77 compilation systems are supported.
@BAll violations to the Fortran 77 standard produce a warning message,
these messages may be suppressed by setting the compiler options.
@S310.3.1 Holleriths
@BHolleriths have been included as an extension to the standard language.
The use of Hollerith constants is restricted to DATA statements
in a manner described in Appendix C of the Fortran 77 standard.
A Hollerith constant may only be used
with INTEGER, LOGICAL or REAL types.
The actual number of characters in such types is machine
dependent (see 10.7).
@BThe standard Fortran character set has been extended to
include lower case letters, the dollar sign '$', underscore '_', tab and EOT cha
racters.
Lower case letters are accepted and treated as if they
were upper case letters, everywhere except in character and
hollerith constants.  Symbolic names may include dollar sign and underscore char
acters.  A Fortran source line may
include a tab character. A tab in columns 1 to 5 of the
Fortran source line has the affect of sufficient spaces to
ensure the following character is treated as being in column 6.
Tabs in column 6 and beyond are treated as spaces. The EOT
character may be used to mark the end of the Fortran compilation
and is an alternative to the *END directive (see 10.4)
or the compiler reaching the end of the input document both of which
indicate the end of the compilation.
@BMUSS commands may be included in the Fortran program source
for optional interpretation at compile time as they are encountered.
The option to interpret the MUSS commands is activated by the third
Parameter to the compiler, as described in section 10.8. MUSS commands
to be interpreted at compile time consist of an asterisk in columns one
and two of an input card followed by an alphabetic character which
begins the command, any other format is treated as a comment card beginning
with an asterisk and is ignored. If the option is not switched on the
directives are treated as normal comments. MUSS commands can occur
anywhere a Fortran comment could occur.
@BCompiler directives (which are described in Section 10.4) are also
non-standard extensions to the Fortran standard language.
@BThis compiler is more generous than the Standard in allowing any
comments after the last END of the last program unit (and before any *END
directive). Any program which has comments (or even MUSS commands) beyond
the last END would be non-standard, but would be acceptable to this
implementation.
@S310.3.3 Relaxation of Subprogram Argument Checks
@BThe compiler has a non-standard option of relaxing the strict
checking between dummy and actual arguments of a subprogram. This option,
when activated by setting a bit in the compiler mode parameter, permits
an actual argument of REAL, INTEGER or LOGICAL type to be substituted for
a dummy argument of either REAL, INTEGER or LOGICAL type, an actual
argument of DOUBLE PRECISION or COMPLEX type to be substituted for
a dummy argument of either DOUBLE PRECISION or COMPLEX type,
and an actual argument which is an expression, variable, array element
name or an array name to be substituted for a dummy argument which is a
variable or an array.
@S310.3.4 Precision of Arithmetic Data Types
@BREAL is nominally 32 bit precision, DOUBLE PRECISION 64 bit and
COMPLEX components 32 bits.  INTEGER and LOGICAL is nominally either
16 bit or 32 bit precision, depending on installation.  The compiler
also provides for INTEGER and LOGICAL data types with nominal precision
of 8, 16 and 32 bits.
@BIn addition to the standard arithmetic data types words REAL, DOUBLE
PRECISION, COMPLEX, INTEGER and LOGICAL the compiler is extended to cater
for the following non-standard arithmetic data types.@
@T% 10 30
@
@
%INTEGER*1%8 bit integer@
%BYTE%Synonym for INTEGER*1@
%INTEGER*2%16 bit integer@
%INTEGER*4%32 bit integer@
%LOGICAL*1%8 bit logical@
%LOGICAL*2%16 bit logical@
%LOGICAL*4%32 bit logical@
%REAL*4%Synonym for REAL@
%REAL*8%Synonym for DOUBLE PRECISION@
%COMPLEX*8%Synonym for COMPLEX@
@BThe compiler is extended to allow these additional arithmetic data
type words in any Fortran statement instead of a standard arithmetic
data type word.  Thus the compiler caters for additional data type
words in:@
@
@Mtype specification statements
@Nimplicit statements and
@Nfunction statements.
@S310.3.5 Data Initialisation in Declarative Statements
@S310.3.6 Common Block Extensions
@BThere are several extensions concerning common:@
@T% 10
@
@
i)@IThe compiler is extended for initialisation of blank common.
ANSI Fortran 77 only allows named common initialisation.@
@
ii)@IThe compiler is extended for blank common and named common
to be initialised in any program unit.  ANSI Fortran 77 only allows
initialisation in block data program units.@
@
iii)@ICharacter and non-character variables may be present in the
same common block.@
@
iv)@IWithin separate program units the size of the same
named common block can be different.  However, after a named common
block definition, all further definitions to the same named common
block in following program units, the size of the common block must
not be greater than its initial definition.
@S310.3.7 Length of Symbolic Names
@BSymbolic names can have any number of characters.
@S310.3.8 Recursion of Subroutines and Functions
@BThe compiler is extended to allow recursion of subroutines and
functions. Normally all data variables are statoic, however
non-common data variables may be allocated dynamically on the
procedure call by the *MAP directive.
@S310.3.9 DO Loop Extensions
@BThere are several extensions concerning DO loops:@
@
i)@IIn ANSI Fortran 77 if the iteration count of a DO loop is
initially zero the statements in a DO loop are not obeyed.  In
Fortran 66 all DO loops were executed at least once.  The compiler
is extended for Fortran 66 loops, the compiler option (LOOP66)
allows DO loops to be executed at least once.@
@
ii)@IFortran 66 has the notion of an extended DO loop range;
ANSI Fortran 77 does not.  The compiler option (EX-RANGE) allows
a DO loop range to be extended.
@S310.3.10 ENCODE and DECODE Statements
@BThese are additional statements which are an extension to ANSI
Fortran 77.
@BThe DECODE statement transfers data from variables or arrays in external form
to variables or arrays in internal storage.
@BDECODE translates the data from character form to internal form according
to a format identifier.  The form of a DECODE statement is:@
@BDECODE (c, f, b [, IOSTAT = ios] [, ERR = s]) [list]@
@
c@IAn integer expression that indicates the number of characters
to be translated to internal form.@
@
f@IA format identifier.  It can be either the label of a FORMAT
statement, or the name of a character array, character variable,
character expression, or arithmetic array.@
@
b@IThe name of an array, array element, variable, or character substring
reference.  OIt contains the characters to be translated to internal
form.  The array or variable can be of any type.@
@
ios@IAn integer variable or integer array element that is defined as a
positive integer if an error occurs, and as a zero if no error occurs.@
@
s@IThe label of an executable statement.@
@
list@IA list of the data items which receive the data after translation
to internal form.
@BThe DECODE statement translates the character data in b to
internal (binary) form according to the format specifier, and stores
the elements in the list, as does a READ statement.
@BIf b is an array, its elements are processed in the order of their
subscripts.
@BThe number of characters that the DECODE statement can process
depends on the data type of b in that statement.  For example, an INTEGER*2
array can contain two characters per element, so that the maximum
number of characters is twice the number of elements in that array.
A character variable or character array element can contain characters
equal in number to its length.  A character array can contain characters
equal in number to the length of each element multiplied by the number
of elements.
@BIn a DECODE statement, c cannot be greater than b.  If it is, the
results are unpredictable.
@BThe format specifier works the same way that it would for a formatted
READ or WRITE statement.
@SExample:@
@
@3
@M     DIMENSION I(3)
@N     CHARACTER*9 X
@N     DATA X /'123456789'/
@N     DECODE (9, 100, X) I
@N100  FORMAT (I9)
@0
@BThis example translates the nine characters in X to integer form
(specified by statement 100), and stores them in array I as follows:@
@
@3
@N     I(1) = 123
@N     i(2) = 456
@N     I(3) = 789
@0
@BThe ENCODE statement transfers data from variables or arrays in
internal storage to variables or arrays in external form.
@BENCODE translates the data from internal form to character form
according to a format identifier.  The form of an ENCODE statement is:@
@
@MENCODE (c, f, b [IOSTAT = ios] [, ERR = s]) [list]
@
@
c@IAn integer expression.  It indicates the number of characters (bytes)
to be translated to character form.@
@
f@IA format identifier.  It can be either the label of a FORMAT
statement, or the name of a character array, character variable,
character expression or arithmetic array.@
@
b@IThe name of an array, array element, variable, or character substring
reference.  It receives the characters after translation to external
form.@
@
ios@IAn integer variable or integer array element that is defined as a
positive integer if an error occurs, and as a zero if no error occurs.@
@
s@IThe label of an executable statement.@
@
list@IContains the data to be translated to character form.
@BThe ENCODE statement translates the list elements to character
form according to the format specifier, and stores the characters in b, as
does a WRITE statement.  If fewer than c characters are transmitted, the
remaining character positions are filled with spaces.
@BIf b is an array, its elements are processed in the order of their
subscripts.
@BThe number of characters that the ENCODE statement can process
depends on the data type of b in that statement.  For example, an
INTEGER*2 array can contain two characters per element, so that the
maximum number of characters is twice the number of elements in that
array.  A character variable or character array element can contain
characters equal in number to its length.  A character array can
contain characters equal in number to the length of each element
multiplied by the number of elements.
@BIn an ENCODE statement, c must not be greater than b.  If it is the
results are unpredictable.
@BThe format specifier works the same way that it would for a
formatted READ or WRITE statement.
@SExample:@
@3
@
@M     CHARACTER A(3)*3
@N     DATA I /123456789/
@N     ENCODE (9, 100, A) I
@N100  FORMAT (I9)
@0
@BThis example translates the value of X to character form and
stores the characters in the character array I as follows:@
@3
@
@N     A(1) = '123'
@N     A(2) = '456'
@N     A(3) = '789'
@0
@S310.3.11 Direct Access READ and WRITE Industry-Standard Format
@BThe compiler is extended for industry-standard formats for
READ and WRITE statements to direct access files.
@BThus as alternatives to@
@Q 6
@
@MREAD([UNIT=]v[,[FMT=]format],REC=record.no
@N      [,ERR=s][,END=s][,IOSTAT=ios])[input list]
@
@NWRITE([UNIT=]v[,[FMT=]format],REC=record.no
@N      [,ERR=s][,IOSTAT=ios])[output list]
@
@
you can use@
@Q 6
@
@NREAD(u'record.no[,[FMT=]format]
@N        [,ERR=s][,END=s][,IOSTAT=ios])[input list]
@
@NWRITE(u'record.no[,[FMT=]format]
@N          [,ERR=s][,IOSTAT=ios])[output list]
@S310.3.12 Octal and Hexadecimal Typeless Constants
@BConstants may be written in octal and hexadecimal notation.  They are
alternative ways to represent numeric constants.  You can use them
wherever numeric constants are allowed.
@BA typeless constant in octal notation is a string of octal digits
enclosed by apostrophes and followed by the alphabetic character 0.
This constant has the following form:@
@
@M'd[d]...'0
@
@Md   is a digit in the range 0 to 7.
@BA typeless constant in hexadecimal notation is a string of
hexadecimal digits enclosed by apostrophes and followed by the
alphabetic character X.  This constant has the following form:@
@
@M'd[d]...'X
@
@Md   is a digit in the rage 0 to 9, or a letter in the range@
@N    A to F or a to f.
@BLeading zeros are ignored in typeless constants.  You can specify
up to 64 bits (22 octal digits, 16 hexadecimal digits).
@SExamples:@
@T%10 30
@
@
%@OOctal@O:%'12760'0@
%%'5'0@
%%'66666666'0@
@
@
%@OHexadecimal@O:%'A2C12D45'X@
%%'FEDCBA'X@
%%'345'X
@BOctal and hexadecimal constants are typeless numeric constants.
They assume data types based on the way they are used as follows:@
@T% 10
@
i)@IWhen the constant is used with a binary operator, including the
assignment operator, the constant assumes the data type of the
other operand.@
@
ii)@IWhen a specific data type (usually integer) is required, that type is
assumed for the constant.@
@
iii)@IWhen the constant is used as an actual argument, no data type is
assumed; however, a length of four bytes is always used.@
@
iv)@IWhen the constant is used in any other context, a 32 bit INTEGER
data type is assumed.
@SExamples:@
@T% 10 40 47
@
@
%@OStatement@O%Data Type of Constant@O
@
%INTEGER*2 ICOUNT@
%REAL*8 DOUBLE@
%ALPHA = '67B12'X%%REAL*4@
%JCOUNT = ICOUNT + '676'0%%INTEGER*2@
%DOUBLE = 'FFE7A1'X%%REAL*8@
%IF (K .EQ. '123'0) GO TO 50%%INTEGER*4@
%X = Y('16'0) + 6%%INTEGER*4@
%CALL ABC ('D49C2'X)%%none@
%IF ('AD89'X) 1,2,3%%INTEGER*4@
%I = '6543'0 - 'A39'X%%INTEGER*4
@BAn octal or hexadecimal constant actually specifies as much as 8 bytes
of data.  These constants are right justified, and zero filled to the
left and truncated to the left where necessary.  A warning results if any
non-zero digits are truncated.
@S310.3.13 Parenthesis in PARAMETER Statements
@BIn ANSI Fortran 77 the form of the PARAMETER statement is:@
@
@MPARAMETER (p=e[,p=e]...)
@BThe compiler is extended to allow the closing parentheses to be
omitted.  If the enclosing parenthesis are omitted and the variable
is untyped, the type of the constant variable is defined by the
type of the constant value.
@S210.4 COMPILER DIRECTIVES
@BCompiler directives are Fortran statements (and therefore start after
column 6) which commence with an asterisk. They take effect at the point
they occur during the compilation of the Fortran source program.
As with all other Fortran statements they may be continued with continuation
lines, and only columns 7-72 are significant. All spaces, blank lines
and comments within the directives are ignored, in a similar way.
@S310.4.1 *END -End of Program
@BThe *END directive marks a end of the Fortran compilation, it
is an alternative to the end of input document being detected or an EOT characte
r.
@S310.4.2 *IMPORT -Import Library Procedures
@BThe *IMPORT directive is provided to enable Fortran programs to
call subprograms from a Library. The directive has as its arguments
a list of procedure names represented by Fortran character constants or Fortran
names.
@M*IMPORT 'CAPTION', 'OUTHEX', 'OPENFILE'
@B*IMPORT GFNIN, GFNOIUT are examples of Import directives.
Note that as an imported procedure name may have more
than six characters, a character constant is used. If the procedure
names specified are not known to the system, then the Library
containing them must be opened prior to the Fortran compilation.
The procedures imported into a Fortran program can be called as if
they were subprograms from the programs being compiled. This directive
must occur before any Fortran statements.
@S310.4.3 *LIB - Import Whole Library
@BThe *LIB directive is provided to import all the procedures from a
particular library. It is an equivalent to importing each of the procedures
individually with a *IMPORT directive. The *LIB directive has one
argument which is a Fortran character constant containing the name of
the file containing the library. The named library must not be already
open, as this directive will open the library.@
@
@M*LIB  'USR14:TIMER'
@
@
is an example of the *LIB directive. This directive must occur before
any Fortran statements.
@S310.4.4 *EXPORT - Creating Fortran Libraries
@BThe *EXPORT directive is provided to direct the compiler to
include the named subprograms in the interface of a Fortran library.
In addition to using this directive the mode parameter to the compiler
needs the correct value (4) to create a library. The library will be
placed in the file indicated by the second parameter to the Fortran
compiler. The arguments to the *EXPORT directive are the Fortran names
of the subprograms to be included in the library.@
@Q 8
@T% 30
@
%FORTRAN 0 LIB 4@
%      *EXPORT TEST@
%      SUBROUTINE TEST@
%      PRINT *,'TEST'@
%      END@
%      *END@
@
@
is an example of creating a library called LIB containing the Fortran
subroutine called TEST. The *EXPORT directive must occur before any
Fortran statements.
@S310.4.5 *MAP - Storage Control in Fortran
@BThe *MAP directive is provided to give the Fortran programmer control
of the location of code, common and local variables. This would be useful
when several libraries share a common block, or if a program is very large.
When this directive is not used Fortran handles the storage control
automatically. The TL.SEG (23.4) procedure will need to be called in
conjunction with this directive, to create and specify the MUTL segment
in which to place the data or code.
@BThere are three forms of the *MAP directive, for mapping code,
common and local data.
@BThe *MAP CODE form is used to specify the MUTL segment into which any
following code is to be placed. This segment should already have been
declared to MUTL by using the TL.SEG procedure. The TL.SEG may be called
by using the ** command option. This directive has two arguments, the
first specifies the MUTL segment number, the second (optional) parameter
specifies the segment size in bytes.@
@Q 6
@
@X%\
\FORTRAN  0  0  %8000@
\**TLSEG  3  %0 -1 -3 %C@
\        *MAP  CODE 3@
\         I = 1@
@
@
is an example of the *MAP CODE directive which would place the code
for 'I=1' (and any following code) into MUTL segment 3.
@BThe *MAP CODE directive may occur anywhere within a Fortran program.
@BThe *MAP for common is used to specify the MUTL segment into which
the named common is to be placed. This segment should have already
been declared to MUTL. The *MAP directive for common may only occur
before a program unit, it cannot occur within a program unit.@
@Q 11
@
\FORTRAN  0  0  %8000@
\**TLSEG  3  %0  -1  -3  %C@
\**TLSEG  4  123456  -1  -3  %C@
\      *MAP  /NAME/  3@
\      *MAP  // 4, 123456@
\      SUBROUTINE ONE@
\      COMMON /NAME/ A,B,C@
\      COMMON D,E,F@
\      END@
@
@
is an example of mapping the named common /NAME/ into MUTL segment 3
and blank common into segment 4 (of size 123456 bytes). If the common
blocks are not mapped explicitly Fortran will choose store for them
automatically.
@BThe *MAP DATA directive is used to map local data variables and
unmapped common (non blank) into a MUTL segment. The *MAP DATA
directive has two arguments specifying the MUTL segment and its
(optional) size in bytes. This directive may only occur before a
program unit, it cannot occur within a program unit. A MUTL segment
number of zero as an argument causes the explicit mapping to be
disabled, and allows the Fortran to resume automatic store control
of local data.@
@Q 16
@
\FORTRAN  0  0  %8000@
\**TLSEG  3  %0 -1  -3  %C@
\**TLSEG  4 %0  -1  -3  %C@
\       *MAP /COM/ 3@
\       *MAP  DATA 4@
\       SUBROUTINE TWO@
\       COMMON /COM/ A,B,C@
\       COMMON /OTHER/ D,E,F@
\       INTEGER I,J,K@
\       I = J+K@
\         .@
\         .@
\         .@
\       END@
@
@
is an example of mapping the common /COM/ onto MUTL segment 3, and
the common /OTHER/ and the variable I,J,K onto MUTL segment 4. If the
*MAP DATA is not used Fortran will allocate storage space automatically.
@BThe use of mode bit 8 of the compiler also affects storage management.
The setting of mode bit 8 to place items on the stack takes precedence
over the *MAP DATA directive.
@X%%
@S310.4.6 *LIST - Source Program Listing
@BThe *LIST directive enables the listing of the source program during
compilation.  Comment lines of the program are not listed.
@S310.4.7 *NOLIST - Stop Source Program Listing
@BThe *NOLIST directive stops the source program listing.
@S310.4.8 *ANSISWITCH - Suppress Warning of Long Symbolic Names
@BNormally the compiler issues a non-standard warning for Fortran names
longer than six characters.  The *ANSISWITCH turns the printing of this
warning message on and off.  The first occurrence of *ANSISWITCH
suppresses the printing, its second occurrence turns the printing on
again, the third turns it iff again, and so on.
@S210.5 COMPILER PARAMETERS
@BThe compiler parameters were previously mentioned in chapter 8.
@BThe first parameter specifies the origin of the Fortran 77 source.
@BThe second parameter specifies the destination of the compiler output.
@BThe third compiler parameter specifies the compilation options.
@BThe fourth parameter specifies the maximum number of library interface procedu
res.
@S310.5.1 Compiler Options Parameter
@BCompiler options are specified as a list of keywords separated by
commas.  Some of the keywords may be followed by integers expressed in
decimal or hexadecimal.  No spaces are permitted in the list of
options unless the whole list is enclosed in quotes.
@BOption keywords may be chosen from the following list (recognised
abbreviations are in parentheses):@
@T% 30
@
@
CLI@ISpecifies that any line with ** in columns one and two, followed
by a letter in column 3, is a MUSS command language line to be
interpreted.  This is the default.@
@
DEBUG(DB)@ISpecifies that debugging information is to be produced
(the default).@
@
ERRORLIMIT(EL)[number]@IChanges the maximum of errors that can
occur before the compiler abandons the compilation.@
@
LIBRARY(LB)@ISpecifies that the source being compiled is to be made
into a library.@
@
LIST(LS)@ILists the source as it is compiled until an optional
*NOLIST directive is encountered.  Comments are not listed.@
@
LONGINTEGER(LI)@ISpecifies the default integer and logical size to be
32 bits.  It does not affect those types sized explicitly.  Any types
sized explicitly would not conform to the ANSI standard for FORTRAN77.@
@
LOOP66(L66)@ISpecifies that the code planted by the compiler for
DO-loops and implied DO-loops should make the minimum number of times
a loop is obeyed once, as in ANSI-66 FORTRAN.@
@
LOOP77(L77)@ISpecifies that the code planted by the compiler for
DO-loops and implied DO-loops should make the minimum number of times
a loop is obeyed zero, as in standard FORTRAN77 (the default).@
@
NOCLI@ISpecifies that any line with ** in columns one and two, followed
by a letter in column 3, is not to be interpreted as a Command language
line, but is a comment.@
@
NODEBUG(NDB)@ISpecifies that debugging information is not to be
produced.@
@
NOLIST(NLS)@IDo not list he source as it is compiled until an optional
*LIST directive is encountered.  This is the default.@
@
NON-ANSI@IDisables all warnings that indicate how the compiled program
deviates from ANSI FORTRAN77.  Each deviant feature can also be controlled
individually to allow the programmer to be aware of any unexpected non-standard
use.  The options for the detailed manipulations of these warnings are given
below.@
@
   ALTDA(AD)@IDisables the warnings given when alternate forms
of direct access READ and WRITE statements are used.@
@
   COMMON-SIZE(SZ)@IDisables the warnings given when various references
to the same COMMON block are of different sizes.@
@
   ENCODE.DECODE(ED)@IDisables the warnings given when the ENCODE or
DECODE statements are used.@
@
   EXTRACHARS(EC)@IDisables the warning message given when the
non-standard characters underscore '_' and dollar sign '$' are used
in a symbolic name.@
@
   EXTRATYPES(ET)@IDisables the warning given when types are given
an explicit size, (e.g. INTEGER*4).@
@
   EX-RANGE(XR)@IDisables the warnings given when attempting to use
the extended range of a a DO by jumping back into a DO-loop from outside.@
@
   HEX/OCTAL(XO)@IDisables the warnings given when the hexadecimal or octal
form of constants is used.@
@
   HOLLERITHS(HO)@IDisables the warnings given when Hollerith constants
are used as an extension to the ANSI standard, and allows arithmetic
arrays containing Hollerith data to be used as format specifiers.@
@
   INIT-COMMON(IC)@IDisables the warnings given when blank common is
initialised or when a named common is initialised outside of a block
data subprogram.@
@
   INIT-DECL(ID)@IDisables the warnings given when variables are
initialised outside of a block data subprogram.@
@
   LONGNAMES(LN)@IDisables the warnings given for names longer than
six characters.  Names can be of any length.@
@
   MIX-CHAR(MC)@IDisables the warnings given when CHARACTER variables
are mixed with other types in COMMON or by EQUIVALENCE statements.@
@
   NOARGCHECK(NAC)@IDisables warning messages given by the strict
argument checking performed in the compiler between the definition
and reference of program units compiled at one time.@
@
   OLDPARAMETER(OD)@IDisables the warnings given when a PARAMETER
statement with no parenthese is used.@
@
   QUOTE-HOLL(QH)@IDisables the warnings given when quotes are used
to indicate Hollerith data.@
@
   RECURSION(RC)@IDisables the warning message given when recursion
is used.@
@
NOTL@ISpecifies that the code generator should not be initialised.@
@
NOTLEND@ISpecifies that the code generator should not be terminated
at the end of compilation.@
@
number@IThis option is permitted to allow compatability with earlier
versions of the compiler, and to allow implementors to enable
personalised options.@
@
ONSTACK(OS)@ISpecifies that any variables not explicitly static (by
being SAVEed or in common) are allocated storage on the stack.@
@
OPENDEFAULT(OD)@ISpecifies that any OPEN statements within the program
are not for both read and write.  The file should be opened with only
the access required by the first READ or WRITE statement that accesses it.@
@
OPENDEFAULTIO(ODIO)@ISpecifies that any OPEN statements within the program
should open the file with both read and write access allowed (the default).@
@
SHORTINTEGER(SI)@ISpecifies the default integer and logical size to be
16 bits.  It does not affect those types sized explicitly.  Any types
sized explicitly would not conform to the ANSI standard for FORTRAN77.@
@
SYNTAXONLY(SO)@ISpecifies that only a syntax check should be performed
on the program and no code generated.@
@
TLPRINT<number>@IThis causes the compiler to issue a call with the number
as a parameter to TL.PRINT (see Chapter 23) at the start of a compilation.
@S210.6 INPUT/OUTPUT
@BInput/output is implemented to the Fortran Standard. In extension to
this standard characters may be read or written from REAL, INTEGER or LOGICAL da
ta types
using the 'A' format (see also 10.2).
@BThe details of pre-connection are left undefined by the standard.
In the implementation unit numbers are related to MUSS streams for the purpose o
f
pre-connection. The result of unit modulus 8 gives the MUSS stream number
which is used for the transput. It is the first access to the unit which
defines if it is an input or output stream. However, some operations
on a pre-connected unit do not imply input or output (namely BACKSPACE,
REWIND, INQUIRE, OPEN, CLOSE). In these cases there should not be
an input and output stream of the same number (unless it's an I.O stream),
and then it is unambiguous
which stream should be used.
@BThe BACKSPACE statement cannot be used to move between sections of a
multi-sectioned MUSS stream. REWIND operates differently, rewinding a unit
causes the stream to be ended and re-connected on
the next access.  This affects output to a process; any output
destined for a process will be sent when a rewind is made, each rewind
causing a further document to be sent.
@BIt is not possible, at present, to BACKSPACE unformatted records,
neither does the implementation allow the changing from reading to
writing on pre-connected streams which are only defined for one mode
of operation (an I.O stream should be used instead).
@BWhen an INQUIRE by name is made to a pre-connected file, the
inquiry will not be able to determine which unit the file is connected to,
unless the unit has been accessed previously in the same run.  If such
an inquriy is made only details about the file will be returned, and not
any about the connection.  An OPEN statement which gives no file name
causes a connection to the MUSS current file.  A PRINT statement or a
READ with no unit number, or an '*' as a unit refers to input or output
stream zero.
@BOutput from programs consists of what was specified by the FORMAT, WRITE
or PRINT statements.  The carriage control characters in the first
column are not interpreted or removed, this enables output to be read
back by the same format that was used to write it (as the standard
requires).  To send any output to a printer the LIST command should be
used.  This has two parameters (the file to be printed, and the
destination device), and it processes the file producing the correct
interpretation of the carriage control characters for printing.
@BFortran sequential input/output has a default maximum record length.
In Standard Fortran there is no way of specifying the record length for
sequential input/output so the subprogram FIO.SET.UNIT.REC.L is used.
This subprogram has two parameters, the first the unit number and the
second the maximum record length required.  If this procedure is not
used a suitable default is assumed.  This procedure may be used for
both program connected and pre-connected units.
@S210.7 FAULT MONITORING
@S310.7.1 Compile Time Faults
@BFaults at compile time are divided into warnings and fatal errors.
A program containing only warnings may be run, as the warnings only
refer to non-standard or bad features of the program (such as GOTO
the next statement). Fatal errors are issued when the compiler is
unable to understand the supplied program and may generate incomplete
code for the offending statement.
Each faulty line is output by the compiler followed by the fault messages.
@BEvery fault message will attempt to locate the fault within a statement
by either an upward arrow below the point the compiler reached on
determining the fault or including an offending name from the statement
in the message. The former method is usually used for syntactic faults,
the latter for semantic faults.
At the end of a compilation the total number of message faults are printed.
@S310.7.2 Run Time Faults
@BFaults at run time will cause MUSS to trap the program, and these traps
will be handled as any other high level language trap. A fault message
usually accompanies such a trap. The Fortran run-time system uses trap
number 6 for any input/output faults. A list of Fortran trap 6 reasons
is given below.@
@Q 31
@
@M101  Inconsistent field descriptor for input/output list item.
@N102  Illegal character in list directed complex character.
@N103  Illegal use of null value in list directed complex constant.
@N104  Attempted read beyond end of record.
@N105  No field descriptor for input/output list item.
@N106  Illegal character in integer or exponent.
@N107  Illegal value separator.
@N108  Illegal use of repeat counts.
@N109  Zero repeat count not allowed.
@N110  As 104.
@N111  Illegal character in logical item.
@N112  Illegal character (in repeat count?).
@N113  * missing from a repeat count.
@N114  Illegal character in a real.
@N115  Illegal sign in integer or exponent.
@N116  Attempted write beyond end of record.
@N117  Illegal carriage control char on output.
@N118  Illegal run time format.
@N119  Format label specified not defined.
@N120  No digit following sign.
@N121  Reading beyond sequential ENDFILE record.
@N122  Illegal unit access.
@N123  Invalid parameter in OPEN.
@N124  Invalid parameter in CLOSE.
@N125  Writing Direct Access record of wrong length.
@N126  Writing beyond sequential record.
@N127  Invalid unit number.
@N128  Too many units connected.
@N129  Invalid Fortran file format.
@N130  Attempted use of unimplemented I/O feature.
@BFortran also generates a trap Class 8 Reason 111 for an Assigned
GOTO with a faulty argument specifying an invalid label. The
mathematical functions library which can be called from a Fortran
program also generates class 8 fault.
@S210.8 MULTI LANGUAGE PROGRAMMING CONSIDERATIONS
@BProviding a compiler supports calls to procedures in a previously
compiled library, then potentially procedure calls to any other
high level language supported by MUSS are possible.  However, there
are difficulties due to contrasting language concepts.  To aid
multi-language programming in Fortran in this manner the procedural
conventions of Fortran are described in terms of the systems
implementation language MUSL.
@BArguments to Fortran functions and subroutines are passed in a
similar manner, sections 10.8.1 through 10.8.6 detail conventions
concerned with calling Fortran procedures. Section 10.8.7 is
concerned with calling library procedures from Fortran.
@S310.8.1 Variables as Dummy Arguments
@BAn actual argument is passed as a bounded reference to a variable
of the same type and precision as the dummy argument.  For character
arguments the bound of the reference is the maximum length of the
dummy argument.
@SExample@
@U 11
@
@
          ----FORTRAN----
          SUBROUTINE FSUB(X)
          REAL X
          X = SQRT (X**3 + LOG10(X))
          END
          ----MUSL----
          REAL32 [1] MY;
          FSUB (^MY);
          ---------------
@S310.8.2 Arrays as Dummy Arguments
@BAn actual argument is passed as a bounded reference to a
vector whose elements are of the same type and precision as the
dummy argument.  For non-character arguments the bound of
the reference gives the maximum permitted size of the dummy
argument.  For character arguments the bound of the reference
gives the maximum numbers of characters accessible via the
dummy argument, and an additional value of default INTEGER is
always passed which gives the length of the character elements
in the array.  This value is used when the length of the array
elements of the dummy arguments are of assumed size.
@SExamples@
@U 16
@
@
          ----FORTRAN----
          SUBROUTINE FARR(XA,XB,I,J)
          REAL XA(100), XB(I,J)
          INTEGER I.J
          ....
          XA (K) = XB (L,M+1) + XB (L,M-1)
          ....
          END
          ----MUSL----
          REAL32[200] XA;
          REAL32[4000] XB;
          ...
          FARR (^XA,^XB,20,20)
          ---------------
@
@
@U 15
          ----FORTRAN----
          SUBROUTINE PRVEC (CH,I)
          CHARACTER CH (I) * (*)
          WRITE (6,100) (CH)
    100   FORMAT (1X,A)
          END
          ----MUSL----
          $LO8 [20] VEC;
          DATAVEC MESS ($LO8)
          "MESSAGE 1"
          "MESSAGE 2"
          END
          PRVEC (^VEC,4,5); ::5 elements of 4 characters
          PRVEC (^MESS,9,2);::2 elements of 9 characters
          ---------------
@S310.8.3 Asterisks as Dummy Arguments
@BIn Fortran when the dummy argument is an asterisk the actual
argument must be an alternate return specifier.  No information is
passed for asterisk dummy arguments; the result of a Fortran
subroutine is always INTEGER and it contains a non-negative value.
A result of zero or greater than the number of asterisks in the
dummy argument list indicates a normal return, otherwise.  Control
is returned to the alternate return label associated with this
result value.  Thus one indicates the first alternate return label,
two the second, etc., in the actual argument list.
@SExamples@
@U 30
@
@
          ----FORTRAN----
          ....
          CALL SELECT (Y,*100,*300,*500)
          ....
          SUBROUTINE SELECT (X,*,*,*)
          REAL X
          IF (X.LT.O) RETURN 1
          IF (X.GE.0.NAD.LT.100) RETURN 2
          IF (X.GT.1E6) RETURN
          RETURN 3
          END
          ----MUSL----
          REAL32 Y;
          INTEGER I;
          IF SELECT (Y) => I > 0 < 4 THEN
             ALTERNATIVE I-1 FROM
                BEGIN   ::First alternate return
                ...
                END
                BEGIN    ::Second alternate return
                ...
                END
                BEGIN    ::Third alternate return
                ...
                END
             END
          FI;
          ---------------
@S310.8.4 Procedures as Dummy Arguments
@BOnly the address of a procedure actual argument is passed.  There is no
dynamic check to enusre compatibility between the argument list of the
dummy and actual procedure argument, the onus is on the programmer
to check carefully use of this facility.
@SExamples@
@U 26
@
@
          ----FORTRAN----
          ...
          ANS = INTEGR (SIN,0,0.5);
          ...
          REAL FUNCTION INTEGR (FX,A,B)
          REAL FX, A, B
          EXTERNAL FX
          ...
          ...
          Y = 0.5*(FX(A+I*STEP) + FX(A+(I+!)*STEP)
          ...
          END
          ----MUSL----
          PSPEC MSIN(ADDR[REAL32])/REAL32
          PROC MSIN(X);
          MSIN = SIN(x^[0]);
          END
          ...
          REAL32 ANS;
          REAL32 [1] A,B;
          0 => A[0];
          0.5 => A[1];
          INTEGR(^MSIN, ^A,^B) => ANS
          ---------------
@S310.8.5 Complex Arguments and Functions
@BComplex variables are defined as variables of user type with two
REAL32 fields for the real and imaginary components.  For a complex
function after the argument list is passed an additional
parameter is passed which is an unbounded reference to a complex
variable for the function value.
@SExamples@
@U 14
@
@
          ----FORTRAN----
          COMPLEX FUNCTION CXADD (CA,CD)
          COMPLEX CA,CD
          CXADD = CA + CD
          END
          ----MUSL----
          TYPE COMPLEX IS REAL32 R, I;
          COMPLEX[1] A, B;
          COMPLEX RES;
          ....
          CXADD (^A, ^B, ^RES);
          ---------------
@S310.8.6 Character Functions
@BFor a character function after the argument list is passed one
additional parameter is passed which is a bounded reference to a
byte vector for the function value.
@SExamples@
@U 13
@
@
          ----FORTRAN----
          CHARACTER*(*) FUNCTION CONCAT (STR1,STR2)
          CHARACTER*(*) STR1, STR2
          CONCAT = STR1//STR2
          END
          ----MUSL----
          $LO8[100] RES;
          $LO8[20] A, B;
          INTEGER I,J,K,L;
          CONCAT (PART(^A,I,J),PART(^B,K,L),^RES);
          ---------------
@S310.8.7 Parameter Conventions when Calling Library Procedures from Fortran
@S210.9 INSTALLATION DEPENDENCE
@S310.9.1 Accuracy
@S310.9.1.1 MU6G
@BOn MU6G INTEGER is in the range -2**31 to 2**31.  REAL has a
mantissa of 24 binary digits (approximately 7 decimal digits) with an exponent
range 16**64 to 16**(-64) which gives a maximum decimal magnitude of
10**77 approximately.
@BDOUBLE PRECISION has an accuracy of 16 decimal digits approximately.
@BINTEGER, LOGICAL and REAL may hold up to four characters.
@S310.9.1.2 VAX
@BOn VAX INTEGER is in the range -2**31 to 2**31, REAL has a mantissa
of 24 binary digits (approximately 7 decimal digits) with an
exponent range 2**64 to 2**(-64) which gives a maximum decimal
magnitude of 10**19 approximately.
@BDOUBLE PRECISION has an accuracy of 16 decimal digits approximately.
@BINTEGER, LOGICAL and REAL items may hold up to four characters.
@S310.9.1.3 MC68000
@BOn MC68000 INTEGER is in the range -2**15 to 2**15.  REAL has a
mantissa of 24 binary digits (approximately 7 decimal digits) with an
exponent range of 2**64 to 2**(-64) which gives a maximum decimal
magnitude of 10**19 approximately.
@BDOUBLE PRECISION has the same accuracy as REAL.
@BINTEGER and LOGICAL may hold up to two characters and REAL up
to four characters.
@BThe action of the EQUIVALENCE is non-standard.  INTEGER and
LOGICAL are allocated 2 bytes, REAL and DOUBLE PRECISION 4 bytes,
and COMPLEX 8 bytes.
@S310.9.2 Stop and Pause
@BFor STOP and PAUSE statements with no arguments, a caption
indicating that the program has stopped or paused together with source
@program line number of the STOP or PAUSE statement is output on
stream zero.  When STOP and PAUSE have arguments the string of digits
or characters is output with the caption.
@BAfter obeying a STOP or PAUSE control exits from the program to the
caller.  A paused program may be re-entered by the command CONTINUE.
@F

