View previous topic :: View next topic |
Author |
Message |
mgup
Joined: 04 Feb 2015 Posts: 3
|
Posted: Wed Feb 04, 2015 5:18 pm Post subject: GFortran to FTN95: How does ENUM work? |
|
|
I have a project of roughly 38k lines of Fortran that currently builds as a Win32 dll in GFortran. I am working on getting it to build in FTN95, and I don't really know much about Fortran.
The main problem I'm having right now that I haven't had much luck in finding a solution for is these enums, coded like this:
Code: |
ENUM, BIND(C)
ENUMERATOR :: SeaSI = 1
ENUMERATOR :: SeaField = 2
ENUMERATOR :: SeaSeapp = 3
ENUMERATOR :: SeaYaws = 4
ENUMERATOR :: SeaDippr = 5
ENUMERATOR :: SeaBritish = 6
ENUMERATOR :: SeaPureSI = 7
ENUMERATOR :: SeaHysys = 8
END ENUM
|
It builds as-is in GFortran, but building in FTN95 gives me an error message on the first line, saying "The '::' separator is missing".
I tried looking up Fortran syntax, and found this, which seems to suggest that the first line should be followed by a :: type_alias_name. I tried changing it to:
Code: |
ENUM, BIND(C) :: SEATYPE
|
And FTN95 says Syntax Error on that line. I tried a few other variations of the same idea, and keep getting Syntax Errors. I haven't been able to find any documentation on what FTN95 expects Enums to look like, so I'm not really sure what to do now. Can anyone point me in the right direction for getting FTN95 to accept these enums? |
|
Back to top |
|
 |
mecej4
Joined: 31 Oct 2006 Posts: 1899
|
Posted: Wed Feb 04, 2015 5:55 pm Post subject: |
|
|
Enumerators are not part of Fortran-95, and were introduced in Fortran-2003. Silverfrost FTN95 is a Fortran-95 compiler with some features from Fortran-2003 added. Enumerators are not one of those, so you have to use another compiler or replace enumerators with another constructs. |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Wed Feb 04, 2015 6:10 pm Post subject: |
|
|
ENUM is available in FTN95 with /f2k on the command line (from v6.2).
I have not tried it with this code. |
|
Back to top |
|
 |
mgup
Joined: 04 Feb 2015 Posts: 3
|
Posted: Wed Feb 04, 2015 7:41 pm Post subject: |
|
|
I had been trying to build it in FTN95 Express, which seems to have an older version of FTN95. I downloaded the Personal edition, and tried loading the project in Plato, and it seems to like the Enums properly now. Of course, there's a pile of other errors to figure out... |
|
Back to top |
|
 |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Wed Feb 04, 2015 7:57 pm Post subject: |
|
|
FTN95 Express does have an older version of FTN95.
However, if you download and install the Personal edition after you have installed FTN95 Express (which you have done), this will update FTN95, and you can use the up-to-date FTN95 either using Plato or the Visual Studio shell.
Well this is my recollection. Its been a while since I used the express version as I prefer Plato and the command line. _________________ Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl |
|
Back to top |
|
 |
mecej4
Joined: 31 Oct 2006 Posts: 1899
|
Posted: Wed Feb 04, 2015 8:14 pm Post subject: Re: |
|
|
PaulLaidler wrote: | ENUM is available in FTN95 with /f2k on the command line (from v6.2).
| That's good to know! I checked only in the FTN95 7.10 help file, and found no mention of enumerators other than in a .NET context. Perhaps the documentation is a tad older than the compiler? |
|
Back to top |
|
 |
mgup
Joined: 04 Feb 2015 Posts: 3
|
Posted: Thu Feb 05, 2015 12:40 am Post subject: Re: |
|
|
davidb wrote: | FTN95 Express does have an older version of FTN95.
However, if you download and install the Personal edition after you have installed FTN95 Express (which you have done), this will update FTN95, and you can use the up-to-date FTN95 either using Plato or the Visual Studio shell.
Well this is my recollection. Its been a while since I used the express version as I prefer Plato and the command line. |
I did that, and it didn't update FTN95 Express for me automatically. However, FTN95 Express did use the new version after I copied all of the files from the FTN95 folder into the FTN95 Express folder. |
|
Back to top |
|
 |
|