]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/c++.scm
* lily/beam.cc (least_squares): Fix asymmetry and scary float
[lilypond.git] / scm / c++.scm
index e2a807e76b08c884d8219327ec4de3e6bdf587b1..41bd34139e4243869fe608a20859336feafc449a 100644 (file)
 (define (number-pair?  x)
   (and (pair? x)
        (number? (car x)) (number? (cdr x))))
+(define (number-or-grob? x)
+  (or (ly-grob? x) (number? x))
+  )
+
+(define (grob-list? x)
+  (list? x))
 
 (define (moment-pair?  x)
   (and (pair? x)
@@ -18,9 +24,6 @@
 (define (boolean-or-symbol? x)
   (or (boolean? x) (symbol? x)))
 
-(define (number-or-boolean? x)
-  (or (number? x) (boolean? x)))
-
 (define (number-or-string? x)
   (or (number? x) (string? x)))
 
@@ -36,6 +39,7 @@
    (,number-pair? . "pair of numbers")
    (,ly-input-location? . "input location")   
    (,ly-grob? . "grob (GRaphical OBject)")
+   (,grob-list? . "list of grobs")
    (,duration? . "duration")
    (,pair? . "pair")
    (,integer? . "integer")
@@ -55,8 +59,8 @@
    (,procedure? . "procedure") 
    (,boolean-or-symbol? . "boolean or symbol")
    (,number-or-string? . "number or string")
-   (,number-or-boolean? . "number or boolean")
    (,markup? . "markup (list or string)")
+   (,number-or-grob? . "number or grob")
    ))
 
 
 
 
 
+(define (take-from-list-until todo gathered crit?)
+  "return (G, T), where (reverse G) + T = GATHERED + TODO, and the last of G
+is the  first to satisfy CRIT "
+  (if (null? todo)
+      (cons gathered todo)
+      (if (crit? (car todo))
+         (cons (cons (car todo) gathered) (cdr todo))
+         (take-from-list-until (cdr todo) (cons (car todo) gathered) crit?)
+      )
+  ))
+; test:
+; (take-from-list-until '(1 2 3  4 5) '() (lambda (x) (eq? x 3)))
+; ((3 2 1) 4 5)
+
+
+
 ; Make a function that checks score element for being of a specific type. 
 (define (make-type-checker symbol)
   (lambda (elt)
   (let*
       ((supported-reps
        `(("volta" . ((iterator-ctor . ,Volta_repeat_iterator::constructor)
+                     (start-moment-function .  ,Repeated_music::first_start)
                      (length . ,Repeated_music::volta_music_length)))
+         
            ("unfold" . ((iterator-ctor . ,Unfolded_repeat_iterator::constructor)
-                      (length . ,Repeated_music::unfolded_music_length)))
+                        (start-moment-function .  ,Repeated_music::first_start)                         
+                        (length . ,Repeated_music::unfolded_music_length)))
            ("fold" . ((iterator-ctor  . ,Folded_repeat_iterator::constructor)
+                      (start-moment-function .  ,Repeated_music::minimum_start)                         
                       (length . ,Repeated_music::folded_music_length)))
            ("percent" . ((iterator-ctor . ,Percent_repeat_iterator::constructor)
+                         (start-moment-function .  ,Repeated_music::first_start)
                          (length . ,Repeated_music::unfolded_music_length)))
            ("tremolo" . ((iterator-ctor . ,Chord_tremolo_iterator::constructor)
-                         (length . ,Repeated_music::unfolded_music_length)))))
+                         (start-moment-function .  ,Repeated_music::first_start)
+
+                         ;; the length of the repeat is handled by shifting the note logs
+                         (length . ,Repeated_music::folded_music_length)))))
          
        (handle (assoc name supported-reps)))