[cffi-objects-cvs] r6 -
rklochkov at common-lisp.net
rklochkov at common-lisp.net
Sun Jul 29 16:11:18 UTC 2012
Author: rklochkov
Date: Sun Jul 29 09:11:18 2012
New Revision: 6
Log:
Added cffi-keyword and cffi-pathname
Modified:
package.lisp
redefines.lisp
Modified: package.lisp
==============================================================================
--- package.lisp Sun Jul 29 08:15:41 2012 (r5)
+++ package.lisp Sun Jul 29 09:11:18 2012 (r6)
@@ -45,6 +45,9 @@
#:null-array
#:string-array
+ #:cffi-keyword
+ #:cffi-pathname
+
#:struct
; #:cffi-struct
#:new-struct
Modified: redefines.lisp
==============================================================================
--- redefines.lisp Sun Jul 29 08:15:41 2012 (r5)
+++ redefines.lisp Sun Jul 29 09:11:18 2012 (r6)
@@ -31,3 +31,27 @@
(defmethod translate-from-foreign (ptr (type cffi-string))
(foreign-string-to-lisp ptr))
+(define-foreign-type cffi-keyword ()
+ ()
+ (:simple-parser cffi-keyword)
+ (:actual-type :string))
+
+(defmethod translate-to-foreign ((value symbol) (type cffi-keyword))
+ (convert-to-foreign (string-downcase value) :string))
+
+(defmethod translate-to-foreign ((value string) (type cffi-keyword))
+ (convert-to-foreign value :string))
+
+(define-foreign-type cffi-pathname ()
+ ()
+ (:simple-parser cffi-pathname)
+ (:actual-type :string))
+
+(defmethod translate-to-foreign ((value pathname) (type cffi-pathname))
+ (convert-to-foreign (namestring value) :string))
+
+(defmethod translate-to-foreign ((value string) (type cffi-pathname))
+ (convert-to-foreign value :string))
+
+
+
More information about the cffi-objects-cvs
mailing list