Add 'Q' to the standard 
Author Message
 Add 'Q' to the standard

Is it only me, or is it a real pity that the Q format edit descriptor is
not included in standard fortran90/95? (For those who are not familiar
with the Q format, it returns the number of characters left to read on
the current line.)

With the Q format it is possible to write routines for quite advanced
interpretation of input files, e.g. to read the headers of a matrix
input file. The headers can be separated by any delimiter (comma, tab,or
any other character or combination of characters (html code...))

I know there is a site out there where one may suggest additions to the
standard, but I don't seem to find it. Anyone has a clue?

M. Alveteg

PS
The core of my small getheaders routine is:

101   format (Q,1024a1) ! maxlength
      read(unitnumber,101,end=900) maxpos,(a(pos),pos=startpos,
     &  min(maxlength,maxpos-startpos+1))

then I just go through the characters one by one and identify the
delimiter. I also once wrote a routine for fetching the apparent format
in which the file was written (g15.3,a1,f8.3,etc.). It only works in F77
and not  with tab-separated files in the *current* release of Absoft Pro
Fortran (at least not for Mac, I haven't tested their Windows version)
although it will in the next release.

While I'm at it, I must say that the $ (dollar) or / format edit
descriptor also can be quite useful.
DS



Wed, 18 Jun 1902 08:00:00 GMT  
 Add 'Q' to the standard


Quote:
>Is it only me, or is it a real pity that the Q format edit descriptor is
>not included in standard FORTRAN90/95? (For those who are not familiar
>with the Q format, it returns the number of characters left to read on
>the current line.)

The Q format was invented by Digital for PDP-11 FORTRAN-IV-PLUS in the
1970s.  It is not a part of the standard.  Sometimes you can use
non-advancing I/O, which is standard in F90, for places where you
might have used Q, but it's more complicated if all you want is the
length of the line just read.

Q format is supported by all DIGITAL/Compaq Fortran compilers.

--

Fortran Engineering
Compaq Computer Corporation, Nashua NH

Compaq Fortran web site: http://www.compaq.com/fortran



Wed, 18 Jun 1902 08:00:00 GMT  
 Add 'Q' to the standard


Quote:
> Is it only me, or is it a real pity that the Q format edit descriptor is
> not included in standard FORTRAN90/95? (For those who are not familiar
> with the Q format, it returns the number of characters left to read on
> the current line.)

The implementations that use Q for other purposes (e.g., as the
quad-precision variant on E and D) might be less enthusiastic.

Although not entirely equivalent, it has been my experience that most uses
of this version of Q can be converted to using non-advancing input as an
alternative.  In many cases, this actually comes out cleaner because you
deal with the values you find on the line rather than the number of
characters used to represent those values.

Quote:
> While I'm at it, I must say that the $ (dollar) or / format edit
> descriptor also can be quite useful.

/ _is_ standard.
$ can generally be replaced by non-advancing output.

        -Kurt
--

Center for Computational Sciences



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Qs re 'Write & 'Read

2. TIP #39: Add New Standard Tk Option: -component

3. Newbie Qs: startup time, Module.constants, chdir, Ruby distro's library

4. Extending standard 'names'?

5. Adding 'Applescriptability' to a RB application

6. (eq 'standard-library 'in-the-language)

7. EXIT PROGRAM ('74 vs '85 Standard)

8. Ada '87 and '95 standards.

9. adding program to windows 'programs' menu

10. TIP #210: Add 'tempname' to file

11. TIP #208: Add a 'chan' Command

12. 'logger' package added to tcllib CVS

 

 
Powered by phpBB® Forum Software