Nitpick: ly:spanner-bound grob name slur -> spanner.
[lilypond.git] / scm / c++.scm
blobb6ec6a4ee7602c31e8daca2ac365102bd64a12e7
1 ;;;; c++.scm -- implement Scheme frontends to C++ functions
2 ;;;;
3 ;;;;  source file of the GNU LilyPond music typesetter
4 ;;;; 
5 ;;;; (c) 1998--2009 Jan Nieuwenhuizen <janneke@gnu.org>
6 ;;;;                 Han-Wen Nienhuys <hanwen@xs4all.nl>
8 ;;; Note: this file can't be used without LilyPond executable
11 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12 ;; type predicates.
13 (define-public (number-pair? x)
14   (and (pair? x)
15        (number? (car x)) (number? (cdr x))))
17 (define-public (number-or-grob? x)
18   (or (ly:grob? x) (number? x)))
20 (define-public (grob-list? x)
21   (list? x))
23 (define-public (moment-pair? x)
24   (and (pair? x)
25        (ly:moment? (car x)) (ly:moment? (cdr x))))
27 (define-public (boolean-or-symbol? x)
28   (or (boolean? x) (symbol? x)))
30 (define-public (string-or-symbol? x)
31   (or (string? x) (symbol? x)))
33 (define-public (number-or-string? x)
34   (or (number? x) (string? x)))
36 (define-public (string-or-pair? x)
37   (or (string? x) (pair? x)))
39 (define-public (scheme? x) #t)
42 ;; moved list to end of lily.scm: then all type-predicates are
43 ;; defined.
44 (define type-p-name-alist '()) 
46 (define (match-predicate obj alist)
47   (if (null? alist)
48       "Unknown type"
49       (if (apply (caar alist) obj)
50           (cdar alist)
51           (match-predicate obj (cdr alist)))))
53 (define-public (object-type obj)
54   (match-predicate obj type-p-name-alist))
56 (define-public (object-type-name obj)
57   (type-name (match-predicate obj type-p-name-alist)))
59 (define-public (type-name predicate)
60   (let ((entry (assoc predicate type-p-name-alist)))
61     (if (pair? entry) (cdr entry)
62         "unknown")))