]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/parser.yy (Simple_music): \applycontext #FUNCTION allows
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 18 Nov 2002 23:36:42 +0000 (23:36 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 18 Nov 2002 23:36:42 +0000 (23:36 +0000)
code to be executed during interpretation. Possible applications:
smart octavation, more advanced bar checks.

* lily/apply-context-iterator.cc: new file.

13 files changed:
ChangeLog
Documentation/topdocs/INSTALL.texi
Documentation/user/music-glossary.tely
input/regression/custos.ly [new file with mode: 0644]
input/test/clef-end-of-line.ly
input/test/custos.ly [deleted file]
input/test/new-markup.ly [new file with mode: 0644]
lily/apply-context-iterator.cc [new file with mode: 0644]
lily/beam.cc
lily/my-lily-lexer.cc
lily/parser.yy
scm/music-property-description.scm
scm/music-types.scm

index a4b7b297ccfa6d27cc3f91bbb1f17f9c9a680c81..235a726efb26d79867c61a428c889ab272127b33 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2002-11-19  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
+       * 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  <hanwen@cs.uu.nl>
+
+       * 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  <hanwen@cs.uu.nl>
+
+       * Documentation/user/music-glossary.tely (Top): add custos.
+
 2002-11-16  Heikki Junes <hjunes@cc.hut.fi>
 
        * Documentation/topdocs/INSTALL.texi: advise how to include source
index 688e10fb411cf82ce71f3d20ffffefa6fc6bdb2a..012a598e733ea1c63834d3480c10c219b53896c6 100644 (file)
@@ -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}
index f59c1778ca9debed9d15aa993504e2c80b0c9839..1aa2d15578236b336608e4fce7841207b97cff5c 100644 (file)
@@ -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 (file)
index 0000000..fd9a2f9
--- /dev/null
@@ -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 %%
index a2a95b6fb721c74cf32f9caad82807d4fb0ea070..3357f412614bc5f60b2e2752624d3641bf30c428 100644 (file)
@@ -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 (file)
index fd9a2f9..0000000
+++ /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 (file)
index 0000000..3dca2cd
--- /dev/null
@@ -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 (file)
index 0000000..3b42c54
--- /dev/null
@@ -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);
+  
index 975b6685c2f7a3107624314920a5606668f65777..b30abf449258dbf41bf79890aec4afa24aa08900 100644 (file)
@@ -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");
 
 
index 55519c2176168a259c5309df2d758688143d6f5f..d84fb082e3fcd9b4166170734da793efad84ce98 100644 (file)
@@ -28,6 +28,7 @@
 static Keyword_ent the_key_tab[]={
   {"alias", ALIAS},
   {"apply", APPLY},
+  {"applycontext", APPLYCONTEXT},
   {"autochange", AUTOCHANGE},
   {"simultaneous", SIMULTANEOUS},
   {"sequential", SEQUENTIAL},
index 204426ae8a441a6307bf2b71b2b313087e0e7e33..e39a2d78ca22e991180c09b7b73a189cc05ff114 100644 (file)
@@ -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))
index d2ea5533044034d04ab0e601ddbcbe32747cdef0..9dd8e8c9ce9cfcd55e970dded99601f2b2862067 100644 (file)
@@ -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.")
index a0115817aebcacbdaf9ece09a535df7d9c26e824..6c56a7393d0bb01239770b047aae29d2984d0666 100644 (file)
@@ -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: