From dmitry.pavlov at gmail.com Sun Apr 20 21:59:43 2008 From: dmitry.pavlov at gmail.com (Dmitry Pavlov) Date: Mon, 21 Apr 2008 01:59:43 +0400 Subject: [cl-cairo2-devel] translation of my-double type to foreign is broken Message-ID: <87d93dd20804201459o3e19a833ue36b2bcc5f6a0aaa@mail.gmail.com> 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 From dmitry.pavlov at gmail.com Sun Apr 20 22:13:04 2008 From: dmitry.pavlov at gmail.com (Dmitry Pavlov) Date: Mon, 21 Apr 2008 02:13:04 +0400 Subject: [cl-cairo2-devel] Re: translation of my-double type to foreign is broken In-Reply-To: <87d93dd20804201459o3e19a833ue36b2bcc5f6a0aaa@mail.gmail.com> References: <87d93dd20804201459o3e19a833ue36b2bcc5f6a0aaa@mail.gmail.com> Message-ID: <87d93dd20804201513ma5e359eybed8a736e354bb9c@mail.gmail.com> > cl-cffi version number is 0.9.2 (Debian package cl-cffi_20080217-1) Downloading the latest cffi tarball did't help. With regards, Dmitry From tpapp at Princeton.EDU Sun Apr 20 23:44:45 2008 From: tpapp at Princeton.EDU (Tamas K Papp) Date: Sun, 20 Apr 2008 19:44:45 -0400 Subject: [cl-cairo2-devel] translation of my-double type to foreign is broken In-Reply-To: <87d93dd20804201459o3e19a833ue36b2bcc5f6a0aaa@mail.gmail.com> References: <87d93dd20804201459o3e19a833ue36b2bcc5f6a0aaa@mail.gmail.com> Message-ID: <20080420234445.GB3384@pu100877.student.princeton.edu> 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 at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/cl-cairo2-devel From dmitry.pavlov at gmail.com Mon Apr 21 00:04:04 2008 From: dmitry.pavlov at gmail.com (Dmitry Pavlov) Date: Mon, 21 Apr 2008 04:04:04 +0400 Subject: [cl-cairo2-devel] translation of my-double type to foreign is broken In-Reply-To: <20080420234445.GB3384@pu100877.student.princeton.edu> References: <87d93dd20804201459o3e19a833ue36b2bcc5f6a0aaa@mail.gmail.com> <20080420234445.GB3384@pu100877.student.princeton.edu> Message-ID: <87d93dd20804201704t30a0a7d1ybbec643b3c4b8631@mail.gmail.com> > 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)) # CL-USER> (cffi:translate-to-foreign 10 'my-double) 10.0d0 CL-USER> (cffi:convert-to-foreign 10 'my-double) 10 Regards, Dmitry From tpapp at Princeton.EDU Mon Apr 21 13:04:54 2008 From: tpapp at Princeton.EDU (Tamas K Papp) Date: Mon, 21 Apr 2008 09:04:54 -0400 Subject: [cl-cairo2-devel] translation of my-double type to foreign is broken In-Reply-To: <87d93dd20804201704t30a0a7d1ybbec643b3c4b8631@mail.gmail.com> References: <87d93dd20804201459o3e19a833ue36b2bcc5f6a0aaa@mail.gmail.com> <20080420234445.GB3384@pu100877.student.princeton.edu> <87d93dd20804201704t30a0a7d1ybbec643b3c4b8631@mail.gmail.com> Message-ID: <20080421130454.GA25764@pu100877.student.princeton.edu> 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)) > # (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 From dmitry.pavlov at gmail.com Mon Apr 21 13:48:17 2008 From: dmitry.pavlov at gmail.com (Dmitry Pavlov) Date: Mon, 21 Apr 2008 17:48:17 +0400 Subject: [cl-cairo2-devel] translation of my-double type to foreign is broken In-Reply-To: <20080421130454.GA25764@pu100877.student.princeton.edu> References: <87d93dd20804201459o3e19a833ue36b2bcc5f6a0aaa@mail.gmail.com> <20080420234445.GB3384@pu100877.student.princeton.edu> <87d93dd20804201704t30a0a7d1ybbec643b3c4b8631@mail.gmail.com> <20080421130454.GA25764@pu100877.student.princeton.edu> Message-ID: <87d93dd20804210648l2d4d9720od2a4afda9afd4376@mail.gmail.com> 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 From dmitry.pavlov at gmail.com Mon Apr 21 14:03:15 2008 From: dmitry.pavlov at gmail.com (Dmitry Pavlov) Date: Mon, 21 Apr 2008 18:03:15 +0400 Subject: [cl-cairo2-devel] translation of my-double type to foreign is broken In-Reply-To: <87d93dd20804210648l2d4d9720od2a4afda9afd4376@mail.gmail.com> References: <87d93dd20804201459o3e19a833ue36b2bcc5f6a0aaa@mail.gmail.com> <20080420234445.GB3384@pu100877.student.princeton.edu> <87d93dd20804201704t30a0a7d1ybbec643b3c4b8631@mail.gmail.com> <20080421130454.GA25764@pu100877.student.princeton.edu> <87d93dd20804210648l2d4d9720od2a4afda9afd4376@mail.gmail.com> Message-ID: <87d93dd20804210703v5d84b4b0k7d3c6fc30b80eb44@mail.gmail.com> > 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 From dmitry.pavlov at gmail.com Mon Apr 21 14:04:29 2008 From: dmitry.pavlov at gmail.com (Dmitry Pavlov) Date: Mon, 21 Apr 2008 18:04:29 +0400 Subject: [cl-cairo2-devel] translation of my-double type to foreign is broken In-Reply-To: <87d93dd20804210703v5d84b4b0k7d3c6fc30b80eb44@mail.gmail.com> References: <87d93dd20804201459o3e19a833ue36b2bcc5f6a0aaa@mail.gmail.com> <20080420234445.GB3384@pu100877.student.princeton.edu> <87d93dd20804201704t30a0a7d1ybbec643b3c4b8631@mail.gmail.com> <20080421130454.GA25764@pu100877.student.princeton.edu> <87d93dd20804210648l2d4d9720od2a4afda9afd4376@mail.gmail.com> <87d93dd20804210703v5d84b4b0k7d3c6fc30b80eb44@mail.gmail.com> Message-ID: <87d93dd20804210704k7eb21485gd98b1543d5e6ac7@mail.gmail.com> > the text size is very small, about 10 times smaller than > in the manual that I downloaded from the project page. I meant the text in the figures rendered by Cairo, of course. -- Dmitry From tpapp at Princeton.EDU Mon Apr 21 23:59:59 2008 From: tpapp at Princeton.EDU (Tamas K Papp) Date: Mon, 21 Apr 2008 19:59:59 -0400 Subject: [cl-cairo2-devel] translation of my-double type to foreign is broken In-Reply-To: <87d93dd20804210703v5d84b4b0k7d3c6fc30b80eb44@mail.gmail.com> References: <87d93dd20804201459o3e19a833ue36b2bcc5f6a0aaa@mail.gmail.com> <20080420234445.GB3384@pu100877.student.princeton.edu> <87d93dd20804201704t30a0a7d1ybbec643b3c4b8631@mail.gmail.com> <20080421130454.GA25764@pu100877.student.princeton.edu> <87d93dd20804210648l2d4d9720od2a4afda9afd4376@mail.gmail.com> <87d93dd20804210703v5d84b4b0k7d3c6fc30b80eb44@mail.gmail.com> Message-ID: <20080421235959.GA18704@pu100877.student.princeton.edu> 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 From dmitry.pavlov at gmail.com Tue Apr 22 00:08:52 2008 From: dmitry.pavlov at gmail.com (Dmitry Pavlov) Date: Tue, 22 Apr 2008 04:08:52 +0400 Subject: [cl-cairo2-devel] translation of my-double type to foreign is broken In-Reply-To: <20080421235959.GA18704@pu100877.student.princeton.edu> References: <87d93dd20804201459o3e19a833ue36b2bcc5f6a0aaa@mail.gmail.com> <20080420234445.GB3384@pu100877.student.princeton.edu> <87d93dd20804201704t30a0a7d1ybbec643b3c4b8631@mail.gmail.com> <20080421130454.GA25764@pu100877.student.princeton.edu> <87d93dd20804210648l2d4d9720od2a4afda9afd4376@mail.gmail.com> <87d93dd20804210703v5d84b4b0k7d3c6fc30b80eb44@mail.gmail.com> <20080421235959.GA18704@pu100877.student.princeton.edu> Message-ID: <87d93dd20804211708t50cddf08w4bf81208a3c97b33@mail.gmail.com> 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: psfiles.zip Type: application/zip Size: 26513 bytes Desc: not available URL: From peter.hildebrandt at gmail.com Tue Apr 29 15:57:41 2008 From: peter.hildebrandt at gmail.com (Peter Hildebrandt) Date: Tue, 29 Apr 2008 17:57:41 +0200 Subject: [cl-cairo2-devel] issues with cl-cairo2 from asdf-install Message-ID: <7758b2680804290857q7c4d933ftd3fe41f7c92ff7c5@mail.gmail.com> I just tried to pull in a current version of cl-cairo2 via asdf-install, and I ran into the following: There is no class named CL-CAIRO2::MY-DOUBLE-TYPE. (in cl-cairo2-swig) For me, the failing define-foreign-type expands into: (PROGN (CFFI::DEFINE-TYPE-SPEC-PARSER MY-DOUBLE-TYPE NIL (MAKE-INSTANCE 'CFFI::FOREIGN-TYPEDEF :NAME 'MY-DOUBLE-TYPE :ACTUAL-TYPE (CFFI::PARSE-TYPE (PROGN NIL (:ACTUAL-TYPE :DOUBLE) (:SIMPLE-PARSER MY-DOUBLE))))) 'MY-DOUBLE-TYPE) Note that parse-type is a function, thus (:actual-type ...) will be interpreted as a function call. This could be due a cffi mismatch: I have cffi 0.9.2 (the latest release). Do you use the one from darcs? Also, all three library names don't work in Ubuntu 8.04. I added the alternatives: cairo.lisp: (load-foreign-library '(:or "libcairo" "libcairo.so.2")) gtk-context.lisp: (define-foreign-library :gdk (cffi-features:unix (:or "libgdk-x11-2.0.so" "libgdk-x11-2.0.so.0")) (cffi-features:windows "libgdk-win32-2.0-0.dll") (cffi-features:darwin "libgdk-win32-2.0-0.dylib")) xlib.lisp: (load-foreign-library '(:or "libX11.so" "libX11.so.6")) Peter