[cffi-devel] LispWorks 5.0/5.1 and LONG-LONG support

Chun Tian (binghe) binghe.lisp at gmail.com
Sun Apr 6 15:41:27 UTC 2008


Hi, Oliveira

> 2008/4/6 Chun Tian (binghe) <binghe.lisp at gmail.com>:
>> LWL64  5.0:
>>
>> Cannot compile tests/foreign-globals.lisp, seems in somewhere the
>> FLI:FORIEGN-TYPED-AREF been called for 64-bit integers which LW 5.0  
>> cannot
>> support where I have no idea. For details, see test-reports-5.0 in  
>> attach.
>
> That's odd. What do these two forms output?
>
>    (hcl:compiler-macroexpand '(cffi:mem-ref ptr :char))
>
>    (hcl:compiler-macroexpand '(cffi:mem-ref ptr :long-long))

CL-USER 2 > (lisp-implementation-version)
"5.0.2"

CL-USER 3 > (lisp-implementation-type)
"LispWorks"

CL-USER 4 > (hcl:compiler-macroexpand '(cffi:mem-ref ptr :char))
(LOCALLY
   (DECLARE (OPTIMIZE (SPEED 3) (SAFETY 0)))
   (FLI:FOREIGN-TYPED-AREF '(SIGNED-BYTE 8) PTR (THE FIXNUM 0)))
T

CL-USER 5 > (hcl:compiler-macroexpand '(cffi:mem-ref ptr :long-long))
(CFFI-SYS:%MEM-REF PTR :LONG-LONG 0)
T

>
>
>
>> Both 5.0 and 5.1 give me this result, I think it's OK:
>>
>> CL-USER 6 > (cffi:with-foreign-string (s "abc")
>> (cffi:foreign-string-to-lisp s))
>> "abc"
>> 3
>
> No such luck here:
>
> CL-USER 5 : 1 > (cffi:with-foreign-string (s "abc")
>                  (cffi:foreign-string-to-lisp s))
>
> Error: "��" is not of type SIMPLE-TEXT-STRING.
>
> (lispworks-personal-5-0-1-x86-linux running on an AMD64)

Oh, I know this time. I set this in my LispWorks startup script:

(set-default-character-element-type 'simple-char)

Without this line, I'll also get a error:

CL-USER 2 > (cffi:with-foreign-string (s "abc")
                  (cffi:foreign-string-to-lisp s))

Error: "" is not of type SIMPLE-TEXT-STRING.
   1 (abort) Return to level 0.
   2 Restart top-level loop.

Type :b for backtrace, :c <option number> to proceed,  or :? for other  
options

CL-USER 3 : 1 > :bb
#<The COMMON-LISP-USER package, 15/32 internal, 0/4 external>

Condition: "" is not of type SIMPLE-TEXT-STRING.
Call to ERROR (offset 80)
   SYSTEM::ESTRING : TYPE-ERROR
   SYSTEM::EARGS   : (:EXPECTED-TYPE SIMPLE-TEXT-STRING :DATUM "")

Call to CONDITIONS:TYPE-ERROR-FUNCTION (offset 42)

Call to (SUBFUNCTION 3 (DEFVAR CFFI::*FOREIGN-STRING-MAPPINGS*))  
(offset 451)
   BABEL-ENCODINGS::SRC     : #<Pointer to type :BYTE = #x0050B450>
   BABEL-ENCODINGS::START   : 0
   BABEL-ENCODINGS::END     : 3
   BABEL-ENCODINGS::DEST    : ""
   BABEL-ENCODINGS::D-START : 0
   BABEL-ENCODINGS::U2      : 0
   BABEL-ENCODINGS::U3      : 0
   BABEL-ENCODINGS::U4      : 0
   BABEL-ENCODINGS::U5      : 0
   BABEL-ENCODINGS::U6      : 0
   BABEL-ENCODINGS::DI      : 0
   BABEL-ENCODINGS::I       : 0
   BABEL-ENCODINGS::U1      : 97
   DBG::G                   : 0
   DBG::G                   : #\a

Call to CFFI:FOREIGN-STRING-TO-LISP (offset 652)
   CFFI::POINTER   : #<Pointer to type :BYTE = #x0050B450>
   DBG::|rest-|    : NIL
   CFFI::OFFSET    : 0
   COUNT           : NIL
   CFFI::MAX-CHARS : NIL
   CFFI::ENCODING  : :UTF-8
   COUNT           : 3
   CFFI::MAPPING   : #<BABEL-ENCODINGS::CONCRETE-MAPPING 40502DA4B3>
   CFFI::SIZE      : 3
   CFFI::NEW-END   : 3
   DBG::EXTRA-VALS : :DONT-KNOW
   STRING          : ""

Call to SYSTEM::%EVAL (offset 275)
   EXP : (CFFI:FOREIGN-STRING-TO-LISP S)

Call to SYSTEM::%EVAL (offset 275)
   EXP : (PROGN (CFFI:FOREIGN-STRING-TO-LISP S))

Catch frame: "<* Catch All Object *>"

Call to UNWIND-PROTECT (offset 116)
   SYSTEM::STUFF : ((PROGN (CFFI:FOREIGN-STRING-TO-LISP S))  
(CFFI:FOREIGN-STRING-FREE S))

Call to SYSTEM::%EVAL (offset 275)
   EXP : (UNWIND-PROTECT (PROGN (CFFI:FOREIGN-STRING-TO-LISP S))  
(CFFI:FOREIGN-STRING-FREE S))

Catch frame: #:DYNAMIC-BINDING-CONTOUR61376

Variable environment contour: ()
Call to MULTIPLE-VALUE-BIND (offset 1116)
   SYSTEM::X : ((S) (CFFI:FOREIGN-STRING-ALLOC "abc") (UNWIND-PROTECT  
(PROGN (CFFI:FOREIGN-STRING-TO-LISP S)) (CFFI:FOREIGN-STRING-FREE S)))

Call to SYSTEM::%EVAL (offset 275)
   EXP : (MULTIPLE-VALUE-BIND (S) (CFFI:FOREIGN-STRING-ALLOC "abc")  
(UNWIND-PROTECT (PROGN (CFFI:FOREIGN-STRING-TO-LISP S)) (CFFI:FOREIGN- 
STRING-FREE S)))

Call to SYSTEM::%EVAL (offset 275)
   EXP : (CFFI:WITH-FOREIGN-STRING (S "abc") (CFFI:FOREIGN-STRING-TO- 
LISP S))


SYSTEM::%EVAL <- EVAL <- SYSTEM::DO-EVALUATION
<- SYSTEM::%TOP-LEVEL-INTERNAL <- SYSTEM::%TOP-LEVEL
<- SYSTEM::IN-START-FUNCTION-ONCE <- SYSTEM::IN-START-FUNCTION
<- SYSTEM::START-FUNCTION
T

>
>
> -- 
> Luís Oliveira
> http://student.dei.uc.pt/~lmoliv/




More information about the cffi-devel mailing list