]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/scm-hash.cc
release: 1.3.131
[lilypond.git] / lily / scm-hash.cc
index 8a2094b86ee7508b246f70f70417fbf0981bb6ed..cd8841a5ea9f9bb4ae480a2822d88596ad3473f1 100644 (file)
@@ -3,35 +3,35 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1999--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1999--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 #include <stdio.h>
 
 #include "scm-hash.hh"
-#include "hash-table-iter.hh"
+#include "ly-smobs.icc"
 
 
 Scheme_hash_table::Scheme_hash_table ()
 {
-  self_scm_ = SCM_EOL;
   smobify_self ();
 }
 
-void
-Scheme_hash_table::operator =(Scheme_hash_table const & src)
+
+Scheme_hash_table::Scheme_hash_table (Scheme_hash_table const &src)
+  : Scm_stl_map (src)
 {
-  Scm_stl_map::operator = (src);
-       
-  // we do not copy the self_scm_ field!
+  smobify_self ();
 }
 
 void
-Scheme_hash_table::do_smobify_self ()
+Scheme_hash_table::operator =(Scheme_hash_table const & src)
 {
+  Scm_stl_map::operator = (src);
+       
+  // we do not copy the self_scm () field!
 }
 
-
 SCM
 Scheme_hash_table::mark_smob (SCM s)
 {
@@ -39,7 +39,7 @@ Scheme_hash_table::mark_smob (SCM s)
     can't typecheck naively, since GC bit lives in CAR of S
    */
   
-  Scheme_hash_table *me = SMOB_TO_TYPE(Scheme_hash_table,s);
+  Scheme_hash_table *me = (Scheme_hash_table*) SCM_CELL_WORD_1(s);
 
   for (Scm_stl_map::const_iterator i= me->begin (); i != me->end(); i++)
     {
@@ -49,22 +49,14 @@ Scheme_hash_table::mark_smob (SCM s)
   return SCM_EOL;
 }
 
-
-Scheme_hash_table::Scheme_hash_table (Scheme_hash_table const &src)
-  : Scm_stl_map (src)
-{
-  self_scm_ = SCM_EOL;
-  smobify_self ();
-}
-
 int
 Scheme_hash_table::print_smob (SCM s, SCM p, scm_print_state*)
 {
-  assert (SMOB_IS_TYPE_B (Scheme_hash_table, s));
+  assert (unsmob (s));
   char str[1000];
   sprintf (str, "#<Scheme_hash_table 0x%0x ", s);
   scm_puts (str, p);      
-  Scheme_hash_table *me = SMOB_TO_TYPE(Scheme_hash_table,s);
+  Scheme_hash_table *me = unsmob(s);
   for (Scm_stl_map::const_iterator i = me->begin (); i != me->end(); i++)
     {
       scm_display ((*i).first, p);
@@ -97,7 +89,6 @@ void
 Scheme_hash_table::set (SCM k, SCM v)
 {
   (*this)[k] = v;
-  scm_unprotect_object (v);
 }
 
 // UGH. 
@@ -110,7 +101,6 @@ Scheme_hash_table::get (SCM k)const
 
 Scheme_hash_table::~Scheme_hash_table( )
 {
-  unsmobify_self ();
 }
 
 SCM
@@ -123,8 +113,9 @@ Scheme_hash_table::to_alist () const
 }
 
 
-#include "ly-smobs.icc"
+
 IMPLEMENT_UNSMOB(Scheme_hash_table,scheme_hash);
 IMPLEMENT_SMOBS(Scheme_hash_table);
+IMPLEMENT_DEFAULT_EQUAL_P(Scheme_hash_table);