]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 1.3.74 release/1.3.74
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 19 Jul 2000 17:01:09 +0000 (19:01 +0200)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 19 Jul 2000 17:01:09 +0000 (19:01 +0200)
======
* Removed \interscoreline after the last line, prevents some
empty pages. (patch by Mats Bengtsson)

* Smobified Music, junked associated identifiers. Use Scheme list to
store Music_sequence.  Removed const declarations from
Music_iterators.  Added a mutable and immutable property list to
Music.  Use music property for all Scheme values in Music.  Created
and fixed a load of Garbage Collection bugs.

* Changed number font to allow automatic .mf creation.

* Output place of definition as \special{src:LOCATION}. See FAQ for
explanation how to use.

* Schemified Local_key_item and fixed minor bug with accidentals.

* new Japanese .po file.

* Bugfix for broken tie direction

* Bugfix for bar at beginning of line break

1.3

84 files changed:
AUTHORS.txt
CHANGES
Documentation/faq.texi
Documentation/topdocs/AUTHORS.texi
VERSION
input/test/lyric-phrasing.ly [new file with mode: 0644]
input/trip.ly
lily/afm.cc
lily/align-interface.cc
lily/all-font-metrics.cc
lily/auto-change-iterator.cc
lily/bar-number-engraver.cc
lily/bar.cc
lily/beam.cc
lily/break-align-engraver.cc
lily/collision.cc
lily/dynamic-engraver.cc
lily/font-metric.cc
lily/grace-position-performer.cc
lily/identifier.cc
lily/include/afm.hh
lily/include/all-font-metrics.hh
lily/include/font-metric.hh
lily/include/identifier.hh
lily/include/lily-proto.hh
lily/include/lookup.hh
lily/include/ly-smobs.icc
lily/include/moment.hh
lily/include/music.hh
lily/include/paper-def.hh
lily/include/request.hh
lily/include/scm-hash.hh
lily/include/score-element.hh
lily/include/smobs.hh
lily/include/tfm-reader.hh
lily/include/tfm.hh
lily/item.cc
lily/line-of-score.cc
lily/lookup.cc
lily/lyric-combine-music.cc
lily/mark-engraver.cc
lily/midi-def.cc
lily/moment.cc
lily/multi-measure-rest-engraver.cc
lily/music-sequence.cc
lily/music-wrapper.cc
lily/music.cc
lily/my-lily-parser.cc
lily/note-column.cc
lily/output-property-engraver.cc
lily/paper-def.cc
lily/paper-score.cc
lily/parser.yy
lily/pointer-group-interface.cc
lily/property-engraver.cc
lily/repeated-music.cc
lily/rest-collision.cc
lily/rhythmic-head.cc
lily/scm-hash.cc
lily/scope.cc
lily/score-element.cc
lily/score-engraver.cc
lily/score.cc
lily/script-engraver.cc
lily/separation-item.cc
lily/slur.cc
lily/spaceable-element.cc
lily/spacing-engraver.cc
lily/spacing-spanner.cc
lily/spanner.cc
lily/staff-symbol-engraver.cc
lily/stem-tremolo.cc
lily/stem.cc
lily/tfm-reader.cc
lily/tfm.cc
lily/tie-engraver.cc
lily/tie.cc
lily/timing-translator.cc
lily/translator-group.cc
ly/declarations.ly
ly/engraver.ly
ly/init.ly
make/out/lilypond.lsm
make/out/lilypond.spec

index b0453ea529d8c4e001da65c52829bfa42f4de33c..7ec65fe642bf6a7e247b8fe0fbdeccbef3f50313 100644 (file)
@@ -60,8 +60,8 @@ list is alphabetically ordered.
 
    * Stephen Peters <portnoy@ai.mit.edu>,     pdfTeX support
 
-   * Glen Prideaux <glenprideaux@iname.com>,     minor bug fix to
-     script used to generate doc++ documentation
+   * Glen Prideaux <glenprideaux@iname.com>,     minor bug fixes,
+     lyric-phrasing.
 
    * Roy R. Rankin <Roy.Rankin@alcatel.com.au>,     major extension,
      fixes to abc2ly, lilypond bug fixes
diff --git a/CHANGES b/CHANGES
index d6504f157929e7da44e089106b89dc61b88ea16b..0e730c4cdfaf21ceba2f9a9542cc31cfc57630ad 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,19 @@
+* Small bugfix: also do a deep copy on  submusices
 
+* Fixed:  \autochange doesn't crash anymore.
+
+* Cleanup, documentation and enforcement of smob interfaces in
+LilyPond.  We distinguish between SIMPLE_SMOBS and SMOBS (objects that
+have self_scm_)
+
+* Glen Prideaux lyric phrasing engraver. See
+input/test/lyric-phrasing.ly
+
+
+
+
+1.3.73
+======
 * Removed \interscoreline after the last line, prevents some
 empty pages. (patch by Mats Bengtsson)
 
index ae735e482b25965f83ce8e1b7c3a13a8238dc42f..725efa3fa6fd34a0fb20798789951f452a1e9ddf 100644 (file)
@@ -401,7 +401,8 @@ Upgrade/downgrade to 4.17.
 As of 1.3.73, lilypond provides support for the xdvi @code{src:}
 special. This can be used with Xdvik (22.16 or better) and xdvi (22.28
 or better) to go to the place in the input that corresponds to a symbol
-in the output.
+in the output: click on the note, and your editor jumps to the place
+where it was defined
 
 lilypond:
 
@@ -446,8 +447,14 @@ Xdvi
 
 @uref{Xdvi,ftp://ftp.math.berkeley.edu/pub/Software/TeX/xdvi.tar.gz} has
 better support for src specials. Apply @uref{this patch,
-http://www.cs.uu.nl/~hanwen/software/xdvi-src}. When viewing,
-control-mousebutton 1 will take you to the correct line/column. 
+http://www.cs.uu.nl/~hanwen/software/xdvi-src}. Before starting, set the
+environment variable @code{XEDITOR} to @code{"emacsclient --no-wait +%d
+%s"}.  When viewing, control-mousebutton 1 will take you to the correct
+line/column. Control-mousebutton 2 will show all clickable boxes.
+
+dvips:
+
+dvips will complain about the specials, but the complaints are harmless.
 
 
 @subsubsection I use dvilj4, and there are lots of warning messages for the printing
index 9c0ce77848ef0d8a9d255a20fd5f6b3054d5168d..8ef54580a1d2a0ee0ba8571e17203e9620e4e687 100644 (file)
@@ -63,7 +63,7 @@ list is alphabetically ordered.
 @item @email{portnoy@@ai.mit.edu,Stephen Peters},
     pdfTeX support
 @item @email{glenprideaux@@iname.com, Glen Prideaux},
-    minor bug fix to script used to generate doc++ documentation
+    minor bug fixes, lyric-phrasing.
 @item @email{Roy.Rankin@@alcatel.com.au, Roy R. Rankin},
     major extension, fixes to abc2ly, lilypond bug fixes
 @item @email{daboys@@austin.rr.com, Jeffrey B. Reed},
diff --git a/VERSION b/VERSION
index a0d0b48def9488e713a2c0c3e79c9735653e6fc3..26c0f6075813ecbc74d0735fda5c7194fe61c979 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,7 +1,7 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
-PATCH_LEVEL=73
+PATCH_LEVEL=74
 MY_PATCH_LEVEL=
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
diff --git a/input/test/lyric-phrasing.ly b/input/test/lyric-phrasing.ly
new file mode 100644 (file)
index 0000000..2edfa2d
--- /dev/null
@@ -0,0 +1,48 @@
+\header{
+filename =      "twinkle-pop.ly";
+%title =        "Ah, vous dirais-je, maman ";
+description =   "twinkle twinkle in pop-song-settings";
+composer =      "traditional";
+enteredby =     "HWN, chords by Johan Vromans";
+copyright =     "public domain";
+}
+
+\version "1.3.59";
+
+m =\notes  \relative c'' {
+       \property Staff.automaticMelismata = ##t
+       \autoBeamOff
+       g4  r8 \times 2/3 { g'8( f )e } r8 \grace { [d16 c b] } e4
+       \emptyText
+       d8.^"melisma"   \melisma c16
+       \melismaEnd
+       b c d e }
+
+textI =  \lyrics  { la4 __ la -- la  I, la dargh la dargh.  }
+textII =  \lyrics  { dar -- dargh __ dargh dargh; dargh la dargh loo.  }
+textIII =  \lyrics  { la -- da __ doo dah; dargh la dargh loo.  }
+
+\score {
+
+    \notes < \context Staff = SA \context Voice = VA { s1 }
+      \context LyricVoice = "VA-1" { s1 }
+      \context LyricVoice = "VA-2" { s1 }
+      
+      \addlyrics
+         \context Staff = SA \m
+         < \context LyricVoice = "VA-1" \textI
+           \context LyricVoice = "VA-2" \textII
+           \context LyricVoice = "VA-3" \textIII
+         >
+         
+    >
+
+  \paper {
+    \translator {
+      \ScoreContext
+      \consists "Lyric_phrasing_engraver";
+      automaticPhrasing = ##t;
+    }
+  }
+
+}
\ No newline at end of file
index 2e0f75403b60d81c7bfa7c2b7dcb44606e2b6bc0..750a0f6eb73cbef1fd3247cc9617aea32c595f3a 100644 (file)
@@ -11,7 +11,7 @@ basic faults in lily, this file will not run correctly.
 
 TODO:
 
-* repeats.
+* autochange.
 
 * tremolo
 
index 9f1f8045f5d4e7bb6567d38e59b89efa464d14b3..c86c1faafcd4980ee24f7492826dbc2841d14c79 100644 (file)
@@ -24,7 +24,16 @@ Adobe_font_metric::Adobe_font_metric (AFM_Font_info * fi)
       name_to_metric_dict_[c->name] = i;
     }
 }
-  
+
+
+SCM
+Adobe_font_metric::make_afm (AFM_Font_info *fi)
+{
+  Adobe_font_metric * fm = new Adobe_font_metric (fi);
+
+  return fm->smobbed_self();    
+}
+
 
 AFM_CharMetricInfo const *
 Adobe_font_metric::find_ascii_metric (int a , bool warn) const
@@ -74,7 +83,7 @@ Adobe_font_metric::get_char (int code, bool warn) const
     return Box (Interval (0,0),Interval(0,0));
 }
 
-Adobe_font_metric*
+SCM
 read_afm_file (String nm)
 {
   FILE *f = fopen (nm.ch_C() , "r");
@@ -89,7 +98,7 @@ read_afm_file (String nm)
     }
   fclose (f);
 
-  return new Adobe_font_metric (fi);
+  return Adobe_font_metric::make_afm (fi);
 }
 
   
index 51ac50d50980babc739c3550b0dd093f63335f4d..4527bbf41b56cdfc80e43db89942ab1b776b87ba 100644 (file)
@@ -138,7 +138,7 @@ Align_interface::get_count (Score_element*me,Score_element*s)
   int c =0;
   while (gh_pair_p (e))
     {
-      if (gh_car (e) == s->self_scm_)
+      if (gh_car (e) == s->self_scm ())
        break;
       c++;
       e = gh_cdr (e);
index 9cff0e2b28fc19da4a8d866347074d2e040b12dc..10f0ef3476766ec966d2dc1655e4ecc1add2fce7 100644 (file)
 #include "afm.hh"
 #include "tfm.hh"
 #include "lily-guile.hh"
-#include "tfm-reader.hh"
+#include "scm-hash.hh"
+
+
+
 
 extern "C" {
 #include <kpathsea/kpathsea.h>
@@ -24,14 +27,25 @@ const char * default_font_sz_ = "cmr10";
 
 All_font_metrics::All_font_metrics (String path)
 {
+  afm_p_dict_ = new Scheme_hash_table;
+  tfm_p_dict_ = new Scheme_hash_table;
+  scaled_p_dict_ = new Scheme_hash_table;
+  
   search_path_.parse_path (path);
 }
 
+All_font_metrics::~All_font_metrics ()
+{
+  scm_unprotect_object (afm_p_dict_->self_scm ());
+  scm_unprotect_object (tfm_p_dict_->self_scm ());
+  scm_unprotect_object (scaled_p_dict_->self_scm ());
+}
+
 Adobe_font_metric *
 All_font_metrics::find_afm (String name)
 {
   SCM sname = ly_symbol2scm (name.ch_C ());
-  if (!afm_p_dict_.elem_b (sname))
+  if (!afm_p_dict_->elem_b (sname))
     {
       String path;
       if (path.empty_b ())
@@ -48,36 +62,35 @@ All_font_metrics::find_afm (String name)
       
       if (verbose_global_b)
        progress_indication ("[" + path);
-      Adobe_font_metric * afm_p = read_afm_file (path);
+      SCM  afm = read_afm_file (path);
 
-      afm_p->name_ = ly_symbol2scm (name.ch_C ());
+      unsmob_metrics (afm)->name_ = sname;
 
       if (verbose_global_b)
        progress_indication ("]");
 
-      afm_p_dict_.set (sname,afm_p->self_scm_);
+       afm_p_dict_->set (sname,afm);
     }
   
-  return dynamic_cast<Adobe_font_metric*> (unsmob_metrics (afm_p_dict_.get (sname)));
+  return dynamic_cast<Adobe_font_metric*> (unsmob_metrics (afm_p_dict_->get (sname)));
 }
 
 Scaled_font_metric * 
 All_font_metrics::find_scaled (String nm, int m)
 {
-  Scaled_font_metric * s=0;
   String index =  nm + "@" + to_str (m);
   SCM sname = ly_symbol2scm (index.ch_C ());
 
   Font_metric *fm =0;
-  if (!scaled_p_dict_.elem_b (sname))
+  if (!scaled_p_dict_->elem_b (sname))
     {
       Font_metric *f = find_font (nm);
-      s = new Scaled_font_metric (f, m);
-      scaled_p_dict_.set (sname, s->self_scm_);
-      fm =  s;
+      SCM s =  Scaled_font_metric::make_scaled_font_metric (f, m);
+      scaled_p_dict_->set (sname, s);
+      fm =  unsmob_metrics (s);
     }
   else
-    fm = unsmob_metrics (scaled_p_dict_.get (sname));
+    fm = unsmob_metrics (scaled_p_dict_->get (sname));
 
   return dynamic_cast<Scaled_font_metric*> (fm);
 }
@@ -86,7 +99,7 @@ Tex_font_metric *
 All_font_metrics::find_tfm (String name)
 {
   SCM sname = ly_symbol2scm (name.ch_C ());  
-  if (!tfm_p_dict_.elem_b (sname))
+  if (!tfm_p_dict_->elem_b (sname))
     {
       String path;
       
@@ -102,17 +115,17 @@ All_font_metrics::find_tfm (String name)
 
       if (verbose_global_b)
        progress_indication ("[" + path);
-      Tex_font_metric  * tfm_p = Tex_font_metric_reader::read_file (path);
-      tfm_p->name_ = ly_symbol2scm (name.ch_C( ));
-
+      SCM tfm = Tex_font_metric::make_tfm (path);
       if (verbose_global_b)
        progress_indication ("]");
 
-      tfm_p_dict_.set (sname, tfm_p->self_scm_);
+      Font_metric *fm = unsmob_metrics (tfm);
+      fm->name_ = sname;
+      tfm_p_dict_->set (sname, tfm);
     }
     
   return
-    dynamic_cast<Tex_font_metric*> (unsmob_metrics (tfm_p_dict_.get(sname)));
+    dynamic_cast<Tex_font_metric*> (unsmob_metrics (tfm_p_dict_->get(sname)));
 }
 
 
@@ -158,9 +171,9 @@ All_font_metrics::font_descriptions () const
 {
   SCM l[] = {0,0,0};
 
-  l[0] = afm_p_dict_.to_alist ();
-  l[1] = tfm_p_dict_.to_alist ();
-  l[2] = scaled_p_dict_.to_alist ();  
+  l[0] = afm_p_dict_->to_alist ();
+  l[1] = tfm_p_dict_->to_alist ();
+  l[2] = scaled_p_dict_->to_alist ();  
 
   SCM list = SCM_EOL;
   for (int i=0; i < 3; i++)
index ef0edb3cbd127caf02fe7454baaad79822545b11..2c9de1f71799e36533c2f65a383b59309ab401bf 100644 (file)
@@ -65,18 +65,20 @@ Auto_change_iterator::change_to (Music_iterator *it, String to_type,
     ; //    error (_ ("none of these in my family"));
 
 }
-
+Pitch_interrogate_req* spanish_inquisition; // nobody expects it
 void
 Auto_change_iterator::do_process_and_next (Moment m)
 {
   Music_wrapper_iterator::do_process_and_next (m);
-  Pitch_interrogate_req spanish_inquisition; // nobody expects it
 
-  Music_iterator *it = try_music (&spanish_inquisition);
+  if (!spanish_inquisition)
+    spanish_inquisition = new Pitch_interrogate_req;
+
+  Music_iterator *it = try_music (spanish_inquisition);
 
-  if (it && spanish_inquisition.pitch_arr_.size ())
+  if (it && spanish_inquisition->pitch_arr_.size ())
     {
-      Musical_pitch p = spanish_inquisition.pitch_arr_[0];
+      Musical_pitch p = spanish_inquisition->pitch_arr_[0];
       Direction s = Direction (sign(p.steps ()));
       if (s != where_dir_)
        {
@@ -87,6 +89,8 @@ Auto_change_iterator::do_process_and_next (Moment m)
          change_to (it, auto_mus->what_str_, to_id);     
        }
     }
+
+  spanish_inquisition->pitch_arr_.clear ();
 }
 
 Auto_change_iterator::Auto_change_iterator( )
index facf059ace39a0a9d27e3053f0d52539a9992780..34a0cb2eae3228113aa22b72c3212cd03c693f43 100644 (file)
@@ -70,7 +70,7 @@ Bar_number_engraver::acknowledge_element (Score_element_info inf)
   Score_element * s = inf.elem_l_;
   if (Staff_symbol::has_interface (s))
     {
-      staffs_ = gh_cons (inf.elem_l_->self_scm_, staffs_);
+      staffs_ = gh_cons (inf.elem_l_->self_scm (), staffs_);
     }
   else if (text_p_
           && dynamic_cast<Item*> (s)
index bb91147180bebba77fc9a8670eed611ebf761295..cb956edf231d2ae475200eb4598db5f27bfd527f 100644 (file)
@@ -32,7 +32,7 @@ Bar::brew_molecule (SCM smob)
   if (gh_string_p (s) && gh_procedure_p (barsiz_proc))
     {
       String str  =ly_scm2string (s);
-      SCM siz = gh_call1 (barsiz_proc, me->self_scm_);
+      SCM siz = gh_call1 (barsiz_proc, me->self_scm ());
       return compound_barline (me, str, gh_scm2double (siz)).create_scheme ();
     }
   return SCM_EOL;
index 1356abe3333460dec86d01cff87cfb3751ad198c..25fe6e901901559e2c556541f8f3f4b05189290b 100644 (file)
@@ -45,7 +45,7 @@ Beam::add_stem (Score_element*me, Score_element*s)
   s->add_dependency (me);
 
   assert (!Stem::beam_l (s));
-  s->set_elt_property ("beam", me->self_scm_);
+  s->set_elt_property ("beam", me->self_scm ());
 
   add_bound_item (dynamic_cast<Spanner*> (me), dynamic_cast<Item*> (s));
 }
index 3ca38f7db74572d81620e40948ca48b7c5a10a02..b48f31b25ac870527f12041d59b552e6dda41f86 100644 (file)
@@ -111,10 +111,10 @@ Break_align_engraver::acknowledge_element (Score_element_info inf)
          */
          edge->set_extent_callback (Score_element::point_dimension_callback,X_AXIS);
          
-         align_l_->set_elt_property ("group-center-element", edge->self_scm_);
+         align_l_->set_elt_property ("group-center-element", edge->self_scm ());
 
          announce_element (edge, 0);
-         column_alist_ = scm_assoc_set_x (column_alist_, edge_sym, edge->self_scm_);
+         column_alist_ = scm_assoc_set_x (column_alist_, edge_sym, edge->self_scm ());
        }
 
       SCM s = scm_assoc (align_name, column_alist_);
@@ -136,7 +136,7 @@ Break_align_engraver::acknowledge_element (Score_element_info inf)
          group->set_elt_property ("break-align-symbol", align_name);
          group->set_parent (align_l_, Y_AXIS);
          announce_element (group, 0);
-         column_alist_ = scm_assoc_set_x (column_alist_, align_name, group->self_scm_);
+         column_alist_ = scm_assoc_set_x (column_alist_, align_name, group->self_scm ());
        }
       Axis_group_interface::add_element (group, item_l);
     }
index 8d1f6d1232ca0fa1d63cce82821b665af6be83db..c0bec3356d87cea6d52fad9362f7ba91fbf79ea1 100644 (file)
@@ -32,7 +32,7 @@ Collision::force_shift_callback (Score_element * c, Axis a)
    */
   if (!unsmob_element (me->get_elt_property ("done")))
     {
-      me->set_elt_property ("done", me->self_scm_);
+      me->set_elt_property ("done", me->self_scm ());
       do_shifts (me);
     }
   
@@ -195,7 +195,7 @@ Collision::automatic_shift (Score_element *me)
   do
     {
       for (int i=0; i < clash_groups[d].size (); i++)
-       tups = gh_cons (gh_cons (clash_groups[d][i]->self_scm_, gh_double2scm (offsets[d][i])),
+       tups = gh_cons (gh_cons (clash_groups[d][i]->self_scm (), gh_double2scm (offsets[d][i])),
                                 tups);
     }
   while (flip (&d) != UP);
@@ -216,7 +216,7 @@ Collision::forced_shift (Score_element *me)
       SCM force =  se->remove_elt_property ("force-hshift");
       if (gh_number_p (force))
        {
-         tups = gh_cons (gh_cons (se->self_scm_, force),
+         tups = gh_cons (gh_cons (se->self_scm (), force),
                          tups);
        }
     }
index c57c5332657d662ee5742947f1cf201be12666e9..cfd5eae9a234c79b72bc0525074bda483c825112 100644 (file)
@@ -256,10 +256,10 @@ Dynamic_engraver::do_process_music ()
          if (text_p_)
            {
              index_set_cell (cresc_p_->get_elt_property ("dynamic-drul"),
-                             LEFT, text_p_->self_scm_);
+                             LEFT, text_p_->self_scm ());
              if (finished_cresc_p_)
                index_set_cell (finished_cresc_p_->get_elt_property ("dynamic-drul"),
-                               RIGHT, text_p_->self_scm_);
+                               RIGHT, text_p_->self_scm ());
            }
 
          Axis_group_interface::add_element (line_spanner_, cresc_p_);
index 4443aa6399cc3dbbf7477606fc57e87785d8f630..467f0f84cfdb15cfa8d70957131847fc03751c1b 100644 (file)
@@ -67,14 +67,11 @@ Scaled_font_metric::text_dimension (String t) const
 
 Font_metric::~Font_metric ()
 {
-  unsmobify_self ();
 }
 
 Font_metric::Font_metric ()
 {
-  self_scm_ = SCM_EOL;
   name_ = SCM_EOL;
-  smobify_self ();
 }
 
 Font_metric::Font_metric (Font_metric const &)
@@ -94,6 +91,15 @@ Scaled_font_metric::Scaled_font_metric (Font_metric* m, int s)
   orig_l_ = m;
 }
 
+SCM
+Scaled_font_metric::make_scaled_font_metric (Font_metric*m, int s)
+{
+  Scaled_font_metric *sfm = new Scaled_font_metric (m,s);
+  sfm->name_ = m->name_;
+  
+  return sfm->smobbed_self ();
+}
+
 SCM
 Font_metric::description () const
 {
@@ -110,15 +116,11 @@ Scaled_font_metric::description () const
 }
 
 
-void
-Font_metric::do_smobify_self ()
-{
-}
 
 SCM
 Font_metric::mark_smob (SCM s)
 {
-  Font_metric * m = SMOB_TO_TYPE(Font_metric, s);
+  Font_metric * m = (Font_metric*) SCM_CELL_WORD_1(s);
   return m->name_;
 }
 
@@ -134,5 +136,5 @@ Font_metric::print_smob (SCM s, SCM port, scm_print_state * )
 
 
 IMPLEMENT_UNSMOB (Font_metric, metrics);
-IMPLEMENT_SMOBS (Font_metric);
-
+IMPLEMENT_SIMPLE_SMOBS (Font_metric);
+IMPLEMENT_DEFAULT_EQUAL_P(Font_metric);
index c1c4ae88960b0a88b992c52d053ad25ae4147272..0259587934c542151c6465d2684b17ae98a5df95 100644 (file)
@@ -62,8 +62,8 @@ Grace_position_performer::process_acknowledged ()
          
          Rational grace_fraction_rat (1, 2);
          SCM prop = get_property ("graceFraction");
-         if (SMOB_IS_TYPE_B(Moment, prop))
-           grace_fraction_rat = *SMOB_TO_TYPE (Moment,prop);
+         if (unsmob_moment (prop))
+           grace_fraction_rat = *unsmob_moment (prop);
 
          delay_mom = shortest_mom * grace_fraction_rat;
          for (int i=0; i < notes_.size (); i++)
index 41b5e049f958b330db1fdf99e6e8fb44b5b39fd6..d3d0e7221b7024d83614dc6b29aaab9c783070f7 100644 (file)
 
 IMPLEMENT_UNSMOB(Identifier, identifier);
 IMPLEMENT_SMOBS(Identifier);
+IMPLEMENT_DEFAULT_EQUAL_P(Identifier);
 
 Identifier::Identifier (int code)
 {
-  self_scm_ = SCM_EOL;
   token_code_i_ = code;
   accessed_b_ = 0;
+  smobify_self ();
 }
 
 Identifier::Identifier (Identifier const&s)
   : Input (s)
 {
-  self_scm_ = SCM_EOL;
+  smobify_self ();  
   token_code_i_ = s.token_code_i_;
   accessed_b_ = s.accessed_b_;
 }
@@ -173,8 +174,3 @@ Identifier::mark_smob (SCM s)
 
 
 
-void
-Identifier::do_smobify_self ()
-{
-  
-}
index a0dfa15f429063fe9df88cb867fde1e084d2d5d0..d761dc093c09c4d224980131201db7a028e23ded 100644 (file)
 #include "font-metric.hh"
 #include "parse-afm.hh"
 
-struct Adobe_font_metric : Font_metric {
+struct Adobe_font_metric : Font_metric
+{
   AFM_Font_info * font_inf_;
 
-  Array<int> ascii_to_metric_idx_;
-  Dictionary<int> name_to_metric_dict_;
-
   Box get_char (int, bool) const;
   AFM_CharMetricInfo const *find_char_metric (String name, bool warn=true) const;
   AFM_CharMetricInfo const *find_ascii_metric (int, bool warn=true) const;  
 
   String str () const;
-  Adobe_font_metric (AFM_Font_info*);
   ~Adobe_font_metric ();
+  static SCM make_afm (AFM_Font_info*);
+
+protected:
+  Array<int> ascii_to_metric_idx_;
+  Dictionary<int> name_to_metric_dict_;
+
+  Adobe_font_metric (AFM_Font_info*);
+
 };
 
-Adobe_font_metric * read_afm_file (String fn);
+SCM read_afm_file (String fn);
 Box afm_bbox_to_box (AFM_BBox bb);
   
 
index b01ad19119138d8a13dfe2f50809a6acc12af93a..f705080d32cea8c0992c14d2cbcfe6866b457c0f 100644 (file)
 #ifndef ALL_FONTS_HH
 #define ALL_FONTS_HH
 
-
 #include "file-path.hh"
 #include "lily-proto.hh"
 #include "font-metric.hh"
-#include "scm-hash.hh"
 
 /**
    Interface to all .afm files living in the filesystem.
  */
 class All_font_metrics
 {
-  Scheme_hash_table afm_p_dict_;
-  Scheme_hash_table tfm_p_dict_;
-  Scheme_hash_table scaled_p_dict_;
+  Scheme_hash_table *afm_p_dict_;
+  Scheme_hash_table *tfm_p_dict_;
+  Scheme_hash_table *scaled_p_dict_;
   
   File_path search_path_;
 public:
-  
+  ~All_font_metrics ();  
   Adobe_font_metric *find_afm (String name);
   Tex_font_metric *find_tfm (String);
   Font_metric *find_font (String name);  
index 9db37fda4e8dbadc05ac993ee50b615e5299a760..843fab6ffe9332ecaca7f1af3125f31f1239de4f 100644 (file)
 
 struct Font_metric
 {
-  Font_metric ();
   SCM name_;
   virtual SCM description () const;
   virtual Box get_char (int ascii, bool warn) const;
   virtual ~Font_metric ();
   virtual Box text_dimension (String) const;
 
-  DECLARE_SMOBS;
+  DECLARE_SIMPLE_SMOBS(Font_metric,);
 private:
   Font_metric (Font_metric const&); // no copy.
+protected:
+  Font_metric ();
 };
 
 
 struct Scaled_font_metric : public Font_metric
 {
+  virtual SCM description () const;
+  virtual Box text_dimension (String) const;
+
+  static SCM make_scaled_font_metric (Font_metric*, int);
+protected:
   Font_metric *orig_l_;
   int magstep_i_;
   
-  Scaled_font_metric (Font_metric*, int);
-  virtual SCM description () const;
-  virtual Box text_dimension (String) const;
+  Scaled_font_metric (Font_metric*,int);
 };
 
 Font_metric * unsmob_metrics (SCM s);
 
-
 #endif /* FONT_METRIC_HH */
 
index 750c49089a4d555328d397516b27d25cfd4e0e43..02587ce9788138e74c767052f1a8f2c22cf8cec4 100644 (file)
@@ -33,14 +33,11 @@ virtual Class *  access_content_ ## Class (bool) const { error (#Class  + String
    */
 struct Identifier : public Input {
 
-  DECLARE_SMOBS;
   bool init_b_;
   bool accessed_b_;
   int token_code_i_;
   Identifier (Identifier const&);    
   Identifier (int code) ;
-  virtual ~Identifier() ;
-  
 
   void print() const;
   
@@ -52,6 +49,7 @@ struct Identifier : public Input {
   IDACCESSOR(Duration)
   VIRTUAL_COPY_CONS(Identifier);
 
+  DECLARE_SMOBS(Identifier, foo);
 protected:
   virtual void do_print () const;
   virtual String do_str () const;
index b63843e6d16dd874916dc323b4e2b7820cfbf607..d0de6ff36ba6834d7bd273dc8f3e07ba00b77b3f 100644 (file)
@@ -84,6 +84,7 @@ class Lyric_combine_music;
 class Lyric_combine_music_iterator;
 class Lyric_engraver;
 class Lyric_performer;
+class Lyric_phrasing_engraver;
 class Lyric_req;
 class Mark_req;
 class Melisma_playing_req;
index d0f5e33f2c54a4b36933afa8bbf30df0e30810c9..88f48b2603669cce3f3c8d016f22d5e8c0843d28 100644 (file)
  */
 class Lookup
 {
-
-
   Lookup ();
   Lookup (Lookup const&);
-
-  friend class Brutus;         // kai su, teknon. (make GCC shut up.)
-  
+  DECLARE_SIMPLE_SMOBS(Lookup,);  
 public:
-  DECLARE_SMOBS;
+
   static SCM make_lookup ();
   String font_name_;
   Adobe_font_metric * afm_l_;
index 8a8648e6a558610bf10244f72acebeab0f2c75e6..b17bd314f1487ab144a261a23baff84e79077de0 100644 (file)
 CL *                                           \
 unsmob_ ## name ( SCM s)                       \
 {                                              \
-  if (SMOB_IS_TYPE_B(CL, s))                   \
-    return SMOB_TO_TYPE(CL, s);                        \
-  else                                         \
-    return 0;                                  \
-}\
-SCM smobify (CL *cl)\
-{\
-  SCM s;                                                               \
-                                                                       \
-  SCM_NEWCELL(s);                                                      \
-  SCM_SETCAR(s,CL::smob_tag_);                                         \
-  SCM me_s = SCM_PACK(cl);                                                     \
-  SCM_SETCDR (s, me_s); \
-return s;\
-}\
+return  CL::unsmob (s);                                \
+}
 
 
-/*
-  should include equal_p ? 
- */
-#define IMPLEMENT_SMOBS(CL)\
-long CL::smob_tag_;\
-void                                                                   \
-CL::init_smobs ()                                                      \
-{                                                                      \
-  smob_tag_ = scm_make_smob_type_mfpe ( \
-     #CL, 0, CL::mark_smob, CL::free_smob, CL::print_smob, 0);\
-}\
-                                                                       \
-                                                                        \
-void                                                                    \
-CL::unsmobify_self ()                                                   \
-{                                                                       \
-  SCM s = self_scm_;                                                    \
-  scm_unprotect_object (s);                                             \
-                                                                        \
-  SCM_SETCAR (self_scm_, SCM_EOL); \
-  SCM_SETCDR (self_scm_, SCM_EOL); \
-  self_scm_ = SCM_EOL;                                                  \
-\
-  scm_done_malloc ( - sizeof (CL));\
-}                                                                       \
-\
-SCM                                                                    \
-CL::smobify_self ()                                                    \
-{                                                                      \
-  if (self_scm_ != SCM_EOL)                                            \
-    return self_scm_;                                                  \
-                                                                       \
-  /*                                                                   \
-    This is local. We don't assign to self_scm_ directly, to assure    \
-    that S isn't GC-ed from under us.                                  \
-   */                                                                  \
-  SCM s = smobify (this); \
-  self_scm_ = s;                                                       \
-  scm_protect_object (s);                                              \
-                                                                       \
-  scm_done_malloc(sizeof(CL));\
-  do_smobify_self();                                                   \
-  return s;                                    \
-}                                              \
-scm_sizet                                      \
-CL::free_smob (SCM ses)                                \
+#ifndef SCM_CELL_TYPE
+#define SCM_CELL_TYPE(X) SCM_CAR(X)
+#endif
+
+#ifndef SCM_CELL_WORD_1
+#define SCM_CELL_WORD_1(X) SCM_CDR(X)
+#endif
+
+
+#define IMPLEMENT_SIMPLE_SMOBS(CL)                             \
+long CL::smob_tag_;                                            \
+void                                                           \
+CL::init_smobs ()                                              \
+{                                                              \
+  smob_tag_ = scm_make_smob_type_mfpe (                                \
+     #CL, 0, CL::mark_smob, CL::free_smob, CL::print_smob, 0); \
+}                                                              \
+SCM CL::smobbed_self () const                                  \
+{                                                              \
+  SCM s;                                                       \
+  s = gh_cons (SCM_PACK(CL::smob_tag_), SCM_PACK(this));       \
+  scm_done_malloc(sizeof(CL));                                 \
+                                                               \
+  return s;                                                    \
+}                                                              \
+CL *                                                           \
+CL::unsmob (SCM s)                                             \
+{                                                              \
+  if (SCM_NIMP(s) && SCM_CELL_TYPE(s) == smob_tag_)            \
+    return (CL*) SCM_CELL_WORD_1(s);                           \
+  else                                                         \
+    return 0;                                                  \
+}                                                              \
+scm_sizet                                                      \
+CL::free_smob (SCM ses)                                                \
+{                                                              \
+  CL * s = (CL*) SCM_CDR(ses);                                 \
+   delete s;                                                   \
+  return sizeof (CL);                                          \
+}                                                              \
+ADD_SCM_INIT_FUNC(CL, CL::init_smobs)
+
+#define IMPLEMENT_SMOBS(CL)                                                    \
+IMPLEMENT_SIMPLE_SMOBS(CL)                                                     \
+SCM                                                                            \
+CL::smobify_self ()                                                            \
+{                                                                              \
+  /*                                                                           \
+    This is local. We don't assign to self_scm_ directly, to assure            \
+    that S isn't GC-ed from under us.                                          \
+                                                                               \
+    We don't use smobbed_self () to ensure that mark_smob () doesn't have to   \
+    deal half-initialized objects: scm_done_malloc( ) might trigger GC.                \
+    the warning in smobs.hh is just to be doubleplus goodly sure               \
+   */                                                                          \
+  SCM s;                                                                               \
+  SCM_NEWCELL(s);                                                              \
+  SCM_SETCAR(s,CL::smob_tag_);                                                 \
+  SCM_SETCDR (s, SCM_PACK(this));                                              \
+  self_scm_ = s;                                                               \
+ scm_done_malloc(sizeof(CL));                                                  \
+  scm_protect_object (s);                                                      \
+  return s;                                                                    \
+}
+
+#define IMPLEMENT_DEFAULT_EQUAL_P(CL)          \
+SCM                                            \
+CL::equal_p (SCM a , SCM b)                    \
 {                                              \
-  CL * s = (CL*) SCM_CDR(ses);                 \
-  /* someone else did the deed already; this might be an automatic var.*/ \
-  if (s->self_scm_ != ses)\
-     return 0; \
-\
- /* no need to call scm_unprotect_object, since this call \
-    implies that the object is not protected. */ \
-  SCM_SETCAR (ses, SCM_EOL); \
-  delete s;\
-  return sizeof (CL);\
-} \
-ADD_SCM_INIT_FUNC(CL, CL::init_smobs)\
+  return a == b ? SCM_BOOL_T : SCM_BOOL_F;     \
+}
 
 
 #endif /* LY_SMOBS_ICC */
 
+
index 53afd01816d17107c91a8b599ab59afba6307209..0bd535a6d5c7c9d5edd6174b626c53fdbf227958 100644 (file)
    Rationals with glue for Guilification;
 
    FIXME: remove self_scm_ and then remove this class */
-struct Moment : public Rational
+class Moment : public Rational
 {
-  Moment () { self_scm_ = SCM_EOL; }
-  Moment (int m) : Rational (m) {self_scm_ = SCM_EOL; }
-  Moment (int m, int n) : Rational (m,n) {self_scm_ = SCM_EOL; }
-  Moment (Rational m) : Rational (m) {self_scm_ = SCM_EOL; }
-  ~Moment ();
-  
-  DECLARE_SMOBS;
+  DECLARE_SIMPLE_SMOBS(Moment,);
+public:
+  Moment () { }
+  Moment (int m) : Rational (m) { }
+  Moment (int m, int n) : Rational (m,n) { }
+  Moment (Rational m) : Rational (m) { }
+
+  /*
+    Deliver a copy of THIS as a smobified SCM
+   */
+  SCM make_scm () const; 
 };
 
-SCM smobify (Moment*);
+
 Moment * unsmob_moment (SCM);
 
 IMPLEMENT_ARITHMETIC_OPERATOR (Moment, / );
index 2eee399d18de24bc6be327c4a755bfdeac18fe31..fc3d8ae05cf708487b983d8af9d94e8dfdd17608 100644 (file)
   */
 class Music {
 public:
-  DECLARE_SMOBS;
-  SCM immutable_property_alist_;
-  SCM mutable_property_alist_;
   Input *origin () const; 
   void set_spot (Input);  
   
@@ -46,13 +42,11 @@ public:
   void set_mus_pointer (const char*, SCM val);
   SCM remove_mus_property (const char* nm);
 
-  virtual SCM do_derived_mark ();
   virtual Musical_pitch to_relative_octave (Musical_pitch);
 
   /// The duration of this piece of music
   virtual Moment length_mom () const;
 
-  virtual ~Music();
   void print() const;
   /// Transpose, with the interval central C to #p#
   virtual void transpose (Musical_pitch p);
@@ -64,6 +58,10 @@ public:
   Music();
 protected:
   virtual void do_print() const;
+  DECLARE_SMOBS(Music,);
+  SCM immutable_property_alist_;
+  SCM mutable_property_alist_;
 };
 
 
index 8d4c326c756bcfae6c27da2112737c28fafdbded..94bf6dd94f0fb09438afa29a41609b48bc5a0048 100644 (file)
@@ -62,7 +62,7 @@ public:
   SCM get_scmvar (String id)const; 
   void reinit ();
   Paper_def ();
-  void set_lookup (int, Lookup*);
+  void set_lookup (int, SCM lookup_smob);
   Paper_def (Paper_def const&);
 
   /** The distance between beams of multiplicity_i
index 0b8ec16d6aaa27e985c41202e36ae9656d0dbf86..35401d75d7c38b662c88067ce66abcf18ab3f4cf 100644 (file)
@@ -26,7 +26,6 @@
  */
 class Request : public Music {
 public:
-  virtual ~Request(){}
   VIRTUAL_COPY_CONS(Music);
   bool equal_b (Request const*) const;
 protected:
index 7a903469c1dc537de3010f30c9ea62a520dae09d..ae733e9df80a53acfe909c23b70d157fcb632fa0 100644 (file)
@@ -30,7 +30,7 @@ typedef map<SCM,SCM, SCM_less> Scm_stl_map;
 /**
    auto resizing hash table. This should come from GUILE.
 
-   ALWAYS USE THIS AS VIA A POINTER, i.e.
+   1. ALWAYS USE THIS AS VIA A POINTER, i.e.
 
    class Foo {
     Scheme_hash_table * tab;
@@ -41,6 +41,12 @@ typedef map<SCM,SCM, SCM_less> Scm_stl_map;
    class Foo {
     Scheme_hash_table tab;
    }
+
+
+   2. UPON DESTRUCTION, DO
+
+   scm_unprotect_object (tab->self_scm_);
+   
  */
 class Scheme_hash_table :  private Scm_stl_map
 {
@@ -57,9 +63,10 @@ public:
   Scheme_hash_table ();
   void operator = (Scheme_hash_table const &); 
   Scheme_hash_table (Scheme_hash_table const &);
-  virtual ~Scheme_hash_table ();
-  DECLARE_SMOBS;
+
   SCM to_alist () const;
+  DECLARE_SMOBS(Scheme_hash_table,foo);
+
 };
 
 #endif /* SCM_HASH_HH */
index 7ce14c8cc1aef7a8e6d650fd2fc918db2e23a87f..85ff5e8774a90fd61edf77169657bfab7ed06d80 100644 (file)
@@ -141,11 +141,6 @@ public:
   static Interval molecule_extent (Score_element *,Axis);
 
 protected:
-  /**
-    Junk score element. This is protected because this is supposed to
-    be handled by GUILE gc.  */
-  virtual ~Score_element ();
-  
   ///executed directly after the item is added to the Paper_score
   virtual void do_add_processing ();
   static Interval dim_cache_callback (Dimension_cache const*);
@@ -163,7 +158,7 @@ public:
   virtual void handle_prebroken_dependencies ();
 
 
-  DECLARE_SMOBS;
+  DECLARE_SMOBS(Score_element,foo);
 
   void init ();
 
index dff21977b1af843a1261d758c3127e270b6f09ae..edd1f2e60c127d24c11216b8974675570beb0cd5 100644 (file)
 
 #include "lily-guile.hh"
 
-/**
-   A smob is a C++ class with static member functions to glue it with
-   Scheme. Every instance carries SELF_SCM_, a pointer to the Scheme
-   smob of itself.  Upon destruction, SELF_SCM_ is set to SCM_EOL.
 
-   smob_free() checks if SELF_SCM_ equals its argument, so we can also
-   use a smobbified object on the stack: the destruction will happen
-   before GC hits the object.
+/*
 
-   This is discouraged, though, because it causes memory leaks, and has
-   weird semantics.
+   Each smobbed C-object may only be interfaced by a single, unique
+   smob cell. Therefore NEVER provide a public function that will
+   create a smobcell for an existing object pointer.
+
+   There are two ways to reach this goal:
+
+   simple smobs:
+
+   - Data structures that are encapsulated by GUILE. If constructed
+   through GUILE, you may only store them as protected SCMs, and may
+   not copy the pointer the object itself. Typical interface
+
+   struct Ssmob {
+   public:
+     SCM make_copy_scm () const {
+       Ssmob *sp = new Ssmob (*this);
+       return sp->smobbed_self ();
+     }
+   };
+
+   or
+
+   struct Ssmob {
+   public:
+     DECLARE_SIMPLE_SMOBS;
+     static SCM make_scm (void initdata) {
+       Ssmob * sp = new Ssmob (initdata);
+       return sp->smobbed_self();
+     }
+   private:
+     Ssmob (initdata);
+   }
+
+   Objets of type Ssmob may live on the stack, or on the heap, or as
+   part of other objects.  However, as soon as the object is smobbed,
+   by definition (by definition of the constructors, in this example),
+   lives on the heap as a separate object
    
+   - complex smobs: data structures whose identity is referenced and
+   stored both in C++ and in GUILE form. From going from C++ to GUILE,
+   you use smob_ptr->self_scm_
+
+   class Csmob {
+     DECLARE_SMOBS;
+     Csmob () { smobify_self(); }
+     Csmob (Csmob const & s) {
+       // don't copy self_scm_
+       smobify_self ();
+     }
+   };
+   
+   A complex smob is a C++ class with static member functions to glue
+   it with Scheme. Every instance carries SELF_SCM_, a pointer to the
+   unique Scheme smob cell of itself.
+
+   Upon creation, SELF_SCM_ is protected, so if you choose to store it
+   in C++ structures, you need to do
+
+   class Bla {
+   Csmob *ptr;
+   ~Bla () {  scm_unprotect_object (ptr->self_scm_); }
+   
+   };
+
+   If protection is done via GUILE, don't forget to unprotect AFTER putting
+   stuff into the GUILE datastructs
 
+
+   guile_data = gh_cons (ptr->self_scm_, guile_data);
+   ptr->self_scm_
+
+   Since GUILE takes care of the freeing the object, the destructor
+   is private.
+
+   DUMMY a thing to make sure compiles only work if this header
+   if this file is there.
+
+
+   WARNING:
+
+   smobify_self() might trigger a GC, so make sure that objects are  
+   sane when you do smobify_self().
 */
 
-#define DECLARE_SMOBS                                  \
-       SCM smobify_self ();                                    \
+#define DECLARE_SIMPLE_SMOBS(CL,dummy) \
+protected: \
+       friend class Non_existant_class ; \
+       SCM smobbed_self () const; \
+private:\
+       static long smob_tag_;                                  \
        static SCM mark_smob (SCM);                             \
        static scm_sizet free_smob (SCM s);                     \
        static int print_smob (SCM s, SCM p, scm_print_state*); \
-       static long smob_tag_;                                  \
+public: \
        static SCM equal_p (SCM a, SCM b);\
+       static CL * unsmob (SCM);\
        static void init_smobs();                               \
-       void unsmobify_self ();\
-        void do_smobify_self();\
-       SCM self_scm_;
+private:
 
 
-#ifndef SCM_CELL_TYPE
-#define SCM_CELL_TYPE(X) SCM_CAR(X)
-#endif
-
-#ifndef SCM_CELL_WORD_1
-#define SCM_CELL_WORD_1(X) SCM_CDR(X)
-#endif 
+#define DECLARE_SMOBS(CL,dummy)                                        \
+       DECLARE_SIMPLE_SMOBS(CL,dammy) \
+protected:\
+       virtual ~CL();\
+private: \
+       SCM smobify_self ();                                    \
+       SCM self_scm_; \
+public: \
+       SCM self_scm () const { return self_scm_; } \
+private:
 
-/**
-   Check if S is of the specified C++ class.
- */
-#define SMOB_IS_TYPE_B(TYPE, S)  (SCM_NIMP(S) && SCM_CELL_TYPE(S) == TYPE::smob_tag_)
 
-/// Cast S.  No checks are done.
-#define SMOB_TO_TYPE(TYPE, S)  ((TYPE*) SCM_CELL_WORD_1(S))
 #endif /* SMOBS_HH */
 
index 569a2d06143f60058d0a0651475bd629d2f990a1..53cb6d45ede5aa22e75c39c947ca22e20e0d607f 100644 (file)
 
 class Tex_font_metric_reader
 {
-public:
-  static Tex_font_metric * read_file (String name);
-  
 private:
-  Tex_font_metric_reader (Tex_font_metric *, String name);
-
   Real get_U32_fix_f ();
   Real get_U32_fix_scaled_f ();
   String get_bcpl_str ();
@@ -34,8 +29,17 @@ private:
   Tex_font_char_metric read_char ();
   void read_lig_kern_program (Array<Tfm_ligature>* ligature_arr_p, Array <Tfm_kern>* kern_arr_p);
 
-  Tex_font_metric *tfm_l_;
+
   Binary_source_file input_;
+
+public:
+  Tex_font_metric_reader ( String name);
+
+  
+  Tfm_info info_;
+  Tfm_header header_;
+  Array<Tex_font_char_metric> char_metrics_;
+  Array<int> ascii_to_metric_idx_;
 };
 
 
index 0481ad1b7e345de560414c93d49b9829ab40437e..098fbe3e912c36410fd29ba7409cfd8e86428e86 100644 (file)
@@ -148,14 +148,16 @@ struct Tex_font_char_metric
 class Tex_font_metric : public Font_metric
 {
 public:
-  Tex_font_metric ();
+  static  SCM make_tfm (String filename);
 
-  void clear (int n);
   Box get_char (int, bool) const;
   Tex_font_char_metric const *find_ascii (int ascii, bool warn=true) const;
 
   String str () const;
 
+private:
+  Tex_font_metric ();
+  
   Tfm_info info_;
   Tfm_header header_;
   Array<Tex_font_char_metric> char_metrics_;
index d9531c6dfb100eeb69c759b34ffaa4ce7c4d09c5..eac4533b4c9eee8898b416c994bff2e43e7ba7da 100644 (file)
@@ -180,8 +180,8 @@ SCM
 Item::do_derived_mark ()
 {
   if (broken_to_drul_[LEFT])
-    scm_gc_mark (broken_to_drul_[LEFT]->self_scm_);
+    scm_gc_mark (broken_to_drul_[LEFT]->self_scm ());
   if (broken_to_drul_[RIGHT])
-    scm_gc_mark (broken_to_drul_[RIGHT]->self_scm_);
+    scm_gc_mark (broken_to_drul_[RIGHT]->self_scm ());
   return SCM_EOL;
 }
index 3d104e93775104d5e74748a36bbd2cf5a32b766c..9af28cc404ac0d90858fc6ff97992a3d8e16fc22 100644 (file)
@@ -52,7 +52,7 @@ Line_of_score::typeset_element (Score_element * elem_p)
 {
   elem_p->pscore_l_ = pscore_l_;
   Pointer_group_interface (this, "all-elements").add_element (elem_p);
-  scm_unprotect_object (elem_p->self_scm_);
+  scm_unprotect_object (elem_p->self_scm ());
 }
 
 void
@@ -235,7 +235,7 @@ Line_of_score::add_column (Paper_column*p)
 
 
 
-  me->set_elt_property ("columns",  gh_cons (p->self_scm_, cs));
+  me->set_elt_property ("columns",  gh_cons (p->self_scm (), cs));
 
   Axis_group_interface::add_element (me, p);
 }
@@ -272,7 +272,7 @@ Line_of_score::pre_processing ()
       Score_element * e = unsmob_element (gh_car (s));
       SCM proc = e->get_elt_property ("spacing-procedure");
       if (gh_procedure_p (proc))
-       gh_call1 (proc, e->self_scm_);
+       gh_call1 (proc, e->self_scm ());
     }
 }
 
@@ -364,13 +364,13 @@ Line_of_score::broken_col_range (Item const*l, Item const*r) const
   r = r->column_l ();
   SCM s = get_elt_property ("columns");
 
-  while (gh_pair_p (s) && gh_car (s) != r->self_scm_)
+  while (gh_pair_p (s) && gh_car (s) != r->self_scm ())
     s = gh_cdr  (s);
     
   if (gh_pair_p (s))
     s = gh_cdr (s);
   
-  while (gh_pair_p (s) && gh_car (s) != l->self_scm_)
+  while (gh_pair_p (s) && gh_car (s) != l->self_scm ())
     {
       Paper_column*c = dynamic_cast<Paper_column*> ( unsmob_element (gh_car (s)));
       if (Item::breakable_b (c) && !c->line_l_)
index 4b7a9bdc534210762785df5bc958f378847e58c4..a6c24eddd35692b5f4f5b328090fd4d2806d00af 100644 (file)
 Lookup::Lookup ()
 {
   afm_l_ = 0;  
-  self_scm_ = SCM_EOL;
-  smobify_self ();  
 }
 
 Lookup::Lookup (Lookup const& s)
 {
   font_name_ = s.font_name_;
-  self_scm_ = SCM_EOL;
   afm_l_ = 0;
-  smobify_self ();
 }
 
 SCM
@@ -59,28 +55,16 @@ Lookup::print_smob (SCM s, SCM p, scm_print_state*)
   return 1;
 }
 
-SCM
-Lookup::equal_p (SCM a , SCM b)
-{
-  return a == b ? SCM_BOOL_T : SCM_BOOL_F;
-}
-
-void
-Lookup::do_smobify_self ()
-{
-  
-}
 
 IMPLEMENT_UNSMOB(Lookup, lookup);
-IMPLEMENT_SMOBS(Lookup);
+IMPLEMENT_SIMPLE_SMOBS(Lookup);
+IMPLEMENT_DEFAULT_EQUAL_P(Lookup);
 
 SCM
 Lookup::make_lookup ()
 {
   Lookup * l = new Lookup;
-  SCM ls = l->self_scm_;
-  scm_unprotect_object (ls);
-  return ls;
+  return l->smobbed_self();
 }
 
 
index d6e42d2cbced0d83353e119fbf25710115e6ffce..0b1f86b332836e5d207d0f9164dea67942bceb97 100644 (file)
@@ -12,8 +12,8 @@
 
 Lyric_combine_music::Lyric_combine_music (Music * m, Music * l)
 {
-  set_mus_property ("music", m->self_scm_);
-  set_mus_property ("lyrics", l->self_scm_);  
+  set_mus_property ("music", m->self_scm ());
+  set_mus_property ("lyrics", l->self_scm ());  
 }
 
 
index 6b37780158ebaf01594677c936093b670a93a6cc..0f2df8fcdf5e3b05744eb83ad47bbdfe92d6e83d 100644 (file)
@@ -64,7 +64,7 @@ Mark_engraver::acknowledge_element (Score_element_info inf)
   Score_element * s = inf.elem_l_;
   if (Staff_symbol::has_interface (s))
     {
-      staffs_ = gh_cons (inf.elem_l_->self_scm_, staffs_);
+      staffs_ = gh_cons (inf.elem_l_->self_scm (), staffs_);
     }
   else if (text_p_ && Bar::has_interface (s))
     {
index 1013399eac1b91fa8c35f01bd8e3bbd339bdffb2..f5cbd2a9529c73b869354e3c3b550fd4e3b6f3c3 100644 (file)
@@ -39,8 +39,8 @@ Midi_def::set_tempo (Moment one_beat_mom, int beats_per_minute_i)
 {
   Moment beats_per_second = Moment (beats_per_minute_i) / Moment (60);
 
-  Moment *m = new Moment (Moment(1)/Moment(beats_per_second * one_beat_mom));
-  scope_p_->set ("whole-in-seconds", smobify (m));
+  Moment m = Moment(1)/Moment(beats_per_second * one_beat_mom);
+  scope_p_->set ("whole-in-seconds", m.make_scm());
 }
 
 
index 8495cdc47068a08230cd20bcaae09b78a9895bb8..a224da0a1ca4a58ac7ec2012d0d3a7e0a791fe3b 100644 (file)
 #include "moment.hh"
 #include "warn.hh"
 
+#include "ly-smobs.icc"
+
+IMPLEMENT_UNSMOB(Moment,moment);
+IMPLEMENT_SIMPLE_SMOBS(Moment);
+
+
 SCM
 Moment::mark_smob (SCM)
 {
@@ -19,11 +25,14 @@ Moment::mark_smob (SCM)
 }
 
 
-Moment::~Moment()
+SCM
+Moment::make_scm () const
 {
-  self_scm_ = SCM_EOL;
+  Moment * m = new Moment (*this);
+  return m->smobbed_self();
 }
 
+
 int
 Moment::print_smob (SCM s, SCM port, scm_print_state *)
 {
@@ -37,35 +46,23 @@ Moment::print_smob (SCM s, SCM port, scm_print_state *)
   return 1;
 }
 
-void
-Moment::do_smobify_self ()
-{
-}
-
 SCM
 make_rational (SCM n, SCM d)
 {
-  Moment *r;
-  SCM retval = SCM_EOL;
+  Moment m (1,1);
+
   if (SCM_INUMP (n) && SCM_INUMP(d))
     {
-      r= new Moment (gh_scm2int (n), gh_scm2int (d));
+      m =  Moment (gh_scm2int (n), gh_scm2int (d));
     }
   else
     {
-      ::error ("make-moment takes two integer arguments.");
-      r = new Moment (1,1);
+      ::error ("make-moment takes two integer arguments. Using 1/1");
     }
 
-  retval = r->smobify_self ();
-  scm_unprotect_object (r->self_scm_);
-  return retval ;  
+  return m.make_scm ();
 }
 
-#include "ly-smobs.icc"
-
-IMPLEMENT_UNSMOB(Moment,moment);
-IMPLEMENT_SMOBS(Moment);
 
 void
 init_moments ()
@@ -78,8 +75,9 @@ ADD_SCM_INIT_FUNC(moms,init_moments);
 SCM
 Moment::equal_p (SCM a, SCM b)
 {
-  Moment *m1 = SMOB_TO_TYPE(Moment, a);
-  Moment *m2 = SMOB_TO_TYPE(Moment, b);
+  Moment *m1 = unsmob_moment (a);
+  Moment *m2 = unsmob_moment (b);
       
   return (*m1 == *m2) ? SCM_BOOL_T : SCM_BOOL_F;
 }
+
index d6a34e326866f05b14efcc701979e22250800554..c5d75d3a9f5ddc279748da445227d80d85effde1 100644 (file)
@@ -155,7 +155,6 @@ Multi_measure_rest_engraver::do_post_move_processing ()
 {
   Moment now (now_mom ());
   
-  
   SCM smp = get_property ("measurePosition");
   Moment mp =  (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0);
   
index aa3bc2eb352b91c5a7b818f993a8927462d554a8..32c386c323df7e3fcdcb41091ac8a6093f44564c 100644 (file)
@@ -47,7 +47,7 @@ void
 Music_sequence::append_music (Music *m)
 {
   set_mus_property ("list",
-                   gh_append2( music_list(), gh_cons (m->self_scm_, SCM_EOL)));
+                   gh_append2( music_list(), gh_cons (m->self_scm (), SCM_EOL)));
 }
 Music_sequence::Music_sequence(SCM h)
 {
index 59d3c43441064334e4aad394820672088ab82254..641c83b91ba32d5256186f79230a6d95deeaa95a 100644 (file)
@@ -27,7 +27,7 @@ Music_wrapper::transpose (Musical_pitch p)
 
 Music_wrapper::Music_wrapper(Music*p)
 {
-  set_mus_property ("element", p->self_scm_);
+  set_mus_property ("element", p->self_scm ());
 }
 
 Moment
index 536082211ea68e117c587f2a1c4716d0229aebda..8ce821e0124a6685535ec471a33dcbd6b92bf95b 100644 (file)
@@ -18,11 +18,13 @@ ly_deep_mus_copy (SCM m)
 {
   if (unsmob_music (m))
     {
-      return unsmob_music (m)->clone ()->self_scm_;
+      SCM ss =  unsmob_music (m)->clone ()->self_scm ();
+      scm_unprotect_object (ss);
+      return ss;
     }
   else if (gh_pair_p (m))
     {
-      return gh_cons (ly_deep_copy (gh_car (m)), ly_deep_copy (gh_cdr (m)));
+      return gh_cons (ly_deep_mus_copy (gh_car (m)), ly_deep_mus_copy (gh_cdr (m)));
     }
   else
     return m;
@@ -31,7 +33,6 @@ ly_deep_mus_copy (SCM m)
 
 Music::Music (Music const &m)
 {
-  self_scm_ = SCM_EOL;
   immutable_property_alist_ = m.immutable_property_alist_;
   SCM c =ly_deep_mus_copy (m.mutable_property_alist_);
   mutable_property_alist_ = c;
@@ -44,7 +45,6 @@ Music::Music (Music const &m)
 
 Music::Music()
 {
-  self_scm_ = SCM_EOL;
   immutable_property_alist_ = SCM_EOL;
   mutable_property_alist_ = SCM_EOL;
   smobify_self ();
@@ -53,10 +53,10 @@ Music::Music()
 SCM
 Music::mark_smob (SCM m)
 {
-  Music * mus = SMOB_TO_TYPE (Music, m);
+  Music * mus = (Music *)SCM_CELL_WORD_1(m);
   scm_gc_mark (mus->immutable_property_alist_);
   scm_gc_mark (mus->mutable_property_alist_);
-  return mus->do_derived_mark ();
+  return SCM_EOL;
 }
 
 void    
@@ -99,6 +99,7 @@ Music::transpose (Musical_pitch )
 
 IMPLEMENT_UNSMOB(Music,music);
 IMPLEMENT_SMOBS(Music);
+IMPLEMENT_DEFAULT_EQUAL_P(Music);
 
 /****************************/
 
@@ -175,21 +176,13 @@ Music::origin () const
   return ip ? ip : & dummy_input_global; 
 }
 
-SCM
-Music::do_derived_mark ()
-{
-  return SCM_EOL;
-}
 
 void
 Music::print ()const
 {
 }
 
-void
-Music::do_smobify_self ()
-{
-}
+
 
 Music::~Music ()
 {
index 3e4bbb602b96b022c0b277055689e60b2369b915..f77e59a4dfcfa7214a94bd5a1edebf2faf40410a 100644 (file)
@@ -126,14 +126,14 @@ My_lily_parser::get_chord (Musical_pitch tonic,
     {
       Inversion_req* i = new Inversion_req;
       i->pitch_ = chord.inversion_pitch_;
-      l = gh_cons (i->self_scm_, l);
+      l = gh_cons (i->self_scm (), l);
     }
 
   if (chord.bass_b_)
     {
       Bass_req* b = new Bass_req;
       b->pitch_ = chord.bass_pitch_;
-      l = gh_cons (b->self_scm_, l);      
+      l = gh_cons (b->self_scm (), l);      
     }
 
   Array<Musical_pitch> pitch_arr = chord.to_pitch_arr ();
@@ -143,7 +143,7 @@ My_lily_parser::get_chord (Musical_pitch tonic,
       Note_req* n = new Note_req;
       n->pitch_ = p;
       n->duration_ = d;
-      l = gh_cons (n->self_scm_, l);
+      l = gh_cons (n->self_scm (), l);
     }
 
   Simultaneous_music*v = new Request_chord (l);
index 473c0146636dbcff21dd5d5e5c27df7ffa40b342..f9711fc9549ca057bb6cb013cb3e66f258a604ac 100644 (file)
@@ -86,7 +86,7 @@ Note_column::dir (Score_element*  me)
 void
 Note_column::set_stem (Score_element*me,Score_element * stem_l)
 {
-  me->set_elt_property ("stem", stem_l->self_scm_);
+  me->set_elt_property ("stem", stem_l->self_scm ());
   me->add_dependency (stem_l);
   Axis_group_interface::add_element (me, stem_l);
 }
@@ -96,7 +96,7 @@ Note_column::add_head (Score_element*me,Score_element *h)
 {
   if (Rest::has_interface (h))
     {
-      me->set_elt_property ("rest", h->self_scm_);
+      me->set_elt_property ("rest", h->self_scm ());
     }
   else if (Note_head::has_interface (h))
     {
index 40036ec0af177d3055ea5382bda806b5c7894461..b20f3d7ca2bc0ed14fa39b2df47bef3e1e4eb750 100644 (file)
@@ -48,7 +48,7 @@ Output_property_engraver::acknowledge_element (Score_element_info inf)
        should typecheck pred. 
        */
       SCM result=gh_apply (pred,
-                          gh_list (inf.elem_l_->self_scm_, SCM_UNDEFINED));
+                          gh_list (inf.elem_l_->self_scm (), SCM_UNDEFINED));
       if (to_boolean (result))
        {
          SCM sym = o->get_mus_property ("symbol");
index d90d5b305bc8eb37fea2894a781a88873ddb4d78..698daf4585f39c01089ca15f10203fe7492463ba 100644 (file)
@@ -87,9 +87,10 @@ Paper_def::line_dimensions_int (int n) const
 }
 
 void
-Paper_def::set_lookup (int i, Lookup*l)
+Paper_def::set_lookup (int i, SCM l)
 {
-  lookup_alist_ = scm_assq_set_x(lookup_alist_, gh_int2scm (i), l->self_scm_);
+  assert (unsmob_lookup (l));
+  lookup_alist_ = scm_assq_set_x(lookup_alist_, gh_int2scm (i), l);
 }
 
 
index ec2c83f65f0f0052a5b7bc62785d030c101183c3..9c13a867eacf3556eac97c61bdce22f09d745e5d 100644 (file)
@@ -38,11 +38,11 @@ Paper_score::typeset_line (Line_of_score *l)
     {
       line_l_ = l;             // ugh.
     }
-  main_smob_ = gh_cons (l->self_scm_, main_smob_);
+  main_smob_ = gh_cons (l->self_scm (), main_smob_);
   l->pscore_l_ = this;
 
   /*
-    We don't unprotect l->self_scm_, we haven't got any place else to
+    We don't unprotect l->self_scm (), we haven't got any place else to
     protect it from collection.  */
 
 }
index 8ce72cb8855b8290ed6afd22ef26d150043a8bae..5c4632ac7227f192e5c9415944f9072a60792b34 100644 (file)
@@ -289,9 +289,9 @@ toplevel_expression:
                Identifier * id = new
                        Music_output_def_identifier ($1, MUSIC_OUTPUT_DEF_IDENTIFIER);
                if (dynamic_cast<Paper_def*> ($1))
-                       THIS->lexer_p_->set_identifier ("$defaultpaper", smobify (id));
+                       THIS->lexer_p_->set_identifier ("$defaultpaper", id->self_scm ());
                else if (dynamic_cast<Midi_def*> ($1))
-                       THIS->lexer_p_->set_identifier ("$defaultmidi", smobify (id));
+                       THIS->lexer_p_->set_identifier ("$defaultmidi", id->self_scm ());
        }
        | embedded_scm {
                // junk value
@@ -357,8 +357,17 @@ assignment:
                THIS->remember_spot ();
        }
        /* cont */ '=' identifier_init  {
-           THIS->lexer_p_->set_identifier (ly_scm2string ($1), $4);
+               THIS->lexer_p_->set_identifier (ly_scm2string ($1), $4);
 
+/*
+ TODO: devise standard for protection in parser.
+               if (SCM_NIMP($4))
+                       scm_unprotect_object ($4);
+
+  The parser stack lives on the C-stack, which means that
+all objects can be unprotected as soon as they're here.
+
+*/
                Identifier * id =unsmob_identifier ($4);
                Input spot = THIS->pop_spot ();
                if (id) id->set_spot (spot);
@@ -369,24 +378,22 @@ assignment:
 
 identifier_init:
        score_block {
-               $$ = smobify (new Score_identifier ($1, SCORE_IDENTIFIER));
+               $$ = (new Score_identifier ($1, SCORE_IDENTIFIER))->self_scm();
        }
        | output_def {
-               $$ = smobify (new Music_output_def_identifier ($1, MUSIC_OUTPUT_DEF_IDENTIFIER));
+               $$ = (new Music_output_def_identifier ($1, MUSIC_OUTPUT_DEF_IDENTIFIER))->self_scm();
        }
        | translator_spec_block {
-               $$ = smobify (new Translator_group_identifier ($1, TRANS_IDENTIFIER));
+               $$ = (new Translator_group_identifier ($1, TRANS_IDENTIFIER))->self_scm();
        }
        | Music  {
-               $$ = $1->self_scm_;
-               scm_unprotect_object ($$);
+               $$ = $1->self_scm ();
        }
        | post_request {
-               $$ = $1->self_scm_;
-               scm_unprotect_object ($$);
+               $$ = $1->self_scm ();
        }
        | explicit_duration {
-               $$ = smobify (new Duration_identifier ($1, DURATION_IDENTIFIER));
+               $$ = (new Duration_identifier ($1, DURATION_IDENTIFIER))->self_scm ();
        }
        | number_expression {
                $$ = $1;
@@ -477,8 +484,8 @@ score_body:
                $$ = new Score;
 
                $$->set_spot (THIS->here_input ());
-               SCM m = $1->self_scm_;
-               scm_unprotect_object (m);
+               SCM m = $1->self_scm ();
+//             scm_unprotect_object (m);
                $$->music_ = m;
        }
        | SCORE_IDENTIFIER {
@@ -554,9 +561,10 @@ music_output_def_body:
                dynamic_cast<Midi_def*> ($$)->set_tempo ($2->dur_.length_mom (), $2->metronome_i_);
        }
        | music_output_def_body bare_int '=' FONT STRING                { // ugh, what a syntax
-               Lookup * l =unsmob_lookup (Lookup::make_lookup());
+               SCM sl = Lookup::make_lookup();
+               Lookup * l =unsmob_lookup (sl);
                l->font_name_ = ly_scm2string ($5);
-               dynamic_cast<Paper_def*> ($$)->set_lookup ($2, l);
+               dynamic_cast<Paper_def*> ($$)->set_lookup ($2, sl);
        }
        | music_output_def_body error {
 
@@ -577,8 +585,8 @@ Music_list: /* empty */ {
        }
        | Music_list Music {
                SCM s = $$;
-               SCM c = gh_cons ($2->self_scm_, SCM_EOL);
-               scm_unprotect_object ($2->self_scm_); /* UGH */
+               SCM c = gh_cons ($2->self_scm (), SCM_EOL);
+//             scm_unprotect_object ($2->self_scm ()); /* UGH */
 
        
                if (gh_pair_p (gh_cdr (s)))
@@ -817,14 +825,15 @@ request_chord:
 
 command_element:
        command_req {
-               $$ = new Request_chord (gh_cons ($1->self_scm_, SCM_EOL));
+               $$ = new Request_chord (gh_cons ($1->self_scm (), SCM_EOL));
                $$-> set_spot (THIS->here_input ());
                $1-> set_spot (THIS->here_input ());
        }
        | PARTIAL duration_length ';'   {
                Translation_property * p = new Translation_property;
                p->set_mus_property ("symbol", ly_symbol2scm ( "measurePosition"));
-               p->set_mus_property ("value", (new Moment (-$2->length_mom ()))->smobify_self ());
+               Moment m = - $2->length_mom ();
+               p->set_mus_property ("value", m.make_scm());
                delete $2; // ugh
                Context_specced_music * sp = new Context_specced_music (p);
                $$ =sp ;
@@ -1274,7 +1283,7 @@ simple_element:
                n->forceacc_b_ = $2 % 2 || n->cautionary_b_;
 
 
-               Simultaneous_music*v = new Request_chord (gh_list (n->self_scm_, SCM_UNDEFINED));
+               Simultaneous_music*v = new Request_chord (gh_list (n->self_scm (), SCM_UNDEFINED));
                v->set_spot ($1->spot ());
                n->set_spot ($1->spot ());
                $$ = v;
@@ -1291,14 +1300,14 @@ simple_element:
                      skip_p->duration_ = *$2;
 
                      skip_p->set_spot (THIS->here_input());
-                       e = skip_p->self_scm_;
+                       e = skip_p->self_scm ();
                    }
                  else
                    {
                      Rest_req * rest_req_p = new Rest_req;
                      rest_req_p->duration_ = *$2;
                      rest_req_p->set_spot (THIS->here_input());
-                       e = rest_req_p->self_scm_;
+                       e = rest_req_p->self_scm ();
                    }
                  Simultaneous_music* velt_p = new Request_chord (gh_list (e,SCM_UNDEFINED));
                  velt_p->set_spot (THIS->here_input());
@@ -1317,11 +1326,11 @@ simple_element:
                sp2-> span_dir_ = STOP;
                sp1->span_type_str_ = sp2->span_type_str_ = "rest";
 
-               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 (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));;
 
-               SCM ms = gh_list (rqc1->self_scm_, rqc2->self_scm_, rqc3->self_scm_, SCM_UNDEFINED);
+               SCM ms = gh_list (rqc1->self_scm (), rqc2->self_scm (), rqc3->self_scm (), SCM_UNDEFINED);
 
                $$ = new Sequential_music (ms);
        }
@@ -1332,7 +1341,7 @@ simple_element:
                lreq_p ->text_str_ = ly_scm2string ($1);
                lreq_p->duration_ = *$2;
                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 (gh_list (lreq_p->self_scm (), SCM_UNDEFINED));
 
                delete  $2; // ugh
                $$= velt_p;
index cb9c413a9dacc9aedb75609d9d476f70a62d280b..f1a6ae4011d00daaf127246ca0c6f8df850a264b 100644 (file)
@@ -34,7 +34,7 @@ void
 Pointer_group_interface::add_element (Score_element*p) 
 {
   elt_l_->set_elt_property (name_.ch_C(),
-                          gh_cons (p->self_scm_,
+                          gh_cons (p->self_scm (),
                                    elt_l_->get_elt_property (name_.ch_C())));
 }
 
index 35d19d162a5e2580603f9ca8c5c45b9f37738d14..c6e54302637fb1b2523d54014a2cddef262cd8e5 100644 (file)
@@ -19,24 +19,47 @@ class Property_engraver : public Engraver
   /*
     UGH. Junk Dictionary
   */
-  Scheme_hash_table prop_dict_;        // junkme
+  Scheme_hash_table *prop_dict_;       // junkme
   void apply_properties (SCM, Score_element*);
 
 protected:
   virtual void acknowledge_element (Score_element_info ei);
   virtual void do_creation_processing ();
-
+  virtual void do_removal_processing ();
+public:
+  ~Property_engraver();
+  Property_engraver();
   VIRTUAL_COPY_CONS(Translator);
 };
 
+
+
+Property_engraver::Property_engraver()
+{
+  prop_dict_ = 0;
+}
+void
+Property_engraver::do_removal_processing()
+{
+  
+}
+
+Property_engraver::~Property_engraver ()
+{
+  if (prop_dict_)
+    scm_unprotect_object (prop_dict_->self_scm ());
+}
+
 void
 Property_engraver::do_creation_processing ()
 {
+  prop_dict_ = new Scheme_hash_table;
+
   SCM plist = get_property ("Generic_property_list");
   for (; gh_pair_p (plist); plist = gh_cdr (plist))
     {
       SCM elt_props = gh_car (plist);
-      prop_dict_.set (gh_car (elt_props), gh_cdr (elt_props));
+      prop_dict_->set (gh_car (elt_props), gh_cdr (elt_props));
     }
 }
 
@@ -47,13 +70,13 @@ Property_engraver::acknowledge_element (Score_element_info i)
   SCM props;
   for (; gh_pair_p (ifs); ifs = gh_cdr (ifs))
     {      
-      if (prop_dict_.try_retrieve (gh_car (ifs), &props))
+      if (prop_dict_->try_retrieve (gh_car (ifs), &props))
        {
          apply_properties (props,i.elem_l_);
        }
     }
 
-  if (prop_dict_.try_retrieve (ly_symbol2scm ("all"), &props))
+  if (prop_dict_->try_retrieve (ly_symbol2scm ("all"), &props))
     {
       apply_properties (props, i.elem_l_);
     }
index f2e9b77daae147c1212967f29a1609bd511d2f0b..2e8e0e3d0204ece0397d25e1b17a86c6d2ffebd6 100644 (file)
@@ -26,14 +26,14 @@ Repeated_music::alternatives ()const
 
 Repeated_music::Repeated_music(Music *beg, int times, Music_sequence * alts)
 {
-  set_mus_property ("body", beg->self_scm_);
+  set_mus_property ("body", beg->self_scm ());
   fold_b_ = false;
   repeats_i_ = times;
   volta_fold_b_ = true;
   if (alts)
     {
       alts->truncate (times);
-      set_mus_property ("alternatives", alts->self_scm_);
+      set_mus_property ("alternatives", alts->self_scm ());
     }
 }
 
index 5427a20c6ddf74507c726d48bd50fad14227cdaa..6429df3684cbdb10f4d1d98bfe1df3f44e9fd2ce 100644 (file)
@@ -48,7 +48,7 @@ Rest_collision::add_column (Score_element*me,Score_element *p)
   gi.add_element (p);
 
   p->add_offset_callback (&Rest_collision::force_shift_callback, Y_AXIS);
-  p->set_elt_property ("rest-collision", me->self_scm_);
+  p->set_elt_property ("rest-collision", me->self_scm ());
 }
 
 static SCM
index 63006674fce24236e9fbea65d6eca5ddb9d51984..cf188631529d4b35566cb3265218bfa0139895bc 100644 (file)
@@ -51,7 +51,7 @@ Rhythmic_head::dot_count (Score_element*me)
 void
 Rhythmic_head::set_dots (Score_element*me,Item *dot_l)
 {
-  me->set_elt_property ("dot", dot_l->self_scm_);
+  me->set_elt_property ("dot", dot_l->self_scm ());
 }
 
 
index 98c430b3ebe7a3a3e9b788bf882f74016b40a241..16c59747376ed9c2fe32d86686867ca2d1426a4b 100644 (file)
 
 Scheme_hash_table::Scheme_hash_table ()
 {
-  self_scm_ = SCM_EOL;
+  smobify_self ();
+}
+
+
+Scheme_hash_table::Scheme_hash_table (Scheme_hash_table const &src)
+  : Scm_stl_map (src)
+{
   smobify_self ();
 }
 
@@ -23,13 +29,10 @@ Scheme_hash_table::operator =(Scheme_hash_table const & src)
 {
   Scm_stl_map::operator = (src);
        
-  // we do not copy the self_scm_ field!
+  // we do not copy the self_scm () field!
 }
 
-void
-Scheme_hash_table::do_smobify_self ()
-{
-}
+
 
 
 SCM
@@ -39,7 +42,7 @@ Scheme_hash_table::mark_smob (SCM s)
     can't typecheck naively, since GC bit lives in CAR of S
    */
   
-  Scheme_hash_table *me = SMOB_TO_TYPE(Scheme_hash_table,s);
+  Scheme_hash_table *me = (Scheme_hash_table*) SCM_CELL_WORD_1(s);
 
   for (Scm_stl_map::const_iterator i= me->begin (); i != me->end(); i++)
     {
@@ -49,22 +52,14 @@ Scheme_hash_table::mark_smob (SCM s)
   return SCM_EOL;
 }
 
-
-Scheme_hash_table::Scheme_hash_table (Scheme_hash_table const &src)
-  : Scm_stl_map (src)
-{
-  self_scm_ = SCM_EOL;
-  smobify_self ();
-}
-
 int
 Scheme_hash_table::print_smob (SCM s, SCM p, scm_print_state*)
 {
-  assert (SMOB_IS_TYPE_B (Scheme_hash_table, s));
+  assert (unsmob (s));
   char str[1000];
   sprintf (str, "#<Scheme_hash_table 0x%0x ", s);
   scm_puts (str, p);      
-  Scheme_hash_table *me = SMOB_TO_TYPE(Scheme_hash_table,s);
+  Scheme_hash_table *me = unsmob(s);
   for (Scm_stl_map::const_iterator i = me->begin (); i != me->end(); i++)
     {
       scm_display ((*i).first, p);
@@ -109,7 +104,6 @@ Scheme_hash_table::get (SCM k)const
 
 Scheme_hash_table::~Scheme_hash_table( )
 {
-  unsmobify_self ();
 }
 
 SCM
@@ -125,5 +119,6 @@ Scheme_hash_table::to_alist () const
 #include "ly-smobs.icc"
 IMPLEMENT_UNSMOB(Scheme_hash_table,scheme_hash);
 IMPLEMENT_SMOBS(Scheme_hash_table);
+IMPLEMENT_DEFAULT_EQUAL_P(Scheme_hash_table);
 
 
index c04878f93404c54865193ea6e60014e9224185df..85837e5d0979ca048aa9872620b6d74bb1bf9e6a 100644 (file)
 
 Scope::~Scope ()
 {
-  delete id_dict_;
+  scm_unprotect_object (id_dict_->self_scm ());
 }
 
 Scope::Scope (Scope const&s)
-  : id_dict_ (new Scheme_hash_table (*s.id_dict_))
 {
+  id_dict_ =new Scheme_hash_table (*s.id_dict_);
 }
 
 Scope::Scope ()
@@ -72,7 +72,7 @@ Scope::set (String s, SCM id)
 void
 Scope::set (String s, Identifier * id) 
 {
-  return id_dict_->set (ly_symbol2scm (s.ch_C()), smobify (id));
+  return id_dict_->set (ly_symbol2scm (s.ch_C()), id->self_scm ());
 }
 
 SCM
index 451c1f40be1a8451c80e802f160f600be6f82814..e1c218d1bf4440dbd66ae30e4b1772dda7fde75a 100644 (file)
@@ -49,7 +49,6 @@ Score_element::Score_element(SCM basicprops)
   pscore_l_=0;
   lookup_l_ =0;
   status_i_ = 0;
-  self_scm_ = SCM_EOL;
   original_l_ = 0;
   immutable_property_alist_ =  basicprops;
   mutable_property_alist_ = SCM_EOL;
@@ -65,7 +64,6 @@ Score_element::Score_element(SCM basicprops)
 Score_element::Score_element (Score_element const&s)
    : dim_cache_ (s.dim_cache_)
 {
-  self_scm_ = SCM_EOL;
   original_l_ =(Score_element*) &s;
   immutable_property_alist_ = s.immutable_property_alist_;
   mutable_property_alist_ = SCM_EOL;
@@ -236,7 +234,7 @@ Score_element::calculate_dependencies (int final, int busy, SCM funcname)
   String s = ly_symbol2string (funcname);
   SCM proc = get_elt_property (s.ch_C());
   if (gh_procedure_p (proc))
-    gh_call1 (proc, this->self_scm_);
+    gh_call1 (proc, this->self_scm ());
   
   status_i_= final;
 
@@ -249,7 +247,7 @@ Score_element::get_molecule ()  const
 
   SCM mol = SCM_EOL;
   if (gh_procedure_p (proc)) 
-    mol = gh_apply (proc, gh_list (this->self_scm_, SCM_UNDEFINED));
+    mol = gh_apply (proc, gh_list (this->self_scm (), SCM_UNDEFINED));
 
 
   SCM origin =get_elt_property ("origin");
@@ -345,7 +343,7 @@ Score_element::handle_broken_smobs (SCM src, SCM criterion)
          if (i && i->break_status_dir () != d)
            {
              Item *br = i->find_prebroken_piece (d);
-             return  (br) ? br->self_scm_ : SCM_UNDEFINED;
+             return  (br) ? br->self_scm () : SCM_UNDEFINED;
            }
        }
       else
@@ -367,7 +365,7 @@ Score_element::handle_broken_smobs (SCM src, SCM criterion)
              || (sc->common_refpoint (line, X_AXIS)
                  && sc->common_refpoint (line, Y_AXIS)))
            {
-             return sc->self_scm_;
+             return sc->self_scm ();
            }
          return SCM_UNDEFINED;
        }
@@ -419,7 +417,7 @@ Score_element::handle_broken_dependencies()
          Line_of_score * l = sc->line_l ();
          sc->mutable_property_alist_ =
            handle_broken_smobs (mutable_property_alist_,
-                                l ? l->self_scm_ : SCM_UNDEFINED);
+                                l ? l->self_scm () : SCM_UNDEFINED);
        }
     }
 
@@ -430,7 +428,7 @@ Score_element::handle_broken_dependencies()
     {
       mutable_property_alist_
        = handle_broken_smobs (mutable_property_alist_,
-                              line ? line->self_scm_ : SCM_UNDEFINED);
+                              line ? line->self_scm () : SCM_UNDEFINED);
     }
   else if (dynamic_cast <Line_of_score*> (this))
     {
@@ -712,26 +710,22 @@ Score_element::fixup_refpoint (SCM smob)
 
 IMPLEMENT_UNSMOB(Score_element, element);
 IMPLEMENT_SMOBS(Score_element);
+IMPLEMENT_DEFAULT_EQUAL_P(Score_element);
 
 SCM
 Score_element::mark_smob (SCM ses)
 {
-  Score_element * s = SMOB_TO_TYPE (Score_element, ses);
-  if (s->self_scm_ != ses)
-    {
-      programming_error ("SMOB marking gone awry");
-      return SCM_EOL;
-    }
+  Score_element * s = (Score_element*) SCM_CELL_WORD_1(ses);
   scm_gc_mark (s->immutable_property_alist_);
   scm_gc_mark (s->mutable_property_alist_);
   
   if (s->parent_l (Y_AXIS))
-    scm_gc_mark (s->parent_l (Y_AXIS)->self_scm_);
+    scm_gc_mark (s->parent_l (Y_AXIS)->self_scm ());
   if (s->parent_l (X_AXIS))
-    scm_gc_mark (s->parent_l (X_AXIS)->self_scm_);
+    scm_gc_mark (s->parent_l (X_AXIS)->self_scm ());
 
   if (s->original_l_)
-    scm_gc_mark (s->original_l_->self_scm_);
+    scm_gc_mark (s->original_l_->self_scm ());
   return s->do_derived_mark ();
 }
 
@@ -756,17 +750,6 @@ Score_element::do_derived_mark ()
   return SCM_EOL;
 }
 
-void
-Score_element::do_smobify_self ()
-{
-}
-
-SCM
-Score_element::equal_p (SCM a, SCM b)
-{
-  return gh_cdr(a) == gh_cdr(b) ? SCM_BOOL_T : SCM_BOOL_F;
-}
-
 
 SCM
 ly_set_elt_property (SCM elt, SCM sym, SCM val)
@@ -822,7 +805,7 @@ Score_element::discretionary_processing()
 SCM
 spanner_get_bound (SCM slur, SCM dir)
 {
-  return dynamic_cast<Spanner*> (unsmob_element (slur))->get_bound (to_dir (dir))->self_scm_;
+  return dynamic_cast<Spanner*> (unsmob_element (slur))->get_bound (to_dir (dir))->self_scm ();
 }
 
 
index c360b9964934f975c89ab5e483f3189b8aee287b..80ad78157a8fea3c180ebaf92b7911a18b58faad 100644 (file)
@@ -35,9 +35,8 @@ Score_engraver::prepare (Moment w)
   SCM props = get_property (ly_symbol2scm ("basicPaperColumnProperties"));
   set_columns (new Paper_column (props),  new Paper_column (props));
   
-  SCM when = smobify (new Moment (w));
-  command_column_l_->set_elt_property ("when", when);
-  musical_column_l_->set_elt_property ("when", when);
+  command_column_l_->set_elt_property ("when", w.make_scm());
+  musical_column_l_->set_elt_property ("when", w.make_scm());
   command_column_l_->set_elt_property ("breakable", SCM_BOOL_T);
   
   Score_element_info i1(command_column_l_, 0), i2 (musical_column_l_,0);
@@ -206,9 +205,9 @@ Score_engraver::set_columns (Paper_column *new_command_l,
     }
 
   if (new_musical_l)
-    set_property ("currentMusicalColumn", new_musical_l->self_scm_);
+    set_property ("currentMusicalColumn", new_musical_l->self_scm ());
   if (new_command_l)
-    set_property ("currentCommandColumn", new_command_l->self_scm_);  
+    set_property ("currentCommandColumn", new_command_l->self_scm ());  
 }
 
 Music_output*
index 8a4e348d0d46d65b44bd9ab95e4fd6df2aec6fed..75e397aab8a9686fdedfe48f88944e3b264a0a1a 100644 (file)
@@ -39,7 +39,7 @@ Score::Score (Score const &s)
   : Input (s)
 {
   Music * m =unsmob_music (s.music_);
-  music_ =  m?m->clone()->self_scm_ : SCM_EOL;
+  music_ =  m?m->clone()->self_scm () : SCM_EOL;
   for (int i=0; i < s.def_p_arr_.size (); i++)
     def_p_arr_.push(s.def_p_arr_[i]->clone());
   errorlevel_i_ = s.errorlevel_i_;
index db95e855f47163e67171f40afc89502f563d161e..3f47d8f7142715cd294bb8e14905a6531ce97851 100644 (file)
@@ -128,7 +128,7 @@ Script_engraver::acknowledge_element (Score_element_info inf)
        {
          Score_element*e = script_p_arr_[i];
 
-         e->set_elt_property ("direction-source", inf.elem_l_->self_scm_);
+         e->set_elt_property ("direction-source", inf.elem_l_->self_scm ());
          Side_position::add_support (e, inf.elem_l_);
        }
     }
index 7613471c7f66dc9a50b15b7da8951991f6c2b876..d740483ac8016287c4f8d7fc30c33740d829096b 100644 (file)
@@ -38,9 +38,9 @@ Separation_item::my_width (Score_element *me)
   for (SCM s =  me->get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s))
     {
       SCM elt = gh_car (s);
-      if (!SMOB_IS_TYPE_B(Score_element, elt))
+      if (!unsmob_element (elt))
        continue;
-      
+
       Item *il = dynamic_cast<Item*> (unsmob_element (elt));
       if (pc != il->column_l ())
        {
index 19cabbc6c1d29a117ffade4201b08ed8f4be3fd0..ccad52d81cd9172fdc879cacb1180f2923cbcaf2 100644 (file)
@@ -177,7 +177,7 @@ Slur::set_extremities (Score_element*me)
          for (SCM s = scm_eval (ly_symbol2scm ("slur-extremity-rules"));
               s != SCM_EOL; s = gh_cdr (s))
            {
-             SCM r = gh_call2 (gh_caar (s), me->self_scm_,
+             SCM r = gh_call2 (gh_caar (s), me->self_scm (),
                                 gh_int2scm ((int)dir));
              if (r != SCM_BOOL_F)
                {
index 6bc4c1893fd31866d6af70203de01832a43b8428..b11f9842184203c10f3f954037c9027982302513 100644 (file)
@@ -27,7 +27,7 @@ Spaceable_element::add_rod (Score_element *me , Score_element * p, Real d)
   for (SCM s = mins; gh_pair_p (s); s = gh_cdr (s))
     {
       SCM dist = gh_car (s);
-      if (gh_car (dist) == p->self_scm_)
+      if (gh_car (dist) == p->self_scm ())
        {
          gh_set_cdr_x (dist, scm_max (gh_cdr (dist),
                                       newdist));
@@ -35,7 +35,7 @@ Spaceable_element::add_rod (Score_element *me , Score_element * p, Real d)
        }
     }
 
-  mins = gh_cons (gh_cons (p->self_scm_, newdist), mins);
+  mins = gh_cons (gh_cons (p->self_scm (), newdist), mins);
   me->set_elt_property ("minimum-distances", mins);
 }
 
@@ -47,7 +47,7 @@ Spaceable_element::add_spring (Score_element*me, Score_element * p, Real d, Real
   for (SCM s = mins; gh_pair_p (s); s = gh_cdr (s))
     {
       SCM dist = gh_car (s);
-      if (gh_car (dist) == p->self_scm_)
+      if (gh_car (dist) == p->self_scm ())
        {
          programming_error("already have that spring");
          return ;
@@ -55,7 +55,7 @@ Spaceable_element::add_spring (Score_element*me, Score_element * p, Real d, Real
     }
   SCM newstrength= gh_double2scm (strength);  
   
-  mins = gh_cons (gh_cons (p->self_scm_, gh_cons (newdist, newstrength)), mins);
+  mins = gh_cons (gh_cons (p->self_scm (), gh_cons (newdist, newstrength)), mins);
   me->set_elt_property ("ideal-distances", mins);
 }
 
index de4be78cb2b24c9f304af1ade18a8d13f3eddc88..7578fa007306c13f26326188e3c4b31f55666e4b 100644 (file)
@@ -138,8 +138,8 @@ Spacing_engraver::do_pre_move_processing ()
   Paper_column * sc
     = dynamic_cast<Paper_column*> (unsmob_element (get_property ("currentMusicalColumn")));
 
-  SCM sh = smobify (new Moment (shortest_playing));
-  SCM st = smobify (new Moment (starter));
+  SCM sh = shortest_playing.make_scm( );
+  SCM st = starter.make_scm();
 
   sc->set_elt_property ("shortest-playing-duration", sh);  
   sc->set_elt_property ("shortest-starter-duration", st);
index d83d58e725eaecfddd8b1d8642418452dee68af1..5ad98d494ecf7f6b5227e2a1e0726d2240dfbdd9 100644 (file)
@@ -54,7 +54,7 @@ Spacing_spanner::do_measure (Score_element*me, Link_array<Score_element> cols)
       if (dynamic_cast<Paper_column*> (cols[i])->musical_b ())
        {
          SCM  st = cols[i]->get_elt_property ("shortest-starter-duration");
-         Moment this_shortest = (*SMOB_TO_TYPE(Moment, st));
+         Moment this_shortest = *unsmob_moment(st);
          shortest = shortest <? this_shortest;
          if (!mean_shortest.infty_b ())
            {
index 5c8f4a1977699ba5ddcbc360e8afd8a0ab29fd96..04387ef9f702f89d4dee623f6d19d69452bc2a9b 100644 (file)
@@ -271,11 +271,11 @@ Spanner::do_derived_mark ()
   Direction d = LEFT;
   do
     if (spanned_drul_[d])
-      scm_gc_mark (spanned_drul_[d]->self_scm_);
+      scm_gc_mark (spanned_drul_[d]->self_scm ());
   while (flip (&d) != LEFT);
 
   for (int i= broken_into_l_arr_.size () ; i--;)
-    scm_gc_mark (broken_into_l_arr_[i]->self_scm_);
+    scm_gc_mark (broken_into_l_arr_[i]->self_scm ());
 
   return SCM_EOL;
 }
index d5fb4860f227987f1a723af0a4c0c7aa58bb9910..410cbac927eedb45b81705bc6b15c520df7474e8 100644 (file)
@@ -70,7 +70,7 @@ Staff_symbol_engraver::do_removal_processing()
 void
 Staff_symbol_engraver::acknowledge_element (Score_element_info s)
 {
-  s.elem_l_->set_elt_property ("staff-symbol", span_p_->self_scm_);
+  s.elem_l_->set_elt_property ("staff-symbol", span_p_->self_scm ());
   s.elem_l_->add_dependency (span_p_); // UGH. UGH. UGH 
 }
 
index fff6f5c056729e2aadd355b67fd8601ca95728ea..fc0ed1023f31f51ff49c0c2eacfb60344a46e430 100644 (file)
@@ -126,6 +126,6 @@ Stem_tremolo::brew_molecule (SCM smob)
 void
 Stem_tremolo::set_stem (Score_element*me,Score_element *s)
 {
-  me->set_elt_property ("stem", s->self_scm_);
+  me->set_elt_property ("stem", s->self_scm ());
 }
 
index 9a0f2b468881c936591192ce256989e312e99811..9332b6532d515b313947d1107719c438c44d69d2 100644 (file)
@@ -200,7 +200,7 @@ Stem::extremal_heads (Score_element*me)
 void
 Stem::add_head (Score_element*me, Score_element *n)
 {
-  n->set_elt_property ("stem", me->self_scm_);
+  n->set_elt_property ("stem", me->self_scm ());
   n->add_dependency (me);
 
   if (Note_head::has_interface (n))
@@ -209,7 +209,7 @@ Stem::add_head (Score_element*me, Score_element *n)
     }
   else
     {
-      n->set_elt_property ("rest", n->self_scm_);
+      n->set_elt_property ("rest", n->self_scm ());
     }
 }
 
index 7bc495b49bd29340133da4c8844633b1a0eb9e86..f188e300c2a4cdee48a70fec22f679b480c6ea0d 100644 (file)
 static const Real fix_to_real (Fix f);
 
 
-Tex_font_metric_reader::Tex_font_metric_reader (Tex_font_metric* fp, String name)
+Tex_font_metric_reader::Tex_font_metric_reader (String name)
   : input_ (name)
 {
-  tfm_l_=fp;
-  tfm_l_->clear (TFM_SIZE);
+  
+  for (int i=0; i < TFM_SIZE; i++)
+    ascii_to_metric_idx_.push (-1);
+
   read_header ();
   read_params ();
   read_char_metrics ();
 
 }
 
-Tex_font_metric * 
-Tex_font_metric_reader::read_file (String name)
-{
-  Tex_font_metric * tfmp = new Tex_font_metric;
-  Tex_font_metric_reader tfm_reader (tfmp, name);
-
-  return tfmp;
-}
-
-
-
-
 static const Real
 fix_to_real (Fix f)
 {
@@ -62,7 +52,7 @@ Tex_font_metric_reader::get_U32_fix_f ()
 Real
 Tex_font_metric_reader::get_U32_fix_scaled_f ()
 {
-  return get_U32_fix_f () * tfm_l_->info_.design_size;
+  return get_U32_fix_f () * info_.design_size;
 }
 
 String
@@ -83,8 +73,8 @@ Tex_font_metric_reader::read_header ()
   (void) file_length;
   U16 header_length = input_.get_U16 ();
 
-  tfm_l_->info_.first_charcode = input_.get_U16 ();
-  tfm_l_->info_.last_charcode = input_.get_U16 ();
+  info_.first_charcode = input_.get_U16 ();
+  info_.last_charcode = input_.get_U16 ();
   U16 width_word_count = input_.get_U16 ();
   U16 height_word_count = input_.get_U16 ();
   U16 depth_word_count = input_.get_U16 ();
@@ -95,38 +85,38 @@ Tex_font_metric_reader::read_header ()
   U16 extensible_word_count = input_.get_U16 ();
   (void)extensible_word_count;
   
-  tfm_l_->header_.param_word_count = input_.get_U16 ();
-  tfm_l_->info_.parameter_count = tfm_l_->header_.param_word_count;
-
-  tfm_l_->header_.char_info_pos = (6 + header_length) * 4;
-  tfm_l_->header_.width_pos = tfm_l_->header_.char_info_pos
-                         + (tfm_l_->info_.last_charcode
-                            - tfm_l_->info_.first_charcode + 1) * 4;
-  tfm_l_->header_.height_pos = tfm_l_->header_.width_pos + width_word_count * 4;
-  tfm_l_->header_.depth_pos = tfm_l_->header_.height_pos + height_word_count * 4;
-  tfm_l_->header_.italic_correction_pos = tfm_l_->header_.depth_pos
+  header_.param_word_count = input_.get_U16 ();
+  info_.parameter_count = header_.param_word_count;
+
+  header_.char_info_pos = (6 + header_length) * 4;
+  header_.width_pos = header_.char_info_pos
+                         + (info_.last_charcode
+                            - info_.first_charcode + 1) * 4;
+  header_.height_pos = header_.width_pos + width_word_count * 4;
+  header_.depth_pos = header_.height_pos + height_word_count * 4;
+  header_.italic_correction_pos = header_.depth_pos
                                      + depth_word_count * 4;
-  tfm_l_->header_.lig_kern_pos = tfm_l_->header_.italic_correction_pos
+  header_.lig_kern_pos = header_.italic_correction_pos
     + italic_correction_word_count * 4;
-  tfm_l_->header_.kern_pos = tfm_l_->header_.lig_kern_pos + lig_kern_word_count * 4;
+  header_.kern_pos = header_.lig_kern_pos + lig_kern_word_count * 4;
   /* We don't care about the extensible table.  */
 
   if (header_length < 2)
     error (_f ("TFM header of `%s' has only %u word(s)",
               input_.name_str ().ch_C (), header_length));
 
-  tfm_l_->info_.checksum = input_.get_U32 ();
-  tfm_l_->info_.design_size = get_U32_fix_f ();
+  info_.checksum = input_.get_U32 ();
+  info_.design_size = get_U32_fix_f ();
 
   /* Although the coding scheme might be interesting to the caller, the
      font family and face byte probably aren't.  So we don't read them.  */
-  tfm_l_->info_.coding_scheme = header_length > 2
+  info_.coding_scheme = header_length > 2
     ? get_bcpl_str () : "unspecified";
 
   DEBUG_OUT << format_str ("TFM checksum = %u, design_size = %fpt, coding scheme = `%s'.\n",
-                     tfm_l_->info_.checksum,
-                     tfm_l_->info_.design_size,
-                     tfm_l_->info_.coding_scheme.ch_C ());
+                     info_.checksum,
+                     info_.design_size,
+                     info_.coding_scheme.ch_C ());
 }
 
 /* Although TFM files are only usable by TeX if they have at least seven
@@ -139,34 +129,34 @@ void
 Tex_font_metric_reader::read_params ()
 {
   /* If we have no font parameters at all, we're done.  */
-  if (tfm_l_->header_.param_word_count == 0)
+  if (header_.param_word_count == 0)
     return;
 
   //brrr
   /* Move to the beginning of the parameter table in the file.  */
-  input_.seek_ch_C (-4 * tfm_l_->header_.param_word_count);
+  input_.seek_ch_C (-4 * header_.param_word_count);
 
   /* It's unlikely but possible that this TFM file has more fontdimens
      than we can deal with.  */
-  if (tfm_l_->header_.param_word_count > TFM_MAX_FONTDIMENS)
+  if (header_.param_word_count > TFM_MAX_FONTDIMENS)
     {
       warning (_f ("%s: TFM file has %u parameters, which is more than the %u I can handle",
                   input_.name_str ().ch_C (),
-                  tfm_l_->header_.param_word_count,
+                  header_.param_word_count,
                   TFM_MAX_FONTDIMENS));
-      tfm_l_->header_.param_word_count = TFM_MAX_FONTDIMENS;
+      header_.param_word_count = TFM_MAX_FONTDIMENS;
     }
 
   /* The first parameter is different than all the rest, because it
      isn't scaled by the design size.  */
-  tfm_l_->info_.parameters[(TFM_SLANT_PARAMETER) - 1] = get_U32_fix_f ();
+  info_.parameters[(TFM_SLANT_PARAMETER) - 1] = get_U32_fix_f ();
 
-  for (Char_code i = 2; i <= tfm_l_->header_.param_word_count; i++)
-    tfm_l_->info_.parameters[i - 1] = get_U32_fix_scaled_f ();
+  for (Char_code i = 2; i <= header_.param_word_count; i++)
+    info_.parameters[i - 1] = get_U32_fix_scaled_f ();
 
 #ifdef PRINT
-  for (Char_code i = 1; i <= tfm_l_->header_.param_word_count; i++)
-    DEBUG_OUT << format_str ("TFM parameter %d: %.3f", i, tfm_l_->info_.parameters[i - 1]);
+  for (Char_code i = 1; i <= header_.param_word_count; i++)
+    DEBUG_OUT << format_str ("TFM parameter %d: %.3f", i, info_.parameters[i - 1]);
 #endif
 }
 
@@ -176,12 +166,12 @@ Tex_font_metric_reader::read_params ()
 void
 Tex_font_metric_reader::read_char_metrics ()
 {
-  for (int i = tfm_l_->info_.first_charcode; i <= tfm_l_->info_.last_charcode; i++)
+  for (int i = info_.first_charcode; i <= info_.last_charcode; i++)
     {
       Tex_font_char_metric tfm_char = read_char_metric (i);
       if (tfm_char.exists_b_)
-       tfm_l_->ascii_to_metric_idx_[tfm_char.code_] = tfm_l_->char_metrics_.size ();
-      tfm_l_->char_metrics_.push (tfm_char);
+       ascii_to_metric_idx_[tfm_char.code_] = char_metrics_.size ();
+      char_metrics_.push (tfm_char);
     }
 }
 
@@ -196,12 +186,12 @@ Tex_font_metric_reader::read_char_metric (Char_code code)
 
   /* If the character is outside the declared bounds in the file, don't
      try to read it. */
-  if (code < tfm_l_->info_.first_charcode || code > tfm_l_->info_.last_charcode)
+  if (code < info_.first_charcode || code > info_.last_charcode)
     return tfm_char;
   
   //brr
   /* Move to the appropriate place in the `char_info' array.  */
-  input_.seek_ch_C (tfm_l_->header_.char_info_pos + (code - tfm_l_->info_.first_charcode) * 4);
+  input_.seek_ch_C (header_.char_info_pos + (code - info_.first_charcode) * 4);
 
   /* Read the character.  */
   tfm_char = read_char ();
@@ -239,10 +229,10 @@ Tex_font_metric_reader::read_char ()
 #define GET_CHAR_DIMEN(d) \
    if (d##_index != 0) \
      { \
-       input_.seek_ch_C (tfm_l_->header_.##d##_pos + d##_index*4); \
+       input_.seek_ch_C (header_.##d##_pos + d##_index*4); \
        tfm_char.d##_fix_ = input_.get_U32 (); \
        tfm_char.d##_ = fix_to_real (tfm_char.d##_fix_) \
-                      * tfm_l_->info_.design_size; \
+                      * info_.design_size; \
      }
 
   GET_CHAR_DIMEN (width);
@@ -265,7 +255,7 @@ Tex_font_metric_reader::read_char ()
 
   if (tag == 1)
     {
-      input_.seek_ch_C (tfm_l_->header_.lig_kern_pos + remainder * 4);
+      input_.seek_ch_C (header_.lig_kern_pos + remainder * 4);
       read_lig_kern_program (&tfm_char.ligature_arr_, &tfm_char.kern_arr_);
     }
 
@@ -303,7 +293,7 @@ Tex_font_metric_reader::read_lig_kern_program (Array <Tfm_ligature>* ligature_ar
          kern_element.character = next_char;
 
          char const* old_pos = input_.pos_ch_C ();
-         input_.seek_ch_C (tfm_l_->header_.kern_pos + remainder * 4);
+         input_.seek_ch_C (header_.kern_pos + remainder * 4);
          kern_element.kern = get_U32_fix_scaled_f ();
          input_.set_pos (old_pos);
 
index 982b357300ef76c9a53510d4a189b6bcf73d671a..7b6f0085273458c88c79526b5013904cf9da4949 100644 (file)
@@ -57,6 +57,7 @@ Tex_font_metric::Tex_font_metric ()
 {
 }
 
+
 static Tex_font_char_metric dummy_static_char_metric;
 
 Tex_font_char_metric const *
@@ -89,11 +90,19 @@ Tex_font_metric::str () const
   return outstr;
 }
 
-void
-Tex_font_metric::clear (int n)
-{
-  for (int i=0; i < n; i++)
-    ascii_to_metric_idx_.push (-1);
-}
 
 
+
+SCM
+Tex_font_metric::make_tfm (String fn)
+{
+  Tex_font_metric      * tfm_p = new Tex_font_metric;
+  Tex_font_metric_reader reader (fn);
+
+  tfm_p->info_ = reader.info_;
+  tfm_p->header_ = reader.header_;
+  tfm_p->char_metrics_ = reader.char_metrics_;
+  tfm_p->ascii_to_metric_idx_ = reader.ascii_to_metric_idx_;
+  
+  return tfm_p->smobbed_self ();
+}
index aa3180f7f620a603649f1d91ab01e0eb0e2a9376..68121fb2bbf1753c89f1348c68fdd5fc0bf34e6f 100644 (file)
@@ -156,8 +156,8 @@ Tie_engraver::process_acknowledged ()
            }
          else
            {
-             head_list  = gh_cons (gh_cons (stopped_heads_[j].head_l_->self_scm_,
-                                            now_heads_[i].head_l_->self_scm_),
+             head_list  = gh_cons (gh_cons (stopped_heads_[j].head_l_->self_scm (),
+                                            now_heads_[i].head_l_->self_scm ()),
                                    head_list);
 
              past_notes_pq_. insert (now_heads_[i]);
@@ -250,8 +250,8 @@ Tie_engraver::typeset_tie (Score_element *her)
       new_head_drul[d] = Tie::head(her,(Direction)-d);
   } while (flip(&d) != LEFT);
 
-  index_set_cell (her->get_elt_property ("heads"), LEFT, new_head_drul[LEFT]->self_scm_ );
-  index_set_cell (her->get_elt_property ("heads"), RIGHT, new_head_drul[RIGHT]->self_scm_ );
+  index_set_cell (her->get_elt_property ("heads"), LEFT, new_head_drul[LEFT]->self_scm () );
+  index_set_cell (her->get_elt_property ("heads"), RIGHT, new_head_drul[RIGHT]->self_scm () );
 
   typeset_element (her);
 }
index 4eae4439cb4d49bb220ede7af3326aeeb27c3f9f..2b214131b1f4d5f4ee03169d1bfa4a0b5ac7d24f 100644 (file)
@@ -38,7 +38,7 @@ void
 Tie::set_head (Score_element*me,Direction d, Item * head_l)
 {
   assert (!head (me,d));
-  index_set_cell (me->get_elt_property ("heads"), d, head_l->self_scm_);
+  index_set_cell (me->get_elt_property ("heads"), d, head_l->self_scm ());
   
   dynamic_cast<Spanner*> (me)->set_bound (d, head_l);
   me->add_dependency (head_l);
index 762ac771bac580498589a830e6c8cc6f0cb9e11f..ab453e5a45d3fa0bf34009d9e84fafd237955e6c 100644 (file)
@@ -75,12 +75,11 @@ Timing_translator::do_process_music()
        {
          if (measure_position ())
            {
+             Moment nm; 
              tr_l ->origin ()->warning (_f ("barcheck failed at: %s", 
                                  measure_position ().str ()));
              // resync
-             daddy_trans_l_->set_property("measurePosition",
-                                          smobify (new Moment));
-
+             daddy_trans_l_->set_property("measurePosition", nm.make_scm ());
            }
        }
     }
@@ -122,11 +121,12 @@ ADD_THIS_TRANSLATOR(Timing_translator);
 void
 Timing_translator::do_creation_processing()
 {
+  Moment m;
   daddy_trans_l_->set_property ("timing" , SCM_BOOL_T);  
   daddy_trans_l_->set_property ("currentBarNumber" , gh_int2scm (1));
-  daddy_trans_l_->set_property ("measurePosition", smobify (new Moment));
-  daddy_trans_l_->set_property ("beatLength", smobify (new Moment (1,4)));
-  daddy_trans_l_->set_property ("measureLength", smobify (new Moment (1)));
+  daddy_trans_l_->set_property ("measurePosition", m.make_scm ());
+  daddy_trans_l_->set_property ("beatLength", Moment (1,4).make_scm ());
+  daddy_trans_l_->set_property ("measureLength",  Moment (1).make_scm());
 }
 
 Moment
@@ -145,8 +145,8 @@ Timing_translator::set_time_signature (int l, int o)
 {
   Moment one_beat = Moment (1)/Moment (o);
   Moment len = Moment (l) * one_beat;
-  daddy_trans_l_->set_property ("measureLength", smobify (new Moment (len)));
-  daddy_trans_l_->set_property ("beatLength", smobify (new Moment (one_beat)));
+  daddy_trans_l_->set_property ("measureLength", len.make_scm ());
+  daddy_trans_l_->set_property ("beatLength", one_beat.make_scm ());
 }
 
 Timing_translator::Timing_translator()
@@ -160,9 +160,9 @@ Timing_translator::measure_position () const
   SCM sm = get_property ("measurePosition");
   
   Moment m   =0;
-  if (SMOB_IS_TYPE_B (Moment, sm))
+  if (unsmob_moment (sm))
     {
-      m = *SMOB_TO_TYPE (Moment, sm);
+      m = *unsmob_moment(sm);
       while (m < Moment (0))
        m += measure_length ();
     }
@@ -192,21 +192,19 @@ Timing_translator::do_post_move_processing()
   if (!dt)
     return;
 
-  Moment * measposp =0;
+  Moment measposp;
 
   SCM s = get_property ("measurePosition");
-  if (SMOB_IS_TYPE_B (Moment, s))
+  if (unsmob_moment (s))
     {
-      measposp = SMOB_TO_TYPE (Moment,s);
+      measposp = *unsmob_moment(s);
     }
   else
     {
-      measposp = new Moment;
-      daddy_trans_l_->set_property ("measurePosition", smobify (measposp));
+      daddy_trans_l_->set_property ("measurePosition", measposp.make_scm());
     }
   
-  *measposp += dt;
-  // don't need to set_property
+  measposp += dt;
   
   SCM barn = get_property ("currentBarNumber");
   int b = 0;
@@ -219,12 +217,13 @@ Timing_translator::do_post_move_processing()
   bool c= to_boolean (cad );
 
   Moment len = measure_length ();
-  while (c && *measposp >= len)
-      {
-       *measposp -= len;
-       b ++;
-      }
+  while (c && measposp >= len)
+    {
+      measposp -= len;
+      b ++;
+    }
 
   daddy_trans_l_->set_property ("currentBarNumber", gh_int2scm (b));
+  daddy_trans_l_->set_property ("measurePosition", measposp.make_scm());
 }
 
index 4303d0cbf470bdeef0991cf46efd761aeafb2273..8d92fb8ac15b9d7d528923ffe7b695cec7751f1b 100644 (file)
@@ -28,7 +28,7 @@ Translator_group::~Translator_group ()
 {
   assert (removable_b());
   trans_p_list_.junk ();
-  delete properties_dict_;
+  scm_unprotect_object (properties_dict_->self_scm ());
 }
 
 
@@ -358,7 +358,7 @@ Translator_group::do_print() const
   if (!flower_dstream)
     return ;
 
-  gh_display (properties_dict_->self_scm_);
+  gh_display (properties_dict_->self_scm ());
   if (status == ORPHAN)
     {
       DEBUG_OUT << "consists of: ";
index ec640fb578d0d2522df10b4bb185498f3f447ef1..408a512e26163c719b6ba7d966a12a5e314b3c67 100644 (file)
@@ -1,17 +1,29 @@
-
+#(gc)
   
 breve = \duration #'( -1 0)
 longa = \duration #'( -2 0 )
 maxima = \duration #'( -3 0 )
 
+#(gc)
+
 #(eval-string (ly-gulp-file "generic-property.scm"))
 
+#(gc)
+
 % urg, move to basic property?
 #(eval-string (ly-gulp-file "slur.scm"))
 
+#(gc)
+
 \include "nederlands.ly"               % dutch
+
+#(gc)
+
 \include "chord-modifiers.ly"
+#(gc)
+
 \include "script.ly"
+#(gc)
 
 
 % declarations for standard directions
index b9bbb9fb10fda06d00ff5dca7f1db55d836e45a0..d189cae32a9bc7e85f09a53db4278fe9f280d7ec 100644 (file)
@@ -264,13 +264,15 @@ StaffGroupContext= \translator {
 LyricsVoiceContext= \translator{
        \type "Engraver_group_engraver";
        \consistsend "Axis_group_engraver";
-       LyricVoiceMinimumVerticalExtent = #(cons -2.5 2.5)
+       LyricVoiceMinimumVerticalExtent = #(cons -1.2 1.2)
 
        \name LyricVoice ;
        \consists "Separating_line_group_engraver";
        \consists "Lyric_engraver";
        \consists "Extender_engraver";
        \consists "Hyphen_engraver";
+
+       phrasingPunctuation = #".,;:!?"
 };
 \translator{ \LyricsVoiceContext }
 
@@ -376,6 +378,10 @@ ScoreContext = \translator {
        \consists "Spacing_engraver";
 
        \consists "Vertical_align_engraver";
+
+       \consists "Lyric_phrasing_engraver";
+        automaticPhrasing = ##f;
+
        \consists "Bar_number_engraver";
        alignmentReference = \down;
        defaultClef = #"treble"
@@ -536,7 +542,7 @@ ScoreContext = \translator {
                (molecule-callback . ,Text_item::brew_molecule)
                (self-alignment-X . 0)
                (non-rhythmic . #t)
-               (interfaces .  (text-item-interface))
+               (interfaces .  (lyric-syllable-interface text-item-interface))
        )
        basicMarkProperties = #`(
          (molecule-callback . ,Text_item::brew_molecule)       
index 41308ac2cf12974fdb974aeed29701a74f629957..b7d9ee49b59092c81b489f82e3edcf5c49749bb9 100644 (file)
@@ -1,5 +1,6 @@
 % Toplevel initialisation file. 
 
+
 \version "1.3.59";
 
 \include "declarations.ly";
index e7e6b811eb404a4eda88f49393ad6daac99a781e..cae88b51f502970f708a9ff00c46900ce6f1c7da 100644 (file)
@@ -1,15 +1,15 @@
 Begin3
 Title: LilyPond
-Version: 1.3.73
-Entered-date: 17JUL00
+Version: 1.3.74
+Entered-date: 19JUL00
 Description: 
 Keywords: music notation typesetting midi fonts engraving
 Author: hanwen@cs.uu.nl (Han-Wen Nienhuys)
        janneke@gnu.org (Jan Nieuwenhuizen)
 Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys)
 Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert
-       1000k lilypond-1.3.73.tar.gz 
+       1000k lilypond-1.3.74.tar.gz 
 Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/
-       1000k lilypond-1.3.73.tar.gz 
+       1000k lilypond-1.3.74.tar.gz 
 Copying-policy: GPL
 End
index 37f6140aacad218fb5f4b9c6785b42983add001a..d7d2b3f08896e794738c5410f4baa9f057ae2b07 100644 (file)
@@ -1,9 +1,9 @@
 Name: lilypond
-Version: 1.3.73
+Version: 1.3.74
 Release: 1
 Copyright: GPL
 Group: Applications/Publishing
-Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.73.tar.gz
+Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.74.tar.gz
 Summary: A program for printing sheet music.
 URL: http://www.cs.uu.nl/~hanwen/lilypond
 # Icon: lilypond-icon.gif