From ade3566d3f6c8e3b780db83fed000046c16071a1 Mon Sep 17 00:00:00 2001 From: hanwen Date: Thu, 3 Jul 2003 14:40:58 +0000 Subject: [PATCH] * scm/lily.scm: remove reduce-no-unit (list-insert-separator): use fold-right * lily/molecule-scheme.cc (ly_molecule_add): take variable number of arguments. * NEWS: more neutral language for ancient notation * lily/chord-tremolo-engraver.cc (acknowledge_grob): only set inside pointing beaming for chord tremolo. --- ChangeLog | 8 ++++++++ NEWS | 14 ++++++-------- lily/chord-tremolo-engraver.cc | 11 ++++------- lily/molecule-scheme.cc | 24 ++++++++++++++++-------- scm/lily.scm | 26 +++++++++----------------- scm/molecule.scm | 14 +++++--------- scm/new-markup.scm | 13 ++----------- 7 files changed, 50 insertions(+), 60 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0b30e69478..7174edb19e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2003-07-03 Han-Wen Nienhuys + * scm/lily.scm: remove reduce-no-unit + (list-insert-separator): use fold-right + + * lily/molecule-scheme.cc (ly_molecule_add): take variable number + of arguments. + + * NEWS: more neutral language for ancient notation + * lily/chord-tremolo-engraver.cc (acknowledge_grob): only set inside pointing beaming for chord tremolo. diff --git a/NEWS b/NEWS index 3ec2dd4f6b..fa782857fa 100644 --- a/NEWS +++ b/NEWS @@ -14,8 +14,8 @@ LilyPond identifiers in Scheme, and use Scheme expressions instead of LilyPond identifiers. ** The internal representation of music has been cleaned up completely -converted to Scheme data structure. The representation can optionally -be exported as XML. +converted to Scheme data structure. The representation may be +exported as XML. ** A new syntax has been added for chords: @@ -30,7 +30,6 @@ and \simultaneous { .. } for simultaneous music. ** A new uniform postfix syntax for articulation has been introduced. - A beamed slurred pair of eighth notes can be entered as c8-[-( d8-]-) @@ -53,11 +52,10 @@ exceptions. R1*20^\markup { "GP" } -** Ancient notation now supports ligatures in Gregorian square neumes +** Ancient notation now prints ligatures in Gregorian square neumes notation, roughly following the typographical style of the Liber -hymnarius of Solesmes, published in 1983. The line breaking and -horizontal spacing algorithms however are still completely messed up -by ligatures. +hymnarius of Solesmes, published in 1983. Ligatures are still printed +without the proper line breaking and horizontal spacing. ** Glissandi can now be printed using the zigzag style. @@ -95,7 +93,7 @@ The syntax is ** The emacs support has been extended. -** The manual has been completely revised and extended manual. +** The manual has been completely revised and extended. diff --git a/lily/chord-tremolo-engraver.cc b/lily/chord-tremolo-engraver.cc index 8d5f748940..983676ccc3 100644 --- a/lily/chord-tremolo-engraver.cc +++ b/lily/chord-tremolo-engraver.cc @@ -25,6 +25,7 @@ #include "math.h" // ceil /** + This acknowledges repeated music with "tremolo" style. It typesets a beam. @@ -35,13 +36,13 @@ - create dots if appropriate. - - create TremoloBeam iso Beam? - */ + - create TremoloBeam iso Beam? +*/ class Chord_tremolo_engraver : public Engraver { void typeset_beam (); -TRANSLATOR_DECLARATIONS(Chord_tremolo_engraver); + TRANSLATOR_DECLARATIONS(Chord_tremolo_engraver); protected: Repeated_music * repeat_; @@ -111,7 +112,6 @@ Chord_tremolo_engraver::try_music (Music * m) rp->origin ()->warning ("Chord tremolo is too short to denote properly."); } - Rational written_note_dur = total_dur / Rational (elt_count); flags_ = intlog2 (note_dur.den ()) -2 ; return true; @@ -169,7 +169,6 @@ Chord_tremolo_engraver::typeset_beam () } } - void Chord_tremolo_engraver::acknowledge_grob (Grob_info info) { @@ -216,7 +215,6 @@ Chord_tremolo_engraver::start_translation_timestep () if (beam_ && stop_mom_ == now_mom ()) { finished_beam_ = beam_; - repeat_ = 0; beam_ = 0; } @@ -233,7 +231,6 @@ Chord_tremolo_engraver::stop_translation_timestep () typeset_grob (stem_tremolo_); stem_tremolo_ = 0; } - } diff --git a/lily/molecule-scheme.cc b/lily/molecule-scheme.cc index 8ba102f34d..1bef34afed 100644 --- a/lily/molecule-scheme.cc +++ b/lily/molecule-scheme.cc @@ -123,20 +123,28 @@ LY_DEFINE(ly_molecule_combined_at_edge, */ LY_DEFINE(ly_molecule_add , - "ly:molecule-add", 2, 0, 0, (SCM first, SCM second), - "Combine two molecules." + "ly:molecule-add", 0, 0, 1, (SCM args), + "Combine molecules. Takes any number of arguments." ) { - Molecule * m1 = unsmob_molecule (first); - Molecule * m2 = unsmob_molecule (second); +#define FUNC_NAME __FUNCTION__ + SCM_VALIDATE_REST_ARGUMENT (args); + Molecule result; + while (!SCM_NULLP (args)) + { + Molecule * m = unsmob_molecule (gh_car (args)); - if (m1) - result = *m1; - if (m2) - result.add_molecule (*m2); + if (!m) + SCM_ASSERT_TYPE(m, gh_car (args), SCM_ARGn, __FUNCTION__, + "Molecule"); + + result.add_molecule (*m); + args = gh_cdr (args); + } + return result.smobbed_copy (); } diff --git a/scm/lily.scm b/scm/lily.scm index 7aa5cbdc17..aa6856af3a 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -121,6 +121,7 @@ ;; TODO: use the srfi-1 partition function. (define-public (uniq-list list) + "Uniq LIST, assuming that it is sorted" (if (null? list) '() (if (null? (cdr list)) list @@ -218,25 +219,16 @@ L1 is copied, L2 not. "map F to contents of X" (cons (f (car x)) (f (cdr x)))) -;; TODO: remove. -(define-public (reduce-no-unit operator list) - "reduce OP [A, B, C, D, ... ] = - A op (B op (C ... )) -" - (if (null? (cdr list)) (car list) - (operator (car list) (reduce-no-unit operator (cdr list))))) -(define-public (list-insert-separator list between) +(define-public (list-insert-separator lst between) "Create new list, inserting BETWEEN between elements of LIST" - (if (null? list) - '() - (if (null? (cdr list)) - list - (cons (car list) - (cons between (list-insert-separator (cdr list) between))) - - ))) - + (define (conc x y ) + (if (eq? y #f) + (list x) + (cons x (cons between y)) + )) + (fold-right conc #f lst) + ) ;;;;;;;;;;;;;;;; ; other diff --git a/scm/molecule.scm b/scm/molecule.scm index c994c92629..605cccb515 100644 --- a/scm/molecule.scm +++ b/scm/molecule.scm @@ -60,13 +60,9 @@ encloses the contents. " (let* ((xext (ly:get-extent grob grob 0)) (yext (ly:get-extent grob grob 1)) - (mol (ly:make-molecule '() '(10000 . -10000) '(10000 . -10000))) - (thick 0.1) - ) + (thick 0.1)) - (set! mol (ly:molecule-add mol (box-molecule xext (cons (- (car yext) thick) (car yext) )))) - (set! mol (ly:molecule-add mol (box-molecule xext (cons (cdr yext) (+ (cdr yext) thick) )))) - (set! mol (ly:molecule-add mol (box-molecule (cons (cdr xext) (+ (cdr xext) thick)) yext))) - (set! mol (ly:molecule-add mol (box-molecule (cons (- (car xext) thick) (car xext)) yext))) - mol - )) + (ly:molecule-add (box-molecule xext (cons (- (car yext) thick) (car yext) )) + (box-molecule xext (cons (cdr yext) (+ (cdr yext) thick) )) + (box-molecule (cons (cdr xext) (+ (cdr xext) thick)) yext) + (box-molecule (cons (- (car xext) thick) (car xext)) yext)))) diff --git a/scm/new-markup.scm b/scm/new-markup.scm index f04cf768d8..a29b9027a8 100644 --- a/scm/new-markup.scm +++ b/scm/new-markup.scm @@ -73,18 +73,12 @@ for the reader. (map (lambda (x) (interpret-markup grob props x)) (car rest))) ) -(define (combine-molecule-list lst) - (if (null? (cdr lst)) (car lst) - (ly:molecule-add (car lst) (combine-molecule-list (cdr lst))) - )) (define-public (combine-markup grob props . rest) (ly:molecule-add (interpret-markup grob props (car rest)) (interpret-markup grob props (cadr rest)))) -; (combine-molecule-list (map (lambda (x) (interpret-markup grob props x)) (car rest)))) - (define (font-markup qualifier value) (lambda (grob props . rest) (interpret-markup grob (cons (cons `(,qualifier . ,value) (car props)) (cdr props)) (car rest)) @@ -223,15 +217,12 @@ for the reader. (dot (ly:find-glyph-by-name font "dots-dot")) (dotwid (interval-length (ly:molecule-get-extent dot X))) (dots (if (> dot-count 0) - (reduce-no-unit ; TODO: use reduce. - (lambda (x y) - (ly:molecule-add x y)) + (ly:molecule-add (map (lambda (x) (ly:molecule-translate-axis dot (* (+ 1 (* 2 x)) dotwid) X) ) (iota dot-count 1))) - #f - )) + #f)) (flaggl (if (> log 2) (ly:molecule-translate -- 2.39.5