Silverfrost Forums

Welcome to our forums

GFortran to FTN95: How does ENUM work?

4 Feb 2015 4:18 #15591

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:

   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:

   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?

4 Feb 2015 4:55 #15592

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.

4 Feb 2015 5:10 #15593

ENUM is available in FTN95 with /f2k on the command line (from v6.2).

I have not tried it with this code.

4 Feb 2015 6:41 #15594

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...

4 Feb 2015 6:57 #15595

FTN95 Express does have an older version of FTN95.

However, if you download and install the Personal edition [u:0c453daa8f]after [/u:0c453daa8f]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.

4 Feb 2015 7:14 #15596

Quoted from PaulLaidler 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?

4 Feb 2015 11:40 #15600

Quoted from davidb FTN95 Express does have an older version of FTN95.

However, if you download and install the Personal edition [u:ce01869632]after [/u:ce01869632]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.

Please login to reply.