]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 3983: Avoid define-public and define*-public with curried definitions
authorDavid Kastrup <dak@gnu.org>
Thu, 5 Jun 2014 18:34:14 +0000 (20:34 +0200)
committerDavid Kastrup <dak@gnu.org>
Sun, 6 Jul 2014 12:31:00 +0000 (14:31 +0200)
Regarding curried definitions, GUILE has problems with define-public
before version 2.0.10, and with define*-public even later.

define-safe-public is implemented by LilyPond itself rather than the
(ice-9 curried-definitions) module and is unproblematic.

This is basically a cop-out since juggling with overriding bugfix
definitions of define-public is a distraction for getting GUILEv2
migration under way that we can do without.

scm/chord-name.scm
scm/flag-styles.scm
scm/music-functions.scm
scm/output-lib.scm
scm/tablature.scm
scm/titling.scm
scm/translation-functions.scm
scripts/musicxml2ly.py

index 54faaa5ba7b2e157d118cfb14c2ec43727f90b4d..4dd959bb5b47163e4b2c49bc85fe8bc3708343a5 100644 (file)
            (list-ref '( "ses" "s" "" "is" "isis") (+ 2 (cdr n-a)))
            (list-ref '("eses" "es" "" "is" "isis") (+ 2 (cdr n-a)))))))))
 
-(define-public ((chord-name->italian-markup re-with-eacute) pitch lowercase?)
+(define ((chord-name->italian-markup re-with-eacute) pitch lowercase?)
   "Return pitch markup for @var{pitch}, using Italian/@/French note names.
 If @var{re-with-eacute} is set to @code{#t}, french `rĂ©' is returned for
 pitch@tie{}D instead of `re'."
@@ -125,6 +125,7 @@ pitch@tie{}D instead of `re'."
         lowercase?))
       (accidental->markup-italian alt)
       ))))
+(export chord-name->italian-markup)
 
 ;; fixme we should standardize on omit-root (or the other one.)
 ;; perhaps the default should also be reversed --hwn
index 98ec0e4d80b1a742e9b4e96844152e0c321b2e05..502cb7738cab06b2e206a6e462570cab01642a75 100644 (file)
@@ -214,11 +214,12 @@ a flag always touches a staff line."
 
 
 
-(define-public ((glyph-flag flag-style) grob)
+(define ((glyph-flag flag-style) grob)
   "Simulatesthe default way of generating flags: Look up glyphs
 @code{flags.style[ud][1234]} from the feta font and use it for the flag
 stencil."
   (create-glyph-flag flag-style "" grob))
+(export glyph-flag)
 
 
 
index 0665236a08af64b780dbc2141f1d349b9e395334..b8ceadf5bde6d516fa464ed827c439ec87a80ee8 100644 (file)
@@ -906,17 +906,19 @@ NUMBER is 0-base, i.e., Voice=1 (upstems) has number 0.
   (lambda (elt)
     (grob::has-interface elt symbol)))
 
-(define-public ((outputproperty-compatibility func sym val) grob g-context ao-context)
+(define ((outputproperty-compatibility func sym val) grob g-context ao-context)
   (if (func grob)
       (set! (ly:grob-property grob sym) val)))
+(export outputproperty-compatibility)
 
 
-(define-public ((set-output-property grob-name symbol val)  grob grob-c context)
+(define ((set-output-property grob-name symbol val)  grob grob-c context)
   "Usage example:
 @code{\\applyoutput #(set-output-property 'Clef 'extra-offset '(0 . 1))}"
   (let ((meta (ly:grob-property grob 'meta)))
     (if (equal? (assoc-get 'name meta) grob-name)
         (set! (ly:grob-property grob symbol) val))))
+(export set-output-property)
 
 
 (define-public (skip->rest mus)
@@ -1229,7 +1231,7 @@ set to the @code{location} parameter."
                  (and clef (make-cue-clef-unset))))))
       quote-music))
 
-(define-public ((quote-substitute quote-tab) music)
+(define ((quote-substitute quote-tab) music)
   (let* ((quoted-name (ly:music-property music 'quoted-music-name))
          (quoted-vector (and (string? quoted-name)
                              (hash-ref quote-tab quoted-name #f))))
@@ -1243,6 +1245,7 @@ set to the @code{location} parameter."
                     ly:quote-iterator::constructor))
             (ly:music-warning music (ly:format (_ "cannot find quoted music: `~S'") quoted-name))))
     music))
+(export quote-substitute)
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1507,7 +1510,7 @@ also get an accidental."
 
     (cons need-restore need-accidental)))
 
-(define-public ((make-accidental-rule octaveness laziness) context pitch barnum measurepos)
+(define ((make-accidental-rule octaveness laziness) context pitch barnum measurepos)
   "Create an accidental rule that makes its decision based on the octave of
 the note and a laziness value.
 
@@ -1525,12 +1528,14 @@ accidental lasts over that many bar lines.  @w{@code{-1}} is `forget
 immediately', that is, only look at key signature.  @code{#t} is `forever'."
 
   (check-pitch-against-signature context pitch barnum laziness octaveness #f))
+(export make-accidental-rule)
 
-(define-public ((make-accidental-dodecaphonic-rule octaveness laziness) context pitch barnum measurepos)
+(define ((make-accidental-dodecaphonic-rule octaveness laziness) context pitch barnum measurepos)
   "Variation on function make-accidental-rule that creates an dodecaphonic
 accidental rule."
 
   (check-pitch-against-signature context pitch barnum laziness octaveness #t))
+(export make-accidental-dodecaphonic-rule)
 
 (define (key-entry-notename entry)
   "Return the pitch of an @var{entry} in @code{localAlterations}.
@@ -2223,7 +2228,7 @@ other stems just because of that."
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; The following is used by the alterBroken function.
 
-(define-public ((value-for-spanner-piece arg) grob)
+(define ((value-for-spanner-piece arg) grob)
   "Associate a piece of broken spanner @var{grob} with an element
 of list @var{arg}."
   (let* ((orig (ly:grob-original grob))
@@ -2239,6 +2244,7 @@ of list @var{arg}."
     (if (>= (length siblings) 2)
         (helper siblings arg)
         (car arg))))
+(export value-for-spanner-piece)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; measure counter
index 776e618e37f1b6823c2f5524cef24fa86d817ebb..c607fe4122805ab0e3baa92539fc26c8f1ea3ac0 100644 (file)
@@ -562,34 +562,37 @@ and duration-log @var{log}."
 ;; a formatter function, which is simply a wrapper around an existing
 ;; tuplet formatter function. It takes the value returned by the given
 ;; function and appends a note of given length.
-(define-public ((tuplet-number::append-note-wrapper function note) grob)
+(define ((tuplet-number::append-note-wrapper function note) grob)
   (let ((txt (if function (function grob) #f)))
 
     (if txt
         (markup txt #:fontsize -5 #:note note UP)
         (markup #:fontsize -5 #:note note UP))))
+(export tuplet-number::append-note-wrapper)
 
 ;; Print a tuplet denominator with a different number than the one derived from
 ;; the actual tuplet fraction
-(define-public ((tuplet-number::non-default-tuplet-denominator-text denominator)
+(define ((tuplet-number::non-default-tuplet-denominator-text denominator)
                 grob)
   (number->string (if denominator
                       denominator
                       (ly:event-property (event-cause grob) 'denominator))))
+(export tuplet-number::non-default-tuplet-denominator-text)
 
 ;; Print a tuplet fraction with different numbers than the ones derived from
 ;; the actual tuplet fraction
-(define-public ((tuplet-number::non-default-tuplet-fraction-text
+(define ((tuplet-number::non-default-tuplet-fraction-text
                  denominator numerator) grob)
   (let* ((ev (event-cause grob))
          (den (if denominator denominator (ly:event-property ev 'denominator)))
          (num (if numerator numerator (ly:event-property ev 'numerator))))
 
     (format #f "~a:~a" den num)))
+(export tuplet-number::non-default-tuplet-fraction-text)
 
 ;; Print a tuplet fraction with note durations appended to the numerator and the
 ;; denominator
-(define-public ((tuplet-number::fraction-with-notes
+(define ((tuplet-number::fraction-with-notes
                  denominatornote numeratornote) grob)
   (let* ((ev (event-cause grob))
          (denominator (ly:event-property ev 'denominator))
@@ -597,10 +600,11 @@ and duration-log @var{log}."
 
     ((tuplet-number::non-default-fraction-with-notes
       denominator denominatornote numerator numeratornote) grob)))
+(export tuplet-number::fraction-with-notes)
 
 ;; Print a tuplet fraction with note durations appended to the numerator and the
 ;; denominator
-(define-public ((tuplet-number::non-default-fraction-with-notes
+(define ((tuplet-number::non-default-fraction-with-notes
                  denominator denominatornote numerator numeratornote) grob)
   (let* ((ev (event-cause grob))
          (den (if denominator denominator (ly:event-property ev 'denominator)))
@@ -612,6 +616,7 @@ and duration-log @var{log}."
                          (make-simple-markup " : ")
                          (make-simple-markup (format #f "~a" num))
                          (markup #:fontsize -5 #:note numeratornote UP)))))
+(export tuplet-number::non-default-fraction-with-notes)
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1021,7 +1026,7 @@ between the two text elements."
                                              '(bound-details left padding)
                                              (+ my-padding script-padding)))))))
 
-(define-public ((elbowed-hairpin coords mirrored?) grob)
+(define ((elbowed-hairpin coords mirrored?) grob)
   "Create hairpin based on a list of @var{coords} in @code{(cons x y)}
 form.  @code{x} is the portion of the width consumed for a given line
 and @code{y} is the portion of the height.  For example,
@@ -1080,6 +1085,7 @@ and draws the stencil based on its coordinates.
             (if mirrored? (my-c-p-s downlist thick decresc?) empty-stencil))
            (cons xtrans ytrans)))
         '())))
+(export elbowed-hairpin)
 
 (define-public flared-hairpin
   (elbowed-hairpin '((0.95 . 0.4) (1.0 . 1.0)) #t))
@@ -1099,13 +1105,14 @@ and draws the stencil based on its coordinates.
                                     (make-tied-lyric-markup text)
                                     text))))
 
-(define-public ((grob::calc-property-by-copy prop) grob)
+(define ((grob::calc-property-by-copy prop) grob)
   (ly:event-property (event-cause grob) prop))
+(export grob::calc-property-by-copy)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; general inheritance
 
-(define-public ((grob::inherit-parent-property axis property . default) grob)
+(define ((grob::inherit-parent-property axis property . default) grob)
   "@var{grob} callback generator for inheriting a @var{property} from
 an @var{axis} parent, defaulting to @var{default} if there is no
 parent or the parent has no setting."
@@ -1115,6 +1122,7 @@ parent or the parent has no setting."
       (apply ly:grob-property parent property default))
      ((pair? default) (car default))
      (else '()))))
+(export grob::inherit-parent-property)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; fret boards
index 668bf2faa3a1b390bc13f2552859fac18cbf1b9b..36b81106c1bcb0046b9f2a73f5b7f1aab842bacf 100644 (file)
 
 
 ;; a callback for custom fret labels
-(define-public ((tab-note-head::print-custom-fret-label fret) grob)
+(define ((tab-note-head::print-custom-fret-label fret) grob)
   (ly:grob-set-property! grob 'text fret)
   (tab-note-head::print grob))
+(export tab-note-head::print-custom-fret-label)
 
 (define-public (tab-note-head::print grob)
   (define (is-harmonic? grob)
index 8e6ae7b7bb703b98533df4b6796eee23c56a9ce4..41a32dd4672b19c0658119de1b4c3b7ee42b1637 100644 (file)
@@ -23,7 +23,7 @@
 
 ;;;;;;;;;;;;;;;;;;
 
-(define-public ((marked-up-headfoot what-odd what-even)
+(define ((marked-up-headfoot what-odd what-even)
                 layout scopes page-number is-last-bookpart is-bookpart-last-page)
   "Read variables @var{what-odd}, @var{what-even} from @var{layout},
 and interpret them as markup.  The @var{props} argument will include
@@ -71,8 +71,9 @@ variables set in @var{scopes} and @code{page:is-bookpart-last-page},
             (markup? (get what-even)))
        (get what-even)
        (get what-odd))))
+(export marked-up-headfoot)
 
-(define-public ((marked-up-title what) layout scopes)
+(define ((marked-up-title what) layout scopes)
   "Read variables @var{what} from @var{scopes}, and interpret it as markup.
 The @var{props} argument will include variables set in @var{scopes} (prefixed
 with `header:'."
@@ -101,3 +102,4 @@ with `header:'."
     (if (markup? markup)
         (interpret-markup layout props markup)
         empty-stencil)))
+(export marked-up-title)
index 4479d3ae1b24f51e87671fccdc99cf100f889715..3e65016edb9b391225afe2536b97f4ad61e66c88 100644 (file)
@@ -42,7 +42,7 @@ way the transposition number is displayed."
 ;; prepare using other fonts than 'fetaMusic.
 ;; Currently it ensures that the default-fonts are used by the
 ;; markup-command 'note-by-number' in 'metronome-markup' (see below).
-(define*-public
+(define*
   ((styled-metronome-markup #:optional (glyph-font 'default))
                             event context)
    (let ((hide-note (ly:context-property context 'tempoHideNote #f))
@@ -51,6 +51,7 @@ way the transposition number is displayed."
          (count (ly:event-property event 'metronome-count)))
 
    (metronome-markup glyph-font text dur count hide-note)))
+(export styled-metronome-markup)
 
 (define-public format-metronome-markup
   (styled-metronome-markup))
@@ -634,16 +635,19 @@ only ~a fret labels provided")
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; bar numbers
 
-(define-public ((every-nth-bar-number-visible n) barnum mp)
+(define ((every-nth-bar-number-visible n) barnum mp)
   (= 0 (modulo barnum n)))
+(export every-nth-bar-number-visible)
 
-(define-public ((modulo-bar-number-visible n m) barnum mp)
+(define ((modulo-bar-number-visible n m) barnum mp)
   (and (> barnum 1) (= m (modulo barnum n))))
+(export modulo-bar-number-visible)
 
-(define-public ((set-bar-number-visibility n) tr)
+(define ((set-bar-number-visibility n) tr)
   (let ((bn (ly:context-property tr 'currentBarNumber)))
     (ly:context-set-property! tr 'barNumberVisibility
                               (modulo-bar-number-visible n (modulo bn n)))))
+(export set-bar-number-visibility)
 
 (define-public (first-bar-number-invisible barnum mp)
   (> barnum 1))
@@ -688,8 +692,9 @@ only ~a fret labels provided")
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; percent repeat counters
 
-(define-public ((every-nth-repeat-count-visible n) count context)
+(define ((every-nth-repeat-count-visible n) count context)
   (= 0 (modulo count n)))
+(export every-nth-repeat-count-visible)
 
 (define-public (all-repeat-counts-visible count context) #t)
 
index 2da2dab60e93e574860f99c9ee5bbd55de82d9be..e270aed95e7d3001ea905a3eb5c5ffac03f8adde 100644 (file)
@@ -41,7 +41,7 @@ additional_definitions = {
   "tuplet-note-wrapper": """      % a formatter function, which is simply a wrapper around an existing
       % tuplet formatter function. It takes the value returned by the given
       % function and appends a note of given length.
-  #(define-public ((tuplet-number::append-note-wrapper function note) grob)
+  #(define ((tuplet-number::append-note-wrapper function note) grob)
     (let* ((txt (if function (function grob) #f)))
       (if txt
         (markup txt #:fontsize -5 #:note note UP)