]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4135/2: Replace mark_smob static member functions with non-static members
authorDavid Kastrup <dak@gnu.org>
Wed, 10 Sep 2014 15:01:43 +0000 (17:01 +0200)
committerDavid Kastrup <dak@gnu.org>
Thu, 2 Oct 2014 10:07:09 +0000 (12:07 +0200)
Since the mark functions generally need to access a number of members,
it is quite more convenient if the mark functions are proper non-static
member functions.

61 files changed:
lily/book.cc
lily/context-def.cc
lily/context-mod.cc
lily/context-property.cc
lily/context.cc
lily/dispatcher.cc
lily/font-metric.cc
lily/grob-array.cc
lily/grob-smob.cc
lily/include/book.hh
lily/include/context-def.hh
lily/include/context-mod.hh
lily/include/context.hh
lily/include/dispatcher.hh
lily/include/font-metric.hh
lily/include/grob-array.hh
lily/include/grob.hh
lily/include/input.hh
lily/include/lily-lexer.hh
lily/include/lily-parser.hh
lily/include/listener.hh
lily/include/music-function.hh
lily/include/music-iterator.hh
lily/include/music-output.hh
lily/include/output-def.hh
lily/include/page-marker.hh
lily/include/paper-book.hh
lily/include/paper-outputter.hh
lily/include/pitch.hh
lily/include/prob.hh
lily/include/scheme-listener.hh
lily/include/scm-hash.hh
lily/include/score.hh
lily/include/small-smobs.hh
lily/include/smobs.hh
lily/include/smobs.tcc
lily/include/source-file.hh
lily/include/stencil.hh
lily/include/translator-group.hh
lily/include/translator.hh
lily/input-smob.cc
lily/lily-lexer.cc
lily/lily-parser.cc
lily/listener.cc
lily/music-function.cc
lily/music-iterator.cc
lily/music-output.cc
lily/output-def.cc
lily/page-marker.cc
lily/paper-book.cc
lily/paper-outputter.cc
lily/pitch.cc
lily/prob.cc
lily/scheme-listener.cc
lily/scm-hash.cc
lily/score.cc
lily/source-file.cc
lily/stencil.cc
lily/translator-group.cc
lily/translator.cc
lily/undead.cc

index 6a09d77b69b6f85439e39717350614cce1425e8f..4c426da4fd16c63cae9d9e6880fdeafdeeee70e7 100644 (file)
@@ -106,17 +106,15 @@ Book::~Book ()
 
 
 SCM
-Book::mark_smob (SCM s)
+Book::mark_smob ()
 {
-  Book *book = (Book *) SCM_CELL_WORD_1 (s);
+  if (paper_)
+    scm_gc_mark (paper_->self_scm ());
+  scm_gc_mark (scores_);
+  scm_gc_mark (bookparts_);
+  scm_gc_mark (input_location_);
 
-  if (book->paper_)
-    scm_gc_mark (book->paper_->self_scm ());
-  scm_gc_mark (book->scores_);
-  scm_gc_mark (book->bookparts_);
-  scm_gc_mark (book->input_location_);
-
-  return book->header_;
+  return header_;
 }
 
 int
index 3d9caa2734a1258508862ae487d4ca52d6960126..24803a5d9484bdf07de0cc5c79d59fdcc0ff5aec 100644 (file)
@@ -98,22 +98,20 @@ Context_def::print_smob (SCM smob, SCM port, scm_print_state *)
 }
 
 SCM
-Context_def::mark_smob (SCM smob)
+Context_def::mark_smob ()
 {
-  ASSERT_LIVE_IS_ALLOWED (smob);
-
-  Context_def *me = (Context_def *) SCM_CELL_WORD_1 (smob);
-
-  scm_gc_mark (me->description_);
-  scm_gc_mark (me->context_aliases_);
-  scm_gc_mark (me->accept_mods_);
-  scm_gc_mark (me->translator_mods_);
-  scm_gc_mark (me->property_ops_);
-  scm_gc_mark (me->translator_group_type_);
-  scm_gc_mark (me->default_child_);
-  scm_gc_mark (me->input_location_);
-
-  return me->context_name_;
+  ASSERT_LIVE_IS_ALLOWED (self_scm ());
+
+  scm_gc_mark (description_);
+  scm_gc_mark (context_aliases_);
+  scm_gc_mark (accept_mods_);
+  scm_gc_mark (translator_mods_);
+  scm_gc_mark (property_ops_);
+  scm_gc_mark (translator_group_type_);
+  scm_gc_mark (default_child_);
+  scm_gc_mark (input_location_);
+
+  return context_name_;
 }
 
 void
index 329bb092dcd69861c27ea6ee8c7d5f0e868cb701..16910aa37ed455bb445993af8d7d9f2a1ce64694 100644 (file)
@@ -48,11 +48,9 @@ Context_mod::print_smob (SCM smob, SCM port, scm_print_state *)
 }
 
 SCM
-Context_mod::mark_smob (SCM smob)
+Context_mod::mark_smob ()
 {
-  Context_mod *me = (Context_mod *) SCM_CELL_WORD_1 (smob);
-
-  return me->mods_;
+  return mods_;
 }
 
 void
index 000bd0b5cc8dd926f99a575d3bc988657974147d..369037381aba5b67ef8d5f01996c1d6e357ed9ba 100644 (file)
@@ -67,7 +67,7 @@ class Grob_properties : public Simple_smob<Grob_properties>
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static const char type_p_name_[];
 private:
   friend class Grob_property_info;
@@ -98,13 +98,12 @@ private:
 const char Grob_properties::type_p_name_[] = "ly:grob-properties?";
 
 SCM
-Grob_properties::mark_smob (SCM smob)
+Grob_properties::mark_smob ()
 {
-  Grob_properties *gp = (Grob_properties *) SCM_SMOB_DATA (smob);
-  scm_gc_mark (gp->alist_);
-  scm_gc_mark (gp->based_on_);
-  scm_gc_mark (gp->cooked_);
-  return gp->cooked_from_;
+  scm_gc_mark (alist_);
+  scm_gc_mark (based_on_);
+  scm_gc_mark (cooked_);
+  return cooked_from_;
 }
 
 int
index da1810240135ff030d5f419ef4ea33a479d4137a..e43c10dc2aa49a9f8f5c6842651c535d4f51fcbc 100644 (file)
@@ -690,28 +690,26 @@ Context::print_smob (SCM s, SCM port, scm_print_state *)
 }
 
 SCM
-Context::mark_smob (SCM sm)
+Context::mark_smob ()
 {
-  Context *me = (Context *) SCM_CELL_WORD_1 (sm);
+  scm_gc_mark (context_list_);
+  scm_gc_mark (aliases_);
+  scm_gc_mark (definition_);
+  scm_gc_mark (definition_mods_);
+  scm_gc_mark (properties_scm_);
+  scm_gc_mark (accepts_list_);
+  scm_gc_mark (default_child_);
 
-  scm_gc_mark (me->context_list_);
-  scm_gc_mark (me->aliases_);
-  scm_gc_mark (me->definition_);
-  scm_gc_mark (me->definition_mods_);
-  scm_gc_mark (me->properties_scm_);
-  scm_gc_mark (me->accepts_list_);
-  scm_gc_mark (me->default_child_);
+  if (implementation_)
+    scm_gc_mark (implementation_->self_scm ());
 
-  if (me->implementation_)
-    scm_gc_mark (me->implementation_->self_scm ());
+  if (event_source_)
+    scm_gc_mark (event_source_->self_scm ());
 
-  if (me->event_source_)
-    scm_gc_mark (me->event_source_->self_scm ());
+  if (events_below_)
+    scm_gc_mark (events_below_->self_scm ());
 
-  if (me->events_below_)
-    scm_gc_mark (me->events_below_->self_scm ());
-
-  return me->properties_scm_;
+  return properties_scm_;
 }
 
 const char Context::type_p_name_[] = "ly:context?";
index 2e537307919c2be900f8544b74dae2535cb7a1b0..41f3237651e0217b4d8e7aa12e78e01826c4428f 100644 (file)
@@ -41,12 +41,11 @@ Dispatcher::Dispatcher ()
 }
 
 SCM
-Dispatcher::mark_smob (SCM sm)
+Dispatcher::mark_smob ()
 {
-  Dispatcher *me = (Dispatcher *) SCM_CELL_WORD_1 (sm);
-  scm_gc_mark (me->dispatchers_);
-  scm_gc_mark (me->listen_classes_);
-  return me->listeners_;
+  scm_gc_mark (dispatchers_);
+  scm_gc_mark (listen_classes_);
+  return listeners_;
 }
 
 int
index ab0f8f47e36a7a4c53e6e546836c73276a63c107..899d80f821166ad95d10f6b0b0e9e11b495c078d 100644 (file)
@@ -94,11 +94,10 @@ Font_metric::derived_mark () const
 }
 
 SCM
-Font_metric::mark_smob (SCM s)
+Font_metric::mark_smob ()
 {
-  Font_metric *m = (Font_metric *) SCM_CELL_WORD_1 (s);
-  m->derived_mark ();
-  return m->description_;
+  derived_mark ();
+  return description_;
 }
 
 int
index 593ce6a568462236441fbabda7109c5197e13b2f..f1f47561e306c3b31550d13f38efc504456924a3 100644 (file)
@@ -52,10 +52,8 @@ Grob_array::array () const
 }
 
 SCM
-Grob_array::mark_smob (SCM s)
+Grob_array::mark_smob ()
 {
-  (void) s;
-
 #if 0  /* see System::derived_mark () const */
   Grob_array *ga = Grob_array::unsmob (s);
   for (vsize i = 0; i < ga->grobs_.size (); i++)
index eaec5420c23e1b084131f6ec9575e2e39fd00469..dc7082e3d5204a4971bb5de05ffe6cc4cb1bd584 100644 (file)
 const char Grob::type_p_name_[] = "ly:grob?";
 
 SCM
-Grob::mark_smob (SCM ses)
+Grob::mark_smob ()
 {
-  ASSERT_LIVE_IS_ALLOWED (ses);
+  ASSERT_LIVE_IS_ALLOWED (self_scm ());
 
-  Grob *s = (Grob *) SCM_CELL_WORD_1 (ses);
-  scm_gc_mark (s->immutable_property_alist_);
+  scm_gc_mark (immutable_property_alist_);
 
   /* Do not mark the parents.  The pointers in the mutable
      property list form two tree like structures (one for X
@@ -40,14 +39,14 @@ Grob::mark_smob (SCM ses)
      between X and Y in an erratic manner, leading to much more
      recursion depth (and core dumps if we link to pthreads).  */
 
-  if (s->original ())
-    scm_gc_mark (s->original ()->self_scm ());
+  if (original ())
+    scm_gc_mark (original ()->self_scm ());
 
-  s->derived_mark ();
-  scm_gc_mark (s->object_alist_);
-  scm_gc_mark (s->interfaces_);
+  derived_mark ();
+  scm_gc_mark (object_alist_);
+  scm_gc_mark (interfaces_);
 
-  return s->mutable_property_alist_;
+  return mutable_property_alist_;
 }
 
 int
index eb0a105f86d83196b32a0cdd8ed2f66ce57fe6e6..0910a9b9e7bfdc2f75a5024ff646e5559a5ea6d1 100644 (file)
@@ -30,7 +30,7 @@ class Book : public Smob<Book>
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static const char type_p_name_[];
   virtual ~Book ();
   SCM header_;
index 258d07ba92d6de226a40f9770ff297a317202195..ba1aad2f2b4cb6f58185acba78ca25d1aefd330a 100644 (file)
@@ -33,7 +33,7 @@
 */
 struct Context_def : public Smob<Context_def>
 {
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static int print_smob (SCM, SCM, scm_print_state *);
   static const char type_p_name_[];
   virtual ~Context_def ();
index 424f06a8ecdebe5b7fe8d1516798f07ae08a7b51..665dc3b64fa0f5de286b3d627cc893bcf0f049fb 100644 (file)
@@ -36,7 +36,7 @@
 */
 struct Context_mod : public Simple_smob<Context_mod>
 {
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static int print_smob (SCM, SCM, scm_print_state *);
   static const char type_p_name_[];
 private:
index ae21895590144800486d8f0ae27e28457ac7e5f3..150996c4e41694ca8ee073ea9a3346aa6d5a61b0 100644 (file)
@@ -31,7 +31,7 @@
 class Context : public Smob<Context>
 {
 public:
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static int print_smob (SCM, SCM, scm_print_state *);
   static const char type_p_name_[];
   virtual ~Context ();
index 2be14d91777425f0080ccb6a73c29ce44ea01e42..5532d935fc1c4fe292da6101ccb70d47e744adf2 100644 (file)
@@ -27,7 +27,7 @@ class Dispatcher : public Smob<Dispatcher>
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static const char type_p_name_[];
   virtual ~Dispatcher ();
 private:
index 0eb2e0808bd9afc91e9bfae1658cbc99bab0bccc..e5a2b236be9509ec57c3ddc80dc4c739437bc74d 100644 (file)
@@ -34,7 +34,7 @@ class Font_metric : public Smob<Font_metric>
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static const char type_p_name_[];
   virtual ~Font_metric ();
 private:
index feeda8a36a23c43831ee11a1f7f3d39e39568bb9..093b2d6bdc2750f1a4e28ef11eff45e9b74af10e 100644 (file)
@@ -28,7 +28,7 @@ class Grob_array : public Simple_smob<Grob_array>
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static const char type_p_name_[];
 private:
   vector<Grob *> grobs_;
index ae2a9a20a1eb4dead148333203a36268efe22046..10d8c794ebeb83f2496b47c11850c1d686af7ba0 100644 (file)
@@ -31,7 +31,7 @@ class Grob : public Smob<Grob>
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static const char type_p_name_[];
   virtual ~Grob ();
 private:
index 5cdbdca2e6303c3855176a9ec355d77e56d32064..12c3485b117e8c0761a11b29ffda4849188ac99b 100644 (file)
@@ -35,7 +35,7 @@ public:
   static const char type_p_name_[];
   static int print_smob (SCM, SCM, scm_print_state *);
   static SCM equal_p (SCM, SCM);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   Source_file *get_source_file () const;
   char const *start () const;
   char const *end () const;
index 050e01f525b79261ef0df705917fe6d64f427aa3..eb57de8f6a5b6e16d7d2d3c30383da632e0b7371 100644 (file)
@@ -35,7 +35,7 @@ class Lily_lexer : public Smob<Lily_lexer>, public Includable_lexer
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static const char type_p_name_[];
   virtual ~Lily_lexer ();
 private:
index 2ea3b0c6dcdaff87d68342fd16fa785c8bf31888..0255b46074ebc9a0d34cc55a3f1adb06c4d58609 100644 (file)
@@ -33,7 +33,7 @@ class Lily_parser : public Smob<Lily_parser>
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static const char type_p_name_[];
   virtual ~Lily_parser ();
   Lily_lexer *lexer_;
index 38b11b2d3452e5146e82da311dc77b7265cd2d50..2dfdc0c9f8da4865fbb279cf554d57c838a9b089 100644 (file)
@@ -75,7 +75,7 @@ class Listener : public Simple_smob<Listener>
 public:
   static SCM equal_p (SCM, SCM);
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static const char type_p_name_[];
 private:
   void *target_;
index 0c3c67a5ca4c48cea434370ac43794780bfc0631..2356c3ecef92397290228d52eab47c565a1c786d 100644 (file)
@@ -28,7 +28,7 @@ class Music_function : public Smob2<Music_function>
 {
 public:
   static const char type_p_name_[];
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static int print_smob (SCM, SCM, scm_print_state *);
   SCM get_signature () { return scm1 (); }
   SCM get_function () { return scm2 (); }
index cf7d640626aacee684fb76282b7244a977b64c80..9ca076c6255c1bc0e2566b69ce8dcef7db59c6e2 100644 (file)
@@ -62,7 +62,7 @@ class Music_iterator : public Smob<Music_iterator>
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static const char type_p_name_[];
   virtual ~Music_iterator ();
 protected:
index 685b764160fd5247b1361dd7ccab841a55c909d2..b9f99f2221318f87e5865b3df1c074fb08e8897e 100644 (file)
@@ -30,7 +30,7 @@ class Music_output : public Smob<Music_output>
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static const char type_p_name_[];
   virtual ~Music_output ();
 private:
index 1e572e6e3023f52ebbe7d0b678948551a89429fa..518171120a08100fd8a81af121298ea8bef974d5 100644 (file)
@@ -50,7 +50,7 @@ class Output_def : public Smob<Output_def>
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   virtual ~Output_def ();
   VIRTUAL_COPY_CONSTRUCTOR (Output_def, Output_def);
 
index 53c29d4f325bed706ddb2bb1dbae6e0669215be9..57315f5322537417b81c512c67fac19b6864e7fd 100644 (file)
@@ -27,7 +27,7 @@ class Page_marker : public Smob<Page_marker>
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static const char type_p_name_[];
   virtual ~Page_marker ();
 private:
index beca941da7d000f7c956d2118098ca7ebd8480b4..c1c8d2267bac0f62a6df45dd581d78d2126a4130 100644 (file)
@@ -31,7 +31,7 @@ class Paper_book : public Smob<Paper_book>
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static const char type_p_name_[];
   virtual ~Paper_book ();
 private:
index a156c382d9348b056320d2a9015af59eac9ba48d..624ae65a3937f196eaf53806eacc4458108efd4f 100644 (file)
@@ -34,7 +34,7 @@ class Paper_outputter : public Smob<Paper_outputter>
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   virtual ~Paper_outputter ();
 private:
   SCM output_module_;
index e21f629b57164f135caf893cbe4a84b39e9c93a1..a6e3c3860afb4331c91dd7b1ac1aad0aea50c5f9 100644 (file)
@@ -37,7 +37,7 @@ class Pitch : public Simple_smob<Pitch>
 public:
   static SCM equal_p (SCM, SCM);
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static const char type_p_name_[];
 private:
   int octave_;
index eb19c8d79ab9cd6766ec2464d1597a1065a4c543..793d390b08bbf0577d5490622c1fa03e9a4c68d0 100644 (file)
@@ -35,7 +35,7 @@ class Prob : public Smob<Prob>
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static SCM equal_p (SCM, SCM);
   static const char type_p_name_[];
   virtual ~Prob ();
index b8e42ee9110a86cd833b2916b0ab4cc37e93d8c7..00242083fda0fdbd4585cc1053626ece4d0c0825 100644 (file)
@@ -30,7 +30,7 @@ class Scheme_listener : public Smob<Scheme_listener>
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   virtual ~Scheme_listener ();
   Scheme_listener (SCM callback);
   DECLARE_LISTENER (call);
index 1a15aff359ec247bef0eec46e483c8a656ae5c28..eea2d1436a21614546b8decf25eeb2357e4b957d 100644 (file)
@@ -47,7 +47,7 @@ class Scheme_hash_table : public Smob<Scheme_hash_table>
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   virtual ~Scheme_hash_table ();
   bool try_retrieve (SCM key, SCM *val);
   bool contains (SCM key) const;
index 15e32ab17390d6e2c40a1cadaef6761756d25751..f66a81ba62adacb8518709f030ab658b942870f6 100644 (file)
@@ -31,7 +31,7 @@ class Score : public Smob<Score>
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static const char type_p_name_[];
   virtual ~Score ();
 private:
index 0a3f6f0d2d54163034a66a9c3907a3cdfb5faa5d..a752662c1e534da09c82336d8be22b7bd71f4e69 100644 (file)
@@ -33,7 +33,7 @@ public:
     SCM_RETURN_NEWSMOB (Smob_base<Super>::smob_tag (), SCM_UNPACK (arg1));
   }
   static const int free_smob = 0;
-  static SCM mark_smob (SCM s) { return SCM_SMOB_OBJECT (s); };
+  SCM mark_smob () { return scm1 (); };
   static Super *unchecked_unsmob (SCM s) {
     return reinterpret_cast<Super *> (SCM_UNPACK (s));
   }
@@ -54,10 +54,10 @@ public:
                          SCM_UNPACK (arg2));
   }
   static const int free_smob = 0;
-  static SCM mark_smob (SCM s)
+  SCM mark_smob ()
   {
-    scm_gc_mark (SCM_SMOB_OBJECT_2 (s));
-    return SCM_SMOB_OBJECT (s);
+    scm_gc_mark (scm2 ());
+    return scm1 ();
   }
   static Super *unchecked_unsmob (SCM s) {
     return reinterpret_cast<Super *> (SCM_UNPACK (s));
@@ -85,9 +85,9 @@ public:
   static const int free_smob = 0;
   static SCM mark_smob (SCM s)
   {
-    scm_gc_mark (SCM_SMOB_OBJECT_3 (s));
-    scm_gc_mark (SCM_SMOB_OBJECT_2 (s));
-    return SCM_SMOB_OBJECT (s);
+    scm_gc_mark (scm3 ());
+    scm_gc_mark (scm2 ());
+    return scm1 ();
   }
   static Super *unchecked_unsmob (SCM s) {
     return reinterpret_cast<Super *> (SCM_UNPACK (s));
index c3a9f4bf4c9d4e1d0870791b0bca8a9a7b3fe450..f9eeed7f85545e8dc9a5b4c539129bd51a09178c 100644 (file)
@@ -179,7 +179,9 @@ private:
   // #<Context_mod 0x7352414> would depend on memory layout, thus
   // being unsuitable for regtest comparisons unless filtered.
 
-  static const int mark_smob = 0;
+  SCM mark_smob (void); // Should not be inline since we do an address
+                        // comparison
+  static SCM mark_trampoline (SCM); // Used for calling mark_smob
   static const int equal_p = 0;
   static const int smob_proc = 0;
   static const int smob_proc_signature_ = 0;
index f990a08f539abbb94120ac559b9be310374f7a30..c2616b321692ec431f4c0dea55370872b0ab976f 100644 (file)
 #include "smobs.hh"
 #include <typeinfo>
 
+template <class Super>
+SCM
+Smob_base<Super>::mark_trampoline (SCM arg)
+{
+  return (Super::unsmob (arg))->mark_smob ();
+}
+
 template <class Super>
 SCM
 Smob_base<Super>::register_ptr (Super *p)
@@ -42,6 +49,14 @@ Smob_base<Super>::register_ptr (Super *p)
   return s;
 }
 
+// Default, should not actually get called
+template <class Super>
+SCM
+Smob_base<Super>::mark_smob ()
+{
+  return SCM_UNSPECIFIED;
+}
+
 template <class Super>
 int
 Smob_base<Super>::print_smob (SCM, SCM p, scm_print_state *)
@@ -90,8 +105,8 @@ void Smob_base<Super>::init ()
 
   if (Super::free_smob != 0)
     scm_set_smob_free (smob_tag_, Super::free_smob);
-  if (Super::mark_smob != 0)
-    scm_set_smob_mark (smob_tag_, Super::mark_smob);
+  if (&Super::mark_smob != &Smob_base<Super>::mark_smob)
+    scm_set_smob_mark (smob_tag_, Super::mark_trampoline);
   if (Super::print_smob != 0)
     scm_set_smob_print (smob_tag_, Super::print_smob);
   if (Super::equal_p != 0)
index 7647ce3830320132f58f97cad03190109880fe62..8dfbab6c629f054cdac4cda21bc4864e4b99053d 100644 (file)
@@ -39,7 +39,7 @@ class Source_file : public Smob<Source_file>
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static const char type_p_name_[];
   virtual ~Source_file ();
 private:
index e91cfa97590c300f16b1efd50ceb4dde45fbe2af..ad686dcfe782c1925c5526431f9e0676537e25de 100644 (file)
@@ -58,7 +58,7 @@ using namespace std;
 class Stencil : public Simple_smob<Stencil>
 {
 public:
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static int print_smob (SCM, SCM, scm_print_state *);
   static const char type_p_name_[];
 private:
index 17352269d980f7bfb38cdf04e8ed2d30952da10d..1c907ef25fb49fef77c04843652469945d5eb5b2 100644 (file)
@@ -50,7 +50,7 @@ struct Translator_method_binding
 class Translator_group : public Smob<Translator_group>
 {
 public:
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static int print_smob (SCM, SCM, scm_print_state *);
   static const char type_p_name_[];
   virtual ~Translator_group ();
index 31cbe0590d431984b5e20fd25ed9bb99665f8d5b..f7b9677a00d8d4da989c875addfde24d676cb435 100644 (file)
@@ -121,7 +121,7 @@ class Translator : public Smob<Translator>
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static const char type_p_name_[];
   virtual ~Translator ();
 private:
index 6700936d44cc084c965de39f83f4ea881229927e..4439955af4e3964dfe9505448b9ecb11eebd30a2 100644 (file)
@@ -28,11 +28,9 @@ Input dummy_input_global;
 const char Input::type_p_name_[] = "ly:input-location?";
 
 SCM
-Input::mark_smob (SCM s)
+Input::mark_smob ()
 {
-  Input *sc = unsmob (s);
-
-  if (Source_file *sf = sc->get_source_file ())
+  if (Source_file *sf = get_source_file ())
     return sf->self_scm ();
 
   return SCM_EOL;
index 921dd2ad7a488f4a8ab50b4d2592ca86b68d68ba..c02143da4ccc556323dab062f9b2649b9e3e0725 100644 (file)
@@ -368,19 +368,17 @@ Lily_lexer::add_lexed_char (int count)
 const char Lily_lexer::type_p_name_[] = "ly:lily-lexer?";
 
 SCM
-Lily_lexer::mark_smob (SCM s)
+Lily_lexer::mark_smob ()
 {
-  ASSERT_LIVE_IS_ALLOWED (s);
-
-  Lily_lexer *lexer = (Lily_lexer *) SCM_CELL_WORD_1 (s);
-
-  scm_gc_mark (lexer->chordmodifier_tab_);
-  if (lexer->parser_)
-    scm_gc_mark (lexer->parser_->self_scm ());
-  scm_gc_mark (lexer->pitchname_tab_stack_);
-  scm_gc_mark (lexer->start_module_);
-  scm_gc_mark (lexer->extra_tokens_);
-  return lexer->scopes_;
+  ASSERT_LIVE_IS_ALLOWED (self_scm ());
+
+  scm_gc_mark (chordmodifier_tab_);
+  if (parser_)
+    scm_gc_mark (parser_->self_scm ());
+  scm_gc_mark (pitchname_tab_stack_);
+  scm_gc_mark (start_module_);
+  scm_gc_mark (extra_tokens_);
+  return scopes_;
 }
 
 int
index b9100e123653fdf5f338f4127400cfa39ce53930..fd1eb489816956d37824aabb2cc07c61d4b4029d 100644 (file)
@@ -76,11 +76,10 @@ Lily_parser::~Lily_parser ()
 }
 
 SCM
-Lily_parser::mark_smob (SCM s)
+Lily_parser::mark_smob ()
 {
-  Lily_parser *parser = (Lily_parser *) SCM_CELL_WORD_1 (s);
-  scm_gc_mark (parser->closures_);
-  return (parser->lexer_) ? parser->lexer_->self_scm () : SCM_EOL;
+  scm_gc_mark (closures_);
+  return (lexer_) ? lexer_->self_scm () : SCM_EOL;
 }
 
 int
index 7dc4cc370c4f66cefe32449ef7331779cfdd4509..a6dcbd10205037066e0160764ff4e985318c8640 100644 (file)
@@ -44,11 +44,10 @@ void Listener::listen (SCM ev) const
 }
 
 SCM
-Listener::mark_smob (SCM sm)
+Listener::mark_smob ()
 {
-  Listener *me = (Listener *) SCM_CELL_WORD_1 (sm);
-  if (me->type_)
-    (me->type_->mark_callback) (me->target_);
+  if (type_)
+    (type_->mark_callback) (target_);
   return SCM_EOL;
 }
 
index 743b7f6767df339619fae1c23aec02dad290cef2..79d872c43b256aa1d359410f2ffbc6263812e0d9 100644 (file)
@@ -34,8 +34,8 @@ Music_function::print_smob (SCM b, SCM port, scm_print_state *)
 }
 
 SCM
-Music_function::mark_smob (SCM s)
+Music_function::mark_smob ()
 {
-  ASSERT_LIVE_IS_ALLOWED (s);
-  return Smob2<Music_function>::mark_smob (s);
+  ASSERT_LIVE_IS_ALLOWED (self_scm ());
+  return Smob2<Music_function>::mark_smob ();
 }
index 3647d4dc46bbd95c2b35e45a87960d7232718bc4..293a91ed4bdd83be22d4768e06f1d669a2440023 100644 (file)
@@ -195,11 +195,9 @@ Music_iterator::get_music () const
 const char Music_iterator::type_p_name_[] = "ly:iterator?";
 
 SCM
-Music_iterator::mark_smob (SCM smob)
+Music_iterator::mark_smob ()
 {
-  Music_iterator *mus = (Music_iterator *)SCM_CELL_WORD_1 (smob);
-
-  mus->derived_mark ();
+  derived_mark ();
   /*
     Careful with GC, although we intend the following as pointers
     only, we _must_ mark them.
@@ -207,10 +205,10 @@ Music_iterator::mark_smob (SCM smob)
   /* Use handle_ directly as get_outlet is a virtual function and we
      need to protect the context until Music_iterator::quit is being
      run. */
-  if (mus->handle_.get_context ())
-    scm_gc_mark (mus->handle_.get_context ()->self_scm ());
-  if (mus->music_)
-    scm_gc_mark (mus->music_->self_scm ());
+  if (handle_.get_context ())
+    scm_gc_mark (handle_.get_context ()->self_scm ());
+  if (music_)
+    scm_gc_mark (music_->self_scm ());
 
   return SCM_EOL;
 }
index d0c08a118841d732269160cc98ed8eeb2995a360..18eb372020f3bf381fe358baeaa749f6dceec4d0 100644 (file)
@@ -42,11 +42,9 @@ Music_output::derived_mark () const
 const char Music_output::type_p_name_[] = "ly:music-output?";
 
 SCM
-Music_output::mark_smob (SCM s)
+Music_output::mark_smob ()
 {
-  Music_output *sc = (Music_output *) SCM_CELL_WORD_1 (s);
-
-  sc->derived_mark ();
+  derived_mark ();
   return SCM_EOL;
 }
 
index ca0f7ad88a904000f658c7bb454d1c68f3a0b780..eeb5a7a84c0d7cf160f2adf2113e3c95ea983d64 100644 (file)
@@ -62,16 +62,14 @@ Output_def::~Output_def ()
 
 
 SCM
-Output_def::mark_smob (SCM m)
+Output_def::mark_smob ()
 {
-  Output_def *mo = (Output_def*) SCM_CELL_WORD_1 (m);
-
   /* FIXME: why is this necessary?
      all paper_ should be protected by themselves. */
-  if (mo->parent_)
-    scm_gc_mark (mo->parent_->self_scm ());
+  if (parent_)
+    scm_gc_mark (parent_->self_scm ());
 
-  return mo->scope_;
+  return scope_;
 }
 
 void
index ba5342ab2bdb603d8b4cf53dca2adc25320c2b28..f2940d2b76c2ee2ab9e41c5c67470249e38787e1 100644 (file)
@@ -42,12 +42,11 @@ Page_marker::~Page_marker ()
 const char Page_marker::type_p_name_[] = "ly:page-marker?";
 
 SCM
-Page_marker::mark_smob (SCM smob)
+Page_marker::mark_smob ()
 {
-  Page_marker *pm = (Page_marker *) SCM_CELL_WORD_1 (smob);
-  scm_gc_mark (pm->symbol_);
-  scm_gc_mark (pm->permission_);
-  scm_gc_mark (pm->label_);
+  scm_gc_mark (symbol_);
+  scm_gc_mark (permission_);
+  scm_gc_mark (label_);
   return SCM_EOL;
 }
 
index 3a6d4b1074079b5d555551a3d65ed67364f02111..cfc1caf2afa06d47e7c9b92e01dbcf92104423ef 100644 (file)
@@ -54,20 +54,19 @@ Paper_book::~Paper_book ()
 const char Paper_book::type_p_name_[] = "ly:paper-book?";
 
 SCM
-Paper_book::mark_smob (SCM smob)
+Paper_book::mark_smob ()
 {
-  Paper_book *b = (Paper_book *) SCM_CELL_WORD_1 (smob);
-  if (b->paper_)
-    scm_gc_mark (b->paper_->self_scm ());
-  if (b->parent_)
-    scm_gc_mark (b->parent_->self_scm ());
-  scm_gc_mark (b->header_);
-  scm_gc_mark (b->header_0_);
-  scm_gc_mark (b->pages_);
-  scm_gc_mark (b->performances_);
-  scm_gc_mark (b->scores_);
-  scm_gc_mark (b->bookparts_);
-  return b->systems_;
+  if (paper_)
+    scm_gc_mark (paper_->self_scm ());
+  if (parent_)
+    scm_gc_mark (parent_->self_scm ());
+  scm_gc_mark (header_);
+  scm_gc_mark (header_0_);
+  scm_gc_mark (pages_);
+  scm_gc_mark (performances_);
+  scm_gc_mark (scores_);
+  scm_gc_mark (bookparts_);
+  return systems_;
 }
 
 int
index 712c9c9bab71773e77dae2442cc031ee0772934c..91bffa2242a946c4e1917ef6b67a8a57ee59efe5 100644 (file)
@@ -62,11 +62,10 @@ Paper_outputter::~Paper_outputter ()
 
 
 SCM
-Paper_outputter::mark_smob (SCM x)
+Paper_outputter::mark_smob ()
 {
-  Paper_outputter *p = (Paper_outputter *) SCM_CELL_WORD_1 (x);
-  scm_gc_mark (p->output_module_);
-  return p->file_;
+  scm_gc_mark (output_module_);
+  return file_;
 }
 
 int
index 8fd4d67171cc2cb5970c0a3fed5464e53f0d8602..08e6556cf6962be729c3bb3e24e1775c3b44875c 100644 (file)
@@ -219,11 +219,11 @@ Pitch::down_to (int notename)
 }
 
 const char Pitch::type_p_name_[] = "ly:pitch?";
+
 SCM
-Pitch::mark_smob (SCM x)
+Pitch::mark_smob ()
 {
-  Pitch *p = (Pitch *) SCM_CELL_WORD_1 (x);
-  return p->scale_->self_scm ();
+  return scale_->self_scm ();
 }
 
 int
index bb679512d36c4879fa7ab7f52f023e98f76b3ec2..490ae2f0c5361781c2c46a4bb2f0ba0c467b272d 100644 (file)
@@ -113,15 +113,14 @@ Prob::derived_mark () const
 }
 
 SCM
-Prob::mark_smob (SCM smob)
+Prob::mark_smob ()
 {
-  ASSERT_LIVE_IS_ALLOWED (smob);
+  ASSERT_LIVE_IS_ALLOWED (self_scm ());
 
-  Prob *system = (Prob *) SCM_CELL_WORD_1 (smob);
-  scm_gc_mark (system->mutable_property_alist_);
-  system->derived_mark ();
+  scm_gc_mark (mutable_property_alist_);
+  derived_mark ();
 
-  return system->immutable_property_alist_;
+  return immutable_property_alist_;
 }
 
 int
index 2807cc4ad14ca7039685d8b39818f72225d70ae2..6e567b0aebc4375b4548d68e93538afb54dae6e5 100644 (file)
@@ -35,10 +35,9 @@ Scheme_listener::Scheme_listener (SCM c)
 }
 
 SCM
-Scheme_listener::mark_smob (SCM obj)
+Scheme_listener::mark_smob ()
 {
-  Scheme_listener *me = (Scheme_listener *) SCM_CELL_WORD_1 (obj);
-  return me->callback_;
+  return callback_;
 }
 
 int
index 173dd49ccccfa661785b30e95b61e51aee7a76d6..1944b537e18cfeef68b53ea27eab7c483d1d7679 100644 (file)
@@ -71,10 +71,9 @@ Scheme_hash_table::~Scheme_hash_table ()
 }
 
 SCM
-Scheme_hash_table::mark_smob (SCM s)
+Scheme_hash_table::mark_smob ()
 {
-  Scheme_hash_table *me = (Scheme_hash_table *) SCM_CELL_WORD_1 (s);
-  scm_gc_mark (me->hash_tab_);
+  scm_gc_mark (hash_tab_);
   return SCM_EOL;
 }
 
index 2074f810e7a8c3565e4e76f7d54a0bf926270535..b1659e2fbb19e3bc5ebbec68cb1f368f89947dbe 100644 (file)
@@ -62,16 +62,14 @@ Score::~Score ()
 const char Score::type_p_name_[] = "ly:score?";
 
 SCM
-Score::mark_smob (SCM s)
+Score::mark_smob ()
 {
-  Score *sc = (Score *) SCM_CELL_WORD_1 (s);
+  scm_gc_mark (header_);
+  for (vsize i = defs_.size (); i--;)
+    scm_gc_mark (defs_[i]->self_scm ());
 
-  scm_gc_mark (sc->header_);
-  for (vsize i = sc->defs_.size (); i--;)
-    scm_gc_mark (sc->defs_[i]->self_scm ());
-
-  scm_gc_mark (sc->input_location_);
-  return sc->music_;
+  scm_gc_mark (input_location_);
+  return music_;
 }
 
 int
index 34f8c8b9c53d690c7caa3eb9ae2f8dbf6a851954..849a8f7e6fc83a11e65fbdc598c1edb0cf6371cb 100644 (file)
@@ -362,11 +362,9 @@ Source_file::get_port () const
 const char Source_file::type_p_name_[] = "ly:source-file?";
 
 SCM
-Source_file::mark_smob (SCM smob)
+Source_file::mark_smob ()
 {
-  Source_file *sc = (Source_file *) SCM_CELL_WORD_1 (smob);
-
-  return sc->str_port_;
+  return str_port_;
 }
 
 int
index 331dde28310c9f16e8fa977160e7fe448d48a1d0..1e5e0ad4cc845aae82c488b510c2494c2db0ce84 100644 (file)
@@ -47,10 +47,9 @@ Stencil::print_smob (SCM, SCM port, scm_print_state *)
 }
 
 SCM
-Stencil::mark_smob (SCM smob)
+Stencil::mark_smob ()
 {
-  Stencil *s = (Stencil *) SCM_CELL_WORD_1 (smob);
-  return s->expr_;
+  return expr_;
 }
 
 const char Stencil::type_p_name_[] = "ly:stencil?";
index 23aae462e55a14d1e03831c6ed4d4872b48cbd0b..5f5e12aeba0796e11f7757a85e717dbd42e0d00d 100644 (file)
@@ -358,11 +358,9 @@ Translator_group::print_smob (SCM s, SCM port, scm_print_state *)
 }
 
 SCM
-Translator_group::mark_smob (SCM smob)
+Translator_group::mark_smob ()
 {
-  Translator_group *me = (Translator_group *)SCM_CELL_WORD_1 (smob);
-
-  me->derived_mark ();
-  scm_gc_mark (me->protected_events_);
-  return me->simple_trans_list_;
+  derived_mark ();
+  scm_gc_mark (protected_events_);
+  return simple_trans_list_;
 }
index e48b8956cfe08bddef879b2b830503a3e733c541..4b73b7cd5425b29080abfca51163e6cbb786c4fb 100644 (file)
@@ -199,10 +199,9 @@ Translator::static_translator_description (const char *grobs,
   SMOBS
 */
 SCM
-Translator::mark_smob (SCM sm)
+Translator::mark_smob ()
 {
-  Translator *me = (Translator *) SCM_CELL_WORD_1 (sm);
-  me->derived_mark ();
+  derived_mark ();
   return SCM_EOL;
 }
 
index 33d5ed545523059a5fc78af38b32a853ae1a29cd..9105a995eac1a07b43eb29d114999d2263046e90 100644 (file)
@@ -23,7 +23,7 @@ class Undead : public Simple_smob<Undead>
 {
 public:
   static int print_smob (SCM, SCM, scm_print_state *);
-  static SCM mark_smob (SCM);
+  SCM mark_smob ();
   static const char type_p_name_[];
 private:
   SCM object_;
@@ -33,11 +33,11 @@ public:
 };
 
 SCM
-Undead::mark_smob (SCM s)
+Undead::mark_smob ()
 {
   bool saved = parsed_objects_should_be_dead;
   parsed_objects_should_be_dead = false;
-  scm_gc_mark (Undead::unsmob (s)->object ());
+  scm_gc_mark (object ());
   parsed_objects_should_be_dead = saved;
   return SCM_UNDEFINED;
 }