From: Han-Wen Nienhuys Date: Thu, 27 May 2004 17:12:02 +0000 (+0000) Subject: * lily/music-output-def.cc (Music_output_def): remove separate X-Git-Tag: release/2.3.3~22 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=13d8b383afd5bceb11747f5a3ee79ee9d4eca0aa;p=lilypond.git * lily/music-output-def.cc (Music_output_def): remove separate translator table. Lookup translators in scope directly. This obviates Context suffix for context identifiers, i.e. * Documentation/user/notation.itely (Chords mode): typo: 13 -> 3. * Documentation/user/changing-defaults.itely (Horizontal spacing): document spacing override hack. --- diff --git a/ChangeLog b/ChangeLog index 6ab627920a..da3a853ce6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2004-05-27 Han-Wen Nienhuys + + * lily/music-output-def.cc (Music_output_def): remove separate + translator table. Lookup translators in scope directly. This + obviates Context suffix for context identifiers, i.e. + + \context { + \Staff + .. + } + + + will work. + + + * Documentation/user/notation.itely (Chords mode): typo: 13 -> 3. + + * Documentation/user/changing-defaults.itely (Horizontal spacing): + document spacing override hack. + 2004-05-27 Jan Nieuwenhuizen * scm/output-gnome.scm: Add C-q, C-w keybindings. Update @@ -6,6 +26,8 @@ 2004-05-26 Han-Wen Nienhuys + * VERSION: 2.3.2 released + * lily/parser.yy (book_body): set default bookpaper. * scm/output-tex.scm (header): kludge: hard code linewidth. diff --git a/Documentation/topdocs/NEWS.texi b/Documentation/topdocs/NEWS.texi index 1347d2791e..a79c291906 100644 --- a/Documentation/topdocs/NEWS.texi +++ b/Documentation/topdocs/NEWS.texi @@ -8,6 +8,17 @@ @itemize @bullet +@item Context definitions are now stored in identifiers that match the +context name, in other words, to modify a @code{Staff} context, the +following code may be used. + +@example + \context @{ + \Staff + .. + @} +@end example + @item A new block, @code{\bookpaper} has been introduced to hold settings for paper size and output scaling. @@ -95,10 +106,9 @@ block at toplevel is encapsulated in a @code{book} block. A The default value is one octave below middle C. @c update-me? formal definition of newaddlyrics, once it works -@item Combining lyrics with music can be @code{\newlyrics} +@item Combining lyrics with music can be done with @code{\newlyrics} @example -<< \relative @{ \clef bass d2 d c4 bes a2 \break @@ -109,7 +119,6 @@ The default value is one octave below middle C. \newlyrics @{ Not much can go wrong! @} ->> @end example Syntactically, @code{\newlyrics} acts like an infix operator. diff --git a/Documentation/user/changing-defaults.itely b/Documentation/user/changing-defaults.itely index 8f244a7c8e..9d82431678 100644 --- a/Documentation/user/changing-defaults.itely +++ b/Documentation/user/changing-defaults.itely @@ -693,7 +693,7 @@ from the music, in the @code{\paper} block, \paper @{ @dots{} \context @{ - \StaffContext + \Staff \set fontSize = #-2 \override Stem #'thickness @@ -704,13 +704,12 @@ from the music, in the @code{\paper} block, Here @example - \StaffContext + \Staff @end example @noindent takes the existing definition @context{Staff} from the identifier -@code{StaffContext}. This works analogously to other contexts, so that -the existing definition of @code{Voice} is in @code{\VoiceContext}. +@code{Staff}. This works analogously to other contexts. The statements @example @@ -764,7 +763,7 @@ to indicate improvisation in Jazz pieces, \override Stem #'transparent = ##t \alias Voice } - \context { \StaffContext + \context { \Staff \accepts "ImproVoice" }} \score { \notes \relative c'' { @@ -1874,8 +1873,13 @@ changes its character (measured in durations) halfway during the score, the part containing the longer durations will be spaced too widely. -There is no convenient mechanism to manually override spacing. +There is no convenient mechanism to manually override spacing. The +following work-around may be used to insert extra space into a score. +@example + \once \override Score.SeparationItem #'padding = #1 +@end example +No work-around exists for decreasing the amount of space. @menu diff --git a/Documentation/user/invoking.itexi b/Documentation/user/invoking.itexi index a66b62f6ed..3fdebf1ae0 100644 --- a/Documentation/user/invoking.itexi +++ b/Documentation/user/invoking.itexi @@ -427,6 +427,12 @@ intended to help the programmers and debuggers. Usually, they can be ignored. Sometimes, they come in such big quantities that they obscure other output. In this case, file a bug-report. +@item Aborted (core dumped) +This signals a serious programming error that caused the program to +crash. Such errors are considered critical. If you stumble on one, +send a bugreport. + + @end table @cindex errors, message format diff --git a/Documentation/user/notation.itely b/Documentation/user/notation.itely index f67f948b67..a37e99b822 100644 --- a/Documentation/user/notation.itely +++ b/Documentation/user/notation.itely @@ -3924,7 +3924,7 @@ Modifiers can be mixed with additions @cindex @code{m} Since an unaltered 11 does not sound good when combined with an -unaltered 13, the 11 is removed in this case (unless it is added +unaltered 3, the 11 is removed in this case (unless it is added explicitly) @c @lilypond[quote,fragment,verbatim] diff --git a/input/test/ancient-font.ly b/input/test/ancient-font.ly index 71bc283ee2..9268eeb072 100644 --- a/input/test/ancient-font.ly +++ b/input/test/ancient-font.ly @@ -1,4 +1,4 @@ -\version "2.3.1" +\version "2.3.2" % TODO: split ancient-font into seperate files; possibly in % different locations. \header { @@ -222,13 +222,13 @@ lowerStaff = \context MensuralStaff = lowerStaff << linethickness = #(/ staffspace 5.0) indent = 0.0 \context { - \ScoreContext + \Score \accepts MensuralStaff \accepts GregorianStaff % timing = ##f %%%%%%%% FIXME: this has no effect } \context { - \VoiceContext + \Voice \name MensuralVoice \alias Voice \remove Ligature_bracket_engraver @@ -240,7 +240,7 @@ lowerStaff = \context MensuralStaff = lowerStaff << autoBeaming = ##f } \context { - \VoiceContext + \Voice \name GregorianVoice \alias Voice \remove Ligature_bracket_engraver @@ -249,7 +249,7 @@ lowerStaff = \context MensuralStaff = lowerStaff << autoBeaming = ##f } \context { - \StaffContext + \Staff \name MensuralStaff \alias Staff \accepts MensuralVoice @@ -265,7 +265,7 @@ lowerStaff = \context MensuralStaff = lowerStaff << clefOctavation = #0 } \context { - \StaffContext + \Staff \name GregorianStaff \alias Staff \accepts GregorianVoice diff --git a/lily/auto-beam-engraver.cc b/lily/auto-beam-engraver.cc index cbeba2f434..fda74a0cf0 100644 --- a/lily/auto-beam-engraver.cc +++ b/lily/auto-beam-engraver.cc @@ -21,9 +21,6 @@ #include "duration.hh" #include "context.hh" -/* - TODO: documentme. - */ class Auto_beam_engraver : public Engraver { TRANSLATOR_DECLARATIONS (Auto_beam_engraver); diff --git a/lily/include/music-output-def.hh b/lily/include/music-output-def.hh index bbaf79cfc4..d95ee038bc 100644 --- a/lily/include/music-output-def.hh +++ b/lily/include/music-output-def.hh @@ -22,26 +22,21 @@ class Music_output_def { public: - Scheme_hash_table * translator_tab_; Input input_origin_; - Array targets_; SCM scope_; - virtual void derived_mark (); + void assign_context_def (SCM transdef); + SCM find_context_def (SCM name) const; + Music_output_def (Music_output_def const&); Music_output_def (); VIRTUAL_COPY_CONSTRUCTOR (Music_output_def, Music_output_def); Context *get_group_translator (String type) const; - void assign_context_def (SCM transdef); - SCM find_context_def (SCM name) const; String outname_string () ; SCM c_variable (String id) const; SCM lookup_variable (SCM sym) const; void set_variable (SCM, SCM sym); - // fixme: dependencies - // virtual void add_target_file (String); - DECLARE_SMOBS (Music_output_def,); }; diff --git a/lily/include/paper-def.hh b/lily/include/paper-def.hh index f5ea1cacb4..a23afe7f45 100644 --- a/lily/include/paper-def.hh +++ b/lily/include/paper-def.hh @@ -55,7 +55,6 @@ public: Paper_def (); Paper_def (Paper_def const&); virtual ~Paper_def (); - virtual void derived_mark (); Paper_outputter* get_paper_outputter (String) const; SCM font_descriptions () const; diff --git a/lily/music-output-def.cc b/lily/music-output-def.cc index 54b9b33cab..042398e6f0 100644 --- a/lily/music-output-def.cc +++ b/lily/music-output-def.cc @@ -21,11 +21,9 @@ Music_output_def::Music_output_def () { - translator_tab_ = new Scheme_hash_table; scope_ = SCM_EOL; smobify_self (); - scm_gc_unprotect_object (translator_tab_->self_scm ()); scope_ = ly_make_anonymous_module (false); } @@ -36,12 +34,8 @@ Music_output_def::~Music_output_def () Music_output_def::Music_output_def (Music_output_def const &s) { scope_ = SCM_EOL; - translator_tab_ = 0; smobify_self (); - translator_tab_ = new Scheme_hash_table (*s.translator_tab_); - scm_gc_unprotect_object (translator_tab_->self_scm ()); - scope_= ly_make_anonymous_module (false); if (is_module (s.scope_)) ly_import_module (scope_, s.scope_); @@ -55,31 +49,22 @@ SCM Music_output_def::mark_smob (SCM m) { Music_output_def * mo = (Music_output_def*) SCM_CELL_WORD_1 (m); - if (mo->translator_tab_) - scm_gc_mark (mo->translator_tab_->self_scm ()); - - mo->derived_mark (); - return mo->scope_; } -void -Music_output_def::derived_mark () -{ - -} - void Music_output_def::assign_context_def (SCM transdef) { Context_def *tp = unsmob_context_def (transdef); assert (tp); - translator_tab_->set (tp->get_context_name (), transdef); + if (tp) + { + SCM sym = tp->get_context_name (); + scm_module_define (scope_, sym, transdef); + } String nm = ly_symbol2string (tp->get_context_name ()) + "Context"; - - scm_module_define (scope_, ly_symbol2scm (nm.to_str0 ()), transdef); } @@ -89,9 +74,16 @@ Music_output_def::assign_context_def (SCM transdef) SCM Music_output_def::find_context_def (SCM name) const { - SCM val =SCM_EOL; - translator_tab_->try_retrieve (name, &val); - return val; + SCM var = ly_module_lookup (scope_, name); + + if (var != SCM_BOOL_F) + { + var = scm_variable_ref (var); + Context_def *cd = (unsmob_context_def (var)); + return cd ? cd->self_scm () : SCM_EOL; + } + else + return SCM_EOL; } int @@ -168,12 +160,19 @@ LY_DEFINE(ly_output_description, "ly:output-description", "Return the description of translators in @var{output-def}.") { Music_output_def *id = unsmob_music_output_def (output_def); - SCM al = id->translator_tab_->to_alist (); + + SCM al =ly_module_to_alist (id->scope_); + SCM l = SCM_EOL; for (SCM s = al ; ly_c_pair_p (s); s = ly_cdr (s)) { Context_def * td = unsmob_context_def (ly_cdar (s)); - l = scm_cons (scm_cons (ly_caar (s), td->to_alist ()), l); + SCM key = ly_caar (s); + if (td && key == td->get_context_name ()) + { + + l = scm_cons (scm_cons (key, td->to_alist ()), l); + } } return l; } diff --git a/lily/paper-def.cc b/lily/paper-def.cc index 85cb00b73e..388235ab7d 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -44,13 +44,6 @@ Paper_def::~Paper_def () { } -void -Paper_def::derived_mark () -{ - if (bookpaper_) - scm_gc_mark (bookpaper_->self_scm ()); -} - Real Paper_def::get_dimension (SCM s) const { diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index 98151137c3..9f0aeef0cb 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -150,9 +150,15 @@ Rest_collision::do_shift (Grob *me) ordered_rests[d].sort (Note_column::shift_compare); } while (flip (&d) != LEFT); - if (ordered_rests[UP].size () < 1 - || ordered_rests[DOWN].size () < 1) - return SCM_UNSPECIFIED; + do { + if (ordered_rests[d].size () < 1) + { + if (ordered_rests[-d].size() > 1) + ordered_rests[-d][0]->warning (_("Too many colliding rests.")); + + return SCM_UNSPECIFIED; + } + } while (flip (&d) != LEFT); Grob *common = common_refpoint_of_array (ordered_rests[DOWN], me, Y_AXIS); common = common_refpoint_of_array (ordered_rests[UP], common, Y_AXIS); @@ -245,7 +251,7 @@ Rest_collision::do_shift (Grob *me) ADD_INTERFACE (Rest_collision,"rest-collision-interface", - "Move around ordinary rests (not multi-measure-rests) to avoid " -"conflicts.", - "minimum-distance positioning-done elements"); + "Move around ordinary rests (not multi-measure-rests) to avoid " + "conflicts.", + "minimum-distance positioning-done elements"); diff --git a/lily/system.cc b/lily/system.cc index 72937087f8..fed4dfd792 100644 --- a/lily/system.cc +++ b/lily/system.cc @@ -377,7 +377,7 @@ System::get_line () Interval x (extent (this, X_AXIS)); Interval y (extent (this, Y_AXIS)); Paper_line *pl = new Paper_line (Offset (x.length (), y.length ()), - stencils, penalty); + stencils, (bool) penalty); // FIXME. return scm_gc_unprotect_object (pl->self_scm ()); } diff --git a/scm/document-translation.scm b/scm/document-translation.scm index a138bbc399..b5ac64d324 100644 --- a/scm/document-translation.scm +++ b/scm/document-translation.scm @@ -115,7 +115,6 @@ )) ;; Second level, part of Context description - (define name->engraver-table (make-vector 61 '())) (map (lambda (x) diff --git a/scm/lily.scm b/scm/lily.scm index 186e92ade1..6e6605703e 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -7,6 +7,7 @@ ;;; Library functions + (if (defined? 'set-debug-cell-accesses!) (set-debug-cell-accesses! #f)) diff --git a/scm/page-layout.scm b/scm/page-layout.scm index 26c37b474a..5d22f14c00 100644 --- a/scm/page-layout.scm +++ b/scm/page-layout.scm @@ -20,7 +20,7 @@ (let ((props (page-properties paper))) (interpret-markup paper props - (markup #:fill-line ("" (number->string page-number)))))) + (markup #:fill-line ("" (number->string page-number)))))) (define TAGLINE diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py index 934e52ea78..cabc4a0ba0 100644 --- a/scripts/convert-ly.py +++ b/scripts/convert-ly.py @@ -2088,6 +2088,19 @@ def conv (str): conversions.append (((2, 3, 1), conv, '''\\apply -> \\applymusic''')) +def conv (str): + def func(m): + if m.group(1) not in ['RemoveEmptyStaff', + ]: + return '\\' + m.group (1) + else: + return m.group (0) + + return re.sub (r'\\([a-zA-Z]+)Context\b', func, str) + +conversions.append (((2, 3, 2), conv, + '''\\FooContext -> \\Foo''')) + ################################ # END OF CONVERSIONS ################################