projects
/
uffi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r10124: revert change for openmcl that broke clsql
[uffi.git]
/
src
/
strings.lisp
diff --git
a/src/strings.lisp
b/src/strings.lisp
index 6e7292cff8e8e89ea4f3a2f4b0a2dc8fb91fe996..c63d943e2c8e3496fb89056de87df03bb722bab1 100644
(file)
--- a/
src/strings.lisp
+++ b/
src/strings.lisp
@@
-157,10
+157,11
@@
that LW/CMU automatically converts strings from c-calls."
nil
(if (eq ,locale :none)
(fast-native-to-string ,obj ,length)
nil
(if (eq ,locale :none)
(fast-native-to-string ,obj ,length)
- (excl:native-to-string
- ,obj
- ,@(when length (list :length length))
- :truncate (not ,null-terminated-p))))
+ (values
+ (excl:native-to-string
+ ,obj
+ ,@(when length (list :length length))
+ :truncate (not ,null-terminated-p)))))
#+lispworks
`(if (fli:null-pointer-p ,obj)
nil
#+lispworks
`(if (fli:null-pointer-p ,obj)
nil
@@
-188,7
+189,10
@@
that LW/CMU automatically converts strings from c-calls."
#+mcl
`(if (ccl:%null-ptr-p ,obj)
nil
#+mcl
`(if (ccl:%null-ptr-p ,obj)
nil
- (ccl:%get-cstring ,obj 0 ,@(if length (list length) nil)))
+ #+(and mcl (not openmcl)) (ccl:%get-cstring ,obj 0 ,@(if length (list length) nil))
+ #+openmcl ,@(if length
+ `((ccl:%str-from-ptr ,obj ,length))
+ `((ccl:%get-cstring ,obj))))
)
)
@@
-318,10
+322,10
@@
that LW/CMU automatically converts strings from c-calls."
(* length sb-vm:n-byte-bits))
result)))
(* length sb-vm:n-byte-bits))
result)))
-
-(def-function "strlen"
- ((str (* :unsigned-char)))
-
:returning :unsigned-int
)
+(eval-when (:compile-toplevel :load-toplevel :execute)
+
(def-function "strlen"
+
((str (* :unsigned-char)))
+
:returning :unsigned-int)
)
(def-type char-ptr-def (* :unsigned-char))
(def-type char-ptr-def (* :unsigned-char))
@@
-344,4
+348,4
@@
that LW/CMU automatically converts strings from c-calls."
(let* ((len (or len (strlen s)))
(str (make-string len)))
(dotimes (i len str)
(let* ((len (or len (strlen s)))
(str (make-string len)))
(dotimes (i len str)
- (setf (schar str i) (code-char (uffi:deref-array s '(:array :byte) i))))))
+ (setf (schar str i) (code-char (uffi:deref-array s '(:array :
unsigned-
byte) i))))))