@@ -159,7 +159,6 @@ declareLibrary =
159159 ))
160160 options)))
161161
162-
163162% Initialize a library before first use.
164163% This also serves as a kind of declaration of the intent of using it.
165164% If options are passed in a \with {} clause they are set after in
@@ -192,8 +191,10 @@ useLibrary =
192191 (if (file-exists? init-file)
193192 (begin
194193 (oll:log location " Initialize library \" ~a\" ..." display-name)
195- (ly:parser-include-string parser
196- (format " \\ include \" ~a\" " init-file))))
194+ (let ((arg (format " \\ include \" ~a\" " init-file)))
195+ (if (lilypond-greater-than? " 2.19.21" )
196+ (ly:parser-include-string arg)
197+ (ly:parser-include-string parser arg)))))
197198
198199 ; ; If a \with clause has been given pass the options to the library.
199200 ; ; If the options have not been registered in the __init__ file this
@@ -210,13 +211,16 @@ useLibrary =
210211 (if (file-exists? main-file)
211212 (begin
212213 ; (ly:parser-include-string parser (ly:gulp-file main-file))
213- (ly:parser-include-string parser
214- (format " \\ include \" ~a\" " main-file))
214+ (let ((arg (format " \\ include \" ~a\" " main-file)))
215+ (if (lilypond-greater-than? " 2.19.21" )
216+ (ly:parser-include-string arg)
217+ (ly:parser-include-string parser arg))
218+
215219 (set! oll-loaded-libraries
216220 (append oll-loaded-libraries
217221 `(,name)))
218222 (oll:log " ... completed." " " ))
219- (oll:warn location (format " Library main file \" ~a\" not found" main-file)))))))
223+ (oll:warn location (format " Library main file \" ~a\" not found" main-file))))))))
220224
221225
222226% Load a module from within a library.
@@ -275,13 +279,25 @@ useModule =
275279
276280 ; ; include init-file if present
277281 (if init-file
282+ (if (lilypond-greater-tha
283+ (if init-file
284+ (if (lilypond-greater-than? " 2.19.21" )
285+ (ly:parser-include-string
286+ (format " \\ include \" ~a\" " init-file))
287+ (ly:parser-include-string parser
288+ (format " \\ include \" ~a\" " init-file))))n? " 2.19.21" )
289+ (ly:parser-include-string
290+ (format " \\ include \" ~a\" " init-file))
278291 (ly:parser-include-string parser
279- (format " \\ include \" ~a\" " init-file)))
292+ (format " \\ include \" ~a\" " init-file))))
280293
281294
282295 ; ; include module file
283- (ly:parser-include-string parser
284- (format " \\ include \" ~a\" " filename))
296+ (if (lilypond-greater-than? " 2.19.21" )
297+ (ly:parser-include-string
298+ (format " \\ include \" ~a\" " filename))
299+ (ly:parser-include-string parser
300+ (format " \\ include \" ~a\" " filename)))
285301
286302 ; ; register module
287303 (set! oll-loaded-modules
@@ -325,8 +341,12 @@ registerLibrary =
325341 (if (file-exists? lib-init-file)
326342 (begin
327343 (oll:log " initialize library \" ~a\" " lib)
328- (ly:parser-include-string parser
329- (format " \\ include \" ~a\" " lib-init-file))))))))
344+ (if (lilypond-greater-than? " 2.19.21" )
345+ (ly:parser-include-string
346+ (format " \\ include \" ~a\" " lib-init-file))
347+ (ly:parser-include-string parser
348+ (format " \\ include \" ~a\" " lib-init-file))
349+ )))))))
330350
331351% Load module from an openLilyLib library
332352% A module may be an individual file or a whole library, this can also be
@@ -376,8 +396,11 @@ loadModule =
376396 #{ \registerLibrary # (first path-list) #}
377397 ; ; then load the requested module
378398 (oll:log " load module ~a" load-path)
379- (ly:parser-include-string parser
380- (format " \\ include \" ~a\" " load-path))
399+ (if (lilypond-greater-than? " 2.19.21" )
400+ (ly:parser-include-string
401+ (format " \\ include \" ~a\" " load-path))
402+ (ly:parser-include-string parser
403+ (format " \\ include \" ~a\" " load-path)))
381404 (set! oll-loaded-modules
382405 (append ! oll-loaded-modules `(,load-path))))
383406 (oll:warn " module not found: ~a" load-path)))))
0 commit comments