From 39b4f9f0fc8a90376e1c4d5558fa2bde2d6c2b34 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 21:28:32 +0000 Subject: [PATCH] lilypond-1.1.1 --- Documentation/ntweb/index.yo | 11 ++-- flower/include/dictionary.hh | 2 +- flower/include/vector.hh | 1 + flower/include/virtual-methods.hh | 61 ++++++++++++++++------ lily/abbrev.cc | 2 +- lily/abbreviation-beam-engraver.cc | 13 ++--- lily/atom.cc | 8 ++- lily/auto-plet-engraver.cc | 16 +++--- lily/bar-column-engraver.cc | 15 +++--- lily/bar-column.cc | 2 +- lily/bar-engraver.cc | 18 ++++--- lily/bar-number-engraver.cc | 8 ++- lily/beam-engraver.cc | 12 ++--- lily/beam.cc | 5 +- lily/chord-iterator.cc | 2 +- lily/clef-engraver.cc | 47 ++++++++--------- lily/collision-engraver.cc | 3 +- lily/collision.cc | 9 +++- lily/dot-column-engraver.cc | 7 +-- lily/dot-column.cc | 11 ++-- lily/dynamic-engraver.cc | 37 +++++--------- lily/engraver.cc | 2 +- lily/hara-kiri-line-group-engraver.cc | 9 ++-- lily/hara-kiri-vertical-group-spanner.cc | 6 +-- lily/head-engraver.cc | 11 ++-- lily/heads-engraver.cc | 17 +++---- lily/include/atom.hh | 8 ++- lily/include/lily-guile.hh | 3 ++ lily/include/music-list.hh | 1 - lily/include/protected-scm.hh | 30 +++++++++++ lily/include/spring-spacer.hh | 5 +- lily/item.cc | 13 ++--- lily/key-engraver.cc | 24 ++++----- lily/key-performer.cc | 14 ++--- lily/lily-guile.cc | 1 + lily/local-key-engraver.cc | 15 +++--- lily/lookup.cc | 65 ++++++++++++------------ lily/lyric-engraver.cc | 12 ++--- lily/main.cc | 23 +++++---- lily/mark-engraver.cc | 13 +++-- lily/multi-measure-rest-engraver.cc | 26 +++++----- lily/music-iterator.cc | 14 ++--- lily/music-list.cc | 6 +-- lily/music-output-def.cc | 8 +-- lily/music-sequence.cc | 2 - lily/musical-request.cc | 15 +++--- lily/my-lily-lexer.cc | 4 +- lily/my-lily-parser.cc | 8 ++- lily/note-column.cc | 18 +++---- lily/p-score.cc | 7 ++- lily/performer.cc | 2 +- lily/pitch-squash-engraver.cc | 5 +- lily/plet-engraver.cc | 8 +-- lily/plet-spanner.cc | 2 +- lily/plet-swallow-engraver.cc | 2 +- lily/priority-halign-engraver.cc | 2 +- lily/protected-scm.cc | 52 +++++++++++++++++++ lily/request-iterator.cc | 13 +++-- lily/request.cc | 9 +--- lily/rest-collision-engraver.cc | 4 +- lily/rest-collision.cc | 11 ++-- lily/rest-engraver.cc | 14 ++--- lily/rhythmic-column-engraver.cc | 8 +-- lily/rhythmic-head.cc | 2 +- lily/score-element.cc | 12 +++-- lily/score-engraver.cc | 33 ++++++------ lily/score-performer.cc | 6 +-- lily/score-priority-engraver.cc | 2 +- lily/score.cc | 2 +- lily/script-column.cc | 6 ++- lily/script-def.cc | 4 +- lily/script-engraver.cc | 2 +- lily/script.cc | 2 +- lily/separating-group-spanner.cc | 7 ++- lily/separating-line-group-engraver.cc | 4 +- lily/single-malt-grouping-item.cc | 3 +- lily/slur-engraver.cc | 15 +++--- lily/slur.cc | 4 +- lily/span-bar-engraver.cc | 8 +-- lily/span-score-bar-engraver.cc | 2 +- lily/spring-spacer.cc | 10 ++-- lily/staff-margin-engraver.cc | 2 +- lily/staff-performer.cc | 2 +- lily/stem-engraver.cc | 4 +- lily/stem.cc | 4 +- lily/symtable.cc | 6 +-- lily/text-def.cc | 4 +- lily/text-item.cc | 8 +-- lily/tie.cc | 2 +- lily/ties-engraver.cc | 8 +-- lily/time-signature-engraver.cc | 6 +-- lily/timing-translator.cc | 47 +++++++++-------- lily/type-swallow-trans.cc | 6 +-- lily/vertical-align-engraver.cc | 2 +- make/generic-vars.make | 2 +- make/toplevel.make.in | 2 +- scripts/convert-mudela.py | 6 ++- stepmake/bin/package-zip32.sh | 9 ++-- stepmake/stepmake/c++-vars.make | 4 +- stepmake/stepmake/generic-vars.make | 2 +- 100 files changed, 577 insertions(+), 475 deletions(-) create mode 100644 lily/include/protected-scm.hh create mode 100644 lily/protected-scm.cc diff --git a/Documentation/ntweb/index.yo b/Documentation/ntweb/index.yo index 4460f700c8..1a3a8df1f1 100644 --- a/Documentation/ntweb/index.yo +++ b/Documentation/ntweb/index.yo @@ -4,11 +4,12 @@ sect(Windows NT Binary Distribution) subsect(Introduction) label(introduction) -This page is dedicated to the distribution of precompiled and preformatted -LilyPond binaries for Windows NT 4.0 . This package is covered under the -GNU General Public License and all of the source and documentation are +This page is dedicated to the distribution of precompiled and +preformatted LilyPond binaries for Windows NT 4.0 . This package is +covered under the GNU General Public License and all of the source is available on the official url(LilyPond Homepage)(http://www.cs.ruu.nl/people/hanwen/lilypond/index.html). +A full set of url(documentation)(http://www.cs.ruu.nl/people/hanwen/lilypond/Documentation/tex/out-www/index.html) in various formats is also available. includefile(../BLURB.in) @@ -69,8 +70,8 @@ itemize( In a batch file you can add the following entries: nl() bf(set LILYPONDPREFIX=em(LilyPond-dir)) nl() bf(set path=%path%;%LILYPONDPREFIX%\bin;em(MiKTeX-dir)\miktex\bin) nl() - bf(set TEXINPUTS=%LILYPONDPREFIX%\texmf\tex\lilypond;;) nl() - bf(set MFINPUTS=%LILYPONDPREFIX%\texmf\mf\public\lilypond;;) nl() + bf(set TEXINPUTS=%LILYPONDPREFIX%\share\lilypond\tex;;) nl() + bf(set MFINPUTS=%LILYPONDPREFIX%\share\lilypond\mf;;) nl() COMMENT( dit(Windows Environment) In the Windows environment you can select properties menu of the My Computer icon. Click on diff --git a/flower/include/dictionary.hh b/flower/include/dictionary.hh index d3c9a7afb3..e1e840b8a1 100644 --- a/flower/include/dictionary.hh +++ b/flower/include/dictionary.hh @@ -183,7 +183,7 @@ public: V retval; if (!elem_b (k)) return retval ; - retval ((Dictionary *) this)->elem (k); + return ((Dictionary *) this)->elem (k); } V remove (String s) diff --git a/flower/include/vector.hh b/flower/include/vector.hh index 8b4d280cf5..b4eeb97597 100644 --- a/flower/include/vector.hh +++ b/flower/include/vector.hh @@ -78,6 +78,7 @@ public: return sqrt (norm_sq()); } operator Array() { return dat; } + Array const &to_array()const { return dat; } void print() const; /// set to j-th element of unit-base void set_unit (int j) ; diff --git a/flower/include/virtual-methods.hh b/flower/include/virtual-methods.hh index 39795ce115..909267165b 100644 --- a/flower/include/virtual-methods.hh +++ b/flower/include/virtual-methods.hh @@ -10,6 +10,7 @@ #ifndef VIRTUAL_METHODS_HH #define VIRTUAL_METHODS_HH +#include #include "stdlib.h" // size_t /** Declare the classes name as a static and virtual function. @@ -17,49 +18,79 @@ s->name() != S::static_name (). Overlapping strings need not be merged in C++ */ #define DECLARE_MY_RUNTIME_TYPEINFO \ -static bool static_is_type_b (const char*s);\ -virtual bool is_type_b (const char *s) const { return static_is_type_b (s); } \ -virtual char const *name() const{ return static_name (); } \ -virtual size_t class_size () const { return static_class_size (); }\ -static size_t static_class_size (); \ +virtual char const *name() const{ return static_name (); }\ static char const *static_name() -#define IMPLEMENT_STATIC_NAME(c)\ - char const *c::static_name() { return #c; } \ - size_t c::static_class_size () { return sizeof (c); } +#if 0 + /* + oops. before() has nothing to do with inheritance + */ +inline bool operator > (type_info const &a1, type_info const &a2) +{ + return a2.before (a1); +} +inline bool operator < (type_info const &a1, type_info const &a2) +{ + return a1.before (a2); +} -#define VIRTUAL_COPY_CONS(T, R)\ - virtual R *clone() const { return new T(*this); } \ - int yet_another_stupid_function_to_allow_semicolon() +inline bool operator <= (type_info const &a1, type_info const &a2) +{ + return a1 == a2 || a1 < a2; +} + +inline bool operator >= (type_info const &a1, type_info const &a2) +{ + return a1 == a2 || a1 > a2; +} +#endif + +#define IMPLEMENT_STATIC_NAME(c)\ + char const *c::static_name() { return #c; } + + /* + size_t c::static_class_size () { return sizeof (c); } + */ +#define VIRTUAL_COPY_CONS(T, R)\ + virtual R *clone() const { return new T(*this); } #define DECLARE_VIRTUAL_COPY_CONS(T, R)\ virtual R *clone() const + #define IMPLEMENT_VIRTUAL_COPY_CONS(T, R)\ R *T::clone() const { return new T(*this); }\ #define IMPLEMENT_IS_TYPE_B(D)\ - IMPLEMENT_STATIC_NAME(D)\ + IMPLEMENT_STATIC_NAME(D) + +/* bool D::static_is_type_b (const char *s)\ {\ return s == static_name();\ -} +}*/ #define IMPLEMENT_IS_TYPE_B1(D, B)\ - IMPLEMENT_STATIC_NAME(D)\ + IMPLEMENT_STATIC_NAME(D) +/* bool D::static_is_type_b (const char *s)\ {\ return s == static_name() || B::static_is_type_b (s);\ } +*/ #define IMPLEMENT_IS_TYPE_B2(D, BA, BB)\ - IMPLEMENT_STATIC_NAME(D)\ + IMPLEMENT_STATIC_NAME(D) + +/* + bool D::static_is_type_b (const char *s)\ {\ return s == static_name() || BA::static_is_type_b (s) || BB::static_is_type_b (s);\ } +*/ #endif diff --git a/lily/abbrev.cc b/lily/abbrev.cc index eb87945cd7..841f063ca6 100644 --- a/lily/abbrev.cc +++ b/lily/abbrev.cc @@ -129,7 +129,7 @@ void Abbreviation::do_substitute_dependent (Score_element*o, Score_element*n) { if (stem_l_ == o) - stem_l_ = n ? dynamic_cast (n) : 0; + stem_l_ = dynamic_cast (n); } diff --git a/lily/abbreviation-beam-engraver.cc b/lily/abbreviation-beam-engraver.cc index be29437462..145ab50bcb 100644 --- a/lily/abbreviation-beam-engraver.cc +++ b/lily/abbreviation-beam-engraver.cc @@ -27,11 +27,7 @@ Abbreviation_beam_engraver::Abbreviation_beam_engraver () bool Abbreviation_beam_engraver::do_try_request (Request*r) { - Musical_req* mus_l = dynamic_cast (r); - if (!mus_l) - return false; - - Abbreviation_beam_req * b = dynamic_cast (mus_l); + Abbreviation_beam_req * b = dynamic_cast (r); if (!b) return false; @@ -40,7 +36,7 @@ Abbreviation_beam_engraver::do_try_request (Request*r) return false; Direction d = (!abeam_p_) ? LEFT : RIGHT; - if (span_reqs_drul_[d] && !span_reqs_drul_[d]->equal_b (mus_l)) + if (span_reqs_drul_[d] && !span_reqs_drul_[d]->equal_b (b)) return false; span_reqs_drul_[d] = b; @@ -82,11 +78,10 @@ Abbreviation_beam_engraver::do_removal_processing () void Abbreviation_beam_engraver::acknowledge_element (Score_element_info i) { - if (!abeam_p_ || !i.elem_l_->is_type_b (Stem::static_name ())) + Stem* s = dynamic_cast (i.elem_l_); + if (!abeam_p_ || !s) return; - Stem* s = (Stem*)dynamic_cast (i.elem_l_); - int type_i = span_reqs_drul_[LEFT]->type_i_; s->flag_i_ = intlog2 (type_i) - 2; if (span_reqs_drul_[RIGHT]) diff --git a/lily/atom.cc b/lily/atom.cc index 2d8f11e78e..ae6092c165 100644 --- a/lily/atom.cc +++ b/lily/atom.cc @@ -6,7 +6,6 @@ (c) 1997--1998 Han-Wen Nienhuys */ - #include "atom.hh" #include "interval.hh" #include "string.hh" @@ -66,6 +65,7 @@ Atom::extent () const } + Atom::Atom () : dim_ (Interval (0,0),Interval (0,0)) { @@ -76,15 +76,15 @@ Atom::Atom () But Atom is used as a simple type *everywhere*, and we don't have virtual contructors. */ - lambda_ = 0; str_ = "unknown\n"; + origin_l_ = 0; } Atom::Atom (String s, Box b) : dim_ (b) { - lambda_ = 0; str_ = s; + origin_l_ = 0; } @@ -101,8 +101,6 @@ Atom::offset () const return off_; } - - void Atom::translate_axis (Real r, Axis a) { diff --git a/lily/auto-plet-engraver.cc b/lily/auto-plet-engraver.cc index 254f029f59..c97be06723 100644 --- a/lily/auto-plet-engraver.cc +++ b/lily/auto-plet-engraver.cc @@ -15,16 +15,12 @@ bool Tuplet_engraver::do_try_request (Request *r) { - Command_req * c = dynamic_cast (r); - if (!(c && - dynamic_cast (c))) + if (Bracket_req * b = dynamic_cast (r)) { - return false; + bracket_req_arr_.push (b); + return true; } - - Bracket_req * b = dynamic_cast (c); - bracket_req_arr_.push (b); - return true; + return false; } void @@ -59,9 +55,9 @@ Tuplet_engraver::do_process_requests () void Tuplet_engraver::acknowledge_element (Score_element_info i) { - if (i.elem_l_->is_type_b (Note_column::static_name ())) + if (Note_column *nc = dynamic_cast (i.elem_l_)) { - Note_column *nc = (Note_column*)dynamic_cast (i.elem_l_); + for (int j =0; j add_column (nc); ; diff --git a/lily/bar-column-engraver.cc b/lily/bar-column-engraver.cc index 0832448a2a..230a0f3ea2 100644 --- a/lily/bar-column-engraver.cc +++ b/lily/bar-column-engraver.cc @@ -12,6 +12,7 @@ #include "request.hh" #include "script.hh" #include "bar.hh" +#include Bar_column_engraver::Bar_column_engraver() { @@ -55,22 +56,24 @@ Bar_column_engraver::acknowledge_element (Score_element_info info) Item * it = dynamic_cast (info.elem_l_); if (!it) return; - - if (it->is_type_b (Script::static_name()) + Script *s = dynamic_cast (it); + Bar *b = dynamic_cast (it); + if (s && it->breakable_b_ && info.origin_grav_l_arr_.size() == 1 && it->break_priority_i_ == break_priority_i_) { create_column (); - barcol_p_->add_script ((Script*)it); + barcol_p_->add_script (s); } else if (info.origin_grav_l_arr_.size() == 1 && it->break_priority_i_ == break_priority_i_ - && it->breakable_b_ - && it->is_type_b (Bar::static_name())) + && it->breakable_b_ + &&b) + { create_column (); - barcol_p_->set_bar ( (Bar*)it); + barcol_p_->set_bar (b); } } diff --git a/lily/bar-column.cc b/lily/bar-column.cc index 74ce5386af..5f1a40d93f 100644 --- a/lily/bar-column.cc +++ b/lily/bar-column.cc @@ -28,7 +28,7 @@ Bar_column::do_substitute_dependency (Score_element*o,Score_element*n) Script_column::do_substitute_dependency (o,n); if (o == bar_l_) { - bar_l_ = n ? (Bar*)dynamic_cast (n) : 0; + bar_l_ = dynamic_cast (n); } } diff --git a/lily/bar-engraver.cc b/lily/bar-engraver.cc index 7a2a515cdc..456a13cf40 100644 --- a/lily/bar-engraver.cc +++ b/lily/bar-engraver.cc @@ -23,16 +23,18 @@ Bar_engraver::Bar_engraver() bool Bar_engraver::do_try_request (Request*r_l) { - Command_req* c_l = dynamic_cast (r_l); - if (!c_l|| !dynamic_cast (c_l)) - return false; - Bar_req * b= dynamic_cast (c_l); - if (bar_req_l_ && bar_req_l_->equal_b (b)) - return false; + if (Bar_req * b= dynamic_cast (r_l)) + { + if (bar_req_l_ && bar_req_l_->equal_b (b)) // huh? + return false; + + bar_req_l_ = b; + + return true; + } - bar_req_l_ = b; + return false; - return true; } void diff --git a/lily/bar-number-engraver.cc b/lily/bar-number-engraver.cc index 380cb65145..455690e516 100644 --- a/lily/bar-number-engraver.cc +++ b/lily/bar-number-engraver.cc @@ -25,10 +25,8 @@ Bar_number_engraver::Bar_number_engraver() void Bar_number_engraver::acknowledge_element (Score_element_info i) { - - Item *it=dynamic_cast (i.elem_l_); - if (script_p_ - || !it || !it->is_type_b (Bar::static_name())) + Bar *b =dynamic_cast (i.elem_l_); + if (script_p_ || !b) return; /* Only put numbers on bars that are at our own level (don't put @@ -58,7 +56,7 @@ Bar_number_engraver::acknowledge_element (Score_element_info i) script_p_->break_priority_i_ = int (pri); } else - script_p_->break_priority_i_ = it->break_priority_i_; + script_p_->break_priority_i_ = b->break_priority_i_; Scalar padding = get_property ("barScriptPadding"); if (padding.length_i() && padding.isnum_b ()) diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index 4ef398b499..b8eb55903b 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -25,11 +25,7 @@ Beam_engraver::Beam_engraver() bool Beam_engraver::do_try_request(Request*r) { - Musical_req* mus_l = dynamic_cast (r); - if (!mus_l) - return false; - - Beam_req* b = dynamic_cast (mus_l); + Beam_req* b = dynamic_cast (r); if (!b) return false; @@ -37,7 +33,7 @@ Beam_engraver::do_try_request(Request*r) return false; Direction d = (!beam_p_) ? LEFT : RIGHT; - if (span_reqs_drul_[d] && !span_reqs_drul_[d]->equal_b (mus_l)) + if (span_reqs_drul_[d] && !span_reqs_drul_[d]->equal_b (b)) return false; span_reqs_drul_[d] = b; @@ -97,10 +93,10 @@ Beam_engraver::do_removal_processing() void Beam_engraver::acknowledge_element (Score_element_info i) { - if (!beam_p_ || !i.elem_l_->is_type_b (Stem::static_name ())) + Stem* s = dynamic_cast (i.elem_l_); + if (!beam_p_ || !s) return; - Stem* s = (Stem*)dynamic_cast (i.elem_l_); if (!dynamic_cast (i.req_l_)) { ::warning ( _("Stem must have Rhythmic structure.")); diff --git a/lily/beam.cc b/lily/beam.cc index a9dd24bda3..4982dd3937 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -125,8 +125,9 @@ Beam::do_post_processing () void Beam::do_substitute_dependent (Score_element*o,Score_element*n) { - if (o->is_type_b (Stem::static_name ())) - stems_.substitute ((Stem*)dynamic_cast (o), n? (Stem*) dynamic_cast (n):0); + if (Stem * os = dynamic_cast (o)) + stems_.substitute (os, + dynamic_cast (n)); } Interval diff --git a/lily/chord-iterator.cc b/lily/chord-iterator.cc index 34c91c586c..8b691619ee 100644 --- a/lily/chord-iterator.cc +++ b/lily/chord-iterator.cc @@ -24,7 +24,7 @@ Simultaneous_music_iterator::construct_children() if (mi->ok()) { if (simultaneous_music_l ()->translator_type_str_.empty_b ()) - set_translator (mi->report_to_l()->ancestor_l (simultaneous_music_l ()->multi_level_i_)); + set_translator (mi->report_to_l()->ancestor_l (0)); children_p_list_.bottom().add (mi); } else diff --git a/lily/clef-engraver.cc b/lily/clef-engraver.cc index 462a9c1402..83e6eff1e6 100644 --- a/lily/clef-engraver.cc +++ b/lily/clef-engraver.cc @@ -14,8 +14,6 @@ #include "debug.hh" #include "command-request.hh" #include "time-description.hh" - - #include "note-head.hh" #include "key-item.hh" #include "local-key-item.hh" @@ -148,7 +146,7 @@ Clef_engraver::read_req (Clef_change_req*c_l) void Clef_engraver::acknowledge_element (Score_element_info info) { - if (info.elem_l_->is_type_b (Bar::static_name ()) + if (dynamic_cast(info.elem_l_) && clef_type_str_.length_i()) { create_clef(); @@ -158,24 +156,21 @@ Clef_engraver::acknowledge_element (Score_element_info info) /* ugh; should make Clef_referenced baseclass */ Item * it_l =dynamic_cast (info.elem_l_); -if (it_l) - { - if (it_l->is_type_b (Note_head::static_name ())) + if (it_l) { - Note_head * h = (Note_head*)it_l; - h->position_i_ += c0_position_i_; - } - else if (it_l->is_type_b (Local_key_item::static_name ())) - { - Local_key_item *i = (Local_key_item*)it_l; - i->c0_position_i_ =c0_position_i_; - } - else if (it_l->is_type_b (Key_item::static_name ())) - { - Key_item *k = (Key_item*)it_l; - k-> set_c_position (c0_position_i_); - } - } + if (Note_head * h = dynamic_cast(it_l)) + { + h->position_i_ += c0_position_i_; + } + else if (Local_key_item *i = dynamic_cast (it_l)) + { + i->c0_position_i_ =c0_position_i_; + } + else if (Key_item *k = dynamic_cast(it_l)) + { + k-> set_c_position (c0_position_i_); + } + } } void @@ -195,13 +190,15 @@ Clef_engraver::do_creation_processing() bool Clef_engraver::do_try_request (Request * r_l) { - Command_req* creq_l= dynamic_cast (r_l); - if (!creq_l || !dynamic_cast (creq_l)) + if (Clef_change_req *cl = dynamic_cast (r_l)) + { + clef_req_l_ = cl; + read_req (clef_req_l_); + return true; + } + else return false; - clef_req_l_ = dynamic_cast (creq_l); - read_req (clef_req_l_); - return true; } void diff --git a/lily/collision-engraver.cc b/lily/collision-engraver.cc index d7c6a102ab..a0d5dc1006 100644 --- a/lily/collision-engraver.cc +++ b/lily/collision-engraver.cc @@ -28,9 +28,8 @@ Collision_engraver::process_acknowledged () void Collision_engraver::acknowledge_element (Score_element_info i) { - if (i.elem_l_->is_type_b (Note_column::static_name ())) + if (Note_column * c = dynamic_cast (i.elem_l_)) { - Note_column * c = (Note_column*) dynamic_cast (i.elem_l_); if (c->rest_b ()) return ; diff --git a/lily/collision.cc b/lily/collision.cc index 3a07ce18e1..a9971951b9 100644 --- a/lily/collision.cc +++ b/lily/collision.cc @@ -18,6 +18,7 @@ Collision::Collision() void Collision::add_column (Note_column* ncol_l) { + // ugh. Fixme. clash_l_arr_.push (ncol_l); add_element (ncol_l); add_dependency (ncol_l); @@ -165,6 +166,10 @@ IMPLEMENT_IS_TYPE_B1(Collision, Item); void Collision::do_substitute_dependency (Score_element*o_l,Score_element*n_l) { - clash_l_arr_.substitute ((Note_column*)dynamic_cast (o_l), - (Note_column*)(n_l?dynamic_cast (n_l):0)); + if (o_l) + { + clash_l_arr_.substitute (dynamic_cast (o_l), + dynamic_cast (n_l)); + + } } diff --git a/lily/dot-column-engraver.cc b/lily/dot-column-engraver.cc index ae6259ac4c..771963e348 100644 --- a/lily/dot-column-engraver.cc +++ b/lily/dot-column-engraver.cc @@ -30,13 +30,10 @@ Dot_column_engraver::do_pre_move_processing () void Dot_column_engraver::acknowledge_element (Score_element_info info) { - Item * i=dynamic_cast (info.elem_l_); - - if (! (i && i->is_type_b (Rhythmic_head::static_name ()))) + Rhythmic_head * h = dynamic_cast(info.elem_l_); + if (!h) return; - Rhythmic_head * h = (Rhythmic_head*)i; - if (!h->dots_l_) return; diff --git a/lily/dot-column.cc b/lily/dot-column.cc index cee8a3edec..284b746cc9 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -33,12 +33,13 @@ void Dot_column::do_substitute_dependency (Score_element*o,Score_element*n) { Item *oi =dynamic_cast (o); - Item *ni = n?dynamic_cast (n):0; - if (oi&&oi->is_type_b (Rhythmic_head::static_name ())) - head_l_arr_.substitute ((Rhythmic_head*)oi, (Rhythmic_head*)ni); - else if (oi && oi->is_type_b (Dots::static_name ())) - dot_l_arr_.substitute ((Dots*) oi, (Dots*) ni); + if (oi && dynamic_cast (oi)) + head_l_arr_.substitute (dynamic_cast (oi), + dynamic_cast(n)); + else if (oi && dynamic_cast (oi)) + dot_l_arr_.substitute (dynamic_cast (oi), + dynamic_cast (n)); } void diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 2b38c4c08e..e0f2680748 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -34,24 +34,16 @@ Dynamic_engraver::do_post_move_processing() bool Dynamic_engraver::do_try_request (Request * r) { - Musical_req * m = dynamic_cast (r); - if (!m) - return false; - Dynamic_req * d = dynamic_cast (m); - if (!d) - return false; - -#if 0 - if (cresc_p_ && dynamic_cast (d) - && dynamic_cast (d)->spantype == Span_req::START) - return false; -#endif - for (int i=0; i < dynamic_req_l_arr_.size (); i++) - if (d->equal_b (dynamic_req_l_arr_[i])) + if(Dynamic_req * d = dynamic_cast (r)) + { + for (int i=0; i < dynamic_req_l_arr_.size (); i++) + if (d->equal_b (dynamic_req_l_arr_[i])) + return true; + + dynamic_req_l_arr_.push (d); return true; - - dynamic_req_l_arr_.push (dynamic_cast (m)); - return true; + } + return false; } void Dynamic_engraver::do_process_requests() @@ -60,7 +52,7 @@ Dynamic_engraver::do_process_requests() for (int i=0; i < dynamic_req_l_arr_.size(); i++) { Dynamic_req *dreq_l = dynamic_req_l_arr_[i]; - if (dynamic_cast (dreq_l)) + if (Absolute_dynamic_req *absd = dynamic_cast (dreq_l)) { if (dynamic_p_) @@ -71,8 +63,8 @@ Dynamic_engraver::do_process_requests() Text_def * td_p = new Text_def; td_p->align_dir_ = CENTER; - String loud = dynamic_cast (dreq_l)->loudness_str (); - td_p->text_str_ = paper ()->lookup_l (0)->dynamic (loud).str_; + String loud = absd->loudness_str (); + td_p->text_str_ = paper ()->lookup_l (0)->dynamic (loud).str_; // ugh td_p->style_str_ = "dynamic"; @@ -80,9 +72,8 @@ Dynamic_engraver::do_process_requests() dynamic_p_ = new Text_item (td_p); announce_element (Score_element_info (dynamic_p_, dreq_l)); } - else if (dynamic_cast (dreq_l)) + else if (Span_dynamic_req *span_l = dynamic_cast (dreq_l)) { - Span_dynamic_req* span_l = dynamic_cast (dreq_l); if (span_l->spantype == Span_req::STOP) { if (!cresc_p_) @@ -188,7 +179,7 @@ Dynamic_engraver::do_removal_processing () void Dynamic_engraver::acknowledge_element (Score_element_info i) { - if (i.elem_l_->is_type_b (Note_column::static_name ())) + if (dynamic_cast (i.elem_l_)) { if (dynamic_p_) dynamic_p_->add_support (i.elem_l_); diff --git a/lily/engraver.cc b/lily/engraver.cc index 8a79b60346..8fccb6a84d 100644 --- a/lily/engraver.cc +++ b/lily/engraver.cc @@ -57,6 +57,6 @@ Engraver_group_engraver* Engraver::daddy_grav_l () const { return (daddy_trans_l_ ) - ? (Engraver_group_engraver*) dynamic_cast (daddy_trans_l_) + ? dynamic_cast (daddy_trans_l_) : 0; } diff --git a/lily/hara-kiri-line-group-engraver.cc b/lily/hara-kiri-line-group-engraver.cc index d85437a921..16619f83c8 100644 --- a/lily/hara-kiri-line-group-engraver.cc +++ b/lily/hara-kiri-line-group-engraver.cc @@ -24,10 +24,11 @@ Hara_kiri_line_group_engraver::create_line_spanner () void Hara_kiri_line_group_engraver::typeset_element(Score_element * e) { - if (e->is_type_b (Note_head::static_name ())) - ((Hara_kiri_vertical_group_spanner*)staffline_p_)->add_note - ((Note_head*)dynamic_cast (e)); - + if (Note_head *h = dynamic_cast (e)) + { + dynamic_cast (staffline_p_) + ->add_note (h); + } Line_group_engraver_group::typeset_element (e); } diff --git a/lily/hara-kiri-vertical-group-spanner.cc b/lily/hara-kiri-vertical-group-spanner.cc index 38468cf91c..9a31e52bca 100644 --- a/lily/hara-kiri-vertical-group-spanner.cc +++ b/lily/hara-kiri-vertical-group-spanner.cc @@ -43,9 +43,9 @@ Hara_kiri_vertical_group_spanner::do_post_processing () void Hara_kiri_vertical_group_spanner::do_substitute_dependency (Score_element*o, Score_element*n) { - if (o->is_type_b (Note_head::static_name ())) - head_l_arr_.substitute ((Note_head*)dynamic_cast (o), - (n)? (Note_head*)dynamic_cast (n) : 0); + if (dynamic_cast (o)) + head_l_arr_.substitute (dynamic_cast (o), + (n)? dynamic_cast (n) : 0); } diff --git a/lily/head-engraver.cc b/lily/head-engraver.cc index ce4e5dcdf3..4b0a3b06fd 100644 --- a/lily/head-engraver.cc +++ b/lily/head-engraver.cc @@ -23,11 +23,12 @@ Note_head_engraver::do_try_request (Request *req_l) if (note_req_l_) return false; - if (!(dynamic_cast (req_l))) - return false; - - note_req_l_=dynamic_cast (req_l); - return true; + if (Note_req * nr = dynamic_cast (req_l)) + { + note_req_l_= nr; + return true; + } + return false; } void diff --git a/lily/heads-engraver.cc b/lily/heads-engraver.cc index a8e0aaa46b..1fc2627102 100644 --- a/lily/heads-engraver.cc +++ b/lily/heads-engraver.cc @@ -18,15 +18,12 @@ Note_heads_engraver::Note_heads_engraver() bool Note_heads_engraver::do_try_request (Request *req_l) { - if (!dynamic_cast (req_l)) - return false; - - Note_req * n =dynamic_cast (req_l); - if (!n) - return false; - - note_req_l_arr_.push (n); - return true; + if (Note_req * n =dynamic_cast (req_l)) + { + note_req_l_arr_.push (n); + return true; + } + return false; } void @@ -49,7 +46,7 @@ Note_heads_engraver::do_process_requests() dot_p_arr_.push (d); } - note_p->position_i_ = dynamic_cast (note_req_l)->pitch_.steps (); + note_p->position_i_ = note_req_l->pitch_.steps (); Score_element_info itinf (note_p,note_req_l); diff --git a/lily/include/atom.hh b/lily/include/atom.hh index f9621382bc..1fd7ef262c 100644 --- a/lily/include/atom.hh +++ b/lily/include/atom.hh @@ -9,7 +9,7 @@ #ifndef ATOM_HH #define ATOM_HH -#include "lily-guile.hh" +#include "protected-scm.hh" #include "string.hh" #include "box.hh" #include "lily-proto.hh" @@ -17,11 +17,15 @@ /// a symbol which can be translated, and freely copied class Atom { Offset off_; + + public: + Protected_scm lambda_; + Score_element * origin_l_; + // urg, only used as a temp buffer String str_; String font_; - SCM lambda_; Box dim_; Offset offset () const; diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index 56ce820c7e..c4479cb567 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -40,4 +40,7 @@ SCM ly_quote (); SCM lambda_scm (String str, Array args_arr); SCM lambda_scm (String str, Array args_arr); + + + #endif // LILY_GUILE_HH diff --git a/lily/include/music-list.hh b/lily/include/music-list.hh index 6cdda3dc5b..477ab2465f 100644 --- a/lily/include/music-list.hh +++ b/lily/include/music-list.hh @@ -30,7 +30,6 @@ public: class Music_sequence : public Music { public: - int multi_level_i_; Music_list * music_p_list_p_; Music_sequence (Music_sequence const&); diff --git a/lily/include/protected-scm.hh b/lily/include/protected-scm.hh new file mode 100644 index 0000000000..e83593a537 --- /dev/null +++ b/lily/include/protected-scm.hh @@ -0,0 +1,30 @@ +/* + protected-scm.hh -- declare Protected_scm + + source file of the GNU LilyPond music typesetter + + (c) 1998 Han-Wen Nienhuys + + */ + +#ifndef PROTECTED_SCM_HH +#define PROTECTED_SCM_HH + +#include "lily-guile.hh" + +/* + Mix GUILE GC with C++ ctors and dtors. + */ +class Protected_scm +{ + SCM object_; +public: + Protected_scm (); + Protected_scm (SCM); + Protected_scm (Protected_scm const &); + ~Protected_scm (); + Protected_scm &operator = (Protected_scm const &); + operator SCM (); +}; + +#endif /* PROTECTED_SCM_HH */ diff --git a/lily/include/spring-spacer.hh b/lily/include/spring-spacer.hh index defcd15bc3..33390810ce 100644 --- a/lily/include/spring-spacer.hh +++ b/lily/include/spring-spacer.hh @@ -45,12 +45,11 @@ class Spring_spacer : public Line_spacer { friend class Durations_iter; - - + Pointer_list ideal_p_list_; Array cols_; Array loose_col_arr_; - Array rods_; + /// mark column #i# as being loose. void loosen_column (int i); diff --git a/lily/item.cc b/lily/item.cc index e48d576cfd..ad00cb3685 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -129,10 +129,10 @@ Item::handle_prebroken_dependencies() int Item::left_right_compare(Item const *l, Item const *r) { - while (!l->is_type_b (Paper_column::static_name ())) - l = dynamic_cast (l->axis_group_l_a_[X_AXIS]); - while (!r->is_type_b (Paper_column::static_name ())) - r = dynamic_cast (r->axis_group_l_a_[X_AXIS]); + while (!(dynamic_cast (l))) + l = dynamic_cast (l->axis_group_l_a_[X_AXIS]); + while (!(dynamic_cast (r))) + r = dynamic_cast (r->axis_group_l_a_[X_AXIS]); Paper_column *p1 = (Paper_column*)l; Paper_column* p2 = (Paper_column*)r; @@ -190,8 +190,3 @@ Item::Item (Item const &s) break_priority_i_ = s.break_priority_i_; } -Item * -Item::access_Item () -{ - return this; -} diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index bb66802d86..77a29425f5 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -36,29 +36,27 @@ Key_engraver::create_key () bool Key_engraver::do_try_request (Request * req_l) { - Command_req* creq_l= dynamic_cast (req_l); - if (!creq_l|| !dynamic_cast (creq_l)) - return false; - - if (keyreq_l_) - return false; // TODO - keyreq_l_ = dynamic_cast (creq_l); - read_req (keyreq_l_); - return true; + if (Key_change_req *kc = dynamic_cast (req_l)) + { + if (keyreq_l_) + warning ("Fixme: key change merge."); + keyreq_l_ = kc; + read_req (keyreq_l_); + return true; + } + return false; } void Key_engraver::acknowledge_element (Score_element_info info) { - Command_req * r_l = dynamic_cast (info.req_l_) ; - - if (r_l && dynamic_cast (r_l)) + if (dynamic_cast (info.req_l_)) { int i= get_property ("createKeyOnClefChange").length_i (); if (i) create_key (); } - else if (info.elem_l_->is_type_b (Bar::static_name ()) + else if (dynamic_cast (info.elem_l_) && accidental_idx_arr_.size ()) { if (!keyreq_l_) diff --git a/lily/key-performer.cc b/lily/key-performer.cc index 3ccac03e21..b163e4022f 100644 --- a/lily/key-performer.cc +++ b/lily/key-performer.cc @@ -29,7 +29,7 @@ Key_performer::do_print() const { #ifndef NPRINT if (key_req_l_) - key_req_l_->print(); + key_req_l_->print(); #endif } @@ -37,19 +37,19 @@ void Key_performer::do_process_requests() { if (key_req_l_) - play (new Audio_key (key_req_l_)); + play (new Audio_key (key_req_l_)); key_req_l_ = 0; } bool Key_performer::do_try_request (Request* req_l) { - if (key_req_l_) - return false; - - if (dynamic_cast (req_l)) + if (Key_change_req *kc = dynamic_cast (req_l)) { - key_req_l_ = dynamic_cast (req_l); + if (key_req_l_) + warning ("FIXME. Key change merge"); + + key_req_l_ = kc; return true; } diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index daa7588554..375ff46359 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -97,3 +97,4 @@ lambda_scm (String str, Array args_arr) return scm; } + diff --git a/lily/local-key-engraver.cc b/lily/local-key-engraver.cc index 54df397c45..9b0658b647 100644 --- a/lily/local-key-engraver.cc +++ b/lily/local-key-engraver.cc @@ -40,7 +40,7 @@ Local_key_engraver::do_creation_processing () } else { - key_C_ = &((Key_engraver*)dynamic_cast (result))->key_; + key_C_ = &(dynamic_cast (result))->key_; local_key_ = *key_C_; } } @@ -96,23 +96,20 @@ Local_key_engraver::do_pre_move_processing() void Local_key_engraver::acknowledge_element (Score_element_info info) { - Score_element * elem_l = info.elem_l_; - Item * item_l = dynamic_cast (elem_l); - Note_req * note_l = dynamic_cast (info.req_l_); - - if (note_l && item_l && item_l->is_type_b (Note_head::static_name ())) + Note_head * note_head = dynamic_cast (info.elem_l_); + + if (note_l && note_head) { mel_l_arr_.push (note_l); - support_l_arr_.push (item_l); + support_l_arr_.push (note_head); } else if (dynamic_cast (info.req_l_)) { local_key_ = *key_C_; } - else if (elem_l->is_type_b (Tie::static_name ())) + else if (Tie * tie_l = dynamic_cast (info.elem_l_)) { - Tie * tie_l = (Tie*)dynamic_cast (elem_l); if (tie_l->same_pitch_b_) tied_l_arr_.push (tie_l-> head_l_drul_[RIGHT]); } diff --git a/lily/lookup.cc b/lily/lookup.cc index 9d85d63ba9..c763bb56e1 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -86,7 +86,7 @@ Lookup::afm_find (String s) const a.dim_[Y_AXIS] *= 1 / 1000.0; Array arr; arr.push (m.code ()); - a.lambda_ = lambda_scm ("char", arr); + a.lambda_ = (lambda_scm ("char", arr)); a.font_ = font_; return a; } @@ -106,7 +106,7 @@ Lookup::bar (String str, Real h) const Array arr; arr.push (h); Atom a = (*symtables_p_) ("bars")->lookup (str); - a.lambda_ = lambda_scm (a.str_, arr); + a.lambda_ = (lambda_scm (a.str_, arr)); a.dim_.y () = Interval (-h/2, h/2); a.font_ = font_; return a; @@ -115,11 +115,17 @@ Lookup::bar (String str, Real h) const Atom Lookup::beam (Real slope, Real width, Real thick) const { - Atom a (ps_beam (slope, width, thick)); Real height = slope * width; Real min_y = (0 ? height) + thick/2; - + + Array arr; + arr.push (width); + arr.push (slope); + arr.push (thick); + + Atom a; + a.lambda_ = (lambda_scm ("beam", arr)); a.dim_[X_AXIS] = Interval (0, width); a.dim_[Y_AXIS] = Interval (min_y, max_y); return a; @@ -145,7 +151,7 @@ Lookup::dashed_slur (Array controls, Real thick, Real dash) const a.dim_[Y_AXIS] = Interval (0 ? dy); // (lambda (o) (dashed-slur o '((0.1 0.2) (1.1 1.2) (2.1 2.2) (3.1 3.2)))) - a.lambda_ = + a.lambda_ = ( ly_append (ly_lambda_o (), ly_list1 (ly_append (ly_func_o ("dashed-slur"), gh_cons (gh_double2scm (thick), gh_cons (gh_double2scm (dash), @@ -154,7 +160,7 @@ Lookup::dashed_slur (Array controls, Real thick, Real dash) const gh_cons (ly_list2 (gh_double2scm (controls[2].x ()), gh_double2scm (controls[2].y ())), gh_cons (ly_list2 (gh_double2scm (controls[3].x ()), gh_double2scm (controls[3].y ())), gh_cons (ly_list2 (gh_double2scm (controls[0].x ()), gh_double2scm (controls[0].y ())), - SCM_EOL))))))))))); + SCM_EOL)))))))))))); return a; } @@ -210,7 +216,7 @@ Lookup::rule_symbol (Real height, Real width) const Array args; args.push (height); args.push (width); - bs.lambda_ = lambda_scm (bs.str_, args); + bs.lambda_ = (lambda_scm (bs.str_, args)); bs.dim_.x () = Interval (0, width); bs.dim_.y () = Interval (0, height); return bs; @@ -223,19 +229,26 @@ Lookup::script (String str) const } Atom -Lookup::special_time_signature (String s, Array arr) const +Lookup::special_time_signature (String s, Array arr) const { -#if 0 - String symbolname = "timesig-"+s+"%/%"; - Atom a (afm_find (lambda_scm (symbolname, arr))); + String symbolname = "timesig-" + s; + if (!arr.empty ()) + symbolname += to_str (arr[0]); + if (arr.size () >1) + symbolname += "/" + to_str (arr[1]); + + Atom a = afm_find (symbolname); if (!a.empty ()) return a; + +#if 0 //guess we covered this // Try if the full name was given a = afm_find ("timesig-"+s); if (!a.empty ()) return a; - // Resort to default layout with numbers #endif + + // Resort to default layout with numbers return time_signature (arr); } @@ -261,7 +274,7 @@ Lookup::stem (Real y1, Real y2) const a.push (y2); a.push (-y1); - s.lambda_ = lambda_scm ("stem", a); + s.lambda_ = (lambda_scm ("stem", a)); s.font_ = font_; return s; } @@ -282,17 +295,17 @@ Lookup::text (String style, String text) const a.push (text); Atom s = (*symtables_p_) ("style")->lookup (style); - s.lambda_ = lambda_scm (s.str_, a); + s.lambda_ = (lambda_scm (s.str_, a)); s.font_ = font_; return s; } Atom -Lookup::time_signature (Array a) const +Lookup::time_signature (Array a) const { Atom s ((*symtables_p_) ("param")->lookup ("time_signature")); - s.lambda_ = lambda_scm (s.str_, a); + s.lambda_ = (lambda_scm (s.str_, a)); return s; } @@ -327,7 +340,7 @@ Lookup::vbrace (Real &y) const Array a; a.push (idx); - brace.lambda_ = lambda_scm (brace.str_, a); + brace.lambda_ = (lambda_scm (brace.str_, a)); brace.dim_[Y_AXIS] = Interval (-y/2,y/2); brace.font_ = font_; @@ -370,18 +383,6 @@ Lookup::plet (Real dy , Real dx, Direction dir) const return s; } -Atom -Lookup::ps_beam (Real slope, Real width, Real thick) const -{ - String ps; - ps += to_str (width) + " "+ to_str (slope) + " " + to_str (thick) - + " draw_beam "; - - Atom s; - s.str_ = ps; - return s; -} - Atom Lookup::slur (Array controls) const { @@ -394,7 +395,7 @@ Lookup::slur (Array controls) const Atom a; // (lambda (o) (slur o '((0.1 0.2) (1.1 1.2) (2.1 2.2) (3.1 3.2) .. ))) - a.lambda_ = + a.lambda_ = ( ly_append (ly_lambda_o (), ly_list1 (ly_append (ly_func_o ("slur"), ly_list1 (ly_list2 (ly_quote (), @@ -406,7 +407,7 @@ Lookup::slur (Array controls) const gh_cons (ly_list2 (gh_double2scm (controls[2].x ()), gh_double2scm (controls[2].y ())), gh_cons (ly_list2 (gh_double2scm (controls[3].x ()), gh_double2scm (controls[3].y ())), gh_cons (ly_list2 (gh_double2scm (controls[0].x ()), gh_double2scm (controls[0].y ())), - SCM_EOL))))))))))))); + SCM_EOL)))))))))))))); a.dim_[X_AXIS] = Interval (0, dx); a.dim_[Y_AXIS] = Interval (0 ? dy); @@ -427,7 +428,7 @@ Lookup::vbracket (Real &y) const } Array arr; arr.push (y); - a.lambda_ = lambda_scm ("bracket", arr); + a.lambda_ = (lambda_scm ("bracket", arr)); a.dim_[Y_AXIS] = Interval (-y/2,y/2); a.dim_[X_AXIS] = Interval (0,4 PT); return a; diff --git a/lily/lyric-engraver.cc b/lily/lyric-engraver.cc index da7102b1f7..9555cad7eb 100644 --- a/lily/lyric-engraver.cc +++ b/lily/lyric-engraver.cc @@ -23,12 +23,12 @@ Lyric_engraver::Lyric_engraver() bool Lyric_engraver::do_try_request (Request*r) { - Musical_req * m =dynamic_cast (r); - if (!m || ! dynamic_cast (m)) - return false; - lreq_l_ = dynamic_cast (m); - - return true; + if (Lyric_req * lr = dynamic_cast (r)) + { + lreq_l_ = lr; + return true; + } + return false; } void diff --git a/lily/main.cc b/lily/main.cc index d9a7a0afc0..9adf5a5941 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -224,15 +224,18 @@ setup_paths () if (!prefix_directory.empty_b()) { - global_path.add (prefix_directory + "/share/lilypond/init/"); - global_path.add (prefix_directory + "/share/lilypond"); + global_path.add (prefix_directory + "/share/lilypond/ly/"); + global_path.add (prefix_directory + "/share/lilypond/afm/"); + } + else + { + global_path.add (String (DIR_DATADIR) + "/ly/"); + global_path.add (String (DIR_DATADIR) + "/afm/"); } - - global_path.add (String (DIR_DATADIR) + "/ly/"); - global_path.add (String (DIR_DATADIR) + "/afm/"); } + void main_prog (int argc, char **argv) { @@ -341,6 +344,7 @@ main_prog (int argc, char **argv) default_outname_base_global = outname_str; do_one_file (i, default_outname_base_global); } + exit( exit_status_i_); } int @@ -355,12 +359,12 @@ main (int argc, char **argv) #endif } -/* - urg: make input file name: +/** + make input file name from command arg. - input: file name + @input file name - output: file name with added default extension. "" is stdin. + @output file name with added default extension. "" is stdin. in reference argument: the extension. ".ly" if none */ String @@ -375,6 +379,7 @@ distill_inname_str (String name_str, String& ext_r) split_path (str,a,b,c,ext_r); // add extension if not present. + // UGH. Should parametrise in list of default extensions. if (ext_r.empty_b ()) { ext_r = ".fly"; diff --git a/lily/mark-engraver.cc b/lily/mark-engraver.cc index 71119e4eb6..3c25f1aeae 100644 --- a/lily/mark-engraver.cc +++ b/lily/mark-engraver.cc @@ -26,13 +26,12 @@ Mark_engraver::Mark_engraver () bool Mark_engraver::do_try_request (Request* r_l) { - Command_req* c_l = dynamic_cast (r_l); - if (!c_l || !dynamic_cast (c_l) || mark_req_l_) - return false; - - mark_req_l_ = dynamic_cast (c_l); - - return true; + if (Mark_req *mr = dynamic_cast (r_l)) + { + mark_req_l_ = mr; + return true; + } + return false; } void diff --git a/lily/multi-measure-rest-engraver.cc b/lily/multi-measure-rest-engraver.cc index 03578a5815..d72da1d4f0 100644 --- a/lily/multi-measure-rest-engraver.cc +++ b/lily/multi-measure-rest-engraver.cc @@ -26,20 +26,20 @@ Multi_measure_rest_engraver::Multi_measure_rest_engraver () bool Multi_measure_rest_engraver::do_try_request (Request* req_l) { - if (!dynamic_cast (req_l)) - return false; - - if (multi_measure_req_l_) - if (!multi_measure_req_l_->equal_b (req_l) - || req_start_mom_ != now_moment ()) - return false; - - multi_measure_req_l_ = dynamic_cast (req_l); - req_start_mom_ = now_moment (); + if (Multi_measure_rest_req *mr = dynamic_cast (req_l)) + { + if (multi_measure_req_l_) + if (!multi_measure_req_l_->equal_b (req_l) + || req_start_mom_ != now_moment ()) + return false; - rest_req_stop_mom_ = req_start_mom_ + multi_measure_req_l_->duration_.length (); - - return true; + multi_measure_req_l_ = mr; + req_start_mom_ = now_moment (); + + rest_req_stop_mom_ = req_start_mom_ + multi_measure_req_l_->duration_.length (); + return true; + } + return false; } void diff --git a/lily/music-iterator.cc b/lily/music-iterator.cc index 2b329815d6..5505c145a7 100644 --- a/lily/music-iterator.cc +++ b/lily/music-iterator.cc @@ -136,19 +136,19 @@ Music_iterator* Music_iterator::static_get_iterator_p (Music const *m, Translator_group *report_l) { Music_iterator * p =0; - if (m->is_type_b (Request_chord::static_name())) + if (dynamic_cast (m)) p = new Request_chord_iterator; - else if (m->is_type_b (Simultaneous_music::static_name())) + else if (dynamic_cast (m)) p = new Simultaneous_music_iterator; - else if (m->is_type_b (Sequential_music::static_name())) + else if (dynamic_cast (m)) p = new Sequential_music_iterator; - else if (m->is_type_b (Translation_property::static_name ())) + else if (dynamic_cast (m)) p = new Property_iterator; - else if (m->is_type_b (Change_translator::static_name ())) + else if (dynamic_cast (m)) p = new Change_iterator; - else if (m->is_type_b (Compressed_music::static_name ())) + else if (dynamic_cast (m)) p = new Compressed_music_iterator; - else if (m->is_type_b (Music_wrapper::static_name ())) + else if (dynamic_cast (m)) p = new Music_wrapper_iterator; p->music_l_ = m; diff --git a/lily/music-list.cc b/lily/music-list.cc index 7c47ded027..b712f3e255 100644 --- a/lily/music-list.cc +++ b/lily/music-list.cc @@ -109,7 +109,6 @@ IMPLEMENT_IS_TYPE_B1(Request_chord, Simultaneous_music); Request_chord::Request_chord() : Simultaneous_music (new Music_list) { - multi_level_i_ =0; } @@ -118,10 +117,9 @@ Request_chord::to_relative_octave (Musical_pitch last) { for (iter (music_p_list_p_->top(),i); i.ok (); i++) { - Musical_req *m = dynamic_cast (i.ptr ()); - if (m && dynamic_cast (m)) + if (Melodic_req *m= dynamic_cast (i.ptr ())) { - Musical_pitch &pit = dynamic_cast (m)->pitch_; + Musical_pitch &pit = m->pitch_; pit.to_relative_octave (last); return pit; } diff --git a/lily/music-output-def.cc b/lily/music-output-def.cc index 8e28cdf4bb..cdd7af56a8 100644 --- a/lily/music-output-def.cc +++ b/lily/music-output-def.cc @@ -40,7 +40,7 @@ Music_output_def::Music_output_def (Music_output_def const &s) for (Dictionary_iter i (*translator_p_dict_p_); i.ok (); i++) { - Translator * t = i.val ()->access_Translator (false); + Translator * t = i.val ()->access_content_Translator (false); t-> output_def_l_ = this; } } @@ -60,7 +60,7 @@ Translator* Music_output_def::find_translator_l (String name) const { if (translator_p_dict_p_->elem_b (name)) - return (*translator_p_dict_p_)[name]->access_Translator (); + return (*translator_p_dict_p_)[name]->access_content_Translator (false); if (global_translator_dict_p->elem_b (name)) return (*global_translator_dict_p)[name]; @@ -76,7 +76,7 @@ Music_output_def::get_global_translator_p () if (!t) error (_("Can't find Score context")); t = t->clone (); - Global_translator *g = dynamic_cast (t)->global_l (); + Global_translator *g = dynamic_cast (t); t->add_processing (); return g; @@ -98,6 +98,6 @@ Music_output_def::get_default_output () const return ""; Identifier * id = (*scope_p_) ["output"]; - String *p = dynamic_cast (id); + String *p = id->access_content_String (false); return p ? *p : String (""); } diff --git a/lily/music-sequence.cc b/lily/music-sequence.cc index fd00a120e8..8d8299a510 100644 --- a/lily/music-sequence.cc +++ b/lily/music-sequence.cc @@ -13,7 +13,6 @@ Music_sequence::Music_sequence (Music_sequence const&s) : Music (s) { - multi_level_i_ = s.multi_level_i_; music_p_list_p_ = new Music_list (*s.music_p_list_p_); } @@ -21,7 +20,6 @@ IMPLEMENT_IS_TYPE_B1(Music_sequence, Music); Music_sequence::Music_sequence(Music_list *mlist_p) { - multi_level_i_ = 0; music_p_list_p_ = mlist_p; } diff --git a/lily/musical-request.cc b/lily/musical-request.cc index 6c72cb538a..c12cd16c29 100644 --- a/lily/musical-request.cc +++ b/lily/musical-request.cc @@ -105,7 +105,7 @@ bool Melodic_req::do_equal_b (Request*r) const { Melodic_req* m= dynamic_cast (r); - return !compare (*m, *this); + return m&& !compare (*m, *this); } int @@ -131,7 +131,7 @@ Rhythmic_req::do_equal_b (Request*r) const { Rhythmic_req* rh = dynamic_cast (r); - return !compare (*this, *rh); + return rh&& !compare (*this, *rh); } @@ -178,7 +178,8 @@ Lyric_req::do_print () const bool Note_req::do_equal_b (Request*r) const { - return Rhythmic_req::do_equal_b (r) && Melodic_req::do_equal_b (r); + Note_req *n = dynamic_cast (r); + return n&& Rhythmic_req::do_equal_b (n) && Melodic_req::do_equal_b (n); } @@ -270,7 +271,7 @@ bool Span_req:: do_equal_b (Request*r) const { Span_req * s = dynamic_cast (r); - return spantype == s->spantype; + return s&& spantype == s->spantype; } Span_req::Span_req () @@ -294,7 +295,7 @@ Script_req::do_equal_b (Request*r) const { Script_req * s = dynamic_cast (r); - return scriptdef_p_->equal_b (*s->scriptdef_p_); + return s&& scriptdef_p_->equal_b (*s->scriptdef_p_); } Script_req::Script_req () @@ -401,7 +402,7 @@ bool Absolute_dynamic_req::do_equal_b (Request *r) const { Absolute_dynamic_req *a = dynamic_cast (r); - return loudness_ == a->loudness_; + return a&& loudness_ == a->loudness_; } String @@ -451,7 +452,7 @@ Span_dynamic_req::do_equal_b (Request *req) const { Span_dynamic_req * s = dynamic_cast (req); - return Span_req::do_equal_b (req) && s->dynamic_dir_ == dynamic_dir_; + return s&& Span_req::do_equal_b (req) && s->dynamic_dir_ == dynamic_dir_; } Span_dynamic_req::Span_dynamic_req () diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index 4c7d05a9a2..df3634bce5 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -109,7 +109,7 @@ My_lily_lexer::start_main_input () } void -My_lily_lexer::set_identifier (String name_str, Identifier* i, bool unique_b) +My_lily_lexer::set_identifier (String name_str, Identifier* i, bool ) { Identifier *old =0; if (scope_l_arr_.top ()->elem_b (name_str)) @@ -140,7 +140,7 @@ My_lily_lexer::~My_lily_lexer() } void -My_lily_lexer::print_declarations (bool init_b) const +My_lily_lexer::print_declarations (bool ) const { for (int i=scope_l_arr_.size (); i--; ) { diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc index f3cdf87aba..a024f0dd68 100644 --- a/lily/my-lily-parser.cc +++ b/lily/my-lily-parser.cc @@ -177,6 +177,10 @@ My_lily_parser::get_note_element (Note_req *rq, Duration * duration_p) return v; } + +/* + UGH. + */ Array* My_lily_parser::get_parens_request (int t) { @@ -314,13 +318,13 @@ Paper_def* My_lily_parser::default_paper_p () { Identifier *id = lexer_p_->lookup_identifier ("$defaultpaper"); - return id ? id->access_Paper_def () : new Paper_def ; + return id ? id->access_content_Paper_def (true) : new Paper_def ; } Midi_def* My_lily_parser::default_midi_p () { Identifier *id = lexer_p_->lookup_identifier ("$defaultmidi"); - return id ? id->access_Midi_def () : new Midi_def ; + return id ? id->access_content_Midi_def (true) : new Midi_def ; } diff --git a/lily/note-column.cc b/lily/note-column.cc index b00cb5ea0a..ef0c81e380 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -102,30 +102,30 @@ Note_column::do_substitute_dependency (Score_element*o, Score_element*n) { if (stem_l_ == o) { - stem_l_ = n ? (Stem*)dynamic_cast (n):0; + stem_l_ = n ? dynamic_cast (n):0; } - if (o->is_type_b (Note_head::static_name ())) + if (dynamic_cast (o)) { - head_l_arr_.substitute ((Note_head*)dynamic_cast (o), - (n)? (Note_head*)dynamic_cast (n) : 0); + head_l_arr_.substitute (dynamic_cast (o), + (n)? dynamic_cast (n) : 0); } Script_column::do_substitute_dependency (o,n); - if (o->is_type_b (Rest::static_name ())) + if (dynamic_cast (o)) { - rest_l_arr_.substitute ((Rest*)dynamic_cast (o), - (n)? (Rest*)dynamic_cast (n) : 0); + rest_l_arr_.substitute (dynamic_cast (o), + (n)? dynamic_cast (n) : 0); } } void Note_column::add_head (Rhythmic_head *h) { - if (h->is_type_b (Rest::static_name ())) + if (dynamic_cast (h)) { rest_l_arr_.push ((Rest*)h); add_support (h); } - if (h->is_type_b (Note_head::static_name ())) + if (dynamic_cast (h)) { head_l_arr_.push ((Note_head*) h); add_support (h); diff --git a/lily/p-score.cc b/lily/p-score.cc index be107cd929..6b68f7f0fd 100644 --- a/lily/p-score.cc +++ b/lily/p-score.cc @@ -25,9 +25,11 @@ #include "file-results.hh" #include "misc.hh" +#if 0 // has w32 advanced? // sucking Cygnus egcs - w32 #include "list.tcc" #include "cursor.tcc" +#endif Paper_score::Paper_score () { @@ -319,10 +321,11 @@ Paper_score::broken_col_range (Item const*l_item_l, Item const*r_item_l) const Item const*l=l_item_l; Item const*r=r_item_l; - while (! l->is_type_b(Paper_column::static_name ())) + // huh? see Item::left_right_compare () + while (! (dynamic_cast (l))) l = dynamic_cast (l->axis_group_l_a_[X_AXIS]); - while (! r->is_type_b(Paper_column::static_name ())) + while (! (dynamic_cast (r))) r = dynamic_cast(r->axis_group_l_a_[X_AXIS]); PCursor start (l ? find_col ((Paper_column*)l)+1 : col_p_list_.top ()); diff --git a/lily/performer.cc b/lily/performer.cc index 7c5e541f82..449caf22bb 100644 --- a/lily/performer.cc +++ b/lily/performer.cc @@ -30,6 +30,6 @@ Performer_group_performer* Performer::daddy_perf_l () const { return (daddy_trans_l_) - ?(Performer_group_performer*) dynamic_cast (daddy_trans_l_) + ?dynamic_cast (daddy_trans_l_) : 0; } diff --git a/lily/pitch-squash-engraver.cc b/lily/pitch-squash-engraver.cc index 4851cee02c..8c3273cd7c 100644 --- a/lily/pitch-squash-engraver.cc +++ b/lily/pitch-squash-engraver.cc @@ -13,10 +13,9 @@ void Pitch_squash_engraver::acknowledge_element (Score_element_info i) { - if (i.elem_l_->is_type_b (Note_head::static_name ())) + if (Note_head *nh = dynamic_cast (i.elem_l_)) { - Note_head * nl = (Note_head*)dynamic_cast (i.elem_l_); - nl->position_i_ =0; + nh->position_i_ =0; } } diff --git a/lily/plet-engraver.cc b/lily/plet-engraver.cc index ed85c58bfd..172a491200 100644 --- a/lily/plet-engraver.cc +++ b/lily/plet-engraver.cc @@ -27,7 +27,9 @@ Plet_engraver::Plet_engraver () void Plet_engraver::acknowledge_element (Score_element_info i) { - if (!i.elem_l_->is_type_b (Stem::static_name ())) + + Stem * st = (dynamic_cast (i.elem_l_)); + if (!st) return; if (!plet_spanner_p_) return; @@ -35,10 +37,10 @@ Plet_engraver::acknowledge_element (Score_element_info i) return; if (!plet_spanner_p_->stem_l_drul_[LEFT]) - plet_spanner_p_->set_stem (LEFT, (Stem*)dynamic_cast (i.elem_l_)); + plet_spanner_p_->set_stem (LEFT, st); else if (span_reqs_drul_[RIGHT] && !plet_spanner_p_->stem_l_drul_[RIGHT]) - plet_spanner_p_->set_stem (RIGHT, (Stem*)dynamic_cast (i.elem_l_)); + plet_spanner_p_->set_stem (RIGHT, st); } bool diff --git a/lily/plet-spanner.cc b/lily/plet-spanner.cc index 4a032ffc72..57f6ca30cf 100644 --- a/lily/plet-spanner.cc +++ b/lily/plet-spanner.cc @@ -130,7 +130,7 @@ Plet_spanner::do_post_processing () void Plet_spanner::do_substitute_dependency (Score_element* o, Score_element* n) { - Stem* new_l = n ? (Stem*)dynamic_cast (n) : 0; + Stem* new_l = n ? dynamic_cast (n) : 0; if (dynamic_cast (o) == stem_l_drul_[LEFT]) stem_l_drul_[LEFT] = new_l; else if (dynamic_cast (o) == stem_l_drul_[RIGHT]) diff --git a/lily/plet-swallow-engraver.cc b/lily/plet-swallow-engraver.cc index 47da034354..994a84003b 100644 --- a/lily/plet-swallow-engraver.cc +++ b/lily/plet-swallow-engraver.cc @@ -15,5 +15,5 @@ ADD_THIS_TRANSLATOR(Plet_swallow_engraver); bool Plet_swallow_engraver::do_try_request (Request* req_l) { - return dynamic_cast (req_l); + return dynamic_cast (req_l); } diff --git a/lily/priority-halign-engraver.cc b/lily/priority-halign-engraver.cc index 2aa56cb7cf..6a9d8d15dd 100644 --- a/lily/priority-halign-engraver.cc +++ b/lily/priority-halign-engraver.cc @@ -30,7 +30,7 @@ void Priority_horizontal_align_engraver::acknowledge_element (Score_element_info i) { Engraver* reg = i.origin_grav_l_arr_[0]; - if (reg->is_type_b (Score_priority_engraver::static_name())) + if (dynamic_cast (reg)) { if (!halign_p_) { diff --git a/lily/protected-scm.cc b/lily/protected-scm.cc new file mode 100644 index 0000000000..0304d91f91 --- /dev/null +++ b/lily/protected-scm.cc @@ -0,0 +1,52 @@ +/* + protected-scm.cc -- implement Protected_scm + + source file of the GNU LilyPond music typesetter + + (c) 1998 Han-Wen Nienhuys + + */ +#include "protected-scm.hh" +extern "C" +{ +#include +}; + + +Protected_scm::Protected_scm () +{ + object_ = 0; +} + +Protected_scm::Protected_scm (SCM s) +{ + object_ = s ? scm_protect_object (s): 0; +} + +Protected_scm::Protected_scm (Protected_scm const &s) +{ + object_ = s.object_ ? scm_protect_object (s.object_) : 0; +} + +Protected_scm & +Protected_scm::operator =(Protected_scm const &s) +{ + if (this == &s) + return *this; + if (object_) + scm_unprotect_object(object_); + + object_ = (s.object_) ? scm_protect_object (s.object_): 0; + return *this; +} + +Protected_scm::~Protected_scm () +{ + if (object_) + scm_unprotect_object (object_); +} + +Protected_scm::operator SCM () +{ + return object_; +} diff --git a/lily/request-iterator.cc b/lily/request-iterator.cc index 56764298f5..5ed0f31155 100644 --- a/lily/request-iterator.cc +++ b/lily/request-iterator.cc @@ -65,11 +65,14 @@ Request_chord_iterator::do_process_and_next (Moment mom) { for (PCursor i (elt_l ()->music_p_list_p_->top ()); i.ok(); i++) { - assert (i->is_type_b (Request::static_name())); - Request * req_l = (Request*)i.ptr(); - bool gotcha = report_to_l()->try_request (req_l); - if (!gotcha) - req_l->warning (_f ("junking request: `%s\'", req_l->name())); + if (Request * req_l = dynamic_cast (i.ptr())) + { + bool gotcha = report_to_l()->try_request (req_l); + if (!gotcha) + req_l->warning (_f ("junking request: `%s\'", req_l->name())); + } + else + i.ptr ()->warning (_f ("Huh? Not a Request: `%s\'", i.ptr()->name ())); } first_b_ = false; } diff --git a/lily/request.cc b/lily/request.cc index 858d5c44d5..aadbe80aef 100644 --- a/lily/request.cc +++ b/lily/request.cc @@ -23,17 +23,12 @@ Request::do_print() const bool Request::equal_b (Request *r) const { - if (is_type_b (r->name())) - return r->do_equal_b ((Request*)this); - if (r->is_type_b (name())) - return do_equal_b (r); - - return false; + return r->do_equal_b (this) || this->do_equal_b (r) ; } bool Request::do_equal_b (Request*) const { - return false; + return true; } diff --git a/lily/rest-collision-engraver.cc b/lily/rest-collision-engraver.cc index 2c52168807..89ac8e6531 100644 --- a/lily/rest-collision-engraver.cc +++ b/lily/rest-collision-engraver.cc @@ -36,8 +36,8 @@ Rest_collision_engraver::process_acknowledged () void Rest_collision_engraver::acknowledge_element (Score_element_info i) { - if (i.elem_l_->is_type_b (Note_column::static_name())) - note_column_l_arr_.push ((Note_column*)dynamic_cast (i.elem_l_)); + if (dynamic_cast (i.elem_l_)) + note_column_l_arr_.push (dynamic_cast (i.elem_l_)); } void diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index 54cfe814c1..095c6ac469 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -133,14 +133,11 @@ Rest_collision::do_print() const void Rest_collision::do_substitute_dependency (Score_element*o,Score_element*n) { - Item*o_l = dynamic_cast (o); - - - if (o_l&&o_l->is_type_b (Note_column::static_name ())) + if (Note_column *onl = dynamic_cast (o)) { - Note_column *n_l = n?(Note_column*)dynamic_cast (n):0; - rest_l_arr_.substitute ((Note_column*)o_l, n_l); - ncol_l_arr_.substitute ((Note_column*)o_l, n_l); + Note_column *n_l = n?dynamic_cast (n):0; + rest_l_arr_.substitute (onl, n_l); + ncol_l_arr_.substitute (onl, n_l); } } diff --git a/lily/rest-engraver.cc b/lily/rest-engraver.cc index f4f2e6efbe..2170886e55 100644 --- a/lily/rest-engraver.cc +++ b/lily/rest-engraver.cc @@ -60,14 +60,14 @@ Rest_engraver::do_process_requests () } bool -Rest_engraver::do_try_request (Request *r) +Rest_engraver::do_try_request (Request *req) { - Musical_req *m = dynamic_cast (r); - if (!m || !dynamic_cast (m)) - return false; - - rest_req_l_ = dynamic_cast (m); // ugh - return true; + if (Rest_req *r = dynamic_cast (req)) + { + rest_req_l_ = r; + return true; + } + return false; } IMPLEMENT_IS_TYPE_B1(Rest_engraver, Engraver); diff --git a/lily/rhythmic-column-engraver.cc b/lily/rhythmic-column-engraver.cc index 8c1cacfdf5..8bccc1eec6 100644 --- a/lily/rhythmic-column-engraver.cc +++ b/lily/rhythmic-column-engraver.cc @@ -70,21 +70,21 @@ Rhythmic_column_engraver::acknowledge_element (Score_element_info i) Item * item = dynamic_cast (i.elem_l_); if (!item) return; - if (item->is_type_b (Script::static_name ()) + if (dynamic_cast