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:
Dmitry Solomennikov 2025-11-25 14:49:41 +00:00
commit eee3007827

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