Hello,
I have a problem compiling the cl-cairo2 manual:
The 'make' command, executed from the 'tutorial' directory, says the following:
Error during processing of --eval option "(progn (load "example.lisp") (quit))": The value 200 is not of type DOUBLE-FLOAT.
The error is raised from the first call to cl-cairo at example.lisp:
(create-ps-surface "example.ps" 200 100)
It seems that 200 is not converted to my-double datatype before it is passed to the foreign function. translate-to-foreign method for my-double doesn't get called.
I tried to fix the problem by hacking cl-cairo2-swig.lisp, but without success.
I have SBCL 1.0.15 on Debian-unstable on amd64. cl-cffi version number is 0.9.2 (Debian package cl-cffi_20080217-1) cl-cairo2-latest.tar.gz I downloaded today from common-lisp.net.
With regards, Dmitry
Hi Dimtry,
Thanks for the bug report. I can't figure it out, contacted the CFFI folks about this. In the meantime, can you tell me what the following does on your version:
(require :cffi)
(cffi:defctype my-double :double)
(defmethod cffi:translate-to-foreign (value (type (eql 'my-double))) (coerce value 'double-float))
(cffi:translate-to-foreign 10 'my-double) ; => 10d0
(cffi:convert-to-foreign 10 'my-double) ; => 10
(please start a clean lisp, no previous packages loaded).
Also, you can pass doubles (like 200d0 100d0) to make these functions work until I figure out a fix. The type translation is just a convenience.
HTH,
Tamas
On Mon, Apr 21, 2008 at 01:59:43AM +0400, Dmitry Pavlov wrote:
Hello,
I have a problem compiling the cl-cairo2 manual:
The 'make' command, executed from the 'tutorial' directory, says the following:
Error during processing of --eval option "(progn (load "example.lisp") (quit))": The value 200 is not of type DOUBLE-FLOAT.
The error is raised from the first call to cl-cairo at example.lisp:
(create-ps-surface "example.ps" 200 100)
It seems that 200 is not converted to my-double datatype before it is passed to the foreign function. translate-to-foreign method for my-double doesn't get called.
I tried to fix the problem by hacking cl-cairo2-swig.lisp, but without success.
I have SBCL 1.0.15 on Debian-unstable on amd64. cl-cffi version number is 0.9.2 (Debian package cl-cffi_20080217-1) cl-cairo2-latest.tar.gz I downloaded today from common-lisp.net.
With regards, Dmitry _______________________________________________ cl-cairo2-devel mailing list cl-cairo2-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/cl-cairo2-devel
In the meantime, can you tell me what the following does on your version:
CL-USER> (require :cffi) NIL CL-USER> (cffi:defctype my-double :double) MY-DOUBLE CL-USER> (defmethod cffi:translate-to-foreign (value (type (eql 'my-double))) (coerce value 'double-float)) #<STANDARD-METHOD CFFI:TRANSLATE-TO-FOREIGN (T (EQL MY-DOUBLE)) {10038378E1}> CL-USER> (cffi:translate-to-foreign 10 'my-double) 10.0d0 CL-USER> (cffi:convert-to-foreign 10 'my-double) 10
Regards, Dmitry
Hi Dmitry,
I have just committed a revision of cl-cairo2 which I believe fixes the issue (uses CFFI's fancy define-foreign-type, with the help of Luis Oliveira).
If you have the time, please check if the new version fixes things for you, it works for me.
Also, thanks for the bug report.
Enjoy cl-cairo2,
Tamas
On Mon, Apr 21, 2008 at 04:04:04AM +0400, Dmitry Pavlov wrote:
In the meantime, can you tell me what the following does on your version:
CL-USER> (require :cffi) NIL CL-USER> (cffi:defctype my-double :double) MY-DOUBLE CL-USER> (defmethod cffi:translate-to-foreign (value (type (eql 'my-double))) (coerce value 'double-float)) #<STANDARD-METHOD CFFI:TRANSLATE-TO-FOREIGN (T (EQL MY-DOUBLE)) {10038378E1}> CL-USER> (cffi:translate-to-foreign 10 'my-double) 10.0d0 CL-USER> (cffi:convert-to-foreign 10 'my-double) 10
Regards, Dmitry
Hi Tamas,
If you have the time, please check if the new version fixes things for you, it works for me.
Yes, the type conversion is OK now. Thank you and Luis for fast response.
I had to upgrade Cairo 1.4 to 1.6 to get the manual compiled. With Cairo 1.4, example.lisp used to fail again with the message
"arithmetic error FLOATING-POINT-INVALID-OPERATION signalled"
from some foreign function. Maybe this is Cairo 64-bit issue that was fixed in 1.6, or maybe not.
With regards, Dmitry
I had to upgrade Cairo 1.4 to 1.6 to get the manual compiled.
I noticed another problem with the compiled manual: the text size is very small, about 10 times smaller than in the manual that I downloaded from the project page. I can send you text.ps and lissajoux.ps if you need them.
Regards, Dmitry
On Mon, Apr 21, 2008 at 06:03:15PM +0400, Dmitry Pavlov wrote:
I had to upgrade Cairo 1.4 to 1.6 to get the manual compiled.
I noticed another problem with the compiled manual: the text size is very small, about 10 times smaller than in the manual that I downloaded from the project page. I can send you text.ps and lissajoux.ps if you need them.
Hi Dmitry,
I can't reproduce your problem, but I am getting the "arithmetic error FLOATING-POINT-INVALID-OPERATION signalled" when running the example which produces text.ps. You mentioned this error before with 1.4, I am getting it with libcairo2 1.6.4-1.
Please tell me which version of Cairo are you using, and also send me the ps files above.
Tamas
Hi Tamas,
Please tell me which version of Cairo are you using, and also send me the ps files above.
I have libcairo2 1.6.4-1. Attaching the zipped PS files to this message...
Regards, Dmitry
cl-cairo2-devel@common-lisp.net