CVSROOT: /cvsroot/lilypond Module name: lilypond Branch: Changes by: Han-Wen Nienhuys <[EMAIL PROTECTED]> 05/07/10 11:25:24
Modified files: . : ChangeLog lily : music-wrapper-iterator.cc music-wrapper.cc music.cc paper-column.cc parser.yy score-scheme.cc score.cc unfolded-repeat-iterator.cc lily/include : music-wrapper.hh score.hh python : lilylib.py scm : define-grobs.scm define-music-types.scm lily-library.scm music-functions.scm safe-lily.scm scripts : lilypond-book.py mup2ly.py Added files: lily : volta-repeat-iterator.cc Log message: * scm/define-music-types.scm (music-descriptions): don't use Music_wrapper type. * lily/paper-column.cc (print): print moment too. * scripts/mup2ly.py (cp_to_dir): remove 1.5.2 compat glue. remove compatibility cruft. * lily/parser.yy (score_body): \score can only begin with Music. * lily/score-scheme.cc (LY_DEFINE): rename scorify to make-score. Take music argument only. Move parser interaction to Scheme. * scm/lily-library.scm (scorify-music): new function. * python/lilylib.py (datadir): remove 2.1 compat kludge. (datadir): remove resource import. (print_environment): remove get_bbox() (cp_to_dir): remove pre 1.5.2 compat glue. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3859&tr2=1.3860&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/volta-repeat-iterator.cc?rev=1.1 http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/music-wrapper-iterator.cc.diff?tr1=1.40&tr2=1.41&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/music-wrapper.cc.diff?tr1=1.40&tr2=1.41&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/music.cc.diff?tr1=1.134&tr2=1.135&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/paper-column.cc.diff?tr1=1.77&tr2=1.78&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/parser.yy.diff?tr1=1.475&tr2=1.476&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/score-scheme.cc.diff?tr1=1.8&tr2=1.9&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/score.cc.diff?tr1=1.164&tr2=1.165&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/unfolded-repeat-iterator.cc.diff?tr1=1.54&tr2=1.55&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/music-wrapper.hh.diff?tr1=1.33&tr2=1.34&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/score.hh.diff?tr1=1.54&tr2=1.55&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/python/lilylib.py.diff?tr1=1.66&tr2=1.67&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/define-grobs.scm.diff?tr1=1.210&tr2=1.211&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/define-music-types.scm.diff?tr1=1.56&tr2=1.57&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/lily-library.scm.diff?tr1=1.38&tr2=1.39&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/music-functions.scm.diff?tr1=1.148&tr2=1.149&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/safe-lily.scm.diff?tr1=1.31&tr2=1.32&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scripts/lilypond-book.py.diff?tr1=1.266&tr2=1.267&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scripts/mup2ly.py.diff?tr1=1.29&tr2=1.30&r1=text&r2=text Patches: Index: lilypond/ChangeLog diff -u lilypond/ChangeLog:1.3859 lilypond/ChangeLog:1.3860 --- lilypond/ChangeLog:1.3859 Sat Jul 9 22:35:37 2005 +++ lilypond/ChangeLog Sun Jul 10 11:25:24 2005 @@ -1,3 +1,26 @@ +2005-07-10 Han-Wen Nienhuys <[EMAIL PROTECTED]> + + * scm/define-music-types.scm (music-descriptions): don't use + Music_wrapper type. + + * lily/paper-column.cc (print): print moment too. + + * scripts/mup2ly.py (cp_to_dir): remove 1.5.2 compat glue. + remove compatibility cruft. + + * lily/parser.yy (score_body): \score can only begin with Music. + + * lily/score-scheme.cc (LY_DEFINE): rename scorify to + make-score. Take music argument only. Move parser interaction to + Scheme. + + * scm/lily-library.scm (scorify-music): new function. + + * python/lilylib.py (datadir): remove 2.1 compat kludge. + (datadir): remove resource import. + (print_environment): remove get_bbox() + (cp_to_dir): remove pre 1.5.2 compat glue. + 2005-07-09 Han-Wen Nienhuys <[EMAIL PROTECTED]> * lily/include/simple-spacer.hh (Module): idem. Index: lilypond/lily/include/music-wrapper.hh diff -u lilypond/lily/include/music-wrapper.hh:1.33 lilypond/lily/include/music-wrapper.hh:1.34 --- lilypond/lily/include/music-wrapper.hh:1.33 Thu Mar 10 14:36:12 2005 +++ lilypond/lily/include/music-wrapper.hh Sun Jul 10 11:25:24 2005 @@ -9,23 +9,13 @@ #ifndef MUSIC_WRAPPER_HH #define MUSIC_WRAPPER_HH -#include "music.hh" -#include "pitch.hh" +#include "lily-guile.hh" -/** A Music that modifies an existing Music. This data structure - corresponds to a production that takes a single Music argument, - - Music: STUFF Music -*/ -class Music_wrapper : public Music +struct Music_wrapper { public: - Music_wrapper (SCM); - VIRTUAL_COPY_CONSTRUCTOR (Music, Music_wrapper); DECLARE_SCHEME_CALLBACK (length_callback, (SCM)); DECLARE_SCHEME_CALLBACK (start_callback, (SCM)); - - Music *element () const; }; #endif /* MUSIC_WRAPPER_HH */ Index: lilypond/lily/include/score.hh diff -u lilypond/lily/include/score.hh:1.54 lilypond/lily/include/score.hh:1.55 --- lilypond/lily/include/score.hh:1.54 Mon Apr 18 00:36:45 2005 +++ lilypond/lily/include/score.hh Sun Jul 10 11:25:24 2005 @@ -34,14 +34,13 @@ Score (Score const &); SCM get_music () const; - void set_music (SCM music, SCM parser); + void set_music (SCM music); SCM book_rendering (Output_def *, Output_def *, Object_key *); }; DECLARE_UNSMOB (Score, score); void default_rendering (SCM, SCM, SCM, SCM, SCM, SCM); -SCM ly_music_scorify (SCM, SCM); SCM ly_render_output (SCM, SCM); SCM ly_run_translator (SCM, SCM, SCM); Index: lilypond/lily/music-wrapper-iterator.cc diff -u lilypond/lily/music-wrapper-iterator.cc:1.40 lilypond/lily/music-wrapper-iterator.cc:1.41 --- lilypond/lily/music-wrapper-iterator.cc:1.40 Tue Mar 29 14:15:39 2005 +++ lilypond/lily/music-wrapper-iterator.cc Sun Jul 10 11:25:24 2005 @@ -37,8 +37,9 @@ void Music_wrapper_iterator::construct_children () { - Music *m = dynamic_cast<Music_wrapper const *> (get_music ())->element (); - child_iter_ = unsmob_iterator (get_iterator (m)); + Music *my_music = get_music (); + Music *child = unsmob_music (my_music->get_property ("element")); + child_iter_ = unsmob_iterator (get_iterator (child)); } bool Index: lilypond/lily/music-wrapper.cc diff -u lilypond/lily/music-wrapper.cc:1.40 lilypond/lily/music-wrapper.cc:1.41 --- lilypond/lily/music-wrapper.cc:1.40 Thu Mar 10 14:36:13 2005 +++ lilypond/lily/music-wrapper.cc Sun Jul 10 11:25:24 2005 @@ -8,14 +8,8 @@ #include "music-wrapper.hh" -Music_wrapper::Music_wrapper (SCM x) - : Music (x) -{ - if (!ly_c_procedure_p (length_callback_)) - length_callback_ = length_callback_proc; - if (!ly_c_procedure_p (start_callback_)) - start_callback_ = length_callback_proc; -} +#include "music.hh" + MAKE_SCHEME_CALLBACK (Music_wrapper, start_callback, 1); SCM @@ -34,12 +28,4 @@ Music *elt = unsmob_music (me->get_property ("element")); return elt->get_length ().smobbed_copy (); } - -Music * -Music_wrapper::element () const -{ - return unsmob_music (get_property ("element")); -} - -ADD_MUSIC (Music_wrapper); Index: lilypond/lily/music.cc diff -u lilypond/lily/music.cc:1.134 lilypond/lily/music.cc:1.135 --- lilypond/lily/music.cc:1.134 Fri Jul 8 22:16:28 2005 +++ lilypond/lily/music.cc Sun Jul 10 11:25:24 2005 @@ -112,7 +112,7 @@ Moment Music::start_mom () const { - SCM lst = get_property ("start-callback"); + SCM lst = start_callback_; if (ly_c_procedure_p (lst)) { SCM res = scm_call_1 (lst, self_scm ()); Index: lilypond/lily/paper-column.cc diff -u lilypond/lily/paper-column.cc:1.77 lilypond/lily/paper-column.cc:1.78 --- lilypond/lily/paper-column.cc:1.77 Tue Jun 7 15:13:06 2005 +++ lilypond/lily/paper-column.cc Sun Jul 10 11:25:24 2005 @@ -118,12 +118,20 @@ Grob *me = unsmob_grob (p); String r = to_string (Paper_column::get_rank (me)); + + Moment *mom = unsmob_moment (me->get_property ("when")); + String when = mom ? mom->to_string () : "?/?"; + SCM properties = Font_interface::text_font_alist_chain (me); SCM scm_mol = Text_interface::interpret_markup (me->get_layout ()->self_scm (), properties, scm_makfrom0str (r.to_str0 ())); + SCM when_mol = Text_interface::interpret_markup (me->get_layout ()->self_scm (), + properties, + scm_makfrom0str (when.to_str0 ())); Stencil t = *unsmob_stencil (scm_mol); + t.add_at_edge (Y_AXIS, DOWN, *unsmob_stencil (when_mol), 0.1, 0.1); t.align_to (X_AXIS, CENTER); t.align_to (Y_AXIS, DOWN); Index: lilypond/lily/parser.yy diff -u lilypond/lily/parser.yy:1.475 lilypond/lily/parser.yy:1.476 --- lilypond/lily/parser.yy:1.475 Thu Jun 9 18:05:31 2005 +++ lilypond/lily/parser.yy Sun Jul 10 11:25:24 2005 @@ -787,8 +787,15 @@ ; score_body: - /**/ { - $$ = new Score; + Music { + SCM m = $1->self_scm (); + scm_gc_unprotect_object (m); + SCM scorify = ly_lily_module_constant ("scorify-music"); + SCM score = scm_call_2 (scorify, m, THIS->self_scm ()); + + // pass ownernship to C++ again. + scm_gc_protect_object (score); + $$ = unsmob_score (score); $$->set_spot (@$); } | SCORE_IDENTIFIER { @@ -797,11 +804,6 @@ } | score_body object_id_setting { $$->user_key_ = ly_scm2string ($2); - } - | score_body Music { - SCM m = $2->self_scm (); - scm_gc_unprotect_object (m); - $$->set_music (m, THIS->self_scm ()); } | score_body lilypond_header { $$->header_ = $2; Index: lilypond/lily/score-scheme.cc diff -u lilypond/lily/score-scheme.cc:1.8 lilypond/lily/score-scheme.cc:1.9 --- lilypond/lily/score-scheme.cc:1.8 Mon Apr 18 13:27:48 2005 +++ lilypond/lily/score-scheme.cc Sun Jul 10 11:25:24 2005 @@ -11,16 +11,16 @@ #include "output-def.hh" #include "global-context.hh" -LY_DEFINE (ly_music_scorify, "ly:music-scorify", - 2, 0, 0, - (SCM music, SCM parser), - "Return @var{music} with @var{texts} encapsulated in @var{score}.") +LY_DEFINE (ly_make_score, "ly:make-score", + 1, 0, 0, + (SCM music), + "Return score with @var{music} encapsulated in @var{score}.") { Music *mus = unsmob_music (music); SCM_ASSERT_TYPE (mus, music, SCM_ARG1, __FUNCTION__, "music"); Score *score = new Score; - score->set_music (music, parser); + score->set_music (music); SCM self = score->self_scm (); scm_gc_unprotect_object (self); Index: lilypond/lily/score.cc diff -u lilypond/lily/score.cc:1.164 lilypond/lily/score.cc:1.165 --- lilypond/lily/score.cc:1.164 Tue May 31 18:50:04 2005 +++ lilypond/lily/score.cc Sun Jul 10 11:25:24 2005 @@ -205,13 +205,8 @@ } void -Score::set_music (SCM music, SCM parser) +Score::set_music (SCM music) { - /* URG? */ - SCM check_funcs = ly_lily_module_constant ("toplevel-music-functions"); - for (; scm_is_pair (check_funcs); check_funcs = scm_cdr (check_funcs)) - music = scm_call_2 (scm_car (check_funcs), music, parser); - if (unsmob_music (music_)) { unsmob_music (music)->origin ()->error (_ ("already have music in score")); Index: lilypond/lily/unfolded-repeat-iterator.cc diff -u lilypond/lily/unfolded-repeat-iterator.cc:1.54 lilypond/lily/unfolded-repeat-iterator.cc:1.55 --- lilypond/lily/unfolded-repeat-iterator.cc:1.54 Thu Mar 10 14:36:12 2005 +++ lilypond/lily/unfolded-repeat-iterator.cc Sun Jul 10 11:25:24 2005 @@ -1,9 +1,8 @@ /* - unfolded-repeat-iterator.cc -- implement Unfolded_repeat_iterator, Volta_repeat_iterator - + unfolded-repeat-iterator.cc -- implement Unfolded_repeat_iterator + source file of the GNU LilyPond music typesetter - (c) 2002--2005 Han-Wen Nienhuys <[EMAIL PROTECTED]> */ @@ -50,114 +49,4 @@ return l; } -class Volta_repeat_iterator : public Sequential_iterator -{ -public: - DECLARE_SCHEME_CALLBACK (constructor, ()); - Volta_repeat_iterator (); - - void add_repeat_command (SCM); -protected: - virtual SCM get_music_list () const; - virtual void next_element (bool); - virtual void construct_children (); - virtual void process (Moment); - - bool first_time_; - int alt_count_; - int rep_count_; - int done_count_; -}; - -Volta_repeat_iterator::Volta_repeat_iterator () -{ - done_count_ = alt_count_ = rep_count_ = 0; - first_time_ = true; -} - -SCM -Volta_repeat_iterator::get_music_list ()const -{ - return scm_cons (get_music ()->get_property ("element"), - get_music ()->get_property ("elements")); -} - -void -Volta_repeat_iterator::construct_children () -{ - Sequential_iterator::construct_children (); - - SCM alts = get_music ()->get_property ("elements"); - - alt_count_ = scm_ilength (alts); - rep_count_ = scm_to_int (get_music ()->get_property ("repeat-count")); - done_count_ = 0; -} - -/* - TODO: add source information for debugging -*/ -void -Volta_repeat_iterator::add_repeat_command (SCM what) -{ - SCM reps = ly_symbol2scm ("repeatCommands"); - SCM current_reps = get_outlet ()->internal_get_property (reps); - - Context *where = get_outlet ()->where_defined (reps); - if (where - && current_reps == SCM_EOL || scm_is_pair (current_reps)) - { - current_reps = scm_cons (what, current_reps); - where->internal_set_property (reps, current_reps); - } -} - -void -Volta_repeat_iterator::next_element (bool side_effect) -{ - done_count_++; - - Sequential_iterator::next_element (side_effect); - - if (side_effect) - { - if (alt_count_) - { - String repstr = to_string (rep_count_ - alt_count_ + done_count_) + "."; - if (done_count_ > 1) - { - add_repeat_command (scm_list_n (ly_symbol2scm ("volta"), SCM_BOOL_F, SCM_UNDEFINED)); - - if (done_count_ - 1 < alt_count_) - add_repeat_command (ly_symbol2scm ("end-repeat")); - } - - if (done_count_ == 1 && alt_count_ < rep_count_) - { - repstr = "1.--" + to_string (rep_count_ - alt_count_ + done_count_) + "."; - } - - if (done_count_ <= alt_count_) - add_repeat_command (scm_list_n (ly_symbol2scm ("volta"), - scm_makfrom0str (repstr.to_str0 ()), SCM_UNDEFINED)); - } - else - { - add_repeat_command (ly_symbol2scm ("end-repeat")); - } - } -} - -void -Volta_repeat_iterator::process (Moment m) -{ - if (first_time_) - { - add_repeat_command (ly_symbol2scm ("start-repeat")); - first_time_ = false; - } - Sequential_iterator::process (m); -} - -IMPLEMENT_CTOR_CALLBACK (Volta_repeat_iterator); IMPLEMENT_CTOR_CALLBACK (Unfolded_repeat_iterator); Index: lilypond/python/lilylib.py diff -u lilypond/python/lilylib.py:1.66 lilypond/python/lilylib.py:1.67 --- lilypond/python/lilylib.py:1.66 Wed Jun 29 22:01:45 2005 +++ lilypond/python/lilylib.py Sun Jul 10 11:25:24 2005 @@ -12,11 +12,14 @@ ### subst: \(help_summary\|keep_temp_dir_p\|option_definitions\|original_dir\|program_name\|pseudo_filter_p\|temp_dir\|verbose_p\) import __main__ +import getopt +import glob +import os +import re import shutil import string import sys import tempfile -import glob ################################################################ # Users of python modules should include this snippet @@ -30,9 +33,6 @@ # If set, LILYPONDPREFIX must take prevalence # if datadir is not set, we're doing a build and LILYPONDPREFIX -import getopt -import os -import sys datadir = '@local_lilypond_datadir@' if not os.path.isdir (datadir): datadir = '@lilypond_datadir@' @@ -45,59 +45,6 @@ -# Customize these - -# UGH. - why? Py2exe barfs -if __name__ == '__main__': - import lilylib as ly - global _;_=ly._ - global re;re = ly.re - - # lilylib globals - program_name = 'unset' - pseudo_filter_p = 0 - original_dir = os.getcwd () - temp_dir = os.path.join (original_dir, '%s.dir' % program_name) - keep_temp_dir_p = 0 - verbose_p = 0 - - help_summary = _ ("lilylib module") - - option_definitions = [ - ('', 'h', 'help', _ ("print this help")), - ] - - from lilylib import * -################################################################ - -# Handle bug in Python 1.6-2.1 -# -# there are recursion limits for some patterns in Python 1.6 til 2.1. -# fix this by importing pre instead. Fix by Mats. - - -# Ugh. py2exe barfs on conditional imports -if float (sys.version[0:3]) <= 2.1: - try: - import pre - re = pre - del pre - except ImportError: - import re -else: - import re - -# Attempt to fix problems with limited stack size set by Python! -# Sets unlimited stack size. Note that the resource module only -# is available on UNIX. - - -# Ugh. py2exe barfs on conditional imports -try: - import resource - resource.setrlimit (resource.RLIMIT_STACK, (-1, -1)) -except: - pass localedir = '@localedir@' try: @@ -157,7 +104,7 @@ return (short, long) def option_help_str (o): - '''Transform one option description (4-tuple ) into neatly formatted string''' + '''Transform one option description (4-tuple) into neatly formatted string''' sh = ' ' if o[1]: sh = '-%s' % o[1] @@ -382,25 +329,6 @@ map (lambda x, d=dir: shutil.copy2 (x, os.path.join (d, x)), files) -# Python < 1.5.2 compatibility -# -# On most platforms, this is equivalent to -#`normpath(join(os.getcwd()), PATH)'. *Added in Python version 1.5.2* - -if os.path.__dict__.has_key ('abspath'): - abspath = os.path.abspath -else: - def abspath (path): - return os.path.normpath (os.path.join (os.getcwd (), path)) - -if os.__dict__.has_key ('makedirs'): - makedirs = os.makedirs -else: - def makedirs (dir, mode=0777): - system ('mkdir -p %s' % dir) - - - def search_exe_path (name): p = os.environ['PATH'] exe_paths = string.split (p, ':') @@ -418,21 +346,6 @@ def print_environment (): for (k,v) in os.environ.items (): sys.stderr.write ("%s=\"%s\"\n" % (k, v)) - -BOUNDING_BOX_RE = '^%%BoundingBox: (-?[0-9]+) (-?[0-9]+) (-?[0-9]+) (-?[0-9]+)' -def get_bbox (filename): - bbox = filename + '.bbox' - ## -sOutputFile does not work with bbox? - cmd = 'gs -sDEVICE=bbox -q -dNOPAUSE %s -c showpage -c quit 2>%s' % \ - (filename, bbox) - system (cmd, progress_p = 1) - box = open (bbox).read () - m = re.match (BOUNDING_BOX_RE, box) - gr = [] - if m: - gr = map (string.atoi, m.groups ()) - - return gr def make_ps_images (ps_name, resolution = 90, papersize = "a4", Index: lilypond/scm/define-grobs.scm diff -u lilypond/scm/define-grobs.scm:1.210 lilypond/scm/define-grobs.scm:1.211 --- lilypond/scm/define-grobs.scm:1.210 Fri Jul 8 22:16:28 2005 +++ lilypond/scm/define-grobs.scm Sun Jul 10 11:25:24 2005 @@ -836,7 +836,8 @@ (before-line-breaking-callback . ,Paper_column::before_line_breaking) (X-extent-callback . ,Axis_group_interface::group_extent_callback) -; (print-function . ,Paper_column::print) (font-name . "ecrm8") (Y-extent-callback . #f) + ;; debugging +;; (print-function . ,Paper_column::print) (font-size . -6) (font-name . "sans") (Y-extent-callback . #f) (meta . ((interfaces . (paper-column-interface axis-group-interface spaceable-grob-interface item-interface )))) )) @@ -859,8 +860,9 @@ (X-extent-callback . ,Axis_group_interface::group_extent_callback) (before-line-breaking-callback . ,Paper_column::before_line_breaking) (breakable . #t) + ;; debugging stuff: print column number. -; (print-function . ,Paper_column::print) (font-name . "ecrm8") (Y-extent-callback . #f) +;; (print-function . ,Paper_column::print) (font-size . -6) (font-name . "sans") (Y-extent-callback . #f) (meta . ((interfaces . (paper-column-interface axis-group-interface spaceable-grob-interface item-interface )))) Index: lilypond/scm/define-music-types.scm diff -u lilypond/scm/define-music-types.scm:1.56 lilypond/scm/define-music-types.scm:1.57 --- lilypond/scm/define-music-types.scm:1.56 Wed May 25 01:16:45 2005 +++ lilypond/scm/define-music-types.scm Sun Jul 10 11:25:24 2005 @@ -70,9 +70,10 @@ (AutoChangeMusic . ( (description . "Used for making voices that switch between piano staves automatically.") - - (internal-class-name . "Music_wrapper") + (internal-class-name . "Music") (iterator-ctor . ,Auto_change_iterator::constructor) + (start-callback . ,Music_wrapper::start_callback) + (length-callback . ,Music_wrapper::length_callback) (types . (general-music music-wrapper-music auto-change-instruction)) )) (BarCheck @@ -146,7 +147,9 @@ . ( (description . "Interpret the argument music within a specific context.") (iterator-ctor . ,Context_specced_music_iterator::constructor) - (internal-class-name . "Music_wrapper") + (length-callback . ,Music_wrapper::length_callback) + (start-callback . ,Music_wrapper::start_callback) + (internal-class-name . "Music") (types . (context-specification general-music music-wrapper-music)) )) @@ -210,7 +213,7 @@ (GraceMusic . ( (description . "Interpret the argument as grace notes. ") - (internal-class-name . "Music_wrapper") + (internal-class-name . "Music") (start-callback . ,Grace_music::start_callback) (length . ,(ly:make-moment 0 1)) (iterator-ctor . ,Grace_iterator::constructor) @@ -437,7 +440,7 @@ (QuoteMusic . ( (description . "Quote preprocessed snippets of music. ") - (internal-class-name . "Music_wrapper") + (internal-class-name . "Music") (iterator-ctor . ,Quote_iterator::constructor) (types . (general-music)) )) @@ -578,7 +581,9 @@ Syntax @code{\\times @var{fraction} @var{music}}, e.g. @code{\\times 2/3 @{ ... @}} for triplets. ") - (internal-class-name . "Music_wrapper") + (internal-class-name . "Music") + (length-callback . ,Music_wrapper::length_callback) + (start-callback . ,Music_wrapper::start_callback) (iterator-ctor . ,Time_scaled_music_iterator::constructor) (types . (time-scaled-music music-wrapper-music general-music)) )) @@ -586,7 +591,10 @@ (TransposedMusic . ( (description . "Music that has been transposed.") - (internal-class-name . "Music_wrapper") + (internal-class-name . "Music") + (iterator-ctor . ,Music_wrapper_iterator::constructor) + (start-callback . ,Music_wrapper::start_callback) + (length-callback . ,Music_wrapper::length_callback) (to-relative-callback . ,Relative_octave_music::no_relative_callback) (types . (music-wrapper-music general-music transposed-music)) )) @@ -596,7 +604,9 @@ (description . "Music that can not be converted from relative to absolute notation. For example, transposed music.") (to-relative-callback . ,Relative_octave_music::no_relative_callback) - (internal-class-name . "Music_wrapper") + (iterator-ctor . ,Music_wrapper_iterator::constructor) + (length-callback . ,Music_wrapper::length_callback) + (internal-class-name . "Music") (types . (music-wrapper-music general-music unrelativable-music)) )) @@ -604,7 +614,10 @@ . ( (description . "Music that was entered in relative octave notation.") (to-relative-callback . ,Relative_octave_music::relative_callback) - (internal-class-name . "Music_wrapper") + (iterator-ctor . ,Music_wrapper_iterator::constructor) + (length-callback . ,Music_wrapper::length_callback) + (start-callback . ,Music_wrapper::start_callback) + (internal-class-name . "Music") (types . (music-wrapper-music general-music relative-octave-music)) )) (ScriptEvent Index: lilypond/scm/lily-library.scm diff -u lilypond/scm/lily-library.scm:1.38 lilypond/scm/lily-library.scm:1.39 --- lilypond/scm/lily-library.scm:1.38 Wed Jun 29 10:55:46 2005 +++ lilypond/scm/lily-library.scm Sun Jul 10 11:25:24 2005 @@ -64,9 +64,20 @@ (ly:parser-define parser 'toplevel-scores (cons score (ly:parser-lookup parser 'toplevel-scores)))) - + + +(define-public (scorify-music music parser) + + (for-each (lambda (func) + (set! music (func music parser))) + toplevel-music-functions) + +; (display-scheme-music music) + (ly:make-score music)) + + (define-public (collect-music-for-book parser music) - (collect-scores-for-book parser (ly:music-scorify music parser))) + (collect-scores-for-book parser (scorify-music music parser))) ;;;;;;;;;;;;;;;; Index: lilypond/scm/music-functions.scm diff -u lilypond/scm/music-functions.scm:1.148 lilypond/scm/music-functions.scm:1.149 --- lilypond/scm/music-functions.scm:1.148 Thu Jun 9 15:44:49 2005 +++ lilypond/scm/music-functions.scm Sun Jul 10 11:25:24 2005 @@ -744,7 +744,7 @@ ;; switch-on-debugging (lambda (x parser) (music-map cue-substitute x)) -; (lambda (x parser) (music-map display-scheme-music x)) + )) Index: lilypond/scm/safe-lily.scm diff -u lilypond/scm/safe-lily.scm:1.31 lilypond/scm/safe-lily.scm:1.32 --- lilypond/scm/safe-lily.scm:1.31 Fri Jul 8 17:53:41 2005 +++ lilypond/scm/safe-lily.scm Sun Jul 10 11:25:24 2005 @@ -85,7 +85,7 @@ ly:music-mutable-properties ly:music-name ly:music-property - ly:music-scorify + ly:make-score ly:music-set-property! ly:music-transpose ly:music? Index: lilypond/scripts/lilypond-book.py diff -u lilypond/scripts/lilypond-book.py:1.266 lilypond/scripts/lilypond-book.py:1.267 --- lilypond/scripts/lilypond-book.py:1.266 Wed Jun 29 22:01:45 2005 +++ lilypond/scripts/lilypond-book.py Sun Jul 10 11:25:24 2005 @@ -106,7 +106,7 @@ _ ("show warranty and copyright")), ] -include_path = [ly.abspath (os.getcwd ())] +include_path = [os.path.abspath (os.getcwd ())] lilypond_binary = os.path.join ('@bindir@', 'lilypond') # Only use installed binary when we are installed too. @@ -554,7 +554,7 @@ #(set! toplevel-score-handler ly:parser-print-score) #(set! toplevel-music-handler (lambda (p m) (ly:parser-print-score - p (ly:music-scorify m p)))) + p (scorify-music m p)))) #(ly:set-option (quote no-point-and-click)) @@ -1531,7 +1531,7 @@ sys.exit (0) elif o == '--include' or o == '-I': include_path.append (os.path.join (original_dir, - ly.abspath (a))) + os.path.abspath (a))) elif o == '--output' or o == '-o': output_name = a elif o == '--process' or o == '-P': Index: lilypond/scripts/mup2ly.py diff -u lilypond/scripts/mup2ly.py:1.29 lilypond/scripts/mup2ly.py:1.30 --- lilypond/scripts/mup2ly.py:1.29 Fri Feb 4 13:48:10 2005 +++ lilypond/scripts/mup2ly.py Sun Jul 10 11:25:24 2005 @@ -86,28 +86,6 @@ # # source file of the GNU LilyPond music typesetter -# Handle bug in Python 1.6-2.1 -# -# there are recursion limits for some patterns in Python 1.6 til 2.1. -# fix this by importing pre instead. Fix by Mats. - -# todo: should check Python version first. -try: - import pre - re = pre - del pre -except ImportError: - import re - -# Attempt to fix problems with limited stack size set by Python! -# Sets unlimited stack size. Note that the resource module only -# is available on UNIX. -try: - import resource - resource.setrlimit (resource.RLIMIT_STACK, (-1, -1)) -except: - pass - try: import gettext gettext.bindtextdomain ('lilypond', localedir) @@ -287,23 +265,6 @@ # system ('cp *.%s %s' % (ext, outdir), 1) files = filter (lambda x, p=pattern: re.match (p, x), os.listdir ('.')) map (lambda x, d=dir: shutil.copy2 (x, os.path.join (d, x)), files) - - -# Python < 1.5.2 compatibility -# -# On most platforms, this is equivalent to -#`normpath(join(os.getcwd()), PATH)'. *Added in Python version 1.5.2* -if os.path.__dict__.has_key ('abspath'): - abspath = os.path.abspath -else: - def abspath (path): - return os.path.normpath (os.path.join (os.getcwd (), path)) - -if os.__dict__.has_key ('makedirs'): - makedirs = os.makedirs -else: - def makedirs (dir, mode=0777): - system ('mkdir -p %s' % dir) def mkdir_p (dir, mode=0777): _______________________________________________ Lilypond-cvs mailing list Lilypond-cvs@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-cvs