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 

How program knows that it is 64bit or 32bit?
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit
View previous topic :: View next topic  
Author Message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Thu May 23, 2019 1:10 pm    Post subject: Reply with quote

mecej4,

I have been requesting for a few of these new system routines for a while, see:
http://forums.silverfrost.com/viewtopic.php?t=2176&postdays=0&postorder=asc&start=120

A few more requesting some of these utility routines may help identify those that are more useful.

Support for a FTN95 version of the module ISO_FORTRAN_ENV could also be helpful, which would provide some guidance for making code more portable.

The idea of more flexibility on KIND values could also help. More consensus on this idea could lead to a better approach.

John
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu May 23, 2019 3:44 pm    Post subject: Reply with quote

It turns out that the version number is intended to be provided via _SAL_VER but this seems to have been forgotten and not updated from 450 which presumably refers to FTN95 v4.50.

We can add a new macro (say _FTN95_VER) and aim to keep it up to date.

I have made a note of the request for COMPILE_VERSION() etc.
Back to top
View user's profile Send private message AIM Address
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Fri May 24, 2019 8:03 am    Post subject: Reply with quote

I have my own solution for compiler_version , which is:
Code:
   subroutine get_compiler_version ( version )
      character version*(*)
      character ftn95_ver*80
!
      include <ftn95_ver.ins>
      version = ftn95_ver
   end subroutine get_compiler_version


The include file in C:\Program Files (x86)\Silverfrost\ftn95\include looks like
Code:
      ftn95_ver = '[FTN95/x64 Ver. 8.40.0 Nov18 Copyright (c) Silverfrost Ltd 1993-2018]'


It would be good if a similar (or different) approach could be applied to salflibc.dll or where suitable.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri May 24, 2019 8:43 am    Post subject: Reply with quote

For future releases of FTN95, _SAL_VER will be kept up to date and _FTN95_VER will be provided as an alternative.
Back to top
View user's profile Send private message AIM Address
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 279

PostPosted: Fri May 24, 2019 11:05 am    Post subject: Reply with quote

Thanks Paul, John and mecej4 for your information/discussion (@Paul ... and for providing the symbols Smile

John, did you create include file ftn95_ver.ins? I could not find it in my SALFORD installations.

Regards,
Dietmar
Back to top
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2554
Location: Sydney

PostPosted: Fri May 24, 2019 11:14 am    Post subject: Reply with quote

Dietmar,

Yes, for each new version I create the file, by running ftn95 > zz, editing zz then copying into ...ftn95..\include\ftn95_ver.ins

With difficulty, as you need to copy as administrator. C:\Program Files (x86)\Silverfrost\ftn95\include is now too protected.
Back to top
View user's profile Send private message
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 279

PostPosted: Thu Jan 09, 2020 8:16 pm    Post subject: Reply with quote

Now, with fnt95 version 8.60.0 preprocessor macros _SAL_VER and _FTN95_VER are available. I would like to use _FTN95_VER, however, I do not know the value it is defined to.

Following code works and activates the code between #IF and #ELSE:
Code:

#IF _FTN95_VER
      ctmp='_FTN95_VER  defined'
#ELSE
      ctmp='_FTN95_VER  not defined'
#ENDIF

This may be checked e.g. using sdbg64 or via creating the corresponding *.lis file.

However, I do not know how to activate code which applies only for ftn95 version 8.60.0. I would expect something like
Code:

#IF _FTN95_VER == 8.60.0
      ctmp='_FTN95_VER  defined'
#ELSE
      ctmp='_FTN95_VER  not defined'
#ENDIF

but when compiling this code (using ftn95 options /64 and /cfpp) the following error messages occur:
Code:

#IF _FTN95_VER == 8.60.0
*** Invalid character '' found in expression

    1 ERROR [test_graphics_window0.for] - Compilation failed.

. I suspect the right hand side of the #IF statement above expects an integer value. For code sequence
Code:

#IF _FTN95_VER == 8
      ctmp='_FTN95_VER  defined'
#ELSE
      ctmp='_FTN95_VER  not defined'
#ENDIF

works and activates the code between the #ELSE and the #ENDIF.

Now I wonder which right hand side I would have to specify in order to activate the code bewtween #IF and #ELSE for version 8.60.0 of ftn95 only.

I know I could bypass this problem by defining a preprocessor symbol via ftn95 option /define in the ftn95 call, however, the reason for introducing symbol _FTN95_VER was to avoid this proceeding, wasn't it?

Regards,
Dietmar
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Jan 10, 2020 9:00 am    Post subject: Reply with quote

The internal value is the integer 860 for v8.60...

Code:
      character(80) ctmp
#IF (_FTN95_VER == 860)
      ctmp='FTN95 is v8.60'
#ELSE
      ctmp='FTN95 is not v8.60'
#ENDIF   
      print*, ctmp
      end 
Back to top
View user's profile Send private message AIM Address
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 279

PostPosted: Fri Jan 10, 2020 3:52 pm    Post subject: Reply with quote

Thanks, Paul.

I tried with internal value 8600 (because of ftn95 displaying version number 8.60.0) but this did not work Wink

I'm fine with internal value 860.

Is there any documentaion about all the preprocessor constants of ftn95 for version 8.60?
It may be worthwhile having some examples for the C style preprocessor usage, especially #if clauses
Code:

#IF (_FTN95_VER == 860)
#IF _FTN95_VER == 860

which both may start at column 1 even if using ftn95 option /fixed_format.
Maybe some more documentation could be added to the online help, tabs
Code:

FTN95 Language extension
Conditional compilation

?

Regards
Dietmar
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Jan 10, 2020 5:10 pm    Post subject: Reply with quote

There is some information in ftn95.chm when you search for "conditional compilation".
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Thu Mar 05, 2020 4:00 pm    Post subject: Reply with quote

COMPILER_VERSION and COMPILER_OPTIONS have been added to FTN95 for the next release.
Back to top
View user's profile Send private message AIM Address
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 279

PostPosted: Wed May 20, 2020 4:59 pm    Post subject: Reply with quote

Paul,

I would like to make use of _FTN95_VER to write version specific code. To this end I would appreciate having more information about the C-Style pre-processor (option /CFPP).

I learnt that ftn95 version 8.60 defines _FTN95_VER to 860 but I did not find any documentation to which value ftn95 version 8.62.1 defines _FTN95_VER (meanwhile I figured out that it is defined to 862 isn't it?).

Moreover I could not see documentation about the logical operators to be used in this context. I already have used operators == and > , but I suspect there will be more (eg. like && and ||).

What I do not know at all is how to negate a condition in this context (is it done via .not. or will it work at all ?).

I would appreciate very much if you could place some more documentation concerning this topic in the online help of ftn95.

Regards
Dietmar


I
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu May 21, 2020 9:56 am    Post subject: Reply with quote

Dietmar

Some information is provided in the help file under "FTN95 Fortran language extensions" then "The C-Style preprocessor".

In addition, the C-style operators are:

&& logical AND

|| logical OR

! logical NOT

I have not tested these out. If they don't work then please let me know.
Back to top
View user's profile Send private message AIM Address
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Thu May 28, 2020 10:11 pm    Post subject: Reply with quote

Dietmar, you wrote:
Quote:
I learnt that ftn95 version 8.60 defines _FTN95_VER to 860 but I did not find any documentation to which value ftn95 version 8.62.1 defines _FTN95_VER (meanwhile I figured out that it is defined to 862 isn't it?).


.... it can't be, because in that case what would V 8.62 be defined as ?§?§
_________________
''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 ... Smile "
Back to top
View user's profile Send private message
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 279

PostPosted: Fri May 29, 2020 11:21 am    Post subject: Reply with quote

John-Silver,

I do not know if I understood your "it can't be" write. I interpret it in the way that you think that _FTN95_VER should be different for version 8.62.0 and 8.62.1. This is what I would have expected at first sight. I tried the following code:

Code:

      character*48 str
#IF _FTN95_VER == 860
      str='_FTN95_VER=860'
      write(*,*) str
#ENDIF
     
#IF _FTN95_VER == 862
      str='_FTN95_VER=862'
      write(*,*) str
#ENDIF
#IF _FTN95_VER == 8621
      str='_FTN95_VER=8621'
      write(*,*) str
#ENDIF
      end

and compiled via command
Code:

ftn95 test_cfpp_behaviour1.for /cfpp /link /64

The outputs of the executables built are
Code:

_FTN95_VER=862    for FTN95/x64 Ver. 8.62.0
_FTN95_VER=862    for FTN95/x64 Ver. 8.62.1
_FTN95_VER=860    for FTN95/x64 Ver. 8.60.0

However, at a second sight I think setting _FTN95_VER=8621 would not be a good idea, because if you had a new version ftn95, say version 8.63, with _FTN95_VER set to
Code:

_FTN95_VER=863

then the following code
Code:

#IF _FTN95_VER >= 862
      str='_FTN95_VER=greater equal 862'
      write(*,*) str
#ENDIF

would be activated for both version 8.63 and 8.62.1 of ftn95. Now normally I would intend use the latter code to be activated for version 8.63 only and not for version 8.62.1.
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 -> 64-bit 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