[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Identify included files
From: |
David Kastrup |
Subject: |
Re: Identify included files |
Date: |
Fri, 15 May 2020 23:04:27 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
"Fr. Samuel Springuel" <address@hidden> writes:
> Before I start writing a script to do this, is there an existing tool
> which will identify all the `\include` files that a LilyPond file
> depends on? Even better, one that will work in a recursive fashion?
You can use a file like
%% Toplevel initialisation file.
\version "2.19.22"
#(if (guile-v2)
(begin
(use-modules (ice-9 curried-definitions))
(setlocale LC_ALL "")
(setlocale LC_NUMERIC "C")))
#(session-initialize
(lambda ()
;; we can't use ly:parser-include-string here since that does not
;; actually do any parsing but merely switches inputs, so the
;; session saved by the session initializer after calling this
;; function has not actually started. A parser clone, in contrast,
;; can run and complete synchronously and shares the module with
;; the current parser.
(ly:parser-parse-string (ly:parser-clone)
"\\include \"declarations-init.ly\"")))
#(define (do-nothing . x) #f)
#(define toplevel-book-handler do-nothing)
#(define toplevel-bookpart-handler do-nothing)
#(define toplevel-music-handler do-nothing)
#(define toplevel-score-handler do-nothing)
#(define toplevel-text-handler do-nothing)
#(define book-bookpart-handler do-nothing)
#(define book-music-handler do-nothing)
#(define book-score-handler do-nothing)
#(define book-text-handler do-nothing)
#(define bookpart-score-handler do-nothing)
#(define bookpart-text-handler do-nothing)
#(define bookpart-music-handler do-nothing)
#(define output-def-music-handler do-nothing)
#(define context-mod-music-handler do-nothing)
#(note-names-language default-language)
#(define toplevel-scores (list))
#(define toplevel-bookparts (list))
#(define $defaultheader #f)
#(define $current-book #f)
#(define $current-bookpart #f)
#(define version-seen #f)
#(define expect-error #f)
#(define output-empty-score-list #f)
#(define output-suffix #f)
#(use-modules (scm clip-region))
#(use-modules (srfi srfi-1))
#(use-modules (ice-9 pretty-print))
\maininput
#(format #t "~{~a\n~^~}" (ly:source-files))
and call it with
lilypond --init parse-only.ly actual-file-name.ly 2> /dev/null
and it should be pretty fast. Of course the file list includes
parse-only.ly...
--
David Kastrup
- Re: Identify included files, (continued)
- Re: Identify included files, antlists, 2020/05/21
- Re: Identify included files, David Wright, 2020/05/21
- Re: Identify included files, Wols Lists, 2020/05/22
- Re: Identify included files, Michael Gerdau, 2020/05/23
- Re: Identify included files, antlists, 2020/05/23
- Re: Identify included files, David Wright, 2020/05/23
- Re: Identify included files, Fr. Samuel Springuel, 2020/05/22
- Re: Identify included files, antlists, 2020/05/18
- Re: Identify included files, David Wright, 2020/05/18
- Re: Identify included files, Urs Liska, 2020/05/18
Re: Identify included files,
David Kastrup <=