![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
Next: 1.2 Programming
Up: 1 Free format
Prev: 1 Free format
Index
Contents
In the simplest case, the data format is analogous to that of
a "list directed read" in Fortran 77(
READ (UNIT,*) ...)
This type of read is obtained by replacing the format by a star, as in:
The following sections describes the above notions.
The format of the constants are very similar to that of Fortran. Consequently, only a few examples are given below. Depending on the case, the user must enter:
It is possible to add a point at the beginning or at the end:
.TRUE. .T FALSE.
'EXAMPLE OF A STRING' 'IT''S EASY'
The other form corresponds to not delimiting the string by apostrophes, on
condition that the string does not contain any
(blanc),
',
$,
-- or
// characters,
and does not start by a
! or
% character:
EXAMPLE3
Comments are ignored by the program, however, they promote understanding by the human reader. In its most usual form, a comment begins with two consecutive dashes and ends with an end-of-line:
3 -- NUMBER OF CURVED LINES
0.5 -- RADIUS OF THE CIRCLE
The other format is older but remains compatible with the previous one. It is less accommodating, especially when commenting a line already containing comments. In this format, each comment is delimited on the left by a dollar character ($) and on the right by a dollar character or an end-of-line:
1 2 3 $FIRST COMMENT$ 4 5 6 $SECOND COMMENT$ 7
1 2 3 4 5 6 7 $COMMENT AT THE END OF A LINE
Instead of the classical constant (section 1.1.1), the user can input a numerical or character expression:
.
No matter what the the type of operand is, the computation is done using
double precision (for example,
is evaluated as
, and
the result, 0.5D0, is converted to the variable type.
Blanks and "carriage-returns" are forbidden, except in expression between parentheses.
For example:
3.85*1.42 ( 1 / 3 ) SQRT(3)/2 PI/2
-- THE 4 VALUES READ ARE : 5.46700 0.333333 0.866025 1.57080
A//B'DAY '//
'AND NIGHT'
-- THE 2 STRINGS READ ARE : 'AB' 'DAY AND NIGHT'
It is possible to assign a value to a variable and then to use the same variable in an expression.
The syntax is as follows:
!<variable>=<expression>
where:
All variables are converted to double precision.
Some commands are directly linked to using variables, namely !DUMP and <variable>=? (section 1.1.5). For example:
!R=1
!ALPHA=PI/3
R*COS(ALPHA)
-- THE VALUE READ IS : 0.5
Before entering the data, we can initiate a command. Most commands begin with an exclamation mark (!). Certain older commands, beginning with a percentage character (%), have been conserved for compatibility.
!NOADRESSAGE suppresses this effect.
!NOECHO suppresses this effect.
!NOSOUFFLEUR suppress this effect.
!NOTRACE suppress this effect.
The old commands, starting with the character, %, have been conserved so that all the
existing data sets remains usable. In fact, it suffices to type only the
beginning of these commands, until there are a sufficient amount of characters
to avoid any ambiguity
(for example: %R). In the listing below, the arrow (
) indicates the name of the new equivalent command, if it
exists.
!ADRESSAGE ;
n = 0
!NOADRESSAGE.
!BAVARDAGE n.
!ECHO ;
n = 0
!NOECHO.
!ECRIRE <file>,
where <file> is the name of the file with logical number n ;
n < 0
!ECRIRE *.
!LIRE <file>, where <file>
is the name of the file with logical number n.
In all cases,
%LECTEUR is usable with a file which is already open
(and reads therefore at the end of the last data read),
whereas !LIRE is not.
!LIRE <file>, where <file>
is the name of the file with logical number n.
!RETOUR.
!TRACE <file>, where <file>
is the name of the file with logical number n.
!SOUFFLEUR ;
n = 0
!NOSOUFFLEUR.
!TERMINAL n.