From: Han-Wen Nienhuys Date: Thu, 8 Jan 2004 16:09:36 +0000 (+0000) Subject: * lily/translator-def.cc (get_translator_names): new function X-Git-Tag: release/2.1.23~267 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d02fb0875e52111272553a47e657b6f58e136e22;p=lilypond.git * lily/translator-def.cc (get_translator_names): new function (add_context_mod): new function (get_accepted): new function * lily/parser.yy (context_mod): put all modifications of \translator { } in a single production, encode as SCM. * lily/translator-def.cc (add_context_mod): rewrite Translator_def to use read-only lists, so additions to the definition can be prepended easily. * Documentation/user/invoking.itexi (Editor support): add node on editor support. * Documentation/user/refman.itely (Bar check): add lyrics example of bar checks. * input/mutopia/F.Schubert/morgenlied.ly: add bar checks. * scripts/convert-ly.py (conv): add conversion rule. * lily/parser.yy: use \change iso. \translator for staff switch. * lily/my-lily-lexer.cc: add \change. * scm/define-translator-properties.scm (default-melisma-properties): add definition. --- diff --git a/ChangeLog b/ChangeLog index 8374433d51..6e25639ec9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,38 @@ +2004-01-08 Han-Wen Nienhuys + + * lily/translator-def.cc (get_translator_names): new function + (add_context_mod): new function + (get_accepted): new function + + * lily/parser.yy (context_mod): put all modifications of + \translator { } in a single production, encode as SCM. + + * lily/translator-def.cc (add_context_mod): rewrite Translator_def + to use read-only lists, so additions to the definition can be + prepended easily. + + * Documentation/user/invoking.itexi (Editor support): add node on + editor support. + + * Documentation/user/refman.itely (Bar check): add lyrics example + of bar checks. + + * input/mutopia/F.Schubert/morgenlied.ly: add bar checks. + + * scripts/convert-ly.py (conv): add conversion rule. + + * lily/parser.yy: use \change iso. \translator for staff switch. + + * lily/my-lily-lexer.cc: add \change. + + * scm/define-translator-properties.scm + (default-melisma-properties): add definition. + 2004-01-07 Han-Wen Nienhuys + * Documentation/user/refman.itely (Bar lines): clarification of + systemStartDelimiter. + * input/test/slur-shape.ly (x): remove file. * lily/translator-group.cc (apply_property_operations): new function. @@ -304,7 +337,7 @@ use -n for head/tail commands. * lily/tie-engraver.cc (acknowledge_grob): make ties only for note - heads with the same pitch. (backportme) + heads with the same pitch. 2003-12-20 Han-Wen Nienhuys diff --git a/Documentation/user/introduction.itely b/Documentation/user/introduction.itely index 098aa29173..545ff28e7b 100644 --- a/Documentation/user/introduction.itely +++ b/Documentation/user/introduction.itely @@ -630,8 +630,8 @@ how to upgrade input files from previous versions of LilyPond. Once you are an experienced user, you can use the manual as reference: there is an extensive index@footnote{If you are looking for something, -and you cannot find it by using the index, that is considered a bug. -In that case, please file a bug report.}, but the document is also +and you cannot find it in the manual, that is considered a bug. In +that case, please file a bug report.}, but the document is also available in @ifnothtml a big HTML page, diff --git a/Documentation/user/invoking.itexi b/Documentation/user/invoking.itexi index cc7079a4f4..12bbfb7481 100644 --- a/Documentation/user/invoking.itexi +++ b/Documentation/user/invoking.itexi @@ -10,6 +10,7 @@ This chapter details the technicalities of running LilyPond. * Invoking the lilypond binary:: * Error messages:: * Reporting bugs:: +* Editor support:: * Point and click:: @end menu @@ -465,6 +466,40 @@ problem. Don't forget to tell which version you use, and on which platform you run it. Send the report to @email{bug-lilypond@@gnu.org}. +@node Editor support +@section Editor support + +@cindex editors +@cindex vim +@cindex emacs +@cindex modes, editor +@cindex syntax coloring +@cindex coloring, syntax + +There is support from different editors for LilyPond. + +Emacs has a @file{lilypond-mode}, which provides keyword +autocompletion, indentation, LilyPond specific parenthesis matching +and syntax coloring, handy compile short-cuts and reading LilyPond +manuals using Info. If lilypond-mode is not installed on your +platform, then refer to the installation instructions for more +information. + +For VIM, a vimrc is supplied, along with syntax coloring tools. For +more information, refer to the +@ifhtml +@uref{../../../topdocs/out-www/INSTALL.html,installation instructions}. +@end ifhtml + +@ifnothtml +installation instructions. +@end ifnothtml + +For both editors, there is also a facility to jump in the input file +to the source of errors in the graphical output. See @ref{Point and +click}. + + @node Point and click @section Point and click @cindex poind and click @@ -480,9 +515,9 @@ To use it, you need the following software: @item Xdvi, version 22.36 or newer. Available from @uref{ftp://ftp.math.berkeley.edu/pub/Software/TeX/xdvi.tar.gz,ftp.math.berkeley.edu}. - Most @TeX{} distributions ship with xdvik, which is always - a few versions behind the official Xdvi. To find out which Xdvi you - are running, try @code{xdvi -version} or @code{xdvi.bin -version}. + Most @TeX{} distributions ship with xdvik, which is always a few +versions behind the official Xdvi. To find out which Xdvi you are +running, try @code{xdvi -version} or @code{xdvi.bin -version}. @item KDVI. A dvi viewer for KDE. You need KDVI from KDE 3.0 or newer. Enable option @emph{Inverse search} in the menu @emph{Settings}. @@ -508,12 +543,6 @@ column location. @c move this elsewhere? -There is also support for Emacs: lilypond-mode for Emacs provides -keyword autocompletion, indentation, LilyPond specific parenthesis -matching and syntax coloring, handy compile short-cuts and reading -LilyPond manuals using Info. If lilypond-mode is not installed on -your platform, then refer to the installation instructions for more -information. @cindex Emacs @cindex Emacs mode diff --git a/Documentation/user/macros.itexi b/Documentation/user/macros.itexi index 794cbbdc84..c0000cc179 100644 --- a/Documentation/user/macros.itexi +++ b/Documentation/user/macros.itexi @@ -93,7 +93,7 @@ $\\flat$% @cindex \NAME\@c @end macro -@macro inputfileref{DIR,NAME}i +@macro inputfileref{DIR,NAME} @file{\DIR\/\NAME\} @end macro diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index 8f96a33991..dcd20b587f 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -673,8 +673,6 @@ be deleted without changing the meaning of the piece. } @end lilypond - - @node Bar check @subsection Bar check @cindex Bar check @@ -695,6 +693,14 @@ In the next example, the second bar check will signal an error: \time 3/4 c2 e4 | g2 | @end example +Bar checks can also be used in lyrics, for example + +@example + \lyrics @{ + \time 2/4 + Twin -- kle | Twin -- kle + @} +@end example @cindex skipTypesetting @@ -1181,8 +1187,12 @@ are called @internalsref{BarLine}, the bar lines that span staves are The barlines at the start of each system are @internalsref{SystemStartBar}, @internalsref{SystemStartBrace}, and -@internalsref{SystemStartBracket}. They are spanner objects and -typically must be tuned from a @code{\translator} block. +@internalsref{SystemStartBracket}. Only one of these types is created +in every context, and that type is determined by the property +@code{systemStartDelimiter}. They are spanner objects and therefore +the objects, as well as @code{systemStartDelimiter} must be set from a +@code{\translator} block (see @ref{Defining contexts}) or using +@code{\with} (see @code{Tuning spanning contexts}). @node Polyphony @@ -2508,6 +2518,7 @@ used to typeset two lines of lyrics in songs with repeats, see @inputfileref{input,star-spangled-banner.ly}. @end ignore +@c tremolo, beamed @item tremolo Make tremolo beams. @@ -2650,28 +2661,35 @@ alphabetic characters. Or, To place tremolo marks between notes, use @code{\repeat} with tremolo style: -@lilypond[verbatim,center,singleline] +@lilypond[verbatim,singleline] \score { \context Voice \notes\relative c' { \repeat "tremolo" 8 { c16 d16 } \repeat "tremolo" 4 { c16 d16 } \repeat "tremolo" 2 { c16 d16 } - \repeat "tremolo" 4 c16 } } @end lilypond -@seealso +Tremolo marks can also be put on a single note. In this case, the +note should not be surrounded by braces. +@lilypond[verbatim,singleline] + \repeat "tremolo" 4 c16 +@end lilypond -Tremolo beams are @internalsref{Beam} objects. Single stem tremolos -are @internalsref{StemTremolo}s. The music expression is -@internalsref{TremoloEvent}. +A similar mechanism is the tremolo subdivision, described in +@ref{Tremolo subdivisions}. +@seealso -@refbugs +In this manual: @ref{Tremolo subdivisions}, @ref{Repeats}. -The single stem tremolo must be entered without @code{@{} and -@code{@}}. +Internals: tremolo beams are @internalsref{Beam} objects. Single stem +tremolos are @internalsref{StemTremolo}s. The music expression is +@internalsref{TremoloEvent}, + +Example files: @inputfileref{input/regression,chord-tremolo.ly}, +@inputfileref{input/regression,stem-tremolo.ly}. @node Tremolo subdivisions @subsection Tremolo subdivisions @@ -2694,6 +2712,11 @@ length is omitted, then then the last value (stored in Tremolos in this style do not carry over into the MIDI output. +@seealso + +In this manual: @ref{Tremolo repeats}. + +Elsewhere: @internalsref{StemTremolo}, @internalsref{TremoloEvent}. @node Measure repeats @subsection Measure repeats @@ -3126,7 +3149,7 @@ quality output, staff switches should be specified manually. Voices can be switched between staves manually, using the following command: @example - \translator Staff = @var{staffname} @var{music} + \change Staff = @var{staffname} @var{music} @end example @noindent @@ -3290,7 +3313,7 @@ can be printed automatically. This is enabled if the property \property PianoStaff.followVoice = ##t \context Staff \context Voice { c1 - \translator Staff=two + \change Staff=two b2 a } \context Staff=two { \clef bass \skip 1*2 } @@ -3718,10 +3741,8 @@ chord. @cindex Non-guitar tablatures You can change the number of strings, by setting the number of lines -in the @internalsref{TabStaff} (the @code{line-count} property of -@internalsref{TabStaff} can only be changed using -@code{\applyoutput}, for more information, see @ref{Tuning -objects}). +in the @internalsref{TabStaff}. For more information, see @ref{Tuning +spanning contexts}). You can change the tuning of the strings. A string tuning is given as a Scheme list with one integer number for each string, the number diff --git a/input/mutopia/F.Schubert/morgenlied.ly b/input/mutopia/F.Schubert/morgenlied.ly index 012c8c3cc9..49af8024c2 100644 --- a/input/mutopia/F.Schubert/morgenlied.ly +++ b/input/mutopia/F.Schubert/morgenlied.ly @@ -74,18 +74,19 @@ melody = \notes \relative c'' \repeat volta 2 \context Voice = singer { firstVerse = \lyrics { \property LyricsVoice . stanza = "1." - Sü -- ßes Licht! Aus gol -- de -- nen Pfor -- ten brichst du __ \manuscriptBreak - sie -- gend durch __ die Nacht. Schö -- ner Tag, du __ bist er -- wacht. __ Mit \manuscriptBreak - ge -- heim -- nis -- vol -- len Wor -- ten, in me -- lo -- di -- schen Ak -- kor -- den, grüß __ ich __ \manuscriptBreak + Sü -- ßes Licht! Aus gol -- de -- nen Pfor -- ten brichst du __ \manuscriptBreak | + sie -- gend durch __ die Nacht. Schö -- ner Tag, du __ bist er -- wacht. __ Mit ge -- | + \manuscriptBreak + heim -- nis -- vol -- len Wor -- ten, in me -- lo -- di -- schen Ak -- kor -- den, grüß __ ich __ \manuscriptBreak | dei -- ne Ro -- sen -- pracht, grüß ich __ dei -- ne Ro -- sen -- pracht. } secondVerse = \lyrics { \property LyricsVoice . stanza = "2." - Ach, der Lie -- be sanf "" -- tes We -- hen schwellt mir - das be -- weg -- te __ Herz, sanft, wie ein ge -- lieb -- ter Schmerz. __ Dürft ich - nur auf gold -- nen Hö -- hen mich im Mor -- gen -- duft er -- ge -- hen! Sehn -- sucht + Ach, der Lie -- be sanf "" -- tes We -- hen schwellt mir | + das be -- weg -- te __ Herz, sanft, wie ein ge -- lieb -- ter Schmerz. __ Dürft ich | + nur auf gold -- nen Hö -- hen mich im Mor -- gen -- duft er -- ge -- hen! Sehn -- sucht | zieht mich him -- mel -- wärts, Sehn -- sucht zieht mich him -- mel -- wärts. } diff --git a/input/regression/beam-cross-staff.ly b/input/regression/beam-cross-staff.ly index f9d9794fbf..9173d6b33f 100644 --- a/input/regression/beam-cross-staff.ly +++ b/input/regression/beam-cross-staff.ly @@ -1,5 +1,5 @@ -\version "1.9.8" +\version "2.1.7" \header{ texidoc=" Beams can be typeset over fixed distance aligned staves, beam @@ -10,15 +10,15 @@ behave well, wherever the switching point is. \score{ \context PianoStaff << \context Staff=one \notes\relative c'{ - \stemUp c8[ c \translator Staff=two \stemUp c c] + \stemUp c8[ c \change Staff=two \stemUp c c] c[ c c c] - \translator Staff=one - \stemDown c8[ c \translator Staff=two \stemUp c c] + \change Staff=one + \stemDown c8[ c \change Staff=two \stemUp c c] r2 - \stemDown c8[ c \translator Staff=one \stemDown c c] + \stemDown c8[ c \change Staff=one \stemDown c c] r2 - \translator Staff=two - \stemUp c8[ c \translator Staff=one \stemDown c c] + \change Staff=two + \stemUp c8[ c \change Staff=one \stemDown c c] r2 } \context Staff=two \notes\relative c'{ diff --git a/input/regression/chord-tremolo.ly b/input/regression/chord-tremolo.ly index c8b2b192d7..8f2d1f5a7e 100644 --- a/input/regression/chord-tremolo.ly +++ b/input/regression/chord-tremolo.ly @@ -1,4 +1,3 @@ -#(ly:set-option 'old-relative) \version "1.9.8" \header{ diff --git a/lily/dot-column.cc b/lily/dot-column.cc index cd95dfc039..beff0f4f0f 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -293,5 +293,5 @@ Dot_column::add_head (Grob * me, Grob *rh) ADD_INTERFACE (Dot_column, "dot-column-interface", "Interface that groups dots so they form a column", - "direction stem"); + "collision-done direction stem"); diff --git a/lily/include/translator-change.hh b/lily/include/translator-change.hh index 5dd368fe63..65296f8106 100644 --- a/lily/include/translator-change.hh +++ b/lily/include/translator-change.hh @@ -1,21 +1,2 @@ -/* - translator-change.hh -- declare Translator_change - source file of the GNU LilyPond music typesetter - - (c) 1997--2003 Han-Wen Nienhuys -*/ - - -#ifndef TRANSLATOR_CHANGE_HH -#define TRANSLATOR_CHANGE_HH - -/** Change the nesting of the current translation. Uses the type_string_ - and id_string_ differently. - */ -class Translator_change : public Music -{ - -} - -#endif // TRANSLATOR_CHANGE_HH +#error diff --git a/lily/include/translator-def.hh b/lily/include/translator-def.hh index 167cf28551..bb641d5bf5 100644 --- a/lily/include/translator-def.hh +++ b/lily/include/translator-def.hh @@ -24,46 +24,36 @@ private: /* these lists store the definition, in opposite order of entry */ - - SCM consists_name_list_; - SCM end_consists_name_list_; - SCM accepts_name_list_; + SCM translator_mods_; + SCM accept_mods_; SCM property_ops_; -public: SCM description_; - /* - "type" is overloaded. - */ - SCM type_name_; - SCM type_aliases_; + SCM context_name_; + SCM context_aliases_; SCM translator_group_type_; - - SCM modify_definition (SCM, SCM, bool); - SCM default_child_context_name (); +public: + void add_context_mod (SCM); + SCM default_child_context_name (); + SCM get_context_name () const; + SCM get_accepted () const; + SCM get_translator_names () const; void set_acceptor (SCM accepts, bool add); - void add_element (SCM name); - void remove_element (SCM name); - void add_last_element (SCM name); - void add_property_operation (SCM); Link_array path_to_acceptable_translator (SCM type_string, Music_output_def* odef) const; Translator_group * instantiate (Music_output_def*); SCM to_alist () const; - + bool is_alias (SCM) const; static SCM make_scm () ; 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_UNSMOB(Translator_def,translator_def); diff --git a/lily/include/translator.hh b/lily/include/translator.hh index ae0109329b..9cb6e7c171 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -128,6 +128,6 @@ classname::static_translator_description () const \ void add_translator (Translator*trans); -Translator*get_translator (String s); +Translator*get_translator (SCM s); DECLARE_UNSMOB(Translator,translator); #endif // TRANSLATOR_HH diff --git a/lily/music-output-def.cc b/lily/music-output-def.cc index e7b012e203..d13d5ec76a 100644 --- a/lily/music-output-def.cc +++ b/lily/music-output-def.cc @@ -73,9 +73,9 @@ Music_output_def::assign_translator (SCM transdef) Translator_def *tp = unsmob_translator_def (transdef); assert (tp); - translator_tab_->set (tp->type_name_, transdef); + translator_tab_->set (tp->get_context_name (), transdef); - String nm = ly_symbol2string (tp->type_name_) + "Context"; + String nm = ly_symbol2string (tp->get_context_name ()) + "Context"; scm_module_define (scope_, ly_symbol2scm (nm.to_str0()), transdef); diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index b631fe6be7..43b5a5cc18 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -38,6 +38,7 @@ static Keyword_ent the_key_tab[]={ {"autochange", AUTOCHANGE}, {"bar", BAR}, {"breathe", BREATHE}, + {"change", CHANGE}, {"chordmodifiers", CHORDMODIFIERS}, {"chords", CHORDS}, {"clef", CLEF}, diff --git a/lily/parser.yy b/lily/parser.yy index cac1751847..86a4b070e3 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -86,7 +86,7 @@ TODO: Music *property_op_to_music (SCM op); Music *context_spec_music (SCM type, SCM id, Music * m, SCM ops_); - +SCM get_next_unique_context (); #define YYERROR_VERBOSE 1 @@ -246,6 +246,7 @@ yylex (YYSTYPE *s, void * v) %token AUTOCHANGE %token BAR %token BREATHE +%token CHANGE %token CHORDMODIFIERS %token CHORDS %token LESSLESS @@ -315,7 +316,7 @@ yylex (YYSTYPE *s, void * v) %type exclamations questions dots optional_rest %type bass_mod %type grace_head -%type prop_ops_body optional_prop_ops +%type property_operation_list %type lyric_element %type bass_number br_bass_figure bass_figure figure_list figure_spec %token DIGIT @@ -380,8 +381,9 @@ yylex (YYSTYPE *s, void * v) %type embedded_scm scalar %type Music Sequential_music Simultaneous_music %type relative_music re_rhythmed_music part_combined_music -%type music_property_def translator_change -%type Music_list property_operation +%type music_property_def context_change +%type Music_list +%type property_operation context_mod translator_mod %type music_output_def_body %type shorthand_command_req %type post_event tagged_post_event @@ -594,49 +596,19 @@ translator_spec_body: } | TRANSLATOR_IDENTIFIER { $$ = $1; - unsmob_translator_def ($$)-> set_spot (THIS->here_input ()); - } - | translator_spec_body TYPE STRING { - unsmob_translator_def ($$)->translator_group_type_ = $3; - } - | translator_spec_body DESCRIPTION string { - unsmob_translator_def ($$)->description_ = $3; - } - | translator_spec_body property_operation { - unsmob_translator_def ($$)->add_property_operation ($2); - } - | translator_spec_body NAME STRING { - unsmob_translator_def ($$)->type_name_ = scm_string_to_symbol ($3); - } - | translator_spec_body CONSISTS STRING { - unsmob_translator_def ($$)->add_element ($3); - } - | translator_spec_body ALIAS STRING { - Translator_def*td = unsmob_translator_def ($$); - td->type_aliases_ = scm_cons (scm_string_to_symbol ($3), td->type_aliases_); + unsmob_translator_def ($$)->set_spot (THIS->here_input ()); } | translator_spec_body GROBDESCRIPTIONS embedded_scm { Translator_def*td = unsmob_translator_def($$); for (SCM p = $3; gh_pair_p (p); p = ly_cdr (p)) { SCM tag = gh_caar (p); - if (tag == ly_symbol2scm ("poppush")) - tag = ly_symbol2scm ("push"); - td->add_property_operation (scm_list_n (ly_symbol2scm ("assign"), + td->add_context_mod (scm_list_n (ly_symbol2scm ("assign"), tag, ly_cdar (p), SCM_UNDEFINED)); } } - | translator_spec_body CONSISTSEND STRING { - unsmob_translator_def ($$)->add_last_element ( $3); - } - | translator_spec_body ACCEPTS STRING { - unsmob_translator_def ($$)->set_acceptor (scm_string_to_symbol ($3), true); - } - | translator_spec_body DENIES STRING { - unsmob_translator_def ($$)->set_acceptor (scm_string_to_symbol ($3), false); - } - | translator_spec_body REMOVE STRING { - unsmob_translator_def ($$)->remove_element ($3); + | translator_spec_body context_mod { + unsmob_translator_def ($$)->add_context_mod ($2); } ; @@ -912,7 +884,7 @@ Simple_music: $$ = unsmob_music ($1); } | music_property_def - | translator_change + | context_change ; @@ -922,22 +894,12 @@ grace_head: | APPOGGIATURA { $$ = scm_makfrom0str ("Appoggiatura"); } ; -optional_prop_ops: - /* */ { - $$ = SCM_EOL; - } - | WITH '{' prop_ops_body '}' { - $$ = $3; - } - ; - -prop_ops_body: +property_operation_list: /* */ { $$ = SCM_EOL; } - | prop_ops_body property_operation { + | property_operation_list property_operation { $$ = gh_cons ($2, $1); } ; - Composite_music: AUTOCHANGE STRING Music { @@ -1002,21 +964,25 @@ basic music objects too, since the meaning is different. scm_gc_unprotect_object ($2->self_scm ()); #endif } - | CONTEXT string '=' string optional_prop_ops Music { - $$ = context_spec_music ($2, $4, $6, $5); + | CONTEXT string '=' string Music { + $$ = context_spec_music ($2, $4, $5, SCM_EOL); } - | CONTEXT STRING optional_prop_ops Music { - $$ = context_spec_music ($2, SCM_UNDEFINED, $4, $3); + | CONTEXT STRING Music { + $$ = context_spec_music ($2, SCM_UNDEFINED, $3, SCM_EOL); } - | NEWCONTEXT string optional_prop_ops Music { - static int new_context_count; - - char s[1024]; - snprintf (s, 1024, "uniqueContext%d", new_context_count ++); + | NEWCONTEXT string Music { + $$ = context_spec_music ($2, get_next_unique_context (), + $3, SCM_EOL); + } + | TRANSLATOR string '{' property_operation_list '}' Music { + $$ = context_spec_music ($2, get_next_unique_context (), + $6, $4); - SCM new_id = scm_makfrom0str (s); - $$ = context_spec_music ($2, new_id, $4, $3); + } + | TRANSLATOR string '=' string '{' property_operation_list '}' Music { + $$ = context_spec_music ($2, $4, + $8, $6); } | TIMES { THIS->push_spot (); @@ -1151,8 +1117,8 @@ part_combined_music: } ; -translator_change: - TRANSLATOR STRING '=' STRING { +context_change: + CHANGE STRING '=' STRING { Music*t= MY_MAKE_MUSIC("TranslatorChange"); t-> set_mus_property ("change-to-type", scm_string_to_symbol ($2)); t-> set_mus_property ("change-to-id", $4); @@ -1162,8 +1128,6 @@ translator_change: } ; - - property_operation: STRING '=' scalar { $$ = scm_list_n (ly_symbol2scm ("assign"), @@ -1187,12 +1151,33 @@ property_operation: } ; +translator_mod: + CONSISTSEND { $$ = ly_symbol2scm ("consists-end"); } + | CONSISTS { $$ = ly_symbol2scm ("consists"); } + | REMOVE { $$ = ly_symbol2scm ("remove"); } + + | ACCEPTS { $$ = ly_symbol2scm ("accepts"); } + | DENIES { $$ = ly_symbol2scm ("denies"); } + + | ALIAS { $$ = ly_symbol2scm ("alias"); } + | TYPE { $$ = ly_symbol2scm ("translator-type"); } + | DESCRIPTION { $$ = ly_symbol2scm ("description"); } + | NAME { $$ = ly_symbol2scm ("context-name"); } + ; + +context_mod: + property_operation { $$ = $1; } + | translator_mod STRING { + $$ = scm_list_n ($1, $2, SCM_UNDEFINED); + } + ; + music_property_def: PROPERTY STRING '.' property_operation { Music * t = property_op_to_music ($4); Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic"); - csm->set_mus_property ("element", t->self_scm ()); + csm->set_mus_property ("element", t->self_scm ()); scm_gc_unprotect_object (t->self_scm ()); $$ = csm; @@ -1216,8 +1201,6 @@ scalar: | DIGIT { $$ = gh_int2scm ($1); } ; - - /* This is a trick: @@ -1548,11 +1531,13 @@ configurable, i.e. } | close_event { $$ = $1; - dynamic_cast ($$)->set_mus_property ("span-direction", gh_int2scm (START)); + dynamic_cast ($$)->set_mus_property ("span-direction", + gh_int2scm (START)); } | open_event { $$ = $1; - dynamic_cast ($$)->set_mus_property ("span-direction", gh_int2scm (STOP)); + dynamic_cast ($$)->set_mus_property ("span-direction", + gh_int2scm (STOP)); } | EVENT_IDENTIFIER { $$ = unsmob_music ($1); @@ -1645,10 +1630,6 @@ pitch_also_in_chords: | steno_tonic_pitch ; - - - - hyphen_req: HYPHEN { if (!THIS->lexer_->lyric_state_b ()) @@ -2441,3 +2422,14 @@ context_spec_music (SCM type, SCM id, Music * m, SCM ops) return csm; } + +SCM +get_next_unique_context () +{ + static int new_context_count; + + char s[1024]; + snprintf (s, 1024, "uniqueContext%d", new_context_count ++); + + return scm_makfrom0str (s); +} diff --git a/lily/simultaneous-music-iterator.cc b/lily/simultaneous-music-iterator.cc index c59cab4cae..932d8e2f66 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_)->type_name_; + SCM name = unsmob_translator_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-ctors.cc b/lily/translator-ctors.cc index 9eb51e7c68..783c39698b 100644 --- a/lily/translator-ctors.cc +++ b/lily/translator-ctors.cc @@ -7,25 +7,26 @@ */ #include "translator.hh" -#include +#include "scm-hash.hh" #include "warn.hh" /* should delete these after exit. */ -std::map *global_translator_dict=0; +Scheme_hash_table *global_translator_dict=0; LY_DEFINE(get_all_translators,"ly:get-all-translators", 0, 0, 0, (), "Return an list of a all translator objects that may be instantiated " " during a lilypond run.") { - SCM l = SCM_EOL; - for (std::map::const_iterator (ci (global_translator_dict->begin())); - ci != global_translator_dict->end (); ci++) + SCM l = global_translator_dict ? global_translator_dict->to_alist () : SCM_EOL; + + for (SCM s =l; gh_pair_p (s); s = gh_cdr (s)) { - l = scm_cons ((*ci).second->self_scm (), l); + gh_set_car_x (s, gh_cdar (s)); } + return l; } @@ -33,22 +34,22 @@ void add_translator (Translator *t) { if (!global_translator_dict) - global_translator_dict = new std::map; + global_translator_dict = new Scheme_hash_table; - (*global_translator_dict)[classname (t)] = t; + SCM k= ly_symbol2scm (classname (t)); + global_translator_dict->set (k, t->self_scm ()); } Translator* -get_translator (String s) +get_translator (SCM sym) { - if (global_translator_dict->find (s) != - global_translator_dict->end ()) - { - Translator* t = (*global_translator_dict)[s]; - return t; - } + SCM v = SCM_BOOL_F; + if (global_translator_dict) + global_translator_dict->try_retrieve (sym, &v); + + if (v == SCM_BOOL_F) + error (_f ("unknown translator: `%s'", ly_symbol2string (sym).to_str0 ())); - error (_f ("unknown translator: `%s'", s)); - return 0; + return unsmob_translator (v); } diff --git a/lily/translator-def.cc b/lily/translator-def.cc index 3873850d01..1386d0bdd7 100644 --- a/lily/translator-def.cc +++ b/lily/translator-def.cc @@ -20,7 +20,7 @@ Translator_def::print_smob (SCM smob, SCM port, scm_print_state*) Translator_def* me = (Translator_def*) SCM_CELL_WORD_1 (smob); scm_puts ("#type_name_, port); + scm_display (me->context_name_, port); scm_puts (">", port); return 1; } @@ -32,25 +32,23 @@ Translator_def::mark_smob (SCM smob) Translator_def* me = (Translator_def*) SCM_CELL_WORD_1 (smob); scm_gc_mark (me->description_); - scm_gc_mark (me->type_aliases_); - scm_gc_mark (me->consists_name_list_); - scm_gc_mark (me->accepts_name_list_); - scm_gc_mark (me->end_consists_name_list_); + scm_gc_mark (me->context_aliases_); + scm_gc_mark (me->accept_mods_); + scm_gc_mark (me->translator_mods_); scm_gc_mark (me->property_ops_); scm_gc_mark (me->translator_group_type_); - return me->type_name_; + return me->context_name_; } Translator_def::Translator_def () { - type_aliases_ = SCM_EOL; + context_aliases_ = SCM_EOL; translator_group_type_ = SCM_EOL; - accepts_name_list_ = SCM_EOL; - consists_name_list_ = SCM_EOL; - end_consists_name_list_ = SCM_EOL; + accept_mods_ = SCM_EOL; + translator_mods_ = SCM_EOL; property_ops_ = SCM_EOL; - type_name_ = SCM_EOL; + context_name_ = SCM_EOL; description_ = SCM_EOL; smobify_self(); @@ -63,100 +61,140 @@ Translator_def::~Translator_def () Translator_def::Translator_def (Translator_def const & s) : Input (s) { - type_aliases_ = SCM_EOL; + context_aliases_ = SCM_EOL; translator_group_type_ = SCM_EOL; - accepts_name_list_ = SCM_EOL; - consists_name_list_ = SCM_EOL; - end_consists_name_list_ = SCM_EOL; + accept_mods_ = SCM_EOL; + translator_mods_ = SCM_EOL; property_ops_ = SCM_EOL; - type_name_ = SCM_EOL; + context_name_ = SCM_EOL; description_ = SCM_EOL; smobify_self(); description_ = s.description_; - consists_name_list_ = scm_list_copy (s.consists_name_list_); - end_consists_name_list_ = scm_list_copy (s.end_consists_name_list_); - accepts_name_list_ = scm_list_copy (s.accepts_name_list_); - property_ops_ = scm_list_copy (s.property_ops_); - type_aliases_ = scm_list_copy (s.type_aliases_); + + accept_mods_ = s.accept_mods_; + property_ops_ = s.property_ops_; + translator_mods_ = s.translator_mods_; + context_aliases_ = s.context_aliases_; translator_group_type_ = s.translator_group_type_; - type_name_ = s.type_name_; + context_name_ = s.context_name_; } - 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 - this->accepts_name_list_ = scm_delete_x (name, this->accepts_name_list_); -} - - -SCM -Translator_def::modify_definition (SCM list, SCM str, bool add) +Translator_def::add_context_mod (SCM mod) { - String s = ly_scm2string (str); - if (!get_translator (s)) - error (_ ("Program has no such type")); + SCM tag = gh_car (mod); + if (ly_symbol2scm ("description") == tag) + { + description_ = gh_cadr (mod); + return ; + } - if (add) + SCM sym = gh_cadr (mod); + if (gh_string_p (sym)) + sym = scm_string_to_symbol (sym); + + if (ly_symbol2scm ("consists") == tag + || ly_symbol2scm ("consists-end") == tag + || ly_symbol2scm ("remove") == tag) { - if (scm_memq (str, list) != SCM_BOOL_F) - { - warning (_f ("Already contains: `%s'", s)); - warning (_f ("Not adding translator: `%s'", s)); - } + if (!get_translator (sym)) + error (_f ("Program has no such type: `%s'", ly_symbol2string (sym).to_str0 ())); else - list= gh_cons (str, list); + translator_mods_ = gh_cons (scm_list_2 (tag, sym), translator_mods_ ); + } + else if (ly_symbol2scm ("accepts") == tag + || ly_symbol2scm ("denies") == tag) + { + accept_mods_ = gh_cons (scm_list_2 (tag, sym), accept_mods_); + } + else if (ly_symbol2scm ("poppush") == tag + || ly_symbol2scm ("pop") == tag + || ly_symbol2scm ("push") == tag + || ly_symbol2scm ("assign") == tag + || ly_symbol2scm ("unset") == tag) + { + property_ops_ = gh_cons (mod, property_ops_); + } + else if (ly_symbol2scm ("alias") == tag) + { + context_aliases_ = gh_cons (sym, context_aliases_); + } + else if (ly_symbol2scm ("translator-type") == tag) + { + translator_group_type_ = sym; + } + else if (ly_symbol2scm ("context-name") == tag) + { + context_name_ = sym; } else { - list = scm_delete_x (str, list); + programming_error ("Unknown context mod tag."); } - return list; } - - -void -Translator_def::remove_element (SCM s) +SCM +Translator_def::get_translator_names () const { - this->end_consists_name_list_ = modify_definition (this->end_consists_name_list_, s, false); - this->consists_name_list_ = modify_definition (this->consists_name_list_, s, false); -} + SCM l1 = SCM_EOL; + SCM l2 = SCM_EOL; -void -Translator_def::add_element (SCM s) -{ - this->consists_name_list_ = modify_definition (this->consists_name_list_, s, true); + SCM mods = scm_reverse (translator_mods_); + for (SCM s = mods; gh_pair_p (s); s = gh_cdr (s)) + { + SCM tag = gh_caar (s); + SCM arg = gh_cadar (s); + + if (ly_symbol2scm ("consists") == tag) + l1 = gh_cons (arg, l1); + else if (ly_symbol2scm ("consists-end") == tag) + l2 = gh_cons (arg, l2); + else if (ly_symbol2scm ("remove") == tag) + { + l1 = scm_delete_x (arg, l1); + l2 = scm_delete_x (arg, l2); + } + } + + return scm_append_x (scm_list_2 (l1, l2)); } -void -Translator_def::add_last_element (SCM s) +SCM +Translator_def::get_context_name () const { - this->end_consists_name_list_ = modify_definition (this->end_consists_name_list_, s, true); + return context_name_; } -void -Translator_def::add_property_operation (SCM what) +SCM +Translator_def::get_accepted () const { - this->property_ops_ = gh_cons (what, this->property_ops_); + SCM correct_order = scm_reverse (accept_mods_); + SCM acc = SCM_EOL; + for (SCM s = correct_order; gh_pair_p (s); s = gh_cdr (s)) + { + SCM tag = gh_caar (s); + SCM sym = gh_cadar (s); + if (tag == ly_symbol2scm ("accepts")) + acc = gh_cons (sym, acc); + else if (tag == ly_symbol2scm ("denies")) + acc = scm_delete_x (sym, acc); + } + return acc; } - - + Link_array Translator_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; - for (SCM s = accepts_name_list_; gh_pair_p (s); s = ly_cdr (s)) + for (SCM s = accepted; gh_pair_p (s); s = ly_cdr (s)) { Translator_def *t = unsmob_translator_def (odef->find_translator (ly_car (s))); if (!t) @@ -170,7 +208,7 @@ Translator_def::path_to_acceptable_translator (SCM type_sym, Music_output_def* o /* don't check aliases, because \context Staff should not create RhythmicStaff. */ - if (gh_equal_p (accepteds[i]->type_name_, type_sym)) + if (gh_equal_p (accepteds[i]->get_context_name (), type_sym)) { best_result.push (accepteds[i]); return best_result; @@ -205,12 +243,12 @@ IMPLEMENT_DEFAULT_EQUAL_P (Translator_def); static SCM -trans_list (SCM namelist, Translator_group*tg) +names_to_translators (SCM namelist, Translator_group*tg) { SCM l = SCM_EOL; for (SCM s = namelist; gh_pair_p (s) ; s = ly_cdr (s)) { - Translator * t = get_translator (ly_scm2string (ly_car (s))); + Translator * t = get_translator (ly_car (s)); if (!t) warning (_f ("can't find: `%s'", s)); else @@ -232,21 +270,15 @@ trans_list (SCM namelist, Translator_group*tg) Translator_group * Translator_def::instantiate (Music_output_def* md) { - Translator * g = get_translator (ly_scm2string (translator_group_type_)); + Translator * g = get_translator (translator_group_type_); g = g->clone (); Translator_group *tg = dynamic_cast (g); tg->output_def_ = md; tg->definition_ = self_scm (); - /* - TODO: ugh. we're reversing CONSISTS_NAME_LIST_ here - */ - SCM l1 = trans_list (consists_name_list_, tg); - SCM l2 =trans_list (end_consists_name_list_,tg); - l1 = scm_reverse_x (l1, l2); - - tg->simple_trans_list_ = l1; + SCM trans_names = get_translator_names (); + tg->simple_trans_list_ = names_to_translators (trans_names, tg); return tg; } @@ -282,7 +314,7 @@ Translator_def::make_scm () SCM Translator_def::default_child_context_name () { - SCM d = accepts_name_list_; + SCM d = get_accepted (); return gh_pair_p (d) ? ly_car (scm_last_pair (d)) : SCM_EOL; } @@ -290,21 +322,25 @@ SCM Translator_def::to_alist () const { SCM l = SCM_EOL; - - l = gh_cons (gh_cons (ly_symbol2scm ("consists"), consists_name_list_), l); + + l = gh_cons (gh_cons (ly_symbol2scm ("consists"), get_translator_names ()), l); l = gh_cons (gh_cons (ly_symbol2scm ("description"), description_), l); - l = gh_cons (gh_cons (ly_symbol2scm ("aliases"), type_aliases_), l); - l = gh_cons (gh_cons (ly_symbol2scm ("end-consists"), - end_consists_name_list_), l); - l = gh_cons (gh_cons (ly_symbol2scm ("accepts"), accepts_name_list_), l); + l = gh_cons (gh_cons (ly_symbol2scm ("aliases"), context_aliases_), l); + l = gh_cons (gh_cons (ly_symbol2scm ("accepts"), get_accepted ()), l); l = gh_cons (gh_cons (ly_symbol2scm ("property-ops"), property_ops_), l); - - /* - junkme: - */ - l = gh_cons (gh_cons (ly_symbol2scm ("type-name"), type_name_), l); - + l = gh_cons (gh_cons (ly_symbol2scm ("context-name"), context_name_), l); l = gh_cons (gh_cons (ly_symbol2scm ("group-type"), translator_group_type_), l); return l; } + +bool +Translator_def::is_alias (SCM sym) const +{ + bool b = sym == context_name_; + + for (SCM a = context_aliases_; !b && gh_pair_p (a); a = ly_cdr (a)) + b = b || sym == ly_car (a); + + return b; +} diff --git a/lily/translator-group.cc b/lily/translator-group.cc index aae7f5071f..1ce7b11e31 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -470,7 +470,7 @@ String Translator_group::context_name () const { Translator_def * td = unsmob_translator_def (definition_ ); - return ly_symbol2string (td->type_name_); + return ly_symbol2string (td->get_context_name ()); } void diff --git a/lily/translator-scheme.cc b/lily/translator-scheme.cc index ac2d1d5d0a..8e3a7f7697 100644 --- a/lily/translator-scheme.cc +++ b/lily/translator-scheme.cc @@ -139,13 +139,13 @@ LY_DEFINE(ly_context_properties, LY_DEFINE(ly_translator_name, "ly:translator-name", 1,0,0, (SCM trans), - "Return the type name of the translator @var{trans}.") + "Return the type name of the translator @var{trans}. The name is a symbol.") { Translator* tr = unsmob_translator (trans); SCM_ASSERT_TYPE(tr, trans, SCM_ARG1, __FUNCTION__, "Context"); char const* nm = classname (tr); - return scm_makfrom0str (nm); + return ly_symbol2scm (nm); } LY_DEFINE(ly_translator_description, @@ -198,7 +198,7 @@ Translator::print_smob (SCM s, SCM port, scm_print_state *) scm_puts ("#definition_)) { - scm_display (d->type_name_, port); + scm_display (d->get_context_name (), port); } else scm_display (ly_translator_name (s), port); diff --git a/lily/translator.cc b/lily/translator.cc index 5c53e35449..ee40e52e0b 100644 --- a/lily/translator.cc +++ b/lily/translator.cc @@ -50,13 +50,7 @@ Translator::Translator (Translator const &s) bool Translator::is_alias (SCM sym) const { - Translator_def * td = unsmob_translator_def (definition_); - bool b = (sym == td->type_name_); - - for (SCM a = td->type_aliases_; !b && gh_pair_p (a); a = ly_cdr (a)) - b = b || sym == ly_car (a); - - return b; + return unsmob_translator_def (definition_)->is_alias (sym); } bool diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 4fca0d7521..c3802fb24f 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -443,7 +443,7 @@ AncientRemoveEmptyStaffContext = \translator { changeMoment = #`(,(ly:make-moment 0 0) . ,(ly:make-moment 1 512)) systemStartDelimiter =#'SystemStartBar - melismaBusyProperties = #'(melismaBusy slurMelismaBusy tieMelismaBusy beamMelismaBusy) + melismaBusyProperties = #default-melisma-properties clefGlyph = #"clefs-G" clefPosition = #-2 diff --git a/scm/define-translator-properties.scm b/scm/define-translator-properties.scm index e8b561adac..780d434af3 100644 --- a/scm/define-translator-properties.scm +++ b/scm/define-translator-properties.scm @@ -311,6 +311,8 @@ top of those automatically detected. ") (translator-property-description 'melismaBusyProperties list? "List of properties (symbols) to determine whether a melisma is playing.") + + (translator-property-description 'metronomeMarkFormatter procedure? "How to produce a metronome markup. Called with 2 arguments, event and context.") @@ -501,3 +503,8 @@ according to values of @code{defaultBarType}, @code{barAlways}, Valid values are described in @ref{(lilypond-internals)bar-line-interface}. .") + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(define-public default-melisma-properties '(melismaBusy slurMelismaBusy tieMelismaBusy beamMelismaBusy)) diff --git a/scm/document-backend.scm b/scm/document-backend.scm index a8df442aa3..5346a98127 100644 --- a/scm/document-backend.scm +++ b/scm/document-backend.scm @@ -105,7 +105,7 @@ node." (engravers (filter (lambda (x) (engraver-makes-grob? name x)) all-engravers-list)) (namestr (symbol->string name)) - (engraver-names (map ly:translator-name engravers)) + (engraver-names (map symbol->string (map ly:translator-name engravers))) ) (make diff --git a/scm/document-music.scm b/scm/document-music.scm index 9b14484a30..c7979b59b1 100644 --- a/scm/document-music.scm +++ b/scm/document-music.scm @@ -57,9 +57,10 @@ "\n\nAccepted by: " (human-listify (map ref-ify - (map ly:translator-name - (filter - (lambda (x) (engraver-accepts-music-type? (car entry) x)) all-engravers-list)))) + (map symbol->string + (map ly:translator-name + (filter + (lambda (x) (engraver-accepts-music-type? (car entry) x)) all-engravers-list))))) "\n\n" ))) @@ -88,9 +89,9 @@ "\n\nAccepted by: " (human-listify (map ref-ify - (map ly:translator-name - (filter - (lambda (x) (engraver-accepts-music-types? types x)) all-engravers-list)))) + (map symbol->string (map ly:translator-name + (filter + (lambda (x) (engraver-accepts-music-types? types x)) all-engravers-list))))) "\n\nProperties: \n" (description-list->texi (map diff --git a/scm/document-translation.scm b/scm/document-translation.scm index bd057d5a22..25b08fc25f 100644 --- a/scm/document-translation.scm +++ b/scm/document-translation.scm @@ -29,8 +29,8 @@ (propsr (cdr (assoc 'properties-read (ly:translator-description engraver)))) (propsw (cdr (assoc 'properties-written (ly:translator-description engraver)))) (accepted (cdr (assoc 'events-accepted (ly:translator-description engraver)))) - (name (ly:translator-name engraver)) - (name-sym (string->symbol name)) + (name-sym (ly:translator-name engraver)) + (name (symbol->string name-sym)) (desc (cdr (assoc 'description (ly:translator-description engraver)))) (grobs (engraver-grobs engraver)) ) @@ -79,11 +79,11 @@ (contexts (apply append (map (lambda (x) - (let ((context (cdr (assoc 'type-name x))) + (let ((context (cdr (assoc 'context-name x))) (consists (append (list (cdr (assoc 'group-type x))) (cdr (assoc 'consists x)) - (cdr (assoc 'end-consists x))))) + ))) (if (member name consists) (list context) @@ -101,7 +101,7 @@ ;; First level Engraver description (define (engraver-doc grav) (make - #:name (ly:translator-name grav) + #:name (symbol->string (ly:translator-name grav)) #:text (engraver-doc-string grav #t) )) @@ -114,17 +114,18 @@ (ly:get-all-translators)) (define (find-engraver-by-name name) + "NAME is a symbol." (hash-ref name->engraver-table name #f)) (define (document-engraver-by-name name) + "NAME is a symbol." (let* ( (eg (find-engraver-by-name name )) ) - (cons name + (cons (symbol->string name ) (engraver-doc-string eg #f) - ) )) @@ -171,7 +172,7 @@ (define (context-doc context-desc) (let* ( - (name-sym (cdr (assoc 'type-name context-desc))) + (name-sym (cdr (assoc 'context-name context-desc))) (name (symbol->string name-sym)) (aliases (map symbol->string (cdr (assoc 'aliases context-desc)))) (desc-handle (assoc 'description context-desc)) @@ -182,7 +183,6 @@ (consists (append (list (cdr (assoc 'group-type context-desc))) (cdr (assoc 'consists context-desc)) - (cdr (assoc 'end-consists context-desc)) )) (props (cdr (assoc 'property-ops context-desc))) (grobs (context-grobs context-desc)) @@ -213,7 +213,7 @@ (string-append "\n\nContext " name " can contain \n" - (human-listify (map ref-ify (map symbol->string accepts))))) + (human-listify (map ref-ify (map symbol->string accepts))))) "\n\nThis context is built from the following engravers: " (description-list->texi @@ -221,30 +221,23 @@ )))) (define (engraver-grobs grav) - (let* ( - (eg (if (string? grav) + (let* ((eg (if (symbol? grav) (find-engraver-by-name grav) - grav)) - - ) + grav))) (if (eq? eg #f) '() - (map symbol->string (cdr (assoc 'grobs-created (ly:translator-description eg)))) - ) + (map symbol->string (cdr (assoc 'grobs-created (ly:translator-description eg))))) )) (define (context-grobs context-desc) - (let* ( - (consists (append + (let* ((consists (append (list (cdr (assoc 'group-type context-desc))) (cdr (assoc 'consists context-desc)) - (cdr (assoc 'end-consists context-desc)) )) (grobs (apply append (map engraver-grobs consists)) - ) - ) + )) grobs )) @@ -272,8 +265,8 @@ (define all-engravers-list (ly:get-all-translators)) (set! all-engravers-list (sort all-engravers-list - (lambda (a b) (stringstring (ly:translator-name a)) + (symbol->string (ly:translator-name b)))))) (define (all-engravers-doc) (make diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py index 2c6d519f1c..daf03fd202 100644 --- a/scripts/convert-ly.py +++ b/scripts/convert-ly.py @@ -1644,6 +1644,15 @@ def conv (str): conversions.append (((2,1,4), conv, """removal of automaticMelismata; use melismaBusyProperties instead.""")) + + +def conv (str): + str =re.sub (r"\\translator\s+([a-zA-Z]+)", r"\\change \1", str) + return str + +conversions.append (((2,1,7), conv, """\\translator Staff -> \\change Staff""")) + + ################################ # END OF CONVERSIONS ################################