]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/lily.scm
Merge branch 'master' of ssh+git://hanwen@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / scm / lily.scm
index bd6a95be446af7e8eca09ce7d145dad1d7465261..33f3c9014c3adaff1f0a58036631057c6937dbe2 100644 (file)
@@ -5,6 +5,14 @@
 ;;;; (c) 1998--2006 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;; Han-Wen Nienhuys <hanwen@xs4all.nl>
 
+;; Internationalisation: (_i "to be translated") gets an entry in the
+;; POT file (gettext ) must be invoked explicitely to do the actual
+;; "translation".
+;;(define-macro (_i x) x)
+;;(define-macro-public _i (x) x)
+;;(define-public-macro _i (x) x)
+;; Abbrv-PWR!
+(defmacro-public _i (x) x)
 
 (define (define-scheme-options)
   (for-each (lambda (x)
@@ -61,8 +69,8 @@ on errors, and print a stack trace.")
              (read-file-list #f "Read files to be processed from command line arguments")
 
              (safe #f "Run safely")
-             (strict-infinity-checking #f "If yes, crash on encountering Inf/NaN")
-
+             (strict-infinity-checking #f "If yes, crash on encountering Inf/NaN.")
+             (separate-log-files #f "Output to FILE.log per file.")
              (ttf-verbosity 0
                             "how much verbosity for TTF font embedding?")
 
@@ -357,12 +365,13 @@ The syntax is the same as `define*-public'."
 (define (profile-measurements)
   (let* ((t (times))
         (stats (gc-stats)))
-
+    
     (list
-     (- (+ (tms:utime t)
-          (tms:stime t))
+     (- (tms:utime t)
        (ly:assoc-get 'gc-time-taken stats))
 
+     ;; unreliable...
+     ;;(ly:assoc-get 'total-cells-allocated  stats 0)
      ;; difficult to put memory amount stats into here.
      
      )))
@@ -372,11 +381,12 @@ The syntax is the same as `define*-public'."
       ((outname (format "~a.profile" (basename name ".ly")))
        (diff (map (lambda (y) (apply - y)) (zip this last))))
     
-    (display diff)
     (ly:progress "\nWriting timing to ~a..." outname)
     (format (open-file outname "w")
-           "time: ~a"
-           (car diff))))
+           "time: ~a\ncells: ~a\n"
+           (car diff)
+           (cadr diff)
+           )))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -570,27 +580,50 @@ The syntax is the same as `define*-public'."
        ))
   
   (let* ((failed '())
-        (start-measurements #f)
+        (separate-logs (ly:get-option 'separate-log-files))
+        (do-measurements (ly:get-option 'dump-profile))
         (handler (lambda (key failed-file)
                    (set! failed (append (list failed-file) failed)))))
 
     (for-each
      (lambda (x)
-
-       (gc)
-       (set! start-measurements (profile-measurements))
-       (lilypond-file handler x)
-       (if (ly:get-option 'dump-profile)
-          (dump-profile x start-measurements (profile-measurements)))
+       (let*
+          ((start-measurements (if do-measurements
+                                   (begin
+                                     (gc)
+                                     (profile-measurements))
+                                   #f))
+           (base (basename x ".ly"))
+           (all-settings (ly:all-options)))
+
+        (if separate-logs
+            (ly:stderr-redirect (format "~a.log" base) "w"))
        
+        (lilypond-file handler x)
+        (if start-measurements
+            (dump-profile x start-measurements (profile-measurements)))
        
-       (ly:clear-anonymous-modules)
-       (if (ly:get-option 'debug-gc)
-          (dump-gc-protects)
-          (if (= (random 40) 1)
-              (ly:reset-all-fonts))))
+        (for-each
+         (lambda (s)
+           (ly:set-option (car s) (cdr s)))
+         all-settings)
+        
+        (ly:clear-anonymous-modules)
+        (if (ly:get-option 'debug-gc)
+            (dump-gc-protects)
+            (if (= (random 40) 1)
+                (ly:reset-all-fonts)))))
 
      files)
+
+    ;; we want the failed-files notice in the aggregrate logfile.
+    (if (ly:get-option 'separate-logs)
+       (ly:stderr-redirect
+        (if (string-or-symbol? (ly:get-option 'log-file))
+            (format "~a.log" (ly:get-option 'log-file))
+            "/dev/tty") "a"))
+        
+
     failed))
 
 (define (lilypond-file handler file-name)