From 9c62c7293a657743e212d8ab279b5d100a9c75a3 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 10 Jan 2007 16:51:22 +0100 Subject: [PATCH] Excise object keys from Contexts. --- lily/book.cc | 2 +- lily/context-def.cc | 4 ++-- lily/context.cc | 6 +++--- lily/engraver.cc | 1 + lily/global-context-scheme.cc | 12 +++++------- lily/global-context.cc | 6 ++---- lily/include/context-def.hh | 2 +- lily/include/context.hh | 7 +------ lily/include/global-context.hh | 2 +- lily/include/score.hh | 4 ++-- lily/score-scheme.cc | 5 ++--- lily/score.cc | 9 ++------- 12 files changed, 23 insertions(+), 37 deletions(-) diff --git a/lily/book.cc b/lily/book.cc index e8f1ee4ae2..06b3ea217f 100644 --- a/lily/book.cc +++ b/lily/book.cc @@ -144,7 +144,7 @@ Book::process (Output_def *default_paper, if (Score *score = unsmob_score (scm_car (s))) { SCM outputs = score - ->book_rendering (paper_book->paper_, default_layout, key); + ->book_rendering (paper_book->paper_, default_layout); while (scm_is_pair (outputs)) { diff --git a/lily/context-def.cc b/lily/context-def.cc index 8b28c5cde8..a5c13305d4 100644 --- a/lily/context-def.cc +++ b/lily/context-def.cc @@ -261,9 +261,9 @@ Context_def::get_translator_names (SCM user_mod) const } Context * -Context_def::instantiate (SCM ops, Object_key const *key) +Context_def::instantiate (SCM ops) { - Context *context = new Context (key); + Context *context = new Context (); context->definition_ = self_scm (); context->definition_mods_ = ops; diff --git a/lily/context.cc b/lily/context.cc index 53bca3b07b..15bd3c5fb8 100644 --- a/lily/context.cc +++ b/lily/context.cc @@ -48,6 +48,7 @@ Context::check_removal () Context::Context (Context const &src) { + (void) src; assert (false); } @@ -68,7 +69,7 @@ Context::add_context (Context *child) } -Context::Context (Object_key const *key) +Context::Context () { daddy_context_ = 0; aliases_ = SCM_EOL; @@ -259,7 +260,6 @@ Context::create_context_from_event (SCM sev) SCM ops = ev->get_property ("ops"); SCM type_scm = ev->get_property ("type"); string type = ly_symbol2string (type_scm); - Object_key const *key = 0; vector path = unsmob_context_def (definition_)->path_to_acceptable_context (type_scm, get_output_def ()); @@ -270,7 +270,7 @@ Context::create_context_from_event (SCM sev) } Context_def *cdef = path[0]; - Context *new_context = cdef->instantiate (ops, key); + Context *new_context = cdef->instantiate (ops); new_context->id_string_ = id; diff --git a/lily/engraver.cc b/lily/engraver.cc index f5fe392b13..365eefe006 100644 --- a/lily/engraver.cc +++ b/lily/engraver.cc @@ -112,6 +112,7 @@ Engraver::internal_make_grob (SCM symbol, SCM cause, char const *name, char cons (void) file; (void) fun; (void) line; + (void) name; SCM props = updated_grob_properties (context (), symbol); diff --git a/lily/global-context-scheme.cc b/lily/global-context-scheme.cc index e4a941d807..1cb52c8620 100644 --- a/lily/global-context-scheme.cc +++ b/lily/global-context-scheme.cc @@ -50,20 +50,18 @@ LY_DEFINE (ly_make_global_translator, "ly:make-global-translator", } LY_DEFINE (ly_make_global_context, "ly:make-global-context", - 1, 1, 0, (SCM output_def, SCM key), + 1, 0, 0, (SCM output_def), "Set up a global interpretation context, using the output\n" "block @var{output_def}.\n" "The context is returned.\n" - - "\n\nOptionally, this routine takes an Object-key to\n" - "to uniquely identify the Score block containing it.\n") + ) { Output_def *odef = unsmob_output_def (output_def); SCM_ASSERT_TYPE (odef, output_def, SCM_ARG1, __FUNCTION__, "Output definition"); - Global_context *glob = new Global_context (odef, unsmob_key (key)); + Global_context *glob = new Global_context (odef); if (!glob) { @@ -123,7 +121,7 @@ LY_DEFINE (ly_interpret_music_expression, "ly:interpret-music-expression", } LY_DEFINE (ly_run_translator, "ly:run-translator", - 2, 1, 0, (SCM mus, SCM output_def, SCM key), + 2, 1, 0, (SCM mus, SCM output_def), "Process @var{mus} according to @var{output_def}. \n" "An interpretation context is set up,\n" "and @var{mus} is interpreted with it. \n" @@ -132,7 +130,7 @@ LY_DEFINE (ly_run_translator, "ly:run-translator", "Optionally, this routine takes an Object-key to\n" "to uniquely identify the Score block containing it.\n") { - SCM glob = ly_make_global_context (output_def, key); + SCM glob = ly_make_global_context (output_def); ly_make_global_translator (glob); ly_interpret_music_expression (mus, glob); return glob; diff --git a/lily/global-context.cc b/lily/global-context.cc index 6bfbe20454..095f1f46a7 100644 --- a/lily/global-context.cc +++ b/lily/global-context.cc @@ -20,10 +20,8 @@ using namespace std; #include "output-def.hh" #include "warn.hh" -Global_context::Global_context (Output_def *o, Object_key *key) - : Context (new Lilypond_context_key (key, - Moment (0), - "Global", "", 0)) +Global_context::Global_context (Output_def *o) + : Context () { output_def_ = o; definition_ = find_context_def (o, ly_symbol2scm ("Global")); diff --git a/lily/include/context-def.hh b/lily/include/context-def.hh index 5d133ddbf4..dd4df4c802 100644 --- a/lily/include/context-def.hh +++ b/lily/include/context-def.hh @@ -50,7 +50,7 @@ public: vector path_to_acceptable_context (SCM type_string, Output_def *) const; - Context *instantiate (SCM extra_ops, Object_key const *); + Context *instantiate (SCM extra_ops); SCM to_alist () const; static SCM make_scm (); diff --git a/lily/include/context.hh b/lily/include/context.hh index a8866708f2..2cb0280ea1 100644 --- a/lily/include/context.hh +++ b/lily/include/context.hh @@ -38,7 +38,6 @@ protected: SCM definition_; /* Additions to the Context_def, given by \with */ SCM definition_mods_; - // Context_key_manager key_manager_; SCM properties_scm_; SCM context_list_; @@ -60,15 +59,11 @@ protected: friend class Context_def; // UGH! initialises implementation_ friend SCM ly_make_global_translator (SCM); - void clear_key_disambiguations (); DECLARE_LISTENER (set_property_from_event); DECLARE_LISTENER (unset_property_from_event); public: - Object_key const *get_grob_key (string name); - Object_key const *get_context_key (string name, string id); - string id_string () const { return id_string_; } SCM children_contexts () const { return context_list_; } SCM default_child_context_name () const; @@ -82,7 +77,7 @@ public: Translator_group *implementation () const { return implementation_; } Context *get_parent_context () const; - Context (Object_key const *); + Context (); /* properties: */ SCM internal_get_property (SCM name_sym) const; diff --git a/lily/include/global-context.hh b/lily/include/global-context.hh index bbb3095a11..540d96654b 100644 --- a/lily/include/global-context.hh +++ b/lily/include/global-context.hh @@ -21,7 +21,7 @@ class Global_context : public virtual Context friend class Output_def; public: - Global_context (Output_def *, Object_key *key); + Global_context (Output_def *); int get_moments_left () const; Moment sneaky_insert_extra_moment (Moment); void add_moment_to_process (Moment); diff --git a/lily/include/score.hh b/lily/include/score.hh index a5279d25b6..d4f26da4d2 100644 --- a/lily/include/score.hh +++ b/lily/include/score.hh @@ -38,12 +38,12 @@ public: SCM get_music () const; void add_output_def (Output_def *def); void set_music (SCM music); - SCM book_rendering (Output_def *, Output_def *, Object_key *); + SCM book_rendering (Output_def *, Output_def *); }; DECLARE_UNSMOB (Score, score); SCM ly_render_output (SCM, SCM); -SCM ly_run_translator (SCM, SCM, SCM); +SCM ly_run_translator (SCM, SCM); #endif /* SCORE_HH */ diff --git a/lily/score-scheme.cc b/lily/score-scheme.cc index 8bad81c618..b20b292dfd 100644 --- a/lily/score-scheme.cc +++ b/lily/score-scheme.cc @@ -74,7 +74,7 @@ LY_DEFINE (ly_score_error_p, "ly:score-error?", } LY_DEFINE (ly_score_embedded_format, "ly:score-embedded-format", - 2, 1, 0, (SCM score, SCM layout, SCM key), + 2, 0, 0, (SCM score, SCM layout), "Run @var{score} through @var{layout}, an output definition, " "scaled to correct output-scale already, " "return a list of layout-lines. " @@ -107,8 +107,7 @@ LY_DEFINE (ly_score_embedded_format, "ly:score-embedded-format", itself. */ score_def->parent_ = od; - SCM context = ly_run_translator (sc->get_music (), score_def->self_scm (), - key); + SCM context = ly_run_translator (sc->get_music (), score_def->self_scm ()); SCM output = ly_format_output (context); scm_remember_upto_here_1 (prot); diff --git a/lily/score.cc b/lily/score.cc index ff3aa63820..b5753c0ad7 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -114,8 +114,7 @@ Score::Score (Score const &s) */ SCM Score::book_rendering (Output_def *layoutbook, - Output_def *default_def, - Object_key *book_key) + Output_def *default_def) { if (error_found_) return SCM_EOL; @@ -131,9 +130,6 @@ Score::book_rendering (Output_def *layoutbook, int outdef_count = defs_.size (); - Object_key *key = new Lilypond_general_key (book_key, user_key_, 0); - SCM scm_key = key->unprotect (); - for (int i = 0; !i || i < outdef_count; i++) { Output_def *def = outdef_count ? defs_[i] : default_def; @@ -148,7 +144,7 @@ Score::book_rendering (Output_def *layoutbook, } /* TODO: fix or junk --no-layout. */ - SCM context = ly_run_translator (music_, def->self_scm (), scm_key); + SCM context = ly_run_translator (music_, def->self_scm ()); if (dynamic_cast (unsmob_context (context))) { SCM s = ly_format_output (context); @@ -160,7 +156,6 @@ Score::book_rendering (Output_def *layoutbook, scm_remember_upto_here_1 (scaled); } - scm_remember_upto_here_1 (scm_key); scm_remember_upto_here_1 (scaled_bookdef); return outputs; } -- 2.39.5