From: Kevin Rosenberg Date: Thu, 11 Feb 2010 21:27:35 +0000 (-0700) Subject: Version 1.8.6: Standardize on :encoding keyword X-Git-Tag: v1.8.6^0 X-Git-Url: http://git.kpe.io/?p=uffi.git;a=commitdiff_plain;h=e6419ce97079be93787ea6b57a239be60ad9beca Version 1.8.6: Standardize on :encoding keyword --- diff --git a/ChangeLog b/ChangeLog index 326b8b9..109b613 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-02-11 Kevin Rosenberg + * Version 1.8.6 + * src/strings.lisp: Standards on :encoding keyword + parameter + 2010-02-08 Kevin Rosenberg * Version 1.8.5 * src/primitives.lisp: Fix for long-long patch diff --git a/debian/changelog b/debian/changelog index c8446a6..d503c7e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +cl-uffi (1.8.6-1) unstable; urgency=low + + * New upstream + + -- Kevin M. Rosenberg Thu, 11 Feb 2010 13:05:40 -0700 + cl-uffi (1.8.5-1) unstable; urgency=low * New upstream diff --git a/src/strings.lisp b/src/strings.lisp index fc7a282..f6c6d9f 100644 --- a/src/strings.lisp +++ b/src/strings.lisp @@ -99,8 +99,8 @@ that LW/CMU automatically converts strings from c-calls." ;;; Foreign string functions -(defun %convert-to-foreign-string (str foreign-encoding) - (declare (ignorable str foreign-encoding)) +(defun %convert-to-foreign-string (str encoding) + (declare (ignorable str encoding)) #+(or cmu scl) (etypecase str (null @@ -144,7 +144,7 @@ that LW/CMU automatically converts strings from c-calls." (string (locally (declare (optimize (speed 3) (safety 0))) - (let* ((fe (or foreign-encoding *default-foreign-encoding*)) + (let* ((fe (or encoding *default-foreign-encoding*)) (ife (when fe (lookup-foreign-encoding fe)))) (if ife (let* ((octets (sb-ext:string-to-octets str :external-format ife)) @@ -176,7 +176,7 @@ that LW/CMU automatically converts strings from c-calls." +null-cstring-pointer+ (locally (declare (optimize (speed 3) (safety 0))) - (let* ((fe (or foreign-encoding *default-foreign-encoding*)) + (let* ((fe (or encoding *default-foreign-encoding*)) (ife (when fe (lookup-foreign-encoding fe)))) (if ife (let* ((octets (ccl:encode-string-to-octets str :external-format ife)) @@ -205,14 +205,14 @@ that LW/CMU automatically converts strings from c-calls." nil ) -(defmacro convert-to-foreign-string (obj &optional foreign-encoding) - (declare (ignorable foreign-encoding)) +(defmacro convert-to-foreign-string (obj &optional encoding) + (declare (ignorable encoding)) #+allegro (let ((stored (gensym "STR-")) (fe (gensym "FE-")) (ife (gensym "IFE-"))) `(let* ((,stored ,obj) - (,fe (or foreign-encoding *default-foreign-encoding*)) + (,fe (or encoding *default-foreign-encoding*)) (,ife (when ,fe (lookup-foreign-encoding ,fe)))) (cond @@ -228,7 +228,7 @@ that LW/CMU automatically converts strings from c-calls." (fe (gensym "EF-")) (ife (gensym "NEF-"))) `(let* ((,stored ,obj) - (,fe (or ,foreign-encoding *default-foreign-encoding*)) + (,fe (or ,encoding *default-foreign-encoding*)) (,ife (when ,fe (lookup-foreign-encoding ,fe)))) (cond @@ -241,16 +241,16 @@ that LW/CMU automatically converts strings from c-calls." #+(or cmu scl sbcl digitool openmcl) `(%convert-to-foreign-string ,obj (lookup-foreign-encoding - (or ,foreign-encoding *default-foreign-encoding*))) + (or ,encoding *default-foreign-encoding*))) ) ;; Either length or null-terminated-p must be non-nil (defmacro convert-from-foreign-string (obj &key length - foreign-encoding + encoding (null-terminated-p t)) - (declare (ignorable length foreign-encoding null-terminated-p)) + (declare (ignorable length encoding null-terminated-p)) #+allegro (let ((stored-obj (gensym "STR-")) (fe (gensym "FE-")) @@ -258,7 +258,7 @@ that LW/CMU automatically converts strings from c-calls." `(let ((,stored-obj ,obj)) (if (zerop ,stored-obj) nil - (let* ((,fe (or ,foreign-encoding *default-foreign-encoding*)) + (let* ((,fe (or ,encoding *default-foreign-encoding*)) (,ife (when ,fe (lookup-foreign-encoding ,fe)))) (if ,ife (values @@ -289,7 +289,7 @@ that LW/CMU automatically converts strings from c-calls." `(let ((,stored-obj ,obj)) (if (fli:null-pointer-p ,stored-obj) nil - (let* ((,fe (or ,foreign-encoding *default-foreign-encoding*)) + (let* ((,fe (or ,encoding *default-foreign-encoding*)) (,ife (when ,fe (lookup-foreign-encoding ,fe)))) (if ,ife (fli:convert-from-foreign-string @@ -324,7 +324,7 @@ that LW/CMU automatically converts strings from c-calls." `(let ((,stored-obj ,obj)) (if (null-pointer-p ,stored-obj) nil - (let* ((,fe (or ,foreign-encoding *default-foreign-encoding*)) + (let* ((,fe (or ,encoding *default-foreign-encoding*)) (,ife (when ,fe (lookup-foreign-encoding ,fe)))) (sb-alien::c-string-to-string (sb-alien:alien-sap ,stored-obj) (or ,ife sb-impl::*default-external-format* :latin-1) @@ -341,7 +341,7 @@ that LW/CMU automatically converts strings from c-calls." ,stored-obj 0 ,@(if length (list length) nil)) #+openmcl - (let ((,fe (or ,foreign-encoding *default-foreign-encoding*))) + (let ((,fe (or ,encoding *default-foreign-encoding*))) (case ,fe (:utf-8 (ccl::%get-utf-8-cstring ,stored-obj)) @@ -397,11 +397,11 @@ that LW/CMU automatically converts strings from c-calls." finally return size)) -(defmacro with-foreign-string ((foreign-string lisp-string &optional foreign-encoding) +(defmacro with-foreign-string ((foreign-string lisp-string &optional encoding) &body body) (let ((result (gensym)) (fe (gensym))) - `(let* ((,fe ,foreign-encoding) + `(let* ((,fe ,encoding) (,foreign-string (convert-to-foreign-string ,lisp-string ,fe)) (,result (progn ,@body))) (declare (dynamic-extent ,foreign-string))