From: Han-Wen Nienhuys Date: Thu, 16 Feb 2006 11:54:21 +0000 (+0000) Subject: * lily/include/midi-item.hh (class Midi_track): idem. X-Git-Tag: release/2.7.35~20 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8347f6f06cd4c56d7a2d2ec482647afaaade1267;p=lilypond.git * lily/include/midi-item.hh (class Midi_track): idem. * lily/include/source.hh (class Sources): idem. * lily/include/performance.hh (class Performance): use vector iso. Cons<> * flower/include/cons.hh (class Cons): remove file. * flower/include/flower-proto.hh: remove template cruft. * lily/include/font-metric.hh: use size_t not vsize for indices. * flower/include/flower-proto.hh (Module): remove std-vector.hh from proto. * lily/include/all-font-metrics.hh: use HAVE_PANGO_FT2 * flower/include/flower-proto.hh: remove outdated templates. --- diff --git a/ChangeLog b/ChangeLog index 1ce394b799..27ccc1f260 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,23 @@ 2006-02-16 Han-Wen Nienhuys + * lily/include/midi-item.hh (class Midi_track): idem. + + * lily/include/source.hh (class Sources): idem. + + * lily/include/performance.hh (class Performance): use vector + iso. Cons<> + + * flower/include/cons.hh (class Cons): remove file. + + * flower/include/flower-proto.hh: remove template cruft. + + * lily/include/font-metric.hh: use size_t not vsize for indices. + + * flower/include/flower-proto.hh (Module): remove std-vector.hh + from proto. + + * lily/include/all-font-metrics.hh: use HAVE_PANGO_FT2 + * lily/include/paper-book.hh (class Paper_book): make get_system_specs() public. diff --git a/flower/include/cons.hh b/flower/include/cons.hh deleted file mode 100644 index e6be3c419b..0000000000 --- a/flower/include/cons.hh +++ /dev/null @@ -1,161 +0,0 @@ -/* - cons.hh -- declare LISP like datatypes - - source file of the GNU LilyPond music typesetter - - (c) 1999--2006 Han-Wen Nienhuys -*/ - -#ifndef CONS_HH -#define CONS_HH - -#include -using namespace std; - -template -class Cons -{ -public: - T *car_; - Cons *next_; - Cons () - { - car_ = 0; - next_ = 0; - } - Cons (T *t, Cons *c) - { - car_ = t; - next_ = c; - } - virtual ~Cons () - { - delete next_; - } -}; - -template -class Killing_cons : public Cons -{ -public: - Killing_cons (T *t, Cons *p) - : Cons (t, p) - { - } - virtual ~Killing_cons (); -}; - -/// remove the link pointed to by *p. -template -Cons *remove_cons (Cons **pp) -{ - Cons *knip = *pp; - *pp = (*pp)->next_; - knip->next_ = 0; - return knip; -} - -template int cons_list_size (Cons *l) -{ - int i = 0; - while (l) - { - l = l->next_; - i++; - } - return i; -} - -template -Cons *last_cons (Cons *head) -{ - while (head && head->next_) - head = head->next_; - return head; -} - -/** - -Invariants: - -(*tail_) is either the head_ pointer, or a next_ pointer from the list. - -**tail_ == NULL -*/ - -template -class Cons_list -{ -public: - Cons *head_; - Cons ** nil_pointer_address_; - Cons_list () - { - init (); - } - void init () - { - head_ = 0; - nil_pointer_address_ = &head_; - } - void append (T *c) - { - append (new Cons (c, 0)); - } - void append (Cons *c) - { - assert (!c->next_); - *nil_pointer_address_ = c; - while (*nil_pointer_address_) - nil_pointer_address_ = &(*nil_pointer_address_)->next_; - } - /** - PRE: *pp should either be the head_ pointer, or the next_ pointer - from a list cell. - */ - Cons *remove_cons (Cons **pp) - { - if (& (*pp)->next_ == nil_pointer_address_) - nil_pointer_address_ = pp; - - return ::remove_cons (pp); - } - - /// junk everything after the first I elements. - void truncate (int i) - { - Cons **p = &head_; - for (; *p && i; p = &((*p)->next_)) - i--; - - if (*p) - { - delete *p; - *p = 0; - } - nil_pointer_address_ = p; - } - - void junk () - { - delete head_; - head_ = 0; - } - ~Cons_list () - { - junk (); - } - int size () - { - return cons_list_size (head_); - } -}; - -template -void copy_killing_cons_list (Cons_list &, Cons *src); -template -void -clone_killing_cons_list (Cons_list &, Cons *src); - -#endif /* CONS_HH */ - diff --git a/flower/include/flower-proto.hh b/flower/include/flower-proto.hh index cb8cb71bae..0d82d8bbc7 100644 --- a/flower/include/flower-proto.hh +++ b/flower/include/flower-proto.hh @@ -13,7 +13,6 @@ typedef unsigned char Byte; struct String_convert; #include "std-string.hh" -#include "std-vector.hh" using namespace std; #include "real.hh" diff --git a/flower/include/string-convert.hh b/flower/include/string-convert.hh index 2cd863f495..4717bfc49b 100644 --- a/flower/include/string-convert.hh +++ b/flower/include/string-convert.hh @@ -45,7 +45,7 @@ public: static string rational_string (Rational); static string pointer_string (void const *); static string precision_string (double x, int n); - static vector split (string str, char c); + // static vector split (string str, char c); static string i64_string (I64, char const *fmt = 0); static string to_lower (string s); static string to_upper (string s); diff --git a/flower/string-convert.cc b/flower/string-convert.cc index 2175dd8cd4..f9449363f0 100644 --- a/flower/string-convert.cc +++ b/flower/string-convert.cc @@ -315,24 +315,6 @@ String_convert::precision_string (double x, int n) return (sign (x) > 0 ? str : "-" + str); } -vector -String_convert::split (string str, char c) -{ - vector a; - ssize i = str.find (c); - while (i != NPOS) - { - string s = str.substr (0, i); - a.push_back (s); - while (str[++i] == c) - ; - str = str.substr (i); - i = str.find (c); - } - if (str.length ()) - a.push_back (str); - return a; -} string String_convert::long_string (long l) diff --git a/lily/font-metric.cc b/lily/font-metric.cc index eccc9d2441..70017df10c 100644 --- a/lily/font-metric.cc +++ b/lily/font-metric.cc @@ -64,32 +64,32 @@ Font_metric::~Font_metric () { } -vsize +size_t Font_metric::count () const { return 0; } Box -Font_metric::get_ascii_char (vsize) const +Font_metric::get_ascii_char (size_t) const { return Box (Interval (0, 0), Interval (0, 0)); } Box -Font_metric::get_indexed_char (vsize k) const +Font_metric::get_indexed_char (size_t k) const { return get_ascii_char (k); } -vsize +size_t Font_metric::name_to_index (string) const { - return VPOS; + return (size_t)-1; } Offset -Font_metric::get_indexed_wxwy (vsize) const +Font_metric::get_indexed_wxwy (size_t) const { return Offset (0, 0); } @@ -136,20 +136,20 @@ Font_metric::font_name () const return s; } -vsize -Font_metric::index_to_ascii (vsize i) const +size_t +Font_metric::index_to_ascii (size_t i) const { return i; } -vsize -Font_metric::index_to_charcode (vsize i) const +size_t +Font_metric::index_to_charcode (size_t i) const { return index_to_ascii (i); } Stencil -Font_metric::get_ascii_char_stencil (vsize code) const +Font_metric::get_ascii_char_stencil (size_t code) const { SCM at = scm_list_3 (ly_symbol2scm ("char"), self_scm (), scm_from_unsigned (code)); @@ -158,9 +158,9 @@ Font_metric::get_ascii_char_stencil (vsize code) const } Stencil -Font_metric::get_indexed_char_stencil (vsize code) const +Font_metric::get_indexed_char_stencil (size_t code) const { - vsize idx = index_to_ascii (code); + size_t idx = index_to_ascii (code); SCM at = scm_list_3 (ly_symbol2scm ("char"), self_scm (), scm_from_unsigned (idx)); Box b = get_indexed_char (code); diff --git a/lily/include/accidental-interface.hh b/lily/include/accidental-interface.hh index 77cc815a63..b9f4e7c83d 100644 --- a/lily/include/accidental-interface.hh +++ b/lily/include/accidental-interface.hh @@ -9,6 +9,8 @@ #ifndef ACCIDENTAL_INTERFACE_HH #define ACCIDENTAL_INTERFACE_HH +#include "std-vector.hh" + #include "box.hh" #include "lily-guile.hh" #include "lily-proto.hh" diff --git a/lily/include/all-font-metrics.hh b/lily/include/all-font-metrics.hh index 8243ccbe34..59cc9f86ea 100644 --- a/lily/include/all-font-metrics.hh +++ b/lily/include/all-font-metrics.hh @@ -13,7 +13,7 @@ #include "font-metric.hh" #include "config.hh" -#if HAVE_PANGO16 +#if HAVE_PANGO_FT2 #include #include #endif diff --git a/lily/include/axis-group-interface.hh b/lily/include/axis-group-interface.hh index 11e95233a6..94e1a256d9 100644 --- a/lily/include/axis-group-interface.hh +++ b/lily/include/axis-group-interface.hh @@ -9,6 +9,7 @@ #ifndef AXIS_GROUP_INTERFACE_HH #define AXIS_GROUP_INTERFACE_HH +#include "std-vector.hh" #include "lily-proto.hh" #include "lily-guile.hh" diff --git a/lily/include/beam.hh b/lily/include/beam.hh index 15ddae2bf1..44460905e8 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -10,6 +10,7 @@ #ifndef BEAM_HH #define BEAM_HH +#include "std-vector.hh" #include "lily-proto.hh" #include "lily-guile.hh" #include "stem-info.hh" diff --git a/lily/include/context-def.hh b/lily/include/context-def.hh index 4882892730..8f5ba8686d 100644 --- a/lily/include/context-def.hh +++ b/lily/include/context-def.hh @@ -9,6 +9,7 @@ #ifndef CONTEXT_DEF_HH #define CONTEXT_DEF_HH +#include "std-vector.hh" #include "lily-proto.hh" #include "smobs.hh" #include "input.hh" diff --git a/lily/include/context.hh b/lily/include/context.hh index 6a2fcb0d22..d0b9ac7248 100644 --- a/lily/include/context.hh +++ b/lily/include/context.hh @@ -10,6 +10,7 @@ #define CONTEXT_HH +#include "std-vector.hh" #include "moment.hh" #include "lily-proto.hh" #include "virtual-methods.hh" diff --git a/lily/include/font-metric.hh b/lily/include/font-metric.hh index d4507a45ae..f5d036f972 100644 --- a/lily/include/font-metric.hh +++ b/lily/include/font-metric.hh @@ -22,21 +22,28 @@ public: SCM description_; string file_name_; + virtual Stencil text_stencil (string) const; virtual Box text_dimension (string) const; virtual string font_name () const; - virtual vsize count () const; + virtual size_t count () const; virtual Offset attachment_point (string) const; - virtual Offset get_indexed_wxwy (vsize) const; - virtual Box get_indexed_char (vsize index) const; - virtual Box get_ascii_char (vsize ascii) const; - virtual vsize name_to_index (string) const; - virtual vsize index_to_charcode (vsize) const; - virtual vsize index_to_ascii (vsize) const; + virtual Offset get_indexed_wxwy (size_t) const; + virtual Box get_indexed_char (size_t index) const; + virtual Box get_ascii_char (size_t ascii) const; + + /* + WTF are these vsize ? + + Font_metric is not related to vector<> + */ + virtual size_t name_to_index (string) const; + virtual size_t index_to_charcode (size_t) const; + virtual size_t index_to_ascii (size_t) const; virtual Real design_size () const; virtual Stencil find_by_name (string) const; - virtual Stencil get_indexed_char_stencil (vsize k) const; - virtual Stencil get_ascii_char_stencil (vsize k) const; + virtual Stencil get_indexed_char_stencil (size_t k) const; + virtual Stencil get_ascii_char_stencil (size_t k) const; virtual SCM sub_fonts () const; virtual SCM font_file_name () const; DECLARE_SMOBS (Font_metric,); diff --git a/lily/include/horizontal-bracket.hh b/lily/include/horizontal-bracket.hh index 7cc2b21b09..cb54b95a26 100644 --- a/lily/include/horizontal-bracket.hh +++ b/lily/include/horizontal-bracket.hh @@ -11,6 +11,7 @@ #include "lily-guile.hh" #include "lily-proto.hh" +#include "std-vector.hh" struct Horizontal_bracket { diff --git a/lily/include/lookup.hh b/lily/include/lookup.hh index edde194538..54ad282f9f 100644 --- a/lily/include/lookup.hh +++ b/lily/include/lookup.hh @@ -11,6 +11,7 @@ #define LOOKUP_HH #include "stencil.hh" +#include "std-vector.hh" struct Lookup { diff --git a/lily/include/midi-item.hh b/lily/include/midi-item.hh index 178ddedbf5..ba3f2c0a9a 100644 --- a/lily/include/midi-item.hh +++ b/lily/include/midi-item.hh @@ -7,8 +7,8 @@ #ifndef MIDI_ITEM_HH #define MIDI_ITEM_HH -#include "cons.hh" #include "audio-item.hh" +#include "std-vector.hh" /** Any piece of midi information. @@ -211,9 +211,10 @@ public: /* Compensate for starting grace notes. */ - Cons_list event_p_list_; + vector events_; Midi_track (); + ~Midi_track (); void add (Moment delta_time_mom, Midi_item *midi); virtual string data_string () const; diff --git a/lily/include/modified-font-metric.hh b/lily/include/modified-font-metric.hh index c2f66f9292..c5e6d3c5bf 100644 --- a/lily/include/modified-font-metric.hh +++ b/lily/include/modified-font-metric.hh @@ -19,11 +19,11 @@ public: Stencil text_stencil (string) const; static SCM make_scaled_font_metric (Font_metric *fm, Real magnification); - vsize count () const; - Offset get_indexed_wxwy (vsize) const; + size_t count () const; + Offset get_indexed_wxwy (size_t) const; Offset attachment_point (string) const; - vsize name_to_index (string) const; - vsize index_to_charcode (vsize) const; + size_t name_to_index (string) const; + size_t index_to_charcode (size_t) const; Font_metric *original_font () const; protected: @@ -35,9 +35,9 @@ protected: string font_name () const; Real design_size () const; void derived_mark () const; - Box get_indexed_char (vsize) const; - vsize index_to_ascii (vsize) const; - Box get_ascii_char (vsize) const; + Box get_indexed_char (size_t) const; + size_t index_to_ascii (size_t) const; + Box get_ascii_char (size_t) const; Box tex_kludge (string) const; }; diff --git a/lily/include/open-type-font.hh b/lily/include/open-type-font.hh index e1d798611b..462837e595 100644 --- a/lily/include/open-type-font.hh +++ b/lily/include/open-type-font.hh @@ -43,11 +43,11 @@ public: string font_name () const; ~Open_type_font (); Offset attachment_point (string) const; - vsize count () const; - Box get_indexed_char (vsize) const; - vsize name_to_index (string) const; - //vsize glyph_name_to_charcode (string) const; - vsize index_to_charcode (vsize) const; + size_t count () const; + Box get_indexed_char (size_t) const; + size_t name_to_index (string) const; + //size_t glyph_name_to_charcode (string) const; + size_t index_to_charcode (size_t) const; void derived_mark () const; SCM sub_fonts () const; Real design_size () const; diff --git a/lily/include/performance.hh b/lily/include/performance.hh index ff90bfd417..90a825bb1d 100644 --- a/lily/include/performance.hh +++ b/lily/include/performance.hh @@ -8,7 +8,6 @@ #define PERFORMANCE_HH #include "std-vector.hh" -#include "cons.hh" #include "music-output.hh" /* MIDI output. */ @@ -28,7 +27,7 @@ public: void write_output (string filename); vector audio_staffs_; - Cons *audio_element_list_; + vector audio_elements_; Output_def *midi_; }; diff --git a/lily/include/pitch.hh b/lily/include/pitch.hh index da61960ecb..57cb076b52 100644 --- a/lily/include/pitch.hh +++ b/lily/include/pitch.hh @@ -82,7 +82,6 @@ DECLARE_UNSMOB (Pitch, pitch); INSTANTIATE_COMPARE (Pitch, Pitch::compare); -int compare (vector *, vector *); extern SCM pitch_less_proc; Pitch pitch_interval (Pitch const &from, Pitch const &to); diff --git a/lily/include/source-file.hh b/lily/include/source-file.hh index 5463672446..dd88a2c65a 100644 --- a/lily/include/source-file.hh +++ b/lily/include/source-file.hh @@ -9,15 +9,14 @@ #ifndef SOURCE_FILE_HH #define SOURCE_FILE_HH -#include "std-string.hh" +#include "flower-proto.hh" #include "std-vector.hh" #include "lily-proto.hh" +#include "protected-scm.hh" #include using namespace std; -#include "protected-scm.hh" - /** class for reading and mapping a file. diff --git a/lily/include/source.hh b/lily/include/source.hh index eaa0a30850..8b3a40fbec 100644 --- a/lily/include/source.hh +++ b/lily/include/source.hh @@ -7,15 +7,14 @@ #ifndef SOURCE_HH #define SOURCE_HH -#include "cons.hh" #include "flower-proto.hh" -#include "std-string.hh" +#include "std-vector.hh" /* A set of sourcefiles. */ class Sources { Sources (Sources const &) {} - Cons *sourcefile_list_; + vector sourcefiles_; bool is_binary_; public: diff --git a/lily/include/spacing-spanner.hh b/lily/include/spacing-spanner.hh index c713c8755a..7f560e2880 100644 --- a/lily/include/spacing-spanner.hh +++ b/lily/include/spacing-spanner.hh @@ -12,6 +12,7 @@ #include "lily-proto.hh" #include "lily-guile.hh" #include "rational.hh" +#include "std-vector.hh" struct Spacing_options { diff --git a/lily/include/stem.hh b/lily/include/stem.hh index 09daee1d16..da024edb35 100644 --- a/lily/include/stem.hh +++ b/lily/include/stem.hh @@ -7,6 +7,7 @@ #ifndef STEM_HH #define STEM_HH +#include "std-vector.hh" #include "lily-proto.hh" #include "lily-guile.hh" #include "stem-info.hh" diff --git a/lily/include/translator.hh b/lily/include/translator.hh index ab587cb5d2..8566f0e3a2 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -15,6 +15,7 @@ #include "virtual-methods.hh" #include "input.hh" #include "smobs.hh" +#include "std-vector.hh" struct Acknowledge_information { diff --git a/lily/include/tuplet-bracket.hh b/lily/include/tuplet-bracket.hh index fc6830dd12..1b9d9c03c0 100644 --- a/lily/include/tuplet-bracket.hh +++ b/lily/include/tuplet-bracket.hh @@ -9,6 +9,7 @@ #include "lily-guile.hh" #include "lily-proto.hh" +#include "std-vector.hh" class Tuplet_bracket { diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 935846a8ec..19fe4b0132 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -373,7 +373,7 @@ parse_symbol_list (char const *symbols) string s = symbols; replace_all (s, '\n', ' '); replace_all (s, '\t', ' '); - return ly_string_array_to_scm (String_convert::split (s, ' ')); + return ly_string_array_to_scm (split_string (s, ' ')); } SCM diff --git a/lily/lilypond-version.cc b/lily/lilypond-version.cc index 252366251d..6c453fab74 100644 --- a/lily/lilypond-version.cc +++ b/lily/lilypond-version.cc @@ -10,7 +10,7 @@ #include "lilypond-input-version.hh" #include "string-convert.hh" -#include "std-vector.hh" +#include "misc.hh" Lilypond_version::Lilypond_version (int major, int minor, int patch) { @@ -26,7 +26,7 @@ Lilypond_version::Lilypond_version (string str) patch_ = 0; vector version; - version = String_convert::split (str, '.'); + version = split_string (str, '.'); if (version.size () > 0 && isdigit (version[0][0])) major_ = String_convert::dec2int (version[0]); diff --git a/lily/main.cc b/lily/main.cc index 7e9927e34d..8e73ac95f3 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -300,7 +300,7 @@ do_chroot_jail () USER_NAME, GROUP_NAME, JAIL, DIR, JAIL_MAX }; - vector components = String_convert::split (jail_spec, ','); + vector components = split_string (jail_spec, ','); if (components.size () != JAIL_MAX) { error (_f ("expected %d arguments with jail, found: %d", JAIL_MAX, diff --git a/lily/midi-item.cc b/lily/midi-item.cc index 46906cd7e9..a7d3e629d8 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -460,7 +460,7 @@ Midi_track::add (Moment delta_time_mom, Midi_item *midi) assert (delta_time_mom >= Moment (0)); Midi_event *e = new Midi_event (delta_time_mom, midi); - event_p_list_.append (new Killing_cons (e, 0)); + events_.push_back (e); } string @@ -469,9 +469,11 @@ Midi_track::data_string () const string str = Midi_chunk::data_string (); if (do_midi_debugging_global) str += "\n"; - for (Cons *i = event_p_list_.head_; i; i = i->next_) + + for (vector::const_iterator i (events_.begin()); + i != events_.end(); i ++) { - str += i->car_->to_string (); + str += (*i)->to_string (); if (do_midi_debugging_global) str += "\n"; } @@ -484,3 +486,8 @@ Midi_item::name () const { return this->class_name (); } + +Midi_track::~Midi_track () +{ + junk_pointers (events_); +} diff --git a/lily/misc.cc b/lily/misc.cc index f8eda18b87..5c3293073c 100644 --- a/lily/misc.cc +++ b/lily/misc.cc @@ -35,6 +35,26 @@ log_2 (double x) return log (x) / log (2.0); } +vector +split_string (string str, char c) +{ + vector a; + ssize i = str.find (c); + while (i != NPOS) + { + string s = str.substr (0, i); + a.push_back (s); + while (str[++i] == c) + ; + str = str.substr (i); + i = str.find (c); + } + if (str.length ()) + a.push_back (str); + return a; +} + +#if 0 vector split_string (string s, char c) { @@ -58,6 +78,7 @@ split_string (string s, char c) return rv; } +#endif Real diff --git a/lily/open-type-font.cc b/lily/open-type-font.cc index 32bd597df2..73395fb9cb 100644 --- a/lily/open-type-font.cc +++ b/lily/open-type-font.cc @@ -163,7 +163,7 @@ Open_type_font::attachment_point (string glyph_name) const } Box -Open_type_font::get_indexed_char (vsize signed_idx) const +Open_type_font::get_indexed_char (size_t signed_idx) const { if (SCM_HASHTABLE_P (lily_index_to_bbox_table_)) { @@ -176,9 +176,9 @@ Open_type_font::get_indexed_char (vsize signed_idx) const if (SCM_HASHTABLE_P (lily_character_table_)) { - const vsize len = 256; + const size_t len = 256; char name[len]; - vsize code = FT_Get_Glyph_Name (face_, signed_idx, name, len); + size_t code = FT_Get_Glyph_Name (face_, signed_idx, name, len); if (code) warning (_f ("FT_Get_Glyph_Name() returned error: %d", code)); @@ -223,22 +223,23 @@ Open_type_font::get_indexed_char (vsize signed_idx) const return b; } -vsize +size_t Open_type_font::name_to_index (string nm) const { char *nm_str = (char *) nm.c_str (); - if (vsize idx = FT_Get_Name_Index (face_, nm_str)) + if (size_t idx = FT_Get_Name_Index (face_, nm_str)) return idx; - return VPOS; + + return (size_t) -1; } -vsize -Open_type_font::index_to_charcode (vsize i) const +size_t +Open_type_font::index_to_charcode (size_t i) const { return ((Open_type_font *) this)->index_to_charcode_map_[i]; } -vsize +size_t Open_type_font::count () const { return ((Open_type_font *) this)->index_to_charcode_map_.size (); @@ -299,9 +300,9 @@ Open_type_font::glyph_list () const for (int i = 0; i < face_->num_glyphs; i++) { - const vsize len = 256; + const size_t len = 256; char name[len]; - vsize code = FT_Get_Glyph_Name (face_, i, name, len); + size_t code = FT_Get_Glyph_Name (face_, i, name, len); if (code) warning (_f ("FT_Get_Glyph_Name() returned error: %d", code)); diff --git a/lily/performance.cc b/lily/performance.cc index 2430df6670..7fc440e6b8 100644 --- a/lily/performance.cc +++ b/lily/performance.cc @@ -28,12 +28,11 @@ using namespace std; Performance::Performance () { midi_ = 0; - audio_element_list_ = 0; } Performance::~Performance () { - delete audio_element_list_; + junk_pointers (audio_elements_); } void @@ -146,7 +145,8 @@ Performance::add_element (Audio_element *p) { if (Audio_staff *s = dynamic_cast (p)) audio_staffs_.push_back (s); - audio_element_list_ = new Killing_cons (p, audio_element_list_); + + audio_elements_.push_back (p); } void diff --git a/lily/source.cc b/lily/source.cc index 462bfcffa0..90e99d5ed3 100644 --- a/lily/source.cc +++ b/lily/source.cc @@ -14,7 +14,6 @@ Sources::Sources () { - sourcefile_list_ = 0; path_ = 0; is_binary_ = false; } @@ -57,25 +56,24 @@ Sources::get_file (string &file_string) //UGH void Sources::add (Source_file *sourcefile) { - sourcefile_list_ = new Killing_cons (sourcefile, sourcefile_list_); + sourcefiles_.push_back (sourcefile); } Sources::~Sources () { - delete sourcefile_list_; + junk_pointers (sourcefiles_); } -/** - search the list for file whose map contains pointer #str0# - @return 0 if not found. -*/ Source_file * Sources::get_sourcefile (char const *str0) { + for (vector::iterator i = sourcefiles_.begin(); + i != sourcefiles_.end (); i++) + { + if ((*i)->contains (str0)) + return *i; + } - for (Cons *i = sourcefile_list_; i; i = i->next_) - if (i->car_->contains (str0)) - return i->car_; return 0; }