/[cffi-objects]/redefines.lisp
ViewVC logotype

Diff of /redefines.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 7 by rklochkov, Thu Aug 9 16:55:23 2012 UTC revision 9 by rklochkov, Fri Aug 24 19:26:53 2012 UTC
# Line 13  Line 13 
13        `(let ((,var (coerce ,value 'double-float))) ,@body)        `(let ((,var (coerce ,value 'double-float))) ,@body)
14        `(let ((,var ,value)) ,@body)))        `(let ((,var ,value)) ,@body)))
15    
 ;; make type string with :free for uniformity  
 (define-foreign-type cffi-string (freeable)  
   ()  
   (:actual-type :pointer)  
   (:simple-parser pstring))  
   
 (defmethod translate-to-foreign ((value string) (type cffi-string))  
   (values (foreign-string-alloc value) value))  
   
 (defmethod translate-to-foreign (value (type cffi-string))  
   (values (foreign-string-alloc (string value)) value))  
   
 (defmethod free-ptr ((type cffi-string) ptr)  
   (foreign-string-free ptr))  
   
 (defmethod translate-from-foreign (ptr (type cffi-string))  
   (foreign-string-to-lisp ptr))  
   
16  (define-foreign-type cffi-keyword (freeable)  (define-foreign-type cffi-keyword (freeable)
17    ()    ()
18    (:simple-parser cffi-keyword)    (:simple-parser cffi-keyword)
19    (:actual-type :string))    (:actual-type :pointer))
20    
21  (defmethod translate-to-foreign ((value symbol) (type cffi-keyword))  (defmethod translate-to-foreign ((value symbol) (type cffi-keyword))
22    (convert-to-foreign (string-downcase value) :string))    (foreign-string-alloc (string-downcase value)))
23    
24  (defmethod translate-to-foreign ((value string) (type cffi-keyword))  (defmethod translate-to-foreign ((value string) (type cffi-keyword))
25    (convert-to-foreign value :string))    (foreign-string-alloc value))
26    
27    (defmethod free-ptr ((type (eql 'cffi-keyword)) ptr)
28      (foreign-string-free ptr))
29    
30  (define-foreign-type cffi-pathname (freeable)  (define-foreign-type cffi-pathname (freeable)
31    ()    ()

Legend:
Removed from v.7  
changed lines
  Added in v.9

  ViewVC Help
Powered by ViewVC 1.1.5