View previous topic :: View next topic |
Author |
Message |
DanRRight
Joined: 10 Mar 2008 Posts: 2816 Location: South Pole, Antarctica
|
Posted: Sun Sep 08, 2019 11:53 pm Post subject: Is this extension standard conforming now? |
|
|
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
Code: | Write(11, '(<iii>x, i4)') iii |
was writing iii and 3 spaces before it which is equivalent to
Code: | Write(11, '(3x, i4)') iii |
You can do similar thing today in FTN95 only in 4 lines of text
Code: | character chFormat*16
chformat = '(xxxx, i4)'
write(chformat(2:5), '(i4.4)') = iii
Write(11, chformat) iii |
Hell. |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1886
|
Posted: Mon Sep 09, 2019 1:38 am Post subject: |
|
|
Variable Format Expression, "VFE", please see:
<https://gnu.huihoo.org/gcc/gcc-4.8.5/gfortran/Variable-FORMAT-expressions.html> |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Mon Sep 09, 2019 6:59 am Post subject: |
|
|
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@. |
|
Back to top |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Fri Sep 13, 2019 7:31 pm Post subject: |
|
|
intteresting,
so does that mean that in q winio statement if somewher is specified:
'*'.'*'
it will look for and pick up 2 variables, say i and j, integers and read the format as i.j (with the values )
e.g. if i=3 and j= 9 it could be used to create a real value 3.9 ?
(just a nonsense hypothetical example) _________________ ''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... " |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7924 Location: Salford, UK
|
Posted: Sat Sep 14, 2019 7:41 am Post subject: |
|
|
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. |
|
Back to top |
|
|
|