]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.27
authorfred <fred>
Tue, 26 Mar 2002 22:45:53 +0000 (22:45 +0000)
committerfred <fred>
Tue, 26 Mar 2002 22:45:53 +0000 (22:45 +0000)
16 files changed:
input/test/generic-output-property.ly [new file with mode: 0644]
lily/dynamic-engraver.cc
lily/group-interface.cc
lily/include/group-interface.hh
lily/include/output-property.hh [new file with mode: 0644]
lily/include/request-iterator.hh
lily/include/score-element.hh
lily/include/translator.hh
lily/lily-guile.cc
lily/music-iterator.cc
lily/my-lily-lexer.cc
lily/output-property-engraver.cc [new file with mode: 0644]
lily/output-property-engraver.hh [new file with mode: 0644]
lily/output-property.cc [new file with mode: 0644]
lily/request-iterator.cc
mf/feta-accordion.mf

diff --git a/input/test/generic-output-property.ly b/input/test/generic-output-property.ly
new file mode 100644 (file)
index 0000000..3a7661e
--- /dev/null
@@ -0,0 +1,10 @@
+
+\score
+{
+\notes {
+  c''4
+  \outputproperty #(make-type-checker 'Note_head) #'staff-position = #20
+  c''4
+
+}
+}
index c6c35a908f7ad1c19abc4b0cc684605274616417..7f519db38b220b235587685b039b640771a16ee7 100644 (file)
@@ -18,6 +18,7 @@
 #include "engraver.hh"
 #include "stem.hh"
 #include "note-head.hh"
+#include "group-interface.hh"
 
 /**
    print text & hairpin dynamics.
@@ -36,6 +37,9 @@ public:
   Dynamic_engraver();
   
 protected:
+
+  void announce_element (Score_element_info);
+  
   virtual void do_removal_processing ();
   virtual void acknowledge_element (Score_element_info);
   virtual bool do_try_music (Music *req_l);
@@ -45,6 +49,13 @@ protected:
   virtual void typeset_element (Score_element*);
 };
 
+void
+Dynamic_engraver::announce_element (Score_element_info i)
+{
+  group (i.elem_l_, "interfaces").add_thing (ly_symbol2scm ("dynamic"));
+  
+  Engraver::announce_element (i);
+}
 
 
 Dynamic_engraver::Dynamic_engraver()
index d9ae970c193633e93f90d6f225a7dbf929c821d7..628a9fff582087f40b18fa3ca8fc7f7a81968e41 100644 (file)
@@ -35,11 +35,19 @@ Group_interface::add_element (Score_element*p)
 {
   p->used_b_ =  true;
   elt_l_->used_b_ = true;
-  
+
+  add_thing (p->self_scm_);
+}
+
+void
+Group_interface::add_thing (SCM s)
+{
   elt_l_->set_elt_property (name_,
-                           gh_cons (p->self_scm_, elt_l_->get_elt_property (name_)));
+                           gh_cons (s, elt_l_->get_elt_property (name_)));
+
 }
 
+
 int
 Group_interface::count ()
 {
index bf461a4052320e209157520c39092452acaa0b28..eb21db6ee6ec4baced96048e55781ca1993b54d1 100644 (file)
 #include "lily-guile.hh"
 #include "smobs.hh"
 
+/*
+  rename to list interface?
+ */
+
+/**
+   Look at Score element ELT as thing which has a list property called
+   NAME_. Normally the list would contain Score_elements, but
+   sometimes it can be different things.
+*/
 struct Group_interface
 {
   Score_element * elt_l_;
@@ -23,6 +32,7 @@ public:
   Group_interface (Score_element const*);
   Group_interface (Score_element const*, String);
   int count ();
+  void add_thing (SCM);
   bool has_interface_b ();
   void set_interface ();
   void add_element (Score_element*);
@@ -31,10 +41,9 @@ public:
 Group_interface group (Score_element*);
 Group_interface group (Score_element*, String);
 
-/*
-  template<class T>
-  Link_array<T> Group_interface__extract_elements (T *, String name);
-*/
+/** 
+  Put all score elements of ELT's property called NAME into an array,
+  and return it.  */
 template<class T>
 Link_array<T>
 Group_interface__extract_elements (Score_element const *elt, T *, String name)
diff --git a/lily/include/output-property.hh b/lily/include/output-property.hh
new file mode 100644 (file)
index 0000000..f266642
--- /dev/null
@@ -0,0 +1,27 @@
+/*   
+  output-property.hh -- declare Output_property
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#ifndef OUTPUT_PROPERTY_HH
+#define OUTPUT_PROPERTY_HH
+
+#include "music.hh"
+#include "protected-scm.hh"
+
+class Output_property : public Music
+{
+public:
+  Output_property(SCM, SCM, SCM);
+
+  /**
+    relevant stuff: the predicate, the symbol, the value
+   */
+  Protected_scm pred_sym_val_list_;
+};
+
+#endif /* OUTPUT_PROPERTY_HH */
index 53a7a760704ec0cdac6226f9e0a9b115d476afbb..ea2b07b026b221caf0579b1a00ac986fb6ca094d 100644 (file)
 
 #include "music-iterator.hh"
 
-class Request_iterator : public Music_iterator
+class Simple_music_iterator : public Music_iterator
 {
 public:
-  Request_iterator ();
 protected:
   virtual void do_process_and_next (Moment );
 };
index f37990f7ee71c83a71a351f75612bc78ecf0357b..2a962607fd387180003333718397ab366b8ea0cf 100644 (file)
@@ -154,6 +154,9 @@ protected:
 
   static Interval dim_cache_callback (Dimension_cache const*);
 public:
+  static SCM ly_set_elt_property (SCM, SCM,SCM);
+  static SCM ly_get_elt_property (SCM, SCM);  
+  
   virtual void handle_broken_dependencies ();
   virtual void handle_prebroken_dependencies ();
 
index 6c4e314941a12756b6e4f9ebfb013e6c8f97f731..df5f2532541488171fba727d56be88e214155320 100644 (file)
@@ -67,6 +67,9 @@ public:
   virtual Moment now_mom () const;  
 
 protected:
+  /*
+    UGH. Clean this up.
+   */
    enum { 
     ORPHAN,
     VIRGIN,
index e317ea543815e3a466ef1f2440f75eb0235fa652..036bd19039bfe4614ba41f1a2f6291c56d9802f8 100644 (file)
@@ -220,7 +220,7 @@ ly_isdir_p (SCM s)
 }
 
 
-void
+static void
 init_functions ()
 {
   scm_make_gsubr ("ly-warn", 1, 0, 0, (SCM(*)(...))ly_warning);
@@ -310,9 +310,7 @@ to_boolean (SCM s)
 /*
   Appendable list L: the cdr contains the list, the car the last cons
   in the list.
-  
  */
-
 SCM
 appendable_list ()
 {
index 590271201cc062f1ff092a890ddb22b0cff88556..edbb722e24993471aa7357f20b9df7ad7ee49e91 100644 (file)
@@ -5,6 +5,10 @@
 
   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
+
+/*
+  UGH. too many includes.
+ */
 #include "debug.hh"
 #include "music-list.hh"
 #include "music-iterator.hh"
@@ -32,6 +36,7 @@
 #include "auto-change-iterator.hh"
 #include "request.hh"
 #include "request-iterator.hh"
+#include "output-property.hh"
 
 void
 Music_iterator::do_print() const
@@ -149,12 +154,10 @@ Music_iterator::static_get_iterator_p (Music const *m)
       else
        p = new Unfolded_repeat_iterator;
     }
-  else if (Request const * r = dynamic_cast<Request const* > (m))
+  else
     {
-      p = new Request_iterator ;
+      p = new Simple_music_iterator ;
     }
-  else
-    assert (0);
 
   p->music_l_ = m;
   return p;
index f413a5dc9a1a4ff815d0f4f863e2621ca2cf2786..0e74531f07ecc547d3c5ae04c21bef6980882073 100644 (file)
@@ -57,6 +57,7 @@ static Keyword_ent the_key_tab[]={
   {"name", NAME},
   {"notenames", NOTENAMES},
   {"notes", NOTES},
+  {"outputproperty", OUTPUTPROPERTY},
   {"partial", PARTIAL},
   {"paper", PAPER},
   {"penalty", PENALTY},
diff --git a/lily/output-property-engraver.cc b/lily/output-property-engraver.cc
new file mode 100644 (file)
index 0000000..6f0b6cf
--- /dev/null
@@ -0,0 +1,66 @@
+/*   
+  output-property-engraver.cc --  implement Output_property_engraver
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#include "output-property.hh"
+#include "engraver.hh"
+#include "score-element.hh"
+
+class Output_property_engraver : public Engraver
+{
+public:
+  VIRTUAL_COPY_CONS(Translator);
+protected:
+  
+  Link_array<Output_property> props_;
+
+  virtual void do_pre_move_processing ();
+  virtual void acknowledge_element (Score_element_info);
+  virtual bool do_try_music (Music*);
+};
+
+
+bool
+Output_property_engraver::do_try_music (Music* m)
+{
+  if (Output_property * o = dynamic_cast<Output_property*> (m))
+    {
+      props_.push (o);
+      return true;
+    }
+  return false;
+}
+
+void
+Output_property_engraver::acknowledge_element (Score_element_info inf)
+{
+  for (int i=props_.size (); i--; )
+    {
+      Output_property * o = props_[i];
+      SCM pred = gh_car (o->pred_sym_val_list_);
+      /*
+       should typecheck pred. 
+       */
+      SCM result=gh_apply (pred,
+                          gh_list (inf.elem_l_->self_scm_, SCM_UNDEFINED));
+      if (to_boolean (result))
+       {
+         Score_element::ly_set_elt_property (inf.elem_l_->self_scm_,
+                                             gh_cadr (o->pred_sym_val_list_),
+                                             gh_caddr (o->pred_sym_val_list_));
+       }
+    }
+}
+
+void
+Output_property_engraver::do_pre_move_processing ()
+{
+  props_.clear ();
+}
+
+ADD_THIS_TRANSLATOR(Output_property_engraver);
diff --git a/lily/output-property-engraver.hh b/lily/output-property-engraver.hh
new file mode 100644 (file)
index 0000000..ef30fdf
--- /dev/null
@@ -0,0 +1,61 @@
+/*   
+  output-property-engraver.cc --  implement Output_property_engraver
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#include "output-property.hh"
+#include "engraver.hh"
+
+class Output_property_engraver : public Engraver
+{
+public:
+  Output_property_engraver();
+  VIRTUAL_COPY_CONS(Translator);
+protected:
+  
+  Link_array<Output_property> props_;
+
+  virtual void do_acknowledge_element (Score_element_info);
+  virtual bool do_try_music (Music*);
+};
+
+
+Output_property_engraver::do_try_music (Music* m)
+{
+  if (Output_property * o = dynamic_cast<Output_property*> (m))
+    {
+      props_.push (m);
+      return true;
+    }
+  return false;
+}
+
+void
+Output_property_engraver::do_acknowledge_element (Score_element_info i)
+{
+  for (int i=props_.size (); i--; )
+    {
+      Output_property * o = props_[i];
+      SCM pred = gh_car (o->pred_sym_val_list_);
+      /*
+       should typecheck pred. 
+       */
+      SCM result=gh_apply (pred,
+                          gh_listify (i.elem_l_->self_scm_, SCM_UNDEFINED));
+      if (to_boolean (result))
+       {
+         i.elem_l_->set_elt_property (gh_cadr (o->pred_sym_val_list_),
+                                      gh_caddr (o->pred_sym_val_list_));
+       }
+    }
+}
+
+void
+Output_property_engraver::do_pre_move_processing ()
+{
+  props_.clear ();
+}
diff --git a/lily/output-property.cc b/lily/output-property.cc
new file mode 100644 (file)
index 0000000..e8a2d6a
--- /dev/null
@@ -0,0 +1,16 @@
+/*   
+  output-property.cc --  implement Output_property
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+#include "output-property.hh"
+#include "lily-guile.hh"
+
+Output_property::Output_property(SCM pred, SCM sym, SCM val)
+{
+  pred_sym_val_list_ = gh_list (pred, sym, val, SCM_UNDEFINED);
+}
+
index 94d5e90dcc1e7b8c146e2b3139cdae6bc57b93d5..6cefe8b5b5cf166e9c76199b34efa1640ef7fb86 100644 (file)
@@ -1,5 +1,5 @@
 /*   
-  request-iterator.cc --  implement 
+  request-iterator.cc --  implement Simple_music_iterator
   
   source file of the GNU LilyPond music typesetter
   
@@ -9,19 +9,15 @@
 #include "request-iterator.hh"
 #include "music.hh"
 
-Request_iterator::Request_iterator()
-{
-}
-
 
 void
-Request_iterator::do_process_and_next (Moment m)
+Simple_music_iterator::do_process_and_next (Moment m)
 {
   if (first_b_)
     {
       bool g= try_music (music_l_);
       if (!g)
-       music_l_->warning (_f ("Junking request: `%s'", classname(music_l_)));
+       music_l_->warning (_f ("Junking music: `%s'", classname(music_l_)));
 
       first_b_ = false;
     }
index 2ac7cdecbedf50199a838555fade12b804704f8a..7694cc3a18e3679441f275bb09692c01ab5df92b 100644 (file)
@@ -62,6 +62,7 @@ fet_beginchar("accStdbase", "accStdbase", "accStdbase")
        currentpicture := currentpicture shifted (0, r);
 fet_endchar;
 
+%%% strange turning path.
 fet_beginchar("accBayanbase", "accBayanbase", "accBayanbase")
        save lh;
        lh = accreg_lh;
@@ -143,6 +144,7 @@ def def_some_vars =
        cTwo = 0.60;
 enddef;
 
+%%% strange turning path.
 fet_beginchar("accSB", "accSB", "accSB")
        set_char_box(.4staffsize#, .4staffsize#, 0, 2.4staff_space#);
        def_some_vars;
@@ -172,6 +174,7 @@ fet_beginchar("accSB", "accSB", "accSB")
        currentpicture := currentpicture shifted (0, 2.4staff_space);
 fet_endchar;
 
+%%% strange turning path.
 fet_beginchar("accBB", "accBB", "accBB")
        set_char_box(.4staffsize#, .4staffsize#, 0, 2.4staff_space#);
        def_some_vars;
@@ -196,6 +199,7 @@ fet_beginchar("accBB", "accBB", "accBB")
 fet_endchar;
 
 
+%%% strange turning path.
 fet_beginchar("accOldEE", "accOldEE", "accOldEE")
        set_char_box(staff_space#, staff_space#, 0, 2staff_space#);
        show w;