]> git.donarmstrong.com Git - lilypond.git/commitdiff
more object key removal.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 11 Jan 2007 12:50:02 +0000 (13:50 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 11 Jan 2007 12:50:02 +0000 (13:50 +0100)
lily/book.cc
lily/engraver.cc
lily/global-context-scheme.cc
lily/global-context.cc
lily/include/book.hh
lily/lily-parser.cc
lily/lilypond-key.cc
lily/object-key.cc
lily/score-engraver.cc
lily/score-scheme.cc
lily/score.cc

index 06b3ea217febeb634fb49b8bb6fb14b79cd0e492..f4d4dd790e1310b31cc53223b3e23f4b6f4e9404 100644 (file)
@@ -11,7 +11,6 @@
 #include <cstdio>
 using namespace std;
 
-#include "lilypond-key.hh"
 #include "main.hh"
 #include "music.hh"
 #include "output-def.hh"
@@ -130,9 +129,6 @@ Book::process (Output_def *default_paper,
   Real scale = scm_to_double (paper->c_variable ("output-scale"));
   Output_def *scaled_bookdef = scale_output_def (paper, scale);
 
-  Object_key *key = new Lilypond_general_key (0, user_key_, 0);
-  SCM scm_key = key->unprotect ();
-
   paper_book->paper_ = scaled_bookdef;
   scaled_bookdef->unprotect ();
 
@@ -168,7 +164,6 @@ Book::process (Output_def *default_paper,
        assert (0);
     }
 
-  scm_remember_upto_here_1 (scm_key);
   return paper_book;
 }
 
index d7973d18b63a1bea0e54e25c4a8a4907536a7a08..ac74d5e93064f9c808dccf6358fc95fae9465cc3 100644 (file)
@@ -10,7 +10,6 @@
 
 #include "context.hh"
 #include "international.hh"
-#include "lilypond-key.hh"
 #include "music.hh"
 #include "paper-column.hh"
 #include "score-engraver.hh"
index 1cb52c8620367b12ab52a5be211f618146611497..c5f4d561f9966487c647527f8d189809ef0a8d6b 100644 (file)
@@ -12,7 +12,6 @@
 #include "music-iterator.hh"
 #include "music-output.hh"
 #include "music.hh"
-#include "object-key.hh"
 #include "output-def.hh"
 #include "translator-group.hh"
 #include "warn.hh"
index 095f1f46a74a3207df04785cfcb722e70e602099..f4aff0398eeaa977015b2142e212c88985aa7fa8 100644 (file)
@@ -14,7 +14,6 @@ using namespace std;
 #include "context-def.hh"
 #include "dispatcher.hh"
 #include "international.hh"
-#include "lilypond-key.hh"
 #include "music-iterator.hh"
 #include "music.hh"
 #include "output-def.hh"
index 6441b0eee008763776c52c5b94659e6c5ddc1d1c..cf478432388fea996d8a35224815a64d1a56de57 100644 (file)
@@ -11,9 +11,9 @@
 
 #include "lily-proto.hh"
 #include "std-vector.hh"
-#include "object-key.hh"
 #include "std-string.hh"
 #include "virtual-methods.hh"
+#include "smobs.hh"
 
 class Book
 {
index b1804e307c3644828699f8cbeb571b1326c8f41a..356615adc3cbf3d2ea93a42ed9d40964eabf3987 100644 (file)
@@ -15,7 +15,6 @@
 #include "international.hh"
 #include "lily-lexer.hh"
 #include "lily-version.hh"
-#include "lilypond-key.hh"
 #include "main.hh"
 #include "output-def.hh"
 #include "paper-book.hh"
index dbe82a7dd0e7a807d7a0d8882a829469ad53d5b4..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,226 +0,0 @@
-/*
-  lilypond-key.cc -- implement Lilypond_{grob, context}_key
-
-  source file of the GNU LilyPond music typesetter
-
-  (c) 2004--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
-*/
-
-#include "lilypond-key.hh"
-
-Lilypond_grob_key::Lilypond_grob_key (Object_key const *context,
-                                     Moment start,
-                                     string name,
-                                     int disambiguation_count)
-{
-  context_ = context;
-  creation_moment_ = start;
-  grob_name_ = name;
-  disambiguation_count_ = disambiguation_count;
-}
-
-void
-Lilypond_grob_key::derived_mark () const
-{
-  if (context_)
-    scm_gc_mark (context_->self_scm ());
-}
-
-// todo: reverse order of comparison for efficiency reasons.
-int
-Lilypond_grob_key::do_compare (Object_key const *key) const
-{
-  Lilypond_grob_key const *other = dynamic_cast<Lilypond_grob_key const *> (key);
-  int c;
-
-  c = context_->compare (other->context_);
-  if (c)
-    return c;
-
-  c = Moment::compare (creation_moment_, other->creation_moment_);
-  if (c)
-    return c;
-
-  c = grob_name_.compare (other->grob_name_);
-  if (c)
-    return c;
-
-  c = sign (disambiguation_count_ - other->disambiguation_count_);
-  if (c)
-    return c;
-
-  return 0;
-}
-
-int
-Lilypond_grob_key::get_type () const
-{
-  return GROB_KEY;
-}
-
-SCM
-Lilypond_grob_key::as_scheme () const
-{
-  return scm_list_4 (context_ ? context_->self_scm () : SCM_BOOL_F,
-                    creation_moment_.smobbed_copy (),
-                    ly_string2scm (grob_name_),
-                    scm_from_int (disambiguation_count_));
-}
-
-Object_key *
-Lilypond_grob_key::from_scheme (SCM a)
-{
-  return new Lilypond_grob_key (unsmob_key (scm_car (a)),
-                               *unsmob_moment (scm_cadr (a)),
-                               ly_scm2string (scm_caddr (a)),
-                               scm_to_int (scm_list_ref (a, scm_from_int (3))));
-}
-
-/****************************************************************/
-
-void
-Lilypond_context_key::derived_mark () const
-{
-  if (parent_context_)
-    scm_gc_mark (parent_context_->self_scm ());
-}
-
-Lilypond_context_key::Lilypond_context_key (Object_key const *parent,
-                                           Moment start,
-                                           string type,
-                                           string id,
-                                           int count)
-{
-  disambiguation_count_ = count;
-  parent_context_ = parent;
-  start_moment_ = start;
-  context_name_ = type;
-  id_ = id;
-}
-
-int
-Lilypond_context_key::do_compare (Object_key const *key) const
-{
-  Lilypond_context_key const *other
-    = dynamic_cast<Lilypond_context_key const *> (key);
-
-  int c;
-  if (parent_context_ && other->parent_context_)
-    {
-      c = parent_context_->compare (other->parent_context_);
-      if (c)
-       return c;
-    }
-  else if (parent_context_)
-    return -1;
-  else if (other->parent_context_)
-    return 1;
-
-  c = Moment::compare (start_moment_, other->start_moment_);
-  if (c)
-    return c;
-
-  c = context_name_.compare (other->context_name_);
-  if (c)
-    return c;
-
-  c = id_.compare (other->id_);
-  if (c)
-    return c;
-
-  c = sign (disambiguation_count_ - other->disambiguation_count_);
-  if (c)
-    return c;
-
-  return 0;
-}
-
-int
-Lilypond_context_key::get_type () const
-{
-  return CONTEXT_KEY;
-}
-
-SCM
-Lilypond_context_key::as_scheme () const
-{
-  return scm_list_5 (parent_context_ ? parent_context_->self_scm () : SCM_BOOL_F,
-                    start_moment_.smobbed_copy (),
-                    ly_string2scm (context_name_),
-                    ly_string2scm (id_),
-                    scm_from_int (disambiguation_count_));
-}
-
-Object_key *
-Lilypond_context_key::from_scheme (SCM a)
-{
-  return new Lilypond_context_key (unsmob_key (scm_car (a)),
-                                  *unsmob_moment (scm_cadr (a)),
-                                  ly_scm2string (scm_list_ref (a, scm_from_int (2))),
-                                  ly_scm2string (scm_list_ref (a, scm_from_int (3))),
-                                  scm_to_int (scm_list_ref (a, scm_from_int (4))));
-}
-
-/****************************************************************/
-
-int
-Lilypond_general_key::get_type () const
-{
-  return GENERAL_KEY;
-}
-
-void
-Lilypond_general_key::derived_mark () const
-{
-  if (parent_)
-    scm_gc_mark (parent_->self_scm ());
-}
-
-Lilypond_general_key::Lilypond_general_key (Object_key const *parent,
-                                           string name,
-                                           int count)
-{
-  parent_ = parent;
-  name_ = name;
-  disambiguation_count_ = count;
-}
-
-int
-Lilypond_general_key::do_compare (Object_key const *key)const
-{
-  Lilypond_general_key const *other
-    = dynamic_cast<Lilypond_general_key const *> (key);
-
-  if (parent_ && other->parent_)
-    parent_->compare (other->parent_);
-  else if (parent_)
-    return -1;
-  else if (other->parent_)
-    return 1;
-
-  int c = name_.compare (other->name_);
-  if (c)
-    return c;
-
-  c = sign (disambiguation_count_ - other->disambiguation_count_);
-  if (c)
-    return c;
-
-  return 0;
-}
-
-SCM
-Lilypond_general_key::as_scheme () const
-{
-  return scm_list_3 (parent_ ? parent_->self_scm () : SCM_BOOL_F,
-                    ly_string2scm (name_),
-                    scm_from_int (disambiguation_count_));
-}
-
-Object_key *
-Lilypond_general_key::from_scheme (SCM a)
-{
-  return new Lilypond_general_key (unsmob_key (scm_car (a)),
-                                  ly_scm2string (scm_list_ref (a, scm_from_int (1))),
-                                  scm_to_int (scm_list_ref (a, scm_from_int (2))));
-}
index 86b58448f0bd6a4bff20b462ed433188c492123c..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,169 +0,0 @@
-/*
-  object-key.cc -- implement Object_key
-
-  source file of the GNU LilyPond music typesetter
-
-  (c) 2004--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
-*/
-
-#include "lilypond-key.hh"
-#include "ly-smobs.icc"
-
-SCM
-Object_key::mark_smob (SCM key)
-{
-  Object_key *k = (Object_key *) SCM_CELL_WORD_1 (key);
-  k->derived_mark ();
-  return SCM_EOL;
-}
-
-void
-Object_key::derived_mark () const
-{
-}
-
-Object_key::~Object_key ()
-{
-}
-
-int
-Object_key::get_type () const
-{
-  return GENERAL_KEY;
-}
-
-int
-Object_key::print_smob (SCM smob, SCM port, scm_print_state*)
-{
-  Object_key *k = (Object_key *) SCM_CELL_WORD_1 (smob);
-  scm_puts ("#<Object_key ", port);
-  scm_display (scm_from_int (k->get_type ()), port);
-  scm_puts (">", port);
-  return 1;
-}
-
-Object_key::Object_key ()
-{
-  smobify_self ();
-}
-
-int
-Object_key::compare (Object_key const *other) const
-{
-  if (this == other)
-    return 0;
-
-  int c = sign (get_type () - other->get_type ());
-  if (c)
-    return c;
-  else
-    return do_compare (other);
-}
-
-IMPLEMENT_SMOBS (Object_key);
-
-SCM
-Object_key::equal_p (SCM a, SCM b)
-{
-  Object_key *ka = unsmob_key (a);
-  Object_key *kb = unsmob_key (b);
-
-  return (ka->compare (kb)) ? SCM_BOOL_F : SCM_BOOL_T;
-}
-
-int
-Object_key::do_compare (Object_key const *) const
-{
-  return 0;
-}
-
-SCM
-Object_key::dump () const
-{
-  return scm_cons (scm_from_int (get_type ()),
-                  as_scheme ());
-}
-
-SCM
-Object_key::as_scheme () const
-{
-  return SCM_EOL;
-}
-
-Object_key *
-Object_key::from_scheme (SCM)
-{
-  return new Object_key ();
-}
-
-struct Object_dumper_table_entry
-{
-  Object_key_type type_;
-  Object_key *(*ctor_) (SCM);
-};
-
-static Object_dumper_table_entry undumpers[]
-= {
-  {BASE_KEY, Object_key::from_scheme},
-  {COPIED_KEY, Copied_key::from_scheme},
-  {GENERAL_KEY, Lilypond_general_key::from_scheme},
-  {GROB_KEY, Lilypond_grob_key::from_scheme},
-  {CONTEXT_KEY, Lilypond_context_key::from_scheme},
-  {KEY_COUNT, 0},
-};
-
-Object_key *
-Object_key::undump (SCM scm_key)
-{
-  int t = scm_to_int (scm_car (scm_key));
-  assert (t == undumpers[t].type_);
-  return (undumpers[t].ctor_) (scm_cdr (scm_key));
-}
-
-/****************************************************************/
-
-Copied_key::Copied_key (Object_key const *key, int count)
-{
-  copy_count_ = count;
-  original_ = key;
-}
-
-int
-Copied_key::get_type () const
-{
-  return COPIED_KEY;
-}
-
-int
-Copied_key::do_compare (Object_key const *key) const
-{
-  Copied_key const *other = dynamic_cast<Copied_key const *> (key);
-
-  int c = original_->compare (other->original_);
-  if (c)
-    return c;
-
-  return sign (copy_count_ - other->copy_count_);
-}
-
-void
-Copied_key::derived_mark () const
-{
-  scm_gc_mark (original_->self_scm ());
-}
-
-SCM
-Copied_key::as_scheme () const
-{
-  return scm_list_2 (original_
-                    ? original_->self_scm ()
-                    : SCM_BOOL_F, scm_from_int (copy_count_));
-}
-
-Object_key *
-Copied_key::from_scheme (SCM a)
-{
-  return new Copied_key (unsmob_key (scm_car (a)),
-                        scm_to_int (scm_list_ref (a, scm_from_int (1))));
-}
-
index c6d84823c0c65ff5a9be3fc38ed2d221cbd6901e..eb89e555f83819771cc2054c6e7e1adde0f0d9e4 100644 (file)
@@ -184,7 +184,7 @@ ADD_TRANSLATOR_GROUP (Score_engraver,
                      /* read */
                      "currentMusicalColumn "
                      "currentCommandColumn "
-                     "verticallySpacedContexts",
+                     "verticallySpacedContexts ",
 
                      /* write */
                      "");
index b20b292dfd2a25bf40393132cc5258106e8afe5f..eebdedbb95c3d8614b043d932a799d1e9896b25e 100644 (file)
@@ -11,7 +11,6 @@
 #include "music.hh"
 #include "output-def.hh"
 #include "global-context.hh"
-#include "lilypond-key.hh"
 #include "music-output.hh"
 #include "paper-score.hh"
 #include "paper-book.hh"
index b5753c0ad7ae4b852ecf4f4c9c70dd83fb9baa4d..5b11a0d4271b34534a809ce84f1ac68183278c83 100644 (file)
@@ -17,7 +17,6 @@ using namespace std;
 #include "global-context.hh"
 #include "international.hh"
 #include "lily-parser.hh"
-#include "lilypond-key.hh"
 #include "main.hh"
 #include "music.hh"
 #include "music.hh"