* 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
+* 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)
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:
@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
@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},
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
--- /dev/null
+\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
TODO:
-* repeats.
+* autochange.
* tremolo
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
return Box (Interval (0,0),Interval(0,0));
}
-Adobe_font_metric*
+SCM
read_afm_file (String nm)
{
FILE *f = fopen (nm.ch_C() , "r");
}
fclose (f);
- return new Adobe_font_metric (fi);
+ return Adobe_font_metric::make_afm (fi);
}
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);
#include "afm.hh"
#include "tfm.hh"
#include "lily-guile.hh"
-#include "tfm-reader.hh"
+#include "scm-hash.hh"
+
+
+
extern "C" {
#include <kpathsea/kpathsea.h>
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 ())
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);
}
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;
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)));
}
{
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++)
; // 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_)
{
change_to (it, auto_mus->what_str_, to_id);
}
}
+
+ spanish_inquisition->pitch_arr_.clear ();
}
Auto_change_iterator::Auto_change_iterator( )
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)
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;
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));
}
*/
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_);
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);
}
*/
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);
}
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);
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);
}
}
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_);
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 &)
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
{
}
-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_;
}
IMPLEMENT_UNSMOB (Font_metric, metrics);
-IMPLEMENT_SMOBS (Font_metric);
-
+IMPLEMENT_SIMPLE_SMOBS (Font_metric);
+IMPLEMENT_DEFAULT_EQUAL_P(Font_metric);
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++)
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_;
}
-void
-Identifier::do_smobify_self ()
-{
-
-}
#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);
#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);
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 */
*/
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;
IDACCESSOR(Duration)
VIRTUAL_COPY_CONS(Identifier);
+ DECLARE_SMOBS(Identifier, foo);
protected:
virtual void do_print () const;
virtual String do_str () const;
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;
*/
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_;
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 */
+
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, / );
*/
class Music {
public:
- DECLARE_SMOBS;
- SCM immutable_property_alist_;
- SCM mutable_property_alist_;
-
Input *origin () const;
void set_spot (Input);
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);
Music();
protected:
virtual void do_print() const;
+ DECLARE_SMOBS(Music,);
+ SCM immutable_property_alist_;
+ SCM mutable_property_alist_;
+
};
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
*/
class Request : public Music {
public:
- virtual ~Request(){}
VIRTUAL_COPY_CONS(Music);
bool equal_b (Request const*) const;
protected:
/**
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;
class Foo {
Scheme_hash_table tab;
}
+
+
+ 2. UPON DESTRUCTION, DO
+
+ scm_unprotect_object (tab->self_scm_);
+
*/
class Scheme_hash_table : private Scm_stl_map
{
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 */
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*);
virtual void handle_prebroken_dependencies ();
- DECLARE_SMOBS;
+ DECLARE_SMOBS(Score_element,foo);
void init ();
#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 */
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 ();
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_;
};
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_;
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;
}
{
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
- 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);
}
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 ());
}
}
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_)
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
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();
}
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 ());
}
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))
{
{
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());
}
#include "moment.hh"
#include "warn.hh"
+#include "ly-smobs.icc"
+
+IMPLEMENT_UNSMOB(Moment,moment);
+IMPLEMENT_SIMPLE_SMOBS(Moment);
+
+
SCM
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 *)
{
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 ()
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;
}
+
{
Moment now (now_mom ());
-
SCM smp = get_property ("measurePosition");
Moment mp = (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0);
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)
{
Music_wrapper::Music_wrapper(Music*p)
{
- set_mus_property ("element", p->self_scm_);
+ set_mus_property ("element", p->self_scm ());
}
Moment
{
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;
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;
Music::Music()
{
- self_scm_ = SCM_EOL;
immutable_property_alist_ = SCM_EOL;
mutable_property_alist_ = SCM_EOL;
smobify_self ();
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
IMPLEMENT_UNSMOB(Music,music);
IMPLEMENT_SMOBS(Music);
+IMPLEMENT_DEFAULT_EQUAL_P(Music);
/****************************/
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 ()
{
{
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 ();
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);
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);
}
{
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))
{
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");
}
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);
}
{
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. */
}
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
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);
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;
$$ = 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 {
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 {
}
| 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)))
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 ;
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;
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());
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);
}
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;
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())));
}
/*
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));
}
}
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_);
}
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 ());
}
}
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
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 ());
}
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 ();
}
{
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
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++)
{
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);
Scheme_hash_table::~Scheme_hash_table( )
{
- unsmobify_self ();
}
SCM
#include "ly-smobs.icc"
IMPLEMENT_UNSMOB(Scheme_hash_table,scheme_hash);
IMPLEMENT_SMOBS(Scheme_hash_table);
+IMPLEMENT_DEFAULT_EQUAL_P(Scheme_hash_table);
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 ()
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
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;
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;
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;
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");
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
|| (sc->common_refpoint (line, X_AXIS)
&& sc->common_refpoint (line, Y_AXIS)))
{
- return sc->self_scm_;
+ return sc->self_scm ();
}
return SCM_UNDEFINED;
}
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);
}
}
{
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))
{
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 ();
}
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)
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 ();
}
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);
}
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*
: 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_;
{
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_);
}
}
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 ())
{
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)
{
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));
}
}
- 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);
}
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 ;
}
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);
}
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);
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 ())
{
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;
}
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
}
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 ());
}
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))
}
else
{
- n->set_elt_property ("rest", n->self_scm_);
+ n->set_elt_property ("rest", n->self_scm ());
}
}
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)
{
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
(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 ();
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
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
}
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);
}
}
/* 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 ();
#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);
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_);
}
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);
{
}
+
static Tex_font_char_metric dummy_static_char_metric;
Tex_font_char_metric 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 ();
+}
}
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]);
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);
}
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);
{
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 ());
}
}
}
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
{
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()
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 ();
}
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;
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());
}
{
assert (removable_b());
trans_p_list_.junk ();
- delete properties_dict_;
+ scm_unprotect_object (properties_dict_->self_scm ());
}
if (!flower_dstream)
return ;
- gh_display (properties_dict_->self_scm_);
+ gh_display (properties_dict_->self_scm ());
if (status == ORPHAN)
{
DEBUG_OUT << "consists of: ";
-
+#(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
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 }
\consists "Spacing_engraver";
\consists "Vertical_align_engraver";
+
+ \consists "Lyric_phrasing_engraver";
+ automaticPhrasing = ##f;
+
\consists "Bar_number_engraver";
alignmentReference = \down;
defaultClef = #"treble"
(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)
% Toplevel initialisation file.
+
\version "1.3.59";
\include "declarations.ly";
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
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