lilypond-user
[Top][All Lists]
Advanced

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

Re: Can \barNumberCheck be set to error?


From: Urs Liska
Subject: Re: Can \barNumberCheck be set to error?
Date: Fri, 4 Dec 2015 00:06:12 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0



Am 03.12.2015 um 23:34 schrieb thorne:
Thank you.  I have changed the relevant bit to

     (begin
       (ly:input-message (*location*) "")
       (ly:error "Barcheck failed got ~a expect ~a" cbn n)))))))

which works, but is not very elegant.  This is the first time I've
looked at the Internals documentation.  I didn't see anything like a
"ly:input-error" function that I would have expected.  Is this the
idiomatic way to send a location in the input file along with an error
message?

I have written this function which I think is more idiomatic:

test =
#(define-void-function (expected got)(integer? integer?)
   (let*
    ((loc (ly:input-file-line-char-column (*location*) ))
     (locstring
      (format "~a:~a:~a" (first loc) (second loc) (third loc))))
       (ly:error (format "Barcheck failed in ~a. Got ~a, expected ~a" locstring expected got))))

\test 5 4

which you could adapt and include into your code.
Maybe it can be improved so the link to the source also works. Right now this seems to look for the file "

fatal error: Barcheck failed in /home/uliska/Aktuell/lily-bugs/barcheck-error/barcheck-error.ly"

Actually I think having the option to have barcheck failures cause errors instead of warning would be a nice thing for LilyPond.

HTH Urs





On Wed, Dec 2, 2015 at 11:39 PM, David Kastrup <address@hidden> wrote:
thorne <address@hidden> writes:

I am just wondering if there is any way to set only \barNumberCheck to
generate an error instead of a warning.

I am using a Makefile to handle a project.  I am using \barNumberCheck
on every bar on every part.  It is convenient to have Lilypond error
any time a bar number check fails so that the render fails and I know
right away.

I tried doing -dwarning-as-error, which works, but then makes the
render fail any time anything generates a warning, which is probably
not something I can have.

Or, is there a better approach in general?
\barNumberCheck is defined in ly/music-functions-init.ly.  It's less
than a dozen lines.  Just copy that definition and replace the call to
ly:input-warning with something else.

--
David Kastrup




reply via email to

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