X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Finclude%2Fsmobs.tcc;h=818c0900a56bac154476b49282eae6bf529241b8;hb=ef9512388b15e1e5e2b3592299ffe489ac43abb4;hp=913785315ae9bb46f9d72f1ea6f44233ac5e277e;hpb=ee35bce9fe991b2ee3dfa7e33539d74b29bcf91f;p=lilypond.git diff --git a/lily/include/smobs.tcc b/lily/include/smobs.tcc index 913785315a..818c0900a5 100644 --- a/lily/include/smobs.tcc +++ b/lily/include/smobs.tcc @@ -24,15 +24,13 @@ // included from smobs.hh, but other template expansion systems might // make it feasible to compile this only a single time. -#include "lily-guile-macros.hh" -#include "smobs.hh" #include template SCM Smob_base::mark_trampoline (SCM arg) { - Super *ptr = Super::unsmob (arg); + Super *ptr = unsmob (arg); if (ptr) return ptr->mark_smob (); return SCM_UNDEFINED; @@ -42,7 +40,7 @@ template int Smob_base::print_trampoline (SCM arg, SCM port, scm_print_state *p) { - Super *ptr = Super::unsmob (arg); + Super *ptr = unsmob (arg); if (ptr) return ptr->print_smob (port, p); return 0; @@ -65,7 +63,7 @@ Smob_base::register_ptr (Super *p) // Defaults, should not actually get called template SCM -Smob_base::mark_smob () +Smob_base::mark_smob () const { return SCM_UNSPECIFIED; } @@ -88,7 +86,7 @@ Smob_base::equal_p (SCM, SCM) template int -Smob_base::print_smob (SCM p, scm_print_state *) +Smob_base::print_smob (SCM p, scm_print_state *) const { scm_puts ("#<", p); scm_puts (smob_name_.c_str (), p); @@ -115,6 +113,9 @@ Scm_init Smob_base::scm_init_ (init); template string Smob_base::smob_name_; +template +const char * const Smob_base::type_p_name_ = 0; + template void Smob_base::init () { @@ -135,13 +136,7 @@ void Smob_base::init () if (&Super::free_smob != &Smob_base::free_smob) scm_set_smob_free (smob_tag_, Super::free_smob); - // Old GCC versions get their type lattice for pointers-to-members - // tangled up to a degree where we need to typecast _both_ covariant - // types in order to be able to compare them. The other comparisons - // are for static member functions and thus are ordinary function - // pointers which work without those contortions. - if (static_cast(&Super::mark_smob) != - static_cast(&Smob_base::mark_smob)) + if (&Super::mark_smob != &Smob_base::mark_smob) scm_set_smob_mark (smob_tag_, Super::mark_trampoline); scm_set_smob_print (smob_tag_, Super::print_trampoline); if (&Super::equal_p != &Smob_base::equal_p) @@ -157,11 +152,6 @@ void Smob_base::init () scm_c_export (Super::type_p_name_, NULL); } ly_add_type_predicate ((void *) is_smob, smob_name_.c_str ()); - if (Super::smob_proc_signature_ >= 0) - scm_set_smob_apply (smob_tag_, - (scm_t_subr)Super::smob_proc, - Super::smob_proc_signature_ >> 8, - (Super::smob_proc_signature_ >> 4)&0xf, - Super::smob_proc_signature_ & 0xf); + Super::smob_proc_init (smob_tag_); } #endif