From: Han-Wen Nienhuys Date: Thu, 11 Jan 2007 00:36:05 +0000 (+0100) Subject: excise object keys from back-end. X-Git-Tag: release/2.11.11-1~16 X-Git-Url: https://git.donarmstrong.com/lilypond.git?a=commitdiff_plain;h=e79a1b386108bd84ef04a4a71b21b4049ca6b867;p=lilypond.git excise object keys from back-end. --- diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc index 073aec59f2..4ff8d9d2b7 100644 --- a/lily/auto-beam-engraver.cc +++ b/lily/auto-beam-engraver.cc @@ -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]); diff --git a/lily/engraver.cc b/lily/engraver.cc index 365eefe006..d7973d18b6 100644 --- a/lily/engraver.cc +++ b/lily/engraver.cc @@ -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); diff --git a/lily/grob-scheme.cc b/lily/grob-scheme.cc index fb2c5b5402..a7c3a0475f 100644 --- a/lily/grob-scheme.cc +++ b/lily/grob-scheme.cc @@ -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}.") diff --git a/lily/grob-smob.cc b/lily/grob-smob.cc index a37febc41d..44c16e149f 100644 --- a/lily/grob-smob.cc +++ b/lily/grob-smob.cc @@ -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 diff --git a/lily/grob.cc b/lily/grob.cc index 02bf6a1b50..01b2c7f3e3 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -27,15 +27,13 @@ #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 () diff --git a/lily/include/grob.hh b/lily/include/grob.hh index 31e219f126..c66c58f2dd 100644 --- a/lily/include/grob.hh +++ b/lily/include/grob.hh @@ -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 (); diff --git a/lily/include/item.hh b/lily/include/item.hh index d4b6444232..d00541a8bf 100644 --- a/lily/include/item.hh +++ b/lily/include/item.hh @@ -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; diff --git a/lily/include/main.hh b/lily/include/main.hh index 08194ca22f..69aa8899c7 100644 --- a/lily/include/main.hh +++ b/lily/include/main.hh @@ -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; /* diff --git a/lily/include/paper-column.hh b/lily/include/paper-column.hh index 4a4df146de..0157eb6bb9 100644 --- a/lily/include/paper-column.hh +++ b/lily/include/paper-column.hh @@ -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; diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index 5c6b610d22..e4a09cc0cf 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -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 (); }; diff --git a/lily/include/system.hh b/lily/include/system.hh index a4b5d276bf..48e6875dfb 100644 --- a/lily/include/system.hh +++ b/lily/include/system.hh @@ -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 index 6b912279f8..0000000000 --- a/lily/include/tweak-registration.hh +++ /dev/null @@ -1,42 +0,0 @@ -/* - tweak-registration.hh -- declare - - source file of the GNU LilyPond music typesetter - - (c) 2004--2007 Han-Wen Nienhuys -*/ - -#ifndef TWEAK_REGISTRATION_HH -#define TWEAK_REGISTRATION_HH - -#include -using namespace std; - -#include "lily-proto.hh" - -typedef map 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 */ diff --git a/lily/item.cc b/lily/item.cc index 324df0e97c..c6ca1b2c69 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -17,13 +17,13 @@ #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 new_copies; Direction i = LEFT; - int count = 0; do { - Grob *dolly = clone (count++); + Grob *dolly = clone (); Item *item = dynamic_cast (dolly); get_root_system (this)->typeset_grob (item); new_copies[i] = item; diff --git a/lily/main.cc b/lily/main.cc index 9161511e68..c3a058795b 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -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 (); diff --git a/lily/note-heads-engraver.cc b/lily/note-heads-engraver.cc index b6b457b6e3..a49bbbe81f 100644 --- a/lily/note-heads-engraver.cc +++ b/lily/note-heads-engraver.cc @@ -104,5 +104,7 @@ ADD_TRANSLATOR (Note_heads_engraver, /* doc */ "Generate noteheads.", /* create */ "NoteHead ", - /* read */ "middleCPosition", - /* write */ ""); + /* read */ + "middleCPosition", + /* write */ + ""); diff --git a/lily/paper-column.cc b/lily/paper-column.cc index 28c7af69d3..c313475f49 100644 --- a/lily/paper-column.cc +++ b/lily/paper-column.cc @@ -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_; diff --git a/lily/program-option.cc b/lily/program-option.cc index 64318c00a8..8f593aaa39 100644 --- a/lily/program-option.cc +++ b/lily/program-option.cc @@ -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, (), diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index e1359ae4c3..c6d84823c0 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -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 ()); diff --git a/lily/spanner.cc b/lily/spanner.cc index 09359644b9..e1fe55efe1 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -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 (clone (broken_intos_.size ())); + Spanner *span = dynamic_cast (clone ()); span->set_bound (LEFT, bound); span->set_bound (RIGHT, bound); @@ -102,7 +102,7 @@ Spanner::do_break_processing () continue; } - Spanner *span = dynamic_cast (clone (broken_intos_.size ())); + Spanner *span = dynamic_cast (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; } diff --git a/lily/system.cc b/lily/system.cc index b804e43a31..06ac09e39a 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -21,14 +21,13 @@ #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 const &breaking) { for (vsize i = 0; i < breaking.size (); i++) { - System *system = dynamic_cast (clone (broken_intos_.size ())); + System *system = dynamic_cast (clone ()); system->rank_ = broken_intos_.size (); vector c (breaking[i].cols_); diff --git a/lily/tie-engraver.cc b/lily/tie-engraver.cc index e6d48dfea0..b97a5ad9c2 100644 --- a/lily/tie-engraver.cc +++ b/lily/tie-engraver.cc @@ -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 ()