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

Diff of /redefines.lisp

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

revision 1 by rklochkov, Thu Feb 9 15:53:55 2012 UTC revision 8 by rklochkov, Sun Aug 12 17:36:30 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    
16  ;; make type string with :free for uniformity  (define-foreign-type cffi-keyword (freeable)
 (define-foreign-type cffi-string (freeable)  
17    ()    ()
18    (:actual-type :pointer)    (:simple-parser cffi-keyword)
19    (:simple-parser pstring))    (:actual-type :pointer))
20    
21  (defmethod translate-to-foreign ((value string) (type cffi-string))  (defmethod translate-to-foreign ((value symbol) (type cffi-keyword))
22    (values (foreign-string-alloc value) value))    (foreign-string-alloc (string-downcase value)))
23    
24  (defmethod free-ptr ((type cffi-string) ptr)  (defmethod translate-to-foreign ((value string) (type cffi-keyword))
25      (foreign-string-alloc value))
26    
27    (defmethod free-ptr ((type cffi-keyword) ptr)
28    (foreign-string-free ptr))    (foreign-string-free ptr))
29    
30  (defmethod translate-from-foreign (ptr (type cffi-string))  (define-foreign-type cffi-pathname (freeable)
31    (foreign-string-to-lisp ptr))    ()
32      (:simple-parser cffi-pathname)
33      (:actual-type :string))
34    
35    (defmethod translate-to-foreign ((value pathname) (type cffi-pathname))
36      (convert-to-foreign (namestring value) :string))
37    
38    (defmethod translate-to-foreign ((value string) (type cffi-pathname))
39      (convert-to-foreign value :string))
40    
41    
42    

Legend:
Removed from v.1  
changed lines
  Added in v.8

  ViewVC Help
Powered by ViewVC 1.1.5