]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.115
authorfred <fred>
Wed, 27 Mar 2002 00:34:18 +0000 (00:34 +0000)
committerfred <fred>
Wed, 27 Mar 2002 00:34:18 +0000 (00:34 +0000)
14 files changed:
input/test/american-chords.ly
input/test/chord-names.ly
input/test/jazz-chords.ly
lily/include/main.hh
lily/include/paper-def.hh
lily/include/paper-outputter.hh
lily/include/paper-stream.hh
lily/main.cc
lily/paper-def.cc
lily/paper-outputter.cc
lily/paper-score.cc
lily/paper-stream.cc
lily/parser.yy
scripts/lilypond-book.py

index ac9716fe66c87792832d0947c467ba56e9389f34..79350c64bf0923e631a5cbfa725a6093a03d30a6 100644 (file)
@@ -50,7 +50,7 @@ c:m7.9    % Minor ninth
     {
                \translator { 
                        \ChordNamesContext
-                       ChordNames \override #'word-space = #1 
+                       ChordName \override #'word-space = #1 
                }
     }
 }
index d640871803b34c4f30eb7b2904558eae6fe133fd..ef9dd45407f88abecc82d5199c65409fcd61e577 100644 (file)
@@ -30,7 +30,7 @@ chord = \notes\transpose c''\chords{
 
                \translator { 
                        \ChordNamesContext
-                       ChordNames \override #'word-space = #1 
+                       ChordName \override #'word-space = #1 
                }
     }
 }
index d5fd1fc651e0e555b5f015694da49fed057b33df..ca0225fb77ab5b879a1ba0ea317ff4390467461c 100644 (file)
@@ -61,7 +61,7 @@ c:m5-.7-      % o = diminished seventh chord
 >
     \paper
     {
-        \translator { \ChordNamesContext ChordNames \override #'word-space = #1 }
+        \translator { \ChordNamesContext ChordName \override #'word-space = #1 }
 %        \translator { \LyricsContext textScriptWordSpace = #0.3 }
     }
 }
index de6cf4f4174cabb42f6883c5b159392958fe5bf0..f8b2612d217c80c5cc0f4b16cd309937ac0d8988 100644 (file)
@@ -36,6 +36,7 @@ extern Array<String> get_inclusion_names ();
 extern void set_inclusion_names (Array<String>);
 
 extern File_path global_path;
+extern Array<String> global_score_header_fields;
 
 extern String default_outname_base_global;
 extern String default_outname_suffix_global;
index 7c569fd7adcb6c4c18ce3704cee759594a0a97fd..6c137247a6303cfdfc3bd2ed435d676cd5e27ef6 100644 (file)
@@ -56,6 +56,8 @@ public:
   SCM font_descriptions ()const;
   virtual ~Paper_def ();
   static int default_count_i_;
+  String current_output_base_;
+  
   /*
     JUNKME
    */
index 3a7d04466c5f557418ff73a93893c1f1b268a869..2f30e86e43842c44e65cba0ff2a7089ccffc84d6 100644 (file)
@@ -43,6 +43,8 @@ public:
   void output_comment (String s);
   void output_string (SCM s);
   void output_scheme (SCM scm);
+  static void output_score_header_field (String filename, String key, String value);
+  static void output_score_header_fields (Paper_def *paper);
 };
 
 #endif // PAPER_OUTPUTTER_HH
index ab5de0684e39739aa84e90acafd9197cbd67a9a9..4b5f51652b9a450e2ba6092bb0b728f5283042c2 100644 (file)
@@ -13,7 +13,7 @@ class Paper_stream
 {
 public:
     bool outputting_comment_b_;
-    ostream *os;
+    ostream *os_;
     int nest_level;
     /// to check linelen in output. TeX has limits.
     int line_len_i_;
@@ -32,4 +32,9 @@ private:
     void break_line();
 };
 
+class ostream;
+ostream *open_file_stream (String filename);
+void close_file_stream (ostream *os);
+
+
 #endif // PAPER_STREAM_HH
index 8a998eb9f0f82d580f0aed610f72833f484407ae..b98056a3755a25259eec18eeacdb3a0e1f259c87 100644 (file)
@@ -51,6 +51,8 @@ String init_str_global;
 int default_count_global;
 File_path global_path;
 
+Array<String> global_score_header_fields;
+
 bool safe_global_b = false;
 bool experimental_features_global_b = false;
 bool dependency_global_b = false;
@@ -72,6 +74,7 @@ String distill_inname_str (String name_str, String& ext_r);
 Long_option_init theopts[] = {
   {_i ("EXT"), "output-format", 'f',  _i ("use output format EXT (scm, ps, tex or as)")},
   {0, "help", 'h',  _i ("this help")},
+  {_i ("FIELD"), "header", 'H',  _i ("write header field to BASENAME.FIELD")},
   {_i ("DIR"), "include", 'I',  _i ("add DIR to search path")},
   {_i ("FILE"), "init", 'i',  _i ("use FILE as init file")},
   {0, "dependencies", 'M',  _i ("write Makefile dependencies for every input file")},
@@ -234,19 +237,6 @@ setup_paths ()
       global_path.add (p);
 
 #if !KPATHSEA
-      /*
-      Although kpathsea seems nice, it is not universally available 
-      (GNU/Windows). 
-
-      Compiling kpathsea seems not possible without
-      (compiling) a matching tex installation.  Apart from the fact
-      that I cannot get kpathsea compiled for GNU/Windows, another
-      major problem is that TeX installations may be different on
-      different clients, so it wouldn't work anyway.  While ugly,
-      this code is simple and effective.
-        -- jcn
-      */
-
       /* Urg: GNU make's $(word) index starts at 1 */
       int i  = 1;
       while (global_path.try_add (p + to_str (".") + to_str (i)))
@@ -361,6 +351,9 @@ main (int argc, char **argv)
        case 'Q':
          find_old_relative_b= true;
          break;
+       case 'H':
+         global_score_header_fields.push (oparser_global_p->optional_argument_ch_C_);
+         break;
        case 'I':
          global_path.push (oparser_global_p->optional_argument_ch_C_);
          break;
index 27c33651a4b9041cf586aaed8d3e8761b539b04a..001e801175d98e8db6835a8aef979525f2de45b5 100644 (file)
@@ -121,6 +121,11 @@ Paper_def::paper_stream_p () const
 }
 
 
+/* URGURGUGUUGH
+
+   not const.
+
+   Wat een puinhoop is dit. */
 String
 Paper_def::base_output_str () const
 {
@@ -133,6 +138,11 @@ Paper_def::base_output_str () const
       if (def)
        str += "-" + to_str (def);
     }
+
+  /* Must store value, as this function can be called only once */
+  Paper_def *urg = (Paper_def*)this;
+  urg->current_output_base_ = str;
+
   return str;
 }
 
index 2c2f1790198e2f3c3cf5a7a39045067f342930e2..781215c2002df99c6e0fe170a3716b53eb1cbf23 100644 (file)
@@ -25,6 +25,8 @@
 #include "scope.hh"
 #include "identifier.hh"
 #include "lily-version.hh"
+#include "paper-def.hh"
+#include "file-results.hh"
 
 
 /*
@@ -159,6 +161,7 @@ Paper_outputter::dump_scheme (SCM s)
       free (c);
     }
 }
+
 void
 Paper_outputter::output_scope (Scope *scope, String prefix)
 {
@@ -233,10 +236,49 @@ Paper_outputter::output_int_def (String k, int v)
   output_scheme (scm);
 }
 
-
-
 void
 Paper_outputter::output_string (SCM str)
 {
   *stream_p_ <<  ly_scm2string (str);
 }
+
+void
+Paper_outputter::output_score_header_field (String filename, String key, String value)
+{
+  if (filename != "-")
+    filename += String (".") + key;
+  progress_indication (_f ("writing header field %s to %s...",
+                          key,
+                          filename == "-" ? String ("<stdout>") : filename));
+  
+  ostream *os = open_file_stream (filename);
+  *os << value;
+  close_file_stream (os);
+  progress_indication ("\n");
+}
+
+void
+Paper_outputter::output_score_header_fields (Paper_def *paper)
+{
+  if (global_score_header_fields.size ())
+    {
+      SCM fields;
+#if 0 // ugh, how to reach current Score or Paper_score?
+      if (paper->header_l_)
+       fields = paper->header_l_->to_alist ();
+      else
+#endif
+       fields = header_global_p->to_alist ();
+      String base = paper->current_output_base_;
+      for (int i = 0; i < global_score_header_fields.size (); i++)
+       {
+         String key = global_score_header_fields[i];
+         //      SCM val = gh_assoc (ly_str02scm (key.ch_C ()), fields);
+         SCM val = gh_assoc (ly_symbol2scm (key.ch_C ()), fields);
+         String s;
+         if (gh_pair_p (val))
+           s = ly_scm2string (gh_cdr (val));
+         output_score_header_field (base, key, s);
+       }
+    }
+}
index f00db3099c6e4a6ef9888c608681311c2b70d515..b5f5e2d193ae080dda08d303415101ff337f70de 100644 (file)
@@ -67,8 +67,6 @@ Paper_score::calc_breaking ()
   return sol;
 }
 
-
-
 /*
   urg. clean me
  */
@@ -125,10 +123,13 @@ Paper_score::process ()
   outputter_l_->output_scheme (scm);
 
   progress_indication ("\n");
+
+  outputter_l_->output_score_header_fields (paper_l_);
+    
   // huh?
   delete outputter_l_;
   outputter_l_ = 0;
-
+  
   if (verbose_global_b)
     ly_display_scm (scm_gc_stats ()); 
 }
index caab11e504165cba9cb576816bed4422407a7e35..86f2ee5de8adef3145a3179a3faf91f3b5b73c02 100644 (file)
 
 const int MAXLINELEN = 200;
 
-Paper_stream::Paper_stream (String filename)
+ostream *
+open_file_stream (String filename)
 {
+  ostream *os;
   if (filename.length_i () && (filename != "-"))
     os = new ofstream (filename.ch_C ());
   else
-    //    os = new ostream (cout.ostreambuf ());
     os = new ostream (cout._strbuf);
   if (!*os)
     error (_f ("can't open file: `%s'", filename));
-  nest_level = 0;
-  line_len_i_ = 0;
-  outputting_comment_b_=false;
+  return os;
 }
 
-Paper_stream::~Paper_stream ()
+void
+close_file_stream (ostream *os)
 {
   *os << flush;
   if (!*os)
@@ -37,6 +37,19 @@ Paper_stream::~Paper_stream ()
       exit_status_i_ = 1;
     }
   delete os;
+}  
+
+Paper_stream::Paper_stream (String filename)
+{
+  os_ = open_file_stream (filename);
+  nest_level = 0;
+  line_len_i_ = 0;
+  outputting_comment_b_=false;
+}
+
+Paper_stream::~Paper_stream ()
+{
+  close_file_stream (os_);
   assert (nest_level == 0);
 }
 
@@ -48,7 +61,7 @@ Paper_stream::operator << (String s)
     {
       if (outputting_comment_b_)
        {
-         *os << *cp;
+         *os_ << *cp;
          if (*cp == '\n')
            {
              outputting_comment_b_=false;
@@ -61,19 +74,19 @@ Paper_stream::operator << (String s)
        {
        case '%':
          outputting_comment_b_ = true;
-         *os << *cp;
+         *os_ << *cp;
          break;
        case '{':
          nest_level++;
-         *os << *cp;
+         *os_ << *cp;
          break;
        case '}':
          nest_level--;
-         *os << *cp;
+         *os_ << *cp;
 
          if (nest_level < 0)
            {
-             delete os       // we want to see the remains.
+             delete os_;       // we want to see the remains.
              assert (nest_level>=0);
            }
 
@@ -81,33 +94,33 @@ Paper_stream::operator << (String s)
          if (nest_level == 0)
            break;
 
-         *os << '%';
+         *os_ << '%';
          break_line ();
          break;
        case '\n':
          break_line ();
          break;
        case ' ':
-         *os <<  ' ';
+         *os_ <<  ' ';
          if (line_len_i_ > MAXLINELEN)
            break_line ();
 
          break;
        default:
-         *os << *cp;
+         *os_ << *cp;
          break;
        }
     }
   //urg, for debugging only!!
-  *os << flush;
+  *os_ << flush;
   return *this;
 }
 
 void
 Paper_stream::break_line ()
 {
-  *os << '\n';
-  *os << to_str (' ', nest_level);
+  *os_ << '\n';
+  *os_ << to_str (' ', nest_level);
   outputting_comment_b_ = false;
   line_len_i_ = 0;
 }
index b44508c4b834c7b53598dec1d45ff8436bb3f2fb..5d6485132af54fa428aafb6f98db879f71bd7d8e 100644 (file)
@@ -368,7 +368,7 @@ lilypond_header_body:
 lilypond_header:
        HEADER '{' lilypond_header_body '}'     {
                $$ = $3;
-               THIS->lexer_p_-> scope_l_arr_.pop ();           
+               THIS->lexer_p_-> scope_l_arr_.pop ();
        }
        ;
 
@@ -663,13 +663,30 @@ Alternative_music:
 Repeated_music:
        REPEAT STRING bare_unsigned Music Alternative_music
        {
-               Music_sequence* m = dynamic_cast <Music_sequence*> ($5);
-               if (m && $3 < m->length_i ())
+               Music_sequence* alts = dynamic_cast <Music_sequence*> ($5);
+               if (alts && $3 < alts->length_i ())
                        $5->origin ()->warning (_ ("More alternatives than repeats.  Junking excess alternatives."));
+               Music *beg = $4;
+               int times = $3;
 
+               Repeated_music * r = new Repeated_music (SCM_EOL);
+
+               if (beg)
+                       {
+                       r-> set_mus_property ("body", beg->self_scm ());
+                       scm_unprotect_object (beg->self_scm ());
+                       }
+               r->set_mus_property ("repeat-count", gh_int2scm (times >? 1));
+
+               if (alts)
+                       {
+                       alts->truncate (times);
+                       r-> set_mus_property ("alternatives", alts->self_scm ());
+                       scm_unprotect_object (alts->self_scm ());  
+                       }
                SCM func = scm_eval2 (ly_symbol2scm ("repeat-name-to-ctor"), SCM_EOL);
                SCM result = gh_call1 (func, $2);
-               Repeated_music * r = new Repeated_music ($4, $3 >? 1, m);
+
                set_music_properties (r, result);
 
                r->set_spot (*$4->origin ());
@@ -678,25 +695,31 @@ Repeated_music:
        ;
 
 Music_sequence: '{' Music_list '}'     {
-               $$ = new Music_sequence (gh_car ($2));
+               $$ = new Music_sequence (SCM_EOL);
+               $$->set_mus_property ("elements", gh_car ($2));
        }
        ;
 
 Sequential_music:
        SEQUENTIAL '{' Music_list '}'           {
-               $$ = new Sequential_music (gh_car ($3));
+               $$ = new Sequential_music (SCM_EOL);
+               $$->set_mus_property ("elements", gh_car ($3));
        }
        | '{' Music_list '}'            {
-               $$ = new Sequential_music (gh_car ($2));
+               $$ = new Sequential_music (SCM_EOL);
+               $$->set_mus_property ("elements", gh_car ($2));
        }
        ;
 
 Simultaneous_music:
        SIMULTANEOUS '{' Music_list '}'{
-               $$ = new Simultaneous_music (gh_car ($3));
+               $$ = new Simultaneous_music (SCM_EOL);
+               $$->set_mus_property ("elements", gh_car ($3));
+
        }
        | '<' Music_list '>'    {
-               $$ = new Simultaneous_music (gh_car ($2));
+               $$ = new Simultaneous_music (SCM_EOL);
+               $$->set_mus_property ("elements", gh_car ($2));
        }
        ;
 
@@ -714,7 +737,7 @@ Simple_music:
                        THIS->parser_error (_("First argument must be a procedure taking 1 argument"));
                }
 
-         Music *m = new Music;
+         Music *m = new Music (SCM_EOL);
          m->set_mus_property ("predicate", pred);
          m->set_mus_property ("symbol", $3);
          m->set_mus_property ("value",  $5);
@@ -741,7 +764,9 @@ Simple_music:
 
 Composite_music:
        CONTEXT STRING Music    {
-               Context_specced_music *csm =  new Context_specced_music ($3);
+               Context_specced_music *csm =  new Context_specced_music (SCM_EOL);
+               csm->set_mus_property ("element", $3->self_scm ());
+               scm_unprotect_object ($3->self_scm ());
 
                csm->set_mus_property ("context-type",$2);
                csm->set_mus_property ("context-id", ly_str02scm (""));
@@ -749,17 +774,25 @@ Composite_music:
                $$ = csm;
        }
        | AUTOCHANGE STRING Music       {
-               Auto_change_music * chm = new Auto_change_music ($3);
+               Auto_change_music * chm = new Auto_change_music (SCM_EOL);
+               chm->set_mus_property ("element", $3->self_scm ());
+
+               scm_unprotect_object ($3->self_scm ());
                chm->set_mus_property ("what", $2); 
 
                $$ = chm;
                chm->set_spot (*$3->origin ());
        }
        | GRACE Music {
-               $$ = new Grace_music ($2);
+               $$ = new Grace_music (SCM_EOL);
+               $$->set_mus_property ("element", $2->self_scm ());
+               scm_unprotect_object ($2->self_scm ());
+
        }
        | CONTEXT STRING '=' STRING Music {
-               Context_specced_music *csm =  new Context_specced_music ($5);
+               Context_specced_music *csm =  new Context_specced_music (SCM_EOL);
+               csm->set_mus_property ("element", $5->self_scm ());
+               scm_unprotect_object ($5->self_scm ());
 
                csm->set_mus_property ("context-type", $2);
                csm->set_mus_property ("context-id", $4);
@@ -773,24 +806,47 @@ Composite_music:
                bare_unsigned '/' bare_unsigned Music   
 
        {
-               $$ = new Time_scaled_music ($3, $5, $6);
+               int n = $3; int d = $5;
+               Music *mp = $6;
+               $$ = new Time_scaled_music (SCM_EOL);
                $$->set_spot (THIS->pop_spot ());
+
+
+               $$->set_mus_property ("element", mp->self_scm ());
+               scm_unprotect_object (mp->self_scm ());
+               $$->set_mus_property ("numerator", gh_int2scm (n));
+               $$->set_mus_property ("denominator", gh_int2scm (d));
+               $$->compress (Moment (n,d));
+
        }
        | Repeated_music                { $$ = $1; }
        | Simultaneous_music            { $$ = $1; }
        | Sequential_music              { $$ = $1; }
        | TRANSPOSE musical_pitch Music {
-               $$ = new Transposed_music ($3, *unsmob_pitch ($2));
+               $$ = new Transposed_music (SCM_EOL);
+               Music *p = $3;
+               Pitch pit = *unsmob_pitch ($2);
+
+               p->transpose (pit);
+               $$->set_mus_property ("element", p->self_scm ());
+               scm_unprotect_object (p->self_scm ());
        }
        | TRANSPOSE steno_tonic_pitch Music {
-               $$ = new Transposed_music ($3, *unsmob_pitch ($2));
+               $$ = new Transposed_music (SCM_EOL);
+               Music *p = $3;
+               Pitch pit = *unsmob_pitch ($2);
+
+               p->transpose (pit);
+               $$->set_mus_property ("element", p->self_scm ());
+               scm_unprotect_object (p->self_scm ());
+       
        }
        | APPLY embedded_scm Music  {
                SCM ret = gh_call1 ($2, $3->self_scm ());
                Music *m = unsmob_music (ret);
                if (!m) {
                        THIS->parser_error ("\\apply must return a Music");
-                       m = new Music ();
+                       m = new Music (SCM_EOL);
                        }
                $$ = m;
        }
@@ -821,27 +877,48 @@ Composite_music:
 
 relative_music:
        RELATIVE absolute_musical_pitch Music {
-               $$ = new Relative_octave_music ($3, *unsmob_pitch ($2));
+               Music * p = $3;
+               Pitch pit = *unsmob_pitch ($2);
+               $$ = new Relative_octave_music (SCM_EOL);
+
+               $$->set_mus_property ("element", p->self_scm ());
+               scm_unprotect_object (p->self_scm ());
+
+               $$->set_mus_property ("last-pitch", p->to_relative_octave (pit).smobbed_copy ());
+
        }
        ;
 
 re_rhythmed_music:
        ADDLYRICS Music Music {
-               Lyric_combine_music * l = new Lyric_combine_music ($2, $3);
-               $$ = l;
+         Lyric_combine_music * l = new Lyric_combine_music (SCM_EOL);
+         l->set_mus_property ("music", $2->self_scm ());
+         l->set_mus_property ("lyrics", $3->self_scm ());
+         scm_unprotect_object ($3->self_scm ());
+         scm_unprotect_object ($2->self_scm ());
+         $$ = l;
        }
        ;
 
 part_combined_music:
        PARTCOMBINE STRING Music Music {
-               Part_combine_music * p = new Part_combine_music ($2, $3, $4);
+               Part_combine_music * p = new Part_combine_music (SCM_EOL);
+
+               p->set_mus_property ("what", $2);
+               p->set_mus_property ("one", $3->self_scm ());
+               p->set_mus_property ("two", $4->self_scm ());  
+
+               scm_unprotect_object ($3->self_scm());
+               scm_unprotect_object ($4->self_scm());  
+
+
                $$ = p;
        }
        ;
 
 translator_change:
        TRANSLATOR STRING '=' STRING  {
-               Music * t = new Music;
+               Music * t = new Music (SCM_EOL);
                t->set_mus_property ("iterator-ctor",
                        Change_iterator::constructor_cxx_function);
                t-> set_mus_property ("change-to-type", $2);
@@ -854,54 +931,66 @@ translator_change:
 
 property_def:
        PROPERTY STRING '.' STRING '='  scalar {
-               Music *t = new Music;
+               Music *t = new Music (SCM_EOL);
 
                t->set_mus_property ("iterator-ctor",
                        Property_iterator::constructor_cxx_function);
                t->set_mus_property ("symbol", scm_string_to_symbol ($4));
                t->set_mus_property ("value", $6);
 
-               Context_specced_music *csm = new Context_specced_music (t);
+               Context_specced_music *csm = new Context_specced_music (SCM_EOL);
+
+               csm->set_mus_property ("element", t->self_scm ());
+               scm_unprotect_object (t->self_scm ());
+
                $$ = csm;
                $$->set_spot (THIS->here_input ());
 
                csm-> set_mus_property ("context-type", $2);
        }
        | PROPERTY STRING '.' STRING SET embedded_scm '=' embedded_scm {
-               Music *t = new Music;
+               Music *t = new Music (SCM_EOL);
                t->set_mus_property ("iterator-ctor",
                        Push_property_iterator::constructor_cxx_function);
                t->set_mus_property ("symbols", scm_string_to_symbol ($4));
                t->set_mus_property ("pop-first", SCM_BOOL_T);
                t->set_mus_property ("grob-property", $6);
                t->set_mus_property ("grob-value", $8);
-               Context_specced_music *csm = new Context_specced_music (t);
+               Context_specced_music *csm = new Context_specced_music (SCM_EOL);
+               csm->set_mus_property ("element", t->self_scm ());
+               scm_unprotect_object (t->self_scm ());
                $$ = csm;
                $$->set_spot (THIS->here_input ());
 
                csm-> set_mus_property ("context-type", $2);
        }
        | PROPERTY STRING '.' STRING OVERRIDE embedded_scm '=' embedded_scm {
-               Music *t = new Music;
+               Music *t = new Music (SCM_EOL);
                t->set_mus_property ("iterator-ctor",
                        Push_property_iterator::constructor_cxx_function);
                t->set_mus_property ("symbols", scm_string_to_symbol ($4));
                t->set_mus_property ("grob-property", $6);
                t->set_mus_property ("grob-value", $8);
-               Context_specced_music *csm = new Context_specced_music (t);
+               Context_specced_music *csm = new Context_specced_music (SCM_EOL);
+               csm->set_mus_property ("element", t->self_scm ());
+               scm_unprotect_object (t->self_scm ());
+
                $$ = csm;
                $$->set_spot (THIS->here_input ());
 
                csm-> set_mus_property ("context-type", $2);
        }
        | PROPERTY STRING '.' STRING REVERT embedded_scm {
-               Music *t = new Music;
+               Music *t = new Music (SCM_EOL);
                t->set_mus_property ("iterator-ctor",
                        Pop_property_iterator::constructor_cxx_function);
                t->set_mus_property ("symbols", scm_string_to_symbol ($4));
                t->set_mus_property ("grob-property", $6);
 
-               Context_specced_music *csm = new Context_specced_music (t);
+               Context_specced_music *csm = new Context_specced_music (SCM_EOL);
+               csm->set_mus_property ("element", t->self_scm ());
+               scm_unprotect_object (t->self_scm ());
+
                $$ = csm;
                $$->set_spot (THIS->here_input ());
 
@@ -935,26 +1024,30 @@ request_chord:
 
 command_element:
        command_req {
-               $$ = new Request_chord (gh_cons ($1->self_scm (), SCM_EOL));
+               $$ = new Request_chord (SCM_EOL);
+               $$->set_mus_property ("elements", gh_cons ($1->self_scm (), SCM_EOL));
                $$-> set_spot (THIS->here_input ());
                $1-> set_spot (THIS->here_input ());
        }
        | BAR STRING ';'                        {
-               Music *t = new Music;
+               Music *t = new Music (SCM_EOL);
 
                t->set_mus_property ("iterator-ctor",
                        Property_iterator::constructor_cxx_function);
                t->set_mus_property ("symbol", ly_symbol2scm ("whichBar"));
                t->set_mus_property ("value", $2);
 
-               Context_specced_music *csm = new Context_specced_music (t);
+               Context_specced_music *csm = new Context_specced_music (SCM_EOL);
+               csm->set_mus_property ("element", t->self_scm ());
+               scm_unprotect_object (t->self_scm ());
+
                $$ = csm;
                $$->set_spot (THIS->here_input ());
 
                csm->set_mus_property ("context-type", ly_str02scm ("Score"));
        }
        | PARTIAL duration_length ';'   {
-               Music * p = new Music;
+               Music * p = new Music (SCM_EOL);
                p->set_mus_property ("symbol", ly_symbol2scm ( "measurePosition"));
                p->set_mus_property ("iterator-ctor",
                        Property_iterator::constructor_cxx_function);
@@ -962,7 +1055,10 @@ command_element:
                Moment m = - unsmob_duration($2)->length_mom ();
                p->set_mus_property ("value", m.smobbed_copy ());
 
-               Context_specced_music * sp = new Context_specced_music (p);
+               Context_specced_music * sp = new Context_specced_music (SCM_EOL);
+               sp->set_mus_property ("element", p->self_scm ());
+               scm_unprotect_object (p->self_scm ());
+
                $$ =sp ;
                sp-> set_mus_property ("context-type", ly_str02scm ( "Score"));
        }
@@ -972,19 +1068,23 @@ command_element:
 
                SCM l = SCM_EOL;
                for (SCM s = result ; gh_pair_p (s); s = gh_cdr (s)) {
-                       Music * p = new Music;
+                       Music * p = new Music (SCM_EOL);
                        set_music_properties(p, gh_car (s));
                        l = gh_cons (p->self_scm (), l);
                        scm_unprotect_object (p->self_scm ());
                }
-               Sequential_music * seq = new Sequential_music (l);
+               Sequential_music * seq = new Sequential_music (SCM_EOL);
+               seq->set_mus_property ("elements", l);
+
+               Context_specced_music * sp = new Context_specced_music (SCM_EOL);
+               sp->set_mus_property ("element", seq->self_scm ());
+               scm_unprotect_object (seq->self_scm ());
 
-               Context_specced_music * sp = new Context_specced_music (seq);
                $$ =sp ;
                sp-> set_mus_property("context-type", ly_str02scm("Staff"));
        }
        | TIME_T bare_unsigned '/' bare_unsigned ';' {
-               Music * p = new Music;
+               Music * p = new Music (SCM_EOL);
                p->set_mus_property ("symbol",
                        ly_symbol2scm ( "timeSignatureFraction"));
                p->set_mus_property ("iterator-ctor",
@@ -993,8 +1093,11 @@ command_element:
                p->set_mus_property ("value", gh_cons (gh_int2scm ($2),
                                                        gh_int2scm ($4)));
 
-               Context_specced_music * sp = new Context_specced_music (p);
-               $$ =sp ;
+               Context_specced_music * sp = new Context_specced_music (SCM_EOL);
+               sp->set_mus_property ("element", p->self_scm ());
+               scm_unprotect_object (p->self_scm ());
+
+               $$ = sp;
                sp-> set_mus_property ("context-type", ly_str02scm ( "Score"));
        }
        ;
@@ -1469,10 +1572,11 @@ simple_element:
                if ($2 % 2 || $3 % 2)
                        n->set_mus_property ("force-accidental", SCM_BOOL_T);
 
-               Simultaneous_music*v = new Request_chord (gh_list (n->self_scm (), SCM_UNDEFINED));
+               Simultaneous_music*v = new Request_chord (SCM_EOL);
+               v->set_mus_property ("elements", gh_list (n->self_scm (), SCM_UNDEFINED));
                
 /*
-FIXME
+FIXME: location is one off, since ptich & duration don't contain origin refs. 
 */
                v->set_spot (THIS->here_input ());
                n->set_spot (THIS->here_input ());
@@ -1497,7 +1601,8 @@ FIXME
                      rest_req_p->set_spot (THIS->here_input());
                        e = rest_req_p->self_scm ();
                    }
-                 Simultaneous_music* velt_p = new Request_chord (gh_list (e,SCM_UNDEFINED));
+                 Simultaneous_music* velt_p = new Request_chord (SCM_EOL);
+               velt_p-> set_mus_property ("elements", gh_list (e,SCM_UNDEFINED));
                  velt_p->set_spot (THIS->here_input());
 
 
@@ -1514,13 +1619,17 @@ FIXME
                sp1->set_mus_property ("span-type", r);
                sp2->set_mus_property ("span-type", r);
 
-               Request_chord * rqc1 = new Request_chord (gh_list (sp1->self_scm (), SCM_UNDEFINED));
-               Request_chord * rqc2 = new Request_chord (gh_list (sk->self_scm (), SCM_UNDEFINED));;
-               Request_chord * rqc3 = new Request_chord(gh_list (sp2->self_scm (), SCM_UNDEFINED));;
+               Request_chord * rqc1 = new Request_chord (SCM_EOL);
+               rqc1->set_mus_property ("elements", gh_list (sp1->self_scm (), SCM_UNDEFINED));
+               Request_chord * rqc2 = new Request_chord (SCM_EOL);
+               rqc2->set_mus_property ("elements", gh_list (sk->self_scm (), SCM_UNDEFINED));;
+               Request_chord * rqc3 = new Request_chord(SCM_EOL);
+               rqc2->set_mus_property ("elements", gh_list (sp2->self_scm (), SCM_UNDEFINED));;
 
                SCM ms = gh_list (rqc1->self_scm (), rqc2->self_scm (), rqc3->self_scm (), SCM_UNDEFINED);
 
-               $$ = new Sequential_music (ms);
+               $$ = new Sequential_music (SCM_EOL);
+               $$->set_mus_property ("elements", ms);
        }
        | STRING { 
                THIS->remember_spot ();
@@ -1538,7 +1647,8 @@ FIXME
                 lreq_p->set_mus_property ("text", $1);
                lreq_p->set_mus_property ("duration",$3);
                lreq_p->set_spot (THIS->here_input());
-               Simultaneous_music* velt_p = new Request_chord (gh_list (lreq_p->self_scm (), SCM_UNDEFINED));
+               Simultaneous_music* velt_p = new Request_chord (SCM_EOL);
+               velt_p->set_mus_property ("elements", gh_list (lreq_p->self_scm (), SCM_UNDEFINED));
 
 
                $$= velt_p;
index 79f63be70c5dc3e7c06cddc710a9524769da05ec..763aa79fa148b90ab29e586aafe4df11946d9f46 100644 (file)
@@ -348,7 +348,7 @@ output_dict= {
 # should also support fragment in
                  
                  'output-all': r"""
-@include %(fn)s-doc.texi
+@include %(fn)s.texidoc
 @tex
 \catcode`\@=12
 \input lilyponddefs
@@ -840,28 +840,6 @@ def system (cmd):
                error ('Error command exited with value %d\n' % st)
        return st
 
-
-texidoc_re = re.compile (r'.*?\n\s*texidoc\s*=\s*"((([^"])|([^\\]\\"))*)".*', re.DOTALL)
-def extract_texidoc (lyfile):
-       """
-       Extract the ``texidoc'' entry from the lyfile.ly, and write it to
-       lyfile-doc.texi.
-
-       Maybe this should be output by `lilypond --header=texidoc' or so?
-       """
-       outfile = os.path.basename (os.path.splitext (lyfile)[0]) + "-doc.texi"
-       sys.stderr.write ("Writing `%s'\n" % outfile)
-       f = open (lyfile)
-       s = f.read (-1)
-#      doc = re.sub (r'(.|\n)*?\n\s*texidoc\s*=\s*"((([^"])|([^\\]\\"))*)"(.|\n)*', '\\2', s) + '\n'
-       m = texidoc_re.match (s)
-       doc = ''
-       if m:
-               doc = m.group (1) + '\n'
-       f = open (outfile, 'w')
-       f.write (doc)
-       f.close ()
-
 def compile_all_files (chunks):
        eps = []
        tex = []
@@ -894,9 +872,7 @@ def compile_all_files (chunks):
                incs =  map (incl_opt, include_path)
                lilyopts = string.join (incs, ' ' )
                texfiles = string.join (tex, ' ')
-               system ('lilypond %s %s' % (lilyopts, texfiles))
-               for i in tex:
-                       extract_texidoc (i)
+               system ('lilypond --header=texidoc %s %s' % (lilyopts, texfiles))
        for e in eps:
                system(r"tex '\nonstopmode \input %s'" % e)
                system(r"dvips -E -o %s %s" % (e + '.eps', e))