X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=src%2Ffunctions.lisp;h=ea87b2e3d8f112664463d8ec18052234b3e9ffea;hb=944a7d156be31efb1c01b9dfc49a5661a825eced;hp=5210f0a22a2ec41a8e51839ee85b9fff8a19a212;hpb=c6c305a69913c148753813cc057be7127017ae6a;p=uffi.git diff --git a/src/functions.lisp b/src/functions.lisp index 5210f0a..ea87b2e 100644 --- a/src/functions.lisp +++ b/src/functions.lisp @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Feb 2002 ;;;; -;;;; $Id: functions.lisp,v 1.3 2002/10/14 01:51:15 kevin Exp $ +;;;; $Id: functions.lisp,v 1.6 2002/11/20 21:01:31 kevin Exp $ ;;;; ;;;; This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -21,40 +21,41 @@ (defun process-function-args (args) (if (null args) - #+(or lispworks cmu sbcl cormanlisp (and mcl (not openmcl))) nil + #+(or lispworks cmu sbcl scl cormanlisp (and mcl (not openmcl))) nil #+allegro '(:void) - #+mcl (values nil nil) + #+openmcl (values nil nil) ;; args not null - #+(or lispworks allegro cmu sbcl (and mcl (not openmcl)) cormanlisp) + #+(or lispworks allegro cmu sbcl scl (and mcl (not openmcl)) cormanlisp) (let (processed) (dolist (arg args) (push (process-one-function-arg arg) processed)) (nreverse processed)) #+openmcl (let ((processed nil) - (params nil) - name type) + (params nil)) (dolist (arg args) - (setf name (car arg)) - (setf type (convert-from-uffi-type (cadr arg) :routine)) - ;;(when (and (listp type) (eq (car type) :address)) - ;;(setf type :address)) - (push name params) - (push type processed) - (push name processed)) + (let ((name (car arg)) + (type (convert-from-uffi-type (cadr arg) :routine))) + ;;(when (and (listp type) (eq (car type) :address)) + ;;(setf type :address)) + (push name params) + (push type processed) + (push name processed))) (values (nreverse params) (nreverse processed))) )) (defun process-one-function-arg (arg) (let ((name (car arg)) (type (convert-from-uffi-type (cadr arg) :routine))) - #+(or cmu sbcl) + #+(or cmu sbcl scl) (list name type :in) #+(or allegro lispworks (and mcl (not openmcl))) (if (and (listp type) (listp (car type))) (append (list name) type) (list name type)) + #+openmcl + (declare (ignore name type)) )) @@ -66,7 +67,7 @@ ;; name is either a string representing foreign name, or a list ;; of foreign-name as a string and lisp name as a symbol (defmacro def-function (names args &key module returning) - #+(or cmu sbcl allegro mcl cormanlisp) (declare (ignore module)) + #+(or cmu sbcl scl allegro mcl cormanlisp) (declare (ignore module)) (let* ((result-type (convert-from-uffi-type returning :return)) (function-args (process-function-args args)) @@ -80,12 +81,12 @@ :returning ,(allegro-convert-return-type result-type) :call-direct t :strings-convert nil) - #+cmu + #+(or cmu scl) `(alien:def-alien-routine (,foreign-name ,lisp-name) ,result-type ,@function-args) #+sbcl - `(sb-alien:def-alien-routine (,foreign-name ,lisp-name) + `(sb-alien:define-alien-routine (,foreign-name ,lisp-name) ,result-type ,@function-args) #+lispworks @@ -99,6 +100,8 @@ (ccl:define-entry-point (,lisp-name ,foreign-name) ,function-args ,result-type)) + #+openmcl + (declare (ignore function-args)) #+(and openmcl darwinppc-target) (setf foreign-name (concatenate 'string "_" foreign-name)) #+openmcl