lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Named book file suffixes -- regtest?


From: Marek Klein
Subject: Re: Named book file suffixes -- regtest?
Date: Sun, 1 Mar 2009 22:44:43 +0100

2009/3/1 Carl D. Sorensen <address@hidden>

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]