|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
DanRRight
Joined: 10 Mar 2008 Posts: 2852 Location: South Pole, Antarctica
|
Posted: Wed Oct 11, 2023 7:16 am Post subject: Do you also have an error? |
|
|
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 |
|
|
Kenneth_Smith
Joined: 18 May 2012 Posts: 703 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Wed Oct 11, 2023 9:52 am Post subject: |
|
|
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 |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2852 Location: South Pole, Antarctica
|
Posted: Wed Oct 11, 2023 10:52 am Post subject: |
|
|
Damn....i was swearing and yelling whole day like a russian drayman.
Never expected compiler will miss this.
Thanks Ken |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8003 Location: Salford, UK
|
Posted: Wed Oct 11, 2023 7:00 pm Post subject: |
|
|
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 |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2852 Location: South Pole, Antarctica
|
Posted: Wed Oct 11, 2023 9:16 pm Post subject: |
|
|
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 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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8003 Location: Salford, UK
|
Posted: Thu Oct 12, 2023 6:24 am Post subject: |
|
|
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 |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2852 Location: South Pole, Antarctica
|
Posted: Thu Oct 12, 2023 8:17 am Post subject: |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8003 Location: Salford, UK
|
Posted: Sat Oct 14, 2023 6:33 am Post subject: |
|
|
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 |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1896
|
Posted: Sun Oct 15, 2023 12:24 pm Post subject: |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8003 Location: Salford, UK
|
Posted: Sun Oct 15, 2023 2:05 pm Post subject: |
|
|
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 |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2852 Location: South Pole, Antarctica
|
Posted: Mon Oct 16, 2023 6:57 am Post subject: |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8003 Location: Salford, UK
|
Posted: Mon Oct 16, 2023 12:18 pm Post subject: |
|
|
This has now been fixed but probably not in time for the next full release. |
|
Back to top |
|
|
|
|
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
|