|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
DanRRight
Joined: 10 Mar 2008 Posts: 2824 Location: South Pole, Antarctica
|
Posted: Tue Apr 10, 2018 9:25 am Post subject: New DLL23 with Ver 8.30 and %cw unit=0 |
|
|
Got new warning at start that "%cw unit should not be =0". Why and what's wrong with zero? Zero is very popular among other Fortrans compilers where print* or write (*,*) goes by default (in gFortran for example write(0,*) is equivalent to write(*,*). I suspect ALL compilers do the same as one of third-party codes i use written in gFortran works on a dozen of different compilers without any changes and only FTN95 does not understand zero so i have to change it to 6 ). I think whether zero is Standard conforming or not should be considered as a de facto conforming if everyone use it and it does not contradict or break anything
With Clearwin+ though using non-zero value for %cw produces something i do not understand: taking it 1 or 6 opens one more huge out of control size %cw window (???) while previous %cw window is still in place but keeps to be empty (the printed text is redirected to this new window). Looks like a bug or some other devilry.
Permanently answering questions "Do you still agree to use zero as %cw unit number?" is not a fun. Why it is needed?
Last edited by DanRRight on Tue Apr 10, 2018 1:12 pm; edited 1 time in total |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7930 Location: Salford, UK
|
Posted: Tue Apr 10, 2018 11:17 am Post subject: |
|
|
I guess that it has always been the case that 1 and 6 are used for a non-embedded (old style) ClearWin window. For an embedded %cw ClearWin window, other values must be used.
The zero value has been shown to cause a crash in 32 bit applications when the current window is not the main window. ClearWin+ has no way of knowing if the current window is the main window, hence the warning and the option to continue.
At the moment I can't think of a better solution. |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2824 Location: South Pole, Antarctica
|
Posted: Tue Apr 10, 2018 1:26 pm Post subject: |
|
|
This hints on some internal Clearwin or FTN95 or even Windows bug somewhere. At least with Clearwin's %cw I never had the problem with unit=0 before, was the %cw embedded or not. And I'd prefer to continue using it as the current solution to automatically opening the text window of the size of entire 4K monitor space is unacceptable and the permanently flashing warning-reminder asking 50 times per day if i want to continue using zero is annoying. Would be good to find the other solution at least like suppressing this warning permanently after first use. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7930 Location: Salford, UK
|
Posted: Tue Apr 10, 2018 4:28 pm Post subject: |
|
|
Dan
The large text window is a result of your coding. You should use a unit number (like 7 say) both in your %cw winio@ statement and in the corresponding Fortran WRITE statements when writing to the window.
At the moment I don't have an alternative fix that would enable you to continue to use your existing code without change.
We could change it so that the message is suppressed after the first occurrence but not from one run to the next. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7930 Location: Salford, UK
|
Posted: Tue Apr 10, 2018 9:37 pm Post subject: |
|
|
Dan
The use of zero is allowed in 64 bit code, so if 64 bit compilation is possible then that is the way to go. |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2824 Location: South Pole, Antarctica
|
Posted: Wed Apr 11, 2018 11:56 pm Post subject: |
|
|
Indeed, there is no warning with 64. But there is nothing printed into %cw window with zero unit either. Totally empty screen. And even no additional screen pops where Print* is redirected like with 32
This story now goes to Clearwin+. In 1990 FTN77 and in 1997 FTN90 both had troubles with units from 0 to 10. I have no clue what's happened there, some kind of new fashion or new schizophrenic ideas in computer science were implemented probably. Because at this time Salford invented non-standard READF@, READFA@ etc nonstandard options as regular units from 0 to 10 were causing crashes. And fun is that the history returns.
Recently we found all these READFA's are very fast compared to READ but still no other compiler had any troubles with units 0-10... |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7930 Location: Salford, UK
|
Posted: Thu Apr 12, 2018 7:25 am Post subject: |
|
|
Dan
My first impression was that you did not like the new message about not using zero when zero was working OK for you. Now it looks like zero does not work anyway. Is this your understanding?
I don't know why zero does not work and, for 64 bits, I don't think that we have any control over this.
Here is my test code...
Code: | winapp
integer,parameter::wUnit=0
integer ctrl,i,iw,winio@
iw = winio@("%ac[Ctrl+C]&","COPY")
iw = winio@("%40.20cw[vscroll]&",wUnit)
iw = winio@("%lw",ctrl)
do i=1,50
write(wUnit,"(a,i3)") "This is line ",i
enddo
end |
|
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2824 Location: South Pole, Antarctica
|
Posted: Thu Apr 12, 2018 11:21 am Post subject: |
|
|
Both 32 and 64 fail crashing with the message that the unit was neither opened or preconnected.
Yes, I do not like to change 1000s of write(*,*) and prints* to something like write(1111,*) and Print 1111, in my code and other people codes which are also large. Imagine - you change some third-party code ones, then in 6 months new version comes and I have to do that for 1000 files again and again because developers in a million year will never change that just for FTN95 given all worked for all other Fortran compilers for 50 years. The absence of unit zero has no merit and is a "feature" of only FTN77/95
Ones I tried to convince one of developers not to use write(0,*) and just use write(*,*) and got many excuses not to do that. Now he uses both simultaneously hell knows what for, as both give the print to the same screen twice As I remember he said something like that write(*,*) can be redirected to the file but write (0,*) means higher priority console output which is never redirected |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7930 Location: Salford, UK
|
Posted: Thu Apr 12, 2018 3:01 pm Post subject: |
|
|
Dan
I find that I can use unit = 2 with %cw together with WRITE(*, ...
I think that you will find that you can still use WRITE(*, and the corresponding PRINT provided that you use 2 with %cw. |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2824 Location: South Pole, Antarctica
|
Posted: Fri Apr 13, 2018 12:48 pm Post subject: |
|
|
Unit=2 works but all that abrupt changes look to me like very bad idea. No more write(*,*) to %cw, no more print*. Let alone write(0,*) which now causes a crash. As I wrote this reminds me never ending mess with the I/O units with this compiler from day 1 which was more or less cleaned starting from FTN95 at the turn of the century and (besides unit=0). And now all past mess abruptly exploded in even more options.
If user said no to ancient Command Prompt input/output (and eventually all will stop using it) by using keyword WINAPP or using compiler switch /WINDOWS or /WIN he said bye-bye to DOS-like windows. The only what he expects is that all what was before going to DOS prompt window now go to %cw without changes. And all these years unit=0 in %cw acted like that allowing to use usual write(*,*) and Print* absolutely all Fortran people use. Now the codes have to be rewritten to write(2,*), remembering this unit 2 and knowing no one else use or will ever use it, because it is non-standard Clearwin-specific unit. Besides the user has to forget short and convenient Print*. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7930 Location: Salford, UK
|
Posted: Fri Apr 13, 2018 4:26 pm Post subject: |
|
|
Dan
Now you have me confused. Are you saying that using zero was working but now doesn't. Can you tell me when it was working and if it was 32 bits, 64 bits or both.
I know that I keep repeating myself but WRITE(*, *) etc., works for me with %cw provided you use unit 2 with %cw. This works...
Code: | winapp
integer ctrl,i,iw,winio@
iw = winio@("%40.20cw[vscroll]&",2)
iw = winio@("%lw",ctrl)
do i=1,50
write(*,*) "This is line ",i
enddo
end |
|
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Fri Apr 13, 2018 5:48 pm Post subject: |
|
|
Dan,
I'm interested in this. Can you write a small sample that works with 8.1 and doesn't with 8.3? I'm using 8.1 so if you think it should work with that, and you've upgraded past it, then I'll try it out for you.
Eddie |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2824 Location: South Pole, Antarctica
|
Posted: Sat Apr 14, 2018 12:23 am Post subject: |
|
|
I'm still investigating how unit=2 in my real, not demo, code gave me old DOS prompt window popped into the face despite Winapp was used. And still nothing goes to %cw despite unit=2, all Print* goes to DOS prompt window.
With the demo above where i added one line isn't it funny to see that
Code: | winapp
integer ctrl,i,iw,winio@
iw = winio@("%40.20cw[vscroll]&",2)
iw = winio@("%lw",ctrl)
do i=1,10
write(*,*) "This is write (*,*) line",i
write(2,*) "This is write (2,*) line",i
enddo
end |
write (*,*) and write(2,*) do the same output? By the way why 2 not 11? Or 111?
I guarantee that even everyone in in broader Fortran community will accept and start using Clearwin+ no one will like that and will demand that it should be that
write (*,*) and write(0,*)
were printing into the same screen |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7930 Location: Salford, UK
|
Posted: Sat Apr 14, 2018 8:14 am Post subject: |
|
|
Dan
If you are compiling a 64 bit executable then WINAPP is not always effective. It depends on how you do the linking. For 32 bits, I think that WINAPP always works.
WINAPP is an instruction that is passed to the linker to make it create a Windows application. For 64 bits this only works with FTN95 /LINK or /LGO. In other situations it is necessary to provide an explicit "windows" instruction to SLINK64.
If you are getting a DOS box for 32 bits then you could try adding "windows" to the link script but in my experience this is not necessary. |
|
Back to top |
|
|
DanRRight
Joined: 10 Mar 2008 Posts: 2824 Location: South Pole, Antarctica
|
Posted: Sat Apr 14, 2018 11:59 am Post subject: |
|
|
Thanks, Paul, adding /WIN to SLINK64 solved the inconveniences problem, all WRITE(*,*) or PRINT* output now goes to the %cw with unit=2 without automatically opening any other not intended windows. Good to know that WINAPP keyword not yet always works with 64.
I was using 64. The 32 asks if i want to continue using unit=0. If i change to unit=2 all works OK like with 64bits.
This may look like small issue but still i strongly suggest to synchronize behavior of FTN95 with all other Fortran compilers by using with %cw unit=0 instead of unit=2. Plus allow WRITE(0,*) to be equivalent to WRITE(*,*).
Many people still use unit 0 for typing to the screen with regular Command Prompt windows. Would be good allowing usage of unit=0 for Command Prompt window (for those who still not use Clearwin+) also making WRITE(0,*) to produce the same output as WRITE(*,*) or PRINT* |
|
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
|