[Top][All Lists]

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

Re: "include" music-function

From: Jan-Peter Voigt
Subject: Re: "include" music-function
Date: Fri, 06 Jan 2012 10:17:47 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20111108 Lightning/1.0b2 Thunderbird/3.1.16

Am 06.01.2012 09:35, schrieb Jan-Peter Voigt:
Hello David,

the \sourcefilename hint is helpful! Thank you!
If I use this in my function and do a ly:parser-clone, the location is up to date:
Now I will look, if this is working also with ly:parser-include-string while resetting filename and fileline at the end, so that definitions in the included file get into the current parser.

... yes it does:

#(define-public includeLocal (define-music-function (parser location file)(string?)
    (let ((outname (format "" (ly:parser-output-name parser)))
          (locname (car (ly:input-file-line-char-column location)))
          (locpos (cadr (ly:input-file-line-char-column location))))
(if (or (string=? outname locname)(string-suffix? outname locname))
(ly:parser-include-string parser (format "\\sourcefilename \"~A\" \\sourcefileline 0\n" (ly:find-file file)))
               (ly:parser-include-string parser (ly:gulp-file file))
(ly:parser-include-string parser (format " \\sourcefilename \"~A\" \\sourcefileline ~A\n" locname locpos))))
         (make-music 'SequentialMusic 'void #t))))

... but if I include a file in an included file, it will not parse. I will investigate that for more info.


reply via email to

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