]> git.donarmstrong.com Git - lilypond.git/commitdiff
*** empty log message ***
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 7 Jan 2005 12:40:11 +0000 (12:40 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 7 Jan 2005 12:40:11 +0000 (12:40 +0000)
ChangeLog
lily/event.cc
lily/lily-parser.cc
lily/music-scheme.cc
lily/stencil-scheme.cc
lily/stencil.cc

index 2d386908f554afe5719b4811572f2b64daf5a78d..290da25e7178ce7e8c612414095914849ac22dcc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2005-01-07  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * lily/lily-parser-scheme.cc: new file.
+
        * lily/output-def-scheme.cc: new file.
 
        * lily/paper-book-scheme.cc: new file.
index e79f39eafcf9d511068d246eda3362a92bd76c30..cd803f87c0e0fbc17e40cf2b511fa412998b35c0 100644 (file)
@@ -66,90 +66,6 @@ Event::Event ()
 
 ADD_MUSIC (Event);
 
-LY_DEFINE (ly_music_duration_length, "ly:music-duration-length", 1, 0,0,
-         (SCM mus),
-         "Extract the duration field from @var{mus}, and return the length.")
-{
-  Music* m =   unsmob_music (mus);
-  SCM_ASSERT_TYPE (m, mus, SCM_ARG1, __FUNCTION__, "Music");
-  
-  Duration *d = unsmob_duration (m->get_property ("duration"));
-
-  Moment l ;
-  
-  if (d)
-    {
-      l = d->get_length ();  
-    }
-  else
-    programming_error ("Music has no duration");
-  return l.smobbed_copy ();
-  
-}
-
-
-LY_DEFINE (ly_music_duration_compress, "ly:music-duration-compress", 2, 0,0,
-         (SCM mus, SCM fact),
-         "Compress @var{mus} by factor @var{fact}, which is a @code{Moment}.")
-{
-  Music* m =   unsmob_music (mus);
-  Moment * f = unsmob_moment (fact);
-  SCM_ASSERT_TYPE (m, mus, SCM_ARG1, __FUNCTION__, "Music");
-  SCM_ASSERT_TYPE (f, fact, SCM_ARG2, __FUNCTION__, "Moment");
-  
-  Duration *d = unsmob_duration (m->get_property ("duration"));
-  if (d)
-    m->set_property ("duration", d->compressed (f->main_part_).smobbed_copy ());
-  return SCM_UNSPECIFIED;
-}
-
-
-
-/*
-  This is hairy, since the scale in a key-change event may contain
-  octaveless notes.
-
-
-  TODO: this should use ly:pitch. 
- */
-LY_DEFINE (ly_transpose_key_alist, "ly:transpose-key-alist",
-         2, 0, 0, (SCM l, SCM pit),
-         "Make a new key alist of @var{l} transposed by pitch @var{pit}")
-{
-  SCM newlist = SCM_EOL;
-  Pitch *p = unsmob_pitch (pit);
-  
-  for (SCM s = l; scm_is_pair (s); s = scm_cdr (s))
-    {
-      SCM key = scm_caar (s);
-      SCM alter = scm_cdar (s);
-      if (scm_is_pair (key))
-       {
-         Pitch orig (scm_to_int (scm_car (key)),
-                     scm_to_int (scm_cdr (key)),
-                     scm_to_int (alter));
-
-         orig = orig.transposed (*p);
-
-         SCM key = scm_cons (scm_int2num (orig.get_octave ()),
-                            scm_int2num (orig.get_notename ()));
-
-         newlist = scm_cons (scm_cons (key, scm_int2num (orig.get_alteration ())),
-                            newlist);
-       }
-      else if (scm_is_number (key))
-       {
-         Pitch orig (0, scm_to_int (key), scm_to_int (alter));
-         orig = orig.transposed (*p);
-
-         key = scm_int2num (orig.get_notename ());
-         alter = scm_int2num (orig.get_alteration ());
-         newlist = scm_cons (scm_cons (key, alter), newlist);
-       }
-    }
-  return scm_reverse_x (newlist, SCM_EOL);
-}
-
 void
 Key_change_ev::transpose (Pitch p)
 {
index 08f8e8e7bb85d467aaacd560eea4f8bf7d56c176..e5eeb5077533ca4a74eae24a1b5f8289ba2f9c86 100644 (file)
@@ -153,7 +153,7 @@ Lily_parser::parse_string (String ly_code)
     {
       if (define_spots_.is_empty()
          && !error_level_ )
-       programming_error ("Braces don't match, but error_level_ not set.");
+       programming_error ("define_spots_ don't match, but error_level_ not set.");
     }
 
   error_level_ = error_level_ | lexer_->error_level_;
index 672e6f022ec3eeee16c12994d7c8b40b1379e157..b4813c5e05061861fd1f406e494df8f749016849 100644 (file)
@@ -154,3 +154,86 @@ LY_DEFINE (ly_music_compress, "ly:music-compress",
   return sc->self_scm ();
 }
 
+LY_DEFINE (ly_music_duration_length, "ly:music-duration-length", 1, 0,0,
+         (SCM mus),
+         "Extract the duration field from @var{mus}, and return the length.")
+{
+  Music* m =   unsmob_music (mus);
+  SCM_ASSERT_TYPE (m, mus, SCM_ARG1, __FUNCTION__, "Music");
+  
+  Duration *d = unsmob_duration (m->get_property ("duration"));
+
+  Moment l ;
+  
+  if (d)
+    {
+      l = d->get_length ();  
+    }
+  else
+    programming_error ("Music has no duration");
+  return l.smobbed_copy ();
+  
+}
+
+
+LY_DEFINE (ly_music_duration_compress, "ly:music-duration-compress", 2, 0,0,
+         (SCM mus, SCM fact),
+         "Compress @var{mus} by factor @var{fact}, which is a @code{Moment}.")
+{
+  Music* m =   unsmob_music (mus);
+  Moment * f = unsmob_moment (fact);
+  SCM_ASSERT_TYPE (m, mus, SCM_ARG1, __FUNCTION__, "Music");
+  SCM_ASSERT_TYPE (f, fact, SCM_ARG2, __FUNCTION__, "Moment");
+  
+  Duration *d = unsmob_duration (m->get_property ("duration"));
+  if (d)
+    m->set_property ("duration", d->compressed (f->main_part_).smobbed_copy ());
+  return SCM_UNSPECIFIED;
+}
+
+
+
+/*
+  This is hairy, since the scale in a key-change event may contain
+  octaveless notes.
+
+
+  TODO: this should use ly:pitch. 
+ */
+LY_DEFINE (ly_transpose_key_alist, "ly:transpose-key-alist",
+         2, 0, 0, (SCM l, SCM pit),
+         "Make a new key alist of @var{l} transposed by pitch @var{pit}")
+{
+  SCM newlist = SCM_EOL;
+  Pitch *p = unsmob_pitch (pit);
+  
+  for (SCM s = l; scm_is_pair (s); s = scm_cdr (s))
+    {
+      SCM key = scm_caar (s);
+      SCM alter = scm_cdar (s);
+      if (scm_is_pair (key))
+       {
+         Pitch orig (scm_to_int (scm_car (key)),
+                     scm_to_int (scm_cdr (key)),
+                     scm_to_int (alter));
+
+         orig = orig.transposed (*p);
+
+         SCM key = scm_cons (scm_int2num (orig.get_octave ()),
+                            scm_int2num (orig.get_notename ()));
+
+         newlist = scm_cons (scm_cons (key, scm_int2num (orig.get_alteration ())),
+                            newlist);
+       }
+      else if (scm_is_number (key))
+       {
+         Pitch orig (0, scm_to_int (key), scm_to_int (alter));
+         orig = orig.transposed (*p);
+
+         key = scm_int2num (orig.get_notename ());
+         alter = scm_int2num (orig.get_alteration ());
+         newlist = scm_cons (scm_cons (key, alter), newlist);
+       }
+    }
+  return scm_reverse_x (newlist, SCM_EOL);
+}
index 0a81950758264313efff8c003748753b7eea32fc..ebd50de6b6bac9a1373a03bc5668cdb7a0eb4fe3 100644 (file)
@@ -254,3 +254,44 @@ LY_DEFINE (ly_stencil_align_to_x, "ly:stencil-align-to!",
                                   scm_to_double (dir));
   return stil;
 }
+
+
+LY_DEFINE (ly_stencil_fonts, "ly:stencil-fonts",
+          1, 0, 0, (SCM s),
+         " Analyse @var{s}, and return a list of fonts used in @var{s}.")
+{
+  Stencil *stil = unsmob_stencil (s);
+  SCM_ASSERT_TYPE (stil, s, SCM_ARG1, __FUNCTION__, "Stencil");
+  return find_expression_fonts (stil->expr ());
+}
+
+
+struct Stencil_interpret_arguments
+{
+  SCM func;
+  SCM arg1;
+};
+
+void stencil_interpret_in_scm (void *p, SCM expr)
+{
+  Stencil_interpret_arguments *ap = (Stencil_interpret_arguments*) p;
+  scm_call_2 (ap->func, ap->arg1, expr);
+}
+
+LY_DEFINE (ly_interpret_stencil_expression, "ly:interpret-stencil-expression",
+           4, 0, 0, (SCM expr, SCM func, SCM arg1, SCM offset),
+           "Parse EXPR, feed bits to FUNC with first arg ARG1")
+{
+  SCM_ASSERT_TYPE (ly_c_procedure_p(func), func, SCM_ARG1, __FUNCTION__,
+                  "procedure");
+
+  Stencil_interpret_arguments a;
+  a.func = func;
+  a.arg1 = arg1;
+  Offset o = ly_scm2offset (offset);
+
+  interpret_stencil_expression (expr, stencil_interpret_in_scm, (void*) &a, o);
+
+  return SCM_UNSPECIFIED;
+}
+
index c684dcb31c7d7fc4feeb5cd12532f88592b290c3..81cc03329613d2f587b92de76cf85201f5c0a2f2 100644 (file)
@@ -279,43 +279,3 @@ find_expression_fonts (SCM expr)
 }
 
 
-LY_DEFINE (ly_stencil_fonts, "ly:stencil-fonts",
-          1, 0, 0, (SCM s),
-         " Analyse @var{s}, and return a list of fonts used in @var{s}.")
-{
-  Stencil *stil = unsmob_stencil (s);
-  SCM_ASSERT_TYPE (stil, s, SCM_ARG1, __FUNCTION__, "Stencil");
-  return find_expression_fonts (stil->expr ());
-}
-
-struct Stencil_interpret_arguments
-{
-  SCM func;
-  SCM arg1;
-};
-
-void stencil_interpret_in_scm (void *p, SCM expr)
-{
-  Stencil_interpret_arguments *ap = (Stencil_interpret_arguments*) p;
-  scm_call_2 (ap->func, ap->arg1, expr);
-}
-
-
-
-LY_DEFINE (ly_interpret_stencil_expression, "ly:interpret-stencil-expression",
-           4, 0, 0, (SCM expr, SCM func, SCM arg1, SCM offset),
-           "Parse EXPR, feed bits to FUNC with first arg ARG1")
-{
-  SCM_ASSERT_TYPE (ly_c_procedure_p(func), func, SCM_ARG1, __FUNCTION__,
-                  "procedure");
-
-  Stencil_interpret_arguments a;
-  a.func = func;
-  a.arg1 = arg1;
-  Offset o = ly_scm2offset (offset);
-
-  interpret_stencil_expression (expr, stencil_interpret_in_scm, (void*) &a, o);
-
-  return SCM_UNSPECIFIED;
-}
-