From 5460535f2ea7285b3a56e7f8e6acbfc9418320c0 Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 27 Mar 2002 02:05:40 +0000 Subject: [PATCH] lilypond-1.5.33 --- buildscripts/lilypond-login.sh | 11 ++ buildscripts/lilypond-profile.sh | 7 +- buildscripts/lys-to-tely.py | 2 +- debian/rules | 4 +- input/regression/grace-bar-number.ly | 13 +++ input/test/figured-bass.ly | 2 +- input/test/voicify-chords.ly | 64 +++++++++++ lily/bar-number-engraver.cc | 33 +++--- lily/figured-bass-engraver.cc | 1 + lily/lexer.ll | 2 + lily/lily-guile.cc | 42 +++++++ lily/music-constructor.cc | 2 +- lily/music-sequence.cc | 14 ++- lily/music.cc | 71 +++++------- lily/parser.yy | 6 + lily/translator-group.cc | 42 ------- ly/property-init.ly | 41 +------ mf/GNUmakefile | 4 +- mf/feta-nummer10.mf | 2 +- mf/lilypond.map | 38 +++++++ scm/c++.scm | 10 +- scm/drums.scm | 20 ++-- scm/music-functions.scm | 162 +++++++++++++++++++++++++++ scm/music-property-description.scm | 4 +- scm/ps.scm | 2 +- 25 files changed, 435 insertions(+), 164 deletions(-) create mode 100644 input/regression/grace-bar-number.ly create mode 100644 input/test/voicify-chords.ly create mode 100644 mf/lilypond.map diff --git a/buildscripts/lilypond-login.sh b/buildscripts/lilypond-login.sh index e809b66224..3bd0e43195 100644 --- a/buildscripts/lilypond-login.sh +++ b/buildscripts/lilypond-login.sh @@ -41,5 +41,16 @@ else setenv TFMFONTS "$datadir/tfm:" endif +if ($?TEXPSHEADERS) then + setenv TFMFONTS "$datadir/pfa:$TEXPSHEADERS" +else + setenv TFMFONTS "$datadir/pfa:" +endif +if ($?TEXCONFIG) then + setenv TEXCONFIG "$datadir/pfa:$TEXPSHEADERS" +else + setenv TEXCONFIG "$datadir/pfa:" +endif + diff --git a/buildscripts/lilypond-profile.sh b/buildscripts/lilypond-profile.sh index cae362c8ae..95cd90bd84 100644 --- a/buildscripts/lilypond-profile.sh +++ b/buildscripts/lilypond-profile.sh @@ -27,11 +27,16 @@ GS_LIB="$datadir/ps:"${GS_LIB:=""} MFINPUTS="$datadir/mf:"${MFINPUTS:=":"} TEXINPUTS="$datadir/tex:$datadir/ps:"${TEXINPUTS:=":"} TFMFONTS="$datadir/tfm:"${TFMFONTS:=":"} +TEXPSHEADERS="$datadir/pfa/:"${TEXPSHEADERS:=":"} +TEXCONFIG="$datadir/pfa/:"${TEXCONFIG:=":"} + + # LILYPONDPREFIX="$datadir" # export LILYPONDPREFIX -export MFINPUTS TEXINPUTS TFMFONTS GS_LIB GS_FONTPATH +export MFINPUTS TEXINPUTS TFMFONTS GS_LIB GS_FONTPATH +export TEXPSHEADERS TEXCONFIG diff --git a/buildscripts/lys-to-tely.py b/buildscripts/lys-to-tely.py index 22343a77a7..57b0f90796 100644 --- a/buildscripts/lys-to-tely.py +++ b/buildscripts/lys-to-tely.py @@ -63,7 +63,7 @@ if files: def name2line (n): # UGR if string.find (n, '+') >= 0: - s = "@lilypondfile{%s}" % n + s = "@lilypondfile[printfilename]{%s}" % n else: s = "@lilypondfile[printfilename,verbatim]{%s}" % n return s diff --git a/debian/rules b/debian/rules index d854c688eb..d8dfa0a755 100644 --- a/debian/rules +++ b/debian/rules @@ -42,7 +42,7 @@ build-stamp: --prefix=/usr --enable-optimise \ --infodir='$${prefix}/share/info' \ --mandir='$${prefix}/share/man' - $(MAKE) + $(MAKE) MAKE_PFA_FILES=1 touch build-stamp @@ -75,7 +75,7 @@ install: build # Add here commands to install the package into debian/tmp. dh_installdirs - $(MAKE) prefix=$(PWD)/$(r)/usr install + $(MAKE) prefix=$(PWD)/$(r)/usr MAKE_PFA_FILES=1 install # Change from an absolute symlink to a relative symlink (Lintian) if [ -L $(r)/usr/share/lilypond/cmtfm ]; then \ diff --git a/input/regression/grace-bar-number.ly b/input/regression/grace-bar-number.ly new file mode 100644 index 0000000000..7368e1eb9f --- /dev/null +++ b/input/regression/grace-bar-number.ly @@ -0,0 +1,13 @@ +\header { + +texidoc = "Grace notes do tricky things with timing. If a measure +starts with a grace note, the measure does not start at 0, but +earlier. Nevertheless, lily should not get confused. For example, line +breaks should be possible at grace notes, and the bar number should be +printed correctly. +" +} + +\score { \notes\relative c''' { c1 \break +\grace c8 +c1 }} diff --git a/input/test/figured-bass.ly b/input/test/figured-bass.ly index 9c6b0300be..daaf2ea6d5 100644 --- a/input/test/figured-bass.ly +++ b/input/test/figured-bass.ly @@ -13,7 +13,7 @@ mode, which allows you to type numbers, like @code{<4 6+>}. \figures { - r + r8 <1 3 5>4 <3- 5+ 6!> <5> } } diff --git a/input/test/voicify-chords.ly b/input/test/voicify-chords.ly new file mode 100644 index 0000000000..f0592545b4 --- /dev/null +++ b/input/test/voicify-chords.ly @@ -0,0 +1,64 @@ + +#(define (voicify-list lst number) + "Make a list of Musics. + + voicify-list :: [ [Music ] ] -> number -> [Music] + LST is a list music-lists. +" + + (if (null? lst) '() + (cons (context-spec-music + (make-sequential-music + (list + (make-voice-props-set number) + (make-simultaneous-music (car lst)))) + + "Voice" (number->string number)) + (voicify-list (cdr lst) (+ number 1)) + )) + ) + +#(define (voicify-chord ch) + "Split the parts of a chord into different Voices using separator" + (let* ((es (ly-get-mus-property ch 'elements))) + + + (ly-set-mus-property ch 'elements + (voicify-list (split-list es music-separator?) 0)) + ch + )) + +#(define (voicify-music m) + "Recursively split chords that are separated with \\ " + + (if (not (music? m)) + (begin (display m) + (error "not music!")) + ) + (let* + ((es (ly-get-mus-property m 'elements)) + (e (ly-get-mus-property m 'element)) + ) + + (if + (and (equal? (ly-music-name m) "Simultaneous_music") + (reduce (lambda (x y ) (or x y)) (map music-separator? es))) + (voicify-chord m) + (begin + (if (pair? es) + (ly-set-mus-property m 'elements (map voicify-music es))) + (if (music? e) + (ly-set-mus-property m 'element (voicify-music e))) + + m) + + ) + )) + +\score { \notes \context Staff \relative c'' +\apply #voicify-music { + c4 f g < c \\ d> a +} +} + + diff --git a/lily/bar-number-engraver.cc b/lily/bar-number-engraver.cc index 2c6d4d6c26..614b750e61 100644 --- a/lily/bar-number-engraver.cc +++ b/lily/bar-number-engraver.cc @@ -21,11 +21,10 @@ class Bar_number_engraver : public Engraver { protected: Item* text_p_; - protected: virtual void stop_translation_timestep (); virtual void acknowledge_grob (Grob_info); - virtual void create_grobs (); + virtual void process_music (); void create_items (); TRANSLATOR_DECLARATIONS( Bar_number_engraver ); }; @@ -36,22 +35,30 @@ protected: every 5 measures? */ void -Bar_number_engraver::create_grobs () +Bar_number_engraver::process_music () { // todo include (&&!time->cadenza_b_) - SCM bn = get_property ("currentBarNumber"); - SCM smp = get_property ("measurePosition"); - Moment mp = (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0); + + SCM wb = get_property ("whichBar"); - if (gh_number_p (bn) && - !mp.to_bool () && now_mom () > Moment (0)) + if (gh_string_p (wb)) { - create_items (); - - // guh. - text_p_->set_grob_property ("text", - ly_str02scm (to_str (gh_scm2int (bn)).ch_C ())); + SCM bn = get_property ("currentBarNumber"); + SCM smp = get_property ("measurePosition"); + int ibn = gh_number_p (bn) ? gh_scm2int(bn) : 1; + + Moment mp = (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0); + if (mp.main_part_ == Rational (0) + && ibn != 1) + { + create_items (); + + // guh. + text_p_->set_grob_property ("text", + ly_str02scm (to_str (gh_scm2int (bn)).ch_C ())); + } } + } diff --git a/lily/figured-bass-engraver.cc b/lily/figured-bass-engraver.cc index 624490ac57..9703975358 100644 --- a/lily/figured-bass-engraver.cc +++ b/lily/figured-bass-engraver.cc @@ -35,6 +35,7 @@ Figured_bass_engraver::stop_translation_timestep () } figures_.clear (); + rest_req_ = 0; } bool diff --git a/lily/lexer.ll b/lily/lexer.ll index e07648fc32..fa5a4dad89 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -459,6 +459,8 @@ HYPHEN -- return E_CLOSE; case '~': return E_TILDE; + case '\\': + return E_BACKSLASH; default: return E_CHAR; } diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 3e1abf6765..c70f40e482 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -606,3 +606,45 @@ SCM my_gh_symbol2scm (const char* x) { return gh_symbol2scm ((char*)x); } + + +bool +type_check_assignment (SCM val, SCM sym, SCM type_symbol) +{ + bool ok = true; + SCM type_p = SCM_EOL; + + if (gh_symbol_p (sym)) + type_p = scm_object_property (sym, type_symbol); + + if (type_p != SCM_EOL && !gh_procedure_p (type_p)) + { + warning (_f ("Can't find property type-check for `%s'. Perhaps you made a typing error? Doing assignment anyway.", + ly_symbol2string (sym).ch_C ())); + } + else + { + if (val != SCM_EOL + && gh_procedure_p (type_p) + && gh_call1 (type_p, val) == SCM_BOOL_F) + { + SCM errport = scm_current_error_port (); + ok = false; + SCM typefunc = scm_primitive_eval (ly_symbol2scm ("type-name")); + SCM type_name = gh_call1 (typefunc, type_p); + + String realval = ly_scm2string (ly_write2scm (val)); + if (realval.length_i () > 200) + realval = realval.left_str (100) + "\n :\n :\n" + realval.right_str (100); + + + scm_puts (_f ("Type check for `%s' failed; value `%s' must be of type `%s'", + ly_symbol2string (sym).ch_C (), + realval.ch_C (), + ly_scm2string (type_name).ch_C ()).ch_C (), + errport); + scm_puts ("\n", errport); + } + } + return ok; +} diff --git a/lily/music-constructor.cc b/lily/music-constructor.cc index dc60a9deb4..b8f3b24209 100644 --- a/lily/music-constructor.cc +++ b/lily/music-constructor.cc @@ -35,6 +35,6 @@ get_music_ctor (String s) Music* get_music (String s) { - return (*get_music_ctor (s)) (); + return (*get_music_ctor (s)) () ; } diff --git a/lily/music-sequence.cc b/lily/music-sequence.cc index b7e0e56954..69755be050 100644 --- a/lily/music-sequence.cc +++ b/lily/music-sequence.cc @@ -100,9 +100,17 @@ Music_sequence::do_relative_octave (Pitch p, bool ret_first) Pitch last = p; for (SCM s = music_list (); gh_pair_p (s); s = ly_cdr (s)) { - last = unsmob_music (ly_car (s))->to_relative_octave (last); - if (!count ++) - retval = last; + Music *m = unsmob_music (ly_car (s)); + if (!m) + { + programming_error ("Music_sequence should only contain music!"); + } + else + { + last = m->to_relative_octave (last); + if (!count ++) + retval = last; + } } if (!ret_first) diff --git a/lily/music.cc b/lily/music.cc index 65b6bd608f..597afc58b2 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -166,42 +166,6 @@ Music::internal_get_mus_property (SCM sym) const return (s == SCM_BOOL_F) ? SCM_EOL : ly_cdr (s); } -#if 0 -/* - Remove the value associated with KEY, and return it. The result is - that a next call will yield SCM_EOL (and not the underlying - `basic' property. -*/ -SCM -Music::remove_mus_property (const char* key) -{ - SCM val = get_mus_property (key); - if (val != SCM_EOL) - set_mus_property (key, SCM_EOL); - return val; -} - -SCM -Music::get_mus_property (const char *nm) const -{ - SCM sym = ly_symbol2scm (nm); - return get_mus_property (sym); -} - -void -Music::set_mus_property (const char* k, SCM v) -{ - SCM s = ly_symbol2scm (k); - set_mus_property (s, v); -} - -void -Music::set_immutable_mus_property (SCM s, SCM v) -{ - immutable_property_alist_ = gh_cons (gh_cons (s,v), mutable_property_alist_); - mutable_property_alist_ = scm_assq_remove_x (mutable_property_alist_, s); -} -#endif void Music::internal_set_mus_property (SCM s, SCM v) @@ -266,16 +230,20 @@ ly_set_mus_property (SCM mus, SCM sym, SCM val) return SCM_UNSPECIFIED; } - if (sc) + if (!sc) { - sc->internal_set_mus_property (sym, val); - } - else - { - warning (_ ("ly_set_mus_property (): not of type Music")); + warning (_ ("ly_set_mus_property (): not of type Music: ")); scm_write (mus, scm_current_error_port ()); + return SCM_UNSPECIFIED; } + + bool ok = type_check_assignment (val, sym, ly_symbol2scm ("music-type?")); + if (ok) + { + sc->internal_set_mus_property (sym, val); + } + return SCM_UNSPECIFIED; } @@ -293,8 +261,9 @@ ly_make_music (SCM type) } else { - SCM s = get_music (ly_scm2string (type))->self_scm (); + SCM s = get_music (ly_scm2string (type))->self_scm (); scm_gc_unprotect_object (s); + return s; } } @@ -314,9 +283,25 @@ ly_music_name (SCM mus) return ly_str02scm (nm); } +SCM +ly_music_list_p (SCM l) +{ + if (scm_list_p (l) != SCM_BOOL_T) + return SCM_BOOL_F; + + while (gh_pair_p (l)) + { + if (!unsmob_music (gh_car (l))) + return SCM_BOOL_F; + l =gh_cdr (l); + } + return SCM_BOOL_T; +} + static void init_functions () { + scm_c_define_gsubr ("music-list?", 1, 0, 0, (Scheme_function_unknown)ly_music_list_p); scm_c_define_gsubr ("ly-get-mus-property", 2, 0, 0, (Scheme_function_unknown)ly_get_mus_property); scm_c_define_gsubr ("ly-set-mus-property", 3, 0, 0, (Scheme_function_unknown)ly_set_mus_property); scm_c_define_gsubr ("ly-make-music", 1, 0, 0, (Scheme_function_unknown)ly_make_music); diff --git a/lily/parser.yy b/lily/parser.yy index 0de5be0bf5..4f39421694 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -242,6 +242,7 @@ yylex (YYSTYPE *s, void * v_l) /* escaped */ %token E_CHAR E_EXCLAMATION E_SMALLER E_BIGGER E_OPEN E_CLOSE E_TILDE +%token E_BACKSLASH %token CHORD_BASS CHORD_COLON CHORD_MINUS CHORD_CARET %type exclamations questions dots @@ -1112,7 +1113,12 @@ command_element: $$-> set_spot (THIS->here_input ()); $1-> set_spot (THIS->here_input ()); } + | E_BACKSLASH { + $$ = new Music (gh_list (gh_cons (ly_symbol2scm ("name"), ly_symbol2scm ("separator")), SCM_UNDEFINED)); + $$->set_spot (THIS->here_input ()); + } | '|' { + extern Music * get_barcheck(); $$ = get_barcheck (); $$->set_spot (THIS->here_input ()); diff --git a/lily/translator-group.cc b/lily/translator-group.cc index bd9d1d1002..90e0c70acc 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -75,12 +75,6 @@ Translator_group::add_translator (SCM list, Translator *t) return list; } -void -Translator_group::add_fresh_simple_translator (Translator*t) -{ - simple_trans_list_ = add_translator (simple_trans_list_, t); - t->initialize (); -} void Translator_group::add_used_group_translator (Translator *t) @@ -410,42 +404,6 @@ Translator_group::finalize () } -bool -type_check_assignment (SCM val, SCM sym, SCM type_symbol) -{ - bool ok = true; - SCM type_p = SCM_EOL; - - if (gh_symbol_p (sym)) - type_p = scm_object_property (sym, type_symbol); - - if (type_p != SCM_EOL && !gh_procedure_p (type_p)) - { - warning (_f ("Can't find property type-check for `%s'. Perhaps you made a typing error? Doing assignment anyway.", - ly_symbol2string (sym).ch_C ())); - } - else - { - if (val != SCM_EOL - && gh_procedure_p (type_p) - && gh_call1 (type_p, val) == SCM_BOOL_F) - { - SCM errport = scm_current_error_port (); - ok = false; - SCM typefunc = scm_primitive_eval (ly_symbol2scm ("type-name")); - SCM type_name = gh_call1 (typefunc, type_p); - - scm_puts (_f ("Type check for `%s' failed; value `%s' must be of type `%s'", - ly_symbol2string (sym).ch_C (), - ly_scm2string (ly_write2scm (val)).ch_C (), - ly_scm2string (type_name).ch_C ()).ch_C (), - errport); - scm_puts ("\n", errport); - } - } - return ok; -} - SCM ly_get_trans_property (SCM context, SCM name) { diff --git a/ly/property-init.ly b/ly/property-init.ly index 4c1eb13019..5601b73a33 100644 --- a/ly/property-init.ly +++ b/ly/property-init.ly @@ -78,42 +78,11 @@ newpage = { } % dynamic dir? text script, articulation script dir? -oneVoice = { - \stemBoth - \slurBoth - \tieBoth - \shiftOff -} - -voiceOne = { - \stemUp - \slurUp - \tieUp - \dotsUp -} - -voiceTwo = { - \stemDown - \slurDown - \tieDown - \dotsDown -} - -voiceThree = { - \stemUp - \slurUp - \tieUp - \shiftOn - \dotsUp -} - -voiceFour = { - \stemDown - \slurDown - \tieDown - \shiftOn - \dotsDown -} +oneVoice = #(context-spec-music (make-voice-props-revert) "Voice") +voiceOne = #(context-spec-music (make-voice-props-set 0) "Voice") +voiceTwo = #(context-spec-music (make-voice-props-set 1) "Voice") +voiceThree =#(context-spec-music (make-voice-props-set 2) "Voice") +voiceFour = #(context-spec-music (make-voice-props-set 3) "Voice") % There's also dash, but setting dash period/length should be fixed. slurDotted = \property Voice.Slur \override #'dashed = #1 diff --git a/mf/GNUmakefile b/mf/GNUmakefile index 17ea22feca..ee62663cfa 100644 --- a/mf/GNUmakefile +++ b/mf/GNUmakefile @@ -8,7 +8,7 @@ include $(depth)/make/stepmake.make AF_FILES = $(wildcard *.af) -EXTRA_DIST_FILES += README feta.tex +EXTRA_DIST_FILES += README feta.tex lilypond.map # don't try to make fonts from test files TEST_FILES = $(wildcard *test*.mf) @@ -57,7 +57,7 @@ ifdef MAKE_PFA_FILES PFA_FILES = $(addprefix $(outdir)/, $(FONT_FILES:.mf=.pfa)) ALL_GEN_FILES += $(PFA_FILES) INSTALLATION_OUT_DIR4=$(datadir)/pfa -INSTALLATION_OUT_FILES4=$(PFA_FILES) +INSTALLATION_OUT_FILES4=$(PFA_FILES) lilypond.map pfa: $(PFA_FILES) endif diff --git a/mf/feta-nummer10.mf b/mf/feta-nummer10.mf index 884ca5c30a..2c6e8f5338 100644 --- a/mf/feta-nummer10.mf +++ b/mf/feta-nummer10.mf @@ -2,7 +2,7 @@ % part of LilyPond's pretty-but-neat music font design_size:=10; % feta20 = 20pt - +% mode := smoke; input feta-nummer; end. diff --git a/mf/lilypond.map b/mf/lilypond.map new file mode 100644 index 0000000000..5ba7e28655 --- /dev/null +++ b/mf/lilypond.map @@ -0,0 +1,38 @@ +%vvv UniqueID=4455667 +feta11 TeX-feta11 number -> [Music] + LST is a list music-lists. +" + + (if (null? lst) '() + (cons (context-spec-music + (make-sequential-music + (list + (make-voice-props-set number) + (make-simultaneous-music (car lst)))) + + "Voice" (number->string number)) + (voicify-list (cdr lst) (+ number 1)) + )) + ) + +(define (voicify-chord ch) + "Split the parts of a chord into different Voices using separator" + (let* ((es (ly-get-mus-property ch 'elements))) + + + (ly-set-mus-property ch 'elements + (voicify-list (split-list es music-separator?) 0)) + ch + )) + +(define (voicify-music m) + "Recursively split chords that are separated with \\ " + + (if (not (music? m)) + (begin (display m) + (error "not music!")) + ) + (let* + ((es (ly-get-mus-property m 'elements)) + (e (ly-get-mus-property m 'element)) + ) + + (if + (and (equal? (ly-music-name m) "Simultaneous_music") + (reduce (lambda (x y ) (or x y)) (map music-separator? es))) + (voicify-chord m) + (begin + (if (pair? es) + (ly-set-mus-property m 'elements (map voicify-music es))) + (if (music? e) + (ly-set-mus-property m 'element (voicify-music e))) + + m) + + ) + )) + +;;; diff --git a/scm/music-property-description.scm b/scm/music-property-description.scm index 8914c5c3db..d0d76a9445 100644 --- a/scm/music-property-description.scm +++ b/scm/music-property-description.scm @@ -36,7 +36,7 @@ (music-property-description 'direction dir? "Print this up or down?") (music-property-description 'text-type symbol? "Particular type of text script (eg. finger, dynamic).") (music-property-description 'element music? "The single child of a Music_wrapper music object, or the body of a repeat.") -(music-property-description 'elements list? "A list of elements for sequential of simultaneous music, or the alternatives of repeated music. ") +(music-property-description 'elements music-list? "A list of elements for sequential of simultaneous music, or the alternatives of repeated music. ") (music-property-description 'force-accidental boolean? "If set, a cautionary accidental should always be printed on this note") (music-property-description 'grob-property symbol? "The symbol of the grob property to set. ") (music-property-description 'grob-value scheme? "The value of the grob property to set") @@ -49,6 +49,8 @@ (music-property-description 'penalty number? "Penalty for break hint.") (music-property-description 'pitch pitch? "the pitch of this note") (music-property-description 'pitch-alist list? "list of pitches jointly forming the scale of a key signature") +(music-property-description 'pop-first boolean? "Do a revert before we try to do a override on some grob property.") + (music-property-description 'predicate procedure? "the predicate of a \outputproperty") (music-property-description 'type symbol? "The type of this music object. Determines iteration in some cases.") (music-property-description 'repeat-count integer? "do a @code{\repeat} how ofen?") diff --git a/scm/ps.scm b/scm/ps.scm index 77ee7d379e..7f2aca9c3a 100644 --- a/scm/ps.scm +++ b/scm/ps.scm @@ -92,7 +92,7 @@ " { /" (car name-mag) " findfont " - "12 " (ly-number->string (cdr name-mag)) " mul " + "20 " (ly-number->string (cdr name-mag)) " mul " "lilypondpaperoutputscale div scalefont setfont } bind def " "\n")) -- 2.39.5