suffix for main_input_b_.
* scm/music-functions.scm (toplevel-music-functions):
precompute music lengths for music expressions.
+2005-01-10 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * lily/include/lily-lexer.hh (class Lily_lexer): lose hungarian _b
+ suffix for main_input_b_.
+
+ * scm/music-functions.scm (toplevel-music-functions):
+ precompute music lengths for music expressions.
+
2005-01-11 Nicolas Sceaux <nicolas.sceaux@free.fr>
* lily/include/input.hh (class Input): new `end_' slot for end of
String main_input_name_;
void *lexval;
Input *lexloc;
- bool main_input_b_;
+ bool is_main_input_;
Sources *sources_;
}
<<EOF>> {
LexerError (_ ("EOF found inside a comment").to_str0 ());
- main_input_b_ = false;
+ is_main_input_ = false;
if (! close_input ())
yyterminate (); // can't move this, since it actually rets a YY_NULL
}
<INITIAL,chords,lyrics,notes,figures>\\maininput {
- if (!main_input_b_)
+ if (!is_main_input_)
{
start_main_input ();
- main_input_b_ = true;
+ is_main_input_ = true;
}
else
error (_ ("\\maininput not allowed outside init files"));
Input hi = here_input();
hi.step_forward ();
SCM sval = ly_parse_scm (hi.start_, &n, hi,
- be_safe_global && main_input_b_);
+ be_safe_global && is_main_input_);
if (sval == SCM_UNDEFINED)
{
}
<<EOF>> {
- if (main_input_b_)
+ if (is_main_input_)
{
- main_input_b_ = false;
+ is_main_input_ = false;
if (!close_input ())
/* Returns YY_NULL */
yyterminate ();
sources_ = sources;
scopes_ = SCM_EOL;
error_level_ = 0;
- main_input_b_ = false;
+ is_main_input_ = false;
smobify_self ();
sources_ = src.sources_;
error_level_ = src.error_level_;
- main_input_b_ = src.main_input_b_;
+ is_main_input_ = src.is_main_input_;
scopes_ = SCM_EOL;
self_scm ());
lexer_->main_input_name_ = "<string>";
- lexer_->main_input_b_ = true;
+ lexer_->is_main_input_ = true;
set_yydebug (0);
lexer_->new_input (lexer_->main_input_name_, ly_code, sources_);
SCM lst = get_property ("length");
if (unsmob_moment (lst))
return *unsmob_moment (lst);
- else if (ly_c_procedure_p (lst))
+
+ lst = get_property ("length-callback");
+ if (ly_c_procedure_p (lst))
{
SCM res = scm_call_1 (lst, self_scm ());
return *unsmob_moment (res);
break-aligned-interface item-interface ))))
))
-
(DotColumn
. (
(axes . (0))
(staff-padding . 0.25)
(meta . ((interfaces . (side-position-interface multi-measure-interface self-alignment-interface font-interface spanner-interface text-interface))))
))
- (NoteCollision
+
+ (NoteCollision
. (
(axes . (0 1))
(X-extent-callback . ,Axis_group_interface::group_extent_callback)
(inversion ,boolean? "If set, this chord note is inverted.")
(label ,markup? "label of a mark.")
(last-pitch ,ly:pitch? "The last pitch after relativization.")
- (length ,procedure? "How to compute the duration of this music")
+ (length ,ly:moment? "The duration of this music")
+ (length-callback ,procedure? "How to compute the duration of this music")
(internal-class-name ,string? "C++ class to use for this Music object")
(name ,symbol? "Name of this music object")
(numerator ,integer? "numerator of a time signature")
Syntax: @code{\\skip }@var{duration}.")
(internal-class-name . "Music")
- (length . ,ly:music-duration-length)
+ (length-callback . ,ly:music-duration-length)
(iterator-ctor . ,Simple_music_iterator::constructor)
(types . (general-music event rhythmic-event skip-event))
))
(internal-class-name . "Repeated_music")
(description . "")
(start-moment-function . ,Repeated_music::first_start)
- (length . ,Repeated_music::volta_music_length)
+ (length-callback . ,Repeated_music::volta_music_length)
(types . (general-music repeated-music volta-repeated-music))
))
(start-moment-function . ,Repeated_music::first_start)
(internal-class-name . "Repeated_music")
(types . (general-music repeated-music unfolded-repeated-music))
- (length . ,Repeated_music::unfolded_music_length)
+ (length-callback . ,Repeated_music::unfolded_music_length)
))
(PercentRepeatedMusic
. (
(description . "Repeats encoded by percents.")
(iterator-ctor . ,Percent_repeat_iterator::constructor)
(start-moment-function . ,Repeated_music::first_start)
- (length . ,Repeated_music::unfolded_music_length)
+ (length-callback . ,Repeated_music::unfolded_music_length)
(types . (general-music repeated-music percent-repeated-music))
))
(start-moment-function . ,Repeated_music::first_start)
;; the length of the repeat is handled by shifting the note logs
- (length . ,Repeated_music::folded_music_length)
+ (length-callback . ,Repeated_music::folded_music_length)
(types . (general-music repeated-music tremolo-repeated-music))
))
(description . "Repeats with alternatives placed in parallel. ")
(iterator-ctor . ,Folded_repeat_iterator::constructor)
(start-moment-function . ,Repeated_music::minimum_start)
- (length . ,Repeated_music::folded_music_length)
+ (length-callback . ,Repeated_music::folded_music_length)
(types . (general-music repeated-music folded-repeated-music))
))
))
ly:grob-set-property!))
(define-public (music-map function music)
- "Apply @var{function} to @var{music} and all of the music it contains. "
+ "Apply @var{function} to @var{music} and all of the music it contains.
+
+First it recurses over the children, then the function is applied to MUSIC.
+"
(let ((es (ly:music-property music 'elements))
(e (ly:music-property music 'element)))
(set! (ly:music-property music 'elements)
(set! (ly:music-property music 'error-found) #t))
music)
+(define (precompute-music-length music)
+ (set! (ly:music-property music 'length)
+ (ly:music-length music))
+ music)
+
(define-public toplevel-music-functions
(list
;; check-start-chords ; ; no longer needed with chord syntax.
(lambda (music parser) (voicify-music music))
(lambda (x parser) (music-map glue-mm-rest-texts x))
(lambda (x parser) (music-map music-check-error x))
+ (lambda (x parser) (music-map precompute-music-length x))
(lambda (music parser)
(music-map (quote-substitute (ly:parser-lookup parser 'musicQuotes)) music))