HELP: The WATFIV Compiler on MUSIC
GENERAL
WATFIV is a FORTRAN compiler and executor developed by the University
of Waterloo. It features the ability to compile full FORTRAN IV pro-
grams more quickly and giving more complete diagnostics than the
FORTRAN G1 compiler. While the user's program is executing, checks
are made for incorrect use of undefined variables, subscript range
errors and other violations of FORTRAN rules.
The WATFIV compiler on MUSIC incorporates the Waterloo FORTRAN exten-
sions that support structured programming. Modifications to the com-
piler were made at McGill University to increase its compatibility
with FORTRAN G1 and to adapt it to the MUSIC terminal environment.
USAGE NOTES
WATFIV cannot produce object decks or assembler listings of generated
code. Object decks produced by other compilers and assemblers cannot
be used.
Since the compiler is resident during the compile and execution steps,
the maximum size of the user's program is reduced by the size of the
compiler. The total main storage available to the user program in a
108K region is about 16K with V2L0 of WATFIV.
Statements within a program or subprogram should appear in the follow-
ing order:
1. Specification statements (for example, DIMENSION statements).
2. Arithmetic statement functions.
3. Executable statements.
The subroutines available for WATFIV are the standard FORTRAN func-
tions, and the system subroutines SUPRED, NOPAUS, NPRMPT, NOCRLF,
RESTED, PAUSE, PROMPT, CRLF, TPOPEN, TPCLSE, SIGNOF, CLSOUT, SAVREQ,
EXREQ, RUNREQ, SYSMSG, GETDY, GETIM, and RSTART.
A maximum of 3 UDS files may be defined by the user, and unit numbers
1 through 15 may be used. For direct access on a UDS file, the unit
number must be 1 to 4. Save files may be defined on /FILE statements,
in addition to UDS files. The above maximum of 3 UDS files does not
apply to save files.
WATFIV supports several extensions to the FORTRAN language. Examples
of the extensions are character variables, structured programming, and
the ability to enter multiple FORTRAN statements per line. These
extensions should be used with caution, since they will lead to com-
patibility problems should you wish to use other FORTRAN compilers.
The $COPY feature is not available on MUSIC WATFIV, because it per-
forms the same function as the /INCLUDE command. Object decks are
ignored on input. A DO loop index becomes undefined at the end of the
DO loop. On the DATA statement, it is allowed to mix a REAL*4 con-
stant with a REAL*8 variable, and vice versa.
CONTROL STATEMENTS
The WATFIV compiler is invoked by the use of the /LOAD WATFIV deferred
command. This may optionally be followed by a /OPT statement, con-
taining parameters separated by commas (the various parameters are
described below). Data records (if any) to be read on unit 5 follow
the FORTRAN source and are separated from it by a /DATA statement.
The /LOAD statement may be preceded by /SYS and /FILE statements, as
for other MUSIC jobs.
NOTE: Some MUSIC/SP systems may need to use /INC WATFIV instead
of /LOAD WATFIV. If /LOAD WATFIV does not work, try
using /INC WATFIV instead.
A typical job would appear as follows:
/LOAD WATFIV <--- or /INC WATFIV (see the note above)
/OPT option,option,...
...
... (FORTRAN statements)
...
/DATA
...
... (data records for unit 5)
...
The standard WATFIV control statements beginning with $ or C$ can be
used on MUSIC: $WATFIV, C$WATFIV, $OPTIONS, C$OPTIONS, etc. Refer to
the WATFIV User's Guide. The advantage of using C$ instead of $ is
that the statements will appear as comments to other FORTRAN compi-
lers, and so do not have to be removed when changing to another compi-
ler.
Normally there is only one WATFIV job per MUSIC job. However, several
WATFIV jobs can be batched together and run as a single MUSIC job if
desired. To do this, each WATFIV job must start with $WATFIV (or
C$WATFIV), and the $DATA (or C$DATA) statement must not be omitted,
i.e. the same control sequence as described in the WATFIV User's
Guide.
PARAMETERS
+---------------------------------------------------------------------------+
| |
| /OPT NOSOURCE,EBCDIC,NOEXT,WARN ,LIBLIST,INFO, |
| SOURCE BCD EXT NOWARN |
| |
| XREF ,NOSUB,PROFC,S=nnnnn,CCOMP=nnnn |
| XREFP PROFP CCOFF=nnnn |
| PROFA |
| PROF |
| |
+---------------------------------------------------------------------------+
NOSOURCE No listing of the program is to be produced by the compi-
ler. This is the default for jobs run from a terminal.
SOURCE A listing of the program is to be produced by the compiler.
This is the default for jobs run from batch.
EBCDIC (default) The program is in EBCDIC coding (029 keypunch
code) or was typed in from a MUSIC terminal.
BCD The program is in BCD coding (026 keypunch code).
EXT Will allow all language extensions to be used, but will
print a warning message where extensions are used.
NOEXT (default) Suppresses warning messages regarding the use of
extensions.
NOWARN Suppresses the printing of warning messages.
WARN (default) Prints warning messages as well as error mes-
sages.
LIBLIST Source listings of subroutines called from the WATFIV
library will be produced.
INFO Causes information about main storage usage and error
counts to be displayed at the end of the job.
XREF
XREFP Requests a cross-reference of the variable names, subpro-
gram names, and statement numbers used in the program.
XREF gives the output with one item per line. XREFP uses a
packed format, with more than one item per line.
NOSUB Allows a subroutine to access any element of an array argu-
ment, provided the element is within the storage area
reserved for the array in the calling program. The indi-
vidual array dimensions may be exceeded. Without this
option, access is restricted by each array dimension
declared in the subroutine (after the rightmost dimension
of the subroutine array, if 1, has been increased to occupy
as much as possible of the array's storage in the calling
program).
PROFC Turns on the profile count option.
PROFP Turns on the profile histogram percentage option.
PROFA Turns on the profile histogram absolute count option.
PROF Equivalent to specifying all of PROFC, PROFP, PROFA.
The above four options invoke the WATFIV Profiler, which is
a tuning and testing option. It counts the number of times
each statement is executed, and provides frequency histo-
grams (bar graphs) of these counts. In order to start the
profiling function, the statement $PROFON (or C$PROFON)
must be used.
S=nnnnn Causes the program to be terminated after the specified
number of source statements have been executed. This is
useful for detecting program loops.
CCOMP=nnnn
CCOFF=nnnn These conditional compilation options can cause source
lines with "Cn" in columns 1-2 to be treated as Fortran
statements rather than as comments. The string nnnn in the
options is a series of 1 or more decimal digits, each of
which will cause the first 2 columns of the corresponding
"Cn" cards to be blanked out. CCOMP starts this action,
and CCOFF stops it.
The standard WATFIV parameters such as NOCHECK, PAGES=nnn, etc. may
also be used. These are described in the WATFIV User's Guide.
Also, most standard WATFIV options can be specified on $OPTIONS (or
C$OPTIONS) control statements, which may appear anywhere within the
program.
REFERENCES
Cress, P., Dirksen, P., and Graham, J.W., FORTRAN IV with WATFOR and
WATFIV, Englewood Cliffs, New Jersey: Prentice-Hall, Inc., 1970.
WATFIV Implementation and User's Guide. This is provided by the Uni-
versity of Waterloo.
EXAMPLE
/load watfiv
/opt source
1 read(9,*) a
b=sqrt(a)
write(6,*) a,b
go to 1
end
/endrun
*IN PROGRESS
1 1 READ(9,*) A
2 B=SQRT(A)
3 WRITE(6,*) A,B
4 GO TO 1
5 END
COMPILE = 0.15 SU
?
25.
25.00000 5.000000
?
36
36.00000 6.000000
?
-2
***ERROR*** LI-C X .LT. 0. FOR SQRT OR DSQRT OF X
*STOPPED AT LINE 00002 IN ROUTINE MAIN
EXEC = 0.05 SU
-----
Converted Wed Oct 12, 2005 20:39:07 by help2html from Help file $HLP:@GO.WATFIV