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


|