]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.38
authorfred <fred>
Tue, 26 Mar 2002 23:09:59 +0000 (23:09 +0000)
committerfred <fred>
Tue, 26 Mar 2002 23:09:59 +0000 (23:09 +0000)
31 files changed:
Documentation/user/properties.itely
lily/all-font-metrics.cc
lily/bar.cc
lily/base-span-bar-engraver.cc
lily/beam.cc
lily/bezier.cc
lily/breathing-sign.cc
lily/chord-name-engraver.cc
lily/chord-name.cc
lily/clef-engraver.cc
lily/dynamic-performer.cc
lily/include/bezier.hh
lily/include/chord.hh
lily/include/lily-guile.hh
lily/include/musical-pitch.hh
lily/include/notename-table.hh
lily/key-engraver.cc
lily/lily-guile.cc
lily/lookup.cc
lily/molecule.cc
lily/musical-pitch.cc
lily/notename-table.cc
lily/paper-outputter.cc
lily/property-engraver.cc
lily/script-engraver.cc
lily/slur.cc
lily/staff-margin-engraver.cc
ly/property.ly
scm/generic-property.scm
scm/lily.scm
scm/paper.scm

index 3b92694c797f35a7564fa60e34090fa6319d6092..ecfcfd0c50fedcf61cb249f29c09399a3eff9b44 100644 (file)
@@ -294,6 +294,9 @@ g''4 \property Voice.stemLength = #14  g4 \property Voice.stemLength = #3 g4  g,
     note.  Overrides automatic beaming.  The value is only used once,
     and then it is erased.
 
+  @item @code{tieDash}@indexcode{tieDash} @propertytype{integer}
+    Set dashing of ties. See also @code{slurDash}
+
   @item @code{tieVerticalDirection}@indexcode{tieVerticalDirection} @propertytype{direction}
     Set to @code{\free} for free choice of tie direction, set to
     @code{\up} to force ties up, set to @code{\down} to force ties
index 5a3975fa9a709e5138509e6013f43363dfe69995..20b5483348bb9049adef56175e6727f12b49077c 100644 (file)
@@ -105,7 +105,10 @@ All_font_metrics::find_font (String name)
   warning (_ ("Loading default font"));
   
   String def_name = default_font_sz_;
-  SCM l = ly_eval_str ("(style-to-cmr \"default\")");
+  SCM l = scm_eval (gh_list (ly_symbol2scm ("style-to-cmr"),
+                           ly_str02scm ("default"),
+                           SCM_UNDEFINED));
+  
   if (l != SCM_BOOL_F)
     def_name = ly_scm2string (gh_cdr (l));
 
index 04ea330fb1c080cc8c1b611c8eccf016b6a44084..70432970eee65e98d05cd6652731a6e96c84360f 100644 (file)
@@ -157,7 +157,10 @@ Bar::staff_brace (Real y)  const
   int idx = int (((maxht - step) <? y - minht) / step);
   idx = idx >? 0;
 
-  SCM l = ly_eval_str ("(style-to-cmr \"brace\")");
+  SCM l = scm_eval (gh_list (ly_symbol2scm ("style-to-cmr"),
+                           ly_str02scm ("brace"),
+                           SCM_UNDEFINED));
+  
   String nm = "feta-braces";
   if (l != SCM_BOOL_F)
     nm = ly_scm2string (gh_cdr (l));
index 78df27dc2edf8b930a2873f5cac31cb6fec1aea3..3993776b427409e0366bdc425672bc4873f922ed 100644 (file)
@@ -53,12 +53,11 @@ Base_span_bar_engraver::acknowledge_element (Score_element_info i)
 
          /*
            UGH. UGH UUHGK GUHG G
-           (ly_eval_str ??)
           */
          String visnam =  String(name()) + "-visibility";
-         
+
          spanbar_p_->set_elt_property ("visibility-lambda",
-                                       ly_eval_str (visnam.ch_C()));
+                                       scm_eval (ly_symbol2scm (visnam.ch_C())));
 
          if (use_priority_b_)
            {
index 23a62f4a5c4bc9f4a065c371b0554a28bbc0bd26..dfc960c3a491b46028d2ec58cc135a733d099704 100644 (file)
@@ -31,7 +31,7 @@
 #include "group-interface.hh"
 #include "staff-symbol-referencer.hh"
 #include "cross-staff.hh"
-#include "lily-guile.icc"
+
 
 Beam::Beam ()
 {
@@ -232,17 +232,19 @@ Beam::set_stem_shorten ()
     return;
 
   int multiplicity = get_multiplicity ();
+
   // grace stems?
-  SCM shorten = ly_eval_str ("beamed-stem-shorten");
+  SCM shorten = scm_eval (ly_symbol2scm ("beamed-stem-shorten"));
 
-  Array<Real> a;
-  scm_to_array (shorten, &a);
-  if (!a.size ())
+  if (shorten == SCM_EOL)
     return;
 
+  int sz = scm_ilength (shorten);
+  
   Staff_symbol_referencer_interface st (this);
   Real staff_space = st.staff_space ();
-  Real shorten_f = a[multiplicity <? (a.size () - 1)] * staff_space;
+  SCM shorten_elt = scm_list_ref (shorten, gh_int2scm (multiplicity <? (sz - 1)));
+  Real shorten_f = gh_scm2double (shorten_elt) * staff_space;
 
   /* cute, but who invented this -- how to customise ? */
   if (forced_fraction < 1)
@@ -511,10 +513,10 @@ Beam::set_stem_length (Real y, Real dy)
 Real
 Beam::quantise_dy_f (Real dy) const
 {
-  SCM quants = ly_eval_str ("beam-height-quants");
-
   Array<Real> a;
-  scm_to_array (quants, &a);
+  for (SCM s = scm_eval (ly_symbol2scm ("beam-height-quants")); s !=SCM_EOL; s = gh_cdr (s))
+    a.push (gh_scm2double (gh_car (s)));
+  
   if (a.size () <= 1)
     return dy;
 
@@ -543,13 +545,16 @@ Beam::quantise_y_f (Real y, Real dy, int quant_dir)
   int multiplicity = get_multiplicity ();
   Staff_symbol_referencer_interface st (this);
   Real staff_space = st.staff_space ();
-  SCM quants = scm_eval (gh_list (
-                                 ly_symbol2scm ("beam-vertical-position-quants"),
+  SCM quants = scm_eval (gh_list (ly_symbol2scm ("beam-vertical-position-quants"),
                                  gh_int2scm (multiplicity),
                                  gh_double2scm (dy/staff_space),
                                  SCM_UNDEFINED));
+
   Array<Real> a;
-  scm_to_array (quants, &a);
+
+  for (; quants != SCM_EOL; quants = gh_cdr (quants))
+    a.push (gh_scm2double (gh_car (quants)));
+
   if (a.size () <= 1)
     return y;
 
index 6b388e1d8ff47f7c0589b610e296df1f8864a390..4cb2b3682ed3e9b7015718bbf524322d402955f2 100644 (file)
@@ -56,11 +56,6 @@ translate (Array<Offset>* arr_p, Offset o)
   sum_{j=0}^3  (3 over j) z_j (1-t)^(3-j)  t^j
  */
 
-Bezier::Bezier ()
-  : control_ (CONTROL_COUNT)
-{
-}
-
 Real
 Bezier::get_other_coordinate (Axis a,  Real x) const
 {
@@ -177,19 +172,23 @@ Bezier::extent (Axis a)const
 void
 Bezier::flip (Axis a)
 {
-  ::flip (&control_, a);
+  for (int i = CONTROL_COUNT; i--;)
+    control_[i][a] = - control_[i][a];
 }
 
 void
 Bezier::rotate (Real phi)
 {
-  ::rotate (&control_, phi);
+  Offset rot (complex_exp (Offset (0, phi)));
+  for (int i = 0; i < CONTROL_COUNT; i++)
+    control_[i] = complex_multiply (rot, control_[i]);
 }
 
 void
 Bezier::translate (Offset o)
 {
-  ::translate (&control_, o);
+  for (int i = 0; i < CONTROL_COUNT; i++)
+    control_[i] += o;
 }
 
 void
index 0b9758edc38ae7eb035202e489bcae642368927c..2c1f5152491c973f261c2823915eebed4e5502df 100644 (file)
@@ -5,7 +5,7 @@
 
   written for the GNU LilyPond music typesetter
 
-TODO: --> see breathing-sign-engraver.cc
+  TODO: --> see breathing-sign-engraver.cc
 
 */
 #include "staff-symbol-referencer.hh"
index eb28971785a01cf8fa2e3a56126ced2cbe61676c..32419e420c42693e55b80804f263cb42d6369222 100644 (file)
@@ -15,7 +15,7 @@
 #include "main.hh"
 #include "dimensions.hh"
 #include "text-item.hh"
-#include "lily-guile.icc"
+
 
 ADD_THIS_TRANSLATOR (Chord_name_engraver);
 
@@ -81,12 +81,16 @@ Chord_name_engraver::do_process_music ()
     Hmm, why not represent complete chord as list?
     ((tonic third fifth) (inversion bass))
   */
-  chord_name_p_->set_elt_property ("pitches", array_to_scm (chord.pitch_arr_));
+  SCM plist = SCM_EOL;
+  for (int i= chord.pitch_arr_.size (); i--; )
+    plist = gh_cons (chord.pitch_arr_[i].to_scm (), plist);
+  
+  chord_name_p_->set_elt_property ("pitches", plist);
   if (chord.inversion_b_)
     chord_name_p_->set_elt_property ("inversion",
-                                    to_scm (chord.inversion_pitch_));
+                                    chord.inversion_pitch_.to_scm ());
   if (chord.bass_b_)
-    chord_name_p_->set_elt_property ("bass", to_scm (chord.bass_pitch_));
+    chord_name_p_->set_elt_property ("bass", chord.bass_pitch_.to_scm ());
 
   announce_element (Score_element_info (chord_name_p_, 0));
 }
index 396909c4614ffe1fe6f4214f625a4330ad41f8ee..7b94bb1771c87693b3f4909f283afaa94afb16c0 100644 (file)
@@ -13,7 +13,7 @@
 #include "molecule.hh"
 #include "paper-def.hh"
 #include "lookup.hh"
-#include "lily-guile.icc"
+
 
 /*
   TODO: move text lookup out of Chord_name
@@ -63,7 +63,7 @@ Molecule
 Chord_name::pitch2molecule (Musical_pitch p) const
 {
   SCM name = scm_eval (gh_list (ly_symbol2scm ("user-pitch-name"),
-                               ly_quote_scm (to_scm (p)),
+                               ly_quote_scm (p.to_scm ()),
                                SCM_UNDEFINED));
 
   if (name != SCM_UNSPECIFIED)
@@ -116,13 +116,10 @@ Chord_name::user_chord_name (Array<Musical_pitch> pitch_arr, Chord_mol* name_p)
   Array<Musical_pitch> chord_type = pitch_arr;
   Chord::rebuild_transpose (&chord_type, diff_pitch (pitch_arr[0], Musical_pitch (0)), false);
 
-#if 0
   SCM chord = SCM_EOL;
   for (int i= chord_type.size (); i--; )
-    chord = gh_cons (to_scm (chord_type[i]), chord);
-#else
-  SCM chord = array_to_scm (chord_type);
-#endif
+    chord = gh_cons (chord_type[i].to_scm (), chord);
+
 
   SCM name = scm_eval (gh_list (ly_symbol2scm ("user-chord-name"),
                                ly_quote_scm (chord),
@@ -225,7 +222,10 @@ Molecule
 Chord_name::do_brew_molecule () const
 {
   Array<Musical_pitch> pitch_arr;
-  scm_to_array (get_elt_property ("pitches"), &pitch_arr);
+  
+  for (SCM s = get_elt_property ("pitches"); s != SCM_EOL; s = gh_cdr (s))
+    pitch_arr.push (Musical_pitch (gh_car (s)));
+  
   Musical_pitch tonic = pitch_arr[0];
   
   Chord_mol name;
@@ -265,8 +265,8 @@ Chord_name::do_brew_molecule () const
   if (s != SCM_UNDEFINED)
     {
       name.inversion_mol = lookup_l ()->text ("", "/", paper_l ());
-      Musical_pitch p;
-      p = scm_to (s, &p);
+      Musical_pitch p (s);
+
       Molecule mol = pitch2molecule (p);
       name.inversion_mol.add_at_edge (X_AXIS, RIGHT, mol, 0);
     }
@@ -275,8 +275,7 @@ Chord_name::do_brew_molecule () const
   if (s != SCM_UNDEFINED)
     {
       name.bass_mol = lookup_l ()->text ("", "/", paper_l ());
-      Musical_pitch p;
-      p = scm_to (s, &p);
+      Musical_pitch p (s);
       Molecule mol = pitch2molecule (p);
       name.bass_mol.add_at_edge (X_AXIS, RIGHT, mol, 0);
     }
index cffdd3f34059e624483b5fa71dc419e22d8c591c..041e3410f5c1ad04014148fe3d2cc992d496648e 100644 (file)
@@ -199,7 +199,7 @@ Clef_engraver::do_pre_move_processing()
     {
       if(to_boolean (clef_p_->remove_elt_property("non-default")))
         clef_p_->set_elt_property("visibility-lambda",
-                                  ly_eval_str ("all-visible"));
+                                  scm_eval (ly_symbol2scm ("all-visible")));
       
       typeset_element (clef_p_);
       clef_p_ =0;
index 7fbca0dd698718d599a2dca4e009e224a2ed94bf..f51ae2beb67cd805e5c1b74ea83c9f6813ab9db7 100644 (file)
@@ -71,10 +71,49 @@ Dynamic_performer::do_process_music ()
         (ly_symbol2scm ("dynamic-absolute-volume"),
          ly_quote_scm (ly_str02scm (text_script_req_l_->text_str_.ch_C ())),
          SCM_UNDEFINED));
-      int volume = gh_scm2int (ly_eval_str ("dynamic-default-volume"));
+      Real volume = gh_scm2double (scm_eval (ly_symbol2scm ("dynamic-default-volume")));
       if (gh_number_p (s))
-       volume = gh_scm2int (s);
-
+       volume = gh_scm2double (s);
+      
+      /*
+       properties override default equaliser setting
+       */
+      SCM min = get_property ("midiMinimumVolume");
+      SCM max = get_property ("midiMaximumVolume");
+      if (gh_number_p (min) || gh_number_p (max))
+       {
+         Interval iv (0, 1);
+         if (gh_number_p (min))
+           iv[MIN] = gh_scm2double (min);
+         if (gh_number_p (max))
+           iv[MAX] = gh_scm2double (max);
+         volume = iv[MIN] + iv.length () * volume;
+       }
+      else
+       {
+         /*
+           urg, code duplication:: staff_performer
+         */
+         s = get_property ("midiInstrument");
+         
+         if (!gh_string_p(s))
+           s = get_property ("instrument");
+         
+         if (!gh_string_p(s))
+           s = ly_str02scm ("piano");
+         
+         
+         s = scm_eval (gh_list (ly_symbol2scm ("instrument-equaliser"),
+                                s, SCM_UNDEFINED));
+         if (gh_pair_p (s))
+           {
+             Interval iv;
+             iv[MIN] = gh_scm2double (gh_car (s));
+             iv[MAX] = gh_scm2double (gh_cdr (s));
+             volume = iv[MIN] + iv.length () * volume;
+           }
+       }
+      
       audio_p_ = new Audio_dynamic (volume);
       Audio_element_info info (audio_p_, text_script_req_l_);
       announce_element (info);
index 3ac97b71706ea7baa09ac9f819f47ba254841465..1f9bd2d2523c1bde1304a8eebe302e1e360f7a85 100644 (file)
@@ -22,8 +22,6 @@
 class Bezier
 {
 public:
-  Bezier ();
-
   void assert_sanity () const;
   void flip (Axis);
   void reverse ();
@@ -38,7 +36,14 @@ public:
   Offset curve_point (Real t) const;
 
   static const int CONTROL_COUNT = 4;
-  Array<Offset> control_;
+
+  /*
+    Bezier curves always have 4 control points. Making this into an
+    Array<> gives unnecessary overhead, and makes debugging a royal
+    pain.  */
+
+  
+  Offset control_[4];
 };
 
 void flip (Array<Offset>* arr_p, Axis a);
index 3075bab0acab28d12b05dc59726361e8a0a75e2d..2d13e75deb2ac319d490ffa34a5dce4edc1cf13e 100644 (file)
 #include "array.hh"
 #include "musical-pitch.hh"
 #include "lily-proto.hh"
+
+
+
+/*
+  Slightly on the hairy side? In any case COMMENTME.
+ */
 class Chord
 {
 public:
index 8a8f4c2d020201bba21821be20c443b2c5b7a479..cb0fb404910faf8d5a7dfbd412c7c601eb00fca3 100644 (file)
 #include <libguile.h>
 #include "direction.hh"
 
+/*
+  conversion functions follow the GUILE naming convention, i.e.
+
+    A ly_B2A (B b);
+ */
 SCM ly_str02scm (char const*c);
-SCM ly_eval_str (String s);
 SCM ly_symbol2scm (char const *);
+String ly_scm2string (SCM s);
 String ly_symbol2string (SCM);
-SCM ly_type (SCM);
+SCM ly_offset2scm (Offset);
+Offset ly_scm2offset (SCM);
 
-SCM ly_eval (SCM a);
 SCM ly_parse_scm (char const* s, int* n);
 SCM ly_quote_scm (SCM s);
+SCM ly_type (SCM);
+
+/*
+  display and print newline.
+ */
 void ly_display_scm (SCM s);
-String ly_scm2string (SCM s);
 
 #include "array.hh"
 
@@ -33,8 +42,13 @@ void read_lily_scm_file (String);
 void init_lily_guile ();
 
 bool isdir_b (SCM s);
-Direction to_dir (SCM s);
 
+/*
+  these conversion functions also do a typecheck on the argument, and
+  return a default value if S has the wrong type.
+*/
+
+Direction to_dir (SCM s);
 bool to_boolean (SCM s);
 
 void init_ly_protection ();
@@ -43,18 +57,6 @@ unsigned int ly_scm_hash (SCM s);
 SCM index_cell (SCM cellp, Direction d);
 SCM index_set_cell (SCM cellp, Direction d, SCM val);
 
-template<class T>SCM array_to_scm (Array<T> arr);
-template<class T>void scm_to_array (SCM s, Array<T>* arr);
-
-//URG how templates suck!
-SCM to_scm (int i);
-int scm_to (SCM s, int* i);
-
-SCM to_scm (Real r);
-Real scm_to (SCM s, Real* r);
-
-SCM to_scm (Offset o);
-Offset scm_to (SCM s, Offset* o);
 
 /*
   snarfing.
index 7bc94b499f17562670dd47232c3d7c0f1f04cec1..1c691712da09a8d09b8712844798e83d6394470c 100644 (file)
@@ -23,6 +23,7 @@
 struct Musical_pitch : public Input
 {
   Musical_pitch (int notename=0, int accidental=0, int octave=0);
+  Musical_pitch (SCM);
 
   /// 0 is c, 6 is b
   int notename_i_;
@@ -42,11 +43,9 @@ struct Musical_pitch : public Input
   void down_to (int);
   String str () const;
   void print () const;
+  SCM to_scm () const;
 };
 
-SCM to_scm (Musical_pitch p);
-Musical_pitch scm_to (SCM s, Musical_pitch* p);
-
 #include "compare.hh"
 INSTANTIATE_COMPARE(Musical_pitch, Musical_pitch::compare);
 
index 2d84a7ead0fa1ccf0e1c7b8bf233e2baa35dd81a..f6eab20400a195061358e7ee4c9904597ff8fd5c 100644 (file)
@@ -21,7 +21,6 @@ public:
   Notename_table (Notename_table const&);
   Musical_pitch get_pitch(String s) const;
   void add_note_name (String, Musical_pitch const *p);
-  String get_name (Musical_pitch) const;
   bool elem_b (String )const;
 };
   
index 88ca9e102cf3b2b12ba04caf7221bf913616c0a3..e81e72c2279be0843bad427eeb4353a13f5b215c 100644 (file)
@@ -99,7 +99,7 @@ Key_engraver::acknowledge_element (Score_element_info info)
       if (!def)
        {
          item_p_->set_elt_property ("visibility-lambda",
-                                   ly_eval_str ("all-visible"));
+                                   scm_eval (ly_symbol2scm  ("all-visible")));
        }
     }
 
index d8866c3a8e3c66b064b4f00ebb7c197c92434a83..38a409cb8787935b002c549c4b231ca876c5d7d0 100644 (file)
@@ -29,12 +29,14 @@ ly_str02scm (char const*c)
   return gh_str02scm ((char*)c);
 }
 
+
+#if 0
+/*
+  this all really sucks, LilyPond should not communicate with GUILE using strings.
+ */
 SCM
-ly_eval_str (String s)
-{
-  // this all really sucks, guile should take char const* arguments!
-  return gh_eval_str ((char*)s.ch_C ());
-}
+ly_eval_str (String s);
+#endif
 
   
 /*
@@ -134,7 +136,7 @@ read_lily_scm_file (String fn)
 
   Simple_file_storage f(s);
   
-  ly_eval_str ((char *) f.ch_C());
+  gh_eval_str ((char *) f.ch_C());
   progress_indication ("]");
 }
 
@@ -262,32 +264,7 @@ to_dir (SCM s)
 }
 
 
-SCM
-to_scm (int i)
-{
-  return gh_int2scm (i);
-}
-
-/*
-  UGR. junkme.
- */
-int
-scm_to (SCM s, int* )
-{
-  return gh_number_p (s) ? gh_scm2int (s) : 0;
-}
-
-SCM
-to_scm (Real r)
-{
-  return gh_double2scm (r);
-}
 
-Real
-scm_to (SCM s, Real* )
-{
-  return gh_number_p (s) ? gh_scm2double (s) : 0;
-}
 
 bool
 to_boolean (SCM s)
@@ -319,13 +296,13 @@ appendable_list_append (SCM l, SCM elt)
 
 
 SCM
-to_scm (Offset o)
+ly_offset2scm (Offset o)
 {
   return gh_cons (gh_double2scm (o[X_AXIS]), gh_double2scm(o[Y_AXIS]));
 }
 
 Offset
-scm_to (SCM s, Offset*)
+ly_scm2offset (SCM s)
 {
   return Offset (gh_scm2double (gh_car (s)),
                 gh_scm2double (gh_cdr (s)));
index 818ce69e3f5f508b71b8982280b95a790fc9f6fa..8be036fa7805a66e99fe1f24b4a1fea3f09c343f 100644 (file)
@@ -105,10 +105,10 @@ Molecule
 Lookup::dashed_slur (Bezier b, Real thick, Real dash)
 {
   SCM l = SCM_EOL;
-  // this is silly, we have array_to_scm
+
   for (int i= 4; i -- ;)
     {
-      l = gh_cons (to_scm (b.control_[i]), l);
+      l = gh_cons (ly_offset2scm (b.control_[i]), l);
     }
 
   SCM at = (gh_list (ly_symbol2scm ("dashed-slur"),
@@ -246,7 +246,10 @@ Lookup::text (String style, String text, Paper_def *paper_l)
   /*
     UGH.
   */
-  SCM l = ly_eval_str (("(style-to-cmr \"" + style + "\")").ch_C());
+  SCM l = scm_eval (gh_list (ly_symbol2scm ("style-to-cmr"),
+                            ly_str02scm (style.ch_C()),
+                            SCM_UNDEFINED));
+  
   if (l != SCM_BOOL_F)
     {
       style = ly_scm2string (gh_cdr(l)) +to_str  ((int)font_h);
@@ -327,11 +330,11 @@ Lookup::slur (Bezier curve, Real curvethick, Real linethick)
   back.control_[2] += curvethick * complex_exp (Offset (0, alpha + M_PI/2));  
 
   SCM scontrols[8];
-  // this is silly, we have array_to_scm
+
   for (int i=4; i--;)
-    scontrols[ i ] = to_scm (back.control_[i]);
+    scontrols[ i ] = ly_offset2scm(back.control_[i]);
   for (int i=4 ; i--;)
-    scontrols[i+4] = to_scm (curve.control_[i]);
+    scontrols[i+4] = ly_offset2scm (curve.control_[i]);
 
   /*
     Need the weird order b.o. the way PS want its arguments  
index ac70426542d700de6a607ca283849bbcb1cf8afe..db6472b9e547804ba21e6227505e00a2b6b16505 100644 (file)
@@ -63,7 +63,7 @@ Molecule::translate (Offset o)
     }
 
   expr_ = gh_list (ly_symbol2scm ("translate-molecule"),
-                  to_scm (o),
+                  ly_offset2scm (o),
                   expr_, SCM_UNDEFINED);
   if (!empty_b ())
     dim_.translate (o);
index dc4a5171dae5f01e407c5b1664cd6c00cce35674..dfc0614e4a93d3a4c6d8049b3e2856298f142ef6 100644 (file)
 #include "main.hh"
 
 SCM
-to_scm (Musical_pitch p)
+Musical_pitch::to_scm ()const
 {
-  return gh_list (gh_int2scm (p.notename_i_),
-                 gh_int2scm (p.accidental_i_),
-                 gh_int2scm (p.octave_i_),
+  return gh_list (gh_int2scm (notename_i_),
+                 gh_int2scm (accidental_i_),
+                 gh_int2scm (octave_i_),
                  SCM_UNDEFINED);
 }
 
-/*
-  TODO: check -- is_pitch () ?
- */
-Musical_pitch
-scm_to (SCM s, Musical_pitch* )
+
+Musical_pitch::Musical_pitch (SCM s)
 {
-  return Musical_pitch (gh_scm2int (gh_car (s)),
-                         gh_scm2int (gh_cadr (s)),
-                     gh_scm2int (gh_caddr (s)));
+  notename_i_ = gh_scm2int (gh_car (s));
+  accidental_i_ = gh_scm2int (gh_cadr (s));
+  octave_i_ = gh_scm2int (gh_caddr (s));
 }
 
 Musical_pitch::Musical_pitch (int n, int a, int o)
index f3a85c1ad671c12ed811a55568cc16d9321fd067..091f2b7685579d4b40b8362061cda17d7ac4ddef 100644 (file)
 #include "dictionary.hh"
 #include "musical-pitch.hh"
 
-String
-Notename_table::get_name (Musical_pitch m) const
-{
-  for (Dictionary_iter<Musical_pitch> ai (*pitch_dict_); ai.ok (); ai++)
-    {
-      if (ai.val () == m)
-       return ai.key ();
-    }
-  return "r";                  // rest. 
-}
-
-
 void
 Notename_table::add_note_name (String s,
                               Musical_pitch const *p)
index b624b8ea8f2643308c9cc5109c07f2c3eed833cb..584347bae9318192f19b171c8a1d51f059f2c645 100644 (file)
@@ -40,11 +40,14 @@ Paper_outputter::output_header ()
 {
   if (safe_global_b)
     {
-
       gh_define ("security-paranoia", SCM_BOOL_T);      
     }
-  String s = String ("(eval (") + output_global_ch + "-scm 'all-definitions))";
-  ly_eval_str (s.ch_C ());
+
+  SCM exp = gh_list (ly_symbol2scm ((String (output_global_ch) + "-scm").ch_C()),
+                    ly_quote_scm (ly_symbol2scm ("all-definitions")),
+                    SCM_UNDEFINED);
+  exp = scm_eval (exp);
+  scm_eval (exp);
   
   String creator;
   if (no_timestamps_global_b)
@@ -92,7 +95,7 @@ enter:
   SCM head =gh_car (expr);
   if (head == offset_sym)
     {
-      o += scm_to (gh_cadr (expr), &o);
+      o += ly_scm2offset (gh_cadr (expr));
       expr = gh_caddr (expr);
       goto enter;
     }
index 519ca724b3415c0221e7ac656f138d30b15c21d3..c0f2887008f22d93a14e5b5652cd9422f048e5be 100644 (file)
@@ -50,28 +50,48 @@ Property_engraver::acknowledge_element (Score_element_info i)
     }
 }
 
+
 void
 Property_engraver::apply_properties (SCM p, Score_element *e)
 {  
   for (; gh_pair_p (p); p = gh_cdr (p))
     {
+      /*
+       Try each property in order; earlier descriptions take
+       precedence over later ones, and we don't touch elt-properties if
+       they're already set.
+      */
+      
       SCM entry = gh_car (p);
       SCM prop_sym = gh_car (entry);
       SCM type_p   = gh_cadr (entry);
-      SCM elt_prop_name = gh_caddr (entry);
+      SCM elt_prop_sym = gh_caddr (entry);
 
-      SCM preset = scm_assq(prop_sym, e->element_property_alist_);
+      SCM preset = scm_assq(elt_prop_sym, e->element_property_alist_);
       if (preset != SCM_BOOL_F)
        continue;
   
       SCM val = get_property (prop_sym);
+
+     
       if (val == SCM_UNDEFINED)
-       ;
+       ;                       // Not defined in context.
       else if (gh_apply (type_p, scm_listify (val, SCM_UNDEFINED))
-              == SCM_BOOL_T)
-       e->set_elt_property (ly_symbol2string (elt_prop_name), val);
+              == SCM_BOOL_T)   // defined and  right type: do it
+       e->set_elt_property (ly_symbol2string (elt_prop_sym), val);
       else
-       {
+ /*
+           we don't print a warning if VAL == #f, because we would
+           get lots of warnings when we restore stuff to default, eg.
+
+           slurDash = #1 [...] slurDash = ##f
+
+           should not cause "type error: slurDash expects number not
+           boolean"
+
+         */
+       if (val != SCM_BOOL_F)
+       {                       // not the right type: error message.
          SCM errport = scm_current_error_port ();
          warning (_("Wrong type for property"));
          scm_display (prop_sym, errport);
@@ -82,7 +102,6 @@ Property_engraver::apply_properties (SCM p, Score_element *e)
          scm_puts (" type: ", errport);
          scm_display (ly_type (val), errport);
          scm_puts ("\n", errport);
-           
        }
     }
 }
index 5498b5b7f60f2db2d717bd5e41293609853932da..846cc192e697f3f908e37a891e7a3bdc7f7e73ce 100644 (file)
@@ -60,7 +60,9 @@ Script_engraver::do_process_music()
     {
       Articulation_req* l=script_req_l_arr_[i];
 
-      SCM list = ly_eval_str (("(articulation-to-scriptdef \"" + l->articulation_str_ + "\")").ch_C());
+      SCM list = scm_eval (gh_list (ly_symbol2scm ("articulation-to-scriptdef"),
+                                   ly_str02scm (l->articulation_str_.ch_C()),
+                                   SCM_UNDEFINED));
       
       if (list == SCM_BOOL_F)
        {
index 7a0f91f9413b840e644c17ca36cb135f82ae5b5b..a5e4140275710438054695c92a6bf85a82ea82e4 100644 (file)
@@ -29,7 +29,7 @@
 #include "cross-staff.hh"
 #include "group-interface.hh"
 #include "staff-symbol-referencer.hh"
-#include "lily-guile.icc"
+
 
 
 class Slur_bezier_bow : public Bezier_bow
@@ -668,7 +668,12 @@ Slur::set_control_points ()
     }
 
   Bezier b = bb.get_bezier ();
-  SCM controls = array_to_scm (b.control_);
+
+
+  SCM controls = SCM_EOL;
+  for (int i= 4; i--;)
+    controls = gh_cons ( ly_offset2scm (b.control_[i]), controls);
+
   set_elt_property ("control-points", controls);
 }
   
@@ -677,9 +682,12 @@ Bezier
 Slur::get_curve () const
 {
   Bezier b;
-  Array<Offset> controls (4);
-  scm_to_array (get_elt_property ("control-points"), &controls);
-  b.control_ = controls;
+  int i = 0;
+  for (SCM s= get_elt_property ("control-points"); s != SCM_EOL; s = gh_cdr (s))
+    {
+      b.control_[i] = ly_scm2offset (gh_car (s));
+      i++;
+    }
   
   Array<Offset> enc (get_encompass_offset_arr ());
   Direction dir = directional_element (this).get ();
index 88adb28af6ecbf3713bd17a4c8e22a7da4e7d289..3e3a43585697e748e29eb4553625419cdd89786a 100644 (file)
@@ -188,7 +188,7 @@ Staff_margin_engraver::do_pre_move_processing ()
        make a properly ordered Right_edge_item, if that need arises.
        */
       text_p_->set_elt_property("visibility-lambda",
-                             ly_eval_str ("begin-of-line-visible"));
+                               scm_eval (ly_symbol2scm ("begin-of-line-visible")));
       typeset_element (text_p_);
       text_p_ = 0;
       assert (left_edge_p_);
index a45c4702c20e104901b0b78912b37b5970bb2bcc..306fc176c083e4fbff6c4e2ab9e9734c1e2b59ea 100644 (file)
@@ -77,7 +77,7 @@ beampostraditional =
 
 
 slurnormal = 
-       \property Voice.slurDash = ""
+       \property Voice.slurDash = ##f
 
 
 slurdotted =                           
index 467f9e8c73acdf1dc6c99858122e6665ebac7c35..358e1f3a71f4f1ddda7f2decf9b0f8ca870e4b35 100644 (file)
@@ -1,4 +1,19 @@
 
+;
+; Format: 
+; (cons "Type name"
+;    (list PROPERTYDESCRIPTIONS))
+; 
+; where
+; PROPERTYDESCRIPTION
+; is
+;
+;  (list 'translatorPropertySymbol type-predicate backend-property-symbol)
+;
+; Descriptions earlier in the list take precedence over later descriptions.
+;
+
+
 (define generic-beam-properties
   (cons "Beam"
        (list
@@ -16,8 +31,8 @@
 (define generic-stem-properties
   (cons "Stem"
        (list
-        (list 'verticalDirection dir? 'direction)       
         (list 'stemVerticalDirection dir? 'direction)
+        (list 'verticalDirection dir? 'direction)       
         (list 'stemLength number? 'length)
         (list 'flagStyle string? 'flag-style)
         (list 'stemCentered boolean? 'stem-centered)
@@ -28,8 +43,8 @@
 
 (define generic-dot-properties
   (cons "Dots" (list
-               (list 'verticalDirection dir? 'direction)
                (list 'dotDirection dir? 'direction)
+               (list 'verticalDirection dir? 'direction)
                )
        ))
 
 (define generic-breathing-sign-properties
   (cons "Breathing_sign"
        (list
-        (list 'verticalDirection dir? 'direction)
         (list 'breathingSignVerticalDirection dir? 'direction)
+        (list 'verticalDirection dir? 'direction)
         )))
 
 (define generic-clef-properties
 
 (define generic-tie-properties
   (cons "Tie" (list
-              (list 'verticalDirection dir? 'direction)
               (list 'tieVerticalDirection dir? 'direction)
+              (list 'verticalDirection dir? 'direction)
+(list 'tieDash number? 'dashed)
   )))
+
 (define generic-tie-column-properties
   (cons "Tie_column" (list
-                     (list 'verticalDirection dir? 'direction)
                      (list 'tieVerticalDirection dir? 'direction)
+                     (list 'verticalDirection dir? 'direction)
   )))
 
-
 (define generic-note-column-properties
   (cons "Note_column"
        (list
 (define generic-slur-properties
   (cons "Slur"
        (list
-        (list 'verticalDirection dir? 'direction)       
         (list 'slurVerticalDirection dir? 'direction)
+        (list 'verticalDirection dir? 'direction)       
         (list 'slurDash number? 'dashed))))
 
 (define generic-timesig-properties
index 9933b82133a94f16b8444611f095e208c1a05c27..17b7c457946d90ad9f72a89394089d5add665e49 100644 (file)
@@ -9,8 +9,6 @@
 ; This file contains various routines in Scheme that are easier to 
 ; do here than in C++.  At present it is a unorganised mess. Sorry. 
 ;
-;
-
 
 
 ;(debug-enable 'backtrace)
index 9a6b05a8c02f2a700f22a096158ee5ebd3a13e9f..a615f9564f13c9b38b8d4c16a9d3164cb2920d43 100644 (file)
@@ -7,6 +7,9 @@
 ;;; All dimensions are measured in staff-spaces
 
 
+; This is a mess : global namespace pollution. We should wait
+;  till guile has proper toplevel environment support.
+
 
 ;; Beams should be prevented to conflict with the stafflines, 
 ;; especially at small slopes