]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/lily.scm
*** empty log message ***
[lilypond.git] / scm / lily.scm
index 882445dae340a1cad09e36e4342554d37e635c5c..31a24cd074cc9ab4edadc2f512cb28a5020c3ed6 100644 (file)
@@ -1,8 +1,8 @@
-;;; lily.scm -- implement Scheme output routines for TeX and PostScript
+;;;; lily.scm -- implement Scheme output routines for TeX and PostScript
 ;;;;
 ;;;;  source file of the GNU LilyPond music typesetter
 ;;;; 
-;;;; (c)  1998--2003 Jan Nieuwenhuizen <janneke@gnu.org>
+;;;; (c)  1998--2004 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;; Han-Wen Nienhuys <hanwen@cs.uu.nl>
 
 ;;; Library functions
            (map-alist-keys func (cdr list)))
       ))
  
+;;;;;;;;;;;;;;;;
+;; hash
 
-(define-public (hash-table->alist t)
-  "Convert table t to list"
-  (apply append
-        (vector->list t)
-  ))
+
+
+(if (not (defined? 'hash-table?))      ; guile 1.6 compat
+    (begin
+      (define hash-table? vector?)
+
+      (define-public (hash-table->alist t)
+       "Convert table t to list"
+       (apply append
+              (vector->list t)
+              )))
+
+    ;; native hashtabs.
+    (begin
+      (define-public (hash-table->alist t)
+
+       (hash-fold (lambda (k v acc) (acons  k v  acc))
+                  '() t)
+       )
+      ))
 
 ;; todo: code dup with C++. 
 (define-public (alist->hash-table l)
@@ -409,6 +426,7 @@ L1 is copied, L2 not.
        "slur.scm"
        "font.scm"
        
+       "define-markup-commands.scm"
        "define-grob-properties.scm"
        "define-grobs.scm"
        "define-grob-interfaces.scm"
@@ -417,15 +435,13 @@ L1 is copied, L2 not.
        ))
 
 
-       
-
-
 (set! type-p-name-alist
   `(
    (,boolean-or-symbol? . "boolean or symbol")
    (,boolean? . "boolean")
    (,char? . "char")
    (,grob-list? . "list of grobs")
+   (,hash-table? . "hash table")
    (,input-port? . "input port")
    (,integer? . "integer")
    (,list? . "list")
@@ -433,7 +449,7 @@ L1 is copied, L2 not.
    (,ly:dimension? . "dimension, in staff space")
    (,ly:dir? . "direction")
    (,ly:duration? . "duration")
-   (,ly:grob? . "grob (GRaphical OBject)")
+   (,ly:grob? . "layout object")
    (,ly:input-location? . "input location")
    (,ly:input-location? . "input location")   
    (,ly:moment? . "moment")
@@ -457,3 +473,33 @@ L1 is copied, L2 not.
    ))
 
 
+;; debug mem leaks
+
+(define gc-protect-stat-count 0)
+(define-public (dump-gc-protects)
+  (set! gc-protect-stat-count (1+ gc-protect-stat-count) )
+  
+  (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")))
+
+         (sort
+          (hash-table->alist (ly:protects))
+          (lambda (a b)
+            (< (object-address (car a))
+               (object-address (car b)))))
+         
+         )
+      (open-file (string-append
+              "gcstat-" (number->string gc-protect-stat-count)
+              ".scm"
+              ) "w")))
+