subclass.
*/
-//#define HASHING_FOR_MUTABLE_PROPS
#define HASH_SIZE 3
#define INFINITY_MSG "Infinity or NaN encountered"
smobify_self ();
-#ifdef HASHING_FOR_MUTABLE_PROPS
- mutable_property_alist_ = scm_c_make_hash_table (HASH_SIZE);
-#endif
SCM meta = get_property ("meta");
if (ly_c_pair_p (meta))
if (is_number_pair (xt))
cb = xt;
else if (cb != SCM_BOOL_F
- && !is_procedure (cb) && !ly_c_pair_p (cb)
- && is_procedure (get_property ("print-function")))
+ && !ly_c_procedure_p (cb) && !ly_c_pair_p (cb)
+ && ly_c_procedure_p (get_property ("print-function")))
cb = stencil_extent_proc;
dim_cache_[a].dimension_ = cb;
pscore_ = 0;
smobify_self ();
-
-#ifdef HASHING_FOR_MUTABLE_PROPS
- mutable_property_alist_ = scm_c_make_hash_table (HASH_SIZE);
-#endif
}
Grob::~Grob ()
{
- /*
- do nothing scm-ish and no unprotecting here.
- */
}
return ly_interval2scm (e);
}
-Paper_def*
+Output_def*
Grob::get_paper () const
{
return pscore_ ? pscore_->paper_ : 0;
}
+
+/*
+ Recursively track all dependencies of this Grob. The
+ status_ field is used as a mark-field. It is marked with
+ BUSY during execution of this function, and marked with FINAL
+ when finished.
+
+ FUNCPTR is the function to call to update this element.
+*/
void
Grob::calculate_dependencies (int final, int busy, SCM funcname)
{
if (status_ >= final)
return;
- if (status_== busy)
+ if (status_ == busy)
{
programming_error ("Element is busy, come back later");
return;
SCM proc = internal_get_property (funcname);
- if (is_procedure (proc))
+ if (ly_c_procedure_p (proc))
scm_call_1 (proc, this->self_scm ());
- status_= final;
+ status_ = final;
}
Stencil *
Grob::get_stencil () const
{
- if (!live ())
+ if (!is_live ())
{
return 0;
}
mol = get_uncached_stencil ();
- if (live ())
+ if (is_live ())
{
Grob *me = (Grob*)this;
me->set_property ("stencil", mol);
SCM proc = get_property ("print-function");
SCM mol = SCM_EOL;
- if (is_procedure (proc))
+ if (ly_c_procedure_p (proc))
mol = scm_apply_0 (proc, scm_list_n (this->self_scm (), SCM_UNDEFINED));
- Stencil *m = unsmob_stencil (mol);
-
- if (unsmob_stencil (mol))
- {
- SCM origin = ly_symbol2scm ("no-origin");
+ if (Stencil *m = unsmob_stencil (mol))
+ {
+ if (to_boolean (get_property ("transparent")))
+ mol = Stencil (m->extent_box (), SCM_EOL).smobbed_copy ();
+ else
+ {
+ SCM origin = ly_symbol2scm ("no-origin");
- if (store_locations_global_b)
- {
- SCM cause = get_property ("cause");
- if (Music*m = unsmob_music (cause))
- {
- SCM music_origin = m->get_property ("origin");
- if (unsmob_input (music_origin))
- origin = music_origin;
- }
+ if (store_locations_global_b)
+ {
+ SCM cause = get_property ("cause");
+ if (Music*m = unsmob_music (cause))
+ {
+ SCM music_origin = m->get_property ("origin");
+ if (unsmob_input (music_origin))
+ origin = music_origin;
+ }
+ }
+
+ // ugr.
+ mol = Stencil (m->extent_box (),
+ scm_list_n (origin, m->expr (), SCM_UNDEFINED)
+ ). smobbed_copy ();
}
-
- // ugr.
-
- mol = Stencil (m->extent_box (),
- scm_list_n (origin, m->get_expr (), SCM_UNDEFINED)
- ). smobbed_copy ();
-
- m = unsmob_stencil (mol);
- }
-
- /*
- transparent retains dimensions of element.
- */
- if (m && to_boolean (get_property ("transparent")))
- mol = Stencil (m->extent_box (), SCM_EOL).smobbed_copy ();
+ }
return mol;
}
programming_error ("Null dependency added");
}
-
void
Grob::handle_broken_dependencies ()
{
System *system = get_system ();
- if (live ()
+ if (is_live ()
&& system && common_refpoint (system, X_AXIS) && common_refpoint (system, Y_AXIS))
{
substitute_mutable_properties (system ? system->self_scm () : SCM_UNDEFINED,
void
Grob::suicide ()
{
- if (!live ())
+ if (!is_live ())
return;
-#if 0 // see below.
- String nm = name ();
-#endif
mutable_property_alist_ = SCM_EOL;
immutable_property_alist_ = SCM_EOL;
dim_cache_[a].offset_callbacks_ = SCM_EOL;
dim_cache_[a].offsets_left_ = 0;
}
-
-#if 0
- /*
- This can make debugging a little easier: we can still know what
- the object used to be. However, since all its links have been
- broken, it's usually more convenient to set a conditional
- breakpoint in GDB before the property lists are wiped.
- */
- mutable_property_alist_ = scm_acons (ly_symbol2scm ("name"),
- scm_makfrom0str (nm.to_str0()),
- mutable_property_alist_
- );
-#endif
}
void
Grob::is_empty (Axis a)const
{
return ! (ly_c_pair_p (dim_cache_[a].dimension_) ||
- is_procedure (dim_cache_[a].dimension_));
+ ly_c_procedure_p (dim_cache_[a].dimension_));
}
Interval
Interval ext ;
if (ly_c_pair_p (d->dimension_))
;
- else if (is_procedure (d->dimension_))
+ else if (ly_c_procedure_p (d->dimension_))
{
/*
FIXME: add doco on types, and should typecheck maybe?
SCM meta = get_property ("meta");
SCM nm = scm_assoc (ly_symbol2scm ("name"), meta);
nm = (ly_c_pair_p (nm)) ? ly_cdr (nm) : SCM_EOL;
- return is_symbol (nm) ? ly_symbol2string (nm) : classname (this);
+ return ly_c_symbol_p (nm) ? ly_symbol2string (nm) : classname (this);
}
void
void
Grob::set_extent (SCM dc, Axis a)
{
- dim_cache_[a].dimension_ =dc;
+ dim_cache_[a].dimension_ = dc;
}
void