* flower/include/parray.hh: Conform to std::vector interface.
Update users.
+2006-02-03 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * flower/include/pqueue.hh: Derive from std::vector.
+
+ * flower/include/parray.hh: Conform to std::vector interface.
+ Update users.
+
2006-02-02 Graham Percival <gpermus@gmail.com>
* Documentation/topdocs/NEWS.itely: grammar fix from Laura.
Distributed under GNU GPL
*/
-#ifndef ARRAY_H
-#define ARRAY_H
-
#ifndef STD_VECTOR_HH
#error array.hh is obsolete, use std-vector.hh
#endif
+#ifndef ARRAY_H
+#define ARRAY_H
+
#include <cassert>
using namespace std;
return Tarray;
}
- T const *accesses () const
- {
- return array_;
- }
void operator = (Array const &src)
{
resize (src.size_);
swap (v[i], v[j]);
}
+ template<typename T>
+ void
+ concat (Array<T> &v, Array<T> const& w)
+ {
+ v.insert (v.end (), w.begin (), w.end ());
+ }
+
+ template<typename T>
+ void
+ vector_sort (Array<T> &v, int (*compare) (T const &, T const &),
+ vsize lower=-1, vsize upper=-1)
+ {
+ if (lower < 0)
+ {
+ lower = 0;
+ upper = v.size () - 1;
+ }
+ if (lower >= upper)
+ return;
+ swap (v[lower], v[(lower + upper) / 2]);
+ vsize last = lower;
+ for (vsize i = lower +1; i <= upper; i++)
+ if (compare (v.array_[i], v.array_[lower]) < 0)
+ swap (v[++last], v[i]);
+ swap (v[lower], v[last]);
+ vector_sort (v, compare, lower, last - 1);
+ vector_sort (v, compare, last + 1, upper);
+ }
+
#include "array.icc"
}
#endif
}
-template<typename T> INLINE void
-vector_sort (Array<T> &v, int (*compare) (T const &, T const &),
- vsize lower=-1, vsize upper=-1)
-{
- if (lower < 0)
- {
- lower = 0;
- upper = v.size () - 1;
- }
- if (lower >= upper)
- return;
- swap (v[lower], v[(lower + upper) / 2]);
- vsize last = lower;
- for (vsize i = lower +1; i <= upper; i++)
- if (compare (v.array_[i], v.array_[lower]) < 0)
- swap (v[++last], v[i]);
- swap (v[lower], v[last]);
- vector_sort (v, compare, lower, last - 1);
- vector_sort (v, compare, last + 1, upper);
-}
-
template<class T> INLINE
void
Array<T>::OK () const
namespace std {
struct String_data;
struct String_handle;
+ //template<class T> struct Array;
+ template<class T> struct Link_array;
}
struct String_convert;
#include "std-vector.hh"
#include "real.hh"
-//template<class T> struct Array;
-template<class T> struct Link_array;
template<class T> struct Link_list;
template<class T> struct Interval_t;
template<class T> struct PQueue;
#ifndef PARRAY_HH
#define PARRAY_HH
-#include "std-vector.hh"
+#ifndef STD_VECTOR_HH
+#error array.hh is obsolete, use std-vector.hh
+#endif
+using namespace std;
+
+namespace std {
/**
an array of pointers.
}
Array<void *>::begin;
+ Array<void *>::data;
Array<void *>::end;
Array<void *>::clear;
Array<void *>::erase;
{
}
+ /* std::vector interface */
+ //typedef T** iterator;
+ //typedef T* const* iterator_const;
+
+ Link_array (const_iterator begin, const_iterator end)
+ : Array<void *> (begin, end)
+ {
+ }
+
T *at (int i)
{
return (T *) Array<void *>::at (i);
return at (i);
}
- T ** accesses () const
+ T **
+ data ()
{
- return (T **) Array<void *>::accesses ();
+ return (T**) Array<void *>::data ();
}
+
+ T * const*
+ data () const
+ {
+ return (T**) Array<void *>::data ();
+ }
+
/**
remove i-th element, and return it.
*/
a.clear ();
}
-/*
- lookup with binsearch, return tokencode.
-*/
template<class T>
int
-binsearch (Array<T> const &arr, T t, int (*compare) (T const &, T const &))
-{
- int cmp;
- int result;
- int lo = 0;
- int hi = arr.size ();
-
- /* binary search */
- do
- {
- cmp = (lo + hi) / 2;
-
- result = compare (t, arr[cmp]);
-
- if (result < 0)
- hi = cmp;
- else
- lo = cmp;
- }
- while (hi - lo > 1);
-
- if (!compare (t, arr[lo]))
- return lo;
- /* not found */
- return -1;
-}
-
-template<class T>
-int
-binsearch_links (Link_array<T> const &arr, T *t,
- int (*compare) (T *const &, T *const &))
+binary_search (Link_array<T> const &arr, T *t,
+ int (*compare) (T *const &, T *const &))
{
int cmp;
int result;
while (*hi - *lo > 1);
}
+template<class T>
+void
+reverse (Link_array<T> &v)
+{
+ vsize h = v.size () / 2;
+ for (vsize i = 0, j = v.size () - 1; i < h; i++, j--)
+ swap (v[i], v[j]);
+}
+
+template<typename T>
+void
+concat (Link_array<T> &v, Link_array<T> const& w)
+{
+ v.insert (v.end (), w.begin (), w.end ());
+}
+
+template<typename T>
+void
+vector_sort (Link_array<T> &v, int (*compare) (T *const &, T * const &),
+ vsize lower=-1, vsize upper=-1)
+{
+ if (lower < 0)
+ {
+ lower = 0;
+ upper = v.size () - 1;
+ }
+ if (lower >= upper)
+ return;
+ swap (v[lower], v[(lower + upper) / 2]);
+ vsize last = lower;
+ for (vsize i = lower +1; i <= upper; i++)
+ if (compare (v[i], v[lower]) < 0)
+ swap (v[++last], v[i]);
+ swap (v[lower], v[last]);
+ vector_sort (v, compare, lower, last - 1);
+ vector_sort (v, compare, last + 1, upper);
+}
+
+template<typename T>
+void
+uniq (Link_array<T> &v)
+{
+ v.uniq ();
+}
+
+template<typename T>
+typename Array<void *>::const_iterator
+find (Link_array<T> const &v, T * const& key)
+{
+ return v.begin () + v.find_index (key);
+}
+
+}
#endif // PARRAY_HH
template<class T>
class PQueue
{
- Array<T> heap_array_;
+ std::vector<T> heap_array_;
T &elt (vsize i)
{
return heap_array_[i - 1];
#include "string.hh"
-#endif /* STD_STRING */
+#endif /* ! STD_STRING */
namespace std {
#ifndef STD_VECTOR_HH
#define STD_VECTOR_HH
-#include <algorithm> // reverse, sort
+#include <algorithm> /* find, reverse, sort */
+#include <functional> /* unary_function */
+#include <cassert>
+
+#if HAVE_BOOST_LAMBDA
+#include <boost/lambda/lambda.hpp>
+#endif
+
+template<typename T>
+int default_compare (T const &a, T const &b)
+{
+ if (a < b)
+ return -1;
+ else if (a > b)
+ return 1;
+ else
+ return 0;
+}
+
+template<typename T>
+int default_compare (T *const &a, T *const &b)
+{
+ if (a < b)
+ return -1;
+ else if (a > b)
+ return 1;
+ else
+ return 0;
+}
#if !STD_VECTOR
/* Also declare vector, in the wrong way. */
#include <sstream>
#endif
-
#include "compare.hh"
#if STD_VECTOR
{
return v[v.size () - i - 1];
}
-
-#if 0
+
template<typename T>
- vsize
- // binary_search (std::vector<T> const &v,
- binary_search (vector<T> const &v,
- T const &key, int (*compare) (T const &, T const &),
- vsize b=0, vsize e=VPOS)
+ void
+ concat (vector<T> &v, vector<T> const& w)
{
- //(void) compare;
- typename vector<T>::const_iterator i = find (v.iter (b), v.iter (e), key);
- if (i != v.end ())
- return i - v.begin ();
- return VPOS;
+ v.insert (v.end (), w.begin (), w.end ());
}
-#else // c&p from array.icc; cannot easily use stl_algo:find b.o. compare func.
+
template<class T>
void
binary_search_bounds (vector<T> const &table,
vsize *lo,
vsize *hi)
{
+ if (*lo >= *hi)
+ return;
+
int cmp;
int result;
}
template<class T>
+ void
+ binary_search_bounds (vector<T> const &table,
+ T const *key, int (*compare) (T *const &, T *const &),
+ int *lo,
+ int *hi)
+ {
+ int cmp;
+ int result;
+
+ /* binary search */
+ do
+ {
+ cmp = (*lo + *hi) / 2;
+
+ result = (*compare) ((T *) key, table[cmp]);
+
+ if (result < 0)
+ *hi = cmp;
+ else
+ *lo = cmp;
+ }
+ while (*hi - *lo > 1);
+ }
+
+#if 0
+ template<typename T>
vsize
- binary_search (vector<T> const &table,
+ // binary_search (std::vector<T> const &v,
+ binary_search (vector<T> const &v,
T const &key, int (*compare) (T const &, T const &),
+ vsize b=0, vsize e=VPOS)
+ {
+ //(void) compare;
+ if (e == VPOS)
+ e = v.size ();
+ typename vector<T>::const_iterator i = find (v.begin () + b,
+ v.begin () + e, key);
+ if (i != v.end ())
+ return i - v.begin ();
+ return VPOS;
+ }
+#else // c&p from array.icc; cannot easily use stl_algo:find b.o. compare func.
+ template<class T>
+ vsize
+ binary_search (vector<T> const &table,
+ T const &key,
+ int (*compare) (T const &, T const &),
vsize lo=0,
vsize hi=VPOS)
{
if (hi == VPOS)
hi = table.size ();
+ if (lo >= hi)
+ return VPOS;
+
binary_search_bounds (table, key, compare, &lo, &hi);
if (! (*compare) (key, table[lo]))
/* not found */
return VPOS;
}
+
+
#endif
#if 0
- /* FIXME: the simple test works, but lily barfs. */
+ /* FIXME: the COMPARE functionality is broken? */
template<typename T>
void
vector_sort (vector<T> &v, int (*compare) (T const &, T const &),
}
#else
- template<typename T>
- void
- swap (T *a, T *b)
- {
- T t = *a;
- *a = *b;
- *b = t;
- }
-
// ugh, c&p
-template<typename T> void
-vector_sort (vector<T> &v, int (*compare) (T const &, T const &),
- vsize lower=VPOS, vsize upper=VPOS)
-{
- if (lower == VPOS)
- {
- lower = 0;
- upper = v.size () - 1;
+ template<typename T> void
+ vector_sort (vector<T> &v, int (*compare) (T const &, T const &),
+ vsize lower=VPOS, vsize upper=VPOS)
+ {
+ if (lower == VPOS)
+ {
+ lower = 0;
+ upper = v.size () - 1;
}
- if (upper == VPOS || lower >= upper)
- return;
- swap (v[lower], v[(lower + upper) / 2]);
- vsize last = lower;
- for (vsize i = lower +1; i <= upper; i++)
- if (compare (v[i], v[lower]) < 0)
- swap (v[++last], v[i]);
- swap (v[lower], v[last]);
- vector_sort (v, compare, lower, last - 1);
- vector_sort (v, compare, last + 1, upper);
-}
-
+ if (upper == VPOS || lower >= upper)
+ return;
+ swap (v[lower], v[(lower + upper) / 2]);
+ vsize last = lower;
+ for (vsize i = lower +1; i <= upper; i++)
+ if (compare (v[i], v[lower]) < 0)
+ swap (v[++last], v[i]);
+ swap (v[lower], v[last]);
+ vector_sort (v, compare, lower, last - 1);
+ vector_sort (v, compare, last + 1, upper);
+ }
+#endif
+
template<typename T>
void
reverse (vector<T> &v)
::std::reverse (v.begin (), v.end ());
}
-#endif
+ template<typename T>
+ void
+ uniq (vector<T> &v)
+ {
+ v.erase (unique (v.begin (), v.end ()), v.end ());
+ }
-}
+ template<typename T>
+ typename vector<T>::const_iterator
+ find (vector<T> const &v, T const &key)
+ {
+ return ::std::find (v.begin (), v.end (), key);
+ }
+
+#if HAVE_BOOST_LAMBDA
+#include <boost/lambda/lambda.hpp>
+ using namespace boost::lambda;
+ template<typename T>
+ void
+ junk_pointers (vector<T> &v)
+ {
+ for_each (v.begin (), v.end (), (delete _1, _1 = 0));
+ v.clear ();
+ }
+#else
+
+ template<typename T> struct del : public unary_function<T, void>
+ {
+ void operator() (T x)
+ {
+ delete x;
+ x = 0;
+ }
+ };
+ template<typename T>
+ void
+ junk_pointers (vector<T> &v)
+ {
+ // Hmm.
+ ::std::for_each (v.begin (), v.end (), del<T> ());
+ v.clear ();
+ }
+#endif /* HAVE_BOOST_LAMBDA */
+}
#else /* ! STD_VECTOR */
}
-
#endif /* STD_VECTOR */
-template<typename T>
-int default_compare (T const &a, T const &b)
-{
- if (a < b)
- return -1;
- else if (a > b)
- return 1;
- else
- return 0;
-}
-
-
#include "array.hh"
+#include "parray.hh"
+
+using namespace std;
#endif /* STD_VECTOR_HH */
+
+
#if !STD_VECTOR
#define Array flower_vector
#endif
+#define HAVE_BOOST_LAMBDA 1
#include "std-vector.hh"
-#include "parray.hh"
-
#include <iostream>
#include <boost/test/auto_unit_test.hpp>
#define vector flower_vector
#endif
+using namespace std;
+
template<typename T>
void
print (vector<T> v)
cout << endl;
}
+#if !STD_VECTOR
template<typename T>
void
print (Link_array<T> v)
cout << "v[" << i << "] = " << *v[i] << endl;
cout << endl;
}
-
+#endif
BOOST_AUTO_UNIT_TEST (vector_erase)
{
BOOST_AUTO_UNIT_TEST (parray_concat)
{
-#if 1
+#if !STD_VECTOR
Link_array<int> u, v;
#else
vector<int*> u, v;
u.push_back (&a[2]);
v.push_back (&a[3]);
v.push_back (&a[4]);
- u.concat (v);
+ concat (u, v);
BOOST_CHECK_EQUAL (u[0], &a[0]);
BOOST_CHECK_EQUAL (u[1], &a[1]);
BOOST_CHECK_EQUAL (u[2], &a[2]);
BOOST_CHECK_EQUAL (u[3], &a[3]);
BOOST_CHECK_EQUAL (u[4], &a[4]);
BOOST_CHECK_EQUAL (u.size (), vsize (5));
- u.concat (v);
+ concat (u, v);
BOOST_CHECK_EQUAL (u.size (), vsize (7));
u.clear ();
v.push_back (&a[2]);
v.push_back (&a[3]);
v.push_back (&a[4]);
- u.concat (v);
+ concat (u, v);
BOOST_CHECK_EQUAL (u[0], &a[0]);
BOOST_CHECK_EQUAL (u[1], &a[1]);
BOOST_CHECK_EQUAL (u[2], &a[2]);
BOOST_CHECK_EQUAL (u.size (), vsize (5));
}
+BOOST_AUTO_UNIT_TEST (parray_uniq)
+{
+ vector<int> v;
+ v.push_back (0);
+ v.push_back (1);
+ v.push_back (0);
+ vector_sort (v, default_compare);
+ uniq (v);
+ BOOST_CHECK_EQUAL (v.size (), vsize (2));
+}
+
+BOOST_AUTO_UNIT_TEST (vector_search)
+{
+ vector<int> v;
+ v.push_back (0);
+ v.push_back (1);
+ v.push_back (2);
+ vsize i = binary_search (v, 1, &default_compare);
+ BOOST_CHECK_EQUAL (i, vsize (1));
+}
+
test_suite*
init_unit_test_suite (int, char**)
{
test->add (BOOST_TEST_CASE (vector_sorting));
test->add (BOOST_TEST_CASE (vector_insert));
test->add (BOOST_TEST_CASE (parray_concat));
+ test->add (BOOST_TEST_CASE (parray_uniq));
+ test->add (BOOST_TEST_CASE (vector_search));
return test;
}
to store all information before we can really create the
accidentals.
*/
- Link_array<Grob> left_objects_;
- Link_array<Grob> right_objects_;
+ std::vector<Grob*> left_objects_;
+ std::vector<Grob*> right_objects_;
Grob *accidental_placement_;
std::vector<Accidental_entry> accidentals_;
- Link_array<Spanner> ties_;
+ std::vector<Spanner*> ties_;
};
/*
*/
void
Accidental_placement::split_accidentals (Grob *accs,
- Link_array<Grob> *break_reminder,
- Link_array<Grob> *real_acc)
+ Link_array__Grob_ *break_reminder,
+ Link_array__Grob_ *real_acc)
{
for (SCM acs = accs->get_object ("accidental-grobs"); scm_is_pair (acs);
acs = scm_cdr (acs))
Item *item_col,
Grob *left_object)
{
- Link_array<Grob> br, ra;
- Link_array<Grob> *which = 0;
+ Link_array__Grob_ br, ra;
+ Link_array__Grob_ *which = 0;
Accidental_placement::split_accidentals (me, &br, &ra);
- br.concat (ra);
+ concat (br, ra);
if (dynamic_cast<Item *> (left_object)->break_status_dir () == RIGHT)
which = &br;
std::vector<Skyline_entry> right_skyline_;
Interval vertical_extent_;
std::vector<Box> extents_;
- Link_array<Grob> grobs_;
+ Link_array__Grob_ grobs_;
Real offset_;
int notename_;
Accidental_placement_entry ()
placement
*/
void
-stagger_apes (Link_array<Accidental_placement_entry> *apes)
+stagger_apes (Link_array__Accidental_placement_entry_ *apes)
{
- Link_array<Accidental_placement_entry> asc = *apes;
+ Link_array__Accidental_placement_entry_ asc = *apes;
- asc.sort (&ape_compare);
+ vector_sort (asc, &ape_compare);
apes->clear ();
{
Accidental_placement_entry *a = 0;
if (parity)
- a = asc.pop ();
+ {
+ a = asc.back ();
+ asc.pop_back ();
+ }
else
a = asc[i++];
parity = !parity;
}
- apes->reverse ();
+ reverse (*apes);
}
/*
TODO: there is a bug in this code. If two accs are on the same
Y-position, they share an Ape, and will be printed in overstrike.
*/
- Link_array<Accidental_placement_entry> apes;
+ Link_array__Accidental_placement_entry_ apes;
for (SCM s = accs; scm_is_pair (s); s = scm_cdr (s))
{
Accidental_placement_entry *ape = new Accidental_placement_entry;
First we must extract *all* pointers. We can only determine
extents if we're sure that we've found the right common refpoint
*/
- Link_array<Grob> note_cols, heads;
+ Link_array__Grob_ note_cols, heads;
for (vsize i = apes.size (); i--;)
{
Accidental_placement_entry *ape = apes[i];
{
extract_grob_set (c, "elements", gs);
- note_cols.concat (gs);
+ concat (note_cols, gs);
}
}
for (vsize i = note_cols.size (); i--;)
- heads.concat (extract_grob_array (note_cols[i], "note-heads"));
+ concat (heads, extract_grob_array (note_cols[i], "note-heads"));
- heads.default_sort ();
- heads.uniq ();
+ vector_sort (heads, default_compare);
+ uniq (heads);
common[Y_AXIS] = common_refpoint_of_array (heads, common[Y_AXIS], Y_AXIS);
for (vsize i = apes.size (); i--;)
extract_grob_set (me, "elements", elem_source);
- Link_array<Grob> elems (elem_source); // writable..
+ Link_array__Grob_ elems (elem_source); // writable..
Real where_f = 0;
Interval (0, Interval::infinity ()));
std::vector<Interval> dims;
- Link_array<Grob> elems;
+ Link_array__Grob_ elems;
extract_grob_set (me, "elements", all_grobs);
for (vsize i = 0; i < all_grobs.size (); i++)
&& heads.size () > 1)
{
Grob *common
- = common_refpoint_of_array (heads.slice (0, 2), me, Y_AXIS);
+ = common_refpoint_of_array (Link_array__Grob_ (heads.begin (),
+ heads.begin () + 2),
+ me, Y_AXIS);
Grob *minh = heads[0];
Grob *maxh = heads[1];
origin_trans_ = 0;
}
-Link_array<Context>
+Link_array__Context_
Audio_element_info::origin_contexts (Translator *end) const
{
Context *t = origin_trans_->context ();
- Link_array<Context> r;
+ Link_array__Context_ r;
do
{
r.push_back (t);
*/
Moment shortest_mom_;
Spanner *finished_beam_;
- Link_array<Item> *stems_;
+ Link_array__Item_ *stems_;
int process_acknowledged_count_;
Moment last_add_mom_;
return;
}
- stems_ = new Link_array<Item>;
+ stems_ = new Link_array__Item_;
grouping_ = new Beaming_info_list;
beam_settings_ = updated_grob_properties (context (), ly_symbol2scm ("Beam"));
SCM_ASSERT_TYPE (unsmob_grob (common), common, SCM_ARG2, __FUNCTION__, "grob");
SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG3, __FUNCTION__, "axis");
- Link_array<Grob> elts;
+ Link_array__Grob_ elts;
if (!ga)
{
for (SCM s = elements; scm_is_pair (s); s = scm_cdr (s))
}
Interval
-Axis_group_interface::relative_group_extent (Link_array<Grob> const &elts,
+Axis_group_interface::relative_group_extent (Link_array__Grob_ const &elts,
Grob *common, Axis a)
{
Interval r;
}
void
-Axis_group_interface::get_children (Grob *me, Link_array<Grob> *found)
+Axis_group_interface::get_children (Grob *me, Link_array__Grob_ *found)
{
found->push_back (me);
{
Grob *me = unsmob_grob (smob);
- Link_array<Grob> stems
+ Link_array__Grob_ stems
= extract_grob_array (me, "stems");
if (is_knee (me))
Do stem computations. These depend on YL and YR linearly, so we can
precompute for every stem 2 factors.
*/
- Link_array<Grob> stems
+ Link_array__Grob_ stems
= extract_grob_array (me, "stems");
std::vector<Stem_info> stem_infos;
std::vector<Real> base_lengths;
}
Real
-Beam::score_stem_lengths (Link_array<Grob> const &stems,
+Beam::score_stem_lengths (Link_array__Grob_ const &stems,
std::vector<Stem_info> const &stem_infos,
std::vector<Real> const &base_stem_ys,
std::vector<Real> const &stem_xs,
std::vector<int>
Break_algorithm::find_break_indices () const
{
- Link_array<Grob> all = pscore_->root_system ()->columns ();
+ Link_array__Grob_ all = pscore_->root_system ()->columns ();
std::vector<int> retval;
for (vsize i = 0; i < all.size (); i++)
return retval;
}
-Link_array<Grob>
+Link_array__Grob_
Break_algorithm::find_breaks () const
{
- Link_array<Grob> all = pscore_->root_system ()->columns ();
- Link_array<Grob> retval;
+ Link_array__Grob_ all = pscore_->root_system ()->columns ();
+ Link_array__Grob_ retval;
for (vsize i = 0; i < all.size (); i++)
if (Item::is_breakable (all[i]))
}
Simple_spacer_wrapper *
-Break_algorithm::generate_spacing_problem (Link_array<Grob> const &curline,
+Break_algorithm::generate_spacing_problem (Link_array__Grob_ const &curline,
Interval line) const
{
Simple_spacer_wrapper *spw = new Simple_spacer_wrapper;
So we return the correct order as an array.
*/
-Link_array<Grob>
+Link_array__Grob_
Break_align_interface::ordered_elements (Grob *grob)
{
Item *me = dynamic_cast<Item *> (grob);
|| scm_c_vector_length (order_vec) < 3)
return elts;
- Link_array<Grob> writable_elts (elts);
+ Link_array__Grob_ writable_elts (elts);
SCM order = scm_vector_ref (order_vec,
scm_from_int (me->break_status_dir () + 1));
/*
Copy in order specified in BREAK-ALIGN-ORDER.
*/
- Link_array<Grob> new_elts;
+ Link_array__Grob_ new_elts;
for (; scm_is_pair (order); order = scm_cdr (order))
{
SCM sym = scm_car (order);
Grob *grob = unsmob_grob (smob);
Item *me = dynamic_cast<Item *> (grob);
- Link_array<Grob> elems = ordered_elements (me);
+ Link_array__Grob_ elems = ordered_elements (me);
std::vector<Interval> extents;
int last_nonempty = -1;
/*
Perform substitution on GROB_LIST using a constant amount of stack.
*/
-Link_array<Grob> temporary_substition_array;
+Link_array__Grob_ temporary_substition_array;
void
substitute_grob_array (Grob_array *grob_arr, Grob_array *new_arr)
{
- Link_array<Grob> &old_grobs (grob_arr->array_reference ());
- Link_array<Grob> *new_grobs (new_arr == grob_arr
+ Link_array__Grob_ &old_grobs (grob_arr->array_reference ());
+ Link_array__Grob_ *new_grobs (new_arr == grob_arr
? & temporary_substition_array
: &new_arr->array_reference ());
new_grobs->resize (old_grobs.size ());
- Grob **array = (Grob **) new_grobs->accesses ();
+ Grob **array = (Grob **) new_grobs->data ();
Grob **ptr = array;
for (vsize i = 0; i < old_grobs.size (); i++)
{
void add_note (Music *);
Item *chord_name_;
- Link_array<Music> notes_;
+ Link_array__Music_ notes_;
SCM last_chord_;
};
void stop_translation_timestep ();
virtual void finalize ();
private:
- Link_array<Music> cluster_notes_;
+ Link_array__Music_ cluster_notes_;
Item *beacon_;
void typeset_grobs ();
Grob *commonx = left_bound->common_refpoint (right_bound, X_AXIS);
- Link_array<Grob> const &cols = extract_grob_array (me, "columns");
+ Link_array__Grob_ const &cols = extract_grob_array (me, "columns");
if (cols.empty ())
{
me->warning (_ ("junking empty cluster"));
if (spanner->get_break_index () < orig->broken_intos_.size () - 1)
{
Spanner *next = orig->broken_intos_[spanner->get_break_index () + 1];
- Link_array<Grob> const &next_cols = extract_grob_array (next, "columns");
+ Link_array__Grob_ const &next_cols = extract_grob_array (next, "columns");
if (next_cols.size () > 0)
{
Grob *next_commony = common_refpoint_of_array (next_cols, next, Y_AXIS);
class Collision_engraver : public Engraver
{
Item *col_;
- Link_array<Grob> note_columns_;
+ Link_array__Grob_ note_columns_;
protected:
DECLARE_ACKNOWLEDGER (note_column);
class Completion_heads_engraver : public Engraver
{
- Link_array<Item> notes_;
- Link_array<Item> prev_notes_;
- Link_array<Grob> ties_;
+ Link_array__Item_ notes_;
+ Link_array__Item_ prev_notes_;
+ Link_array__Grob_ ties_;
- Link_array<Item> dots_;
- Link_array<Music> note_events_;
- Link_array<Music> scratch_note_events_;
+ Link_array__Item_ dots_;
+ Link_array__Music_ note_events_;
+ Link_array__Music_ scratch_note_events_;
Moment note_end_mom_;
bool is_first_;
return name;
}
-Link_array<Context_def>
+Link_array__Context_def_
Context_def::path_to_acceptable_context (SCM type_sym, Output_def *odef) const
{
assert (scm_is_symbol (type_sym));
SCM accepted = get_accepted (SCM_EOL);
- Link_array<Context_def> accepteds;
+ Link_array__Context_def_ accepteds;
for (SCM s = accepted; scm_is_pair (s); s = scm_cdr (s))
if (Context_def *t = unsmob_context_def (find_context_def (odef,
scm_car (s))))
accepteds.push_back (t);
- Link_array<Context_def> best_result;
+ Link_array__Context_def_ best_result;
for (vsize i = 0; i < accepteds.size (); i++)
{
/* do not check aliases, because \context Staff should not
{
Context_def *g = accepteds[i];
- Link_array<Context_def> result
+ Link_array__Context_def_ result
= g->path_to_acceptable_context (type_sym, odef);
if (result.size () && result.size () < best_depth)
{
/*
TODO: use accepts_list_.
*/
- Link_array<Context_def> path
+ Link_array__Context_def_ path
= unsmob_context_def (definition_)->path_to_acceptable_context (n, get_output_def ());
if (path.size ())
/*
TODO: use accepts_list_.
*/
- Link_array<Context_def> path
+ Link_array__Context_def_ path
= unsmob_context_def (definition_)->path_to_acceptable_context (n, get_output_def ());
if (path.size ())
private:
Item *create_custos ();
bool custos_permitted_;
- Link_array<Grob> custodes_;
+ Link_array__Grob_ custodes_;
std::vector<Pitch> pitches_;
};
{
Grob *dotcol_;
Grob *stem_;
- Link_array<Item> heads_;
+ Link_array__Item_ heads_;
public:
TRANSLATOR_DECLARATIONS (Dot_column_engraver);
Dot_column::calc_positioning_done (SCM smob)
{
Grob *me = unsmob_grob (smob);
- Link_array<Grob> dots
+ Link_array__Grob_ dots
= extract_grob_array (me, "dots");
{ /*
}
}
- dots.sort (compare_position);
+ vector_sort (dots, &compare_position);
for (vsize i = dots.size (); i--;)
if (!dots[i]->is_live ())
dots.erase (dots.begin () + i);
class Drum_notes_engraver : public Engraver
{
- Link_array<Item> notes_;
- Link_array<Item> dots_;
- Link_array<Item> scripts_;
- Link_array<Music> events_;
+ Link_array__Item_ notes_;
+ Link_array__Item_ dots_;
+ Link_array__Item_ scripts_;
+ Link_array__Music_ events_;
public:
TRANSLATOR_DECLARATIONS (Drum_notes_engraver);
void process_music ();
private:
- Link_array<Music> note_evs_;
- Link_array<Audio_note> notes_;
+ Link_array__Music_ note_evs_;
+ Link_array__Audio_note_ notes_;
};
Drum_note_performer::Drum_note_performer ()
while (note_evs_.size ())
{
- Music *n = note_evs_.pop ();
+ Music *n = note_evs_.back ();
+ note_evs_.pop_back ();
SCM sym = n->get_property ("drum-type");
SCM defn = SCM_EOL;
Drul_array<Music *> accepted_spanevents_drul_;
- Link_array<Note_column> pending_columns_;
- Link_array<Grob> pending_elements_;
+ Link_array__Note_column_ pending_columns_;
+ Link_array__Grob_ pending_elements_;
void typeset_all ();
void add_brackets ();
void create_grobs ();
- void center_continuations (Link_array<Spanner> const &consecutive_lines);
+ void center_continuations (Link_array__Spanner_ const &consecutive_lines);
void center_repeated_continuations ();
protected:
std::vector<Figure_group> groups_;
Spanner *alignment_;
- Link_array<Music> new_musics_;
+ Link_array__Music_ new_musics_;
bool continuation_;
bool new_music_found_;
}
void
-Figured_bass_engraver::center_continuations (Link_array<Spanner> const &consecutive_lines)
+Figured_bass_engraver::center_continuations (Link_array__Spanner_ const &consecutive_lines)
{
if (consecutive_lines.size () == 2)
{
- Link_array<Grob> left_figs;
+ Link_array__Grob_ left_figs;
for (vsize j = consecutive_lines.size(); j--;)
left_figs.push_back (consecutive_lines[j]->get_bound (LEFT));
void
Figured_bass_engraver::center_repeated_continuations ()
{
- Link_array<Spanner> consecutive_lines;
+ Link_array__Spanner_ consecutive_lines;
for (vsize i = 0; i <= groups_.size(); i++)
{
if (i < groups_.size ()
void
Figured_bass_engraver::add_brackets ()
{
- Link_array<Grob> encompass;
+ Link_array__Grob_ encompass;
bool inside = false;
for (vsize i = 0; i < groups_.size (); i ++)
{
/*
Ugh, repeated code.
*/
- Link_array<Spanner> consecutive;
+ Link_array__Spanner_ consecutive;
if (to_boolean (get_property ("figuredBassCenterContinuations")))
{
for (vsize i = 0; i <= junk_continuations.size (); i++)
class Fingering_engraver : public Engraver
{
- Link_array<Music> events_;
- Link_array<Item> fingerings_;
+ Link_array__Music_ events_;
+ Link_array__Item_ fingerings_;
public:
TRANSLATOR_DECLARATIONS (Fingering_engraver);
Gourlay_breaking::do_solve () const
{
std::vector<Break_node> optimal_paths;
- Link_array<Grob> all
+ Link_array__Grob_ all
= pscore_->root_system ()->columns ();
std::vector<int> breaks = find_break_indices ();
for (vsize start_idx = break_idx; start_idx--;)
{
- Link_array<Grob> line = all.slice (breaks[start_idx],
- breaks[break_idx] + 1);
+ Link_array__Grob_ line (all.begin () + breaks[start_idx],
+ all.begin () + breaks[break_idx] + 1);
line[0] = dynamic_cast<Item *> (line[0])->find_prebroken_piece (RIGHT);
line.back () = dynamic_cast<Item *> (line.back ())->find_prebroken_piece (LEFT);
class Grid_line_span_engraver : public Engraver
{
Item *spanline_;
- Link_array<Item> lines_;
+ Link_array__Item_ lines_;
public:
TRANSLATOR_DECLARATIONS (Grid_line_span_engraver);
ordered_ = false;
}
-Link_array<Grob> &
+Link_array__Grob_ &
Grob_array::array_reference ()
{
return grobs_;
}
-Link_array<Grob> const &
+Link_array__Grob_ const &
Grob_array::array () const
{
return grobs_;
}
void
-Grob_array::set_array (Link_array<Grob> const &src)
+Grob_array::set_array (Link_array__Grob_ const &src)
{
grobs_ = src;
}
return unsmob_music (cause);
}
-Link_array<Context>
+Link_array__Context_
Grob_info::origin_contexts (Translator *end) const
{
Context *t = origin_trans_->context ();
- Link_array<Context> r;
+ Link_array__Context_ r;
do
{
r.push_back (t);
}
Grob *
-common_refpoint_of_array (Link_array<Grob> const &arr, Grob *common, Axis a)
+common_refpoint_of_array (Link_array__Grob_ const &arr, Grob *common, Axis a)
{
for (vsize i = arr.size (); i--;)
if (Grob *s = arr[i])
== 0))
return;
- Link_array<Grob> childs;
+ Link_array__Grob_ childs;
Axis_group_interface::get_children (me, &childs);
for (vsize i = 0; i < childs.size (); i++)
childs[i]->suicide ();
{
public:
TRANSLATOR_DECLARATIONS (Horizontal_bracket_engraver);
- Link_array<Spanner> bracket_stack_;
- Link_array<Music> events_;
+ Link_array__Spanner_ bracket_stack_;
+ Link_array__Music_ events_;
int pop_count_;
int push_count_;
Horizontal_bracket_engraver::stop_translation_timestep ()
{
for (int i = pop_count_; i--;)
- {
- if (bracket_stack_.size ())
- bracket_stack_.pop ();
- }
+ if (bracket_stack_.size ())
+ bracket_stack_.pop_back ();
pop_count_ = 0;
push_count_ = 0;
}
Stencil
Horizontal_bracket::make_enclosing_bracket (Grob *me, Grob *refpoint,
- Link_array<Grob> grobs,
+ Link_array__Grob_ grobs,
Axis a, Direction dir)
{
Grob *common = common_refpoint_of_array (grobs, refpoint, a);
Item *item_col,
Grob *acc);
static void split_accidentals (Grob *accs,
- Link_array<Grob> *break_reminder,
- Link_array<Grob> *real_acc);
+ Link_array__Grob_ *break_reminder,
+ Link_array__Grob_ *real_acc);
DECLARE_SCHEME_CALLBACK(calc_positioning_done, (SCM));
static bool has_interface (Grob *);
#include "lily-proto.hh"
#include "moment.hh"
-#include "parray.hh"
+#include "std-vector.hh"
#include "audio-element.hh"
/**
void add_audio_item (Audio_item *i);
Moment at_mom () const;
- Link_array<Audio_item> audio_items_;
+ Link_array__Audio_item_ audio_items_;
private:
Audio_column (Audio_column const &);
#define AUDIO_ITEM_INFO_HH
#include "lily-proto.hh"
-#include "parray.hh"
+#include "std-vector.hh"
/**
Data container for broadcasts
Music *event_;
Translator *origin_trans_;
- Link_array<Context> origin_contexts (Translator *) const;
+ Link_array__Context_ origin_contexts (Translator *) const;
Audio_element_info (Audio_element *, Music *);
Audio_element_info ();
#ifndef AUDIO_STAFF_HH
#define AUDIO_STAFF_HH
-#include "parray.hh"
+#include "std-vector.hh"
#include "lily-proto.hh"
#include "audio-element.hh"
void add_audio_item (Audio_item *l);
void output (Midi_stream &midi_stream_r, int track_i);
- Link_array<Audio_item> audio_items_;
+ Link_array__Audio_item_ audio_items_;
int channel_;
};
{
protected:
Spanner *staffline_;
- Link_array<Grob> elts_;
+ Link_array__Grob_ elts_;
void process_music ();
virtual void finalize ();
DECLARE_ACKNOWLEDGER (grob);
static SCM generic_group_extent (Grob *me, Axis a);
DECLARE_SCHEME_CALLBACK (width, (SCM smob));
DECLARE_SCHEME_CALLBACK (height, (SCM smob));
- static Interval relative_group_extent (Link_array<Grob> const &list,
+ static Interval relative_group_extent (Link_array__Grob_ const &list,
Grob *common, Axis);
static void add_element (Grob *me, Grob *);
static void set_axes (Grob *, Axis, Axis);
static bool has_axis (Grob *, Axis);
- static void get_children (Grob *, Link_array<Grob> *);
+ static void get_children (Grob *, Link_array__Grob_ *);
static bool has_interface (Grob *);
};
static Real score_slopes_dy (Real, Real, Real, Real, Real, bool, Beam_quant_parameters const *);
- static Real score_stem_lengths (Link_array<Grob> const &stems,
+ static Real score_stem_lengths (Link_array__Grob_ const &stems,
std::vector<Stem_info> const &stem_infos,
std::vector<Real> const &base_stem_ys,
std::vector<Real> const &stem_xs,
#ifndef BEAMING_HH
#define BEAMING_HH
-#include "parray.hh"
+#include "std-vector.hh"
#include "moment.hh"
struct Beaming_info
#include "input.hh"
#include "lily-proto.hh"
-#include "parray.hh"
+#include "std-vector.hh"
#include "object-key.hh"
#include "std-string.hh"
Paper_score *pscore_;
Real linewidth_;
- Link_array<Grob> find_breaks () const;
+ Link_array__Grob_ find_breaks () const;
std::vector<int> find_break_indices () const;
void solve_line (Column_x_positions *) const;
- bool feasible (Link_array<Grob> const &) const;
+ bool feasible (Link_array__Grob_ const &) const;
- Simple_spacer_wrapper *generate_spacing_problem (Link_array<Grob> const &,
+ Simple_spacer_wrapper *generate_spacing_problem (Link_array__Grob_ const &,
Interval) const;
virtual std::vector<Column_x_positions> do_solve () const = 0;
class Break_align_interface
{
public:
- static Link_array<Grob> ordered_elements (Grob *me);
+ static Link_array__Grob_ ordered_elements (Grob *me);
static bool has_interface (Grob *);
static void add_element (Grob *me, Grob *add);
DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM element));
#ifndef COLUMN_X_POSITIONS_HH
#define COLUMN_X_POSITIONS_HH
-#include "parray.hh"
+#include "std-vector.hh"
#include "lily-proto.hh"
struct Column_x_positions
{
- Link_array<Grob> cols_;
- Link_array<Grob> loose_cols_;
+ Link_array__Grob_ cols_;
+ Link_array__Grob_ loose_cols_;
std::vector<Real> config_;
Real force_;
SCM get_translator_names (SCM) const;
void set_acceptor (SCM accepts, bool add);
- Link_array<Context_def> path_to_acceptable_context (SCM type_string,
+ Link_array__Context_def_ path_to_acceptable_context (SCM type_string,
Output_def *) const;
Context *instantiate (SCM extra_ops, Object_key const *);
std::string id, SCM ops);
Context *create_unique_context (SCM context_name,
SCM ops);
- Link_array<Context> path_to_acceptable_context (SCM alias,
+ Link_array__Context_ path_to_acceptable_context (SCM alias,
Output_def *) const;
};
#define DIMENSION_CACHE_HH
#include "lily-proto.hh"
-#include "parray.hh"
+#include "std-vector.hh"
#include "dimension-cache-callback.hh"
#include "lily-guile.hh"
#include "lily-proto.hh"
#include "smobs.hh"
-#include "parray.hh"
+#include "std-vector.hh"
class Grob_array
{
- Link_array<Grob> grobs_;
+ Link_array__Grob_ grobs_;
bool ordered_;
DECLARE_SIMPLE_SMOBS (Grob_array,);
bool empty () const;
void clear ();
void add (Grob *x) { grobs_.push_back (x); }
- void set_array (Link_array<Grob> const &src);
- Link_array<Grob> &array_reference ();
- Link_array<Grob> const &array () const;
+ void set_array (Link_array__Grob_ const &src);
+ Link_array__Grob_ &array_reference ();
+ Link_array__Grob_ const &array () const;
static SCM make_array ();
};
DECLARE_UNSMOB (Grob_array, grob_array);
-Link_array<Grob> const &ly_scm2link_array (SCM x);
+Link_array__Grob_ const &ly_scm2link_array (SCM x);
SCM grob_list_to_grob_array (SCM lst);
#endif /* GROB_ARRAY_HH */
#include "lily-guile.hh"
#include "lily-proto.hh"
-#include "parray.hh"
+#include "std-vector.hh"
/*
Data container for broadcasts.
Context *context () const;
Music *music_cause () const;
Music *ultimate_music_cause () const;
- Link_array<Context> origin_contexts (Translator *) const;
+ Link_array__Context_ origin_contexts (Translator *) const;
Grob_info (Translator *, Grob *);
Grob_info ();
/* refpoints */
Grob *common_refpoint_of_list (SCM elt_list, Grob *, Axis a);
-Grob *common_refpoint_of_array (Link_array<Grob> const &, Grob *, Axis a);
+Grob *common_refpoint_of_array (Link_array__Grob_ const &, Grob *, Axis a);
System *get_root_system (Grob *me);
/* extents */
DECLARE_SCHEME_CALLBACK (print, (SCM));
static Stencil make_bracket (Grob *, Real, Axis, Direction);
static Stencil make_enclosing_bracket (Grob *me, Grob *refpoint,
- Link_array<Grob> grobs,
+ Link_array__Grob_ grobs,
Axis a, Direction dir);
static bool has_interface (Grob *);
};
#endif
#include "std-string.hh"
-#include "parray.hh"
+#include "std-vector.hh"
#include "lily-proto.hh"
// GIGA urg!
protected:
bool close_input ();
- Link_array<Source_file> include_stack_;
+ Link_array__Source_file_ include_stack_;
std::vector<int> char_count_stack_;
public:
#include "duration.hh"
#include "input.hh"
-#include "parray.hh"
+#include "std-vector.hh"
#include "pitch.hh"
/**
typedef void (*Translator_void_method_ptr) (Translator *);
+/* FIXME: when Link_array is dropped, do grand s/r to vector<TYPE*>. */
+#if STD_VECTOR
+
+// FIXME: does not work with sourc-file.cc
+// #define Link_array__char_ std::vector<char*>
+
+#define Link_array__char_ Link_array<char>
+#define Link_array__Grob_ std::vector<Grob*>
+#define Link_array__Accidental_placement_entry_ std::vector<Accidental_placement_entry*>
+#define Link_array__Audio_item_ std::vector<Audio_item*>
+#define Link_array__Audio_note_ std::vector<Audio_note*>
+#define Link_array__Audio_piano_pedal_ std::vector<Audio_piano_pedal*>
+#define Link_array__Audio_staff_ std::vector<Audio_staff*>
+#define Link_array__Bracket_nesting_node_ std::vector<Bracket_nesting_node*>
+#define Link_array__Context_ std::vector<Context*>
+#define Link_array__Context_def_ std::vector<Context_def*>
+#define Link_array__Grob_ std::vector<Grob*>
+#define Link_array__Item_ std::vector<Item*>
+#define Link_array__Music_ std::vector<Music*>
+#define Link_array__Note_column_ std::vector<Note_column*>
+#define Link_array__Output_def_ std::vector<Output_def*>
+#define Link_array__Slur_configuration_ std::vector<Slur_configuration*>
+#define Link_array__Source_file_ std::vector<Source_file*>
+#define Link_array__Spanner_ std::vector<Spanner*>
+#define Link_array__Tie_configuration_ std::vector<Tie_configuration*>
+#else /* !STD_VECTOR */
+#define Link_array__char_ Link_array<char>
+#define Link_array__Grob_ Link_array<Grob>
+#define Link_array__Accidental_placement_entry_ Link_array<Accidental_placement_entry>
+#define Link_array__Audio_item_ Link_array<Audio_item>
+#define Link_array__Audio_note_ Link_array<Audio_note>
+#define Link_array__Audio_piano_pedal_ Link_array<Audio_piano_pedal>
+#define Link_array__Audio_staff_ Link_array<Audio_staff>
+#define Link_array__Bracket_nesting_node_ Link_array<Bracket_nesting_node>
+#define Link_array__Context_ Link_array<Context>
+#define Link_array__Context_def_ Link_array<Context_def>
+#define Link_array__Grob_ Link_array<Grob>
+#define Link_array__Item_ Link_array<Item>
+#define Link_array__Music_ Link_array<Music>
+#define Link_array__Note_column_ Link_array<Note_column>
+#define Link_array__Output_def_ Link_array<Output_def>
+#define Link_array__Slur_configuration_ Link_array<Slur_configuration>
+#define Link_array__Source_file_ Link_array<Source_file>
+#define Link_array__Spanner_ Link_array<Spanner>
+#define Link_array__Tie_configuration_ Link_array<Tie_configuration>
+#endif /* !STD_VECTOR */
+
+
#endif /* LILY_PROTO_HH */
Midi_track *track_;
Audio_staff *staff_;
int index_;
- Link_array<Audio_item> *items_;
+ Link_array__Audio_item_ *items_;
PQueue<Midi_note_event> stop_note_queue;
Moment last_mom_;
};
#include "lily-proto.hh"
#include "lily-guile.hh"
-#include "parray.hh"
+#include "std-vector.hh"
/**
Resolve conflicts between various Note_columns (chords).
class Note_collision_interface
{
public:
- static SCM automatic_shift (Grob *, Drul_array<Link_array<Grob> >);
+ static SCM automatic_shift (Grob *, Drul_array<Link_array__Grob_ >);
static SCM forced_shift (Grob *);
- static Drul_array<Link_array<Grob> > get_clash_groups (Grob *me);
+ static Drul_array<Link_array__Grob_ > get_clash_groups (Grob *me);
DECLARE_SCHEME_CALLBACK (calc_positioning_done, (SCM smob));
static void add_column (Grob *me, Grob *ncol);
static bool has_interface (Grob *);
#ifndef PAPER_BOOK_HH
#define PAPER_BOOK_HH
-#include "parray.hh"
+#include "std-vector.hh"
#include "protected-scm.hh"
#include "smobs.hh"
int breaks_; // used for stat printing
Paper_column *command_column_;
Paper_column *musical_column_;
- Link_array<Item> items_;
+ Link_array__Item_ items_;
bool first_;
Moment last_moment_;
public:
#ifndef PERFORMANCE_HH
#define PERFORMANCE_HH
-#include "parray.hh"
+#include "std-vector.hh"
#include "cons.hh"
#include "music-output.hh"
void print () const;
void write_output (std::string filename);
- Link_array<Audio_staff> audio_staffs_;
+ Link_array__Audio_staff_ audio_staffs_;
Cons<Audio_element> *audio_element_list_;
Output_def *midi_;
};
#ifndef POINTER_GROUP_INTERFACE_HH
#define POINTER_GROUP_INTERFACE_HH
-#include "parray.hh"
+#include "std-vector.hh"
#include "lily-proto.hh"
#include "lily-guile.hh"
static void add_grob (Grob *, SCM nm, SCM x);
};
-Link_array<Grob> const &internal_extract_grob_array (Grob const *elt, SCM symbol);
-Link_array<Item> internal_extract_item_array (Grob const *elt, SCM symbol);
+Link_array__Grob_ const &internal_extract_grob_array (Grob const *elt, SCM symbol);
+Link_array__Item_ internal_extract_item_array (Grob const *elt, SCM symbol);
#define extract_grob_array(x, prop) internal_extract_grob_array (x, ly_symbol2scm (prop))
#define extract_item_array(x, prop) internal_extract_item_array (x, ly_symbol2scm (prop))
representation of grob sets again.
*/
#define extract_grob_set(grob, prop, set) \
- Link_array<Grob> const &set (internal_extract_grob_array (grob, ly_symbol2scm (prop)))
+ Link_array__Grob_ const &set (internal_extract_grob_array (grob, ly_symbol2scm (prop)))
#define extract_item_set(grob, prop, set) \
- Link_array<Item> set (internal_extract_item_array (grob, ly_symbol2scm (prop)))
+ Link_array__Item_ set (internal_extract_item_array (grob, ly_symbol2scm (prop)))
#endif /* POINTER_GROUP_INTERFACE_HH */
{
System *system_;
- Link_array<Grob> elems_;
+ Link_array__Grob_ elems_;
Paper_score *pscore_;
void typeset_all ();
#include "lily-proto.hh"
#include "input.hh"
-#include "parray.hh"
+#include "std-vector.hh"
#include "smobs.hh"
#include "virtual-methods.hh"
#include "std-string.hh"
SCM music_;
public:
- Link_array<Output_def> defs_;
+ Link_array__Output_def_ defs_;
std::string user_key_;
SCM header_;
bool error_found_;
class Separating_group_spanner
{
static void find_rods (Item *,
- Link_array<Grob> const &separators,
+ Link_array__Grob_ const &separators,
vsize idx,
Real);
public:
#ifndef SIMPLE_SPACER_HH
#define SIMPLE_SPACER_HH
-#include "parray.hh"
+#include "std-vector.hh"
#include "lily-proto.hh"
#include "smobs.hh"
struct Simple_spacer_wrapper
{
Simple_spacer *spacer_;
- Link_array<Grob> spaced_cols_;
- Link_array<Grob> loose_cols_;
+ Link_array__Grob_ spaced_cols_;
+ Link_array__Grob_ loose_cols_;
Simple_spacer_wrapper ();
- void add_columns (Link_array<Grob> const &);
+ void add_columns (Link_array__Grob_ const &);
void solve (Column_x_positions *, bool);
~Simple_spacer_wrapper ();
private:
#define SLUR_CONFIGURATION_HH
#include "bezier.hh"
-#include "parray.hh"
+#include "std-vector.hh"
#include "main.hh"
class Slur_configuration
#include "box.hh"
#include "lily-proto.hh"
-#include "parray.hh"
+#include "std-vector.hh"
#include "lily-guile.hh"
struct Slur_score_parameters
bool has_same_beam_;
Real musical_dy_;
- Link_array<Grob> columns_;
+ Link_array__Grob_ columns_;
std::vector<Encompass_info> encompass_infos_;
std::vector<Extra_collision_info> extra_encompass_infos_;
Slur_score_parameters parameters_;
Drul_array<Bound_info> extremes_;
Drul_array<Offset> base_attachments_;
- Link_array<Slur_configuration> configurations_;
+ Link_array__Slur_configuration_ configurations_;
Real staff_space_;
Real thickness_;
std::vector<Offset> generate_avoid_offsets () const;
Drul_array<Bound_info> get_bound_info () const;
void generate_curves () const;
- Link_array<Slur_configuration> enumerate_attachments (Drul_array<Real> end_ys) const;
+ Link_array__Slur_configuration_ enumerate_attachments (Drul_array<Real> end_ys) const;
Drul_array<Offset> get_base_attachments () const;
Drul_array<Real> get_y_attachment_range () const;
Encompass_info get_encompass_info (Grob *col) const;
#define SOURCE_FILE_HH
#include "std-string.hh"
+#include "std-vector.hh"
+#include "lily-proto.hh"
#include <iostream>
using namespace std;
#include "protected-scm.hh"
-#include "parray.hh"
/**
class for reading and mapping a file.
std::string name_;
private:
- Link_array<char> newline_locations_;
+ Link_array__char_ newline_locations_;
istream *istream_;
char *contents_str0_;
std::vector<char> chs_;
static Real default_bar_spacing (Grob *, Grob *, Grob *, Moment);
static Real note_spacing (Grob *, Grob *, Grob *, Spacing_options const *, bool *);
static Real get_duration_space (Moment dur, Spacing_options const *, bool *);
- static Rational find_shortest (Grob *, Link_array<Grob> const &);
- static Rational effective_shortest_duration (Grob *me, Link_array<Grob> const &all);
+ static Rational find_shortest (Grob *, Link_array__Grob_ const &);
+ static Rational effective_shortest_duration (Grob *me, Link_array__Grob_ const &all);
static void breakable_column_spacing (Grob *, Item *l, Item *r, Spacing_options const *);
- static void prune_loose_columns (Grob *, Link_array<Grob> *cols, Spacing_options const *);
- static void set_explicit_neighbor_columns (Link_array<Grob> const &cols);
- static void set_implicit_neighbor_columns (Link_array<Grob> const &cols);
- static void generate_springs (Grob *me, Link_array<Grob> const &cols, Spacing_options const *);
+ static void prune_loose_columns (Grob *, Link_array__Grob_ *cols, Spacing_options const *);
+ static void set_explicit_neighbor_columns (Link_array__Grob_ const &cols);
+ static void set_implicit_neighbor_columns (Link_array__Grob_ const &cols);
+ static void generate_springs (Grob *me, Link_array__Grob_ const &cols, Spacing_options const *);
static void musical_column_spacing (Grob *, Item *, Item *, Spacing_options const *);
DECLARE_SCHEME_CALLBACK (set_springs, (SCM));
static bool has_interface (Grob *);
public:
DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM));
- Link_array<Spanner> broken_intos_;
+ Link_array__Spanner_ broken_intos_;
int get_break_index () const;
void break_into_pieces (std::vector<Column_x_positions> const &);
static bool has_interface (Grob *);
- Link_array<Item> broken_col_range (Item const *, Item const *) const;
- Link_array<Grob> columns () const;
+ Link_array__Item_ broken_col_range (Item const *, Item const *) const;
+ Link_array__Grob_ columns () const;
void add_column (Paper_column *);
void typeset_grob (Grob *);
#include "tie-configuration.hh"
void set_chord_outline (std::vector<Skyline_entry> *skyline,
- Link_array<Item> bounds,
+ Link_array__Item_ bounds,
Grob *common,
Direction d);
void set_tie_config_directions (Ties_configuration *tie_configs_ptr);
Grob *staff_referencer);
void
set_chord_outlines (Drul_array< std::vector<Skyline_entry> > *skyline_drul,
- Link_array<Grob> ties,
+ Link_array__Grob_ ties,
Grob *common);
void
#define TIE_FORMATTING_PROBLEM_HH
#include "drul-array.hh"
-#include "parray.hh"
+#include "std-vector.hh"
#include "skyline.hh"
#include "lily-proto.hh"
#include "tie-configuration.hh"
Ties_configuration generate_optimal_chord_configuration ();
Ties_configuration generate_ties_configuration (Ties_configuration const &);
Tie_configuration find_optimal_tie_configuration (Tie_specification const &) const;
- void from_ties (Link_array<Grob> const &ties);
+ void from_ties (Link_array__Grob_ const &ties);
void from_tie (Grob *tie);
- void from_lv_ties (Link_array<Grob> const &);
- void set_chord_outline (Link_array<Item>, Direction);
+ void from_lv_ties (Link_array__Grob_ const &);
+ void set_chord_outline (Link_array__Item_, Direction);
void set_manual_tie_configuration (SCM);
Interval get_attachment (Real) const;
Grob *common_x_refpoint () const;
#include "moment.hh"
#include "translator.hh"
-#include "parray.hh"
+#include "std-vector.hh"
class Timing_translator : public Translator
{
#define TRANSLATOR_GROUP_HH
#include "translator.hh"
-#include "parray.hh"
+#include "std-vector.hh"
typedef void (Translator:: *Translator_method) (void);
typedef void (Translator_group:: *Translator_group_method) (void);
static void get_bounds (Grob *, Grob **, Grob **);
static void add_column (Grob *me, Item *);
static void add_beam (Grob *me, Grob *);
- static Grob *parallel_beam (Grob *me, Link_array<Grob> const &cols, bool *equally_long);
+ static Grob *parallel_beam (Grob *me, Link_array__Grob_ const &cols, bool *equally_long);
static void calc_position_and_height (Grob *, Real *, Real *dy);
static Stencil make_bracket (Grob *me, Axis protusion_axis,
Offset dz, Drul_array<Real> height,
vsize idx = binary_search (table_, e, tabcmp);
if (idx != VPOS)
return table_[idx].tokcode_;
- else
- return VPOS;
+ return VPOS;
}
Music *event_;
Grob *lv_column_;
- Link_array<Grob> lv_ties_;
+ Link_array__Grob_ lv_ties_;
void stop_translation_timestep ();
DECLARE_ACKNOWLEDGER (note_head);
Grob *me = unsmob_grob (smob);
extract_grob_set (me, "ties", lv_ro_ties);
- Link_array<Grob> lv_ties (lv_ro_ties);
+ Link_array__Grob_ lv_ties (lv_ro_ties);
- lv_ties.sort (&Laissez_vibrer_tie::compare);
+ vector_sort (lv_ties, &Laissez_vibrer_tie::compare);
Ties_configuration ties_config;
void process_music ();
private:
- Link_array<Music> events_;
+ Link_array__Music_ events_;
Audio_text *audio_;
};
private:
Music *rest_ev_;
- Link_array<Music> text_events_;
+ Link_array__Music_ text_events_;
int start_measure_;
Rational last_main_moment_;
Moment stop_moment_;
Spanner *last_rest_;
Spanner *mmrest_;
- Link_array<Spanner> numbers_;
- Link_array<Spanner> last_numbers_;
+ Link_array__Spanner_ numbers_;
+ Link_array__Spanner_ last_numbers_;
};
Multi_measure_rest_engraver::Multi_measure_rest_engraver ()
std::vector<Finger_tuple> articulations_;
std::vector<Finger_tuple> string_numbers_;
- Link_array<Grob> heads_;
+ Link_array__Grob_ heads_;
Grob *stem_;
public:
check_meshing_chords (Grob *me,
Drul_array<std::vector<Real> > *offsets,
Drul_array<std::vector<Slice> > const &extents,
- Drul_array<Link_array<Grob> > const &clash_groups)
+ Drul_array<Link_array__Grob_ > const &clash_groups)
{
if (!extents[UP].size () || ! extents[DOWN].size ())
Note_collision_interface::calc_positioning_done (SCM smob)
{
Grob *me = unsmob_grob (smob);
- Drul_array<Link_array<Grob> > cg = get_clash_groups (me);
+ Drul_array<Link_array__Grob_ > cg = get_clash_groups (me);
Direction d = UP;
do
}
while (flip (&d) != UP);
- Link_array<Grob> done;
+ Link_array__Grob_ done;
Real left_most = 1e6;
std::vector<Real> amounts;
Grob *s = unsmob_grob (scm_caar (autos));
Real amount = scm_to_double (scm_cdar (autos)) * wid;
- if (!done.find (s))
+ vsize x = find (done, s) - done.begin ();
+ if (x == VPOS || x >= done.size ())
{
done.push_back (s);
amounts.push_back (amount);
return SCM_BOOL_T;
}
-Drul_array < Link_array<Grob> >
+Drul_array < Link_array__Grob_ >
Note_collision_interface::get_clash_groups (Grob *me)
{
- Drul_array<Link_array<Grob> > clash_groups;
+ Drul_array<Link_array__Grob_ > clash_groups;
extract_grob_set (me, "elements", elements);
for (vsize i = 0; i < elements.size (); i++)
Direction d = UP;
do
{
- Link_array<Grob> &clashes (clash_groups[d]);
- clashes.sort (Note_column::shift_compare);
+ Link_array__Grob_ &clashes (clash_groups[d]);
+ vector_sort (clashes, Note_column::shift_compare);
}
while ((flip (&d)) != UP);
*/
SCM
Note_collision_interface::automatic_shift (Grob *me,
- Drul_array < Link_array<Grob>
+ Drul_array < Link_array__Grob_
> clash_groups)
{
Drul_array < std::vector<int> > shifts;
do
{
std::vector<int> &shift (shifts[d]);
- Link_array<Grob> &clashes (clash_groups[d]);
+ Link_array__Grob_ &clashes (clash_groups[d]);
for (vsize i = 0; i < clashes.size (); i++)
{
class Note_heads_engraver : public Engraver
{
- Link_array<Item> notes_;
- Link_array<Item> dots_;
- Link_array<Music> note_evs_;
+ Link_array__Item_ notes_;
+ Link_array__Item_ dots_;
+ Link_array__Music_ note_evs_;
public:
TRANSLATOR_DECLARATIONS (Note_heads_engraver);
public:
TRANSLATOR_DECLARATIONS (Note_name_engraver);
- Link_array<Music> events_;
- Link_array<Item> texts_;
+ Link_array__Music_ events_;
+ Link_array__Item_ texts_;
virtual bool try_music (Music *m);
void process_music ();
void stop_translation_timestep ();
void process_music ();
private:
- Link_array<Music> note_evs_;
- Link_array<Audio_note> notes_;
+ Link_array__Music_ note_evs_;
+ Link_array__Audio_note_ notes_;
};
void
while (note_evs_.size ())
{
- Music *n = note_evs_.pop ();
+ Music *n = note_evs_.back ();
+ note_evs_.pop_back ();
SCM pit = n->get_property ("pitch");
if (Pitch *pitp = unsmob_pitch (pit))
Interval left_head_wid;
do
{
- Link_array<Grob> const &items (ly_scm2link_array (props [d]));
+ Link_array__Grob_ const &items (ly_scm2link_array (props [d]));
for (vsize i = items.size (); i--;)
{
Item *it = dynamic_cast<Item *> (items[i]);
if (prune && a)
{
- Link_array<Grob> &right = a->array_reference ();
+ Link_array__Grob_ &right = a->array_reference ();
for (vsize i = right.size (); i--;)
{
if (dynamic_cast<Item *> (right[i])->get_column () != mincol)
do
{
- Link_array<Grob> const &items (ly_scm2link_array (props [d]));
+ Link_array__Grob_ const &items (ly_scm2link_array (props [d]));
for (vsize i = 0; i < items.size (); i++)
{
Item *it = dynamic_cast<Item *> (items[i]);
{
TRANSLATOR_DECLARATIONS (Output_property_engraver);
protected:
- Link_array<Music> props_;
+ Link_array__Music_ props_;
DECLARE_ACKNOWLEDGER (grob)
void stop_translation_timestep ();
if (!ga)
return SCM_UNSPECIFIED;
- Link_array<Grob> &array (ga->array_reference ());
+ Link_array__Grob_ &array (ga->array_reference ());
for (vsize i = array.size (); i--;)
{
down the road.
doubly, also done in Score_engraver */
- Link_array<Grob> pc (system_->columns ());
+ Link_array__Grob_ pc (system_->columns ());
pc[0]->set_property ("breakable", SCM_BOOL_T);
pc.back ()->set_property ("breakable", SCM_BOOL_T);
{
Drul_array<Music *> events_;
Music *running_slur_start_;
- Link_array<Grob> slurs_;
- Link_array<Grob> end_slurs_;
+ Link_array__Grob_ slurs_;
+ Link_array__Grob_ end_slurs_;
protected:
virtual bool try_music (Music *);
occurs simultaneously then extra space can be added between them.
*/
- Link_array<Spanner> previous_;
+ Link_array__Spanner_ previous_;
void del_linespanner (Spanner *);
void create_text_grobs (Pedal_info *p, bool);
void
Piano_pedal_engraver::del_linespanner (Spanner *g)
{
- int idx = previous_.find_index (g);
- if (idx >= 0)
+ vsize idx = find (previous_, g) - previous_.begin ();
+ if (idx != VPOS && idx < previous_.size ())
previous_.erase (previous_.begin () + idx);
}
void start_translation_timestep ();
private:
- Link_array<Audio_piano_pedal> audios_;
+ Link_array__Audio_piano_pedal_ audios_;
Pedal_info *info_alist_;
};
Item *trill_group_;
Item *trill_accidental_;
- Link_array<Grob> heads_;
+ Link_array__Grob_ heads_;
void make_trill (Music *);
};
arr->add (p);
}
-static Link_array<Grob> empty_array;
+static Link_array__Grob_ empty_array;
-Link_array<Grob> const &
+Link_array__Grob_ const &
ly_scm2link_array (SCM x)
{
Grob_array *arr = unsmob_grob_array (x);
return arr ? arr->array () : empty_array;
}
-Link_array<Grob> const &
+Link_array__Grob_ const &
internal_extract_grob_array (Grob const *elt, SCM symbol)
{
return ly_scm2link_array (elt->internal_get_object (symbol));
}
-Link_array<Item>
+Link_array__Item_
internal_extract_item_array (Grob const *elt, SCM symbol)
{
Grob_array *arr = unsmob_grob_array (elt->internal_get_object (symbol));
- Link_array<Item> items;
+ Link_array__Item_ items;
for (vsize i = 0; arr && i < arr->size (); i++)
items.push_back (arr->item (i));
{
Item *rest_collision_;
int rest_count_;
- Link_array<Grob> note_columns_;
+ Link_array__Grob_ note_columns_;
protected:
DECLARE_ACKNOWLEDGER (note_column);
void process_acknowledged ();
Grob *me = unsmob_grob (smob);
extract_grob_set (me, "elements", elts);
- Link_array<Grob> rests;
- Link_array<Grob> notes;
+ Link_array__Grob_ rests;
+ Link_array__Grob_ notes;
for (vsize i = 0; i < elts.size (); i++)
{
This is incomplete: in case of an uneven number of rests, the
center one should be centered on the staff.
*/
- Drul_array<Link_array<Grob> > ordered_rests;
+ Drul_array<Link_array__Grob_ > ordered_rests;
for (vsize i = 0; i < rests.size (); i++)
{
Grob *r = Note_column::get_rest (rests[i]);
Direction d = LEFT;
do
- ordered_rests[d].sort (Note_column::shift_compare);
+ vector_sort (ordered_rests[d], Note_column::shift_compare);
while (flip (&d) != LEFT)
;
class Rhythmic_column_engraver : public Engraver
{
- Link_array<Grob> rheads_;
+ Link_array__Grob_ rheads_;
Grob *stem_;
Grob *note_column_;
Grob *dotcol_;
class Script_column_engraver : public Engraver
{
Grob *scol_;
- Link_array<Item> scripts_;
+ Link_array__Item_ scripts_;
public:
TRANSLATOR_DECLARATIONS (Script_column_engraver);
{
Grob *me = unsmob_grob (smob);
Drul_array<SCM> scripts_drul (SCM_EOL, SCM_EOL);
- Link_array<Grob> staff_sided;
+ Link_array__Grob_ staff_sided;
extract_grob_set (me, "scripts", scripts);
for (vsize i = 0; i < scripts.size (); i++)
void
Separating_group_spanner::find_rods (Item *r,
- Link_array<Grob> const &separators,
+ Link_array__Grob_ const &separators,
vsize idx,
Real padding)
{
struct Spacings
{
Item *staff_spacing_;
- Link_array<Item> note_spacings_;
+ Link_array__Item_ note_spacings_;
Spacings ()
{
}
void
-Simple_spacer_wrapper::add_columns (Link_array<Grob> const &icols)
+Simple_spacer_wrapper::add_columns (Link_array__Grob_ const &icols)
{
- Link_array<Grob> cols (icols);
+ Link_array__Grob_ cols (icols);
cols.clear ();
for (vsize i = 0; i < icols.size (); i++)
scm_is_pair (s); s = scm_cdr (s))
{
Grob *other = unsmob_grob (scm_caar (s));
- int j = binsearch_links (cols, other, &compare_paper_column_rank);
- if (j >= 0 && cols[j] == other)
+ vsize j = binary_search (cols, other, &compare_paper_column_rank);
+ if (j != VPOS && cols[j] == other)
spacer_->add_rod (i, j, scm_to_double (scm_cdar (s)));
}
{
Drul_array<Music *> events_;
Music *running_slur_start_;
- Link_array<Grob> slurs_;
- Link_array<Grob> end_slurs_;
+ Link_array__Grob_ slurs_;
+ Link_array__Grob_ end_slurs_;
void set_melisma (bool);
Slur_score_state::generate_avoid_offsets () const
{
std::vector<Offset> avoid;
- Link_array<Grob> encompasses = columns_;
+ Link_array__Grob_ encompasses = columns_;
for (vsize i = 0; i < encompasses.size (); i++)
{
configurations_[i]->generate_curve (*this, r_0, h_inf, avoid);
}
-Link_array<Slur_configuration>
+Link_array__Slur_configuration_
Slur_score_state::enumerate_attachments (Drul_array<Real> end_ys) const
{
- Link_array<Slur_configuration> scores;
+ Link_array__Slur_configuration_ scores;
Drul_array<Offset> os;
os[LEFT] = base_attachments_[LEFT];
binary_search_bounds (newline_locations_,
pos_str0,
- Link_array<char>::default_compare,
+ default_compare,
&lo, &hi);
if (*pos_str0 == '\n')
between.
*/
void
-Spacing_spanner::prune_loose_columns (Grob *me, Link_array<Grob> *cols,
+Spacing_spanner::prune_loose_columns (Grob *me, Link_array__Grob_ *cols,
Spacing_options const *options)
{
- Link_array<Grob> newcols;
+ Link_array__Grob_ newcols;
for (vsize i = 0; i < cols->size (); i++)
{
Set neighboring columns determined by the spacing-wishes grob property.
*/
void
-Spacing_spanner::set_explicit_neighbor_columns (Link_array<Grob> const &cols)
+Spacing_spanner::set_explicit_neighbor_columns (Link_array__Grob_ const &cols)
{
for (vsize i = 0; i < cols.size (); i++)
{
yet. Only do breakable non-musical columns, and musical columns.
*/
void
-Spacing_spanner::set_implicit_neighbor_columns (Link_array<Grob> const &cols)
+Spacing_spanner::set_implicit_neighbor_columns (Link_array__Grob_ const &cols)
{
for (vsize i = 0; i < cols.size (); i++)
{
Item *left = 0;
Item *right = 0;
- Link_array<Item> clique;
+ Link_array__Item_ clique;
while (1)
{
SCM between = loose->get_object ("between-cols");
*/
Rational
Spacing_spanner::effective_shortest_duration (Grob *me,
- Link_array<Grob> const &all)
+ Link_array__Grob_ const &all)
{
SCM preset_shortest = me->get_property ("common-shortest-duration");
Rational global_shortest;
/*
can't use get_system() ? --hwn.
*/
- Link_array<Grob> all (get_root_system (me)->columns ());
+ Link_array__Grob_ all (get_root_system (me)->columns ());
set_explicit_neighbor_columns (all);
stuff, then.
*/
Rational
-Spacing_spanner::find_shortest (Grob *me, Link_array<Grob> const &cols)
+Spacing_spanner::find_shortest (Grob *me, Link_array__Grob_ const &cols)
{
/*
ascending in duration
void
Spacing_spanner::generate_springs (Grob *me,
- Link_array<Grob> const &cols,
+ Link_array__Grob_ const &cols,
Spacing_options const *options)
{
Paper_column *next = 0;
private:
Item *span_arpeggio_;
- Link_array<Grob> arpeggios_;
+ Link_array__Grob_ arpeggios_;
};
Span_arpeggio_engraver::Span_arpeggio_engraver ()
class Span_bar_engraver : public Engraver
{
Item *spanbar_;
- Link_array<Item> bars_;
+ Link_array__Item_ bars_;
public:
TRANSLATOR_DECLARATIONS (Span_bar_engraver);
else
{
System *root = get_root_system (this);
- Link_array<Item> break_points = root->broken_col_range (left, right);
+ Link_array__Item_ break_points = root->broken_col_range (left, right);
break_points.insert (break_points.begin () + 0, left);
break_points.push_back (right);
}
}
}
- broken_intos_.sort (Spanner::compare);
+ vector_sort (broken_intos_, Spanner::compare);
for (vsize i = broken_intos_.size ();i--;)
broken_intos_[i]->break_index_ = i;
}
Grob *
Spanner::find_broken_piece (System *l) const
{
- int idx = binsearch_links (broken_intos_, (Spanner *)l, Spanner::compare);
-
- if (idx < 0)
- return 0;
- else
+ vsize idx = binary_search (broken_intos_, (Spanner *)l, Spanner::compare);
+ if (idx != VPOS)
return broken_intos_ [idx];
+ return 0;
}
int
broken_spanner_index (Spanner *sp)
{
Spanner *parent = dynamic_cast<Spanner *> (sp->original ());
- return parent->broken_intos_.find_index (sp);
+ return find (parent->broken_intos_, sp) - parent->broken_intos_.begin ();
}
Spanner *
TRANSLATOR_DECLARATIONS (Stanza_number_align_engraver);
protected:
- Link_array<Grob> lyrics_;
- Link_array<Grob> stanza_numbers_;
+ Link_array__Grob_ lyrics_;
+ Link_array__Grob_ stanza_numbers_;
DECLARE_ACKNOWLEDGER (lyric_syllable);
DECLARE_ACKNOWLEDGER (stanza_number);
return SCM_BOOL_T;
extract_grob_set (me, "note-heads", ro_heads);
- Link_array<Grob> heads (ro_heads);
- heads.sort (compare_position);
+ Link_array__Grob_ heads (ro_heads);
+ vector_sort (heads, compare_position);
Direction dir = get_grob_direction (me);
if (dir < 0)
- heads.reverse ();
+ reverse (heads);
Real thick = thickness (me);
struct Bracket_nesting_group : public Bracket_nesting_node
{
Spanner *delimiter_;
- Link_array<Bracket_nesting_node> children_;
+ Link_array__Bracket_nesting_node_ children_;
SCM symbol_;
void from_list (SCM );
}
static void
-fixup_refpoints (Link_array<Grob> const &grobs)
+fixup_refpoints (Link_array__Grob_ const &grobs)
{
for (vsize i = grobs.size (); i--;)
grobs[i]->fixup_refpoint ();
System *system = dynamic_cast<System *> (clone (i));
system->rank_ = i;
- Link_array<Grob> c (breaking[i].cols_);
+ Link_array__Grob_ c (breaking[i].cols_);
pscore_->typeset_system (system);
system->set_bound (LEFT, c[0]);
This might seem inefficient, but Stencils are cached per grob
anyway. */
- Link_array<Grob> all_elts_sorted (all_elements_->array ());
- all_elts_sorted.default_sort ();
- all_elts_sorted.uniq ();
+ Link_array__Grob_ all_elts_sorted (all_elements_->array ());
+ vector_sort (all_elts_sorted, default_compare);
+ uniq (all_elts_sorted);
this->get_stencil ();
for (vsize i = all_elts_sorted.size (); i--;)
{
return pl->unprotect ();
}
-Link_array<Item>
+Link_array__Item_
System::broken_col_range (Item const *left, Item const *right) const
{
- Link_array<Item> ret;
+ Link_array__Item_ ret;
left = left->get_column ();
right = right->get_column ();
/** Return all columns, but filter out any unused columns , since they might
disrupt the spacing problem. */
-Link_array<Grob>
+Link_array__Grob_
System::columns () const
{
extract_grob_set (this, "columns", ro_columns);
break;
}
- Link_array<Grob> columns;
+ Link_array__Grob_ columns;
for (int i = 0; i <= last_breakable; i++)
{
if (Paper_column::is_used (ro_columns[i]))
*/
class Tab_note_heads_engraver : public Engraver
{
- Link_array<Item> notes_;
+ Link_array__Item_ notes_;
- Link_array<Item> dots_;
- Link_array<Music> note_events_;
- Link_array<Music> tabstring_events_;
+ Link_array__Item_ dots_;
+ Link_array__Music_ note_events_;
+ Link_array__Music_ tabstring_events_;
public:
TRANSLATOR_DECLARATIONS (Tab_note_heads_engraver);
*/
class Text_engraver : public Engraver
{
- Link_array<Music> evs_;
- Link_array<Item> texts_;
+ Link_array__Music_ evs_;
+ Link_array__Item_ texts_;
public:
TRANSLATOR_DECLARATIONS (Text_engraver);
protected:
#include "stem.hh"
#include "note-head.hh"
#include "tie.hh"
-#include "parray.hh"
+#include "std-vector.hh"
#include "spanner.hh"
#include "item.hh"
#include "staff-symbol-referencer.hh"
{
Grob *me = unsmob_grob (smob);
extract_grob_set (me, "ties", ro_ties);
- Link_array<Grob> ties (ro_ties);
+ Link_array__Grob_ ties (ro_ties);
if (!ties.size ())
return SCM_BOOL_T;
return SCM_BOOL_T;
}
- ties.sort (&Tie::compare);
+ vector_sort (ties, &Tie::compare);
Tie_formatting_problem problem;
problem.from_ties (ties);
class Tie_engraver : public Engraver
{
Music *event_;
- Link_array<Grob> now_heads_;
+ Link_array__Grob_ now_heads_;
std::vector<Head_event_tuple> heads_to_tie_;
- Link_array<Grob> ties_;
+ Link_array__Grob_ ties_;
Spanner *tie_column_;
}
void
-Tie_formatting_problem::set_chord_outline (Link_array<Item> bounds,
+Tie_formatting_problem::set_chord_outline (Link_array__Item_ bounds,
Direction d)
{
Real staff_space = Staff_symbol_referencer::staff_space (bounds[0]);
void
Tie_formatting_problem::from_tie (Grob *tie)
{
- Link_array<Grob> ties;
+ Link_array__Grob_ ties;
ties.push_back (tie);
from_ties (ties);
}
void
-Tie_formatting_problem::from_ties (Link_array<Grob> const &ties)
+Tie_formatting_problem::from_ties (Link_array__Grob_ const &ties)
{
if (ties.empty ())
return;
Direction d = LEFT;
do
{
- Link_array<Item> bounds;
+ Link_array__Item_ bounds;
for (vsize i = 0; i < ties.size (); i++)
{
}
void
-Tie_formatting_problem::from_lv_ties (Link_array<Grob> const &lv_ties)
+Tie_formatting_problem::from_lv_ties (Link_array__Grob_ const &lv_ties)
{
if (lv_ties.empty ())
return;
details_.from_grob (lv_ties[0]);
- Link_array<Item> heads;
+ Link_array__Item_ heads;
for (vsize i = 0; i < lv_ties.size (); i++)
{
Tie_configuration
Tie_formatting_problem::find_optimal_tie_configuration (Tie_specification const &spec) const
{
- Link_array<Tie_configuration> confs;
+ Link_array__Tie_configuration_ confs;
int pos = spec.position_;
Direction dir = spec.manual_dir_;
Grob *
-Tuplet_bracket::parallel_beam (Grob *me_grob, Link_array<Grob> const &cols, bool *equally_long)
+Tuplet_bracket::parallel_beam (Grob *me_grob, Link_array__Grob_ const &cols, bool *equally_long)
{
Spanner *me = dynamic_cast<Spanner *> (me_grob);
protected:
std::vector<Tuplet_description> tuplets_;
- Link_array<Spanner> last_tuplets_;
+ Link_array__Spanner_ last_tuplets_;
DECLARE_ACKNOWLEDGER (note_column);
virtual bool try_music (Music *r);
virtual void finalize ();
if (before_grob || after_grob)
{
Grob_array *ga = unsmob_grob_array (valign_->get_object ("elements"));
- Link_array<Grob> &arr = ga->array_reference ();
+ Link_array__Grob_ &arr = ga->array_reference ();
- Grob *added = arr.pop ();
+ Grob *added = arr.back ();
+ arr.pop_back ();
for (vsize i = 0; i < arr.size (); i++)
{
if (arr[i] == before_grob)