Ratmac is the distribution language of the Xtal System because it provides for
better portability and efficiency than Fortran77. The structured facilities in
ratmac, and the provision for defining macro instructions, can also lead to
improved algorithmic approaches to many calculations. It is in most respects a
structured 'Fortran-like' language with some obvious similarities to the Unix
language C. Indeed, much of the code in a ratmac program is identical to
Fortran. To a programmer this can be both a source of comfort and a cause of
some difficulty, the latter because some Fortran practices are discouraged in
Xtal programs. Here are the restrictions placed on Fortran77 code as used in an
Xtal ratmac program.
Xtal restrictions on Fortran77
-
Active code may only appear in columns 1 to 71. Columns 73 to 80 are
reserved for line identifiers. A sharp character (#) must follow the last
column containing active code.
-
Logical expressions involving floating-point numbers should not use
relational operators involving 'equals' (i.e. ==, <=, >=, != ). This is
because of the inherent problems of rounding-off and exact representations in
floating-point numbers. Use the macros ifeq: and ifne: to test for equality or
inequality.
-
PAUSE and STOP should not be used except by nucleus routines.
-
In the distributed versions of Xtal, the line I/O instructions, READ,
WRITE, PRINT, and PUNCH must not be used, except in macro definitions.
-
In the distributed version of Xtal, the file control instructions,
REWIND, BACKSPACE, ENDFILE, etc., must not be used, except in macro
definitions.
-
Line output carriage-control characters must not be used.
-
The use of multi-dimensioned array variables should be kept to a minimum.
The contiguous single-dimensioned data array, QX(), should be used for all
major storage of data. This includes binary I/O buffers.
-
Dimension statements containing adjustable subscripts must not be
used.
-
Explicit type-definition statements INTEGER and REAL should be used
rather than DIMENSION statements.
-
Data definitions should be made using the macro statements chardata:,
realdata:, dbledata:. and intdata:. Note that these macros specify both the
type and data content of a variable. They must always be followed by a single
datastuff: macro.
-
Statement and inline functions should not be used.
-
Blank common should not be used. Labelled commons may be used in the way
described in the following chapters.
-
Double precision, if used, should be placed in macro definitions because
of the wide range of word sizes. A 32-bit machine may need double precision,
but a 64 bit word machine will not. See the program ABSORB for an example of
this.
|