]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/lily.scm
Merge branch 'jneeman' of git+ssh://jneem@git.sv.gnu.org/srv/git/lilypond into jneeman
[lilypond.git] / scm / lily.scm
index b947853471f010dadfc18949ee325b890d45efa7..a016901bcb4754c54c8eb99b7afeb011efbece35 100644 (file)
@@ -48,6 +48,7 @@ similar to chord syntax")
                           "experimental mechanism for remembering tweaks")
              (point-and-click #t "use point & click")
              (paper-size "a4" "the default paper size")
+             (pixmap-format "png16m" "GS format to use for pixel images")
              (protected-scheme-parsing #t "continue when finding errors in inline
 scheme are caught in the parser. If off, halt 
 on errors, and print a stack trace.")
@@ -106,6 +107,7 @@ on errors, and print a stack trace.")
 
 (if (ly:get-option 'verbose)
     (begin
+      (ly:set-option 'protected-scheme-parsing #f)
       (debug-enable 'debug)
       (debug-enable 'backtrace)
       (read-enable 'positions)))
@@ -139,7 +141,7 @@ on errors, and print a stack trace.")
     (if (ly:get-option 'verbose)
        (ly:progress "[~A" file-name))
     (if (not file-name)
-       (ly:error (_ "Can't find ~A" x)))
+       (ly:error (_ "Can't find ~A") x))
     (primitive-load file-name)
     (if (ly:get-option 'verbose)
        (ly:progress "]"))))
@@ -347,8 +349,10 @@ The syntax is the same as `define*-public'."
        (,vector? . "vector")))
 
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; debug mem leaks
 
+(define gc-dumping #f)
 (define gc-protect-stat-count 0)
 (define-public (dump-gc-protects)
   (set! gc-protect-stat-count (1+ gc-protect-stat-count))
@@ -363,34 +367,38 @@ The syntax is the same as `define*-public'."
                         ".scm"))
         (outfile    (open-file  out-file-name  "w")))
 
-    (display (format "Dumping gc protected objs to ~a...\n" out-file-name))
+    (set! gc-dumping #t)
+    (display (format "Dumping GC statistics ~a...\n" out-file-name))
     (display
      (map (lambda (y)
            (let ((x (car y))
                  (c (cdr y)))
-             
-             (string-append
-              (string-join
-               (map object->string (list (object-address x) c x))
-               " ")
-              "\n")))
-
+             (display 
+              (format "~a (~a) = ~a\n" (object-address x) c x)
+              outfile)))
          (filter
           (lambda (x)
             (not (symbol? (car x))))
           protects))
      outfile)
 
-                                       ;    (display (ly:smob-protects))
+    (format outfile "\nprotected symbols: ~a\n"
+           (length (filter symbol?  (map car protects))))
+    
+            
+
+    ;; (display (ly:smob-protects))
     (newline outfile)
     (if (defined? 'gc-live-object-stats)
        (let* ((stats #f))
          (display "Live object statistics: GC'ing\n")
+         (ly:reset-all-fonts)
          (gc)
          (gc)
          (ly:set-option 'debug-gc-assert-parsed-dead #t)
          (gc)
-         
+         (ly:set-option 'debug-gc-assert-parsed-dead #f)
+
          (set! stats (gc-live-object-stats))
          (display "Dumping live object statistics.\n")
          
@@ -412,9 +420,16 @@ The syntax is the same as `define*-public'."
          (format "~a ~a ~a\n"
                  gc-protect-stat-count
                  sym
-                 (cdr (assoc sym stats)))
+                 (let ((sym-stat (assoc sym stats)))
+                   (if sym-stat 
+                       (cdr sym-stat)
+                       "?")))
          outfile))
-       '(protected-objects bytes-malloced cell-heap-size)))
+       '(protected-objects bytes-malloced cell-heap-size
+                          
+                          )))
+
+    (set! gc-dumping #f)
     
     ))
 
@@ -510,6 +525,7 @@ The syntax is the same as `define*-public'."
          (ly:error (_ "failed files: ~S") (string-join failed))
          (exit 1))
        (begin
+         (ly:do-atexit)
          ;; HACK: be sure to exit with single newline
          (ly:message "")
          (exit 0)))))
@@ -524,17 +540,25 @@ The syntax is the same as `define*-public'."
        ))
   
   (let* ((failed '())
+        (first #t)
         (handler (lambda (key failed-file)
                    (set! failed (append (list failed-file) failed)))))
 
     (for-each
      (lambda (x)
-       (ly:set-option 'debug-gc-assert-parsed-dead #f)
+
+       ;; We don't carry info across file boundaries
+       (if first
+          (set! first #f)
+          (gc))
+       
        (lilypond-file handler x)
        (ly:clear-anonymous-modules)
        (if (ly:get-option 'debug-gc)
-          (dump-gc-protects)))
-     
+          (dump-gc-protects)
+          (if (= (random 40) 1)
+              (ly:reset-all-fonts))))
+
      files)
     failed))