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 

LCASE@ and TRIM@ functions

 
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: 2818
Location: South Pole, Antarctica

PostPosted: Tue Nov 07, 2023 11:31 am    Post subject: LCASE@ and TRIM@ functions Reply with quote

I do not find similar functions in gFortran :

call lcase@ (text)
call trim@ (text)

Text is character variable (in my case character*256).

I know there exist simple programs to do the same
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1886

PostPosted: Tue Nov 07, 2023 2:59 pm    Post subject: Reply with quote

As the FTN95 documentation tells you, you can use the standard intrinsic ADJUSTL instead of TRIM@. For LCASE@, unless you want to convert the entire works of Shakespeare to lower case, the following code should suffice as a replacement.

Code:
program tlcase
   implicit none
   character*20 :: mstr = 'abcdEFGHijklmN12Qr@#'
   call toLower(mstr)
   print 10,mstr
10 format(' |',A,'|')
end program

subroutine toLower(str)
   implicit none
   character(*), intent(in out) :: str
   integer*1 itmp(len(str))
   integer*1, parameter :: i32 = 32

   itmp = transfer(str,itmp)
   str  = transfer(merge(IOR(itmp,i32), itmp, &
                         65 <= itmp .AND. itmp <= 90), str)
   return
end subroutine


Last edited by mecej4 on Wed Nov 08, 2023 1:08 am; edited 1 time in total
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Tue Nov 07, 2023 10:37 pm    Post subject: Reply with quote

Brain crushing solution, thanks mecej4.
Mathematics is foundation of everything Smile
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Wed Feb 07, 2024 6:46 am    Post subject: Reply with quote

But what also happened with LCASE@ in FTN95 9.0+ ? Was it dropped from the compiler? This makes some older codes broken
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Feb 07, 2024 7:57 am    Post subject: Reply with quote

Dan

I don't know of any problems with LCASE@. Can you provide details and sample code?
Back to top
View user's profile Send private message AIM Address
DanRRight



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

PostPosted: Wed Feb 07, 2024 2:28 pm    Post subject: Reply with quote

Paul,
It behaves a bit unexpectedly, not that it is unsupported in Ver9 but better say kind of lost backward compatibility. If i create an example and compile it with Ver9 all works fine. But if compile with older compilers and run under Ver9 it freezes or crash.
Code:
character*256 text
Text='QWERTY'
print*,trim(text)
call lcase@(text)
print*,trim(text)
end
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Feb 07, 2024 4:11 pm    Post subject: Reply with quote

Dan

If you compile using an older FTN95 and run using the latest Silverfrost DLLs then it may well crash.
Back to top
View user's profile Send private message AIM Address
DanRRight



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

PostPosted: Wed Feb 07, 2024 11:44 pm    Post subject: Reply with quote

lcase can crash Clearwin? Shocked Shocked Shocked
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1886

PostPosted: Thu Feb 08, 2024 12:55 am    Post subject: Reply with quote

Dan, many of the 64-bit RTL routines (such as lcase@, dot_product8@, etc.) are in CLEARWIN64.DLL rather than in SALFLIB64.DLL. Just today I posted a bug report ( http://forums.silverfrost.com/viewtopic.php?p=34982#34982 ) for dot_product8@, and the demonstrator did not use any CLEARWIN features.
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Thu Feb 08, 2024 2:21 pm    Post subject: Reply with quote

Are CLEARWIN64.DLL and SALFLIB64.DLL provided by the different companies?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Feb 08, 2024 3:24 pm    Post subject: Reply with quote

CLEARWIN64.DLL and SALFLIBC64.DLL are provided by Silverfrost and are companion DLLs for 64 bit FTN95, SCC and SLINK64.

For 32 bits there is just one DLL which is salflibc.dll but for 64 bits CLEARWIN64.DLL and SALFLIBC64.DLL replace salflibc.dll.
Back to top
View user's profile Send private message AIM Address
DanRRight



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

PostPosted: Thu Feb 08, 2024 9:39 pm    Post subject: Reply with quote

I forgot to put the smile or irony in my last post. I meant what happened with lcase in Ver9 which abruptly started to hiccup after 30 years of previous no problem upgrades ?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Feb 09, 2024 8:33 am    Post subject: Reply with quote

Dan

A cure for hicups is to hold your breath for a long time. Long enough to remember to keep compiler and DLL versions in step.
Back to top
View user's profile Send private message AIM Address
DanRRight



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

PostPosted: Fri Feb 09, 2024 2:43 pm    Post subject: Reply with quote

Paul,
Looks like the devilry now found your computers too Razz In October in this forum we discussed lcase@ and 3 days later FTN95 Ver.9.0 appeared

I downloaded it in November, installed it on new drives in Linux, in Windows, and when launched my codes they even did not start.

I informed you about two problems with Ver9,0 and got new FTN95. It cured one of them and did not fix lcase@ with you just commented that you can not do anything with it (???). How one can interpret that and how "my breath" and "in step" can fix the issue?

New compiler broke backward compatibility. May be i missed something and you meantime fixed it? No, after that I found new and the only latest DLLs since i reported this bug, i installed them and the problem is still there.

Should i interpret "i can not do anything with it" that now i have to dig into ages and find older compilers' with their Salflibc64 and Clearwin64 to run older codes? 35 years all older codes worked fine with new versions of FTN95.

What, the FTN95 still does not attach needed libraries to EXE? Is this to advertise that FTN95 has one "huge advantage" of having smallest EXE files to fit them into 1.44MB 2.5" floppy drives?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Feb 09, 2024 5:29 pm    Post subject: Reply with quote

Dan

I tried to explain that you can't normally use an old version of FTN95 with later (dated) versions of the Silverfrost DLLs.

I will send you the latest FTN95 with compatible DLLs off my machine (probably on Monday). If you use them together then your problems should be solved.
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