]> git.donarmstrong.com Git - lilypond.git/commitdiff
*** empty log message ***
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 28 Sep 2002 15:51:09 +0000 (15:51 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sat, 28 Sep 2002 15:51:09 +0000 (15:51 +0000)
ChangeLog
input/test/add-staccato.ly
input/test/add-text-script.ly
input/test/music-creation.ly
input/test/to-xml.ly [new file with mode: 0644]
lily/music.cc
lily/parse-scm.cc
scm/music-types.scm

index 64a4fd9a938e549d75960d9ae65d8ee297d4b5eb..70cc1d1fd24e3b950fadc4b0e3a3f4c90ecb6b33 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2002-09-28  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
+       * scm/to-xml.scm: new file.
+
+       * input/test/to-xml.ly (fooBar): demo of what is possible with the
+       new Input representation: dump music as XML.
+
        * scm/engraver-documentation-lib.scm
        (engraver-accepts-music-types?): add links from music to engraver,
        from music-type to engraver.
index 19abe00052f726e77074a33d9419881d47793c39..15268357b438e8f62b09b6f777205e580ee4e39f 100644 (file)
@@ -8,12 +8,12 @@ one would not use scm constructs.  See separate-staccato.ly first."
 } 
 
 #(define (make-script x)
-   (let ((m (make-music-by-name "Articulation_req")))
+   (let ((m (make-music-by-name 'ArticulationEvent)))
      (ly-set-mus-property! m 'articulation-type x)
      m))
     
 #(define (add-script m x)
-   (if (equal? (make-music-by-name m) "Request_chord")
+   (if (equal? (ly-get-mus-property m 'name) 'RequestChord)
        (ly-set-mus-property! m 'elements
                            (cons (make-script x)
                                  (ly-get-mus-property m 'elements)))
index b800ad259a9635f624933d7c0d1ca11f4aa6c473..bec0a159107850d01df29196bb7de1675f493273 100644 (file)
@@ -9,13 +9,13 @@ create, then write a function that will build the structure for you."
 } 
 
 #(define (make-text-script x) 
-   (let ((m (make-music-by-name "Text_script_req")))
+   (let ((m (make-music-by-name 'TextScriptEvent)))
      (ly-set-mus-property! m 'text-type 'finger)
      (ly-set-mus-property! m 'text x)
      m))
      
 #(define (add-text-script m x)
-   (if (equal? (ly-music-name m) "Request_chord")
+   (if (equal? (ly-music-name m) 'RequestChord)
        (ly-set-mus-property! m 'elements
                            (cons (make-text-script x)
                                  (ly-get-mus-property m 'elements)))
index 00e12dd2ce77b403eda16338e2f692f68c079f9b..647005b7dbf7ab8ce26ba6dfe374f2d9267f4b1e 100644 (file)
    ml))
 
 #(define (make-note elts)
-   ;; huh?  lily-guile: Could not find music type `Request_chord'
-   ;;(let* ((ml (make-music-by-name "Request_chord")))
    (let* ((ml (make-music-by-name 'RequestChord)))
    (ly-set-mus-property! ml 'elements elts)
    ml))
 
 #(define (seq-music-list elts)
-   ;; huh? lily-guile: Could not find music type `Sequential_music' 
-   ;;(let* ((ml (make-music-by-name "Sequential_music")))
    (let* ((ml (make-music-by-name 'SequentialMusic)))
    (ly-set-mus-property! ml 'elements elts)
    ml))
diff --git a/input/test/to-xml.ly b/input/test/to-xml.ly
new file mode 100644 (file)
index 0000000..04938d8
--- /dev/null
@@ -0,0 +1,27 @@
+
+
+fooBar = \notes { < c''4 \\ g'4 > }
+
+#(ly-set-parse-protect #f)
+#(load-from-path "to-xml.scm")
+
+#(music-to-xml fooBar (current-output-port))
+
+\header {
+    texidoc =
+
+    #(string-append
+      "The input representation is very generic. It
+      should not be hard to convert it to XML or a similar format:\n\n"
+
+      "@example\n"
+       (call-with-output-string
+              (lambda (p) (music-to-xml fooBar p))
+      )
+    "@end example" )
+}
+
+
+\score {
+\fooBar
+}
index d95603ad81cb5f1241dd01820ddc260b479f84cb..f72290d5464bd98271625b7f759ec53d44389781 100644 (file)
@@ -270,6 +270,21 @@ WARNING: deprecated; use make-music-by-name.
   return s;
 }
 
+// to do  property args 
+LY_DEFINE(ly_get_mutable_properties,
+         "ly-get-mutable-properties", 1, 0, 0,  (SCM mus),
+         "
+Return an alist signifying the mutable properties of @var{mus}.
+The immutable properties are not available; they should be initialized
+by the functions make-music-by-name function.
+  ")
+{
+  Music *m = unsmob_music (mus);
+  SCM_ASSERT_TYPE(m, mus, SCM_ARG1, __FUNCTION__, "music");
+
+  return m->get_property_alist (true);
+}
+
 LY_DEFINE(ly_music_list_p,"music-list?", 1, 0, 0, 
   (SCM l),"Type predicate: return true if @var{l} is a list of music objects.")
 {
index 9c49be4b5ef429a82fd6c606b9a7fcfedabac3b6..694872a335c4ec2af6ae18c9b8e9a81f3efb2726 100644 (file)
@@ -21,7 +21,6 @@ internal_ly_parse_scm (Parse_start * ps)
 
   int off = ps->start_location_.defined_str0_ - sf->to_str0();
   
-  
   scm_seek (port, scm_long2num (off), scm_long2num (SEEK_SET));
   SCM from = scm_ftell (port);
 
@@ -114,14 +113,26 @@ protected_ly_parse_scm (Parse_start *ps)
 }
 
 
+static bool protect = true;
+
+LY_DEFINE(set_parse_protect, "ly-set-parse-protect",
+         1,0,0, (SCM t),
+         "If protection is switched on, errors in inline scheme are caught.")
+{
+  protect =  (t == SCM_BOOL_T);
+  return SCM_UNSPECIFIED;
+}
+
 SCM
 ly_parse_scm (char const* s, int *n, Input i)
 {
+  
   Parse_start ps ;
   ps.str = s;
   ps.start_location_ = i;
 
-  SCM ans = protected_ly_parse_scm (&ps);
+  SCM ans = protect ? protected_ly_parse_scm (&ps)
+    : internal_ly_parse_scm (&ps);
   *n = ps.nchars;
   return ans;  
 }
index 3e5ca4a78b403c048361e95f0a6d962007eb395b..a33ad0934c5b48cc5153045e320207c07e63c723 100644 (file)
 
 (define-public (make-music-by-name x)
   (if (not (symbol? x))
-      (misc-error "Not a symbol: ~s" x))
+      (error (format "Not a symbol: ~a" x)))
   (let*
       (
        (props (hashq-ref music-name-to-property-table x '()))