1 %% Toplevel initialisation file.
3 %% switch on debugging.
4 #(if
(and
#t
(defined?
'set-debug-cell-accesses
!))
5 (set-debug-cell-accesses
! 5000))
9 \include "declarations-init.ly"
12 #(ly
:set-option
'old-relative
#f)
13 #(define toplevel-scores
(list
))
14 #(define toplevel-bookparts
(list
))
15 #(define $defaultheader
#f)
16 #(define $current-book
#f)
17 #(define $current-bookpart
#f)
18 #(define version-seen
#f)
19 #(define expect-error
#f)
20 #(define output-empty-score-list
#f)
21 #(define output-suffix
#f)
22 #(define book-filename
#f)
23 #(define book-output-suffix
#f)
24 #(use-modules
(scm clip-region
))
26 #(if
(ly
:get-option
'include-settings
)
27 (ly
:parser-include-string parser
28 (format
"\\include \"~a\"" (ly
:get-option
'include-settings
))))
31 %% there is a problem at the end of the input file
34 %% Above and below comments compensate for the parser's look-ahead.
37 #(if
(and
(ly
:get-option
'old-relative
)
38 (defined?
'input-file-name
)
39 (not
(ly
:get-option
'old-relative-used
)))
40 (old-relative-not-used-message input-file-name
))%% there is a problem at the end of the input file
42 #(if
(and
(not version-seen
)
43 (defined?
'input-file-name
))
44 (version-not-seen-message input-file-name
))
46 #(ly
:set-option
'protected-scheme-parsing
#f)
48 #(let
((book-handler
(if
(defined?
'default-toplevel-book-handler
)
49 default-toplevel-book-handler
50 toplevel-book-handler
)))
51 (cond
((pair? toplevel-bookparts
)
52 (let
((book
(ly
:make-book $defaultpaper $defaultheader
)))
54 (ly
:book-add-bookpart
! book part
))
55 (reverse
! toplevel-bookparts
))
56 (set
! toplevel-bookparts
(list
))
57 ;; if scores have been defined after the last explicit
\bookpart:
58 (if
(pair? toplevel-scores
)
60 (ly
:book-add-score
! book score
))
61 (reverse
! toplevel-scores
)))
62 (set
! toplevel-scores
(list
))
63 (book-handler parser book
)))
64 ((or
(pair? toplevel-scores
) output-empty-score-list
)
65 (let
((book
(apply ly
:make-book $defaultpaper
66 $defaultheader toplevel-scores
)))
67 (set
! toplevel-scores
(list
))
68 (book-handler parser book
)))))
70 #(if
(eq? expect-error
(ly
:parser-has-error? parser
))
71 (ly
:parser-clear-error parser
)
73 (ly
:parser-error parser
(_ "expected error, but none found"))))