Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Forth > Re: libffg2: gf...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 9 Topic 3683 of 4325
Post > Topic >>

Re: libffg2: gforth interface for g2 library

by Roelf Toxopeus <these3rt0only@[EMAIL PROTECTED] > Jan 8, 2008 at 12:14 AM

In article <2008010709050816807-druffer@[EMAIL PROTECTED]
>,
 Dennis Ruffer <druffer@[EMAIL PROTECTED]
> wrote:

> On 2008-01-07 00:11:14 -0700, Robert Spykerman 
> <robert.spykerman@[EMAIL PROTECTED]
> said:
> > For that matter if there are any good examples on how to extend
> > gforth, call c, or cobble a GUI onto it under linux. Cheers
> 
> Robert,
> 
> There are many examples of calling external libraries from gforth, a 
> few even in the distribution itself.  Look at the Unix subdirectory for 
> time.fs and see if you can load that.  You may have to also load the 
> lib.fs sup****t and you may need to point it to the correct library on 
> your system.
> 
> Here's some simple code that works on OSX:
> 
> [IFUNDEF] library require lib.fs [THEN]
> 
> library libc /usr/lib/libc.dylib 
> 
> 1 (int) libc sleep sleep  
> 
> 10 sleep . cr
> 
> 
> The GUI side of your question gets to be a little more complex.  There 
> used to be an example from Jorge Acereda Maci· 
> <jacereda@[EMAIL PROTECTED]
> that implemented a GLUT interface in 
> gforth, but I can't find it at the moment.  Perhaps Jorge is listening 
> or maybe Anton knows where it is.  I tried doing some cross platform 
> stuff in OpenGL a while ago, but ran into issues with SwiftForth that I 
> couldn't resolve.  I don't have Linux setup, but I do have a pretty 
> good handle on the gforth calls in OSX.  I could come up with some 
> example code if you don't find anything else.
> 
> DaR

Hello Dennis,

That sounds very interesting!
I have tried some tihings wrt OSX, but failed:

needs fflib.fs
library sys /system/library/frameworks/system.framework/system
library carbon /system/library/frameworks/carbon.framework/carbon

\ windows:
carbon _CreateNewWindow int int ptr ptr (int) CreateNewWindow
carbon _ShowWindow ptr (void) ShowWindow

6 constant standard-window
302514207 constant some-attributes   \ standardhandler, composite, etc

variable winref winref off
create winrec 2 cells allot
100 dup 16 l****ft or winrec !           \ top left
200 dup 16 l****ft or winrec cell+ !   \ bottom right
standard-window some-attributes winrec winref _CreateNewWindow drop
winref @[EMAIL PROTECTED]
 _ShowWindow

\ eventhandler:
carbon _GetWindowEventTarget int (int) GetWindowEventTarget
carbon _InstallStandardEventHandler int (int) InstallStandardEventHandler

winref @[EMAIL PROTECTED]
 _GetWindowEventTarget _InstallStandardEventHandler drop

\  ----

Ok, I get the window displayed, but I can't do anything with it.
The window doesn't react to any mouse actions apart from the spinning
beachball. Naively I expect the OS taking care of it because of the 
installed standard handler.
Actually I can have it react by executing RunApplicationEventLoop, but
that stops interacting with gForth.
What should I have done instead? Any ideas, pointers, examples highly 
appreciated.

regards
Roelf

-- 
Posted via a free Usenet account from http://www.teranews.com
 




 9 Posts in Topic:
libffg2: gforth interface for g2 library
Robert Spykerman <robe  2008-01-06 23:11:14 
Re: libffg2: gforth interface for g2 library
Dennis Ruffer <druffer  2008-01-07 16:05:21 
Re: libffg2: gforth interface for g2 library
Coos Haak <chforth@[EM  2008-01-08 18:02:42 
Re: libffg2: gforth interface for g2 library
Dennis Ruffer <druffer  2008-01-09 16:58:41 
Re: libffg2: gforth interface for g2 library
Roelf Toxopeus <these3  2008-01-08 00:14:53 
Re: libffg2: gforth interface for g2 library
Robert Spykerman <robe  2008-01-07 18:45:19 
Re: libffg2: gforth interface for g2 library
astrobe <fdubois76@[EM  2008-01-09 09:24:41 
Re: libffg2: gforth interface for g2 library
Josh Grams <josh@[EMAI  2008-01-09 10:44:04 
Re: libffg2: gforth interface for g2 library
Robert Spykerman <robe  2008-01-09 22:28:28 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 14:15:01 CST 2008.