Allow usage of (ffi:def-foreign-type ... )

Signed-off-by: Dmitry Solomennikov <dmitrys99@mail.ru>
This commit is contained in:
Dmitry Solomennikov 2025-08-14 15:31:13 +03:00
parent bebb43d558
commit bb3f48af4e

View file

@ -38,12 +38,20 @@
(defun host-type-record (host-type)
(ext:if-let ((record (gethash host-type (machine-host-type-hash *machine*))))
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)
(let ((output (host-type-record-unsafe name)))
(cond (output
(host-type-lisp-type output))
(let ((output (host-type-record-unsafe name))
(ffi-type (when ffi::*ffi-types*
(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)
(t (error "Unknown representation type ~S" name)))))