forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Spaces and 72-character limit
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2551
Location: Sydney

PostPosted: Fri Feb 09, 2018 12:28 pm    Post subject: Reply with quote

I think a good approach for /tab would be to do as gFortran has done and replicate the Intel "Tab-Format Lines" approach.

What is also necessary is that FTN95 and PLATO have the same interpretation of equivalent spaces for <HT>. With this approach, this post would not be necessary as the position of column 73 would be clearly displayed.

Perhaps a better warning of the line format, such as containing <HT> or lines that don't end in <CR><LF>.

The list could continue ...
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7912
Location: Salford, UK

PostPosted: Fri Feb 09, 2018 12:43 pm    Post subject: Reply with quote

John

I am not familiar with "Tab-Format Lines" and what does <HT> mean?

The extension to configurable tab size was easy to implement but I am not contemplating anything further. Presumably it only relates to fixed format which means legacy code.
Back to top
View user's profile Send private message AIM Address
mecej4



Joined: 31 Oct 2006
Posts: 1884

PostPosted: Fri Feb 09, 2018 2:16 pm    Post subject: Re: Reply with quote

PaulLaidler wrote:

I am not familiar with "Tab-Format Lines" and what does <HT> mean?

<HT> is simply a mnemonic for char(9), "horizontal tab", '\t' in C.
Tab (ASCII 09, ctrl+I) characters in source and data have always caused trouble. I get rid of tabs from source files before compiling and from data files before reading them in a program.

The much less used vertical tab (except on line printers) <VT>, '\v' in C, is similar, but is rarely at issue. Likewise for the form feed character.

Here are two places where the widely used conventions for tabs are described:

https://software.intel.com/en-us/node/692006

https://docs.oracle.com/cd/E19957-01/805-4941/z40000a545d9/index.html

There are utilities for converting files with tabs:

http://fortranwiki.org/fortran/show/notab

http://fortranwiki.org/fortran/show/expand
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7912
Location: Salford, UK

PostPosted: Fri Feb 09, 2018 3:14 pm    Post subject: Reply with quote

Thanks for this.
Back to top
View user's profile Send private message AIM Address
jalih



Joined: 30 Jul 2012
Posts: 196

PostPosted: Fri Feb 09, 2018 3:15 pm    Post subject: Re: Reply with quote

JohnCampbell wrote:

I looked in the Intel documentation and it provides a "Tab-Format Lines", which basically tabs to column 7. There are special cases for continuation, comments and statement numbers.
For tabs past column 7, it treats the tab character in a statement field the same way it treats a blank character. (assuming single blank for column 72 problem ?)
This could be confusing, as most IDE's will replace with multiple spaces.

Look at the following link for more details.
https://software.intel.com/en-us/fortran-compiler-18.0-developer-guide-and-reference-fixed-and-tab-source-forms


It also notes:

NOTE
If you use the sequence number field, do not use tabs anywhere in the source line, or the compiler may interpret the sequence numbers as part of the statement field in your program.


I would use ISPF-style editor, like SPFLite on Windows to work with fixed format source files. You can set tabs and column markers and just type away, plus there are a lot of commands to help work with fixed format source files.

For an example, you could type command: EX ALL; SHOW P'=' 73 80 ALL

It would show all the lines using sequence number field and hide the rest.
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Sun Apr 15, 2018 1:42 pm    Post subject: Re: Reply with quote

PaulLaidler wrote:
I think that gFortran treats tabs as 6 spaces. FTN95 has 8 spaces.
It looks like it would be a relatively simple job to add a new FTN95 option /TAB 6 etc. in order to change from 8 to 6. Let me know if this would make it significantly easier. However, editors like Plato often have an automatic way to translate tabs into spaces.


Paul, Was this feature implemented in last release?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7912
Location: Salford, UK

PostPosted: Mon Apr 16, 2018 1:01 pm    Post subject: Reply with quote

Yes. See my post on 9 Feb 2018.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Tue Apr 17, 2018 6:02 am    Post subject: Reply with quote

Paul, How it works?

Here is the file with fixed form Fortran text which uses more or less standard 8 space long TAB for the left margins of all lines. The line with continuation is intentionally made 73 characters long.
Code:
   parameter (N=5)
   real*8 X(N), Y(N)
   Data X/1e1, 1e2, 1e3, 1e4, 1e5/
   Data Y/2.2, 66, 8333, 1111, 777/

   i=winio@('%ww%pv%pl[framed,x_array,scale=log_log,N_GRAPHS=1]',
     * 625,500,N,X,Y)

   end


Compiling file called aaa.for with

>ftn95 aaa.for /link /wide_source

works OK. Shortening the long line to 72 characters of course works too even without /wide_source. But compilation

>ftn95 aaa.for /link /tabs 6

or any other tab value does not work.

(By the way the plot displays X axis correctly while Y axis incorrectly. But if resize it with the mouse little bit the X axis becomes wrong while Y is displayed correctly. Do everyone see the same behavior or this is just me?)


Last edited by DanRRight on Tue Apr 17, 2018 1:28 pm; edited 1 time in total
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7912
Location: Salford, UK

PostPosted: Tue Apr 17, 2018 7:30 am    Post subject: Reply with quote

Dan

Where are the tabs? When I copy your program I get 3 spaces at the start of each line apart from the continuation that has 5 spaces. Also, are there any tabs within the text?
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Tue Apr 17, 2018 8:39 am    Post subject: Reply with quote

Unfortunately forums removes tabs substituting them with 3 spaces. Here i marked all tabs used with the keyword <...>. Forum might also removed the spaces i added to make the long line to be 73 character long
Code:

<...>parameter (N=5)
<...>real*8 X(N), Y(N)
<...>Data X/1e1, 1e2, 1e3, 1e4, 1e5/
<...>Data Y/2.2, 66, 8333, 1111, 777/

<...>i=winio@('%ww%pv%pl[framed,x_array,scale=log_log,N_GRAPHS=1]',
     * 625,500,N,X,Y)

<...>end


Last edited by DanRRight on Tue Apr 17, 2018 1:29 pm; edited 2 times in total
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7912
Location: Salford, UK

PostPosted: Tue Apr 17, 2018 12:53 pm    Post subject: Reply with quote

Yes this was not working correctly and has now been fixed for the next release of FTN95.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Tue Apr 17, 2018 3:55 pm    Post subject: Reply with quote

Thanks, Paul
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group