LEFT | RIGHT |
1 ;;;; This file is part of LilyPond, the GNU music typesetter. | 1 ;;;; This file is part of LilyPond, the GNU music typesetter. |
2 ;;;; | 2 ;;;; |
3 ;;;; Copyright (C) 1998--2015 Jan Nieuwenhuizen <janneke@gnu.org> | 3 ;;;; Copyright (C) 1998--2015 Jan Nieuwenhuizen <janneke@gnu.org> |
4 ;;;; Han-Wen Nienhuys <hanwen@xs4all.nl> | 4 ;;;; Han-Wen Nienhuys <hanwen@xs4all.nl> |
5 ;;;; | 5 ;;;; |
6 ;;;; LilyPond is free software: you can redistribute it and/or modify | 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 | 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 | 8 ;;;; the Free Software Foundation, either version 3 of the License, or |
9 ;;;; (at your option) any later version. | 9 ;;;; (at your option) any later version. |
10 ;;;; | 10 ;;;; |
(...skipping 23 matching lines...) Expand all Loading... |
34 (read-enable 'positions) | 34 (read-enable 'positions) |
35 (if (not (guile-v2)) | 35 (if (not (guile-v2)) |
36 (debug-enable 'debug) | 36 (debug-enable 'debug) |
37 (begin | 37 (begin |
38 (debug-enable 'backtrace) | 38 (debug-enable 'backtrace) |
39 (debug-set! show-file-name #t))) | 39 (debug-set! show-file-name #t))) |
40 | 40 |
41 (define-public PLATFORM | 41 (define-public PLATFORM |
42 (string->symbol | 42 (string->symbol |
43 (string-downcase | 43 (string-downcase |
44 (car (string-tokenize (utsname:sysname (uname))))))) | 44 (car (string-tokenize (utsname:sysname (uname)) char-set:letter))))) |
| 45 |
| 46 ;; We don't use (srfi srfi-39) (parameter objects) here because that |
| 47 ;; does not give us a name/handle to the underlying fluids themselves. |
| 48 |
| 49 (define %parser (make-fluid)) |
| 50 (define %location (make-fluid)) |
| 51 ;; No public setters: should not get overwritten in action |
| 52 (define-public (*parser*) (fluid-ref %parser)) |
| 53 (define-public (*location*) (fluid-ref %location)) |
| 54 ;; but properly scoped location should be fine |
| 55 (defmacro-public with-location (loc . body) |
| 56 `(with-fluids ((,%location ,loc)) ,@body)) |
| 57 |
| 58 ;; It would be nice to convert occurences of parser/location to |
| 59 ;; (*parser*)/(*location*) using the syncase module but it is utterly |
| 60 ;; broken in GUILE 1 and would require changing a lot of unrelated |
| 61 ;; innocuous constructs which just happen to fall apart with |
| 62 ;; inscrutable error messages. |
45 | 63 |
46 ;; | 64 ;; |
47 ;; Session-handling variables and procedures. | 65 ;; Session-handling variables and procedures. |
48 ;; | 66 ;; |
49 ;; A "session" corresponds to one .ly file processed on a LilyPond | 67 ;; A "session" corresponds to one .ly file processed on a LilyPond |
50 ;; command line. Every session gets to see a reasonably fresh state | 68 ;; command line. Every session gets to see a reasonably fresh state |
51 ;; of LilyPond and should work independently from previous files. | 69 ;; of LilyPond and should work independently from previous files. |
52 ;; | 70 ;; |
53 ;; Session management relies on cooperation, namely the user not | 71 ;; Session management relies on cooperation, namely the user not |
54 ;; trying to change variables and data structures internal to | 72 ;; trying to change variables and data structures internal to |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 (getcwd))) | 503 (getcwd))) |
486 | 504 |
487 (define-public (is-absolute? file-name) | 505 (define-public (is-absolute? file-name) |
488 (let ((file-name-length (string-length file-name))) | 506 (let ((file-name-length (string-length file-name))) |
489 (if (= file-name-length 0) | 507 (if (= file-name-length 0) |
490 #f | 508 #f |
491 (or (eq? (string-ref file-name 0) #\/) | 509 (or (eq? (string-ref file-name 0) #\/) |
492 (and (eq? PLATFORM 'windows) | 510 (and (eq? PLATFORM 'windows) |
493 (> file-name-length 2) | 511 (> file-name-length 2) |
494 (eq? (string-ref file-name 1) #\:) | 512 (eq? (string-ref file-name 1) #\:) |
495 (eq? (string-ref file-name 2) #\/)))))) | 513 (or (eq? (string-ref file-name 2) #\\) |
| 514 (eq? (string-ref file-name 2) #\/))))))) |
496 | 515 |
497 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 516 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
498 ;;; If necessary, emulate Guile V2 module_export_all! for Guile V1.8.n | 517 ;;; If necessary, emulate Guile V2 module_export_all! for Guile V1.8.n |
499 (cond-expand | 518 (cond-expand |
500 ((not guile-v2) | 519 ((not guile-v2) |
501 (define (module-export-all! mod) | 520 (define (module-export-all! mod) |
502 (define (fresh-interface!) | 521 (define (fresh-interface!) |
503 (let ((iface (make-module))) | 522 (let ((iface (make-module))) |
504 (set-module-name! iface (module-name mod)) | 523 (set-module-name! iface (module-name mod)) |
505 ;; for guile 2: (set-module-version! iface (module-version mod)) | 524 ;; for guile 2: (set-module-version! iface (module-version mod)) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 "chord-ignatzek-names.scm" | 575 "chord-ignatzek-names.scm" |
557 "music-functions.scm" | 576 "music-functions.scm" |
558 "part-combiner.scm" | 577 "part-combiner.scm" |
559 "autochange.scm" | 578 "autochange.scm" |
560 "define-music-properties.scm" | 579 "define-music-properties.scm" |
561 "time-signature.scm" | 580 "time-signature.scm" |
562 "time-signature-settings.scm" | 581 "time-signature-settings.scm" |
563 "auto-beam.scm" | 582 "auto-beam.scm" |
564 "chord-name.scm" | 583 "chord-name.scm" |
565 "bezier-tools.scm" | 584 "bezier-tools.scm" |
566 "ly-syntax-constructors.scm" | |
567 | 585 |
568 "define-context-properties.scm" | 586 "define-context-properties.scm" |
569 "translation-functions.scm" | 587 "translation-functions.scm" |
570 "script.scm" | 588 "script.scm" |
571 "midi.scm" | 589 "midi.scm" |
572 "layout-beam.scm" | 590 "layout-beam.scm" |
573 "parser-clef.scm" | 591 "parser-clef.scm" |
574 "layout-slur.scm" | 592 "layout-slur.scm" |
575 "font.scm" | 593 "font.scm" |
576 "encoding.scm" | 594 "encoding.scm" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 (,ly:music-output? . "music output") | 729 (,ly:music-output? . "music output") |
712 (,ly:otf-font? . "OpenType font") | 730 (,ly:otf-font? . "OpenType font") |
713 (,ly:output-def? . "output definition") | 731 (,ly:output-def? . "output definition") |
714 (,ly:page-marker? . "page marker") | 732 (,ly:page-marker? . "page marker") |
715 (,ly:pango-font? . "pango font") | 733 (,ly:pango-font? . "pango font") |
716 (,ly:paper-book? . "paper book") | 734 (,ly:paper-book? . "paper book") |
717 (,ly:paper-system? . "paper-system Prob") | 735 (,ly:paper-system? . "paper-system Prob") |
718 (,ly:pitch? . "pitch") | 736 (,ly:pitch? . "pitch") |
719 (,ly:prob? . "property object") | 737 (,ly:prob? . "property object") |
720 (,ly:score? . "score") | 738 (,ly:score? . "score") |
721 (,ly:simple-closure? . "simple closure") | |
722 (,ly:skyline? . "skyline") | 739 (,ly:skyline? . "skyline") |
723 (,ly:skyline-pair? . "pair of skylines") | 740 (,ly:skyline-pair? . "pair of skylines") |
724 (,ly:source-file? . "source file") | 741 (,ly:source-file? . "source file") |
725 (,ly:spanner? . "spanner") | 742 (,ly:spanner? . "spanner") |
726 (,ly:spring? . "spring") | 743 (,ly:spring? . "spring") |
727 (,ly:stencil? . "stencil") | 744 (,ly:stencil? . "stencil") |
728 (,ly:stream-event? . "stream event") | 745 (,ly:stream-event? . "stream event") |
729 (,ly:translator? . "translator") | 746 (,ly:translator? . "translator") |
730 (,ly:translator-group? . "translator group") | 747 (,ly:translator-group? . "translator group") |
731 (,ly:undead? . "undead container") | 748 (,ly:undead? . "undead container") |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 (ly:exit 0 #f))))) | 1085 (ly:exit 0 #f))))) |
1069 | 1086 |
1070 (define (gui-no-files-handler) | 1087 (define (gui-no-files-handler) |
1071 (let* ((ly (string-append (ly:effective-prefix) "/ly/")) | 1088 (let* ((ly (string-append (ly:effective-prefix) "/ly/")) |
1072 ;; FIXME: soft-code, localize | 1089 ;; FIXME: soft-code, localize |
1073 (welcome-ly (string-append ly "Welcome_to_LilyPond.ly")) | 1090 (welcome-ly (string-append ly "Welcome_to_LilyPond.ly")) |
1074 (cmd (get-editor-command welcome-ly 0 0 0))) | 1091 (cmd (get-editor-command welcome-ly 0 0 0))) |
1075 (ly:message (_ "Invoking `~a'...\n") cmd) | 1092 (ly:message (_ "Invoking `~a'...\n") cmd) |
1076 (system cmd) | 1093 (system cmd) |
1077 (ly:exit 1 #f))) | 1094 (ly:exit 1 #f))) |
LEFT | RIGHT |