From lnp at healy.washington.dc.us Tue Jan 28 04:07:11 2014 From: lnp at healy.washington.dc.us (Liam Healy) Date: Mon, 27 Jan 2014 21:07:11 -0700 Subject: [cffi-devel] cffi changes are generating deprecation warning in cl-gd now In-Reply-To: <52E6EEE0.3060707@jkcunningham.com> References: <52E6EEE0.3060707@jkcunningham.com> Message-ID: Hi Jeff, It's harmless, it's just telling you that the syntax that cl-gd uses for structure arguments will eventually (in a future version of CFFI) not work. The messages describes the problem. The structure is specified as cl-gd::gd-image in a function argument or return value. In the old versions of CFFI, that was interpreted as a pointer to that structure, because there was no other possibility. Now structures can also be passed/returned by value using cffi-libffi, so you have to say explicitly as the error message indicates. They might also need to change the use of #'mem-aref (which before returned a pointer to the structure but now returns the structure itself) into a #'mem-aptr. I'm not subscribed to the cl-gd-devel list, so you should forward this response there. Liam On Mon, Jan 27, 2014 at 4:42 PM, Jeff Cunningham wrote: > Hi; > > A short while ago I started noticing this error message showing up > > ;; STYLE-WARNING: > ;; bare references to struct types are deprecated. Please use (:POINTER > (:STRUCT CL-GD::GD-IMAGE)) > ;; or (:STRUCT CL-GD::GD-IMAGE) instead. > > It took me awhile to extract a simple demo case, but I've narrowed it down > to the WITH-THICKNESS macro call I believe. > I'm not sure which list would be best for this question, so I cross-posted > it. > > Here's a test case. > > (ql:quickload "cl-gd") > (use-package :cl-gd) > > (let* ((x1 -86) > (x2 529) > (y1 -0.13) > (y2 1.16) > (xv '(0.0 1.0 2.0 3.0 4.0)) > (yv '(0.99 0.12 0.66 0.24 0.075))) > (with-image* (500 250) > (allocate-color 255 255 255) > (let ((c (allocate-color 0 0 255))) > (with-transformation (:x1 x1 :x2 x2 :y1 y1 :y2 y2) > (with-thickness (1) > (mapl #'(lambda (x y) > (when (and (cdr x) (cdr y)) > (draw-line (car x) (car y) (cadr x) (cadr y) :color > c))) xv yv)) > (write-image-to-file "test.png" :if-exists :supersede))))) > > If you take out the with-thickness macro call the message disappears. > > I played around with that macro but don't really understand enough about > the intricacies of cffi to fix it. > Does anyone have any ideas? Here's the macro in question: > > (defmacro with-thickness ((thickness &key (image '*default-image*)) &body > body) > "Executes BODY with the current line width of IMAGE set to > THICKNESS. The image's previous line width is guaranteed to be > restored before the macro exits. Note that the line width is measured > in pixels and is not affected by WITH-TRANSFORMATION." > (cl-gd::with-unique-names (old-thickness) > ;; we rebind everything so we have left-to-right evaluation > (cl-gd::with-rebinding (thickness image) > `(let ((,old-thickness (thickness ,image))) > (unwind-protect > (progn > (setf (thickness ,image) ,thickness)) > , at body) > (setf (thickness ,image) ,old-thickness))))) > > > Much obliged. > > --Jeff Cunningham > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffrey at jkcunningham.com Tue Jan 28 16:39:25 2014 From: jeffrey at jkcunningham.com (Jeff Cunningham) Date: Tue, 28 Jan 2014 08:39:25 -0800 Subject: Fwd: Re: [cffi-devel] cffi changes are generating deprecation warning in cl-gd now In-Reply-To: References: Message-ID: <52E7DD3D.5080503@jkcunningham.com> I received this response from Liam Healy over in cffi-devel and am posting his response. I have also done as Edi suggested and submitted an issue on cl-gd at github. --Jeff -------- Original Message -------- Subject: Re: [cffi-devel] cffi changes are generating deprecation warning in cl-gd now Date: Mon, 27 Jan 2014 21:07:11 -0700 From: Liam Healy To: Jeff Cunningham CC: CFFI , cl-gd-devel at common-lisp.net Hi Jeff, It's harmless, it's just telling you that the syntax that cl-gd uses for structure arguments will eventually (in a future version of CFFI) not work. The messages describes the problem. The structure is specified as cl-gd::gd-image in a function argument or return value. In the old versions of CFFI, that was interpreted as a pointer to that structure, because there was no other possibility. Now structures can also be passed/returned by value using cffi-libffi, so you have to say explicitly as the error message indicates. They might also need to change the use of #'mem-aref (which before returned a pointer to the structure but now returns the structure itself) into a #'mem-aptr. I'm not subscribed to the cl-gd-devel list, so you should forward this response there. Liam On Mon, Jan 27, 2014 at 4:42 PM, Jeff Cunningham > wrote: Hi; A short while ago I started noticing this error message showing up ;; STYLE-WARNING: ;; bare references to struct types are deprecated. Please use (:POINTER (:STRUCT CL-GD::GD-IMAGE)) ;; or (:STRUCT CL-GD::GD-IMAGE) instead. It took me awhile to extract a simple demo case, but I've narrowed it down to the WITH-THICKNESS macro call I believe. I'm not sure which list would be best for this question, so I cross-posted it. Here's a test case. (ql:quickload "cl-gd") (use-package :cl-gd) (let* ((x1 -86) (x2 529) (y1 -0.13) (y2 1.16) (xv '(0.0 1.0 2.0 3.0 4.0)) (yv '(0.99 0.12 0.66 0.24 0.075))) (with-image* (500 250) (allocate-color 255 255 255) (let ((c (allocate-color 0 0 255))) (with-transformation (:x1 x1 :x2 x2 :y1 y1 :y2 y2) (with-thickness (1) (mapl #'(lambda (x y) (when (and (cdr x) (cdr y)) (draw-line (car x) (car y) (cadr x) (cadr y) :color c))) xv yv)) (write-image-to-file "test.png" :if-exists :supersede))))) If you take out the with-thickness macro call the message disappears. I played around with that macro but don't really understand enough about the intricacies of cffi to fix it. Does anyone have any ideas? Here's the macro in question: (defmacro with-thickness ((thickness &key (image '*default-image*)) &body body) "Executes BODY with the current line width of IMAGE set to THICKNESS. The image's previous line width is guaranteed to be restored before the macro exits. Note that the line width is measured in pixels and is not affected by WITH-TRANSFORMATION." (cl-gd::with-unique-names (old-thickness) ;; we rebind everything so we have left-to-right evaluation (cl-gd::with-rebinding (thickness image) `(let ((,old-thickness (thickness ,image))) (unwind-protect (progn (setf (thickness ,image) ,thickness)) , at body) (setf (thickness ,image) ,old-thickness))))) Much obliged. --Jeff Cunningham -------------- next part -------------- An HTML attachment was scrubbed... URL: From jeffrey at jkcunningham.com Mon Jan 27 23:42:24 2014 From: jeffrey at jkcunningham.com (Jeff Cunningham) Date: Mon, 27 Jan 2014 15:42:24 -0800 Subject: cffi changes are generating deprecation warning in cl-gd now Message-ID: <52E6EEE0.3060707@jkcunningham.com> Hi; A short while ago I started noticing this error message showing up ;; STYLE-WARNING: ;; bare references to struct types are deprecated. Please use (:POINTER (:STRUCT CL-GD::GD-IMAGE)) ;; or (:STRUCT CL-GD::GD-IMAGE) instead. It took me awhile to extract a simple demo case, but I've narrowed it down to the WITH-THICKNESS macro call I believe. I'm not sure which list would be best for this question, so I cross-posted it. Here's a test case. (ql:quickload "cl-gd") (use-package :cl-gd) (let* ((x1 -86) (x2 529) (y1 -0.13) (y2 1.16) (xv '(0.0 1.0 2.0 3.0 4.0)) (yv '(0.99 0.12 0.66 0.24 0.075))) (with-image* (500 250) (allocate-color 255 255 255) (let ((c (allocate-color 0 0 255))) (with-transformation (:x1 x1 :x2 x2 :y1 y1 :y2 y2) (with-thickness (1) (mapl #'(lambda (x y) (when (and (cdr x) (cdr y)) (draw-line (car x) (car y) (cadr x) (cadr y) :color c))) xv yv)) (write-image-to-file "test.png" :if-exists :supersede))))) If you take out the with-thickness macro call the message disappears. I played around with that macro but don't really understand enough about the intricacies of cffi to fix it. Does anyone have any ideas? Here's the macro in question: (defmacro with-thickness ((thickness &key (image '*default-image*)) &body body) "Executes BODY with the current line width of IMAGE set to THICKNESS. The image's previous line width is guaranteed to be restored before the macro exits. Note that the line width is measured in pixels and is not affected by WITH-TRANSFORMATION." (cl-gd::with-unique-names (old-thickness) ;; we rebind everything so we have left-to-right evaluation (cl-gd::with-rebinding (thickness image) `(let ((,old-thickness (thickness ,image))) (unwind-protect (progn (setf (thickness ,image) ,thickness)) , at body) (setf (thickness ,image) ,old-thickness))))) Much obliged. --Jeff Cunningham From edi at agharta.de Tue Jan 28 05:22:27 2014 From: edi at agharta.de (Edi Weitz) Date: Tue, 28 Jan 2014 06:22:27 +0100 Subject: cffi changes are generating deprecation warning in cl-gd now In-Reply-To: <52E6EEE0.3060707@jkcunningham.com> References: <52E6EEE0.3060707@jkcunningham.com> Message-ID: Jeff, Thanks for the report. The best way to proceed is to make it an issue here: https://github.com/edicl/cl-gd Cheers, Edi. On Tue, Jan 28, 2014 at 12:42 AM, Jeff Cunningham wrote: > Hi; > > A short while ago I started noticing this error message showing up > > ;; STYLE-WARNING: > ;; bare references to struct types are deprecated. Please use (:POINTER > (:STRUCT CL-GD::GD-IMAGE)) > ;; or (:STRUCT CL-GD::GD-IMAGE) instead. > > It took me awhile to extract a simple demo case, but I've narrowed it down > to the WITH-THICKNESS macro call I believe. > I'm not sure which list would be best for this question, so I cross-posted > it. > > Here's a test case. > > (ql:quickload "cl-gd") > (use-package :cl-gd) > > (let* ((x1 -86) > (x2 529) > (y1 -0.13) > (y2 1.16) > (xv '(0.0 1.0 2.0 3.0 4.0)) > (yv '(0.99 0.12 0.66 0.24 0.075))) > (with-image* (500 250) > (allocate-color 255 255 255) > (let ((c (allocate-color 0 0 255))) > (with-transformation (:x1 x1 :x2 x2 :y1 y1 :y2 y2) > (with-thickness (1) > (mapl #'(lambda (x y) > (when (and (cdr x) (cdr y)) > (draw-line (car x) (car y) (cadr x) (cadr y) :color > c))) xv yv)) > (write-image-to-file "test.png" :if-exists :supersede))))) > > If you take out the with-thickness macro call the message disappears. > > I played around with that macro but don't really understand enough about the > intricacies of cffi to fix it. > Does anyone have any ideas? Here's the macro in question: > > (defmacro with-thickness ((thickness &key (image '*default-image*)) &body > body) > "Executes BODY with the current line width of IMAGE set to > THICKNESS. The image's previous line width is guaranteed to be > restored before the macro exits. Note that the line width is measured > in pixels and is not affected by WITH-TRANSFORMATION." > (cl-gd::with-unique-names (old-thickness) > ;; we rebind everything so we have left-to-right evaluation > (cl-gd::with-rebinding (thickness image) > `(let ((,old-thickness (thickness ,image))) > (unwind-protect > (progn > (setf (thickness ,image) ,thickness)) > , at body) > (setf (thickness ,image) ,old-thickness))))) > > > Much obliged. > > --Jeff Cunningham > >