source file of the GNU LilyPond music typesetter
- (c) 2000--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 2000--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
/* TODO: should junk this class an replace by
a single list of context modifications? */
#include "context-def.hh"
+
#include "engraver.hh"
-#include "lily-proto.hh"
#include "output-def.hh"
#include "performer.hh"
#include "score-context.hh"
void
Context_def::add_context_mod (SCM mod)
{
- SCM tag = ly_car (mod);
+ SCM tag = scm_car (mod);
if (ly_symbol2scm ("description") == tag)
{
- description_ = ly_cadr (mod);
+ description_ = scm_cadr (mod);
return;
}
- SCM sym = ly_cadr (mod);
+ SCM sym = scm_cadr (mod);
if (scm_is_string (sym))
sym = scm_string_to_symbol (sym);
{
SCM mods = scm_reverse_x (scm_list_copy (accept_mods_), user_mod);
SCM acc = SCM_EOL;
- for (SCM s = mods; ly_c_pair_p (s); s = ly_cdr (s))
+ for (SCM s = mods; scm_is_pair (s); s = scm_cdr (s))
{
- SCM tag = ly_caar (s);
- SCM sym = ly_cadar (s);
+ SCM tag = scm_caar (s);
+ SCM sym = scm_cadar (s);
if (tag == ly_symbol2scm ("accepts"))
acc = scm_cons (sym, acc);
else if (tag == ly_symbol2scm ("denies"))
SCM accepted = get_accepted (SCM_EOL);
Link_array<Context_def> accepteds;
- for (SCM s = accepted; ly_c_pair_p (s); s = ly_cdr (s))
+ for (SCM s = accepted; scm_is_pair (s); s = scm_cdr (s))
if (Context_def *t = unsmob_context_def (find_context_def (odef,
- ly_car (s))))
+ scm_car (s))))
accepteds.push (t);
Link_array<Context_def> best_result;
- for (int i=0; i < accepteds.size (); i++)
+ for (int i = 0; i < accepteds.size (); i++)
{
/* do not check aliases, because \context Staff should not
create RhythmicStaff. */
}
}
- int best_depth= INT_MAX;
- for (int i=0; i < accepteds.size (); i++)
+ int best_depth = INT_MAX;
+ for (int i = 0; i < accepteds.size (); i++)
{
Context_def * g = accepteds[i];
= g->path_to_acceptable_context (type_sym, odef);
if (result.size () && result.size () < best_depth)
{
- result.insert (g,0);
+ result.insert (g, 0);
best_result = result;
/* this following line was added in 1.9.3, but hsould've been
SCM mods = scm_reverse_x (scm_list_copy (translator_mods_), user_mod);
- for (SCM s = mods; ly_c_pair_p (s); s = ly_cdr (s))
+ for (SCM s = mods; scm_is_pair (s); s = scm_cdr (s))
{
- SCM tag = ly_caar (s);
- SCM arg = ly_cadar (s);
+ SCM tag = scm_caar (s);
+ SCM arg = scm_cadar (s);
if (scm_is_string (arg))
arg = scm_string_to_symbol (arg);
SCM
filter_performers (SCM ell)
{
- for (SCM *tail = ℓ ly_c_pair_p (*tail); tail = SCM_CDRLOC (*tail))
+ for (SCM *tail = ℓ scm_is_pair (*tail); tail = SCM_CDRLOC (*tail))
{
- if (dynamic_cast<Performer*> (unsmob_translator (ly_car (*tail))))
+ if (dynamic_cast<Performer*> (unsmob_translator (scm_car (*tail))))
{
- *tail = ly_cdr (*tail);
- if (!ly_c_pair_p (*tail))
+ *tail = scm_cdr (*tail);
+ if (!scm_is_pair (*tail))
break ;
}
}
filter_engravers (SCM ell)
{
SCM *tail = ℓ
- for (; ly_c_pair_p (*tail) ; tail = SCM_CDRLOC (*tail))
+ for (; scm_is_pair (*tail) ; tail = SCM_CDRLOC (*tail))
{
- if (dynamic_cast<Engraver*> (unsmob_translator (ly_car (*tail))))
+ if (dynamic_cast<Engraver*> (unsmob_translator (scm_car (*tail))))
{
- *tail = ly_cdr (*tail);
- if (!ly_c_pair_p (*tail))
+ *tail = scm_cdr (*tail);
+ if (!scm_is_pair (*tail))
break ;
}
}
Context *
-Context_def::instantiate (SCM ops)
+Context_def::instantiate (SCM ops, Object_key const *key)
{
Context *tg = 0;
if (context_name_ == ly_symbol2scm ("Score"))
- tg = new Score_context ();
+ tg = new Score_context (key);
else
- tg = new Context ();
+ tg = new Context (key);
tg->definition_ = self_scm ();
SCM trans_list = SCM_EOL;
- for (SCM s = trans_names; ly_c_pair_p (s) ; s = ly_cdr (s))
+ for (SCM s = trans_names; scm_is_pair (s) ; s = scm_cdr (s))
{
- Translator *t = get_translator (ly_car (s));
+ Translator *t = get_translator (scm_car (s));
if (!t)
warning (_f ("can't find: `%s'", s));
else
if (tr->must_be_last ())
{
SCM cons = scm_cons (str, SCM_EOL);
- if (ly_c_pair_p (trans_list))
+ if (scm_is_pair (trans_list))
scm_set_cdr_x (scm_last_pair (trans_list), cons);
else
- trans_list= cons;
+ trans_list = cons;
}
else
{
scm_gc_unprotect_object (g->self_scm ());
- tg->accepts_list_ = get_accepted (ops);
-
+ tg->accepts_list_ = get_accepted (ops);
+
return tg;
}
SCM
Context_def::clone_scm () const
{
- Context_def * t = new Context_def (*this);
+ Context_def *t = new Context_def (*this);
SCM x = t->self_scm ();
scm_gc_unprotect_object (x);
return x;
SCM
Context_def::make_scm ()
{
- Context_def* t = new Context_def;
+ Context_def *t = new Context_def;
SCM x = t->self_scm ();
scm_gc_unprotect_object (x);
return x;