Silverfrost Forums

Welcome to our forums

Native %pl

28 Nov 2016 9:07 (Edited: 28 Nov 2016 10:07) #18492

Paul, I am always trying to write my code such a way that there will be no crash in any circumstances. You as a developer definitely have even more control over that so why it is impossible in case of all unknown errors just add one small screen such as

'%pl can not finish the task due to unknown problem. Press OK to continue',

or 'Internal crash while performing %gr. Press OK', or

'The resize can not be completed due to unknown error. Press OK to continue'

Or just one single message for all cases 'To prevent crash due to unknown reason the Clearwin task was aborted. We suggest you to check user supplied parameters. Press OK to continue'

I know that our re#$%^ Fortran Standard committee of pensioners wants to crash, crash,crash and crash Fortran code always and in all unknown circumstances blaming programmer. But this is obsolete absurd DOS command prompt way of doing things. Windows Clearwin+ code must never crash, period.

Always think how Fortran will be used for heart beat controllers. Crash means death.

Or imagine that you have 100 tabs in your browser and some code in one of them crash the entire browser with all its tabs. Same was in Windows 95 era, you have 100 windows open and abruptly one error in one of them took the whole computer to reboot. That was total absurd. That is unacceptable.

Today when anyone opens my code (which is doing a hell lot of things gathered under one name) when the user is ready to navigate the universe the movie can abruptly stop with crash in some small task, small sub-code which is 1/10000 of what user could do. Anyone would think that i as an author am total idiot who can not program 😦. Or even worse. Just remember how did you call Bill Gates at the time of crashing DOS/Windows ?

28 Nov 2016 9:32 #18493

Agustin

  1. I used [pen_style] because it already has this name in %gr.

  2. [style] is not new but I could add [plot_style] as an alias.

  3. Remarkably I have anticipated your request and [symbol_size] has already been added.

  4. I have added four more symbols so I don't think that I can give them all names. At some point they will be documented and developers can annotate their code.

28 Nov 2016 9:55 #18494

Hi Paul,

Thank you for responding to my post while you are busy with %pl. I think Dan and I are on the same wavelength. 'Fortran Stop' (or a variation of it) is not really the way to terminate a windows application, but ClearWin's origins date back to when it was. If even by Windows 10 Microsoft can't guarantee that apps don't crash then programmers must program defensively, especially as Dan's suggestion looks to me to be a major software development task.

Eddie

28 Nov 2016 9:55 #18495

Quoted from PaulLaidler Agustin

  1. I used [pen_style] because it already has this name in %gr.

well, that's a good reason...

because it already has this name in %gr.

well, that's a good reason...

because it already has this name in %gr.

well, that's a good reason...

because it already has this name in %gr.

well, that's a good reason...

because it already has this name in %gr.

well, that's a good reason...

because it already has this name in %gr.

well, that's a good reason...

because it already has this name in %gr.

well, that's a good reason...

because it already has this name in %gr.

well, that's a good reason...

[quote:266931993d] 2) [style] is not new but I could add [plot_style] as an alias.

I think it would be nice, but I do not know what the other users think about..

[quote:266931993d] 3) Remarkably I have anticipated your request and [symbol_size] has already been added.

great!

[quote:266931993d] 4) I have added four more symbols so I don't think that I can give them all names. At some point they will be documented and developers can annotate their code.

I have to agree with you in this point.....but symbol numbers should be consecutive, not as it happens now that you have to use numbers 1, 3, 4, etc. and avoid number 2 in the style option because 2 is related to a style of line. I don't know if it is possible= easy to revert this and let 0 and 1 for lines and the rest of the numbers for symbols...

Agustin

28 Nov 2016 9:58 #18496

Dan

We seem to be at cross purposes. I am thinking of errors like a missing winio@ argument or perhaps there is an argument but it has the wrong type.

These are the kind of errors that cause ClearWin+ to abort.

If there is a particular situation where you think that ClearWin+ should be able to recover then please post some code to illustrate this so that we can try to make improvements.

29 Nov 2016 12:25 #18497

Here is the code which works with pre-selected parameters, just click and see that. You can add Y_max=0.9 to PlotSettings and run again, it works OK. But if you change just one letter wrong way, for example, Y_min to X_min (X_min option does not exist yet, or change 0.2 to o.2 or add anything stupid to PlotSettings) and again click 'Launch Plot' you will get the entire code crashed instead of coming out without crash with error message (and may be even also with an offer to repeat your choice with different parameters. OK, this is completely optional)

module AllSubs
  parameter(n=100) 
  real*8 x(n),y(n) 
  integer wid, heig 
  character PlotSettings*64

Contains 

Integer function plotter()
  i=winio@('%ww%pv&')
  i=winio@(PlotSettings, wid, heig, N, x, y) 
  i=winio@('%ff%cn%bt[OK]%es')
  plotter =2
end function

end module AllSubs
!.............................................
Program Test
  use clrwin 
  use AllSubs

  do i=1,n 
    x(i)=i-1 
    y(i)=sin(7.*i/n)**2 
  enddo 

  wid =400 
  heig=250 
  PlotSettings ='%pl[x_array,Y_min=0.2]&'

  i=winio@('%ww%ca[Plot]&') 
  i=winio@(' Enter Plot parameters%30rs%ff %ff&',PlotSettings) 
  i=winio@('%cn%^tt[Launch Plot]%ff&', plotter) 
  i=winio@('%cn%bt[OK]%es') 
 end program
29 Nov 2016 8:06 #18498

Agustin

To make things simpler I propose to add [lines] as an alternative for [style=0] and [curves] as an alternative for [style=2]. Then I will also be able to add [symbol=n] as an alias for [style=n]. The result will be that you will be able to have symbols joined with straight lines or curves.

Dan

Are you sure that you want to lose the trace-back information that tells you where the error occurred in your code? At the moment I can only provide one or the other not both.

29 Nov 2016 10:40 #18499

Paul,

Traceback info is of use to a developer (and then only if you understand what it is telling you) but of no use to an end-user - unless you are programming for yourself, as I often am.

Perhaps there needs to be some differentiation between compiling or linking a 'release; version from a 'development' version.

Which ultimately is having your cake and eating it, I suppose.

Eddie

29 Nov 2016 11:58 #18501

Quoted from PaulLaidler Agustin

To make things simpler I propose to add [lines] as an alternative for [style=0] and [curves] as an alternative for [style=2]. Then I will also be able to add [symbol=n] as an alias for [style=n]. The result will be that you will be able to have symbols joined with straight lines or curves.

excellent idea!.........I will wait for the next DLLs version......in the meantime I am also thinking about how to write plot legends...for simple line plots I am using draw_line_between@ and draw_character@, but for scatter plots and line+symbol, well, it will be rather more complex.....but the improvements you are doing for %pl are great!!

Agustin

29 Nov 2016 5:45 #18504

Paul, Well, let's do the experiment. I have some Clearwin+ code which not me not anyone else here were able to make amicable for a decade. It crashes on all my computers. The only time it does not crash is when I run it through the debugger even if I compile it with /nocheck. This behavior prevents finding the bug as the debugger medicine does not work with this devil's self-hiding bug. This devilry surprisingly does not crash on John-Silver's computer. Yes it provides me crash info but I have no willingness or such amount of free time to dig into its French (read - assembler). I feel that most probably the reason is in some Property Sheet %ps conflict.

If you will find this bug using this crash traceback then let's consider keeping traceback for extra hard cases. If not then I agree with Eddie that we have to kill this purely top 0.00001â„… of power users and developers option.

I am sure if developers like them they will find hidden ways to keep them for themselves. But for the users crash is unacceptable at least for Clearwin code and possibly for entire Fortran.

Clearwin code is essentially multithreaded and the bug in one independent thread does not have to put down all others. That may mean that company has to make special developer edition or option of compiler.

To accelerate the interest i will pay $100 for fixing the bug natural way without major rebuild of the code. I also welcome anyone who wants to try.

30 Nov 2016 7:21 #18505

Dan

For $100 no, but as a challenge I will at least look at the code if you can put it on to Dropbox.

30 Nov 2016 10:58 #18506

Dan,

Last time you offered a $ reward for fixing a problem, I recall I was unable to collect due to the fine print !! If you have a link for this problem, send it to me and I will see if I can understand the problem and provide a fix. I will try to use Clearwin+ /64 and see where I get to.

John

1 Dec 2016 8:12 #18507

Here is a new native %pl to try...

https://www.dropbox.com/s/fvl3qcrdzwqmmro/newDlls16.zip?dl=0

Don't forget to backup your original release.

Notes, samples and new 'include' files are provided in the download.

1 Dec 2016 5:00 #18508

Great job Paul!......I am testing your new version and runs fine.....the frame option is nice, and the variety of options now make %pl a very good tool for 2D plots....however.....I still have a pair of questions:

  1. the lack of circles within the symbols set is due to some kind of difficulty to make %pl to draw them?......I ask this just because open and filled circles are usually the first symbols one selects for a plot...although I do not know why.....

  2. is there any possibility to change the location of the x-axis caption to the centre of the axis?. Now we have the y-caption centred (in general, but in some cases it can appear quite below the centre) but the x caption appears (always) located towards the end of the axis.

  3. I am now plotting a data set that goes from 0.0 to 60.0 on the x-axis and the result is that the x-axis shows 30 tick labels and the y-axis 23. Moreover: as the y-values are not very far one from the other, I have duplicated labels among those 23, i.e. 0.01,0.01,0.02,0.02,0.03,0.03, etc....with [x_array] option, 'dx' does not work. I do not know if it could be possible to indicate %pl to write a label every n ticks.

These are some kind of embellishments of %pl, not critical issues......in the meantime, I will continue testing the new DLLs....thanks a lot Paul for your efforts.

Agustin

1 Dec 2016 5:19 #18509

More about the ticks.....

As I mentioned, I have a data set with x going from 0 to 60, and the number of ticks depends in a funny way on the x-range plotted. The following is what I have obtained after plotting a region of the data set.

The x-axis shows:

Case 1: data plotted from 0 to 5: tick interval =0.15 Case 2: data plotted from 0 to 10: tick interval = 0.30 Case 3: data plotted from 0 to 15: tick interval = 0.45 Case 4: data plotted from 0 to 20: tick interval b= 0.5 from 0 to 10, then 1 from 10 to 17 and finally no tick from 17 to 20 Case 5: data plotted from 0 to 25 (0-30 or 0-35): tick interval = 1 Case 6: data plotted from 0 to 40: tick interval = 1 from 0 to 34, then no tick Case 7 data plotted from 0 to 45: tick interval = 1.5 Case 8: data plotted from 0 to 50: tick interval = 1.5 Case 9: data plotted from 0 to 55: tick interval = 1.5, but no tick above 51 Case 10: data plotted from 0 to 60: tick interval = 2

These results indicate that there is no simple way in which Clearwin makes the division of the axis.

Agustin

2 Dec 2016 3:38 #18510

Agustin

If you can send me your code then I will take a closer look at what is happening within ClearWin+.

2 Dec 2016 3:46 #18511

I can send you a zip file with the source code and the data file. Just let me know where to send it.

Agustin

7 Dec 2016 4:47 #18518

Here is a link to the latest and probably the final version of %pl in the current development exercise.

https://www.dropbox.com/s/9yau5etm8koqrt2/newDlls17.zip?dl=0

7 Dec 2016 5:19 #18519

Paul,

reading your notes, I noticed that first you say:

The function DCHANGE_GRAPH_DATA@ or FCHANGE_GRAPH_DATA@ can be called after a window has been formed in order to change the data.

and immediately you write:

** INTEGER FUNCTION CHANGE_PLOT_INT@(id, option, index, dval) INTEGER FUNCTION CHANGE_PLOT_DBL@(id, option, index, fval) INTEGER id,index,dval CHARACTER*() option REAL8 fval**

so, 'change_graph' or 'change_plot' is what we have to use? and...CHANGE_GRAPH_STYLE@ is no more available?.....

Agustin

7 Dec 2016 6:45 #18520

Agustin

Yes that needs correcting. I changed the names and the previous functions have been replaced. The sample programs have the correct names.

Please login to reply.