From feb0b96b015c19f2c215326689924acabce0c9a5 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Fri, 7 May 2004 09:16:10 +0000 Subject: [PATCH] (conv): \apply -> \applymusic --- ChangeLog | 4 ++++ Documentation/user/notation.itely | 6 ++--- .../user/programming-interface.itely | 24 +++++++++---------- input/regression/apply-context.ly | 2 +- input/regression/apply-output.ly | 2 +- input/regression/balloon.ly | 2 +- input/regression/cluster-cross-staff.ly | 4 ++-- input/regression/cluster.ly | 4 ++-- input/regression/generic-output-property.ly | 2 +- input/regression/music-map.ly | 4 ++-- input/regression/repeat-unfold-all.ly | 4 ++-- input/regression/repeat-unfold-tremolo.ly | 6 ++--- input/regression/tag-filter.ly | 6 ++--- input/regression/tuplet-nest.ly | 2 +- input/screech-boink.ly | 4 ++-- input/test/add-staccato.ly | 4 ++-- input/test/add-text-script.ly | 4 ++-- input/test/ambitus-mixed.ly | 2 +- input/test/ancient-font.ly | 2 +- input/test/bar-number-every-five-reset.ly | 2 +- input/test/move-accidentals.ly | 2 +- input/test/move-specific-text.ly | 2 +- input/test/music-box.ly | 6 ++--- input/test/polymetric-differing-notes.ly | 6 ++--- input/test/reverse-music.ly | 4 ++-- input/test/smart-transpose.ly | 6 ++--- input/test/unfold-all-repeats.ly | 4 ++-- input/wilhelmus.ly | 2 +- lily/music-function.cc | 3 ++- lily/parser.yy | 7 +++--- ly/grace-init.ly | 2 +- scm/document-functions.scm | 12 ++++------ scripts/convert-ly.py | 6 +++++ 33 files changed, 80 insertions(+), 72 deletions(-) diff --git a/ChangeLog b/ChangeLog index a7b1661307..59a9a7f878 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-05-07 Han-Wen Nienhuys + + * scripts/convert-ly.py (conv): \apply -> \applymusic + 2004-05-06 Kristof Bastiaensen * elisp/lilypond-mode.el: changed the order of some commands diff --git a/Documentation/user/notation.itely b/Documentation/user/notation.itely index 8ac4acb22f..32bb0ff043 100644 --- a/Documentation/user/notation.itely +++ b/Documentation/user/notation.itely @@ -4663,8 +4663,8 @@ filtered. For example, @example \simultaneous @{ @var{the music} - \apply #(remove-tag 'score) @var{the music} - \apply #(remove-tag 'part) @var{the music} + \applymusic #(remove-tag 'score) @var{the music} + \applymusic #(remove-tag 'part) @var{the music} @} @end example would yield @@ -7369,7 +7369,7 @@ applying the function @code{notes-to-clusters} to a sequence of chords, e.g. @c @lilypond[quote,relative=2,verbatim] -\apply #notes-to-clusters { } +\applymusic #notes-to-clusters { } @end lilypond The following example (from diff --git a/Documentation/user/programming-interface.itely b/Documentation/user/programming-interface.itely index e5d06e7853..8f8ac35cbc 100644 --- a/Documentation/user/programming-interface.itely +++ b/Documentation/user/programming-interface.itely @@ -151,11 +151,11 @@ follows the general form of Such syntax can also be defined as user code. To do this, it is necessary to create a @em{music function}. This is a specially marked -Scheme function. For example, the music function @code{\apply} applies +Scheme function. For example, the music function @code{\applymusic} applies a user-defined function to a music expression. Its syntax is @example -\apply #@var{func} @var{music} +\applymusic #@var{func} @var{music} @end example A music function is created with @code{ly:make-music-function}, @@ -164,7 +164,7 @@ A music function is created with @code{ly:make-music-function}, (ly:make-music-function @end example -@code{\apply} takes a Scheme function and a Music expression as +@code{\applymusic} takes a Scheme function and a Music expression as argument. This is encoded in its first argument, @example @@ -183,7 +183,7 @@ function @end example The above Scheme code only defines the functionality. The tag -@code{\apply} is selected by defining +@code{\applymusic} is selected by defining @example apply = #(ly:make-music-function @@ -192,17 +192,17 @@ The above Scheme code only defines the functionality. The tag (func music))) @end example -Examples of the use of @code{\apply} are in the next section. +Examples of the use of @code{\applymusic} are in the next section. @node Manipulating music expressions @appendixsubsec Manipulating music expressions Music objects and their properties can be accessed and manipulated -directly, through the @code{\apply} mechanism. -The syntax for @code{\apply} is +directly, through the @code{\applymusic} mechanism. +The syntax for @code{\applymusic} is @example -\apply #@var{func} @var{music} +\applymusic #@var{func} @var{music} @end example @noindent @@ -219,7 +219,7 @@ its argument: (ly:music-set-property! m 'elements (reverse (ly:music-property m 'elements))) m) - \score { \notes \apply #rev-music-1 { c4 d4 } } + \score { \notes \applymusic #rev-music-1 { c4 d4 } } @end lilypond The use of such a function is very limited. The effect of this @@ -227,13 +227,13 @@ function is void when applied to an argument which is does not have multiple children. The following function application has no effect: @example - \apply #rev-music-1 \grace @{ c4 d4 @} + \applymusic #rev-music-1 \grace @{ c4 d4 @} @end example @noindent In this case, @code{\grace} is stored as @internalsref{GraceMusic}, which has no @code{elements}, only a single @code{element}. Every generally -applicable function for @code{\apply} must -- like music expressions +applicable function for @code{\applymusic} must -- like music expressions themselves -- be recursive. The following example is such a recursive function: It first extracts @@ -273,7 +273,7 @@ above by the internal equivalent of \context Voice = "2" @{ \voiceTwo b @} >> @end example -Other applications of @code{\apply} are writing out repeats +Other applications of @code{\applymusic} are writing out repeats automatically (@inputfileref{input/test,unfold-all-repeats.ly}), saving keystrokes (@inputfileref{input/test,music-box.ly}) and exporting diff --git a/input/regression/apply-context.ly b/input/regression/apply-context.ly index 50a6807de6..9bca0035a8 100644 --- a/input/regression/apply-context.ly +++ b/input/regression/apply-context.ly @@ -1,5 +1,5 @@ -\version "2.2.0" +\version "2.3.1" \header { diff --git a/input/regression/apply-output.ly b/input/regression/apply-output.ly index 426e64f9f0..853eb29cef 100644 --- a/input/regression/apply-output.ly +++ b/input/regression/apply-output.ly @@ -1,5 +1,5 @@ -\version "2.2.0" +\version "2.3.1" \header { texidoc = "The @code{\applyoutput} expression is the most flexible way to diff --git a/input/regression/balloon.ly b/input/regression/balloon.ly index fd71bbc544..63fa72a1a8 100644 --- a/input/regression/balloon.ly +++ b/input/regression/balloon.ly @@ -3,7 +3,7 @@ texidoc = "With balloon texts, objects in the output can be marked, with lines and explanatory text added." } -\version "2.2.0" +\version "2.3.1" \score { \notes { diff --git a/input/regression/cluster-cross-staff.ly b/input/regression/cluster-cross-staff.ly index 9cc7ce6e0e..ba52e278ae 100644 --- a/input/regression/cluster-cross-staff.ly +++ b/input/regression/cluster-cross-staff.ly @@ -4,7 +4,7 @@ } -\version "2.2.0" +\version "2.3.1" \score { \notes \new PianoStaff << @@ -12,7 +12,7 @@ s1 *2 } \context Staff = down << - \apply #notes-to-clusters \relative c { 4 \change Staff = up + \applymusic #notes-to-clusters \relative c { 4 \change Staff = up } { \clef bass s1 * 2 } diff --git a/input/regression/cluster.ly b/input/regression/cluster.ly index 70633f4214..aa16d05396 100644 --- a/input/regression/cluster.ly +++ b/input/regression/cluster.ly @@ -1,5 +1,5 @@ -\version "2.2.0" +\version "2.3.1" \header { texidoc = "Clusters are a device to denote that a complete range of notes is to be played." @@ -13,7 +13,7 @@ fragment =\notes \relative c' { \score { \notes << \new Staff \fragment - \new Staff \apply #notes-to-clusters \fragment + \new Staff \applymusic #notes-to-clusters \fragment >> \paper { raggedright = ##t } } diff --git a/input/regression/generic-output-property.ly b/input/regression/generic-output-property.ly index aac9f00dde..7a8bafbe8e 100644 --- a/input/regression/generic-output-property.ly +++ b/input/regression/generic-output-property.ly @@ -1,5 +1,5 @@ -\version "2.2.0" +\version "2.3.1" \header{ texidoc=" diff --git a/input/regression/music-map.ly b/input/regression/music-map.ly index 67c5d7852e..6246f42dc6 100644 --- a/input/regression/music-map.ly +++ b/input/regression/music-map.ly @@ -10,7 +10,7 @@ dynamics are left over. These are put onto the 2nd measure." } -\version "2.2.0" +\version "2.3.1" #(define (notes-to-skip m) "Convert all stuff with duration (notes, lyrics, bass figures, etc.) to skips. @@ -35,7 +35,7 @@ foobar = \notes \transpose c c' { c4\>-^ c4-^ c4\!-^ c4-^ } \notes \relative c'' \context Voice { \foobar - << \apply #(lambda (x) (music-map notes-to-skip x)) + << \applymusic #(lambda (x) (music-map notes-to-skip x)) \foobar { d2 d2 } >> }} diff --git a/input/regression/repeat-unfold-all.ly b/input/regression/repeat-unfold-all.ly index db3fc7de03..07d34f1c87 100644 --- a/input/regression/repeat-unfold-all.ly +++ b/input/regression/repeat-unfold-all.ly @@ -1,4 +1,4 @@ -\version "2.2.0" +\version "2.3.1" \header { texidoc = "Volta repeats may be unfolded through the Scheme function @code{unfold-repeats}." @@ -13,7 +13,7 @@ nots = \notes\relative c' { \notes \context Voice { \nots \bar "||" - \apply #unfold-repeats \nots + \applymusic #unfold-repeats \nots } \paper {raggedright = ##t} } diff --git a/input/regression/repeat-unfold-tremolo.ly b/input/regression/repeat-unfold-tremolo.ly index ba1bde2268..350fa9e975 100644 --- a/input/regression/repeat-unfold-tremolo.ly +++ b/input/regression/repeat-unfold-tremolo.ly @@ -1,4 +1,4 @@ -\version "2.2.0" +\version "2.3.1" \header { texidoc = "Unfolding tremolo repeats. All fragments fill one @@ -10,12 +10,12 @@ \score{ \notes{ \time 2/4 - \apply #unfold-repeats + \applymusic #unfold-repeats { \repeat tremolo 4 { c'16 e' } | \repeat tremolo 8 c'16 } | \time 3/4 - \apply #unfold-repeats + \applymusic #unfold-repeats { \repeat tremolo 6 { c'16 e' } | \repeat tremolo 12 c'16 } | \bar "|." diff --git a/input/regression/tag-filter.ly b/input/regression/tag-filter.ly index 4f3ff5dcbc..593c89b2aa 100644 --- a/input/regression/tag-filter.ly +++ b/input/regression/tag-filter.ly @@ -1,5 +1,5 @@ -\version "2.2.0" +\version "2.3.1" \header { texidoc = "The @code{\\tag} command marks music expressions with a @@ -38,11 +38,11 @@ common = } \new Staff { \set Staff.instrument = #"part" - \apply #(remove-tag 'score) \common + \applymusic #(remove-tag 'score) \common } \new Staff { \set Staff.instrument = #"score" - \apply #(remove-tag 'part) \common + \applymusic #(remove-tag 'part) \common } } } diff --git a/input/regression/tuplet-nest.ly b/input/regression/tuplet-nest.ly index 73facf8d3d..216ca7892f 100644 --- a/input/regression/tuplet-nest.ly +++ b/input/regression/tuplet-nest.ly @@ -1,5 +1,5 @@ -\version "2.2.0" +\version "2.3.1" \header { texidoc="By a manual hack for nested tuplets, an outer tuplet can be moved up." } diff --git a/input/screech-boink.ly b/input/screech-boink.ly index 31cbad7b7f..3e7d3330a2 100644 --- a/input/screech-boink.ly +++ b/input/screech-boink.ly @@ -1,4 +1,4 @@ -\version "2.2.0" +\version "2.3.1" \header { title = "Screech and boink" subtitle = "Random complex notation" @@ -40,7 +40,7 @@ \override Beam #'thickness = #0.3 \override Stem #'thickness = #4.0 g'16[ b16 fis16 g16] - << \apply #notes-to-clusters { + << \applymusic #notes-to-clusters { as16 diff --git a/input/test/add-staccato.ly b/input/test/add-staccato.ly index 7a0975085b..fa6498658d 100644 --- a/input/test/add-staccato.ly +++ b/input/test/add-staccato.ly @@ -1,5 +1,5 @@ -\version "2.2.0" +\version "2.3.1" \header { @@ -27,7 +27,7 @@ it is not necessary to use scm constructs (see @code{separate-staccato.ly}). \score { \notes\relative c'' { - a b \apply #(lambda (x) (music-map add-staccato x)) { c c } + a b \applymusic #(lambda (x) (music-map add-staccato x)) { c c } } \paper{ raggedright = ##t } } diff --git a/input/test/add-text-script.ly b/input/test/add-text-script.ly index 2c6ead7bd9..c9d32e4da2 100644 --- a/input/test/add-text-script.ly +++ b/input/test/add-text-script.ly @@ -1,4 +1,4 @@ -\version "2.2.0" +\version "2.3.1" \header { texidoc= "@cindex make-music Fingering @@ -28,7 +28,7 @@ create, then write a function that will structure the music for you. m) \score { - \apply #(lambda (x) (add-text-script x "6") (display-music x) x ) \notes { c'4-3 } + \applymusic #(lambda (x) (add-text-script x "6") (display-music x) x ) \notes { c'4-3 } \paper{ raggedright = ##t } } diff --git a/input/test/ambitus-mixed.ly b/input/test/ambitus-mixed.ly index d166dacf6c..5b1533c5d5 100644 --- a/input/test/ambitus-mixed.ly +++ b/input/test/ambitus-mixed.ly @@ -13,7 +13,7 @@ in the same score (not demonstrated in this file). " } -\version "2.2.0" +\version "2.3.1" #(define (kill-ambitus grob grob-context apply-context) (if (memq 'ambitus-interface (ly:grob-property grob 'interfaces)) diff --git a/input/test/ancient-font.ly b/input/test/ancient-font.ly index 354585fa2a..71bc283ee2 100644 --- a/input/test/ancient-font.ly +++ b/input/test/ancient-font.ly @@ -1,4 +1,4 @@ -\version "2.2.0" +\version "2.3.1" % TODO: split ancient-font into seperate files; possibly in % different locations. \header { diff --git a/input/test/bar-number-every-five-reset.ly b/input/test/bar-number-every-five-reset.ly index 2208f7d6e6..571acee991 100644 --- a/input/test/bar-number-every-five-reset.ly +++ b/input/test/bar-number-every-five-reset.ly @@ -1,4 +1,4 @@ -\version "2.2.0" +\version "2.3.1" \header { texidoc = "@cindex Bar Number Every Fifth Reset diff --git a/input/test/move-accidentals.ly b/input/test/move-accidentals.ly index f3ee83c531..12ab42a909 100644 --- a/input/test/move-accidentals.ly +++ b/input/test/move-accidentals.ly @@ -1,4 +1,4 @@ -\version "2.2.0" +\version "2.3.1" % possible rename to scheme- or something like that. -gp \header { texidoc= "@cindex Scheme Manual Accidentals diff --git a/input/test/move-specific-text.ly b/input/test/move-specific-text.ly index a66a019e5c..37aa14827f 100644 --- a/input/test/move-specific-text.ly +++ b/input/test/move-specific-text.ly @@ -1,5 +1,5 @@ -\version "2.2.0" +\version "2.3.1" % possible rename to scheme- or something like that. -gp \header { texidoc = "@cindex Scheme Move Text Objects, like text, can be moved around by using some Scheme code. diff --git a/input/test/music-box.ly b/input/test/music-box.ly index 7bcfcd1ff4..91182ee3c5 100644 --- a/input/test/music-box.ly +++ b/input/test/music-box.ly @@ -1,4 +1,4 @@ -\version "2.2.0" +\version "2.3.1" \include "deutsch.ly" % possible rename to scheme- something. -gp % TODO: ask if it needs to have so many empty bars in the middle. -gp @@ -62,7 +62,7 @@ using Scheme functions to avoid typing work. " } -\version "2.2.0" +\version "2.3.1" pat = \notes \transpose c c' \repeat unfold 2 { << { \context Staff=up {r8 e16 f g e f g } } @@ -84,7 +84,7 @@ endc = \notes {\stemDown \tieDown c,,2~c,, c,,~c,, c,,1_\fermata } \notes \transpose c c' \context PianoStaff << \context Staff=up { \clef "G" } \context Staff=down { \clef "F" } - { \apply #transform {\pat {c e g c' e' } + { \applymusic #transform {\pat {c e g c' e' } \pat {c d a d' f' } \pat {h, d g d' f' } \pat {c e g c' e' } diff --git a/input/test/polymetric-differing-notes.ly b/input/test/polymetric-differing-notes.ly index cb0f97ecdc..0e8d843da8 100644 --- a/input/test/polymetric-differing-notes.ly +++ b/input/test/polymetric-differing-notes.ly @@ -1,4 +1,4 @@ -\version "2.2.0" +\version "2.3.1" \header{ texidoc=" @@ -37,14 +37,14 @@ multiplied by 3/5, so that 3/5 * 10/8 = 3/4. \new Staff { \time 3/4 \set Staff.timeSignatureFraction = #'(9 . 8) - \apply #(scale-music-function '(2 . 3)) + \applymusic #(scale-music-function '(2 . 3)) \repeat unfold 6 { c8[ c c] } } \new Staff { \time 3/4 \set Staff.timeSignatureFraction = #'(10 . 8) - \apply #(scale-music-function '(3 . 5)) + \applymusic #(scale-music-function '(3 . 5)) { \repeat unfold 2 { c8[ c c] } \repeat unfold 2 { c8[ c] } | c4. c4. \times 2/3 { c8 c c } c4 } diff --git a/input/test/reverse-music.ly b/input/test/reverse-music.ly index 390fa7f8c2..7dbfcaafd9 100644 --- a/input/test/reverse-music.ly +++ b/input/test/reverse-music.ly @@ -1,5 +1,5 @@ -\version "2.2.0" +\version "2.3.1" % possible rename to scheme-something. \header { texidoc="@cindex Scheme Reverse Music Symmetric, or palindromical music can be produced, first, by printing @@ -33,7 +33,7 @@ music = \notes \relative c'' { c4 d4( e4 f4 } \score { \context Voice { \music - \apply #reverse-music \music + \applymusic #reverse-music \music } \paper { raggedright = ##t} } diff --git a/input/test/smart-transpose.ly b/input/test/smart-transpose.ly index d8fdd1edaf..3894820e81 100644 --- a/input/test/smart-transpose.ly +++ b/input/test/smart-transpose.ly @@ -1,5 +1,5 @@ -\version "2.2.0" +\version "2.3.1" \header { texidoc="@cindex Smart Transpose @@ -69,9 +69,9 @@ music = \notes \relative c' { c4 d e f g a b c } \score { \notes \context Staff { \transpose c ais \music - \apply #naturalise \transpose c ais \music + \applymusic #naturalise \transpose c ais \music \transpose c deses \music - \apply #naturalise \transpose c deses \music + \applymusic #naturalise \transpose c deses \music } \paper { raggedright = ##t} } diff --git a/input/test/unfold-all-repeats.ly b/input/test/unfold-all-repeats.ly index ea1f233ff4..b5af649865 100644 --- a/input/test/unfold-all-repeats.ly +++ b/input/test/unfold-all-repeats.ly @@ -1,4 +1,4 @@ -\version "2.2.0" +\version "2.3.1" % regression. -gp \header { @@ -20,7 +20,7 @@ mel = \notes \context Staff { \score { \notes { \mel \break - \apply #unfold-repeats \mel + \applymusic #unfold-repeats \mel } } diff --git a/input/wilhelmus.ly b/input/wilhelmus.ly index deee4d79d1..13da16aaad 100644 --- a/input/wilhelmus.ly +++ b/input/wilhelmus.ly @@ -1,4 +1,4 @@ -\version "2.3.0" +\version "2.3.1" \header { texidoc = "Wilhelmus van Nassouwe" diff --git a/lily/music-function.cc b/lily/music-function.cc index 11cda8255c..ed7e3fa4e6 100644 --- a/lily/music-function.cc +++ b/lily/music-function.cc @@ -18,7 +18,7 @@ print_music_function (SCM b, SCM port, scm_print_state *) { SCM value = SCM_CELL_OBJECT_1 (b); - scm_puts ("#", port); @@ -78,4 +78,5 @@ init_music_function (void) scm_set_smob_mark (music_function_tag, scm_markcdr); scm_set_smob_print (music_function_tag, print_music_function); } + ADD_SCM_INIT_FUNC (music_function_tag, init_music_function); diff --git a/lily/parser.yy b/lily/parser.yy index f8efe45b33..261aa720f7 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -993,7 +993,7 @@ Generic_prefix_music: SCM func = ly_car ($1); Input *loc = unsmob_input (ly_cadr ($1)); SCM args = ly_cddr ($1); - SCM sig = scm_object_property (func, ly_symbol2scm ("music-head-signature")); + SCM sig = scm_object_property (func, ly_symbol2scm ("music-function-signature")); int k = 0; bool ok = true; for (SCM s = sig, t = args; @@ -1015,9 +1015,10 @@ Generic_prefix_music: $$ = unsmob_music (m); scm_gc_protect_object (m); } - else + else { - loc->error (_ ("Music head function should return Music object.")); + if (ok) + loc->error (_ ("Music head function should return Music object.")); $$ = MY_MAKE_MUSIC ("Music"); } $$->set_spot (*loc); diff --git a/ly/grace-init.ly b/ly/grace-init.ly index cdd041dca5..8cd9b0392d 100644 --- a/ly/grace-init.ly +++ b/ly/grace-init.ly @@ -1,4 +1,4 @@ -\version "2.2.0" +\version "2.3.1" startGraceMusic = \notes { diff --git a/scm/document-functions.scm b/scm/document-functions.scm index 8924af01c6..3bce48caf6 100644 --- a/scm/document-functions.scm +++ b/scm/document-functions.scm @@ -29,29 +29,25 @@ (define all-scheme-functions (hash-fold (lambda (key val prior) - (cons (cons key val) prior) - ) + (cons (cons key val) prior)) '() (ly:get-all-function-documentation))) (define (all-scheme-functions-doc) (let* - ( - - (fdocs (map (lambda (x) + ((fdocs (map (lambda (x) (document-scheme-function (car x) (cadr x) (cddr x)) ) all-scheme-functions) ) (sfdocs (sort fdocs string #:name "Scheme functions" #:desc "Primitive functions exported by LilyPond" #:text - (apply string-append sfdocs) - ) + (apply string-append sfdocs)) )) diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py index a3e247c77d..cc9bb0cd73 100644 --- a/scripts/convert-ly.py +++ b/scripts/convert-ly.py @@ -2082,6 +2082,12 @@ def conv (str): conversions.append (((2,2, 0), conv, '''clean up version. ''')) +def conv (str): + return re.sub (r'\\apply\b', r'\\applymusic', str) + +conversions.append (((2, 3, 1), conv, + '''\\apply -> \\applymusic''')) + ################################ # END OF CONVERSIONS ################################ -- 2.39.5