





![[BIG]](../icons/zoom18.gif)
![[Normal]](../icons/zoom14.gif)
![[small]](../icons/zoom10.gif)
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(
This type of read is obtained by replacing the format by a star, as in:
READ (UNIT,*) ...)
:
it corresponds to a string of constants separated by one or several blanks.
Each constant must be wholly contained within a record and is situated between columns
1 and 72 inclusively. In addition, the MODULEF free format offers a large number of supplementary
possibilities:
- insert comments in the data,
- replace a data item by an arithmetic expression,
- use variables,
- call commands.
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:
- an integer:
-
36 -123
- a single precision real:
-
12 12. 12.0 0.012E3
- a double precision real:
-
12 12. 12.0 0.012D3
- a complex:
-
A complex number is read like two consecutive single precision real numbers.
For example, the complex number 3.5 + 7.9 i is obtained by reading the
two real numbers:
3.5 7.9
- a logical:
-
TRUE T YES Y
FALSE F NO N
It is possible to add a point at the beginning or at the end:
.TRUE. .T FALSE.
- a character string:
-
One of the formats of a character string is the same as in Fortran:
the string is delimited by apostrophes;
any apostrophe contained within the string is represented by two consecutive
apostrophes:
'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:
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:
- !
- is an exclamation mark,
preceding most commands
(section 1.1.5).
- <variable>
- is the variable name. It may contain
letters, numbers, underscore characters
(_) and points (.), but may not start with a number.
It is truncated to 12 characters if it exceeds this length.
It may not be a predefined name:
function name
(section 1.1.3),
constant name (section 1.1.3), or command
name (section 1.1.5).
Lastly, if the host computer employs upper- and lower-case letters, they are
differentiated.
- =
- is the assignment symbol.
- <expression>
- is an expression
(section 1.1.3).
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.
- !ADRESSAGE
-
prints a message each time a dynamic array is allocated.
!NOADRESSAGE suppresses this effect.
- !BAVARDAGE <expression>
-
modifies the MODULEF print parameter (from 0 to 10: the higher this value, the more output obtained).
- !DEBUGING,
- (normally not used!)
- !DUMP
- prints the name and value of each variable.
- !ECHO
- prints each line read.
!NOECHO suppresses this effect.
- !ECRIRE <file>
-
(or !IMPRIMANTE <file>) writes all output to a file.
If <file> is the character *,
the write is directed to the initial printer.
If <file> is the name of a file which exists already, it will be deleted.
- !IDEM
-
do not modify the value of the variable to read.
If the calling program has previously assigned a value by default, this value will be conserved.
- !IMPRIMANTE <file>
-
: see !ECRIRE.
- !LIRE <file>
- reads input from a file.
If <file> is the character *,
the read is done from the initial input device.
A read file can itself contain
!LIRE commands. The command
!RETOUR or an end-of-file returns to the previous file.
- !NOADRESSAGE
-
: see !ADRESSAGE.
- !NOECHO
-
: see !ECHO.
- !NOSOUFFLEUR
-
: see !SOUFFLEUR.
- !NOTRACE
-
: see !TRACE.
- !RETOUR
-
: see !LIRE.
- !SOUFFLEUR
- print, before each read, the type of data requested.
!NOSOUFFLEUR suppress this effect.
- !TERMINAL <expression>
-
change the type of MODULEF terminal
(hardly ever used):
0 batch,
1 alphanumerics terminal,
2 graphics terminal.
- !TRACE <file>
-
recopy onto file all that is typed on the initial input device.
!NOTRACE suppress this effect.
- !TRACEBACK
- print the name of every file open
(in free format or other).
- !<variable>=<expression>
-
evaluate an expression and assign the result to a variable
(section 1.1.4).
- !<variable>=?
-
request the value of a variable from the user.
- !!<system command>
-
initiate a host system command.
If the command contains one or several blanks, it must be delimited by apostrophes.
For example, in Unix,
!!ls or !!'ls -lg' prints the contents of a directory.
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
-
:
!ADRESSAGE ;
n = 0
!NOADRESSAGE.
- %BAVARDAGE n
-
!BAVARDAGE n.
- %ECHO n
-
: n = 1
!ECHO ;
n = 0
!NOECHO.
- %IMPRIMANTE n
-
:
!ECRIRE <file>,
where <file> is the name of the file with logical number n ;
n < 0
!ECRIRE *.
- %LECTEUR n
-
!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.
- %OUVRIR n
-
!LIRE <file>, where <file>
is the name of the file with logical number n.
- %RETOUR
-
!RETOUR.
- %SAUVER n
-
!TRACE <file>, where <file>
is the name of the file with logical number n.
- %SOUFFLEUR n
-
: n = 1
!SOUFFLEUR ;
n = 0
!NOSOUFFLEUR.
- %TERMINAL n
-
!TERMINAL n.
- %?
-
: outputs the type of data requested
(see also %SOUFFLEUR).






![[BIG]](../icons/zoom18.gif)
![[Normal]](../icons/zoom14.gif)
![[small]](../icons/zoom10.gif)
Next: 1.2 Programming
Up: 1 Free format
Prev: 1 Free format
Index
Contents