]> git.donarmstrong.com Git - lilypond.git/blob - scm/lily.scm
Merge with master
[lilypond.git] / scm / lily.scm
1 ;;;; lily.scm -- toplevel Scheme stuff
2 ;;;;
3 ;;;;  source file of the GNU LilyPond music typesetter
4 ;;;; 
5 ;;;; (c) 1998--2006 Jan Nieuwenhuizen <janneke@gnu.org>
6 ;;;; Han-Wen Nienhuys <hanwen@xs4all.nl>
7
8 ;; Internationalisation: (_i "to be translated") gets an entry in the
9 ;; POT file (gettext ) must be invoked explicitely to do the actual
10 ;; "translation".
11 ;;(define-macro (_i x) x)
12 ;;(define-macro-public _i (x) x)
13 ;;(define-public-macro _i (x) x)
14 ;; Abbrv-PWR!
15 (defmacro-public _i (x) x)
16
17 (read-enable 'positions)
18 (debug-enable 'debug)
19
20
21 (define (define-scheme-options)
22   (for-each (lambda (x)
23               (ly:add-option (car x) (cadr x) (caddr x)))
24           
25             `(
26
27               ;; NAMING: either
28
29               ;; - [subject-]object-object-verb +"ing"
30               ;; - [subject-]-verb-object-object
31
32               (anti-alias-factor 1 "render at higher resolution and scale down result\nto prevent jaggies in PNG")
33               (check-internal-types #f "check every property assignment for types")
34               (clip-systems #f "Generate cut-out snippets of a score")
35               (debug-gc #f "dump memory debugging statistics")
36               (debug-gc-assert-parsed-dead #f "for memory debugging:
37 ensure that all refs to parsed objects are dead.  This is an internal option, and is switched on automatically for -ddebug-gc.") 
38               (debug-lexer #f "debug the flex lexer")
39               (debug-parser #f "debug the bison parser")
40               (debug-skylines #f "debug skylines")
41               (delete-intermediate-files #f
42                                          "delete unusable PostScript files")
43               (dump-profile #f "dump timing information for each file")
44               (dump-signatures #f "dump output signatures of each system.  Used for regression testing.")
45               
46               (eps-box-padding #f "Pad EPS bounding box left edge.  Guarantee alignment between systems in LaTeX.")
47               (gs-load-fonts #f
48                             "load fonts via Ghostscript.")
49               (gui #f "running from gui; redirect stderr to log file")
50
51               (include-book-title-preview #t "include book-titles in preview images.")
52               (include-eps-fonts #t "Include fonts in separate-system EPS files.")
53               (job-count #f "Process in parallel") 
54               (log-file #f "redirect output to log FILE.log")
55
56               (old-relative #f
57                             "relative for simultaneous music works
58 similar to chord syntax")
59               (point-and-click #t "use point & click")
60               (paper-size "a4" "the default paper size")
61               (pixmap-format "png16m" "GS format to use for pixel images")
62               (protected-scheme-parsing #t "continue when finding errors in inline
63 scheme are caught in the parser. If off, halt 
64 on errors, and print a stack trace.")
65               (profile-property-accesses #f "keep statistics of get_property() calls.")
66               
67               (resolution 101 "resolution for generating PNG bitmaps")
68               (read-file-list #f "Read files to be processed from command line arguments")
69
70               (safe #f "Run safely")
71               (strict-infinity-checking #f "If yes, crash on encountering Inf/NaN.")
72               (separate-log-files #f "Output to FILE.log per file.")
73               (trace-memory-frequency #f "Record Scheme cell usage this many times per second, and dump to file.")
74               (ttf-verbosity 0
75                              "how much verbosity for TTF font embedding?")
76               (show-available-fonts #f
77                                     "List font names available.")
78               (verbose ,(ly:command-line-verbose?) "value for the --verbose flag")
79               ))
80
81   (map
82    (lambda (x)
83      (ly:set-option (car x) (cdr x))) 
84    (eval-string (ly:command-line-options))))
85
86
87 ;; need to do this in the beginning. Other parts of the
88 ;; Scheme init depend on these options.
89 ;;
90 (define-scheme-options)
91
92
93
94 (debug-set! stack 0)
95
96 (if (defined? 'set-debug-cell-accesses!)
97     (set-debug-cell-accesses! #f))
98
99                                         ;(set-debug-cell-accesses! 1000)
100
101 (use-modules (ice-9 regex)
102              (ice-9 safe)
103              (ice-9 rdelim)
104              (ice-9 optargs)
105              (oop goops)
106              (srfi srfi-1)
107              (srfi srfi-13)
108              (srfi srfi-14)
109              (scm clip-region)
110              (scm memory-trace)
111              )
112
113 ;; my display
114 (define-public (myd k v) (display k) (display ": ") (display v) (display ", ")
115   v)
116
117 (define-public (print . args)
118   (apply format (cons (current-output-port) args)))
119
120
121 ;;; General settings
122 ;;; debugging evaluator is slower.  This should
123 ;;; have a more sensible default.
124
125 (if (ly:get-option 'verbose)
126     (begin
127       (ly:set-option 'protected-scheme-parsing #f)
128       (debug-enable 'debug)
129       (debug-enable 'backtrace)
130       (read-enable 'positions)))
131
132 (define-public tex-backend?
133   (member (ly:output-backend) '("texstr" "tex")))
134
135 (define-public parser #f)
136
137 (define-public (lilypond-version)
138   (string-join
139    (map (lambda (x) (if (symbol? x)
140                         (symbol->string x)
141                         (number->string x)))
142         (ly:version))
143    "."))
144
145
146 ;; TeX C++ code actually hooks into TEX_STRING_HASHLIMIT 
147 (define-public TEX_STRING_HASHLIMIT 10000000)
148
149
150
151 ;; gettext wrapper for guile < 1.7.2
152 (if (defined? 'gettext)
153     (define-public _ gettext)
154     (define-public _ ly:gettext))
155
156 (define-public (ly:load x)
157   (let* ((file-name (%search-load-path x)))
158     (if (ly:get-option 'verbose)
159         (ly:progress "[~A" file-name))
160     (if (not file-name)
161         (ly:error (_ "cannot find: ~A") x))
162     (primitive-load file-name)
163     (if (ly:get-option 'verbose)
164         (ly:progress "]"))))
165
166 ;; Cygwin
167 ;; #(CYGWIN_NT-5.1 Hostname 1.5.12(0.116/4/2) 2004-11-10 08:34 i686)
168 ;;
169 ;; Debian
170 ;; #(Linux hostname 2.4.27-1-686 #1 Fri Sep 3 06:28:00 UTC 2004 i686)
171 ;;
172 ;; Mingw
173 ;; #(Windows XP HOSTNAME build 2600 5.01 Service Pack 1 i686)
174 ;;
175
176 ;; ugh, code dup.
177 (define-public PLATFORM
178   (string->symbol
179    (string-downcase
180     (car (string-tokenize (vector-ref (uname) 0) char-set:letter)))))
181
182 (define-public DOS
183   (let ((platform (string-tokenize
184                    (vector-ref (uname) 0) char-set:letter+digit)))
185     (if (null? (cdr platform)) #f
186         (member (string-downcase (cadr platform)) '("95" "98" "me")))))
187
188 (case PLATFORM
189   ((windows)
190    (define native-getcwd getcwd)
191    (define (slashify x)
192      (if (string-index x #\\)
193          x
194          (string-regexp-substitute
195           "//*" "/"
196           (string-regexp-substitute "\\\\" "/" x))))
197    ;; FIXME: this prints a warning.
198    (define-public (ly-getcwd)
199      (slashify (native-getcwd))))
200   (else (define-public ly-getcwd getcwd)))
201
202 (define-public (is-absolute? file-name)
203   (let ((file-name-length (string-length file-name)))
204     (if (= file-name-length 0)
205         #f
206         (or (eq? (string-ref file-name 0) #\/)
207             (and (eq? PLATFORM 'windows)
208                  (> file-name-length 2)
209                  (eq? (string-ref file-name 1) #\:)
210                  (eq? (string-ref file-name 2) #\/))))))
211
212 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
213
214 (define (type-check-list location signature arguments)
215   "Typecheck a list of arguments against a list of type
216 predicates. Print a message at LOCATION if any predicate failed."
217
218   (define (recursion-helper signature arguments count) 
219     (define (helper pred? arg count) 
220       (if (not (pred? arg))
221
222           (begin
223             (ly:input-message
224              location
225              (format
226               #f (_ "wrong type for argument ~a.  Expecting ~a, found ~s")
227               count (type-name pred?) arg))
228             #f)
229           #t))
230
231     (if (null? signature)
232         #t
233         (and (helper (car signature) (car arguments) count)
234              (recursion-helper (cdr signature) (cdr arguments) (1+ count)))))
235
236   (recursion-helper signature arguments 1))
237
238 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
239 ;;  output
240
241
242 ;;(define-public (output-framework) (write "hello\n"))
243
244 (define output-tex-module
245   (make-module 1021 (list (resolve-interface '(scm output-tex)))))
246 (define output-ps-module
247   (make-module 1021 (list (resolve-interface '(scm output-ps)))))
248
249 (define-public (ps-output-expression expr port)
250   (display (eval expr output-ps-module) port))
251
252 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
253 ;; Safe definitions utility
254 (define safe-objects (list))
255
256 (define-macro (define-safe-public arglist . body)
257   "Define a variable, export it, and mark it as safe, ie usable in LilyPond safe mode.
258 The syntax is the same as `define*-public'."
259   (define (get-symbol arg)
260     (if (pair? arg)
261         (get-symbol (car arg))
262         arg))
263   (let ((safe-symbol (get-symbol arglist)))
264     `(begin
265        (define*-public ,arglist
266          ,@body)
267        (set! safe-objects (cons (cons ',safe-symbol ,safe-symbol)
268                                 safe-objects))
269        ,safe-symbol)))
270
271 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
272 ;; init pitch system
273
274 (ly:set-default-scale (ly:make-scale #(0 1 2 5/2 7/2 9/2 11/2)))
275
276
277
278 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
279 ;; other files.
280
281
282 (define
283   init-scheme-files
284   '("lily-library.scm"
285             "file-cache.scm"
286             "define-event-classes.scm"
287             "define-music-types.scm"
288             "output-lib.scm"
289             "c++.scm"
290             "chord-ignatzek-names.scm"
291             "chord-entry.scm"
292             "chord-generic-names.scm"
293             "stencil.scm"
294             "markup.scm"
295             "music-functions.scm"
296             "part-combiner.scm"
297             "autochange.scm"
298             "define-music-properties.scm"
299             "auto-beam.scm"
300             "chord-name.scm"
301
302             "parser-ly-from-scheme.scm"
303             "ly-syntax-constructors.scm"
304             
305             "define-context-properties.scm"
306             "translation-functions.scm"
307             "script.scm"
308             "midi.scm"
309             "layout-beam.scm"
310             "parser-clef.scm"
311             "layout-slur.scm"
312             "font.scm"
313             "encoding.scm"
314             
315             "fret-diagrams.scm"
316             "define-markup-commands.scm"
317             "define-grob-properties.scm"
318             "define-grobs.scm"
319             "define-grob-interfaces.scm"
320             "define-stencil-commands.scm"
321             "titling.scm"
322             
323             "paper.scm"
324             "backend-library.scm"
325             "x11-color.scm"
326
327             ;; must be after everything has been defined
328             "safe-lily.scm"))
329
330
331
332
333 (for-each ly:load init-scheme-files)
334
335
336 (set! type-p-name-alist
337       `(
338         (,boolean-or-symbol? . "boolean or symbol")
339         (,boolean? . "boolean")
340         (,char? . "char")
341         (,grob-list? . "list of grobs")
342         (,hash-table? . "hash table")
343         (,input-port? . "input port")
344         (,integer? . "integer")
345         (,list? . "list")
346         (,ly:context? . "context")
347         (,ly:dimension? . "dimension, in staff space")
348         (,ly:dir? . "direction")
349         (,ly:duration? . "duration")
350         (,ly:grob? . "layout object")
351         (,ly:input-location? . "input location")
352         (,ly:moment? . "moment")
353         (,ly:music? . "music")
354         (,ly:pitch? . "pitch")
355         (,ly:translator? . "translator")
356         (,ly:font-metric? . "font metric")
357         (,ly:simple-closure? . "simple closure")
358         (,markup-list? . "list of markups")
359         (,markup? . "markup")
360         (,ly:music-list? . "list of music")
361         (,number-or-grob? . "number or grob")
362         (,number-or-string? . "number or string")
363         (,number-pair? . "pair of numbers")
364         (,number? . "number")
365         (,output-port? . "output port")   
366         (,pair? . "pair")
367         (,procedure? . "procedure")
368         (,rhythmic-location? . "rhythmic location")
369         (,scheme? . "any type")
370         (,string? . "string")
371         (,symbol? . "symbol")
372         (,vector? . "vector")))
373
374 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
375 ;; timing
376
377 (define (profile-measurements)
378   (let* ((t (times))
379          (stats (gc-stats)))
380     
381     (list
382      (- (+ (tms:cutime t)
383            (tms:utime t))
384         (ly:assoc-get 'gc-time-taken stats))
385      
386      (ly:assoc-get 'total-cells-allocated  stats 0)
387      )))
388
389 (define (dump-profile base last this)
390   (let*
391       ((outname (format "~a.profile" (basename base ".ly")))
392        (diff (map (lambda (y) (apply - y)) (zip this last))))
393     
394     (ly:progress "\nWriting timing to ~a..." outname)
395     (format (open-file outname "w")
396             "time: ~a\ncells: ~a\n"
397             (car diff)
398             (cadr diff)
399             )))
400
401
402 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
403 ;; debug mem leaks
404
405 (define gc-dumping #f)
406 (define gc-protect-stat-count 0)
407
408 (define-public (dump-live-object-stats outfile)
409   (for-each
410    (lambda (x)
411      (format outfile "~a: ~a\n" (car x) (cdr x)))
412    (sort (gc-live-object-stats)
413          (lambda (x y)
414            (string<? (car x) (car y))))))
415
416 (define-public (dump-gc-protects)
417   (set! gc-protect-stat-count (1+ gc-protect-stat-count))
418   (let* ((protects (sort
419                     (hash-table->alist (ly:protects))
420                     (lambda (a b)
421                       (< (object-address (car a))
422                          (object-address (car b))))))
423
424          (out-file-name (string-append
425                          "gcstat-" (number->string gc-protect-stat-count)
426                          ".scm"))
427          (outfile    (open-file  out-file-name  "w")))
428
429     (set! gc-dumping #t)
430     (display (format "Dumping GC statistics ~a...\n" out-file-name))
431     (display
432      (map (lambda (y)
433             (let ((x (car y))
434                   (c (cdr y)))
435               (display 
436                (format "~a (~a) = ~a\n" (object-address x) c x)
437                outfile)))
438           (filter
439            (lambda (x)
440              (not (symbol? (car x))))
441            protects))
442      outfile)
443
444     (format outfile "\nprotected symbols: ~a\n"
445             (length (filter symbol?  (map car protects))))
446     
447              
448
449     ;; (display (ly:smob-protects))
450     (newline outfile)
451     (if (defined? 'gc-live-object-stats)
452         (let* ((stats #f))
453           (display "Live object statistics: GC'ing\n")
454           (ly:reset-all-fonts)
455           (gc)
456           (gc)
457           (display "Asserting dead objects\n")
458           (ly:set-option 'debug-gc-assert-parsed-dead #t)
459           (gc)
460           (ly:set-option 'debug-gc-assert-parsed-dead #f)
461
462           (set! stats (gc-live-object-stats))
463           (display "Dumping live object statistics.\n")
464           (dump-live-object-stats outfile)))
465
466     (newline outfile)
467     (let*
468         ((stats (gc-stats)))
469       
470       (for-each
471        (lambda (sym)
472          (display
473           (format "~a ~a ~a\n"
474                   gc-protect-stat-count
475                   sym
476                   (let ((sym-stat (assoc sym stats)))
477                     (if sym-stat 
478                         (cdr sym-stat)
479                         "?")))
480           outfile))
481        '(protected-objects bytes-malloced cell-heap-size
482                            
483                            )))
484
485     (set! gc-dumping #f)
486     (close-port outfile)
487     
488     ))
489
490
491 (define (check-memory)
492   "read /proc/self to check up on memory use." 
493   (define (gulp-file name)
494     (let* ((file (open-input-file name))
495            (text (read-delimited "" file)))
496       (close file)
497       text))
498   (let*
499       ((stat (gulp-file "/proc/self/status"))
500        (lines (string-split stat #\newline))
501        (interesting (filter identity
502                             (map
503                              (lambda (l)
504                                (string-match "^VmData:[ \t]*([0-9]*) kB" l))
505                              lines)))
506        (mem (string->number (match:substring (car interesting) 1)))
507        )
508
509     
510     (display (format  "VMDATA: ~a\n" mem))
511     (display (gc-stats))
512     (if (> mem 100000)
513         (begin
514           (dump-gc-protects)
515           (raise 1)))
516     
517     ))
518
519 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
520
521
522 (define (multi-fork count)
523   (define (helper count acc)
524     (if (> count 0)
525       (let*
526           ((pid  (primitive-fork)))
527         (if (= pid 0)
528             (1- count)
529             (helper (1- count) (cons pid acc))))
530       acc))
531   (helper count '()))
532
533
534 (define-public (lilypond-main files)
535   "Entry point for LilyPond."
536
537   (define (no-files-handler)
538     (ly:usage)
539     (exit 2))
540
541   (eval-string (ly:command-line-code))
542   
543   (if (ly:get-option 'gui)
544       (gui-main files))
545
546   (if (null? files)
547       (no-files-handler))
548
549   (if (ly:get-option 'read-file-list)
550       (set! files
551             (filter (lambda (s)
552                       (> (string-length s) 0))
553                     (apply append
554                            (map (lambda (f) (string-split (ly:gulp-file f) #\nl))
555                                 files)))
556             ))
557   
558   (if (and (number? (ly:get-option 'job-count))
559            (>= (length files) (ly:get-option 'job-count)))
560       
561       (let*
562           ((count (ly:get-option 'job-count))
563            (split-todo (split-list files count)) 
564            (joblist (multi-fork count))
565            (errors '()))
566
567         (if (not (string-or-symbol? (ly:get-option 'log-file)))
568             (ly:set-option 'log-file "lilypond-multi-run"))
569         
570         (if (number? joblist)
571             (begin
572               (ly:set-option 'log-file (format "~a-~a"
573                                                (ly:get-option 'log-file) joblist))
574               (set! files (vector-ref split-todo joblist)))
575
576             (begin
577               (ly:progress "\nForking into jobs:  ~a\n" joblist)
578               (for-each
579                (lambda (pid)
580                  (let* ((stat (cdr (waitpid pid))))
581                    
582                    (if (not (= stat 0))
583                        (set! errors (acons (list-element-index joblist pid) stat errors)))))
584                joblist)
585
586               (for-each
587                (lambda (x)
588                  (let* ((job (car x))
589                         (state (cdr x))
590                         (logfile  (format "~a-~a.log"
591                                           (ly:get-option 'log-file) job))
592                         (log (ly:gulp-file logfile))
593                         (len (string-length log))
594                         (tail (substring  log (max 0 (- len 1024)))))
595
596                    (if (status:term-sig state)
597                        (ly:message "\n\n~a\n"
598                                    (format (_ "job ~a terminated with signal: ~a")
599                                            job
600                                            (status:term-sig state)))
601                        (ly:message (_ "logfile ~a (exit ~a):\n~a") logfile (status:exit-val state) tail))))
602
603                errors)
604
605               (if (pair? errors)
606                   (ly:error "Children ~a exited with errors." (map car errors)))
607
608               ;; must overwrite individual entries
609               (if (ly:get-option 'dump-profile)
610                   (dump-profile "lily-run-total" '(0 0) (profile-measurements)))
611
612             (exit (if (null? errors) 0 1))))))
613               
614            
615   (if (string-or-symbol? (ly:get-option 'log-file))
616       (ly:stderr-redirect (format "~a.log" (ly:get-option 'log-file)) "w"))
617
618   
619   (let ((failed (lilypond-all files)))
620     (if (pair? failed)
621         (begin
622           (ly:error (_ "failed files: ~S") (string-join failed))
623           (exit 1))
624         (begin
625           (ly:do-atexit)
626           ;; HACK: be sure to exit with single newline
627           (ly:message "")
628           (exit 0)))))
629
630 (define-public (lilypond-all files)
631   
632
633   (if (ly:get-option 'show-available-fonts)
634       (begin
635         (ly:font-config-display-fonts)
636         (exit 0)
637         ))
638   
639   (let* ((failed '())
640          (separate-logs (ly:get-option 'separate-log-files))
641          (do-measurements (ly:get-option 'dump-profile))
642          (handler (lambda (key failed-file)
643                     (set! failed (append (list failed-file) failed)))))
644
645     (gc)
646     (for-each
647      (lambda (x)
648        (let*
649            ((start-measurements (if do-measurements
650                                     (profile-measurements)
651                                     #f))
652             (base (basename x ".ly"))
653             (all-settings (ly:all-options)))
654
655          (if separate-logs
656              (ly:stderr-redirect (format "~a.log" base) "w"))
657          (if (ly:get-option 'trace-memory-frequency) 
658              (mtrace:start-trace  (ly:get-option 'trace-memory-frequency)))
659          
660          (lilypond-file handler x)
661          (if start-measurements
662              (dump-profile x start-measurements (profile-measurements)))
663
664          (if (ly:get-option 'trace-memory-frequency)
665              (begin
666                (mtrace:stop-trace)
667                (mtrace:dump-results base)))
668                  
669          (for-each
670           (lambda (s)
671             (ly:set-option (car s) (cdr s)))
672           all-settings)
673
674          (ly:clear-anonymous-modules)
675          (ly:set-option 'debug-gc-assert-parsed-dead #t)
676          (gc)
677          (ly:set-option 'debug-gc-assert-parsed-dead #f)
678
679          
680          (if (ly:get-option 'debug-gc)
681              (dump-gc-protects)
682              (if (= (random 40) 1)
683                  (ly:reset-all-fonts)))))
684
685      files)
686
687     ;; we want the failed-files notice in the aggregrate logfile.
688     (if (ly:get-option 'separate-logs)
689         (ly:stderr-redirect
690          (if (string-or-symbol? (ly:get-option 'log-file))
691              (format "~a.log" (ly:get-option 'log-file))
692              "/dev/tty") "a"))
693
694     (if (ly:get-option 'dump-profile)
695         (dump-profile "lily-run-total" '(0 0) (profile-measurements)))
696
697     failed))
698
699 (define (lilypond-file handler file-name)
700   (catch 'ly-file-failed
701          (lambda () (ly:parse-file file-name))
702          (lambda (x . args) (handler x file-name))))
703
704 (use-modules (scm editor))
705
706 (define-public (gui-main files)
707   (if (null? files)
708       (gui-no-files-handler))
709
710   (if (not (string? (ly:get-option 'log-file)))
711       (let* ((base (basename (car files) ".ly"))
712              (log-name (string-append base ".log")))
713         (if (not (ly:get-option 'gui))
714             (ly:message (_ "Redirecting output to ~a...") log-name))
715         (ly:stderr-redirect log-name "w")
716         (ly:message "# -*-compilation-*-"))
717     
718     (let ((failed (lilypond-all files)))
719       (if (pair? failed)
720           (begin
721             ;; ugh
722             (ly:stderr-redirect "foo" "r")
723             (system (get-editor-command log-name 0 0 0))
724             (ly:error (_ "failed files: ~S") (string-join failed))
725             ;; not reached?
726             (exit 1))
727           (exit 0)))))
728
729 (define (gui-no-files-handler)
730   (let* ((ly (string-append (ly:effective-prefix) "/ly/"))
731          ;; FIXME: soft-code, localize
732          (welcome-ly (string-append ly "Welcome_to_LilyPond.ly"))
733          (cmd (get-editor-command welcome-ly 0 0 0)))
734     (ly:message (_ "Invoking `~a'...") cmd)
735     (system cmd)
736     (exit 1)))