From 85eb4ef5a20cf5af63cd76335cd9bd3839efc84a Mon Sep 17 00:00:00 2001 From: hanwen Date: Fri, 9 Jan 2004 00:27:01 +0000 Subject: [PATCH] * lily/main.cc (main_prog): print summary of failed files. * lily/axis-group-engraver.cc: move all spanner creation to process_music (). Now staffs can be adjusted with \override too. * lily/chord-tremolo-engraver.cc (try_music): fix spurious warning. --- ChangeLog | 15 +++++ Documentation/topdocs/NEWS.texi | 13 +++- input/regression/staff-tweak.ly | 20 ++++--- input/screech-boink.ly | 2 +- lily/axis-group-engraver.cc | 9 ++- lily/bar-line.cc | 1 - lily/bar-number-engraver.cc | 3 +- lily/chord-name-engraver.cc | 1 - lily/chord-tremolo-engraver.cc | 2 +- lily/engraver.cc | 2 - lily/include/main.hh | 2 + lily/include/output-property.hh | 32 ---------- lily/include/translator-change.hh | 2 - lily/include/translator-def.hh | 5 +- lily/include/translator-group.hh | 2 +- lily/input-file-results.cc | 1 + lily/main.cc | 9 +++ lily/music-output-def.cc | 2 +- lily/parser.yy | 39 ++++++------ lily/piano-pedal-engraver.cc | 1 - lily/protected-scm.cc | 1 - lily/separating-line-group-engraver.cc | 15 +++-- lily/slur-bezier-bow.cc | 1 - lily/spacing-engraver.cc | 14 +++-- lily/spacing-spanner.cc | 2 +- lily/staff-symbol-engraver.cc | 13 ++-- lily/streams.cc | 54 ----------------- lily/system-start-delimiter-engraver.cc | 16 ++--- lily/translator-def.cc | 80 +++++++++++++------------ lily/translator-group.cc | 27 +++++---- lily/vertical-align-engraver.cc | 13 ++-- mf/feta-bolletjes.mf | 33 +++++----- 32 files changed, 205 insertions(+), 227 deletions(-) delete mode 100644 lily/include/output-property.hh delete mode 100644 lily/include/translator-change.hh delete mode 100644 lily/streams.cc diff --git a/ChangeLog b/ChangeLog index 823b199878..d59be95f03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,20 @@ +2004-01-09 Han-Wen Nienhuys + + * lily/main.cc (main_prog): print summary of failed files. + + * lily/axis-group-engraver.cc: move all spanner creation to + process_music (). Now staffs can be adjusted with \override too. + + * lily/chord-tremolo-engraver.cc (try_music): fix spurious warning. + 2004-01-08 Han-Wen Nienhuys + * lily/translator-def.cc (get_translator_names): accept user + tweaks too. + + * mf/feta-bolletjes.mf (overdone_heads): oops, slashes are twice + as big as normal heads. + * input/*ly: run convert-ly * lily/tuplet-bracket.cc (brew_molecule): call after_line_breaking diff --git a/Documentation/topdocs/NEWS.texi b/Documentation/topdocs/NEWS.texi index 84d146fca6..c85cc20c2d 100644 --- a/Documentation/topdocs/NEWS.texi +++ b/Documentation/topdocs/NEWS.texi @@ -10,7 +10,15 @@ Unreleased: @itemize -@item Features of spanner contexts, like Staff, can now be changed easily: + +@item The syntax for changing staffs has changed. The keyword +@code{\change} should now be used, e.g. + +@example + \change Staff = up +@end example + +@item Features of spanner contexts, like @code{Staff}, can now be changed easily: @example \new Staff \with @{ @@ -30,7 +38,8 @@ Version 2.1.7 @itemize @bullet @item Multi measure rests are now truly centered between the -clefs/barlines of the staff, independent of symbols on the other staffs. +clefs/barlines of the staff, their position is independent of symbols +on the other staffs. @item Collision resolution for dots in chords has been improved greatly. diff --git a/input/regression/staff-tweak.ly b/input/regression/staff-tweak.ly index f088dc8fda..fcc21b8f44 100644 --- a/input/regression/staff-tweak.ly +++ b/input/regression/staff-tweak.ly @@ -1,8 +1,10 @@ \version "2.1.7" + \header { texidoc = "The staff is a grob, and may be adjusted as well: this one shows a staff with 6 thick line, and a slightly large staffspace. Beams remain correctly quantized." + } @@ -10,15 +12,19 @@ mus = \notes \relative c' { c4 g' d'8 d d d } \score { \notes << - \new Staff \mus - \new Staff \with { - StaffSymbol \set #'thickness = #2.0 - StaffSymbol \set #'line-count = #6 - StaffSymbol \set #'staff-space = #1.1 - } \mus + \new Staff { + \property + Staff. StaffSymbol \set #'thickness = #2.0 + \property + Staff.StaffSymbol \set #'line-count = #6 + \property + Staff.StaffSymbol \set #'staff-space = #1.1 + \mus + } + \mus >> \paper { raggedright = ##t - } + } } diff --git a/input/screech-boink.ly b/input/screech-boink.ly index f779df0e9c..6c42914cf2 100644 --- a/input/screech-boink.ly +++ b/input/screech-boink.ly @@ -21,7 +21,7 @@ c'''32 \change Staff = down g16] \change Staff = up -\property Voice.Stem \revert #'direction + \property Voice.Stem \revert #'direction \property Voice.followVoice = ##t c'''32([ b''16 a''16 gis''16 g''32)] } \\ { s4 \times 2/3 { d'16[ f' g'] } as'32[ b''32 e'' d''] } \\ diff --git a/lily/axis-group-engraver.cc b/lily/axis-group-engraver.cc index b8e5774684..c00c4af282 100644 --- a/lily/axis-group-engraver.cc +++ b/lily/axis-group-engraver.cc @@ -21,7 +21,7 @@ class Axis_group_engraver : public Engraver protected: Spanner *staffline_; Link_array elts_; - virtual void initialize (); + virtual void process_music (); virtual void finalize (); virtual void acknowledge_grob (Grob_info); virtual void process_acknowledged_grobs (); @@ -39,9 +39,11 @@ Axis_group_engraver::Axis_group_engraver () } void -Axis_group_engraver::initialize () +Axis_group_engraver::process_music () { - staffline_ = get_spanner (); +if (!staffline_) + { + staffline_ = get_spanner (); Grob * it = unsmob_grob (get_property ("currentCommandColumn")); @@ -49,6 +51,7 @@ Axis_group_engraver::initialize () announce_grob(staffline_, SCM_EOL); } +} Spanner* Axis_group_engraver::get_spanner () const diff --git a/lily/bar-line.cc b/lily/bar-line.cc index 82fdf74bdc..e9dd56728b 100644 --- a/lily/bar-line.cc +++ b/lily/bar-line.cc @@ -10,7 +10,6 @@ #include "lookup.hh" #include "paper-column.hh" -#include "main.hh" #include "grob.hh" #include "bar-line.hh" #include "string.hh" diff --git a/lily/bar-number-engraver.cc b/lily/bar-number-engraver.cc index 4ef961ad74..e2689a9482 100644 --- a/lily/bar-number-engraver.cc +++ b/lily/bar-number-engraver.cc @@ -54,7 +54,8 @@ Bar_number_engraver::process_music () { SCM bn = get_property ("currentBarNumber"); SCM proc = get_property ("barNumberVisibility"); - if (gh_number_p (bn) && to_boolean(gh_call1(proc, bn))) + if (gh_number_p (bn) && gh_procedure_p (proc) + && to_boolean(gh_call1(proc, bn))) { create_items (); // guh. diff --git a/lily/chord-name-engraver.cc b/lily/chord-name-engraver.cc index 619b51a639..633e1b3e11 100644 --- a/lily/chord-name-engraver.cc +++ b/lily/chord-name-engraver.cc @@ -12,7 +12,6 @@ #include "paper-def.hh" #include "font-interface.hh" #include "paper-def.hh" -#include "main.hh" #include "dimensions.hh" #include "item.hh" #include "pitch.hh" diff --git a/lily/chord-tremolo-engraver.cc b/lily/chord-tremolo-engraver.cc index 6d4160ea66..a67946fe7b 100644 --- a/lily/chord-tremolo-engraver.cc +++ b/lily/chord-tremolo-engraver.cc @@ -95,7 +95,7 @@ Chord_tremolo_engraver::try_music (Music * m) int elt_count = seq ? scm_ilength (seq-> music_list ()) : 1; - if (elt_count != 2) + if (seq && elt_count != 2) { rp->origin ()->warning (_f ("Chord tremolo with %d elements. Must have two elements.", elt_count)); } diff --git a/lily/engraver.cc b/lily/engraver.cc index c49e76062e..e4a6367216 100644 --- a/lily/engraver.cc +++ b/lily/engraver.cc @@ -10,7 +10,6 @@ #include "engraver.hh" #include "engraver-group-engraver.hh" #include "grob.hh" -#include "main.hh" #include "score-engraver.hh" #include "warn.hh" @@ -31,7 +30,6 @@ Engraver::announce_grob (Grob* e, SCM cause) TODO: junk grob-info, and make a cause grob-property to store `causes' generically. */ - if (unsmob_music (cause) || unsmob_grob (cause)) e->set_grob_property ("cause", cause); diff --git a/lily/include/main.hh b/lily/include/main.hh index 9904c75121..748128eea8 100644 --- a/lily/include/main.hh +++ b/lily/include/main.hh @@ -9,6 +9,7 @@ #define MAIN_HH #include "lily-proto.hh" +#include "array.hh" void debug_init (); void set_debug (bool); @@ -39,6 +40,7 @@ extern bool internal_type_checking_global_b; /* misc */ extern All_font_metrics *all_fonts_global; +extern Array failed_files; extern int exit_status_global; extern File_path global_path; extern int score_count_global; diff --git a/lily/include/output-property.hh b/lily/include/output-property.hh deleted file mode 100644 index 3c6608a9a2..0000000000 --- a/lily/include/output-property.hh +++ /dev/null @@ -1,32 +0,0 @@ -/* - output-property.hh -- declare Output_property - - source file of the GNU LilyPond music typesetter - - (c) 2000--2003 Han-Wen Nienhuys - - */ - -#ifndef OUTPUT_PROPERTY_HH -#define OUTPUT_PROPERTY_HH - -#include "music.hh" - - -/* - -props: - - relevant stuff: the predicate, the symbol, the value - - */ -class Output_property : public Music -{ -public: - VIRTUAL_COPY_CONS (Music); - Output_property (SCM, SCM, SCM); -}; - -#endif /* OUTPUT_PROPERTY_HH */ - -#error diff --git a/lily/include/translator-change.hh b/lily/include/translator-change.hh deleted file mode 100644 index 65296f8106..0000000000 --- a/lily/include/translator-change.hh +++ /dev/null @@ -1,2 +0,0 @@ - -#error diff --git a/lily/include/translator-def.hh b/lily/include/translator-def.hh index bb641d5bf5..acc70202ca 100644 --- a/lily/include/translator-def.hh +++ b/lily/include/translator-def.hh @@ -38,11 +38,12 @@ public: SCM default_child_context_name (); SCM get_context_name () const; SCM get_accepted () const; - SCM get_translator_names () const; + SCM get_property_ops () const { return property_ops_; } + 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; - Translator_group * instantiate (Music_output_def*); + Translator_group * instantiate (Music_output_def*, SCM extra_ops); SCM to_alist () const; bool is_alias (SCM) const; diff --git a/lily/include/translator-group.hh b/lily/include/translator-group.hh index b68f4b4ec2..566e33a42f 100644 --- a/lily/include/translator-group.hh +++ b/lily/include/translator-group.hh @@ -52,7 +52,7 @@ public: VIRTUAL_COPY_CONS (Translator); Translator_group (Translator_group const &); Translator_group (); - void add_fresh_group_translator (Translator *trans, SCM ops); + void add_fresh_group_translator (Translator *trans); void add_used_group_translator (Translator *trans); /// Score_register = 0, Staff_registers = 1, etc) diff --git a/lily/input-file-results.cc b/lily/input-file-results.cc index 90bf8d4e2a..8565efe074 100644 --- a/lily/input-file-results.cc +++ b/lily/input-file-results.cc @@ -144,6 +144,7 @@ Input_file_results::Input_file_results (String init, String in_file, String out_ if (parser.error_level_) { exit_status_global = 1; + failed_files.push (in_file); } diff --git a/lily/main.cc b/lily/main.cc index 58d7553430..5d88928cc7 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -34,6 +34,8 @@ #include "global-ctor.hh" #include "kpath.hh" +Array failed_files; + static int sane_putenv (char const* key, char const* value, bool overwrite = false); /* @@ -371,6 +373,13 @@ main_prog (void *, int, char **) } while ((arg = oparser_p_static->get_next_arg ())); delete oparser_p_static; oparser_p_static = 0; + + if (exit_status_global) + { + printf ("Failed files: "); + for (int i = 0; i < failed_files.size (); i++) + printf ("%s", failed_files[i].to_str0 ()); + } exit (exit_status_global); } diff --git a/lily/music-output-def.cc b/lily/music-output-def.cc index d13d5ec76a..56d6bf6ca8 100644 --- a/lily/music-output-def.cc +++ b/lily/music-output-def.cc @@ -102,7 +102,7 @@ Music_output_def::get_global_translator () if (!t) error (_f ("can't find `%s' context", "Score")); - Translator_group * tg = t->instantiate (this); + Translator_group * tg = t->instantiate (this, SCM_EOL); tg->initialize (); diff --git a/lily/parser.yy b/lily/parser.yy index 86a4b070e3..e9b33a4e0e 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -316,7 +316,7 @@ yylex (YYSTYPE *s, void * v) %type exclamations questions dots optional_rest %type bass_mod %type grace_head -%type property_operation_list +%type context_mod_list %type lyric_element %type bass_number br_bass_figure bass_figure figure_list figure_spec %token DIGIT @@ -327,9 +327,7 @@ yylex (YYSTYPE *s, void * v) %token FRACTION %token IDENTIFIER %token CHORDNAMES - -%token CHORD_MODIFIER - +%token CHORD_MODIFIER %token SCORE_IDENTIFIER %token MUSIC_OUTPUT_DEF_IDENTIFIER %token NUMBER_IDENTIFIER @@ -383,7 +381,7 @@ yylex (YYSTYPE *s, void * v) %type relative_music re_rhythmed_music part_combined_music %type music_property_def context_change %type Music_list -%type property_operation context_mod translator_mod +%type property_operation context_mod translator_mod optional_context_mod %type music_output_def_body %type shorthand_command_req %type post_event tagged_post_event @@ -888,15 +886,20 @@ Simple_music: ; +optional_context_mod: + /**/ { $$ = SCM_EOL; } + | WITH '{' context_mod_list '}' { $$ = $3; } + ; + grace_head: GRACE { $$ = scm_makfrom0str ("Grace"); } | ACCIACCATURA { $$ = scm_makfrom0str ("Acciaccatura"); } | APPOGGIATURA { $$ = scm_makfrom0str ("Appoggiatura"); } ; -property_operation_list: +context_mod_list: /* */ { $$ = SCM_EOL; } - | property_operation_list property_operation { + | context_mod_list context_mod { $$ = gh_cons ($2, $1); } ; @@ -964,26 +967,18 @@ basic music objects too, since the meaning is different. scm_gc_unprotect_object ($2->self_scm ()); #endif } - | CONTEXT string '=' string Music { - $$ = context_spec_music ($2, $4, $5, SCM_EOL); + | CONTEXT string '=' string optional_context_mod Music { + $$ = context_spec_music ($2, $4, $6, $5); } - | CONTEXT STRING Music { - $$ = context_spec_music ($2, SCM_UNDEFINED, $3, SCM_EOL); + | CONTEXT STRING optional_context_mod Music { + $$ = context_spec_music ($2, SCM_UNDEFINED, $4, $3); } - | NEWCONTEXT string Music { + | NEWCONTEXT string optional_context_mod 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); - - } - | TRANSLATOR string '=' string '{' property_operation_list '}' Music { - $$ = context_spec_music ($2, $4, - $8, $6); + $4, $3); } + | TIMES { THIS->push_spot (); } diff --git a/lily/piano-pedal-engraver.cc b/lily/piano-pedal-engraver.cc index cb993f4bab..5204f51f68 100644 --- a/lily/piano-pedal-engraver.cc +++ b/lily/piano-pedal-engraver.cc @@ -98,7 +98,6 @@ Piano_pedal_engraver::Piano_pedal_engraver () void Piano_pedal_engraver::initialize () { - previous_.clear (); char * names [] = { "Sostenuto", "Sustain", "UnaCorda", 0 }; diff --git a/lily/protected-scm.cc b/lily/protected-scm.cc index 17193eeda5..db784cbac6 100644 --- a/lily/protected-scm.cc +++ b/lily/protected-scm.cc @@ -8,7 +8,6 @@ */ #include "protected-scm.hh" #include "lily-guile.hh" -#include "main.hh" Protected_scm::Protected_scm () { diff --git a/lily/separating-line-group-engraver.cc b/lily/separating-line-group-engraver.cc index 2cb1cf9aa2..cd6b5ca868 100644 --- a/lily/separating-line-group-engraver.cc +++ b/lily/separating-line-group-engraver.cc @@ -53,7 +53,7 @@ protected: Spanner * sep_span_; virtual void acknowledge_grob (Grob_info); - virtual void initialize (); + virtual void process_music (); virtual void finalize (); virtual void stop_translation_timestep (); virtual void start_translation_timestep (); @@ -69,14 +69,17 @@ Separating_line_group_engraver::Separating_line_group_engraver () } void -Separating_line_group_engraver::initialize () +Separating_line_group_engraver::process_music () { - sep_span_ = new Spanner (get_property ("SeparatingGroupSpanner")); - announce_grob(sep_span_, SCM_EOL); - sep_span_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn"))); -} + if (!sep_span_) + { + sep_span_ = new Spanner (get_property ("SeparatingGroupSpanner")); + announce_grob(sep_span_, SCM_EOL); + sep_span_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn"))); + } +} void Separating_line_group_engraver::finalize () { diff --git a/lily/slur-bezier-bow.cc b/lily/slur-bezier-bow.cc index 9a152ddcab..b2bd25ca3e 100644 --- a/lily/slur-bezier-bow.cc +++ b/lily/slur-bezier-bow.cc @@ -9,7 +9,6 @@ #include "warn.hh" #include "paper-def.hh" #include "slur-bezier-bow.hh" -#include "main.hh" Slur_bezier_bow::Slur_bezier_bow (Array encompass, Direction dir, Real h_inf, Real r_0) diff --git a/lily/spacing-engraver.cc b/lily/spacing-engraver.cc index 6e5447df01..ae331b60d6 100644 --- a/lily/spacing-engraver.cc +++ b/lily/spacing-engraver.cc @@ -51,7 +51,7 @@ protected: virtual void acknowledge_grob (Grob_info); virtual void start_translation_timestep (); virtual void stop_translation_timestep (); - virtual void initialize (); + virtual void process_music (); virtual void finalize (); }; @@ -74,13 +74,15 @@ Spacing_engraver::Spacing_engraver () } void -Spacing_engraver::initialize () +Spacing_engraver::process_music () { - spacing_ =new Spanner (get_property ("SpacingSpanner")); - spacing_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn"))); - announce_grob(spacing_, SCM_EOL); + if (!spacing_) + { + spacing_ =new Spanner (get_property ("SpacingSpanner")); + spacing_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn"))); + announce_grob(spacing_, SCM_EOL); + } } - void Spacing_engraver::finalize () { diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index 17915f5442..14d7699d78 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -32,7 +32,7 @@ /* TODO: this file/class is too complex. Should figure out how to chop this up even more. - + */ class Spacing_spanner diff --git a/lily/staff-symbol-engraver.cc b/lily/staff-symbol-engraver.cc index ea7300749a..71c9c8ca7d 100644 --- a/lily/staff-symbol-engraver.cc +++ b/lily/staff-symbol-engraver.cc @@ -26,7 +26,7 @@ protected: virtual ~Staff_symbol_engraver (); virtual void acknowledge_grob (Grob_info); virtual void finalize (); - virtual void initialize (); + virtual void process_music (); }; @@ -41,13 +41,16 @@ Staff_symbol_engraver::Staff_symbol_engraver () } void -Staff_symbol_engraver::initialize () +Staff_symbol_engraver::process_music () { - span_ = new Spanner (get_property ("StaffSymbol")); + if (!span_) + { + span_ = new Spanner (get_property ("StaffSymbol")); - span_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn"))); + span_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn"))); - announce_grob(span_, SCM_EOL); + announce_grob(span_, SCM_EOL); + } } void diff --git a/lily/streams.cc b/lily/streams.cc deleted file mode 100644 index 022b3abbf9..0000000000 --- a/lily/streams.cc +++ /dev/null @@ -1,54 +0,0 @@ -#include "config.h" - -#include -#include -#include -#if HAVE_SYS_STAT_H -#include -#endif - -#include -#include - -#include "stream.hh" -#include "file-path.hh" -#include "warn.hh" -#include "main.hh" - -#if __GNUC__ > 2 -std::ostream * -open_file_stream (String filename, std::ios_base::openmode mode) -#else -std::ostream * -open_file_stream (String filename, int mode) -#endif -{ - std::ostream *os; - if ((filename == "-")) - os = &std::cout; - else - { - Path p = split_path (filename); - if (!p.dir.is_empty ()) - if (mkdir (p.dir.to_str0 (), 0777) == -1 && errno != EEXIST) - error (_f ("can't create directory: `%s'", p.dir)); - os = new std::ofstream (filename.to_str0 (), mode); - } - if (!*os) - error (_f ("can't open file: `%s'", filename)); - return os; -} - -void -close_file_stream (std::ostream *os) -{ - *os << std::flush; - if (!*os) - { - warning (_ ("Error syncing file (disk full?)")); - exit_status_global = 1; - } - if (os != &std::cout) - delete os; - os = 0; -} diff --git a/lily/system-start-delimiter-engraver.cc b/lily/system-start-delimiter-engraver.cc index b2a621a3dd..d8045610bd 100644 --- a/lily/system-start-delimiter-engraver.cc +++ b/lily/system-start-delimiter-engraver.cc @@ -23,7 +23,7 @@ public: protected: Spanner * delim_; virtual void acknowledge_grob (Grob_info); - virtual void initialize (); + virtual void process_music (); virtual void finalize (); }; @@ -68,15 +68,17 @@ System_start_delimiter_engraver::System_start_delimiter_engraver () } void -System_start_delimiter_engraver::initialize () +System_start_delimiter_engraver::process_music () { - SCM delim_name =get_property ("systemStartDelimiter"); - delim_ = new Spanner (internal_get_property (delim_name)); + if (!delim_) + { + SCM delim_name =get_property ("systemStartDelimiter"); + delim_ = new Spanner (internal_get_property (delim_name)); - delim_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn"))); - announce_grob (delim_, SCM_EOL); + delim_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn"))); + announce_grob (delim_, SCM_EOL); + } } - void System_start_delimiter_engraver::finalize () { diff --git a/lily/translator-def.cc b/lily/translator-def.cc index 1386d0bdd7..37bc280533 100644 --- a/lily/translator-def.cc +++ b/lily/translator-def.cc @@ -72,7 +72,6 @@ Translator_def::Translator_def (Translator_def const & s) smobify_self(); description_ = s.description_; - accept_mods_ = s.accept_mods_; property_ops_ = s.property_ops_; translator_mods_ = s.translator_mods_; @@ -136,31 +135,7 @@ Translator_def::add_context_mod (SCM mod) } } -SCM -Translator_def::get_translator_names () const -{ - SCM l1 = SCM_EOL; - SCM l2 = SCM_EOL; - - 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)); -} SCM Translator_def::get_context_name () const @@ -263,12 +238,44 @@ names_to_translators (SCM namelist, Translator_group*tg) scm_gc_unprotect_object (str); } } - return l; + return l; +} + + +SCM +Translator_def::get_translator_names (SCM user_mod) const +{ + SCM l1 = SCM_EOL; + SCM l2 = SCM_EOL; + + SCM mods = scm_reverse_x (scm_list_copy (translator_mods_), + user_mod); + + for (SCM s = mods; gh_pair_p (s); s = gh_cdr (s)) + { + SCM tag = gh_caar (s); + SCM arg = gh_cadar (s); + + if (gh_string_p (arg)) + arg = scm_string_to_symbol (arg); + + 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)); } Translator_group * -Translator_def::instantiate (Music_output_def* md) +Translator_def::instantiate (Music_output_def* md, SCM ops) { Translator * g = get_translator (translator_group_type_); g = g->clone (); @@ -277,19 +284,12 @@ Translator_def::instantiate (Music_output_def* md) tg->output_def_ = md; tg->definition_ = self_scm (); - SCM trans_names = get_translator_names (); + SCM trans_names = get_translator_names (ops); tg->simple_trans_list_ = names_to_translators (trans_names, tg); - - return tg; -} -void -Translator_def::apply_default_property_operations (Translator_group*tg) -{ - apply_property_operations (tg, property_ops_); + return tg; } - SCM Translator_def::clone_scm () const { @@ -317,13 +317,19 @@ Translator_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) +{ + apply_property_operations (tg , property_ops_); +} SCM Translator_def::to_alist () const { SCM l = SCM_EOL; - l = gh_cons (gh_cons (ly_symbol2scm ("consists"), get_translator_names ()), l); + l = gh_cons (gh_cons (ly_symbol2scm ("consists"), + get_translator_names (SCM_EOL)), l); l = gh_cons (gh_cons (ly_symbol2scm ("description"), description_), l); l = gh_cons (gh_cons (ly_symbol2scm ("aliases"), context_aliases_), l); l = gh_cons (gh_cons (ly_symbol2scm ("accepts"), get_accepted ()), l); diff --git a/lily/translator-group.cc b/lily/translator-group.cc index 1ce7b11e31..c83baf9f95 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -86,14 +86,15 @@ Translator_group::add_used_group_translator (Translator *t) void -Translator_group::add_fresh_group_translator (Translator*t, SCM pre_init_ops) +Translator_group::add_fresh_group_translator (Translator*t) { Translator_group*tg = dynamic_cast (t); - assert (tg); trans_group_list_ = add_translator (trans_group_list_,t); - unsmob_translator_def (tg->definition_)->apply_default_property_operations (tg); - apply_property_operations (tg, pre_init_ops); + + Translator_def * td = unsmob_translator_def (tg->definition_); + td->apply_default_property_operations (tg); + t->initialize (); } @@ -139,16 +140,19 @@ Translator_group::find_create_translator (SCM n, String id, SCM operations) // start at 1. The first one (index 0) will be us. for (int i=0; i < path.size (); i++) { - Translator_group * new_group = path[i]->instantiate (output_def_); + SCM ops = (i == path.size () -1) ? operations : SCM_EOL; + + Translator_group * new_group + = path[i]->instantiate (output_def_, ops); - SCM ops = SCM_EOL; if (i == path.size () -1) { new_group->id_string_ = id; - ops = operations; } - current->add_fresh_group_translator (new_group, ops); + current->add_fresh_group_translator (new_group); + apply_property_operations (new_group, ops); + current = new_group; } @@ -236,8 +240,8 @@ Translator_group::get_default_interpreter () warning (_f ("can't find or create: `%s'", ly_symbol2string (nm).to_str0 ())); t = unsmob_translator_def (this->definition_); } - Translator_group *tg = t->instantiate (output_def_); - add_fresh_group_translator (tg, SCM_EOL); + Translator_group *tg = t->instantiate (output_def_, SCM_EOL); + add_fresh_group_translator (tg); if (!tg->is_bottom_translator_b ()) return tg->get_default_interpreter (); @@ -473,6 +477,9 @@ Translator_group::context_name () const return ly_symbol2string (td->get_context_name ()); } +/* + PRE_INIT_OPS is in the order specified, and hence must be reversed. + */ void apply_property_operations (Translator_group*tg, SCM pre_init_ops) { diff --git a/lily/vertical-align-engraver.cc b/lily/vertical-align-engraver.cc index e38d46686b..9248973f0b 100644 --- a/lily/vertical-align-engraver.cc +++ b/lily/vertical-align-engraver.cc @@ -21,7 +21,7 @@ public: TRANSLATOR_DECLARATIONS(Vertical_align_engraver); protected: virtual void acknowledge_grob (Grob_info); - virtual void initialize (); + virtual void process_music (); virtual void finalize (); }; @@ -31,11 +31,14 @@ Vertical_align_engraver::Vertical_align_engraver () } void -Vertical_align_engraver::initialize () +Vertical_align_engraver::process_music () { - valign_ =new Spanner (get_property ("VerticalAlignment")); - valign_->set_bound (LEFT,unsmob_grob (get_property ("currentCommandColumn"))); - announce_grob(valign_ , SCM_EOL); + if (!valign_) + { + valign_ =new Spanner (get_property ("VerticalAlignment")); + valign_->set_bound (LEFT,unsmob_grob (get_property ("currentCommandColumn"))); + announce_grob(valign_ , SCM_EOL); + } } void diff --git a/mf/feta-bolletjes.mf b/mf/feta-bolletjes.mf index d173b4bf17..fd4a7e9299 100644 --- a/mf/feta-bolletjes.mf +++ b/mf/feta-bolletjes.mf @@ -285,13 +285,18 @@ fet_beginchar("Quart trianglehead", "2triangle", "trianglehead") fet_endchar; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - +% +% slash heads are for indicating improvisation. They are +% twice as high as normal heads. +% def draw_slash(expr hwid_hash) = + save exact_height; + save ne_dir; + pair ne_dir; + exact_height = staff_space# + stafflinethickness#/2; - - set_char_box (0, staff_space# / slash_slope + hwid_hash, - staff_space#/2 + stafflinethickness#/2, - staff_space#/2 + stafflinethickness#/2); + set_char_box (0, 2 exact_height / slash_slope + hwid_hash, + exact_height, exact_height); charwx := charwd; charwy := charht; @@ -302,13 +307,14 @@ def draw_slash(expr hwid_hash) = bot y1 = - d; top y2 = h; lft x1 = 0; - lft x2 = staff_space / slash_slope; + lft x2 = 2 h / slash_slope; rt x3 = w; y3 = y2; y4 = y1; x3- x2 = x4 - x1; + ne_dir := unitvector( z3 - z4); filldraw z1 --- z2 --- z3 --- z4 --- cycle; if hwid_hash > 2 slash_thick#: @@ -319,11 +325,11 @@ def draw_slash(expr hwid_hash) = y5 = y8; y3 - y7 = th; y5 - y1 = th; - z6 - z5 = whatever * (1, slash_slope); - z8 - z7 = whatever * (1, slash_slope); + z6 - z5 = whatever * ne_dir; + z8 - z7 = whatever * ne_dir; - z5 = z1 + whatever * (1, slash_slope) + (th, 0); - z8 = z4 + whatever * (1, slash_slope) + (-th, 0); + z5 = z1 + whatever * ne_dir + th * (ne_dir rotated -90); + z8 = z4 + whatever * ne_dir + th * (ne_dir rotated 90); unfill z5 -- z6 -- z7 -- z8 -- cycle; @@ -332,19 +338,18 @@ def draw_slash(expr hwid_hash) = enddef; fet_beginchar("Whole slashhead","0slash","wholeslashhead") - draw_slash(2 slash_thick# + 0.5 staff_space#); + draw_slash(4 slash_thick# + 0.5 staff_space#); fet_endchar; fet_beginchar("Half slashhead","1slash","halfslashhead") - draw_slash(2 slash_thick# + 0.15 staff_space#); + draw_slash(3.0 slash_thick# + 0.15 staff_space#); fet_endchar; fet_beginchar("Quart slashhead","2slash","quartslashhead") - draw_slash(slash_thick#); + draw_slash(1.5 slash_thick#); fet_endchar; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - % thick is the distance between the NE/SW parallel lines in the cross % (distance between centres of lines) % in stafflinethickness def -- 2.39.2