/*
This file is part of LilyPond, the GNU music typesetter.
- Copyright (C) 2005--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ Copyright (C) 2005--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
" @var{val} or @code{'()} if @var{val} is undefined.")
{
LY_ASSERT_SMOB (Output_def, def, 1);
- Output_def *op = unsmob_output_def (def);
+ Output_def *op = unsmob<Output_def> (def);
LY_ASSERT_TYPE (ly_is_symbol, sym, 2);
SCM answer = op->lookup_variable (sym);
- if (answer == SCM_UNDEFINED)
+ if (SCM_UNBNDP (answer))
{
- if (val == SCM_UNDEFINED)
+ if (SCM_UNBNDP (val))
val = SCM_EOL;
answer = val;
"Return the variable scope inside @var{def}.")
{
LY_ASSERT_SMOB (Output_def, def, 1);
- Output_def *op = unsmob_output_def (def);
+ Output_def *op = unsmob<Output_def> (def);
return op->scope_;
}
"Return the parent output definition of @var{def}.")
{
LY_ASSERT_SMOB (Output_def, def, 1);
- Output_def *op = unsmob_output_def (def);
+ Output_def *op = unsmob<Output_def> (def);
return op->parent_ ? op->parent_->self_scm () : SCM_EOL;
}
"Set an output definition @var{def} variable @var{sym} to @var{val}.")
{
LY_ASSERT_SMOB (Output_def, def, 1);
- Output_def *output_def = unsmob_output_def (def);
+ Output_def *output_def = unsmob<Output_def> (def);
LY_ASSERT_TYPE (ly_is_symbol, sym, 2);
output_def->set_variable (sym, val);
return SCM_UNSPECIFIED;
"Clone output definition @var{def}.")
{
LY_ASSERT_SMOB (Output_def, def, 1);
- Output_def *op = unsmob_output_def (def);
+ Output_def *op = unsmob<Output_def> (def);
Output_def *clone = op->clone ();
return clone->unprotect ();
{
LY_ASSERT_SMOB (Output_def, output_def, 1);
- Output_def *id = unsmob_output_def (output_def);
+ Output_def *id = unsmob<Output_def> (output_def);
SCM al = ly_module_2_alist (id->scope_);
SCM ell = SCM_EOL;
for (SCM s = al; scm_is_pair (s); s = scm_cdr (s))
{
- Context_def *td = unsmob_context_def (scm_cdar (s));
+ Context_def *td = unsmob<Context_def> (scm_cdar (s));
SCM key = scm_caar (s);
- if (td && key == td->get_context_name ())
- ell = scm_cons (scm_cons (key, td->to_alist ()), ell);
+ if (td && scm_is_eq (key, td->get_context_name ()))
+ ell = scm_cons (scm_cons (key, td->to_alist ()), ell);
}
return ell;
}
if (!SCM_UNBNDP (context_name))
LY_ASSERT_TYPE (ly_is_symbol, context_name, 2);
- Output_def *id = unsmob_output_def (output_def);
+ Output_def *id = unsmob<Output_def> (output_def);
SCM al = ly_module_2_alist (id->scope_);
SCM ell = SCM_EOL;
for (SCM s = al; scm_is_pair (s); s = scm_cdr (s))
{
SCM p = scm_car (s);
- Context_def *td = unsmob_context_def (scm_cdr (p));
+ Context_def *td = unsmob<Context_def> (scm_cdr (p));
if (td && scm_is_eq (scm_car (p), td->get_context_name ())
&& (SCM_UNBNDP (context_name) || td->is_alias (context_name)))
ell = scm_cons (p, ell);
return ell;
}
-
-LY_DEFINE (ly_output_def_p, "ly:output-def?",
- 1, 0, 0, (SCM def),
- "Is @var{def} an output definition?")
-{
- return ly_bool2scm (unsmob_output_def (def));
-}
+const char
+* const Output_def::type_p_name_ = "ly:output-def?";
LY_DEFINE (ly_paper_outputscale, "ly:paper-outputscale",
1, 0, 0, (SCM def),
"Return the output-scale for output definition @var{def}.")
{
LY_ASSERT_SMOB (Output_def, def, 1);
- Output_def *b = unsmob_output_def (def);
+ Output_def *b = unsmob<Output_def> (def);
return scm_from_double (output_scale (b));
}
{
LY_ASSERT_SMOB (Output_def, def, 1);
- Output_def *paper = unsmob_output_def (def);
+ Output_def *paper = unsmob<Output_def> (def);
Font_metric *fm = select_font (paper, chain);
return fm->self_scm ();
}
" @var{def} as a double.")
{
LY_ASSERT_SMOB (Output_def, def, 1);
- Output_def *layout = unsmob_output_def (def);
+ Output_def *layout = unsmob<Output_def> (def);
return scm_from_double (layout->get_dimension (sym));
}
" @var{def} (e.g., @code{\\paper}).")
{
LY_ASSERT_SMOB (Output_def, def, 1);
- Output_def *b = unsmob_output_def (def);
+ Output_def *b = unsmob<Output_def> (def);
SCM tab1 = b->lookup_variable (ly_symbol2scm ("scaled-fonts"));
SCM tab2 = b->lookup_variable (ly_symbol2scm ("pango-fonts"));
SCM alist1 = SCM_EOL;
- if (scm_hash_table_p (tab1) == SCM_BOOL_T)
+ if (to_boolean (scm_hash_table_p (tab1)))
{
alist1 = scm_append (ly_alist_vals (ly_hash2alist (tab1)));
}
SCM alist2 = SCM_EOL;
- if (scm_hash_table_p (tab2) == SCM_BOOL_T)
+ if (scm_is_true (scm_hash_table_p (tab2)))
{
// strip original-fonts/pango-font-descriptions
alist2 = scm_append (ly_alist_vals (ly_hash2alist (tab2)));
{
SCM entry = scm_car (s);
- Font_metric *fm = unsmob_metrics (entry);
+ Font_metric *fm = unsmob<Font_metric> (entry);
if (dynamic_cast<Modified_font_metric *> (fm)
|| dynamic_cast<Pango_font *> (fm))