source file of the GNU LilyPond music typesetter
- (c) 2000--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 2000--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
end_consists_name_list_ = SCM_EOL;
property_ops_ = SCM_EOL;
type_name_ = SCM_EOL;
+
+ smobify_self();
+
}
+
Translator_def::~Translator_def ()
{
}
Translator_def::Translator_def (Translator_def const & s)
: Input (s)
{
+ type_aliases_ = SCM_EOL;
+ translator_group_type_ = SCM_EOL;
+ accepts_name_list_ = SCM_EOL;
+ consists_name_list_ = SCM_EOL;
+ end_consists_name_list_ = SCM_EOL;
+ property_ops_ = SCM_EOL;
+ type_name_ = SCM_EOL;
+
+
+ smobify_self();
consists_name_list_ = scm_list_copy (s.consists_name_list_);
end_consists_name_list_ = scm_list_copy (s.end_consists_name_list_);
accepts_name_list_ = scm_list_copy (s.accepts_name_list_);
property_ops_ = scm_list_copy (s.property_ops_);
- type_aliases_ = s.type_aliases_;
+ type_aliases_ = scm_list_copy (s.type_aliases_);
translator_group_type_ = s.translator_group_type_;
type_name_ = s.type_name_;
}
Translator_def::modify_definition (SCM list, SCM str, bool add)
{
String s = ly_scm2string (str);
- if (!get_translator_l (s))
+ if (!get_translator (s))
error (_ ("Program has no such type"));
if (add)
}
/*
- Do it. SYMS maybe a symbol or a list of symbols. VAL is
- SCM_UNDEFINED in case of a pop
+ Do it. SYM is single symbol. VAL is SCM_UNDEFINED in case of a pop
*/
void
-Translator_def::apply_pushpop_property (Translator_group* me,SCM syms, SCM eprop, SCM val)
+Translator_def::apply_pushpop_property (Translator_group* me,SCM sym, SCM eprop, SCM val)
{
- if (gh_symbol_p (syms))
- dynamic_cast<Translator_group*> (me)->execute_single_pushpop_property (syms, eprop, val);
- else for (SCM s = syms; gh_pair_p (s); s = ly_cdr (s))
- dynamic_cast<Translator_group*> (me)->execute_single_pushpop_property (ly_car (s), eprop, val);
+ dynamic_cast<Translator_group*> (me)
+ ->execute_single_pushpop_property (sym, eprop, val);
}
Link_array<Translator_def>
-Translator_def::path_to_acceptable_translator (SCM type_str, Music_output_def* odef) const
+Translator_def::path_to_acceptable_translator (SCM type_string, Music_output_def* odef) const
{
- assert (gh_string_p (type_str));
+ assert (gh_string_p (type_string));
- Link_array<Translator_def> accepted_arr;
+ Link_array<Translator_def> accepteds;
for (SCM s = accepts_name_list_; gh_pair_p (s); s = ly_cdr (s))
{
- Translator_def *t = unsmob_translator_def (odef->find_translator_l (ly_car (s)));
+ Translator_def *t = unsmob_translator_def (odef->find_translator (ly_car (s)));
if (!t)
continue;
- accepted_arr.push (t);
+ accepteds.push (t);
}
Link_array<Translator_def> best_result;
- for (int i=0; i < accepted_arr.size (); i++)
+ for (int i=0; i < accepteds.size (); i++)
{
/*
don't check aliases, because \context Staff should not create RhythmicStaff.
*/
- if (gh_equal_p (accepted_arr[i]->type_name_, type_str))
+ if (gh_equal_p (accepteds[i]->type_name_, type_string))
{
- best_result.push (accepted_arr[i]);
+ best_result.push (accepteds[i]);
return best_result;
}
}
int best_depth= INT_MAX;
- for (int i=0; i < accepted_arr.size (); i++)
+ for (int i=0; i < accepteds.size (); i++)
{
- Translator_def * g = accepted_arr[i];
+ Translator_def * g = accepteds[i];
Link_array<Translator_def> result
- = g->path_to_acceptable_translator (type_str, odef);
+ = g->path_to_acceptable_translator (type_string, odef);
if (result.size () && result.size () < best_depth)
{
result.insert (g,0);
SCM l = SCM_EOL;
for (SCM s = namelist; gh_pair_p (s) ; s = ly_cdr (s))
{
- Translator * t = get_translator_l (ly_scm2string (ly_car (s)));
+ Translator * t = get_translator (ly_scm2string (ly_car (s)));
if (!t)
warning (_f ("can't find: `%s'", s));
else
SCM str = tr->self_scm ();
l = gh_cons (str, l);
- tr->daddy_trans_l_ = tg;
- tr->output_def_l_ = tg->output_def_l_;
+ tr->daddy_trans_ = tg;
+ tr->output_def_ = tg->output_def_;
scm_gc_unprotect_object (str);
}
Translator_group *
Translator_def::instantiate (Music_output_def* md)
{
- Translator * g = get_translator_l (ly_scm2string (translator_group_type_));
+ Translator * g = get_translator (ly_scm2string (translator_group_type_));
g = g->clone ();
Translator_group *tg = dynamic_cast<Translator_group*> (g);
- tg->output_def_l_ = md;
+ tg->output_def_ = md;
tg->definition_ = self_scm ();
- tg->type_str_ = ly_scm2string (type_name_);
+ tg->type_string_ = ly_scm2string (type_name_);
/*
TODO: ugh. we're reversing CONSISTS_NAME_LIST_ here
Translator_def::clone_scm () const
{
Translator_def * t = new Translator_def (*this);
- return t->unprotected_smobify_self ();
+ scm_gc_unprotect_object (t->self_scm());
+ return t->self_scm();
}
SCM
Translator_def::make_scm ()
{
Translator_def* t = new Translator_def;
- return t->unprotected_smobify_self ();
+ scm_gc_unprotect_object (t->self_scm());
+ return t->self_scm();
}
void
}
SCM
-Translator_def::to_alist ()const
+Translator_def::to_alist () const
{
SCM l = SCM_EOL;