+2006-02-04 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * scm/music-functions.scm (pitch-of-note): new function.
+
+ * ly/music-functions-init.ly: add \octave and \addquote
+
+ * lily/parser.yy (music_function_chord_body): softcode \octave.
+ (lilypond_header): softcode \addquote
+
2006-02-03 Jan Nieuwenhuizen <janneke@gnu.org>
* flower/include/std-vector.hh[STD_VECTOR]: Do not include
do
splits[d].beamify (beat_length, subdivide);
- while (flip (&d) != LEFT)
- ;
+ while (flip (&d) != LEFT);
int middle_beams = (split ? 1
: min (splits[RIGHT].beam_extend_count (LEFT),
= {
{"accepts", ACCEPTS},
{"addlyrics", ADDLYRICS},
- {"addquote", ADDQUOTE},
{"alias", ALIAS},
{"alternative", ALTERNATIVE},
{"book", BOOK},
{"new", NEWCONTEXT},
{"notemode", NOTEMODE},
{"objectid", OBJECTID},
- {"octave", OCTAVE},
{"once", ONCE},
{"override", OVERRIDE},
{"paper", PAPER},
toplevel_expression:
lilypond_header {
THIS->lexer_->set_identifier (ly_symbol2scm ("$defaultheader"), $1);
- }
- | add_quote {
-
}
| book_block {
Book *book = $1;
Repeated_music:
REPEAT simple_string bare_unsigned Music Alternative_music
{
+ /*TODO: move to Scheme.*/
Music *beg = $4;
int times = $3;
SCM alts = scm_is_pair ($5) ? scm_car ($5) : SCM_EOL;
}
| TIMES fraction Music
-
{
- int n = scm_to_int (scm_car ($2)); int d = scm_to_int (scm_cdr ($2));
+ int n = scm_to_int (scm_car ($2));
+ int d = scm_to_int (scm_cdr ($2));
Music *mp = $3;
$$= MY_MAKE_MUSIC ("TimeScaledMusic");
;
-add_quote:
- ADDQUOTE string Music {
- SCM adder = ly_lily_module_constant ("add-quotable");
-
- scm_call_2 (adder, $2, $3->self_scm ());
- $3->unprotect();
- }
- ;
-
command_element:
command_event {
$$ = MY_MAKE_MUSIC ("EventChord");
skip->set_spot (@$);
$$ = skip;
}
- | OCTAVE pitch {
- Music *m = MY_MAKE_MUSIC ("RelativeOctaveCheck");
- $$ = m;
- $$->set_spot (@$);
- $$->set_property ("pitch", $2);
- }
| E_BRACKET_OPEN {
Music *m = MY_MAKE_MUSIC ("LigatureEvent");
m->set_property ("span-direction", scm_from_int (START));
spacingTweaks =
#(def-music-function (parser location parameters) (list?)
(make-music 'SequentialMusic 'void #t))
+
+octave =
+#(def-music-function (parser location pitch-note) (ly:music?)
+ "octave check"
+
+ (make-music 'RelativeOctaveCheck
+ 'origin location
+ 'pitch (pitch-of-note pitch-note)
+ ))
+
+addquote =
+#(def-music-function (parser location name music) (string? ly:music?)
+ "Add a piece of music to be quoted "
+ (add-quotable name music)
+ (make-music 'SequentialMusic 'void #t))
+
+
(ly:make-duration 0 0) '())))
(ly:music-compress skip (ly:music-length mus))
skip))
+
+(define-public (pitch-of-note event-chord)
+
+ (let*
+ ((evs (filter (lambda (x) (memq 'note-event (ly:music-property x 'types)))
+ (ly:music-property event-chord 'elements))))
+
+ (if (pair? evs)
+ (ly:music-property (car evs) 'pitch)
+ #f)))
+