Silverfrost Forums

Welcome to our forums

Is this extension standard conforming now?

8 Sep 2019 10:53 #24324

DEC had very convenient format specifier <n> where n defined number of spaces for example. Possibly also number of digits in mantissa etc like instead of fixed e10.4 you write e<i1>.<j1>, which is equivalent to it if i=10, j=4, but i do not remember this for sure already. Very convenient. For example with iii=3 this

Write(11, '(<iii>x, i4)') iii

was writing iii and 3 spaces before it which is equivalent to

Write(11, '(3x, i4)') iii

You can do similar thing today in FTN95 only in 4 lines of text

character chFormat*16
chformat = '(xxxx, i4)'
write(chformat(2:5), '(i4.4)') = iii
Write(11, chformat) iii

Hell.

9 Sep 2019 12:38 #24325

Variable Format Expression, 'VFE', please see:

https://gnu.huihoo.org/gcc/gcc-4.8.5/gfortran/Variable-FORMAT-expressions.html

9 Sep 2019 5:59 #24326

FTN95 does not have this extension but there is something like it in ClearWin+ winio@. The standard C function printf uses a '*' and picks up the field width from the argument list. This feature is mirrored in winio@.

14 Sep 2019 6:41 #24355

Here is a quote from the manual...

Each format code begins with the percent (%) character, followed by optional size information of the form n or n.m where n and m are integer constants (e.g. %6.4wd). n and/or m can be replaced by an asterisk '*' with the corresponding value(s) being supplied as one or two INTEGER arguments in the argument list. After the optional size information, a two-letter code is used to define the format. This two letter code is not case sensitive. Some format codes have mandatory size information. These sizes are represented by uppercase N and M in the text.

Please login to reply.