I found this for GForth and tried it.  I got it to work (with Gforth 
anyway).
http://www.shockfamily.net/cedric/fflib.html

I, too, would like this implemented in Bigforth.  I haven't examined the 
differences and difficulties.

Regards,
Ed Tannenbaum



----- Original Message ----- 
From: "Sergey Plis" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, January 08, 2007 10:06 PM
Subject: Re: [bigforth] callbacks in bigforth


| Good job! I am not able to do anything like that due to lack of expertise 
in
| assembly language and lack of time to figure that out. However I have 
found
| that reva forth (http://ronware.org/reva/) and retroforth
| (http://www.retroforth.org/) have implemented the callbacks. Reva code for
| the callbacks looks like:
|
| variable cb-param-base
| : cb-param ( n -- m ) 1+ cells cb-param-base @ + @ ;
| : cb-setup (s0) @ >rr sp cell+ cell+ (s0) !   cb-param-base xchg >rr ;
| : cb-teardown rr> rr> (s0) ! cb-param-base ! ;
|
| : cb: ( xt stacksize <name> -- )
| cells allot | save that many bytes out of 'here'
| here cell-
| | ( xt newstack <name> -- )
| | now, create the callback entity:
| header
| | fill in "stuff":
| $e089 2, | mov eax, esp  -- use TOS as the offset
| $50 1, | push eax  -- temporary area for returned EAX
| $60 1, | pusha ( pushed eight registers on-stack )
| $be 1,  | mov esi, imm32
| , | 'here' which was beginning of our stack
| ['] cb-setup compile
| | ( xt -- )
| $bb 1, , | mov ebx, imm32 (xt)
| $d3ff 2, | call dword ebx
| ['] cb-teardown compile
| $20244489 , | mov [esp+32], eax | save till after popa
| $61 1,  | popa
| $58 1, | pop eax -- get EAX result
| $c3 1, | ret
| ;
|
| and is used as:
| ::    ( buttonptr -- )  0 cb-param ['] blocks setpat  ; 20 cb: blocks-cb
|
| but you can find the details in the corresponding code trees of those 
forths
|
| It would be great if one could figure out how to translate it to bigforth.
| I've failed so far to make it working :(
|
|
|
| On Monday 18 December 2006 18:29, Don Venhaus wrote:
| > Also, I'm not sure how to
| > return a value.
|
| -- 
| Sergey
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: [EMAIL PROTECTED]
| For additional commands, e-mail: [EMAIL PROTECTED]
|
| 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to