lilypond-user
[Top][All Lists]
Advanced

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

Re: Determine the including file


From: Urs Liska
Subject: Re: Determine the including file
Date: Fri, 22 Jan 2016 12:15:51 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0



Am 22.01.2016 um 12:04 schrieb Chris Yate:
On 22 January 2016 at 10:44, Urs Liska <address@hidden> wrote:
If I have

% file a.ly
\include "b.ily"

% file b.ily
\include "c.ily"

% file c.ily

can I somehow refer to file b.ily from file c.ily?
In other words: If b.ily includes c.ily can I know from within c.ily
that it was b.ily who included me?

I suppose not, but one should never give up without asking ...

Best
Urs

Hi Urs,

What are you trying to achieve? If you \include "c" at the end of "b", I imagine the code in "c" will have access to code from "b".

But this smells like a circular dependency that you need to break with a common include file.

Well, I should probably be more explicit with my question.

What I'm thinking about is the following:

I have the file openlilylib.ily, which is the main entry point to openLilyLib.
I'm currently changing the way how openLilyLib is organized. Previously you loaded openLilyLib, and then you had the command \useLibrary to load specific libraries from within openLilyLib.
In the future the libraries will be in separate repositories each (disentangling code, distribution, collaboration and whatever).
For example you'll have the directories
    openlilylib/scholarly
    openlilylib/oll-core

You'll "load" the ScholarLY library by including its main file (e.g.) openlilylib/scholarly/main.ily, and this will in turn include openlilylib/oll-core/main.ily.

So as a user you won't write
    \include "openlilylib"
    \useLibrary Scholarly
anymore but
    \include "scholarly/main.ily"
(or something similar)

Now the question comes:
openLilyLib registers a list of loaded libraries and its options. What I'm thinking about is if a function inside openlilylib/oll-core/main.ily can determine from which file it has been included and then add this to the list of loaded libraries.

If that's not possible that wouldn't be much of an issue. ScholarLY would then simply have to include oll-core and *then* issue a command to register itself with oll. But I just wanted to explore the possibility.

Urs


Chris


reply via email to

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