-2002-06-21 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+2002-06-22 Han-Wen <hanwen@cs.uu.nl>
+
+ * lily/grob.cc (do_break_substitution): rename function, use
+ global var for criterion argument. Reduces stack usage a little.
+
+ * ly/engraver-init.ly (StaffContext): add Instrument_engraver
* scripts/convert-ly.py, lily/*.cc, scm/*.scm: change
visibility-lambda to break-visibility
met through music.
- Those deserving special mentioning (in no particular order): Esther,
-Marijke, Heike, Inge, Judith, Hannah, Auke, Ilse, Evelyn, Maartje, Suzanne,
-Ilse (gee, again?), Marieke, Irene, Martine, Idwine and last (but certainly not
-least) Janneke!
+ Those deserving special mentioning (in no particular order):
+Esther, Marijke, Heike, Inge, Judith, Hannah, Auke, Ilse, Evelyn,
+Maartje, Suzanne, Ilse (gee, again?), Marieke, Irene, Martine, Idwine,
+Hanna and last (but certainly not least) Janneke!
HWN
It is rather tightly coded, since it takes a lot of time; it is
one of the top functions in the profile.
+ We don't pass break_criterion as a parameter, since it is
+ `constant', but takes up stack space.
+
*/
+
+
+static SCM break_criterion;
+void
+set_break_subsititution (SCM criterion)
+{
+ break_criterion = criterion;
+}
+
SCM
-Grob::handle_broken_grobs (SCM src, SCM criterion)
+do_break_substitution (SCM src)
{
again:
Grob *sc = unsmob_grob (src);
if (sc)
{
- if (SCM_INUMP (criterion))
+ if (SCM_INUMP (break_criterion))
{
Item * i = dynamic_cast<Item*> (sc);
- Direction d = to_dir (criterion);
+ Direction d = to_dir (break_criterion);
if (i && i->break_status_dir () != d)
{
Item *br = i->find_prebroken_piece (d);
else
{
System * line
- = dynamic_cast<System*> (unsmob_grob (criterion));
+ = dynamic_cast<System*> (unsmob_grob (break_criterion));
if (sc->line_l () != line)
{
sc = sc->find_broken_piece (line);
/*
UGH! breaks on circular lists.
*/
- SCM newcar = handle_broken_grobs (oldcar, criterion);
+ SCM newcar = do_break_substitution (oldcar);
SCM oldcdr = ly_cdr (src);
if (newcar == SCM_UNDEFINED
/*
This is tail-recursion, ie.
- return handle_broken_grobs (cdr, criterion);
+ return do_break_substution (cdr, break_criterion);
We don't want to rely on the compiler to do this. Without
tail-recursion, this easily crashes with a stack overflow. */
goto again;
}
- SCM newcdr = handle_broken_grobs (oldcdr, criterion);
+ SCM newcdr = do_break_substitution (oldcdr);
return scm_cons (newcar, newcdr);
}
else
{
Grob * sc = s->broken_into_l_arr_[i];
System * l = sc->line_l ();
+
+ set_break_subsititution (l ? l->self_scm () : SCM_UNDEFINED);
sc->mutable_property_alist_ =
- handle_broken_grobs (mutable_property_alist_,
- l ? l->self_scm () : SCM_UNDEFINED);
+ do_break_substitution (mutable_property_alist_);
+
}
}
if (line && common_refpoint (line, X_AXIS) && common_refpoint (line, Y_AXIS))
{
- mutable_property_alist_
- = handle_broken_grobs (mutable_property_alist_,
- line ? line->self_scm () : SCM_UNDEFINED);
+ set_break_subsititution (line ? line->self_scm () : SCM_UNDEFINED);
+ mutable_property_alist_ = do_break_substitution (mutable_property_alist_);
}
else if (dynamic_cast <System*> (this))
{
- mutable_property_alist_ = handle_broken_grobs (mutable_property_alist_,
- SCM_UNDEFINED);
+ set_break_subsititution (SCM_UNDEFINED);
+ mutable_property_alist_ = do_break_substitution (mutable_property_alist_);
}
else
{
return 0;
}
+/*
+ translate in one direction
+*/
void
Grob::translate_axis (Real y, Axis a)
{
}
}
+
+/*
+ Find the offset relative to D. If D equals THIS, then it is 0.
+ Otherwise, it recursively defd as
+
+ OFFSET_ + PARENT_L_->relative_coordinate (D)
+*/
Real
Grob::relative_coordinate (Grob const*refp, Axis a) const
{
return get_offset (a) + dim_cache_[a].parent_l_->relative_coordinate (refp, a);
}
+
+
+/*
+ Invoke callbacks to get offset relative to parent.
+*/
Real
Grob::get_offset (Axis a) const
{
return ext;
}
+/*
+ Find the group-element which has both #this# and #s#
+*/
Grob *
Grob::common_refpoint (Grob const* s, Axis a) const
{
#funcptr# is the function to call to update this element.
*/
void calculate_dependencies (int final, int busy, SCM funcname);
- static SCM handle_broken_grobs(SCM, SCM criterion);
+
virtual void do_break_processing ();
virtual Grob *find_broken_piece (System*) const;
DECLARE_SCHEME_CALLBACK (point_dimension_callback, (SCM smob, SCM axis));
DECLARE_SCHEME_CALLBACK (molecule_extent, (SCM smob, SCM axis));
-
static SCM ly_set_grob_property (SCM, SCM,SCM);
static SCM ly_get_grob_property (SCM, SCM);
virtual void handle_broken_dependencies ();
virtual void handle_prebroken_dependencies ();
-
DECLARE_SMOBS (Grob,foo);
void init ();
-
-
public:
-
bool empty_b (Axis a) const;
Interval extent (Grob * refpoint, Axis) const;
- /**
- translate in one direction
- */
-
void translate_axis (Real, Axis);
-
- /**
- Find the offset relative to D. If D equals THIS, then it is 0.
- Otherwise, it recursively defd as
-
- OFFSET_ + PARENT_L_->relative_coordinate (D)
- */
Real relative_coordinate (Grob const* refp, Axis) const;
- /**
- Find the group-element which has both #this# and #s#
- */
Grob*common_refpoint (Grob const* s, Axis a) const;
void add_offset_callback (SCM callback, Axis);
bool has_extent_callback_b (SCM, Axis)const;
void set_extent (SCM , Axis);
-
-
- /**
- Invoke callbacks to get offset relative to parent.
- */
Real get_offset (Axis a) const;
- /**
- Set the parent refpoint of THIS to E
- */
+
void set_parent (Grob* e, Axis);
Grob *get_parent (Axis a) const { return dim_cache_[a].parent_l_; }
Grob*common_refpoint_of_list (SCM elt_list, Grob * , Axis a);
Grob*common_refpoint_of_array (Link_array<Grob> const&, Grob * , Axis a);
+void set_break_subsititution (SCM criterion);
+SCM do_break_substitution (SCM);
+
#endif // STAFFELEM_HH
{
if (original_l_)
{
- mutable_property_alist_
- = handle_broken_grobs(original_l_->mutable_property_alist_,
- gh_int2scm (break_status_dir ()));
+ set_break_subsititution (gh_int2scm (break_status_dir ()));
+ mutable_property_alist_ = do_break_substitution(original_l_->mutable_property_alist_);
+
}
/*
\consists "Bar_engraver"
\consists "Time_signature_engraver"
\consists "Staff_symbol_engraver"
+ \consists "Instrument_name_engraver"
\consistsend "Axis_group_engraver"
\accepts "Voice"
}
\consistsend "Axis_group_engraver"
}
+
TabVoiceContext = \translator {
\VoiceContext
\name "TabVoice"
\denies "Thread"
\consists "Tab_note_heads_engraver"
-
+
% Draws all stems/beams out of the staff (and not in the middle of the staff !)
Beam \override #'damping = #100000
Stem \override #'up-to-staff = ##t
-
+
% No accidental in tablature !
\remove Accidental_engraver
Accidental = \turnOff