From e33e199645b88d244f1f4fb43850c807cdc7dedc Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 16 May 2002 22:35:08 +0000 Subject: [PATCH] '' --- ChangeLog | 16 +++++++- Documentation/user/GNUmakefile | 2 +- Documentation/user/internals.itely | 6 +-- flower/include/string.hh | 2 +- flower/include/virtual-methods.hh | 20 ++++------ lily/bar-line.cc | 22 ++--------- lily/grob-info.cc | 4 +- lily/include/clef.hh | 2 +- lily/include/command-request.hh | 2 +- lily/include/item.hh | 2 +- lily/include/lyric-phrasing-engraver.hh | 4 ++ lily/include/main.hh | 3 -- lily/include/output-property.hh | 2 +- lily/include/paper-def.hh | 4 +- lily/include/paper-score.hh | 2 +- lily/include/score.hh | 2 +- lily/include/system.hh | 2 +- lily/include/translator.hh | 1 - lily/input-smob.cc | 18 ++++++++- lily/note-head.cc | 5 ++- lily/paper-outputter.cc | 2 - lily/parser.yy | 11 ++++++ scm/music-functions.scm | 49 +++++++++++++++++++++++++ scm/output-lib.scm | 2 + 24 files changed, 129 insertions(+), 56 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7354b4b79c..e2244a7a58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2002-05-17 Han-Wen + + * scm/music-functions.scm (check-start-chords): function to check + for chords without \context. Apply automatically from parser. + +2002-05-16 Han-Wen + + * lily/bar-line.cc: remove index entries. Texinfo can't handle : + in index entries. + + * scm/output-lib.scm: fix ez notation stems. + + * lily/paper-outputter.cc: various fixes to speed up compilation. + 2002-05-16 Mats Bengtsson * scripts/lilypond-book.py: Don't import pre for Python >= 2.2 @@ -54,7 +68,7 @@ * mf/GNUmakefile (INSTALLATION_OUT_FILES4): create and install fonts.dir file. - * lily/parser.yy (My_lily_parser): uncomment code. (Causes + * lily/parser.yy (My_lily_parser): comment out code. (Causes problems with recent bison releases). * make/lilypond.redhat.spec.in: add pfa fonts to X. diff --git a/Documentation/user/GNUmakefile b/Documentation/user/GNUmakefile index def4e0dd4d..b28fc11998 100644 --- a/Documentation/user/GNUmakefile +++ b/Documentation/user/GNUmakefile @@ -120,7 +120,7 @@ ifneq ($(CROSS),yes) # however, this triggers compilation during install, which is a bad thing (tm). $(outdir)/lilypond-internals.nexi $(outdir)/lilypond-internals.texi: $(depth)/$(builddir)/lily/$(outconfbase)/lilypond - cd $(outdir) && ../$(depth)/$(builddir)/lily/$(outconfbase)/lilypond ../$(src-depth)/ly/generate-documentation + cd $(outdir) && ../$(depth)/$(builddir)/lily/$(outconfbase)/lilypond --verbose ../$(src-depth)/ly/generate-documentation -ln $(outdir)/lilypond-internals.texi $(outdir)/lilypond-internals.nexi diff --git a/Documentation/user/internals.itely b/Documentation/user/internals.itely index 51fc93f048..a22b7acf3b 100644 --- a/Documentation/user/internals.itely +++ b/Documentation/user/internals.itely @@ -177,7 +177,7 @@ extract the alteration from pitch @var{p}. calculate the number of semitones of @var{p} from central C. @end defun -@defun Pitch::transpose t p +@defun Pitch@code{:}@code{:}transpose t p Transpose @var{p} by the amount @var{t}, where @var{t} is the pitch that central C is transposed to. @end defun @@ -238,11 +238,11 @@ retrieve the value of @var{sym} from context @var{tr} set value of property @var{sym} in context @var{tr} to @var{val}. @end defun -@defun Translator::name tr +@defun Translator@code{:}@code{:}name tr Return the type name of the translator @var{tr}. @end defun -@defun Translator::description tr +@defun Translator@code{:}@code{:}description tr Return an alist of properties of translator @var{tr}. @end defun diff --git a/flower/include/string.hh b/flower/include/string.hh index 921afb2a65..4737be12d2 100644 --- a/flower/include/string.hh +++ b/flower/include/string.hh @@ -53,7 +53,7 @@ class ostream; \item No operator[] is provided, since this would be enormously slow. If needed, - convert to char const* . +k convert to char const* . \end{itemize} */ diff --git a/flower/include/virtual-methods.hh b/flower/include/virtual-methods.hh index 45e6104127..eb144367a9 100644 --- a/flower/include/virtual-methods.hh +++ b/flower/include/virtual-methods.hh @@ -28,17 +28,13 @@ demangle_classname (std::type_info const &); */ -// fix constness: gcc-2.95 is correct in defining -// typeof (*this) -// in a const member function to be const - -#if 0 -#define VIRTUAL_COPY_CONS(base) \ - virtual base *clone () const \ - { \ - return new typeof (*this) (*this); \ - } -#else +/* + fix constness: gcc-2.95 is correct in defining + + typeof (*this) + + in a const member function to be const +*/ #define VIRTUAL_COPY_CONS(base) \ virtual base* clone_const_helper () \ { \ @@ -49,6 +45,6 @@ demangle_classname (std::type_info const &); base* urg = (base*)this; \ return urg->clone_const_helper (); \ } -#endif + #endif /* VIRTUAL_METHODS_HH */ diff --git a/lily/bar-line.cc b/lily/bar-line.cc index e124e3a658..f48667ede9 100644 --- a/lily/bar-line.cc +++ b/lily/bar-line.cc @@ -196,24 +196,10 @@ ADD_INTERFACE (Bar_line, "bar-line-interface", This is a request to print a special bar symbol. It replaces the regular bar symbol with a special symbol. The argument @var{bartype} is a string which specifies the -kind of bar to print. Options are @code{:|} -@cindex |A@@@code{:|} -, -@code{|:} -@cindex |B@@@code{|:} -, @code{:|:} -@cindex |C@@@code{:|:} -, -@code{||} -@cindex |D@@@code{||} -, @code{|.} -@cindex |E@@@code{|.} -, -@code{.|} -@cindex |F@@@code{.|} -, and @code{.|.} -@cindex |G@@@code{.|.} -. +kind of bar to print. Options are @code{:|}, +@code{|:}, @code{:|:}, +@code{||}, @code{|.}, +@code{.|}, and @code{.|.}. These produce, respectively, a right repeat, a left repeat, a double repeat, a double bar, a start bar, an end bar, and a thick double bar. diff --git a/lily/grob-info.cc b/lily/grob-info.cc index 4cc90129c4..9b4d540e0e 100644 --- a/lily/grob-info.cc +++ b/lily/grob-info.cc @@ -5,10 +5,10 @@ (c) 1997--2002 Han-Wen Nienhuys */ + #include "grob.hh" #include "grob-info.hh" -#include "request.hh" -#include "translator.hh" +#include "music.hh" #include "translator-group.hh" Grob_info::Grob_info (Grob*s_l) diff --git a/lily/include/clef.hh b/lily/include/clef.hh index 0f0d4f0ce9..5f05fe31d8 100644 --- a/lily/include/clef.hh +++ b/lily/include/clef.hh @@ -1,5 +1,5 @@ /* - clef.hh -- declare + clef.hh -- declare Clef source file of the GNU LilyPond music typesetter diff --git a/lily/include/command-request.hh b/lily/include/command-request.hh index 204e93fbd6..0d05e7dbf5 100644 --- a/lily/include/command-request.hh +++ b/lily/include/command-request.hh @@ -14,7 +14,7 @@ #include "array.hh" #include "duration.hh" #include "pitch.hh" -#include "protected-scm.hh" + class Break_req : public Request { public: diff --git a/lily/include/item.hh b/lily/include/item.hh index 408e73ddeb..e7bb841789 100644 --- a/lily/include/item.hh +++ b/lily/include/item.hh @@ -12,7 +12,7 @@ #include "box.hh" #include "grob.hh" #include "drul-array.hh" -#include "protected-scm.hh" + /** A horizontally fixed size element of the score. diff --git a/lily/include/lyric-phrasing-engraver.hh b/lily/include/lyric-phrasing-engraver.hh index 8a336e55ae..ef0db36a91 100644 --- a/lily/include/lyric-phrasing-engraver.hh +++ b/lily/include/lyric-phrasing-engraver.hh @@ -14,6 +14,7 @@ #include "engraver.hh" #include "item.hh" #include "smobs.hh" +#include "protected-scm.hh" class Syllable_group; @@ -80,6 +81,9 @@ public: private: /** association list of Syllable_group smobs + + fixme: should use property. + */ Protected_scm voice_alist_; Grob * any_notehead_l_; diff --git a/lily/include/main.hh b/lily/include/main.hh index 0fadb2524a..e7caae383c 100644 --- a/lily/include/main.hh +++ b/lily/include/main.hh @@ -41,7 +41,4 @@ extern File_path global_path; extern int score_count_global; extern Sources* source_global_l; -#include /* gcc 3.0 */ - - #endif /* MAIN_HH */ diff --git a/lily/include/output-property.hh b/lily/include/output-property.hh index be204448b1..015225e548 100644 --- a/lily/include/output-property.hh +++ b/lily/include/output-property.hh @@ -11,7 +11,7 @@ #define OUTPUT_PROPERTY_HH #include "music.hh" -//#include "protected-scm.hh" + /* diff --git a/lily/include/paper-def.hh b/lily/include/paper-def.hh index 6bc9df23d3..5987e6527f 100644 --- a/lily/include/paper-def.hh +++ b/lily/include/paper-def.hh @@ -14,12 +14,10 @@ #include "lily-proto.hh" #include "lily-guile.hh" #include "real.hh" - -#include "moment.hh" #include "array.hh" #include "interval.hh" #include "music-output-def.hh" -#include "protected-scm.hh" + /** diff --git a/lily/include/paper-score.hh b/lily/include/paper-score.hh index 940a4fb62b..a24a75c6ed 100644 --- a/lily/include/paper-score.hh +++ b/lily/include/paper-score.hh @@ -15,7 +15,7 @@ #include "lily-proto.hh" #include "music-output.hh" #include "lily-guile.hh" -#include "protected-scm.hh" + /** all stuff which goes onto paper. notes, signs, symbols in a score #Paper_score# contains the items, the columns. diff --git a/lily/include/score.hh b/lily/include/score.hh index 6019c8fa11..91db170187 100644 --- a/lily/include/score.hh +++ b/lily/include/score.hh @@ -12,7 +12,7 @@ #include "input.hh" #include "lily-proto.hh" -#include "protected-scm.hh" + #include "parray.hh" #include "smobs.hh" diff --git a/lily/include/system.hh b/lily/include/system.hh index 7f67f070a8..3e838b268c 100644 --- a/lily/include/system.hh +++ b/lily/include/system.hh @@ -8,7 +8,7 @@ #ifndef SCORELINE_HH #define SCORELINE_HH -#include "protected-scm.hh" + #include "column-x-positions.hh" #include "spanner.hh" diff --git a/lily/include/translator.hh b/lily/include/translator.hh index dbe0ff7e62..fa08548668 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -15,7 +15,6 @@ #include "lily-proto.hh" #include "virtual-methods.hh" #include "lily-guile.hh" -#include "parray.hh" #include "input.hh" #include "smobs.hh" diff --git a/lily/input-smob.cc b/lily/input-smob.cc index 89a96a1e4a..af9180a744 100644 --- a/lily/input-smob.cc +++ b/lily/input-smob.cc @@ -36,7 +36,8 @@ free_smob (SCM s) } /* - for unknown reason, we don't use IMPLEMENT_TYPE_P + We don't use IMPLEMENT_TYPE_P, since the smobification part is + implemented separately from the class. */ SCM ly_input_p (SCM x) @@ -44,6 +45,19 @@ ly_input_p (SCM x) return unsmob_input (x) ? SCM_BOOL_T : SCM_BOOL_F ; } +SCM +ly_input_message (SCM sip, SCM msg) +{ + Input *ip = unsmob_input(sip); + + SCM_ASSERT_TYPE(ip, sip, SCM_ARG1, __FUNCTION__, "input location"); + SCM_ASSERT_TYPE(gh_string_p(msg), msg, SCM_ARG2, __FUNCTION__, "string"); + + String m = ly_scm2string (msg); + + ip->message (m); + return SCM_UNDEFINED; +} static void @@ -58,6 +72,8 @@ start_input_smobs () scm_c_define_gsubr ("ly-input-location?", 1, 0, 0, (Scheme_function_unknown)ly_input_p); + scm_c_define_gsubr ("ly-input-message", 2, 0, 0, + (Scheme_function_unknown)ly_input_message); } SCM diff --git a/lily/note-head.cc b/lily/note-head.cc index 23328569c5..01ecae6a33 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -173,11 +173,14 @@ Note_head::brew_molecule (SCM smob) /* Compute the width the head without ledgers. + + -- there used to be some code from the time that ledgers + did take space. Nowadays, we can simply take the standard extent. */ Interval Note_head::head_extent (Grob *me, Axis a) { - return internal_brew_molecule (me, false).extent (a); + return me->get_molecule()->extent (a); } diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index 7f1cfaac4c..5e8c509807 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -8,10 +8,8 @@ */ #include - #include - #include "dimensions.hh" #include "virtual-methods.hh" #include "paper-outputter.hh" diff --git a/lily/parser.yy b/lily/parser.yy index 22d49dc65a..c1a0b28271 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -570,6 +570,13 @@ score_body: SCM m = $1->self_scm (); scm_gc_unprotect_object (m); $$->music_ = m; + + /* + guh. + */ + SCM check_func = scm_c_eval_string ("check-start-chords"); + gh_call1 (check_func, m); + } | SCORE_IDENTIFIER { $$ = new Score (*unsmob_score ($1)); @@ -741,10 +748,12 @@ Sequential_music: SEQUENTIAL '{' Music_list '}' { $$ = new Sequential_music (SCM_EOL); $$->set_mus_property ("elements", ly_car ($3)); + $$->set_spot(THIS->here_input()); } | '{' Music_list '}' { $$ = new Sequential_music (SCM_EOL); $$->set_mus_property ("elements", ly_car ($2)); + $$->set_spot(THIS->here_input()); } ; @@ -752,11 +761,13 @@ Simultaneous_music: SIMULTANEOUS '{' Music_list '}'{ $$ = new Simultaneous_music (SCM_EOL); $$->set_mus_property ("elements", ly_car ($3)); + $$->set_spot(THIS->here_input()); } | '<' Music_list '>' { $$ = new Simultaneous_music (SCM_EOL); $$->set_mus_property ("elements", ly_car ($2)); + $$->set_spot(THIS->here_input()); } ; diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 77b54f113c..81d56d3881 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -240,3 +240,52 @@ this is not an override )) ;;; + +;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;; + +(define (has-request-chord elts) + (reduce (lambda (x y) (or x y)) (map (lambda (x) (equal? (ly-music-name x) + "Request_chord")) elts) + )) + +(define (ly-music-message music msg) + (let* ( + (ip (ly-get-mus-property music 'origin)) + ) + + (if (ly-input-location? ip) + (ly-input-message ip msg) + (ly-warn msg)) + )) + +(define (check-start-chords music) + "Check music expression for a Simultaneous_music containing notes +(ie. Request_chords), without context specification. + +Called from parser. +" + (let* + ((es (ly-get-mus-property music 'elements)) + (e (ly-get-mus-property music 'element)) + (name (ly-music-name music)) + ) + + (cond + ((equal? name "Context_specced_music") #t) + ((equal? name "Simultaneous_music") + + (if (has-request-chord es) + (ly-music-message music "Starting score with a chord. +Please insert an explicit \\context before chord") + (map check-start-chords es))) + + ((equal? name "Sequential_music") + (if (pair? es) + (check-start-chords (car es)))) + (else (if (music? e) (check-start-chords e ))) + + )) + + music + ) diff --git a/scm/output-lib.scm b/scm/output-lib.scm index 254732788f..8ae4df7790 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -91,6 +91,8 @@ centered, X==1 is at the right, X == -1 is at the left." ((harmonic) '(1.0 0.0)) ((triangle) '(0.75 . 0.15)) (else + + ;; this also works for easy notation. '(1.0 . 0.0) ))) -- 2.39.5