From: hanwen Date: Sun, 11 Jan 2004 22:15:41 +0000 (+0000) Subject: * lily/translator-def.cc: rename Translator_def to Context_def. X-Git-Tag: release/2.1.9~8 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=74d622b7bbc21b54656744babead90ec0bb2cc4e;p=lilypond.git * lily/translator-def.cc: rename Translator_def to Context_def. * Documentation/user/refman.itely (Rhythmic music): add link to RhythmicStaff --- diff --git a/ChangeLog b/ChangeLog index a49f4aa010..201ef96752 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2004-01-11 Han-Wen Nienhuys + * lily/translator-def.cc: rename Translator_def to Context_def. + * Documentation/user/internals.itely (Lexical details): clarify string def. diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index 7a2f755ac9..d082a8a761 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -1303,6 +1303,11 @@ be used to override typesetting decisions. When using @code{merge-differently-headed} with an upstem 8th or a shorter note, and a downstem half note, the 8th note gets the wrong offset. +There is no support for clusters where the same note occurs with +different accidentals in the same chord. In this case, it is +recommended to use enharmonic transcription, or to use special cluster +notation (see @ref{Clusters}). + @node Beaming @section Beaming @@ -4281,7 +4286,9 @@ is @end example This means that @var{musicexpr} is transposed by the interval -between @var{from} and @var{to}. +between the pitches @var{from} and @var{to}. +Since @var{from} and @var{to} are pitches, @code{\transpose} must be +inside a @code{\notes} section. @code{\transpose} distinguishes between enharmonic pitches: both @code{\transpose c cis} or @code{\transpose c des} will transpose up @@ -4298,6 +4305,7 @@ mus =\notes { \key d \major cis d fis g } }} @end lilypond + @seealso Internals: @internalsref{TransposedMusic}, and @@ -5119,34 +5127,34 @@ following table: \property Score.timing = ##f \property Score.barAlways = ##t s_\markup { "$\\backslash$time 4/4" } - ^\markup { " " \musicglyph #"timesig-neo\_mensural4/4" } + ^\markup { " " \musicglyph #"timesig-neo_mensural4/4" } s s_\markup { "$\\backslash$time 2/2" } - ^\markup { " " \musicglyph #"timesig-neo\_mensural2/2" } + ^\markup { " " \musicglyph #"timesig-neo_mensural2/2" } s s_\markup { "$\\backslash$time 6/4" } - ^\markup { " " \musicglyph #"timesig-neo\_mensural6/4" } + ^\markup { " " \musicglyph #"timesig-neo_mensural6/4" } s s_\markup { "$\\backslash$time 6/8" } - ^\markup { " " \musicglyph #"timesig-neo\_mensural6/8" } + ^\markup { " " \musicglyph #"timesig-neo_mensural6/8" } \break s_\markup { "$\\backslash$time 3/2" } - ^\markup { " " \musicglyph #"timesig-neo\_mensural3/2" } + ^\markup { " " \musicglyph #"timesig-neo_mensural3/2" } s s_\markup { "$\\backslash$time 3/4" } - ^\markup { " " \musicglyph #"timesig-neo\_mensural3/4" } + ^\markup { " " \musicglyph #"timesig-neo_mensural3/4" } s s_\markup { "$\\backslash$time 9/4" } - ^\markup { " " \musicglyph #"timesig-neo\_mensural9/4" } + ^\markup { " " \musicglyph #"timesig-neo_mensural9/4" } s s_\markup { "$\\backslash$time 9/8" } - ^\markup { " " \musicglyph #"timesig-neo\_mensural9/8" } + ^\markup { " " \musicglyph #"timesig-neo_mensural9/8" } \break s_\markup { "$\\backslash$time 4/8" } - ^\markup { " " \musicglyph #"timesig-neo\_mensural4/8" } + ^\markup { " " \musicglyph #"timesig-neo_mensural4/8" } s s_\markup { "$\\backslash$time 2/4" } - ^\markup { " " \musicglyph #"timesig-neo\_mensural2/4" } + ^\markup { " " \musicglyph #"timesig-neo_mensural2/4" } \break } \paper { diff --git a/buildscripts/mf-to-table.py b/buildscripts/mf-to-table.py index c3051019a0..3ad0c86bc2 100644 --- a/buildscripts/mf-to-table.py +++ b/buildscripts/mf-to-table.py @@ -169,13 +169,15 @@ def write_fontlist (file, global_info, charmetrics): count += 1 ## \musicglyph and \markup require "_" to be escaped differently: - musicglyphname=re.sub('_','\\\\_', m['name']) - markupname=re.sub('_','\\\\_', musicglyphname) + + scm_string = re.sub('_', r'_', m['name']) + tex_string = re.sub ('_', r'\\_' , m['name']) + ## prevent TeX from interpreting "--" as long dash: - markupname=re.sub('--','-{}-', markupname) + tex_string=re.sub('--','-{}-', tex_string) - file.write (' s^\\markup { \\musicglyph #"%s" "%s" }\n' % (musicglyphname, markupname)) + file.write (' s^\\markup { \\musicglyph #"%s" "%s" }\n' % (scm_string, tex_string)) if (count % 3) ==0: file.write (' \\break\n') diff --git a/lily/include/translator-def.hh b/lily/include/translator-def.hh index acc70202ca..ad47f9781c 100644 --- a/lily/include/translator-def.hh +++ b/lily/include/translator-def.hh @@ -1,5 +1,5 @@ /* - translator-def.hh -- declare Translator_def + translator-def.hh -- declare Context_def source file of the GNU LilyPond music typesetter @@ -18,7 +18,7 @@ The definition of a interpretation context as given in the input. The lists are stored in order of definition. */ -struct Translator_def : public Input +struct Context_def : public Input { private: /* @@ -42,7 +42,7 @@ public: SCM get_translator_names (SCM) const; void set_acceptor (SCM accepts, bool add); - Link_array path_to_acceptable_translator (SCM type_string, Music_output_def* odef) const; + Link_array path_to_acceptable_translator (SCM type_string, Music_output_def* odef) const; Translator_group * instantiate (Music_output_def*, SCM extra_ops); SCM to_alist () const; @@ -52,12 +52,12 @@ public: SCM clone_scm ()const; void apply_default_property_operations (Translator_group*); private: - DECLARE_SMOBS (Translator_def,foo); - Translator_def (); - Translator_def (Translator_def const&); + DECLARE_SMOBS (Context_def,foo); + Context_def (); + Context_def (Context_def const&); }; -DECLARE_UNSMOB(Translator_def,translator_def); +DECLARE_UNSMOB(Context_def,context_def); #endif /* TRANSLATOR_DEF_HH */ diff --git a/lily/include/translator-group.hh b/lily/include/translator-group.hh index 54e355692e..4a1a10c361 100644 --- a/lily/include/translator-group.hh +++ b/lily/include/translator-group.hh @@ -86,5 +86,6 @@ public: bool melisma_busy (Translator* tr); // where to put this? --hwn void apply_property_operations (Translator_group*tg, SCM pre_init_ops); +SCM names_to_translators (SCM namelist, Translator_group*tg); #endif // TRANSLATOR_GROUP_HH diff --git a/lily/include/translator.hh b/lily/include/translator.hh index e23b68d701..de045a56b3 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -70,8 +70,8 @@ private: protected: // should be private. SCM simple_trans_list_; - - // ugr. + friend class Context_def; + // ugir. // friend SCM Translator_group::get_simple_trans_list (); diff --git a/lily/instrument-name-engraver.cc b/lily/instrument-name-engraver.cc index 40dcbca846..254b4e7119 100644 --- a/lily/instrument-name-engraver.cc +++ b/lily/instrument-name-engraver.cc @@ -32,8 +32,6 @@ public: virtual void process_music (); }; - - Instrument_name_engraver::Instrument_name_engraver () { text_ = 0; diff --git a/lily/music-output-def.cc b/lily/music-output-def.cc index 56d6bf6ca8..dd07057161 100644 --- a/lily/music-output-def.cc +++ b/lily/music-output-def.cc @@ -70,7 +70,7 @@ Music_output_def::mark_smob (SCM m) void Music_output_def::assign_translator (SCM transdef) { - Translator_def *tp = unsmob_translator_def (transdef); + Context_def *tp = unsmob_context_def (transdef); assert (tp); translator_tab_->set (tp->get_context_name (), transdef); @@ -97,7 +97,7 @@ Global_translator * Music_output_def::get_global_translator () { SCM key = ly_symbol2scm ("Score"); - Translator_def * t = unsmob_translator_def (find_translator (key)); + Context_def * t = unsmob_context_def (find_translator (key)); if (!t) error (_f ("can't find `%s' context", "Score")); diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc index 86d7bc3fa9..f9f5127e70 100644 --- a/lily/my-lily-parser.cc +++ b/lily/my-lily-parser.cc @@ -132,7 +132,7 @@ My_lily_parser::paper_description () SCM l = SCM_EOL; for (SCM s = al ; gh_pair_p (s); s = ly_cdr (s)) { - Translator_def * td = unsmob_translator_def (ly_cdar (s)); + Context_def * td = unsmob_context_def (ly_cdar (s)); l = gh_cons (gh_cons (ly_caar (s), td->to_alist ()), l); } return l; diff --git a/lily/parser.yy b/lily/parser.yy index e9b33a4e0e..aee249d756 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -590,14 +590,14 @@ translator_spec_block: translator_spec_body: /**/ { $$ = Translator_def::make_scm (); - unsmob_translator_def ($$)->set_spot (THIS->here_input ()); + unsmob_context_def ($$)->set_spot (THIS->here_input ()); } | TRANSLATOR_IDENTIFIER { $$ = $1; - unsmob_translator_def ($$)->set_spot (THIS->here_input ()); + unsmob_context_def ($$)->set_spot (THIS->here_input ()); } | translator_spec_body GROBDESCRIPTIONS embedded_scm { - Translator_def*td = unsmob_translator_def($$); + Translator_def*td = unsmob_context_def($$); for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p)) { SCM tag = gh_caar (p); @@ -606,7 +606,7 @@ translator_spec_body: } } | translator_spec_body context_mod { - unsmob_translator_def ($$)->add_context_mod ($2); + unsmob_context_def ($$)->add_context_mod ($2); } ; @@ -2314,8 +2314,8 @@ My_lily_lexer::try_special_identifiers (SCM * destination, SCM sid) } else if (gh_number_p (sid)) { *destination = sid; return NUMBER_IDENTIFIER; - } else if (unsmob_translator_def (sid)) { - *destination = unsmob_translator_def (sid)->clone_scm(); + } else if (unsmob_context_def (sid)) { + *destination = unsmob_context_def (sid)->clone_scm(); return TRANSLATOR_IDENTIFIER; } else if (unsmob_score (sid)) { Score *sc = new Score (*unsmob_score (sid)); diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index 96968bd589..4876f374ee 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -101,7 +101,7 @@ Score_engraver::initialize () error (_f ("can't find `%s'", "feta20.afm") + "\n" +_ ("Fonts have not been installed properly. Aborting")); - unsmob_translator_def (definition_)->apply_default_property_operations (this); + unsmob_context_def (definition_)->apply_default_property_operations (this); assert (dynamic_cast (output_def_)); assert (!daddy_trans_); diff --git a/lily/score-performer.cc b/lily/score-performer.cc index 1c0af88cfc..c00f29ccc2 100644 --- a/lily/score-performer.cc +++ b/lily/score-performer.cc @@ -112,7 +112,7 @@ Score_performer::get_output () void Score_performer::initialize () { - unsmob_translator_def (definition_)->apply_default_property_operations (this); + unsmob_context_def (definition_)->apply_default_property_operations (this); assert (dynamic_cast (output_def_)); performance_ = new Performance; performance_->midi_ = dynamic_cast (output_def_); diff --git a/lily/simultaneous-music-iterator.cc b/lily/simultaneous-music-iterator.cc index 932d8e2f66..84008b6b11 100644 --- a/lily/simultaneous-music-iterator.cc +++ b/lily/simultaneous-music-iterator.cc @@ -77,7 +77,7 @@ 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_)->get_context_name (); + SCM name = unsmob_context_def (report_to ()->definition_)->get_context_name (); Translator_group * t = (j && separate_contexts_b_) ? report_to ()->find_create_translator (name, to_string (j), SCM_EOL) : report_to (); diff --git a/lily/translator-def.cc b/lily/translator-def.cc index abe16e0b69..d1b53ef096 100644 --- a/lily/translator-def.cc +++ b/lily/translator-def.cc @@ -1,5 +1,5 @@ /* - translator-def.cc -- implement Translator_def + translator-def.cc -- implement Context_def source file of the GNU LilyPond music typesetter @@ -15,11 +15,11 @@ #include "ly-smobs.icc" int -Translator_def::print_smob (SCM smob, SCM port, scm_print_state*) +Context_def::print_smob (SCM smob, SCM port, scm_print_state*) { - Translator_def* me = (Translator_def*) SCM_CELL_WORD_1 (smob); + Context_def* me = (Context_def*) SCM_CELL_WORD_1 (smob); - scm_puts ("#context_name_, port); scm_puts (">", port); return 1; @@ -27,9 +27,9 @@ Translator_def::print_smob (SCM smob, SCM port, scm_print_state*) SCM -Translator_def::mark_smob (SCM smob) +Context_def::mark_smob (SCM smob) { - Translator_def* me = (Translator_def*) SCM_CELL_WORD_1 (smob); + Context_def* me = (Context_def*) SCM_CELL_WORD_1 (smob); scm_gc_mark (me->description_); scm_gc_mark (me->context_aliases_); @@ -41,7 +41,7 @@ Translator_def::mark_smob (SCM smob) } -Translator_def::Translator_def () +Context_def::Context_def () { context_aliases_ = SCM_EOL; translator_group_type_ = SCM_EOL; @@ -54,11 +54,11 @@ Translator_def::Translator_def () smobify_self(); } -Translator_def::~Translator_def () +Context_def::~Context_def () { } -Translator_def::Translator_def (Translator_def const & s) +Context_def::Context_def (Context_def const & s) : Input (s) { context_aliases_ = SCM_EOL; @@ -82,7 +82,7 @@ Translator_def::Translator_def (Translator_def const & s) void -Translator_def::add_context_mod (SCM mod) +Context_def::add_context_mod (SCM mod) { SCM tag = gh_car (mod); if (ly_symbol2scm ("description") == tag) @@ -138,13 +138,13 @@ Translator_def::add_context_mod (SCM mod) SCM -Translator_def::get_context_name () const +Context_def::get_context_name () const { return context_name_; } SCM -Translator_def::get_accepted () const +Context_def::get_accepted () const { SCM correct_order = scm_reverse (accept_mods_); SCM acc = SCM_EOL; @@ -161,23 +161,23 @@ Translator_def::get_accepted () const } -Link_array -Translator_def::path_to_acceptable_translator (SCM type_sym, Music_output_def* odef) const +Link_array +Context_def::path_to_acceptable_translator (SCM type_sym, Music_output_def* odef) const { assert (gh_symbol_p (type_sym)); SCM accepted = get_accepted (); - Link_array accepteds; + Link_array accepteds; for (SCM s = accepted; gh_pair_p (s); s = ly_cdr (s)) { - Translator_def *t = unsmob_translator_def (odef->find_translator (ly_car (s))); + Context_def *t = unsmob_context_def (odef->find_translator (ly_car (s))); if (!t) continue; accepteds.push (t); } - Link_array best_result; + Link_array best_result; for (int i=0; i < accepteds.size (); i++) { /* @@ -193,9 +193,9 @@ Translator_def::path_to_acceptable_translator (SCM type_sym, Music_output_def* o int best_depth= INT_MAX; for (int i=0; i < accepteds.size (); i++) { - Translator_def * g = accepteds[i]; + Context_def * g = accepteds[i]; - Link_array result + Link_array result = g->path_to_acceptable_translator (type_sym, odef); if (result.size () && result.size () < best_depth) { @@ -213,14 +213,14 @@ Translator_def::path_to_acceptable_translator (SCM type_sym, Music_output_def* o return best_result; } -IMPLEMENT_SMOBS (Translator_def); -IMPLEMENT_DEFAULT_EQUAL_P (Translator_def); +IMPLEMENT_SMOBS (Context_def); +IMPLEMENT_DEFAULT_EQUAL_P (Context_def); SCM -Translator_def::get_translator_names (SCM user_mod) const +Context_def::get_translator_names (SCM user_mod) const { SCM l1 = SCM_EOL; SCM l2 = SCM_EOL; @@ -252,7 +252,7 @@ Translator_def::get_translator_names (SCM user_mod) const Translator_group * -Translator_def::instantiate (Music_output_def* md, SCM ops) +Context_def::instantiate (Music_output_def* md, SCM ops) { Translator * g = get_translator (translator_group_type_); g = g->clone (); @@ -261,22 +261,25 @@ Translator_def::instantiate (Music_output_def* md, SCM ops) tg->output_def_ = md; tg->definition_ = self_scm (); + SCM trans_names = get_translator_names (ops); + tg->simple_trans_list_ = names_to_translators (trans_names); + return tg; } SCM -Translator_def::clone_scm () const +Context_def::clone_scm () const { - Translator_def * t = new Translator_def (*this); + Context_def * t = new Context_def (*this); scm_gc_unprotect_object (t->self_scm()); return t->self_scm(); } SCM -Translator_def::make_scm () +Context_def::make_scm () { - Translator_def* t = new Translator_def; + Context_def* t = new Context_def; scm_gc_unprotect_object (t->self_scm()); return t->self_scm(); } @@ -287,19 +290,19 @@ Translator_def::make_scm () none. */ SCM -Translator_def::default_child_context_name () +Context_def::default_child_context_name () { SCM d = get_accepted (); return gh_pair_p (d) ? ly_car (scm_last_pair (d)) : SCM_EOL; } void -Translator_def::apply_default_property_operations (Translator_group *tg) +Context_def::apply_default_property_operations (Translator_group *tg) { apply_property_operations (tg , property_ops_); } SCM -Translator_def::to_alist () const +Context_def::to_alist () const { SCM l = SCM_EOL; @@ -316,7 +319,7 @@ Translator_def::to_alist () const } bool -Translator_def::is_alias (SCM sym) const +Context_def::is_alias (SCM sym) const { bool b = sym == context_name_; diff --git a/lily/translator-group.cc b/lily/translator-group.cc index a81f9f1d5a..118bb76488 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -89,10 +89,8 @@ void Translator_group::add_fresh_group_translator (Translator*t) { Translator_group*tg = dynamic_cast (t); - trans_group_list_ = add_translator (trans_group_list_,t); - - Translator_def * td = unsmob_translator_def (tg->definition_); + Context_def * td = unsmob_context_def (tg->definition_); /* this can not move before add_translator(), because \override @@ -103,7 +101,6 @@ Translator_group::add_fresh_group_translator (Translator*t) t->initialize (); } - bool Translator_group::is_removable () const { @@ -121,8 +118,7 @@ Translator_group::find_existing_translator (SCM n, String id) { Translator * t = unsmob_translator (ly_car (p)); - r = dynamic_cast (t)->find_existing_translator (n, id); - } + r = dynamic_cast (t)->find_existing_translator (n, id); } return r; } @@ -135,8 +131,8 @@ Translator_group::find_create_translator (SCM n, String id, SCM operations) if (existing) return existing; - Link_array path - = unsmob_translator_def (definition_)->path_to_acceptable_translator (n, get_output_def ()); + Link_array path + = unsmob_context_def (definition_)->path_to_acceptable_translator (n, get_output_def ()); if (path.size ()) { @@ -228,7 +224,7 @@ Translator_group::remove_translator (Translator*trans) bool Translator_group::is_bottom_translator_b () const { - return !gh_symbol_p (unsmob_translator_def (definition_)->default_child_context_name ()); + return !gh_symbol_p (unsmob_context_def (definition_)->default_child_context_name ()); } Translator_group* @@ -236,14 +232,14 @@ Translator_group::get_default_interpreter () { if (!is_bottom_translator_b ()) { - SCM nm = unsmob_translator_def (definition_)->default_child_context_name (); + SCM nm = unsmob_context_def (definition_)->default_child_context_name (); SCM st = get_output_def ()->find_translator (nm); - Translator_def *t = unsmob_translator_def (st); + Context_def *t = unsmob_context_def (st); if (!t) { warning (_f ("can't find or create: `%s'", ly_symbol2string (nm).to_str0 ())); - t = unsmob_translator_def (this->definition_); + t = unsmob_context_def (this->definition_); } Translator_group *tg = t->instantiate (output_def_, SCM_EOL); add_fresh_group_translator (tg); @@ -404,7 +400,7 @@ Translator_group::initialize () { SCM tab = scm_make_vector (gh_int2scm (19), SCM_BOOL_F); set_property ("acceptHashTable", tab); - static_each (trans_group_list_, &Translator::initialize); + each (&Translator::initialize); } void @@ -477,7 +473,7 @@ Translator_group::properties_as_alist () const String Translator_group::context_name () const { - Translator_def * td = unsmob_translator_def (definition_ ); + Context_def * td = unsmob_context_def (definition_ ); return ly_symbol2string (td->get_context_name ()); } @@ -536,10 +532,13 @@ names_to_translators (SCM namelist, Translator_group*tg) SCM Translator_group::get_simple_trans_list () { + return simple_trans_list_; + +#if 0 if (simple_trans_list_ != SCM_BOOL_F) return simple_trans_list_; - Translator_def * td = unsmob_translator_def (definition_); + Context_def * td = unsmob_context_def (definition_); /* The following cannot work, since start_translation_timestep () @@ -547,10 +546,11 @@ Translator_group::get_simple_trans_list () \property Voice.Voice =#'() */ + trans_names = td->get_translator_names (SCM_EOL); + SCM trans_names = internal_get_property (td->get_context_name ()); if (!gh_pair_p (trans_names)) { - trans_names = td->get_translator_names (SCM_EOL); } simple_trans_list_ = names_to_translators (trans_names, this); @@ -558,4 +558,5 @@ Translator_group::get_simple_trans_list () static_each (simple_trans_list_, &Translator::initialize); return simple_trans_list_; +#endif } diff --git a/lily/translator-scheme.cc b/lily/translator-scheme.cc index 8e3a7f7697..b387276157 100644 --- a/lily/translator-scheme.cc +++ b/lily/translator-scheme.cc @@ -196,7 +196,7 @@ Translator::print_smob (SCM s, SCM port, scm_print_state *) Translator *sc = (Translator *) ly_cdr (s); scm_puts ("#definition_)) + if (Context_def *d=unsmob_context_def (sc->definition_)) { scm_display (d->get_context_name (), port); } diff --git a/lily/translator.cc b/lily/translator.cc index 90cf7f7e34..aac514c3a1 100644 --- a/lily/translator.cc +++ b/lily/translator.cc @@ -50,7 +50,7 @@ Translator::Translator (Translator const &s) bool Translator::is_alias (SCM sym) const { - return unsmob_translator_def (definition_)->is_alias (sym); + return unsmob_context_def (definition_)->is_alias (sym); } bool diff --git a/scm/to-xml.scm b/scm/to-xml.scm index b53b2f5e5f..0e6bd24ae6 100644 --- a/scm/to-xml.scm +++ b/scm/to-xml.scm @@ -12,7 +12,7 @@ That is much cleaner: building the document, and dumping it to output is then separated. - foo = \score { ... } + foo = \\score { ... } #(as-xml foo)