From 1ba07be46357dbe79055c29999109c842c038b92 Mon Sep 17 00:00:00 2001 From: hanwen Date: Fri, 29 Aug 2003 22:28:37 +0000 Subject: [PATCH] (main): don't identify binary. --- ChangeLog | 8 +++++ lily/accidental-engraver.cc | 5 ++- lily/auto-change-iterator.cc | 9 +++-- lily/axis-group-engraver.cc | 2 +- lily/change-iterator.cc | 7 ++-- lily/context-specced-music-iterator.cc | 7 ++-- lily/include/auto-change-iterator.hh | 2 +- lily/include/part-combine-music-iterator.hh | 2 +- lily/include/translator-def.hh | 5 ++- lily/include/translator-group.hh | 12 ++++--- lily/include/translator.hh | 7 +--- lily/lyric-phrasing-engraver.cc | 12 +++---- lily/main.cc | 1 - lily/music-output-def.cc | 12 ++----- lily/new-accidental-engraver.cc | 4 +-- lily/note-head-line-engraver.cc | 4 +-- lily/parser.yy | 38 ++++++++++----------- lily/part-combine-music-iterator.cc | 10 +++--- lily/simultaneous-music-iterator.cc | 8 ++--- lily/translator-def.cc | 16 ++++++--- lily/translator-group.cc | 20 +++++++---- lily/translator-scheme.cc | 6 ++-- lily/translator.cc | 12 +++---- ly/property-init.ly | 10 +++--- scm/define-music-properties.scm | 6 ++-- scm/drums.scm | 4 +-- scm/music-functions.scm | 8 ++--- scripts/convert-ly.py | 5 +++ scripts/lilypond.py | 10 +++--- 29 files changed, 130 insertions(+), 122 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4796f798b2..84af288515 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ +2003-08-30 Han-Wen Nienhuys + + * lily/main.cc (main): don't identify binary. + 2003-08-29 Han-Wen Nienhuys + * lily/include/translator.hh (class Translator): remove + type_string_ , use symbol for context name throughout. + Changes through whole source tree. + * scripts/lilypond.py: rename ly2dvi.py to lilypond.py set PDF as default, and always make PDF. diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc index 2395847889..e7ee765463 100644 --- a/lily/accidental-engraver.cc +++ b/lily/accidental-engraver.cc @@ -203,14 +203,13 @@ number_accidentals (Music * note, Pitch *pitch, Translator_group * origin, */ else if (gh_symbol_p (ly_car (accidentals))) { - String context = ly_symbol2string (ly_car (accidentals)); - + SCM context =ly_car (accidentals); while (origin && !origin->is_alias_b (context)) origin = origin->daddy_trans_; if (!origin) warning (_f ("Symbol is not a parent context: %s. Ignored", - context.to_str0 ())); + ly_symbol2string (context).to_str0 ())); } else warning (_f ("Accidental typesetting must be pair or context-name: %s", ly_scm2string (ly_car (accidentals)).to_str0 ())); diff --git a/lily/auto-change-iterator.cc b/lily/auto-change-iterator.cc index d57960f9bb..51e2284b2f 100644 --- a/lily/auto-change-iterator.cc +++ b/lily/auto-change-iterator.cc @@ -15,7 +15,7 @@ void -Auto_change_iterator::change_to (Music_iterator *it, String to_type, +Auto_change_iterator::change_to (Music_iterator *it, SCM to_type_sym, String to_id) { Translator_group * current = it->report_to (); @@ -31,7 +31,7 @@ Auto_change_iterator::change_to (Music_iterator *it, String to_type, If \translator Staff = bass, then look for Staff = * */ - while (current && current->type_string_ != to_type) + while (current && !current->is_alias_b (to_type_sym)) { last = current; current = current->daddy_trans_; @@ -47,7 +47,7 @@ Auto_change_iterator::change_to (Music_iterator *it, String to_type, if (last) { Translator_group * dest = - it->report_to ()->find_create_translator (to_type, to_id); + it->report_to ()->find_create_translator (to_type_sym, to_id); current->remove_translator (last); dest->add_used_group_translator (last); } @@ -134,8 +134,7 @@ Auto_change_iterator::process (Moment m) { where_dir_ = s; String to_id = (s >= 0) ? "up" : "down"; - String wh = ly_scm2string (get_music ()->get_mus_property ("what")); - change_to (child_iter_, wh, to_id); + change_to (child_iter_, get_music ()->get_mus_property ("what"), to_id); } } } diff --git a/lily/axis-group-engraver.cc b/lily/axis-group-engraver.cc index 90d9cc0861..bd728738f3 100644 --- a/lily/axis-group-engraver.cc +++ b/lily/axis-group-engraver.cc @@ -59,7 +59,7 @@ Axis_group_engraver::get_spanner () const void Axis_group_engraver::finalize () { - String type = get_daddy_grav ()->type_string_ ; + String type = get_daddy_grav ()->context_name (); SCM dims = get_property ("verticalExtent"); if (gh_pair_p (dims) && gh_number_p (ly_car (dims)) diff --git a/lily/change-iterator.cc b/lily/change-iterator.cc index b07781ebcb..b8ccb356b1 100644 --- a/lily/change-iterator.cc +++ b/lily/change-iterator.cc @@ -21,11 +21,12 @@ Change_iterator::error (String reason) String warn1 = _f ("can't change `%s' to `%s'", to_type, to_id) + ": " + reason; + /* GUHG! */ String warn2= "Change_iterator::process (): " - + report_to ()->type_string_ + " = `" + + report_to ()->context_name () + " = `" + report_to ()->id_string_ + "': "; warning (warn2); get_music ()->origin ()->warning (warn1); @@ -40,7 +41,7 @@ Change_iterator::process (Moment m) Translator_group * current = report_to (); Translator_group * last = 0; - String to_type = ly_scm2string (get_music ()->get_mus_property ("change-to-type")); + SCM to_type = get_music ()->get_mus_property ("change-to-type"); String to_id = ly_scm2string (get_music ()->get_mus_property ("change-to-id")); @@ -48,7 +49,7 @@ Change_iterator::process (Moment m) If \translator Staff = bass, then look for Staff = * */ - while (current && current->type_string_ != to_type) + while (current && !current->is_alias_b (to_type)) { last = current; current = current->daddy_trans_; diff --git a/lily/context-specced-music-iterator.cc b/lily/context-specced-music-iterator.cc index f1e64ba558..a5b808a9ba 100644 --- a/lily/context-specced-music-iterator.cc +++ b/lily/context-specced-music-iterator.cc @@ -23,17 +23,14 @@ void Context_specced_music_iterator::construct_children () { SCM ct = get_music ()->get_mus_property ("context-type"); - String c_type; - if (gh_string_p (ct)) - c_type = ly_scm2string (ct); - + String c_id; SCM ci = get_music ()->get_mus_property ("context-id"); if (gh_string_p (ci)) c_id = ly_scm2string (ci); Translator_group* a - =report_to ()->find_create_translator (c_type, c_id); + =report_to ()->find_create_translator (ct, c_id); set_translator (a); diff --git a/lily/include/auto-change-iterator.hh b/lily/include/auto-change-iterator.hh index 4e71a300db..896de1b258 100644 --- a/lily/include/auto-change-iterator.hh +++ b/lily/include/auto-change-iterator.hh @@ -26,7 +26,7 @@ protected: Array pending_pitch (Moment)const; private: Direction where_dir_; - void change_to (Music_iterator* , String, String); + void change_to (Music_iterator* , SCM, String); }; #endif /* AUTO_CHANGE_ITERATOR_HH */ diff --git a/lily/include/part-combine-music-iterator.hh b/lily/include/part-combine-music-iterator.hh index 80ddf1eb42..8d6d6a18d9 100644 --- a/lily/include/part-combine-music-iterator.hh +++ b/lily/include/part-combine-music-iterator.hh @@ -32,7 +32,7 @@ protected: virtual bool ok () const; private: - void change_to (Music_iterator*, String, String); + void change_to (Music_iterator*, SCM, String); int get_state (Moment m); Music_iterator * first_iter_; diff --git a/lily/include/translator-def.hh b/lily/include/translator-def.hh index 0c3d8457f5..844bf8178c 100644 --- a/lily/include/translator-def.hh +++ b/lily/include/translator-def.hh @@ -31,7 +31,10 @@ private: SCM property_ops_; public: - SCM description_; + SCM description_; + /* + "type" is overloaded. + */ SCM type_name_; SCM type_aliases_; SCM translator_group_type_; diff --git a/lily/include/translator-group.hh b/lily/include/translator-group.hh index 4a40e07208..87b9616339 100644 --- a/lily/include/translator-group.hh +++ b/lily/include/translator-group.hh @@ -34,9 +34,10 @@ class Translator_group : public virtual Translator { friend class Interpretation_context_handle; SCM add_translator (SCM, Translator*); - + protected: ~Translator_group (); + public: void execute_pushpop_property (SCM prop, SCM sym, SCM val); SCM internal_get_property (SCM name_sym) const; @@ -47,7 +48,7 @@ public: Translator_group *where_defined (SCM name_sym) const; String id_string_; - + String context_name () const; VIRTUAL_COPY_CONS (Translator); Translator_group (Translator_group const &); Translator_group (); @@ -63,9 +64,10 @@ public: Translator *remove_translator (Translator*trans); void check_removal (); // Translator *get_simple_translator (String) const; - Translator_group *find_existing_translator (String n, String id); - Translator_group *find_create_translator (String n, String id); - Link_array path_to_acceptable_translator (String alias, Music_output_def*) const; + Translator_group *find_existing_translator (SCM context_name, String id); + Translator_group *find_create_translator (SCM context_name, String id); + Link_array path_to_acceptable_translator (SCM alias, + Music_output_def*) const; Translator_group*get_default_interpreter (); public: diff --git a/lily/include/translator.hh b/lily/include/translator.hh index eaafa53145..81b95bbdf7 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -37,11 +37,8 @@ class Translator void init (); public: Music_output_def * output_def_; - String type_string_; - bool is_alias_b (String) const; - - + bool is_alias_b (SCM) const; Translator (Translator const &); @@ -62,7 +59,6 @@ public: SCM simple_trans_list_; SCM trans_group_list_; SCM definition_; - SCM properties_scm_; DECLARE_SMOBS (Translator, dummy); @@ -88,7 +84,6 @@ static void _ ## T ## _adder () {\ T *t = new T;\ T::static_description_ = t->static_translator_description ();\ scm_permanent_object (T::static_description_);\ - t->type_string_ = classname (t);\ add_translator (t);\ }\ SCM T::translator_description() const\ diff --git a/lily/lyric-phrasing-engraver.cc b/lily/lyric-phrasing-engraver.cc index 904b78f79a..fab2a8e607 100644 --- a/lily/lyric-phrasing-engraver.cc +++ b/lily/lyric-phrasing-engraver.cc @@ -14,7 +14,7 @@ #include "warn.hh" -String get_context_id (Translator_group * ancestor, const char * type); +String get_context_id (Translator_group * ancestor, SCM); String trim_suffix (String &id); @@ -200,7 +200,7 @@ Lyric_phrasing_engraver::acknowledge_grob (Grob_info i) /* caught a note head ... do something with it */ /* what's its Voice context name? */ - String voice_context_id = get_context_id (i.origin_trans_->daddy_trans_, "Voice"); + String voice_context_id = get_context_id (i.origin_trans_->daddy_trans_, ly_symbol2scm ("Voice")); record_notehead (voice_context_id, h); /* is it in a melisma ? */ @@ -224,7 +224,7 @@ Lyric_phrasing_engraver::acknowledge_grob (Grob_info i) } else { - voice_context_id = get_context_id (i.origin_trans_->daddy_trans_, "LyricsVoice"); + voice_context_id = get_context_id (i.origin_trans_->daddy_trans_,ly_symbol2scm ( "LyricsVoice")); voice_context_id = trim_suffix (voice_context_id); } record_lyric (voice_context_id, h); @@ -246,16 +246,16 @@ Lyric_phrasing_engraver::acknowledge_grob (Grob_info i) */ if (h->internal_has_interface (ly_symbol2scm ("lyric-extender-interface"))) { - String voice_context_id = get_context_id (i.origin_trans_->daddy_trans_, "LyricsVoice"); + String voice_context_id = get_context_id (i.origin_trans_->daddy_trans_, ly_symbol2scm ("LyricsVoice")); record_extender (trim_suffix (voice_context_id), h); return; } } String -get_context_id (Translator_group * ancestor, const char *type) +get_context_id (Translator_group * ancestor, SCM type) { - while (ancestor != 0 && ancestor->type_string_ != type) + while (ancestor != 0 && !ancestor->is_alias_b(type)) { ancestor = ancestor->daddy_trans_; } diff --git a/lily/main.cc b/lily/main.cc index ef55cffc56..6ea0664d18 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -490,7 +490,6 @@ main (int argc, char **argv) break; } } - identify (stderr); if (help_b) { diff --git a/lily/music-output-def.cc b/lily/music-output-def.cc index e8ae40ccfd..f9a305127c 100644 --- a/lily/music-output-def.cc +++ b/lily/music-output-def.cc @@ -77,23 +77,15 @@ Music_output_def::assign_translator (SCM transdef) Translator_def *tp = unsmob_translator_def (transdef); assert (tp); - - SCM s = ly_symbol2scm (""); - if (gh_string_p (tp->type_name_)) - s = scm_string_to_symbol (tp->type_name_); - - translator_tab_->set (s, transdef); + translator_tab_->set (tp->type_name_, transdef); } /* - find the translator for NAME. NAME may be a string or a symbol. + find the translator for NAME. NAME must be a symbol. */ SCM Music_output_def::find_translator (SCM name) const { - if (gh_string_p (name)) - name = scm_string_to_symbol (name); - SCM val =SCM_EOL; translator_tab_->try_retrieve (name, &val); return val; diff --git a/lily/new-accidental-engraver.cc b/lily/new-accidental-engraver.cc index bb1b7b7181..4d2cad0b29 100644 --- a/lily/new-accidental-engraver.cc +++ b/lily/new-accidental-engraver.cc @@ -270,14 +270,14 @@ number_accidentals (Music * note, Pitch *pitch, Translator_group * origin, */ else if (gh_symbol_p (ly_car (accidentals))) { - String context = ly_symbol2string (ly_car (accidentals)); + SCM context = ly_car (accidentals); while (origin && !origin->is_alias_b (context)) origin = origin->daddy_trans_; if (!origin) warning (_f ("Symbol is not a parent context: %s. Ignored", - context.to_str0 ())); + ly_symbol2string (context).to_str0 ())); } else warning (_f ("Accidental typesetting must be pair or context-name: %s", ly_scm2string (ly_car (accidentals)).to_str0 ())); diff --git a/lily/note-head-line-engraver.cc b/lily/note-head-line-engraver.cc index 57ad1be124..84e8af2652 100644 --- a/lily/note-head-line-engraver.cc +++ b/lily/note-head-line-engraver.cc @@ -60,10 +60,10 @@ Note_head_line_engraver::acknowledge_grob (Grob_info info) if (to_boolean (get_property ("followVoice"))) { Translator_group * tr = daddy_trans_; - while (tr && tr->type_string_ != "Staff") + while (tr && !tr->is_alias_b (ly_symbol2scm ( "Staff"))) tr = tr->daddy_trans_ ; - if (tr && tr->type_string_ == "Staff" && tr != last_staff_) + if (tr && tr->is_alias_b (ly_symbol2scm ("Staff")) && tr != last_staff_) { if (last_head_) follow_ = true; diff --git a/lily/parser.yy b/lily/parser.yy index 87cb025130..fdf8f5c3d9 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -575,7 +575,7 @@ translator_spec_body: scm_string_to_symbol ($2), $4); } | translator_spec_body NAME STRING { - unsmob_translator_def ($$)->type_name_ = $3; + unsmob_translator_def ($$)->type_name_ = scm_string_to_symbol ($3); } | translator_spec_body CONSISTS STRING { unsmob_translator_def ($$)->add_element ($3); @@ -594,10 +594,10 @@ translator_spec_body: unsmob_translator_def ($$)->add_last_element ( $3); } | translator_spec_body ACCEPTS STRING { - unsmob_translator_def ($$)->set_acceptor ($3,true); + unsmob_translator_def ($$)->set_acceptor (scm_string_to_symbol ($3), true); } | translator_spec_body DENIES STRING { - unsmob_translator_def ($$)->set_acceptor ($3,false); + unsmob_translator_def ($$)->set_acceptor (scm_string_to_symbol ($3), false); } | translator_spec_body REMOVE STRING { unsmob_translator_def ($$)->remove_element ($3); @@ -917,7 +917,7 @@ Composite_music: csm->set_mus_property ("element", $3->self_scm ()); scm_gc_unprotect_object ($3->self_scm ()); - csm->set_mus_property ("context-type",$2); + csm->set_mus_property ("context-type", scm_string_to_symbol ($2)); csm->set_mus_property ("context-id", scm_makfrom0str ("")); $$ = csm; @@ -928,7 +928,7 @@ Composite_music: chm->set_mus_property ("iterator-ctor", Auto_change_iterator::constructor_proc); scm_gc_unprotect_object ($3->self_scm ()); - chm->set_mus_property ("what", $2); + chm->set_mus_property ("what", scm_string_to_symbol ($2)); $$ = chm; chm->set_spot (*$3->origin ()); @@ -990,7 +990,7 @@ basic music objects too, since the meaning is different. csm->set_mus_property ("element", $5->self_scm ()); scm_gc_unprotect_object ($5->self_scm ()); - csm->set_mus_property ("context-type", $2); + csm->set_mus_property ("context-type", scm_string_to_symbol ($2)); csm->set_mus_property ("context-id", $4); $$ = csm; @@ -1003,7 +1003,7 @@ basic music objects too, since the meaning is different. csm->set_mus_property ("element", $3->self_scm ()); scm_gc_unprotect_object ($3->self_scm ()); - csm->set_mus_property ("context-type", $2); + csm->set_mus_property ("context-type", scm_string_to_symbol ($2)); SCM new_id = scm_number_to_string (gh_int2scm (new_context_count ++), gh_int2scm (10)); @@ -1019,9 +1019,9 @@ basic music objects too, since the meaning is different. { int n = gh_scm2int (ly_car ($3)); int d = gh_scm2int (ly_cdr ($3)); Music *mp = $4; - $$= MY_MAKE_MUSIC("TimeScaledMusic"); - $$->set_spot (THIS->pop_spot ()); + $$= MY_MAKE_MUSIC("TimeScaledMusic"); + $$->set_spot (THIS->pop_spot ()); $$->set_mus_property ("element", mp->self_scm ()); scm_gc_unprotect_object (mp->self_scm ()); @@ -1123,8 +1123,8 @@ re_rhythmed_music: part_combined_music: PARTCOMBINE STRING Music Music { - Music * p= MY_MAKE_MUSIC("PartCombineMusic"); - p->set_mus_property ("what", $2); + Music * p= MY_MAKE_MUSIC("PartCombineMusic"); + p->set_mus_property ("what", scm_string_to_symbol ($2)); p->set_mus_property ("elements", gh_list ($3->self_scm (),$4->self_scm (), SCM_UNDEFINED)); scm_gc_unprotect_object ($3->self_scm ()); @@ -1137,7 +1137,7 @@ part_combined_music: translator_change: TRANSLATOR STRING '=' STRING { Music*t= MY_MAKE_MUSIC("TranslatorChange"); - t-> set_mus_property ("change-to-type", $2); + t-> set_mus_property ("change-to-type", scm_string_to_symbol ($2)); t-> set_mus_property ("change-to-id", $4); $$ = t; @@ -1165,7 +1165,7 @@ simple_property_def: $$ = csm; $$->set_spot (THIS->here_input ()); - csm-> set_mus_property ("context-type", $2); + csm-> set_mus_property ("context-type", scm_string_to_symbol ($2)); } | PROPERTY STRING '.' STRING UNSET { @@ -1179,7 +1179,7 @@ simple_property_def: $$ = csm; $$->set_spot (THIS->here_input ()); - csm-> set_mus_property ("context-type", $2); + csm-> set_mus_property ("context-type", scm_string_to_symbol ($2)); } | PROPERTY STRING '.' STRING SET embedded_scm '=' embedded_scm { bool autobeam @@ -1201,7 +1201,7 @@ simple_property_def: $$ = csm; $$->set_spot (THIS->here_input ()); - csm-> set_mus_property ("context-type", $2); + csm-> set_mus_property ("context-type", scm_string_to_symbol ($2)); } | PROPERTY STRING '.' STRING OVERRIDE embedded_scm '=' embedded_scm @@ -1229,7 +1229,7 @@ simple_property_def: $$ = csm; $$->set_spot (THIS->here_input ()); - csm-> set_mus_property ("context-type", $2); + csm-> set_mus_property ("context-type", scm_string_to_symbol ($2)); } | PROPERTY STRING '.' STRING REVERT embedded_scm { @@ -1252,7 +1252,7 @@ simple_property_def: $$ = csm; $$->set_spot (THIS->here_input ()); - csm-> set_mus_property ("context-type", $2); + csm-> set_mus_property ("context-type", scm_string_to_symbol ($2)); } ; @@ -1409,7 +1409,7 @@ command_element: $$ = csm; $$->set_spot (THIS->here_input ()); - csm->set_mus_property ("context-type", scm_makfrom0str ("Timing")); + csm->set_mus_property ("context-type", ly_symbol2scm ("Timing")); } | PARTIAL duration_length { Moment m = - unsmob_duration ($2)->get_length (); @@ -1420,7 +1420,7 @@ command_element: scm_gc_unprotect_object (p->self_scm ()); $$ =sp ; - sp-> set_mus_property ("context-type", scm_makfrom0str ("Timing")); + sp-> set_mus_property ("context-type", ly_symbol2scm ("Timing")); } | CLEF STRING { static SCM proc ; diff --git a/lily/part-combine-music-iterator.cc b/lily/part-combine-music-iterator.cc index b249224f3b..0aa59eb11d 100644 --- a/lily/part-combine-music-iterator.cc +++ b/lily/part-combine-music-iterator.cc @@ -92,7 +92,7 @@ Part_combine_music_iterator::construct_children () } void -Part_combine_music_iterator::change_to (Music_iterator *it, String to_type, +Part_combine_music_iterator::change_to (Music_iterator *it, SCM to_type, String to_id) { Translator_group * current = it->report_to (); @@ -108,7 +108,7 @@ Part_combine_music_iterator::change_to (Music_iterator *it, String to_type, If \translator Staff = bass, then look for Staff = * */ - while (current && current->type_string_ != to_type) + while (current && !current->is_alias_b (to_type)) { last = current; current = current->daddy_trans_; @@ -136,7 +136,7 @@ Part_combine_music_iterator::change_to (Music_iterator *it, String to_type, last->translator_id_string_ = get_change ()->change_to_id_string_; */ - error (_f ("I'm one myself: `%s'", to_type.to_str0 ())); + error (_f ("I'm one myself: `%s'", ly_symbol2string (to_type).to_str0 ())); } else error (_f ("none of these in my family: `%s'", to_id.to_str0 ())); @@ -169,7 +169,7 @@ Part_combine_music_iterator::get_state (Moment) Music *p = get_music (); - String w = ly_scm2string (p->get_mus_property ("what")); + SCM w = p->get_mus_property ("what"); Translator_group *first_translator = first_iter_->report_to ()->find_create_translator (w, "one" + suffix_); @@ -394,7 +394,7 @@ s Consider thread switching: threads "one", "two" and "both". if (second_iter_ && second_iter_->ok ()) second_iter_->try_music (abort_req); } - String w = ly_scm2string (p->get_mus_property ("what")); + SCM w = p->get_mus_property ("what"); if (combine_b != previously_combined_b) change_to (second_iter_, w, (combine_b ? "one" : "two") + suffix_); diff --git a/lily/simultaneous-music-iterator.cc b/lily/simultaneous-music-iterator.cc index 92e244974e..6a93ab7b0c 100644 --- a/lily/simultaneous-music-iterator.cc +++ b/lily/simultaneous-music-iterator.cc @@ -10,7 +10,7 @@ #include "warn.hh" #include "simultaneous-music-iterator.hh" #include "music-list.hh" -#include "killing-cons.tcc" +#include "translator-def.hh" Simultaneous_music_iterator::Simultaneous_music_iterator () @@ -76,10 +76,10 @@ Simultaneous_music_iterator::construct_children () /* if separate_contexts_b_ is set, create a new context with the number number as name */ - + + SCM name = unsmob_translator_def (report_to ()->definition_)->type_name_; Translator_group * t = (j && separate_contexts_b_) - ? report_to ()->find_create_translator (report_to ()->type_string_, - to_string (j)) + ? report_to ()->find_create_translator (name, to_string (j)) : report_to (); if (!t) diff --git a/lily/translator-def.cc b/lily/translator-def.cc index de404836ed..3e15e61b40 100644 --- a/lily/translator-def.cc +++ b/lily/translator-def.cc @@ -90,6 +90,7 @@ Translator_def::Translator_def (Translator_def const & s) void Translator_def::set_acceptor (SCM name, bool add) { + assert (gh_symbol_p (name)); if (add) this->accepts_name_list_ = gh_cons (name, this->accepts_name_list_); else @@ -159,9 +160,9 @@ Translator_def::add_pop_property (SCM props, SCM syms) Link_array -Translator_def::path_to_acceptable_translator (SCM type_string, Music_output_def* odef) const +Translator_def::path_to_acceptable_translator (SCM type_sym, Music_output_def* odef) const { - assert (gh_string_p (type_string)); + assert (gh_symbol_p (type_sym)); Link_array accepteds; for (SCM s = accepts_name_list_; gh_pair_p (s); s = ly_cdr (s)) @@ -179,7 +180,7 @@ Translator_def::path_to_acceptable_translator (SCM type_string, Music_output_def /* don't check aliases, because \context Staff should not create RhythmicStaff. */ - if (gh_equal_p (accepteds[i]->type_name_, type_string)) + if (gh_equal_p (accepteds[i]->type_name_, type_sym)) { best_result.push (accepteds[i]); return best_result; @@ -192,11 +193,17 @@ Translator_def::path_to_acceptable_translator (SCM type_string, Music_output_def Translator_def * g = accepteds[i]; Link_array result - = g->path_to_acceptable_translator (type_string, odef); + = g->path_to_acceptable_translator (type_sym, odef); if (result.size () && result.size () < best_depth) { result.insert (g,0); best_result = result; + + /* + this following line was added in 1.9.3, but hsould've been + there all along... Let's hope it doesn't cause nightmares. + */ + best_depth = result.size(); } } @@ -241,7 +248,6 @@ Translator_def::instantiate (Music_output_def* md) Translator_group *tg = dynamic_cast (g); tg->output_def_ = md; tg->definition_ = self_scm (); - tg->type_string_ = ly_scm2string (type_name_); /* TODO: ugh. we're reversing CONSISTS_NAME_LIST_ here diff --git a/lily/translator-group.cc b/lily/translator-group.cc index f57e3ecfb6..ac4e97eb2a 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -105,9 +105,9 @@ Translator_group::removable_b () const } Translator_group * -Translator_group::find_existing_translator (String n, String id) +Translator_group::find_existing_translator (SCM n, String id) { - if ((is_alias_b (n) && (id_string_ == id || id.empty_b ())) || n == "Current") + if ((is_alias_b (n) && (id_string_ == id || id.empty_b ())) || n == ly_symbol2scm ("Current")) return this; Translator_group* r = 0; @@ -123,14 +123,14 @@ Translator_group::find_existing_translator (String n, String id) Translator_group* -Translator_group::find_create_translator (String n, String id) +Translator_group::find_create_translator (SCM n, String id) { Translator_group * existing = find_existing_translator (n,id); if (existing) return existing; Link_array path - = unsmob_translator_def (definition_)->path_to_acceptable_translator (scm_makfrom0str ((char*)n.to_str0 ()), get_output_def ()); + = unsmob_translator_def (definition_)->path_to_acceptable_translator (n, get_output_def ()); if (path.size ()) { @@ -155,7 +155,7 @@ Translator_group::find_create_translator (String n, String id) ret = daddy_trans_->find_create_translator (n,id); else { - warning (_f ("can't find or create `%s' called `%s'", n, id)); + warning (_f ("can't find or create `%s' called `%s'", ly_symbol2string (n).to_str0 (), id)); ret =0; } return ret; @@ -213,7 +213,7 @@ Translator_group::remove_translator (Translator*trans) bool Translator_group::is_bottom_translator_b () const { - return !gh_string_p (unsmob_translator_def (definition_)->default_child_context_name ()); + return !gh_symbol_p (unsmob_translator_def (definition_)->default_child_context_name ()); } Translator_group* @@ -455,4 +455,10 @@ Translator_group::properties_as_alist () const { return properties_dict()->to_alist(); } - + +String +Translator_group::context_name () const +{ + Translator_def * td = unsmob_translator_def (definition_ ); + return ly_symbol2string (td->type_name_); +} diff --git a/lily/translator-scheme.cc b/lily/translator-scheme.cc index ed42abdb18..9a7bf5c065 100644 --- a/lily/translator-scheme.cc +++ b/lily/translator-scheme.cc @@ -109,13 +109,11 @@ LY_DEFINE(ly_translator_find, Translator_group* tr= dynamic_cast ( unsmob_translator (context)); SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "context"); - SCM_ASSERT_TYPE(gh_string_p (name), name, SCM_ARG2, __FUNCTION__, "string"); - - String s = ly_scm2string (name); + SCM_ASSERT_TYPE(gh_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol"); while (tr) { - if (tr->is_alias_b (s)) + if (tr->is_alias_b (name)) return tr->self_scm(); tr = tr->daddy_trans_ ; } diff --git a/lily/translator.cc b/lily/translator.cc index 7d2bdbc702..3e440ab335 100644 --- a/lily/translator.cc +++ b/lily/translator.cc @@ -43,19 +43,18 @@ Translator::Translator (Translator const &s) self_scm_ = SCM_EOL; init (); output_def_ = s.output_def_; - type_string_ = s.type_string_; smobify_self (); } bool -Translator::is_alias_b (String s) const +Translator::is_alias_b (SCM sym) const { - bool b = s == type_string_; + Translator_def * td = unsmob_translator_def (definition_); + bool b = (sym == td->type_name_); - for (SCM a = unsmob_translator_def (definition_)->type_aliases_; - !b && gh_pair_p (a); a = ly_cdr (a)) - b = b || s == ly_scm2string (ly_car (a)); + for (SCM a = td->type_aliases_; !b && gh_pair_p (a); a = ly_cdr (a)) + b = b || sym == ly_car (a); return b; } @@ -150,3 +149,4 @@ Translator::static_translator_description ()const IMPLEMENT_SMOBS (Translator); IMPLEMENT_DEFAULT_EQUAL_P (Translator); IMPLEMENT_TYPE_P(Translator,"ly:translator?"); + diff --git a/ly/property-init.ly b/ly/property-init.ly index 5ab7062c3d..0f4d2c1901 100644 --- a/ly/property-init.ly +++ b/ly/property-init.ly @@ -81,11 +81,11 @@ newpage = \notes } % dynamic ly:dir? text script, articulation script ly:dir? -oneVoice = #(context-spec-music (make-voice-props-revert) "Voice") -voiceOne = #(context-spec-music (make-voice-props-set 0) "Voice") -voiceTwo = #(context-spec-music (make-voice-props-set 1) "Voice") -voiceThree =#(context-spec-music (make-voice-props-set 2) "Voice") -voiceFour = #(context-spec-music (make-voice-props-set 3) "Voice") +oneVoice = #(context-spec-music (make-voice-props-revert) 'Voice) +voiceOne = #(context-spec-music (make-voice-props-set 0) 'Voice) +voiceTwo = #(context-spec-music (make-voice-props-set 1) 'Voice) +voiceThree =#(context-spec-music (make-voice-props-set 2) 'Voice) +voiceFour = #(context-spec-music (make-voice-props-set 3) 'Voice) tiny = diff --git a/scm/define-music-properties.scm b/scm/define-music-properties.scm index 5b146f580d..e705f24b59 100644 --- a/scm/define-music-properties.scm +++ b/scm/define-music-properties.scm @@ -35,10 +35,10 @@ TODO: consider making type into symbol ") (music-property-description 'bass boolean? "Set if this note is a bass note in a chord") (music-property-description 'cautionary boolean? "If set, this alteration needs cautionary accidental") (music-property-description 'change-to-id string? "name of the context to change to ") -(music-property-description 'change-to-type string? "type of the context to change to.") +(music-property-description 'change-to-type symbol? "type of the context to change to.") (music-property-description 'compress-procedure procedure? "compress this music expression. Argument 1: the music, arg 2: factor") (music-property-description 'context-id string? "name of context") -(music-property-description 'context-type string? "type of context") +(music-property-description 'context-type symbol? "type of context") (music-property-description 'denominator integer? "denominator in a time signature") (music-property-description 'digit integer? "digit for fingering") (music-property-description 'direction ly:dir? "Print this up or down?") @@ -83,7 +83,7 @@ starting grace notes.") (music-property-description 'tremolo-type integer? "") (music-property-description 'value scheme? "Assignment value for a translation property") -(music-property-description 'what string? "What to change for auto-change. FIXME, naming") +(music-property-description 'what symbol? "What to change for auto-change. FIXME, naming") (music-property-description 'figure string? "a `figure' (which may be a string) for figured bass") diff --git a/scm/drums.scm b/scm/drums.scm index 90a0cef020..b6beb241b5 100644 --- a/scm/drums.scm +++ b/scm/drums.scm @@ -231,10 +231,10 @@ ) (define (make-head-type t) - (context-spec-music (make-head-type-elem t) "Thread")) + (context-spec-music (make-head-type-elem t) 'Thread)) (define (make-thread-context thread-name element) - (context-spec-music element "Thread" thread-name)) + (context-spec-music element 'Thread thread-name)) ;; makes a sequential-music of thread-context, head-change and note (define (make-drum-head kit req-ch ) diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 73a398cffe..431b9bdc30 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -354,7 +354,7 @@ and set OTTAVATION to `8va', or whatever appropriate." )))) (ly:set-mus-property! m 'procedure ottava-modify) - (context-spec-music m "Staff") + (context-spec-music m 'Staff) )) (define-public (set-octavation ottavation) @@ -379,7 +379,7 @@ Rest can contain a list of beat groupings (basic (list set1 set2 set3 set4))) (context-spec-music - (make-sequential-music basic) "Timing"))) + (make-sequential-music basic) 'Timing))) (define-public (set-time-signature num den . rest) (ly:export (apply make-time-signature-set `(,num ,den . ,rest)))) @@ -446,7 +446,7 @@ Rest can contain a list of beat groupings (make-voice-props-set number) (make-simultaneous-music (car lst)))) - "Voice" (number->string number)) + 'Voice (number->string number)) (voicify-list (cdr lst) (+ number 1)) )) ) @@ -612,7 +612,7 @@ Rest can contain a list of beat groupings ) (ly:set-context-property! where 'graceSettings new-settings))) - (ly:export (context-spec-music (make-apply-context set-prop) "Voice"))) + (ly:export (context-spec-music (make-apply-context set-prop) 'Voice))) (define-public (set-start-grace-properties context) diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py index 2f14ad226d..7e9c2d78fa 100644 --- a/scripts/convert-ly.py +++ b/scripts/convert-ly.py @@ -1444,6 +1444,11 @@ if 1: def conv (str): str = re.sub ('accacciatura', 'acciaccatura', str) + + if re.search ("context-spec-music"): + sys.stderr.write ("context-spec-music takes a symbol for the context now. Update by hand." + raise FatalConversionError() + return str conversions.append (((1,9,3), conv, """\acciaccatura misspelling""")) diff --git a/scripts/lilypond.py b/scripts/lilypond.py index 22c65e2e72..04d278a65e 100644 --- a/scripts/lilypond.py +++ b/scripts/lilypond.py @@ -1,6 +1,6 @@ #!@PYTHON@ # -# ly2dvi.py -- Run LilyPond, add titles to bare score, generate printable +# lilypond.py -- Run LilyPond, add titles to bare score, generate printable # document # Invokes: lilypond, latex (or pdflatex), dvips, ps2pdf, gs # @@ -9,7 +9,7 @@ # (c) 1998--2003 Han-Wen Nienhuys # Jan Nieuwenhuizen -# This is the third incarnation of ly2dvi. +# This is the third incarnation of ly2dvi, now renamed lilypond. # # Earlier incarnations of ly2dvi were written by # Jeffrey B. Reed (Python version) @@ -24,7 +24,7 @@ ''' TODO: - * figure out which set of command line options should make ly2dvi: + * figure out which set of command line options should make lilypond: na: create tex only? na: create latex only? @@ -37,8 +37,6 @@ TODO: etc. - * for foo.ly, rename ly2dvi.dir to out-ly2dvi, foo.ly2dvi, foo.dir ? - * move versatile taglines, \header { @@ -106,7 +104,7 @@ global _;_=ly._ global re;re = ly.re # lilylib globals -program_name = 'ly2dvi' +program_name = 'lilypond' program_version = '@TOPLEVEL_VERSION@' verbose_p = 0 pseudo_filter_p = 0 -- 2.39.5