lilypond-devel
[Top][All Lists]
Advanced

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

Re: Solution for including a file only once


From: Carl Sorensen
Subject: Re: Solution for including a file only once
Date: Thu, 11 Feb 2010 16:03:32 -0700



On 2/11/10 1:54 PM, "Michael J. O'Donnell" <address@hidden> wrote:

> Carl,
> 
> includeIfAbsent is indeed the sort of void music function that you
> mention. I gave myself a \voidMusic utility function to help me remember
> it when I need it. Now, I realize that for other purposes I would also
> like a \nullMusic, analogous to the \null markup (which holds a
> point-sized place, but doesn't put anything there, and doesn't occupy
> space). Since \voidMusic is completely ignored by the parser, I'm pretty
> sure it won't even mark a point in score time. Not needed today, but
> I'll be hunting for it.
> 
> I've found that the parser passed to the music function seems to put Scm
> definitions in the right global scope, but causes that final
> segmentation fault. The cloned parser avoids the seg fault, but makes a
> scope that hides Scm definitions.

This is way beyond my depth.  I've copied this to -devel because I'm
assuming somebody there might have an idea.

> 
> Maybe I need to do something else to the parser to resolve some
> inconsistency resulting from feeding it a string not in the normal input
> stream.
> 
> Alternatively, I wonder if the \function notation allows for things that
> are not music functions? Not sure whether that will help this problem,
> but the music function might be leading to the necessity for explicitly
> calling the parser, ... Anyway, it seems silly to have things like
> \include and \includeIfAbsent pretend to be music functions, when all
> sorts of types are allowed at the top level.

If you look at the 2.13 latest docs, Extending LilyPond Section 1.2.3,
there's a discussion about this that might help you.  It may be possible
to step entirely out of the music function environment.

See the unofficial link:
<http://kainhofer.com/~lilypond/Documentation/extending/input-variables-and-
scheme.html>

You can always do 

#(define (include-if-absent filename)  ...)

then

#(include-if-absent "HeaderOne.ly")
#(include-if-absent "TitleUtilities.ly")

etc.

HTH,

Carl





reply via email to

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