2009/3/1 Carl D. Sorensen <c_soren...@byu.edu>

>
> I think this error message says that it's expecting a symbol, and instead
> it
> gets an empty list, which is the value of counter-alist right now.
>
> So I think you should try
>
> (ly:parser-define! parser 'counter-alist (assoc-set! counter-alist
> output-suffix (1+ output-count)))
>
> This puts the symbol as the argument, rather than the value of the symbol,
> I
> think.
>
> Carl
>
>
With your suggestion and one more line of code it works now with
ly:parser-define!

(define counter-alist '())

(define (print-book-with parser book process-procedure)
  (let*
      ((paper (ly:parser-lookup parser '$defaultpaper))
       (layout (ly:parser-lookup parser '$defaultlayout))
       (output-suffix (ly:parser-lookup parser 'output-suffix))
       (counter-alist (ly:parser-lookup parser 'counter-alist))
       (output-count (assoc-ref counter-alist output-suffix))
       (base (ly:parser-output-name parser)) )

      (if (string? output-suffix)
    (set! base (format "~a-~a" base (string-regexp-substitute
                       "[^a-zA-Z0-9-]" "_" output-suffix))))

    ;; must be careful: output-count is under user control.
    (if (not (integer? output-count))
    (set! output-count 0))

    (if (> output-count 0)
    (set! base (format #f "~a-~a" base output-count)))
    (ly:parser-define! parser 'counter-alist (assoc-set! counter-alist
output-suffix (1+ output-count)))
    (process-procedure book paper layout base)
    ))



-- 
Marek Klein
http://gregoriana.sk
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to