-;;; 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)
"slur.scm"
"font.scm"
+ "define-markup-commands.scm"
"define-grob-properties.scm"
"define-grobs.scm"
"define-grob-interfaces.scm"
))
-
-
-
(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")
(,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")
))
+;; 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")))
+