From: Han-Wen Nienhuys Date: Mon, 18 Nov 2002 23:36:42 +0000 (+0000) Subject: * lily/parser.yy (Simple_music): \applycontext #FUNCTION allows X-Git-Tag: release/1.7.8~4 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=98153531a06b6afa43303e12e5289867dc84c39e;p=lilypond.git * lily/parser.yy (Simple_music): \applycontext #FUNCTION allows code to be executed during interpretation. Possible applications: smart octavation, more advanced bar checks. * lily/apply-context-iterator.cc: new file. --- diff --git a/ChangeLog b/ChangeLog index a4b7b297cc..235a726efb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +2002-11-19 Han-Wen Nienhuys + + * input/regression/apply-context.ly (texidoc): new file + + * lily/parser.yy (Simple_music): \applycontext #FUNCTION allows + code to be executed during interpretation. Possible applications: + smart octavation, more advanced bar checks. + + * lily/apply-context-iterator.cc: new file. + +2002-11-18 Han-Wen Nienhuys + + * input/test/new-markup.ly: new file. + + * lily/text-item.cc (text_to_molecule): new function + + * scm/new-markup.scm (lambda): new file + + * lily/function-documentation.cc (ly_add_function_documentation): + add proc property as well + +2002-11-17 Han-Wen Nienhuys + + * Documentation/user/music-glossary.tely (Top): add custos. + 2002-11-16 Heikki Junes * Documentation/topdocs/INSTALL.texi: advise how to include source diff --git a/Documentation/topdocs/INSTALL.texi b/Documentation/topdocs/INSTALL.texi index 688e10fb41..012a598e73 100644 --- a/Documentation/topdocs/INSTALL.texi +++ b/Documentation/topdocs/INSTALL.texi @@ -90,7 +90,7 @@ to compile them ourselves, they are not updated for every version released. @itemize @bullet -@item @uref{ftp://ftp.cs.uu.nl/pub/GNU/LilyPond/binaries/RedHat-7.x/, Red Hat i386} +@item @uref{http://www-ccrma.stanford.edu/planetccrma/software/soundapps.html#lilypond,Red Hat i386} @item @uref{ftp://ftp.lilypond.org/pub/LilyPond/binaries/SuSE, SuSE} @item @uref{ftp://ftp.lilypond.org/pub/LilyPond/binaries/linuxppc/, LinuxPPC} diff --git a/Documentation/user/music-glossary.tely b/Documentation/user/music-glossary.tely index f59c1778ca..1aa2d15578 100644 --- a/Documentation/user/music-glossary.tely +++ b/Documentation/user/music-glossary.tely @@ -965,6 +965,40 @@ N: ?. In a separate part notes belonging to another part with the purpose of hinting when to start playing. Usually printed in a smaller type. +@aitem{custos} + +A custos is a staff symbol that appears at the end of a staff line +with monophonic musical contents (i.e. with a single voice). It +anticipates the pitch of the first note of the following line and thus +helps the player or singer to manage line breaks during performance, +thus enhancing readability of a score. + +Custodes were frequently used in music notation until the 16th +century. There were different appearences for different notation +styles. Nowadays, they have survived only in special forms of musical +notation such as via the editio vaticana dating back to the beginning +of the 20th century + +@lilypond[13pt] +\score { + \notes { + \property Staff.Custos \set #'neutral-position = #4 + \property Staff.Custos \set #'neutral-direction = #-1 + \property Staff.Custos \set #'adjust-if-on-staffline = ##t + + \property Staff.Custos \set #'style = #'hufnagel + c'1^"Custos style = \#'hufnagel" + \break << d' a' f''>>1 + } + \paper { + \translator { + \StaffContext + \consists Custos_engraver + } + } +} +@end lilypond + @aitem{D} ES: Re, I: re, diff --git a/input/regression/custos.ly b/input/regression/custos.ly new file mode 100644 index 0000000000..fd9a2f9bac --- /dev/null +++ b/input/regression/custos.ly @@ -0,0 +1,35 @@ +\version "1.7.6" +\header { + texidoc = "custodes in various styles." +} + +\score { + \notes { + \property Staff.Custos \set #'neutral-position = #4 + \property Staff.Custos \set #'neutral-direction = #-1 + \property Staff.Custos \set #'adjust-if-on-staffline = ##t + + \property Staff.Custos \set #'style = #'hufnagel + c'1^"Custos style = \#'hufnagel" + \break << d' a' f''>>1 + + \property Staff.Custos \set #'style = #'medicaea + c'1^"Custos style = \#'medicaea" + \break << d' a' f''>>1 + + \property Staff.Custos \set #'style = #'vaticana + c'1^"Custos style = \#'vaticana" + \break << d' a' f''>>1 + + \property Staff.Custos \set #'style = #'mensural + c'1^"Custos style = \#'mensural" + \break << d' a' f''>>1 + } + \paper { + \translator { + \StaffContext + \consists Custos_engraver + } + } +} +%% new-chords-done %% diff --git a/input/test/clef-end-of-line.ly b/input/test/clef-end-of-line.ly index a2a95b6fb7..3357f41261 100644 --- a/input/test/clef-end-of-line.ly +++ b/input/test/clef-end-of-line.ly @@ -1,3 +1,4 @@ + \version "1.7.7" \header { diff --git a/input/test/custos.ly b/input/test/custos.ly deleted file mode 100644 index fd9a2f9bac..0000000000 --- a/input/test/custos.ly +++ /dev/null @@ -1,35 +0,0 @@ -\version "1.7.6" -\header { - texidoc = "custodes in various styles." -} - -\score { - \notes { - \property Staff.Custos \set #'neutral-position = #4 - \property Staff.Custos \set #'neutral-direction = #-1 - \property Staff.Custos \set #'adjust-if-on-staffline = ##t - - \property Staff.Custos \set #'style = #'hufnagel - c'1^"Custos style = \#'hufnagel" - \break << d' a' f''>>1 - - \property Staff.Custos \set #'style = #'medicaea - c'1^"Custos style = \#'medicaea" - \break << d' a' f''>>1 - - \property Staff.Custos \set #'style = #'vaticana - c'1^"Custos style = \#'vaticana" - \break << d' a' f''>>1 - - \property Staff.Custos \set #'style = #'mensural - c'1^"Custos style = \#'mensural" - \break << d' a' f''>>1 - } - \paper { - \translator { - \StaffContext - \consists Custos_engraver - } - } -} -%% new-chords-done %% diff --git a/input/test/new-markup.ly b/input/test/new-markup.ly new file mode 100644 index 0000000000..3dca2cd8eb --- /dev/null +++ b/input/test/new-markup.ly @@ -0,0 +1,15 @@ +\version "1.7.7" +\header { + texidoc =" New markup scheme. Semantically more sane. We haven't + invented a nice syntax yet." +} + +\score { + \notes \context Voice { + \property Voice.TextScript \set #'molecule-callback = #brew-new-markup-molecule + c4^#`(,simple-markup "foo") + c4^#`(,column-markup ( + (,bold-markup (,simple-markup "foo")) + (,simple-markup "bar"))) + } +} diff --git a/lily/apply-context-iterator.cc b/lily/apply-context-iterator.cc new file mode 100644 index 0000000000..3b42c54fcb --- /dev/null +++ b/lily/apply-context-iterator.cc @@ -0,0 +1,29 @@ +#include "simple-music-iterator.hh" +#include "translator-group.hh" +#include "music.hh" + +/** + Iterate a property. + */ +class Apply_context_iterator : public Simple_music_iterator +{ +public: + VIRTUAL_COPY_CONS (Music_iterator); + DECLARE_SCHEME_CALLBACK(constructor, ()); +protected: + virtual void process (Moment); +}; + + +void +Apply_context_iterator::process (Moment m) +{ + SCM proc = get_music ()->get_mus_property ("procedure"); + + scm_call_1 (proc, report_to()->self_scm()); + + Simple_music_iterator::process(m); +} + +IMPLEMENT_CTOR_CALLBACK (Apply_context_iterator); + diff --git a/lily/beam.cc b/lily/beam.cc index 975b6685c2..b30abf4492 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -1484,23 +1484,22 @@ Beam::get_direction_beam_count (Grob *me, Direction d ) ADD_INTERFACE (Beam, "beam-interface", - "A beam. - -#'thickness= weight of beams, in staffspace - - -We take the least squares line through the ideal-length stems, and -then damp that using - - damped = tanh (slope) - -this gives an unquantized left and right position for the beam end. -Then we take all combinations of quantings near these left and right -positions, and give them a score (according to how close they are to -the ideal slope, how close the result is to the ideal stems, etc.). We -take the best scoring combination. - -", + "A beam. \n\n" +" " +"#'thickness= weight of beams, in staffspace " +" " +" " +"We take the least squares line through the ideal-length stems, and " +"then damp that using " +" \n" +" damped = tanh (slope) \n" +" \n" +"this gives an unquantized left and right position for the beam end. " +"Then we take all combinations of quantings near these left and right " +"positions, and give them a score (according to how close they are to " +"the ideal slope, how close the result is to the ideal stems, etc.). We " +"take the best scoring combination. " +, "knee french-beaming position-callbacks concaveness-gap concaveness-threshold dir-function quant-score auto-knee-gap gap chord-tremolo beamed-stem-shorten shorten least-squares-dy damping flag-width-function neutral-direction positions space-function thickness"); diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index 55519c2176..d84fb082e3 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -28,6 +28,7 @@ static Keyword_ent the_key_tab[]={ {"alias", ALIAS}, {"apply", APPLY}, + {"applycontext", APPLYCONTEXT}, {"autochange", AUTOCHANGE}, {"simultaneous", SIMULTANEOUS}, {"sequential", SEQUENTIAL}, diff --git a/lily/parser.yy b/lily/parser.yy index 204426ae8a..e39a2d78ca 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -179,6 +179,7 @@ yylex (YYSTYPE *s, void * v) /* tokens which are not keywords */ %token AUTOCHANGE %token ALIAS +%token APPLYCONTEXT %token APPLY %token ACCEPTS %token ALTERNATIVE @@ -788,6 +789,13 @@ Simultaneous_music: Simple_music: event_chord { $$ = $1; } + | APPLYCONTEXT embedded_scm { + if (!gh_procedure_p ($2)) + THIS->parser_error (_ ("\applycontext takes function argument")); + $$ = MY_MAKE_MUSIC ("ApplyContext"); + $$->set_mus_property ("procedure", $2); + $$->set_spot (THIS->here_input()); + } | OUTPUTPROPERTY embedded_scm embedded_scm '=' embedded_scm { SCM pred = $2; if (!gh_symbol_p ($3)) diff --git a/scm/music-property-description.scm b/scm/music-property-description.scm index d2ea553304..9dd8e8c9ce 100644 --- a/scm/music-property-description.scm +++ b/scm/music-property-description.scm @@ -61,7 +61,8 @@ TODO: consider making type into symbol ") (music-property-description 'pitch ly:pitch? "the pitch of this note") (music-property-description 'pitch-alist list? "list of pitches jointly forming the scale of a key signature") (music-property-description 'pop-first boolean? "Do a revert before we try to do a override on some grob property.") - +(music-property-description 'procedure procedure? + "The function to run with \\applycontext. It must take a single argument, being the context.") (music-property-description 'predicate procedure? "the predicate of a \outputproperty") (music-property-description 'type symbol? "The type of this music object. Determines iteration in some cases.") (music-property-description 'types list? "The types of this music object. Determines iteration in some cases.") diff --git a/scm/music-types.scm b/scm/music-types.scm index a0115817ae..6c56a7393d 100644 --- a/scm/music-types.scm +++ b/scm/music-types.scm @@ -15,6 +15,13 @@ where x is one of \@\{\\ppp, \\pp, \\p, \\mp, \\mf, \\f, \\ff, \\fff.\@\}") (internal-class-name . "Event") (types . (general-music event dynamic-event absolute-dynamic-event)) )) + (ApplyContext + . ( + (description . "Call the argument with the current context during interpreting phase") + (internal-class-name . "Music") + (types . (general-music apply-context)) + (iterator-ctor . ,Apply_context_iterator::constructor) + )) (ArpeggioEvent . ( (description . "Make an arpeggio on this note. Syntax: