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 

Difference in handling of %cw across compilers

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
Ryan



Joined: 25 Feb 2016
Posts: 110

PostPosted: Mon Feb 26, 2018 10:23 pm    Post subject: Difference in handling of %cw across compilers Reply with quote

The ClearWin code below behaves differently on two different compilers (ftn95 and gfortran). The ftn95 version works as expected (a new window is created for the initial prints / writes and the MDI child window captures subsequent writes).

Under gfortran, the prints / writes do not go anywhere. I can live without the first few prints creating a window, it is the %cw functionality I am trying to get working in a much larger programme. Unit 6 is stdout, but 120 has been tried as well with the same results on both.

They are both compiled using 64 bit ClearWin.

Code:

 PROGRAM main
      use clrwin$
      INTEGER*8 win, subwin
      integer winctrl

      print *, 'Output via print to default'
      WRITE (*,'(//''Output via write to default'')')

      i=winio$('%ww[no_border]&')
      i=winio$('%pv%fr&',400,300)
      i=winio$('%lw&',winctrl)
      i=winio$('%hw',win)

      i=winio$('%ww[no_border,no_maxbox]&')
      i=winio$('%ca[win caption]&')
      i=winio$('%aw&',winctrl)
      i=winio$('%pv%53.10cw[hscroll,vscroll]&',6)
      i=winio$('%hw',subwin)
     
      WRITE (*,'(//''Output to default via write - 2'')')
      WRITE (6,'(//''Redirected output to stdout/win via write'')')
     
      print *, 'win', win
      print *, 'subwin', subwin
     
 END



My question is, am I doing something wrong or is I/O redirection handled differently under non silverfrost compilers?

Apologies for the spammy looking image links.

The Ftn95 version looks like this when run;
[img]https://1drv.ms/u/s!AukE8rFa04Mei80MmsJQ04O1-dJXuw[/img]

The gfortran version looks like this;
[img]https://1drv.ms/u/s!AukE8rFa04Mei80NeHq_Rq57xmghLQ[/img]

The source code can be downloaded from:
https://1drv.ms/u/s!AukE8rFa04Mei80OKkVDq9RtEtL-eQ

I can share the compiler arguments if needed.

Regards

Ryan[/code][/b]
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Tue Feb 27, 2018 9:17 am    Post subject: Reply with quote

Ryan

%cw will only work with Silverfrost compilers. You could try using %re or %eb but off-hand I don't know the easiest way to append new lines.
Back to top
View user's profile Send private message AIM Address
Ryan



Joined: 25 Feb 2016
Posts: 110

PostPosted: Thu Mar 08, 2018 2:40 pm    Post subject: Reply with quote

Understood. As a test I am trying to get %eb to work in Silverfrost 64 bit and I'm failing.

Similar to the above issue, the redirected output disappears but does not turn up in the edit buffer. This is for a Silverfrost executable. Compiling for gfortran yields a runtime error of 'Argument number 2 of WINIO@ (continuation 5) should be a 64 bit integer'.

The %lc call seems to be working (on silverfrost) and grabs the window handle of the edit buffer (confirmed with spyxx.exe).

Code:
PROGRAM main
      use clrwin$
      integer(kind=CW_HANDLE) win, subwin, editHandle
      integer winctrl
      INTEGER UNIT_STDOUT
      PARAMETER (UNIT_STDOUT =6)
      CHARACTER*1000 buffer

      print *, 'Output via print to default'
      WRITE (*,'(//''Output via write to default'')')

      i=winio$('%ww[no_border]&')
      i=winio$('%pv%fr&',400,300)
      i=winio$('%lw&',winctrl)
      i=winio$('%hw',win)

      i=winio$('%ww[no_border,no_maxbox]&')
      i=winio$('%ca[win caption]&')
      i=winio$('%aw&',winctrl)
      i=winio$('%pv%fr&',300,200)
      i=winio$('%53.10eb&',buffer,1000)
      i=winio$('%lc&',editHandle)
      i=winio$('%hw',subwin)

      call open_to_window$(UNIT_STDOUT,editHandle)

      WRITE (*,'(//''Output to default via write - 2'')')
      WRITE (6,'(//''Redirected output to stdout/win via write'')')
     
      print *, 'win', win
      print *, 'subwin', subwin
      print *, 'editHandle', editHandle
     
 END
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Mar 08, 2018 3:09 pm    Post subject: Reply with quote

open_to_window$ is not related to %eb.

You could try writing to a string (internal WRITE) and then calling INSERT_EDIT_STRING@.
Back to top
View user's profile Send private message AIM Address
Ryan



Joined: 25 Feb 2016
Posts: 110

PostPosted: Thu Mar 08, 2018 6:51 pm    Post subject: Reply with quote

My thinking on this was that %eb produced a standard Windows control from which I could get the handle and pass to open_to_window$ which accepts a standard windows handle.

Obviously there is something else going on there.
Back to top
View user's profile Send private message
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