From e578cc9aa823e11cd30dac3d238c3c3f49eeb464 Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Sat, 11 Oct 2008 00:11:14 +0200 Subject: [PATCH] DEFENTRY can now wrap forms in no interrupt blocks --- src/lsp/ffi.lsp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/lsp/ffi.lsp b/src/lsp/ffi.lsp index 50239cb4a..70e280d57 100644 --- a/src/lsp/ffi.lsp +++ b/src/lsp/ffi.lsp @@ -733,7 +733,7 @@ defined Lisp function and VALUE-TYPE is its the return type." (c-inline ,args ,arg-types ,result-type ,C-expr :one-liner t)))) -(defmacro defentry (name arg-types c-name) +(defmacro defentry (name arg-types c-name &key no-interrupts) "Syntax: (defentry symbol ({arg-type}*) (value-type function-name)) The compiler defines a Lisp function named by SYMBOL whose body consists of a @@ -746,9 +746,15 @@ CHAR, CHAR*, FLOAT, DOUBLE are allowed for these types." (if (consp c-name) (setf output-type (first c-name) c-name (second c-name))) - (setf c-name (string c-name)) - `(defun ,name ,args - (c-inline ,args ,arg-types ,output-type - ,(produce-function-call c-name (length arg-types)) - :one-liner t)))) + (let* ((call (produce-function-call (string c-name) (length arg-types))) + (full-text (if no-interrupts + (concatenate 'string + "ecl_disable_interrupts();@(return)=" + call + ";ecl_enable_interrupts();") + call))) + `(defun ,name ,args + (c-inline ,args ,arg-types ,output-type + ,full-text + :one-liner ,(not no-interrupts))))))