--- gforth/fflib.fs 2003/08/16 19:46:11 1.2 +++ gforth/fflib.fs 2003/08/16 21:09:47 1.3 @@ -142,7 +142,7 @@ Variable callbacks Create 0 ] postpone >r also cb-decl DOES> Create here >r 0 , callbacks @ A, r@ callbacks ! - swap postpone Literal compile, postpone EXIT + swap postpone Literal postpone call , postpone EXIT r> dup cell+ cell+ alloc-callback swap ! DOES> @ ; @@ -198,8 +198,24 @@ library libm /lib/libm.so.6 libm fmodf sf sf (sf) fmodf libm fmod df df (fp) fmod +\ example for a windows callback + callback wincall (int) int int int int callback; :noname ( a b c d -- e ) 2drop 2drop 0 ; wincall do_timer - + +\ test a callback + +callback 2:1 (int) int int callback; + +: cb-test ( a b -- c ) + cr ." Testing callback" + cr ." arguments: " .s + cr ." result " + .s cr ; +' cb-test 2:1 c_plus + +: test c_plus av-start-int av-int av-int av-call-int ; + +\ 3 4 test + [then]