summaryrefslogtreecommitdiff
path: root/lily/global-context-scheme.cc
diff options
context:
space:
mode:
authorDan Eble <nine.fierce.ballads@gmail.com>2015-05-01 22:21:43 -0400
committerDan Eble <nine.fierce.ballads@gmail.com>2015-05-22 22:23:26 -0400
commit0c14539bc83d6bb405141b6f21430b33d1e8fcf0 (patch)
treee662f6f5dc73fccbba2297f7fdfc877caf0338bf /lily/global-context-scheme.cc
parente52c5d72fc45e123c8574803ba52871e6fe8a596 (diff)
Issue 4365: non-member unsmob<T> replaces T::unsmob and T::is_smob
Hide Smob_base<>::is_smob() to prevent the misleading situation of D::is_smob(S) returning true when S represents an ancestor of D rather than a D. This issue was previously worked around by overriding is_smob in several derived smob classes; that is no longer needed. LY_ASSERT_SMOB() now returns a smob pointer. This is not used yet, but is available for future use to avoid unsmobbing twice. Smob_base<>::smob_p() is hidden because there doesn't seem to be a need for it to be public. Files in lily/include were edited by hand. Files in lily itself were processed with the following sed script. s/\([A-Za-z_]\+\)::derived_unsmob/unsmob<\1>/g s/derived_unsmob *<\([A-Za-z_]\+\)>/unsmob<\1>/g s/\([A-Za-z_]\+\)::unsmob/unsmob<\1>/g s/\([A-Za-z_]\+\)::is_smob/unsmob<\1>/g s/Input \*\([A-Za-z_]\+\) = unsmob /Input *\1 = unsmob<Input> /g s/LY_ASSERT_SMOB (\([^)]*\))$/LY_ASSERT_SMOB (\1);/g
Diffstat (limited to 'lily/global-context-scheme.cc')
-rw-r--r--lily/global-context-scheme.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/lily/global-context-scheme.cc b/lily/global-context-scheme.cc
index e39b36699a..ea100c912a 100644
--- a/lily/global-context-scheme.cc
+++ b/lily/global-context-scheme.cc
@@ -34,14 +34,14 @@ LY_DEFINE (ly_format_output, "ly:format-output",
" process it and return the @code{Music_output} object"
" in its final state.")
{
- Global_context *g = Global_context::unsmob (context);
+ Global_context *g = unsmob<Global_context> (context);
LY_ASSERT_SMOB (Global_context, context, 1);
SCM output = g->get_output ();
progress_indication ("\n");
- if (Music_output *od = Music_output::unsmob (output))
+ if (Music_output *od = unsmob<Music_output> (output))
od->process ();
return output;
@@ -52,7 +52,7 @@ LY_DEFINE (ly_make_global_translator, "ly:make-global-translator",
"Create a translator group and connect it to the global context"
" @var{global}. The translator group is returned.")
{
- Global_context *g = Global_context::unsmob (global);
+ Global_context *g = unsmob<Global_context> (global);
LY_ASSERT_SMOB (Global_context, global, 1);
Translator_group *tg = new Translator_group ();
@@ -68,7 +68,7 @@ LY_DEFINE (ly_make_global_context, "ly:make-global-context",
" block @var{output-def}. The context is returned.")
{
LY_ASSERT_SMOB (Output_def, output_def, 1);
- Output_def *odef = Output_def::unsmob (output_def);
+ Output_def *odef = unsmob<Output_def> (output_def);
Global_context *glob = new Global_context (odef);
@@ -89,21 +89,21 @@ LY_DEFINE (ly_interpret_music_expression, "ly:interpret-music-expression",
LY_ASSERT_SMOB (Music, mus, 1);
LY_ASSERT_SMOB (Global_context, ctx, 2);
- Music *music = Music::unsmob (mus);
+ Music *music = unsmob<Music> (mus);
if (!music)
{
warning (_ ("no music found in score"));
return SCM_BOOL_F;
}
- Global_context *g = Global_context::unsmob (ctx);
+ Global_context *g = unsmob<Global_context> (ctx);
Cpu_timer timer;
message (_ ("Interpreting music..."));
SCM protected_iter = Music_iterator::get_static_get_iterator (music);
- Music_iterator *iter = Music_iterator::unsmob (protected_iter);
+ Music_iterator *iter = unsmob<Music_iterator> (protected_iter);
iter->init_context (music, g);
iter->construct_children ();