1 ;;;; This file is part of LilyPond, the GNU music typesetter.
3 ;;;; Copyright (C) 1998--2012 Jan Nieuwenhuizen <janneke@gnu.org>
4 ;;;; Han-Wen Nienhuys <hanwen@xs4all.nl>
6 ;;;; LilyPond is free software: you can redistribute it and/or modify
7 ;;;; it under the terms of the GNU General Public License as published by
8 ;;;; the Free Software Foundation, either version 3 of the License, or
9 ;;;; (at your option) any later version.
11 ;;;; LilyPond is distributed in the hope that it will be useful,
12 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;;; GNU General Public License for more details.
16 ;;;; You should have received a copy of the GNU General Public License
17 ;;;; along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
19 ;; Internationalisation: (_i "to be translated") gets an entry in the
20 ;; POT file; (gettext ...) must be invoked explicitly to do the actual
23 ;; (define-macro (_i x) x)
24 ;; (define-macro-public _i (x) x)
25 ;; (define-public-macro _i (x) x)
28 (defmacro-public _i (x) x)
30 ;;; Boolean thunk - are we integrating Guile V2.0 or higher with LilyPond?
31 (define-public (guile-v2)
32 (string>? (version) "1.9.10"))
34 (read-enable 'positions)
38 (debug-enable 'backtrace)
39 (debug-set! show-file-name #t)))
41 (define-public PLATFORM
44 (car (string-tokenize (utsname:sysname (uname)))))))
46 (define scheme-options-definitions
50 ;; - [subject-]object-object-verb +"ing"
51 ;; - [subject-]-verb-object-object
53 ;; Avoid overlong lines in `lilypond -dhelp'! Strings should not
54 ;; be longer than 48 characters per line.
57 "Render at higher resolution (using given factor)
58 and scale down result to prevent jaggies in
61 "Create .tex, .texi, .count files in the
64 "Select backend. Possible values: 'eps, 'null,
65 'ps, 'scm, 'socket, 'svg.")
66 (check-internal-types #f
67 "Check every property assignment for types.")
69 "Generate cut-out snippets of a score.")
71 "LilyPond prefix for data files (read-only).")
73 "Dump memory debugging statistics.")
74 (debug-gc-assert-parsed-dead #f
75 "For memory debugging: Ensure that all
76 references to parsed objects are dead. This is
77 an internal option, and is switched on
78 automatically for `-ddebug-gc'.")
80 "Debug the flex lexer.")
81 (debug-page-breaking-scoring #f
82 "Dump scores for many different page breaking
85 "Debug the bison parser.")
86 (debug-property-callbacks #f
87 "Debug cyclic callback chains.")
90 (delete-intermediate-files #t
91 "Delete unusable, intermediate PostScript files.")
93 "Dump memory and time information for each file.")
95 "Dump timing information (system-dependent).")
97 "Dump output signatures of each system. Used for
100 "Pad left edge of the output EPS bounding box by
101 given amount (in mm).")
103 "Load fonts via Ghostscript.")
104 (gs-load-lily-fonts #f
105 "Load only LilyPond fonts via Ghostscript.")
107 "Run LilyPond from a GUI and redirect stderr to
111 (include-book-title-preview #t
112 "Include book titles in preview images.")
113 (include-eps-fonts #t
114 "Include fonts in separate-system EPS files.")
116 "Include file for global settings, included before the score is processed.")
118 "Process in parallel, using the given number of
121 "If string FOO is given as argument, redirect
122 output to log file `FOO.log'.")
123 (max-markup-depth 1024
124 "Maximum depth for the markup tree. If a markup has more levels,
125 assume it will not terminate on its own, print a warning and return a
126 null markup instead.")
127 (midi-extension ,(if (eq? PLATFORM 'windows)
130 "Set the default file extension for MIDI output
131 file to given string.")
132 (music-strings-to-paths #f
133 "Convert text strings to paths when glyphs belong
136 "Make \\relative mode for simultaneous music work
137 similar to chord syntax.")
139 "Add point & click links to PDF output.")
141 "Set default paper size.")
142 (pixmap-format "png16m"
143 "Set GhostScript's output format for pixel images.")
145 "Create preview images also.")
147 "Print pages in the normal way.")
148 (protected-scheme-parsing #t
149 "Continue when errors in inline scheme are caught
150 in the parser. If #f, halt on errors and print
152 (profile-property-accesses #f
153 "Keep statistics of get_property() calls.")
155 "Set resolution for generating PNG pixmaps to
156 given value (in dpi).")
158 "Specify name of a file which contains a list of
159 input files to be processed.")
160 (relative-includes #f
161 "When processing an \\include command, look for
162 the included file relative to the current file
163 (instead of the root file)")
165 "Run in safer mode.")
166 (separate-log-files #f
167 "For input files `FILE1.ly', `FILE2.ly', ...
168 output log data to files `FILE1.log',
170 (show-available-fonts #f
171 "List available font names.")
172 (strict-infinity-checking #f
173 "Force a crash on encountering Inf and NaN
174 floating point exceptions.")
176 "Don't use directories from input files while
177 constructing output file names.")
179 "Use woff font files in SVG backend.")
180 (trace-memory-frequency #f
181 "Record Scheme cell usage this many times per
182 second. Dump results to `FILE.stacks' and
184 (trace-scheme-coverage #f
185 "Record coverage of Scheme files in `FILE.cov'.")
186 (verbose ,(ly:verbose-output?)
187 "Verbose output, i.e. loglevel at least DEBUG (read-only).")
189 "Change all warning and programming_error
190 messages into errors.")
193 ;; Need to do this in the beginning. Other parts of the Scheme
194 ;; initialization depend on these options.
196 (for-each (lambda (x)
197 (ly:add-option (car x) (cadr x) (caddr x)))
198 scheme-options-definitions)
200 (for-each (lambda (x)
201 (ly:set-option (car x) (cdr x)))
202 (eval-string (ly:command-line-options)))
206 (if (defined? 'set-debug-cell-accesses!)
207 (set-debug-cell-accesses! #f))
209 ;;(set-debug-cell-accesses! 1000)
211 (use-modules (ice-9 regex)
223 (scm safe-utility-defs))
225 (define-public _ gettext)
226 ;;; There are new modules defined in Guile V2.0 which we need to use.
228 ;; Modules and scheme files loaded by lily.scm use currying
229 ;; in Guile V2 this needs a module which is not present in Guile V1.8
234 (ly:debug (_ "Using (ice-9 curried-definitions) module\n"))
235 (use-modules (ice-9 curried-definitions)))
237 (ly:debug (_ "Guile 1.8\n"))))
239 ;; TODO add in modules for V1.8.7 deprecated in V2.0 and integrated
240 ;; into Guile base code, like (ice-9 syncase).
243 (define-public fancy-format
246 (define-public (ergonomic-simple-format dest . rest)
247 "Like ice-9's @code{format}, but without the memory consumption."
249 (apply simple-format (cons #f (cons dest rest)))
250 (apply simple-format (cons dest rest))))
253 ergonomic-simple-format)
256 (define-public (myd k v)
263 (define-public (print . args)
264 (apply format (cons (current-output-port) args)))
267 ;;; General settings.
269 ;;; Debugging evaluator is slower. This should have a more sensible
273 (if (or (ly:get-option 'verbose)
274 (ly:get-option 'trace-memory-frequency)
275 (ly:get-option 'trace-scheme-coverage))
277 (ly:set-option 'protected-scheme-parsing #f)
278 (debug-enable 'backtrace)
279 (read-enable 'positions)))
281 (if (ly:get-option 'trace-scheme-coverage)
284 (define-public parser #f)
286 (define music-string-to-path-backends
289 (if (memq (ly:get-option 'backend) music-string-to-path-backends)
290 (ly:set-option 'music-strings-to-paths #t))
293 (define-public (ly:load x)
294 (let* ((file-name (%search-load-path x)))
295 (ly:debug "[~A" file-name)
297 (ly:error (_ "cannot find: ~A") x))
298 (primitive-load-path file-name) ;; to support Guile V2 autocompile
299 ;; TODO: Any chance to use ly:debug here? Need to extend it to prevent
300 ;; a newline in this case
301 (if (ly:get-option 'verbose)
302 (ly:progress "]\n"))))
305 (let ((platform (string-tokenize
306 (vector-ref (uname) 0) char-set:letter+digit)))
307 (if (null? (cdr platform)) #f
308 (member (string-downcase (cadr platform)) '("95" "98" "me")))))
311 (if (string-index x #\\)
313 (string-regexp-substitute
315 (string-regexp-substitute "\\\\" "/" x))))
317 (define-public (ly-getcwd)
318 (if (eq? PLATFORM 'windows)
322 (define-public (is-absolute? file-name)
323 (let ((file-name-length (string-length file-name)))
324 (if (= file-name-length 0)
326 (or (eq? (string-ref file-name 0) #\/)
327 (and (eq? PLATFORM 'windows)
328 (> file-name-length 2)
329 (eq? (string-ref file-name 1) #\:)
330 (eq? (string-ref file-name 2) #\/))))))
332 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
333 ;;; If necessary, emulate Guile V2 module_export_all! for Guile V1.8.n
336 (define (module-export-all! mod)
337 (define (fresh-interface!)
338 (let ((iface (make-module)))
339 (set-module-name! iface (module-name mod))
340 ;; for guile 2: (set-module-version! iface (module-version mod))
341 (set-module-kind! iface 'interface)
342 (set-module-public-interface! mod iface)
344 (let ((iface (or (module-public-interface mod)
345 (fresh-interface!))))
346 (set-module-obarray! iface (module-obarray mod))))))
349 (define-safe-public (lilypond-version)
351 (map (lambda (x) (if (symbol? x)
357 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
360 (ly:set-default-scale (ly:make-scale #(0 1 2 5/2 7/2 9/2 11/2)))
362 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
366 ;; List of Scheme files to be loaded into the (lily) module.
368 ;; - Library definitions, need to be at the head of the list
369 (define init-scheme-files-lib
372 ;; - Files containing definitions used later by other files later in load
373 (define init-scheme-files-used
374 '("markup-macros.scm"
375 "parser-ly-from-scheme.scm"))
376 ;; - Main body of files to be loaded
377 (define init-scheme-files-body
379 "define-event-classes.scm"
380 "define-music-callbacks.scm"
381 "define-music-types.scm"
382 "define-note-names.scm"
386 "define-markup-commands.scm"
388 "modal-transforms.scm"
389 "chord-generic-names.scm"
390 "chord-ignatzek-names.scm"
391 "music-functions.scm"
394 "define-music-properties.scm"
395 "time-signature-settings.scm"
399 "ly-syntax-constructors.scm"
401 "define-context-properties.scm"
402 "translation-functions.scm"
415 "define-woodwind-diagrams.scm"
416 "display-woodwind-diagrams.scm"
417 "predefined-fretboards.scm"
418 "define-grob-properties.scm"
420 "define-grob-interfaces.scm"
421 "define-stencil-commands.scm"
426 "backend-library.scm"
428 ;; - Files to be loaded last
429 (define init-scheme-files-tail
430 ;; - must be after everything has been defined
433 ;; Now construct the load list
435 (define init-scheme-files
436 (append init-scheme-files-lib
437 init-scheme-files-used
438 init-scheme-files-body
439 init-scheme-files-tail))
441 (for-each ly:load init-scheme-files)
443 (define-public r5rs-primary-predicates
444 `((,boolean? . "boolean")
445 (,char? . "character")
446 (,number? . "number")
449 (,procedure? . "procedure")
450 (,string? . "string")
451 (,symbol? . "symbol")
452 (,vector? . "vector")))
454 (define-public r5rs-secondary-predicates
455 `((,char-alphabetic? . "alphabetic character")
456 (,char-lower-case? . "lower-case character")
457 (,char-numeric? . "numeric character")
458 (,char-upper-case? . "upper-case character")
459 (,char-whitespace? . "whitespace character")
461 (,complex? . "complex number")
462 (,even? . "even number")
463 (,exact? . "exact number")
464 (,inexact? . "inexact number")
465 (,integer? . "integer")
466 (,negative? . "negative number")
467 (,odd? . "odd number")
468 (,positive? . "positive number")
469 (,rational? . "rational number")
470 (,real? . "real number")
476 (,input-port? . "input port")
477 (,output-port? . "output port")
479 ;; would this ever be used?
480 (,eof-object? . "end-of-file object")
483 (define-public guile-predicates
484 `((,hash-table? . "hash table")
487 (define-public lilypond-scheme-predicates
488 `((,boolean-or-symbol? . "boolean or symbol")
490 (,cheap-list? . "list")
491 (,fraction? . "fraction, as pair")
492 (,grob-list? . "list of grobs")
493 (,index? . "non-negative integer")
494 ;; this is built on cheap-list
495 (,list-or-symbol? . "list or symbol")
496 (,markup? . "markup")
497 (,markup-command-list? . "markup command list")
498 (,markup-list? . "markup list")
499 (,moment-pair? . "pair of moment objects")
500 (,number-list? . "number list")
501 (,number-or-grob? . "number or grob")
502 (,number-or-pair? . "number or pair")
503 (,number-or-string? . "number or string")
504 (,number-pair? . "pair of numbers")
505 (,rhythmic-location? . "rhythmic location")
506 (,scheme? . "any type")
507 (,string-or-pair? . "string or pair")
508 (,string-or-symbol? . "string or symbol")
512 (define-public lilypond-exported-predicates
513 `((,ly:book? . "book")
515 (,ly:context? . "context")
516 (,ly:context-def? . "context definition")
517 (,ly:context-mod? . "context modification")
518 (,ly:dimension? . "dimension, in staff space")
519 (,ly:dir? . "direction")
520 (,ly:dispatcher? . "dispatcher")
521 (,ly:duration? . "duration")
522 (,ly:event? . "post event")
523 (,ly:font-metric? . "font metric")
524 (,ly:grob? . "graphical (layout) object")
525 (,ly:grob-array? . "array of grobs")
526 (,ly:input-location? . "input location")
528 (,ly:iterator? . "iterator")
529 (,ly:lily-lexer? . "lily-lexer")
530 (,ly:lily-parser? . "lily-parser")
531 (,ly:listener? . "listener")
532 (,ly:moment? . "moment")
533 (,ly:music? . "music")
534 (,ly:music-function? . "music function")
535 (,ly:music-list? . "list of music objects")
536 (,ly:music-output? . "music output")
537 (,ly:otf-font? . "OpenType font")
538 (,ly:output-def? . "output definition")
539 (,ly:page-marker? . "page marker")
540 (,ly:pango-font? . "pango font")
541 (,ly:paper-book? . "paper book")
542 (,ly:paper-system? . "paper-system Prob")
543 (,ly:pitch? . "pitch")
544 (,ly:prob? . "property object")
545 (,ly:score? . "score")
546 (,ly:simple-closure? . "simple closure")
547 (,ly:skyline? . "skyline")
548 (,ly:skyline-pair? . "pair of skylines")
549 (,ly:source-file? . "source file")
550 (,ly:spanner? . "spanner")
551 (,ly:spring? . "spring")
552 (,ly:stencil? . "stencil")
553 (,ly:stream-event? . "stream event")
554 (,ly:translator? . "translator")
555 (,ly:translator-group? . "translator group")
556 (,ly:unpure-pure-container? . "unpure/pure container")
560 (set! type-p-name-alist
561 (append r5rs-primary-predicates
562 r5rs-secondary-predicates
564 lilypond-scheme-predicates
565 lilypond-exported-predicates))
568 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
571 (define (profile-measurements)
574 (list (- (+ (tms:cutime t)
576 (assoc-get 'gc-time-taken stats))
577 (assoc-get 'total-cells-allocated stats 0))))
579 (define (dump-profile base last this)
580 (let* ((outname (format #f "~a.profile" (dir-basename base ".ly")))
581 (diff (map (lambda (y) (apply - y)) (zip this last))))
582 (ly:progress "\nWriting timing to ~a..." outname)
583 (format (open-file outname "w")
584 "time: ~a\ncells: ~a\n"
585 (if (ly:get-option 'dump-cpu-profile)
590 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
591 ;; debug memory leaks
596 (define gc-protect-stat-count
599 (define-public (dump-live-object-stats outfile)
600 (for-each (lambda (x)
601 (format outfile "~a: ~a\n" (car x) (cdr x)))
602 (sort (gc-live-object-stats)
604 (string<? (car x) (car y))))))
606 (define-public (dump-gc-protects)
607 (set! gc-protect-stat-count (1+ gc-protect-stat-count))
608 (let* ((protects (sort (hash-table->alist (ly:protects))
610 (< (object-address (car a))
611 (object-address (car b))))))
612 (out-file-name (string-append
613 "gcstat-" (number->string gc-protect-stat-count)
615 (outfile (open-file out-file-name "w")))
617 (ly:progress "Dumping GC statistics ~a...\n" out-file-name)
618 (for-each (lambda (y)
621 (format outfile "~a (~a) = ~a\n" (object-address x) c x)))
624 (not (symbol? (car x))))
626 (format outfile "\nprotected symbols: ~a\n"
627 (apply + (map (lambda (obj-count)
628 (if (symbol? (car obj-count))
633 ;; (display (ly:smob-protects))
635 (if (defined? 'gc-live-object-stats)
637 (ly:progress "Live object statistics: GC'ing\n")
641 (ly:progress "Asserting dead objects\n")
642 (ly:set-option 'debug-gc-assert-parsed-dead #t)
644 (ly:set-option 'debug-gc-assert-parsed-dead #f)
645 (set! stats (gc-live-object-stats))
646 (ly:progress "Dumping live object statistics.\n")
647 (dump-live-object-stats outfile)))
649 (let* ((stats (gc-stats)))
650 (for-each (lambda (sym)
651 (format outfile "~a ~a ~a\n"
652 gc-protect-stat-count
654 (assoc-get sym stats "?")))
655 '(protected-objects bytes-malloced cell-heap-size)))
657 (close-port outfile)))
659 (define (check-memory)
660 "Read `/proc/self' to check up on memory use."
661 (define (gulp-file name)
662 (let* ((file (open-input-file name))
663 (text (read-delimited "" file)))
667 (let* ((stat (gulp-file "/proc/self/status"))
668 (lines (string-split stat #\newline))
669 (interesting (filter identity
672 (string-match "^VmData:[ \t]*([0-9]*) kB" l))
674 (mem (string->number (match:substring (car interesting) 1))))
675 (format #t "VMDATA: ~a\n" mem)
679 (begin (dump-gc-protects)
682 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
684 (define (multi-fork count)
685 "Split this process into COUNT helpers. Returns either a list of
686 PIDs or the number of the process."
687 (define (helper count acc)
689 (let* ((pid (primitive-fork)))
692 (helper (1- count) (cons pid acc))))
697 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
699 (define* (ly:exit status #:optional (silently #f))
700 "Exit function for lilypond"
703 ((0) (ly:basic-progress (_ "Success: compilation successfully completed")))
704 ((1) (ly:warning (_ "Compilation completed with warnings or errors")))
705 (else (ly:message ""))))
708 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
710 (define-public (lilypond-main files)
711 "Entry point for LilyPond."
712 (eval-string (ly:command-line-code))
713 (if (ly:get-option 'help)
714 (begin (ly:option-usage)
716 (if (ly:get-option 'show-available-fonts)
717 (begin (ly:font-config-display-fonts)
719 (if (ly:get-option 'gui)
724 (if (ly:get-option 'read-file-list)
727 (> (string-length s) 0))
730 (string-split (ly:gulp-file f) #\nl))
732 (if (and (number? (ly:get-option 'job-count))
733 (>= (length files) (ly:get-option 'job-count)))
734 (let* ((count (ly:get-option 'job-count))
735 (split-todo (split-list files count))
736 (joblist (multi-fork count))
738 (if (not (string-or-symbol? (ly:get-option 'log-file)))
739 (ly:set-option 'log-file "lilypond-multi-run"))
740 (if (number? joblist)
741 (begin (ly:set-option
742 'log-file (format #f "~a-~a"
743 (ly:get-option 'log-file) joblist))
744 (set! files (vector-ref split-todo joblist)))
745 (begin (ly:progress "\nForking into jobs: ~a\n" joblist)
748 (let* ((stat (cdr (waitpid pid))))
751 (acons (list-element-index joblist pid)
758 (logfile (format #f "~a-~a.log"
759 (ly:get-option 'log-file) job))
760 (log (ly:gulp-file logfile))
761 (len (string-length log))
762 (tail (substring log (max 0 (- len 1024)))))
763 (if (status:term-sig state)
766 (format #f (_ "job ~a terminated with signal: ~a")
767 job (status:term-sig state)))
769 (_ "logfile ~a (exit ~a):\n~a")
770 logfile (status:exit-val state) tail))))
773 (ly:error "Children ~a exited with errors."
775 ;; must overwrite individual entries
776 (if (ly:get-option 'dump-profile)
777 (dump-profile "lily-run-total"
778 '(0 0) (profile-measurements)))
783 (if (string-or-symbol? (ly:get-option 'log-file))
784 (ly:stderr-redirect (format #f "~a.log" (ly:get-option 'log-file)) "w"))
785 (let ((failed (lilypond-all files)))
786 (if (ly:get-option 'trace-scheme-coverage)
788 (coverage:show-all (lambda (f)
789 (string-contains f "lilypond")))))
791 (begin (ly:error (_ "failed files: ~S") (string-join failed))
797 (define-public (lilypond-all files)
799 (separate-logs (ly:get-option 'separate-log-files))
802 (open-file (if (string-or-symbol? (ly:get-option 'log-file))
803 (format #f "~a.log" (ly:get-option 'log-file))
804 "/dev/stderr") "a") #f))
805 (do-measurements (ly:get-option 'dump-profile))
806 (handler (lambda (key failed-file)
807 (set! failed (append (list failed-file) failed)))))
811 (let* ((start-measurements (if do-measurements
812 (profile-measurements)
814 (base (dir-basename x ".ly"))
815 (all-settings (ly:all-options)))
817 (ly:stderr-redirect (format #f "~a.log" base) "w"))
819 (format ping-log "Processing ~a\n" base))
820 (if (ly:get-option 'trace-memory-frequency)
821 (mtrace:start-trace (ly:get-option 'trace-memory-frequency)))
822 (lilypond-file handler x)
823 (ly:check-expected-warnings)
824 (if start-measurements
825 (dump-profile x start-measurements (profile-measurements)))
826 (if (ly:get-option 'trace-memory-frequency)
827 (begin (mtrace:stop-trace)
828 (mtrace:dump-results base)))
829 (for-each (lambda (s)
830 (ly:set-option (car s) (cdr s)))
832 (ly:set-option 'debug-gc-assert-parsed-dead #t)
834 (ly:set-option 'debug-gc-assert-parsed-dead #f)
835 (if (ly:get-option 'debug-gc)
837 (ly:reset-all-fonts))
841 ;; Ensure a notice re failed files is written to aggregate logfile.
843 (format ping-log "Failed files: ~a\n" failed))
844 (if (ly:get-option 'dump-profile)
845 (dump-profile "lily-run-total" '(0 0) (profile-measurements)))
848 (define (lilypond-file handler file-name)
849 (catch 'ly-file-failed
850 (lambda () (ly:parse-file file-name))
851 (lambda (x . args) (handler x file-name))))
853 (use-modules (scm editor))
855 (define-public (gui-main files)
857 (gui-no-files-handler))
858 (if (not (string? (ly:get-option 'log-file)))
859 (let* ((base (dir-basename (car files) ".ly"))
860 (log-name (string-append base ".log")))
861 (if (not (ly:get-option 'gui))
862 (ly:message (_ "Redirecting output to ~a...") log-name))
863 (ly:stderr-redirect log-name "w")
864 (ly:message "# -*-compilation-*-"))
865 (let ((failed (lilypond-all files)))
869 (ly:stderr-redirect "foo" "r")
870 (system (get-editor-command log-name 0 0 0))
871 (ly:error (_ "failed files: ~S") (string-join failed))
876 (define (gui-no-files-handler)
877 (let* ((ly (string-append (ly:effective-prefix) "/ly/"))
878 ;; FIXME: soft-code, localize
879 (welcome-ly (string-append ly "Welcome_to_LilyPond.ly"))
880 (cmd (get-editor-command welcome-ly 0 0 0)))
881 (ly:message (_ "Invoking `~a'...\n") cmd)