]> git.donarmstrong.com Git - lilypond.git/commitdiff
excise object keys from back-end.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 11 Jan 2007 00:36:05 +0000 (01:36 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 11 Jan 2007 00:36:05 +0000 (01:36 +0100)
21 files changed:
lily/auto-beam-engraver.cc
lily/engraver.cc
lily/grob-scheme.cc
lily/grob-smob.cc
lily/grob.cc
lily/include/grob.hh
lily/include/item.hh
lily/include/main.hh
lily/include/paper-column.hh
lily/include/spanner.hh
lily/include/system.hh
lily/include/tweak-registration.hh [deleted file]
lily/item.cc
lily/main.cc
lily/note-heads-engraver.cc
lily/paper-column.cc
lily/program-option.cc
lily/score-engraver.cc
lily/spanner.cc
lily/system.cc
lily/tie-engraver.cc

index 073aec59f25bcbb42d3d9f770dd61ffdb99d13ed..4ff8d9d2b7c88e7632907e0651f02483ac90c55e 100644 (file)
@@ -186,7 +186,7 @@ Auto_beam_engraver::create_beam ()
     Can't use make_spanner_from_properties() because we have to use
     beam_settings_.
   */
-  Spanner *beam = new Spanner (beam_settings_, 0);
+  Spanner *beam = new Spanner (beam_settings_);
 
   for (vsize i = 0; i < stems_->size (); i++)
     Beam::add_stem (beam, (*stems_)[i]);
index 365eefe006aeff6e836762887da0e3fc64b709e6..d7973d18b63a1bea0e54e25c4a8a4907536a7a08 100644 (file)
@@ -116,18 +116,17 @@ Engraver::internal_make_grob (SCM symbol, SCM cause, char const *name, char cons
   
   SCM props = updated_grob_properties (context (), symbol);
 
-  Object_key const *key = 0;
   Grob *grob = 0;
 
   SCM handle = scm_sloppy_assq (ly_symbol2scm ("meta"), props);
   SCM klass = scm_cdr (scm_sloppy_assq (ly_symbol2scm ("class"), scm_cdr (handle)));
 
   if (klass == ly_symbol2scm ("Item"))
-    grob = new Item (props, key);
+    grob = new Item (props);
   else if (klass == ly_symbol2scm ("Spanner"))
-    grob = new Spanner (props, key);
+    grob = new Spanner (props);
   else if (klass == ly_symbol2scm ("Paper_column"))
-    grob = new Paper_column (props, key);
+    grob = new Paper_column (props);
 
   assert (grob);
   announce_grob (grob, cause);
index fb2c5b5402e4567e98b6a04051646b33dc9b665d..a7c3a0475f09f3076aeca25d4c32ee07ab048718 100644 (file)
@@ -306,17 +306,6 @@ LY_DEFINE (ly_spanner_p, "ly:spanner?",
   return ly_bool2scm (b);
 }
 
-LY_DEFINE (ly_grob_key, "ly:grob-key",
-          1, 0, 0,
-          (SCM grob),
-          "Return the object-key for @var{grob}.")
-{
-  Grob *me = unsmob_grob (grob);
-  SCM_ASSERT_TYPE (me, grob, SCM_ARG1, __FUNCTION__, "Grob");
-  
-  return me->key () ?  me->key ()->self_scm () : SCM_EOL;
-}
-
 LY_DEFINE (ly_grob_default_font, "ly:grob-default-font",
           1, 0, 0, (SCM grob),
           "Return the default font for grob @var{gr}.")
index a37febc41d24391eb032c7602e162ad5572d3494..44c16e149fe9b478f55ad39615073718eae03da8 100644 (file)
@@ -22,9 +22,6 @@ Grob::mark_smob (SCM ses)
   Grob *s = (Grob *) SCM_CELL_WORD_1 (ses);
   scm_gc_mark (s->immutable_property_alist_);
 
-  if (s->key_)
-    scm_gc_mark (s->key_->self_scm ());
-
   /* Do not mark the parents.  The pointers in the mutable
      property list form two tree like structures (one for X
      relations, one for Y relations).  Marking these can be done
index 02bf6a1b50a5062057a181132eb3eccd5f7e33eb..01b2c7f3e313b33fdeb12e35de11ee33082752fe 100644 (file)
 #include "ly-smobs.icc"
 
 Grob *
-Grob::clone (int count) const
+Grob::clone () const
 {
-  return new Grob (*this, count);
+  return new Grob (*this);
 }
 
-Grob::Grob (SCM basicprops,
-           Object_key const *key)
+Grob::Grob (SCM basicprops)        
 {
-  key_ = key;
   
   /* FIXME: default should be no callback.  */
   self_scm_ = SCM_EOL;
@@ -51,12 +49,6 @@ Grob::Grob (SCM basicprops,
      GC. After smobify_self (), they are.  */
   smobify_self ();
 
-  /*
-    We always get a new key object for a new grob.
-  */
-  if (key_)
-    ((Object_key *)key_)->unprotect ();
-
   SCM meta = get_property ("meta");
   if (scm_is_pair (meta))
     {
@@ -76,10 +68,9 @@ Grob::Grob (SCM basicprops,
     set_property ("Y-extent", Grob::stencil_height_proc);
 }
 
-Grob::Grob (Grob const &s, int copy_index)
+Grob::Grob (Grob const &s)
   : dim_cache_ (s.dim_cache_)
 {
-  key_ = 0; // (use_object_keys) ? new Copied_key (s.key_, copy_index) : 0;
   original_ = (Grob *) & s;
   self_scm_ = SCM_EOL;
 
@@ -91,8 +82,6 @@ Grob::Grob (Grob const &s, int copy_index)
   layout_ = 0;
 
   smobify_self ();
-  if (key_)
-    ((Object_key *)key_)->unprotect ();
 }
 
 Grob::~Grob ()
index 31e219f1267761bde1d248fc9b6a5a7ea6d37670..c66c58f2ddddb2ce7cc6b8bd9c80aa5e13be4fc4 100644 (file)
@@ -13,7 +13,6 @@
 #include "virtual-methods.hh"
 #include "dimension-cache.hh"
 #include "grob-interface.hh"
-#include "object-key.hh"
 
 class Grob
 {
@@ -28,7 +27,6 @@ protected:
   Dimension_cache dim_cache_[NO_AXES];
   Output_def *layout_;
   Grob *original_;
-  Object_key const *key_;
 
   /* SCM data */
   SCM immutable_property_alist_;
@@ -65,12 +63,11 @@ public:
   Output_def *layout () const { return layout_; }
   Grob *original () const { return original_; }
   SCM interfaces () const { return interfaces_; }
-  Object_key const *key () const { return key_; }
 
   /* life & death */ 
-  Grob (SCM basic_props, Object_key const *);
-  Grob (Grob const &, int copy_count);
-  virtual Grob *clone (int count) const;
+  Grob (SCM basic_props);
+  Grob (Grob const &);
+  virtual Grob *clone () const;
 
   /* forced death */
   void suicide ();
index d4b64442324f59d0806ed71aef59b167280be9b2..d00541a8bf26fe35a19e90f43f03515de50eaadd 100644 (file)
@@ -22,10 +22,10 @@ class Item : public Grob
 
   DECLARE_CLASSNAME(Item);
 public:
-  Item (SCM, Object_key const *);
-  Item (Item const &, int count);
+  Item (SCM);
+  Item (Item const &);
 
-  virtual Grob *clone (int count) const;
+  virtual Grob *clone () const;
 
   static bool is_non_musical (Grob *);
   bool is_broken () const;
index 08194ca22f692a6a352dcac358c6a08a65f55a8f..69aa8899c7858d60a47bbeb01dd6a7f7977fbb1a 100644 (file)
@@ -38,7 +38,7 @@ extern bool point_and_click_global;
 extern string prefix_directory;
 extern bool use_object_keys;
 extern bool strict_infinity_checking;
-extern string init_scheme_code_string_global;
+extern string init_scheme_code_global;
 extern string init_scheme_variables_global;
 
 /*
index 4a4df146ded0e47e506e6890a5203d75cdc43537..0157eb6bb9a64079af671078cca25d0f2102e3a1 100644 (file)
@@ -22,10 +22,10 @@ class Paper_column : public Item
   friend void set_loose_columns (System *which, Column_x_positions const *posns);
   friend class System;
 public:
-  Paper_column (SCM, Object_key const *);
-  Paper_column (Paper_column const &, int count);
+  Paper_column (SCM);
+  Paper_column (Paper_column const &);
 
-  virtual Grob *clone (int count) const;
+  virtual Grob *clone () const;
   virtual void do_break_processing ();
   virtual Paper_column *get_column () const;
   virtual System *get_system () const;
index 5c6b610d2210ed00af5e908c8463717f2ba0d14e..e4a09cc0cf8395e6dc0ec5da6a2c3926230a43d6 100644 (file)
@@ -51,8 +51,8 @@ public:
   void set_bound (Direction d, Grob *);
   Item *get_bound (Direction d) const;
 
-  Spanner (SCM, Object_key const *);
-  Spanner (Spanner const &, int copy_count);
+  Spanner (SCM);
+  Spanner (Spanner const &);
   bool is_broken () const;
   void do_break ();
   Real spanner_length () const;
@@ -66,7 +66,7 @@ public:
 
 protected:
   void set_my_columns ();
-  virtual Grob *clone (int count) const;
+  virtual Grob *clone () const;
   virtual void do_break_processing ();
 };
 
index a4b5d276bfdaec8b5f32711fa0aebe2c050a4def..48e6875dfb43e4aaa2d1984602a5658a7f928dfc 100644 (file)
@@ -33,8 +33,8 @@ public:
   SCM get_paper_system ();
   SCM get_paper_systems ();
 
-  System (SCM, Object_key const *);
-  System (System const &, int);
+  System (SCM);
+  System (System const &);
 
   int element_count () const;
   int spanner_count () const;
@@ -52,7 +52,7 @@ public:
 
 protected:
   virtual void derived_mark () const;
-  virtual Grob *clone (int count) const;
+  virtual Grob *clone () const;
 };
 
 void set_loose_columns (System *which, Column_x_positions const *posns);
diff --git a/lily/include/tweak-registration.hh b/lily/include/tweak-registration.hh
deleted file mode 100644 (file)
index 6b91227..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-  tweak-registration.hh -- declare
-
-  source file of the GNU LilyPond music typesetter
-
-  (c) 2004--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
-*/
-
-#ifndef TWEAK_REGISTRATION_HH
-#define TWEAK_REGISTRATION_HH
-
-#include <map>
-using namespace std;
-
-#include "lily-proto.hh"
-
-typedef map<Object_key const *, SCM, Object_key_less> Tweak_map;
-
-class Tweak_registry
-{
-  Tweak_map tweaks_;
-  Object_key_undumper *undumper_;
-
-  DECLARE_SMOBS (Tweak_registry);
-
-public:
-  Tweak_registry ();
-
-  Object_key_undumper *undumper () const;
-  void clear ();
-  void insert_grob_tweak (Grob *, SCM);
-  void replace_grob_tweak (Grob *, SCM);
-  SCM get_tweaks (Grob *);
-  SCM list_tweaks ();
-  void insert_tweak_from_file (SCM);
-};
-
-extern Tweak_registry *global_registry_;
-
-DECLARE_UNSMOB (Tweak_registry, tweak_registry);
-
-#endif /* TWEAK_REGISTRATION_HH */
index 324df0e97c49d1e3481a75b803705ecb83035efa..c6ca1b2c6939778a77f096ba2671bac0ad0ecdd0 100644 (file)
 #include "pointer-group-interface.hh"
 
 Grob *
-Item::clone (int count) const
+Item::clone () const
 {
-  return new Item (*this, count);
+  return new Item (*this);
 }
 
-Item::Item (SCM s, Object_key const *key)
-  : Grob (s, key)
+Item::Item (SCM s)
+  : Grob (s)
 {
   broken_to_drul_[LEFT] = broken_to_drul_[RIGHT] = 0;
 }
@@ -31,8 +31,8 @@ Item::Item (SCM s, Object_key const *key)
 /**
    Item copy ctor.  Copy nothing: everything should be a elt property
    or a special purpose pointer (such as broken_to_drul_[]) */
-Item::Item (Item const &s, int copy_count)
-  : Grob (s, copy_count)
+Item::Item (Item const &s)
+  : Grob (s)
 {
   broken_to_drul_[LEFT] = broken_to_drul_[RIGHT] = 0;
 }
@@ -66,10 +66,9 @@ Item::copy_breakable_items ()
 {
   Drul_array<Item *> new_copies;
   Direction i = LEFT;
-  int count = 0;
   do
     {
-      Grob *dolly = clone (count++);
+      Grob *dolly = clone ();
       Item *item = dynamic_cast<Item *> (dolly);
       get_root_system (this)->typeset_grob (item);
       new_copies[i] = item;
index 9161511e68370b9caa46caf6e91942dab6387799..c3a058795bdffe8d578ce08d66d3adc18c0d46ad 100644 (file)
@@ -77,7 +77,7 @@ bool be_verbose_global = false;
 
 /* Scheme code to execute before parsing, after .scm init.
    This is where -e arguments are appended to.  */
-string init_scheme_code_string_global;
+string init_scheme_code_global;
 string init_scheme_variables_global;
 
 /* Generate preview of first system.  */
@@ -511,7 +511,7 @@ parse_argv (int argc, char **argv)
          break;
          
        case 'e':
-         init_scheme_code_string_global += option_parser->optional_argument_str0_ + string (" ");
+         init_scheme_code_global += option_parser->optional_argument_str0_ + string (" ");
          break;
        case 'w':
          warranty ();
index b6b457b6e33ea42e2bf37a7f8891caebc3078fae..a49bbbe81f64bfefb3d4d43ac1d35111a7895c44 100644 (file)
@@ -104,5 +104,7 @@ ADD_TRANSLATOR (Note_heads_engraver,
                /* doc */ "Generate noteheads.",
                /* create */
                "NoteHead ",
-               /* read */ "middleCPosition",
-               /* write */ "");
+               /* read */
+               "middleCPosition",
+               /* write */
+               "");
index 28c7af69d398a552eb6d47eb4e0abc88e54d4fc9..c313475f49cdf0760d317bce8ad73a6b3461641c 100644 (file)
@@ -25,9 +25,9 @@
 #include "string-convert.hh"
 
 Grob *
-Paper_column::clone (int count) const
+Paper_column::clone () const
 {
-  return new Paper_column (*this, count);
+  return new Paper_column (*this);
 }
 
 void
@@ -60,15 +60,15 @@ Paper_column::get_column () const
   return (Paper_column *) (this);
 }
 
-Paper_column::Paper_column (SCM l, Object_key const *key)
-  : Item (l, key)              // guh.?
+Paper_column::Paper_column (SCM l)
+  : Item (l)
 {
   system_ = 0;
   rank_ = -1;
 }
 
-Paper_column::Paper_column (Paper_column const &src, int count)
-  : Item (src, count)
+Paper_column::Paper_column (Paper_column const &src)
+  : Item (src)
 {
   system_ = 0;
   rank_ = src.rank_;
index 64318c00a80982b7add4acb77589fd4e1afb4acd..8f593aaa393c3d9e8a8a28bbd3fecd25a258914b 100644 (file)
@@ -219,7 +219,7 @@ LY_DEFINE (ly_command_line_options, "ly:command-line-options", 0, 0, 0, (),
 LY_DEFINE (ly_command_line_code, "ly:command-line-code", 0, 0, 0, (),
           "The Scheme specified on command-line with @samp{-e}.")
 {
-  return ly_string2scm (init_scheme_code_string_global); 
+  return ly_string2scm (init_scheme_code_global); 
 }
 
 LY_DEFINE (ly_command_line_verbose_p, "ly:command-line-verbose?", 0, 0, 0, (),
index e1359ae4c369287cdf4f53f551eabbd27b455036..c6d84823c0c65ff5a9be3fc38ed2d221cbd6901e 100644 (file)
@@ -79,8 +79,7 @@ Score_engraver::initialize ()
 
   SCM props = updated_grob_properties (context (), ly_symbol2scm ("System"));
 
-  Object_key const *sys_key = 0;
-  pscore_->typeset_system (new System (props, sys_key));
+  pscore_->typeset_system (new System (props));
   
   system_ = pscore_->root_system ();
   context ()->set_property ("rootSystem", system_->self_scm ());
index 09359644b98096c28c58c06e7aad9b0ed85ff93a..e1fe55efe1d04d6ee65ea6e0ce80ad5f9b94bbbd 100644 (file)
@@ -16,9 +16,9 @@
 #include "warn.hh"
 
 Grob *
-Spanner::clone (int count) const
+Spanner::clone () const
 {
-  return new Spanner (*this, count);
+  return new Spanner (*this);
 }
 
 void
@@ -64,7 +64,7 @@ Spanner::do_break_processing ()
            programming_error ("no broken bound");
          else if (bound->get_system ())
            {
-             Spanner *span = dynamic_cast<Spanner *> (clone (broken_intos_.size ()));
+             Spanner *span = dynamic_cast<Spanner *> (clone ());
              span->set_bound (LEFT, bound);
              span->set_bound (RIGHT, bound);
 
@@ -102,7 +102,7 @@ Spanner::do_break_processing ()
              continue;
            }
 
-         Spanner *span = dynamic_cast<Spanner *> (clone (broken_intos_.size ()));
+         Spanner *span = dynamic_cast<Spanner *> (clone ());
          span->set_bound (LEFT, bounds[LEFT]);
          span->set_bound (RIGHT, bounds[RIGHT]);
 
@@ -196,16 +196,16 @@ Spanner::set_bound (Direction d, Grob *s)
     Pointer_group_interface::add_grob (i, ly_symbol2scm ("bounded-by-me"), this);
 }
 
-Spanner::Spanner (SCM s, Object_key const *key)
-  : Grob (s, key)
+Spanner::Spanner (SCM s)
+  : Grob (s)
 {
   break_index_ = 0;
   spanned_drul_[LEFT] = 0;
   spanned_drul_[RIGHT] = 0;
 }
 
-Spanner::Spanner (Spanner const &s, int count)
-  : Grob (s, count)
+Spanner::Spanner (Spanner const &s)
+  : Grob (s)
 {
   spanned_drul_[LEFT] = spanned_drul_[RIGHT] = 0;
 }
index b804e43a3114704f5cc7203087f5cca5413cba0a..06ac09e39a224b6b31467474d88e14e54bf1d341 100644 (file)
 #include "pointer-group-interface.hh"
 #include "spacing-interface.hh"
 #include "staff-symbol-referencer.hh"
-#include "tweak-registration.hh"
 #include "warn.hh"
 #include "lookup.hh"
 
 extern bool debug_skylines;
 
-System::System (System const &src, int count)
-  : Spanner (src, count)
+System::System (System const &src)
+  : Spanner (src)
 {
   all_elements_ = 0;
   pscore_ = 0;
@@ -36,8 +35,8 @@ System::System (System const &src, int count)
   init_elements ();
 }
 
-System::System (SCM s, Object_key const *key)
-  : Spanner (s, key)
+System::System (SCM s)
+  : Spanner (s)
 {
   all_elements_ = 0;
   rank_ = 0;
@@ -54,9 +53,9 @@ System::init_elements ()
 }
 
 Grob *
-System::clone (int index) const
+System::clone () const
 {
-  return new System (*this, index);
+  return new System (*this);
 }
 
 int
@@ -210,7 +209,7 @@ System::break_into_pieces (vector<Column_x_positions> const &breaking)
 {
   for (vsize i = 0; i < breaking.size (); i++)
     {
-      System *system = dynamic_cast<System *> (clone (broken_intos_.size ()));
+      System *system = dynamic_cast<System *> (clone ());
       system->rank_ = broken_intos_.size ();
 
       vector<Grob*> c (breaking[i].cols_);
index e6d48dfea0f1d6e80fadcadf51ed7a001c410d13..b97a5ad9c2bbd71782b25f95952a902a376aef81 100644 (file)
@@ -123,7 +123,7 @@ Tie_engraver::acknowledge_note_head (Grob_info i)
       if (ly_is_equal (right_ev->get_property ("pitch"),
                       left_ev->get_property ("pitch")))
        {
-         Grob *p = new Spanner (heads_to_tie_[i].tie_definition_, 0);
+         Grob *p = new Spanner (heads_to_tie_[i].tie_definition_);
 
          SCM cause = heads_to_tie_[i].tie_event_
            ? heads_to_tie_[i].tie_event_->self_scm ()