I seem to be having a problem using the examples that come with cl-pdf
in sbcl. The problem occurs when I try to regenerate the 7th
example. In a fresh sbcl either on mac os x or x86 linux (v. 0.8.5.44
from debian unstable), I type
it gives a runtime error
debugger invoked on condition of type TYPE-ERROR in thread 26489:
The value -12.0
is not of type
(OR (SINGLE-FLOAT (0.0)) (DOUBLE-FLOAT (0.0d0)) (RATIONAL (0))).
the backtrace shows that the error occurs in when the pdf:draw-object
method is called on the pdf:legend object. The method is pretty
simple, but has a loop in it.
cmucl (on x86 linux) and openmcl (on mac os x) both work and nothing
obvious is -12. It seemed to me that maybe the type-checker in sbcl
is being a little overzealous?
If I rewrite the code not to use loop than it works in sbcl.
Any ideas? Perhaps the loop code is not ansi, but it looks good to my
BTW: for completeness, here is the loop that causes the problem. In the
real code the numbers are such that y should never be negative.
(loop with dx = font-size
with dy = font-size
with text-x = (+ dx (* 2 space))
for (name color) in (labels&colors obj)
for y from (- height line-height) by (- line-height) do
(apply #'set-rgb-fill color)
(basic-rect space y dx dy)
(apply #'set-rgb-fill (label-color obj))
(move-text text-x y)
(set-font (label-font obj) font-size)
Robbie Sedgewick <rds@...> writes:
> Any ideas? Perhaps the loop code is not ansi, but it looks good to my
> newbie eye.
The loop code is not ANSI.
> for y from (- height line-height) by (- line-height) do
Specifically this line, presuming that LINE-HEIGHT is a positive
The step must be positive. If you want downwards looping, you ask for
it with DOWNFROM or DOWNTO or their close cousins. Probably what was
for y downfrom (- height line-height) by line-height do
http://www-jcsu.jesus.cam.ac.uk/~csr21/ +44 1223 510 299/+44 7729 383 757
(set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
(defvar b "~&Just another Lisp hacker~%") (pprint #36rJesusCollegeCambridge)