For Programmers: Free Programming Magazines  


Home > Archive > Fortran > February 2008 > Re: Variable Format Expressions (VFEs) (Was: Difference between









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Variable Format Expressions (VFEs) (Was: Difference between
glen herrmannsfeldt

2008-02-14, 7:14 pm

Craig Dedo wrote:
(snip)

> I have never understood what the problems and limitations are or
> could be. Variable Format Expressions (VFE) have been an extension in
> many Fortran compilers for over two decades. AFAIK, they are always
> implemented with the same capabilities and limitations. Thus, it
> appears that the technology for implementing them is well known and well
> understood. If there are substantial problems and limitations, please
> explain what they are.


To me, the biggest reason not to implement VFE is that they don't
provide any ability that isn't there with character string format
and internal I/O.

Note that the VFE extension was before internal I/O was added to
the standard, though many compilers that had it also provided an
internal I/O extension.

Some might say they are more readable, and sometimes that is reason
enough to add a feature to the standard. In this case, I don't
believe it is.

For comparison purposes (PL/I-phobics stop reading), PL/I only
supplies VFE. There is no feature like the Fortran character variable
format, though there are some that are not available in Fortran VFE.

For EDIT directed I/O, the format data goes on the same statement:

PUT EDIT(X,Y,Z)(F(3,1),X(3),E(10,3),X(3),F(3
,1));

PL/I provides FORMAT statements and the R (remote) descriptor:

PUT EDIT(X,Y,Z)(R(FMT));
FMT:FORMAT(F(3,1),X(3),E(10,3),X(3),F(3,
1));

Variables are allowed in all format descriptors, including
statement label variables in R descriptors.

PUT EDIT(X,Y,Z)(F(I,J),X(K),E(L,M),X(K),F(I,
J));


DCL VFMT LABEL;
VFMT=FMT1;
IF X>3 THEN VFMT=FMT2;

PUT EDIT(X,Y,Z)(R(VFMT));
FMT1:FORMAT((3)F(4,1));
FMT2:FORMAT((3)E(10,1));

with VFEs and the use of variable R (remote) format descriptors one
should be able to do fairly complicated formatting, though not one that
I have sometimes (rarely) used in Fortran: reading in the format string
from an input file.

-- glen

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com