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 

gFortran and MAKE
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
PaulLaidler
Site Admin


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

PostPosted: Sun May 26, 2019 6:39 am    Post subject: Reply with quote

John

Plato can be set to replace tabs with spaces as you type. There is also a macro to replace all existing tabs with spaces. In both cases you need a manual "Save" afterwards.
Back to top
View user's profile Send private message AIM Address
DanRRight



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

PostPosted: Sun May 26, 2019 11:14 am    Post subject: Reply with quote

I tried /TABS with Gfortran sources in a batch file and it did not perform well in some cases when compiled file also had INCLUDEd files. I used WIDE_SOURCES instead and all was compiled OK. Will make a demo reproducer hopefully quick
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Sun May 26, 2019 1:23 pm    Post subject: Reply with quote

I have had many attempts at correcting TAB characters in Fortran source code I have needed to fix.

My utilities include:
count_char.exe which counts all characters [1:255] that appear in a file
scan_file.exe which lists a text file identifying control characters and provides a character count.

PLATO does a good job of identifying tab characters, especially if "Show whitespace symbols" is enabled, but it does not remove the TAB characters and replace with the correct number of spaces

(my impression of ..) The best advice I can give is don't use tab characters in Fortran code.

Once you change the IDE, the info on tab positioning is lost.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon May 27, 2019 8:10 am    Post subject: Reply with quote

JohnCampbell

/TABS is missing from ftn95.chm and I have corrected this.
Back to top
View user's profile Send private message AIM Address
DanRRight



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

PostPosted: Thu Aug 29, 2019 7:10 am    Post subject: Reply with quote

So where is the good installation files for gfortran?

You get again these

*** Unwritable expresssions in read statement or
*** READ can have a maximum of two non-keyword specifiers

and you are guessing and guessing trying and trying different things to understand what the heck this may mean. Need second opinion from different compiler because that not user-friendly diagnostics got on my nerves. As if it was hard to tell that it is not allowed to over-write the parameter iz or what and where these freaking keywords specifiers are. What, there was competition to write things the shortest and most cryptic way as there are no memory to fit the compiler into 64kB floppy disk?

Code:
parameter (ix=100, iy=100, iz=1000)
Real*8 BEJ (3, ix, iy, iz, 3)
character text32*32

  open(unit=118,file='aaa', STATUS='old')
    read (118,'(a)') text32
    read (text32, '(4x, 3i6)',err=1,end=2) i1, iz, i3
  close (118)

!... Errors
goto 1000
1 print*, 'Error reading'
goto 1000
2 print*, 'End reached'
1000 continue

end



Last edited by DanRRight on Thu Aug 29, 2019 9:38 am; edited 2 times in total
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Thu Aug 29, 2019 7:49 am    Post subject: Reply with quote

Dan,

Not sure what your post is asking, but yes, gFortran does have a better error message in this case:

FTN95 gives:
C:\temp\forum\dan\dan2.F90(8) : error 304 - Non-writable expression in READ statement
C:\temp\forum\dan\dan2.F90(8) : error 52 - Compilation abandoned

gFortran gives:
C:\temp\forum\dan\dan2.f90(8) : error - Named constant 'iz' in variable definition context (item in READ) at column 1
Compilation failed.

iz is a parameter so can't appear in a read statement.

I am in the good position of having FTN95 and gFortran installed and can easily switch between them in PLATO Ver 5, switching via
Tools > Settings > Miscellaneous

Regarding installing gFortran, there are a number of options for downloading, and I have an approach via environment variables to make installs of both gFortran and FTN95 easier to manage. I'm sure I have explained this in previous posts.


Last edited by JohnCampbell on Thu Aug 29, 2019 7:53 am; edited 1 time in total
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Thu Aug 29, 2019 7:53 am    Post subject: Reply with quote

Thanks John. What specifically installation do you have? Please provide the exact link. There are many different options i do not have time to try
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Thu Aug 29, 2019 8:08 am    Post subject: Reply with quote

Dan,

equation.com > Programming tools > Fortran, C, C++
This provides a self extracting file, eg gcc-8.3.0-64.exe
download and then install into : C:\Program Files (x86)\gcc_eq\gcc_8.3.0

Then create the following environment variables, either via a .bat file or via control panel > system
(these work on Win 7)

set f95.ver=8.40F
set _gcc.ver=8.3.0

set _gcc_dir=C:\Program Files (x86)\gcc_eq\gcc_%_gcc.ver%
set gcc_path=%_gcc_dir%\bin;%_gcc_dir%\libexec\gcc\x86_64-w64-mingw32\%_gcc.ver%
set EQ_LIBRARY_PATH=%_gcc_dir%\x86_64-w64-mingw32\lib

set gcc.ver=%_gcc.ver%
set gcc_dir=%_gcc_dir%

set f95_dir=C:\Program Files (x86)\Silverfrost\ftn95_%f95.ver%
set ftn95_path=%f95_dir%
set f95include=%f95_dir%\include
set mod_path=%f95_dir%\include

set Path=C:\ProgramData\Oracle\Java\javapath;%gcc_path%;%ftn95_path%;%orig_path%;c:\utils

Note:
1) set orig_path= " this is the original path prior to installing gFortran or FTN95, but excluding some unnecessary rubbish. your call !
I create orig_path in Control Panel > System > Advanced system settings > Environment Variables > System Variables > New... by cutting and pasting of Path value.
2) all other variables can be created similarly. I have chosen names as their sorted order is important. MS Win 7 does not do multiple pass definition !!
3) changing installed versions is merely changing the value of f95.ver and _gcc.ver to the appropriate value.
4) c:\utils contains most of my own programs to help with programming.

5) equation.com version of gFortran is different to mingw-w64 version (used for clearwin64 ?) in that it is a static build that does not use .dll's. I find this satisfactory.
If you need to use clearwin64, ie gFortran + clearwin+ graphics, that requires .dll's, you may need to install mingw-w64 version. Downloading is a bit more complex, to choose the options you require. I have both but would need to review my last install ( forgotten the options !! )
6) Typically FTN95 is my preferred software development and when combined with /IMPLICIT_NONE is my most reliable approach.

DanRRight wrote:
There are many different options i do not have time to try
I assume this refers to mingw-w64 version. Let me know if this version is required.

I hope this helps

John
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Thu Aug 29, 2019 12:04 pm    Post subject: Reply with quote

OMG...i need to chose among something again.

Question to SF: is it true Clearwin+ does not work with Equation dot com version ?

Meantime here is another code demonstrating unclear, cryptic, elitist or wrong diagnostics of FTN95 input/output. User-made error of not setting "filename" as character variable is identified wrong way or hell knows what the message says. FTN95 is very good at fining errors. But what it burbs in its South / Texas accent often simply impossible to decipher

Code:
  filename = 'zzzOut.data'
  open(unit=19,file=filename, STATUS='unknown', err=950)
  close (19)
  goto 1000
!......... errors
950 print*,' Error opening file'

1000 continue
end 


The error message says

0002) open(unit=19,file=filename, STATUS='unknown', err=950)
*** Scalar, default-kind, CHARACTER expression expected for the FILE keyword
1 ERROR [<main program> FTN95 v8.51.0]
*** Compilation failed
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1885

PostPosted: Thu Aug 29, 2019 12:43 pm    Post subject: Reply with quote

In this case, I think that the compiler did a fine job. It gave you the line number, and even the clause of the statement on that line that it found to be incorrect.

We could have expected the compiler to complain about the preceding line first, since that line (Line-1) is also in error, since a character expression is being assigned to a real (by implicit naming rules F... is real) variable. Indeed, you may try commenting out the second line of the source code and running the compiler on it again.

I have a suggestion for you. You can get the FTN95 compiler to give you error numbers by using the option /ERR . You can then prepare a text file, say, errlist.txt, with error messages worded as you please, in a language of your choice (North Texan, South Polar, etc.), indexed by the error number. If you type the Windows command

findstr <nnnn> errlist.txt

where nnnn is the error number given by the compiler, you can see your wording of the corresponding message.
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Thu Aug 29, 2019 7:52 pm    Post subject: Reply with quote

hahaha Really drunk logic from both of you, FTN95 + mecesj4. Even not two bugs are here but three: not only FTN95 missed the bug on first line, or reported crazy message on second, it mixed out the order by reporting second line error which was caused by error in the first line.

I'd change each and every error messages if was not translating every english word.
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Fri Aug 30, 2019 5:35 am    Post subject: Reply with quote

Line 1 is not an errror, but could be compatibility with ftn 4 storing characters in a real variable.
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Fri Aug 30, 2019 6:56 am    Post subject: Reply with quote

John, looks like not super-duper compatibility too Smile. The filename is 4 bytes, 'zzzOut.data' is 3 times more.

Last edited by DanRRight on Fri Aug 30, 2019 7:32 am; edited 1 time in total
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1885

PostPosted: Fri Aug 30, 2019 7:30 am    Post subject: Re: Reply with quote

JohnCampbell wrote:
Line 1 is not an errror, but could be compatibility with ftn 4 storing characters in a real variable.


It is an error in Fortran 77 and 95 (and later versions). Quote from 7.5.1.2 of Fortran 95 Standard:

A character intrinsic assignment statement is an intrinsic assignment statement for which variable and expr are of type character and have the same kind type parameter.

See also Table 7.9 of Fortran 95 for type compatibility in <variable> = <expression>


Last edited by mecej4 on Fri Aug 30, 2019 11:28 am; edited 1 time in total
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1885

PostPosted: Fri Aug 30, 2019 7:31 am    Post subject: Re: Reply with quote

--DUPLICATE POST, Please Delete---

Last edited by mecej4 on Sat Aug 31, 2019 9:34 am; edited 1 time in total
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, 3  Next
Page 2 of 3

 
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