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 

Clearwin on Linux and Windows
Goto page Previous  1, 2
 
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: 2813
Location: South Pole, Antarctica

PostPosted: Wed Nov 02, 2022 6:24 am    Post subject: Reply with quote

Thanks Mecej4, this solution with as usually perfect guiding description finally works and resolves the major problems of initial start of new thing. You saved me from days of clueless attempts.

Thanks Paul for new video. Clearwin finally has signs of perfection i always wanted to see from the beginning. Visual Clearwin was good idea at that time but it did not get enough traction i think. Please keep broadening its usage. Today with most Fortran compilers, tomorrow hopefully also with other OS

By the way i read in the documentation (possibly i did not update it for a long time) that %cw usage with gFortran/Intel changed vs FTN95 but still i see the attempt to open the %cw text window and write something into it. Unfortunately text window did not work when i ran this code clearly made for other compilers i do not know where from it got into my computer: error messages - missing %cw related and Info related functions. Is this my gFortran installation bug/feature (Equations dot com 13beta) ?
Code:
    program aw
      use clrwin$
      integer i,c0,c1,c2
      integer(CW_HANDLE)::h1,h2,cwh1
      common h1,h2
      integer,external::child_func

      i=winio$('%pv%fr&',400,400)
      i=winio$('%ww[no_border]%ca[MDI frame]&')
      i=winio$('%mn[&Child]&',child_func)
      i=winio$('%lw',c0)

      i=winio$('%aw&',c0)
      i=winio$('%ww[no_border]%ca[First Child]&')
      i=winio$('%pv%30.3`cw[hscroll,vscroll]&',10,cwh1)
      i=winio$('%lw&',c1)
      i=winio$('%hw',h1)

      call set_max_lines$(cwh1,50)
      call cw_write$(10,'Hello there!')

      i=winio$('%aw&',c0)
      i=winio$('%ww[no_border]%ca[Second Child]&')
      i=winio$('%pv%gr[black,metafile_resize]&',200,200)
      i=winio$('%lw&',c2)
      i=winio$('%hw',h2)

      call draw_ellipse$(100,100,50,50,255)
    end

!--------------------------------------------
    integer function child_func()
      use clrwin$
      integer i
      integer(CW_HANDLE)::h,h1,h2
      integer hh
      common h1,h2
      h=clearwin_info$('FOCUS_WINDOW')
      hh=0
      if(h.eq.h1) hh=1
      if(h.eq.h2) hh=2
      if(hh.gt.0) then
        i=winio$('Window %wd is active %2nl%cn%`7bt[OK]',hh)
      endif
      child_func=1
    end
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Nov 02, 2022 11:09 am    Post subject: Reply with quote

%cw is not supported for third party compilers.

The documentation refers to an alternative that uses a call to cw_write$. This is incorrect.

For third party compilers %cw can be replaced by %re. Then you do an internal write (to a character variable str) and call EditWriteLn$(hwnd, str) where hwnd is obtained from %lc.
Back to top
View user's profile Send private message AIM Address
DanRRight



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

PostPosted: Thu Nov 03, 2022 3:49 am    Post subject: Reply with quote

To avoid confusion, i will post the error i got after downloading today Demo file (with newer clrwin.f95 and other library files)
Code:
Compiling file clrwin.f95 using gFortran.
Compilation completed with no errors.
Linking...
c:/users/rigt/gcc/bin/../lib/gcc/x86_64-w64-mingw32/13.0.0/../../../../x86_64-w64-mingw32/bin/ld.exe: c:/users/rigt/gcc/bin/../lib/gcc/x86_64-w64-mingw32/13.0.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text.startup+0x2e): undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status
Linking completed.


But that's possibly because this Fortran file above is kind of "defective" using %cw which does not work with third-party compilers (i'll repeat i do not know where i found this Fortran file with $ instead of @). Again, still compiling it in batch file outside Plato has no problems.

But the Demo1 project itself works now in Plato OK. The only little problem was that it did not load into Plato the file demo.f95 which i loaded separately after loading project from Demo1.zip archive.

Would be nice to add OpenGL to Demo1. I have a 3D game written in FTN95 (actually in FTN77 first versions) and OpenGL. May be needs a bit polishing but it works. Including it here would improve the Demo1 and the attractiveness of Clearwin
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Thu Nov 03, 2022 8:22 am    Post subject: Reply with quote

There are some OpenGL demo programs in the FTN95 samples which by default are located in C:\Users\UserName\OneDrive\Documents\FTN95 Examples\OpenGL.

There is also some code in ftn95.chm at FTN95>ClearWin+>OpenGL>The conversion of a Red Book example.
Back to top
View user's profile Send private message AIM Address
DanRRight



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

PostPosted: Fri Nov 04, 2022 5:32 am    Post subject: Reply with quote

Was the reason to remove %cw because of conflict of FTN95 with gFortran, iFort and basically all other compilers respect to where goes the default console print* - is it channel 0, or 1, or 2 or 6 etc?

Before %cw in FTN95 was using channel 0 for Print*. Now channel 2.

The %cw has a lot of flexibility and usability. You also can use any other channels, for example 155 or 43124 and you will just write there like this:

i=winio@('%100.25cw[hscroll,vscroll]&',155) - creates this window for all other such prints like this:

write(155,*) ...

Good about %cw is that 1) it has virtually unlimited buffer 2) you can change font, 3) font size, make it bolt, italic etc, 4) change window backgrounds and 5) i think you can even change color of output fonts. I do not even mention you can highlight and Ctrl+C and Ctrl+V the text from it and save if you need which workaround %re also can do. Typically, if you simulation works, it prints a lot of stuff as intermediate warnings and info etc and all that if goes into %cw instead of Command Prompt is not lost in %cw. Essentially the %cw is the same as Command Prompt window, but you can open 10 different %cw windows and write specific outputs you need there with no limit and all will be saved, while Command Prompt has small buffer you now can not find where to change in Windows Registry, and even if you increase it it is still very limited and often useless

Now i speculate (i need still to succeed to migrate and run my code with other fortrans which may take unknown time as i used tens of thousand lines of Clearwin text everywhere in the codes ) with this workaround %re instead of %cw we are getting a small buffer and additionally essentially losing the ability simply to Print* or write(155,*) Fortran standard way and return back to ancient ages with its black Command Prompt window for all your Print* outputs...Hope i am wrong.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Nov 04, 2022 8:01 am    Post subject: Reply with quote

%cw is still supported for FTN95. I accesses the FTN95 I/O library so it can't be used with third party compilers. For example, when you issue WRITE for gFortran you are accessing the gFortran I/O library which is not connected to %cw.

I think that you should be able to write large amounts of data using %re, at least for 64 bit applications. If you encounter problems then let me know and I will check this out.

As I recall, %cw also has a limit which is configurable.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Sun Nov 06, 2022 9:23 am    Post subject: Reply with quote

Third party support for %cw has been restored (in the next release of the DLLs) in the sense that %cw will be available via cw_write$ rather than WRITE.
Back to top
View user's profile Send private message AIM Address
DanRRight



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

PostPosted: Wed Nov 09, 2022 5:31 am    Post subject: Re: Reply with quote

PaulLaidler wrote:
There are some OpenGL demo programs in the FTN95 samples which by default are located in C:\Users\UserName\OneDrive\Documents\FTN95 Examples\OpenGL.

There is also some code in ftn95.chm at FTN95>ClearWin+>OpenGL>The conversion of a Red Book example.


Paul, The Help file warns about some potential changes which might be needed when calling OpenGL. So your adaptation of some Fortran OpenGL examples would help. As i wrote i have very compelling i think 3D plotting demos. The 3D became lately the major trend in numerical simulations specifically on supercomputers and of course in all current 3D games. I can send them to you and anyone. Some are relatively small files, and can be reduced more, and they also little bit use Clearwin.
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Mon Nov 14, 2022 1:36 pm    Post subject: Reply with quote

OK, how to compile Clearwin in batch and IDE Plato is clear. Now how to compile in BAT and Plato this simplest OpenGL demo with gFortran? It fails. With native FTN95 the compilation

> FTN95 ooo.f90 /64 /link

works fine both with /64 or without, and no matter with $ or @ without any changes
Code:
      PROGRAM Simple
!      INCLUDE <clearwin.ins>,nolist
!      INCLUDE <opengl.ins>,nolist
use clrwin$
use opengl$

REAL t1,t2
INTEGER i, ctrl

i=winio$('%es%ca[Simple OpengGL Sample]&')
i=winio$('%sp%ww[no_border]%pv%og[static]%lw', 0, 0, 500, 500, ctrl)

CALL glClearColor (0.0, 0.0, 0.0, 0.0)
CALL glClear(GL_COLOR_BUFFER_BIT)
CALL glColor3f(1.0, 1.0, 1.0)
CALL glMatrixMode(GL_PROJECTION)
CALL glLoadIdentity()
CALL glOrtho(-1d0, 1d0, -1d0, 1d0, -1d0, 1d0)
CALL glBegin(GL_POLYGON)     

CALL glColor3f(1.0,0.0,0.0)
CALL glVertex2f(-0.5, -0.5)
     
CALL glColor3f(0.0,1.0,0.0)
CALL glVertex2f(-0.5, 0.5)
 
CALL glColor3f(0.0,0.0,1.0)     
CALL glVertex2f( 0.5, 0.5)
 
CALL glColor3f(1.0,0.0,0.0)     
CALL glVertex2f( 0.5, -0.5)
CALL glEnd()
CALL glFlush()
    END
Back to top
View user's profile Send private message
DanRRight



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

PostPosted: Tue Nov 15, 2022 12:01 pm    Post subject: Reply with quote

And on a side note, since with FTN95 all works with @ and $ may be it's good idea to get rid of @ for the Clearwin codes to be universally compatible with all other external software and become future proof. The @ bugged me from the day one like some foreign for Fortran symbol, the sign of incompatibility
Back to top
View user's profile Send private message
simon



Joined: 05 Jul 2006
Posts: 268

PostPosted: Thu Dec 08, 2022 9:46 pm    Post subject: Reply with quote

How do we include cw_write@ (and presumably we need to use cw_write$)? Is it in clrwin$?

On a slightly separate issue, I have not been able to get %bm to work with other compilers. Is there anything I should be doing differently?
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Dec 09, 2022 8:33 am    Post subject: Reply with quote

Simon

Yes. Use clrwin$ and the form

call cw_write$(10,'Hello there!')

where 10 is the Fortran unit number used with %cw.

So normally you will do a internal WRITE to a CHARACTER variable followed by a call to cw_write$.

But note that %cw was disabled by mistake (for third party compilers) in a recent version of the library. So you may need use a different version of the DLLs.

Please provide a sample for %bm and say which compiler you used.
Back to top
View user's profile Send private message AIM Address
simon



Joined: 05 Jul 2006
Posts: 268

PostPosted: Fri Dec 09, 2022 6:33 pm    Post subject: Reply with quote

Hi Paul,

I understand that %cw will soon be restored - if so, then I will wait for the new release.

My bitmap example is not working with NAGWare. Here is a simple example, which works as expected using FTN95:

Code:
Program p
   Use clrwin$
   Integer :: iw
!
   iw = winio$ ('%za&')
   iw = winio$ ('%bm[exampleBitmap]&')
   iw = winio$ ('%zz')
End Program p


and my resource file looks like this:

Code:
exampleBitmap BITMAP exampleBitmap.bmp


The error message I get is:
Quote:
Bitmap exampleBitmap is not available as a resource
Back to top
View user's profile Send private message
simon



Joined: 05 Jul 2006
Posts: 268

PostPosted: Tue Dec 13, 2022 10:04 pm    Post subject: Reply with quote

The curly-brackets solution you mentioned here:
http://forums.silverfrost.com/viewtopic.php?t=4715
solves this bitmap problem. Evidently something is not working with the resource script file, but that is no longer an issue I need to resolve for now.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Wed Dec 14, 2022 8:24 am    Post subject: Reply with quote

Simon

I have not tried using ClearWin+ with NAGWare so I don't know which resource compiler they use. It might be the same one as for GFortran which works OK for me. As I recall, you need to use the resource compiler to create a .res file from the .rc script and then link the .res file with the other object code using the native linker.
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
Goto page Previous  1, 2
Page 2 of 2

 
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