]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/define-music-types.scm (music-descriptions): don't use
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 10 Jul 2005 11:25:24 +0000 (11:25 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 10 Jul 2005 11:25:24 +0000 (11:25 +0000)
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.

20 files changed:
ChangeLog
lily/include/music-wrapper.hh
lily/include/score.hh
lily/music-wrapper-iterator.cc
lily/music-wrapper.cc
lily/music.cc
lily/paper-column.cc
lily/parser.yy
lily/score-scheme.cc
lily/score.cc
lily/unfolded-repeat-iterator.cc
lily/volta-repeat-iterator.cc [new file with mode: 0644]
python/lilylib.py
scm/define-grobs.scm
scm/define-music-types.scm
scm/lily-library.scm
scm/music-functions.scm
scm/safe-lily.scm
scripts/lilypond-book.py
scripts/mup2ly.py

index 5356f333dd8a8a96eafd7744c8b8c1629fe35979..227490fee4eddaa6da396b70e530ebef98e742db 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2005-07-10  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * 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  <hanwen@xs4all.nl>
 
        * lily/include/simple-spacer.hh (Module): idem.
index 05ba1ae390b01ad31b819ccc8b22a148fbb17d8c..ca57666779bd6297bacd607824f8da5de49ce4cd 100644 (file)
@@ -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 ed6aecddd27ffe4f3e7cdc55c704fe0a84418494..91facb5abfc30f9f54d073fc2e2f1edbd40beead 100644 (file)
@@ -34,14 +34,13 @@ public:
   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 e20a6261f5692e60d18fdc6624834c089a4a8277..15dde8a3d5a245e8461de687acb02f7ff4fcdf74 100644 (file)
@@ -37,8 +37,9 @@ Music_wrapper_iterator::derived_substitute (Context *f, Context *t)
 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 7106707d5a4abe8f2f6e23df8959cb801a664253..81238971718ed1dfd5441f30b9874d0900499e18 100644 (file)
@@ -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
@@ -35,11 +29,3 @@ Music_wrapper::length_callback (SCM m)
   return elt->get_length ().smobbed_copy ();
 }
 
-Music *
-Music_wrapper::element () const
-{
-  return unsmob_music (get_property ("element"));
-}
-
-ADD_MUSIC (Music_wrapper);
-
index 2c631d25d172ebb9382eb3f7f1b763386fec2296..304f658e4bf7ea96a4e25ba234364b2274ed4eb0 100644 (file)
@@ -112,7 +112,7 @@ Music::get_length () const
 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 26e7f5d0b67ad832a2ba3dd97152ab09905a5d78..a518e02c8f384d9ee36f8cab5f13ab2a70961984 100644 (file)
@@ -118,12 +118,20 @@ Paper_column::print (SCM p)
   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 4d73b39b5d692fb28960868ba16f3ba68d3b57a1..b12b03e79682db542cdbe03a4d75a2eebe96fbf1 100644 (file)
@@ -787,8 +787,15 @@ score_block:
        ;
 
 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 {
@@ -798,11 +805,6 @@ score_body:
        | 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 fce8296dc9a9111277691d5df5d55a2a2f4711bb..19bac6c48a7926d5b1078d530c20cd2e933331a2 100644 (file)
 #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 a9029cb21fa64ec17441650088b76797597f9fd3..6d86607e68ce8f28812dea6aef370de495b38bb8 100644 (file)
@@ -205,13 +205,8 @@ Score::book_rendering (Output_def *layoutbook,
 }
 
 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 c7a5db97f794f6926c1fa5f80017cd58e2f72de7..a0fef55567bcf1034d00edfbbfa87e78e840b142 100644 (file)
@@ -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 <hanwen@cs.uu.nl>
 */
 
@@ -50,114 +49,4 @@ Unfolded_repeat_iterator::get_music_list () const
   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);
diff --git a/lily/volta-repeat-iterator.cc b/lily/volta-repeat-iterator.cc
new file mode 100644 (file)
index 0000000..9e37056
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+  volta-repeat-iterator.cc -- implement Volta_repeat_iterator
+
+  source file of the GNU LilyPond music typesetter
+
+
+  (c) 2002--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
+
+#include "music.hh"
+#include "sequential-iterator.hh"
+#include "context.hh"
+
+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);
index e56fa6d9d76963c57fe54b44eef722f5812442f8..82b3818966254231690838fe3d9d2911a1b5470a 100644 (file)
 ### 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 @@ import glob
 # 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 @@ sys.path.insert (0, os.path.join (datadir, 'python'))
 
 
 
-# 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 @@ def getopt_args (opts):
        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 @@ def cp_to_dir (pattern, dir):
        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, ':')
@@ -419,21 +347,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",
                    rename_page1_p = 0):
index a1d6cb361b97dff7fa9b3aab19b174f04623d97c..60ca3f11709e8c65bd7928b71119e28a26f0ee4b 100644 (file)
        (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 ))))
        ))
 
        (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 4593aba5a8fc80172637f015e02fa99f238b8622..f0d555743bb7ed18c01cf4070fd06dd0c6d0866d 100644 (file)
@@ -70,9 +70,10 @@ is an articulation (such as @code{-.}, @code{->}, @code{\\tenuto},
     (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 @@ Syntax @code{\\translator Staff = @var{new-id}}.")
      . (
        (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 @@ Syntax: @var{note}\\cr
     (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 @@ goes down).")
     (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 NOTE(         and )NOTE")
 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 @@ Syntax @code{\\times @var{fraction} @var{music}}, e.g.
     (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 @@ Syntax @code{\\times @var{fraction} @var{music}}, e.g.
        (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 @@ For example, transposed music.")
      . (
        (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 5b08393b80570b00d1e052823e58e3f6a2436689..b9e326cae7167dd7de8ab359020c4d5c0f5a9070 100644 (file)
   (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 d2a0c04a234199877555ddac82da69573abdd224..84ac716f197fbd9c477acfa384c6a68883b96774 100644 (file)
@@ -744,7 +744,7 @@ Syntax:
    
    ;; switch-on-debugging
    (lambda (x parser) (music-map cue-substitute x))
-;   (lambda (x parser) (music-map display-scheme-music x))
 
    ))
 
index e45d2ef6464ff3173d02f51c4546f9a302987a57..0e0fb0d9cf4f70c515fbb19496658ac230ec50de 100644 (file)
@@ -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 ccc873c41c36e8b5556ed93bda1972b6a9ffe03b..692790bf3c670d7000032194257580e1570c0f02 100644 (file)
@@ -106,7 +106,7 @@ option_definitions = [
          _ ("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 @@ PREAMBLE_LY = r'''%%%% Generated by %(program_name)s
 #(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 @@ def do_options ():
                        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 d9154fe079e9a71d8c4d4f0dda95a50e6842a37c..59810972eef2830d40f36e1ee7fbc6f7dd5fd32b 100644 (file)
@@ -86,28 +86,6 @@ option_definitions = [
 # 
 # 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)
@@ -289,23 +267,6 @@ def cp_to_dir (pattern, dir):
        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):
        if not os.path.isdir (dir):
                makedirs (dir, mode)