From 0aeecc4d0e1e2490aa73025d03d9a3b480db48ed Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 26 Mar 2002 21:47:46 +0000 Subject: [PATCH] lilypond-1.1.34 --- NEWS | 26 +++++ lily/axis-group-element.cc | 11 --- lily/axis-group-spanner.cc | 2 - lily/bar-script-engraver.cc | 7 +- lily/base-span-bar-engraver.cc | 5 + lily/clef-item.cc | 14 ++- lily/font-size-engraver.cc | 4 +- lily/graphical-element.cc | 16 ---- lily/include/audio-column.hh | 4 +- lily/include/axis-group-element.hh | 2 - lily/include/axis-group-item.hh | 10 -- lily/include/axis-group-spanner.hh | 8 -- lily/include/graphical-element.hh | 2 - lily/include/horizontal-group-item.hh | 6 -- .../include/horizontal-vertical-group-item.hh | 3 - lily/include/item.hh | 31 +++--- lily/include/line-of-score.hh | 2 - lily/include/midi-item.hh | 19 +--- lily/include/midi-stream.hh | 16 ++-- lily/include/performance.hh | 11 ++- lily/include/score-element.hh | 31 +++--- lily/include/span-bar.hh | 1 - lily/include/spanner.hh | 2 - lily/include/stem.hh | 2 - lily/include/super-element.hh | 1 - lily/include/translator.hh | 5 +- lily/include/vertical-group-spanner.hh | 2 - lily/item.cc | 32 +------ lily/line-of-score.cc | 13 --- lily/lookup.cc | 31 +++--- lily/midi-item.cc | 31 +++--- lily/p-score.cc | 4 - lily/performance.cc | 52 ++++++---- lily/score-element.cc | 95 ++++++++----------- lily/span-bar-engraver.cc | 2 - lily/span-bar.cc | 6 -- lily/span-score-bar-engraver.cc | 10 +- lily/spanner.cc | 20 ---- lily/super-element.cc | 9 -- lily/translator.cc | 6 ++ scm/lily.scm | 50 ++++++++-- 41 files changed, 240 insertions(+), 364 deletions(-) diff --git a/NEWS b/NEWS index 6034166157..c522692383 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,29 @@ +pl 33.uu2 + - some performance cleanups: junked PointerList instance, plugged some leaks. + - style -> fontname now in scheme. + - minor Score_element brainsurgery: + * generic element properties. + * junked Score_element::junk_links, Score_element::unlink + * junked Directed_graph_node as superclass of +Score_element, this should reduce mem usage a bit. + +pl 33.jcn2 + - fixed autobeamer's beam->unlink () + +pl 33.jcn1 + - allow autobeaming according to duration iso (crude) multiplicity + +pl 33.jbr1 + - change my email address + - Windows platform does a cp -r instead of a ln -s + +pl 33.uu1 + - bf: ^ and _ + - junked poor man's dynamics. + +********* +pl 33 + pl 32.mb1 - bf: \> and \< were interchanged!! - Added property: textScriptPadding diff --git a/lily/axis-group-element.cc b/lily/axis-group-element.cc index 85850655b4..5b42c70e8a 100644 --- a/lily/axis-group-element.cc +++ b/lily/axis-group-element.cc @@ -9,17 +9,6 @@ #include "axis-group-element.hh" #include "graphical-axis-group.hh" -void -Axis_group_element::do_unlink() -{ - remove_all(); -} - -void -Axis_group_element::do_junk_links() -{ - elem_l_arr_.set_size (0); -} Link_array diff --git a/lily/axis-group-spanner.cc b/lily/axis-group-spanner.cc index 8517e93862..b78887ef6c 100644 --- a/lily/axis-group-spanner.cc +++ b/lily/axis-group-spanner.cc @@ -102,8 +102,6 @@ Axis_group_spanner::do_break_processing() { my_item->transparent_b_ = true; my_item->set_empty (true); - /*my_item->unlink (); - delete my_item;*/ } } diff --git a/lily/bar-script-engraver.cc b/lily/bar-script-engraver.cc index 14c26b6e03..7262b1fc08 100644 --- a/lily/bar-script-engraver.cc +++ b/lily/bar-script-engraver.cc @@ -138,8 +138,11 @@ Bar_script_engraver::create_items (Request *rq) staff_side_p_->padding_f_ = Real(padding); } - staff_side_p_->visibility_lambda_ = visibility_lambda_; - text_p_->visibility_lambda_ = visibility_lambda_; + + staff_side_p_->set_elt_property (ly_symbol ("visibility_lambda"), + visibility_lambda_); + text_p_->set_elt_property (ly_symbol ("visibility_lambda"), + visibility_lambda_); announce_element (Score_element_info (text_p_, rq)); announce_element (Score_element_info (staff_side_p_, rq)); diff --git a/lily/base-span-bar-engraver.cc b/lily/base-span-bar-engraver.cc index d36a15dee6..92fe5ee248 100644 --- a/lily/base-span-bar-engraver.cc +++ b/lily/base-span-bar-engraver.cc @@ -6,6 +6,7 @@ (c) 1997--1999 Han-Wen Nienhuys */ +#include "lily-guile.hh" #include "span-bar.hh" #include "base-span-bar-engraver.hh" #include "vertical-align-spanner.hh" @@ -50,6 +51,10 @@ Base_span_bar_engraver::acknowledge_element (Score_element_info i) */ { spanbar_p_ = get_span_bar_p(); + String visnam = String(name()) + "_visibility"; + + spanbar_p_->set_elt_property (ly_symbol ("visibility_lambda"), + gh_eval_str (visnam.ch_C())); if (use_priority_b_) { diff --git a/lily/clef-item.cc b/lily/clef-item.cc index 456688dc86..08eb9ea4c4 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -56,21 +56,19 @@ Clef_item::do_add_processing () Real r = do_height ()[octave_dir_] + g->extent (Y_AXIS)[-octave_dir_]; g->dim_cache_[Y_AXIS].set_offset (r); } + if (default_b_) { - visibility_lambda_ = defvis; + set_elt_property (ly_symbol ("visibility_lambda"), + defvis); + if (g) - g->visibility_lambda_ = defvis; + g->set_elt_property (ly_symbol ("visibility_lambda"), + defvis); } } - - } - - - - Molecule* Clef_item::do_brew_molecule_p() const { diff --git a/lily/font-size-engraver.cc b/lily/font-size-engraver.cc index fa5e1e4200..22436f0aba 100644 --- a/lily/font-size-engraver.cc +++ b/lily/font-size-engraver.cc @@ -9,6 +9,7 @@ #include "font-size-engraver.hh" #include "score-element.hh" +#include "lily-guile.hh" Font_size_engraver::Font_size_engraver () { @@ -29,7 +30,8 @@ Font_size_engraver::do_process_requests () void Font_size_engraver::acknowledge_element (Score_element_info e) { - e.elem_l_->size_i_ = size_i_; + e.elem_l_->set_elt_property (ly_symbol ("fontsize"), + gh_int2scm (size_i_)); } ADD_THIS_TRANSLATOR (Font_size_engraver); diff --git a/lily/graphical-element.cc b/lily/graphical-element.cc index e4e217f093..98c3c02b62 100644 --- a/lily/graphical-element.cc +++ b/lily/graphical-element.cc @@ -96,22 +96,6 @@ Graphical_element::extent (Axis a) const return d->get_dim (); } -void -Graphical_element::unlink () -{ - for (int a=X_AXIS; a < NO_AXES; a++) - if (Dimension_cache * d = dim_cache_[a].parent_l_) - { - if (Graphical_axis_group * eg - = dynamic_cast (d->elt_l_)) - eg->remove_element (this); - } -} - -void -Graphical_element::junk_links () -{ -} void Graphical_element::do_print () const diff --git a/lily/include/audio-column.hh b/lily/include/audio-column.hh index f1df72b631..42836a54b4 100644 --- a/lily/include/audio-column.hh +++ b/lily/include/audio-column.hh @@ -12,13 +12,13 @@ #include "lily-proto.hh" #include "moment.hh" #include "pcursor.hh" - +#include "audio-element.hh" /** generic audio grouped vertically. */ -class Audio_column { +class Audio_column : public Audio_element { public: Audio_column (Moment at_mom); diff --git a/lily/include/axis-group-element.hh b/lily/include/axis-group-element.hh index 130dbfdda5..e272ffca0d 100644 --- a/lily/include/axis-group-element.hh +++ b/lily/include/axis-group-element.hh @@ -22,8 +22,6 @@ class Axis_group_element : public virtual Score_element, protected: virtual void do_print() const; virtual Link_array get_extra_dependencies() const; - virtual void do_unlink(); - virtual void do_junk_links(); public: virtual Link_array elem_l_arr() const; diff --git a/lily/include/axis-group-item.hh b/lily/include/axis-group-item.hh index 7ad8e64329..9d0852b64a 100644 --- a/lily/include/axis-group-item.hh +++ b/lily/include/axis-group-item.hh @@ -22,16 +22,6 @@ protected: virtual void do_breakable_col_processing(); void OK() const; virtual void do_print() const; - virtual void do_junk_links() { - Item::do_junk_links(); - Axis_group_element::do_junk_links(); - } - virtual void do_unlink() { - Item::do_unlink(); - Axis_group_element::do_unlink(); - } -public: - }; #endif // AXIS_ITEM_HH diff --git a/lily/include/axis-group-spanner.hh b/lily/include/axis-group-spanner.hh index 029693125d..138c58787a 100644 --- a/lily/include/axis-group-spanner.hh +++ b/lily/include/axis-group-spanner.hh @@ -19,14 +19,6 @@ class Axis_group_spanner : public Spanner, public virtual Axis_group_element { void do_break_processing_if_unbroken(); protected: - virtual void do_junk_links () { - Spanner::do_junk_links(); - Axis_group_element::do_junk_links(); - } - virtual void do_unlink() { - Spanner::do_unlink(); - Axis_group_element::do_unlink(); - } virtual void do_break_processing(); virtual void do_print() const; diff --git a/lily/include/graphical-element.hh b/lily/include/graphical-element.hh index 49e069d065..70e0ea9c2f 100644 --- a/lily/include/graphical-element.hh +++ b/lily/include/graphical-element.hh @@ -59,8 +59,6 @@ public: Graphical_element *parent_l (Axis a) const; - void unlink (); - void junk_links (); virtual void do_print () const; protected: virtual Interval do_height () const=0; diff --git a/lily/include/horizontal-group-item.hh b/lily/include/horizontal-group-item.hh index 6d5a85a738..0c96d29c95 100644 --- a/lily/include/horizontal-group-item.hh +++ b/lily/include/horizontal-group-item.hh @@ -18,12 +18,6 @@ */ class Horizontal_group_item : public Axis_group_item, public Horizontal_group_element { protected: - virtual void do_unlink () { - Axis_group_item::do_unlink (); - } - virtual void do_junk_links() { - Axis_group_item::do_junk_links(); - } virtual void do_print() const; public: Horizontal_group_item (); diff --git a/lily/include/horizontal-vertical-group-item.hh b/lily/include/horizontal-vertical-group-item.hh index bea2065a5d..e5f7bbfe17 100644 --- a/lily/include/horizontal-vertical-group-item.hh +++ b/lily/include/horizontal-vertical-group-item.hh @@ -20,9 +20,6 @@ class Horizontal_vertical_group_item : public Axis_group_item, public Horizontal_vertical_group_element { protected: virtual void do_print() const; - virtual void do_unlink () { - Axis_group_item::do_unlink (); - } VIRTUAL_COPY_CONS(Score_element); public: Horizontal_vertical_group_item (); diff --git a/lily/include/item.hh b/lily/include/item.hh index 75f1bbf8d0..db8e5c4cf9 100644 --- a/lily/include/item.hh +++ b/lily/include/item.hh @@ -24,7 +24,18 @@ NB. This doesn't mean an Item has to initialize the output field before spacing calculation. -*/ + + + @signature + visibility_lambda :: int -> (bool . bool) + + @in + break direction + + @out + (transparent, empty) cons + + */ class Item : public virtual Score_element { void do_break (); void try_visibility_lambda (); @@ -34,22 +45,10 @@ public: Drul_array broken_to_drul_; Item *unbroken_original_l_; - /** - - visibility_lambda :: int -> (bool . bool) - - @in - break direction - - @out - (transparent, empty) cons - - */ - Protected_scm visibility_lambda_; /// should be put in a breakable col. bool breakable_b_; - /// I am really to be broken? + /// I am really to be broken? virtual bool breakable_b () const; Direction break_status_dir_; @@ -70,9 +69,7 @@ public: Item (Item const &); protected: - virtual void do_unlink (); - virtual void do_junk_links(); - virtual void do_breakable_col_processing(); + virtual void do_breakable_col_processing(); virtual void handle_prebroken_dependencies(); virtual void do_print() const; virtual bool linked_b() const; diff --git a/lily/include/line-of-score.hh b/lily/include/line-of-score.hh index 1fd877f9a0..c98ae4dd50 100644 --- a/lily/include/line-of-score.hh +++ b/lily/include/line-of-score.hh @@ -32,8 +32,6 @@ public: protected: virtual Link_array get_extra_dependencies () const; - virtual void do_unlink (); - virtual void do_junk_links (); virtual Interval do_width() const; virtual void do_print() const; diff --git a/lily/include/midi-item.hh b/lily/include/midi-item.hh index 61f374f668..51996efa7f 100644 --- a/lily/include/midi-item.hh +++ b/lily/include/midi-item.hh @@ -7,11 +7,10 @@ #ifndef MIDI_ITEM_HH #define MIDI_ITEM_HH +#include "cons.hh" #include "string.hh" #include "lily-proto.hh" #include "proto.hh" -#include "plist.hh" -#include "virtual-methods.hh" #include "moment.hh" /** @@ -20,7 +19,6 @@ Maybe use base classes for RIFF files? */ struct Midi_item { - Midi_item (Audio_item* audio_item_l); virtual ~Midi_item (); static String i2varint_str (int i); @@ -64,7 +62,6 @@ private: }; struct Midi_duration : public Midi_item { - Midi_duration (Real seconds_f); virtual String str () const; @@ -72,8 +69,6 @@ struct Midi_duration : public Midi_item { }; struct Midi_header : Midi_chunk { - - Midi_header (int format_i, int tracks_i, int clocks_per_4_i); }; @@ -81,7 +76,6 @@ struct Midi_header : Midi_chunk { Change instrument event */ struct Midi_instrument : public Midi_item { - Midi_instrument (int channel_i, String instrument_str); virtual String str () const; @@ -90,15 +84,12 @@ struct Midi_instrument : public Midi_item { struct Midi_key : public Midi_item { - Midi_key (Audio_item* audio_item_l); virtual String str () const; }; struct Midi_time_signature : Midi_item { - - Midi_time_signature (Audio_item* audio_item_l); virtual String str () const; @@ -109,7 +100,6 @@ struct Midi_time_signature : Midi_item { Turn a note on (blond). */ struct Midi_note : public Midi_item { - Midi_note (Audio_item* audio_item_l); Moment length_mom () const; @@ -124,7 +114,6 @@ struct Midi_note : public Midi_item { Turn a note off (dark). */ struct Midi_note_off : public Midi_item { - Midi_note_off (Midi_note*); int pitch_i () const; @@ -150,7 +139,6 @@ struct Midi_text : Midi_item { }; struct Midi_tempo : Midi_item { - Midi_tempo (int per_minute_4_i); Midi_tempo (Audio_item* audio_item_l); @@ -160,10 +148,9 @@ struct Midi_tempo : Midi_item { }; struct Midi_track : Midi_chunk { - int number_i_; - Pointer_list event_p_list_; - + Cons_list event_p_list_; + Midi_track (); ~Midi_track (); diff --git a/lily/include/midi-stream.hh b/lily/include/midi-stream.hh index fef0d537ba..08643bb8d1 100644 --- a/lily/include/midi-stream.hh +++ b/lily/include/midi-stream.hh @@ -12,17 +12,17 @@ /// Midi outputfile struct Midi_stream { - Midi_stream (String filename_str); - ~Midi_stream(); + Midi_stream (String filename_str); + ~Midi_stream(); - Midi_stream& operator <<( String str); - Midi_stream& operator <<( Midi_item const& mitem_c_r); - Midi_stream& operator <<( int i); + Midi_stream& operator <<( String str); + Midi_stream& operator <<( Midi_item const& mitem_c_r); + Midi_stream& operator <<( int i); - void open(); + void open(); - ostream* os_p_; - String filename_str_; + ostream* os_p_; + String filename_str_; }; #endif // MIDI_STREAM_HH diff --git a/lily/include/performance.hh b/lily/include/performance.hh index 9aa8b3af89..3e34dc7cf5 100644 --- a/lily/include/performance.hh +++ b/lily/include/performance.hh @@ -7,8 +7,9 @@ #ifndef PERFORMANCE_HH #define PERFORMANCE_HH +#include "parray.hh" #include "lily-proto.hh" -#include "plist.hh" +#include "cons.hh" #include "music-output.hh" /** all stuff which goes onto midi. notes, signs, symbols in a score @@ -18,7 +19,7 @@ class Performance : public Music_output { public: Performance (); - ~Performance () {} + ~Performance (); void add_column (Audio_column*); void add_staff (Audio_staff* l); @@ -31,9 +32,9 @@ public: void print() const; void process(); - Pointer_list audio_column_p_list_; - Link_list audio_staff_l_list_; - Pointer_list audio_elem_p_list_; + + Link_array audio_staff_l_arr_; + Cons *audio_elem_p_list_; Midi_def * midi_l_; }; diff --git a/lily/include/score-element.hh b/lily/include/score-element.hh index 69f8eb998f..a3cfd50f69 100644 --- a/lily/include/score-element.hh +++ b/lily/include/score-element.hh @@ -11,7 +11,7 @@ #include "virtual-methods.hh" #include "directed-graph.hh" #include "graphical-element.hh" - +#include "protected-scm.hh" typedef void (Score_element::*Score_element_method_pointer) (void); @@ -24,7 +24,10 @@ typedef void (Score_element::*Score_element_method_pointer) (void); form an acyclic graph. (elem) */ -class Score_element : private Directed_graph_node, public virtual Graphical_element { +class Score_element : public virtual Graphical_element { + Protected_scm element_property_alist_; + Link_array dependency_arr_; + public: /// delete after linebreak calculation. bool break_helper_only_b_; @@ -33,19 +36,16 @@ public: Score_element (); Score_element (Score_element const&); virtual void print () const; - + + SCM get_elt_property (SCM sym); + void set_elt_property (SCM sym, SCM val); + Paper_def *paper () const; Lookup const *lookup_l () const; virtual ~Score_element (); - - void add_processing (); - /** - Remove all links (dependencies, dependents, Axis_group_elements. - */ - void unlink (); void substitute_dependency (Score_element*,Score_element*); void remove_dependency (Score_element*); /** @@ -60,12 +60,10 @@ public: /// do not print anything black bool transparent_b_; - int size_i_; - // ugh: no protection. Denk na, Vrij Veilig void calculate_dependencies (int final, int busy, Score_element_method_pointer funcptr); -protected: +public: /** Administration: Where are we?. This is mainly used by Super_element and Score_element::calcalute_dependencies () @@ -74,21 +72,18 @@ protected: -1 means deleted */ -public: int status_i_; + protected: Score_element* dependency (int) const; - Score_element* dependent (int) const; - int dependent_size () const; int dependency_size () const; virtual void output_processing (); - void junk_links (); virtual Interval do_height () const; virtual Interval do_width () const; /// do printing of derived info. - virtual void do_print () const {} + virtual void do_print () const; /// generate the molecule virtual Molecule* do_brew_molecule_p () const; ///executed directly after the item is added to the Paper_score @@ -109,8 +104,6 @@ protected: virtual void handle_prebroken_dependencies (); virtual void handle_prebroken_dependents (); virtual Link_array get_extra_dependencies () const; - virtual void do_unlink (); - virtual void do_junk_links (); }; diff --git a/lily/include/span-bar.hh b/lily/include/span-bar.hh index 42a2937cbf..f55c5f8626 100644 --- a/lily/include/span-bar.hh +++ b/lily/include/span-bar.hh @@ -27,7 +27,6 @@ class Span_bar : public Bar Interval get_spanned_interval () const; public: Real extra_x_off_; - bool no_width_b_; Span_bar(); VIRTUAL_COPY_CONS(Score_element); diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index b046ab1a5f..0c7bf2a5f5 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -71,8 +71,6 @@ protected: Spanner * unbroken_original_l_; - virtual void do_unlink (); - virtual void do_junk_links (); virtual void output_processing (); virtual void do_space_processing (); virtual void do_break_processing (); diff --git a/lily/include/stem.hh b/lily/include/stem.hh index db26221ab8..eb31f3a9f2 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -28,8 +28,6 @@ Stem size depends on flag. */ class Stem : public Item { - - Drul_array yextent_drul_; /// needed for determining direction/length diff --git a/lily/include/super-element.hh b/lily/include/super-element.hh index da982a31db..8c3342a4e6 100644 --- a/lily/include/super-element.hh +++ b/lily/include/super-element.hh @@ -24,7 +24,6 @@ public: void break_processing(); void post_processing(); void output_all (); - void unlink_all (); protected: diff --git a/lily/include/translator.hh b/lily/include/translator.hh index f9d6071849..0f945fc3f5 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -26,10 +26,9 @@ class Translator : public Input { public: Music_output_def * output_def_l_; String type_str_; - - bool is_alias_b (String) const; - + virtual const char *name() const; + bool is_alias_b (String) const; VIRTUAL_COPY_CONS(Translator); Translator (Translator const &); diff --git a/lily/include/vertical-group-spanner.hh b/lily/include/vertical-group-spanner.hh index 49be1529f3..9726ca64b2 100644 --- a/lily/include/vertical-group-spanner.hh +++ b/lily/include/vertical-group-spanner.hh @@ -19,8 +19,6 @@ class Vertical_group_spanner : public Axis_group_spanner, public Vertical_group_ { protected: VIRTUAL_COPY_CONS(Score_element); - virtual void do_junk_links () { Axis_group_spanner::do_junk_links (); } - virtual void do_unlink () { Axis_group_spanner::do_unlink (); } public: Vertical_group_spanner (); diff --git a/lily/item.cc b/lily/item.cc index 6ff6400b99..9a8d10aea4 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -11,6 +11,7 @@ #include "item.hh" #include "p-col.hh" #include "spanner.hh" +#include "lily-guile.hh" Item::Item () { @@ -92,10 +93,11 @@ Item::copy_breakable_items() void Item::try_visibility_lambda () { - if (visibility_lambda_) + SCM vis = get_elt_property (ly_symbol ("visibility_lambda")); + if (vis != SCM_BOOL_F) { SCM args = scm_listify (gh_int2scm (break_status_dir_), SCM_UNDEFINED); - SCM result = gh_apply (visibility_lambda_, args); + SCM result = gh_apply ( SCM_CDR(vis), args); int trans = gh_scm2bool (gh_car (result)); int empty = gh_scm2bool (gh_cdr (result)); @@ -170,32 +172,7 @@ Item::linked_b() const return Score_element::linked_b() || attached_span_l_arr_.size(); } -void -Item::do_junk_links() -{ - attached_span_l_arr_.set_size(0); -} -void -Item::do_unlink() -{ - Link_array attached=attached_span_l_arr_; - for (int i=0; i < attached.size (); i++) - { - Spanner *s= attached[i]; - - Direction d= LEFT; - do { - if (s->spanned_drul_[d] == this) - s->set_bounds (d, 0); - if (unbroken_original_l_ - && unbroken_original_l_-> broken_to_drul_[d] == this) - unbroken_original_l_->broken_to_drul_[d] = 0; - } while (flip (&d) != LEFT); - } - assert (!attached_span_l_arr_.size ()); - unbroken_original_l_ =0; -} Paper_column * Item::column_l () const @@ -209,7 +186,6 @@ Item::Item (Item const &s) unbroken_original_l_ = 0; /* do not copy attached_span_l_arr_ */ breakable_b_ = s.breakable_b_; - visibility_lambda_ = s.visibility_lambda_; broken_to_drul_[LEFT] = broken_to_drul_[RIGHT] =0; break_status_dir_ = s.break_status_dir_; break_priority_i_ = s.break_priority_i_; diff --git a/lily/line-of-score.cc b/lily/line-of-score.cc index 9d563be580..ac6c0a10bb 100644 --- a/lily/line-of-score.cc +++ b/lily/line-of-score.cc @@ -95,18 +95,5 @@ Line_of_score::get_extra_dependencies () const return r; } -void -Line_of_score::do_unlink () -{ - Spanner::do_unlink (); - for (int i=0; i < cols_.size (); i++) - cols_[i]->line_l_ =0; - cols_.set_size (0); -} -void -Line_of_score::do_junk_links () -{ - cols_.set_size (0); -} diff --git a/lily/lookup.cc b/lily/lookup.cc index 7bf26da20b..07b57f0b9b 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -26,6 +26,7 @@ #include "scope.hh" #include "molecule.hh" #include "atom.hh" +#include "lily-guile.hh" SCM array_to_list (SCM *a , int l) @@ -379,27 +380,13 @@ Lookup::stem (Real y1, Real y2) const } -static Dict_initialiser cmr_init[] = { - {"bold", "cmbx"}, - {"dynamic", "feta-din"}, - {"finger", "feta-nummer"}, - {"typewriter", "cmtt"}, - {"italic", "cmti"}, - {"roman", "cmr"}, - {"large", "cmbx"}, - {"Large", "cmbx"}, - {"mark", "feta-nummer"}, - {"number", "feta-nummer"}, - {"volta", "feta-nummer"}, - {0,0} -}; /** Magnification steps. These are powers of 1.2. The numbers are taken from Knuth's plain.tex: */ static Real mag_steps[] = {1, 1, 1.200, 1.440, 1.7280, 2.074, 2.488}; -static Dictionary cmr_dict (cmr_init); + Molecule Lookup::text (String style, String text) const @@ -418,9 +405,13 @@ Lookup::text (String style, String text) const font_mag = (int)paper_l_->get_var ("magnification_" + style); } - if (cmr_dict.elem_b (style)) + SCM l = gh_eval_str (("(style-to-cmr \"" + style + "\")").ch_C()); + if (l != SCM_BOOL_F) { - style = String (cmr_dict [style]) + to_str ((int)font_h); // ugh + int len ; + char * s = gh_scm2newstr(SCM_CDR (l), &len); + style = String (s) + to_str ((int)font_h); + delete s; } Real w = 0; @@ -436,7 +427,8 @@ Lookup::text (String style, String text) const ; else { - Character_metric *c = afm_l->get_char (text[i],false); + Character_metric *c = afm_l->get_char ((unsigned char)text[i],false); + w += c->dimensions()[X_AXIS].length (); ydims.unite (c->dimensions()[Y_AXIS]); } @@ -444,6 +436,7 @@ Lookup::text (String style, String text) const if (font_mag > 1 && font_mag < 7 ) { + /* UGH */ style = style + String(" scaled \\magstep ") + to_str (font_mag); w *= mag_steps[font_mag]; ydims *= mag_steps[font_mag]; @@ -452,6 +445,8 @@ Lookup::text (String style, String text) const DOUT << "\n" << to_str (w) << "\n"; m.dim_.x () = Interval (0, w); m.dim_.y () = ydims; + + Atom at (gh_list (ly_symbol ("text"), gh_str02scm (text.ch_C()), SCM_UNDEFINED)); diff --git a/lily/midi-item.cc b/lily/midi-item.cc index 96c992c3fe..a753b7cc9f 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -19,18 +19,7 @@ #include "midi-stream.hh" #include "audio-item.hh" - - - - - - - - - - - - +#include "killing-cons.tcc" Midi_chunk::Midi_chunk () : Midi_item (0) @@ -122,13 +111,14 @@ Midi_header::Midi_header (int format_i, int tracks_i, int clocks_per_4_i) set ("MThd", str, ""); } +/* why doesn't this start at 0 ? + */ char const* const instrument_name_sz_a_[ ] = { - /* default is usually piano */ /* 0 "piano", */ - /* (1-8 piano) */ - /* 1 */ "acoustic grand", + /* (1-8 piano) */ + /* 1 */ "acoustic grand", /* 2 */ "bright acoustic", /* 3 */ "electric grand", /* 4 */ "honky-tonk", @@ -435,9 +425,11 @@ Midi_note::str () const String str = to_str ((char)status_byte); str += to_str ((char) (pitch_i () + c0_pitch_i_c_)); +#if 0 // poor man's staff dynamics: str += to_str ((char) (dynamic_byte_ - 0x10 * channel_i_)); - +#endif + return str; } @@ -556,7 +548,8 @@ Midi_track::add (Moment delta_time_mom, Midi_item* mitem_p) { assert (delta_time_mom >= Moment (0)); - event_p_list_.bottom ().add (new Midi_event (delta_time_mom, mitem_p)); + Midi_event * e = new Midi_event (delta_time_mom, mitem_p); + event_p_list_.append (new Killing_cons (e, 0)); } String @@ -565,9 +558,9 @@ Midi_track::data_str () const String str = Midi_chunk::data_str (); if (check_debug && !monitor->silent_b ("Midistrings")) str += "\n"; - for (PCursor i (event_p_list_); i.ok (); i++) + for (Cons *i=event_p_list_.head_; i; i = i->next_) { - str += i->str (); + str += i->car_->str (); if (check_debug && !monitor->silent_b ("Midistrings")) str += "\n"; } diff --git a/lily/p-score.cc b/lily/p-score.cc index c1d512e5c9..3d25f61739 100644 --- a/lily/p-score.cc +++ b/lily/p-score.cc @@ -145,10 +145,6 @@ void delete_array_contents (Link_array const&to_remove, Dictionar else if (dynamic_cast(e)) type_stats["Spanner"] ++; type_stats["Total"] ++; - - e->unlink (); - assert (!e->linked_b ()); - delete e; } } diff --git a/lily/performance.cc b/lily/performance.cc index 87392b5153..e10a51c229 100644 --- a/lily/performance.cc +++ b/lily/performance.cc @@ -21,33 +21,53 @@ #include "file-results.hh" #include "lily-version.hh" +#include "killing-cons.tcc" + Performance::Performance () { midi_l_ =0; + audio_elem_p_list_ = 0; } void Performance::add_column (Audio_column* p) { p->performance_l_ = this; - audio_column_p_list_.bottom().add (p); + add_element (p); +} + +Performance::~Performance() +{ + delete audio_elem_p_list_; } void -Performance::output (Midi_stream& midi_stream_r) +Performance::output (Midi_stream& midi_stream) { - int tracks_i = audio_staff_l_list_.size() + 1; + int tracks_i = audio_staff_l_arr_.size() + 1; + // ugh int clocks_per_4_i = 384; - midi_stream_r << Midi_header (1, tracks_i, clocks_per_4_i); - output_header_track (midi_stream_r); + + midi_stream << Midi_header (1, tracks_i, clocks_per_4_i); + output_header_track (midi_stream); int n = 1; - for (PCursor i (audio_staff_l_list_); i.ok(); i++) - i->output (midi_stream_r, n++); + for (int i =0; i < audio_staff_l_arr_.size (); i++) + { + Audio_staff *s = audio_staff_l_arr_[i]; + /* + Aargh, let's hear it for the MIDI standard. + MIDI players tend to ignore instrument settings on + channel 10, the percussion channel by default. + */ + if (n == 10) + n++; + s->output (midi_stream, n++); + } } void -Performance::output_header_track (Midi_stream& midi_stream_r) +Performance::output_header_track (Midi_stream& midi_stream) { Midi_track midi_track; @@ -87,19 +107,19 @@ Performance::output_header_track (Midi_stream& midi_stream_r) Midi_tempo tempo (midi_l_->get_tempo_i (Moment (1, 4))); midi_track.add (Moment (0), &tempo); - midi_stream_r << midi_track; + midi_stream << midi_track; } void Performance::add_staff (Audio_staff* l) { - audio_staff_l_list_.bottom().add (l); + audio_staff_l_arr_.push (l); } void Performance::add_element (Audio_element *p) { - audio_elem_p_list_.bottom().add (p); + audio_elem_p_list_ = new Killing_cons (p, audio_elem_p_list_); } void @@ -108,13 +128,9 @@ Performance::print() const #ifndef NPRINT DOUT << "Performance { "; DOUT << "Items: "; - for (PCursor i (audio_elem_p_list_.top ()); i.ok (); i++) - i->print (); - - DOUT << "\ncolumns: "; - for (PCursor i (audio_column_p_list_); i.ok(); i++) - i->print(); - DOUT << "}\n"; + for (Cons* i =audio_elem_p_list_; i; i = i->next_) + i->car_->print (); + DOUT << "}"; #endif } diff --git a/lily/score-element.cc b/lily/score-element.cc index c3e00d4611..1cd16cdfbd 100644 --- a/lily/score-element.cc +++ b/lily/score-element.cc @@ -28,30 +28,30 @@ Score_element::Score_element() output_p_ =0; break_helper_only_b_ = false; transparent_b_ = false; - size_i_ = 0; pscore_l_=0; status_i_ = 0; + element_property_alist_ = SCM_EOL; } Score_element::Score_element (Score_element const&s) - : Directed_graph_node (s), Graphical_element (s) + : Graphical_element (s) { /* called from derived ctor, so most info points to the same deps as (Directed_graph_node&)s. Nobody points to us, so don't copy dependents. */ - copy_edges_out (s); + + + // deep copy ? + element_property_alist_ = s.element_property_alist_; + dependency_arr_ = s.dependency_arr_; output_p_ =0; break_helper_only_b_ = s.break_helper_only_b_; transparent_b_ = s.transparent_b_; status_i_ = s.status_i_; pscore_l_ = s.pscore_l_; - size_i_ = s.size_i_; } - - - Score_element::~Score_element() { delete output_p_; @@ -62,29 +62,29 @@ Score_element::~Score_element() Score_element* Score_element::dependency (int i) const { - return (Score_element*) (get_out_edge_arr ()[i]); + return dependency_arr_ [i]; } int Score_element::dependency_size () const { - return get_out_edge_arr ().size (); + return dependency_arr_.size (); } -Score_element* -Score_element::dependent (int i) const + + +SCM +Score_element::get_elt_property (SCM s) { - return (Score_element *)( get_in_edge_arr()[i]); + return scm_assq(s, element_property_alist_); } - -int -Score_element::dependent_size() const +void +Score_element::set_elt_property (SCM s, SCM v) { - return get_in_edge_arr().size (); + element_property_alist_ = + scm_assoc_set_x (element_property_alist_, s, v); } - - Interval Score_element::do_width() const { @@ -120,8 +120,7 @@ Score_element::print() const { #ifndef NPRINT DOUT << classname(this) << "{\n"; - DOUT << "dets: " << dependent_size() << "dependencies: " << - dependency_size(); + DOUT << "dependencies: " << dependency_size(); Graphical_element::do_print (); do_print(); @@ -141,7 +140,11 @@ Score_element::paper() const Lookup const * Score_element::lookup_l () const { - return pscore_l_->paper_l_->lookup_l (size_i_); + SCM sz = scm_assq (ly_symbol ("fontsize"), element_property_alist_); + if (sz != SCM_BOOL_F) + return pscore_l_->paper_l_->lookup_l (gh_scm2int (SCM_CDR (sz))); + else + return pscore_l_->paper_l_->lookup_l (0); } void @@ -237,17 +240,6 @@ Score_element::do_substitute_element_pointer (Score_element*,Score_element*) { } -void -Score_element::do_unlink() -{ -} - -void -Score_element::do_junk_links() -{ -} - - Molecule* Score_element::do_brew_molecule_p() const @@ -272,14 +264,21 @@ Score_element::line_l() const void Score_element::remove_dependency (Score_element*e) { - remove_edge_out (e); + int i; + while ((i = dependency_arr_.find_i (e)) >=0 ) + dependency_arr_.unordered_del (i); + substitute_dependency (e, 0); } void Score_element::add_dependency (Score_element*e) { - Directed_graph_node::add_edge (e); + if (e) + dependency_arr_.push (e); + else + warning("Null dependency added"); + } void Score_element::substitute_dependency (Score_element* old, Score_element* new_l) @@ -378,30 +377,6 @@ Score_element::handle_prebroken_dependents() } -void -Score_element::junk_links () -{ - Directed_graph_node::junk_links(); - Graphical_element::junk_links (); - do_junk_links(); -} - -void -Score_element::unlink() -{ - do_unlink(); - while (dependency_size()) - { - do_substitute_element_pointer (dependency (0),0); - remove_edge_out_idx (0); - } - while (dependent_size()) - { - dependent (0)->remove_dependency (this); - } - Graphical_element::unlink (); -} - Link_array Score_element::get_extra_dependencies() const @@ -416,3 +391,7 @@ Score_element::linked_b() const return get_extra_dependencies().size() || dependency_size(); } +void +Score_element::do_print () const +{ +} diff --git a/lily/span-bar-engraver.cc b/lily/span-bar-engraver.cc index 3848b84164..135d978c15 100644 --- a/lily/span-bar-engraver.cc +++ b/lily/span-bar-engraver.cc @@ -3,8 +3,6 @@ class Span_bar_engraver : public Base_span_bar_engraver { -protected: - Span_bar *get_span_bar_p (); public: Span_bar_engraver (); VIRTUAL_COPY_CONS (Translator); diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 62c2c66fac..67d1e2ea92 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -36,11 +36,6 @@ Span_bar::set_align (Align_element *a) Interval Span_bar::do_width () const { - if (no_width_b_) - { - return Interval (0,0); - } - Molecule m = lookup_l ()->bar (type_str_, 40 PT); return m.extent (X_AXIS); @@ -136,5 +131,4 @@ Span_bar::Span_bar () { type_str_ = ""; extra_x_off_ = 0.0; - no_width_b_ = false; } diff --git a/lily/span-score-bar-engraver.cc b/lily/span-score-bar-engraver.cc index 1efa242c6a..bcf62430b8 100644 --- a/lily/span-score-bar-engraver.cc +++ b/lily/span-score-bar-engraver.cc @@ -15,8 +15,6 @@ Span_bar* Span_score_bar_engraver::get_span_bar_p () const { Span_bar*s = new Span_bar; - s->visibility_lambda_ - = gh_eval_str ("Span_score_bar_visibility"); s->type_str_ = "scorebar"; return s; @@ -33,9 +31,7 @@ Span_bar* Piano_bar_engraver::get_span_bar_p () const { Span_bar *s= new Span_bar; - s->visibility_lambda_ - = gh_eval_str ("Piano_bar_visibility"); - s->no_width_b_ =true; + s->dim_cache_[X_AXIS].set_empty (true); s->type_str_ = "{"; return s; } @@ -44,9 +40,7 @@ Span_bar* Staff_group_bar_engraver::get_span_bar_p () const { Span_bar *s= new Span_bar; - s->visibility_lambda_ - = gh_eval_str ("Staff_group_bar_visibility"); - s->no_width_b_ =true; + s->dim_cache_[X_AXIS].set_empty (true); s->type_str_ = "["; return s; } diff --git a/lily/spanner.cc b/lily/spanner.cc index b9c3f00247..f829026a6c 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -203,28 +203,8 @@ Spanner::broken_b() const return broken_info_.size(); } -void -Spanner::do_unlink() -{ - set_bounds (LEFT, 0); - set_bounds (RIGHT, 0); - if (unbroken_original_l_) - { - for (int i=0; i < unbroken_original_l_->broken_info_.size (); i++) - { - if (unbroken_original_l_->broken_info_[i].broken_spanner_l_ == this) - unbroken_original_l_->broken_info_[i].broken_spanner_l_ = 0; - } - - } -} -void -Spanner::do_junk_links() -{ - spanned_drul_[LEFT] = spanned_drul_[RIGHT] =0; -} Array Spanner::get_rods () const diff --git a/lily/super-element.cc b/lily/super-element.cc index 7b927de55e..c5ee89e9fb 100644 --- a/lily/super-element.cc +++ b/lily/super-element.cc @@ -18,8 +18,6 @@ Super_element::Super_element() } - - /** for administration of what was done already */ @@ -37,8 +35,6 @@ enum Score_element_status { POSTCALCED, // after spacing calcs done BREWING, BREWED, - UNLINKING, - UNLINKED, }; void @@ -85,9 +81,4 @@ Super_element::output_all () -void -Super_element::unlink_all () -{ - calculate_dependencies (UNLINKING, UNLINKED, &Score_element::junk_links); -} diff --git a/lily/translator.cc b/lily/translator.cc index 122b34d98e..a6df5e884a 100644 --- a/lily/translator.cc +++ b/lily/translator.cc @@ -13,6 +13,12 @@ #include "rational.hh" +char const* +Translator::name() const +{ + return classname(this); +} + Translator::~Translator () { } diff --git a/scm/lily.scm b/scm/lily.scm index a87b677c26..d473805efe 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -63,15 +63,38 @@ ;; Score_span_bars are only visible at start of line ;; i.e. if break_dir == RIGHT == 1 -(define Span_score_bar_visibility postbreak_only_visibility) -(define Piano_bar_visibility postbreak_only_visibility) -(define Staff_group_bar_visibility postbreak_only_visibility) +(define Span_score_bar_engraver_visibility postbreak_only_visibility) +(define Span_bar_engraver_visibility non_postbreak_visibility) +(define Piano_bar_engraver_visibility postbreak_only_visibility) +(define Staff_group_bar_engraver_visibility postbreak_only_visibility) ;;;;;;;; TeX +(define cmr-alist + '(("bold" . "cmbx") + ("dynamic" . "feta-din") + ("finger" . "feta-nummer") + ("typewriter" . "cmtt") + ("italic" . "cmti") + ("roman" . "cmr") + ("large" . "cmbx") + ("Large" . "cmbx") + ("mark" . "feta-nummer") + ("number" . "feta-nummer") + ("volta" . "feta-nummer")) +) + + +;; Map style names to TeX font names. Return false if +;; no font name found. +(define (style-to-cmr s) + (assoc s cmr-alist ) + ) + + (define (tex-scm action-name) (define (unknown) @@ -295,6 +318,8 @@ ;;;;;;;;;;;; PS (define (ps-scm action-name) + + ;; alist containing fontname -> fontcommand assoc (both strings) (define font-alist '()) (define font-count 0) (define current-font "") @@ -321,10 +346,11 @@ (set! font-count (+ 1 font-count)) (string-append "\n/" font-cmd " {/" font-name - " findfont 12 scalefont setfont} bind def\n" - font-cmd "\n")) - (cdr font-cmd))) - "" ;no switch needed + " findfont 12 scalefont setfont} bind def \n" + font-cmd " \n")) + (string-append (cdr font-cmd) " "))) + ; font-name == current-font no switch needed + "" )) (define (beam width slope thick) @@ -371,7 +397,7 @@ (string-append "\n/" (font i) " {/" (substring s 0 (- (string-length s) 4)) - " findfont 12 scalefont setfont} bind def\n")) + " findfont 12 scalefont setfont} bind def \n")) (define (font-switch i) (string-append (font i) " ")) @@ -400,6 +426,9 @@ (define (placebox x y s) (string-append (number->string x) " " (number->string y) " {" s "} placebox ")) + (define (pianobrace y) + "" + ) (define (rulesym x y) (string-append @@ -424,8 +453,8 @@ (define (stop-line) "}\nstop_line\n") - (define (text f s) - (string-append "(" s ") set" f " ")) + (define (text s) + (string-append "(" s ") show ")) (define (volta w thick last) @@ -461,6 +490,7 @@ (define font-def ,font-def) (define font-switch ,font-switch) (define generalmeter ,generalmeter) + (define pianobrace ,pianobrace) (define header-end ,header-end) (define lily-def ,lily-def) (define header ,header) -- 2.39.5