DEFENTRY can now wrap forms in no interrupt blocks

This commit is contained in:
Juan Jose Garcia Ripoll 2008-10-11 00:11:14 +02:00
parent 6bd1b30f5e
commit e578cc9aa8

View file

@ -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))))))