PACKAGE_NAME=LilyPond
MAJOR_VERSION=1
-MINOR_VERSION=4
-PATCH_LEVEL=4
+MINOR_VERSION=5
+PATCH_LEVEL=0
MY_PATCH_LEVEL=
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
{
where_dir_ = s;
String to_id = (s >= 0) ? "up" : "down";
- String wh = ly_scm2string (music_l_->get_mus_property ("what"));
+ String wh = ly_scm2string (music_l ()->get_mus_property ("what"));
change_to (child_iter_p_, wh, to_id);
}
}
void
Change_iterator::error (String reason)
{
- String to_type = ly_scm2string (music_l_->get_mus_property ("change-to-type"));
- String to_id = ly_scm2string (music_l_->get_mus_property ("change-to-id"));
+ String to_type = ly_scm2string (music_l ()->get_mus_property ("change-to-type"));
+ String to_id = ly_scm2string (music_l ()->get_mus_property ("change-to-id"));
String warn1 = _f ("can't change `%s' to `%s'", to_type, to_id)
+ ": " + reason;
+ report_to_l ()->type_str_ + " = `"
+ report_to_l ()->id_str_ + "': ";
warning (warn2);
- music_l_->origin ()->warning (warn1);
+ music_l ()->origin ()->warning (warn1);
}
/*
Translator_group * current = report_to_l ();
Translator_group * last = 0;
- String to_type = ly_scm2string (music_l_->get_mus_property ("change-to-type"));
- String to_id = ly_scm2string (music_l_->get_mus_property ("change-to-id"));
+ String to_type = ly_scm2string (music_l ()->get_mus_property ("change-to-type"));
+ String to_id = ly_scm2string (music_l ()->get_mus_property ("change-to-id"));
/* find the type of translator that we're changing.
void
Chord_tremolo_iterator::construct_children ()
{
- Repeated_music * rep = dynamic_cast<Repeated_music*> (music_l_);
+ Repeated_music * rep = dynamic_cast<Repeated_music*> (music_l ());
factor_ = Moment (1, rep->repeat_count ());
child_iter_p_ = get_iterator_p (rep->body ());
}
{
if (!m)
{
- Music_iterator *yeah = try_music (music_l_);
+ Music_iterator *yeah = try_music (music_l ());
if (yeah)
set_translator (yeah->report_to_l ());
else
- music_l_->origin ()->warning (_ ("no one to print a tremolos"));
+ music_l ()->origin ()->warning (_ ("no one to print a tremolos"));
}
child_iter_p_->process (factor_ * m);
void
Folded_repeat_iterator::construct_children ()
{
- Repeated_music * mus = dynamic_cast<Repeated_music*> (music_l_);
+ Repeated_music * mus = dynamic_cast<Repeated_music*> (music_l ());
main_iter_p_ = get_iterator_p (mus->body ());
if (!main_iter_p_->ok ())
{
{
if (!m)
{
- bool success = try_music (music_l_);
+ bool success = try_music (music_l ());
if (!success)
- music_l_->origin ()->warning (_ ("no one to print a repeat brace"));
+ music_l ()->origin ()->warning (_ ("no one to print a repeat brace"));
}
if (main_iter_p_)
void
Folded_repeat_iterator::leave_body ()
{
- Repeated_music * mus = dynamic_cast<Repeated_music *> (music_l_);
+ Repeated_music * mus = dynamic_cast<Repeated_music *> (music_l ());
delete main_iter_p_;
main_iter_p_ = 0;
main_length_mom_ += mus->body ()->length_mom ();
void
Folded_repeat_iterator::enter_alternative ()
{
- Repeated_music * mus = dynamic_cast<Repeated_music *> (music_l_);
+ Repeated_music * mus = dynamic_cast<Repeated_music *> (music_l ());
if (mus->alternatives ())
{
Simultaneous_music_iterator * s = new Simultaneous_music_iterator;
{
protected:
Moment music_length_;
-
+ Moment start_mom_;
public:
VIRTUAL_COPY_CONS (Music_iterator);
Moment music_length_mom () const;
+ Moment music_start_mom () const;
Music_iterator ();
Music_iterator (Music_iterator const&);
virtual ~Music_iterator ();
virtual void construct_children ();
static SCM constructor_cxx_function;
-protected:
- Music * music_l_;
-
/**
Get an iterator for MUS, inheriting the translation unit from THIS.
*/
virtual Music_iterator* try_music_in_children (Music *) const;
+ Music * music_l () const;
private:
Interpretation_context_handle handle_;
+ Music * music_l_;
};
void
Lyric_combine_music_iterator::construct_children ()
{
- Lyric_combine_music const * m = dynamic_cast<Lyric_combine_music const*> (music_l_);
+ Lyric_combine_music const * m = dynamic_cast<Lyric_combine_music const*> (music_l ());
music_iter_p_ = get_iterator_p (m->music_l ());
lyric_iter_p_ = get_iterator_p (m->lyrics_l ());
handle_ = *src.handle_.clone ();
music_l_ = src.music_l_;
music_length_ = src.music_length_;
+ start_mom_ = src.start_mom_;
}
Music_iterator::~Music_iterator ()
return 0;
}
-
void
Music_iterator::process (Moment)
{
}
p->music_l_ = m;
+ assert (m);
p->music_length_ = m->length_mom ();
-
+ p->start_mom_ = m->start_mom ();
return p;
}
Music_iterator::music_length_mom () const
{
return music_length_;
+
+}
+
+Moment
+Music_iterator::music_start_mom ()const
+{
+ return start_mom_;
}
void
Music_iterator::init_translator (Music *m, Translator_group *report_l)
{
music_l_ = m;
+ assert (m);
if (Context_specced_music * csm =dynamic_cast<Context_specced_music *> (m))
{
SCM ct = csm->get_mus_property ("context-type");
}
IMPLEMENT_CTOR_CALLBACK (Music_iterator);
+
+Music *
+Music_iterator::music_l () const
+{
+ return music_l_;
+}
Music_wrapper_iterator::construct_children ()
{
child_iter_p_ =
- get_iterator_p (dynamic_cast<Music_wrapper const*> (music_l_)->element ());
+ get_iterator_p (dynamic_cast<Music_wrapper const*> (music_l ())->element ());
}
bool
{
if (last_processed_mom_ < Moment (0))
{
- bool accepted = try_music (music_l_);
+ bool accepted = try_music (music_l ());
if (!accepted)
- music_l_->origin ()->warning (_f ("Junking request: `%s'",
- classname (music_l_)));
+ music_l ()->origin ()->warning (_f ("Junking request: `%s'",
+ classname (music_l ())));
}
skip (m);
%token EXTENDER
%token FONT
%token GLISSANDO
-%token GRACE
+%token GRACE NGRACE
%token HEADER
%token HYPHEN
%token IN_T
chm->set_spot (*$3->origin ());
}
| GRACE Music {
- $$ = new Grace_music (SCM_EOL);
+#if 1
+ /*
+ The other version is for easier debugging of
+ Sequential_music_iterator in combination with grace notes.
+ */
+
+ SCM start = THIS->lexer_p_->lookup_identifier ("startGraceMusic");
+ SCM stop = THIS->lexer_p_->lookup_identifier ("stopGraceMusic");
+ Music *startm = unsmob_music (start);
+ Music *stopm = unsmob_music (stop);
+
+ SCM ms = SCM_EOL;
+ if (stopm) {
+ stopm = stopm->clone ();
+ ms = gh_cons (stopm->self_scm (), ms);
+ scm_unprotect_object (stopm->self_scm ());
+ }
+ ms = gh_cons ($2->self_scm (), ms);
+ scm_unprotect_object ($2->self_scm());
+ if (startm) {
+ startm = startm->clone ();
+ ms = gh_cons (startm->self_scm () , ms);
+ scm_unprotect_object (startm->self_scm ());
+ }
+
+ Music* seq = new Sequential_music (SCM_EOL);
+ seq->set_mus_property ("elements", ms);
+
+ $$ = new New_grace_music (SCM_EOL);
+ $$->set_mus_property ("element", seq->self_scm ());
+ scm_unprotect_object (seq->self_scm ());
+#else
+ $$ = new New_grace_music (SCM_EOL);
$$->set_mus_property ("element", $2->self_scm ());
scm_unprotect_object ($2->self_scm ());
+#endif
+
}
| CONTEXT string '=' string Music {
$$ = unsmob_duration ($$)->compressed ( $3) .smobbed_copy ();
}
| multiplied_duration '*' FRACTION {
- Moment m (gh_scm2int (gh_car ($3)), gh_scm2int (gh_cdr ($3)));
+ Rational m (gh_scm2int (gh_car ($3)), gh_scm2int (gh_cdr ($3)));
$$ = unsmob_duration ($$)->compressed (m).smobbed_copy ();
}
void
Part_combine_music_iterator::construct_children ()
{
- Part_combine_music const * m = dynamic_cast<Part_combine_music const*> (music_l_);
+ Part_combine_music const * m = dynamic_cast<Part_combine_music const*> (music_l ());
first_iter_p_ = get_iterator_p (m->first_l ());
second_iter_p_ = get_iterator_p (m->second_l ());
Part_combine_music_iterator::get_state (Moment)
{
int state = UNKNOWN;
- Part_combine_music const *p = dynamic_cast<Part_combine_music const* > (music_l_);
+ Part_combine_music const *p = dynamic_cast<Part_combine_music const* > (music_l ());
String w = ly_scm2string (p->get_mus_property ("what"));
Moment now = pending_moment ();
- if (!now.mod_rat (change_mom))
+ if (!now.main_part_.mod_rat (change_mom.main_part_))
{
SCM interval = SCM_BOOL_F;
if (first_until_ < now)
else
state = state_;
- Part_combine_music const *p = dynamic_cast<Part_combine_music const* > (music_l_);
+ Part_combine_music const *p = dynamic_cast<Part_combine_music const* > (music_l ());
bool previously_combined_b = first_iter_p_->report_to_l ()->daddy_trans_l_
void
Percent_repeat_iterator::construct_children ()
{
- Repeated_music * mus =dynamic_cast<Repeated_music *> (music_l_);
+ Repeated_music * mus =dynamic_cast<Repeated_music *> (music_l ());
finish_mom_ = mus->length_mom ();
child_iter_p_ = get_iterator_p (mus->body ());
}
{
if (!m)
{
- Music_iterator *yeah = try_music (music_l_);
+ Music_iterator *yeah = try_music (music_l ());
if (yeah)
set_translator (yeah->report_to_l ());
else
- music_l_->origin ()->warning ( _ ("no one to print a percent"));
+ music_l ()->origin ()->warning ( _ ("no one to print a percent"));
}
if (child_iter_p_->ok ())
void
Property_iterator::process (Moment m)
{
- SCM sym = music_l_->get_mus_property ("symbol");
+ SCM sym = music_l ()->get_mus_property ("symbol");
if (gh_symbol_p (sym))
{
- SCM val = music_l_->get_mus_property ("value");
+ SCM val = music_l ()->get_mus_property ("value");
bool ok= true;
if (val != SCM_EOL)
ok = type_check_assignment (val, sym, ly_symbol2scm ("translation-type?"));
void
Property_unset_iterator::process (Moment m)
{
- SCM sym = music_l_->get_mus_property ("symbol");
+ SCM sym = music_l ()->get_mus_property ("symbol");
if (gh_symbol_p (sym))
{
report_to_l ()->unset_property (sym);
void
Push_property_iterator::process (Moment m)
{
- SCM syms = music_l_->get_mus_property ("symbols");
- SCM eprop = music_l_->get_mus_property ("grob-property");
- SCM val = music_l_->get_mus_property ("grob-value");
+ SCM syms = music_l ()->get_mus_property ("symbols");
+ SCM eprop = music_l ()->get_mus_property ("grob-property");
+ SCM val = music_l ()->get_mus_property ("grob-value");
- if (to_boolean (music_l_->get_mus_property ("pop-first")))
+ if (to_boolean (music_l ()->get_mus_property ("pop-first")))
Translator_def::apply_pushpop_property (report_to_l (),
syms, eprop, SCM_UNDEFINED);
void
Pop_property_iterator::process (Moment m)
{
- SCM syms = music_l_->get_mus_property ("symbols");
- SCM eprop = music_l_->get_mus_property ("grob-property");
+ SCM syms = music_l ()->get_mus_property ("symbols");
+ SCM eprop = music_l ()->get_mus_property ("grob-property");
Translator_def::apply_pushpop_property (report_to_l (), syms, eprop, SCM_UNDEFINED);
Simple_music_iterator::process (m);
Request_chord*
Request_chord_iterator::elt_l () const
{
- return (Request_chord*) music_l_;
+ return (Request_chord*) music_l ();
}
SCM
SCM s = SCM_EOL;
if (last_processed_mom_ < Moment (0))
{
- Music_sequence * ms = dynamic_cast<Music_sequence*> (music_l_);
+ Music_sequence * ms = dynamic_cast<Music_sequence*> (music_l ());
for (SCM m = ms->music_list (); gh_pair_p (m); m = gh_cdr (m))
{
{
if (last_processed_mom_ < Moment (0))
{
- for (SCM s = dynamic_cast<Music_sequence *> (music_l_)->music_list ();
+ for (SCM s = dynamic_cast<Music_sequence *> (music_l ())->music_list ();
gh_pair_p (s); s = gh_cdr (s))
{
Music *mus = unsmob_music (gh_car (s));
{
cursor_ = SCM_EOL;
here_mom_ = Moment (0);
-
+ grace_skips_ = 0;
iter_p_ =0;
}
Sequential_music_iterator::Sequential_music_iterator (Sequential_music_iterator const &src)
: Music_iterator (src)
{
+ grace_skips_ = src.grace_skips_;
cursor_ = src.cursor_;
here_mom_ = src.here_mom_;
if (src.iter_p_)
delete iter_p_;
}
+
+Grace_skip *
+get_grace_skips (SCM cursor)
+{
+ Moment here (0);
+ Moment last (here);
+ Grace_skip *head = 0;
+ Grace_skip **tail = &head;
+ bool first = true;
+
+
+ for (; gh_pair_p (cursor); cursor = gh_cdr (cursor))
+ {
+ Music * mus = unsmob_music (gh_car (cursor));
+ Moment l =mus->length_mom ();
+ if (l.main_part_)
+ {
+ first = false;
+ last = here;
+ here += l;
+ }
+ else if(l.grace_mom_ && !first)
+ {
+ assert (!l.main_part_);
+ Grace_skip *p =new Grace_skip;
+ p->start_ = last;
+ p->length_ = (here - last).main_part_;
+ p->grace_length_ = l.grace_mom_;
+ p->next_ = 0;
+ *tail = p;
+ tail = &(*tail)->next_;
+ }
+ }
+ return head;
+}
+
void
Sequential_music_iterator::construct_children ()
{
- cursor_ = dynamic_cast<Music_sequence const*> (music_l_)->music_list ();
+ cursor_ = dynamic_cast<Music_sequence const*> (music_l ())->music_list ();
iter_p_ = gh_pair_p (cursor_) ? get_iterator_p (unsmob_music (gh_car (cursor_))) : 0;
while (iter_p_ && !iter_p_->ok ())
next_element ();
}
+ grace_skips_ = get_grace_skips (cursor_);
+
+ here_mom_ = music_l ()->start_mom ();
+
/*
iter_p_->ok () is tautology, but what the heck.
*/
if (iter_p_ && iter_p_->ok ())
descend_to_child ();
-
}
void
Sequential_music_iterator::next_element ()
{
- here_mom_ += iter_p_->music_length_mom ();
+ Moment len =iter_p_->music_length_mom ();
+ Moment start = iter_p_->music_start_mom ();
+ assert (!grace_skips_ || grace_skips_->start_ >= here_mom_);
+
+ if (len.main_part_ && grace_skips_ && grace_skips_->start_ == here_mom_)
+ {
+ Moment sk;
+ sk.main_part_ = grace_skips_->length_;
+ here_mom_ += sk;
+ here_mom_.grace_mom_ = - grace_skips_->grace_length_;
+
+ Grace_skip * n =grace_skips_->next_;
+ delete grace_skips_;
+ grace_skips_ = n;
+ }
+ else if (len.grace_mom_)
+ {
+ here_mom_.grace_mom_ =0;
+ }
+ else
+ {
+ here_mom_ += len - start;
+ }
+
delete iter_p_;
cursor_ = gh_cdr (cursor_);
return s;
}
/*
- Skip events till UNTIL. We don't do any other side effects (such as
- moving descending to child iterator contexts, because they might
- depend on \context specs and \translator changes being executed
+ Skip events till UNTIL. We don't do any other side effects such as
+ descending to child iterator contexts, because they might depend on
+ \context specs and \translator changes being executed
*/
void
{
while (iter_p_)
{
- iter_p_->process (until - here_mom_);
+ if (grace_skips_ &&
+ grace_skips_->start_ == here_mom_
+ && (grace_skips_->start_ + grace_skips_->length_).main_part_ ==
+ until.main_part_)
+ {
+ /*
+ do the stuff/note/rest preceding a grace.
+ */
+ Moment u = until;
+ u.grace_mom_ = 0;
+ iter_p_->process (u - here_mom_);
+ }
+ else
+ iter_p_->process (until - here_mom_ + iter_p_->music_start_mom ());
/*
if the iter is still OK, there must be events left that have
Moment
Sequential_music_iterator::pending_moment () const
{
- return iter_p_->pending_moment () + here_mom_;
+ Moment cp = iter_p_->pending_moment ();
+
+ if (grace_skips_
+ && here_mom_ == grace_skips_->start_
+ && cp.main_part_ >= grace_skips_->length_)
+ {
+ cp += here_mom_ ;
+ cp.grace_mom_ = - grace_skips_->grace_length_;
+ return cp;
+ }
+ else
+ return cp + here_mom_ - iter_p_->music_start_mom ();
}
void
Simple_music_iterator::skip (Moment m)
{
- music_l_ = 0;
+ /*
+ docme??!!
+ */
+ // music_l_ = 0;
+
last_processed_mom_ = m;
}
#include "music-list.hh"
#include "killing-cons.tcc"
+
Simultaneous_music_iterator::Simultaneous_music_iterator ()
{
separate_contexts_b_ = false;
Simultaneous_music_iterator::construct_children ()
{
int j = 0;
- Music_sequence const *sim = dynamic_cast<Music_sequence const*> (music_l_);
+ Music_sequence const *sim = dynamic_cast<Music_sequence const*> (music_l ());
SCM i = sim->music_list ();
for (; gh_pair_p (i); i = gh_cdr (i), j++)
{
if (!m)
{
- Music_iterator *yeah = try_music (music_l_);
+ Music_iterator *yeah = try_music (music_l ());
if (yeah)
set_translator (yeah->report_to_l ());
else
- music_l_->origin ()->warning (_ ("no one to print a tuplet start bracket"));
+ music_l ()->origin ()->warning (_ ("no one to print a tuplet start bracket"));
}
Music_wrapper_iterator::process (m);
void
Unfolded_repeat_iterator::next_element (bool side_effect)
{
- Repeated_music * repmus =dynamic_cast<Repeated_music *> (music_l_);
+ Repeated_music * repmus =dynamic_cast<Repeated_music *> (music_l ());
delete current_iter_p_;
current_iter_p_ =0;
void
Unfolded_repeat_iterator::construct_children ()
{
- Repeated_music * mus =dynamic_cast<Repeated_music *> (music_l_);
+ Repeated_music * mus =dynamic_cast<Repeated_music *> (music_l ());
alternative_cons_ = (mus->alternatives ())
? mus->alternatives ()->music_list ()