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)) ,@body) (setf (thickness ,image) ,old-thickness)))))
Much obliged.
--Jeff Cunningham
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 jeffrey@jkcunningham.comwrote:
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)) ,@body) (setf (thickness ,image) ,old-thickness)))))
Much obliged.
--Jeff Cunningham