mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2025-12-05 18:30:24 -08:00
Merge branch 'ffi-foreign-types' into 'develop'
Draft: Allow usage of (ffi:def-foreign-type ... ) in function declaration See merge request embeddable-common-lisp/ecl!356
This commit is contained in:
commit
cfca1c3f60
1 changed files with 12 additions and 4 deletions
|
|
@ -38,12 +38,20 @@
|
||||||
(defun host-type-record (host-type)
|
(defun host-type-record (host-type)
|
||||||
(ext:if-let ((record (gethash host-type (machine-host-type-hash *machine*))))
|
(ext:if-let ((record (gethash host-type (machine-host-type-hash *machine*))))
|
||||||
record
|
record
|
||||||
(cmperr "Not a valid C type name ~A" host-type)))
|
(if ffi::*ffi-types*
|
||||||
|
(let ((ffi-type (gethash host-type ffi::*ffi-types*)))
|
||||||
|
(if ffi-type
|
||||||
|
(host-type-record ffi-type)
|
||||||
|
(cmperr "Not a valid FFI type name ~A" host-type)))
|
||||||
|
(cmperr "Not a valid C type name ~A" host-type))))
|
||||||
|
|
||||||
|
|
||||||
(defun host-type->lisp-type (name)
|
(defun host-type->lisp-type (name)
|
||||||
(let ((output (host-type-record-unsafe name)))
|
(let ((output (host-type-record-unsafe name))
|
||||||
(cond (output
|
(ffi-type (when ffi::*ffi-types*
|
||||||
(host-type-lisp-type output))
|
(gethash name ffi::*ffi-types*))))
|
||||||
|
(cond (output (host-type-lisp-type output))
|
||||||
|
(ffi-type (host-type->lisp-type ffi-type))
|
||||||
((lisp-type-p name) name)
|
((lisp-type-p name) name)
|
||||||
(t (error "Unknown representation type ~S" name)))))
|
(t (error "Unknown representation type ~S" name)))))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue