From: Joe Neeman Date: Wed, 31 Jan 2007 11:05:17 +0000 (+0200) Subject: Merge with master X-Git-Tag: release/2.11.16-1^2~12 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c5a3f0c024f4cb629811cff9eb04abff36e94138;hp=3ee551fa4f2a2c3736a06f9f85f29b9f7bd89818;p=lilypond.git Merge with master --- diff --git a/.gitignore b/.gitignore index f69a725cab..0c7c899e60 100644 --- a/.gitignore +++ b/.gitignore @@ -59,3 +59,6 @@ tags test-output-distance config-*.hh config-*.make +*.graph +*.stacks +*.profile diff --git a/Documentation/topdocs/NEWS.tely b/Documentation/topdocs/NEWS.tely index e7b58fc71f..b79a19a998 100644 --- a/Documentation/topdocs/NEWS.tely +++ b/Documentation/topdocs/NEWS.tely @@ -65,6 +65,26 @@ which scares away people. @end ignore +All line spanners are more flexible now in the configuration of their +end points. This includes glissando, voice followers, text crescendos +and other text spanners. + +@lilypond +\relative c'' { + \override Glissando #'bound-details #'right #'text = \markup { \hcenter \bold down } + \override Glissando #'bound-details #'right #'Y = #-4 + \override Glissando #'bound-details #'right #'padding = #0.0 + \override Glissando #'bound-details #'left #'arrow = ##t + \override Glissando #'bound-details #'left #'padding = #5.0 + \override Glissando #'style = #'trill + + c1 \glissando c' +} +@end lilypond + +This feature was sponsored by Trevor Bača. + + @item Notes or rests, such as a typical end note, that fill an entire measure are preceded by some more space. diff --git a/Documentation/user/advanced-notation.itely b/Documentation/user/advanced-notation.itely index 42cdb7bdae..31b4a75c31 100644 --- a/Documentation/user/advanced-notation.itely +++ b/Documentation/user/advanced-notation.itely @@ -40,6 +40,7 @@ saved as UTF-8. For more information, see @ref{Text encoding}. @menu * Text scripts:: +* Text and line spanners:: * Text spanners:: * Text marks:: * Text markup:: @@ -105,6 +106,143 @@ In this manual: @ref{Text markup}. Program reference: @internalsref{TextScript}. +@node Text and line spanners +@subsection Text and line spanners + +Some performance indications, e.g., @i{rallentando} and +@i{accelerando} and @i{trills} are written as text and are extended +over many measures with lines, sometimes dotted or wavy. + +These all use the same routines as the glissando for drawing the texts +and the lines, and tuning their behavior is therefore also done in the +same way. It is done with a spanner, and the routine responsible for +drawing the spanners is @code{ly:line-interface::print}. This +routine creates determines the exact location of the two @i{span +points} and draws a line in between, in the style requested. + +Here is an example of the different line styles available, and how to +tune them. + +@lilypond[relative=2,ragged-right,verbatim,fragment] +d2 \glissando d'2 +\once \override Glissando #'dash-fraction = #0.5 +d,2 \glissando d'2 +\override Glissando #'style = #'dotted-line +d,2 \glissando d'2 +\override Glissando #'style = #'zigzag +d,2 \glissando d'2 +\override Glissando #'style = #'trill +d,2 \glissando d'2 +@end lilypond + +The information that determines the end-points is computed on-the-fly +for every graphic object, but it is possible to override these. + +@lilypond[relative=2,ragged-right,verbatim,fragment] +e2 \glissando f +\once \override Glissando #'bound-details #'right #'Y = #-2 +e2 \glissando f +@end lilypond + +The @code{Glissando} object, like any other using the +@code{ly:line-interface::print} routine, carries a nested +association list. In the above statement, the value for @code{Y} +is set to @code{-2} for association list corresponding to the right +end point. Of course, it is also possible to adjust the left side with +@code{left} instead of @code{right}. + +If @code{Y} is not set, the value is computed from the vertical +position of right attachment point of the spanner. + +In case of a line break, the values for the span-points are extended +with contents of the @code{left-broken} and @code{right-broken} +sublists, for example + +@lilypond[relative=2,ragged-right,verbatim,fragment] +\override Glissando #'breakable = ##T +\override Glissando #'bound-details #'right-broken #'Y = #-3 +c1 \glissando \break +f1 +@end lilypond + +The following properties can be used for the + +@table @code +@item Y +This sets the Y-coordinate of the end point, in staff space. By +default, it is the center of the bound object, so for a glissando it +points to the vertical center of the note head. + +For horizontal spanners, such as text spanner and trill spanners, it +is hardcoded to 0. + +@item attach-dir +This determines where the line starts and ends in X-direction, +relative to the bound object. So, a value of @code{-1} (or +@code{LEFT}) makes the line start/end at the left side of the note +head it is attached to. + +@item X +This is the absolute coordinate of the end point. It is usually +computed on the fly, and there is little use in overriding it. + +@item stencil +Line spanners may have symbols at the beginning or end, which is +contained in this sub-property. This is for internal use, it is +recommended to use @code{text}. + +@item text +This is a markup that is evaluated to yield stencil. It is +used to put @i{cresc.} and @i{tr} on horizontal spanners. + +@lilypond[quote,ragged-right,fragment,relative=2,verbatim] +\override TextSpanner #'bound-details #'left #'text + = \markup { \small \bold Slower } +c2\startTextSpan b c a\stopTextSpan +@end lilypond + +@item stencil-align-dir-y +@item stencil-offset +Without setting this, the stencil is simply put there at the +end-point, as defined by the @code{X} and @code{Y} sub properties. +Setting either @code{stencil-align-dir-y} or @code{stencil-offset} +will move the symbol at the edge relative to the end point of the line + +@lilypond[relative=1,fragment,verbatim] +\override TextSpanner #'bound-details #'left #'stencil-align-dir-y = #DOWN +\override TextSpanner #'bound-details #'right #'stencil-align-dir-y = #UP + +\override TextSpanner #'bound-details #'left #'text = #"gggg" +\override TextSpanner #'bound-details #'right #'text = #"hhhh" +c4^\startTextSpan c c c \stopTextSpan +@end lilypond + +@item arrow +Setting this sub property to @code{#t} produce an arrowhead at the end +of the line. + +@item padding +This sub property controls the space between the specified end-point +of the line and the actual end. Without padding, a glissando would +start and end in the center of each note head. + +@end table + +@seealso + +Program reference: @internalsref{TextSpanner}, +@internalsref{Glissando}, @internalsref{VoiceFollower}, +@internalsref{TrillSpanner}, @internalsref{line-spanner-interface}. + +Examples: +@inputfileref{input/@/regression,dynamics@/-text@/-spanner@/-padding.ly}. +@inputfileref{input/@/regression,glissando@/-broken@/.ly}. +@inputfileref{input/@/regression,line@/-arrows@/.ly}. +@inputfileref{input/@/regression,line@/-style@/.ly}. +@inputfileref{input/@/regression,text@/-spanner@/.ly}. +@inputfileref{input/@/regression,text@/-spanner@/.ly}. + + @node Text spanners @subsection Text spanners diff --git a/Documentation/user/instrument-notation.itely b/Documentation/user/instrument-notation.itely index abff76eef1..117e1199ff 100644 --- a/Documentation/user/instrument-notation.itely +++ b/Documentation/user/instrument-notation.itely @@ -57,11 +57,6 @@ Dynamics are not centered, but workarounds do exist. See the @cindex stem, cross staff @cindex distance between staves in piano music -The distance between the two staves is the same for all systems in the -score. It is possible to override this per system, but it does require -an arcane command incantation. See -@inputfileref{input/@/test,piano@/-staff@/-distance@/.ly}. - @node Automatic staff changes @subsection Automatic staff changes @@ -274,7 +269,10 @@ of the stem in the lower staff, so it reaches the stem in the upper staff, or vice versa. @lilypond[ragged-right,verbatim,quote] -stemExtend = \once \override Stem #'length = #22 +stemExtend = { + \once \override Stem #'length = #10 + \once \override Stem #'cross-staff = ##t +} noFlag = \once \override Stem #'flag-style = #'no-flag \new PianoStaff << \new Staff { diff --git a/Documentation/user/tutorial.itely b/Documentation/user/tutorial.itely index d1b5eb467c..93a5db0ec0 100644 --- a/Documentation/user/tutorial.itely +++ b/Documentation/user/tutorial.itely @@ -127,7 +127,7 @@ and how to view or print the output. @subsubheading MacOS X If you double click LilyPond.app, it will open with an example -file. Save it, for example, to @file{test.ly} on your Desktop, and +file. Save it, for example, to @file{test.ly} on your Desktop, and then process it with the menu command @samp{Compile > Typeset File}. The resulting PDF file will be displayed on your screen. @@ -157,7 +157,7 @@ the file and show the resulting PDF file. To edit an existing @file{.ly} file, right-click on it and select @qq{Edit source}. If you double-click in the LilyPond icon on the Desktop, it will open -a simple text editor with an example file. Save it, for example, to +a simple text editor with an example file. Save it, for example, to @file{test.ly} on your Desktop, and then double-click on the file to process it. After some seconds, you will get a file @file{test.pdf} on your desktop. Double-click on this PDF file to view the typeset @@ -352,7 +352,7 @@ The @rglos{clef} can be set using the @code{\clef} command: \clef treble c1 \clef alto - c1 + c1 \clef tenor c1 \clef bass @@ -823,7 +823,7 @@ of music is multiplied by the fraction. Triplets make notes occupy @lilypond[quote,ragged-right,verbatim,fragment,relative=2] \times 2/3 { f8 g a } \times 2/3 { c r c } -\times 2/3 { f,8 g16 a g a } +\times 2/3 { f,8 g16[ a g a] } \times 2/3 { d4 a8 } @end lilypond @@ -837,7 +837,7 @@ can also be created by prefixing a music expression with the keyword @code{\appoggiatura} or @code{\acciaccatura} @lilypond[quote,ragged-right,verbatim,fragment,relative=2] -c2 \grace { a32 b} c2 +c2 \grace { a32[ b] } c2 c2 \appoggiatura b16 c2 c2 \acciaccatura b16 c2 @end lilypond @@ -1158,7 +1158,7 @@ Consider a simple melody: @lilypond[quote,ragged-right,verbatim] \relative c'' { a4 e c8 e r4 - b2 c4( d) + b2 c4( d) } @end lilypond @@ -1170,7 +1170,7 @@ syllable with a space. << \relative c'' { a4 e c8 e r4 - b2 c4( d) + b2 c4( d) } \addlyrics { One day this shall be free } >> @@ -1186,7 +1186,7 @@ line}. It is entered as two underscores @code{__}: << \relative c'' { a4 e c8 e r4 - b2 c4( d) + b2 c4( d) } \addlyrics { One day this shall be free __ } >> @@ -1220,9 +1220,6 @@ discussed in @ref{Vocal music}. @cindex chords @cindex chord names -@c TODO: revise this, \chords { } is shorter and more intuitive. -@c I need help for this. -gp - In popular music it is common to denote accompaniment with chord names. Such chords can be entered like notes, @@ -1230,12 +1227,10 @@ Such chords can be entered like notes, \chordmode { c2 f4. g8 } @end lilypond -@noindent Now each pitch is read as the root of a chord instead of a note. -This mode is switched on with @code{\chordmode} - -Other chords can be created by adding modifiers after a colon. The -following example shows a few common modifiers +This mode is switched on with @code{\chordmode}. Other chords can be +created by adding modifiers after a colon. The +following example shows a few common modifiers: @lilypond[quote,verbatim,ragged-right] \chordmode { c2 f4:m g4:maj7 gis1:dim7 } @@ -1245,7 +1240,7 @@ For lead sheets, chords are not printed on staves, but as names on a line for themselves. This is achieved by using @code{\chords} instead of @code{\chordmode}. This uses the same syntax as @code{\chordmode}, but renders the notes in a @code{ChordNames} context, with the -following result. +following result: @lilypond[quote,verbatim,ragged-right] \chords { c2 f4.:m g4.:maj7 gis8:dim7 } @@ -1253,22 +1248,25 @@ following result. @cindex lead sheet When put together, chord names, lyrics and a melody form -a lead sheet, for example, +a lead sheet, @lilypond[quote,verbatim,ragged-right] -% FIXME: this melody needs to be changed. See my new example in 2.4.1. -gp << - \chords { r2 c:sus4 f } - \relative { - r4 c' \times 2/3 { f g g } - \times 2/3 { g4( a2) } + \chords { c2 g:sus4 f e } + \relative c'' { + a4 e c8 e r4 + b2 c4( d) } - \addlyrics { I want to break free __ } + \addlyrics { One day this shall be free __ } >> @end lilypond + +@moreinfo +@quotation A complete list of modifiers and other options for layout can be found in @ref{Chords}. +@end quotation @node Final touches diff --git a/Documentation/user/tweaks.itely b/Documentation/user/tweaks.itely index 25a878120e..3d211709dd 100644 --- a/Documentation/user/tweaks.itely +++ b/Documentation/user/tweaks.itely @@ -288,7 +288,7 @@ voices: } >> @end lilypond -To make sure that the just blanked stem doesn't sqeeuze the too much +To make sure that the just blanked stem doesn't squeeze the too much tie, we also lengthen the stem, by setting the @code{length} to @code{8}, @@ -373,10 +373,10 @@ space at the bottom of the page. @example \paper @{ -between-system-padding = #0.1 -between-system-space = #0.1 -ragged-last-bottom = ##f -ragged-bottom = ##f + between-system-padding = #0.1 + between-system-space = #0.1 + ragged-last-bottom = ##f + ragged-bottom = ##f @} @end example @@ -387,7 +387,7 @@ use 10). @example \paper @{ -system-count = #10 + system-count = #10 @} @end example @@ -474,9 +474,9 @@ tempoMark = #(define-music-function (parser location padding marktext) #}) \relative c'' { -c2 e -\tempoMark #3.0 #"Allegro" -g c + c2 e + \tempoMark #3.0 #"Allegro" + g c } @end lilypond diff --git a/Documentation/user/working.itely b/Documentation/user/working.itely index 22659409a2..abef49234d 100644 --- a/Documentation/user/working.itely +++ b/Documentation/user/working.itely @@ -10,7 +10,7 @@ @node Working on LilyPond projects @chapter Working on LilyPond projects -This section explains a how to solve or avoid certain common +This section explains how to solve or avoid certain common problems. If you have programming experience, many of these tips may seem obvious, but it is still advisable to read this chapter. @@ -632,7 +632,7 @@ Another very useful debugging technique is constructing @node Minimal examples @section Minimal examples -A minimal example is an example which is small as possible. These +A minimal example is an example which is as small as possible. These examples are much easier to understand than long examples. Minimal examples are used for @@ -655,14 +655,14 @@ There are two exceptions to the @qq{as small as possible} rule: @itemize @item Include the @code{\version} number. @item If possible, use @code{\paper@{ ragged-right=##t @}} at the -top of your example. +top of your example. @end itemize The whole point of a minimal example is to make it easy to read: @itemize @item Avoid using complicated notes, keys, or time signatures, unless you -wish to demonstrate something is about the behavior of those items. +wish to demonstrate something is about the behavior of those items. @item Do not use \override commands unless that is the point of the example. @end itemize diff --git a/ROADMAP b/ROADMAP index 6a691b6237..af31b7b52f 100644 --- a/ROADMAP +++ b/ROADMAP @@ -13,11 +13,13 @@ source files. patches for third party programs Documentation/ bibliography/ .bib files with references to books and articles - misc Old announcements, ChangeLogs and NEWS + misc/ Old announcements, ChangeLogs and NEWS pictures/ The logo topdocs/ Sources for the toplevel READMEs (README.txt, INSTALL.txt, NEWS.txt etc.) user/ User manuals + po/ translated manual node names + fr/ docs translated to French. buildscripts/ Scripts for the build process cygwin/ Cygwin (Windows) package support debian/ Debian package support @@ -25,9 +27,7 @@ source files. flower/ A simple c++ library include/ input/ Music input examples - bugs/ Buggy or problematic notation mutopia/ Real music, more at www.mutopiaproject.org - no-notation/ Examples that do not produce output regression/ Testing of features, one test per file test/ Tips and tricks tutorial/ Examples from the tutorial diff --git a/THANKS b/THANKS index 2e7cd7cf4a..75aa8e2d0e 100644 --- a/THANKS +++ b/THANKS @@ -15,11 +15,12 @@ John Mandereau - Translation Meister CONTRIBUTORS Rune Zedeler +Maximilian Albert SPONSORS Mike Amundsen - +Trevor Bača BUG HUNTERS/SUGGESTIONS diff --git a/VERSION b/VERSION index 1380565e9e..60452491a6 100644 --- a/VERSION +++ b/VERSION @@ -1,6 +1,6 @@ PACKAGE_NAME=LilyPond MAJOR_VERSION=2 MINOR_VERSION=11 -PATCH_LEVEL=13 +PATCH_LEVEL=15 MY_PATCH_LEVEL= diff --git a/buildscripts/coverage.py b/buildscripts/coverage.py index 0b3b2b7aaf..ed7d0eef25 100644 --- a/buildscripts/coverage.py +++ b/buildscripts/coverage.py @@ -79,6 +79,9 @@ class SchemeChunk (Chunk): and not text.startswith ('(define (')): return 0 + if text.startswith ('(use-modules '): + return 0 + if (text.startswith ('(define-public ') and not text.startswith ('(define-public (')): return 0 @@ -228,7 +231,7 @@ def main (): if options.uncovered: chunks = filter_uncovered (chunks) - chunks = [(c.uncovered_score (), c) for c in chunks] + chunks = [(c.uncovered_score (), c) for c in chunks if c.uncovered_score() > 0] elif options.hotspots: chunks = [((c.coverage_count, -c.length()), c) for c in chunks] diff --git a/input/les-nereides.ly b/input/les-nereides.ly index c39e7f37b5..a7bab52f5a 100644 --- a/input/les-nereides.ly +++ b/input/les-nereides.ly @@ -36,7 +36,7 @@ treble = \new Voice \relative c''{ \change Staff=bass - \once\override TextScript #'extra-offset = #'(-3 . -4) %tweak +% \once\override TextScript #'extra-offset = #'(-3 . -4) %tweak cis,16^2(^\markup {\small \italic "m.d." }\sustainUp 8 @@ -50,7 +50,7 @@ treble = \new Voice \relative c''{ #(set-octavation 1) - \once\override TextScript #'extra-offset = #'(-3 . -2) %tweak +% \once\override TextScript #'extra-offset = #'(-3 . -2) %tweak \tieUp cis''''4^\markup { \small \italic "m.g." }\arpeggio~ @@ -219,7 +219,7 @@ middleDynamics = { s8 s16 s s s32 s - \once\override Dynamics.Hairpin #'extra-offset = #'(0 . 2) %tweak + %\once\override Dynamics.Hairpin #'extra-offset = #'(0 . 2) %tweak s\> s s32 s s s\! @@ -229,7 +229,7 @@ middleDynamics = { \emptyText | %5 s2-"a tempo" s8 - \once\override Dynamics.Hairpin #'extra-offset = #'(1 . 0) %tweak + %\once\override Dynamics.Hairpin #'extra-offset = #'(1 . 0) %tweak s \> s s | %6 s8\! @@ -280,7 +280,6 @@ theScore = \score{ \context { \PianoStaff \accepts Dynamics - \override VerticalAlignment #'forced-distance = #7 } } } diff --git a/input/regression/clip-systems.ly b/input/regression/clip-systems.ly index a49dceaf9d..06247e76b5 100644 --- a/input/regression/clip-systems.ly +++ b/input/regression/clip-systems.ly @@ -21,41 +21,65 @@ The result will be files named \version "2.10.0" +#(ly:set-option 'clip-systems) -% each clip-region is a (START . END) pair -% where both are rhythmic-locations. +#(set! output-count 1) -% (make-rhythmic-locations BAR-NUMBER NUM DEN) -% means NUM/DEN whole-notes into bar numbered BAR-NUMBER - -\paper { +origScore = \score{ + \relative { + \set Staff.instrumentName = #"bla" + c1 + d + \grace c16 + e1 + \key d\major + + f + \break \clef bass + g, + fis + } +} - clip-regions - = #(list - (cons - (make-rhythmic-location 2 0 1) - (make-rhythmic-location 4 0 1)) +\book { + \score { + \origScore + \layout { - (cons - (make-rhythmic-location 0 0 1) - (make-rhythmic-location 4 0 1)) + %% each clip-region is a (START . END) pair + %% where both are rhythmic-locations. - (cons - (make-rhythmic-location 0 0 1) - (make-rhythmic-location 6 0 1)) - ) + %% (make-rhythmic-locations BAR-NUMBER NUM DEN) + %% means NUM/DEN whole-notes into bar numbered BAR-NUMBER + + clip-regions + = #(list + (cons + (make-rhythmic-location 2 0 1) + (make-rhythmic-location 4 0 1)) + + (cons + (make-rhythmic-location 0 0 1) + (make-rhythmic-location 4 0 1)) + + (cons + (make-rhythmic-location 0 0 1) + (make-rhythmic-location 6 0 1)) + ) + } + } } -\relative { - \set Staff.instrumentName = #"bla" - c1 - d - \grace c16 - e1 - \key d\major - - f - \break \clef bass - g, - fis -} +#(set! output-count 0) +#(ly:set-option 'clip-systems #f) + +\book { + \score { \origScore } + \markup { \bold \fontsize #6 clips } + \score { + \lyrics { + \markup { from-2.0.1-to-4.0.1-clip.eps } + \markup { \epsfile #X #30.0 #(format #f "~a-1-from-2.0.1-to-4.0.1-clip.eps" (ly:parser-output-name parser)) } + } + } +} diff --git a/input/regression/dynamics-text-spanner-padding.ly b/input/regression/dynamics-text-spanner-padding.ly new file mode 100644 index 0000000000..545eb2edf5 --- /dev/null +++ b/input/regression/dynamics-text-spanner-padding.ly @@ -0,0 +1,19 @@ +\header { + + texidoc = "The 2nd half of the cresc. stays at a reasonable distance +from the notes. " + +} +\version "2.10.13" + +\layout { + indent = 0.0\mm + line-width = 70.0\mm +} + +\relative c' { + \setTextCresc + c\< c c c | \break + c c\! c c +} + diff --git a/input/regression/line-arrows.ly b/input/regression/line-arrows.ly index 201210c353..7512711cb1 100644 --- a/input/regression/line-arrows.ly +++ b/input/regression/line-arrows.ly @@ -9,12 +9,17 @@ } \relative c'' { - \override TextSpanner #'edge-text = #'("foo" . "bar") \override TextSpanner #'bound-padding = #1.0 \override TextSpanner #'dash-fraction = #'() - \override TextSpanner #'arrow = ##t + \override TextSpanner #'bound-details #'right #'arrow = ##t + \override TextSpanner #'bound-details #'left #'text = #"fof" + \override TextSpanner #'bound-details #'right #'text = #"gag" + \override TextSpanner #'bound-details #'right #'padding = #0.6 + + \override TextSpanner #'bound-details #'right #'stencil-align-dir-y = #CENTER + \override TextSpanner #'bound-details #'left #'stencil-align-dir-y = #CENTER - \override Glissando #'arrow = ##t + \override Glissando #'bound-details #'right #'arrow = ##t \override Glissando #'arrow-length = #0.5 \override Glissando #'arrow-width = #0.25 diff --git a/input/regression/line-dashed-period.ly b/input/regression/line-dashed-period.ly new file mode 100644 index 0000000000..dd0b55e898 --- /dev/null +++ b/input/regression/line-dashed-period.ly @@ -0,0 +1,27 @@ +\header { + + texidoc = "The period of a dashed line is adjusted such that it +starts and ends on a full dash. " + +} + +\version "2.11.13" + +\layout { + indent = 0.0\mm + ragged-right = ##T +} + +\relative << + \new Staff { + \override DynamicTextSpanner #'dash-fraction = ##f + \setTextCresc + c1_\< c c1\! + } + \new Staff { + \override DynamicTextSpanner #'dash-period = #3 + \override DynamicTextSpanner #'dash-fraction = #0.3 + \setTextCresc + c1^\< c c1\! + } +>> diff --git a/input/regression/markup-commands.ly b/input/regression/markup-commands.ly new file mode 100644 index 0000000000..dc01e9e40b --- /dev/null +++ b/input/regression/markup-commands.ly @@ -0,0 +1,35 @@ +\header +{ + + texidoc = "test various markup commands." + +} +\paper { ragged-right = ##T } +\version "2.11.13" + +{ + g'_\markup { + \column { + \line { + foo \magnify #2 foo + LOWER \lower #3 LOWER + \large \bold { normal \normal-text normal } + Small-Caps \smallCaps Small-Caps + } + + \override #'(line-width . 50) + \override #'(bla . "This is a field containing text. Blah blah +blah. This is a field containing text. Blah blah blah. This is a +field containing text. Blah blah blah. This is a field containing +text. Blah blah blah. This is a field containing text. Blah blah +blah.") + \column { + justify: + \justify-field #'bla + wordwrap: + \wordwrap-field #'bla + } + + } + } +} diff --git a/input/regression/music-map.ly b/input/regression/music-map.ly index 1a1afb1d28..1450098a1c 100644 --- a/input/regression/music-map.ly +++ b/input/regression/music-map.ly @@ -37,5 +37,5 @@ foobar = \transpose c c' { c4\>-^ c4-^ c4\!-^ c4-^ } << \applyMusic #(lambda (x) (music-map notes-to-skip x)) \foobar - { d2 d2 } >> + { d8 d d d d d d d } >> } diff --git a/input/regression/skip-of-length.ly b/input/regression/skip-of-length.ly new file mode 100644 index 0000000000..e80bede98c --- /dev/null +++ b/input/regression/skip-of-length.ly @@ -0,0 +1,25 @@ +\header { + texidoc = "skip-of-length and mmrest-of-length create skips and rests that +last as long as their arguments." + +} +\paper { + ragged-right = ##T +} + +\version "2.11.13" + +\relative +<< + \new Staff { + c\breve f4 r2. + c\breve f4 r2. + s\breve^"skip" + } + \new Staff { + \applyMusic #skip-of-length { c\breve } f4 r2. + \applyMusic #mmrest-of-length { c\breve } f4 r2. + \displayMusic \musicMap #skip->rest s\breve + } +>> + diff --git a/input/regression/staff-mixed-size.ly b/input/regression/staff-mixed-size.ly index d1d7cc5021..02b26c068e 100644 --- a/input/regression/staff-mixed-size.ly +++ b/input/regression/staff-mixed-size.ly @@ -10,24 +10,24 @@ large on smaller staves." \version "2.11.11" \layout { - #(layout-set-staff-size 6) ragged-right = ##t } +melody = \relative { + \override DynamicText #'extra-offset = #'(0 . 3) + s1-\f c''8[(\< r a g]) e[ r d( ])\! \times 2/3 { d4 d d } +} + << \new Staff \with { fontSize = #-4 \override StaffSymbol #'staff-space = #(magstep -4) + } { + \melody } - \relative c' { - \override DynamicText #'extra-offset = #'(0 . 3) - s1-\f c''8[(\< r a g]) e[ r d( ])\! \times 2/3 { d4 d d } - } - \new Staff + \new Staff { \relative c' { - \override DynamicText #'extra-offset = #'(0 . 3) - s1-\f c''8[(\< r a g]) e[ r d( ])\! \times 2/3 { d4 d d } - } - >> - - + \melody + } + } +>> diff --git a/lily/accidental-placement.cc b/lily/accidental-placement.cc index cbc1478608..15049f5bc0 100644 --- a/lily/accidental-placement.cc +++ b/lily/accidental-placement.cc @@ -251,6 +251,8 @@ Accidental_placement::calc_positioning_done (SCM smob) if (!me->is_live ()) return SCM_BOOL_T; + me->set_property ("positioning-done", SCM_BOOL_T); + SCM accs = me->get_object ("accidental-grobs"); if (!scm_is_pair (accs)) return SCM_BOOL_T; diff --git a/lily/align-interface.cc b/lily/align-interface.cc index 69fb5e921c..4854383d9e 100644 --- a/lily/align-interface.cc +++ b/lily/align-interface.cc @@ -30,6 +30,9 @@ SCM Align_interface::calc_positioning_done (SCM smob) { Grob *me = unsmob_grob (smob); + + me->set_property ("positioning-done", SCM_BOOL_T); + SCM axis = scm_car (me->get_property ("axes")); Axis ax = Axis (scm_to_int (axis)); @@ -205,13 +208,17 @@ Align_interface::get_extents_aligned_translates (Grob *me, Real padding = robust_scm2double (me->get_property ("padding"), 0.0); vector translates; + Skyline down_skyline (stacking_dir); for (vsize j = 0; j < elems.size (); j++) { Real dy = 0; if (j == 0) dy = skylines[j][-stacking_dir].max_height (); else - dy = skylines[j-1][stacking_dir].distance (skylines[j][-stacking_dir]); + { + down_skyline.merge (skylines[j-1][stacking_dir]); + dy = down_skyline.distance (skylines[j][-stacking_dir]); + } where += stacking_dir * max (0.0, dy + padding + extra_space / elems.size ()); translates.push_back (where); diff --git a/lily/all-font-metrics-scheme.cc b/lily/all-font-metrics-scheme.cc new file mode 100644 index 0000000000..c74f9596b4 --- /dev/null +++ b/lily/all-font-metrics-scheme.cc @@ -0,0 +1,36 @@ +/* + all-font-metrics-scheme.cc -- implement bindings for + All_font_metrics. + + source file of the GNU LilyPond music typesetter + + (c) 2007 Han-Wen Nienhuys + +*/ + +#include "all-font-metrics.hh" +#include "main.hh" + +LY_DEFINE (ly_reset_all_fonts, "ly:reset-all-fonts", 0, 0, 0, + (), + "Forget all about previously loaded fonts. ") +{ + delete all_fonts_global; + all_fonts_global = new All_font_metrics (global_path.to_string ()); + + return SCM_UNSPECIFIED; +} + + +LY_DEFINE (ly_font_load, "ly:font-load", 1, 0, 0, + (SCM name), + "Load the font @var{name}. ") +{ + LY_ASSERT_TYPE(scm_is_string, name, 1); + + Font_metric *fm = all_fonts_global->find_font (ly_scm2string (name)); + + return fm->self_scm (); +} + + diff --git a/lily/all-font-metrics.cc b/lily/all-font-metrics.cc index f8da4b2ecd..8a1143a537 100644 --- a/lily/all-font-metrics.cc +++ b/lily/all-font-metrics.cc @@ -147,27 +147,3 @@ All_font_metrics::find_font (string name) } All_font_metrics *all_fonts_global; - -LY_DEFINE (ly_reset_all_fonts, "ly:reset-all-fonts", 0, 0, 0, - (), - "Forget all about previously loaded fonts. ") -{ - delete all_fonts_global; - all_fonts_global = new All_font_metrics (global_path.to_string ()); - - return SCM_UNSPECIFIED; -} - - -LY_DEFINE (ly_font_load, "ly:font-load", 1, 0, 0, - (SCM name), - "Load the font @var{name}. ") -{ - SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG1, __FUNCTION__, "string"); - - Font_metric *fm = all_fonts_global->find_font (ly_scm2string (name)); - - return fm->self_scm (); -} - - diff --git a/lily/axis-group-interface-scheme.cc b/lily/axis-group-interface-scheme.cc index d0470b5a75..11306233be 100644 --- a/lily/axis-group-interface-scheme.cc +++ b/lily/axis-group-interface-scheme.cc @@ -19,8 +19,8 @@ LY_DEFINE (ly_relative_group_extent, "ly:relative-group-extent", Grob_array *ga = unsmob_grob_array (elements); SCM_ASSERT_TYPE (ga || scm_is_pair (elements), elements, SCM_ARG1, __FUNCTION__, "list or Grob_array"); - SCM_ASSERT_TYPE (unsmob_grob (common), common, SCM_ARG2, __FUNCTION__, "grob"); - SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis"); + LY_ASSERT_SMOB(Grob, common, 2); + LY_ASSERT_TYPE(is_axis, axis, 3); vector elts; if (!ga) diff --git a/lily/bar-number-engraver.cc b/lily/bar-number-engraver.cc index 84ba60c83f..9f23965042 100644 --- a/lily/bar-number-engraver.cc +++ b/lily/bar-number-engraver.cc @@ -36,8 +36,6 @@ protected: void Bar_number_engraver::process_music () { - // todo include (&&!time->cadenza_b_) - SCM wb = get_property ("whichBar"); if (scm_is_string (wb)) diff --git a/lily/beam-quanting.cc b/lily/beam-quanting.cc index 695cb80b6e..7ef972ec27 100644 --- a/lily/beam-quanting.cc +++ b/lily/beam-quanting.cc @@ -160,10 +160,8 @@ Beam::quanting (SCM smob, SCM posns) Real xr = fvs ? lvs->relative_coordinate (common[X_AXIS], X_AXIS) : 0.0; /* - We store some info to quickly interpolate. - - Sometimes my head is screwed on backwards. The stemlength are - AFFINE linear in YL and YR. If YL == YR == 0, then we might have + We store some info to quickly interpolate. The stemlength are + affine linear in YL and YR. If YL == YR == 0, then we might have stem_y != 0.0, when we're cross staff. */ @@ -179,11 +177,18 @@ Beam::quanting (SCM smob, SCM posns) bool f = to_boolean (s->get_property ("french-beaming")) && s != lvs && s != fvs; - base_lengths.push_back (calc_stem_y (me, s, common, xl, xr, - Interval (0, 0), f) / ss); + if (Stem::is_normal_stem (s)) + { + base_lengths.push_back (calc_stem_y (me, s, common, xl, xr, + Interval (0, 0), f) / ss); + } + else + { + base_lengths.push_back (0); + } + stem_xposns.push_back (s->relative_coordinate (common[X_AXIS], X_AXIS)); } - bool xstaff = false; if (lvs && fvs) { @@ -348,7 +353,7 @@ Beam::score_stem_lengths (vector const &stems, for (vsize i = 0; i < stems.size (); i++) { Grob *s = stems[i]; - if (Stem::is_invisible (s)) + if (!Stem::is_normal_stem (s)) continue; Real x = stem_xs[i]; diff --git a/lily/beam.cc b/lily/beam.cc index 75f859ffe4..18cfae23cd 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -1306,7 +1306,7 @@ Beam::last_normal_stem (Grob *me) rest -> stem -> beam -> interpolate_y_position () */ -MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Beam, rest_collision_callback, 2, 1); +MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Beam, rest_collision_callback, 2, 1, ""); SCM Beam::rest_collision_callback (SCM smob, SCM prev_offset) { diff --git a/lily/book-scheme.cc b/lily/book-scheme.cc index 23237dbb0d..516ad6fbe4 100644 --- a/lily/book-scheme.cc +++ b/lily/book-scheme.cc @@ -19,8 +19,7 @@ LY_DEFINE (ly_make_book, "ly:make-book", "containing @code{\\scores}.") { Output_def *odef = unsmob_output_def (paper); - SCM_ASSERT_TYPE (odef, paper, - SCM_ARG1, __FUNCTION__, "Output_def"); + LY_ASSERT_SMOB (Output_def, paper, 1); Book *book = new Book; book->paper_ = odef; @@ -35,7 +34,7 @@ LY_DEFINE (ly_make_book, "ly:make-book", return x; } -LY_DEFINE (ly_parser_print_book, "ly:book-process", +LY_DEFINE (ly_book_process, "ly:book-process", 4, 0, 0, (SCM book_smob, SCM default_paper, SCM default_layout, @@ -47,11 +46,9 @@ LY_DEFINE (ly_parser_print_book, "ly:book-process", { Book *book = unsmob_book (book_smob); - SCM_ASSERT_TYPE (book, book_smob, SCM_ARG1, __FUNCTION__, "Book"); - SCM_ASSERT_TYPE (unsmob_output_def (default_paper), - default_layout, SCM_ARG2, __FUNCTION__, "\\paper block"); - SCM_ASSERT_TYPE (unsmob_output_def (default_layout), - default_layout, SCM_ARG3, __FUNCTION__, "\\layout block"); + LY_ASSERT_SMOB(Book, book_smob, 1); + LY_ASSERT_SMOB(Output_def, default_paper, 2); + LY_ASSERT_SMOB(Output_def, default_layout, 3); Paper_book *pb = book->process (unsmob_output_def (default_paper), unsmob_output_def (default_layout)); @@ -65,7 +62,7 @@ LY_DEFINE (ly_parser_print_book, "ly:book-process", } -LY_DEFINE (ly_parser_print_book_to_systems, "ly:book-process-to-systems", +LY_DEFINE (ly_book_process_to_systems, "ly:book-process-to-systems", 4, 0, 0, (SCM book_smob, SCM default_paper, SCM default_layout, @@ -75,13 +72,11 @@ LY_DEFINE (ly_parser_print_book_to_systems, "ly:book-process-to-systems", "a string (for file based outputs) or a socket (for network based " "output).") { - Book *book = unsmob_book (book_smob); + LY_ASSERT_SMOB (Book, book_smob, 1); + LY_ASSERT_SMOB(Output_def, default_paper, 2); + LY_ASSERT_SMOB(Output_def, default_layout, 3); - SCM_ASSERT_TYPE (book, book_smob, SCM_ARG1, __FUNCTION__, "Book"); - SCM_ASSERT_TYPE (unsmob_output_def (default_paper), - default_layout, SCM_ARG2, __FUNCTION__, "\\paper block"); - SCM_ASSERT_TYPE (unsmob_output_def (default_layout), - default_layout, SCM_ARG3, __FUNCTION__, "\\layout block"); + Book *book = unsmob_book (book_smob); Paper_book *pb = book->process (unsmob_output_def (default_paper), unsmob_output_def (default_layout)); diff --git a/lily/book.cc b/lily/book.cc index f4d4dd790e..01e52ce9cd 100644 --- a/lily/book.cc +++ b/lily/book.cc @@ -83,11 +83,6 @@ Book::mark_smob (SCM s) { Book *book = (Book *) SCM_CELL_WORD_1 (s); -#if 0 - if (book->key_) - scm_gc_mark (book->key_->self_scm ()); -#endif - if (book->paper_) scm_gc_mark (book->paper_->self_scm ()); scm_gc_mark (book->scores_); diff --git a/lily/break-alignment-interface.cc b/lily/break-alignment-interface.cc index 61eca90ab6..c2c3354349 100644 --- a/lily/break-alignment-interface.cc +++ b/lily/break-alignment-interface.cc @@ -93,6 +93,9 @@ Break_alignment_interface::calc_positioning_done (SCM smob) Grob *grob = unsmob_grob (smob); Item *me = dynamic_cast (grob); + + me->set_property ("positioning-done", SCM_BOOL_T); + vector elems = ordered_elements (me); vector extents; diff --git a/lily/context-scheme.cc b/lily/context-scheme.cc index a6ee973a1c..30a876f36d 100644 --- a/lily/context-scheme.cc +++ b/lily/context-scheme.cc @@ -18,7 +18,8 @@ LY_DEFINE (ly_context_id, "ly:context-id", "return the string @code{one}.") { Context *tr = unsmob_context (context); - SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context"); + + LY_ASSERT_SMOB (Context, context, 1); return ly_string2scm (tr->id_string ()); } @@ -29,8 +30,10 @@ LY_DEFINE (ly_context_name, "ly:context-name", "i.e. for @code{\\context Voice = one .. } " "return the symbol @code{Voice}.") { + LY_ASSERT_SMOB (Context, context, 1); + Context *tr = unsmob_context (context); - SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context"); + return ly_symbol2scm (tr->context_name ().c_str ()); } @@ -40,8 +43,9 @@ LY_DEFINE (ly_context_grob_definition, "ly:context-grob-definition", "as an alist") { Context *tr = unsmob_context (context); - SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context"); - SCM_ASSERT_TYPE (scm_is_symbol (name), name, SCM_ARG2, __FUNCTION__, "symbol"); + + LY_ASSERT_SMOB (Context, context, 1); + LY_ASSERT_TYPE(ly_is_symbol, name, 2); return updated_grob_properties (tr, name); } @@ -54,9 +58,10 @@ LY_DEFINE (ly_context_pushpop_property, "ly:context-pushpop-property", "or reverted (if unspecified).") { Context *tg = unsmob_context (context); - SCM_ASSERT_TYPE (tg, context, SCM_ARG1, __FUNCTION__, "context"); - SCM_ASSERT_TYPE (scm_is_symbol (grob), grob, SCM_ARG2, __FUNCTION__, "symbol"); - SCM_ASSERT_TYPE (scm_is_symbol (eltprop), eltprop, SCM_ARG3, __FUNCTION__, "symbol"); + + LY_ASSERT_SMOB (Context, context, 1); + LY_ASSERT_TYPE(ly_is_symbol, grob, 2); + LY_ASSERT_TYPE(ly_is_symbol, eltprop, 3); execute_pushpop_property (tg, grob, eltprop, val); @@ -67,22 +72,22 @@ LY_DEFINE (ly_context_property, "ly:context-property", 2, 0, 0, (SCM c, SCM name), "Return the value of @var{name} from context @var{c}") { - Context *t = unsmob_context (c); - Context *tr = (t); - SCM_ASSERT_TYPE (tr, c, SCM_ARG1, __FUNCTION__, "Translator group"); - SCM_ASSERT_TYPE (scm_is_symbol (name), name, SCM_ARG2, __FUNCTION__, "symbol"); + LY_ASSERT_SMOB (Context, c, 1); + LY_ASSERT_TYPE(ly_is_symbol, name, 2); - return tr->internal_get_property (name); + Context *t = unsmob_context (c); + return t->internal_get_property (name); } -LY_DEFINE (ly_context_set_property, "ly:context-set-property!", +LY_DEFINE (ly_context_set_property_x, "ly:context-set-property!", 3, 0, 0, (SCM context, SCM name, SCM val), "Set value of property @var{name} in context @var{context} " "to @var{val}.") { + LY_ASSERT_SMOB (Context, context, 1); + LY_ASSERT_TYPE(ly_is_symbol, name, 2); + Context *tr = unsmob_context (context); - SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context"); - SCM_ASSERT_TYPE (scm_is_symbol (name), name, SCM_ARG2, __FUNCTION__, "symbol"); tr->set_property (name, val); @@ -94,9 +99,10 @@ LY_DEFINE (ly_context_property_where_defined, "ly:context-property-where-defined "Return the context above @var{context} " "where @var{name} is defined.") { + LY_ASSERT_SMOB (Context, context, 1); + LY_ASSERT_TYPE(ly_is_symbol,name, 2); + Context *tr = unsmob_context (context); - SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context"); - SCM_ASSERT_TYPE (scm_is_symbol (name), name, SCM_ARG2, __FUNCTION__, "symbol"); SCM val; tr = tr->where_defined (name, &val); @@ -106,14 +112,14 @@ LY_DEFINE (ly_context_property_where_defined, "ly:context-property-where-defined return SCM_EOL; } -LY_DEFINE (ly_unset_context_property, "ly:context-unset-property", 2, 0, 0, +LY_DEFINE (ly_context_unset_property, "ly:context-unset-property", 2, 0, 0, (SCM context, SCM name), "Unset value of property @var{name} in context @var{context}.") { + LY_ASSERT_SMOB (Context, context, 1); + LY_ASSERT_TYPE(ly_is_symbol,name, 2); Context *tr = unsmob_context (context); - SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context"); - SCM_ASSERT_TYPE (scm_is_symbol (name), name, SCM_ARG2, __FUNCTION__, "symbol"); - + tr->unset_property (name); return SCM_UNSPECIFIED; } @@ -122,8 +128,8 @@ LY_DEFINE (ly_context_parent, "ly:context-parent", 1, 0, 0, (SCM context), "Return the parent of @var{context}, @code{#f} if none.") { + LY_ASSERT_SMOB (Context, context, 1); Context *tr = unsmob_context (context); - SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "Context"); tr = tr->get_parent_context (); if (tr) @@ -138,9 +144,9 @@ LY_DEFINE (ly_context_find, "ly:context-find", "Find a parent of @var{context} that has name or alias @var{name}. " "Return @code{#f} if not found.") { + LY_ASSERT_SMOB (Context, context, 1); + LY_ASSERT_TYPE(ly_is_symbol,name, 2); Context *tr = unsmob_context (context); - SCM_ASSERT_TYPE (tr, context, SCM_ARG1, __FUNCTION__, "context"); - SCM_ASSERT_TYPE (scm_is_symbol (name), name, SCM_ARG2, __FUNCTION__, "symbol"); while (tr) { @@ -156,8 +162,8 @@ LY_DEFINE (ly_context_now, "ly:context-now", 1, 0, 0, (SCM context), "Return now-moment of context CONTEXT") { + LY_ASSERT_SMOB (Context, context, 1); Context *ctx = unsmob_context (context); - SCM_ASSERT_TYPE (ctx, context, SCM_ARG1, __FUNCTION__, "Context"); return ctx->now_mom ().smobbed_copy (); } @@ -165,8 +171,8 @@ LY_DEFINE (ly_context_event_source, "ly:context-event-source", 1, 0, 0, (SCM context), "Return event-source of context CONTEXT") { + LY_ASSERT_SMOB (Context, context, 1); Context *ctx = unsmob_context (context); - SCM_ASSERT_TYPE (ctx, context, SCM_ARG1, __FUNCTION__, "Context"); return ctx->event_source ()->self_scm (); } @@ -175,7 +181,7 @@ LY_DEFINE (ly_context_events_below, "ly:context-events-below", "Return a stream-distributor that distributes all events\n" " from @var{context} and all its subcontexts.") { + LY_ASSERT_SMOB (Context, context, 1); Context *ctx = unsmob_context (context); - SCM_ASSERT_TYPE (ctx, context, SCM_ARG1, __FUNCTION__, "Context"); return ctx->events_below ()->self_scm (); } diff --git a/lily/dimensions-scheme.cc b/lily/dimensions-scheme.cc index 0d6ed607f7..4025b4078a 100644 --- a/lily/dimensions-scheme.cc +++ b/lily/dimensions-scheme.cc @@ -14,8 +14,7 @@ LY_DEFINE (ly_pt, "ly:pt", 1, 0, 0, (SCM num), "@var{num} printer points") { - SCM_ASSERT_TYPE (scm_is_number (num), num, SCM_ARG1, __FUNCTION__, - "number"); + LY_ASSERT_TYPE (scm_is_number, num, 1); return scm_from_double (point_constant * scm_to_double (num)); } @@ -24,8 +23,7 @@ LY_DEFINE (ly_cm, "ly:cm", 1, 0, 0, (SCM num), "@var{num} cm") { - SCM_ASSERT_TYPE (scm_is_number (num), num, SCM_ARG1, __FUNCTION__, - "number"); + LY_ASSERT_TYPE (scm_is_number, num, 1); return scm_from_double (cm_constant * scm_to_double (num)); } @@ -34,8 +32,7 @@ LY_DEFINE (ly_inch, "ly:inch", 1, 0, 0, (SCM num), "@var{num} inches") { - SCM_ASSERT_TYPE (scm_is_number (num), num, SCM_ARG1, __FUNCTION__, - "number"); + LY_ASSERT_TYPE (scm_is_number, num, 1); return scm_from_double (inch_constant * scm_to_double (num)); } @@ -44,8 +41,7 @@ LY_DEFINE (ly_mm, "ly:mm", 1, 0, 0, (SCM num), "@var{num} mm") { - SCM_ASSERT_TYPE (scm_is_number (num), num, SCM_ARG1, __FUNCTION__, - "number"); + LY_ASSERT_TYPE (scm_is_number, num, 1); return scm_from_double (mm_constant * scm_to_double (num)); } @@ -54,8 +50,7 @@ LY_DEFINE (ly_bp, "ly:bp", 1, 0, 0, (SCM num), "@var{num} bigpoints (1/72th inch)") { - SCM_ASSERT_TYPE (scm_is_number (num), num, SCM_ARG1, __FUNCTION__, - "number"); + LY_ASSERT_TYPE (scm_is_number, num, 1); return scm_from_double (bigpoint_constant * scm_to_double (num)); } diff --git a/lily/dispatcher-scheme.cc b/lily/dispatcher-scheme.cc index 9e491e0a9a..00c52aca59 100644 --- a/lily/dispatcher-scheme.cc +++ b/lily/dispatcher-scheme.cc @@ -15,14 +15,16 @@ LY_DEFINE (ly_make_dispatcher, "ly:make-dispatcher", return (new Dispatcher ())->unprotect (); } -LY_DEFINE (ly_register_dispatcher, "ly:connect-dispatchers", +LY_DEFINE (ly_connect_dispatchers, "ly:connect-dispatchers", 2, 0, 0, (SCM to, SCM from), "Makes the dispatcher @var{to} listen to events from @var{from}." ) { Dispatcher *t = unsmob_dispatcher (to); Dispatcher *f = unsmob_dispatcher (from); - SCM_ASSERT_TYPE (t, from, SCM_ARG1, __FUNCTION__, "dispatcher"); - SCM_ASSERT_TYPE (f, to, SCM_ARG2, __FUNCTION__, "dispatcher"); + + LY_ASSERT_SMOB (Dispatcher, to, 1); + LY_ASSERT_SMOB(Dispatcher, from, 2); + t->register_as_listener (f); return SCM_UNDEFINED; @@ -35,8 +37,9 @@ LY_DEFINE (ly_add_listener, "ly:add-listener", { Listener *l = unsmob_listener (list); Dispatcher *d = unsmob_dispatcher (disp); - SCM_ASSERT_TYPE (l, list, SCM_ARG1, __FUNCTION__, "listener"); - SCM_ASSERT_TYPE (d, disp, SCM_ARG2, __FUNCTION__, "dispatcher"); + + LY_ASSERT_SMOB (Listener, list, 1); + LY_ASSERT_SMOB(Dispatcher, disp, 2); for (int arg = SCM_ARG3; scm_is_pair (cl); cl = scm_cdr (cl), arg++) { @@ -55,8 +58,10 @@ LY_DEFINE (ly_broadcast, "ly:broadcast", { Dispatcher *d = unsmob_dispatcher (disp); Stream_event *e = unsmob_stream_event (ev); - SCM_ASSERT_TYPE (d, disp, SCM_ARG1, __FUNCTION__, "dispatcher"); - SCM_ASSERT_TYPE (e, ev, SCM_ARG2, __FUNCTION__, "stream event"); + + LY_ASSERT_SMOB (Dispatcher, disp, 1); + + LY_ASSERT_SMOB(Stream_event, ev, 2); d->broadcast (e); return SCM_UNDEFINED; } diff --git a/lily/dot-column.cc b/lily/dot-column.cc index 173a9ad981..b2ff0308fa 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -213,6 +213,9 @@ SCM Dot_column::calc_positioning_done (SCM smob) { Grob *me = unsmob_grob (smob); + + me->set_property ("positioning-done", SCM_BOOL_T); + vector dots = extract_grob_array (me, "dots"); diff --git a/lily/duration-scheme.cc b/lily/duration-scheme.cc index 4b8c4605c0..11e6b58d0d 100644 --- a/lily/duration-scheme.cc +++ b/lily/duration-scheme.cc @@ -27,12 +27,12 @@ LY_DEFINE (ly_duration_less_p, "ly:durationduration_log ()); } @@ -100,7 +98,7 @@ LY_DEFINE (ly_duration_dot_count, "ly:duration-dot-count", 1, 0, 0, (SCM dur), "Extract the dot count from @var{dur}") { - SCM_ASSERT_TYPE (unsmob_duration (dur), dur, SCM_ARG1, __FUNCTION__, "duration"); + LY_ASSERT_SMOB (Duration, dur, 1); return scm_from_int (unsmob_duration (dur)->dot_count ()); } @@ -108,7 +106,7 @@ LY_DEFINE (ly_intlog2, "ly:intlog2", 1, 0, 0, (SCM d), "The 2-logarithm of 1/@var{d}.") { - SCM_ASSERT_TYPE (scm_is_number (d), d, SCM_ARG1, __FUNCTION__, "integer"); + LY_ASSERT_TYPE (scm_is_number, d, 1); int log = intlog2 (scm_to_int (d)); return scm_from_int (log); } @@ -117,15 +115,15 @@ LY_DEFINE (ly_duration_length, "ly:duration-length", 1, 0, 0, (SCM dur), "The length of the duration as a Moment.") { - SCM_ASSERT_TYPE (unsmob_duration (dur), dur, SCM_ARG1, __FUNCTION__, "duration"); + LY_ASSERT_SMOB (Duration, dur, 1); return Moment (unsmob_duration (dur)->get_length ()).smobbed_copy (); } -LY_DEFINE (ly_duration2string, "ly:duration->string", +LY_DEFINE (ly_duration_2_string, "ly:duration->string", 1, 0, 0, (SCM dur), "Convert @var{dur} to string.") { - SCM_ASSERT_TYPE (unsmob_duration (dur), dur, SCM_ARG1, __FUNCTION__, "duration"); + LY_ASSERT_SMOB (Duration, dur, 1); return ly_string2scm (unsmob_duration (dur)->to_string ()); } @@ -133,7 +131,7 @@ LY_DEFINE (ly_duration_factor, "ly:duration-factor", 1, 0, 0, (SCM dur), "Extract the compression factor from @var{dur}. Return as a pair.") { - SCM_ASSERT_TYPE (unsmob_duration (dur), dur, SCM_ARG1, __FUNCTION__, "duration"); + LY_ASSERT_SMOB (Duration, dur, 1); Rational r = unsmob_duration (dur)->factor (); return scm_cons (scm_from_int (r.num ()), scm_from_int (r.den ())); } diff --git a/lily/engraver.cc b/lily/engraver.cc index ac74d5e930..84780dd0a2 100644 --- a/lily/engraver.cc +++ b/lily/engraver.cc @@ -96,8 +96,7 @@ LY_DEFINE (ly_set_grob_creation_callback, "ly:set-grob-creation-callback", "the grob to be created and the corresponding line number in the " "C++ source file.") { - SCM_ASSERT_TYPE(ly_is_procedure (cb), cb, SCM_ARG1, __FUNCTION__, - "procedure"); + LY_ASSERT_TYPE (ly_is_procedure, cb, 1); creation_callback = cb; diff --git a/lily/font-config-scheme.cc b/lily/font-config-scheme.cc index 5d734899b2..5fa68f862c 100644 --- a/lily/font-config-scheme.cc +++ b/lily/font-config-scheme.cc @@ -89,9 +89,7 @@ LY_DEFINE (ly_font_config_get_font_file, "ly:font-config-get-font-file", 1, 0, 0 (SCM name), "Get the file for font @var{name}") { - SCM_ASSERT_TYPE (scm_is_string (name), name, - SCM_ARG1, __FUNCTION__, "string"); - + LY_ASSERT_TYPE (scm_is_string, name, 1); FcPattern*pat = FcPatternCreate (); FcValue val; diff --git a/lily/font-metric-scheme.cc b/lily/font-metric-scheme.cc index 18edb7513a..a1e18da2c2 100644 --- a/lily/font-metric-scheme.cc +++ b/lily/font-metric-scheme.cc @@ -20,8 +20,8 @@ LY_DEFINE (ly_font_get_glyph, "ly:font-get-glyph", "is not available, return @code{#f}.") { Font_metric *fm = unsmob_metrics (font); - SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric"); - SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG2, __FUNCTION__, "string"); + LY_ASSERT_SMOB (Font_metric, font, 1); + LY_ASSERT_TYPE(scm_is_string,name, 2); Stencil m = fm->find_by_name (ly_scm2string (name)); @@ -36,8 +36,8 @@ LY_DEFINE (ly_get_glyph, "ly:get-glyph", "in @var{font}.") { Font_metric *fm = unsmob_metrics (font); - SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric"); - SCM_ASSERT_TYPE (scm_is_number (index), index, SCM_ARG2, __FUNCTION__, "number"); + LY_ASSERT_SMOB (Font_metric, font, 1); + LY_ASSERT_TYPE(scm_is_number, index,2); return fm->get_ascii_char_stencil (scm_to_int (index)).smobbed_copy (); } @@ -48,8 +48,8 @@ LY_DEFINE (ly_font_glyph_name_to_index, "ly:font-glyph-name-to-index", "Return the index for @var{name} in @var{font}.") { Font_metric *fm = unsmob_metrics (font); - SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric"); - SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG2, __FUNCTION__, "string"); + LY_ASSERT_SMOB (Font_metric, font, 1); + LY_ASSERT_TYPE(scm_is_string,name, 2); return scm_from_int (fm->name_to_index (ly_scm2string (name))); } @@ -60,8 +60,8 @@ LY_DEFINE (ly_font_index_to_charcode, "ly:font-index-to-charcode", "Return the character code for @var{index} @var{font}.") { Font_metric *fm = unsmob_metrics (font); - SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric"); - SCM_ASSERT_TYPE (scm_is_integer (index), index, SCM_ARG2, __FUNCTION__, "index"); + LY_ASSERT_SMOB (Font_metric, font, 1); + LY_ASSERT_TYPE(scm_is_integer,index, 2); return scm_from_unsigned_integer (fm->index_to_charcode (scm_to_int (index))); } @@ -72,8 +72,8 @@ LY_DEFINE (ly_font_glyph_name_to_charcode, "ly:font-glyph-name-to-charcode", "Return the character code for glyph @var{name} in @var{font}.") { Font_metric *fm = unsmob_metrics (font); - SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric"); - SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG2, __FUNCTION__, "string"); + LY_ASSERT_SMOB (Font_metric, font, 1); + LY_ASSERT_TYPE(scm_is_string,name, 2); return scm_from_unsigned_integer (fm->index_to_charcode (fm->name_to_index (ly_scm2string (name)))); } @@ -89,8 +89,8 @@ LY_DEFINE (ly_text_dimension, "ly:text-dimension", Modified_font_metric *fm = dynamic_cast (unsmob_metrics (font)); - SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "modified font metric"); - SCM_ASSERT_TYPE (scm_is_string (text), text, SCM_ARG2, __FUNCTION__, "string"); + LY_ASSERT_SMOB (Font_metric, font, 1); + LY_ASSERT_TYPE(scm_is_string,text, 2); Stencil stc (fm->text_stencil (ly_scm2string (text))); return scm_cons (ly_interval2scm (stc.extent (X_AXIS)), ly_interval2scm (stc.extent (Y_AXIS))); @@ -106,8 +106,9 @@ LY_DEFINE (ly_font_file_name, "ly:font-file-name", "Given the font metric @var{font}, " "return the corresponding file name.") { + LY_ASSERT_SMOB (Font_metric, font, 1); + Font_metric *fm = unsmob_metrics (font); - SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric"); SCM name = fm->font_file_name (); return name; @@ -119,19 +120,20 @@ LY_DEFINE (ly_font_name, "ly:font-name", "Given the font metric @var{font}, " "return the corresponding name.") { + LY_ASSERT_SMOB (Font_metric, font, 1); Font_metric *fm = unsmob_metrics (font); - SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric"); return ly_string2scm (fm->font_name ()); } LY_DEFINE (ly_font_magnification, "ly:font-magnification", 1, 0, 0, (SCM font), "Given the font metric @var{font}, return the " - "magnification, relative to the current outputs-cale.") + "magnification, relative to the current output-scale.") { + LY_ASSERT_SMOB (Font_metric, font, 1); + Font_metric *fm = unsmob_metrics (font); - SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric"); return scm_cdr (fm->description_); } @@ -140,8 +142,9 @@ LY_DEFINE (ly_font_design_size, "ly:font-design-size", 1, 0, 0, "Given the font metric @var{font}, return the " "design size, relative to the current output-scale.") { + LY_ASSERT_SMOB (Font_metric, font, 1); + Font_metric *fm = unsmob_metrics (font); - SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric"); return scm_from_double (fm->design_size ()); } diff --git a/lily/function-documentation.cc b/lily/function-documentation.cc index 7e450528ae..38e85837c0 100644 --- a/lily/function-documentation.cc +++ b/lily/function-documentation.cc @@ -11,15 +11,33 @@ using namespace std; #include "std-string.hh" #include "lily-guile.hh" +#include "warn.hh" + +/* type predicates. */ +#include "spanner.hh" +#include "item.hh" + static SCM doc_hash_table; -void ly_add_function_documentation (SCM func, - char const *fname, - char const *varlist, - char const *doc) +void +ly_check_name (string cxx, string scm_name) +{ + string mangle = mangle_cxx_identifier (cxx); + if (mangle != scm_name) + { + programming_error ("wrong cxx name: " + mangle + ", " + cxx + ", " + scm_name); + } +} + + +void +ly_add_function_documentation (SCM func, + string fname, + string varlist, + string doc) { - if (!strlen (doc)) + if (doc == "") return; if (!doc_hash_table) @@ -30,8 +48,8 @@ void ly_add_function_documentation (SCM func, scm_set_procedure_property_x (func, ly_symbol2scm ("documentation"), ly_string2scm (s)); - SCM entry = scm_cons (scm_from_locale_string (varlist), scm_from_locale_string (doc)); - scm_hashq_set_x (doc_hash_table, ly_symbol2scm (fname), entry); + SCM entry = scm_cons (ly_string2scm (varlist), ly_string2scm (doc)); + scm_hashq_set_x (doc_hash_table, ly_symbol2scm (fname.c_str()), entry); } LY_DEFINE (ly_get_all_function_documentation, "ly:get-all-function-documentation", @@ -40,3 +58,55 @@ LY_DEFINE (ly_get_all_function_documentation, "ly:get-all-function-documentation { return doc_hash_table; } + + +#include + +map type_names; + +void +ly_add_type_predicate (void *ptr, + string name) +{ + type_names[ptr] = name; +} + +string +predicate_to_typename (void *ptr) +{ + if (type_names.find (ptr) == type_names.end ()) + return "unknown type"; + else + return type_names[ptr]; +} + +static int +arg_dir (int a, int b) +{ + if (&a < &b) + return 1; + else + return -1; +} + + +int function_argument_direction; +void +init_func_doc () +{ + function_argument_direction = arg_dir (2,3); + + ly_add_type_predicate ((void*) &scm_is_integer, "integer"); + ly_add_type_predicate ((void*) &scm_is_bool, "boolean"); + ly_add_type_predicate ((void*) &scm_is_pair, "pair"); + ly_add_type_predicate ((void*) &is_number_pair, "number pair"); + ly_add_type_predicate ((void*) &scm_is_number, "number"); + ly_add_type_predicate ((void*) &scm_is_string, "string"); + ly_add_type_predicate ((void*) &ly_is_symbol, "symbol"); + ly_add_type_predicate ((void*) &scm_is_vector, "vector"); + ly_add_type_predicate ((void*) &is_axis, "axis"); + ly_add_type_predicate ((void*) &unsmob_spanner, "spanner"); + ly_add_type_predicate ((void*) &unsmob_item, "item"); +} + +ADD_SCM_INIT_FUNC(func_doc, init_func_doc); diff --git a/lily/general-scheme.cc b/lily/general-scheme.cc index cbc3b605ed..7f741d059c 100644 --- a/lily/general-scheme.cc +++ b/lily/general-scheme.cc @@ -32,7 +32,7 @@ LY_DEFINE (ly_find_file, "ly:find-file", "Return the absolute file name of @var{name}, " "or @code{#f} if not found.") { - SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG1, __FUNCTION__, "string"); + LY_ASSERT_TYPE (scm_is_string, name, 1); string nm = ly_scm2string (name); string file_name = global_path.find (nm); @@ -51,11 +51,11 @@ LY_DEFINE (ly_gulp_file, "ly:gulp-file", "Read the file @var{name}, and return its contents in a string. " "The file is looked up using the search path. ") { - SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG1, __FUNCTION__, "string"); + LY_ASSERT_TYPE (scm_is_string, name, 1); int sz = INT_MAX; if (size != SCM_UNDEFINED) { - SCM_ASSERT_TYPE (scm_is_number (size), size, SCM_ARG2, __FUNCTION__, "number"); + LY_ASSERT_TYPE(scm_is_number,size, 2); sz = scm_to_int (size); } @@ -68,7 +68,7 @@ LY_DEFINE (ly_error, "ly:error", "Scheme callable function to issue the error @code{msg}. " "The error is formatted with @code{format} and @code{rest}.") { - SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "string"); + LY_ASSERT_TYPE (scm_is_string, str, 1); str = scm_simple_format (SCM_BOOL_F, str, rest); error (ly_scm2string (str)); return SCM_UNSPECIFIED; @@ -79,7 +79,7 @@ LY_DEFINE (ly_message, "ly:message", "Scheme callable function to issue the message @code{msg}. " "The message is formatted with @code{format} and @code{rest}.") { - SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "string"); + LY_ASSERT_TYPE (scm_is_string, str, 1); str = scm_simple_format (SCM_BOOL_F, str, rest); message (ly_scm2string (str)); return SCM_UNSPECIFIED; @@ -90,7 +90,7 @@ LY_DEFINE (ly_progress, "ly:progress", "Scheme callable function to print progress @code{str}. " "The message is formatted with @code{format} and @code{rest}.") { - SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "string"); + LY_ASSERT_TYPE (scm_is_string, str, 1); str = scm_simple_format (SCM_BOOL_F, str, rest); progress_indication (ly_scm2string (str)); return SCM_UNSPECIFIED; @@ -101,7 +101,7 @@ LY_DEFINE (ly_programming_error, "ly:programming-error", "Scheme callable function to issue the warning @code{msg}. " "The message is formatted with @code{format} and @code{rest}.") { - SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "string"); + LY_ASSERT_TYPE (scm_is_string, str, 1); str = scm_simple_format (SCM_BOOL_F, str, rest); programming_error (ly_scm2string (str)); return SCM_UNSPECIFIED; @@ -112,7 +112,7 @@ LY_DEFINE (ly_warning, "ly:warning", "Scheme callable function to issue the warning @code{str}. " "The message is formatted with @code{format} and @code{rest}.") { - SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "string"); + LY_ASSERT_TYPE (scm_is_string, str, 1); str = scm_simple_format (SCM_BOOL_F, str, rest); warning (ly_scm2string (str)); return SCM_UNSPECIFIED; @@ -152,9 +152,9 @@ LY_DEFINE (ly_string_substitute, "ly:string-substitute", 3, 0, 0, (SCM a, SCM b, SCM s), "Replace @var{a} by @var{b} in @var{s}.") { - SCM_ASSERT_TYPE (scm_is_string (a), s, SCM_ARG1, __FUNCTION__, "string"); - SCM_ASSERT_TYPE (scm_is_string (b), s, SCM_ARG2, __FUNCTION__, "string"); - SCM_ASSERT_TYPE (scm_is_string (s), s, SCM_ARG3, __FUNCTION__, "string"); + LY_ASSERT_TYPE (scm_is_string, s, 1); + LY_ASSERT_TYPE(scm_is_string,b, 2); + LY_ASSERT_TYPE(scm_is_string,s, 3); string ss = ly_scm2string (s); replace_all (ss, string (scm_i_string_chars (a)), @@ -162,11 +162,11 @@ LY_DEFINE (ly_string_substitute, "ly:string-substitute", return ly_string2scm (ss); } -LY_DEFINE (ly_number2string, "ly:number->string", +LY_DEFINE (ly_number_2_string, "ly:number->string", 1, 0, 0, (SCM s), "Convert @var{num} to a string without generating many decimals.") { - SCM_ASSERT_TYPE (scm_is_number (s), s, SCM_ARG1, __FUNCTION__, "number"); + LY_ASSERT_TYPE (scm_is_number, s, 1); char str[400]; // ugh. @@ -224,8 +224,7 @@ LY_DEFINE (ly_gettext, "ly:gettext", 1, 0, 0, (SCM string), "Gettext wrapper.") { - SCM_ASSERT_TYPE (scm_is_string (string), string, SCM_ARG1, - __FUNCTION__, "string"); + LY_ASSERT_TYPE (scm_is_string, string, 1); return ly_string2scm (_ (scm_i_string_chars (string))); } @@ -251,13 +250,13 @@ LY_DEFINE (ly_output_formats, "ly:output-formats", return lst; } -LY_DEFINE (ly_wchar_to_utf_8, "ly:wide-char->utf-8", +LY_DEFINE (ly_wide_char_2_utf_8, "ly:wide-char->utf-8", 1, 0, 0, (SCM wc), "Encode the Unicode codepoint @var{wc}, an integer, as UTF-8") { char buf[5]; - SCM_ASSERT_TYPE (scm_is_integer (wc), wc, SCM_ARG1, __FUNCTION__, "integer"); + LY_ASSERT_TYPE (scm_is_integer, wc, 1); unsigned wide_char = (unsigned) scm_to_int (wc); char *p = buf; @@ -315,8 +314,7 @@ LY_DEFINE (ly_stderr_redirect, "ly:stderr-redirect", 1, 1, 0, (SCM file_name, SCM mode), "Redirect stderr to FILE-NAME, opened with MODE.") { - SCM_ASSERT_TYPE (scm_is_string (file_name), file_name, SCM_ARG1, - __FUNCTION__, "file_name"); + LY_ASSERT_TYPE (scm_is_string, file_name, 1); string m = "w"; if (mode != SCM_UNDEFINED && scm_string_p (mode)) @@ -344,12 +342,11 @@ LY_DEFINE(ly_hash_table_keys, "ly:hash-table-keys", NULL, SCM_EOL, tab); } -LY_DEFINE (ly_camel_case_to_lisp_identifier, "ly:camel-case->lisp-identifier", +LY_DEFINE (ly_camel_case_2_lisp_identifier, "ly:camel-case->lisp-identifier", 1, 0, 0, (SCM name_sym), "Convert FooBar_Bla to foo-bar-bla style symbol.") { - SCM_ASSERT_TYPE(scm_is_symbol (name_sym), name_sym, - SCM_ARG1, __FUNCTION__, "symbol"); + LY_ASSERT_TYPE (ly_is_symbol, name_sym, 1); /* TODO: should use strings instead? @@ -365,8 +362,7 @@ LY_DEFINE (ly_expand_environment, "ly:expand-environment", 1, 0, 0, (SCM str), "Expand $VAR and $@{VAR@} in @var{str}.") { - SCM_ASSERT_TYPE(scm_is_string (str), str, - SCM_ARG1, __FUNCTION__, "string"); + LY_ASSERT_TYPE (scm_is_string, str, 1); return ly_string2scm (expand_environment_variables (ly_scm2string (str))); } @@ -376,8 +372,7 @@ LY_DEFINE (ly_truncate_list_x, "ly:truncate-list!", 2, 0, 0, (SCM lst, SCM i), "Take at most the first @var{i} of list @var{lst}") { - SCM_ASSERT_TYPE(scm_is_integer (i), i, - SCM_ARG1, __FUNCTION__, "integer"); + LY_ASSERT_TYPE (scm_is_integer, i, 1); int k = scm_to_int (i); if (k == 0) @@ -432,7 +427,7 @@ LY_DEFINE (ly_format, "ly:format", 1, 0, 1, (SCM str, SCM rest), "LilyPond specific format, supporting ~a ~[0-9]f.") { - SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "string"); + LY_ASSERT_TYPE (scm_is_string, str, 1); string format = ly_scm2string (str); vector results; diff --git a/lily/global-context-scheme.cc b/lily/global-context-scheme.cc index c5f4d561f9..c888487776 100644 --- a/lily/global-context-scheme.cc +++ b/lily/global-context-scheme.cc @@ -5,6 +5,7 @@ (c) 2005--2007 Han-Wen Nienhuys */ + #include "cpu-timer.hh" #include "global-context.hh" #include "international.hh" @@ -22,7 +23,8 @@ LY_DEFINE (ly_format_output, "ly:format-output", "process it and return the @code{Music_output} object in its final state.") { Global_context *g = dynamic_cast (unsmob_context (context)); - SCM_ASSERT_TYPE (g, context, SCM_ARG1, __FUNCTION__, "Global context"); + + LY_ASSERT_TYPE (unsmob_global_context, context, 1) SCM output = g->get_output (); progress_indication ("\n"); @@ -39,7 +41,7 @@ LY_DEFINE (ly_make_global_translator, "ly:make-global-translator", "@var{global}. The translator group is returned.") { Global_context *g = dynamic_cast (unsmob_context (global)); - SCM_ASSERT_TYPE (g, global, SCM_ARG1, __FUNCTION__, "Global context"); + LY_ASSERT_TYPE (unsmob_global_context, global, 1) Translator_group *tg = new Translator_group (); tg->connect_to_context (g); @@ -55,10 +57,8 @@ LY_DEFINE (ly_make_global_context, "ly:make-global-context", "The context is returned.\n" ) { - Output_def *odef = unsmob_output_def (output_def); - - SCM_ASSERT_TYPE (odef, output_def, SCM_ARG1, __FUNCTION__, - "Output definition"); + LY_ASSERT_SMOB (Output_def, output_def, 1); + Output_def *odef = unsmob_output_def (output_def); Global_context *glob = new Global_context (odef); @@ -77,11 +77,10 @@ LY_DEFINE (ly_interpret_music_expression, "ly:interpret-music-expression", "global context @var{ctx}. The context is returned in its\n" "final state.\n") { - Music *music = unsmob_music (mus); - Global_context *g = dynamic_cast (unsmob_context (ctx)); - SCM_ASSERT_TYPE (music, mus, SCM_ARG1, __FUNCTION__, "Music"); - SCM_ASSERT_TYPE (g, ctx, SCM_ARG2, __FUNCTION__, "Global context"); + LY_ASSERT_SMOB (Music, mus, 1); + LY_ASSERT_TYPE (unsmob_global_context,ctx, 2); + Music *music = unsmob_music (mus); if (!music || !music->get_length ().to_bool ()) { @@ -89,6 +88,8 @@ LY_DEFINE (ly_interpret_music_expression, "ly:interpret-music-expression", return SCM_BOOL_F; } + Global_context *g = dynamic_cast (unsmob_context (ctx)); + Cpu_timer timer; message (_ ("Interpreting music... ")); @@ -129,6 +130,9 @@ LY_DEFINE (ly_run_translator, "ly:run-translator", "Optionally, this routine takes an Object-key to\n" "to uniquely identify the Score block containing it.\n") { + LY_ASSERT_SMOB (Music, mus, 1); + LY_ASSERT_SMOB (Output_def, output_def, 2); + SCM glob = ly_make_global_context (output_def); ly_make_global_translator (glob); ly_interpret_music_expression (mus, glob); diff --git a/lily/global-context.cc b/lily/global-context.cc index f4aff0398e..f31a1283af 100644 --- a/lily/global-context.cc +++ b/lily/global-context.cc @@ -196,3 +196,9 @@ Global_context::get_default_interpreter () else return Context::get_default_interpreter (); } + +Global_context * +unsmob_global_context (SCM x) +{ + return dynamic_cast (unsmob_context (x)); +} diff --git a/lily/grob-array-scheme.cc b/lily/grob-array-scheme.cc index b242addf9b..b74b10fc51 100644 --- a/lily/grob-array-scheme.cc +++ b/lily/grob-array-scheme.cc @@ -15,8 +15,9 @@ LY_DEFINE (ly_grob_array_length, "ly:grob-array-length", (SCM grob_arr), "Return the grob_array length.") { + LY_ASSERT_SMOB (Grob_array, grob_arr, 1); + Grob_array *me = unsmob_grob_array (grob_arr); - SCM_ASSERT_TYPE (me, grob_arr, SCM_ARG1, __FUNCTION__, "Grob_array"); return scm_from_int (me->size ()); } @@ -27,8 +28,8 @@ LY_DEFINE (ly_grob_array_ref, "ly:grob-array-ref", "Retrieve the @code{index} element of @code{grob-arr}.") { Grob_array *me = unsmob_grob_array (grob_arr); - SCM_ASSERT_TYPE (me, grob_arr, SCM_ARG1, __FUNCTION__, "Grob_array"); - SCM_ASSERT_TYPE (scm_is_integer (index), index, SCM_ARG2, __FUNCTION__, "integer"); + LY_ASSERT_SMOB (Grob_array, grob_arr, 1); + LY_ASSERT_TYPE(scm_is_integer,index, 2); vsize i = scm_to_unsigned (index); if (i == VPOS || i >= me->size ()) diff --git a/lily/grob-interface-scheme.cc b/lily/grob-interface-scheme.cc index 5d5947cbb7..a174d26453 100644 --- a/lily/grob-interface-scheme.cc +++ b/lily/grob-interface-scheme.cc @@ -15,9 +15,9 @@ LY_DEFINE (ly_add_interface, "ly:add-interface", 3, 0, 0, (SCM a, SCM b, SCM c), "Add an interface description.") { - SCM_ASSERT_TYPE (scm_is_symbol (a), a, SCM_ARG1, __FUNCTION__, "symbol"); - SCM_ASSERT_TYPE (scm_is_string (b), b, SCM_ARG2, __FUNCTION__, "string"); - SCM_ASSERT_TYPE (ly_is_list (c), c, SCM_ARG3, __FUNCTION__, "list of syms"); + LY_ASSERT_TYPE (ly_is_symbol, a, 1); + LY_ASSERT_TYPE(scm_is_string,b, 2); + LY_ASSERT_TYPE(ly_is_list,c, 3); if (!all_ifaces) { SCM tab = scm_c_make_hash_table (59); diff --git a/lily/grob-pq-engraver.cc b/lily/grob-pq-engraver.cc index 476cae950c..7cb4afab87 100644 --- a/lily/grob-pq-engraver.cc +++ b/lily/grob-pq-engraver.cc @@ -47,7 +47,7 @@ Grob_pq_engraver::initialize () context ()->set_property ("busyGrobs", SCM_EOL); } -LY_DEFINE (ly_grob_pq_less_p, "ly:grob-pq-less?", +LY_DEFINE (ly_grob_pq_less_p, "ly:grob-pqget_property_data (sym); } @@ -31,8 +32,9 @@ LY_DEFINE (ly_grob_set_property_x, "ly:grob-set-property!", "Set @var{sym} in grob @var{grob} to value @var{val}") { Grob *sc = unsmob_grob (grob); - SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob"); - SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol"); + + LY_ASSERT_SMOB (Grob, grob, 1); + LY_ASSERT_TYPE (ly_is_symbol,sym, 2); if (!ly_is_procedure (val) && !type_check_assignment (sym, val, ly_symbol2scm ("backend-type?"))) @@ -50,8 +52,9 @@ LY_DEFINE (ly_grob_property, "ly:grob-property", "\n\n") { Grob *sc = unsmob_grob (grob); - SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob"); - SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol"); + + LY_ASSERT_SMOB (Grob, grob, 1); + LY_ASSERT_TYPE (ly_is_symbol,sym, 2); if (deflt == SCM_UNDEFINED) deflt = SCM_EOL; @@ -68,7 +71,8 @@ LY_DEFINE (ly_grob_interfaces, "ly:grob-interfaces", "Return the interfaces list of grob @var{grob}.") { Grob *sc = unsmob_grob (grob); - SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob"); + + LY_ASSERT_SMOB (Grob, grob, 1); return sc->interfaces (); } @@ -81,8 +85,9 @@ LY_DEFINE (ly_grob_object, "ly:grob-object", "\n\n") { Grob *sc = unsmob_grob (grob); - SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob"); - SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol"); + + LY_ASSERT_SMOB (Grob, grob, 1); + LY_ASSERT_TYPE (ly_is_symbol,sym, 2); return sc->internal_get_object (sym); } @@ -92,11 +97,12 @@ LY_DEFINE (ly_grob_object, "ly:grob-object", /* TODO: make difference between scaled and unscalead variable in calling (i.e different funcs.) */ LY_DEFINE (ly_grob_layout, "ly:grob-layout", - 1, 0, 0, (SCM g), - "Get @code{\\layout} definition from grob @var{g}.") + 1, 0, 0, (SCM grob), + "Get @code{\\layout} definition from grob @var{grob}.") { - Grob *sc = unsmob_grob (g); - SCM_ASSERT_TYPE (sc, g, SCM_ARG1, __FUNCTION__, "grob"); + Grob *sc = unsmob_grob (grob); + + LY_ASSERT_SMOB (Grob, grob, 1); return sc->layout ()->self_scm (); } @@ -108,7 +114,8 @@ LY_DEFINE (ly_grob_alist_chain, "ly:grob-alist-chain", "from the layout block is taken. ") { Grob *sc = unsmob_grob (grob); - SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob"); + + LY_ASSERT_SMOB (Grob, grob, 1); if (global == SCM_UNDEFINED) { @@ -120,7 +127,7 @@ LY_DEFINE (ly_grob_alist_chain, "ly:grob-alist-chain", return sc->get_property_alist_chain (global); } -LY_DEFINE (ly_get_extent, "ly:grob-extent", +LY_DEFINE (ly_grob_extent, "ly:grob-extent", 3, 0, 0, (SCM grob, SCM refp, SCM axis), "Get the extent in @var{axis} direction of @var{grob} relative to " "the grob @var{refp}") @@ -128,9 +135,10 @@ LY_DEFINE (ly_get_extent, "ly:grob-extent", Grob *sc = unsmob_grob (grob); Grob *ref = unsmob_grob (refp); - SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob"); - SCM_ASSERT_TYPE (ref, refp, SCM_ARG2, __FUNCTION__, "grob"); - SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis"); + + LY_ASSERT_SMOB (Grob, grob, 1); + LY_ASSERT_SMOB(Grob, refp, 2); + LY_ASSERT_TYPE(is_axis,axis, 3); Axis a = Axis (scm_to_int (axis)); @@ -151,9 +159,10 @@ LY_DEFINE (ly_grob_robust_relative_extent, "ly:grob-robust-relative-extent", Grob *sc = unsmob_grob (grob); Grob *ref = unsmob_grob (refp); - SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob"); - SCM_ASSERT_TYPE (ref, refp, SCM_ARG2, __FUNCTION__, "grob"); - SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis"); + + LY_ASSERT_SMOB (Grob, grob, 1); + LY_ASSERT_SMOB(Grob, refp, 2); + LY_ASSERT_TYPE(is_axis,axis, 3); Axis a = Axis (scm_to_int (axis)); @@ -174,9 +183,10 @@ LY_DEFINE (ly_grob_relative_coordinate, "ly:grob-relative-coordinate", Grob *sc = unsmob_grob (grob); Grob *ref = unsmob_grob (refp); - SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob"); - SCM_ASSERT_TYPE (ref, refp, SCM_ARG2, __FUNCTION__, "grob"); - SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis"); + + LY_ASSERT_SMOB (Grob, grob, 1); + LY_ASSERT_SMOB(Grob,refp, 2); + LY_ASSERT_TYPE(is_axis,axis, 3); Axis a = Axis (scm_to_int (axis)); @@ -197,8 +207,9 @@ LY_DEFINE (ly_grob_parent, "ly:grob-parent", "1 for the Y-axis.") { Grob *sc = unsmob_grob (grob); - SCM_ASSERT_TYPE (sc, grob, SCM_ARG1, __FUNCTION__, "grob"); - SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG2, __FUNCTION__, "axis"); + + LY_ASSERT_SMOB (Grob, grob, 1); + LY_ASSERT_TYPE(is_axis,axis, 2); Grob *par = sc->get_parent (Axis (scm_to_int (axis))); return par ? par->self_scm () : SCM_EOL; @@ -209,7 +220,8 @@ LY_DEFINE (ly_grob_properties, "ly:grob-properties", "Get the mutable proprerties of @var{grob}.") { Grob *g = unsmob_grob (grob); - SCM_ASSERT_TYPE (g, grob, SCM_ARG1, __FUNCTION__, "grob"); + + LY_ASSERT_SMOB (Grob, grob, 1); /* FIXME: uhg? copy/read only? */ return g->mutable_property_alist_; @@ -220,18 +232,20 @@ LY_DEFINE (ly_grob_basic_properties, "ly:grob-basic-properties", "Get the immutable properties of @var{grob}.") { Grob *g = unsmob_grob (grob); - SCM_ASSERT_TYPE (g, grob, SCM_ARG1, __FUNCTION__, "grob"); + + LY_ASSERT_SMOB (Grob, grob, 1); /* FIXME: uhg? copy/read only? */ return g->immutable_property_alist_; } LY_DEFINE (ly_grob_system, "ly:grob-system", - 1, 0, 0, (SCM g), - "Return the System Grob of @var{g}.") + 1, 0, 0, (SCM grob), + "Return the System Grob of @var{grob}.") { - Grob *me = unsmob_grob (g); - SCM_ASSERT_TYPE (me, g, SCM_ARG1, __FUNCTION__, "grob"); + Grob *me = unsmob_grob (grob); + + LY_ASSERT_SMOB (Grob, grob, 1); if (System *g = me->get_system ()) return g->self_scm (); @@ -244,30 +258,33 @@ LY_DEFINE (ly_grob_original, "ly:grob-original", "Return the unbroken original Grob of @var{grob}.") { Grob *me = unsmob_grob (grob); - SCM_ASSERT_TYPE (me, grob, SCM_ARG1, __FUNCTION__, "grob"); + + LY_ASSERT_SMOB (Grob, grob, 1); return me->original () ? me->original ()->self_scm () : me->self_scm (); } LY_DEFINE (ly_grob_suicide_x, "ly:grob-suicide!", - 1, 0, 0, (SCM g), - "Kill @var{g}.") + 1, 0, 0, (SCM grob), + "Kill @var{grob}.") { - Grob *me = unsmob_grob (g); - SCM_ASSERT_TYPE (me, g, SCM_ARG1, __FUNCTION__, "grob"); + Grob *me = unsmob_grob (grob); + + LY_ASSERT_SMOB (Grob, grob, 1); me->suicide (); return SCM_UNSPECIFIED; } LY_DEFINE (ly_grob_translate_axis_x, "ly:grob-translate-axis!", - 3, 0, 0, (SCM g, SCM d, SCM a), + 3, 0, 0, (SCM grob, SCM d, SCM a), "Translate @var{g} on axis @var{a} over distance @var{d}.") { - Grob *me = unsmob_grob (g); - SCM_ASSERT_TYPE (me, g, SCM_ARG1, __FUNCTION__, "grob"); - SCM_ASSERT_TYPE (scm_is_number (d), d, SCM_ARG2, __FUNCTION__, "dimension"); - SCM_ASSERT_TYPE (is_axis (a), a, SCM_ARG3, __FUNCTION__, "axis"); + Grob *me = unsmob_grob (grob); + + LY_ASSERT_SMOB (Grob, grob, 1); + LY_ASSERT_TYPE(scm_is_number,d, 2); + LY_ASSERT_TYPE(is_axis,a, 3); me->translate_axis (scm_to_double (d), Axis (scm_to_int (a))); return SCM_UNSPECIFIED; @@ -278,7 +295,8 @@ LY_DEFINE (ly_grob_default_font, "ly:grob-default-font", "Return the default font for grob @var{gr}.") { Grob *gr = unsmob_grob (grob); - SCM_ASSERT_TYPE (gr, grob, SCM_ARG1, __FUNCTION__, "grob"); + + LY_ASSERT_SMOB (Grob, grob, 1); return Font_interface::get_default_font (gr)->self_scm (); } @@ -296,12 +314,13 @@ LY_DEFINE (ly_grob_common_refpoint, "ly:grob-common-refpoint", { Grob *gr = unsmob_grob (grob); - SCM_ASSERT_TYPE (gr, grob, SCM_ARG1, __FUNCTION__, "grob"); + + LY_ASSERT_SMOB (Grob, grob, 1); + LY_ASSERT_SMOB(Grob,other, 2); Grob *o = unsmob_grob (other); - SCM_ASSERT_TYPE (o, other, SCM_ARG2, __FUNCTION__, "grob"); - SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis"); + LY_ASSERT_TYPE(is_axis,axis, 3); Grob *refp = gr->common_refpoint (o, Axis (scm_to_int (axis))); return refp ? refp->self_scm () : SCM_BOOL_F; @@ -314,11 +333,12 @@ LY_DEFINE (ly_grob_common_refpoint_of_array, "ly:grob-common-refpoint-of-array", ) { Grob *gr = unsmob_grob (grob); - SCM_ASSERT_TYPE (gr, grob, SCM_ARG1, __FUNCTION__, "grob"); + + LY_ASSERT_SMOB (Grob, grob, 1); + LY_ASSERT_SMOB(Grob_array,others, 2); Grob_array *ga = unsmob_grob_array (others); - SCM_ASSERT_TYPE (ga, others, SCM_ARG2, __FUNCTION__, "grob array"); - SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis"); + LY_ASSERT_TYPE(is_axis,axis, 3); Grob *refp = common_refpoint_of_array (ga->array (), gr, Axis (scm_to_int (axis))); return refp ? refp->self_scm () : SCM_BOOL_F; diff --git a/lily/grob.cc b/lily/grob.cc index d1318ba954..37d715bf07 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -394,7 +394,7 @@ Grob::extent (Grob *refp, Axis a) const (a == X_AXIS) ? ly_symbol2scm ("X-extent") : ly_symbol2scm ("Y-extent"); - + SCM ext = internal_get_property (ext_sym); if (is_number_pair (ext)) real_ext.unite (ly_scm2interval (ext)); diff --git a/lily/hara-kiri-group-spanner.cc b/lily/hara-kiri-group-spanner.cc index 81e2c7d971..73fe4d6775 100644 --- a/lily/hara-kiri-group-spanner.cc +++ b/lily/hara-kiri-group-spanner.cc @@ -24,6 +24,15 @@ Hara_kiri_group_spanner::y_extent (SCM smob) return Axis_group_interface::generic_group_extent (me, Y_AXIS); } +MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner, calc_skylines, 1); +SCM +Hara_kiri_group_spanner::calc_skylines (SCM smob) +{ + Grob *me = unsmob_grob (smob); + consider_suicide (me); + return Axis_group_interface::calc_skylines (smob); +} + MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner, pure_height, 3); SCM Hara_kiri_group_spanner::pure_height (SCM smob, SCM start_scm, SCM end_scm) diff --git a/lily/include/font-metric.hh b/lily/include/font-metric.hh index f77d394599..793c0e14a9 100644 --- a/lily/include/font-metric.hh +++ b/lily/include/font-metric.hh @@ -79,4 +79,6 @@ DECLARE_UNSMOB (Font_metric, metrics); Box lookup_tex_text_dimension (Font_metric *font, SCM text); +char *pfb2pfa (Byte const *pfb, int length); + #endif /* FONT_METRIC_HH */ diff --git a/lily/include/global-context.hh b/lily/include/global-context.hh index 540d96654b..2fcbfca298 100644 --- a/lily/include/global-context.hh +++ b/lily/include/global-context.hh @@ -44,5 +44,6 @@ protected: }; SCM ly_format_output (SCM); +Global_context *unsmob_global_context (SCM x); #endif // GLOBAL_CONTEXT_HH diff --git a/lily/include/hara-kiri-group-spanner.hh b/lily/include/hara-kiri-group-spanner.hh index 6505287a4d..7a5ddd6a7c 100644 --- a/lily/include/hara-kiri-group-spanner.hh +++ b/lily/include/hara-kiri-group-spanner.hh @@ -17,6 +17,7 @@ class Hara_kiri_group_spanner public: DECLARE_SCHEME_CALLBACK (force_hara_kiri_callback, (SCM)); DECLARE_SCHEME_CALLBACK (y_extent, (SCM smob)); + DECLARE_SCHEME_CALLBACK (calc_skylines, (SCM smob)); DECLARE_SCHEME_CALLBACK (pure_height, (SCM smob, SCM start, SCM end)); DECLARE_SCHEME_CALLBACK (force_hara_kiri_in_y_parent_callback, (SCM)); DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM)); diff --git a/lily/include/lily-guile-macros.hh b/lily/include/lily-guile-macros.hh index 555d65bfd3..6b0a60a2f0 100644 --- a/lily/include/lily-guile-macros.hh +++ b/lily/include/lily-guile-macros.hh @@ -1,5 +1,5 @@ /* - lily-guile-macros.hh -- declare + lily-guile-macros.hh -- declare GUILE interaction macros. source file of the GNU LilyPond music typesetter @@ -25,9 +25,6 @@ FIXME: should add check for x86 as well? */ #define CACHE_SYMBOLS - - - #ifdef CACHE_SYMBOLS /* this lets us "overload" macros such as get_property to take @@ -94,33 +91,57 @@ inline SCM ly_symbol2scm (char const *x) { return scm_str2symbol ((x)); } #define DECLARE_SCHEME_CALLBACK(NAME, ARGS) \ static SCM NAME ARGS; \ static SCM NAME ## _proc - +#define ADD_TYPE_PREDICATE(func, type_name) \ + void \ + func ## _type_adder () \ + {\ + ly_add_type_predicate ((Type_predicate_ptr)func, type_name); \ + }\ + ADD_SCM_INIT_FUNC(func ## _type_adder_ctor, \ + func ## _type_adder); +#define ADD_TYPE_PREDICATE(func, type_name) \ + void \ + func ## _type_adder () \ + {\ + ly_add_type_predicate ((Type_predicate_ptr)func, type_name); \ + }\ + ADD_SCM_INIT_FUNC(func ## _type_adder_ctor, \ + func ## _type_adder); + +string mangle_cxx_identifier (string); + +void ly_add_type_predicate (void *ptr, string name); +string predicate_to_typename (void *ptr); + /* Make TYPE::FUNC available as a Scheme function. */ -string mangle_cxx_identifier (string); -#define MAKE_SCHEME_CALLBACK_WITH_OPTARGS(TYPE, FUNC, ARGCOUNT, OPTIONAL_COUNT) \ +#define MAKE_SCHEME_CALLBACK_WITH_OPTARGS(TYPE, FUNC, ARGCOUNT, OPTIONAL_COUNT, DOC) \ SCM TYPE ::FUNC ## _proc; \ void \ TYPE ## _ ## FUNC ## _init_functions () \ { \ - string id = mangle_cxx_identifier (string (#TYPE) + "::" + string (#FUNC)); \ + string cxx = string (#TYPE) + "::" + string (#FUNC); \ + string id = mangle_cxx_identifier (cxx); \ TYPE ::FUNC ## _proc = scm_c_define_gsubr (id.c_str(), \ (ARGCOUNT-OPTIONAL_COUNT), OPTIONAL_COUNT, 0, \ (Scheme_function_unknown) TYPE::FUNC); \ + ly_add_function_documentation (TYPE :: FUNC ## _proc, id.c_str(), "", \ + DOC); \ scm_c_export (id.c_str (), NULL); \ } \ \ ADD_SCM_INIT_FUNC (TYPE ## _ ## FUNC ## _callback, \ TYPE ## _ ## FUNC ## _init_functions); +#define MAKE_DOCUMENTED_SCHEME_CALLBACK(TYPE, FUNC, ARGCOUNT, DOC) \ + MAKE_SCHEME_CALLBACK_WITH_OPTARGS(TYPE, FUNC, ARGCOUNT, 0, DOC); + #define MAKE_SCHEME_CALLBACK(TYPE, FUNC, ARGCOUNT) \ - MAKE_SCHEME_CALLBACK_WITH_OPTARGS(TYPE,FUNC,ARGCOUNT,0); + MAKE_SCHEME_CALLBACK_WITH_OPTARGS(TYPE,FUNC,ARGCOUNT, 0, ""); -void -ly_add_function_documentation (SCM proc, char const *fname, - char const *varlist, - char const *doc); +void ly_add_function_documentation (SCM proc, string fname, string varlist, string doc); +void ly_check_name (string cxx, string fname); #define ADD_SCM_INIT_FUNC(name, func) \ class name ## _scm_initter \ @@ -143,6 +164,7 @@ ly_add_function_documentation (SCM proc, char const *fname, { \ FNAME ## _proc = scm_c_define_gsubr (PRIMNAME, REQ, OPT, VAR, \ (Scheme_function_unknown) FNAME); \ + ly_check_name (#FNAME, PRIMNAME);\ ly_add_function_documentation (FNAME ## _proc, PRIMNAME, #ARGLIST, \ DOCSTRING); \ scm_c_export (PRIMNAME, NULL); \ @@ -178,4 +200,20 @@ ly_add_function_documentation (SCM proc, char const *fname, #define set_property(x, y) internal_set_property (ly_symbol2scm (x), y) #endif + + +#define LY_ASSERT_TYPE(pred, var, number) \ + { \ + if (!pred (var)) \ + { \ + scm_wrong_type_arg_msg(mangle_cxx_identifier (__FUNCTION__).c_str(), \ + number, var, \ + predicate_to_typename ((void*) &pred).c_str()); \ + } \ + } + +#define LY_ASSERT_SMOB(klass, var, number) LY_ASSERT_TYPE(klass::unsmob, var, number) + + + #endif /* LILY_GUILE_MACROS_HH */ diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index 6f21a29b03..7349050810 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -88,6 +88,12 @@ inline bool ly_is_list (SCM x) { return SCM_NFALSEP (scm_list_p (x)); } inline bool ly_is_procedure (SCM x) { return SCM_NFALSEP (scm_procedure_p (x)); } inline bool ly_is_port (SCM x) { return SCM_NFALSEP (scm_port_p (x)); } +/* + want to take the address of this function; scm_is_symbol() is a + macro. + */ +inline bool ly_is_symbol (SCM x) { return scm_is_symbol (x); } + inline bool ly_is_equal (SCM x, SCM y) { return SCM_NFALSEP (scm_equal_p (x, y)); diff --git a/lily/include/line-spanner.hh b/lily/include/line-spanner.hh deleted file mode 100644 index ceff6f6a99..0000000000 --- a/lily/include/line-spanner.hh +++ /dev/null @@ -1,28 +0,0 @@ -/* - line-spanner.hh -- declare Line_spanner - - source file of the GNU LilyPond music typesetter - - (c) 2000--2007 Jan Nieuwenhuizen -*/ - -#ifndef LINE_SPANNER_HH -#define LINE_SPANNER_HH - -#include "lily-proto.hh" -#include "grob-interface.hh" - -class Line_spanner -{ -public: - DECLARE_SCHEME_CALLBACK (print, (SCM)); - DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM)); - static Stencil line_stencil (Grob *me, Offset f, Offset t); - DECLARE_GROB_INTERFACE(); - -private: - static Offset get_broken_offset (Grob *me, Direction dir); - static Offset broken_trend_offset (Grob *me, Direction dir); -}; - -#endif /* LINE_SPANNER_HH */ diff --git a/lily/include/ly-module.hh b/lily/include/ly-module.hh index 17595408a7..abb4b20040 100644 --- a/lily/include/ly-module.hh +++ b/lily/include/ly-module.hh @@ -12,7 +12,7 @@ SCM ly_make_anonymous_module (bool safe); SCM ly_module_copy (SCM dest, SCM src); -SCM ly_module2alist (SCM mod); +SCM ly_module_2_alist (SCM mod); SCM ly_module_lookup (SCM module, SCM sym); SCM ly_modules_lookup (SCM modules, SCM sym, SCM); SCM ly_module_symbols (SCM mod); diff --git a/lily/include/ly-smobs.icc b/lily/include/ly-smobs.icc index a77da17fc8..af8035644c 100644 --- a/lily/include/ly-smobs.icc +++ b/lily/include/ly-smobs.icc @@ -25,6 +25,14 @@ ADD_SCM_INIT_FUNC (init_type_ ## CL, init_type_ ## CL) #define IMPLEMENT_BASE_SMOBS(CL) \ + void \ + CL ## _type_adder () \ + {\ + ly_add_type_predicate ((void*) &CL::unsmob, #CL); \ + }\ + ADD_SCM_INIT_FUNC(CL ## _type_adder_ctor, \ + CL ## _type_adder);\ + const char *CL::smob_name_ = #CL; \ scm_t_bits CL::smob_tag_; \ SCM \ CL::smob_p (SCM s) \ diff --git a/lily/include/music-output.hh b/lily/include/music-output.hh index c7c3b82bd5..eafb6ec8d0 100644 --- a/lily/include/music-output.hh +++ b/lily/include/music-output.hh @@ -28,5 +28,6 @@ public: }; DECLARE_UNSMOB (Music_output, music_output); - +Paper_score *unsmob_paper_score (SCM); +Performance *unsmob_performance (SCM); #endif /* MUSIC_OUTPUT_HH */ diff --git a/lily/include/music.hh b/lily/include/music.hh index ec6f98766c..4ed048fda0 100644 --- a/lily/include/music.hh +++ b/lily/include/music.hh @@ -61,7 +61,7 @@ protected: Music *unsmob_music (SCM); Music *make_music_by_name (SCM sym); SCM ly_music_deep_copy (SCM); -SCM ly_camel_case_to_lisp_identifier (SCM name_sym); +SCM ly_camel_case_2_lisp_identifier (SCM name_sym); extern SCM ly_music_p_proc; diff --git a/lily/include/smobs.hh b/lily/include/smobs.hh index 5bd403bce4..9971b19da5 100644 --- a/lily/include/smobs.hh +++ b/lily/include/smobs.hh @@ -96,13 +96,14 @@ #define DECLARE_BASE_SMOBS(CL) \ friend class Non_existent_class; \ private: \ + static const char* smob_name_; \ static scm_t_bits smob_tag_; \ static SCM mark_smob (SCM); \ static size_t free_smob (SCM s); \ static int print_smob (SCM s, SCM p, scm_print_state*); \ public: \ static SCM equal_p (SCM a, SCM b); \ - static CL *unsmob (SCM s) \ + static CL *unsmob (SCM s) __attribute__((pure)) \ { \ if (SCM_NIMP (s) && SCM_CELL_TYPE (s) == smob_tag_) \ return (CL *) SCM_CELL_WORD_1 (s); \ diff --git a/lily/include/text-spanner.hh b/lily/include/text-spanner.hh deleted file mode 100644 index 3af69d6344..0000000000 --- a/lily/include/text-spanner.hh +++ /dev/null @@ -1,22 +0,0 @@ -/* - text-spanner.hh -- declare Text_spanner - - source file of the GNU LilyPond music typesetter - - (c) 2000--2007 Jan Nieuwenhuizen -*/ - -#ifndef TEXT_SPANNER_HH -#define TEXT_SPANNER_HH - -#include "grob-interface.hh" -#include "lily-proto.hh" - -class Text_spanner -{ -public: - DECLARE_SCHEME_CALLBACK (print, (SCM)); - DECLARE_GROB_INTERFACE(); -}; - -#endif /* TEXT_SPANNER_HH */ diff --git a/lily/input-scheme.cc b/lily/input-scheme.cc index 2ff7bf5007..e3d0312642 100644 --- a/lily/input-scheme.cc +++ b/lily/input-scheme.cc @@ -11,7 +11,7 @@ /* We don't use IMPLEMENT_TYPE_P, since the smobification part is implemented separately from the class. */ -LY_DEFINE (ly_input, "ly:input-location?", 1, 0, 0, +LY_DEFINE (ly_input_location_p, "ly:input-location?", 1, 0, 0, (SCM x), "Is @var{x} an @code{input-location}?") { @@ -23,8 +23,9 @@ LY_DEFINE (ly_input_message, "ly:input-message", 2, 0, 1, (SCM sip, SCM msg, SCM "location in @var{sip}. @var{msg} is interpreted similar to @code{format}'s argument\n") { Input *ip = unsmob_input (sip); - SCM_ASSERT_TYPE (ip, sip, SCM_ARG1, __FUNCTION__, "input location"); - SCM_ASSERT_TYPE (scm_is_string (msg), msg, SCM_ARG2, __FUNCTION__, "string"); + + LY_ASSERT_TYPE (unsmob_input, sip, 1); + LY_ASSERT_TYPE(scm_is_string, msg,2); msg = scm_simple_format (SCM_BOOL_F, msg, rest); @@ -35,13 +36,13 @@ LY_DEFINE (ly_input_message, "ly:input-message", 2, 0, 1, (SCM sip, SCM msg, SCM } -LY_DEFINE (ly_input_file_line_column, +LY_DEFINE (ly_input_file_line_char_column, "ly:input-file-line-char-column", 1, 0, 0, (SCM sip), "Return input location in @var{sip} as (file-name line char column).") { + LY_ASSERT_TYPE (unsmob_input, sip, 1); Input *ip = unsmob_input (sip); - SCM_ASSERT_TYPE (ip, sip, SCM_ARG1, __FUNCTION__, "input location"); int l = 0; int ch = 0; @@ -59,8 +60,10 @@ LY_DEFINE (ly_input_both_locations, "Return input location in @var{sip} as " "(file-name first-line first-column last-line last-column).") { + + LY_ASSERT_TYPE (unsmob_input, sip, 1); Input *ip = unsmob_input (sip); - SCM_ASSERT_TYPE (ip, sip, SCM_ARG1, __FUNCTION__, "input location"); + return scm_list_5 (ly_string2scm (ip->file_string ()), scm_from_int (ip->line_number ()), scm_from_int (ip->column_number ()), diff --git a/lily/item-scheme.cc b/lily/item-scheme.cc index 0ebbc2832d..426d9532a6 100644 --- a/lily/item-scheme.cc +++ b/lily/item-scheme.cc @@ -24,7 +24,7 @@ LY_DEFINE (ly_item_break_dir, "ly:item-break-dir", "The break status dir of item @var{it}. @code{-1} is end of " "line, @code{0} unbroken, and @code{1} begin of line.") { - Item *me = dynamic_cast (unsmob_grob (it)); - SCM_ASSERT_TYPE (me, it, SCM_ARG1, __FUNCTION__, "Item"); + LY_ASSERT_TYPE (unsmob_item, it, 1); + Item *me = unsmob_item (it); return scm_from_int (me->break_status_dir ()); } diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 976b19e47c..370dba2998 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -126,7 +126,7 @@ ly_string2scm (string const &str) char * ly_scm2newstr (SCM str, size_t *lenp) { - SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "string"); + LY_ASSERT_TYPE (scm_is_string, str, 1); size_t len = scm_i_string_length (str); if (char *new_str = (char *) malloc ((len + 1) * sizeof (char))) @@ -630,11 +630,16 @@ mangle_cxx_identifier (string cxx_id) cxx_id = "ly:" + cxx_id; } if (cxx_id.substr (cxx_id.length () - 2) == "_p") - cxx_id = cxx_id.replace (cxx_id.length () - 2, 1, "?"); + cxx_id = cxx_id.replace (cxx_id.length () - 2, 2, "?"); else if (cxx_id.substr (cxx_id.length () - 2) == "_x") - cxx_id = cxx_id.replace (cxx_id.length () - 2, 1, "!"); + cxx_id = cxx_id.replace (cxx_id.length () - 2, 2, "!"); + cxx_id = replace_all (cxx_id, "_less?", ""); + cxx_id = replace_all (cxx_id, "__", "::"); cxx_id = replace_all (cxx_id, '_', '-'); + + return cxx_id; } diff --git a/lily/lily-lexer-scheme.cc b/lily/lily-lexer-scheme.cc index 4bf001ea0a..a0501e9eab 100644 --- a/lily/lily-lexer-scheme.cc +++ b/lily/lily-lexer-scheme.cc @@ -13,7 +13,8 @@ LY_DEFINE(ly_lexer_keywords, "ly:lexer-keywords", 1, 0, 0, (SCM lexer), "Return a list of (KEY . CODE) pairs, signifying the lilypond reserved words list.") { + LY_ASSERT_SMOB (Lily_lexer, lexer, 1); + Lily_lexer * lex = Lily_lexer::unsmob (lexer); - SCM_ASSERT_TYPE(lex, lexer, SCM_ARG1, __FUNCTION__, "lily lexer"); return lex->keyword_list (); } diff --git a/lily/lily-parser-scheme.cc b/lily/lily-parser-scheme.cc index ca1d224bd6..4e22461638 100644 --- a/lily/lily-parser-scheme.cc +++ b/lily/lily-parser-scheme.cc @@ -36,7 +36,7 @@ LY_DEFINE (ly_parse_file, "ly:parse-file", "Parse a single @code{.ly} file. " "Upon failure, throw @code{ly-file-failed} key.") { - SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG1, __FUNCTION__, "string"); + LY_ASSERT_TYPE (scm_is_string, name, 1); string file = ly_scm2string (name); char const *extensions[] = {"ly", "", 0}; @@ -138,7 +138,7 @@ LY_DEFINE (ly_parse_file, "ly:parse-file", /* outside the if-else to ensure cleanup fo Sources object, - */ + */ if (error) /* TODO: pass renamed input file too. */ scm_throw (ly_symbol2scm ("ly-file-failed"), @@ -160,20 +160,23 @@ LY_DEFINE (ly_parser_clone, "ly:parser-clone", 1, 0, 0, (SCM parser_smob), "Return a clone of @var{parser-smob}.") { + LY_ASSERT_SMOB (Lily_parser, parser_smob, 1); Lily_parser *parser = unsmob_lily_parser (parser_smob); Lily_parser *clone = new Lily_parser (*parser); return clone->unprotect (); } -LY_DEFINE (ly_parser_define, "ly:parser-define!", +LY_DEFINE (ly_parser_define_x, "ly:parser-define!", 3, 0, 0, (SCM parser_smob, SCM symbol, SCM val), "Bind @var{symbol} to @var{val} in @var{parser-smob}'s module.") { + + LY_ASSERT_SMOB (Lily_parser, parser_smob, 1); Lily_parser *parser = unsmob_lily_parser (parser_smob); - SCM_ASSERT_TYPE (scm_is_symbol (symbol), symbol, SCM_ARG2, __FUNCTION__, "symbol"); - SCM_ASSERT_TYPE (parser, parser_smob, SCM_ARG2, __FUNCTION__, "parser"); + LY_ASSERT_TYPE (ly_is_symbol,symbol, 2); + parser->lexer_->set_identifier (scm_symbol_to_string (symbol), val); return SCM_UNSPECIFIED; } @@ -183,10 +186,11 @@ LY_DEFINE (ly_parser_lookup, "ly:parser-lookup", "Lookup @var{symbol} in @var{parser-smob}'s module. " "Undefined is '().") { - Lily_parser *parser = unsmob_lily_parser (parser_smob); + LY_ASSERT_SMOB (Lily_parser, parser_smob, 1); - SCM_ASSERT_TYPE (scm_is_symbol (symbol), symbol, SCM_ARG2, __FUNCTION__, "symbol"); - SCM_ASSERT_TYPE (parser, parser_smob, SCM_ARG2, __FUNCTION__, "parser"); + Lily_parser *parser = unsmob_lily_parser (parser_smob); + + LY_ASSERT_TYPE (ly_is_symbol,symbol, 2); SCM val = parser->lexer_->lookup_identifier (ly_scm2string (scm_symbol_to_string (symbol))); if (val != SCM_UNDEFINED) @@ -200,10 +204,9 @@ LY_DEFINE (ly_parser_parse_string, "ly:parser-parse-string", "Parse the string @code{ly-code} with @code{parser-smob}." "Upon failure, throw @code{ly-file-failed} key.") { - Lily_parser *parser = unsmob_lily_parser (parser_smob); - - SCM_ASSERT_TYPE (parser, parser_smob, SCM_ARG1, __FUNCTION__, "parser"); - SCM_ASSERT_TYPE (scm_is_string (ly_code), ly_code, SCM_ARG2, __FUNCTION__, "string"); + LY_ASSERT_SMOB (Lily_parser, parser_smob, 1); + Lily_parser *parser = unsmob_lily_parser (parser_smob); + LY_ASSERT_TYPE(scm_is_string,ly_code, 2); parser->parse_string (ly_scm2string (ly_code)); @@ -216,8 +219,8 @@ LY_DEFINE (ly_parser_set_note_names, "ly:parser-set-note-names", "@var{names} is an alist of symbols. " "This only has effect if the current mode is notes.") { + LY_ASSERT_SMOB (Lily_parser, parser, 1); Lily_parser *p = unsmob_lily_parser (parser); - SCM_ASSERT_TYPE (p, parser, SCM_ARG1, __FUNCTION__, "Lilypond parser"); if (p->lexer_->is_note_state ()) { @@ -232,8 +235,8 @@ LY_DEFINE (ly_parser_output_name, "ly:parser-output-name", 1, 0, 0, (SCM parser), "Return the base name of the output file.") { + LY_ASSERT_SMOB (Lily_parser, parser, 1); Lily_parser *p = unsmob_lily_parser (parser); - SCM_ASSERT_TYPE (p, parser, SCM_ARG1, __FUNCTION__, "Lilypond parser"); return ly_string2scm (p->output_basename_); } @@ -242,9 +245,10 @@ LY_DEFINE (ly_parser_error, "ly:parser-error", 2, 1, 0, (SCM parser, SCM msg, SCM input), "Display an error message, and make the parser fail") { + LY_ASSERT_SMOB (Lily_parser, parser, 1); Lily_parser *p = unsmob_lily_parser (parser); - SCM_ASSERT_TYPE (p, parser, SCM_ARG1, __FUNCTION__, "Lilypond parser"); - SCM_ASSERT_TYPE (scm_is_string (msg), msg, SCM_ARG2, __FUNCTION__, "string"); + + LY_ASSERT_TYPE(scm_is_string,msg, 2); string s = ly_scm2string (msg); Input *i = unsmob_input (input); @@ -260,8 +264,9 @@ LY_DEFINE (ly_parser_clear_error, "ly:parser-clear-error", 1, 0, 0, (SCM parser), "Clear the error flag for the parser.") { + LY_ASSERT_SMOB (Lily_parser, parser, 1); Lily_parser *p = unsmob_lily_parser (parser); - SCM_ASSERT_TYPE (p, parser, SCM_ARG1, __FUNCTION__, "Lilypond parser"); + p->error_level_ = 0; p->lexer_->error_level_ = 0; @@ -273,8 +278,8 @@ LY_DEFINE (ly_parser_has_error_p, "ly:parser-has-error?", 1, 0, 0, (SCM parser), "Does @var{parser} have an error flag?") { + LY_ASSERT_SMOB (Lily_parser, parser, 1); Lily_parser *p = unsmob_lily_parser (parser); - SCM_ASSERT_TYPE (p, parser, SCM_ARG1, __FUNCTION__, "Lilypond parser"); return scm_from_bool (p->error_level_ || p->lexer_->error_level_); } diff --git a/lily/line-interface.cc b/lily/line-interface.cc index 8c54fa7ed1..b9155a07ab 100644 --- a/lily/line-interface.cc +++ b/lily/line-interface.cc @@ -48,7 +48,7 @@ Line_interface::make_trill_line (Grob *me, alist_chain)); Stencil elt = fm->find_by_name ("scripts.trill_element"); - + elt.align_to (Y_AXIS, CENTER); Real elt_len = elt.extent (X_AXIS).length (); if (elt_len <= 0.0) { @@ -65,7 +65,7 @@ Line_interface::make_trill_line (Grob *me, } while (len + elt_len < dz.length ()); - line.rotate (dz.arg (), Offset (0,0)); + line.rotate (dz.arg (), Offset (LEFT, CENTER)); line.translate (from); return line; @@ -225,9 +225,20 @@ Line_interface::line (Grob *me, Offset from, Offset to) Real period = Staff_symbol_referencer::staff_space (me) * robust_scm2double (me->get_property ("dash-period"), 1.0); - if (period < 0) + if (period <= 0) return Stencil (); + Real len = (to-from).length(); + + int n = (int) rint ((len - period * fraction) / period); + if (n > 0) + { + /* + TODO: figure out something intelligent for really short + sections. + */ + period = ((to-from).length() - period * fraction) / n; + } stil = make_dashed_line (thick, from, to, period, fraction); } else diff --git a/lily/line-spanner.cc b/lily/line-spanner.cc index 7a8870aee5..5bbc1eeaf2 100644 --- a/lily/line-spanner.cc +++ b/lily/line-spanner.cc @@ -6,70 +6,34 @@ (c) 2000--2007 Jan Nieuwenhuizen */ -#include "line-spanner.hh" - - #include "spanner.hh" #include "output-def.hh" -#include "paper-column.hh" +#include "item.hh" #include "staff-symbol-referencer.hh" #include "font-interface.hh" #include "warn.hh" #include "align-interface.hh" -#include "lookup.hh" #include "line-interface.hh" +#include "moment.hh" -MAKE_SCHEME_CALLBACK (Line_spanner, after_line_breaking, 1); -SCM -Line_spanner::after_line_breaking (SCM g) -{ - Grob *me = unsmob_grob (g); - Spanner *sp = dynamic_cast (me); - - /* - We remove the line at the start of the line. For piano voice - indicators, it makes no sense to have them at the start of the - line. - - I'm not sure what the official rules for glissandi are, but - usually the 2nd note of the glissando is "exact", so when playing - from the start of the line, there is no need to glide. - - From a typographical p.o.v. this makes sense, since the amount of - space left of a note at the start of a line is very small. +#include "lily-proto.hh" +#include "grob-interface.hh" +#include "text-interface.hh" - --hwn. - - */ - if (sp->get_bound (LEFT)->break_status_dir () - && !sp->get_bound (RIGHT)->break_status_dir ()) - { - /* - Can't do suicide, since this mucks up finding the trend. - */ - me->set_property ("transparent", SCM_BOOL_T); - } - return SCM_EOL; -} - -Stencil -Line_spanner::line_stencil (Grob *me, - Offset from, - Offset to) +class Line_spanner { - Stencil line = Line_interface::line (me, from, to); - - if (to_boolean (me->get_property ("arrow"))) - line.add_stencil (Line_interface::arrows (me, from, to, false, true)); - - return line; -} - -/* - Find a common Y parent, which --if found-- should be the - fixed-distance alignment. -*/ -Grob * +public: + DECLARE_SCHEME_CALLBACK (print, (SCM)); + DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_left_bound_info, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_left_bound_info_and_text, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_right_bound_info, (SCM)); + DECLARE_SCHEME_CALLBACK (calc_bound_info, (SCM, Direction)); + DECLARE_GROB_INTERFACE(); +}; + + +static Grob * line_spanner_common_parent (Grob *me) { Grob *common = find_fixed_alignment_parent (me); @@ -85,129 +49,271 @@ line_spanner_common_parent (Grob *me) return common; } -/* - Warning: this thing is a cross-staff object, so it should have empty Y-dimensions. - - (If not, you risk that this is called from the staff-alignment - routine, via stencil_extent. At this point, the staves aren't - separated yet, so it doesn't work cross-staff. - - (huh? crossable staves have fixed distance? --hwn) -*/ - -MAKE_SCHEME_CALLBACK (Line_spanner, print, 1); SCM -Line_spanner::print (SCM smob) +Line_spanner::calc_bound_info (SCM smob, Direction dir) { - Spanner *me = dynamic_cast (unsmob_grob (smob)); + Spanner *me = unsmob_spanner (smob); - Drul_array bound (me->get_bound (LEFT), - me->get_bound (RIGHT)); + Grob *commonx = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT), X_AXIS); + commonx = me->common_refpoint (commonx, X_AXIS); - Real gap = robust_scm2double (me->get_property ("gap"), 0.0); + SCM bound_details = me->get_property ("bound-details"); - Offset ofxy (gap, 0); /* offset from start point to start of line */ - Offset dxy; - Offset my_off; - Offset his_off; + SCM details = SCM_BOOL_F; + if (details == SCM_BOOL_F) + details = ly_assoc_get ((dir == LEFT) + ? ly_symbol2scm ("left") + : ly_symbol2scm ("right"), bound_details, SCM_BOOL_F); - Real extra_dy = robust_scm2double (me->get_property ("extra-dy"), - 0.0); - - if (bound[RIGHT]->break_status_dir ()) + if (me->get_bound (dir)->break_status_dir ()) { - if (bound[LEFT]->break_status_dir ()) - { - programming_error ("line-spanner with two broken ends. Farewell sweet world."); + SCM extra = ly_assoc_get ((dir == LEFT) + ? ly_symbol2scm ("left-broken") + : ly_symbol2scm ("right-broken"), bound_details, SCM_EOL); - me->suicide (); - return SCM_EOL; - } + for (SCM s = extra; scm_is_pair (s); s = scm_cdr (s)) + details = scm_cons (scm_car (s), details); + } + + if (details == SCM_BOOL_F) + details = ly_assoc_get (ly_symbol2scm ("default"), bound_details, SCM_EOL); - /* - This is hairy. For the normal case, we simply find common - parents, and draw a line between the bounds. When two note - heads are on different systems, there is no common parent - anymore. We have to find the piano-staff object. - */ + SCM text = ly_assoc_get (ly_symbol2scm ("text"), details, SCM_BOOL_F); + if (Text_interface::is_markup (text)) + { + Output_def *layout = me->layout (); + SCM properties = Font_interface::text_font_alist_chain (me); + details = scm_acons (ly_symbol2scm ("stencil"), + Text_interface::interpret_markup (layout->self_scm (), + properties, text), + details); + } + + if (!scm_is_number (ly_assoc_get (ly_symbol2scm ("X"), details, SCM_BOOL_F))) + { + Direction attach = (Direction) + robust_scm2int (ly_assoc_get (ly_symbol2scm ("attach-dir"), + details, SCM_BOOL_F), + CENTER); + + details = scm_acons (ly_symbol2scm ("X"), + scm_from_double (me->get_bound (dir)->extent (commonx, X_AXIS) + .linear_combination (attach)), + details); + } + - Spanner *next_sp = me->broken_neighbor (RIGHT); - Item *next_bound = next_sp->get_bound (RIGHT); + if (!scm_is_number (ly_assoc_get (ly_symbol2scm ("Y"), details, SCM_BOOL_F))) + { + Real y = 0.0; - if (next_bound->break_status_dir ()) + Real extra_dy = robust_scm2double (me->get_property ("extra-dy"), + 0.0); + + if (me->get_bound (dir)->break_status_dir ()) + { + /* + This is hairy. For the normal case, we simply find common + parents, and draw a line between the bounds. When two note + heads are on different systems, there is no common parent + anymore. We have to find the piano-staff object. + */ + + Spanner *next_sp = me->broken_neighbor (dir); + Item *next_bound = next_sp->get_bound (dir); + + if (next_bound->break_status_dir ()) + { + programming_error ("no note heads for the line spanner on neighbor line?" + " Confused."); + me->suicide (); + return SCM_EOL; + } + + Grob *next_common_y = line_spanner_common_parent (next_bound); + Interval next_ext = next_bound->extent (next_common_y, Y_AXIS); + + y = next_ext.center (); + } + else { - programming_error ("no note heads for the line spanner on next line?" - " Confused."); - me->suicide (); - return SCM_EOL; + Grob *commony = me->common_refpoint (me->get_bound (dir), Y_AXIS); + y = me->get_bound (dir)->extent (commony, Y_AXIS).center(); + details = scm_acons (ly_symbol2scm ("common-Y"), commony->self_scm (), details); } - Grob *commonx = bound[LEFT]->common_refpoint (bound[RIGHT], X_AXIS); - commonx = me->common_refpoint (commonx, X_AXIS); + y += dir * extra_dy / 2; + details = scm_acons (ly_symbol2scm ("Y"), scm_from_double (y), details); + } - Grob *next_common_y = line_spanner_common_parent (next_bound); - Grob *this_common_y = line_spanner_common_parent (bound[LEFT]); + return details; +} - Grob *all_common_y = me->common_refpoint (this_common_y, Y_AXIS); +MAKE_SCHEME_CALLBACK (Line_spanner, calc_right_bound_info, 1); +SCM +Line_spanner::calc_right_bound_info (SCM smob) +{ + return Line_spanner::calc_bound_info (smob, RIGHT); +} - Interval next_ext = next_bound->extent (next_common_y, Y_AXIS); - Interval this_ext = bound[LEFT]->extent (this_common_y, Y_AXIS); +MAKE_SCHEME_CALLBACK (Line_spanner, calc_left_bound_info, 1); +SCM +Line_spanner::calc_left_bound_info (SCM smob) +{ + return Line_spanner::calc_bound_info (smob, LEFT); +} - Real yoff = this_common_y->relative_coordinate (all_common_y, Y_AXIS); +MAKE_SCHEME_CALLBACK (Line_spanner, calc_left_bound_info_and_text, 1); +SCM +Line_spanner::calc_left_bound_info_and_text (SCM smob) +{ + SCM alist = Line_spanner::calc_bound_info (smob, LEFT); + Spanner *me = unsmob_spanner (smob); - Offset p1 (bound[LEFT]->extent (commonx, X_AXIS)[RIGHT], - this_ext.center () + yoff - extra_dy / 2); - Offset p2 (bound[RIGHT]->extent (commonx, X_AXIS)[LEFT], - next_ext.center () + yoff + extra_dy / 2); + SCM text = me->get_property ("text"); + if (Text_interface::is_markup (text) + && me->get_bound (LEFT)->break_status_dir () == CENTER + && ly_assoc_get (ly_symbol2scm ("stencil"), alist, SCM_BOOL_F) == SCM_BOOL_F) + { + Output_def *layout = me->layout (); + SCM properties = Font_interface::text_font_alist_chain (me); + alist = scm_acons (ly_symbol2scm ("stencil"), + Text_interface::interpret_markup (layout->self_scm (), + properties, text), + alist); + } + + return alist; +} - Offset dz (p2 - p1); - Real len = dz.length (); +MAKE_SCHEME_CALLBACK (Line_spanner, print, 1); +SCM +Line_spanner::print (SCM smob) +{ + Spanner *me = dynamic_cast (unsmob_grob (smob)); - Offset dir = dz * (1 / len); - dz = (dz.length () - 2 * gap) * dir; + Interval_t moments = me->spanned_time (); + /* + We remove the line at the start of the line. For piano voice + indicators, it makes no sense to have them at the start of the + line. - Stencil l (line_stencil (me, Offset (0, 0), dz)); + I'm not sure what the official rules for glissandi are, but + usually the 2nd note of the glissando is "exact", so when playing + from the start of the line, there is no need to glide. - l.translate (dir * gap + p1 - - Offset (me->relative_coordinate (commonx, X_AXIS), - me->relative_coordinate (all_common_y, Y_AXIS))); + From a typographical p.o.v. this makes sense, since the amount of + space left of a note at the start of a line is very small. + + --hwn. + + */ + if (moments.length () == Moment (0,0)) + return SCM_EOL; + + Drul_array bounds (me->get_property ("left-bound-info"), + me->get_property ("right-bound-info")); - return l.smobbed_copy (); + + Grob *commonx = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT), X_AXIS); + commonx = me->common_refpoint (commonx, X_AXIS); + + Drul_array span_points; + + Direction d = LEFT; + do + { + Offset z (robust_scm2double (ly_assoc_get (ly_symbol2scm ("X"), + bounds[d], SCM_BOOL_F), 0.0) + + commonx->relative_coordinate (commonx, X_AXIS), + robust_scm2double (ly_assoc_get (ly_symbol2scm ("Y"), + bounds[d], SCM_BOOL_F), 0.0)); + + span_points[d] = z; } - else + while (flip (&d) != LEFT); + + Drul_array gaps (0, 0); + Drul_array arrows (0, 0); + Drul_array stencils (0,0); + Drul_array common_y (0, 0); + do { - Grob *common[] = { me, me }; - for (int a = X_AXIS; a < NO_AXES; a++) - { - common[a] = me->common_refpoint (bound[RIGHT], Axis (a)); - common[a] = common[a]->common_refpoint (bound[LEFT], Axis (a)); - } + gaps[d] = robust_scm2double (ly_assoc_get (ly_symbol2scm ("padding"), + bounds[d], SCM_BOOL_F), 0.0); + arrows[d] = to_boolean (ly_assoc_get (ly_symbol2scm ("arrow"), + bounds[d], SCM_BOOL_F)); + stencils[d] = unsmob_stencil (ly_assoc_get (ly_symbol2scm ("stencil"), + bounds[d], SCM_BOOL_F)); + common_y[d] = unsmob_grob (ly_assoc_get (ly_symbol2scm ("common-Y"), + bounds[d], SCM_BOOL_F)); + if (!common_y[d]) + common_y[d] = me; + } + while (flip (&d) != LEFT); - // distance from center to start of line - Real off = gap + ((bound[LEFT]->extent (bound[LEFT], X_AXIS).length () * 3) / 4); + Grob *my_common_y = common_y[LEFT]->common_refpoint (common_y[RIGHT], Y_AXIS); + do + span_points[d][Y_AXIS] += common_y[d]->relative_coordinate (my_common_y, Y_AXIS); + while (flip (&d) != LEFT); - for (int a = X_AXIS; a < NO_AXES; a++) - { - Axis ax = (Axis)a; - dxy[ax] - = + robust_relative_extent (bound[RIGHT], common[X_AXIS], ax).center () - - robust_relative_extent (bound[LEFT], common[X_AXIS], ax).center (); + Offset dz = (span_points[RIGHT] - span_points[LEFT]); + Offset dz_dir = dz.direction (); + if (gaps[LEFT] + gaps[RIGHT] > dz.length ()) + { + return SCM_EOL; + } - my_off[ax] = me->relative_coordinate (common[a], ax); - his_off[ax] = bound[LEFT]->relative_coordinate (common[a], ax); + Stencil line; + do + { + if (stencils[d]) + { + Stencil s = stencils[d]->translated (span_points[d]); + SCM align = ly_assoc_get (ly_symbol2scm ("stencil-align-dir-y"), + bounds[d], SCM_BOOL_F); + SCM off = ly_assoc_get (ly_symbol2scm ("stencil-offset"), + bounds[d], SCM_BOOL_F); + + if (scm_is_number (align)) + s.align_to (Y_AXIS, scm_to_double (align)); + + /* + todo: should use font-size. + */ + if (is_number_pair (off)) + s.translate (ly_scm2offset (off)); + + line.add_stencil (s); } + } + while (flip (&d) != LEFT); - ofxy = dxy * (off / dxy.length ()) ; - dxy -= 2*ofxy; - - dxy[Y_AXIS] += extra_dy; + do + { + if (stencils[d]) + span_points[d] += dz_dir * + (stencils[d]->extent (X_AXIS)[-d] / dz_dir[X_AXIS]); - Stencil line = line_stencil (me, Offset (0, 0), dxy); - - line.translate_axis (bound[LEFT]->extent (bound[LEFT], X_AXIS).length () / 2, X_AXIS); - line.translate (ofxy - my_off + his_off + Offset (0, -extra_dy/2)); - return line.smobbed_copy (); + span_points[d] += -d * gaps[d] * dz.direction (); } + while (flip (&d) != LEFT); + + line.add_stencil (Line_interface::line (me, + span_points[LEFT], + span_points[RIGHT])); + + line.add_stencil (Line_interface::arrows (me, + span_points[LEFT], + span_points[RIGHT], + arrows[LEFT], + arrows[RIGHT])); + + line.translate (Offset (-me->relative_coordinate (commonx, X_AXIS), + -me->relative_coordinate (my_common_y, Y_AXIS))); + + + return line.smobbed_copy (); } ADD_INTERFACE (Line_spanner, @@ -218,8 +324,10 @@ ADD_INTERFACE (Line_spanner, "\n", "extra-dy " - "arrow " "gap " "thickness " + "bound-details " + "left-bound-info " + "right-bound-info " ); diff --git a/lily/ly-module.cc b/lily/ly-module.cc index c2e96a4a1c..581984dfe9 100644 --- a/lily/ly-module.cc +++ b/lily/ly-module.cc @@ -106,7 +106,7 @@ entry_to_alist (void *closure, SCM key, SCM val, SCM result) return result; } -LY_DEFINE (ly_module2alist, "ly:module->alist", +LY_DEFINE (ly_module_2_alist, "ly:module->alist", 1, 0, 0, (SCM mod), "Dump the contents of module @var{mod} as an alist.") { diff --git a/lily/moment-scheme.cc b/lily/moment-scheme.cc index b19259e6b2..16839f81bb 100644 --- a/lily/moment-scheme.cc +++ b/lily/moment-scheme.cc @@ -21,20 +21,20 @@ LY_DEFINE (ly_make_moment, "ly:make-moment", "notes, and @var{g} the timing for grace notes. " "In absence of grace notes, @var{g} is zero.\n") { - SCM_ASSERT_TYPE (scm_is_integer (n), n, SCM_ARG1, __FUNCTION__, "integer"); - SCM_ASSERT_TYPE (scm_is_integer (d), d, SCM_ARG2, __FUNCTION__, "integer"); + LY_ASSERT_TYPE (scm_is_integer, n, 1); + LY_ASSERT_TYPE(scm_is_integer,d, 2); int grace_num = 0; if (gn != SCM_UNDEFINED) { - SCM_ASSERT_TYPE (scm_is_integer (gn), gn, SCM_ARG3, __FUNCTION__, "integer"); + LY_ASSERT_TYPE(scm_is_integer,gn, 3); grace_num = scm_to_int (gn); } int grace_den = 1; if (gd != SCM_UNDEFINED) { - SCM_ASSERT_TYPE (scm_is_integer (gd), gd, SCM_ARG4, __FUNCTION__, "integer"); + LY_ASSERT_TYPE(scm_is_integer,gd, 4); grace_den = scm_to_int (gd); } @@ -42,14 +42,16 @@ LY_DEFINE (ly_make_moment, "ly:make-moment", Rational (grace_num, grace_den)).smobbed_copy (); } -LY_DEFINE (ly_sub_moment, "ly:moment-sub", +LY_DEFINE (ly_moment_sub, "ly:moment-sub", 2, 0, 0, (SCM a, SCM b), "Subtract two moments.") { + LY_ASSERT_SMOB (Moment, a, 1); + LY_ASSERT_SMOB (Moment,b, 2); + Moment *ma = unsmob_moment (a); Moment *mb = unsmob_moment (b); - SCM_ASSERT_TYPE (ma, a, SCM_ARG1, __FUNCTION__, "moment"); - SCM_ASSERT_TYPE (mb, b, SCM_ARG2, __FUNCTION__, "moment"); + return (*ma - *mb).smobbed_copy (); } @@ -57,10 +59,12 @@ LY_DEFINE (ly_moment_add, "ly:moment-add", 2, 0, 0, (SCM a, SCM b), "Add two moments.") { + LY_ASSERT_SMOB (Moment, a, 1); + LY_ASSERT_SMOB(Moment,b, 2); + Moment *ma = unsmob_moment (a); Moment *mb = unsmob_moment (b); - SCM_ASSERT_TYPE (ma, a, SCM_ARG1, __FUNCTION__, "moment"); - SCM_ASSERT_TYPE (mb, b, SCM_ARG2, __FUNCTION__, "moment"); + return (*ma + *mb).smobbed_copy (); } @@ -68,10 +72,11 @@ LY_DEFINE (ly_moment_mul, "ly:moment-mul", 2, 0, 0, (SCM a, SCM b), "Multiply two moments.") { + LY_ASSERT_SMOB (Moment, a, 1); + LY_ASSERT_SMOB(Moment, b, 2); + Moment *ma = unsmob_moment (a); Moment *mb = unsmob_moment (b); - SCM_ASSERT_TYPE (ma, a, SCM_ARG1, __FUNCTION__, "moment"); - SCM_ASSERT_TYPE (mb, b, SCM_ARG2, __FUNCTION__, "moment"); return (*ma * * mb).smobbed_copy (); } @@ -79,10 +84,12 @@ LY_DEFINE (ly_moment_div, "ly:moment-div", 2, 0, 0, (SCM a, SCM b), "Divide two moments.") { + LY_ASSERT_SMOB (Moment, a, 1); + LY_ASSERT_SMOB(Moment, b, 2); + Moment *ma = unsmob_moment (a); Moment *mb = unsmob_moment (b); - SCM_ASSERT_TYPE (ma, a, SCM_ARG1, __FUNCTION__, "moment"); - SCM_ASSERT_TYPE (mb, b, SCM_ARG2, __FUNCTION__, "moment"); + return (*ma / * mb).smobbed_copy (); } @@ -90,10 +97,11 @@ LY_DEFINE (ly_moment_mod, "ly:moment-mod", 2, 0, 0, (SCM a, SCM b), "Modulo of two moments.") { + LY_ASSERT_SMOB (Moment, a, 1); + LY_ASSERT_SMOB(Moment, b, 2); + Moment *ma = unsmob_moment (a); Moment *mb = unsmob_moment (b); - SCM_ASSERT_TYPE (ma, a, SCM_ARG1, __FUNCTION__, "moment"); - SCM_ASSERT_TYPE (mb, b, SCM_ARG2, __FUNCTION__, "moment"); return (*ma % * mb).smobbed_copy (); } @@ -101,8 +109,9 @@ LY_DEFINE (ly_moment_grace_numerator, "ly:moment-grace-numerator", 1, 0, 0, (SCM mom), "Extract numerator from grace timing.") { + LY_ASSERT_SMOB (Moment, mom, 1); + Moment *ma = unsmob_moment (mom); - SCM_ASSERT_TYPE (ma, mom, SCM_ARG1, __FUNCTION__, "moment"); return scm_from_int (ma->grace_part_.numerator ()); } @@ -111,8 +120,8 @@ LY_DEFINE (ly_moment_grace_denominator, "ly:moment-grace-denominator", 1, 0, 0, (SCM mom), "Extract denominator from grace timing.") { + LY_ASSERT_SMOB (Moment, mom, 1); Moment *ma = unsmob_moment (mom); - SCM_ASSERT_TYPE (ma, mom, SCM_ARG1, __FUNCTION__, "moment"); return scm_from_int (ma->grace_part_.denominator ()); } @@ -120,8 +129,8 @@ LY_DEFINE (ly_moment_main_numerator, "ly:moment-main-numerator", 1, 0, 0, (SCM mom), "Extract numerator from main timing.") { + LY_ASSERT_SMOB (Moment, mom, 1); Moment *ma = unsmob_moment (mom); - SCM_ASSERT_TYPE (ma, mom, SCM_ARG1, __FUNCTION__, "moment"); return scm_from_int (ma->main_part_.numerator ()); } @@ -130,8 +139,8 @@ LY_DEFINE (ly_moment_main_denominator, "ly:moment-main-denominator", 1, 0, 0, (SCM mom), "Extract denominator from main timing.") { + LY_ASSERT_SMOB (Moment, mom, 1); Moment *ma = unsmob_moment (mom); - SCM_ASSERT_TYPE (ma, mom, SCM_ARG1, __FUNCTION__, "moment"); return scm_from_int (ma->main_part_.denominator ()); } @@ -140,10 +149,12 @@ LY_DEFINE (ly_moment_less_p, "ly:momentget_length ().smobbed_copy (); } @@ -25,17 +25,16 @@ LY_DEFINE (ly_music_property, "Get the property @var{sym} of music expression @var{mus}.\n" "If @var{sym} is undefined, return @code{'()}.\n") { - Music *sc = unsmob_music (mus); - SCM_ASSERT_TYPE (sc, mus, SCM_ARG1, __FUNCTION__, "music"); + LY_ASSERT_TYPE (unsmob_music, mus, 1); return ly_prob_property (mus,sym,dfault); } -LY_DEFINE (ly_music_set_property, "ly:music-set-property!", +LY_DEFINE (ly_music_set_property_x, "ly:music-set-property!", 3, 0, 0, (SCM mus, SCM sym, SCM val), "Set property @var{sym} in music expression @var{mus} to @var{val}.") { - Music *sc = unsmob_music (mus); - SCM_ASSERT_TYPE (sc, mus, SCM_ARG1, __FUNCTION__, "music"); + LY_ASSERT_TYPE (unsmob_music, mus, 1); + return ly_prob_set_property_x (mus, sym, val); } @@ -69,8 +68,8 @@ LY_DEFINE (ly_music_mutable_properties, "ly:music-mutable-properties", "they are constant and initialized by the " "@code{make-music} function.\n") { + LY_ASSERT_TYPE (unsmob_music, mus, 1); Music *m = unsmob_music (mus); - SCM_ASSERT_TYPE (m, mus, SCM_ARG1, __FUNCTION__, "music"); return m->get_property_alist (true); } @@ -111,10 +110,11 @@ LY_DEFINE (ly_music_transpose, "ly:music-transpose", "Transpose @var{m} such that central C is mapped to @var{p}. " "Return @var{m}.") { + LY_ASSERT_TYPE (unsmob_music, m, 1); + LY_ASSERT_SMOB (Pitch, p, 2); + Music *sc = unsmob_music (m); Pitch *sp = unsmob_pitch (p); - SCM_ASSERT_TYPE (sc, m, SCM_ARG1, __FUNCTION__, "music"); - SCM_ASSERT_TYPE (sp, p, SCM_ARG2, __FUNCTION__, "pitch"); sc->transpose (*sp); // SCM_UNDEFINED ? @@ -128,11 +128,10 @@ LY_DEFINE (ly_music_compress, "ly:music-compress", 2, 0, 0, (SCM m, SCM factor), "Compress music object @var{m} by moment @var{factor}.") { - Music *sc = unsmob_music (m); - - SCM_ASSERT_TYPE (sc, m, SCM_ARG1, __FUNCTION__, "music"); - SCM_ASSERT_TYPE (unsmob_moment (factor), factor, SCM_ARG2, __FUNCTION__, "moment"); + LY_ASSERT_TYPE (unsmob_music, m, 1); + LY_ASSERT_TYPE(unsmob_moment,factor, 2); + Music *sc = unsmob_music (m); sc->compress (*unsmob_moment (factor)); return sc->self_scm (); } @@ -141,8 +140,8 @@ LY_DEFINE (ly_music_duration_length, "ly:music-duration-length", 1, 0, 0, (SCM mus), "Extract the duration field from @var{mus}, and return the length.") { + LY_ASSERT_TYPE (unsmob_music, mus, 1); Music *m = unsmob_music (mus); - SCM_ASSERT_TYPE (m, mus, SCM_ARG1, __FUNCTION__, "Music"); Duration *d = unsmob_duration (m->get_property ("duration")); Moment len; @@ -158,10 +157,11 @@ LY_DEFINE (ly_music_duration_compress, "ly:music-duration-compress", 2, 0, 0, (SCM mus, SCM fact), "Compress @var{mus} by factor @var{fact}, which is a @code{Moment}.") { + LY_ASSERT_TYPE (unsmob_music, mus, 1); + LY_ASSERT_SMOB (Moment, fact, 2); + Music *m = unsmob_music (mus); Moment *f = unsmob_moment (fact); - SCM_ASSERT_TYPE (m, mus, SCM_ARG1, __FUNCTION__, "Music"); - SCM_ASSERT_TYPE (f, fact, SCM_ARG2, __FUNCTION__, "Moment"); Duration *d = unsmob_duration (m->get_property ("duration")); if (d) diff --git a/lily/music.cc b/lily/music.cc index b22e243139..77c8f34335 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -250,7 +250,7 @@ Music::origin () const Stream_event * Music::to_event () const { - SCM class_name = ly_camel_case_to_lisp_identifier (get_property ("name")); + SCM class_name = ly_camel_case_2_lisp_identifier (get_property ("name")); // catch programming mistakes. if (!internal_is_music_type (class_name)) diff --git a/lily/new-line-spanner.cc b/lily/new-line-spanner.cc deleted file mode 100644 index 3842cb2cf6..0000000000 --- a/lily/new-line-spanner.cc +++ /dev/null @@ -1,343 +0,0 @@ -/* - line-spanner.cc -- implement New_line_spanner - - source file of the GNU LilyPond music typesetter - - (c) 2000--2007 Jan Nieuwenhuizen -*/ - -#include "spanner.hh" -#include "output-def.hh" -#include "paper-column.hh" -#include "staff-symbol-referencer.hh" -#include "font-interface.hh" -#include "warn.hh" -#include "align-interface.hh" -#include "lookup.hh" -#include "line-interface.hh" -#include "moment.hh" - -#include "lily-proto.hh" -#include "grob-interface.hh" -#include "text-interface.hh" - -class New_line_spanner -{ -public: - DECLARE_SCHEME_CALLBACK (print, (SCM)); - DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM)); - - DECLARE_SCHEME_CALLBACK (calc_left_bound_info, (SCM)); - DECLARE_SCHEME_CALLBACK (calc_left_bound_info_and_text, (SCM)); - DECLARE_SCHEME_CALLBACK (calc_right_bound_info, (SCM)); - DECLARE_SCHEME_CALLBACK (calc_bound_info, (SCM, Direction)); - DECLARE_GROB_INTERFACE(); - - static Grob *common_y (Grob*); -}; - -Grob* -New_line_spanner::common_y (Grob*me_grob) -{ - Spanner *me = dynamic_cast (me_grob); - - Grob *commony = me; - Direction d = LEFT; - do - if (me->get_bound (d)->break_status_dir () == CENTER) - commony = me->get_bound (d)->common_refpoint (commony, Y_AXIS); - while (flip (&d) != LEFT); - - return commony; -} - -static Grob * -line_spanner_common_parent (Grob *me) -{ - Grob *common = find_fixed_alignment_parent (me); - if (!common) - { - common = Staff_symbol_referencer::get_staff_symbol (me); - if (common) - common = common->get_parent (Y_AXIS); - else - common = me->get_parent (Y_AXIS); - } - - return common; -} - -SCM -New_line_spanner::calc_bound_info (SCM smob, Direction dir) -{ - Spanner *me = unsmob_spanner (smob); - - Grob *commonx = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT), X_AXIS); - commonx = me->common_refpoint (commonx, X_AXIS); - - SCM bound_details = me->get_property ("bound-details"); - - SCM details = SCM_BOOL_F; - if (details == SCM_BOOL_F) - details = ly_assoc_get ((dir == LEFT) - ? ly_symbol2scm ("left") - : ly_symbol2scm ("right"), bound_details, SCM_BOOL_F); - - if (me->get_bound (dir)->break_status_dir ()) - { - SCM extra = ly_assoc_get ((dir == LEFT) - ? ly_symbol2scm ("left-broken") - : ly_symbol2scm ("right-broken"), bound_details, SCM_EOL); - - for (SCM s = extra; scm_is_pair (s); s = scm_cdr (s)) - details = scm_cons (scm_car (s), details); - } - - if (details == SCM_BOOL_F) - details = ly_assoc_get (ly_symbol2scm ("default"), bound_details, SCM_EOL); - - SCM text = ly_assoc_get (ly_symbol2scm ("text"), details, SCM_BOOL_F); - if (Text_interface::is_markup (text)) - { - Output_def *layout = me->layout (); - SCM properties = Font_interface::text_font_alist_chain (me); - details = scm_acons (ly_symbol2scm ("stencil"), - Text_interface::interpret_markup (layout->self_scm (), - properties, text), - details); - } - - if (!scm_is_number (ly_assoc_get (ly_symbol2scm ("X"), details, SCM_BOOL_F))) - { - Direction attach = (Direction) - robust_scm2int (ly_assoc_get (ly_symbol2scm ("attach-dir"), - details, SCM_BOOL_F), - CENTER); - - details = scm_acons (ly_symbol2scm ("X"), - scm_from_double (me->get_bound (dir)->extent (commonx, X_AXIS) - .linear_combination (attach)), - details); - } - - - if (!scm_is_number (ly_assoc_get (ly_symbol2scm ("Y"), details, SCM_BOOL_F))) - { - Real y = 0.0; - - Real extra_dy = robust_scm2double (me->get_property ("extra-dy"), - 0.0); - - if (me->get_bound (dir)->break_status_dir ()) - { - /* - This is hairy. For the normal case, we simply find common - parents, and draw a line between the bounds. When two note - heads are on different systems, there is no common parent - anymore. We have to find the piano-staff object. - */ - - Spanner *next_sp = me->broken_neighbor (dir); - Item *next_bound = next_sp->get_bound (dir); - - if (next_bound->break_status_dir ()) - { - programming_error ("no note heads for the line spanner on neighbor line?" - " Confused."); - me->suicide (); - return SCM_EOL; - } - - Grob *next_common_y = line_spanner_common_parent (next_bound); - Interval next_ext = next_bound->extent (next_common_y, Y_AXIS); - - y = next_ext.center (); - } - else - { - Grob *commony = common_y (me); - y = me->get_bound (dir)->extent (commony, Y_AXIS).center(); - } - - y += dir * extra_dy / 2; - details = scm_acons (ly_symbol2scm ("Y"), scm_from_double (y), details); - } - - return details; -} - -MAKE_SCHEME_CALLBACK (New_line_spanner, calc_right_bound_info, 1); -SCM -New_line_spanner::calc_right_bound_info (SCM smob) -{ - return New_line_spanner::calc_bound_info (smob, RIGHT); -} - -MAKE_SCHEME_CALLBACK (New_line_spanner, calc_left_bound_info, 1); -SCM -New_line_spanner::calc_left_bound_info (SCM smob) -{ - return New_line_spanner::calc_bound_info (smob, LEFT); -} - -MAKE_SCHEME_CALLBACK (New_line_spanner, calc_left_bound_info_and_text, 1); -SCM -New_line_spanner::calc_left_bound_info_and_text (SCM smob) -{ - SCM alist = New_line_spanner::calc_bound_info (smob, LEFT); - Spanner *me = unsmob_spanner (smob); - - SCM text = me->get_property ("text"); - if (Text_interface::is_markup (text) - && me->get_bound (LEFT)->break_status_dir () == CENTER - && ly_assoc_get (ly_symbol2scm ("stencil"), alist, SCM_BOOL_F) == SCM_BOOL_F) - { - Output_def *layout = me->layout (); - SCM properties = Font_interface::text_font_alist_chain (me); - alist = scm_acons (ly_symbol2scm ("stencil"), - Text_interface::interpret_markup (layout->self_scm (), - properties, text), - alist); - } - - return alist; -} - -MAKE_SCHEME_CALLBACK (New_line_spanner, print, 1); -SCM -New_line_spanner::print (SCM smob) -{ - Spanner *me = dynamic_cast (unsmob_grob (smob)); - - Interval_t moments = me->spanned_time (); - /* - We remove the line at the start of the line. For piano voice - indicators, it makes no sense to have them at the start of the - line. - - I'm not sure what the official rules for glissandi are, but - usually the 2nd note of the glissando is "exact", so when playing - from the start of the line, there is no need to glide. - - From a typographical p.o.v. this makes sense, since the amount of - space left of a note at the start of a line is very small. - - --hwn. - - */ - if (moments.length () == Moment (0,0)) - return SCM_EOL; - - Drul_array bounds (me->get_property ("left-bound-info"), - me->get_property ("right-bound-info")); - - - Grob *commonx = me->get_bound (LEFT)->common_refpoint (me->get_bound (RIGHT), X_AXIS); - commonx = me->common_refpoint (commonx, X_AXIS); - - Drul_array span_points; - - Direction d = LEFT; - do - { - Offset z (robust_scm2double (ly_assoc_get (ly_symbol2scm ("X"), - bounds[d], SCM_BOOL_F), 0.0) - + commonx->relative_coordinate (commonx, X_AXIS), - robust_scm2double (ly_assoc_get (ly_symbol2scm ("Y"), - bounds[d], SCM_BOOL_F), 0.0)); - - span_points[d] = z; - } - while (flip (&d) != LEFT); - - Offset dz = (span_points[RIGHT] - span_points[LEFT]); - Offset dz_dir = dz.direction (); - Drul_array gaps (0, 0); - Drul_array arrows (0, 0); - Drul_array stencils (0,0); - do - { - gaps[d] = robust_scm2double (ly_assoc_get (ly_symbol2scm ("padding"), - bounds[d], SCM_BOOL_F), 0.0); - arrows[d] = to_boolean (ly_assoc_get (ly_symbol2scm ("arrow"), - bounds[d], SCM_BOOL_F)); - stencils[d] = unsmob_stencil (ly_assoc_get (ly_symbol2scm ("stencil"), - bounds[d], SCM_BOOL_F)); - - } - while (flip (&d) != LEFT); - - if (gaps[LEFT] + gaps[RIGHT] > dz.length ()) - { - return SCM_EOL; - } - - Stencil line; - do - { - if (stencils[d]) - { - Stencil s = stencils[d]->translated (span_points[d]); - SCM align = ly_assoc_get (ly_symbol2scm ("stencil-align-dir-y"), - bounds[d], SCM_BOOL_F); - SCM off = ly_assoc_get (ly_symbol2scm ("stencil-offset"), - bounds[d], SCM_BOOL_F); - - if (scm_is_number (align)) - s.align_to (Y_AXIS, scm_to_double (align)); - - /* - todo: should use font-size. - */ - if (is_number_pair (off)) - s.translate (ly_scm2offset (off)); - - line.add_stencil (s); - } - } - while (flip (&d) != LEFT); - - do - { - if (stencils[d]) - span_points[d] += dz_dir * - (stencils[d]->extent (X_AXIS)[-d] / dz_dir[X_AXIS]); - - - span_points[d] += -d * gaps[d] * dz.direction (); - } - while (flip (&d) != LEFT); - - line.add_stencil (Line_interface::line (me, - span_points[LEFT], - span_points[RIGHT])); - - line.add_stencil (Line_interface::arrows (me, - span_points[LEFT], - span_points[RIGHT], - arrows[LEFT], - arrows[RIGHT])); - Grob *commony = common_y (me); - - line.translate (Offset (-me->relative_coordinate (commonx, X_AXIS), - -me->relative_coordinate (commony, Y_AXIS))); - - - return line.smobbed_copy (); -} - -ADD_INTERFACE (New_line_spanner, - "Generic line drawn between two objects, e.g. for use with glissandi.\n" - "The property @code{style} can be @code{line}, " - "@code{dashed-line}, @code{trill}, \n" - "@code{dotted-line} or @code{zigzag}.\n" - "\n", - - "extra-dy " - "gap " - "thickness " - "bound-details " - "left-bound-info " - "right-bound-info " - ); - diff --git a/lily/note-collision.cc b/lily/note-collision.cc index 7d92a76ec0..488d77f1b7 100644 --- a/lily/note-collision.cc +++ b/lily/note-collision.cc @@ -323,7 +323,9 @@ MAKE_SCHEME_CALLBACK(Note_collision_interface, calc_positioning_done, 1) SCM Note_collision_interface::calc_positioning_done (SCM smob) { - Grob *me = unsmob_grob (smob); + Grob *me = unsmob_grob (smob); + me->set_property ("positioning-done", SCM_BOOL_T); + Drul_array > cg = get_clash_groups (me); Direction d = UP; diff --git a/lily/note-head-scheme.cc b/lily/note-head-scheme.cc index 621e5311b9..5791980269 100644 --- a/lily/note-head-scheme.cc +++ b/lily/note-head-scheme.cc @@ -16,9 +16,9 @@ LY_DEFINE(ly_note_head__stem_attachment, "ly:note-head::stem-attachment", "Get attachment in @var{font-metric} for attaching a stem to notehead " "@var{glyph-name}.") { + LY_ASSERT_SMOB (Font_metric, font_metric, 1); Font_metric *fm = unsmob_metrics (font_metric); - SCM_ASSERT_TYPE(fm, font_metric, SCM_ARG1, __FUNCTION__, "font metric"); - SCM_ASSERT_TYPE(scm_is_string (glyph_name), glyph_name, SCM_ARG2, __FUNCTION__, "string"); + LY_ASSERT_TYPE(scm_is_string,glyph_name, 2); return ly_offset2scm (Note_head::get_stem_attachment (fm, ly_scm2string (glyph_name))); } diff --git a/lily/open-type-font-scheme.cc b/lily/open-type-font-scheme.cc index c6561b48cb..64b140f07e 100644 --- a/lily/open-type-font-scheme.cc +++ b/lily/open-type-font-scheme.cc @@ -14,8 +14,8 @@ LY_DEFINE (ly_font_sub_fonts, "ly:font-sub-fonts", 1, 0, 0, "Given the font metric @var{font} of an OpenType font, return the " "names of the subfonts within @var{font}.") { + LY_ASSERT_SMOB (Font_metric, font, 1); Font_metric *fm = unsmob_metrics (font); - SCM_ASSERT_TYPE (fm, font, SCM_ARG1, __FUNCTION__, "font-metric"); return fm->sub_fonts (); } @@ -27,9 +27,9 @@ LY_DEFINE (ly_otf_font_glyph_info, "ly:otf-font-glyph-info", 2, 0, 0, Modified_font_metric *fm = dynamic_cast (unsmob_metrics (font)); Open_type_font *otf = dynamic_cast (fm->original_font ()); + SCM_ASSERT_TYPE (otf, font, SCM_ARG1, __FUNCTION__, "OTF font-metric"); - SCM_ASSERT_TYPE (scm_is_string (glyph), glyph, SCM_ARG1, - __FUNCTION__, "string"); + LY_ASSERT_TYPE(scm_is_string, glyph, 2); SCM sym = scm_string_to_symbol (glyph); return scm_hashq_ref (otf->get_char_table (), sym, SCM_EOL); @@ -47,7 +47,7 @@ LY_DEFINE (ly_otf_font_table_data, "ly:otf-font-table-data", 2, 0, 0, : dynamic_cast (unsmob_metrics (font)); SCM_ASSERT_TYPE (otf, font, SCM_ARG1, __FUNCTION__, "Open type font"); - SCM_ASSERT_TYPE (scm_is_string (tag), tag, SCM_ARG1, __FUNCTION__, "Open type font"); + LY_ASSERT_TYPE (scm_is_string, tag, 2); char ctag [5] = " "; @@ -83,7 +83,7 @@ LY_DEFINE (ly_otf_glyph_list, "ly:otf-glyph-list", : dynamic_cast (unsmob_metrics (font)); - SCM_ASSERT_TYPE (otf,font, SCM_ARG1, __FUNCTION__, "OTF font"); + SCM_ASSERT_TYPE (otf, font, SCM_ARG1, __FUNCTION__, "OTF font"); return otf->glyph_list (); } diff --git a/lily/ottava-bracket.cc b/lily/ottava-bracket.cc index cf13802844..5dd1036ef1 100644 --- a/lily/ottava-bracket.cc +++ b/lily/ottava-bracket.cc @@ -7,7 +7,6 @@ */ #include "text-interface.hh" -#include "line-spanner.hh" #include "spanner.hh" #include "font-interface.hh" #include "dimensions.hh" diff --git a/lily/output-def-scheme.cc b/lily/output-def-scheme.cc index e7533eed16..ea216a371f 100644 --- a/lily/output-def-scheme.cc +++ b/lily/output-def-scheme.cc @@ -14,14 +14,14 @@ #include "context-def.hh" #include "lily-parser.hh" -LY_DEFINE (ly_layout_lookup, "ly:output-def-lookup", +LY_DEFINE (ly_output_def_lookup, "ly:output-def-lookup", 2, 1, 0, (SCM pap, SCM sym, SCM def), - "Lookup @var{sym} in @var{pap}. " + "Lookup @var{sym} in the Output_def @var{pap}. " "Return the value or @var{def} (which defaults to @code{'()}) if undefined.") { + LY_ASSERT_SMOB (Output_def, pap, 1); Output_def *op = unsmob_output_def (pap); - SCM_ASSERT_TYPE (op, pap, SCM_ARG1, __FUNCTION__, "Output_def"); - SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol"); + LY_ASSERT_TYPE (ly_is_symbol, sym, 2); SCM answer = op->lookup_variable (sym); if (answer == SCM_UNDEFINED) @@ -39,8 +39,8 @@ LY_DEFINE (ly_output_def_scope, "ly:output-def-scope", 1, 0, 0, (SCM def), "Get the variable scope inside @var{def}.") { + LY_ASSERT_SMOB (Output_def, def, 1); Output_def *op = unsmob_output_def (def); - SCM_ASSERT_TYPE (op, def, SCM_ARG1, __FUNCTION__, "Output definition"); return op->scope_; } @@ -48,8 +48,8 @@ LY_DEFINE (ly_output_def_parent, "ly:output-def-parent", 1, 0, 0, (SCM def), "Get the parent output-def of @var{def}.") { + LY_ASSERT_SMOB (Output_def, def, 1); Output_def *op = unsmob_output_def (def); - SCM_ASSERT_TYPE (op, def, SCM_ARG1, __FUNCTION__, "Output definition"); return op->parent_ ? op->parent_->self_scm () : SCM_EOL; } @@ -57,8 +57,8 @@ LY_DEFINE (ly_output_def_clone, "ly:output-def-clone", 1, 0, 0, (SCM def), "Clone @var{def}.") { + LY_ASSERT_SMOB (Output_def, def, 1); Output_def *op = unsmob_output_def (def); - SCM_ASSERT_TYPE (op, def, SCM_ARG1, __FUNCTION__, "Output definition"); Output_def *clone = op->clone (); return clone->unprotect (); @@ -70,7 +70,7 @@ LY_DEFINE (ly_output_description, "ly:output-description", { Output_def *id = unsmob_output_def (output_def); - SCM al = ly_module2alist (id->scope_); + SCM al = ly_module_2_alist (id->scope_); SCM ell = SCM_EOL; for (SCM s = al; scm_is_pair (s); s = scm_cdr (s)) { @@ -93,8 +93,8 @@ LY_DEFINE (ly_paper_outputscale, "ly:paper-outputscale", 1, 0, 0, (SCM bp), "Get output-scale for BP.") { + LY_ASSERT_SMOB (Output_def, bp, 1); Output_def *b = unsmob_output_def (bp); - SCM_ASSERT_TYPE (b, bp, SCM_ARG1, __FUNCTION__, "paper"); return scm_from_double (output_scale (b)); } @@ -114,10 +114,9 @@ LY_DEFINE (ly_paper_get_font, "ly:paper-get-font", 2, 0, 0, "(An alist chain is a list of alists, " "containing grob properties).\n") { - Output_def *paper = unsmob_output_def (paper_smob); - SCM_ASSERT_TYPE (paper, paper_smob, SCM_ARG1, - __FUNCTION__, "paper definition"); + LY_ASSERT_SMOB (Output_def, paper_smob, 1); + Output_def *paper = unsmob_output_def (paper_smob); Font_metric *fm = select_font (paper, chain); return fm->self_scm (); } @@ -126,9 +125,9 @@ LY_DEFINE (ly_paper_get_number, "ly:paper-get-number", 2, 0, 0, (SCM layout_smob, SCM name), "Return the layout variable @var{name}.") { + + LY_ASSERT_SMOB (Output_def, layout_smob, 1); Output_def *layout = unsmob_output_def (layout_smob); - SCM_ASSERT_TYPE (layout, layout_smob, SCM_ARG1, - __FUNCTION__, "layout definition"); return scm_from_double (layout->get_dimension (name)); } @@ -137,10 +136,9 @@ LY_DEFINE (ly_paper_fonts, "ly:paper-fonts", (SCM bp), "Return fonts from the @code{\\paper} block @var{bp}.") { + LY_ASSERT_SMOB (Output_def, bp, 1); Output_def *b = unsmob_output_def (bp); - SCM_ASSERT_TYPE (b, bp, SCM_ARG1, __FUNCTION__, "paper"); - SCM tab1 = b->lookup_variable (ly_symbol2scm ("scaled-fonts")); SCM tab2 = b->lookup_variable (ly_symbol2scm ("pango-fonts")); diff --git a/lily/pango-select-scheme.cc b/lily/pango-select-scheme.cc index b1edd941c5..613cd01cae 100644 --- a/lily/pango-select-scheme.cc +++ b/lily/pango-select-scheme.cc @@ -15,7 +15,7 @@ LY_DEFINE (ly_make_pango_description_string, "ly:make-pango-description-string", 2, 0, 0, (SCM chain, SCM size), "Make a PangoFontDescription string for the property alist @var{chain} at size @var{size}.") { - SCM_ASSERT_TYPE (scm_is_number (size), size, SCM_ARG1, __FUNCTION__, "number"); + LY_ASSERT_TYPE (scm_is_number, size, 1); PangoFontDescription *pfd = properties_to_pango_description (chain, scm_to_double (size)); char *str = pango_font_description_to_string (pfd); diff --git a/lily/paper-book-scheme.cc b/lily/paper-book-scheme.cc index 01e777220b..94bb17f05e 100644 --- a/lily/paper-book-scheme.cc +++ b/lily/paper-book-scheme.cc @@ -14,6 +14,7 @@ LY_DEFINE (ly_paper_book_pages, "ly:paper-book-pages", 1, 0, 0, (SCM pb), "Return pages in book PB.") { + LY_ASSERT_SMOB (Paper_book, pb, 1); return unsmob_paper_book (pb)->pages (); } @@ -21,8 +22,8 @@ LY_DEFINE (ly_paper_book_scopes, "ly:paper-book-scopes", 1, 0, 0, (SCM book), "Return pages in layout book @var{book}.") { + LY_ASSERT_SMOB (Paper_book, book, 1); Paper_book *pb = unsmob_paper_book (book); - SCM_ASSERT_TYPE (pb, book, SCM_ARG1, __FUNCTION__, "Paper_book"); SCM scopes = SCM_EOL; if (ly_is_module (pb->header_)) @@ -35,6 +36,7 @@ LY_DEFINE (ly_paper_book_performances, "ly:paper-book-performances", 1, 0, 0, (SCM paper_book), "Return performances in book @var{paper-book}.") { + LY_ASSERT_SMOB (Paper_book, paper_book, 1); return unsmob_paper_book (paper_book)->performances (); } @@ -42,6 +44,7 @@ LY_DEFINE (ly_paper_book_systems, "ly:paper-book-systems", 1, 0, 0, (SCM pb), "Return systems in book PB.") { + LY_ASSERT_SMOB (Paper_book, pb, 1); return unsmob_paper_book (pb)->systems (); } @@ -49,7 +52,7 @@ LY_DEFINE (ly_paper_book_paper, "ly:paper-book-paper", 1, 0, 0, (SCM pb), "Return pages in book PB.") { + LY_ASSERT_SMOB (Paper_book, pb, 1); Paper_book *pbook = unsmob_paper_book (pb); - SCM_ASSERT_TYPE(pbook, pb, SCM_ARG1, __FUNCTION__, "Paper_book"); return pbook->paper_->self_scm (); } diff --git a/lily/paper-outputter-scheme.cc b/lily/paper-outputter-scheme.cc index e4906f4a9b..3c00d79308 100644 --- a/lily/paper-outputter-scheme.cc +++ b/lily/paper-outputter-scheme.cc @@ -17,10 +17,8 @@ LY_DEFINE (ly_make_paper_outputter, "ly:make-paper-outputter", "Create an outputter that evaluates within " "@code{output-}@var{format}, writing to @var{port}.") { - SCM_ASSERT_TYPE (ly_is_port (port), port, SCM_ARG1, __FUNCTION__, - "port"); - SCM_ASSERT_TYPE (scm_is_string (format), format, SCM_ARG2, __FUNCTION__, - "String"); + LY_ASSERT_TYPE (ly_is_port, port, 1); + LY_ASSERT_TYPE (scm_is_string, format, 2); string f = ly_scm2string (format); @@ -45,10 +43,13 @@ LY_DEFINE (ly_outputter_dump_stencil, "ly:outputter-dump-stencil", 2, 0, 0, (SCM outputter, SCM stencil), "Dump stencil @var{expr} onto @var{outputter}.") { + + LY_ASSERT_SMOB (Paper_outputter, outputter, 1); + LY_ASSERT_SMOB(Stencil, stencil, 2); + Paper_outputter *po = unsmob_outputter (outputter); Stencil *st = unsmob_stencil (stencil); - SCM_ASSERT_TYPE (po, outputter, SCM_ARG1, __FUNCTION__, "Paper_outputter"); - SCM_ASSERT_TYPE (st, stencil, SCM_ARG1, __FUNCTION__, "Paper_outputter"); + po->output_stencil (*st); return SCM_UNSPECIFIED; } @@ -57,9 +58,10 @@ LY_DEFINE (ly_outputter_dump_string, "ly:outputter-dump-string", 2, 0, 0, (SCM outputter, SCM str), "Dump @var{str} onto @var{outputter}.") { + LY_ASSERT_SMOB (Paper_outputter, outputter, 1); + LY_ASSERT_TYPE(scm_is_string, str, 2); + Paper_outputter *po = unsmob_outputter (outputter); - SCM_ASSERT_TYPE (po, outputter, SCM_ARG1, __FUNCTION__, "Paper_outputter"); - SCM_ASSERT_TYPE (scm_is_string (str), str, SCM_ARG1, __FUNCTION__, "Paper_outputter"); return po->dump_string (str); } @@ -68,8 +70,8 @@ LY_DEFINE (ly_outputter_port, "ly:outputter-port", 1, 0, 0, (SCM outputter), "Return output port for @var{outputter}.") { + LY_ASSERT_SMOB (Paper_outputter, outputter, 1); Paper_outputter *po = unsmob_outputter (outputter); - SCM_ASSERT_TYPE (po, outputter, SCM_ARG1, __FUNCTION__, "Paper_outputter"); return po->file (); } @@ -78,8 +80,8 @@ LY_DEFINE (ly_outputter_close, "ly:outputter-close", 1, 0, 0, (SCM outputter), "Close port of @var{outputter}.") { + LY_ASSERT_SMOB (Paper_outputter, outputter, 1); Paper_outputter *po = unsmob_outputter (outputter); - SCM_ASSERT_TYPE (po, outputter, SCM_ARG1, __FUNCTION__, "Paper_outputter"); po->close (); return SCM_UNSPECIFIED; @@ -89,8 +91,8 @@ LY_DEFINE (ly_outputter_output_scheme, "ly:outputter-output-scheme", 2, 0, 0, (SCM outputter, SCM expr), "Eval @var{expr} in module of @var{outputter}.") { + LY_ASSERT_SMOB (Paper_outputter, outputter, 1); Paper_outputter *po = unsmob_outputter (outputter); - SCM_ASSERT_TYPE (po, outputter, SCM_ARG1, __FUNCTION__, "Paper_outputter"); po->output_scheme (expr); diff --git a/lily/paper-score-scheme.cc b/lily/paper-score-scheme.cc index 0c6a16c21c..055b5363df 100644 --- a/lily/paper-score-scheme.cc +++ b/lily/paper-score-scheme.cc @@ -13,8 +13,8 @@ LY_DEFINE (ly_paper_score_paper_systems, "ly:paper-score-paper-systems", (SCM paper_score), "Return vector of paper_system objects from @var{paper-score}.") { - Paper_score *pscore = dynamic_cast (unsmob_music_output (paper_score)); - SCM_ASSERT_TYPE (pscore, paper_score, SCM_ARG1, __FUNCTION__, "Paper score (Music output)"); + LY_ASSERT_TYPE (unsmob_paper_score, paper_score, 1); + Paper_score *pscore = dynamic_cast (unsmob_music_output (paper_score)); return pscore->get_paper_systems (); } diff --git a/lily/paper-score.cc b/lily/paper-score.cc index f91a4cddee..db02583282 100644 --- a/lily/paper-score.cc +++ b/lily/paper-score.cc @@ -158,3 +158,9 @@ Paper_score::get_paper_systems () return paper_systems_; } + +Paper_score * +unsmob_paper_score (SCM x) +{ + return dynamic_cast (unsmob_music_output (x)); +} diff --git a/lily/performance-scheme.cc b/lily/performance-scheme.cc index 3f45829882..5da5e3ee72 100644 --- a/lily/performance-scheme.cc +++ b/lily/performance-scheme.cc @@ -12,12 +12,10 @@ LY_DEFINE (ly_performance_write, "ly:performance-write", 2, 0, 0, (SCM performance, SCM filename), "Write @var{performance} to @var{filename}") { - Performance *perf = dynamic_cast (unsmob_music_output (performance)); + LY_ASSERT_TYPE (unsmob_performance, performance, 1); + LY_ASSERT_TYPE(scm_is_string, filename, 2); - SCM_ASSERT_TYPE (perf, performance, SCM_ARG1, __FUNCTION__, "Performance"); - SCM_ASSERT_TYPE (scm_is_string (filename), filename, SCM_ARG2, __FUNCTION__, "file name"); - - perf->write_output (ly_scm2string (filename)); + unsmob_performance (performance)->write_output (ly_scm2string (filename)); return SCM_UNSPECIFIED; } diff --git a/lily/performance.cc b/lily/performance.cc index e536622f06..70d5348a9b 100644 --- a/lily/performance.cc +++ b/lily/performance.cc @@ -109,3 +109,9 @@ void Performance::process () { } + +Performance * +unsmob_performance (SCM x) +{ + return dynamic_cast (unsmob_music_output (x)); +} diff --git a/lily/pfb-scheme.cc b/lily/pfb-scheme.cc new file mode 100644 index 0000000000..f22a745ac7 --- /dev/null +++ b/lily/pfb-scheme.cc @@ -0,0 +1,53 @@ + +#include "program-option.hh" +#include "source-file.hh" +#include "memory-stream.hh" +#include "open-type-font.hh" +#include "main.hh" +#include "warn.hh" + +LY_DEFINE (ly_pfb_2_pfa, "ly:pfb->pfa", + 1, 0, 0, (SCM pfb_file_name), + "Convert the contents of a PFB file to PFA.") +{ + LY_ASSERT_TYPE (scm_is_string, pfb_file_name, 1); + + string file_name = ly_scm2string (pfb_file_name); + + if (be_verbose_global) + progress_indication ("[" + file_name); + + vector pfb_string = gulp_file (file_name, 0); + char *pfa = pfb2pfa ((Byte *) &pfb_string[0], pfb_string.size ()); + + SCM pfa_scm = scm_from_locale_string (pfa); + free (pfa); + + if (be_verbose_global) + progress_indication ("]"); + + return pfa_scm; +} + +LY_DEFINE (ly_otf_2_cff, "ly:otf->cff", + 1, 0, 0, (SCM otf_file_name), + "Convert the contents of a OTF file to CFF file, returning it as " + " a string.") +{ + LY_ASSERT_TYPE (scm_is_string, otf_file_name, 1); + + string file_name = ly_scm2string (otf_file_name); + if (be_verbose_global) + progress_indication ("[" + file_name); + + FT_Face face = open_ft_face (file_name); + string table = get_otf_table (face, "CFF "); + + SCM asscm = scm_from_locale_stringn ((char *) table.data (), + table.length ()); + + if (be_verbose_global) + progress_indication ("]"); + + return asscm; +} diff --git a/lily/pfb.cc b/lily/pfb.cc index f062c986db..3cee206189 100644 --- a/lily/pfb.cc +++ b/lily/pfb.cc @@ -70,51 +70,3 @@ pfb2pfa (Byte const *pfb, int length) return out; } -LY_DEFINE (ly_pfb_to_pfa, "ly:pfb->pfa", - 1, 0, 0, (SCM pfb_file_name), - "Convert the contents of a PFB file to PFA.") -{ - SCM_ASSERT_TYPE (scm_is_string (pfb_file_name), pfb_file_name, - SCM_ARG1, __FUNCTION__, "string"); - - string file_name = ly_scm2string (pfb_file_name); - - if (be_verbose_global) - progress_indication ("[" + file_name); - - vector pfb_string = gulp_file (file_name, 0); - char *pfa = pfb2pfa ((Byte *) &pfb_string[0], pfb_string.size ()); - - SCM pfa_scm = scm_from_locale_string (pfa); - free (pfa); - - if (be_verbose_global) - progress_indication ("]"); - - return pfa_scm; -} - -LY_DEFINE (ly_otf_to_cff, "ly:otf->cff", - 1, 0, 0, (SCM otf_file_name), - "Convert the contents of a OTF file to CFF file, returning it as " - " a string.") -{ - SCM_ASSERT_TYPE (scm_is_string (otf_file_name), otf_file_name, - SCM_ARG1, __FUNCTION__, "string"); - - string file_name = ly_scm2string (otf_file_name); - if (be_verbose_global) - progress_indication ("[" + file_name); - - FT_Face face = open_ft_face (file_name); - string table = get_otf_table (face, "CFF "); - - SCM asscm = scm_from_locale_stringn ((char *) table.data (), - table.length ()); - - if (be_verbose_global) - progress_indication ("]"); - - return asscm; -} - diff --git a/lily/pitch-scheme.cc b/lily/pitch-scheme.cc index 440df366eb..aa1ac5cbfe 100644 --- a/lily/pitch-scheme.cc +++ b/lily/pitch-scheme.cc @@ -13,10 +13,11 @@ LY_DEFINE (ly_pitch_transpose, "ly:pitch-transpose", "Transpose @var{p} by the amount @var{delta}, " "where @var{delta} is relative to middle C.") { + LY_ASSERT_SMOB (Pitch, p, 1); + LY_ASSERT_SMOB (Pitch, delta, 2); + Pitch *t = unsmob_pitch (p); Pitch *d = unsmob_pitch (delta); - SCM_ASSERT_TYPE (t, p, SCM_ARG1, __FUNCTION__, "pitch"); - SCM_ASSERT_TYPE (d, delta, SCM_ARG1, __FUNCTION__, "pitch"); return t->transposed (*d).smobbed_copy (); } @@ -29,10 +30,9 @@ LY_DEFINE (ly_make_pitch, "ly:make-pitch", "with 0 corresponding to C and 6 corresponding to B. " "The @var{alter} is a rational number of whole tones for alteration.") { - SCM_ASSERT_TYPE (scm_is_integer (octave), octave, SCM_ARG1, __FUNCTION__, "integer"); - SCM_ASSERT_TYPE (scm_is_integer (note), note, SCM_ARG2, __FUNCTION__, "integer"); - SCM_ASSERT_TYPE (scm_is_rational (alter), - alter, SCM_ARG3, __FUNCTION__, "rational"); + LY_ASSERT_TYPE (scm_is_integer, octave, 1); + LY_ASSERT_TYPE(scm_is_integer, note, 2); + LY_ASSERT_TYPE(scm_is_rational, alter, 3); Pitch p (scm_to_int (octave), scm_to_int (note), ly_scm2rational (alter)); @@ -44,8 +44,8 @@ LY_DEFINE (ly_pitch_negate, "ly:pitch-negate", 1, 0, 0, (SCM p), "Negate @var{p}.") { + LY_ASSERT_SMOB (Pitch, p, 1); Pitch *pp = unsmob_pitch (p); - SCM_ASSERT_TYPE (pp, p, SCM_ARG1, __FUNCTION__, "Pitch"); return pp->negated ().smobbed_copy (); } @@ -53,8 +53,8 @@ LY_DEFINE (ly_pitch_steps, "ly:pitch-steps", 1, 0, 0, (SCM p), "Number of steps counted from middle C of the pitch @var{p}.") { + LY_ASSERT_SMOB (Pitch, p, 1); Pitch *pp = unsmob_pitch (p); - SCM_ASSERT_TYPE (pp, p, SCM_ARG1, __FUNCTION__, "Pitch"); return scm_from_int (pp->steps ()); } @@ -62,8 +62,8 @@ LY_DEFINE (ly_pitch_octave, "ly:pitch-octave", 1, 0, 0, (SCM pp), "Extract the octave from pitch @var{p}.") { + LY_ASSERT_SMOB (Pitch, pp, 1); Pitch *p = unsmob_pitch (pp); - SCM_ASSERT_TYPE (p, pp, SCM_ARG1, __FUNCTION__, "Pitch"); int q = p->get_octave (); return scm_from_int (q); } @@ -72,8 +72,8 @@ LY_DEFINE (ly_pitch_alteration, "ly:pitch-alteration", 1, 0, 0, (SCM pp), "Extract the alteration from pitch @var{p}.") { + LY_ASSERT_SMOB (Pitch, pp, 1); Pitch *p = unsmob_pitch (pp); - SCM_ASSERT_TYPE (p, pp, SCM_ARG1, __FUNCTION__, "Pitch"); Rational q = p->get_alteration (); return ly_rational2scm (q); @@ -83,8 +83,8 @@ LY_DEFINE (pitch_notename, "ly:pitch-notename", 1, 0, 0, (SCM pp), "Extract the note name from pitch @var{pp}.") { + LY_ASSERT_SMOB (Pitch, pp, 1); Pitch *p = unsmob_pitch (pp); - SCM_ASSERT_TYPE (p, pp, SCM_ARG1, __FUNCTION__, "Pitch"); int q = p->get_notename (); return scm_from_int (q); } @@ -93,8 +93,8 @@ LY_DEFINE (ly_pitch_quartertones, "ly:pitch-quartertones", 1, 0, 0, (SCM pp), "Calculate the number of quarter tones of @var{p} from middle C.") { + LY_ASSERT_SMOB (Pitch, pp, 1); Pitch *p = unsmob_pitch (pp); - SCM_ASSERT_TYPE (p, pp, SCM_ARG1, __FUNCTION__, "Pitch"); int q = p->rounded_quartertone_pitch (); return scm_from_int (q); } @@ -103,8 +103,8 @@ LY_DEFINE (ly_pitch_semitones, "ly:pitch-semitones", 1, 0, 0, (SCM pp), "calculate the number of semitones of @var{p} from middle C.") { + LY_ASSERT_SMOB (Pitch, pp, 1); Pitch *p = unsmob_pitch (pp); - SCM_ASSERT_TYPE (p, pp, SCM_ARG1, __FUNCTION__, "Pitch"); int q = p->rounded_semitone_pitch (); return scm_from_int (q); } @@ -113,12 +113,12 @@ LY_DEFINE (ly_pitch_less_p, "ly:pitchset_property (sym, value); return SCM_UNSPECIFIED; @@ -23,7 +23,7 @@ LY_DEFINE (ly_prob_set_property_x, "ly:prob-set-property!", /* Hmm, this is not orthogonal. - */ +*/ LY_DEFINE (ly_prob_property_p, "ly:prob-property?", 2, 1, 0, (SCM obj, SCM sym), "Is boolean prop @var{sym} set?") @@ -35,9 +35,9 @@ LY_DEFINE (ly_prob_property, "ly:prob-property", 2, 1, 0, (SCM obj, SCM sym, SCM dfault), "Return the value for @var{sym}.") { + LY_ASSERT_SMOB (Prob, obj, 1); Prob *ps = unsmob_prob (obj); - SCM_ASSERT_TYPE (ps, obj, SCM_ARG1, __FUNCTION__, "Prob"); - SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol"); + LY_ASSERT_TYPE (ly_is_symbol,sym, 2); if (dfault == SCM_UNDEFINED) dfault = SCM_EOL; diff --git a/lily/program-option-scheme.cc b/lily/program-option-scheme.cc new file mode 100644 index 0000000000..fe0f290c27 --- /dev/null +++ b/lily/program-option-scheme.cc @@ -0,0 +1,244 @@ +/* + program-option-scheme.cc -- implement option setting from Scheme + + source file of the GNU LilyPond music typesetter + + (c) 2001--2007 Han-Wen Nienhuys +*/ + +#include "program-option.hh" + +#include +#include +using namespace std; + +#include "profile.hh" +#include "international.hh" +#include "main.hh" +#include "parse-scm.hh" +#include "string-convert.hh" +#include "warn.hh" + +bool debug_skylines; + +/* + Backwards compatibility. +*/ +bool lily_1_8_relative = false; +bool lily_1_8_compatibility_used = false; +bool profile_property_accesses = false; +/* + crash if internally the wrong type is used for a grob property. +*/ +bool do_internal_type_checking_global; +bool strict_infinity_checking = false; + +static SCM option_hash; + +void internal_set_option (SCM var, SCM val) +{ + scm_hashq_set_x (option_hash, var, val); + + if (0) + ; + else if (var == ly_symbol2scm ("profile-property-accesses")) + { + profile_property_accesses = to_boolean (val); + val = scm_from_bool (to_boolean (val)); + } + else if (var == ly_symbol2scm ("point-and-click")) + { + point_and_click_global = to_boolean (val); + val = scm_from_bool (to_boolean (val)); + } + else if (var == ly_symbol2scm ("protected-scheme-parsing")) + { + parse_protect_global = to_boolean (val); + val = scm_from_bool (to_boolean (val)); + } + else if (var == ly_symbol2scm ("check-internal-types")) + { + do_internal_type_checking_global = to_boolean (val); + val = scm_from_bool (to_boolean (val)); + } + else if (var == ly_symbol2scm ("debug-gc-assert-parsed-dead")) + { + parsed_objects_should_be_dead = to_boolean (val); + val = scm_from_bool (parsed_objects_should_be_dead); + } + else if (var == ly_symbol2scm ("safe")) + { + be_safe_global = to_boolean (val); + val = scm_from_bool (be_safe_global); + } + else if (var == ly_symbol2scm ("old-relative")) + { + lily_1_8_relative = to_boolean (val); + /* Needs to be reset for each file that uses this option. */ + lily_1_8_compatibility_used = to_boolean (val); + val = scm_from_bool (to_boolean (val)); + } + else if (var == ly_symbol2scm ("strict-infinity-checking")) + { + strict_infinity_checking = to_boolean (val); + val = scm_from_bool (to_boolean (val)); + } + else if (var == ly_symbol2scm ("debug-skylines")) + { + debug_skylines = to_boolean (val); + val = scm_from_bool (to_boolean (val)); + } +} + + + + +bool +get_program_option (const char *s) +{ + SCM sym = ly_symbol2scm (s); + + return to_boolean (ly_get_option (sym)); +} + + +ssize const HELP_INDENT = 30; +ssize const INDENT = 2; +ssize const SEPARATION = 5; + +/* + Hmmm. should do in SCM / C++ ? +*/ +static string +get_help_string () +{ + SCM alist = ly_hash2alist (option_hash); + SCM convertor = ly_lily_module_constant ("scm->string"); + + vector opts; + + for (SCM s = alist; scm_is_pair (s); s = scm_cdr (s)) + { + SCM sym = scm_caar (s); + SCM val = scm_cdar (s); + string opt_spec + = String_convert::char_string (' ', INDENT) + + ly_symbol2string (sym) + + " (" + + ly_scm2string (scm_call_1 (convertor, val)) + + ")"; + + if (opt_spec.length () + SEPARATION > HELP_INDENT) + { + opt_spec += "\n" + + String_convert::char_string (' ', HELP_INDENT); + } + else + opt_spec += String_convert::char_string (' ', HELP_INDENT - opt_spec.length ()); + + SCM opt_help_scm + = scm_object_property (sym, ly_symbol2scm ("program-option-documentation")); + string opt_help = ly_scm2string (opt_help_scm); + replace_all (opt_help, + string ("\n"), + string ("\n") + + String_convert::char_string (' ', HELP_INDENT)); + + opts.push_back (opt_spec + opt_help + "\n"); + } + + string help ("Options supported by ly:set-option\n\n"); + vector_sort (opts, less ()); + for (vsize i = 0; i < opts.size (); i++) + help += opts[i]; + + help += string ("\n"); + return help; +} + + +LY_DEFINE (ly_option_usage, "ly:option-usage", 0, 0, 0, (), + "Print @code{ly:set-option} usage") +{ + string help = get_help_string (); + progress_indication (help); + + return SCM_UNSPECIFIED; +} + +LY_DEFINE (ly_add_option, "ly:add-option", 3, 0, 0, + (SCM sym, SCM val, SCM description), + "Add a program option @var{sym} with default @var{val}.") +{ + if (!option_hash) + { + option_hash = scm_permanent_object (scm_c_make_hash_table (11)); + } + LY_ASSERT_TYPE (ly_is_symbol, sym, 1); + LY_ASSERT_TYPE (scm_is_string, description, 3); + + internal_set_option (sym, val); + + scm_set_object_property_x (sym, ly_symbol2scm ("program-option-documentation"), + description); + + return SCM_UNSPECIFIED; +} + +LY_DEFINE (ly_set_option, "ly:set-option", 1, 1, 0, (SCM var, SCM val), + "Set a program option.") +{ + LY_ASSERT_TYPE (ly_is_symbol, var, 1); + + if (val == SCM_UNDEFINED) + val = SCM_BOOL_T; + + string varstr = ly_scm2string (scm_symbol_to_string (var)); + if (varstr.substr (0, 3) == string ("no-")) + { + var = ly_symbol2scm (varstr.substr (3, varstr.length () -3).c_str ()); + val = scm_from_bool (!to_boolean (val)); + } + + SCM handle = scm_hashq_get_handle (option_hash, var); + if (handle == SCM_BOOL_F) + warning (_f ("no such internal option: %s", varstr.c_str ())); + + internal_set_option (var, val); + return SCM_UNSPECIFIED; +} + +LY_DEFINE (ly_command_line_options, "ly:command-line-options", 0, 0, 0, (), + "The Scheme specified on command-line with @samp{-d}.") +{ + return ly_string2scm (init_scheme_variables_global); +} + +LY_DEFINE (ly_command_line_code, "ly:command-line-code", 0, 0, 0, (), + "The Scheme specified on command-line with @samp{-e}.") +{ + return ly_string2scm (init_scheme_code_global); +} + +LY_DEFINE (ly_command_line_verbose_p, "ly:command-line-verbose?", 0, 0, 0, (), + "Was be_verbose_global set?") +{ + return scm_from_bool (be_verbose_global); +} + + + +LY_DEFINE (ly_all_options, "ly:all-options", + 0, 0, 0, (), + "Get all option settings in an alist.") +{ + return ly_hash2alist (option_hash); +} + + +LY_DEFINE (ly_get_option, "ly:get-option", 1, 0, 0, (SCM var), + "Get a global option setting.") +{ + LY_ASSERT_TYPE (ly_is_symbol, var, 1); + return scm_hashq_ref (option_hash, var, SCM_BOOL_F); +} diff --git a/lily/program-option.cc b/lily/program-option.cc index 5d9bebd738..e69de29bb2 100644 --- a/lily/program-option.cc +++ b/lily/program-option.cc @@ -1,250 +0,0 @@ -/* - scm-option.cc -- implement option setting from Scheme - - source file of the GNU LilyPond music typesetter - - (c) 2001--2007 Han-Wen Nienhuys -*/ - -#include "program-option.hh" - -#include -#include -using namespace std; - -#include "profile.hh" -#include "international.hh" -#include "main.hh" -#include "parse-scm.hh" -#include "string-convert.hh" -#include "warn.hh" - -bool debug_skylines; - -/* - Backwards compatibility. -*/ -bool lily_1_8_relative = false; -bool lily_1_8_compatibility_used = false; -bool profile_property_accesses = false; -/* - crash if internally the wrong type is used for a grob property. -*/ -bool do_internal_type_checking_global; -bool strict_infinity_checking = false; - -static SCM option_hash; - -void internal_set_option (SCM var, SCM val) -{ - scm_hashq_set_x (option_hash, var, val); - - if (0) - ; - else if (var == ly_symbol2scm ("profile-property-accesses")) - { - profile_property_accesses = to_boolean (val); - val = scm_from_bool (to_boolean (val)); - } - else if (var == ly_symbol2scm ("point-and-click")) - { - point_and_click_global = to_boolean (val); - val = scm_from_bool (to_boolean (val)); - } - else if (var == ly_symbol2scm ("protected-scheme-parsing")) - { - parse_protect_global = to_boolean (val); - val = scm_from_bool (to_boolean (val)); - } - else if (var == ly_symbol2scm ("check-internal-types")) - { - do_internal_type_checking_global = to_boolean (val); - val = scm_from_bool (to_boolean (val)); - } - else if (var == ly_symbol2scm ("debug-gc-assert-parsed-dead")) - { - parsed_objects_should_be_dead = to_boolean (val); - val = scm_from_bool (parsed_objects_should_be_dead); - } - else if (var == ly_symbol2scm ("safe")) - { - be_safe_global = to_boolean (val); - val = scm_from_bool (be_safe_global); - } - else if (var == ly_symbol2scm ("old-relative")) - { - lily_1_8_relative = to_boolean (val); - /* Needs to be reset for each file that uses this option. */ - lily_1_8_compatibility_used = to_boolean (val); - val = scm_from_bool (to_boolean (val)); - } - else if (var == ly_symbol2scm ("strict-infinity-checking")) - { - strict_infinity_checking = to_boolean (val); - val = scm_from_bool (to_boolean (val)); - } - else if (var == ly_symbol2scm ("debug-skylines")) - { - debug_skylines = to_boolean (val); - val = scm_from_bool (to_boolean (val)); - } -} - -ssize const HELP_INDENT = 30; -ssize const INDENT = 2; -ssize const SEPARATION = 5; - -/* - Hmmm. should do in SCM / C++ ? -*/ -static string -get_help_string () -{ - SCM alist = ly_hash2alist (option_hash); - SCM convertor = ly_lily_module_constant ("scm->string"); - - vector opts; - - for (SCM s = alist; scm_is_pair (s); s = scm_cdr (s)) - { - SCM sym = scm_caar (s); - SCM val = scm_cdar (s); - string opt_spec - = String_convert::char_string (' ', INDENT) - + ly_symbol2string (sym) - + " (" - + ly_scm2string (scm_call_1 (convertor, val)) - + ")"; - - if (opt_spec.length () + SEPARATION > HELP_INDENT) - { - opt_spec += "\n" - + String_convert::char_string (' ', HELP_INDENT); - } - else - opt_spec += String_convert::char_string (' ', HELP_INDENT - opt_spec.length ()); - - SCM opt_help_scm - = scm_object_property (sym, ly_symbol2scm ("program-option-documentation")); - string opt_help = ly_scm2string (opt_help_scm); - replace_all (opt_help, - string ("\n"), - string ("\n") - + String_convert::char_string (' ', HELP_INDENT)); - - opts.push_back (opt_spec + opt_help + "\n"); - } - - string help ("Options supported by ly:set-option\n\n"); - vector_sort (opts, less ()); - for (vsize i = 0; i < opts.size (); i++) - help += opts[i]; - - help += string ("\n"); - return help; -} - -LY_DEFINE (ly_option_usage, "ly:option-usage", 0, 0, 0, (), - "Print @code{ly:set-option} usage") -{ - string help = get_help_string (); - progress_indication (help); - - return SCM_UNSPECIFIED; -} - -LY_DEFINE (ly_add_option, "ly:add-option", 3, 0, 0, - (SCM sym, SCM val, SCM description), - "Add a program option @var{sym} with default @var{val}.") -{ - if (!option_hash) - { - option_hash = scm_permanent_object (scm_c_make_hash_table (11)); - } - SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG1, __FUNCTION__, "symbol"); - SCM_ASSERT_TYPE (scm_is_string (description), description, - SCM_ARG3, __FUNCTION__, "string"); - - internal_set_option (sym, val); - - scm_set_object_property_x (sym, ly_symbol2scm ("program-option-documentation"), - description); - - return SCM_UNSPECIFIED; -} - -LY_DEFINE (ly_set_option, "ly:set-option", 1, 1, 0, (SCM var, SCM val), - "Set a program option. Try setting 'help for a help string.") -{ - SCM_ASSERT_TYPE (scm_is_symbol (var), var, SCM_ARG1, - __FUNCTION__, "symbol"); - - if (ly_symbol2scm ("help") == var) - { - ly_option_usage (); - exit (0); - } - - if (val == SCM_UNDEFINED) - val = SCM_BOOL_T; - - string varstr = ly_scm2string (scm_symbol_to_string (var)); - if (varstr.substr (0, 3) == string ("no-")) - { - var = ly_symbol2scm (varstr.substr (3, varstr.length () -3).c_str ()); - val = scm_from_bool (!to_boolean (val)); - } - - SCM handle = scm_hashq_get_handle (option_hash, var); - if (handle == SCM_BOOL_F) - warning (_f ("no such internal option: %s", varstr.c_str ())); - - internal_set_option (var, val); - return SCM_UNSPECIFIED; -} - -LY_DEFINE (ly_command_line_options, "ly:command-line-options", 0, 0, 0, (), - "The Scheme specified on command-line with @samp{-d}.") -{ - return ly_string2scm (init_scheme_variables_global); -} - -LY_DEFINE (ly_command_line_code, "ly:command-line-code", 0, 0, 0, (), - "The Scheme specified on command-line with @samp{-e}.") -{ - return ly_string2scm (init_scheme_code_global); -} - -LY_DEFINE (ly_command_line_verbose_p, "ly:command-line-verbose?", 0, 0, 0, (), - "Was be_verbose_global set?") -{ - return scm_from_bool (be_verbose_global); -} - - - -LY_DEFINE (ly_all_option, "ly:all-options", - 0, 0, 0, (), - "Get all option settings in an alist.") -{ - return ly_hash2alist (option_hash); -} - - -LY_DEFINE (ly_get_option, "ly:get-option", 1, 0, 0, (SCM var), - "Get a global option setting.") -{ - SCM_ASSERT_TYPE (scm_is_symbol (var), var, - SCM_ARG1, __FUNCTION__, "symbol"); - return scm_hashq_ref (option_hash, var, SCM_BOOL_F); -} - - - -bool -get_program_option (const char *s) -{ - SCM sym = ly_symbol2scm (s); - - return to_boolean (ly_get_option (sym)); -} diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index b8ad86ba91..e470e9154c 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -41,7 +41,7 @@ Rest_collision::force_shift_callback (SCM smob) return scm_from_double (0.0); } -MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Rest_collision, force_shift_callback_rest, 2, 1); +MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Rest_collision, force_shift_callback_rest, 2, 1, ""); SCM Rest_collision::force_shift_callback_rest (SCM rest, SCM offset) { @@ -92,6 +92,9 @@ SCM Rest_collision::calc_positioning_done (SCM smob) { Grob *me = unsmob_grob (smob); + + me->set_property ("positioning-done", SCM_BOOL_T); + extract_grob_set (me, "elements", elts); vector rests; diff --git a/lily/scale.cc b/lily/scale.cc index c9fa8b7f22..0859c25dba 100644 --- a/lily/scale.cc +++ b/lily/scale.cc @@ -66,9 +66,9 @@ LY_DEFINE (ly_set_default_scale, "ly:set-default-scale", 1, 0, 0, (SCM scale), "Set the global default scale.") { - Scale *s = Scale::unsmob (scale); - SCM_ASSERT_TYPE (s, scale, SCM_ARG1, __FUNCTION__, "scale"); + LY_ASSERT_SMOB (Scale, scale, 1); + Scale *s = Scale::unsmob (scale); if (default_global_scale) default_global_scale->unprotect (); default_global_scale = s; diff --git a/lily/scheme-listener-scheme.cc b/lily/scheme-listener-scheme.cc index 5d46d7fc5b..004c14c14f 100644 --- a/lily/scheme-listener-scheme.cc +++ b/lily/scheme-listener-scheme.cc @@ -16,7 +16,7 @@ LY_DEFINE (ly_make_listener, "ly:make-listener", "\n" " @var{callback} should take exactly one argument." ) { - SCM_ASSERT_TYPE (ly_is_procedure (callback), callback, SCM_ARG1, __FUNCTION__, "procedure"); + LY_ASSERT_TYPE (ly_is_procedure, callback, 1); Scheme_listener *l = new Scheme_listener (callback); SCM listener = GET_LISTENER (l->call).smobbed_copy (); l->unprotect (); diff --git a/lily/score-scheme.cc b/lily/score-scheme.cc index eebdedbb95..4e08f46ae1 100644 --- a/lily/score-scheme.cc +++ b/lily/score-scheme.cc @@ -20,8 +20,8 @@ LY_DEFINE (ly_make_score, "ly:make-score", (SCM music), "Return score with @var{music} encapsulated in @var{score}.") { + LY_ASSERT_SMOB (Music, music, 1); Music *mus = unsmob_music (music); - SCM_ASSERT_TYPE (mus, music, SCM_ARG1, __FUNCTION__, "music"); Score *score = new Score; score->set_music (music); @@ -33,8 +33,8 @@ LY_DEFINE (ly_score_output_defs, "ly:score-output-defs", 1, 0, 0, (SCM score), "All output defs in a score.") { + LY_ASSERT_SMOB (Score, score, 1); Score *sc = unsmob_score (score); - SCM_ASSERT_TYPE (sc, score, SCM_ARG1, __FUNCTION__, "score"); SCM l = SCM_EOL; for (vsize i = 0; i < sc->defs_.size (); i++) @@ -48,8 +48,8 @@ LY_DEFINE (ly_score_header, "ly:score-header", 1, 0, 0, (SCM score), "return score header.") { + LY_ASSERT_SMOB (Score, score, 1); Score *sc = unsmob_score (score); - SCM_ASSERT_TYPE (sc, score, SCM_ARG1, __FUNCTION__, "score"); return sc->header_; } @@ -58,8 +58,8 @@ LY_DEFINE (ly_score_music, "ly:score-music", 1, 0, 0, (SCM score), "return score music.") { + LY_ASSERT_SMOB (Score, score, 1); Score *sc = unsmob_score (score); - SCM_ASSERT_TYPE (sc, score, SCM_ARG1, __FUNCTION__, "score"); return sc->get_music (); } @@ -67,8 +67,8 @@ LY_DEFINE (ly_score_error_p, "ly:score-error?", 1, 0, 0, (SCM score), "Was there an error in the score?") { + LY_ASSERT_SMOB (Score, score, 1); Score *sc = unsmob_score (score); - SCM_ASSERT_TYPE (sc, score, SCM_ARG1, __FUNCTION__, "score"); return scm_from_bool (sc->error_found_); } @@ -79,15 +79,15 @@ LY_DEFINE (ly_score_embedded_format, "ly:score-embedded-format", "return a list of layout-lines. " "\nTake optional Object_key argument.") { + LY_ASSERT_SMOB (Score, score, 1); + LY_ASSERT_SMOB (Output_def, layout, 2); + Score *sc = unsmob_score (score); Output_def *od = unsmob_output_def (layout); if (sc->error_found_) return SCM_EOL; - SCM_ASSERT_TYPE (sc, score, SCM_ARG1, __FUNCTION__, "Score"); - SCM_ASSERT_TYPE (od, layout, SCM_ARG2, __FUNCTION__, "Output_def"); - Output_def *score_def = 0; /* UGR, FIXME, these are default \layout blocks once again. They diff --git a/lily/self-aligment-interface.cc b/lily/self-aligment-interface.cc index ff089b6bbd..b990ff01c0 100644 --- a/lily/self-aligment-interface.cc +++ b/lily/self-aligment-interface.cc @@ -7,7 +7,9 @@ */ #include "self-alignment-interface.hh" + #include "warn.hh" +#include "paper-column.hh" #include "grob.hh" MAKE_SCHEME_CALLBACK (Self_alignment_interface, y_aligned_on_self, 1); @@ -92,6 +94,9 @@ SCM Self_alignment_interface::aligned_on_parent (Grob *me, Axis a) { Grob *him = me->get_parent (a); + if (Paper_column::has_interface (him)) + return scm_from_double (0.0); + Interval he = him->extent (him, a); SCM sym = (a == X_AXIS) ? ly_symbol2scm ("self-alignment-X") diff --git a/lily/semi-tie-column.cc b/lily/semi-tie-column.cc index c7d44a9568..ee18953aef 100644 --- a/lily/semi-tie-column.cc +++ b/lily/semi-tie-column.cc @@ -39,7 +39,9 @@ SCM Semi_tie_column::calc_positioning_done (SCM smob) { Grob *me = unsmob_grob (smob); - + + me->set_property ("positioning-done", SCM_BOOL_T); + extract_grob_set (me, "ties", lv_ro_ties); vector lv_ties (lv_ro_ties); diff --git a/lily/side-position-interface.cc b/lily/side-position-interface.cc index 0d56fe1868..ceee8a37cb 100644 --- a/lily/side-position-interface.cc +++ b/lily/side-position-interface.cc @@ -177,21 +177,21 @@ axis_aligned_side_helper (SCM smob, Axis a, bool pure, int start, int end, SCM c } -MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Side_position_interface, x_aligned_side, 2, 1); +MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Side_position_interface, x_aligned_side, 2, 1, ""); SCM Side_position_interface::x_aligned_side (SCM smob, SCM current_off) { return axis_aligned_side_helper (smob, X_AXIS, false, 0, 0, current_off); } -MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Side_position_interface, y_aligned_side, 2, 1); +MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Side_position_interface, y_aligned_side, 2, 1, ""); SCM Side_position_interface::y_aligned_side (SCM smob, SCM current_off) { return axis_aligned_side_helper (smob, Y_AXIS, false, 0, 0, current_off); } -MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Side_position_interface, pure_y_aligned_side, 4, 1); +MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Side_position_interface, pure_y_aligned_side, 4, 1, ""); SCM Side_position_interface::pure_y_aligned_side (SCM smob, SCM start, SCM end, SCM cur_off) { diff --git a/lily/simple-spacer-scheme.cc b/lily/simple-spacer-scheme.cc index 24b6d1c763..2e0f4ba9f7 100644 --- a/lily/simple-spacer-scheme.cc +++ b/lily/simple-spacer-scheme.cc @@ -28,9 +28,8 @@ LY_DEFINE (ly_solve_spring_rod_problem, "ly:solve-spring-rod-problem", return scm_list_2 (scm_from_double (0.0), scm_from_double (0.0)); SCM_ASSERT_TYPE (len >= 0, springs, SCM_ARG1, __FUNCTION__, "list of springs"); - SCM_ASSERT_TYPE (scm_ilength (rods) >= 0, rods, SCM_ARG2, __FUNCTION__, "list of rods"); - SCM_ASSERT_TYPE (scm_is_number (length) || length == SCM_BOOL_F, - length, SCM_ARG3, __FUNCTION__, "number or #f"); + SCM_ASSERT_TYPE (scm_ilength (rods) > 0, rods, SCM_ARG1, __FUNCTION__, "list of rods"); + LY_ASSERT_TYPE(scm_is_number, length, 3); bool is_ragged = ragged == SCM_BOOL_T; Simple_spacer spacer; diff --git a/lily/slur.cc b/lily/slur.cc index f3938b23d1..3b26af8beb 100644 --- a/lily/slur.cc +++ b/lily/slur.cc @@ -221,7 +221,7 @@ Slur::add_extra_encompass (Grob *me, Grob *n) Pointer_group_interface::add_grob (me, ly_symbol2scm ("encompass-objects"), n); } -MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Slur, pure_outside_slur_callback, 4, 1); +MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Slur, pure_outside_slur_callback, 4, 1, ""); SCM Slur::pure_outside_slur_callback (SCM grob, SCM start_scm, SCM end_scm, SCM offset_scm) { @@ -241,7 +241,7 @@ Slur::pure_outside_slur_callback (SCM grob, SCM start_scm, SCM end_scm, SCM offs return scm_from_double (offset + dir * slur->pure_height (slur, start, end).length () / 4); } -MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Slur, outside_slur_callback, 2, 1); +MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Slur, outside_slur_callback, 2, 1, ""); SCM Slur::outside_slur_callback (SCM grob, SCM offset_scm) { diff --git a/lily/spanner-scheme.cc b/lily/spanner-scheme.cc index e5a33e0c4b..ec70ba6817 100644 --- a/lily/spanner-scheme.cc +++ b/lily/spanner-scheme.cc @@ -10,15 +10,15 @@ #include "spanner.hh" #include "item.hh" -LY_DEFINE (ly_spanner_get_bound, "ly:spanner-bound", +LY_DEFINE (ly_spanner_bound, "ly:spanner-bound", 2, 0, 0, (SCM slur, SCM dir), "Get one of the bounds of @var{spanner}. @var{dir} is @code{-1} " "for left, and @code{1} for right.") { - Spanner *sl = dynamic_cast (unsmob_grob (slur)); - SCM_ASSERT_TYPE (sl, slur, SCM_ARG1, __FUNCTION__, "spanner grob"); - SCM_ASSERT_TYPE (is_direction (dir), slur, SCM_ARG2, __FUNCTION__, "dir"); - return sl->get_bound (to_dir (dir))->self_scm (); + LY_ASSERT_TYPE (unsmob_spanner, slur, 1); + LY_ASSERT_TYPE(is_direction, dir,2); + + return unsmob_spanner (slur)->get_bound (to_dir (dir))->self_scm (); } /* TODO: maybe we should return a vector -- random access is more @@ -27,8 +27,8 @@ LY_DEFINE (ly_spanner_broken_into, "ly:spanner-broken-into", 1, 0, 0, (SCM spanner), "Return broken-into list for @var{spanner}.") { + LY_ASSERT_TYPE (unsmob_spanner, spanner, 1); Spanner *me = dynamic_cast (unsmob_grob (spanner)); - SCM_ASSERT_TYPE (me, spanner, SCM_ARG1, __FUNCTION__, "spanner"); SCM s = SCM_EOL; for (vsize i = me->broken_intos_.size (); i--;) diff --git a/lily/staff-symbol-referencer-scheme.cc b/lily/staff-symbol-referencer-scheme.cc index ec12f1639b..8e0094f143 100644 --- a/lily/staff-symbol-referencer-scheme.cc +++ b/lily/staff-symbol-referencer-scheme.cc @@ -14,9 +14,8 @@ LY_DEFINE (ly_grob_staff_position, "ly:grob-staff-position", 1, 0, 0, (SCM sg), "Return the Y-position of @var{sg} relative to the staff.") { + LY_ASSERT_SMOB (Grob, sg, 1); Grob *g = unsmob_grob (sg); - - SCM_ASSERT_TYPE (g, sg, SCM_ARG1, __FUNCTION__, "grob"); Real pos = Staff_symbol_referencer::get_position (g); if (fabs (rint (pos) -pos) < 1e-6) // ugh. diff --git a/lily/stem.cc b/lily/stem.cc index dd247b4baa..09786b750b 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -414,6 +414,8 @@ Stem::calc_positioning_done (SCM smob) if (!head_count (me)) return SCM_BOOL_T; + me->set_property ("positioning-done", SCM_BOOL_T); + extract_grob_set (me, "note-heads", ro_heads); vector heads (ro_heads); vector_sort (heads, position_less); @@ -559,13 +561,11 @@ SCM Stem::height (SCM smob) { Grob *me = unsmob_grob (smob); - + if (!is_normal_stem (me)) + return ly_interval2scm (Interval ()); + Direction dir = get_grob_direction (me); - /* Trigger callback. - - UGH. Should be automatic - */ Grob *beam = get_beam (me); if (beam) { @@ -912,10 +912,14 @@ Stem::calc_stem_info (SCM smob) Real height_of_my_trem = 0.0; Grob *trem = unsmob_grob (me->get_object ("tremolo-flag")); if (trem) - height_of_my_trem = trem->extent (trem, Y_AXIS).length () + { + height_of_my_trem + = Stem_tremolo::vertical_length (trem) /* hack a bit of space around the trem. */ + beam_translation; + } + /* UGH It seems that also for ideal minimum length, we must use the maximum beam count (for this direction): diff --git a/lily/stencil-scheme.cc b/lily/stencil-scheme.cc index 6ef0e191fd..90a82ec466 100644 --- a/lily/stencil-scheme.cc +++ b/lily/stencil-scheme.cc @@ -16,37 +16,31 @@ TODO: naming add/combine. */ -LY_DEFINE (ly_translate_stencil_axis, "ly:stencil-translate-axis", +LY_DEFINE (ly_stencil_translate_axis, "ly:stencil-translate-axis", 3, 0, 0, (SCM stil, SCM amount, SCM axis), "Return a copy of @var{stil} but translated by @var{amount} in @var{axis} direction.") { Stencil *s = unsmob_stencil (stil); - SCM_ASSERT_TYPE (s, stil, SCM_ARG1, __FUNCTION__, "stencil"); - SCM_ASSERT_TYPE (scm_is_number (amount), amount, SCM_ARG2, __FUNCTION__, "number"); + LY_ASSERT_SMOB (Stencil, stil, 1); + LY_ASSERT_TYPE(scm_is_number,amount, 2); + LY_ASSERT_TYPE(is_axis,axis, 3); Real real_amount = scm_to_double (amount); -#if 0 - SCM_ASSERT_TYPE (!isinf (real_amount) && !isnan (real_amount), - amount, SCM_ARG2, __FUNCTION__, "finite number"); -#endif - - SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis"); - SCM new_s = s->smobbed_copy (); Stencil *q = unsmob_stencil (new_s); q->translate_axis (real_amount, Axis (scm_to_int (axis))); return new_s; } -LY_DEFINE (ly_translate_stencil, "ly:stencil-translate", +LY_DEFINE (ly_stencil_translate, "ly:stencil-translate", 2, 0, 0, (SCM stil, SCM offset), "Return a @var{stil}, " "but translated by @var{offset} (a pair of numbers).") { Stencil *s = unsmob_stencil (stil); - SCM_ASSERT_TYPE (s, stil, SCM_ARG1, __FUNCTION__, "stencil"); - SCM_ASSERT_TYPE (is_number_pair (offset), offset, SCM_ARG2, __FUNCTION__, "number pair"); + LY_ASSERT_SMOB (Stencil, stil, 1); + LY_ASSERT_TYPE(is_number_pair, offset, 2); Offset o = ly_scm2offset (offset); SCM new_s = s->smobbed_copy (); @@ -60,7 +54,7 @@ LY_DEFINE (ly_stencil_expr, "ly:stencil-expr", "Return the expression of @var{stil}.") { Stencil *s = unsmob_stencil (stil); - SCM_ASSERT_TYPE (s, stil, SCM_ARG1, __FUNCTION__, "stencil"); + LY_ASSERT_SMOB (Stencil, stil, 1); return s->expr (); } @@ -70,8 +64,8 @@ LY_DEFINE (ly_stencil_extent, "ly:stencil-extent", "@var{axis} direction (0 or 1 for x and y axis respectively).") { Stencil *s = unsmob_stencil (stil); - SCM_ASSERT_TYPE (s, stil, SCM_ARG1, __FUNCTION__, "stencil"); - SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG2, __FUNCTION__, "axis"); + LY_ASSERT_SMOB (Stencil, stil, 1); + LY_ASSERT_TYPE(is_axis, axis, 2); return ly_interval2scm (s->extent (Axis (scm_to_int (axis)))); } @@ -81,7 +75,7 @@ LY_DEFINE (ly_stencil_empty_p, "ly:stencil-empty?", "Return whether @var{stil} is empty ") { Stencil *s = unsmob_stencil (stil); - SCM_ASSERT_TYPE (s, stil, SCM_ARG1, __FUNCTION__, "stencil"); + LY_ASSERT_SMOB (Stencil, stil, 1); return scm_from_bool (s->is_empty ()); } @@ -106,19 +100,19 @@ LY_DEFINE (ly_stencil_combine_at_edge, "ly:stencil-combine-at-edge", first, SCM_ARG1, __FUNCTION__, "Stencil, #f or ()"); SCM_ASSERT_TYPE (s2 || second == SCM_BOOL_F || second == SCM_EOL, second, SCM_ARG4, __FUNCTION__, "Stencil, #f or ()"); - SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG2, __FUNCTION__, "axis"); - SCM_ASSERT_TYPE (is_direction (direction), direction, SCM_ARG3, __FUNCTION__, "dir"); + LY_ASSERT_TYPE(is_axis, axis, 2); + LY_ASSERT_TYPE(is_direction, direction, 3); Real p = 0.0; if (padding != SCM_UNDEFINED) { - SCM_ASSERT_TYPE (scm_is_number (padding), padding, SCM_ARG5, __FUNCTION__, "number"); + LY_ASSERT_TYPE(scm_is_number, padding, 5); p = scm_to_double (padding); } Real m = 0.0; if (minimum != SCM_UNDEFINED) { - SCM_ASSERT_TYPE (scm_is_number (minimum), minimum, SCM_ARG6, __FUNCTION__, "number"); + LY_ASSERT_TYPE(scm_is_number, minimum, 6); m = scm_to_double (minimum); } @@ -180,14 +174,14 @@ LY_DEFINE (ly_make_stencil, "ly:make-stencil", Interval x; if (xext != SCM_UNDEFINED) { - SCM_ASSERT_TYPE (is_number_pair (xext), xext, SCM_ARG2, __FUNCTION__, "number pair"); + LY_ASSERT_TYPE(is_number_pair, xext, 2); x = ly_scm2interval (xext); } Interval y; if (yext != SCM_UNDEFINED) { - SCM_ASSERT_TYPE (is_number_pair (yext), yext, SCM_ARG3, __FUNCTION__, "number pair"); + LY_ASSERT_TYPE(is_number_pair,yext, 3); y = ly_scm2interval (yext); } @@ -202,9 +196,9 @@ LY_DEFINE (ly_stencil_aligned_to, "ly:stencil-aligned-to", "@var{dir} is a number -1, 1 are left and right respectively. " "Other values are interpolated (so 0 means the center).") { - SCM_ASSERT_TYPE (unsmob_stencil (stil), stil, SCM_ARG1, __FUNCTION__, "stencil"); - SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG2, __FUNCTION__, "axis"); - SCM_ASSERT_TYPE (scm_is_number (dir), dir, SCM_ARG3, __FUNCTION__, "number"); + LY_ASSERT_SMOB (Stencil, stil, 1); + LY_ASSERT_TYPE(is_axis,axis, 2); + LY_ASSERT_TYPE(scm_is_number, dir, 3); Stencil target = *unsmob_stencil (stil); @@ -217,8 +211,8 @@ LY_DEFINE (ly_stencil_fonts, "ly:stencil-fonts", 1, 0, 0, (SCM s), " Analyse @var{s}, and return a list of fonts used in @var{s}.") { + LY_ASSERT_SMOB (Stencil, s, 1); Stencil *stil = unsmob_stencil (s); - SCM_ASSERT_TYPE (stil, s, SCM_ARG1, __FUNCTION__, "Stencil"); return find_expression_fonts (stil->expr ()); } @@ -226,8 +220,8 @@ LY_DEFINE (ly_stencil_in_color, "ly:stencil-in-color", 4, 0, 0, (SCM stc, SCM r, SCM g, SCM b), "Put @var{stc} in a different color.") { + LY_ASSERT_SMOB (Stencil, stc, 1); Stencil *stil = unsmob_stencil (stc); - SCM_ASSERT_TYPE (stil, stc, SCM_ARG1, __FUNCTION__, "Stencil"); return Stencil (stil->extent_box (), scm_list_3 (ly_symbol2scm ("color"), scm_list_3 (r, g, b), @@ -250,8 +244,7 @@ LY_DEFINE (ly_interpret_stencil_expression, "ly:interpret-stencil-expression", 4, 0, 0, (SCM expr, SCM func, SCM arg1, SCM offset), "Parse EXPR, feed bits to FUNC with first arg ARG1") { - SCM_ASSERT_TYPE (ly_is_procedure (func), func, SCM_ARG1, __FUNCTION__, - "procedure"); + LY_ASSERT_TYPE (ly_is_procedure, func, 2); Stencil_interpret_arguments a; a.func = func; @@ -270,10 +263,10 @@ LY_DEFINE (ly_bracket, "ly:bracket", "given by @var{iv}. The wings protude by an amount of @var{p}, which " "may be negative. The thickness is given by @var{t}.") { - SCM_ASSERT_TYPE (is_axis (a), a, SCM_ARG1, __FUNCTION__, "axis"); - SCM_ASSERT_TYPE (is_number_pair (iv), iv, SCM_ARG2, __FUNCTION__, "number pair"); - SCM_ASSERT_TYPE (scm_is_number (t), a, SCM_ARG3, __FUNCTION__, "number"); - SCM_ASSERT_TYPE (scm_is_number (p), a, SCM_ARG4, __FUNCTION__, "number"); + LY_ASSERT_TYPE (is_axis, a, 1); + LY_ASSERT_TYPE(is_number_pair,iv, 2); + LY_ASSERT_TYPE(scm_is_number, t,3); + LY_ASSERT_TYPE(scm_is_number, p,4); return Lookup::bracket ((Axis)scm_to_int (a), ly_scm2interval (iv), scm_to_double (t), @@ -281,15 +274,15 @@ LY_DEFINE (ly_bracket, "ly:bracket", 0.95 * scm_to_double (t)).smobbed_copy (); } -LY_DEFINE (ly_rotate_stencil, "ly:stencil-rotate", +LY_DEFINE (ly_stencil_rotate, "ly:stencil-rotate", 4, 0, 0, (SCM stil, SCM angle, SCM x, SCM y), "Return a @var{stil} rotated @var{angle} degrees around point (@var{x}, @var{y}).") { Stencil *s = unsmob_stencil (stil); - SCM_ASSERT_TYPE (s, stil, SCM_ARG1, __FUNCTION__, "stencil"); - SCM_ASSERT_TYPE (scm_is_number (angle), angle, SCM_ARG2, __FUNCTION__, "number"); - SCM_ASSERT_TYPE (scm_is_number (x), x, SCM_ARG3, __FUNCTION__, "number"); - SCM_ASSERT_TYPE (scm_is_number (y), y, SCM_ARG4, __FUNCTION__, "number"); + LY_ASSERT_SMOB (Stencil, stil, 1); + LY_ASSERT_TYPE(scm_is_number,angle, 2); + LY_ASSERT_TYPE(scm_is_number, x,3); + LY_ASSERT_TYPE(scm_is_number, y, 4); Real a = scm_to_double (angle); Real x_off = scm_to_double (x); Real y_off = scm_to_double (y); @@ -300,16 +293,16 @@ LY_DEFINE (ly_rotate_stencil, "ly:stencil-rotate", return new_s; } -LY_DEFINE (ly_filled_box, "ly:round-filled-box", +LY_DEFINE (ly_round_filled_box, "ly:round-filled-box", 3, 0, 0, (SCM xext, SCM yext, SCM blot), "Make a @code{Stencil} " "that prints a black box of dimensions @var{xext}, " "@var{yext} and roundness @var{blot}.") { - SCM_ASSERT_TYPE (is_number_pair (xext), xext, SCM_ARG1, __FUNCTION__, "number pair"); - SCM_ASSERT_TYPE (is_number_pair (yext), yext, SCM_ARG2, __FUNCTION__, "number pair"); - SCM_ASSERT_TYPE (scm_is_number (blot), blot, SCM_ARG3, __FUNCTION__, "number"); + LY_ASSERT_TYPE (is_number_pair, xext, 1); + LY_ASSERT_TYPE(is_number_pair, yext, 2); + LY_ASSERT_TYPE(scm_is_number, blot, 3); return Lookup::round_filled_box (Box (ly_scm2interval (xext), ly_scm2interval (yext)), scm_to_double (blot)).smobbed_copy (); @@ -320,8 +313,7 @@ LY_DEFINE (ly_register_stencil_expression, "ly:register-stencil-expression", (SCM symbol), "Add @var{symbol} as head of a stencil expression") { - SCM_ASSERT_TYPE (scm_is_symbol (symbol), symbol, - SCM_ARG1, __FUNCTION__, "Symbol"); + LY_ASSERT_TYPE (ly_is_symbol, symbol, 1); register_stencil_head (symbol); return SCM_UNSPECIFIED; } diff --git a/lily/stencil.cc b/lily/stencil.cc index 12bbf4ea12..59e88398f2 100644 --- a/lily/stencil.cc +++ b/lily/stencil.cc @@ -76,14 +76,17 @@ Stencil::extent_box () const void Stencil::rotate (Real a, Offset off) { - rotate_degrees (a *180/M_PI, off); + rotate_degrees (a * 180/M_PI, off); } /* - Rotate this stencil around the point [x, y] + Rotate this stencil around the point RELATIVE_OFF. + + RELATIVE_OFF is measured in terms of the extent of the stencil, so + -1 = LEFT/DOWN edge, 1 = RIGHT/UP edge. */ void -Stencil::rotate_degrees (Real a, Offset off) +Stencil::rotate_degrees (Real a, Offset relative_off) { const Real x_cen = extent (X_AXIS).center (); const Real y_cen = extent (Y_AXIS).center (); @@ -91,8 +94,8 @@ Stencil::rotate_degrees (Real a, Offset off) /* * Calculate the center of rotation */ - const Real x = x_cen + off[X_AXIS] * x_cen; - const Real y = y_cen + off[Y_AXIS] * y_cen; + const Real x = x_cen + relative_off[X_AXIS] * x_cen; + const Real y = y_cen + relative_off[Y_AXIS] * y_cen; /* * Build scheme expression (processed in stencil-interpret.cc) diff --git a/lily/stream-event-scheme.cc b/lily/stream-event-scheme.cc index e6e4fb7dc6..68aedd5497 100644 --- a/lily/stream-event-scheme.cc +++ b/lily/stream-event-scheme.cc @@ -12,10 +12,10 @@ LY_DEFINE (ly_make_stream_event, "ly:make-stream-event", 1, 1, 0, (SCM cl, SCM proplist), "Creates a stream event of class @var{cl} with the given mutable property list.\n" ) { - SCM_ASSERT_TYPE (scm_is_symbol (cl), cl, SCM_ARG1, __FUNCTION__, "symbol"); + LY_ASSERT_TYPE (ly_is_symbol, cl, 1); /* should be scm_list_p, but scm_list_p is expensive. */ - SCM_ASSERT_TYPE (scm_is_pair (proplist), proplist, SCM_ARG2, __FUNCTION__, "association list"); + LY_ASSERT_TYPE(scm_is_pair, proplist, 2); if (proplist == SCM_UNDEFINED) proplist = SCM_EOL; @@ -29,18 +29,21 @@ LY_DEFINE (ly_event_property, "ly:event-property", "Get the property @var{sym} of stream event @var{mus}.\n" "If @var{sym} is undefined, return @code{'()}.\n") { + LY_ASSERT_SMOB (Stream_event, sev, 1); + LY_ASSERT_TYPE (ly_is_symbol, sym, 2); + Stream_event *e = unsmob_stream_event (sev); - SCM_ASSERT_TYPE (e, sev, SCM_ARG1, __FUNCTION__, "stream event"); - SCM_ASSERT_TYPE (scm_is_symbol (sym), sym, SCM_ARG2, __FUNCTION__, "symbol"); return e->internal_get_property (sym); } -LY_DEFINE (ly_event_set_property, "ly:event-set-property!", +LY_DEFINE (ly_event_set_property_x, "ly:event-set-property!", 3, 0, 0, (SCM ev, SCM sym, SCM val), - "Set property @var{sym} in event @var{ev} to @var{val}."){ - Stream_event *sc = unsmob_stream_event (ev); - SCM_ASSERT_TYPE (sc, ev, SCM_ARG1, __FUNCTION__, "event"); + "Set property @var{sym} in event @var{ev} to @var{val}.") +{ + LY_ASSERT_SMOB (Stream_event, ev, 1); + LY_ASSERT_TYPE (ly_is_symbol, sym, 2); + return ly_prob_set_property_x (ev, sym, val); } diff --git a/lily/text-interface.cc b/lily/text-interface.cc index eec8150894..55e7bb7ec4 100644 --- a/lily/text-interface.cc +++ b/lily/text-interface.cc @@ -25,20 +25,25 @@ Text_interface::interpret_string (SCM layout_smob, SCM props, SCM markup) { - Output_def *layout = unsmob_output_def (layout_smob); - - SCM_ASSERT_TYPE (layout, layout_smob, SCM_ARG1, - __FUNCTION__, "Layout definition"); - SCM_ASSERT_TYPE (scm_is_string (markup), markup, SCM_ARG3, - __FUNCTION__, "string"); + LY_ASSERT_SMOB (Output_def, layout_smob, 1); + LY_ASSERT_TYPE (scm_is_string, markup, 3); string str = ly_scm2string (markup); - + Output_def *layout = unsmob_output_def (layout_smob); Font_metric *fm = select_encoded_font (layout, props); return fm->word_stencil (str).smobbed_copy (); } -MAKE_SCHEME_CALLBACK (Text_interface, interpret_markup, 3); +MAKE_SCHEME_CALLBACK_WITH_OPTARGS (Text_interface, interpret_markup, 3, 0, + "Convert a text markup into a stencil. " +"Takes 3 arguments, @var{layout}, @var{props} and @var{markup}. " +"\n\n" +"@var{layout} is a @code{\\layout} block; it may be obtained from a grob with " +"@code{ly:grob-layout}. @var{props} is a alist chain, ie. a list of alists. " +"This is typically obtained with " +"@code{(ly:grob-alist-chain (ly:layout-lookup layout 'text-font-defaults))}. " +"@var{markup} is the markup text to be processed. " + ); SCM Text_interface::interpret_markup (SCM layout_smob, SCM props, SCM markup) { @@ -92,7 +97,13 @@ Text_interface::is_markup (SCM x) } ADD_INTERFACE (Text_interface, - "A scheme markup text, see @usermanref{Text markup}.", + "A scheme markup text, see @usermanref{Text markup} and " + "@usermanref{New markup command definition}. " + "\n\n" + "There are two important commands: ly:text-interface::print, which is a " + "grob callback, and ly:text-interface::interpret-markup ", + + /* props */ "baseline-skip " "text " "word-space " diff --git a/lily/text-spanner-engraver.cc b/lily/text-spanner-engraver.cc index 0b9f3e4a67..f7b2576d85 100644 --- a/lily/text-spanner-engraver.cc +++ b/lily/text-spanner-engraver.cc @@ -122,7 +122,12 @@ Text_spanner_engraver::finalize () } ADD_TRANSLATOR (Text_spanner_engraver, - /* doc */ "Create text spanner from an event.", - /* create */ "TextSpanner", - /* read */ "", - /* write */ ""); + /* doc */ + "Create text spanner from an event.", + /* create */ + "TextSpanner ", + /* read */ + "", + /* write */ + "" + ); diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc deleted file mode 100644 index e98ae0f7df..0000000000 --- a/lily/text-spanner.cc +++ /dev/null @@ -1,178 +0,0 @@ -/* - text-spanner.cc -- implement Text_spanner - - source file of the GNU LilyPond music typesetter - - (c) 2000--2007 Jan Nieuwenhuizen - - Revised over good by Han-Wen. -*/ - -#include "text-spanner.hh" - -#include "text-interface.hh" -#include "line-spanner.hh" -#include "spanner.hh" -#include "font-interface.hh" -#include "dimensions.hh" -#include "output-def.hh" -#include "warn.hh" -#include "paper-column.hh" -#include "staff-symbol-referencer.hh" - -/* - TODO: - - vertical start / vertical end (fixme-name) | - - contination types (vert. star, vert. end) |-> eat volta-bracket - - more styles - - more texts/positions -*/ - -MAKE_SCHEME_CALLBACK (Text_spanner, print, 1); - -/* - TODO: this function is too long -*/ -SCM -Text_spanner::print (SCM smob) -{ - Grob *me = unsmob_grob (smob); - Spanner *spanner = dynamic_cast (me); - - /* Ugh, must be same as Hairpin::print. */ - - Grob *common = spanner->get_bound (LEFT)->common_refpoint (spanner->get_bound (RIGHT), X_AXIS); - Output_def *layout = me->layout (); - - SCM flare = me->get_property ("bracket-flare"); - SCM shorten = me->get_property ("shorten-pair"); - - Interval span_points; - Drul_array broken; - Direction d = LEFT; - do - { - Item *b = spanner->get_bound (d); - broken[d] = b->break_status_dir () != CENTER; - - if (broken[d]) - { - if (d == LEFT) - span_points[d] = spanner->get_broken_left_end_align (); - else - span_points[d] = b->relative_coordinate (common, X_AXIS); - } - else - { - Real encl = robust_scm2double (me->get_property ("enclose-bounds"), 0.0); - Interval ext = b->extent (common, X_AXIS); - - span_points[d] - = robust_relative_extent (b, common, X_AXIS).linear_combination (d * encl); - - if (is_number_pair (shorten)) - span_points -= d * scm_to_double (index_get_cell (shorten, d)); - } - - if (is_number_pair (flare)) - span_points -= d * scm_to_double (index_get_cell (flare, d)); - } - while (flip (&d) != LEFT); - - SCM properties = Font_interface::text_font_alist_chain (me); - SCM edge_text = me->get_property ("edge-text"); - Drul_array edge; - if (scm_is_pair (edge_text)) - { - Direction d = LEFT; - do - { - if (broken[d]) - continue; - - SCM text = index_get_cell (edge_text, d); - - if (Text_interface::is_markup (text)) - edge[d] = *unsmob_stencil (Text_interface::interpret_markup (layout->self_scm (), properties, text)); - - if (!edge[d].is_empty ()) - edge[d].align_to (Y_AXIS, CENTER); - } - while (flip (&d) != LEFT); - } - - Drul_array edge_height = robust_scm2interval (me->get_property ("edge-height"), - Interval (0.0, 0.0)); - Drul_array edge_line; - { - Direction d = LEFT; - int dir = to_dir (me->get_property ("direction")); - do - { - if (broken[d]) - continue; - - Real dx = 0.0; - if (is_number_pair (flare)) - dx = scm_to_double (index_get_cell (flare, d)) * d; - - Real dy = -dir * edge_height[d]; - if (dy) - edge_line[d] = Line_spanner::line_stencil (me, Offset (0, 0), Offset (dx, dy)); - } - while (flip (&d) != LEFT); - } - - Stencil m; - do - { - Interval ext = edge[d].extent (X_AXIS); - if (!ext.is_empty ()) - { - Real pad = robust_scm2double (me->get_property ("bound-padding"), 0.0); - edge[d].translate_axis (span_points[d], X_AXIS); - m.add_stencil (edge[d]); - span_points[d] += -d * (ext[-d] + pad); - } - } - while (flip (&d) != LEFT); - - do - { - if (d * span_points[d] > d * edge[-d].extent (X_AXIS)[d]) - { - edge_line[d].translate_axis (span_points[d], X_AXIS); - m.add_stencil (edge_line[d]); - } - } - while (flip (&d) != LEFT); - - - if (!span_points.is_empty () - && span_points.length () > robust_scm2double (me->get_property ("dash-period"), 0.0)) - { - Stencil l = Line_spanner::line_stencil (me, - Offset (span_points[LEFT], 0), - Offset (span_points[RIGHT], 0)); - m.add_stencil (l); - } - m.translate_axis (- me->relative_coordinate (common, X_AXIS), X_AXIS); - return m.smobbed_copy (); -} - -ADD_INTERFACE (Text_spanner, - - "generic text spanner", - - "bound-padding " - "bracket-flare " - "dash-fraction " - "dash-period " - "edge-height " - "edge-text " - "enclose-bounds " - "shorten-pair " - "style " - "thickness " - ); - diff --git a/lily/tie-column.cc b/lily/tie-column.cc index 9eefbbf8ee..b54428d986 100644 --- a/lily/tie-column.cc +++ b/lily/tie-column.cc @@ -79,6 +79,9 @@ Tie_column::calc_positioning_done (SCM smob) if (!ties.size ()) return SCM_BOOL_T; + + me->set_property ("positioning-done", SCM_BOOL_T); + vector_sort (ties, Tie::less); Tie_formatting_problem problem; diff --git a/lily/translator-scheme.cc b/lily/translator-scheme.cc index 3b2604fe18..31e7afa92e 100644 --- a/lily/translator-scheme.cc +++ b/lily/translator-scheme.cc @@ -15,8 +15,8 @@ LY_DEFINE (ly_translator_name, "ly:translator-name", "Return the type name of the translator object @var{trans}. " "The name is a symbol.") { + LY_ASSERT_SMOB (Translator, trans, 1); Translator *tr = unsmob_translator (trans); - SCM_ASSERT_TYPE (tr, trans, SCM_ARG1, __FUNCTION__, "Translator"); char const *nm = tr->class_name (); return ly_symbol2scm (nm); } @@ -25,8 +25,8 @@ LY_DEFINE (ly_translator_description, "ly:translator-description", 1, 0, 0, (SCM me), "Return an alist of properties of translator @var{me}.") { + LY_ASSERT_SMOB (Translator, me, 1); Translator *tr = unsmob_translator (me); - SCM_ASSERT_TYPE (tr, me, SCM_ARG1, __FUNCTION__, "Translator"); return tr->translator_description (); } diff --git a/lily/trill-spanner-engraver.cc b/lily/trill-spanner-engraver.cc index 8e56784812..d2ef7e1eb8 100644 --- a/lily/trill-spanner-engraver.cc +++ b/lily/trill-spanner-engraver.cc @@ -128,6 +128,7 @@ Trill_spanner_engraver::finalize () ADD_TRANSLATOR (Trill_spanner_engraver, /* doc */ "Create trill spanner from an event.", - /* create */ "TrillSpanner", + /* create */ + "TrillSpanner ", /* read */ "", /* write */ ""); diff --git a/lily/ttf.cc b/lily/ttf.cc index 26deb0841b..574d1464af 100644 --- a/lily/ttf.cc +++ b/lily/ttf.cc @@ -223,8 +223,7 @@ LY_DEFINE (ly_ttf_ps_name, "ly:ttf-ps-name", 1, 0, 0, (SCM ttf_file_name), "Extract the PostScript name from a TrueType font.") { - SCM_ASSERT_TYPE (scm_is_string (ttf_file_name), ttf_file_name, - SCM_ARG1, __FUNCTION__, "string"); + LY_ASSERT_TYPE (scm_is_string, ttf_file_name, 1); string file_name = ly_scm2string (ttf_file_name); if (be_verbose_global) progress_indication ("[" + file_name); @@ -243,13 +242,12 @@ LY_DEFINE (ly_ttf_ps_name, "ly:ttf-ps-name", -LY_DEFINE (ly_ttf_to_pfa, "ly:ttf->pfa", +LY_DEFINE (ly_ttf_2_pfa, "ly:ttf->pfa", 1, 0, 0, (SCM ttf_file_name), "Convert the contents of a TTF file to Type42 PFA, returning it as " " a string.") { - SCM_ASSERT_TYPE (scm_is_string (ttf_file_name), ttf_file_name, - SCM_ARG1, __FUNCTION__, "string"); + LY_ASSERT_TYPE (scm_is_string, ttf_file_name, 1); string file_name = ly_scm2string (ttf_file_name); if (be_verbose_global) diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index ddcced5c46..0f8560c810 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -756,10 +756,7 @@ AncientRemoveEmptyStaffContext = \context { %% \override TextSpanner #'dash-fraction = #'() \override TextSpanner #'style = #'line - \override TextSpanner #'edge-height = #'(0 . 0) \override TextSpanner #'padding = #-0.1 - \override TextSpanner #'enclose-bounds = #1 - \override TextSpanner #'edge-text = #'("" . "") } \context { @@ -830,10 +827,7 @@ AncientRemoveEmptyStaffContext = \context { %% \override TextSpanner #'dash-fraction = #'() \override TextSpanner #'style = #'line - \override TextSpanner #'edge-height = #'(0 . 0) \override TextSpanner #'padding = #-0.1 - \override TextSpanner #'enclose-bounds = #1 - \override TextSpanner #'edge-text = #'("" . "") } \context { diff --git a/make/lilypond.fedora.spec.in b/make/lilypond.fedora.spec.in deleted file mode 100644 index fafd9cd376..0000000000 --- a/make/lilypond.fedora.spec.in +++ /dev/null @@ -1,200 +0,0 @@ -# -*-rpm-spec-mode-*- - -%define info yes -%define docdir %{_docdir}/lilypond/ - -Name: lilypond -Version: @TOPLEVEL_VERSION@ -Release: 1 -License: GPL -Group: Applications/Publishing -Source0: http://lilypond.org/download/development/lilypond-@TOPLEVEL_VERSION@.tar.gz -Summary: Create and print music notation -URL: http://lilypond.org/ -BuildRoot: %{_tmppath}/%{name}-%{version}-root - - -Buildrequires: t1utils bison flex mftrace ImageMagick -Buildrequires: texinfo >= 4.7 -Buildrequires: guile-devel >= 1.6.4-8 -Buildrequires: freetype-devel >= 2.1 - -Buildrequires: fontforge -#fontforge must be >= 20041211 urg. 0.0.0-fdr.1.20041211 - -Buildrequires: pango-devel >= 1.6.0 -Buildrequires: fontconfig-devel - -Requires: libstdc++ python -Requires: guile >= 1.6.4-8 ghostscript >= 8.15 - -%description -LilyPond lets you create music notation. It produces -beautiful sheet music from a high-level description file. - -%package documentation -Summary: All LilyPond documentation, in HTML -Group: Applications/Publishing -# BuildArchitectures: noarch - -%description documentation -Documentation and example files of LilyPond. An index is available at -%{docdir}/web/Documentation/index.html - -%prep -%setup - -%build - -# DO NOT use % { configure } , it hardcodes all paths, runs libtool, -# so we can't do make prefixix=/tmp/ install. - -# In fact, do not take out the spaces between % and { in the above comment, -# because RPM will gladly do a substitution anyway. - -# compile with static libstdc++ for better platform portability. -./configure --enable-static-gxx --disable-checking --prefix=%{_prefix} --enable-optimising - - -make -j2 all -make web -make -C Documentation/user local_package_docdir=%{docdir} omf - -%install - - -rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT/tmp/lilypond-rpm-doc - -make prefix="$RPM_BUILD_ROOT%{_prefix}" \ - infodir="$RPM_BUILD_ROOT%{_infodir}" \ - mandir="$RPM_BUILD_ROOT%{_mandir}" install - -#emacs -mkdir -p $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp/site-start.d -install -m 644 elisp/lilypond-init.el $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp/site-start.d - -#manual pages -gzip -9fn $RPM_BUILD_ROOT%{_mandir}/man1/* - - -# profile scripts. - - -# web doc -make prefix="$RPM_BUILD_ROOT%{_prefix}" \ - infodir="$RPM_BUILD_ROOT%{_infodir}" \ - webdir="$RPM_BUILD_ROOT%{_prefix}/share/doc/lilypond/" web-install - -ln -sf ../../doc/lilypond/Documentation/user/*png $RPM_BUILD_ROOT%{_infodir}/lilypond/ - -# info -%if %{info} -rm -f $RPM_BUILD_ROOT/%{_infodir}/dir -gzip -9fn `find $RPM_BUILD_ROOT%{_infodir}/ -name '*.info'` -%endif - - - -%post - -touch /tmp/.lilypond-install - -%if %{info} - /sbin/install-info %{_infodir}/lilypond/lilypond.info.gz %{_infodir}/dir - /sbin/install-info %{_infodir}/lilypond/lilypond-internals.info.gz %{_infodir}/dir - /sbin/install-info %{_infodir}/lilypond/music-glossary.info.gz %{_infodir}/dir -%endif - -export PACKAGEDIR=%{_datadir}/lilypond/@TOPLEVEL_VERSION@ -if [ -d /usr/share/vim ]; then - VIMDIR=`find /usr/share/vim -name bugreport.vim` - VIMDIR=`dirname $VIMDIR` - for a in `cd $PACKAGEDIR/vim/ ; find -type d -name '*' ` ; do - mkdir -p $VIMDIR/$a - ln -s $PACKAGEDIR/vim/$a/*.vim $VIMDIR/$a/ - done -fi - - -%preun -if [ -f /usr/share/lilypond/%{version}/ls-R ]; then - rm -f /usr/share/lilypond/%{version}/ls-R -fi - - -if [ -d /usr/share/vim ]; then - rm `find /usr/share/vim -name 'lilypond*.vim'` -fi - - -%if %{info} - /sbin/install-info --delete %{_infodir}/lilypond/lilypond.info.gz %{_infodir}/dir - /sbin/install-info --delete %{_infodir}/lilypond/lilypond-internals.info.gz %{_infodir}/dir - /sbin/install-info --delete %{_infodir}/lilypond/music-glossary.info.gz %{_infodir}/dir -%endif - -# chkfontpath --remove=%{_datadir}/share/lilypond/@TOPLEVEL_VERSION@/fonts/type1n/ - -%postun - -%post documentation -scrollkeeper-update - -%postun documentation -scrollkeeper-update - - - -%files -%defattr(-, root, root) -%{_datadir}/emacs/site-lisp/lilypond* -%{_datadir}/emacs/site-lisp/site-start.d/lilypond* - -%{_bindir}/abc2ly -%{_bindir}/convert-ly -%{_bindir}/etf2ly -%{_bindir}/lilypond -%{_bindir}/midi2ly -%{_bindir}/lilypond-book -%{_bindir}/mup2ly -%{_bindir}/musicxml2ly -%{_bindir}/lilypond-invoke-editor - -%doc THANKS -%doc COPYING -%doc DEDICATION -%doc README.txt -%doc AUTHORS.txt -%doc INSTALL.txt -%doc NEWS.txt - -%if %{info} -%{_infodir}/lilypond/ -%endif - -%{_mandir}/man1/abc2ly.1.gz -%{_mandir}/man1/musicxml2ly.1.gz -%{_mandir}/man1/convert-ly.1.gz -%{_mandir}/man1/etf2ly.1.gz -%{_mandir}/man1/lilypond.1.gz -%{_mandir}/man1/midi2ly.1.gz -%{_mandir}/man1/lilypond-book.1.gz -%{_mandir}/man1/mup2ly.1.gz -%{_mandir}/man1/lilypond-invoke-editor.1.gz - -%{_datadir}/lilypond/@TOPLEVEL_VERSION@/ -%{_datadir}/locale/*/LC_MESSAGES/lilypond.mo -%{_libdir}/lilypond/ - - -%files documentation - -%defattr(-, root, root) - -%{docdir} -%{_datadir}/omf/lilypond/@TOPLEVEL_VERSION@ - - -%clean -rm -rf %{buildroot diff --git a/mf/parmesan-heads.mf b/mf/parmesan-heads.mf index da64dbeb4b..551e3e3bd2 100644 --- a/mf/parmesan-heads.mf +++ b/mf/parmesan-heads.mf @@ -192,6 +192,13 @@ fet_beginchar("Harmonic notehead (Neo-mensural open)", charwy := 0; fet_endchar; +fet_beginchar("Harmonic notehead (Neo-mensural black)", + "s2harmonic") + draw_neomensural_black_head (1.3 staff_space#, 1.3 noteheight#); + charwx := head_width#; + charwy := 0; +fet_endchar; + fet_beginchar("Neo-mensural semibrevis head","s0neomensural") draw_neomensural_open_head (staff_space#, noteheight#); fet_endchar; diff --git a/python/convertrules.py b/python/convertrules.py index 06f572e204..71dbd10d42 100644 --- a/python/convertrules.py +++ b/python/convertrules.py @@ -2952,3 +2952,20 @@ def conv (str): return str conversions.append (((2, 11, 11), conv, """layout-set-staff-size -> layout-set-absolute-staff-size""")) + + +def conv (str): + str = re.sub (r"\\override\s*([a-zA-Z.]+)\s*#'arrow\s*=\s*##t", + r"\\override \1 #'bound-details #'right #'arrow = ##t", + str) + + if re.search ('edge-text', str): + error_file.write (NOT_SMART % "edge-text settings for TextSpanner.") + error_file.write ("Use\n\n" + "\t\\override TextSpanner #'bound-details #'right #'text = \n" + "\t\\override TextSpanner #'bound-details #'left #'text = \n") + + + return str + +conversions.append (((2, 11, 13), conv, """#'arrow = ##t -> #'bound-details #'right #'arrow = ##t""")) diff --git a/python/relocate-preamble.py.in b/python/relocate-preamble.py.in new file mode 100644 index 0000000000..23db6d86a6 --- /dev/null +++ b/python/relocate-preamble.py.in @@ -0,0 +1,19 @@ +This generic code used for all python scripts. + +The quotes are to ensure that the source .py file can still be +run as a python script, but does not include any sys.path handling. +Otherwise, the lilypond-book calls inside the build +might modify installed .pyc files. + +""" + +for d in ['@lilypond_datadir@', + '@lilypond_libdir@']: + sys.path.insert (0, os.path.join (d, 'python')) + +# dynamic relocation, for GUB binaries. +bindir = os.path.abspath (os.path.split (sys.argv[0])[0]) +for p in ['share', 'lib']: + datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % p) + sys.path.insert (0, datadir) +""" diff --git a/scm/define-grob-interfaces.scm b/scm/define-grob-interfaces.scm index 2f8c1413d3..8f7c52660e 100644 --- a/scm/define-grob-interfaces.scm +++ b/scm/define-grob-interfaces.scm @@ -143,6 +143,11 @@ '() ) +(ly:add-interface + 'trill-spanner-interface + "An accidental for trill pitch" + '()) + (ly:add-interface 'rhythmic-grob-interface "Any object with a duration. Used to determine which grobs are diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 68e92a4fbb..7cf4d853f8 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -35,7 +35,6 @@ relative to its Y-parent") (allow-loose-spacing ,boolean? "If set, column can be detached from main spacing.") (arpeggio-direction ,ly:dir? "If set, put an arrow on the arpeggio squiggly line.") - (arrow ,boolean? "Add an arrow to the line.") (arrow-length ,number? "Arrow length.") (arrow-width ,number? "Arrow width.") (auto-knee-gap ,ly:dimension? "If a gap is found between note heads @@ -130,9 +129,6 @@ the vertical edges '(@var{left-height} . @var{right-height}).") (edge-text ,pair? "A pair specifying the texts to be set at the edges '(@var{left-text} . @var{right-text}).") (eccentricity ,number? "How asymmetrical to make a slur. Positive means move the center to the right.") - (enclose-bounds ,number? - "How much of the bound a spanner should enclose: -+1 = completely, 0 = center, -1 not at all.") (expand-limit ,integer? "maximum number of measures expanded in church rests.") ;; remove me? (extra-dy ,number? "Slope glissandi this much extra.") diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 5acb4fc1c6..6cfc4ed188 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -636,6 +636,8 @@ (font-shape . italic) (style . dashed-line) + ;; make sure the spanner doesn't get too close to notes + (minimum-Y-extent . (-1 . 1)) (bound-details . ((right . ((attach-dir . ,LEFT) (Y . 0) (padding . 0.75) @@ -650,15 +652,11 @@ (padding . 0.5) )) (left-broken . ((attach-dir . ,RIGHT) - - ;; make sure the - - - stays at reasonable - ;; distance from staff. - (text . " ") )) )) - (stencil . ,ly:new-line-spanner::print) - (left-bound-info . ,ly:new-line-spanner::calc-left-bound-info-and-text) - (right-bound-info . ,ly:new-line-spanner::calc-right-bound-info) + (stencil . ,ly:line-spanner::print) + (left-bound-info . ,ly:line-spanner::calc-left-bound-info-and-text) + (right-bound-info . ,ly:line-spanner::calc-right-bound-info) ;; need to blend with dynamic texts. (font-size . 1) @@ -667,7 +665,7 @@ (meta . ((class . Spanner) (interfaces . (font-interface text-interface - new-line-spanner-interface + line-spanner-interface line-interface dynamic-interface dynamic-text-spanner-interface @@ -721,13 +719,13 @@ (padding . 1.5) )) )) - (stencil . ,ly:new-line-spanner::print) - (left-bound-info . ,ly:new-line-spanner::calc-left-bound-info) - (right-bound-info . ,ly:new-line-spanner::calc-right-bound-info) + (stencil . ,ly:line-spanner::print) + (left-bound-info . ,ly:line-spanner::calc-left-bound-info) + (right-bound-info . ,ly:line-spanner::calc-right-bound-info) (meta . ((class . Spanner) (interfaces . (line-interface unbreakable-spanner-interface - new-line-spanner-interface)))))) + line-spanner-interface)))))) (GraceSpacing . ( @@ -1680,8 +1678,6 @@ (X-offset . ,ly:self-alignment-interface::x-aligned-on-self) (meta . ((class . Item) (interfaces . (piano-pedal-interface - text-spanner-interface - line-spanner-interface text-interface self-alignment-interface piano-pedal-script-interface @@ -1817,7 +1813,6 @@ (TextSpanner . ( - (stencil . ,ly:text-spanner::print) (Y-offset . ,ly:side-position-interface::y-aligned-side) (font-shape . italic) (style . dashed-line) @@ -1827,9 +1822,21 @@ (side-axis . ,Y) (direction . ,UP) (outside-staff-priority . 350) + + (left-bound-info . ,ly:line-spanner::calc-left-bound-info) + (right-bound-info . ,ly:line-spanner::calc-right-bound-info) + (bound-details . ((left . ((Y . 0) + (padding . 0.25) + (attach-dir . ,LEFT) + )) + (right . ((Y . 0) + (padding . 0.25) + )) + )) + (stencil . ,ly:line-spanner::print) + (meta . ((class . Spanner) - (interfaces . (text-spanner-interface - line-spanner-interface + (interfaces . (line-spanner-interface side-position-interface font-interface)))))) @@ -1897,8 +1904,8 @@ (TrillSpanner . ( - (left-bound-info . ,ly:new-line-spanner::calc-left-bound-info) - (right-bound-info . ,ly:new-line-spanner::calc-right-bound-info) + (left-bound-info . ,ly:line-spanner::calc-left-bound-info) + (right-bound-info . ,ly:line-spanner::calc-right-bound-info) (bound-details . ((left . ((text . ,(make-translate-scaled-markup '(0.5 . -0.6) @@ -1910,7 +1917,7 @@ (right . ((Y . 0))) )) - (stencil . ,ly:new-line-spanner::print) + (stencil . ,ly:line-spanner::print) (style . trill) (staff-padding . 1.0) @@ -1920,8 +1927,9 @@ (side-axis . ,Y) (outside-staff-priority . 50) (meta . ((class . Spanner) - (interfaces . (text-spanner-interface - new-line-spanner-interface + (interfaces . (line-spanner-interface + line-interface + trill-spanner-interface side-position-interface font-interface)))))) @@ -2058,7 +2066,7 @@ (Y-offset . ,ly:hara-kiri-group-spanner::force-hara-kiri-callback) (Y-extent . ,ly:hara-kiri-group-spanner::y-extent) (X-extent . ,ly:axis-group-interface::width) - (skylines . ,ly:axis-group-interface::calc-skylines) + (skylines . ,ly:hara-kiri-group-spanner::calc-skylines) (max-stretch . ,ly:axis-group-interface::calc-max-stretch) (meta . ((class . Spanner) (object-callbacks . ((X-common . ,ly:axis-group-interface::calc-x-common))) @@ -2104,11 +2112,11 @@ (padding . 1.5) )) )) - (stencil . ,ly:new-line-spanner::print) - (left-bound-info . ,ly:new-line-spanner::calc-left-bound-info) - (right-bound-info . ,ly:new-line-spanner::calc-right-bound-info) + (stencil . ,ly:line-spanner::print) + (left-bound-info . ,ly:line-spanner::calc-left-bound-info) + (right-bound-info . ,ly:line-spanner::calc-right-bound-info) (meta . ((class . Spanner) - (interfaces . (new-line-spanner-interface + (interfaces . (line-spanner-interface line-interface)))) )) diff --git a/scm/define-markup-commands.scm b/scm/define-markup-commands.scm index 12dd691634..45833f08e0 100644 --- a/scm/define-markup-commands.scm +++ b/scm/define-markup-commands.scm @@ -848,10 +848,7 @@ any sort of property supported by @internalsref{font-interface} and (cons 'font-size (+ fs increment ))))) (interpret-markup layout (cons entries props) arg))) - - -;; FIXME -> should convert to font-size. (define-builtin-markup-command (magnify layout props sz arg) (number? markup?) "Set the font magnification for the its argument. In the following example, the middle A will be 10% larger: @@ -863,7 +860,7 @@ Note: magnification only works if a font-name is explicitly selected. Use @code{\\fontsize} otherwise." (interpret-markup layout - (prepend-alist-chain 'font-magnification sz props) + (prepend-alist-chain 'font-size (magnification->font-size sz) props) arg)) (define-builtin-markup-command (bold layout props arg) (markup?) diff --git a/scm/font.scm b/scm/font.scm index 8774042ca9..4d5a4bcef3 100644 --- a/scm/font.scm +++ b/scm/font.scm @@ -359,5 +359,8 @@ "Century Schoolbook L" "Sans" "Mono" factor)) -(define-public (magstep x) - (exp (* (/ x 6) (log 2)))) +(define-public (magstep s) + (exp (* (/ s 6) (log 2)))) + +(define-public (magnification->font-size m) + (* 6 (/ (log m) (log 2)))) diff --git a/scm/framework-eps.scm b/scm/framework-eps.scm index cf9bec54b3..fab2d77177 100644 --- a/scm/framework-eps.scm +++ b/scm/framework-eps.scm @@ -146,6 +146,9 @@ stencil, so LaTeX includegraphics doesn't fuck up the alignment." (define-public (output-framework basename book scopes fields) (output-scopes scopes fields basename) + (if (ly:get-option 'clip-systems) + (clip-system-EPSes basename book)) + (dump-stencils-as-EPSes (map page-stencil (ly:paper-book-pages book)) book basename)) diff --git a/scm/framework-ps.scm b/scm/framework-ps.scm index 213d995c2c..28579ebc96 100644 --- a/scm/framework-ps.scm +++ b/scm/framework-ps.scm @@ -164,13 +164,13 @@ (ly:output-def-lookup paper 'output-scale)) (ly:bp 1))) (landscape? (eq? (ly:output-def-lookup paper 'landscape) #t))) - (format "%%DocumentMedia: ~a ~a ~a ~a ~a ~a\n" - (ly:output-def-lookup paper 'papersizename) - (round2 (if landscape? h w)) - (round2 (if landscape? w h)) - 80 ;; weight - "()" ;; color - "()" ;; type + (ly:format "%%DocumentMedia: ~a ~2f ~2f ~a ~a ~a\n" + (ly:output-def-lookup paper 'papersizename) + (if landscape? h w) + (if landscape? w h) + 80 ;; weight + "()" ;; color + "()" ;; type ))) @@ -603,7 +603,7 @@ )) -(define (clip-system-EPSes basename paper-book) +(define-public (clip-system-EPSes basename paper-book) (define do-pdf (member "pdf" (ly:output-formats))) (define (clip-score-systems basename systems) diff --git a/scm/framework-scm.scm b/scm/framework-scm.scm index e4895ae2e0..ecbe711af8 100644 --- a/scm/framework-scm.scm +++ b/scm/framework-scm.scm @@ -17,6 +17,7 @@ (let* ((file (open-output-file (format "~a.scm" basename)))) + (display ";;Creator: LilyPond\n" file) (display ";; raw SCM output\n" file) (for-each diff --git a/scm/lily-library.scm b/scm/lily-library.scm index 0746876ca3..e6215b9823 100644 --- a/scm/lily-library.scm +++ b/scm/lily-library.scm @@ -118,14 +118,6 @@ (stringstring (car x)) (symbol->string (car y)))) -(define-public (chain-assoc x alist-list) - (if (null? alist-list) - #f - (let* ((handle (assoc x (car alist-list)))) - (if (pair? handle) - handle - (chain-assoc x (cdr alist-list)))))) - (define-public (chain-assoc-get x alist-list . default) "Return ALIST entry for X. Return DEFAULT (optional, else #f) if not found." @@ -444,9 +436,6 @@ found." (make-string 1 (integer->char (+ 65 (modulo i 26)))) (string-encode-integer (quotient i 26)))))) -(define-public (ly:numbers->string lst) - (string-join (map ly:number->string lst) " ")) - (define (number->octal-string x) (let* ((n (inexact->exact x)) (n64 (quotient n 64)) @@ -526,13 +515,9 @@ possibly turned off." 0 (if (< x 0) -1 1))) -(define-public (round2 num) - (/ (round (* 100 num)) 100)) - -(define-public (round4 num) - (/ (round (* 10000 num)) 10000)) -(define-public (car< a b) (< (car a) (car b))) +(define-public (car< a b) + (< (car a) (car b))) (define-public (symbolstring lst) (symbol->string r))) diff --git a/scm/lily.scm b/scm/lily.scm index bc4a48f7a9..f455829be6 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -18,79 +18,77 @@ (debug-enable 'debug) -(define (define-scheme-options) - (for-each (lambda (x) - (ly:add-option (car x) (cadr x) (caddr x))) - - `( - ;; NAMING: either +(define scheme-options-definitions + `( + + ;; NAMING: either - ;; - [subject-]object-object-verb +"ing" - ;; - [subject-]-verb-object-object + ;; - [subject-]object-object-verb +"ing" + ;; - [subject-]-verb-object-object - (anti-alias-factor 1 "render at higher resolution and scale down result\nto prevent jaggies in PNG") - (check-internal-types #f "check every property assignment for types") - (clip-systems #f "Generate cut-out snippets of a score") - (debug-gc #f "dump memory debugging statistics") - (debug-gc-assert-parsed-dead #f "for memory debugging: + (anti-alias-factor 1 "render at higher resolution and scale down result\nto prevent jaggies in PNG") + (check-internal-types #f "check every property assignment for types") + (clip-systems #f "Generate cut-out snippets of a score") + (debug-gc #f "dump memory debugging statistics") + (debug-gc-assert-parsed-dead #f "for memory debugging: ensure that all refs to parsed objects are dead. This is an internal option, and is switched on automatically for -ddebug-gc.") - (debug-lexer #f "debug the flex lexer") - (debug-parser #f "debug the bison parser") - (debug-skylines #f "debug skylines") - (delete-intermediate-files #f - "delete unusable PostScript files") - (dump-profile #f "dump timing information for each file") - (dump-signatures #f "dump output signatures of each system. Used for regression testing.") - - (eps-box-padding #f "Pad EPS bounding box left edge. Guarantee alignment between systems in LaTeX.") - (gs-load-fonts #f - "load fonts via Ghostscript.") - (gui #f "running from gui; redirect stderr to log file") - - (include-book-title-preview #t "include book-titles in preview images.") - (include-eps-fonts #t "Include fonts in separate-system EPS files.") - (job-count #f "Process in parallel") - (log-file #f "redirect output to log FILE.log") - - (old-relative #f - "relative for simultaneous music works + (debug-lexer #f "debug the flex lexer") + (debug-parser #f "debug the bison parser") + (debug-skylines #f "debug skylines") + (delete-intermediate-files #f + "delete unusable PostScript files") + (dump-profile #f "dump timing information for each file") + (dump-signatures #f "dump output signatures of each system. Used for regression testing.") + + (eps-box-padding #f "Pad EPS bounding box left edge. Guarantee alignment between systems in LaTeX.") + (gs-load-fonts #f + "load fonts via Ghostscript.") + (gui #f "running from gui; redirect stderr to log file") + (help #f "show this help.") + (include-book-title-preview #t "include book-titles in preview images.") + (include-eps-fonts #t "Include fonts in separate-system EPS files.") + (job-count #f "Process in parallel") + (log-file #f "redirect output to log FILE.log") + + (old-relative #f + "relative for simultaneous music works similar to chord syntax") - (point-and-click #t "use point & click") - (paper-size "a4" "the default paper size") - (pixmap-format "png16m" "GS format to use for pixel images") - (protected-scheme-parsing #t "continue when finding errors in inline + (point-and-click #t "use point & click") + (paper-size "a4" "the default paper size") + (pixmap-format "png16m" "GS format to use for pixel images") + (protected-scheme-parsing #t "continue when finding errors in inline scheme are caught in the parser. If off, halt on errors, and print a stack trace.") - (profile-property-accesses #f "keep statistics of get_property() calls.") - - (resolution 101 "resolution for generating PNG bitmaps") - (read-file-list #f "Read files to be processed from command line arguments") - - (safe #f "Run safely") - (strict-infinity-checking #f "If yes, crash on encountering Inf/NaN.") - (separate-log-files #f "Output to FILE.log per file.") - (trace-memory-frequency #f "Record Scheme cell usage this many times per second, and dump to file.") - (trace-scheme-coverage #f "Record coverage of Scheme files") - (ttf-verbosity 0 - "how much verbosity for TTF font embedding?") - (show-available-fonts #f - "List font names available.") - (verbose ,(ly:command-line-verbose?) "value for the --verbose flag") - )) - - (map - (lambda (x) - (ly:set-option (car x) (cdr x))) - (eval-string (ly:command-line-options)))) - + (profile-property-accesses #f "keep statistics of get_property() calls.") + + (resolution 101 "resolution for generating PNG bitmaps") + (read-file-list #f "Read files to be processed from command line arguments") + + (safe #f "Run safely") + (strict-infinity-checking #f "If yes, crash on encountering Inf/NaN.") + (separate-log-files #f "Output to FILE.log per file.") + (trace-memory-frequency #f "Record Scheme cell usage this many times per second, and dump to file.") + (trace-scheme-coverage #f "Record coverage of Scheme files") + (ttf-verbosity 0 + "how much verbosity for TTF font embedding?") + (show-available-fonts #f + "List font names available.") + (verbose ,(ly:command-line-verbose?) "value for the --verbose flag") + )) ;; need to do this in the beginning. Other parts of the ;; Scheme init depend on these options. ;; -(define-scheme-options) - +(for-each + (lambda (x) + (ly:add-option (car x) (cadr x) (caddr x))) + scheme-options-definitions) +(for-each + (lambda (x) + (ly:set-option (car x) (cdr x))) + (eval-string (ly:command-line-options))) (debug-set! stack 0) @@ -337,8 +335,6 @@ The syntax is the same as `define*-public'." "safe-lily.scm")) - - (for-each ly:load init-scheme-files) @@ -643,8 +639,10 @@ The syntax is the same as `define*-public'." (exit 0))))) (define-public (lilypond-all files) - - + (if (ly:get-option 'help) + (begin + (ly:option-usage) + (exit 0))) (if (ly:get-option 'show-available-fonts) (begin (ly:font-config-display-fonts) diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 049f27ea3a..c4bfa93d18 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -620,7 +620,7 @@ of beat groupings " "Replace MUS by RestEvent of the same duration if it is a SkipEvent. Useful for extracting parts from crowded scores" - (if (equal? (ly:music-property mus 'name) 'SkipEvent) + (if (memq (ly:music-property mus 'name) '(SkipEvent SkipMusic)) (make-music 'RestEvent 'duration (ly:music-property mus 'duration)) mus)) diff --git a/scm/output-lib.scm b/scm/output-lib.scm index f66a78bcbc..3cfefc8f3e 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -26,22 +26,9 @@ (lambda (grob) (circle-stencil (callback grob) thickness padding))) (define-public (print-circled-text-callback grob) - (let* ((text (ly:grob-property grob 'text)) - - (layout (ly:grob-layout grob)) - (defs (ly:output-def-lookup layout 'text-font-defaults)) - (props (ly:grob-alist-chain grob defs)) - (circle (ly:text-interface::interpret-markup - layout props (make-circle-markup text)))) - circle)) - -(define-public (music-cause grob) - (let* - ((event (event-cause grob))) - - (if (ly:stream-event? event) - (ly:event-property event 'music-cause) - #f))) + (grob-interpret-markup grob (make-circle-markup + (ly:grob-property grob 'text)) + )) (define-public (event-cause grob) (let* @@ -168,6 +155,9 @@ ;; statement. -- jr ((xcircle) "2xcircle") ((harmonic) "0harmonic") + ((harmonic-black) "2harmonic") + ((harmonic-mixed) (if (<= log 1) "0harmonic" + "2harmonic")) ((baroque) ;; Oops, I actually would not call this "baroque", but, for ;; backwards compatibility to 1.4, this is supposed to take @@ -436,7 +426,7 @@ centered, X==1 is at the right, X == -1 is at the left." (list lp rp))) -(define (grob-text grob text) +(define-public (grob-interpret-markup grob text) (let* ((layout (ly:grob-layout grob)) (defs (ly:output-def-lookup layout 'text-font-defaults)) @@ -448,9 +438,9 @@ centered, X==1 is at the right, X == -1 is at the left." (define-public (parentheses-item::calc-angled-bracket-stencils grob) (let* ( (font (ly:grob-default-font grob)) - (lp (ly:stencil-aligned-to (ly:stencil-aligned-to (grob-text grob (ly:wide-char->utf-8 #x2329)) + (lp (ly:stencil-aligned-to (ly:stencil-aligned-to (grob-interpret-markup grob (ly:wide-char->utf-8 #x2329)) Y CENTER) X RIGHT)) - (rp (ly:stencil-aligned-to (ly:stencil-aligned-to (grob-text grob (ly:wide-char->utf-8 #x232A)) + (rp (ly:stencil-aligned-to (ly:stencil-aligned-to (grob-interpret-markup grob (ly:wide-char->utf-8 #x232A)) Y CENTER) X LEFT)) ) @@ -639,16 +629,12 @@ centered, X==1 is at the right, X == -1 is at the left." "Allow interpretation of tildes as lyric tieing marks." (let* - ((text (ly:grob-property grob 'text)) - (layout (ly:grob-layout grob)) - (defs (ly:output-def-lookup layout 'text-font-defaults)) - (props (ly:grob-alist-chain grob defs))) + ((text (ly:grob-property grob 'text))) - (ly:text-interface::interpret-markup layout - props - (if (string? text) - (make-tied-lyric-markup text) - text)))) + (grob-interpret-markup grob + (if (string? text) + (make-tied-lyric-markup text) + text)))) (define-public ((grob::calc-property-by-copy prop) grob) (ly:event-property (event-cause grob) prop)) @@ -685,10 +671,8 @@ centered, X==1 is at the right, X == -1 is at the left." (define-public (fret-board::calc-stencil grob) (let* ((string-frets (ly:grob-property grob 'string-fret-finger-combinations)) - (string-count (ly:grob-property grob 'string-count)) - (layout (ly:grob-layout grob)) - (defs (ly:output-def-lookup layout 'text-font-defaults)) - (props (ly:grob-alist-chain grob defs))) - - (make-fret-diagram layout props - (string-frets->description string-frets 6)))) + (string-count (ly:grob-property grob 'string-count))) + + (grob-interpret-markup grob + (make-fret-diagram-verbose-markup + (string-frets->description string-frets string-count))))) diff --git a/scm/output-ps.scm b/scm/output-ps.scm index b82c185e02..1a136ba772 100644 --- a/scm/output-ps.scm +++ b/scm/output-ps.scm @@ -67,9 +67,6 @@ (define (number-pair->string4 numpair) (ly:format "~4l" numpair)) -(define (numbers->string4 numlist) - (string-join (map str4 numlist) " ")) - ;;; ;;; Lily output interface, PostScript implementation --- cleanup and docme ;;; diff --git a/scm/output-socket.scm b/scm/output-socket.scm index e992e7c74b..083d5a081b 100644 --- a/scm/output-socket.scm +++ b/scm/output-socket.scm @@ -55,7 +55,6 @@ (cond ((ly:stream-event? cause) cause) -; ((ly:grob? cause) (music-cause cause)) (else #f)))) diff --git a/scm/paper.scm b/scm/paper.scm index 4750b518f7..dd2ba52b6f 100644 --- a/scm/paper.scm +++ b/scm/paper.scm @@ -61,8 +61,8 @@ points" (layout-set-absolute-staff-size-in-module (current-module) sz)) (define-public (layout-set-staff-size sz) - "Function to be called inside a \\layout{} block to set the staff size. SZ is in -points" + "Function to be called inside a \\layout{} block to set the staff +size. SZ is in points" (layout-set-absolute-staff-size (* (eval 'pt (current-module)) sz))) diff --git a/scm/safe-lily.scm b/scm/safe-lily.scm index c47f05583b..2e3f2afe65 100644 --- a/scm/safe-lily.scm +++ b/scm/safe-lily.scm @@ -51,7 +51,6 @@ ly:grob-original ly:grob-layout ly:grob-parent - ly:grob-pq-less? ly:grob-property ly:grob-script-priority-less ly:grob-set-property! @@ -195,7 +194,6 @@ ly:sustain-pedal::print ly:system-start-delimiter::print ly:text-interface::print - ly:text-spanner::print ly:tie::print ly:time-signature::print ly:tuplet-bracket::print diff --git a/scm/stencil.scm b/scm/stencil.scm index 283f04fe2d..32a64fdede 100644 --- a/scm/stencil.scm +++ b/scm/stencil.scm @@ -274,14 +274,21 @@ encloses the contents. (define-public (eps-file->stencil axis size file-name) (let* ((contents (ly:gulp-file file-name)) - (bbox (get-postscript-bbox contents)) + (bbox (get-postscript-bbox (car (string-split contents #\nul)))) (bbox-size (if (= axis X) (- (list-ref bbox 2) (list-ref bbox 0)) (- (list-ref bbox 3) (list-ref bbox 1)) )) (factor (exact->inexact (/ size bbox-size))) (scaled-bbox - (map (lambda (x) (* factor x)) bbox))) + (map (lambda (x) (* factor x)) bbox)) + (clip-rect-string (format + "~a ~a ~a ~a rectclip" + (list-ref bbox 0) + (list-ref bbox 1) + (- (list-ref bbox 2) (list-ref bbox 0)) + (- (list-ref bbox 3) (list-ref bbox 1))))) + (if bbox (ly:make-stencil @@ -293,9 +300,11 @@ encloses the contents. gsave currentpoint translate BeginEPSF -~a ~a scale +~a dup scale +~a %%BeginDocument: ~a -" factor factor +" factor clip-rect-string + file-name ) contents diff --git a/scm/x11-color.scm b/scm/x11-color.scm index 522ae0d5fe..77f3838b8b 100644 --- a/scm/x11-color.scm +++ b/scm/x11-color.scm @@ -6,670 +6,668 @@ ;;;; (c) 2005--2006 Bernard Hurley ;;;; -(define-public (make-x11-color-handler) - (let - ((x11-color-table (make-hash-table 31)) - (x11-color-list - '((snow 1 0.98039215686274506 0.98039215686274506) - (GhostWhite 0.97254901960784312 0.97254901960784312 1) - (WhiteSmoke 0.96078431372549022 0.96078431372549022 0.96078431372549022) - (gainsboro 0.86274509803921573 0.86274509803921573 0.86274509803921573) - (FloralWhite 1 0.98039215686274506 0.94117647058823528) - (OldLace 0.99215686274509807 0.96078431372549022 0.90196078431372551) - (linen 0.98039215686274506 0.94117647058823528 0.90196078431372551) - (AntiqueWhite 0.98039215686274506 0.92156862745098034 0.84313725490196079) - (PapayaWhip 1 0.93725490196078431 0.83529411764705885) - (BlanchedAlmond 1 0.92156862745098034 0.80392156862745101) - (bisque 1 0.89411764705882357 0.7686274509803922) - (PeachPuff 1 0.85490196078431369 0.72549019607843135) - (NavajoWhite 1 0.87058823529411766 0.67843137254901964) - (moccasin 1 0.89411764705882357 0.70980392156862748) - (cornsilk 1 0.97254901960784312 0.86274509803921573) - (ivory 1 1 0.94117647058823528) - (LemonChiffon 1 0.98039215686274506 0.80392156862745101) - (seashell 1 0.96078431372549022 0.93333333333333335) - (honeydew 0.94117647058823528 1 0.94117647058823528) - (MintCream 0.96078431372549022 1 0.98039215686274506) - (azure 0.94117647058823528 1 1) - (AliceBlue 0.94117647058823528 0.97254901960784312 1) - (lavender 0.90196078431372551 0.90196078431372551 0.98039215686274506) - (LavenderBlush 1 0.94117647058823528 0.96078431372549022) - (MistyRose 1 0.89411764705882357 0.88235294117647056) - (white 1 1 1) - (black 0 0 0) - (DarkSlateGray 0.18431372549019609 0.30980392156862746 0.30980392156862746) - (DarkSlateGrey 0.18431372549019609 0.30980392156862746 0.30980392156862746) - (DimGray 0.41176470588235292 0.41176470588235292 0.41176470588235292) - (DimGrey 0.41176470588235292 0.41176470588235292 0.41176470588235292) - (SlateGray 0.4392156862745098 0.50196078431372548 0.56470588235294117) - (SlateGrey 0.4392156862745098 0.50196078431372548 0.56470588235294117) - (LightSlateGray 0.46666666666666667 0.53333333333333333 0.59999999999999998) - (LightSlateGrey 0.46666666666666667 0.53333333333333333 0.59999999999999998) - (gray 0.74509803921568629 0.74509803921568629 0.74509803921568629) - (grey 0.74509803921568629 0.74509803921568629 0.74509803921568629) - (LightGrey 0.82745098039215681 0.82745098039215681 0.82745098039215681) - (LightGray 0.82745098039215681 0.82745098039215681 0.82745098039215681) - (MidnightBlue 0.098039215686274508 0.098039215686274508 0.4392156862745098) - (navy 0 0 0.50196078431372548) - (NavyBlue 0 0 0.50196078431372548) - (CornflowerBlue 0.39215686274509803 0.58431372549019611 0.92941176470588238) - (DarkSlateBlue 0.28235294117647058 0.23921568627450981 0.54509803921568623) - (SlateBlue 0.41568627450980394 0.35294117647058826 0.80392156862745101) - (MediumSlateBlue 0.4823529411764706 0.40784313725490196 0.93333333333333335) - (LightSlateBlue 0.51764705882352946 0.4392156862745098 1) - (MediumBlue 0 0 0.80392156862745101) - (RoyalBlue 0.25490196078431371 0.41176470588235292 0.88235294117647056) - (blue 0 0 1) - (DodgerBlue 0.11764705882352941 0.56470588235294117 1) - (DeepSkyBlue 0 0.74901960784313726 1) - (SkyBlue 0.52941176470588236 0.80784313725490198 0.92156862745098034) - (LightSkyBlue 0.52941176470588236 0.80784313725490198 0.98039215686274506) - (SteelBlue 0.27450980392156865 0.50980392156862742 0.70588235294117652) - (LightSteelBlue 0.69019607843137254 0.7686274509803922 0.87058823529411766) - (LightBlue 0.67843137254901964 0.84705882352941175 0.90196078431372551) - (PowderBlue 0.69019607843137254 0.8784313725490196 0.90196078431372551) - (PaleTurquoise 0.68627450980392157 0.93333333333333335 0.93333333333333335) - (DarkTurquoise 0 0.80784313725490198 0.81960784313725488) - (MediumTurquoise 0.28235294117647058 0.81960784313725488 0.80000000000000004) - (turquoise 0.25098039215686274 0.8784313725490196 0.81568627450980391) - (cyan 0 1 1) - (LightCyan 0.8784313725490196 1 1) - (CadetBlue 0.37254901960784315 0.61960784313725492 0.62745098039215685) - (MediumAquamarine 0.40000000000000002 0.80392156862745101 0.66666666666666663) - (aquamarine 0.49803921568627452 1 0.83137254901960789) - (DarkGreen 0 0.39215686274509803 0) - (DarkOliveGreen 0.33333333333333331 0.41960784313725491 0.18431372549019609) - (DarkSeaGreen 0.5607843137254902 0.73725490196078436 0.5607843137254902) - (SeaGreen 0.1803921568627451 0.54509803921568623 0.3411764705882353) - (MediumSeaGreen 0.23529411764705882 0.70196078431372544 0.44313725490196076) - (LightSeaGreen 0.12549019607843137 0.69803921568627447 0.66666666666666663) - (PaleGreen 0.59607843137254901 0.98431372549019602 0.59607843137254901) - (SpringGreen 0 1 0.49803921568627452) - (LawnGreen 0.48627450980392156 0.9882352941176471 0) - (green 0 1 0) - (chartreuse 0.49803921568627452 1 0) - (MediumSpringGreen 0 0.98039215686274506 0.60392156862745094) - (GreenYellow 0.67843137254901964 1 0.18431372549019609) - (LimeGreen 0.19607843137254902 0.80392156862745101 0.19607843137254902) - (YellowGreen 0.60392156862745094 0.80392156862745101 0.19607843137254902) - (ForestGreen 0.13333333333333333 0.54509803921568623 0.13333333333333333) - (OliveDrab 0.41960784313725491 0.55686274509803924 0.13725490196078433) - (DarkKhaki 0.74117647058823533 0.71764705882352942 0.41960784313725491) - (khaki 0.94117647058823528 0.90196078431372551 0.5490196078431373) - (PaleGoldenrod 0.93333333333333335 0.90980392156862744 0.66666666666666663) - (LightGoldenrodYellow 0.98039215686274506 0.98039215686274506 0.82352941176470584) - (LightYellow 1 1 0.8784313725490196) - (yellow 1 1 0) - (gold 1 0.84313725490196079 0) - (LightGoldenrod 0.93333333333333335 0.8666666666666667 0.50980392156862742) - (goldenrod 0.85490196078431369 0.6470588235294118 0.12549019607843137) - (DarkGoldenrod 0.72156862745098038 0.52549019607843139 0.043137254901960784) - (RosyBrown 0.73725490196078436 0.5607843137254902 0.5607843137254902) - (IndianRed 0.80392156862745101 0.36078431372549019 0.36078431372549019) - (SaddleBrown 0.54509803921568623 0.27058823529411763 0.074509803921568626) - (sienna 0.62745098039215685 0.32156862745098042 0.17647058823529413) - (peru 0.80392156862745101 0.52156862745098043 0.24705882352941178) - (burlywood 0.87058823529411766 0.72156862745098038 0.52941176470588236) - (beige 0.96078431372549022 0.96078431372549022 0.86274509803921573) - (wheat 0.96078431372549022 0.87058823529411766 0.70196078431372544) - (SandyBrown 0.95686274509803926 0.64313725490196083 0.37647058823529411) - (tan 0.82352941176470584 0.70588235294117652 0.5490196078431373) - (chocolate 0.82352941176470584 0.41176470588235292 0.11764705882352941) - (firebrick 0.69803921568627447 0.13333333333333333 0.13333333333333333) - (brown 0.6470588235294118 0.16470588235294117 0.16470588235294117) - (DarkSalmon 0.9137254901960784 0.58823529411764708 0.47843137254901963) - (salmon 0.98039215686274506 0.50196078431372548 0.44705882352941179) - (LightSalmon 1 0.62745098039215685 0.47843137254901963) - (orange 1 0.6470588235294118 0) - (DarkOrange 1 0.5490196078431373 0) - (coral 1 0.49803921568627452 0.31372549019607843) - (LightCoral 0.94117647058823528 0.50196078431372548 0.50196078431372548) - (tomato 1 0.38823529411764707 0.27843137254901962) - (OrangeRed 1 0.27058823529411763 0) - (red 1 0 0) - (HotPink 1 0.41176470588235292 0.70588235294117652) - (DeepPink 1 0.078431372549019607 0.57647058823529407) - (pink 1 0.75294117647058822 0.79607843137254897) - (LightPink 1 0.71372549019607845 0.75686274509803919) - (PaleVioletRed 0.85882352941176465 0.4392156862745098 0.57647058823529407) - (maroon 0.69019607843137254 0.18823529411764706 0.37647058823529411) - (MediumVioletRed 0.7803921568627451 0.082352941176470587 0.52156862745098043) - (VioletRed 0.81568627450980391 0.12549019607843137 0.56470588235294117) - (magenta 1 0 1) - (violet 0.93333333333333335 0.50980392156862742 0.93333333333333335) - (plum 0.8666666666666667 0.62745098039215685 0.8666666666666667) - (orchid 0.85490196078431369 0.4392156862745098 0.83921568627450982) - (MediumOrchid 0.72941176470588232 0.33333333333333331 0.82745098039215681) - (DarkOrchid 0.59999999999999998 0.19607843137254902 0.80000000000000004) - (DarkViolet 0.58039215686274515 0 0.82745098039215681) - (BlueViolet 0.54117647058823526 0.16862745098039217 0.88627450980392153) - (purple 0.62745098039215685 0.12549019607843137 0.94117647058823528) - (MediumPurple 0.57647058823529407 0.4392156862745098 0.85882352941176465) - (thistle 0.84705882352941175 0.74901960784313726 0.84705882352941175) - (snow1 1 0.98039215686274506 0.98039215686274506) - (snow2 0.93333333333333335 0.9137254901960784 0.9137254901960784) - (snow3 0.80392156862745101 0.78823529411764703 0.78823529411764703) - (snow4 0.54509803921568623 0.53725490196078429 0.53725490196078429) - (seashell1 1 0.96078431372549022 0.93333333333333335) - (seashell2 0.93333333333333335 0.89803921568627454 0.87058823529411766) - (seashell3 0.80392156862745101 0.77254901960784317 0.74901960784313726) - (seashell4 0.54509803921568623 0.52549019607843139 0.50980392156862742) - (AntiqueWhite1 1 0.93725490196078431 0.85882352941176465) - (AntiqueWhite2 0.93333333333333335 0.87450980392156863 0.80000000000000004) - (AntiqueWhite3 0.80392156862745101 0.75294117647058822 0.69019607843137254) - (AntiqueWhite4 0.54509803921568623 0.51372549019607838 0.47058823529411764) - (bisque1 1 0.89411764705882357 0.7686274509803922) - (bisque2 0.93333333333333335 0.83529411764705885 0.71764705882352942) - (bisque3 0.80392156862745101 0.71764705882352942 0.61960784313725492) - (bisque4 0.54509803921568623 0.49019607843137253 0.41960784313725491) - (PeachPuff1 1 0.85490196078431369 0.72549019607843135) - (PeachPuff2 0.93333333333333335 0.79607843137254897 0.67843137254901964) - (PeachPuff3 0.80392156862745101 0.68627450980392157 0.58431372549019611) - (PeachPuff4 0.54509803921568623 0.46666666666666667 0.396078431372549) - (NavajoWhite1 1 0.87058823529411766 0.67843137254901964) - (NavajoWhite2 0.93333333333333335 0.81176470588235294 0.63137254901960782) - (NavajoWhite3 0.80392156862745101 0.70196078431372544 0.54509803921568623) - (NavajoWhite4 0.54509803921568623 0.47450980392156861 0.36862745098039218) - (LemonChiffon1 1 0.98039215686274506 0.80392156862745101) - (LemonChiffon2 0.93333333333333335 0.9137254901960784 0.74901960784313726) - (LemonChiffon3 0.80392156862745101 0.78823529411764703 0.6470588235294118) - (LemonChiffon4 0.54509803921568623 0.53725490196078429 0.4392156862745098) - (cornsilk1 1 0.97254901960784312 0.86274509803921573) - (cornsilk2 0.93333333333333335 0.90980392156862744 0.80392156862745101) - (cornsilk3 0.80392156862745101 0.78431372549019607 0.69411764705882351) - (cornsilk4 0.54509803921568623 0.53333333333333333 0.47058823529411764) - (ivory1 1 1 0.94117647058823528) - (ivory2 0.93333333333333335 0.93333333333333335 0.8784313725490196) - (ivory3 0.80392156862745101 0.80392156862745101 0.75686274509803919) - (ivory4 0.54509803921568623 0.54509803921568623 0.51372549019607838) - (honeydew1 0.94117647058823528 1 0.94117647058823528) - (honeydew2 0.8784313725490196 0.93333333333333335 0.8784313725490196) - (honeydew3 0.75686274509803919 0.80392156862745101 0.75686274509803919) - (honeydew4 0.51372549019607838 0.54509803921568623 0.51372549019607838) - (LavenderBlush1 1 0.94117647058823528 0.96078431372549022) - (LavenderBlush2 0.93333333333333335 0.8784313725490196 0.89803921568627454) - (LavenderBlush3 0.80392156862745101 0.75686274509803919 0.77254901960784317) - (LavenderBlush4 0.54509803921568623 0.51372549019607838 0.52549019607843139) - (MistyRose1 1 0.89411764705882357 0.88235294117647056) - (MistyRose2 0.93333333333333335 0.83529411764705885 0.82352941176470584) - (MistyRose3 0.80392156862745101 0.71764705882352942 0.70980392156862748) - (MistyRose4 0.54509803921568623 0.49019607843137253 0.4823529411764706) - (azure1 0.94117647058823528 1 1) - (azure2 0.8784313725490196 0.93333333333333335 0.93333333333333335) - (azure3 0.75686274509803919 0.80392156862745101 0.80392156862745101) - (azure4 0.51372549019607838 0.54509803921568623 0.54509803921568623) - (SlateBlue1 0.51372549019607838 0.43529411764705883 1) - (SlateBlue2 0.47843137254901963 0.40392156862745099 0.93333333333333335) - (SlateBlue3 0.41176470588235292 0.34901960784313724 0.80392156862745101) - (SlateBlue4 0.27843137254901962 0.23529411764705882 0.54509803921568623) - (RoyalBlue1 0.28235294117647058 0.46274509803921571 1) - (RoyalBlue2 0.2627450980392157 0.43137254901960786 0.93333333333333335) - (RoyalBlue3 0.22745098039215686 0.37254901960784315 0.80392156862745101) - (RoyalBlue4 0.15294117647058825 0.25098039215686274 0.54509803921568623) - (blue1 0 0 1) - (blue2 0 0 0.93333333333333335) - (blue3 0 0 0.80392156862745101) - (blue4 0 0 0.54509803921568623) - (DodgerBlue1 0.11764705882352941 0.56470588235294117 1) - (DodgerBlue2 0.10980392156862745 0.52549019607843139 0.93333333333333335) - (DodgerBlue3 0.094117647058823528 0.45490196078431372 0.80392156862745101) - (DodgerBlue4 0.062745098039215685 0.30588235294117649 0.54509803921568623) - (SteelBlue1 0.38823529411764707 0.72156862745098038 1) - (SteelBlue2 0.36078431372549019 0.67450980392156867 0.93333333333333335) - (SteelBlue3 0.30980392156862746 0.58039215686274515 0.80392156862745101) - (SteelBlue4 0.21176470588235294 0.39215686274509803 0.54509803921568623) - (DeepSkyBlue1 0 0.74901960784313726 1) - (DeepSkyBlue2 0 0.69803921568627447 0.93333333333333335) - (DeepSkyBlue3 0 0.60392156862745094 0.80392156862745101) - (DeepSkyBlue4 0 0.40784313725490196 0.54509803921568623) - (SkyBlue1 0.52941176470588236 0.80784313725490198 1) - (SkyBlue2 0.49411764705882355 0.75294117647058822 0.93333333333333335) - (SkyBlue3 0.42352941176470588 0.65098039215686276 0.80392156862745101) - (SkyBlue4 0.29019607843137257 0.4392156862745098 0.54509803921568623) - (LightSkyBlue1 0.69019607843137254 0.88627450980392153 1) - (LightSkyBlue2 0.64313725490196083 0.82745098039215681 0.93333333333333335) - (LightSkyBlue3 0.55294117647058827 0.71372549019607845 0.80392156862745101) - (LightSkyBlue4 0.37647058823529411 0.4823529411764706 0.54509803921568623) - (SlateGray1 0.77647058823529413 0.88627450980392153 1) - (SlateGray2 0.72549019607843135 0.82745098039215681 0.93333333333333335) - (SlateGray3 0.62352941176470589 0.71372549019607845 0.80392156862745101) - (SlateGray4 0.42352941176470588 0.4823529411764706 0.54509803921568623) - (LightSteelBlue1 0.792156862745098 0.88235294117647056 1) - (LightSteelBlue2 0.73725490196078436 0.82352941176470584 0.93333333333333335) - (LightSteelBlue3 0.63529411764705879 0.70980392156862748 0.80392156862745101) - (LightSteelBlue4 0.43137254901960786 0.4823529411764706 0.54509803921568623) - (LightBlue1 0.74901960784313726 0.93725490196078431 1) - (LightBlue2 0.69803921568627447 0.87450980392156863 0.93333333333333335) - (LightBlue3 0.60392156862745094 0.75294117647058822 0.80392156862745101) - (LightBlue4 0.40784313725490196 0.51372549019607838 0.54509803921568623) - (LightCyan1 0.8784313725490196 1 1) - (LightCyan2 0.81960784313725488 0.93333333333333335 0.93333333333333335) - (LightCyan3 0.70588235294117652 0.80392156862745101 0.80392156862745101) - (LightCyan4 0.47843137254901963 0.54509803921568623 0.54509803921568623) - (PaleTurquoise1 0.73333333333333328 1 1) - (PaleTurquoise2 0.68235294117647061 0.93333333333333335 0.93333333333333335) - (PaleTurquoise3 0.58823529411764708 0.80392156862745101 0.80392156862745101) - (PaleTurquoise4 0.40000000000000002 0.54509803921568623 0.54509803921568623) - (CadetBlue1 0.59607843137254901 0.96078431372549022 1) - (CadetBlue2 0.55686274509803924 0.89803921568627454 0.93333333333333335) - (CadetBlue3 0.47843137254901963 0.77254901960784317 0.80392156862745101) - (CadetBlue4 0.32549019607843138 0.52549019607843139 0.54509803921568623) - (turquoise1 0 0.96078431372549022 1) - (turquoise2 0 0.89803921568627454 0.93333333333333335) - (turquoise3 0 0.77254901960784317 0.80392156862745101) - (turquoise4 0 0.52549019607843139 0.54509803921568623) - (cyan1 0 1 1) - (cyan2 0 0.93333333333333335 0.93333333333333335) - (cyan3 0 0.80392156862745101 0.80392156862745101) - (cyan4 0 0.54509803921568623 0.54509803921568623) - (DarkSlateGray1 0.59215686274509804 1 1) - (DarkSlateGray2 0.55294117647058827 0.93333333333333335 0.93333333333333335) - (DarkSlateGray3 0.47450980392156861 0.80392156862745101 0.80392156862745101) - (DarkSlateGray4 0.32156862745098042 0.54509803921568623 0.54509803921568623) - (aquamarine1 0.49803921568627452 1 0.83137254901960789) - (aquamarine2 0.46274509803921571 0.93333333333333335 0.77647058823529413) - (aquamarine3 0.40000000000000002 0.80392156862745101 0.66666666666666663) - (aquamarine4 0.27058823529411763 0.54509803921568623 0.45490196078431372) - (DarkSeaGreen1 0.75686274509803919 1 0.75686274509803919) - (DarkSeaGreen2 0.70588235294117652 0.93333333333333335 0.70588235294117652) - (DarkSeaGreen3 0.60784313725490191 0.80392156862745101 0.60784313725490191) - (DarkSeaGreen4 0.41176470588235292 0.54509803921568623 0.41176470588235292) - (SeaGreen1 0.32941176470588235 1 0.62352941176470589) - (SeaGreen2 0.30588235294117649 0.93333333333333335 0.58039215686274515) - (SeaGreen3 0.2627450980392157 0.80392156862745101 0.50196078431372548) - (SeaGreen4 0.1803921568627451 0.54509803921568623 0.3411764705882353) - (PaleGreen1 0.60392156862745094 1 0.60392156862745094) - (PaleGreen2 0.56470588235294117 0.93333333333333335 0.56470588235294117) - (PaleGreen3 0.48627450980392156 0.80392156862745101 0.48627450980392156) - (PaleGreen4 0.32941176470588235 0.54509803921568623 0.32941176470588235) - (SpringGreen1 0 1 0.49803921568627452) - (SpringGreen2 0 0.93333333333333335 0.46274509803921571) - (SpringGreen3 0 0.80392156862745101 0.40000000000000002) - (SpringGreen4 0 0.54509803921568623 0.27058823529411763) - (green1 0 1 0) - (green2 0 0.93333333333333335 0) - (green3 0 0.80392156862745101 0) - (green4 0 0.54509803921568623 0) - (chartreuse1 0.49803921568627452 1 0) - (chartreuse2 0.46274509803921571 0.93333333333333335 0) - (chartreuse3 0.40000000000000002 0.80392156862745101 0) - (chartreuse4 0.27058823529411763 0.54509803921568623 0) - (OliveDrab1 0.75294117647058822 1 0.24313725490196078) - (OliveDrab2 0.70196078431372544 0.93333333333333335 0.22745098039215686) - (OliveDrab3 0.60392156862745094 0.80392156862745101 0.19607843137254902) - (OliveDrab4 0.41176470588235292 0.54509803921568623 0.13333333333333333) - (DarkOliveGreen1 0.792156862745098 1 0.4392156862745098) - (DarkOliveGreen2 0.73725490196078436 0.93333333333333335 0.40784313725490196) - (DarkOliveGreen3 0.63529411764705879 0.80392156862745101 0.35294117647058826) - (DarkOliveGreen4 0.43137254901960786 0.54509803921568623 0.23921568627450981) - (khaki1 1 0.96470588235294119 0.5607843137254902) - (khaki2 0.93333333333333335 0.90196078431372551 0.52156862745098043) - (khaki3 0.80392156862745101 0.77647058823529413 0.45098039215686275) - (khaki4 0.54509803921568623 0.52549019607843139 0.30588235294117649) - (LightGoldenrod1 1 0.92549019607843142 0.54509803921568623) - (LightGoldenrod2 0.93333333333333335 0.86274509803921573 0.50980392156862742) - (LightGoldenrod3 0.80392156862745101 0.74509803921568629 0.4392156862745098) - (LightGoldenrod4 0.54509803921568623 0.50588235294117645 0.29803921568627451) - (LightYellow1 1 1 0.8784313725490196) - (LightYellow2 0.93333333333333335 0.93333333333333335 0.81960784313725488) - (LightYellow3 0.80392156862745101 0.80392156862745101 0.70588235294117652) - (LightYellow4 0.54509803921568623 0.54509803921568623 0.47843137254901963) - (yellow1 1 1 0) - (yellow2 0.93333333333333335 0.93333333333333335 0) - (yellow3 0.80392156862745101 0.80392156862745101 0) - (yellow4 0.54509803921568623 0.54509803921568623 0) - (gold1 1 0.84313725490196079 0) - (gold2 0.93333333333333335 0.78823529411764703 0) - (gold3 0.80392156862745101 0.67843137254901964 0) - (gold4 0.54509803921568623 0.45882352941176469 0) - (goldenrod1 1 0.75686274509803919 0.14509803921568629) - (goldenrod2 0.93333333333333335 0.70588235294117652 0.13333333333333333) - (goldenrod3 0.80392156862745101 0.60784313725490191 0.11372549019607843) - (goldenrod4 0.54509803921568623 0.41176470588235292 0.078431372549019607) - (DarkGoldenrod1 1 0.72549019607843135 0.058823529411764705) - (DarkGoldenrod2 0.93333333333333335 0.67843137254901964 0.054901960784313725) - (DarkGoldenrod3 0.80392156862745101 0.58431372549019611 0.047058823529411764) - (DarkGoldenrod4 0.54509803921568623 0.396078431372549 0.031372549019607843) - (RosyBrown1 1 0.75686274509803919 0.75686274509803919) - (RosyBrown2 0.93333333333333335 0.70588235294117652 0.70588235294117652) - (RosyBrown3 0.80392156862745101 0.60784313725490191 0.60784313725490191) - (RosyBrown4 0.54509803921568623 0.41176470588235292 0.41176470588235292) - (IndianRed1 1 0.41568627450980394 0.41568627450980394) - (IndianRed2 0.93333333333333335 0.38823529411764707 0.38823529411764707) - (IndianRed3 0.80392156862745101 0.33333333333333331 0.33333333333333331) - (IndianRed4 0.54509803921568623 0.22745098039215686 0.22745098039215686) - (sienna1 1 0.50980392156862742 0.27843137254901962) - (sienna2 0.93333333333333335 0.47450980392156861 0.25882352941176473) - (sienna3 0.80392156862745101 0.40784313725490196 0.22352941176470589) - (sienna4 0.54509803921568623 0.27843137254901962 0.14901960784313725) - (burlywood1 1 0.82745098039215681 0.60784313725490191) - (burlywood2 0.93333333333333335 0.77254901960784317 0.56862745098039214) - (burlywood3 0.80392156862745101 0.66666666666666663 0.49019607843137253) - (burlywood4 0.54509803921568623 0.45098039215686275 0.33333333333333331) - (wheat1 1 0.90588235294117647 0.72941176470588232) - (wheat2 0.93333333333333335 0.84705882352941175 0.68235294117647061) - (wheat3 0.80392156862745101 0.72941176470588232 0.58823529411764708) - (wheat4 0.54509803921568623 0.49411764705882355 0.40000000000000002) - (tan1 1 0.6470588235294118 0.30980392156862746) - (tan2 0.93333333333333335 0.60392156862745094 0.28627450980392155) - (tan3 0.80392156862745101 0.52156862745098043 0.24705882352941178) - (tan4 0.54509803921568623 0.35294117647058826 0.16862745098039217) - (chocolate1 1 0.49803921568627452 0.14117647058823529) - (chocolate2 0.93333333333333335 0.46274509803921571 0.12941176470588237) - (chocolate3 0.80392156862745101 0.40000000000000002 0.11372549019607843) - (chocolate4 0.54509803921568623 0.27058823529411763 0.074509803921568626) - (firebrick1 1 0.18823529411764706 0.18823529411764706) - (firebrick2 0.93333333333333335 0.17254901960784313 0.17254901960784313) - (firebrick3 0.80392156862745101 0.14901960784313725 0.14901960784313725) - (firebrick4 0.54509803921568623 0.10196078431372549 0.10196078431372549) - (brown1 1 0.25098039215686274 0.25098039215686274) - (brown2 0.93333333333333335 0.23137254901960785 0.23137254901960785) - (brown3 0.80392156862745101 0.20000000000000001 0.20000000000000001) - (brown4 0.54509803921568623 0.13725490196078433 0.13725490196078433) - (salmon1 1 0.5490196078431373 0.41176470588235292) - (salmon2 0.93333333333333335 0.50980392156862742 0.3843137254901961) - (salmon3 0.80392156862745101 0.4392156862745098 0.32941176470588235) - (salmon4 0.54509803921568623 0.29803921568627451 0.22352941176470589) - (LightSalmon1 1 0.62745098039215685 0.47843137254901963) - (LightSalmon2 0.93333333333333335 0.58431372549019611 0.44705882352941179) - (LightSalmon3 0.80392156862745101 0.50588235294117645 0.3843137254901961) - (LightSalmon4 0.54509803921568623 0.3411764705882353 0.25882352941176473) - (orange1 1 0.6470588235294118 0) - (orange2 0.93333333333333335 0.60392156862745094 0) - (orange3 0.80392156862745101 0.52156862745098043 0) - (orange4 0.54509803921568623 0.35294117647058826 0) - (DarkOrange1 1 0.49803921568627452 0) - (DarkOrange2 0.93333333333333335 0.46274509803921571 0) - (DarkOrange3 0.80392156862745101 0.40000000000000002 0) - (DarkOrange4 0.54509803921568623 0.27058823529411763 0) - (coral1 1 0.44705882352941179 0.33725490196078434) - (coral2 0.93333333333333335 0.41568627450980394 0.31372549019607843) - (coral3 0.80392156862745101 0.35686274509803922 0.27058823529411763) - (coral4 0.54509803921568623 0.24313725490196078 0.18431372549019609) - (tomato1 1 0.38823529411764707 0.27843137254901962) - (tomato2 0.93333333333333335 0.36078431372549019 0.25882352941176473) - (tomato3 0.80392156862745101 0.30980392156862746 0.22352941176470589) - (tomato4 0.54509803921568623 0.21176470588235294 0.14901960784313725) - (OrangeRed1 1 0.27058823529411763 0) - (OrangeRed2 0.93333333333333335 0.25098039215686274 0) - (OrangeRed3 0.80392156862745101 0.21568627450980393 0) - (OrangeRed4 0.54509803921568623 0.14509803921568629 0) - (red1 1 0 0) - (red2 0.93333333333333335 0 0) - (red3 0.80392156862745101 0 0) - (red4 0.54509803921568623 0 0) - (DeepPink1 1 0.078431372549019607 0.57647058823529407) - (DeepPink2 0.93333333333333335 0.070588235294117646 0.53725490196078429) - (DeepPink3 0.80392156862745101 0.062745098039215685 0.46274509803921571) - (DeepPink4 0.54509803921568623 0.039215686274509803 0.31372549019607843) - (HotPink1 1 0.43137254901960786 0.70588235294117652) - (HotPink2 0.93333333333333335 0.41568627450980394 0.65490196078431373) - (HotPink3 0.80392156862745101 0.37647058823529411 0.56470588235294117) - (HotPink4 0.54509803921568623 0.22745098039215686 0.3843137254901961) - (pink1 1 0.70980392156862748 0.77254901960784317) - (pink2 0.93333333333333335 0.66274509803921566 0.72156862745098038) - (pink3 0.80392156862745101 0.56862745098039214 0.61960784313725492) - (pink4 0.54509803921568623 0.38823529411764707 0.42352941176470588) - (LightPink1 1 0.68235294117647061 0.72549019607843135) - (LightPink2 0.93333333333333335 0.63529411764705879 0.67843137254901964) - (LightPink3 0.80392156862745101 0.5490196078431373 0.58431372549019611) - (LightPink4 0.54509803921568623 0.37254901960784315 0.396078431372549) - (PaleVioletRed1 1 0.50980392156862742 0.6705882352941176) - (PaleVioletRed2 0.93333333333333335 0.47450980392156861 0.62352941176470589) - (PaleVioletRed3 0.80392156862745101 0.40784313725490196 0.53725490196078429) - (PaleVioletRed4 0.54509803921568623 0.27843137254901962 0.36470588235294116) - (maroon1 1 0.20392156862745098 0.70196078431372544) - (maroon2 0.93333333333333335 0.18823529411764706 0.65490196078431373) - (maroon3 0.80392156862745101 0.16078431372549021 0.56470588235294117) - (maroon4 0.54509803921568623 0.10980392156862745 0.3843137254901961) - (VioletRed1 1 0.24313725490196078 0.58823529411764708) - (VioletRed2 0.93333333333333335 0.22745098039215686 0.5490196078431373) - (VioletRed3 0.80392156862745101 0.19607843137254902 0.47058823529411764) - (VioletRed4 0.54509803921568623 0.13333333333333333 0.32156862745098042) - (magenta1 1 0 1) - (magenta2 0.93333333333333335 0 0.93333333333333335) - (magenta3 0.80392156862745101 0 0.80392156862745101) - (magenta4 0.54509803921568623 0 0.54509803921568623) - (orchid1 1 0.51372549019607838 0.98039215686274506) - (orchid2 0.93333333333333335 0.47843137254901963 0.9137254901960784) - (orchid3 0.80392156862745101 0.41176470588235292 0.78823529411764703) - (orchid4 0.54509803921568623 0.27843137254901962 0.53725490196078429) - (plum1 1 0.73333333333333328 1) - (plum2 0.93333333333333335 0.68235294117647061 0.93333333333333335) - (plum3 0.80392156862745101 0.58823529411764708 0.80392156862745101) - (plum4 0.54509803921568623 0.40000000000000002 0.54509803921568623) - (MediumOrchid1 0.8784313725490196 0.40000000000000002 1) - (MediumOrchid2 0.81960784313725488 0.37254901960784315 0.93333333333333335) - (MediumOrchid3 0.70588235294117652 0.32156862745098042 0.80392156862745101) - (MediumOrchid4 0.47843137254901963 0.21568627450980393 0.54509803921568623) - (DarkOrchid1 0.74901960784313726 0.24313725490196078 1) - (DarkOrchid2 0.69803921568627447 0.22745098039215686 0.93333333333333335) - (DarkOrchid3 0.60392156862745094 0.19607843137254902 0.80392156862745101) - (DarkOrchid4 0.40784313725490196 0.13333333333333333 0.54509803921568623) - (purple1 0.60784313725490191 0.18823529411764706 1) - (purple2 0.56862745098039214 0.17254901960784313 0.93333333333333335) - (purple3 0.49019607843137253 0.14901960784313725 0.80392156862745101) - (purple4 0.33333333333333331 0.10196078431372549 0.54509803921568623) - (MediumPurple1 0.6705882352941176 0.50980392156862742 1) - (MediumPurple2 0.62352941176470589 0.47450980392156861 0.93333333333333335) - (MediumPurple3 0.53725490196078429 0.40784313725490196 0.80392156862745101) - (MediumPurple4 0.36470588235294116 0.27843137254901962 0.54509803921568623) - (thistle1 1 0.88235294117647056 1) - (thistle2 0.93333333333333335 0.82352941176470584 0.93333333333333335) - (thistle3 0.80392156862745101 0.70980392156862748 0.80392156862745101) - (thistle4 0.54509803921568623 0.4823529411764706 0.54509803921568623) - (gray0 0 0 0) - (grey0 0 0 0) - (gray1 0.011764705882352941 0.011764705882352941 0.011764705882352941) - (grey1 0.011764705882352941 0.011764705882352941 0.011764705882352941) - (gray2 0.019607843137254902 0.019607843137254902 0.019607843137254902) - (grey2 0.019607843137254902 0.019607843137254902 0.019607843137254902) - (gray3 0.031372549019607843 0.031372549019607843 0.031372549019607843) - (grey3 0.031372549019607843 0.031372549019607843 0.031372549019607843) - (gray4 0.039215686274509803 0.039215686274509803 0.039215686274509803) - (grey4 0.039215686274509803 0.039215686274509803 0.039215686274509803) - (gray5 0.050980392156862744 0.050980392156862744 0.050980392156862744) - (grey5 0.050980392156862744 0.050980392156862744 0.050980392156862744) - (gray6 0.058823529411764705 0.058823529411764705 0.058823529411764705) - (grey6 0.058823529411764705 0.058823529411764705 0.058823529411764705) - (gray7 0.070588235294117646 0.070588235294117646 0.070588235294117646) - (grey7 0.070588235294117646 0.070588235294117646 0.070588235294117646) - (gray8 0.078431372549019607 0.078431372549019607 0.078431372549019607) - (grey8 0.078431372549019607 0.078431372549019607 0.078431372549019607) - (gray9 0.090196078431372548 0.090196078431372548 0.090196078431372548) - (grey9 0.090196078431372548 0.090196078431372548 0.090196078431372548) - (gray10 0.10196078431372549 0.10196078431372549 0.10196078431372549) - (grey10 0.10196078431372549 0.10196078431372549 0.10196078431372549) - (gray11 0.10980392156862745 0.10980392156862745 0.10980392156862745) - (grey11 0.10980392156862745 0.10980392156862745 0.10980392156862745) - (gray12 0.12156862745098039 0.12156862745098039 0.12156862745098039) - (grey12 0.12156862745098039 0.12156862745098039 0.12156862745098039) - (gray13 0.12941176470588237 0.12941176470588237 0.12941176470588237) - (grey13 0.12941176470588237 0.12941176470588237 0.12941176470588237) - (gray14 0.14117647058823529 0.14117647058823529 0.14117647058823529) - (grey14 0.14117647058823529 0.14117647058823529 0.14117647058823529) - (gray15 0.14901960784313725 0.14901960784313725 0.14901960784313725) - (grey15 0.14901960784313725 0.14901960784313725 0.14901960784313725) - (gray16 0.16078431372549021 0.16078431372549021 0.16078431372549021) - (grey16 0.16078431372549021 0.16078431372549021 0.16078431372549021) - (gray17 0.16862745098039217 0.16862745098039217 0.16862745098039217) - (grey17 0.16862745098039217 0.16862745098039217 0.16862745098039217) - (gray18 0.1803921568627451 0.1803921568627451 0.1803921568627451) - (grey18 0.1803921568627451 0.1803921568627451 0.1803921568627451) - (gray19 0.18823529411764706 0.18823529411764706 0.18823529411764706) - (grey19 0.18823529411764706 0.18823529411764706 0.18823529411764706) - (gray20 0.20000000000000001 0.20000000000000001 0.20000000000000001) - (grey20 0.20000000000000001 0.20000000000000001 0.20000000000000001) - (gray21 0.21176470588235294 0.21176470588235294 0.21176470588235294) - (grey21 0.21176470588235294 0.21176470588235294 0.21176470588235294) - (gray22 0.2196078431372549 0.2196078431372549 0.2196078431372549) - (grey22 0.2196078431372549 0.2196078431372549 0.2196078431372549) - (gray23 0.23137254901960785 0.23137254901960785 0.23137254901960785) - (grey23 0.23137254901960785 0.23137254901960785 0.23137254901960785) - (gray24 0.23921568627450981 0.23921568627450981 0.23921568627450981) - (grey24 0.23921568627450981 0.23921568627450981 0.23921568627450981) - (gray25 0.25098039215686274 0.25098039215686274 0.25098039215686274) - (grey25 0.25098039215686274 0.25098039215686274 0.25098039215686274) - (gray26 0.25882352941176473 0.25882352941176473 0.25882352941176473) - (grey26 0.25882352941176473 0.25882352941176473 0.25882352941176473) - (gray27 0.27058823529411763 0.27058823529411763 0.27058823529411763) - (grey27 0.27058823529411763 0.27058823529411763 0.27058823529411763) - (gray28 0.27843137254901962 0.27843137254901962 0.27843137254901962) - (grey28 0.27843137254901962 0.27843137254901962 0.27843137254901962) - (gray29 0.29019607843137257 0.29019607843137257 0.29019607843137257) - (grey29 0.29019607843137257 0.29019607843137257 0.29019607843137257) - (gray30 0.30196078431372547 0.30196078431372547 0.30196078431372547) - (grey30 0.30196078431372547 0.30196078431372547 0.30196078431372547) - (gray31 0.30980392156862746 0.30980392156862746 0.30980392156862746) - (grey31 0.30980392156862746 0.30980392156862746 0.30980392156862746) - (gray32 0.32156862745098042 0.32156862745098042 0.32156862745098042) - (grey32 0.32156862745098042 0.32156862745098042 0.32156862745098042) - (gray33 0.32941176470588235 0.32941176470588235 0.32941176470588235) - (grey33 0.32941176470588235 0.32941176470588235 0.32941176470588235) - (gray34 0.3411764705882353 0.3411764705882353 0.3411764705882353) - (grey34 0.3411764705882353 0.3411764705882353 0.3411764705882353) - (gray35 0.34901960784313724 0.34901960784313724 0.34901960784313724) - (grey35 0.34901960784313724 0.34901960784313724 0.34901960784313724) - (gray36 0.36078431372549019 0.36078431372549019 0.36078431372549019) - (grey36 0.36078431372549019 0.36078431372549019 0.36078431372549019) - (gray37 0.36862745098039218 0.36862745098039218 0.36862745098039218) - (grey37 0.36862745098039218 0.36862745098039218 0.36862745098039218) - (gray38 0.38039215686274508 0.38039215686274508 0.38039215686274508) - (grey38 0.38039215686274508 0.38039215686274508 0.38039215686274508) - (gray39 0.38823529411764707 0.38823529411764707 0.38823529411764707) - (grey39 0.38823529411764707 0.38823529411764707 0.38823529411764707) - (gray40 0.40000000000000002 0.40000000000000002 0.40000000000000002) - (grey40 0.40000000000000002 0.40000000000000002 0.40000000000000002) - (gray41 0.41176470588235292 0.41176470588235292 0.41176470588235292) - (grey41 0.41176470588235292 0.41176470588235292 0.41176470588235292) - (gray42 0.41960784313725491 0.41960784313725491 0.41960784313725491) - (grey42 0.41960784313725491 0.41960784313725491 0.41960784313725491) - (gray43 0.43137254901960786 0.43137254901960786 0.43137254901960786) - (grey43 0.43137254901960786 0.43137254901960786 0.43137254901960786) - (gray44 0.4392156862745098 0.4392156862745098 0.4392156862745098) - (grey44 0.4392156862745098 0.4392156862745098 0.4392156862745098) - (gray45 0.45098039215686275 0.45098039215686275 0.45098039215686275) - (grey45 0.45098039215686275 0.45098039215686275 0.45098039215686275) - (gray46 0.45882352941176469 0.45882352941176469 0.45882352941176469) - (grey46 0.45882352941176469 0.45882352941176469 0.45882352941176469) - (gray47 0.47058823529411764 0.47058823529411764 0.47058823529411764) - (grey47 0.47058823529411764 0.47058823529411764 0.47058823529411764) - (gray48 0.47843137254901963 0.47843137254901963 0.47843137254901963) - (grey48 0.47843137254901963 0.47843137254901963 0.47843137254901963) - (gray49 0.49019607843137253 0.49019607843137253 0.49019607843137253) - (grey49 0.49019607843137253 0.49019607843137253 0.49019607843137253) - (gray50 0.49803921568627452 0.49803921568627452 0.49803921568627452) - (grey50 0.49803921568627452 0.49803921568627452 0.49803921568627452) - (gray51 0.50980392156862742 0.50980392156862742 0.50980392156862742) - (grey51 0.50980392156862742 0.50980392156862742 0.50980392156862742) - (gray52 0.52156862745098043 0.52156862745098043 0.52156862745098043) - (grey52 0.52156862745098043 0.52156862745098043 0.52156862745098043) - (gray53 0.52941176470588236 0.52941176470588236 0.52941176470588236) - (grey53 0.52941176470588236 0.52941176470588236 0.52941176470588236) - (gray54 0.54117647058823526 0.54117647058823526 0.54117647058823526) - (grey54 0.54117647058823526 0.54117647058823526 0.54117647058823526) - (gray55 0.5490196078431373 0.5490196078431373 0.5490196078431373) - (grey55 0.5490196078431373 0.5490196078431373 0.5490196078431373) - (gray56 0.5607843137254902 0.5607843137254902 0.5607843137254902) - (grey56 0.5607843137254902 0.5607843137254902 0.5607843137254902) - (gray57 0.56862745098039214 0.56862745098039214 0.56862745098039214) - (grey57 0.56862745098039214 0.56862745098039214 0.56862745098039214) - (gray58 0.58039215686274515 0.58039215686274515 0.58039215686274515) - (grey58 0.58039215686274515 0.58039215686274515 0.58039215686274515) - (gray59 0.58823529411764708 0.58823529411764708 0.58823529411764708) - (grey59 0.58823529411764708 0.58823529411764708 0.58823529411764708) - (gray60 0.59999999999999998 0.59999999999999998 0.59999999999999998) - (grey60 0.59999999999999998 0.59999999999999998 0.59999999999999998) - (gray61 0.61176470588235299 0.61176470588235299 0.61176470588235299) - (grey61 0.61176470588235299 0.61176470588235299 0.61176470588235299) - (gray62 0.61960784313725492 0.61960784313725492 0.61960784313725492) - (grey62 0.61960784313725492 0.61960784313725492 0.61960784313725492) - (gray63 0.63137254901960782 0.63137254901960782 0.63137254901960782) - (grey63 0.63137254901960782 0.63137254901960782 0.63137254901960782) - (gray64 0.63921568627450975 0.63921568627450975 0.63921568627450975) - (grey64 0.63921568627450975 0.63921568627450975 0.63921568627450975) - (gray65 0.65098039215686276 0.65098039215686276 0.65098039215686276) - (grey65 0.65098039215686276 0.65098039215686276 0.65098039215686276) - (gray66 0.6588235294117647 0.6588235294117647 0.6588235294117647) - (grey66 0.6588235294117647 0.6588235294117647 0.6588235294117647) - (gray67 0.6705882352941176 0.6705882352941176 0.6705882352941176) - (grey67 0.6705882352941176 0.6705882352941176 0.6705882352941176) - (gray68 0.67843137254901964 0.67843137254901964 0.67843137254901964) - (grey68 0.67843137254901964 0.67843137254901964 0.67843137254901964) - (gray69 0.69019607843137254 0.69019607843137254 0.69019607843137254) - (grey69 0.69019607843137254 0.69019607843137254 0.69019607843137254) - (gray70 0.70196078431372544 0.70196078431372544 0.70196078431372544) - (grey70 0.70196078431372544 0.70196078431372544 0.70196078431372544) - (gray71 0.70980392156862748 0.70980392156862748 0.70980392156862748) - (grey71 0.70980392156862748 0.70980392156862748 0.70980392156862748) - (gray72 0.72156862745098038 0.72156862745098038 0.72156862745098038) - (grey72 0.72156862745098038 0.72156862745098038 0.72156862745098038) - (gray73 0.72941176470588232 0.72941176470588232 0.72941176470588232) - (grey73 0.72941176470588232 0.72941176470588232 0.72941176470588232) - (gray74 0.74117647058823533 0.74117647058823533 0.74117647058823533) - (grey74 0.74117647058823533 0.74117647058823533 0.74117647058823533) - (gray75 0.74901960784313726 0.74901960784313726 0.74901960784313726) - (grey75 0.74901960784313726 0.74901960784313726 0.74901960784313726) - (gray76 0.76078431372549016 0.76078431372549016 0.76078431372549016) - (grey76 0.76078431372549016 0.76078431372549016 0.76078431372549016) - (gray77 0.7686274509803922 0.7686274509803922 0.7686274509803922) - (grey77 0.7686274509803922 0.7686274509803922 0.7686274509803922) - (gray78 0.7803921568627451 0.7803921568627451 0.7803921568627451) - (grey78 0.7803921568627451 0.7803921568627451 0.7803921568627451) - (gray79 0.78823529411764703 0.78823529411764703 0.78823529411764703) - (grey79 0.78823529411764703 0.78823529411764703 0.78823529411764703) - (gray80 0.80000000000000004 0.80000000000000004 0.80000000000000004) - (grey80 0.80000000000000004 0.80000000000000004 0.80000000000000004) - (gray81 0.81176470588235294 0.81176470588235294 0.81176470588235294) - (grey81 0.81176470588235294 0.81176470588235294 0.81176470588235294) - (gray82 0.81960784313725488 0.81960784313725488 0.81960784313725488) - (grey82 0.81960784313725488 0.81960784313725488 0.81960784313725488) - (gray83 0.83137254901960789 0.83137254901960789 0.83137254901960789) - (grey83 0.83137254901960789 0.83137254901960789 0.83137254901960789) - (gray84 0.83921568627450982 0.83921568627450982 0.83921568627450982) - (grey84 0.83921568627450982 0.83921568627450982 0.83921568627450982) - (gray85 0.85098039215686272 0.85098039215686272 0.85098039215686272) - (grey85 0.85098039215686272 0.85098039215686272 0.85098039215686272) - (gray86 0.85882352941176465 0.85882352941176465 0.85882352941176465) - (grey86 0.85882352941176465 0.85882352941176465 0.85882352941176465) - (gray87 0.87058823529411766 0.87058823529411766 0.87058823529411766) - (grey87 0.87058823529411766 0.87058823529411766 0.87058823529411766) - (gray88 0.8784313725490196 0.8784313725490196 0.8784313725490196) - (grey88 0.8784313725490196 0.8784313725490196 0.8784313725490196) - (gray89 0.8901960784313725 0.8901960784313725 0.8901960784313725) - (grey89 0.8901960784313725 0.8901960784313725 0.8901960784313725) - (gray90 0.89803921568627454 0.89803921568627454 0.89803921568627454) - (grey90 0.89803921568627454 0.89803921568627454 0.89803921568627454) - (gray91 0.90980392156862744 0.90980392156862744 0.90980392156862744) - (grey91 0.90980392156862744 0.90980392156862744 0.90980392156862744) - (gray92 0.92156862745098034 0.92156862745098034 0.92156862745098034) - (grey92 0.92156862745098034 0.92156862745098034 0.92156862745098034) - (gray93 0.92941176470588238 0.92941176470588238 0.92941176470588238) - (grey93 0.92941176470588238 0.92941176470588238 0.92941176470588238) - (gray94 0.94117647058823528 0.94117647058823528 0.94117647058823528) - (grey94 0.94117647058823528 0.94117647058823528 0.94117647058823528) - (gray95 0.94901960784313721 0.94901960784313721 0.94901960784313721) - (grey95 0.94901960784313721 0.94901960784313721 0.94901960784313721) - (gray96 0.96078431372549022 0.96078431372549022 0.96078431372549022) - (grey96 0.96078431372549022 0.96078431372549022 0.96078431372549022) - (gray97 0.96862745098039216 0.96862745098039216 0.96862745098039216) - (grey97 0.96862745098039216 0.96862745098039216 0.96862745098039216) - (gray98 0.98039215686274506 0.98039215686274506 0.98039215686274506) - (grey98 0.98039215686274506 0.98039215686274506 0.98039215686274506) - (gray99 0.9882352941176471 0.9882352941176471 0.9882352941176471) - (grey99 0.9882352941176471 0.9882352941176471 0.9882352941176471) - (gray100 1 1 1) - (grey100 1 1 1) - (DarkGrey 0.66274509803921566 0.66274509803921566 0.66274509803921566) - (DarkGray 0.66274509803921566 0.66274509803921566 0.66274509803921566) - (DarkBlue 0 0 0.54509803921568623) - (DarkCyan 0 0.54509803921568623 0.54509803921568623) - (DarkMagenta 0.54509803921568623 0 0.54509803921568623) - (DarkRed 0.54509803921568623 0 0) - (LightGreen 0.56470588235294117 0.93333333333333335 0.56470588235294117) - - ))) +(define x11-color-list + '((snow 1 0.98039215686274506 0.98039215686274506) + (GhostWhite 0.97254901960784312 0.97254901960784312 1) + (WhiteSmoke 0.96078431372549022 0.96078431372549022 0.96078431372549022) + (gainsboro 0.86274509803921573 0.86274509803921573 0.86274509803921573) + (FloralWhite 1 0.98039215686274506 0.94117647058823528) + (OldLace 0.99215686274509807 0.96078431372549022 0.90196078431372551) + (linen 0.98039215686274506 0.94117647058823528 0.90196078431372551) + (AntiqueWhite 0.98039215686274506 0.92156862745098034 0.84313725490196079) + (PapayaWhip 1 0.93725490196078431 0.83529411764705885) + (BlanchedAlmond 1 0.92156862745098034 0.80392156862745101) + (bisque 1 0.89411764705882357 0.7686274509803922) + (PeachPuff 1 0.85490196078431369 0.72549019607843135) + (NavajoWhite 1 0.87058823529411766 0.67843137254901964) + (moccasin 1 0.89411764705882357 0.70980392156862748) + (cornsilk 1 0.97254901960784312 0.86274509803921573) + (ivory 1 1 0.94117647058823528) + (LemonChiffon 1 0.98039215686274506 0.80392156862745101) + (seashell 1 0.96078431372549022 0.93333333333333335) + (honeydew 0.94117647058823528 1 0.94117647058823528) + (MintCream 0.96078431372549022 1 0.98039215686274506) + (azure 0.94117647058823528 1 1) + (AliceBlue 0.94117647058823528 0.97254901960784312 1) + (lavender 0.90196078431372551 0.90196078431372551 0.98039215686274506) + (LavenderBlush 1 0.94117647058823528 0.96078431372549022) + (MistyRose 1 0.89411764705882357 0.88235294117647056) + (white 1 1 1) + (black 0 0 0) + (DarkSlateGray 0.18431372549019609 0.30980392156862746 0.30980392156862746) + (DarkSlateGrey 0.18431372549019609 0.30980392156862746 0.30980392156862746) + (DimGray 0.41176470588235292 0.41176470588235292 0.41176470588235292) + (DimGrey 0.41176470588235292 0.41176470588235292 0.41176470588235292) + (SlateGray 0.4392156862745098 0.50196078431372548 0.56470588235294117) + (SlateGrey 0.4392156862745098 0.50196078431372548 0.56470588235294117) + (LightSlateGray 0.46666666666666667 0.53333333333333333 0.59999999999999998) + (LightSlateGrey 0.46666666666666667 0.53333333333333333 0.59999999999999998) + (gray 0.74509803921568629 0.74509803921568629 0.74509803921568629) + (grey 0.74509803921568629 0.74509803921568629 0.74509803921568629) + (LightGrey 0.82745098039215681 0.82745098039215681 0.82745098039215681) + (LightGray 0.82745098039215681 0.82745098039215681 0.82745098039215681) + (MidnightBlue 0.098039215686274508 0.098039215686274508 0.4392156862745098) + (navy 0 0 0.50196078431372548) + (NavyBlue 0 0 0.50196078431372548) + (CornflowerBlue 0.39215686274509803 0.58431372549019611 0.92941176470588238) + (DarkSlateBlue 0.28235294117647058 0.23921568627450981 0.54509803921568623) + (SlateBlue 0.41568627450980394 0.35294117647058826 0.80392156862745101) + (MediumSlateBlue 0.4823529411764706 0.40784313725490196 0.93333333333333335) + (LightSlateBlue 0.51764705882352946 0.4392156862745098 1) + (MediumBlue 0 0 0.80392156862745101) + (RoyalBlue 0.25490196078431371 0.41176470588235292 0.88235294117647056) + (blue 0 0 1) + (DodgerBlue 0.11764705882352941 0.56470588235294117 1) + (DeepSkyBlue 0 0.74901960784313726 1) + (SkyBlue 0.52941176470588236 0.80784313725490198 0.92156862745098034) + (LightSkyBlue 0.52941176470588236 0.80784313725490198 0.98039215686274506) + (SteelBlue 0.27450980392156865 0.50980392156862742 0.70588235294117652) + (LightSteelBlue 0.69019607843137254 0.7686274509803922 0.87058823529411766) + (LightBlue 0.67843137254901964 0.84705882352941175 0.90196078431372551) + (PowderBlue 0.69019607843137254 0.8784313725490196 0.90196078431372551) + (PaleTurquoise 0.68627450980392157 0.93333333333333335 0.93333333333333335) + (DarkTurquoise 0 0.80784313725490198 0.81960784313725488) + (MediumTurquoise 0.28235294117647058 0.81960784313725488 0.80000000000000004) + (turquoise 0.25098039215686274 0.8784313725490196 0.81568627450980391) + (cyan 0 1 1) + (LightCyan 0.8784313725490196 1 1) + (CadetBlue 0.37254901960784315 0.61960784313725492 0.62745098039215685) + (MediumAquamarine 0.40000000000000002 0.80392156862745101 0.66666666666666663) + (aquamarine 0.49803921568627452 1 0.83137254901960789) + (DarkGreen 0 0.39215686274509803 0) + (DarkOliveGreen 0.33333333333333331 0.41960784313725491 0.18431372549019609) + (DarkSeaGreen 0.5607843137254902 0.73725490196078436 0.5607843137254902) + (SeaGreen 0.1803921568627451 0.54509803921568623 0.3411764705882353) + (MediumSeaGreen 0.23529411764705882 0.70196078431372544 0.44313725490196076) + (LightSeaGreen 0.12549019607843137 0.69803921568627447 0.66666666666666663) + (PaleGreen 0.59607843137254901 0.98431372549019602 0.59607843137254901) + (SpringGreen 0 1 0.49803921568627452) + (LawnGreen 0.48627450980392156 0.9882352941176471 0) + (green 0 1 0) + (chartreuse 0.49803921568627452 1 0) + (MediumSpringGreen 0 0.98039215686274506 0.60392156862745094) + (GreenYellow 0.67843137254901964 1 0.18431372549019609) + (LimeGreen 0.19607843137254902 0.80392156862745101 0.19607843137254902) + (YellowGreen 0.60392156862745094 0.80392156862745101 0.19607843137254902) + (ForestGreen 0.13333333333333333 0.54509803921568623 0.13333333333333333) + (OliveDrab 0.41960784313725491 0.55686274509803924 0.13725490196078433) + (DarkKhaki 0.74117647058823533 0.71764705882352942 0.41960784313725491) + (khaki 0.94117647058823528 0.90196078431372551 0.5490196078431373) + (PaleGoldenrod 0.93333333333333335 0.90980392156862744 0.66666666666666663) + (LightGoldenrodYellow 0.98039215686274506 0.98039215686274506 0.82352941176470584) + (LightYellow 1 1 0.8784313725490196) + (yellow 1 1 0) + (gold 1 0.84313725490196079 0) + (LightGoldenrod 0.93333333333333335 0.8666666666666667 0.50980392156862742) + (goldenrod 0.85490196078431369 0.6470588235294118 0.12549019607843137) + (DarkGoldenrod 0.72156862745098038 0.52549019607843139 0.043137254901960784) + (RosyBrown 0.73725490196078436 0.5607843137254902 0.5607843137254902) + (IndianRed 0.80392156862745101 0.36078431372549019 0.36078431372549019) + (SaddleBrown 0.54509803921568623 0.27058823529411763 0.074509803921568626) + (sienna 0.62745098039215685 0.32156862745098042 0.17647058823529413) + (peru 0.80392156862745101 0.52156862745098043 0.24705882352941178) + (burlywood 0.87058823529411766 0.72156862745098038 0.52941176470588236) + (beige 0.96078431372549022 0.96078431372549022 0.86274509803921573) + (wheat 0.96078431372549022 0.87058823529411766 0.70196078431372544) + (SandyBrown 0.95686274509803926 0.64313725490196083 0.37647058823529411) + (tan 0.82352941176470584 0.70588235294117652 0.5490196078431373) + (chocolate 0.82352941176470584 0.41176470588235292 0.11764705882352941) + (firebrick 0.69803921568627447 0.13333333333333333 0.13333333333333333) + (brown 0.6470588235294118 0.16470588235294117 0.16470588235294117) + (DarkSalmon 0.9137254901960784 0.58823529411764708 0.47843137254901963) + (salmon 0.98039215686274506 0.50196078431372548 0.44705882352941179) + (LightSalmon 1 0.62745098039215685 0.47843137254901963) + (orange 1 0.6470588235294118 0) + (DarkOrange 1 0.5490196078431373 0) + (coral 1 0.49803921568627452 0.31372549019607843) + (LightCoral 0.94117647058823528 0.50196078431372548 0.50196078431372548) + (tomato 1 0.38823529411764707 0.27843137254901962) + (OrangeRed 1 0.27058823529411763 0) + (red 1 0 0) + (HotPink 1 0.41176470588235292 0.70588235294117652) + (DeepPink 1 0.078431372549019607 0.57647058823529407) + (pink 1 0.75294117647058822 0.79607843137254897) + (LightPink 1 0.71372549019607845 0.75686274509803919) + (PaleVioletRed 0.85882352941176465 0.4392156862745098 0.57647058823529407) + (maroon 0.69019607843137254 0.18823529411764706 0.37647058823529411) + (MediumVioletRed 0.7803921568627451 0.082352941176470587 0.52156862745098043) + (VioletRed 0.81568627450980391 0.12549019607843137 0.56470588235294117) + (magenta 1 0 1) + (violet 0.93333333333333335 0.50980392156862742 0.93333333333333335) + (plum 0.8666666666666667 0.62745098039215685 0.8666666666666667) + (orchid 0.85490196078431369 0.4392156862745098 0.83921568627450982) + (MediumOrchid 0.72941176470588232 0.33333333333333331 0.82745098039215681) + (DarkOrchid 0.59999999999999998 0.19607843137254902 0.80000000000000004) + (DarkViolet 0.58039215686274515 0 0.82745098039215681) + (BlueViolet 0.54117647058823526 0.16862745098039217 0.88627450980392153) + (purple 0.62745098039215685 0.12549019607843137 0.94117647058823528) + (MediumPurple 0.57647058823529407 0.4392156862745098 0.85882352941176465) + (thistle 0.84705882352941175 0.74901960784313726 0.84705882352941175) + (snow1 1 0.98039215686274506 0.98039215686274506) + (snow2 0.93333333333333335 0.9137254901960784 0.9137254901960784) + (snow3 0.80392156862745101 0.78823529411764703 0.78823529411764703) + (snow4 0.54509803921568623 0.53725490196078429 0.53725490196078429) + (seashell1 1 0.96078431372549022 0.93333333333333335) + (seashell2 0.93333333333333335 0.89803921568627454 0.87058823529411766) + (seashell3 0.80392156862745101 0.77254901960784317 0.74901960784313726) + (seashell4 0.54509803921568623 0.52549019607843139 0.50980392156862742) + (AntiqueWhite1 1 0.93725490196078431 0.85882352941176465) + (AntiqueWhite2 0.93333333333333335 0.87450980392156863 0.80000000000000004) + (AntiqueWhite3 0.80392156862745101 0.75294117647058822 0.69019607843137254) + (AntiqueWhite4 0.54509803921568623 0.51372549019607838 0.47058823529411764) + (bisque1 1 0.89411764705882357 0.7686274509803922) + (bisque2 0.93333333333333335 0.83529411764705885 0.71764705882352942) + (bisque3 0.80392156862745101 0.71764705882352942 0.61960784313725492) + (bisque4 0.54509803921568623 0.49019607843137253 0.41960784313725491) + (PeachPuff1 1 0.85490196078431369 0.72549019607843135) + (PeachPuff2 0.93333333333333335 0.79607843137254897 0.67843137254901964) + (PeachPuff3 0.80392156862745101 0.68627450980392157 0.58431372549019611) + (PeachPuff4 0.54509803921568623 0.46666666666666667 0.396078431372549) + (NavajoWhite1 1 0.87058823529411766 0.67843137254901964) + (NavajoWhite2 0.93333333333333335 0.81176470588235294 0.63137254901960782) + (NavajoWhite3 0.80392156862745101 0.70196078431372544 0.54509803921568623) + (NavajoWhite4 0.54509803921568623 0.47450980392156861 0.36862745098039218) + (LemonChiffon1 1 0.98039215686274506 0.80392156862745101) + (LemonChiffon2 0.93333333333333335 0.9137254901960784 0.74901960784313726) + (LemonChiffon3 0.80392156862745101 0.78823529411764703 0.6470588235294118) + (LemonChiffon4 0.54509803921568623 0.53725490196078429 0.4392156862745098) + (cornsilk1 1 0.97254901960784312 0.86274509803921573) + (cornsilk2 0.93333333333333335 0.90980392156862744 0.80392156862745101) + (cornsilk3 0.80392156862745101 0.78431372549019607 0.69411764705882351) + (cornsilk4 0.54509803921568623 0.53333333333333333 0.47058823529411764) + (ivory1 1 1 0.94117647058823528) + (ivory2 0.93333333333333335 0.93333333333333335 0.8784313725490196) + (ivory3 0.80392156862745101 0.80392156862745101 0.75686274509803919) + (ivory4 0.54509803921568623 0.54509803921568623 0.51372549019607838) + (honeydew1 0.94117647058823528 1 0.94117647058823528) + (honeydew2 0.8784313725490196 0.93333333333333335 0.8784313725490196) + (honeydew3 0.75686274509803919 0.80392156862745101 0.75686274509803919) + (honeydew4 0.51372549019607838 0.54509803921568623 0.51372549019607838) + (LavenderBlush1 1 0.94117647058823528 0.96078431372549022) + (LavenderBlush2 0.93333333333333335 0.8784313725490196 0.89803921568627454) + (LavenderBlush3 0.80392156862745101 0.75686274509803919 0.77254901960784317) + (LavenderBlush4 0.54509803921568623 0.51372549019607838 0.52549019607843139) + (MistyRose1 1 0.89411764705882357 0.88235294117647056) + (MistyRose2 0.93333333333333335 0.83529411764705885 0.82352941176470584) + (MistyRose3 0.80392156862745101 0.71764705882352942 0.70980392156862748) + (MistyRose4 0.54509803921568623 0.49019607843137253 0.4823529411764706) + (azure1 0.94117647058823528 1 1) + (azure2 0.8784313725490196 0.93333333333333335 0.93333333333333335) + (azure3 0.75686274509803919 0.80392156862745101 0.80392156862745101) + (azure4 0.51372549019607838 0.54509803921568623 0.54509803921568623) + (SlateBlue1 0.51372549019607838 0.43529411764705883 1) + (SlateBlue2 0.47843137254901963 0.40392156862745099 0.93333333333333335) + (SlateBlue3 0.41176470588235292 0.34901960784313724 0.80392156862745101) + (SlateBlue4 0.27843137254901962 0.23529411764705882 0.54509803921568623) + (RoyalBlue1 0.28235294117647058 0.46274509803921571 1) + (RoyalBlue2 0.2627450980392157 0.43137254901960786 0.93333333333333335) + (RoyalBlue3 0.22745098039215686 0.37254901960784315 0.80392156862745101) + (RoyalBlue4 0.15294117647058825 0.25098039215686274 0.54509803921568623) + (blue1 0 0 1) + (blue2 0 0 0.93333333333333335) + (blue3 0 0 0.80392156862745101) + (blue4 0 0 0.54509803921568623) + (DodgerBlue1 0.11764705882352941 0.56470588235294117 1) + (DodgerBlue2 0.10980392156862745 0.52549019607843139 0.93333333333333335) + (DodgerBlue3 0.094117647058823528 0.45490196078431372 0.80392156862745101) + (DodgerBlue4 0.062745098039215685 0.30588235294117649 0.54509803921568623) + (SteelBlue1 0.38823529411764707 0.72156862745098038 1) + (SteelBlue2 0.36078431372549019 0.67450980392156867 0.93333333333333335) + (SteelBlue3 0.30980392156862746 0.58039215686274515 0.80392156862745101) + (SteelBlue4 0.21176470588235294 0.39215686274509803 0.54509803921568623) + (DeepSkyBlue1 0 0.74901960784313726 1) + (DeepSkyBlue2 0 0.69803921568627447 0.93333333333333335) + (DeepSkyBlue3 0 0.60392156862745094 0.80392156862745101) + (DeepSkyBlue4 0 0.40784313725490196 0.54509803921568623) + (SkyBlue1 0.52941176470588236 0.80784313725490198 1) + (SkyBlue2 0.49411764705882355 0.75294117647058822 0.93333333333333335) + (SkyBlue3 0.42352941176470588 0.65098039215686276 0.80392156862745101) + (SkyBlue4 0.29019607843137257 0.4392156862745098 0.54509803921568623) + (LightSkyBlue1 0.69019607843137254 0.88627450980392153 1) + (LightSkyBlue2 0.64313725490196083 0.82745098039215681 0.93333333333333335) + (LightSkyBlue3 0.55294117647058827 0.71372549019607845 0.80392156862745101) + (LightSkyBlue4 0.37647058823529411 0.4823529411764706 0.54509803921568623) + (SlateGray1 0.77647058823529413 0.88627450980392153 1) + (SlateGray2 0.72549019607843135 0.82745098039215681 0.93333333333333335) + (SlateGray3 0.62352941176470589 0.71372549019607845 0.80392156862745101) + (SlateGray4 0.42352941176470588 0.4823529411764706 0.54509803921568623) + (LightSteelBlue1 0.792156862745098 0.88235294117647056 1) + (LightSteelBlue2 0.73725490196078436 0.82352941176470584 0.93333333333333335) + (LightSteelBlue3 0.63529411764705879 0.70980392156862748 0.80392156862745101) + (LightSteelBlue4 0.43137254901960786 0.4823529411764706 0.54509803921568623) + (LightBlue1 0.74901960784313726 0.93725490196078431 1) + (LightBlue2 0.69803921568627447 0.87450980392156863 0.93333333333333335) + (LightBlue3 0.60392156862745094 0.75294117647058822 0.80392156862745101) + (LightBlue4 0.40784313725490196 0.51372549019607838 0.54509803921568623) + (LightCyan1 0.8784313725490196 1 1) + (LightCyan2 0.81960784313725488 0.93333333333333335 0.93333333333333335) + (LightCyan3 0.70588235294117652 0.80392156862745101 0.80392156862745101) + (LightCyan4 0.47843137254901963 0.54509803921568623 0.54509803921568623) + (PaleTurquoise1 0.73333333333333328 1 1) + (PaleTurquoise2 0.68235294117647061 0.93333333333333335 0.93333333333333335) + (PaleTurquoise3 0.58823529411764708 0.80392156862745101 0.80392156862745101) + (PaleTurquoise4 0.40000000000000002 0.54509803921568623 0.54509803921568623) + (CadetBlue1 0.59607843137254901 0.96078431372549022 1) + (CadetBlue2 0.55686274509803924 0.89803921568627454 0.93333333333333335) + (CadetBlue3 0.47843137254901963 0.77254901960784317 0.80392156862745101) + (CadetBlue4 0.32549019607843138 0.52549019607843139 0.54509803921568623) + (turquoise1 0 0.96078431372549022 1) + (turquoise2 0 0.89803921568627454 0.93333333333333335) + (turquoise3 0 0.77254901960784317 0.80392156862745101) + (turquoise4 0 0.52549019607843139 0.54509803921568623) + (cyan1 0 1 1) + (cyan2 0 0.93333333333333335 0.93333333333333335) + (cyan3 0 0.80392156862745101 0.80392156862745101) + (cyan4 0 0.54509803921568623 0.54509803921568623) + (DarkSlateGray1 0.59215686274509804 1 1) + (DarkSlateGray2 0.55294117647058827 0.93333333333333335 0.93333333333333335) + (DarkSlateGray3 0.47450980392156861 0.80392156862745101 0.80392156862745101) + (DarkSlateGray4 0.32156862745098042 0.54509803921568623 0.54509803921568623) + (aquamarine1 0.49803921568627452 1 0.83137254901960789) + (aquamarine2 0.46274509803921571 0.93333333333333335 0.77647058823529413) + (aquamarine3 0.40000000000000002 0.80392156862745101 0.66666666666666663) + (aquamarine4 0.27058823529411763 0.54509803921568623 0.45490196078431372) + (DarkSeaGreen1 0.75686274509803919 1 0.75686274509803919) + (DarkSeaGreen2 0.70588235294117652 0.93333333333333335 0.70588235294117652) + (DarkSeaGreen3 0.60784313725490191 0.80392156862745101 0.60784313725490191) + (DarkSeaGreen4 0.41176470588235292 0.54509803921568623 0.41176470588235292) + (SeaGreen1 0.32941176470588235 1 0.62352941176470589) + (SeaGreen2 0.30588235294117649 0.93333333333333335 0.58039215686274515) + (SeaGreen3 0.2627450980392157 0.80392156862745101 0.50196078431372548) + (SeaGreen4 0.1803921568627451 0.54509803921568623 0.3411764705882353) + (PaleGreen1 0.60392156862745094 1 0.60392156862745094) + (PaleGreen2 0.56470588235294117 0.93333333333333335 0.56470588235294117) + (PaleGreen3 0.48627450980392156 0.80392156862745101 0.48627450980392156) + (PaleGreen4 0.32941176470588235 0.54509803921568623 0.32941176470588235) + (SpringGreen1 0 1 0.49803921568627452) + (SpringGreen2 0 0.93333333333333335 0.46274509803921571) + (SpringGreen3 0 0.80392156862745101 0.40000000000000002) + (SpringGreen4 0 0.54509803921568623 0.27058823529411763) + (green1 0 1 0) + (green2 0 0.93333333333333335 0) + (green3 0 0.80392156862745101 0) + (green4 0 0.54509803921568623 0) + (chartreuse1 0.49803921568627452 1 0) + (chartreuse2 0.46274509803921571 0.93333333333333335 0) + (chartreuse3 0.40000000000000002 0.80392156862745101 0) + (chartreuse4 0.27058823529411763 0.54509803921568623 0) + (OliveDrab1 0.75294117647058822 1 0.24313725490196078) + (OliveDrab2 0.70196078431372544 0.93333333333333335 0.22745098039215686) + (OliveDrab3 0.60392156862745094 0.80392156862745101 0.19607843137254902) + (OliveDrab4 0.41176470588235292 0.54509803921568623 0.13333333333333333) + (DarkOliveGreen1 0.792156862745098 1 0.4392156862745098) + (DarkOliveGreen2 0.73725490196078436 0.93333333333333335 0.40784313725490196) + (DarkOliveGreen3 0.63529411764705879 0.80392156862745101 0.35294117647058826) + (DarkOliveGreen4 0.43137254901960786 0.54509803921568623 0.23921568627450981) + (khaki1 1 0.96470588235294119 0.5607843137254902) + (khaki2 0.93333333333333335 0.90196078431372551 0.52156862745098043) + (khaki3 0.80392156862745101 0.77647058823529413 0.45098039215686275) + (khaki4 0.54509803921568623 0.52549019607843139 0.30588235294117649) + (LightGoldenrod1 1 0.92549019607843142 0.54509803921568623) + (LightGoldenrod2 0.93333333333333335 0.86274509803921573 0.50980392156862742) + (LightGoldenrod3 0.80392156862745101 0.74509803921568629 0.4392156862745098) + (LightGoldenrod4 0.54509803921568623 0.50588235294117645 0.29803921568627451) + (LightYellow1 1 1 0.8784313725490196) + (LightYellow2 0.93333333333333335 0.93333333333333335 0.81960784313725488) + (LightYellow3 0.80392156862745101 0.80392156862745101 0.70588235294117652) + (LightYellow4 0.54509803921568623 0.54509803921568623 0.47843137254901963) + (yellow1 1 1 0) + (yellow2 0.93333333333333335 0.93333333333333335 0) + (yellow3 0.80392156862745101 0.80392156862745101 0) + (yellow4 0.54509803921568623 0.54509803921568623 0) + (gold1 1 0.84313725490196079 0) + (gold2 0.93333333333333335 0.78823529411764703 0) + (gold3 0.80392156862745101 0.67843137254901964 0) + (gold4 0.54509803921568623 0.45882352941176469 0) + (goldenrod1 1 0.75686274509803919 0.14509803921568629) + (goldenrod2 0.93333333333333335 0.70588235294117652 0.13333333333333333) + (goldenrod3 0.80392156862745101 0.60784313725490191 0.11372549019607843) + (goldenrod4 0.54509803921568623 0.41176470588235292 0.078431372549019607) + (DarkGoldenrod1 1 0.72549019607843135 0.058823529411764705) + (DarkGoldenrod2 0.93333333333333335 0.67843137254901964 0.054901960784313725) + (DarkGoldenrod3 0.80392156862745101 0.58431372549019611 0.047058823529411764) + (DarkGoldenrod4 0.54509803921568623 0.396078431372549 0.031372549019607843) + (RosyBrown1 1 0.75686274509803919 0.75686274509803919) + (RosyBrown2 0.93333333333333335 0.70588235294117652 0.70588235294117652) + (RosyBrown3 0.80392156862745101 0.60784313725490191 0.60784313725490191) + (RosyBrown4 0.54509803921568623 0.41176470588235292 0.41176470588235292) + (IndianRed1 1 0.41568627450980394 0.41568627450980394) + (IndianRed2 0.93333333333333335 0.38823529411764707 0.38823529411764707) + (IndianRed3 0.80392156862745101 0.33333333333333331 0.33333333333333331) + (IndianRed4 0.54509803921568623 0.22745098039215686 0.22745098039215686) + (sienna1 1 0.50980392156862742 0.27843137254901962) + (sienna2 0.93333333333333335 0.47450980392156861 0.25882352941176473) + (sienna3 0.80392156862745101 0.40784313725490196 0.22352941176470589) + (sienna4 0.54509803921568623 0.27843137254901962 0.14901960784313725) + (burlywood1 1 0.82745098039215681 0.60784313725490191) + (burlywood2 0.93333333333333335 0.77254901960784317 0.56862745098039214) + (burlywood3 0.80392156862745101 0.66666666666666663 0.49019607843137253) + (burlywood4 0.54509803921568623 0.45098039215686275 0.33333333333333331) + (wheat1 1 0.90588235294117647 0.72941176470588232) + (wheat2 0.93333333333333335 0.84705882352941175 0.68235294117647061) + (wheat3 0.80392156862745101 0.72941176470588232 0.58823529411764708) + (wheat4 0.54509803921568623 0.49411764705882355 0.40000000000000002) + (tan1 1 0.6470588235294118 0.30980392156862746) + (tan2 0.93333333333333335 0.60392156862745094 0.28627450980392155) + (tan3 0.80392156862745101 0.52156862745098043 0.24705882352941178) + (tan4 0.54509803921568623 0.35294117647058826 0.16862745098039217) + (chocolate1 1 0.49803921568627452 0.14117647058823529) + (chocolate2 0.93333333333333335 0.46274509803921571 0.12941176470588237) + (chocolate3 0.80392156862745101 0.40000000000000002 0.11372549019607843) + (chocolate4 0.54509803921568623 0.27058823529411763 0.074509803921568626) + (firebrick1 1 0.18823529411764706 0.18823529411764706) + (firebrick2 0.93333333333333335 0.17254901960784313 0.17254901960784313) + (firebrick3 0.80392156862745101 0.14901960784313725 0.14901960784313725) + (firebrick4 0.54509803921568623 0.10196078431372549 0.10196078431372549) + (brown1 1 0.25098039215686274 0.25098039215686274) + (brown2 0.93333333333333335 0.23137254901960785 0.23137254901960785) + (brown3 0.80392156862745101 0.20000000000000001 0.20000000000000001) + (brown4 0.54509803921568623 0.13725490196078433 0.13725490196078433) + (salmon1 1 0.5490196078431373 0.41176470588235292) + (salmon2 0.93333333333333335 0.50980392156862742 0.3843137254901961) + (salmon3 0.80392156862745101 0.4392156862745098 0.32941176470588235) + (salmon4 0.54509803921568623 0.29803921568627451 0.22352941176470589) + (LightSalmon1 1 0.62745098039215685 0.47843137254901963) + (LightSalmon2 0.93333333333333335 0.58431372549019611 0.44705882352941179) + (LightSalmon3 0.80392156862745101 0.50588235294117645 0.3843137254901961) + (LightSalmon4 0.54509803921568623 0.3411764705882353 0.25882352941176473) + (orange1 1 0.6470588235294118 0) + (orange2 0.93333333333333335 0.60392156862745094 0) + (orange3 0.80392156862745101 0.52156862745098043 0) + (orange4 0.54509803921568623 0.35294117647058826 0) + (DarkOrange1 1 0.49803921568627452 0) + (DarkOrange2 0.93333333333333335 0.46274509803921571 0) + (DarkOrange3 0.80392156862745101 0.40000000000000002 0) + (DarkOrange4 0.54509803921568623 0.27058823529411763 0) + (coral1 1 0.44705882352941179 0.33725490196078434) + (coral2 0.93333333333333335 0.41568627450980394 0.31372549019607843) + (coral3 0.80392156862745101 0.35686274509803922 0.27058823529411763) + (coral4 0.54509803921568623 0.24313725490196078 0.18431372549019609) + (tomato1 1 0.38823529411764707 0.27843137254901962) + (tomato2 0.93333333333333335 0.36078431372549019 0.25882352941176473) + (tomato3 0.80392156862745101 0.30980392156862746 0.22352941176470589) + (tomato4 0.54509803921568623 0.21176470588235294 0.14901960784313725) + (OrangeRed1 1 0.27058823529411763 0) + (OrangeRed2 0.93333333333333335 0.25098039215686274 0) + (OrangeRed3 0.80392156862745101 0.21568627450980393 0) + (OrangeRed4 0.54509803921568623 0.14509803921568629 0) + (red1 1 0 0) + (red2 0.93333333333333335 0 0) + (red3 0.80392156862745101 0 0) + (red4 0.54509803921568623 0 0) + (DeepPink1 1 0.078431372549019607 0.57647058823529407) + (DeepPink2 0.93333333333333335 0.070588235294117646 0.53725490196078429) + (DeepPink3 0.80392156862745101 0.062745098039215685 0.46274509803921571) + (DeepPink4 0.54509803921568623 0.039215686274509803 0.31372549019607843) + (HotPink1 1 0.43137254901960786 0.70588235294117652) + (HotPink2 0.93333333333333335 0.41568627450980394 0.65490196078431373) + (HotPink3 0.80392156862745101 0.37647058823529411 0.56470588235294117) + (HotPink4 0.54509803921568623 0.22745098039215686 0.3843137254901961) + (pink1 1 0.70980392156862748 0.77254901960784317) + (pink2 0.93333333333333335 0.66274509803921566 0.72156862745098038) + (pink3 0.80392156862745101 0.56862745098039214 0.61960784313725492) + (pink4 0.54509803921568623 0.38823529411764707 0.42352941176470588) + (LightPink1 1 0.68235294117647061 0.72549019607843135) + (LightPink2 0.93333333333333335 0.63529411764705879 0.67843137254901964) + (LightPink3 0.80392156862745101 0.5490196078431373 0.58431372549019611) + (LightPink4 0.54509803921568623 0.37254901960784315 0.396078431372549) + (PaleVioletRed1 1 0.50980392156862742 0.6705882352941176) + (PaleVioletRed2 0.93333333333333335 0.47450980392156861 0.62352941176470589) + (PaleVioletRed3 0.80392156862745101 0.40784313725490196 0.53725490196078429) + (PaleVioletRed4 0.54509803921568623 0.27843137254901962 0.36470588235294116) + (maroon1 1 0.20392156862745098 0.70196078431372544) + (maroon2 0.93333333333333335 0.18823529411764706 0.65490196078431373) + (maroon3 0.80392156862745101 0.16078431372549021 0.56470588235294117) + (maroon4 0.54509803921568623 0.10980392156862745 0.3843137254901961) + (VioletRed1 1 0.24313725490196078 0.58823529411764708) + (VioletRed2 0.93333333333333335 0.22745098039215686 0.5490196078431373) + (VioletRed3 0.80392156862745101 0.19607843137254902 0.47058823529411764) + (VioletRed4 0.54509803921568623 0.13333333333333333 0.32156862745098042) + (magenta1 1 0 1) + (magenta2 0.93333333333333335 0 0.93333333333333335) + (magenta3 0.80392156862745101 0 0.80392156862745101) + (magenta4 0.54509803921568623 0 0.54509803921568623) + (orchid1 1 0.51372549019607838 0.98039215686274506) + (orchid2 0.93333333333333335 0.47843137254901963 0.9137254901960784) + (orchid3 0.80392156862745101 0.41176470588235292 0.78823529411764703) + (orchid4 0.54509803921568623 0.27843137254901962 0.53725490196078429) + (plum1 1 0.73333333333333328 1) + (plum2 0.93333333333333335 0.68235294117647061 0.93333333333333335) + (plum3 0.80392156862745101 0.58823529411764708 0.80392156862745101) + (plum4 0.54509803921568623 0.40000000000000002 0.54509803921568623) + (MediumOrchid1 0.8784313725490196 0.40000000000000002 1) + (MediumOrchid2 0.81960784313725488 0.37254901960784315 0.93333333333333335) + (MediumOrchid3 0.70588235294117652 0.32156862745098042 0.80392156862745101) + (MediumOrchid4 0.47843137254901963 0.21568627450980393 0.54509803921568623) + (DarkOrchid1 0.74901960784313726 0.24313725490196078 1) + (DarkOrchid2 0.69803921568627447 0.22745098039215686 0.93333333333333335) + (DarkOrchid3 0.60392156862745094 0.19607843137254902 0.80392156862745101) + (DarkOrchid4 0.40784313725490196 0.13333333333333333 0.54509803921568623) + (purple1 0.60784313725490191 0.18823529411764706 1) + (purple2 0.56862745098039214 0.17254901960784313 0.93333333333333335) + (purple3 0.49019607843137253 0.14901960784313725 0.80392156862745101) + (purple4 0.33333333333333331 0.10196078431372549 0.54509803921568623) + (MediumPurple1 0.6705882352941176 0.50980392156862742 1) + (MediumPurple2 0.62352941176470589 0.47450980392156861 0.93333333333333335) + (MediumPurple3 0.53725490196078429 0.40784313725490196 0.80392156862745101) + (MediumPurple4 0.36470588235294116 0.27843137254901962 0.54509803921568623) + (thistle1 1 0.88235294117647056 1) + (thistle2 0.93333333333333335 0.82352941176470584 0.93333333333333335) + (thistle3 0.80392156862745101 0.70980392156862748 0.80392156862745101) + (thistle4 0.54509803921568623 0.4823529411764706 0.54509803921568623) + (gray0 0 0 0) + (grey0 0 0 0) + (gray1 0.011764705882352941 0.011764705882352941 0.011764705882352941) + (grey1 0.011764705882352941 0.011764705882352941 0.011764705882352941) + (gray2 0.019607843137254902 0.019607843137254902 0.019607843137254902) + (grey2 0.019607843137254902 0.019607843137254902 0.019607843137254902) + (gray3 0.031372549019607843 0.031372549019607843 0.031372549019607843) + (grey3 0.031372549019607843 0.031372549019607843 0.031372549019607843) + (gray4 0.039215686274509803 0.039215686274509803 0.039215686274509803) + (grey4 0.039215686274509803 0.039215686274509803 0.039215686274509803) + (gray5 0.050980392156862744 0.050980392156862744 0.050980392156862744) + (grey5 0.050980392156862744 0.050980392156862744 0.050980392156862744) + (gray6 0.058823529411764705 0.058823529411764705 0.058823529411764705) + (grey6 0.058823529411764705 0.058823529411764705 0.058823529411764705) + (gray7 0.070588235294117646 0.070588235294117646 0.070588235294117646) + (grey7 0.070588235294117646 0.070588235294117646 0.070588235294117646) + (gray8 0.078431372549019607 0.078431372549019607 0.078431372549019607) + (grey8 0.078431372549019607 0.078431372549019607 0.078431372549019607) + (gray9 0.090196078431372548 0.090196078431372548 0.090196078431372548) + (grey9 0.090196078431372548 0.090196078431372548 0.090196078431372548) + (gray10 0.10196078431372549 0.10196078431372549 0.10196078431372549) + (grey10 0.10196078431372549 0.10196078431372549 0.10196078431372549) + (gray11 0.10980392156862745 0.10980392156862745 0.10980392156862745) + (grey11 0.10980392156862745 0.10980392156862745 0.10980392156862745) + (gray12 0.12156862745098039 0.12156862745098039 0.12156862745098039) + (grey12 0.12156862745098039 0.12156862745098039 0.12156862745098039) + (gray13 0.12941176470588237 0.12941176470588237 0.12941176470588237) + (grey13 0.12941176470588237 0.12941176470588237 0.12941176470588237) + (gray14 0.14117647058823529 0.14117647058823529 0.14117647058823529) + (grey14 0.14117647058823529 0.14117647058823529 0.14117647058823529) + (gray15 0.14901960784313725 0.14901960784313725 0.14901960784313725) + (grey15 0.14901960784313725 0.14901960784313725 0.14901960784313725) + (gray16 0.16078431372549021 0.16078431372549021 0.16078431372549021) + (grey16 0.16078431372549021 0.16078431372549021 0.16078431372549021) + (gray17 0.16862745098039217 0.16862745098039217 0.16862745098039217) + (grey17 0.16862745098039217 0.16862745098039217 0.16862745098039217) + (gray18 0.1803921568627451 0.1803921568627451 0.1803921568627451) + (grey18 0.1803921568627451 0.1803921568627451 0.1803921568627451) + (gray19 0.18823529411764706 0.18823529411764706 0.18823529411764706) + (grey19 0.18823529411764706 0.18823529411764706 0.18823529411764706) + (gray20 0.20000000000000001 0.20000000000000001 0.20000000000000001) + (grey20 0.20000000000000001 0.20000000000000001 0.20000000000000001) + (gray21 0.21176470588235294 0.21176470588235294 0.21176470588235294) + (grey21 0.21176470588235294 0.21176470588235294 0.21176470588235294) + (gray22 0.2196078431372549 0.2196078431372549 0.2196078431372549) + (grey22 0.2196078431372549 0.2196078431372549 0.2196078431372549) + (gray23 0.23137254901960785 0.23137254901960785 0.23137254901960785) + (grey23 0.23137254901960785 0.23137254901960785 0.23137254901960785) + (gray24 0.23921568627450981 0.23921568627450981 0.23921568627450981) + (grey24 0.23921568627450981 0.23921568627450981 0.23921568627450981) + (gray25 0.25098039215686274 0.25098039215686274 0.25098039215686274) + (grey25 0.25098039215686274 0.25098039215686274 0.25098039215686274) + (gray26 0.25882352941176473 0.25882352941176473 0.25882352941176473) + (grey26 0.25882352941176473 0.25882352941176473 0.25882352941176473) + (gray27 0.27058823529411763 0.27058823529411763 0.27058823529411763) + (grey27 0.27058823529411763 0.27058823529411763 0.27058823529411763) + (gray28 0.27843137254901962 0.27843137254901962 0.27843137254901962) + (grey28 0.27843137254901962 0.27843137254901962 0.27843137254901962) + (gray29 0.29019607843137257 0.29019607843137257 0.29019607843137257) + (grey29 0.29019607843137257 0.29019607843137257 0.29019607843137257) + (gray30 0.30196078431372547 0.30196078431372547 0.30196078431372547) + (grey30 0.30196078431372547 0.30196078431372547 0.30196078431372547) + (gray31 0.30980392156862746 0.30980392156862746 0.30980392156862746) + (grey31 0.30980392156862746 0.30980392156862746 0.30980392156862746) + (gray32 0.32156862745098042 0.32156862745098042 0.32156862745098042) + (grey32 0.32156862745098042 0.32156862745098042 0.32156862745098042) + (gray33 0.32941176470588235 0.32941176470588235 0.32941176470588235) + (grey33 0.32941176470588235 0.32941176470588235 0.32941176470588235) + (gray34 0.3411764705882353 0.3411764705882353 0.3411764705882353) + (grey34 0.3411764705882353 0.3411764705882353 0.3411764705882353) + (gray35 0.34901960784313724 0.34901960784313724 0.34901960784313724) + (grey35 0.34901960784313724 0.34901960784313724 0.34901960784313724) + (gray36 0.36078431372549019 0.36078431372549019 0.36078431372549019) + (grey36 0.36078431372549019 0.36078431372549019 0.36078431372549019) + (gray37 0.36862745098039218 0.36862745098039218 0.36862745098039218) + (grey37 0.36862745098039218 0.36862745098039218 0.36862745098039218) + (gray38 0.38039215686274508 0.38039215686274508 0.38039215686274508) + (grey38 0.38039215686274508 0.38039215686274508 0.38039215686274508) + (gray39 0.38823529411764707 0.38823529411764707 0.38823529411764707) + (grey39 0.38823529411764707 0.38823529411764707 0.38823529411764707) + (gray40 0.40000000000000002 0.40000000000000002 0.40000000000000002) + (grey40 0.40000000000000002 0.40000000000000002 0.40000000000000002) + (gray41 0.41176470588235292 0.41176470588235292 0.41176470588235292) + (grey41 0.41176470588235292 0.41176470588235292 0.41176470588235292) + (gray42 0.41960784313725491 0.41960784313725491 0.41960784313725491) + (grey42 0.41960784313725491 0.41960784313725491 0.41960784313725491) + (gray43 0.43137254901960786 0.43137254901960786 0.43137254901960786) + (grey43 0.43137254901960786 0.43137254901960786 0.43137254901960786) + (gray44 0.4392156862745098 0.4392156862745098 0.4392156862745098) + (grey44 0.4392156862745098 0.4392156862745098 0.4392156862745098) + (gray45 0.45098039215686275 0.45098039215686275 0.45098039215686275) + (grey45 0.45098039215686275 0.45098039215686275 0.45098039215686275) + (gray46 0.45882352941176469 0.45882352941176469 0.45882352941176469) + (grey46 0.45882352941176469 0.45882352941176469 0.45882352941176469) + (gray47 0.47058823529411764 0.47058823529411764 0.47058823529411764) + (grey47 0.47058823529411764 0.47058823529411764 0.47058823529411764) + (gray48 0.47843137254901963 0.47843137254901963 0.47843137254901963) + (grey48 0.47843137254901963 0.47843137254901963 0.47843137254901963) + (gray49 0.49019607843137253 0.49019607843137253 0.49019607843137253) + (grey49 0.49019607843137253 0.49019607843137253 0.49019607843137253) + (gray50 0.49803921568627452 0.49803921568627452 0.49803921568627452) + (grey50 0.49803921568627452 0.49803921568627452 0.49803921568627452) + (gray51 0.50980392156862742 0.50980392156862742 0.50980392156862742) + (grey51 0.50980392156862742 0.50980392156862742 0.50980392156862742) + (gray52 0.52156862745098043 0.52156862745098043 0.52156862745098043) + (grey52 0.52156862745098043 0.52156862745098043 0.52156862745098043) + (gray53 0.52941176470588236 0.52941176470588236 0.52941176470588236) + (grey53 0.52941176470588236 0.52941176470588236 0.52941176470588236) + (gray54 0.54117647058823526 0.54117647058823526 0.54117647058823526) + (grey54 0.54117647058823526 0.54117647058823526 0.54117647058823526) + (gray55 0.5490196078431373 0.5490196078431373 0.5490196078431373) + (grey55 0.5490196078431373 0.5490196078431373 0.5490196078431373) + (gray56 0.5607843137254902 0.5607843137254902 0.5607843137254902) + (grey56 0.5607843137254902 0.5607843137254902 0.5607843137254902) + (gray57 0.56862745098039214 0.56862745098039214 0.56862745098039214) + (grey57 0.56862745098039214 0.56862745098039214 0.56862745098039214) + (gray58 0.58039215686274515 0.58039215686274515 0.58039215686274515) + (grey58 0.58039215686274515 0.58039215686274515 0.58039215686274515) + (gray59 0.58823529411764708 0.58823529411764708 0.58823529411764708) + (grey59 0.58823529411764708 0.58823529411764708 0.58823529411764708) + (gray60 0.59999999999999998 0.59999999999999998 0.59999999999999998) + (grey60 0.59999999999999998 0.59999999999999998 0.59999999999999998) + (gray61 0.61176470588235299 0.61176470588235299 0.61176470588235299) + (grey61 0.61176470588235299 0.61176470588235299 0.61176470588235299) + (gray62 0.61960784313725492 0.61960784313725492 0.61960784313725492) + (grey62 0.61960784313725492 0.61960784313725492 0.61960784313725492) + (gray63 0.63137254901960782 0.63137254901960782 0.63137254901960782) + (grey63 0.63137254901960782 0.63137254901960782 0.63137254901960782) + (gray64 0.63921568627450975 0.63921568627450975 0.63921568627450975) + (grey64 0.63921568627450975 0.63921568627450975 0.63921568627450975) + (gray65 0.65098039215686276 0.65098039215686276 0.65098039215686276) + (grey65 0.65098039215686276 0.65098039215686276 0.65098039215686276) + (gray66 0.6588235294117647 0.6588235294117647 0.6588235294117647) + (grey66 0.6588235294117647 0.6588235294117647 0.6588235294117647) + (gray67 0.6705882352941176 0.6705882352941176 0.6705882352941176) + (grey67 0.6705882352941176 0.6705882352941176 0.6705882352941176) + (gray68 0.67843137254901964 0.67843137254901964 0.67843137254901964) + (grey68 0.67843137254901964 0.67843137254901964 0.67843137254901964) + (gray69 0.69019607843137254 0.69019607843137254 0.69019607843137254) + (grey69 0.69019607843137254 0.69019607843137254 0.69019607843137254) + (gray70 0.70196078431372544 0.70196078431372544 0.70196078431372544) + (grey70 0.70196078431372544 0.70196078431372544 0.70196078431372544) + (gray71 0.70980392156862748 0.70980392156862748 0.70980392156862748) + (grey71 0.70980392156862748 0.70980392156862748 0.70980392156862748) + (gray72 0.72156862745098038 0.72156862745098038 0.72156862745098038) + (grey72 0.72156862745098038 0.72156862745098038 0.72156862745098038) + (gray73 0.72941176470588232 0.72941176470588232 0.72941176470588232) + (grey73 0.72941176470588232 0.72941176470588232 0.72941176470588232) + (gray74 0.74117647058823533 0.74117647058823533 0.74117647058823533) + (grey74 0.74117647058823533 0.74117647058823533 0.74117647058823533) + (gray75 0.74901960784313726 0.74901960784313726 0.74901960784313726) + (grey75 0.74901960784313726 0.74901960784313726 0.74901960784313726) + (gray76 0.76078431372549016 0.76078431372549016 0.76078431372549016) + (grey76 0.76078431372549016 0.76078431372549016 0.76078431372549016) + (gray77 0.7686274509803922 0.7686274509803922 0.7686274509803922) + (grey77 0.7686274509803922 0.7686274509803922 0.7686274509803922) + (gray78 0.7803921568627451 0.7803921568627451 0.7803921568627451) + (grey78 0.7803921568627451 0.7803921568627451 0.7803921568627451) + (gray79 0.78823529411764703 0.78823529411764703 0.78823529411764703) + (grey79 0.78823529411764703 0.78823529411764703 0.78823529411764703) + (gray80 0.80000000000000004 0.80000000000000004 0.80000000000000004) + (grey80 0.80000000000000004 0.80000000000000004 0.80000000000000004) + (gray81 0.81176470588235294 0.81176470588235294 0.81176470588235294) + (grey81 0.81176470588235294 0.81176470588235294 0.81176470588235294) + (gray82 0.81960784313725488 0.81960784313725488 0.81960784313725488) + (grey82 0.81960784313725488 0.81960784313725488 0.81960784313725488) + (gray83 0.83137254901960789 0.83137254901960789 0.83137254901960789) + (grey83 0.83137254901960789 0.83137254901960789 0.83137254901960789) + (gray84 0.83921568627450982 0.83921568627450982 0.83921568627450982) + (grey84 0.83921568627450982 0.83921568627450982 0.83921568627450982) + (gray85 0.85098039215686272 0.85098039215686272 0.85098039215686272) + (grey85 0.85098039215686272 0.85098039215686272 0.85098039215686272) + (gray86 0.85882352941176465 0.85882352941176465 0.85882352941176465) + (grey86 0.85882352941176465 0.85882352941176465 0.85882352941176465) + (gray87 0.87058823529411766 0.87058823529411766 0.87058823529411766) + (grey87 0.87058823529411766 0.87058823529411766 0.87058823529411766) + (gray88 0.8784313725490196 0.8784313725490196 0.8784313725490196) + (grey88 0.8784313725490196 0.8784313725490196 0.8784313725490196) + (gray89 0.8901960784313725 0.8901960784313725 0.8901960784313725) + (grey89 0.8901960784313725 0.8901960784313725 0.8901960784313725) + (gray90 0.89803921568627454 0.89803921568627454 0.89803921568627454) + (grey90 0.89803921568627454 0.89803921568627454 0.89803921568627454) + (gray91 0.90980392156862744 0.90980392156862744 0.90980392156862744) + (grey91 0.90980392156862744 0.90980392156862744 0.90980392156862744) + (gray92 0.92156862745098034 0.92156862745098034 0.92156862745098034) + (grey92 0.92156862745098034 0.92156862745098034 0.92156862745098034) + (gray93 0.92941176470588238 0.92941176470588238 0.92941176470588238) + (grey93 0.92941176470588238 0.92941176470588238 0.92941176470588238) + (gray94 0.94117647058823528 0.94117647058823528 0.94117647058823528) + (grey94 0.94117647058823528 0.94117647058823528 0.94117647058823528) + (gray95 0.94901960784313721 0.94901960784313721 0.94901960784313721) + (grey95 0.94901960784313721 0.94901960784313721 0.94901960784313721) + (gray96 0.96078431372549022 0.96078431372549022 0.96078431372549022) + (grey96 0.96078431372549022 0.96078431372549022 0.96078431372549022) + (gray97 0.96862745098039216 0.96862745098039216 0.96862745098039216) + (grey97 0.96862745098039216 0.96862745098039216 0.96862745098039216) + (gray98 0.98039215686274506 0.98039215686274506 0.98039215686274506) + (grey98 0.98039215686274506 0.98039215686274506 0.98039215686274506) + (gray99 0.9882352941176471 0.9882352941176471 0.9882352941176471) + (grey99 0.9882352941176471 0.9882352941176471 0.9882352941176471) + (gray100 1 1 1) + (grey100 1 1 1) + (DarkGrey 0.66274509803921566 0.66274509803921566 0.66274509803921566) + (DarkGray 0.66274509803921566 0.66274509803921566 0.66274509803921566) + (DarkBlue 0 0 0.54509803921568623) + (DarkCyan 0 0.54509803921568623 0.54509803921568623) + (DarkMagenta 0.54509803921568623 0 0.54509803921568623) + (DarkRed 0.54509803921568623 0 0) + (LightGreen 0.56470588235294117 0.93333333333333335 0.56470588235294117))) +(define (make-x11-color-handler) + (let + ((x11-color-table (make-hash-table 31))) (lambda (arg) (let* diff --git a/scripts/GNUmakefile b/scripts/GNUmakefile index ce7b006479..2a683a8975 100644 --- a/scripts/GNUmakefile +++ b/scripts/GNUmakefile @@ -6,6 +6,9 @@ STEPMAKE_TEMPLATES=script help2man po LOCALSTEPMAKE_TEMPLATES = lilypond HELP2MAN_EXECS = $(SEXECUTABLES) +AT_FILES=relocate-preamble +at-ext=.py.in +at-dir=$(depth)/python + include $(depth)/make/stepmake.make include $(stepdir)/executable-targets.make - diff --git a/scripts/abc2ly.py b/scripts/abc2ly.py index 83dc1f79ae..570846c4ac 100644 --- a/scripts/abc2ly.py +++ b/scripts/abc2ly.py @@ -78,16 +78,9 @@ import os program_name = sys.argv[0] -for d in ['@lilypond_datadir@', - '@lilypond_libdir@']: - sys.path.insert (0, os.path.join (d, 'python')) - -# dynamic relocation, for GUB binaries. -bindir = os.path.abspath (os.path.split (sys.argv[0])[0]) -for p in ['share', 'lib']: - datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % p) - sys.path.insert (0, datadir) - +""" +@relocate-preamble@ +""" import lilylib as ly global _;_=ly._ diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py index 474144c3ce..cf67f9f240 100644 --- a/scripts/convert-ly.py +++ b/scripts/convert-ly.py @@ -15,18 +15,9 @@ import sys import string import re - -datadir = '@local_lilypond_datadir@' -if not os.path.isdir (datadir): - datadir = '@lilypond_datadir@' - -sys.path.insert (0, os.path.join (datadir, 'python')) - -# dynamic relocation, for GUB binaries. -bindir = os.path.abspath (os.path.split (sys.argv[0])[0]) -for p in ['share', 'lib']: - datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % p) - sys.path.insert (0, datadir) +""" +@relocate-preamble@ +""" import lilylib as ly global _;_=ly._ diff --git a/scripts/etf2ly.py b/scripts/etf2ly.py index 126288f676..f87778d9d4 100644 --- a/scripts/etf2ly.py +++ b/scripts/etf2ly.py @@ -39,25 +39,9 @@ version = '@TOPLEVEL_VERSION@' if version == '@' + 'TOPLEVEL_VERSION' + '@': version = '(unknown version)' # uGUHGUHGHGUGH - -################################################################ -# Users of python modules should include this snippet. -# - - - - -for d in ['@lilypond_datadir@', - '@lilypond_libdir@']: - sys.path.insert (0, os.path.join (d, 'python')) - - -# dynamic relocation, for GUB binaries. -bindir = os.path.abspath (os.path.split (sys.argv[0])[0]) -for p in ['share', 'lib']: - datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % p) - sys.path.insert (0, datadir) - +""" +@relocate-preamble@ +""" ################################################################ diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index dd495fc750..09eefff340 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -37,23 +37,9 @@ import sys import re import md5 -################ -# RELOCATION -################ - - -for d in ['@lilypond_datadir@', - '@lilypond_libdir@']: - sys.path.insert (0, os.path.join (d, 'python')) - -# dynamic relocation, for GUB binaries. -bindir = os.path.abspath (os.path.split (sys.argv[0])[0]) - -os.environ['PATH'] = bindir + os.pathsep + os.environ['PATH'] -for p in ['share', 'lib']: - datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % p) - sys.path.insert (0, datadir) - +""" +@relocate-preamble@ +""" import lilylib as ly import fontextract diff --git a/scripts/midi2ly.py b/scripts/midi2ly.py index f1db678cfb..35b10f3987 100644 --- a/scripts/midi2ly.py +++ b/scripts/midi2ly.py @@ -25,26 +25,15 @@ import os import string import sys -################################################################ -# Users of python modules should include this snippet. -# - -for d in ['@lilypond_datadir@', - '@lilypond_libdir@']: - sys.path.insert (0, os.path.join (d, 'python')) - -# dynamic relocation, for GUB binaries. -bindir = os.path.abspath (os.path.split (sys.argv[0])[0]) -for p in ['share', 'lib']: - datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % p) - sys.path.insert (0, datadir) - +""" +@relocate-preamble@ +""" import midi import lilylib as ly ################################################################ -################ CONSTANTS +## CONSTANTS output_name = '' diff --git a/scripts/musicxml2ly.py b/scripts/musicxml2ly.py index 665cc1d02f..c29daed136 100644 --- a/scripts/musicxml2ly.py +++ b/scripts/musicxml2ly.py @@ -7,20 +7,9 @@ import os import string from gettext import gettext as _ - - -for d in ['@lilypond_datadir@', - '@lilypond_libdir@']: - sys.path.insert (0, os.path.join (d, 'python')) - -# dynamic relocation, for GUB binaries. -bindir = os.path.abspath (os.path.split (sys.argv[0])[0]) -for p in ['share', 'lib']: - datadir = os.path.abspath (bindir + '/../%s/lilypond/current/python/' % p) - sys.path.insert (0, datadir) - - - +""" +@relocate-preamble@ +""" import lilylib as ly @@ -592,7 +581,7 @@ def print_score_setup (printer, part_list, voices): def print_ly_preamble (printer, filename): printer.dump_version () - printer.print_verbatim ('%% converted from %s\n' % filename) + printer.print_verbatim ('%% automatically converted from %s\n' % filename) def read_musicxml (filename, use_lxml): if use_lxml: diff --git a/stepmake/stepmake/python-module-rules.make b/stepmake/stepmake/python-module-rules.make index 511bd87afd..cb3ef487d8 100644 --- a/stepmake/stepmake/python-module-rules.make +++ b/stepmake/stepmake/python-module-rules.make @@ -9,5 +9,6 @@ $(outdir)/%.pyo: $(outdir)/%.py $(PYTHON) -O -c 'import py_compile; py_compile.compile ("$<")' $(outdir)/%.py: %.py $(config_make) - cat $< | sed $(sed-atvariables) > $@ + cat $< | sed $(sed-atfiles) $(sed-atvariables) > $@ chmod 755 $@ + diff --git a/stepmake/stepmake/script-rules.make b/stepmake/stepmake/script-rules.make index 02e99909ac..bf6589e15c 100644 --- a/stepmake/stepmake/script-rules.make +++ b/stepmake/stepmake/script-rules.make @@ -1,25 +1,25 @@ $(outdir)/%: %.pl $(config_make) $(depth)/VERSION - cat $< | sed $(sed-atvariables) > $@ + cat $< | sed $(sed-atfiles) $(sed-atvariables) > $@ chmod 755 $@ $(outdir)/%: %.bash $(config_make) $(depth)/VERSION - cat $< | sed $(sed-atvariables) > $@ + cat $< | sed $(sed-atfiles) $(sed-atvariables) > $@ chmod 755 $@ $(outdir)/%: %.scm $(config_make) $(depth)/VERSION - cat $< | sed $(sed-atvariables) > $@ + cat $< | sed $(sed-atfiles) $(sed-atvariables) > $@ chmod 755 $@ $(outdir)/%: %.expect $(config_make) $(depth)/VERSION - cat $< | sed $(sed-atvariables) > $@ + cat $< | sed $(sed-atfiles) $(sed-atvariables) > $@ chmod 755 $@ $(outdir)/%: %.sh $(config_make) $(depth)/VERSION - cat $< | sed $(sed-atvariables) > $@ + cat $< | sed $(sed-atfiles)$(sed-atvariables) > $@ chmod 755 $@ $(outdir)/%: %.py $(config_make) $(depth)/VERSION - cat $< | sed $(sed-atvariables) > $@ + cat $< | sed $(sed-atfiles) $(sed-atvariables) > $@ chmod 755 $@ diff --git a/stepmake/stepmake/substitute-vars.make b/stepmake/stepmake/substitute-vars.make index eb45a465fc..8d7fd6295b 100644 --- a/stepmake/stepmake/substitute-vars.make +++ b/stepmake/stepmake/substitute-vars.make @@ -10,9 +10,10 @@ DATE = $(date) # for all FILE in AT_FILES: # substitute occurrences of @FILE@ with contents $(at-dir)BLA$(at-ext) sed-atfiles = -e '\#' $(foreach i, $(AT_FILES), \ - -e '/@$i@/r $(at-dir)$i$(at-ext)' -e 's%@$i@%%g') + -e '/@$i@/r $(at-dir)/$i$(at-ext)' -e 's%@$i@%%g') # for all VAR in ATVARIABLES # substitute occurrences of @VAR@ with $(VAR) sed-atvariables = -e '\#' $(foreach i, $(ATVARIABLES), -e 's!@$i@!$($i)!g') +