klisp

an open source interpreter for the Kernel Programming Language.
git clone http://git.hanabi.in/repos/klisp.git
Log | Files | Refs | README

commit e676b7c91217d1e8ebeb9504e1d31a7ab67004f6
parent 1d7655e7bd27a2d79687656faa47a161c3d51b70
Author: Oto Havle <havleoto@gmail.com>
Date:   Thu, 24 Nov 2011 23:36:09 +0100

Updated FFI.

Diffstat:
Msrc/examples/ffi-sdl.k | 6++----
Msrc/examples/ffi-signal.c | 15++++-----------
Msrc/kgffi.c | 8+-------
3 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/src/examples/ffi-sdl.k b/src/examples/ffi-sdl.k @@ -198,8 +198,6 @@ (#t (event-loop screen drawing)))))) -($define! main - ($lambda (argv) - (with-sdl "klisp ffi demo" - ($lambda (screen) (event-loop screen #f))))) +(with-sdl "klisp ffi demo" + ($lambda (screen) (event-loop screen #f))) diff --git a/src/examples/ffi-signal.c b/src/examples/ffi-signal.c @@ -29,12 +29,9 @@ static void handler(int signo) write(self_pipe[1], &message, 1); } -static void install_signal_handler(klisp_State *K, TValue *xparams, - TValue ptree, TValue denv) +static void install_signal_handler(klisp_State *K) { - UNUSED(xparams); - UNUSED(denv); - bind_1tp(K, ptree, "string", ttisstring, signame); + bind_1tp(K, K->next_value, "string", ttisstring, signame); int signo; if (!strcmp(kstring_buf(signame), "SIGINT")) { @@ -49,12 +46,8 @@ static void install_signal_handler(klisp_State *K, TValue *xparams, kapply_cc(K, KINERT); } -static void open_signal_port(klisp_State *K, TValue *xparams, - TValue ptree, TValue denv) +static void open_signal_port(klisp_State *K) { - UNUSED(xparams); - UNUSED(denv); - FILE *fw = fdopen(self_pipe[0], "r"); TValue filename = kstring_new_b_imm(K, "**SIGNAL**"); krooted_tvs_push(K, filename); @@ -65,7 +58,7 @@ static void open_signal_port(klisp_State *K, TValue *xparams, static void safe_add_applicative(klisp_State *K, TValue env, const char *name, - klisp_Ofunc fn) + klisp_CFunction fn) { TValue symbol = ksymbol_new(K, name, KNIL); krooted_tvs_push(K, symbol); diff --git a/src/kgffi.c b/src/kgffi.c @@ -868,13 +868,7 @@ static void ffi_callback_entry(ffi_cif *cif, void *ret, void **args, void *user_ TValue exit_guard = ffi_callback_guard(cb, do_ffi_callback_exit_guard); krooted_tvs_push(K, exit_guard); - /* TEMP: Construct dummy dynamic environment - * for guard_dynamic_extent. Currently, guard_dynamic_extent() - * stores the environment in the interceptor list. The reason - * is not clear, because guard_dynamic_extent() and all - * interceptors() are applicatives. - * - * TODO: investigate and fix */ + /* Construct fresh dynamic environment for the callback applicative. */ TValue denv = kmake_empty_environment(K); krooted_tvs_push(K, denv);