[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ly:parser-parse-string again
From: |
Urs Liska |
Subject: |
Re: ly:parser-parse-string again |
Date: |
Tue, 5 Jul 2016 15:40:08 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 |
Am 05.07.2016 um 15:27 schrieb David Kastrup:
> Urs Liska <address@hidden> writes:
>
>> Hi,
>>
>> I'm once more struggling with the commands to include files within
>> Scheme functions.
>>
>> In the attached .ily files one defines a music expression while the
>> other uses it in a Staff definition.
>>
>> I can happily make that work using regular \includes or by calling
>> ly:parser-include-string twice. But I need to wrap this into a Scheme
>> function to include multiple files from within a function and process
>> the results (the music expressions from the files) within the same function.
>>
>> I am not surprised that the second approach (using
>> ly:parser-include-string twice within the function) doesn't work. Last
>> time this question popped up I learned that any definition from inside
>> the included file will only be visible after the function has returned.
>> (uncomment second example to see it "in action").
> Perhaps you should unlearn that. It's nonsensical. The problem rather
> is that ly:parser-include-string pushes a string on the input stack, so
> your includes are processed in reversed order.
>
> Why would you even do multiple ly:parser-include-string calls in one
> function instead of building _one_ string and including that?
>
Well, first of all I wouldn't have thought of it, so I felt very
embarrassed at first. But actually the problem is that my function is
kind of an adaptor. It includes a number of files (i.e. all from a
directory that match a pattern), and each file defines the same
variables (e.g. \music, \lyricText and \bcFigures). The function wants
then to either rename them so they can independently be used in a score
or rather store them in a tree where the function building the score
will later fetch them from.
So, within my function I have to iterate over the list of files, include
them and process the variables that are defined within the files.
- ly:parser-parse-string again, Urs Liska, 2016/07/05
- Re: ly:parser-parse-string again, David Kastrup, 2016/07/05
- Re: ly:parser-parse-string again, David Kastrup, 2016/07/05
- Re: ly:parser-parse-string again,
Urs Liska <=
- Re: ly:parser-parse-string again, David Kastrup, 2016/07/05
- Re: ly:parser-parse-string again, Urs Liska, 2016/07/05
- Re: ly:parser-parse-string again, David Kastrup, 2016/07/05
- Re: ly:parser-parse-string again, Urs Liska, 2016/07/05
- Re: ly:parser-parse-string again, David Kastrup, 2016/07/05