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 

Clearwin plugs for Linux

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
DanRRight



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

PostPosted: Sun Nov 05, 2023 11:24 pm    Post subject: Clearwin plugs for Linux Reply with quote

Can Silverfrost create the linkable library of blank plugs for all Clearwin controls and functions for the FTN95+Clearwin source code for Windows to be able to be compiled with any Fortran for Linux?

I do not mean to create the full working Clearwin code for Linux. I mean to have just the empty functions which will do nothing. They will be just really empty, have no source code, just the declarations dummies needed to trick the Linux compiler to swallow the entire FTN95 source code with Clearwin for Windows and compile it without complaints..

Things are that the code can be made workable with and without GUI. The GUI of course make it muuuch more usable but since there exist difficulties to create and support two sets of Clearwin, one for Windows and another for Linux, this could be pretty useful workaround. Otherwise user have to remove or comment out all these lines with Clearwin controls and functions and maintain two sets of code, one for Windows with GUI and another for Linux without GUI.

On my own Linux computer/supercomputer i do not need this, Clearwin works on Linux like on its own Windows without me doing any additional steps -- you click on Windows EXE file and the program starts, same on Linux, you click on the same Windows created EXE file and, what a miracle!, it also starts -- but on remote public supercomputers where it is not allowed to install Windows emulators in any form, Wine, Bottle or VirtualBox, i am stuck to modify the code for its software.

1) I can change "call winop@..." to "call winop#..., no problem, Windows also works with #.
2) change include <windows.ins> and <clearwin.ins> to "include mswin" and can make fake mswin.mod and clrwin.mod
3) change integer (7) to integer (2) or to integer (3?) since I will not need any 32-bit code anymore... 32-bits are dead.
4) fix declarations gFortran does not like, it does not like even naturally looking integer*8 thinking it is integer*4
Code:
integer*8, parameter :: nTotalFieldCells = 28000000000
Error: Integer too big for its kind. This check can be disabled with the option ‘-fno-range-check’


Last edited by DanRRight on Mon Nov 06, 2023 6:58 am; edited 2 times in total
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1886

PostPosted: Mon Nov 06, 2023 1:03 am    Post subject: Re: Clearwin plugs for Linux Reply with quote

DanRRight wrote:
... it (Gfortran) does not like even naturally looking integer*8 thinking it is integer*4
Code:
integer*8, parameter :: nTotalFieldCells = 28000000000
Error: Integer too big for its kind. This check can be disabled with the option ‘-fno-range-check’


You are misdiagnosing the error. The literal integer 28000000000 is a default integer, which is only 4 bytes long. That size is not enough to represent 28 billion. Try the following code:

Code:
module mod
   implicit none
   integer*8, parameter :: i8 = 28000000000_8
end module


If you want the code to work with other compilers, do not use '8' as the kind number, but use SELECTED_INTEGER_KIND and write portable code.
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Mon Nov 06, 2023 1:55 am    Post subject: Reply with quote

Thanks, mecej4,
Usually i do this way. I do one general declaration
Code:
INTEGER, PARAMETER :: i8  = SELECTED_INT_KIND(18) ! 8-byte 2^63 ~ 10^18

and then any multiple integer*8 ones declare
Code:
INTEGER(i8) :: TotalFieldCells = 280000000000

Any objections ?
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1886

PostPosted: Mon Nov 06, 2023 3:05 am    Post subject: Reply with quote

Instead of
Code:
INTEGER(i8) :: TotalFieldCells = 280000000000

you need to write
Code:
INTEGER(i8) :: TotalFieldCells = 280000000000_i8

If you don't do that, you are attempting to initialize an 8-byte integer with a 4-byte value. Some Fortran compilers may promote the 4-byte value to an 8-byte value, either with default options or with a specific option, but you cannot count on that being done consistently.
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Mon Nov 06, 2023 7:33 am    Post subject: Reply with quote

And i thought what for needed this perversion with underscore a la 123_8 when all works with 123 just fine...
With FTN95 this even does not work
Code:
module mod
   implicit none
   integer*8, parameter :: i8 = 28000000000_8
end module

*** Invalid KIND specifier
    1 ERROR  [<MOD> FTN95 v8.97.2]
*** Compilation failed
while it automatically promotes the constant
Code:
i8 = 28000000000

WARNING - Constant is out of range for INTEGER(KIND=3) - has been promoted to
    INTEGER(KIND=4)
    NO ERRORS

to fit 28 billion Smile

By the way are integer kind(3) and kind(4) the same in FTN95 and gFortran and Intel VF ? Otherwise i will have even more trouble with all that ...
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Nov 06, 2023 9:15 am    Post subject: Reply with quote

For _4, _8, etc. use /alt_kinds on the FTN95 comand line.

Using ClearWin+ with gFortran and iFort is described here... https://www.youtube.com/watch?v=50BY9gyNY2o
Back to top
View user's profile Send private message AIM Address
DanRRight



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

PostPosted: Mon Nov 06, 2023 10:01 am    Post subject: Reply with quote

Paul, thanks with the Kinds, as to gfortran- the compilation using gfortran has to be performed on supercomputer under Linux. My understanding is that Linux Fortran will not accept any libraries made under Windows unless they are in a source code. Do the sources exist? With Windows gfortran I played a bit and it worked with Clearwin
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Nov 06, 2023 11:29 am    Post subject: Reply with quote

The ClearWin+ library is written in C/C++ but the source code is not in the public domain.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
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