From 28ff6225e11a09afe636e4fb002eeed3e1b5289b Mon Sep 17 00:00:00 2001 From: "Scott L. Burson" Date: Wed, 20 May 2026 16:28:08 -0700 Subject: [PATCH 1/2] Fix '&rest' handling --- src/iffi/function.lisp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/iffi/function.lisp b/src/iffi/function.lisp index f010817..667fbd4 100644 --- a/src/iffi/function.lisp +++ b/src/iffi/function.lisp @@ -124,7 +124,11 @@ (if (null param-config) doc (with-output-to-string (out) - (let ((*print-case* :downcase)) + (let ((*print-case* :downcase) + (rest-p nil)) + (when (eq (car (last param-config)) '&rest) + (setq param-config (butlast param-config)) + (setq rest-p t)) (format out "Adapted result: ") (prin1 return-type out) (format out "~&Adapted parameters:") @@ -133,7 +137,9 @@ (prin1 type out) (format out " ") (princ name out)) - (format out "~&~%~A" doc))))) + (when rest-p + (format out "~&...")) + (format out "~&~%~A" doc))))) (defmacro defifun (name-and-options return-type &body configuration) @@ -160,7 +166,7 @@ '(:const)) (loop for param in param-config if (eq param '&rest) - collect '&rest + collect ''&rest else collect (destructuring-bind (cffi-type @@ -178,8 +184,7 @@ (cffi:defcfun (,mangled ,cfun-name ,@(nreverse cffi-opts)) ,return-type ,@(when doc (list doc)) - ,@(loop for (param-name type) in param-config - collect `(,param-name ,type))) + ,@param-config) (meta-eval (setf (intricate-function ',name ,@signed-param-types) ',cfun-name)) ,@(when pointer-extractor From 3d11061afe78496444180ce44076753be3645234 Mon Sep 17 00:00:00 2001 From: "Scott L. Burson" Date: Thu, 13 Aug 2026 17:55:32 -0700 Subject: [PATCH 2/2] Untabify branch --- src/iffi/function.lisp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/iffi/function.lisp b/src/iffi/function.lisp index 667fbd4..3f1cf8b 100644 --- a/src/iffi/function.lisp +++ b/src/iffi/function.lisp @@ -125,10 +125,10 @@ doc (with-output-to-string (out) (let ((*print-case* :downcase) - (rest-p nil)) - (when (eq (car (last param-config)) '&rest) - (setq param-config (butlast param-config)) - (setq rest-p t)) + (rest-p nil)) + (when (eq (car (last param-config)) '&rest) + (setq param-config (butlast param-config)) + (setq rest-p t)) (format out "Adapted result: ") (prin1 return-type out) (format out "~&Adapted parameters:") @@ -138,8 +138,8 @@ (format out " ") (princ name out)) (when rest-p - (format out "~&...")) - (format out "~&~%~A" doc))))) + (format out "~&...")) + (format out "~&~%~A" doc))))) (defmacro defifun (name-and-options return-type &body configuration)