Shirakumo/glsl-toolkit

Problems with indent in ccl

Closed this issue · 1 comments

While compiling trial with ccl I get an error in serialize.
I believe the error is caused by the following definition.

(defun indent (&optional (offset 0))
  (fresh-line *serialize-stream*)
  (format *serialize-stream* "~v{ ~}" (+ *indent* offset) 0))

If simply indent is called this than simplified executes the following

? (format nil "~v{ ~}" 0 0)
> Error: The value 0 is not of the expected type LIST.
> While executing: CCL::FORMAT-DO-ITERATION, in process listener(1).
> Type :POP to abort, :R for a list of available restarts.
> Type :? for other options.
1 > 

Looking at the definition, the - here second - argument should be a list, even though it is not used.
The following works also in ccl, so might be a fix

(defun indent (&optional (offset 0))
  (fresh-line *serialize-stream*)
  (format *serialize-stream* "~v{ ~}" (+ *indent* offset) (list 0)))

e.g. the following does what you probably wanted to achieve

(format nil "~v{ ~}" 10 (list 0))

That was quick :-)