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 

Do you also have an error?

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

PostPosted: Wed Oct 11, 2023 7:16 am    Post subject: Do you also have an error? Reply with quote

Lost almost one day...

Code:
module mo
  use clrwin
  real*8 xMomTot(10000), y1MomTot(10000), y2MomTot(10000)
  integer :: itime=5

  contains
  integer function plotMomentumTot ()

    ix = 800; iy = 600

    i = winio@('%pv%pl[x_array, scale=linear, N_GRAPHS=2',&
        ix, iy, itime, xMomTot, y1MomTot,  y2MomTot )

     plotMomentumTot = 2
  end function plotMomentumTot
end module

!========================
program aaa
use mo

xMomTot(1)=0
xMomTot(2)=1
xMomTot(3)=2
xMomTot(4)=3
xMomTot(5)=4

y1MomTot(1)= 0
y1MomTot(2)= 1
y1MomTot(3)= 2
y1MomTot(4)= 3
y1MomTot(5)= 2

y2MomTot(1)= 0
y2MomTot(2)= -1
y2MomTot(3)= -2
y2MomTot(4)= -3
y2MomTot(5)= -2

jj = plotMomentumTot ()

End
Back to top
View user's profile Send private message
Kenneth_Smith



Joined: 18 May 2012
Posts: 697
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Wed Oct 11, 2023 9:52 am    Post subject: Reply with quote

Replace:
Code:
    i = winio@('%pv%pl[x_array, scale=linear, N_GRAPHS=2',&
        ix, iy, itime, xMomTot, y1MomTot,  y2MomTot )


with:
Code:
    i = winio@('%pv%pl[x_array, scale=linear, N_GRAPHS=2]', &
        ix, iy, 5, xMomTot, y1MomTot,  y2MomTot )


i.e. the closing square bracket in the %pl[options] is missing.

Or using winop@:
Code:
    call winop@('%pl[x_array, scale=linear, N_GRAPHS=2]')
    i = winio@('%pv%pl', ix, iy, 5, xMomTot, y1MomTot,  y2MomTot )
Back to top
View user's profile Send private message Visit poster's website
DanRRight



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

PostPosted: Wed Oct 11, 2023 10:52 am    Post subject: Reply with quote

Damn....i was swearing and yelling whole day like a russian drayman.
Never expected compiler will miss this.
Thanks Ken
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Oct 11, 2023 7:00 pm    Post subject: Reply with quote

I think that it was you that missed the unmatched bracket, not the compiler.

The compiler is not expected to scan for matching brackets within quotation marks.
Back to top
View user's profile Send private message AIM Address
DanRRight



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

PostPosted: Wed Oct 11, 2023 9:16 pm    Post subject: Reply with quote

25 years ago i had conversation on comp.lang.fortran with Polyhedron team arguing about their choice of using Winteracter GUI builder vs Clearwin. They used both but settled with Winteracter. Their main argument against Clearwin was that it does not check the syntax while Winteracter did. At that time all Clearwin users i know indeed were learning it peppering with strong cursing and swearing. Since that Clearwin improved in this respect and became much more user friendly but that it still does not check matching brackets would be shocking surprise for anyone.
When i type this text the spellchecker automatically checks my poor writing. ChatGPT some people use further improves its style. When i type Fortran text I do even more mistakes per line than the number of letter in the line Smile and do not care because FTN95 with 99.9999...% probability will correct them for me. Isn't it natural to expect the same from Clearwin ?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Oct 12, 2023 6:24 am    Post subject: Reply with quote

Dan

My observation was really a reaction to your criticism. I don't have access to my computer at the moment so I have not yet looked at how ClearWin+ responds to your incorrect code.

ClearWin+ errors are runtime errors reported by the library rather than compiler errors reported at compile time. There is a compiler option that provides some ClearWin+ checking at compile time but it does not include checks for %pl.
Back to top
View user's profile Send private message AIM Address
DanRRight



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

PostPosted: Thu Oct 12, 2023 8:17 am    Post subject: Reply with quote

I was doing this small couple lines plotting code 1000 times before. But this time the error messages were so strange that i could not believe my eyes. At the end swearing i extracted the code from the large code and even there i was still getting disastrous gibberish from it.

At that moment i was swearing at everything and everybody, including all effing dumb Clearwin users who first, by strange stupid reasons not enough often use this great piece of software and when use never complain about anything or suggest things to improve.

And when posted the example i found the error few hours later at the same time as Ken also found it.

I still can not believe that there exist any difficulty to perform the brackets match check. My editor which also do that at run time shows matching brackets. But I did not look at editor checks because last thing i expected was this kind deficiency of Clearwin. This is definitely one of the main checks which always have to be done first. And for the user it is 100th thing compiler is doing that or library at run time
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Oct 14, 2023 6:33 am    Post subject: Reply with quote

ClearWin+ uses square brackets in the strings for format codes and naturally must look for matching closing brackets.

I am confident that a missing closing bracket will be clearly reported in a vast majority of contexts. This is presumably an exceptional case and I will see if the response can be improved in this particular context.
Back to top
View user's profile Send private message AIM Address
mecej4



Joined: 31 Oct 2006
Posts: 1886

PostPosted: Sun Oct 15, 2023 12:24 pm    Post subject: Reply with quote

Dan, there are some limits to what kind of errors can be caught at compile time in ClearWin command strings.

That your string had an unmatched '[' may be an error in the ClearWin+ programming language, but it is certainly not a Fortran error, since a Fortran string may contain anything within it.

Consider the following variant of your code section
Code:
character(len=80) :: wiostr, fmtstr='%pv%pl[x_array, scale=linear, N_GRAPHS='
...
write(wiostr,'(A,i)')fmtstr,ngraphs         !incorrect, no terminating ']'
!write(wiostr,'(A,i,A1)')fmtstr,ngraphs,']' !correct version
...
i = winio@(wiostr, ix, iy, itime, xMomTot, y1MomTot,  y2MomTot )

which allows adding the '2' after 'N_GRAPHS=' at run time, and possibly adding some other number, such as '4', instead.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sun Oct 15, 2023 2:05 pm    Post subject: Reply with quote

Thinking of the differences between compilers and runtime libraries, set me to wondering how this will evolve.

I tried asking Chat GPT to write a Fortran program to find sub-expressions and the result was very sensible. I then tried "Write a Fortran program using ClearWin+ to draw the graph of y = sin(x)". Of sourse the result was not so good but it is early days! (The result may have been a mixture of ClearWin+ and ClearWin for .NET)
Back to top
View user's profile Send private message AIM Address
DanRRight



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

PostPosted: Mon Oct 16, 2023 6:57 am    Post subject: Reply with quote

mecej4, May be both compiler and library have to check for errors. Beauty of situation is that Fortran compiler and Clearwin are both controlled by the same people, so there is nothing left to not to find the best way how to check for human errors.

Paul, Please continue investigating ChatGPT. The result could be a bomb. Clearwin vs the Clearwin for NET are two different contexts. ChatGPT can easily learn that. At the beginning it will for example not write something entirely new but do the opposite: to quickly extract small demo out of large code - this definitely very much needed for all of us. I agree best way would be to teach it on Clearwin code: ask it to duplicate some code, removing something not needed from it. Then you will ask ChatGPT to add,say, some control, radiobutton, Property sheet, regroup position, change day/night styles etc. All that is very much needed. We humans are so hell slow at most programming things even if we perfectly know what and how to do.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Oct 16, 2023 12:18 pm    Post subject: Reply with quote

This has now been fixed but probably not in time for the next full release.
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