(--enable-std-string): On by default.
* flower/include/std-vector.hh: New file. Enable switch to
std::vector, update client code.
+2006-01-31 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * configure.in (--enable-std-vector): New option.
+ (--enable-std-string): On by default.
+
+ * flower/include/std-vector.hh: New file. Enable switch to
+ std::vector, update client code.
+
2006-01-30 Graham Percival <gpermus@gmail.com>
* scm/document-translation.scm: clarify "this context is also
[ --enable-gui compile with experimental GNOME output. Default: off],
[gui_b=$enableval])
-std_string=no
+std_string=yes
AC_ARG_ENABLE(std-string,
- [ --enable-std-string compile with experimental std::string. Default: off],
+ [ --enable-std-string compile with std::string. Default: on],
[std_string=$enableval])
if test "$std_string" = "yes"; then
# Store in config.make rather than in config.hh and have every
DEFINES="$DEFINES -DSTD_STRING=1"
fi
+std_vector=no
+AC_ARG_ENABLE(std-string,
+ [ --enable-std-vector compile with experimental std::vector. Default: off],
+ [std_vector=$enableval])
+if test "$std_vector" = "yes"; then
+ # Store in config.make rather than in config.hh and have every
+ # source file depend on that.
+ DEFINES="$DEFINES -DSTD_VECTOR=1"
+fi
+
NCSB_DIR=unknown
AC_ARG_WITH(ncsb-dir,
[ --with-ncsb-dir=DIR location of Century Schoolbook fonts
#define PATHSEP ':'
#endif
-Array<std::string>
+std::vector<std::string>
File_path::directories () const
{
return dirs_;
if (file_name.dir_[0] == DIRSEP && is_file (file_name.to_string ()))
return file_name.to_string ();
- for (int i = 0; i < dirs_.size (); i++)
+ for (vsize i = 0; i < dirs_.size (); i++)
{
File_name file_name (name);
File_name dir = (std::string) dirs_[i];
File_path::to_string () const
{
std::string s;
- for (int i = 0; i < dirs_.size (); i++)
+ for (vsize i = 0; i < dirs_.size (); i++)
{
s = s + dirs_[i];
if (i < dirs_.size () - 1)
void
File_path::append (std::string str)
{
- dirs_.push (str);
+ dirs_.push_back (str);
}
void
#ifndef ARRAY_H
#define ARRAY_H
+#ifndef STD_VECTOR_HH
+#error array.hh is obsolete, use std-vector.hh
+#endif
+
#include <cassert>
using namespace std;
#define INLINE inline
#endif
+namespace std {
/// copy a bare (C-)array from #src# to #dest# sized #count#
template<class T> void arrcpy (T *dest, T const *src, int count);
{
protected:
/// maximum length of array.
- int max_;
+ vsize max_;
/// the data itself
T *array_;
/// stretch or shrink array.
- void remax (int newmax)
+ void remax (vsize newmax)
{
T *newarr = new T[newmax];
size_ = (newmax < size_) ? newmax : size_;
array_ = newarr;
max_ = newmax;
}
- int size_;
+ vsize size_;
public:
+ /* std::vector interface */
+ Array ()
+ {
+ array_ = 0;
+ max_ = 0;
+ size_ = 0;
+ }
+
+ Array (Array const &src)
+ {
+ array_ = src.copys ();
+ max_ = size_ = src.size_;
+ }
+
+ T const &back () const
+ {
+ return (*this)[size_ - 1];
+ }
+
+ T &back ()
+ {
+ return (*this)[size_ - 1];
+ }
+
+ bool empty () const
+ {
+ return !size_;
+ }
+
+ void pop_back ()
+ {
+ assert (!empty ());
+ resize (size () - 1);
+ }
+
+ vsize size () const
+ {
+ return size_;
+ }
+
+ /** set the size_ to #s#.
+ POST: size () == s.
+ Warning: contents are unspecified */
+ void resize (vsize s)
+ {
+ if (s > max_)
+ remax (s);
+ size_ = s;
+ }
+
+
+
/// check invariants
void OK () const;
/** report the size_.
{setsize_}
*/
- int size () const
- {
- return size_;
- }
-
/// POST: size () == 0
void clear ()
{
size_ = 0;
}
- Array (T *tp, int n)
+ Array (T *tp, vsize n)
{
array_ = new T[n];
max_ = size_ = n;
arrcpy (array_, tp, n);
}
- Array ()
- { array_ = 0; max_ = 0; size_ = 0; }
-
// ugh, get around gcc 2.8.1 ice; see bezier.cc
- Array (int i)
+ Array (vsize i)
{
max_ = size_ = i;
array_ = new T[i];
}
- /** set the size_ to #s#.
- POST: size () == s.
- Warning: contents are unspecified */
- void set_size (int s)
+ /// tighten array size_.
+ void tighten_maxsize ()
{
- if (s > max_) remax (s);
- size_ = s;
+ remax (size_);
}
~Array ()
- { delete[] array_; }
+ {
+ delete[] array_;
+ }
/// return a "new"ed copy of array
T *copys () const
}
void operator = (Array const &src)
{
- set_size (src.size_);
+ resize (src.size_);
arrcpy (array_, src.array_, size_);
}
- Array (Array const &src)
- {
- array_ = src.copys ();
- max_ = size_ = src.size_;
- }
-
- /// tighten array size_.
- void tighten_maxsize ()
- {
- remax (size_);
- }
T *remove_array ();
/// access element
- T &operator [] (int i)
+ T &operator [] (vsize i)
{
return elem_ref (i);
}
/// access element
- T const &operator [] (int i) const
+ T const &operator [] (vsize i) const
{
return elem_ref (i);
}
/// access element
- T &elem_ref (int i) const
+ T &elem_ref (vsize i) const
{
+#if !STD_VECTOR
assert (i >= 0 && i < size_);
+#else
+ assert (i < size_);
+#endif
return ((T *)array_)[i];
}
/// access element
- T elem (int i) const
+ T elem (vsize i) const
{
return elem_ref (i);
}
/// add to the end of array
- void push (T x)
+ void push_back (T x)
{
if (size_ == max_)
remax (2 * max_ + 1);
// vars
array_[size_++] = x;
}
+#if 0
/// remove and return last entry
T pop ()
{
- assert (!is_empty ());
+ assert (!empty ());
T l = top (0);
- set_size (size () - 1);
+ resize (size () - 1);
return l;
}
+#endif
+
/// access last entry
- T &top (int j = 0)
+ T &top (vsize j)
{
return (*this)[size_ - j - 1];
}
/// return last entry
- T top (int j = 0) const
+ T top (vsize j) const
{
return (*this)[size_ - j - 1];
}
- T &boundary (int dir, int idx)
+ T &boundary (int dir, vsize idx)
{
assert (dir);
if (dir == 1)
else
return elem_ref (idx);
}
- T boundary (int dir, int idx) const
+ T boundary (int dir, vsize idx) const
{
assert (dir);
if (dir == 1)
else
return elem (idx);
}
- void swap (int i, int j)
+ void swap (vsize i, vsize j)
{
T t ((*this)[i]);
(*this)[i] = (*this)[j];
(*this)[j] = t;
}
- bool is_empty () const
- { return !size_; }
- void insert (T k, int j);
+ void insert (T k, vsize j);
/**
remove i-th element, and return it.
*/
- T get (int i)
+ T get (vsize i)
{
T t = elem (i);
del (i);
return t;
}
- void unordered_del (int i)
+ void unordered_del (vsize i)
{
- elem_ref (i) = top ();
- set_size (size () -1);
+ elem_ref (i) = back ();
+ resize (size () -1);
}
- void del (int i)
+ void del (vsize i)
{
- assert (i >= 0&& i < size_);
+#if !STD_VECTOR
+ assert (i >= 0 && i < size_);
+#else
+ assert (i < size_);
+#endif
arrcpy (array_ + i, array_ + i + 1, size_ - i - 1);
size_--;
}
// quicksort.
void sort (int (*compare) (T const &, T const &),
- int lower = -1, int upper = -1);
+ vsize lower=VPOS, vsize upper=VPOS);
void concat (Array<T> const &src)
{
- int s = size_;
- set_size (size_ + src.size_);
+ vsize s = size_;
+ resize (size_ + src.size_);
arrcpy (array_ + s, src.array_, src.size_);
}
- Array<T> slice (int lower, int upper) const;
+ Array<T> slice (vsize lower, vsize upper) const;
void reverse ();
};
#include "array.icc"
+}
+
#endif
*/
#if 0
-#include "array.hh"
+#include "std-vector.hh"
#ifdef INLINE
#undef INLINE
#endif
*/
template<class T> INLINE void
-arrcpy (T *dest, T const *src, int count)
+arrcpy (T *dest, T const *src, vsize count)
{
- for (int i_shadows_local = 0; i_shadows_local < count; i_shadows_local++)
+ for (vsize i_shadows_local = 0; i_shadows_local < count; i_shadows_local++)
#ifdef __powerpc__
{
/*
}
template<class T> INLINE void
-Array<T>::insert (T k, int j)
+Array<T>::insert (T k, vsize j)
{
- assert (j >= 0 && j <= size_);
- set_size (size_ + 1);
- for (int i = size_ - 1; i > j; i--)
+#if !STD_VECTOR
+ assert (j >= 0 && j <= size_);
+#else
+ assert (j <= size_);
+#endif
+ resize (size_ + 1);
+ for (vsize i = size_ - 1; i > j; i--)
array_[i] = array_[i - 1];
array_[j] = k;
}
template<class T> INLINE void
-Array<T>::sort (int (*compare) (T const &, T const &), int lower, int upper)
+Array<T>::sort (int (*compare) (T const &, T const &), vsize lower, vsize upper)
{
if (lower < 0)
{
if (lower >= upper)
return;
swap (lower, (lower + upper) / 2);
- int last = lower;
- for (int i = lower +1; i <= upper; i++)
+ vsize last = lower;
+ for (vsize i = lower +1; i <= upper; i++)
if (compare (array_[i], array_[lower]) < 0)
swap (++last, i);
swap (lower, last);
template<class T> INLINE void
Array<T>::reverse ()
{
- int h = size_ / 2;
- for (int i = 0, j = size_ - 1; i < h; i++, j--)
+ vsize h = size_ / 2;
+ for (vsize i = 0, j = size_ - 1; i < h; i++, j--)
swap (i, j);
}
void
Array<T>::OK () const
{
+#if !STD_VECTOR
assert (max_ >= size_ && size_ >= 0);
+#else
+ assert (max_ >= size_);
+#endif
if (max_)
assert (array_);
}
template<class T> INLINE
Array<T>
-Array<T>::slice (int lower, int upper) const
+Array<T>::slice (vsize lower, vsize upper) const
{
+#if !STD_VECTOR
assert (lower >= 0 && lower <= upper && upper <= size_);
+#else
+ assert (lower <= upper && upper <= size_);
+#endif
Array<T> r;
- int s = upper - lower;
- r.set_size (s);
+ vsize s = upper - lower;
+ r.resize (s);
arrcpy (r.array_, array_ + lower, s);
return r;
}
void
binary_search_bounds (Array<T> const &table,
T const &key, int (*compare) (T const &, T const &),
- int *lo,
- int *hi)
+ vsize *lo,
+ vsize *hi)
{
int cmp;
int result;
lookup with binsearch, return array index.
*/
template<class T>
-int
+vsize
binary_search (Array<T> const &table,
T const &key, int (*compare) (T const &, T const &),
- int lo = 0,
- int hi = -1)
+ vsize lo=0,
+ vsize hi=VPOS)
{
- if (hi < 0)
+ if (hi == VPOS)
hi = table.size ();
binary_search_bounds (table, key, compare, &lo, &hi);
if (! (*compare) (key, table[lo]))
return lo;
- else
- return -1; /* not found */
+
+ /* not found */
+ return VPOS;
}
#ifndef FILE_NAME_HH
#define FILE_NAME_HH
-#include "array.hh"
+#include "std-vector.hh"
#include "std-string.hh"
class File_name
#ifndef FILE_PATH_HH
#define FILE_PATH_HH
-#include "array.hh"
+#include "std-vector.hh"
#include "std-string.hh"
/**
class File_path
{
- Array<std::string> dirs_;
+ std::vector<std::string> dirs_;
+
public:
- Array<std::string> directories () const;
+ std::vector<std::string> directories () const;
std::string find (std::string name) const;
std::string find (std::string name, char const *extensions[]);
std::string to_string () const;
char const *flower_version_str0 ();
-template<class T> struct Link_array;
-template<class T> struct Array;
template<class T, class K> struct Assoc;
template<class K, class V> struct Hash_table;
template<class K, class V> struct Hash_table_iter;
-template<class T> struct Link_list;
-template<class T> struct Interval_t;
-template<class T> struct PQueue;
typedef unsigned char Byte;
namespace std {
struct String_data;
struct String_handle;
- //struct String;
}
struct String_convert;
#include "std-string.hh"
+#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;
+
+
typedef Interval_t<Real> Interval;
struct Offset;
#define scm_is_number(x) (scm_number_p (x) == SCM_BOOL_T)
inline int ly_scm2int (SCM x) { return scm_num2int (x, 0, "ly_scm2int"); }
#define scm_to_int(x) (ly_scm2int (x))
+inline int ly_scm2unsigned (SCM x) { return scm_num2uint (x, 0, "ly_scm2unsigned"); }
+#define scm_to_unsigned(x) (ly_scm2unsigned (x))
inline int ly_c_symbol_p (SCM x) { return SCM_SYMBOLP (x); }
#define scm_is_symbol(x) ly_c_symbol_p (x)
inline int ly_c_boolean_p (SCM x) { return SCM_BOOLP (x); }
#define scm_to_double(x) (ly_scm2double (x))
#define scm_from_double(x) (scm_make_real (x))
-#endif /* SCM_MINOR_VERSION < 7 */
+#else /* !SCM_MINOR_VERSION < 7 */
+
+#define scm_to_unsigned(x) scm_to_uint32 (x)
+#define scm_from_unsigned(x) scm_from_unsigned_integer (x)
+
+#endif /* !SCM_MINOR_VERSION < 7 */
#endif /* GUILE_COMPATIBILITY_HH */
#ifndef INTERVAL_SET_HH
#define INTERVAL_SET_HH
-#include "array.hh"
+#include "std-vector.hh"
#include "interval.hh"
/*
*/
struct Interval_set
{
- Array<Interval> allowed_regions_;
+ std::vector<Interval> allowed_regions_;
Interval_set ();
void set_full ();
#ifndef PARRAY_HH
#define PARRAY_HH
-#include "array.hh"
+#include "std-vector.hh"
/**
an array of pointers.
:Array<void *> (v)
{
}
+
public:
Link_array ()
- {}
+ {
+ }
+
+ T *const &back() const
+ {
+ return (T * const &) Array<void *>::back();
+ }
+
+ T *&back ()
+ {
+ return (T *&) Array<void *>::back ();
+ }
+
+ /* Flower compat */
+ Array<void *>::del;
+ Array<void *>::unordered_del;
+ Array<void *>::size;
+ Array<void *>::clear;
+ Array<void *>::resize;
+ Array<void *>::empty;
+ Array<void *>::reverse;
+ Array<void *>::pop_back;
+ Array<void *>::tighten_maxsize;
static int default_compare (T *const &p1, T *const &p2)
{
}
T *pop ()
{
- return (T *) Array<void *>::pop ();
+ T* t = (T *) Array<void *>::back ();
+ pop_back ();
+ return t;
}
- void insert (T *t, int i)
+ void insert (T *t, vsize i)
{
Array<void *>::insert (t, i);
}
- void push (T *t)
+ void push_back (T *t)
{
- Array<void *>::push (t);
+ Array<void *>::push_back (t);
}
+
/// return last entry
- T *top (int j = 0) const
+ T *top (int j) const
{
return (T *) Array<void *>::top (j);
}
- T *& top (int i = 0)
+ T *& top (int i)
{
return (T *&) Array<void *>::top (i);
}
+
void substitute (T *old, T *new_p)
{
int i;
void uniq ()
{
Link_array<T> ls;
- for (int i = 0; i < size (); i++)
+ for (vsize i = 0; i < size (); i++)
if (!i || elem (i - 1) != elem (i))
- ls.push (elem (i));
+ ls.push_back (elem (i));
*this = ls;
}
- Array<void *>::del;
- Array<void *>::unordered_del;
- Array<void *>::size;
- Array<void *>::clear;
- Array<void *>::set_size;
- Array<void *>::is_empty;
- Array<void *>::reverse;
- Array<void *>::tighten_maxsize;
T *& boundary (int d, int i)
{
}
int find_index (T const *t) const
{
- for (int i = 0; i < size (); i++)
+ for (vsize i = 0; i < size (); i++)
if (elem (i) == t)
return i;
return -1;
typecasts (Link_array<V> const &a, T * /* dummy */)
{
Link_array<T> ret;
- for (int i = a.size (); i--;)
- ret.push (dynamic_cast<T *> (a[i])); // ugh?
+ for (vsize i = a.size (); i--;)
+ ret.push_back (dynamic_cast<T *> (a[i])); // ugh?
return ret;
}
void
junk_pointers (Link_array<T> &a)
{
- for (int i = 0; i < a.size (); i++)
+ for (vsize i = 0; i < a.size (); i++)
delete a[i];
a.clear ();
}
#ifndef POLY_H
#define POLY_H
-#include "array.hh"
+#include "std-vector.hh"
#include "arithmetic-operator.hh"
#include "real.hh"
int degree ()const;
/// coefficients
- Array<Real> coefs_;
+ std::vector<Real> coefs_;
// leading coef
Real &lc ();
Real lc () const;
void print () const;
Real eval (Real) const;
- void print_sols (Array<Real>) const;
- void check_sols (Array<Real>) const;
+ void print_sols (std::vector<Real>) const;
+ void check_sols (std::vector<Real>) const;
void check_sol (Real x) const;
static Polynomial multiply (const Polynomial &p1, const Polynomial &p2);
static Polynomial power (int exponent, const Polynomial &src);
void debug_clean ();
- Array<Real> solve_quadric ()const;
- Array<Real> solve_cubic ()const;
- Array<Real> solve_linear ()const;
+ std::vector<Real> solve_quadric ()const;
+ std::vector<Real> solve_cubic ()const;
+ std::vector<Real> solve_linear ()const;
- Array<Real> solve () const;
+ std::vector<Real> solve () const;
};
IMPLEMENT_ARITHMETIC_OPERATOR (Polynomial, -);
#ifndef PQUEUE_HH
#define PQUEUE_HH
-#include "array.hh"
+#include "std-vector.hh"
template<class K, class T>
struct PQueue_ent
class PQueue
{
Array<T> heap_array_;
- T &elt (int i)
+ T &elt (vsize i)
{
return heap_array_[i - 1];
}
- T const &elt (int i) const
+ T const &elt (vsize i) const
{
return heap_array_[i - 1];
}
priority might fuck up the invariants
@param 1 <= i < size () */
- T &operator [] (int i) { return heap_array_[i]; }
- T operator [] (int i) const { return heap_array_[i]; }
+ T &operator [] (vsize i)
+ {
+ return heap_array_[i];
+ }
+ T operator [] (vsize i) const
+ {
+ return heap_array_[i];
+ }
void OK () const
{
#ifndef NDEBUG
- for (int i = 2; i <= size (); i++)
+ for (vsize i = 2; i <= size (); i++)
assert (compare (elt (i / 2), elt (i)) <= 0);
#endif
}
- T front () const { return elt (1); }
- int size () const { return heap_array_.size (); }
+ T front () const
+ {
+ return elt (1);
+ }
+ vsize size () const
+ {
+ return heap_array_.size ();
+ }
void insert (T v)
{
- heap_array_.push (v);
- int i = heap_array_.size ();
- int j = i / 2;
+ heap_array_.push_back (v);
+ vsize i = heap_array_.size ();
+ vsize j = i / 2;
while (j)
{
if (compare (elt (j), v) > 0)
void delmin ()
{
assert (size ());
- T last = heap_array_.top ();
+ T last = heap_array_.back ();
- int mini = 2;
- int lasti = 1;
+ vsize mini = 2;
+ vsize lasti = 1;
while (mini < size ())
{
mini *= 2;
}
elt (lasti) = last;
- heap_array_.pop ();
+ heap_array_.pop_back ();
OK ();
}
T get ()
string to_string (char c, int n = 1);
string to_string (int i, char const *format = 0);
string to_string (double f, char const *format = 0);
- string to_string (long b);
+ string to_string (long);
+ string to_string (unsigned);
string to_string (bool b);
string to_string (char const *format, ...);
--- /dev/null
+/*
+ std-vector.hh -- declare std::vector
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2006 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#ifndef STD_VECTOR_HH
+#define STD_VECTOR_HH
+
+#include <algorithm> // reverse, sort
+
+#if !STD_VECTOR
+/* Also declare vector, in the wrong way. */
+#include <algorithm>
+#include <iostream>
+#include <sstream>
+#endif
+
+
+#include "compare.hh"
+
+#if STD_VECTOR
+
+#define vector __vector
+#include <vector>
+#undef vector
+
+namespace std {
+
+ #ifndef VSIZE
+ #define VSIZE
+ typedef size_t vsize;
+ #define VPOS UINT_MAX
+ #endif
+
+ /* Interface without pointer arithmetic (iterator) semantics. */
+ template<typename T>
+ class vector : public __vector<T>
+ {
+ public:
+ typedef typename __vector<T>::iterator iterator;
+ //typedef int (*compare) (T *const&, T *const&);
+
+ vector<T> () : __vector<T> ()
+ {
+ }
+
+ vector<T> (iterator const b, iterator const e) : __vector<T> (b, e)
+ {
+ }
+
+ vector<T> (vsize b, vsize e) : __vector<T> (iter (b), iter (e))
+ {
+ }
+
+ iterator iter (vsize n)
+ {
+ if (n == VPOS)
+ return this->end ();
+ return __vector<T>::begin () + n;
+ }
+
+ iterator const iter (vsize n) const
+ {
+ if (n == VPOS)
+ return this->end ();
+ return __vector<T>::begin () + n;
+ }
+
+ void
+ insert (T k, vsize i)
+ {
+ __vector<T>::insert (this->iter (i), k);
+ }
+
+ void
+ insert (vector<T> &v, vsize i)
+ {
+ __vector<T>::insert (iter (i), v.begin (), v.end ());
+ }
+
+ void
+ concat (vector<T> const &v)
+ {
+ __vector<T>::insert (this->end (), v.begin (), v.end ());
+ }
+
+ /* Flower-Array compatibility. */
+ T const &
+ boundary (int dir, vsize i) const
+ {
+ assert (dir);
+ if (dir == 1)
+ return this->top (i);
+ else
+ return this->at (i);
+ }
+
+ T &
+ boundary (int dir, vsize i)
+ {
+ assert (dir);
+ if (dir == 1)
+ return this->top (i);
+ else
+ return this->at (i);
+ }
+
+ T
+ del (vsize i)
+ {
+ return *__vector<T>::erase (iter (i));
+ }
+
+ T const &
+ elem (vsize i) const
+ {
+ return this->at (i);
+ }
+
+ T &
+ elem (vsize i)
+ {
+ return this->at (i);
+ }
+
+#if 1 // FIXME, silly, but keep for s/r
+ T const &
+ elem_ref (vsize i) const
+ {
+ return elem (i);
+ }
+
+ T &
+ elem_ref (vsize i)
+ {
+ return elem (i);
+ }
+#endif
+
+#if 0
+ T *
+ remove_array ()
+ {
+ // FIXME, no algorithm for this?
+ T *p = new T[this->size ()];
+ for (vsize i = 0; i < this->size (); i++)
+ p[i] = (*this)[i];
+ this->clear ();
+ return p;
+ }
+#else
+ T *
+ remove_array ()
+ {
+ T *p = &(*this)[0];
+ // forget array?
+ //this->resize (0);
+ return p;
+ }
+#endif
+
+ void
+ reverse ()
+ {
+ // CHECKME: for a simple vector, like vector<int>, this should
+ // expand to memrev.
+ ::std::reverse (this->begin (), this->end ());
+ }
+
+ vector<T>
+ slice (vsize b, vsize e) const
+ {
+ return vector<T> (b, e);
+ }
+
+ void
+ sort (int vsize=VPOS, vsize b=VPOS, vsize e=VPOS)
+ {
+ ::std::sort (iter (b), iter(e));
+ }
+
+ void
+ sort (int (*compare) (T const &, T const &), int b=-1, int e=-1)
+ {
+ ::std::sort (iter (b), iter(e), compare);
+ }
+
+ void swap (vsize i, vsize j)
+ {
+ T t ((*this)[i]);
+ (*this)[i] = (*this)[j];
+ (*this)[j] = t;
+ }
+
+ T const &
+ top (vsize i) const
+ {
+ return (*this)[this->size () - i - 1];
+ }
+
+ T&
+ top (vsize i)
+ {
+ return (*this)[this->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) compare;
+ vector<T>::iterator const i = find (v.iter (b), v.iter (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>
+ void
+ binary_search_bounds (vector<T> const &table,
+ T const &key, int (*compare) (T const &, T const &),
+ vsize *lo,
+ vsize *hi)
+ {
+ int cmp;
+ int result;
+
+ /* binary search */
+ do
+ {
+ cmp = (*lo + *hi) / 2;
+
+ result = (*compare) (key, table[cmp]);
+
+ if (result < 0)
+ *hi = cmp;
+ else
+ *lo = cmp;
+ }
+ while (*hi - *lo > 1);
+ }
+
+ 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 ();
+
+ binary_search_bounds (table, key, compare, &lo, &hi);
+
+ if (! (*compare) (key, table[lo]))
+ return lo;
+
+ /* not found */
+ return VPOS;
+ }
+#endif
+}
+
+
+
+#else /* ! STD_VECTOR */
+
+namespace std {
+
+#define vector Array
+ using namespace std;
+
+ #ifndef VSIZE
+ #define VSIZE
+ typedef int vsize;
+ #define VPOS -1
+ #endif
+}
+
+
+#endif /* STD_VECTOR */
+
+#include "array.hh"
+
+#endif /* STD_VECTOR_HH */
static unsigned hex2unsigned (std::string str);
static std::string hex2bin (std::string str);
static std::string int_string (int i, char const *fmt = 0);
+ static std::string unsigned_string (unsigned);
static std::string long_string (long);
static std::string int2hex (int i, int length_i, char ch);
static std::string unsigned2hex (unsigned u, ssize length, char ch);
static std::string rational_string (Rational);
static std::string pointer_string (void const *);
static std::string precision_string (double x, int n);
- static Array<std::string> split (std::string str, char c);
+ static std::vector<std::string> split (std::string str, char c);
static std::string i64_string (I64, char const *fmt = 0);
static std::string to_lower (std::string s);
static std::string to_upper (std::string s);
allowed_regions_.clear ();
Interval s;
s.set_full ();
- allowed_regions_.push (s);
+ allowed_regions_.push_back (s);
}
void
Interval_set::remove_interval (Interval rm)
{
- for (int i = 0; i < allowed_regions_.size ();)
+ for (vsize i = 0; i < allowed_regions_.size ();)
{
Interval s = rm;
Real p = 0.0;
// horner's scheme
- for (int i = coefs_.size (); i--;)
+ for (vsize i = coefs_.size (); i--;)
p = x * p + coefs_[i];
return p;
int deg = p1.degree () + p2.degree ();
for (int i = 0; i <= deg; i++)
{
- dest.coefs_.push (0);
+ dest.coefs_.push_back (0);
for (int j = 0; j <= i; j++)
if (i - j <= p2.degree () && j <= p1.degree ())
- dest.coefs_.top () += p1.coefs_[j] * p2.coefs_[i - j];
+ dest.coefs_.back () += p1.coefs_[j] * p2.coefs_[i - j];
}
return dest;
{
for (int i = 1; i <= degree (); i++)
coefs_[i - 1] = coefs_[i] * i;
- coefs_.pop ();
+ coefs_.pop_back ();
}
Polynomial
We only do relative comparisons. Absolute comparisons break down in
degenerate cases. */
while (degree () > 0
- && (fabs (coefs_.top ()) < FUDGE * fabs (coefs_.top (1))
- || !coefs_.top ()))
- coefs_.pop ();
+ && (fabs (coefs_.back ()) < FUDGE * fabs (coefs_.top (1))
+ || !coefs_.back ()))
+ coefs_.pop_back ();
}
void
Polynomial::operator += (Polynomial const &p)
{
while (degree () < p.degree ())
- coefs_.push (0.0);
+ coefs_.push_back (0.0);
for (int i = 0; i <= p.degree (); i++)
coefs_[i] += p.coefs_[i];
Polynomial::operator -= (Polynomial const &p)
{
while (degree () < p.degree ())
- coefs_.push (0.0);
+ coefs_.push_back (0.0);
for (int i = 0; i <= p.degree (); i++)
coefs_[i] -= p.coefs_[i];
while (k >= 0 && coefs_[k] == 0.0)
k--;
- coefs_.set_size (1+ ((k < 0) ? 0 : k));
+ coefs_.resize (1+ ((k < 0) ? 0 : k));
return degree ();
}
}
void
-Polynomial::check_sols (Array<Real> roots) const
+Polynomial::check_sols (std::vector<Real> roots) const
{
- for (int i = 0; i < roots.size (); i++)
+ for (vsize i = 0; i < roots.size (); i++)
check_sol (roots[i]);
}
Polynomial::Polynomial (Real a, Real b)
{
- coefs_.push (a);
+ coefs_.push_back (a);
if (b)
- coefs_.push (b);
+ coefs_.push_back (b);
}
/* cubic root. */
return !r;
}
-Array<Real>
+std::vector<Real>
Polynomial::solve_cubic ()const
{
- Array<Real> sol;
+ std::vector<Real> sol;
/* normal form: x^3 + Ax^2 + Bx + C = 0 */
Real A = coefs_[2] / coefs_[3];
if (iszero (D))
{
if (iszero (q)) { /* one triple solution */
- sol.push (0);
- sol.push (0);
- sol.push (0);
+ sol.push_back (0);
+ sol.push_back (0);
+ sol.push_back (0);
}
else { /* one single and one double solution */
Real u = cubic_root (-q);
- sol.push (2 * u);
- sol.push (-u);
+ sol.push_back (2 * u);
+ sol.push_back (-u);
}
}
else if (D < 0)
Real phi = 1.0 / 3 * acos (-q / sqrt (-cb));
Real t = 2 * sqrt (-p);
- sol.push (t * cos (phi));
- sol.push (-t * cos (phi + M_PI / 3));
- sol.push (-t * cos (phi - M_PI / 3));
+ sol.push_back (t * cos (phi));
+ sol.push_back (-t * cos (phi + M_PI / 3));
+ sol.push_back (-t * cos (phi - M_PI / 3));
}
else
{
Real u = cubic_root (sqrt_D - q);
Real v = -cubic_root (sqrt_D + q);
- sol.push (u + v);
+ sol.push_back (u + v);
}
/* resubstitute */
Real sub = 1.0 / 3 * A;
- for (int i = sol.size (); i--;)
+ for (vsize i = sol.size (); i--;)
{
sol[i] -= sub;
Real
Polynomial::lc () const
{
- return coefs_.top ();
+ return coefs_.back ();
}
Real &
Polynomial::lc ()
{
- return coefs_.top ();
+ return coefs_.back ();
}
int
/*
all roots of quadratic eqn.
*/
-Array<Real>
+std::vector<Real>
Polynomial::solve_quadric ()const
{
- Array<Real> sol;
+ std::vector<Real> sol;
/* normal form: x^2 + px + q = 0 */
Real p = coefs_[1] / (2 * coefs_[2]);
Real q = coefs_[0] / coefs_[2];
{
D = sqrt (D);
- sol.push (D - p);
- sol.push (-D - p);
+ sol.push_back (D - p);
+ sol.push_back (-D - p);
}
return sol;
}
/* solve linear equation */
-Array<Real>
+std::vector<Real>
Polynomial::solve_linear ()const
{
- Array<Real> s;
+ std::vector<Real> s;
if (coefs_[1])
- s.push (-coefs_[0] / coefs_[1]);
+ s.push_back (-coefs_[0] / coefs_[1]);
return s;
}
-Array<Real>
+std::vector<Real>
Polynomial::solve () const
{
Polynomial *me = (Polynomial *) this;
case 3:
return solve_cubic ();
}
- Array<Real> s;
+ std::vector<Real> s;
return s;
}
return String_convert::long_string (b);
}
+ std::string
+ to_string (unsigned u)
+ {
+ return String_convert::unsigned_string (u);
+ }
+
std::string
to_string (char const *format, ...)
{
#include "libc-extension.hh"
#include "rational.hh"
-#include "array.hh"
+#include "std-vector.hh"
/**
A safe length for stringconversion buffers.
return (sign (x) > 0 ? str : "-" + str);
}
-Array<std::string>
+std::vector<std::string>
String_convert::split (std::string str, char c)
{
- Array<std::string> a;
+ std::vector<std::string> a;
ssize i = str.find (c);
while (i != NPOS)
{
std::string s = str.substr (0, i);
- a.push (s);
+ a.push_back (s);
while (str[++i] == c)
;
str = str.substr (i);
i = str.find (c);
}
if (str.length ())
- a.push (str);
+ a.push_back (str);
return a;
}
return s;
}
+std::string
+String_convert::unsigned_string (unsigned u)
+{
+ char s[STRING_BUFFER_LEN];
+ sprintf (s, "%ud", u);
+ return s;
+}
+
std::string
String_convert::pad_to (std::string s, int n)
{
Grob *accidental_placement_;
- Array<Accidental_entry> accidentals_;
+ std::vector<Accidental_entry> accidentals_;
Link_array<Spanner> ties_;
};
void
Accidental_engraver::process_acknowledged ()
{
- if (accidentals_.size () && !accidentals_.top ().done_)
+ if (accidentals_.size () && !accidentals_.back ().done_)
{
SCM accidentals = get_property ("autoAccidentals");
SCM cautionaries = get_property ("autoCautionaries");
int barnum = get_bar_number ();
- for (int i = 0; i < accidentals_.size (); i++)
+ for (vsize i = 0; i < accidentals_.size (); i++)
{
if (accidentals_[i].done_)
continue;
We add the accidentals to the support of the arpeggio,
so it is put left of the accidentals.
*/
- for (int i = 0; i < left_objects_.size (); i++)
+ for (vsize i = 0; i < left_objects_.size (); i++)
Side_position_interface::add_support (left_objects_[i], a);
- for (int i = 0; i < right_objects_.size (); i++)
+ for (vsize i = 0; i < right_objects_.size (); i++)
Side_position_interface::add_support (a, right_objects_[i]);
a->set_parent (support, Y_AXIS);
void
Accidental_engraver::stop_translation_timestep ()
{
- for (int j = ties_.size (); j--;)
+ for (vsize j = ties_.size (); j--;)
{
Grob *r = Tie::head (ties_[j], RIGHT);
- for (int i = accidentals_.size (); i--;)
+ for (vsize i = accidentals_.size (); i--;)
if (accidentals_[i].head_ == r)
{
if (Grob *g = accidentals_[i].accidental_)
}
}
- for (int i = accidentals_.size (); i--;)
+ for (vsize i = accidentals_.size (); i--;)
{
int barnum = get_bar_number ();
entry.origin_ = entry.origin_engraver_->context ();
entry.melodic_ = note;
- accidentals_.push (entry);
+ accidentals_.push_back (entry);
}
}
}
void
Accidental_engraver::acknowledge_tie (Grob_info info)
{
- ties_.push (dynamic_cast<Spanner *> (info.grob ()));
+ ties_.push_back (dynamic_cast<Spanner *> (info.grob ()));
}
void
Accidental_engraver::acknowledge_arpeggio (Grob_info info)
{
- left_objects_.push (info.grob ());
+ left_objects_.push_back (info.grob ());
}
void
Accidental_engraver::acknowledge_finger (Grob_info info)
{
- left_objects_.push (info.grob ());
+ left_objects_.push_back (info.grob ());
}
void
Grob *a = unsmob_grob (scm_car (s));
if (unsmob_grob (a->get_object ("tie")))
- break_reminder->push (a);
+ break_reminder->push_back (a);
else
- real_acc->push (a);
+ real_acc->push_back (a);
}
}
which = &ra;
Interval extent;
- for (int i = 0; i < which->size (); i++)
+ for (vsize i = 0; i < which->size (); i++)
extent.unite (which->elem (i)->extent (item_col, X_AXIS));
if (!extent.is_empty ())
struct Accidental_placement_entry
{
- Array<Skyline_entry> left_skyline_;
- Array<Skyline_entry> right_skyline_;
+ std::vector<Skyline_entry> left_skyline_;
+ std::vector<Skyline_entry> right_skyline_;
Interval vertical_extent_;
- Array<Box> extents_;
+ std::vector<Box> extents_;
Link_array<Grob> grobs_;
Real offset_;
int notename_;
apes->clear ();
- int i = 0;
int parity = 1;
- while (i < asc.size ())
+ for (vsize i = 0; i < asc.size ();)
{
Accidental_placement_entry *a = 0;
if (parity)
else
a = asc[i++];
- apes->push (a);
+ apes->push_back (a);
parity = !parity;
}
ape->notename_ = scm_to_int (scm_caar (s));
for (SCM t = scm_cdar (s); scm_is_pair (t); t = scm_cdr (t))
- ape->grobs_.push (unsmob_grob (scm_car (t)));
+ ape->grobs_.push_back (unsmob_grob (scm_car (t)));
- apes.push (ape);
+ apes.push_back (ape);
}
Grob *common[] = {me, 0};
extents if we're sure that we've found the right common refpoint
*/
Link_array<Grob> note_cols, heads;
- for (int i = apes.size (); i--;)
+ for (vsize i = apes.size (); i--;)
{
Accidental_placement_entry *ape = apes[i];
- for (int j = ape->grobs_.size (); j--;)
+ for (vsize j = ape->grobs_.size (); j--;)
{
Grob *a = ape->grobs_[j];
Grob *col = head->get_parent (X_AXIS);
if (Note_column::has_interface (col))
- note_cols.push (col);
+ note_cols.push_back (col);
else
- heads.push (head);
+ heads.push_back (head);
}
}
This is a little kludgy: to get all notes, we look if there are
collisions as well.
*/
- for (int i = note_cols.size (); i--;)
+ for (vsize i = note_cols.size (); i--;)
{
Grob *c = note_cols[i]->get_parent (X_AXIS);
if (Note_collision_interface::has_interface (c))
}
}
- for (int i = note_cols.size (); i--;)
+ for (vsize i = note_cols.size (); i--;)
heads.concat (extract_grob_array (note_cols[i], "note-heads"));
heads.default_sort ();
heads.uniq ();
common[Y_AXIS] = common_refpoint_of_array (heads, common[Y_AXIS], Y_AXIS);
- for (int i = apes.size (); i--;)
+ for (vsize i = apes.size (); i--;)
{
Accidental_placement_entry *ape = apes[i];
ape->left_skyline_ = empty_skyline (LEFT);
ape->right_skyline_ = empty_skyline (RIGHT);
- for (int j = apes[i]->grobs_.size (); j--;)
+ for (vsize j = apes[i]->grobs_.size (); j--;)
{
Grob *a = apes[i]->grobs_[j];
- Array<Box> boxes = Accidental_interface::accurate_boxes (a, common);
+ std::vector<Box> boxes = Accidental_interface::accurate_boxes (a, common);
ape->extents_.concat (boxes);
- for (int j = boxes.size (); j--;)
+ for (vsize j = boxes.size (); j--;)
{
insert_extent_into_skyline (&ape->left_skyline_, boxes[j], Y_AXIS, LEFT);
insert_extent_into_skyline (&ape->right_skyline_, boxes[j], Y_AXIS, RIGHT);
}
Interval total;
- for (int i = apes.size (); i--;)
+ for (vsize i = apes.size (); i--;)
{
Interval y;
- for (int j = apes[i]->extents_.size (); j--;)
+ for (vsize j = apes[i]->extents_.size (); j--;)
y.unite (apes[i]->extents_[j][Y_AXIS]);
apes[i]->vertical_extent_ = y;
total.unite (y);
Accidental_placement_entry *head_ape = new Accidental_placement_entry;
common[X_AXIS] = common_refpoint_of_array (heads, common[X_AXIS], X_AXIS);
- Array<Skyline_entry> head_skyline (empty_skyline (LEFT));
- Array<Box> head_extents;
- for (int i = heads.size (); i--;)
+ std::vector<Skyline_entry> head_skyline (empty_skyline (LEFT));
+ std::vector<Box> head_extents;
+ for (vsize i = heads.size (); i--;)
{
Box b (heads[i]->extent (common[X_AXIS], X_AXIS),
heads[i]->extent (common[Y_AXIS], Y_AXIS));
Real padding = robust_scm2double (me->get_property ("padding"), 0.2);
- Array<Skyline_entry> left_skyline = head_ape->left_skyline_;
+ std::vector<Skyline_entry> left_skyline = head_ape->left_skyline_;
heighten_skyline (&left_skyline,
-robust_scm2double (me->get_property ("right-padding"), 0));
/*
Add accs entries right-to-left.
*/
- for (int i = apes.size (); i-- > 0;)
+ for (vsize i = apes.size (); i-- > 0;)
{
Real offset
= -skyline_meshing_distance (apes[i]->right_skyline_, left_skyline);
apes[i]->offset_ = offset;
- Array<Skyline_entry> new_left_skyline = apes[i]->left_skyline_;
+ std::vector<Skyline_entry> new_left_skyline = apes[i]->left_skyline_;
heighten_skyline (&new_left_skyline, apes[i]->offset_);
merge_skyline (&new_left_skyline, left_skyline, LEFT);
left_skyline = new_left_skyline;
}
- for (int i = apes.size (); i--;)
+ for (vsize i = apes.size (); i--;)
{
Accidental_placement_entry *ape = apes[i];
- for (int j = ape->grobs_.size (); j--;)
+ for (vsize j = ape->grobs_.size (); j--;)
ape->grobs_[j]->translate_axis (ape->offset_, X_AXIS);
}
Interval left_extent, right_extent;
Accidental_placement_entry *ape = apes[0];
- for (int i = ape->extents_.size (); i--;)
+ for (vsize i = ape->extents_.size (); i--;)
left_extent.unite (ape->offset_ + ape->extents_[i][X_AXIS]);
- ape = apes.top ();
- for (int i = ape->extents_.size (); i--;)
+ ape = apes.back ();
+ for (vsize i = ape->extents_.size (); i--;)
right_extent.unite (ape->offset_ + ape->extents_[i][X_AXIS]);
left_extent[LEFT] -= robust_scm2double (me->get_property ("left-padding"), 0);
me->flush_extent_cache (X_AXIS);
me->set_property ("X-extent", scm_width);
- for (int i = apes.size (); i--;)
+ for (vsize i = apes.size (); i--;)
delete apes[i];
return SCM_BOOL_T;
return SCM_UNSPECIFIED;
}
-Array<Box>
+std::vector<Box>
Accidental_interface::accurate_boxes (Grob *a, Grob **common)
{
Box b;
b[X_AXIS] = a->extent (a, X_AXIS);
b[Y_AXIS] = a->extent (a, Y_AXIS);
- Array<Box> boxes;
+ std::vector<Box> boxes;
bool parens = false;
if (to_boolean (a->get_property ("cautionary")))
stem[Y_AXIS] *= 1.1;
bulb[Y_AXIS][UP] *= .35;
- boxes.push (bulb);
- boxes.push (stem);
+ boxes.push_back (bulb);
+ boxes.push_back (stem);
}
break;
case NATURAL:
rstem[X_AXIS][LEFT] = rstem[X_AXIS].linear_combination (1.0 / 3.0);
lstem[Y_AXIS][DOWN] = belly[Y_AXIS][DOWN];
rstem[Y_AXIS][UP] = belly[Y_AXIS][UP];
- boxes.push (belly);
- boxes.push (lstem);
- boxes.push (rstem);
+ boxes.push_back (belly);
+ boxes.push_back (lstem);
+ boxes.push_back (rstem);
}
break;
/*
}
if (!boxes.size ())
- boxes.push (b);
+ boxes.push_back (b);
Offset o (a->relative_coordinate (common[X_AXIS], X_AXIS),
a->relative_coordinate (common[Y_AXIS], Y_AXIS));
- for (int i = boxes.size (); i--;)
+ for (vsize i = boxes.size (); i--;)
boxes[i].translate (o);
return boxes;
Grob *common = common_refpoint_of_array (elems, me, Y_AXIS);
/* force position callbacks */
- for (int i = 0; i < elems.size (); i++)
+ for (vsize i = 0; i < elems.size (); i++)
elems[i]->relative_coordinate (common, Y_AXIS);
SCM details = me_spanner->get_bound (LEFT)->get_property ("line-break-system-details");
Direction stacking_dir = robust_scm2dir (me->get_property ("stacking-dir"),
DOWN);
Real delta = extra_space / elems.size() * stacking_dir;
- for (int i = 0; i < elems.size (); i++)
+ for (vsize i = 0; i < elems.size (); i++)
elems[i]->translate_axis (i * delta, Y_AXIS);
}
Interval v;
v.set_empty ();
- Array<Real> translates;
+ std::vector<Real> translates;
- for (int j = elems.size (); j--;)
+ for (vsize j = elems.size (); j--;)
{
/*
This is not very elegant, in that we need special support for
elems.del (j);
}
- for (int j = 0; j < elems.size (); j++)
+ for (vsize j = 0; j < elems.size (); j++)
{
where_f += stacking_dir * dy;
- translates.push (where_f);
+ translates.push_back (where_f);
v.unite (Interval (where_f, where_f));
}
/*
TODO: support self-alignment-{Y, X}
*/
- for (int i = 0; i < translates.size (); i++)
+ for (vsize i = 0; i < translates.size (); i++)
elems[i]->translate_axis (translates[i] - v.center (), a);
}
Interval threshold = robust_scm2interval (me->get_property ("threshold"),
Interval (0, Interval::infinity ()));
- Array<Interval> dims;
+ std::vector<Interval> dims;
Link_array<Grob> elems;
extract_grob_set (me, "elements", all_grobs);
- for (int i = 0; i < all_grobs.size (); i++)
+ for (vsize i = 0; i < all_grobs.size (); i++)
{
Interval y = all_grobs[i]->extent (me, a);
if (!y.is_empty ())
{
Grob *e = dynamic_cast<Grob *> (all_grobs[i]);
- elems.push (e);
- dims.push (y);
+ elems.push_back (e);
+ dims.push_back (y);
}
}
: SCM_EOL,
extra_space);
- Array<Real> translates;
- for (int j = 0; j < elems.size (); j++)
+ std::vector<Real> translates;
+ for (vsize j = 0; j < elems.size (); j++)
{
Real dy = -dims[j][-stacking_dir];
if (j)
where += stacking_dir * (dy + extra_space / elems.size ());
total.unite (dims[j] + where);
- translates.push (where);
+ translates.push_back (where);
}
SCM offsets_handle = scm_assq (ly_symbol2scm ("alignment-offsets"), line_break_details);
if (scm_is_pair (offsets_handle))
{
- int i = 0;
+ vsize i = 0;
for (SCM s = scm_cdr (offsets_handle); scm_is_pair (s) && i < translates.size (); s = scm_cdr (s), i++)
{
/*
also move the grobs that were empty, to maintain spatial order.
*/
- Array<Real> all_translates;
+ std::vector<Real> all_translates;
if (translates.size ())
{
- int i = 0;
- int j = 0;
Real w = translates[0];
- while (j < all_grobs.size ())
+ for (vsize i = 0, j = 0; j < all_grobs.size (); j++)
{
if (i < elems.size () && all_grobs[j] == elems[i])
w = translates[i++];
- all_translates.push (w);
- j++;
+ all_translates.push_back (w);
}
/*
if (scm_is_number (align))
center_offset = total.linear_combination (scm_to_double (align));
- for (int j = 0; j < all_grobs.size (); j++)
+ for (vsize j = 0; j < all_grobs.size (); j++)
all_grobs[j]->translate_axis (all_translates[j] - center_offset, a);
}
}
Grob *common = me;
extract_grob_set (me, "stems", stems);
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *stem = stems[i];
common = common->common_refpoint (Staff_symbol_referencer::get_staff_symbol (stem),
Interval heads;
Real my_y = me->relative_coordinate (common, Y_AXIS);
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *stem = stems[i];
Grob *ss = Staff_symbol_referencer::get_staff_symbol (stem);
Grob *common = me;
extract_grob_set (me, "stems", stems);
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *stem = stems[i];
common = common->common_refpoint (Staff_symbol_referencer::get_staff_symbol (stem),
Interval heads;
Real my_y = me->relative_coordinate (common, Y_AXIS);
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *stem = stems[i];
Grob *ss = Staff_symbol_referencer::get_staff_symbol (stem);
void
Audio_column::add_audio_item (Audio_item *l)
{
- audio_items_.push (l);
+ audio_items_.push_back (l);
l->audio_column_ = this;
}
Link_array<Context> r;
do
{
- r.push (t);
+ r.push_back (t);
t = t->get_parent_context ();
}
while (t && t != end->context ());
void
Audio_staff::add_audio_item (Audio_item *l)
{
- audio_items_.push (l);
+ audio_items_.push_back (l);
}
void
if (to_boolean (get_property ("skipTypesetting")))
return 0;
- for (int i = 0; i < stems_->size (); i++)
+ for (vsize i = 0; i < stems_->size (); i++)
if (Stem::get_beam ((*stems_)[i]))
return 0;
Spanner *beam = new Spanner (beam_settings_,
context ()->get_grob_key ("Beam"));
- for (int i = 0; i < stems_->size (); i++)
+ for (vsize i = 0; i < stems_->size (); i++)
Beam::add_stem (beam, (*stems_)[i]);
announce_grob (beam, (*stems_)[0]->self_scm ());
grouping_->add_stem (now - beam_start_moment_ + beam_start_location_,
durlog - 2);
- stems_->push (stem);
+ stems_->push_back (stem);
last_add_mom_ = now;
extend_mom_ = max (extend_mom_, now) + m->get_length ();
}
virtual void do_quit ();
virtual void construct_children ();
virtual void process (Moment);
- Array<Pitch> pending_pitch (Moment) const;
+ std::vector<Pitch> pending_pitch (Moment) const;
private:
SCM split_list_;
Direction where_dir_;
void
Axis_group_engraver::acknowledge_grob (Grob_info i)
{
- elts_.push (i.grob ());
+ elts_.push_back (i.grob ());
}
/*
if (!staffline_)
return;
- for (int i = 0; i < elts_.size (); i++)
+ for (vsize i = 0; i < elts_.size (); i++)
{
if (!unsmob_grob (elts_[i]->get_object ("axis-group-parent-Y")))
{
if (!ga)
{
for (SCM s = elements; scm_is_pair (s); s = scm_cdr (s))
- elts.push (unsmob_grob (scm_car (s)));
+ elts.push_back (unsmob_grob (scm_car (s)));
}
Interval ext = Axis_group_interface::relative_group_extent (ga ? ga->array () : elts,
Grob *common, Axis a)
{
Interval r;
- for (int i = 0; i < elts.size (); i++)
+ for (vsize i = 0; i < elts.size (); i++)
{
Grob *se = elts[i];
Interval dims = se->extent (common, a);
void
Axis_group_interface::get_children (Grob *me, Link_array<Grob> *found)
{
- found->push (me);
+ found->push_back (me);
if (!has_interface (me))
return;
extract_grob_set (me, "elements", elements);
- for (int i = 0; i < elements.size (); i++)
+ for (vsize i = 0; i < elements.size (); i++)
{
Grob *e = elements[i];
Axis_group_interface::get_children (e, found);
*/
#include "pointer-group-interface.hh"
-#include "array.hh"
+#include "std-vector.hh"
#include "stem.hh"
#include "beam.hh"
#include "staff-symbol-referencer.hh"
#include "directional-element-interface.hh"
bool
-is_concave_single_notes (Array<int> const &positions, Direction beam_dir)
+is_concave_single_notes (std::vector<int> const &positions, Direction beam_dir)
{
Interval covering;
covering.add_point (positions[0]);
- covering.add_point (positions.top ());
+ covering.add_point (positions.back ());
bool above = false;
bool below = false;
/*
notes above and below the interval covered by 1st and last note.
*/
- for (int i = 1; i < positions.size () - 1; i++)
+ for (vsize i = 1; i < positions.size () - 1; i++)
{
above = above || (positions[i] > covering[UP]);
below = below || (positions[i] < covering[DOWN]);
A note as close or closer to the beam than begin and end, but the
note is reached in the opposite direction as the last-first dy
*/
- int dy = positions.top () - positions[0];
- int closest = max (beam_dir * positions.top (), beam_dir * positions[0]);
- for (int i = 2; !concave && i < positions.size () - 1; i++)
+ int dy = positions.back () - positions[0];
+ int closest = max (beam_dir * positions.back (), beam_dir * positions[0]);
+ for (vsize i = 2; !concave && i < positions.size () - 1; i++)
{
int inner_dy = positions[i] - positions[i - 1];
if (sign (inner_dy) != sign (dy)
}
bool all_closer = true;
- for (int i = 1; all_closer && i < positions.size () - 1; i++)
+ for (vsize i = 1; all_closer && i < positions.size () - 1; i++)
{
all_closer = all_closer
&& (beam_dir * positions[i] > closest);
}
Real
-calc_positions_concaveness (Array<int> const &positions, Direction beam_dir)
+calc_positions_concaveness (std::vector<int> const &positions, Direction beam_dir)
{
- Real dy = positions.top () - positions[0];
+ Real dy = positions.back () - positions[0];
Real slope = dy / Real (positions.size () - 1);
Real concaveness = 0.0;
- for (int i = 1; i < positions.size () - 1; i++)
+ for (vsize i = 1; i < positions.size () - 1; i++)
{
Real line_y = slope * i + positions[0];
return scm_from_double (0.0);
Direction beam_dir = CENTER;
- for (int i = stems.size (); i--;)
+ for (vsize i = stems.size (); i--;)
{
if (Stem::is_invisible (stems[i]))
stems.del (i);
if (stems.size () <= 2)
return SCM_UNSPECIFIED;
- Array<int> close_positions;
- Array<int> far_positions;
- for (int i = 0; i < stems.size (); i++)
+ std::vector<int> close_positions;
+ std::vector<int> far_positions;
+ for (vsize i = 0; i < stems.size (); i++)
{
/*
For chords, we take the note head that is closest to the beam.
*/
Interval posns = Stem::head_positions (stems[i]);
- close_positions.push ((int) rint (posns[beam_dir]));
- far_positions.push ((int) rint (posns[-beam_dir]));
+ close_positions.push_back ((int) rint (posns[beam_dir]));
+ far_positions.push_back ((int) rint (posns[-beam_dir]));
}
Real concaveness = 0.0;
*/
int
-best_quant_score_idx (Array<Quant_score> const &qscores)
+best_quant_score_idx (std::vector<Quant_score> const &qscores)
{
Real best = 1e6;
int best_idx = -1;
- for (int i = qscores.size (); i--;)
+ for (vsize i = qscores.size (); i--;)
{
if (qscores[i].demerits < best)
{
Real quants [] = {straddle, sit, inter, hang };
int num_quants = int (sizeof (quants) / sizeof (Real));
- Array<Real> quantsl;
- Array<Real> quantsr;
+ std::vector<Real> quantsl;
+ std::vector<Real> quantsr;
/*
going to REGION_SIZE == 2, yields another 0.6 second with
*/
Link_array<Grob> stems
= extract_grob_array (me, "stems");
- Array<Stem_info> stem_infos;
- Array<Real> base_lengths;
- Array<Real> stem_xposns;
+ std::vector<Stem_info> stem_infos;
+ std::vector<Real> base_lengths;
+ std::vector<Real> stem_xposns;
Drul_array<bool> dirs_found (0, 0);
Grob *common[2];
stem_y != 0.0, when we're cross staff.
*/
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *s = stems[i];
Stem_info si (Stem::get_stem_info (s));
si.scale (1 / ss);
- stem_infos.push (si);
- dirs_found[stem_infos.top ().dir_] = true;
+ stem_infos.push_back (si);
+ dirs_found[stem_infos.back ().dir_] = true;
bool f = to_boolean (s->get_property ("french-beaming"))
&& s != lvs && s != fvs;
- base_lengths.push (calc_stem_y (me, s, common, xl, xr,
+ base_lengths.push_back (calc_stem_y (me, s, common, xl, xr,
Interval (0, 0), f) / ss);
- stem_xposns.push (s->relative_coordinate (common[X_AXIS], X_AXIS));
+ stem_xposns.push_back (s->relative_coordinate (common[X_AXIS], X_AXIS));
}
bool xstaff = false;
}
Direction ldir = Direction (stem_infos[0].dir_);
- Direction rdir = Direction (stem_infos.top ().dir_);
+ Direction rdir = Direction (stem_infos.back ().dir_);
bool is_knee = dirs_found[LEFT] && dirs_found[RIGHT];
int region_size = (int) parameters.REGION_SIZE;
for (int i = -region_size; i < region_size; i++)
for (int j = 0; j < num_quants; j++)
{
- quantsl.push (i + quants[j] + int (yl));
- quantsr.push (i + quants[j] + int (yr));
+ quantsl.push_back (i + quants[j] + int (yl));
+ quantsr.push_back (i + quants[j] + int (yr));
}
- Array<Quant_score> qscores;
+ std::vector<Quant_score> qscores;
- for (int l = 0; l < quantsl.size (); l++)
- for (int r = 0; r < quantsr.size (); r++)
+ for (vsize l = 0; l < quantsl.size (); l++)
+ for (vsize r = 0; r < quantsr.size (); r++)
{
Quant_score qs;
qs.yl = quantsl[l];
qs.yr = quantsr[r];
qs.demerits = 0.0;
- qscores.push (qs);
+ qscores.push_back (qs);
}
/* This is a longish function, but we don't separate this out into
neat modular separate subfunctions, as the subfunctions would be
called for many values of YL, YR. By precomputing various
parameters outside of the loop, we can save a lot of time. */
- for (int i = qscores.size (); i--;)
+ for (vsize i = qscores.size (); i--;)
{
Real d = score_slopes_dy (qscores[i].yl, qscores[i].yr,
dy_mus, yr- yl,
Real rad = Staff_symbol_referencer::staff_radius (me);
Drul_array<int> edge_beam_counts
(Stem::beam_multiplicity (stems[0]).length () + 1,
- Stem::beam_multiplicity (stems.top ()).length () + 1);
+ Stem::beam_multiplicity (stems.back ()).length () + 1);
Real beam_translation = get_beam_translation (me) / ss;
Real reasonable_score = (is_knee) ? 200000 : 100;
- for (int i = qscores.size (); i--;)
+ for (vsize i = qscores.size (); i--;)
if (qscores[i].demerits < reasonable_score)
{
Real d = score_forbidden_quants (qscores[i].yl, qscores[i].yr,
#endif
}
- for (int i = qscores.size (); i--;)
+ for (vsize i = qscores.size (); i--;)
if (qscores[i].demerits < reasonable_score)
{
Real d = score_stem_lengths (stems, stem_infos,
{
Drul_array<Real> ins = ly_scm2interval (inspect_quants);
- int i = 0;
-
Real mindist = 1e6;
- for (; i < qscores.size (); i++)
+ for (vsize i = 0; i < qscores.size (); i++)
{
Real d = fabs (qscores[i].yl- ins[LEFT]) + fabs (qscores[i].yr - ins[RIGHT]);
if (d < mindist)
Real
Beam::score_stem_lengths (Link_array<Grob> const &stems,
- Array<Stem_info> const &stem_infos,
- Array<Real> const &base_stem_ys,
- Array<Real> const &stem_xs,
+ std::vector<Stem_info> const &stem_infos,
+ std::vector<Real> const &base_stem_ys,
+ std::vector<Real> const &stem_xs,
Real xl, Real xr,
bool knee,
Real yl, Real yr,
Drul_array<Real> score (0, 0);
Drul_array<int> count (0, 0);
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *s = stems[i];
if (Stem::is_invisible (s))
int m = 0;
extract_grob_set (me, "stems", stems);
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *stem = stems[i];
m = max (m, (Stem::beam_multiplicity (stem).length () + 1));
SCM last_beaming = scm_cons (SCM_EOL, scm_list_1 (scm_from_int (0)));
Direction last_dir = CENTER;
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *this_stem = stems[i];
SCM this_beaming = this_stem->get_property ("beaming");
else
{
x0 = stems[0]->relative_coordinate (xcommon, X_AXIS);
- dx = stems.top ()->relative_coordinate (xcommon, X_AXIS) - x0;
+ dx = stems.back ()->relative_coordinate (xcommon, X_AXIS) - x0;
}
SCM posns = me->get_property ("quantized-positions");
Stencil the_beam;
Real lt = me->layout ()->get_dimension (ly_symbol2scm ("linethickness"));
- for (int i = 0; i <= stems.size (); i++)
+ for (vsize i = 0; i <= stems.size (); i++)
{
Grob *stem = (i < stems.size ()) ? stems[i] : 0;
SCM left = (i > 0) ? scm_cdr (last_beaming) : SCM_EOL;
SCM right = stem ? scm_car (this_beaming) : SCM_EOL;
- Array<int> full_beams;
- Array<int> lfliebertjes;
- Array<int> rfliebertjes;
+ std::vector<int> full_beams;
+ std::vector<int> lfliebertjes;
+ std::vector<int> rfliebertjes;
for (SCM s = left;
scm_is_pair (s); s = scm_cdr (s))
{
int b = scm_to_int (scm_car (s));
if (scm_c_memq (scm_car (s), right) != SCM_BOOL_F)
- full_beams.push (b);
+ full_beams.push_back (b);
else
- lfliebertjes.push (b);
+ lfliebertjes.push_back (b);
}
for (SCM s = right;
scm_is_pair (s); s = scm_cdr (s))
{
int b = scm_to_int (scm_car (s));
if (scm_c_memq (scm_car (s), left) == SCM_BOOL_F)
- rfliebertjes.push (b);
+ rfliebertjes.push_back (b);
}
Drul_array<Real> break_overshoot
}
int k = 0;
- for (int j = full_beams.size (); j--;)
+ for (vsize j = full_beams.size (); j--;)
{
Stencil b (whole);
Stencil rhalf = Lookup::beam (slope, rw, thick, blot);
Stencil lhalf = Lookup::beam (slope, lw, thick, blot);
- for (int j = lfliebertjes.size (); j--;)
+ for (vsize j = lfliebertjes.size (); j--;)
{
Stencil b (lhalf);
b.translate_axis (last_xposn - x0 - last_stem_width /2,
Y_AXIS);
the_beam.add_stencil (b);
}
- for (int j = rfliebertjes.size (); j--;)
+ for (vsize j = rfliebertjes.size (); j--;)
{
Stencil b (rhalf);
b.translate_axis (xposn - x0 - rw + stem_width / 2, X_AXIS);
extract_grob_set (me, "stems", stems);
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *s = stems[i];
Direction stem_dir = CENTER;
{
extract_grob_set (me, "stems", stems);
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *s = stems[i];
Grob *common = common_refpoint_of_array (stems, me, Y_AXIS);
Real staff_space = Staff_symbol_referencer::staff_space (me);
- Array<Interval> head_extents_array;
- for (int i = 0; i < stems.size (); i++)
+ std::vector<Interval> head_extents_array;
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *stem = stems[i];
if (Stem::is_invisible (stem))
head_extents[-stemdir] = -stemdir * infinity_f;
}
}
- head_extents_array.push (head_extents);
+ head_extents_array.push_back (head_extents);
gaps.remove_interval (head_extents);
}
Interval max_gap;
Real max_gap_len = 0.0;
- for (int i = gaps.allowed_regions_.size () -1; i >= 0; i--)
+ for (vsize i = gaps.allowed_regions_.size () -1; i != VPOS ;i--)
{
Interval gap = gaps.allowed_regions_[i];
if (max_gap_len > threshold)
{
int j = 0;
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *stem = stems[i];
if (Stem::is_invisible (stem))
if (count < 1)
return ly_interval2scm (pos);
- Array<Real> x_posns;
+ std::vector<Real> x_posns;
extract_grob_set (me, "stems", stems);
Grob *commonx = common_refpoint_of_array (stems, me, X_AXIS);
Grob *commony = common_refpoint_of_array (stems, me, Y_AXIS);
+ lvs->relative_coordinate (commony, Y_AXIS) - my_y);
Real x0 = first_visible_stem (me)->relative_coordinate (commonx, X_AXIS);
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *s = stems[i];
Real x = s->relative_coordinate (commonx, X_AXIS) - x0;
- x_posns.push (x);
+ x_posns.push_back (x);
}
Real dx = last_visible_stem (me)->relative_coordinate (commonx, X_AXIS) - x0;
}
else
{
- Array<Offset> ideals;
- for (int i = 0; i < stems.size (); i++)
+ std::vector<Offset> ideals;
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *s = stems[i];
if (Stem::is_invisible (s))
continue;
- ideals.push (Offset (x_posns[i],
+ ideals.push_back (Offset (x_posns[i],
Stem::get_stem_info (s).ideal_y_
+ s->relative_coordinate (commony, Y_AXIS)
- my_y));
/*
Code dup.
*/
- Array<Real> x_posns;
+ std::vector<Real> x_posns;
extract_grob_set (me, "stems", stems);
Grob *commonx = common_refpoint_of_array (stems, me, X_AXIS);
Grob *commony = common_refpoint_of_array (stems, me, Y_AXIS);
return posns;
Real x0 = fvs->relative_coordinate (commonx, X_AXIS);
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *s = stems[i];
Real x = s->relative_coordinate (commonx, X_AXIS) - x0;
- x_posns.push (x);
+ x_posns.push_back (x);
}
Grob *lvs = last_visible_stem (me);
*/
Interval feasible_left_point;
feasible_left_point.set_full ();
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *s = stems[i];
if (Stem::is_invisible (s))
Real xl = fvs ? fvs->relative_coordinate (common[X_AXIS], X_AXIS) : 0.0;
Real xr = lvs ? lvs->relative_coordinate (common[X_AXIS], X_AXIS) : 0.0;
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *s = stems[i];
if (Stem::is_invisible (s))
extract_grob_set (me, "stems", stems);
Direction d = LEFT;
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
/*
Don't overwrite user settings.
extract_grob_set (me, "stems", stems);
int f = 0;
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *s = stems[i];
{
extract_grob_set (me, "stems", stems);
int c = 0;
- for (int i = stems.size (); i--;)
+ for (vsize i = stems.size (); i--;)
{
if (!Stem::is_invisible (stems[i]))
c++;
{
extract_grob_set (me, "stems", stems);
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
if (!Stem::is_invisible (stems[i]))
return stems[i];
{
extract_grob_set (me, "stems", stems);
- for (int i = stems.size (); i--;)
+ for (vsize i = stems.size (); i--;)
{
if (!Stem::is_invisible (stems[i]))
return stems[i];
bool knee = false;
int d = 0;
extract_grob_set (me, "stems", stems);
- for (int i = stems.size (); i--;)
+ for (vsize i = stems.size (); i--;)
{
Direction dir = get_grob_direction (stems[i]);
if (d && d != dir)
extract_grob_set (me, "stems", stems);
int bc = 0;
- for (int i = stems.size (); i--;)
+ for (vsize i = stems.size (); i--;)
{
/*
Should we take invisible stems into account?
int minidx = -1;
Moment beat_pos;
- for (int i = 1; i < infos_.size (); i++)
+ for (vsize i = 1; i < infos_.size (); i++)
{
beat_pos = infos_[i].start_mom_ / beat_length;
int den = beat_pos.den ();
void
Beaming_info_list::add_stem (Moment m, int b)
{
- infos_.push (Beaming_info (m, b));
+ infos_.push_back (Beaming_info (m, b));
}
void
if (infos_.size ())
{
infos_[0].beams_i_drul_[LEFT] = 0;
- infos_.top().beams_i_drul_[RIGHT] = 0;
+ infos_.back ().beams_i_drul_[RIGHT] = 0;
}
}
}
void
-scale (Array<Offset> *array, Real x, Real y)
+scale (std::vector<Offset> *array, Real x, Real y)
{
- for (int i = 0; i < array->size (); i++)
+ for (vsize i = 0; i < array->size (); i++)
{
(*array)[i][X_AXIS] = x * (*array)[i][X_AXIS];
(*array)[i][Y_AXIS] = y * (*array)[i][Y_AXIS];
}
void
-rotate (Array<Offset> *array, Real phi)
+rotate (std::vector<Offset> *array, Real phi)
{
Offset rot (complex_exp (Offset (0, phi)));
- for (int i = 0; i < array->size (); i++)
+ for (vsize i = 0; i < array->size (); i++)
(*array)[i] = complex_multiply (rot, (*array)[i]);
}
void
-translate (Array<Offset> *array, Offset o)
+translate (std::vector<Offset> *array, Offset o)
{
- for (int i = 0; i < array->size (); i++)
+ for (vsize i = 0; i < array->size (); i++)
(*array)[i] += o;
}
Bezier::get_other_coordinate (Axis a, Real x) const
{
Axis other = Axis ((a +1) % NO_AXES);
- Array<Real> ts = solve_point (a, x);
+ std::vector<Real> ts = solve_point (a, x);
if (ts.size () == 0)
{
/**
Remove all numbers outside [0, 1] from SOL
*/
-Array<Real>
-filter_solutions (Array<Real> sol)
+std::vector<Real>
+filter_solutions (std::vector<Real> sol)
{
- for (int i = sol.size (); i--;)
+ for (vsize i = sol.size (); i--;)
if (sol[i] < 0 || sol[i] > 1)
sol.del (i);
return sol;
/**
find t such that derivative is proportional to DERIV
*/
-Array<Real>
+std::vector<Real>
Bezier::solve_derivative (Offset deriv) const
{
Polynomial xp = polynomial (X_AXIS);
/*
Find t such that curve_point (t)[AX] == COORDINATE
*/
-Array<Real>
+std::vector<Real>
Bezier::solve_point (Axis ax, Real coordinate) const
{
Polynomial p (polynomial (ax));
p.coefs_[0] -= coordinate;
- Array<Real> sol (p.solve ());
+ std::vector<Real> sol (p.solve ());
return filter_solutions (sol);
}
Offset d;
d[Axis (o)] = 1.0;
Interval iv;
- Array<Real> sols (solve_derivative (d));
- sols.push (1.0);
- sols.push (0.0);
- for (int i = sols.size (); i--;)
+ std::vector<Real> sols (solve_derivative (d));
+ sols.push_back (1.0);
+ sols.push_back (0.0);
+ for (vsize i = sols.size (); i--;)
{
Offset o (curve_point (sols[i]));
iv.unite (Interval (o[a], o[a]));
#include "ly-smobs.icc"
#include "box.hh"
-#include "array.hh"
+#include "std-vector.hh"
void
Box::translate (Offset o)
#include "cpu-timer.hh"
#include "simple-spacer.hh"
-Array<int>
+std::vector<int>
Break_algorithm::find_break_indices () const
{
Link_array<Grob> all = pscore_->root_system ()->columns ();
- Array<int> retval;
+ std::vector<int> retval;
- for (int i = 0; i < all.size (); i++)
+ for (vsize i = 0; i < all.size (); i++)
if (Item::is_breakable (all[i]))
- retval.push (i);
+ retval.push_back (i);
if (linewidth_ <= 0)
while (retval.size () > 2)
Link_array<Grob> all = pscore_->root_system ()->columns ();
Link_array<Grob> retval;
- for (int i = 0; i < all.size (); i++)
+ for (vsize i = 0; i < all.size (); i++)
if (Item::is_breakable (all[i]))
- retval.push (all[i]);
+ retval.push_back (all[i]);
if (linewidth_ <= 0)
while (retval.size () > 2)
linewidth_ = s->layout ()->get_dimension (ly_symbol2scm ("linewidth"));
}
-Array<Column_x_positions>
+std::vector<Column_x_positions>
Break_algorithm::solve () const
{
- Array<Column_x_positions> h= do_solve ();
+ std::vector<Column_x_positions> h= do_solve ();
return h;
}
{
SCM sym = scm_car (order);
- for (int i = writable_elts.size (); i--;)
+ for (vsize i = writable_elts.size (); i--;)
{
Grob *g = writable_elts[i];
if (g && sym == g->get_property ("break-align-symbol"))
{
- new_elts.push (g);
+ new_elts.push_back (g);
writable_elts.del (i);
}
}
Item *me = dynamic_cast<Item *> (grob);
Link_array<Grob> elems = ordered_elements (me);
- Array<Interval> extents;
+ std::vector<Interval> extents;
int last_nonempty = -1;
- for (int i = 0; i < elems.size (); i++)
+ for (vsize i = 0; i < elems.size (); i++)
{
Interval y = elems[i]->extent (elems[i], X_AXIS);
- extents.push (y);
+ extents.push_back (y);
if (!y.is_empty ())
last_nonempty = i;
}
- int idx = 0;
+ vsize idx = 0;
while (idx < extents.size () && extents[idx].is_empty ())
idx++;
- Array<Real> offsets;
- offsets.set_size (elems.size ());
- for (int i = 0; i < offsets.size ();i++)
+ std::vector<Real> offsets;
+ offsets.resize (elems.size ());
+ for (vsize i = 0; i < offsets.size ();i++)
offsets[i] = 0.0;
Real extra_right_space = 0.0;
- int edge_idx = -1;
+ vsize edge_idx = VPOS;
while (idx < elems.size ())
{
- int next_idx = idx + 1;
+ vsize next_idx = idx + 1;
while (next_idx < elems.size ()
&& extents[next_idx].is_empty ())
next_idx++;
*/
extract_grob_set (l, "elements", elts);
- for (int i = elts.size (); i--;)
+ for (vsize i = elts.size (); i--;)
{
Grob *elt = elts[i];
- if (edge_idx < 0
+ if (edge_idx == VPOS
&& elt->get_property ("break-align-symbol")
== ly_symbol2scm ("left-edge"))
edge_idx = idx;
if (r)
{
extract_grob_set (r, "elements", elts);
- for (int i = elts.size ();
+ for (vsize i = elts.size ();
!scm_is_symbol (rsym) && i--;)
{
Grob *elt = elts[i];
Interval total_extent;
Real alignment_off = 0.0;
- for (int i = 0; i < offsets.size (); i++)
+ for (vsize i = 0; i < offsets.size (); i++)
{
here += offsets[i];
if (i == edge_idx)
if (me->break_status_dir () == LEFT)
alignment_off = -total_extent[RIGHT] - extra_right_space;
- else if (edge_idx < 0)
+ else if (edge_idx == VPOS)
alignment_off = -total_extent[LEFT];
here = alignment_off;
- for (int i = 0; i < offsets.size (); i++)
+ for (vsize i = 0; i < offsets.size (); i++)
{
here += offsets[i];
elems[i]->translate_axis (here, X_AXIS);
? & temporary_substition_array
: &new_arr->array_reference ());
- new_grobs->set_size (old_grobs.size ());
+ new_grobs->resize (old_grobs.size ());
Grob **array = (Grob **) new_grobs->accesses ();
Grob **ptr = array;
- for (int i = 0; i < old_grobs.size (); i++)
+ for (vsize i = 0; i < old_grobs.size (); i++)
{
Grob *orig = old_grobs[i];
Grob *new_grob = substitute_grob (orig);
*ptr++ = new_grob;
}
- new_grobs->set_size (ptr - array);
+ new_grobs->resize (ptr - array);
if (new_arr == grob_arr)
new_arr->set_array (*new_grobs);
}
{
if (sp->broken_intos_.size ())
rv = Slice (sp->broken_intos_[0]->get_system ()->get_rank (),
- sp->broken_intos_.top ()->get_system ()->get_rank ());
+ sp->broken_intos_.back ()->get_system ()->get_rank ());
}
return rv;
}
int spanner_index = len;
int item_index = 0;
- for (int i = 0; i < grob_array->size (); i++)
+ for (vsize i = 0; i < grob_array->size (); i++)
{
Grob *g = grob_array->grob (i);
qsort (vec, item_index,
sizeof (Substitution_entry), &Substitution_entry::item_compare);
- Array<Slice> item_indices;
- Array<Slice> spanner_indices;
+ std::vector<Slice> item_indices;
+ std::vector<Slice> spanner_indices;
for (int i = 0; i <= system_range.length (); i++)
{
- item_indices.push (Slice (len, 0));
- spanner_indices.push (Slice (len, 0));
+ item_indices.push_back (Slice (len, 0));
+ spanner_indices.push_back (Slice (len, 0));
}
- Array<Slice> *arrs[]
+ std::vector<Slice> *arrs[]
= {
&item_indices, &spanner_indices
};
is a waste of time -- the staff-spanners screw up the
ordering, since they go across the entire score.
*/
- for (int i = spanner_indices.size (); i--;)
+ for (vsize i = spanner_indices.size (); i--;)
spanner_indices[i] = Slice (spanner_index, len - 1);
assert (item_index <= spanner_index);
- assert ((broken_intos_.size () == system_range.length () + 1)
- || (broken_intos_.is_empty () && system_range.length () == 0));
- for (int i = 0; i < broken_intos_.size (); i++)
+ assert ((broken_intos_.size () == (vsize)system_range.length () + 1)
+ || (broken_intos_.empty () && system_range.length () == 0));
+ for (vsize i = 0; i < broken_intos_.size (); i++)
{
Grob *sc = broken_intos_[i];
System *l = sc->get_system ();
fast_done = s->fast_substitute_grob_array (sym, grob_array);
if (!fast_done)
- for (int i = 0; i < s->broken_intos_.size (); i++)
+ for (vsize i = 0; i < s->broken_intos_.size (); i++)
{
Grob *sc = s->broken_intos_[i];
System *l = sc->get_system ();
void
Chord_name_engraver::add_note (Music *n)
{
- notes_.push (n);
+ notes_.push_back (n);
}
void
SCM pitches = SCM_EOL;
Music *inversion_event = 0;
- for (int i = 0; i < notes_.size (); i++)
+ for (vsize i = 0; i < notes_.size (); i++)
{
Music *n = notes_[i];
SCM p = n->get_property ("pitch");
{
if (m->is_mus_type ("cluster-note-event"))
{
- cluster_notes_.push (m);
+ cluster_notes_.push_back (m);
return true;
}
else if (m->is_mus_type ("busy-playing-event"))
int pmax = INT_MIN;
int pmin = INT_MAX;
- for (int i = 0; i < cluster_notes_.size (); i++)
+ for (vsize i = 0; i < cluster_notes_.size (); i++)
{
Pitch *pit = unsmob_pitch (cluster_notes_[i]->get_property ("pitch"));
TODO: Add support for cubic spline segments.
*/
Stencil
-brew_cluster_piece (Grob *me, Array<Offset> bottom_points, Array<Offset> top_points)
+brew_cluster_piece (Grob *me, std::vector<Offset> bottom_points, std::vector<Offset> top_points)
{
Real blotdiameter = Staff_symbol_referencer::staff_space (me) / 2;
}
Stencil out;
- Array<Offset> points;
+ std::vector<Offset> points;
points.clear ();
int size = bottom_points.size ();
if (shape == "leftsided-stairs")
}
else if (shape == "ramp")
{
- points.push (bottom_points[0] - vpadding + hpadding);
+ points.push_back (bottom_points[0] - vpadding + hpadding);
for (int i = 1; i < size - 1; i++)
- points.push (bottom_points[i] - vpadding);
- points.push (bottom_points[size - 1] - vpadding - hpadding);
- points.push (top_points[size - 1] + vpadding - hpadding);
+ points.push_back (bottom_points[i] - vpadding);
+ points.push_back (bottom_points[size - 1] - vpadding - hpadding);
+ points.push_back (top_points[size - 1] + vpadding - hpadding);
for (int i = size - 2; i > 0; i--)
- points.push (top_points[i] + vpadding);
- points.push (top_points[0] + vpadding + hpadding);
+ points.push_back (top_points[i] + vpadding);
+ points.push_back (top_points[0] + vpadding + hpadding);
out.add_stencil (Lookup::round_filled_polygon (points, blotdiameter));
}
else
Grob *commonx = left_bound->common_refpoint (right_bound, X_AXIS);
Link_array<Grob> const &cols = extract_grob_array (me, "columns");
- if (cols.is_empty ())
+ if (cols.empty ())
{
me->warning (_ ("junking empty cluster"));
me->suicide ();
commonx = common_refpoint_of_array (cols, commonx, X_AXIS);
Grob *commony = common_refpoint_of_array (cols, me, Y_AXIS);
- Array<Offset> bottom_points;
- Array<Offset> top_points;
+ std::vector<Offset> bottom_points;
+ std::vector<Offset> top_points;
Real left_coord = left_bound->relative_coordinate (commonx, X_AXIS);
line with the center of the note heads?
*/
- for (int i = 0; i < cols.size (); i++)
+ for (vsize i = 0; i < cols.size (); i++)
{
Grob *col = cols[i];
Interval yext = col->extent (commony, Y_AXIS);
Real x = col->relative_coordinate (commonx, X_AXIS) - left_coord;
- bottom_points.push (Offset (x, yext[DOWN]));
- top_points.push (Offset (x, yext[UP]));
+ bottom_points.push_back (Offset (x, yext[DOWN]));
+ top_points.push_back (Offset (x, yext[UP]));
}
/*
* - collapse superflous space after each ligature (TODO).
*
* Concrete subclasses must implement function build_ligature (Spanner
- * *, Array<Grob_info>). This function is responsible for actually
+ * *, std::vector<Grob_info>). This function is responsible for actually
* building the ligature by transforming the array of noteheads.
*
* Currently, there are two subclasses: Gregorian_ligature_engraver
extract_item_set (parent, "elements", elements);
- for (int i = elements.size (); i--;)
+ for (vsize i = elements.size (); i--;)
{
Item *sibling = elements[i];
if ((sibling)
* occurs within the broken ligatures any more.
*/
void
-Coherent_ligature_engraver::collect_accidentals (Spanner *, Array<Grob_info>)
+Coherent_ligature_engraver::collect_accidentals (Spanner *, std::vector<Grob_info>)
{
/* TODO */
}
void
-compute_delta_pitches (Array<Grob_info> primitives)
+compute_delta_pitches (std::vector<Grob_info> primitives)
{
int prev_pitch = 0;
int delta_pitch = 0;
Item *prev_primitive = 0, *primitive = 0;
- for (int i = 0; i < primitives.size (); i++)
+ for (vsize i = 0; i < primitives.size (); i++)
{
primitive = dynamic_cast<Item *> (primitives[i].grob ());
Music *music_cause = primitives[i].music_cause ();
void
Coherent_ligature_engraver::typeset_ligature (Spanner *ligature,
- Array<Grob_info> primitives)
+ std::vector<Grob_info> primitives)
{
// compute some commonly needed context info stored as grob
// properties
if (!col_)
col_ = make_item ("NoteCollision", SCM_EOL);
- for (int i = 0; i < note_columns_.size (); i++)
+ for (vsize i = 0; i < note_columns_.size (); i++)
Note_collision_interface::add_column (col_, note_columns_[i]);
}
if (Note_column::has_rests (i.grob ()) || i.grob ()->get_parent (X_AXIS))
return;
- note_columns_.push (i.grob ());
+ note_columns_.push_back (i.grob ());
}
}
{
if (m->is_mus_type ("note-event"))
{
- note_events_.push (m);
+ note_events_.push_back (m);
is_first_ = true;
Moment musiclen = m->get_length ();
if (orig && note_dur.get_length () != orig->get_length ())
{
if (!scratch_note_events_.size ())
- for (int i = 0; i < note_events_.size (); i++)
+ for (vsize i = 0; i < note_events_.size (); i++)
{
Music *m = note_events_[i]->clone ();
- scratch_note_events_.push (m);
+ scratch_note_events_.push_back (m);
}
}
- for (int i = 0;
- left_to_do_ && i < note_events_.size (); i++)
+ for (vsize i = 0; left_to_do_ && i < note_events_.size (); i++)
{
Music *event = note_events_[i];
if (scratch_note_events_.size ())
d->set_property ("dot-count", scm_from_int (dots));
d->set_parent (note, Y_AXIS);
- dots_.push (d);
+ dots_.push_back (d);
}
Pitch *pit = unsmob_pitch (event->get_property ("pitch"));
pos += scm_to_int (c0);
note->set_property ("staff-position", scm_from_int (pos));
- notes_.push (note);
+ notes_.push_back (note);
}
if (prev_notes_.size () == notes_.size ())
{
- for (int i = 0; i < notes_.size (); i++)
+ for (vsize i = 0; i < notes_.size (); i++)
{
Grob *p = make_spanner ("Tie", SCM_EOL);
Tie::set_head (p, LEFT, prev_notes_[i]);
Tie::set_head (p, RIGHT, notes_[i]);
- ties_.push (p);
+ ties_.push_back (p);
}
}
dots_.clear ();
- for (int i = scratch_note_events_.size (); i--;)
+ for (vsize i = scratch_note_events_.size (); i--;)
scratch_note_events_[i]->unprotect ();
scratch_note_events_.clear ();
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 (t);
+ accepteds.push_back (t);
Link_array<Context_def> best_result;
- for (int i = 0; i < accepteds.size (); i++)
+ for (vsize i = 0; i < accepteds.size (); i++)
{
/* do not check aliases, because \context Staff should not
create RhythmicStaff. */
if (ly_is_equal (accepteds[i]->get_context_name (), type_sym))
{
- best_result.push (accepteds[i]);
+ best_result.push_back (accepteds[i]);
return best_result;
}
}
- int best_depth = INT_MAX;
- for (int i = 0; i < accepteds.size (); i++)
+ vsize best_depth = UINT_MAX;
+ for (vsize i = 0; i < accepteds.size (); i++)
{
Context_def *g = accepteds[i];
Context *current = this;
// start at 1. The first one (index 0) will be us.
- for (int i = 0; i < path.size (); i++)
+ for (vsize i = 0; i < path.size (); i++)
{
SCM ops = (i == path.size () -1) ? operations : SCM_EOL;
Context *current = this;
// start at 1. The first one (index 0) will be us.
- for (int i = 0; i < path.size (); i++)
+ for (vsize i = 0; i < path.size (); i++)
{
SCM ops = (i == path.size () -1) ? operations : SCM_EOL;
Item *create_custos ();
bool custos_permitted_;
Link_array<Grob> custodes_;
- Array<Pitch> pitches_;
+ std::vector<Pitch> pitches_;
};
Custos_engraver::Custos_engraver ()
don't look at the staff-position, since we can't be sure
whether Clef_engraver already applied a vertical shift.
*/
- pitches_.push (*unsmob_pitch (m->get_property ("pitch")));
+ pitches_.push_back (*unsmob_pitch (m->get_property ("pitch")));
}
}
if (custos_permitted_)
{
- for (int i = pitches_.size (); i--;)
+ for (vsize i = pitches_.size (); i--;)
{
Item *c = create_custos ();
{
Item *custos = make_item ("Custos", SCM_EOL);
- custodes_.push (custos);
+ custodes_.push_back (custos);
return custos;
}
void
Custos_engraver::finalize ()
{
- for (int i = custodes_.size (); i--;)
+ for (vsize i = custodes_.size (); i--;)
custodes_[i]->suicide ();
custodes_.clear ();
}
dots when merging.
*/
Grob *c = 0;
- for (int i = dots.size (); i--;)
+ for (vsize i = dots.size (); i--;)
{
Grob *n = dots[i]->get_parent (Y_AXIS);
if (c)
else
c = n;
}
- for (int i = dots.size (); i--;)
+ for (vsize i = dots.size (); i--;)
{
Grob *n = dots[i]->get_parent (Y_AXIS);
n->relative_coordinate (c, X_AXIS);
}
dots.sort (compare_position);
- for (int i = dots.size (); i--;)
+ for (vsize i = dots.size (); i--;)
if (!dots[i]->is_live ())
dots.del (i);
Dot_configuration cfg;
- for (int i = 0;i < dots.size (); i++)
+ for (vsize i = 0;i < dots.size (); i++)
{
Dot_position dp;
dp.dot_ = dots[i];
{
if (m->is_mus_type ("note-event"))
{
- events_.push (m);
+ events_.push_back (m);
return true;
}
else if (m->is_mus_type ("busy-playing-event"))
Drum_notes_engraver::process_music ()
{
SCM tab = 0;
- for (int i = 0; i < events_.size (); i++)
+ for (vsize i = 0; i < events_.size (); i++)
{
if (!tab)
tab = get_property ("drumStyleTable");
d->set_parent (note, Y_AXIS);
- dots_.push (d);
+ dots_.push_back (d);
}
SCM drum_type = ev->get_property ("drum-type");
p->set_parent (note, Y_AXIS);
Side_position_interface::add_support (p, note);
- scripts_.push (p);
+ scripts_.push_back (p);
}
}
- notes_.push (note);
+ notes_.push_back (note);
}
}
void
Drum_notes_engraver::acknowledge_stem (Grob_info inf)
{
- for (int i = 0; i < scripts_.size (); i++)
+ for (vsize i = 0; i < scripts_.size (); i++)
{
Grob *e = scripts_[i];
void
Drum_notes_engraver::acknowledge_note_column (Grob_info inf)
{
- for (int i = 0; i < scripts_.size (); i++)
+ for (vsize i = 0; i < scripts_.size (); i++)
{
Grob *e = scripts_[i];
Audio_note *p = new Audio_note (*pit, n->get_length (), 0);
Audio_element_info info (p, n);
announce_element (info);
- notes_.push (p);
+ notes_.push_back (p);
}
}
// why don't grace notes show up here?
// --> grace notes effectively do not get delayed
Moment now = now_mom ();
- for (int i = 0; i < notes_.size (); i++)
+ for (vsize i = 0; i < notes_.size (); i++)
play_element (notes_[i]);
notes_.clear ();
note_evs_.clear ();
{
if (ev->is_mus_type ("note-event"))
{
- note_evs_.push (ev);
+ note_evs_.push_back (ev);
return true;
}
else if (ev->is_mus_type ("busy-playing-event"))
{
Grob *me = unsmob_grob (grob);
extract_grob_set (me, "elements", elements);
- if (elements.is_empty ())
+ if (elements.empty ())
{
me->suicide ();
return SCM_EOL;
void
Engraver_group::announce_grob (Grob_info info)
{
- announce_infos_.push (info);
+ announce_infos_.push_back (info);
Engraver_group *dad_eng
= context_->get_parent_context ()
SCM name_sym = ly_symbol2scm ("name");
SCM meta_sym = ly_symbol2scm ("meta");
- for (int j = 0; j < announce_infos_.size (); j++)
+ for (vsize j = 0; j < announce_infos_.size (); j++)
{
Grob_info info = announce_infos_[j];
{
extract_item_set (sp, "heads", heads);
if (heads.size ())
- sp->set_bound (RIGHT, heads.top ());
+ sp->set_bound (RIGHT, heads.back ());
}
}
{
Spanner *me = dynamic_cast<Spanner*> (unsmob_grob (grob));
extract_grob_set (me, "figures", figures);
- if (figures.is_empty ())
+ if (figures.empty ())
return scm_from_double (0.0);
Grob *common = common_refpoint_of_array (figures, me, Y_AXIS);
void center_continuations (Link_array<Spanner> const &consecutive_lines);
void center_repeated_continuations ();
protected:
- Array<Figure_group> groups_;
+ std::vector<Figure_group> groups_;
Spanner *alignment_;
Link_array<Music> new_musics_;
bool continuation_;
void
Figured_bass_engraver::derived_mark () const
{
- for (int i = 0; i < groups_.size (); i++)
+ for (vsize i = 0; i < groups_.size (); i++)
{
scm_gc_mark (groups_[i].number_);
scm_gc_mark (groups_[i].alteration_);
void
Figured_bass_engraver::stop_translation_timestep ()
{
- if (groups_.is_empty ()
+ if (groups_.empty ()
|| now_mom ().main_part_ < stop_moment_.main_part_
|| now_mom ().grace_part_ < Rational (0))
return ;
bool found = false;
- for (int i = 0; !found && i < groups_.size (); i++)
+ for (vsize i = 0; !found && i < groups_.size (); i++)
found = found || groups_[i].current_music_;
if (!found)
rest_event_ = 0;
new_musics_.clear ();
- for (int i = 0; i < groups_.size (); i++)
- {
- groups_[i].current_music_ = 0;
- }
+ for (vsize i = 0; i < groups_.size (); i++)
+ groups_[i].current_music_ = 0;
continuation_ = false;
}
stop_moment_ = now_mom () + m->get_length ();
SCM fig = m->get_property ("figure");
- for (int i = 0; i < groups_.size (); i++)
+ for (vsize i = 0; i < groups_.size (); i++)
{
if (!groups_[i].current_music_
&& ly_is_equal (groups_[i].number_, fig))
}
}
- new_musics_.push (m);
+ new_musics_.push_back (m);
return true;
}
if (consecutive_lines.size () == 2)
{
Link_array<Grob> left_figs;
- for (int j = consecutive_lines.size(); j--;)
- left_figs.push (consecutive_lines[j]->get_bound (LEFT));
+ for (vsize j = consecutive_lines.size(); j--;)
+ left_figs.push_back (consecutive_lines[j]->get_bound (LEFT));
SCM ga = Grob_array::make_array ();
unsmob_grob_array (ga)->set_array (left_figs);
- for (int j = consecutive_lines.size(); j--;)
+ for (vsize j = consecutive_lines.size(); j--;)
consecutive_lines[j]->set_object ("figures",
unsmob_grob_array (ga)->smobbed_copy ());
}
Figured_bass_engraver::center_repeated_continuations ()
{
Link_array<Spanner> consecutive_lines;
- for (int i = 0; i <= groups_.size(); i++)
+ for (vsize i = 0; i <= groups_.size(); i++)
{
if (i < groups_.size ()
&& groups_[i].continuation_line_
- && (consecutive_lines.is_empty ()
+ && (consecutive_lines.empty ()
|| (consecutive_lines[0]->get_bound(LEFT)->get_column ()
== groups_[i].continuation_line_->get_bound (LEFT)->get_column ()
&& consecutive_lines[0]->get_bound(RIGHT)->get_column ()
== groups_[i].continuation_line_->get_bound (RIGHT)->get_column ())))
- {
- consecutive_lines.push (groups_[i].continuation_line_);
- }
+ consecutive_lines.push_back (groups_[i].continuation_line_);
else
{
center_continuations (consecutive_lines);
{
Link_array<Grob> encompass;
bool inside = false;
- for (int i = 0; i < groups_.size (); i ++)
+ for (vsize i = 0; i < groups_.size (); i ++)
{
if (!groups_[i].current_music_)
continue;
if (to_boolean (groups_[i].current_music_->get_property ("bracket-start")))
- {
- inside = true;
- }
+ inside = true;
if (inside && groups_[i].figure_item_)
- encompass.push (groups_[i].figure_item_);
+ encompass.push_back (groups_[i].figure_item_);
if (to_boolean (groups_[i].current_music_->get_property ("bracket-stop")))
{
inside = false;
Item * brack = make_item ("BassFigureBracket", groups_[i].current_music_->self_scm ());
- for (int j = 0; j < encompass.size (); j++)
+ for (vsize j = 0; j < encompass.size (); j++)
{
Pointer_group_interface::add_grob (brack,
ly_symbol2scm ("elements"),
}
if (!continuation_
- && new_musics_.is_empty ())
+ && new_musics_.empty ())
{
clear_spanners ();
return;
}
if (!new_music_found_)
- return ;
+ return;
new_music_found_ = false;
if (to_boolean (get_property ("figuredBassCenterContinuations")))
center_repeated_continuations ();
alignment_ = 0;
- for (int i = 0; i < groups_.size (); i++)
+ for (vsize i = 0; i < groups_.size (); i++)
{
groups_[i].group_ = 0;
groups_[i].continuation_line_ = 0;
}
if (!continuation_)
- {
- clear_spanners ();
- }
+ clear_spanners ();
- int k = 0;
- for (int i = 0; i < new_musics_.size (); i++)
+ vsize k = 0;
+ for (vsize i = 0; i < new_musics_.size (); i++)
{
- while (k < groups_.size() &&
- groups_[k].current_music_)
+ while (k < groups_.size ()
+ && groups_[k].current_music_)
k++;
if (k >= groups_.size ())
{
Figure_group group;
- groups_.push (group);
+ groups_.push_back (group);
}
groups_[k].current_music_ = new_musics_[i];
k++;
}
- for (int i = 0; i < groups_.size (); i++)
+ for (vsize i = 0; i < groups_.size (); i++)
{
if (!groups_[i].is_continuation ())
{
if (use_extenders)
{
- Array<int> junk_continuations;
- for (int i = 0; i < groups_.size(); i++)
+ std::vector<int> junk_continuations;
+ for (vsize i = 0; i < groups_.size(); i++)
{
Figure_group &group = groups_[i];
}
}
else if (group.continuation_line_)
- junk_continuations.push (i);
+ junk_continuations.push_back (i);
}
/*
Link_array<Spanner> consecutive;
if (to_boolean (get_property ("figuredBassCenterContinuations")))
{
- for (int i = 0; i <= junk_continuations.size (); i++)
+ for (vsize i = 0; i <= junk_continuations.size (); i++)
{
if (i < junk_continuations.size()
&& (i == 0 || junk_continuations[i-1] == junk_continuations[i] - 1))
- consecutive.push (groups_[junk_continuations[i]].continuation_line_);
+ consecutive.push_back (groups_[junk_continuations[i]].continuation_line_);
else
{
center_continuations (consecutive);
consecutive.clear ();
if (i < junk_continuations.size ())
- consecutive.push (groups_[junk_continuations[i]].continuation_line_);
+ consecutive.push_back (groups_[junk_continuations[i]].continuation_line_);
}
}
}
- for (int i = 0; i < junk_continuations.size (); i++)
+ for (vsize i = 0; i < junk_continuations.size (); i++)
groups_[junk_continuations[i]].continuation_line_ = 0;
}
alignment_->set_bound (RIGHT, muscol);
SCM proc = get_property ("figuredBassFormatter");
- for (int i = 0; i < groups_.size(); i++)
+ for (vsize i = 0; i < groups_.size(); i++)
{
Figure_group &group = groups_[i];
/* create */
"BassFigure "
"BassFigureAlignment "
- "BassFigureBracket",
+ "BassFigureBracket "
"BassFigureContinuation "
"BassFigureLine "
-
+ ,
/* accept */
"bass-figure-event rest-event",
/* read */
+ "figuredBassAlterationDirection "
"figuredBassCenterContinuations "
- "implicitBassFigures "
"figuredBassFormatter "
- "figuredBassAlterationDirection "
- "useBassFigureExtenders",
+ "implicitBassFigures "
+ "useBassFigureExtenders "
+ ,
/* write */
"");
{
if (m->is_mus_type ("fingering-event"))
{
- events_.push (m);
+ events_.push_back (m);
return true;
}
return false;
void
Fingering_engraver::acknowledge_stem (Grob_info inf)
{
- for (int i = 0; i < fingerings_.size (); i++)
+ for (vsize i = 0; i < fingerings_.size (); i++)
Side_position_interface::add_support (fingerings_[i], inf.grob ());
}
void
Fingering_engraver::acknowledge_rhythmic_head (Grob_info inf)
{
- for (int i = 0; i < fingerings_.size (); i++)
+ for (vsize i = 0; i < fingerings_.size (); i++)
{
Grob *t = fingerings_[i];
Side_position_interface::add_support (t, inf.grob ());
void
Fingering_engraver::process_music ()
{
- for (int i = events_.size (); i--;)
+ for (vsize i = events_.size (); i--;)
{
SCM dir = events_[i]->get_property ("direction");
make_script (to_dir (dir), events_[i], i);
SCM dig = r->get_property ("digit");
fingering->set_property ("text", scm_number_to_string (dig, scm_from_int (10)));
- fingerings_.push (fingering);
+ fingerings_.push_back (fingering);
}
void
if (!is_file ((char*)cache_file))
message (_f ("Rebuilding FontConfig cache %s. this may take a while...", cache_file));
- Array<std::string> dirs;
+ std::vector<std::string> dirs;
- dirs.push (prefix_directory + "/fonts/otf/");
- dirs.push (prefix_directory + "/fonts/type1/");
+ dirs.push_back (prefix_directory + "/fonts/otf/");
+ dirs.push_back (prefix_directory + "/fonts/type1/");
- for (int i = 0; i < dirs.size (); i++)
+ for (vsize i = 0; i < dirs.size (); i++)
{
std::string dir = dirs[i];
if (!FcConfigAppFontAddDir (font_config_global, (FcChar8 *)dir.c_str ()))
"Formats passed to --format as a list of strings, "
"used for the output.")
{
- Array<std::string> output_formats = split_string (output_format_global, ',');
+ std::vector<std::string> output_formats = split_string (output_format_global, ',');
SCM lst = SCM_EOL;
int output_formats_count = output_formats.size ();
if (m < now_mom_)
programming_error ("trying to freeze in time");
- for (int i = 0; i < extra_mom_pq_.size (); i++)
+ for (vsize i = 0; i < extra_mom_pq_.size (); i++)
if (extra_mom_pq_[i] == m)
return;
extra_mom_pq_.insert (m);
#include "global-ctor.hh"
-#include "array.hh"
+#include "std-vector.hh"
-static Array<Global_ctor> *ctor_global_statics_;
+static std::vector<Global_ctor> *ctor_global_statics_;
void
add_constructor (Global_ctor c)
{
if (!ctor_global_statics_)
- ctor_global_statics_ = new Array<Global_ctor>;
- ctor_global_statics_->push (c);
+ ctor_global_statics_ = new std::vector<Global_ctor>;
+ ctor_global_statics_->push_back (c);
}
void
call_constructors ()
{
- for (int i = 0; i < ctor_global_statics_->size (); i++)
+ for (vsize i = 0; i < ctor_global_statics_->size (); i++)
(ctor_global_statics_->elem (i)) ();
}
};
void
-print_break_nodes (Array<Break_node> const &arr)
+print_break_nodes (std::vector<Break_node> const &arr)
{
- for (int i = 0; i < arr.size (); i++)
+ for (vsize i = 0; i < arr.size (); i++)
{
printf ("node %d: ", i);
arr[i].print ();
TODO: should rewrite. See the function in scm/page-layout.scm for
inspiration.
*/
-Array<Column_x_positions>
+std::vector<Column_x_positions>
Gourlay_breaking::do_solve () const
{
- Array<Break_node> optimal_paths;
+ std::vector<Break_node> optimal_paths;
Link_array<Grob> all
= pscore_->root_system ()->columns ();
- Array<int> breaks = find_break_indices ();
+ std::vector<int> breaks = find_break_indices ();
Break_node first_node;
- optimal_paths.push (first_node);
+ optimal_paths.push_back (first_node);
bool ragged_right = to_boolean (pscore_->layout ()->c_variable ("raggedright"));
bool ragged_last = to_boolean (pscore_->layout ()->c_variable ("raggedlast"));
Real worst_force = 0.0;
- for (int break_idx = 1; break_idx < breaks.size (); break_idx++)
+ for (vsize break_idx = 1; break_idx < breaks.size (); break_idx++)
{
/*
start with a short line, add measures. At some point
Real minimal_demerits = infinity_f;
- for (int start_idx = break_idx; start_idx--;)
+ 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.slice (breaks[start_idx],
+ breaks[break_idx] + 1);
line[0] = dynamic_cast<Item *> (line[0])->find_prebroken_piece (RIGHT);
- line.top () = dynamic_cast<Item *> (line.top ())->find_prebroken_piece (LEFT);
+ line.back () = dynamic_cast<Item *> (line.back ())->find_prebroken_piece (LEFT);
Column_x_positions cp;
cp.cols_ = line;
bnod.line_config_ = minimal_sol;
}
bnod.line_ = optimal_paths[bnod.prev_break_].line_ + 1;
- optimal_paths.push (bnod);
+ optimal_paths.push_back (bnod);
if (! (break_idx % HAPPY_DOTS))
progress_indication (std::string ("[") + to_string (break_idx) + "]");
progress_indication ("\n");
- Array<int> final_breaks;
- Array<Column_x_positions> lines;
+ std::vector<int> final_breaks;
+ std::vector<Column_x_positions> lines;
/* skip 0-th element, since it is a "dummy" elt*/
- for (int i = optimal_paths.size () - 1; i > 0;)
+ for (vsize i = optimal_paths.size () - 1; i > 0;)
{
- final_breaks.push (i);
- int prev = optimal_paths[i].prev_break_;
+ final_breaks.push_back (i);
+ vsize prev = optimal_paths[i].prev_break_;
assert (i > prev);
i = prev;
}
if (be_verbose_global)
{
message (_f ("Optimal demerits: %f",
- optimal_paths.top ().demerits_) + "\n");
+ optimal_paths.back ().demerits_) + "\n");
}
- if (optimal_paths.top ().demerits_ >= infinity_f)
+ if (optimal_paths.back ().demerits_ >= infinity_f)
warning (_ ("no feasible line breaking found"));
- for (int i = final_breaks.size (); i--;)
+ for (vsize i = final_breaks.size (); i--;)
{
Column_x_positions cp (optimal_paths[final_breaks[i]].line_config_);
- lines.push (cp);
+ lines.push_back (cp);
if (!cp.satisfies_constraints_)
warning (_ ("can't find line breaking that satisfies constraints"));
}
Column_x_positions const &this_one) const
{
Real break_penalties = 0.0;
- Grob *pc = this_one.cols_.top ();
+ Grob *pc = this_one.cols_.back ();
if (pc->original ())
{
SCM pen = pc->get_property ("penalty");
fix_prefix ("pes_or_flexa", LINEA, current_set, min_set, max_set, primitive);
}
-void check_and_fix_all_prefixes (Array<Grob_info> primitives)
+void check_and_fix_all_prefixes (std::vector<Grob_info> primitives)
{
/* Check for illegal head modifier combinations */
- for (int i = 0; i < primitives.size (); i++)
+ for (vsize i = 0; i < primitives.size (); i++)
{
Grob *primitive = primitives[i].grob ();
* Marks those heads that participate in a pes or flexa.
*/
void
-provide_context_info (Array<Grob_info> primitives)
+provide_context_info (std::vector<Grob_info> primitives)
{
Grob *prev_primitive = 0;
int prev_prefix_set = 0;
int prev_context_info = 0;
int prev_pitch = 0;
- for (int i = 0; i < primitives.size (); i++)
+ for (vsize i = 0; i < primitives.size (); i++)
{
Grob *primitive = primitives[i].grob ();
Music *music_cause = primitives[i].music_cause ();
void
Gregorian_ligature_engraver::build_ligature (Spanner *ligature,
- Array<Grob_info> primitives)
+ std::vector<Grob_info> primitives)
{
// apply style-independent checking and transformation
check_and_fix_all_prefixes (primitives);
Grob *refp = common_refpoint_of_array (elts, me, Y_AXIS);
Interval iv;
- for (int i = 0; i < elts.size (); i++)
+ for (vsize i = 0; i < elts.size (); i++)
{
Grob *point = elts[i];
if (depth)
{
Item *it = dynamic_cast<Item *> (i.grob ());
- lines_.push (it);
+ lines_.push_back (it);
if (lines_.size () >= 2 && !spanline_)
{
{
if (spanline_)
{
- for (int i = 0; i < lines_.size (); i++)
+ for (vsize i = 0; i < lines_.size (); i++)
Grid_line_interface::add_grid_point (spanline_, lines_[i]);
spanline_ = 0;
}
- lines_.set_size (0);
+ lines_.resize (0);
}
#include "translator.icc"
SCM_ASSERT_TYPE (me, grob_arr, SCM_ARG1, __FUNCTION__, "Grob_array");
SCM_ASSERT_TYPE (scm_is_integer (index), index, SCM_ARG2, __FUNCTION__, "integer");
- int i = scm_to_int (index);
- if (i < 0 || i >= me->size ())
- {
- scm_out_of_range (NULL, scm_from_int (i));
- }
+ vsize i = scm_to_unsigned (index);
+ if (i == VPOS || i >= me->size ())
+ scm_out_of_range (NULL, scm_from_unsigned (i));
return me->grob (i)->self_scm ();
}
#include "ly-smobs.icc"
Item *
-Grob_array::item (int i)
+Grob_array::item (vsize i)
{
return dynamic_cast<Item *> (grobs_.elem (i));
}
Spanner *
-Grob_array::spanner (int i)
+Grob_array::spanner (vsize i)
{
return dynamic_cast<Spanner *> (grobs_.elem (i));
}
#if 0 /* see System::derived_mark () const */
Grob_array *ga = unsmob_grob_array (s);
- for (int i = 0; i < ga->grobs_.size (); i++)
+ for (vsize i = 0; i < ga->grobs_.size (); i++)
scm_gc_mark (ga->grobs_[i]->self_scm ());
#endif
return SCM_UNDEFINED;
scm_puts ("#<Grob_array", port);
Grob_array *grob_arr = unsmob (arr);
- for (int i = 0; i < grob_arr->size (); i++)
+ for (vsize i = 0; i < grob_arr->size (); i++)
{
scm_display (grob_arr->grob (i)->self_scm (), port);
scm_puts (" ", port);
}
bool
-Grob_array::is_empty () const
+Grob_array::empty () const
{
- return grobs_.is_empty ();
+ return grobs_.empty ();
}
void
Link_array<Context> r;
do
{
- r.push (t);
+ r.push_back (t);
t = t->get_parent_context ();
}
while (t && t != end->context ());
void start_translation_timestep ();
void stop_translation_timestep ();
- Array<Grob_pq_entry> started_now_;
+ std::vector<Grob_pq_entry> started_now_;
};
Grob_pq_engraver::Grob_pq_engraver ()
e.grob_ = gi.grob ();
e.end_ = end;
- started_now_.push (e);
+ started_now_.push_back (e);
}
}
started_now_.sort (Grob_pq_entry::compare);
SCM lst = SCM_EOL;
SCM *tail = &lst;
- for (int i = 0; i < started_now_.size (); i++)
+ for (vsize i = 0; i < started_now_.size (); i++)
{
*tail = scm_acons (started_now_[i].end_.smobbed_copy (),
started_now_[i].grob_->self_scm (),
SCM_ASSERT_TYPE (me, spanner, SCM_ARG1, __FUNCTION__, "spanner");
SCM s = SCM_EOL;
- for (int i = me->broken_intos_.size (); i--;)
+ for (vsize i = me->broken_intos_.size (); i--;)
s = scm_cons (me->broken_intos_[i]->self_scm (), s);
return s;
}
Grob *
common_refpoint_of_array (Link_array<Grob> const &arr, Grob *common, Axis a)
{
- for (int i = arr.size (); i--;)
+ for (vsize i = arr.size (); i--;)
if (Grob *s = arr[i])
{
if (common)
{
bool neighbor_found = false;
extract_grob_set (me, "adjacent-hairpins", pins);
- for (int i = 0; i < pins.size (); i++)
+ for (vsize i = 0; i < pins.size (); i++)
{
/*
FIXME: this will fuck up in case of polyphonic
Link_array<Grob> childs;
Axis_group_interface::get_children (me, &childs);
- for (int i = 0; i < childs.size (); i++)
+ for (vsize i = 0; i < childs.size (); i++)
childs[i]->suicide ();
/*
else
{
push_count_++;
- events_.push (m);
+ events_.push_back (m);
}
if (pop_count_ && push_count_)
void
Horizontal_bracket_engraver::acknowledge_note_column (Grob_info gi)
{
- for (int i = 0; i < bracket_stack_.size (); i++)
+ for (vsize i = 0; i < bracket_stack_.size (); i++)
{
Side_position_interface::add_support (bracket_stack_[i], gi.grob ());
Pointer_group_interface::add_grob (bracket_stack_[i],
{
Spanner *sp = make_spanner ("HorizontalBracket", events_[k]->self_scm ());
- for (int i = 0; i < bracket_stack_.size (); i++)
+ for (vsize i = 0; i < bracket_stack_.size (); i++)
{
/*
sp is the smallest, it should be added to the bigger brackets.
*/
Side_position_interface::add_support (bracket_stack_[i], sp);
}
- bracket_stack_.push (sp);
+ bracket_stack_.push_back (sp);
}
}
{
extract_item_set (sp, "heads", heads);
if (heads.size ())
- sp->set_bound (RIGHT, heads.top ());
+ sp->set_bound (RIGHT, heads.back ());
}
}
LexerError (msg.c_str ());
return;
}
- file_name_strings_.push (file->name_string ());
+ file_name_strings_.push_back (file->name_string ());
- char_count_stack_.push (0);
+ char_count_stack_.push_back (0);
if (yy_current_buffer)
- state_stack_.push (yy_current_buffer);
+ state_stack_.push_back (yy_current_buffer);
if (be_verbose_global)
progress_indication (std::string ("[") + name);
- include_stack_.push (file);
+ include_stack_.push_back (file);
/* Ugh. We'd want to create a buffer from the bytes directly.
{
Source_file *file = new Source_file (name, data);
sources->add (file);
- file_name_strings_.push (name);
+ file_name_strings_.push_back (name);
- char_count_stack_.push (0);
+ char_count_stack_.push_back (0);
if (yy_current_buffer)
- state_stack_.push (yy_current_buffer);
+ state_stack_.push_back (yy_current_buffer);
if (be_verbose_global)
progress_indication (std::string ("[") + name);
- include_stack_.push (file);
+ include_stack_.push_back (file);
yy_switch_to_buffer (yy_create_buffer (file->get_istream (), YY_BUF_SIZE));
}
bool
Includable_lexer::close_input ()
{
- include_stack_.pop ();
- char_count_stack_.pop ();
+ include_stack_.pop_back ();
+ char_count_stack_.pop_back ();
if (be_verbose_global)
progress_indication ("]");
yy_delete_buffer (yy_current_buffer);
#if HAVE_FLEXLEXER_YY_CURRENT_BUFFER
yy_current_buffer = 0;
#endif
- if (state_stack_.is_empty ())
+ if (state_stack_.empty ())
{
#if HAVE_FLEXLEXER_YY_CURRENT_BUFFER
yy_current_buffer = 0;
#endif
return false;
}
- yy_switch_to_buffer (state_stack_.pop ());
+ yy_switch_to_buffer (state_stack_.back ());
+ state_stack_.pop_back ();
return true;
}
char const *
Includable_lexer::here_str0 () const
{
- if (include_stack_.is_empty ())
+ if (include_stack_.empty ())
return 0;
- return include_stack_.top ()->c_str () + char_count_stack_.top ();
+ return include_stack_.back ()->c_str () + char_count_stack_.back ();
}
Includable_lexer::~Includable_lexer ()
{
- while (!include_stack_.is_empty ())
+ while (!include_stack_.empty ())
close_input ();
}
Source_file *
Includable_lexer::get_source_file () const
{
- if (include_stack_.is_empty ())
+ if (include_stack_.empty ())
return 0;
- return include_stack_.top ();
+ return include_stack_.back ();
}
static bool has_interface (Grob *);
static std::string get_fontcharname (std::string style, int alteration);
- static Array<Box> accurate_boxes (Grob *me,
+ static std::vector<Box> accurate_boxes (Grob *me,
Grob **common);
};
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,
- Array<Stem_info> const &stem_infos,
- Array<Real> const &base_stem_ys,
- Array<Real> const &stem_xs,
+ std::vector<Stem_info> const &stem_infos,
+ std::vector<Real> const &base_stem_ys,
+ std::vector<Real> const &stem_xs,
Real xl, Real xr,
bool knee,
Real yl, Real yr, Beam_quant_parameters const *);
*/
struct Beaming_info_list
{
- Array<Beaming_info> infos_;
+ std::vector<Beaming_info> infos_;
int beam_extend_count (Direction) const;
int best_splitpoint_index (Moment &beat_length, bool subdivide) const;
void translate (Offset);
Real get_other_coordinate (Axis a, Real x) const;
- Array<Real> solve_point (Axis, Real coordinate) const;
- Array<Real> solve_derivative (Offset) const;
+ std::vector<Real> solve_point (Axis, Real coordinate) const;
+ std::vector<Real> solve_derivative (Offset) const;
Interval extent (Axis) const;
Interval control_point_extent (Axis) const;
/*
Bezier curves always have 4 control points. Making this into an
- Array<> gives unnecessary overhead, and makes debugging a royal
+ std::vector<> gives unnecessary overhead, and makes debugging a royal
pain. */
Offset control_[4];
};
-void scale (Array<Offset> *array, Real xscale, Real yscale);
-void rotate (Array<Offset> *array, Real phi);
-void translate (Array<Offset> *array, Offset o);
+void scale (std::vector<Offset> *array, Real xscale, Real yscale);
+void rotate (std::vector<Offset> *array, Real phi);
+void translate (std::vector<Offset> *array, Offset o);
Bezier slur_shape (Real width, Real height_limit,
Real height_proportion);
Real linewidth_;
Link_array<Grob> find_breaks () const;
- Array<int> find_break_indices () const;
+ std::vector<int> find_break_indices () const;
void solve_line (Column_x_positions *) const;
bool feasible (Link_array<Grob> const &) const;
Simple_spacer_wrapper *generate_spacing_problem (Link_array<Grob> const &,
Interval) const;
- virtual Array<Column_x_positions> do_solve () const = 0;
+ virtual std::vector<Column_x_positions> do_solve () const = 0;
public:
virtual ~Break_algorithm ();
Simple_spacer *(*get_line_spacer) ();
Break_algorithm ();
void set_pscore (Paper_score *);
- Array<Column_x_positions> solve () const;
+ std::vector<Column_x_positions> solve () const;
};
#endif // BREAK_HH
protected:
virtual void build_ligature (Spanner *ligature,
- Array<Grob_info> primitives) = 0;
+ std::vector<Grob_info> primitives) = 0;
virtual void typeset_ligature (Spanner *ligature,
- Array<Grob_info> primitives);
+ std::vector<Grob_info> primitives);
virtual void get_set_column (Item *, Paper_column *);
private:
- void collect_accidentals (Spanner *, Array<Grob_info>);
+ void collect_accidentals (Spanner *, std::vector<Grob_info>);
};
#endif // COHERENT_LIGATURE_ENGRAVER_HH
Link_array<Grob> cols_;
Link_array<Grob> loose_cols_;
- Array<Real> config_;
+ std::vector<Real> config_;
Real force_;
bool satisfies_constraints_;
class Engraver_group : public virtual Translator_group
{
protected:
- Array<Grob_info> announce_infos_;
+ std::vector<Grob_info> announce_infos_;
SCM acknowledge_hash_table_;
public:
VIRTUAL_COPY_CONSTRUCTOR (Translator_group, Engraver_group);
*/
struct Gourlay_breaking : public Break_algorithm
{
- Array<Column_x_positions> do_solve () const;
+ std::vector<Column_x_positions> do_solve () const;
Gourlay_breaking ();
Real combine_demerits (Column_x_positions const &, Column_x_positions const &) const;
};
protected:
Gregorian_ligature_engraver ();
virtual bool try_music (Music *);
- virtual void build_ligature (Spanner *ligature, Array<Grob_info> primitives);
+ virtual void build_ligature (Spanner *ligature, std::vector<Grob_info> primitives);
virtual void transform_heads (Spanner *ligature,
- Array<Grob_info> primitives) = 0;
+ std::vector<Grob_info> primitives) = 0;
void stop_translation_timestep ();
};
public:
bool ordered () const { return ordered_; }
void set_ordered (bool b) { ordered_ = b; }
- Item *item (int i);
- Spanner *spanner (int i);
- Grob *grob (int i) { return grobs_.elem (i); }
- int size () const { return grobs_.size (); }
- bool is_empty () const;
+ Item *item (vsize i);
+ Spanner *spanner (vsize i);
+ Grob *grob (vsize i) { return grobs_.elem (i); }
+ vsize size () const { return grobs_.size (); }
+ bool empty () const;
void clear ();
- void add (Grob *x) { grobs_.push (x); }
+ 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;
*/
class Includable_lexer : public yyFlexLexer
{
- Array<YY_BUFFER_STATE> state_stack_;
+ std::vector<YY_BUFFER_STATE> state_stack_;
protected:
bool close_input ();
Link_array<Source_file> include_stack_;
- Array<int> char_count_stack_;
+ std::vector<int> char_count_stack_;
public:
bool allow_includes_b_;
~Includable_lexer ();
/// store dependencies for Makefile stuff.
- Array<std::string> file_name_strings_;
+ std::vector<std::string> file_name_strings_;
Source_file *get_source_file () const;
void new_input (std::string s, Sources *);
#ifndef KEYWORD_HH
#define KEYWORD_HH
-#include "array.hh"
+#include "std-vector.hh"
/* for the keyword table */
struct Keyword_ent
*/
struct Keyword_table
{
- Array<Keyword_ent> table_;
+ std::vector<Keyword_ent> table_;
Keyword_table (Keyword_ent *);
- int lookup (char const *s) const;
+ vsize lookup (char const *s) const;
};
#endif // KEYWORD_HH
#ifndef LEASTSQUARE_HH
#define LEASTSQUARE_HH
-#include "array.hh"
+#include "std-vector.hh"
#include "offset.hh"
/**
Least squares minimisation in 2 variables.
*/
-void minimise_least_squares (Real *coef, Real *offset, Array<Offset> const &);
+void minimise_least_squares (Real *coef, Real *offset, std::vector<Offset> const &);
#endif // LEASTSQUARE_HH
void process_music ();
virtual Spanner *create_ligature_spanner () = 0;
virtual void typeset_ligature (Spanner *ligature,
- Array<Grob_info> primitives) = 0;
+ std::vector<Grob_info> primitives) = 0;
virtual Spanner *current_ligature ();
SCM brew_ligature_primitive_proc;
Drul_array<Music *> events_drul_;
Spanner *ligature_;
- Array<Grob_info> primitives_;
+ std::vector<Grob_info> primitives_;
Spanner *finished_ligature_;
- Array<Grob_info> finished_primitives_;
+ std::vector<Grob_info> finished_primitives_;
Music *prev_start_event_;
DECLARE_SMOBS (Lily_parser,);
friend int yyparse (void *);
- Array<Input> define_spots_;
+ std::vector<Input> define_spots_;
char const *here_str0 () const;
Simultaneous_music *get_chord (Pitch tonic,
- Array<Pitch> *adds, Array<Pitch> *subs,
+ std::vector<Pitch> *adds, std::vector<Pitch> *subs,
Pitch *inversion, Pitch *bass, Duration d);
void set_chord_tremolo (int type_i);
void set_last_duration (Duration const *);
static Stencil dot (Offset p, Real radius);
static Stencil bracket (Axis a, Interval iv, Real thick, Real protude, Real blot);
static Stencil accordion (SCM arg, Real interline_f, Font_metric *fm);
- static Stencil round_filled_polygon (Array<Offset> const &points, Real blotdiameter);
+ static Stencil round_filled_polygon (std::vector<Offset> const &points, Real blotdiameter);
static Stencil frame (Box b, Real thick, Real blot);
static Stencil slur (Bezier controls, Real cthick, Real thick);
static Stencil bezier_sandwich (Bezier top_curve, Bezier bottom_curve);
#define MAIN_HH
#include "lily-proto.hh"
-#include "array.hh"
+#include "std-vector.hh"
#include "std-string.hh"
void debug_init ();
void set_default_output (std::string s);
std::string find_file (std::string);
void call_constructors ();
-Array<std::string> get_inclusion_names ();
-void set_inclusion_names (Array<std::string>);
+std::vector<std::string> get_inclusion_names ();
+void set_inclusion_names (std::vector<std::string>);
extern std::string init_name_global;
/* options */
-extern Array<std::string> dump_header_fieldnames_global;
+extern std::vector<std::string> dump_header_fieldnames_global;
extern std::string output_backend_global;
extern std::string output_name_global;
extern bool be_safe_global;
extern bool make_print;
/* misc */
-extern Array<std::string> failed_files;
+extern std::vector<std::string> failed_files;
extern int exit_status_global;
extern File_path global_path;
extern const char *LILYPOND_DATADIR;
#include <cstdlib>
using namespace std;
-#include "array.hh"
+#include "std-vector.hh"
#include "interval.hh"
double log_2 (double x);
else return 0;
}
-Array<std::string> split_string (std::string s, char c);
+std::vector<std::string> split_string (std::string s, char c);
inline Real
linear_interpolate (Real x, Real x1, Real x2, Real y1, Real y2)
#ifndef MUSIC_ITERATOR_HH
#define MUSIC_ITERATOR_HH
-#include "array.hh"
+#include "std-vector.hh"
#include "moment.hh"
#include "virtual-methods.hh"
#include "context-handle.hh"
#define PAPER_OUTPUTTER_HH
#include "lily-proto.hh"
-#include "array.hh"
+#include "std-vector.hh"
#include "std-string.hh"
#include "protected-scm.hh"
#include "smobs.hh"
System *root_system () const;
void typeset_system (System *);
- Array<Column_x_positions> calc_breaking ();
+ std::vector<Column_x_positions> calc_breaking ();
SCM get_paper_systems () const;
protected:
virtual int get_tempo () const;
protected:
- Array<Audio_element_info> announce_infos_;
+ std::vector<Audio_element_info> announce_infos_;
private:
void acknowledge_audio_elements ();
INSTANTIATE_COMPARE (Pitch, Pitch::compare);
-int compare (Array<Pitch> *, Array<Pitch> *);
+int compare (std::vector<Pitch> *, std::vector<Pitch> *);
extern SCM pitch_less_proc;
Pitch pitch_interval (Pitch const &from, Pitch const &to);
class Simple_spacer
{
public:
- Array<Spring_description> springs_;
+ std::vector<Spring_description> springs_;
Real force_;
Real indent_;
Real line_len_;
#ifndef SKYLINE_HH
#define SKYLINE_HH
-#include "array.hh"
+#include "std-vector.hh"
#include "box.hh"
struct Skyline_entry
};
void
-merge_skyline (Array<Skyline_entry> *a1, Array<Skyline_entry> const &a2,
+merge_skyline (std::vector<Skyline_entry> *a1, std::vector<Skyline_entry> const &a2,
Direction);
-void insert_extent_into_skyline (Array<Skyline_entry> *line, Box b, Axis line_axis,
+void insert_extent_into_skyline (std::vector<Skyline_entry> *line, Box b, Axis line_axis,
Direction d);
-Array<Skyline_entry>
-extents_to_skyline (Array<Box> const &extents, Axis a, Direction d);
-Array<Skyline_entry> empty_skyline (Direction d);
-void heighten_skyline (Array<Skyline_entry> *buildings, Real ground);
+std::vector<Skyline_entry>
+extents_to_skyline (std::vector<Box> const &extents, Axis a, Direction d);
+std::vector<Skyline_entry> empty_skyline (Direction d);
+void heighten_skyline (std::vector<Skyline_entry> *buildings, Real ground);
Real
-skyline_meshing_distance (Array<Skyline_entry> const &buildings,
- Array<Skyline_entry> const &clouds);
+skyline_meshing_distance (std::vector<Skyline_entry> const &buildings,
+ std::vector<Skyline_entry> const &clouds);
Real
-skyline_height (Array<Skyline_entry> const &buildings,
+skyline_height (std::vector<Skyline_entry> const &buildings,
Real airplane, Direction sky_dir);
#endif /* SKYLINE_HH */
Slur_configuration ();
void generate_curve (Slur_score_state const &state, Real r0, Real h_inf,
- Array<Offset> const &);
+ std::vector<Offset> const &);
void score (Slur_score_state const &);
protected:
void score_extra_encompass (Slur_score_state const &);
Real musical_dy_;
Link_array<Grob> columns_;
- Array<Encompass_info> encompass_infos_;
- Array<Extra_collision_info> extra_encompass_infos_;
+ std::vector<Encompass_info> encompass_infos_;
+ std::vector<Extra_collision_info> extra_encompass_infos_;
Direction dir_;
Slur_score_parameters parameters_;
void fill (Grob *);
void set_next_direction ();
- Array<Offset> generate_avoid_offsets () const;
+ 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;
Drul_array<Offset> get_base_attachments () const;
Drul_array<Real> get_y_attachment_range () const;
Encompass_info get_encompass_info (Grob *col) const;
- Array<Extra_collision_info> get_extra_encompass_infos () const;
+ std::vector<Extra_collision_info> get_extra_encompass_infos () const;
Real move_away_from_staffline (Real y, Grob *on_staff) const;
int get_closest_index (SCM inspect_quants) const;
};
class Stem
{
public:
- static Array<int> note_head_positions (Grob *);
+ static std::vector<int> note_head_positions (Grob *);
static int duration_log (Grob *);
static void set_beaming (Grob *, int, Direction d);
static int get_beaming (Grob *, Direction d);
int element_count () const;
int spanner_count () const;
- void break_into_pieces (Array<Column_x_positions> 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;
void read_char_metrics ();
Tex_font_char_metric read_char_metric (Char_code code);
Tex_font_char_metric read_char ();
- void read_lig_kern_program (Array<Tfm_ligature> *ligatures,
- Array<Tfm_kern> *kerns);
+ void read_lig_kern_program (std::vector<Tfm_ligature> *ligatures,
+ std::vector<Tfm_kern> *kerns);
Binary_source_file input_;
Tfm_info info_;
Tfm_header header_;
- Array<Tex_font_char_metric> char_metrics_;
- Array<int> ascii_to_metric_idx_;
+ std::vector<Tex_font_char_metric> char_metrics_;
+ std::vector<int> ascii_to_metric_idx_;
};
#endif /* TFM_READER_HH */
#ifndef TFM_HH
#define TFM_HH
-#include "array.hh"
+#include "std-vector.hh"
#include "font-metric.hh"
/* The type. */
Char_code code_;
Real width_, height_, depth_, italic_correction_;
Fix width_fix_, height_fix_, depth_fix_, italic_correction_fix_;
- Array<Tfm_kern> kerns_;
- Array<Tfm_ligature> ligatures_;
+ std::vector<Tfm_kern> kerns_;
+ std::vector<Tfm_ligature> ligatures_;
Tex_font_char_metric ();
protected:
Tfm_info info_;
Tfm_header header_;
- Array<Tex_font_char_metric> char_metrics_;
- Array<int> ascii_to_metric_idx_;
+ std::vector<Tex_font_char_metric> char_metrics_;
+ std::vector<int> ascii_to_metric_idx_;
SCM encoding_table_;
std::string font_name_;
private:
#include "lily-proto.hh"
#include "tie-configuration.hh"
-void set_chord_outline (Array<Skyline_entry> *skyline,
+void set_chord_outline (std::vector<Skyline_entry> *skyline,
Link_array<Item> bounds,
Grob *common,
Direction d);
Tie_formatting_problem const&,
Grob *staff_referencer);
void
-set_chord_outlines (Drul_array< Array<Skyline_entry> > *skyline_drul,
+set_chord_outlines (Drul_array< std::vector<Skyline_entry> > *skyline_drul,
Link_array<Grob> ties,
Grob *common);
#include "direction.hh"
#include "interval.hh"
#include "compare.hh"
-#include "array.hh"
+#include "std-vector.hh"
class Tie_configuration
{
INSTANTIATE_COMPARE (Tie_configuration, Tie_configuration::compare);
-typedef Array<Tie_configuration> Ties_configuration;
+typedef std::vector<Tie_configuration> Ties_configuration;
#endif /* TIE_CONFIGURATION_HH */
class Tie_formatting_problem
{
- Drul_array< Array<Skyline_entry> > chord_outlines_;
+ Drul_array< std::vector<Skyline_entry> > chord_outlines_;
Drul_array< Box > stem_extents_;
set<int> dot_positions_;
Interval dot_x_;
- Array<Tie_specification> specifications_;
+ std::vector<Tie_specification> specifications_;
Tie_configuration_map possibilities_;
Tie_configuration *get_configuration (int position, Direction dir);
Tie_configuration *generate_configuration (int position, Direction dir) const;
- Array<Tie_configuration_variation> get_variations (Ties_configuration const &ties);
+ std::vector<Tie_configuration_variation> get_variations (Ties_configuration const &ties);
Real score_configuration (Tie_configuration const &) const;
Real score_aptitude (Tie_configuration const &, Tie_specification const &) const;
#include "lily-proto.hh"
#include "lily-guile.hh"
-#include "array.hh"
+#include "std-vector.hh"
#include "smobs.hh"
struct Engraver_dispatch_entry
class Engraver_dispatch_list
{
- Array<Engraver_dispatch_entry> dispatch_entries_;
+ std::vector<Engraver_dispatch_entry> dispatch_entries_;
public:
void apply (Grob_info);
SCM static create (SCM trans_list,
{
private:
void precompute_method_bindings ();
- Array<Translator_method_binding>
+ std::vector<Translator_method_binding>
precomputed_method_bindings_[TRANSLATOR_METHOD_PRECOMPUTE_COUNT];
Translator_group_void_method
NAME (); \
VIRTUAL_COPY_CONSTRUCTOR (Translator, NAME); \
static SCM static_description_; \
- static Array<Acknowledge_information> acknowledge_static_array_; \
+ static std::vector<Acknowledge_information> acknowledge_static_array_; \
virtual void fetch_precomputable_methods (Translator_void_method_ptr methods[]); \
virtual SCM static_translator_description () const; \
virtual SCM translator_description () const; \
#ifndef TRANSLATOR_ICC
#define TRANSLATOR_ICC
-#include "array.hh"
+#include "std-vector.hh"
#include "translator.hh"
/**
ADD_GLOBAL_CTOR (_ ## T ## _adder);
#define ADD_TRANSLATOR(classname, desc, grobs, accepted, read, write) \
- Array<Acknowledge_information> classname::acknowledge_static_array_; \
+ std::vector<Acknowledge_information> classname::acknowledge_static_array_; \
IMPLEMENT_FETCH_PRECOMPUTABLE_METHODS (classname); \
ADD_THIS_TRANSLATOR (classname); \
Engraver_void_function_engraver_grob_info \
void add_acknowledger (Engraver_void_function_engraver_grob_info ptr,
char const *func_name,
- Array<Acknowledge_information> *ack_array);
+ std::vector<Acknowledge_information> *ack_array);
Engraver_void_function_engraver_grob_info
generic_get_acknowledger (SCM sym,
- Array<Acknowledge_information> const *ack_array);
+ std::vector<Acknowledge_information> const *ack_array);
#define ADD_ACKNOWLEDGER(CLASS, NAME) \
void CLASS ## NAME ## _ack_adder () \
Keyword_table::Keyword_table (Keyword_ent *tab)
{
while (tab->name_)
- table_.push (*tab++);
+ table_.push_back (*tab++);
table_.sort (tabcmp);
}
-int
+vsize
Keyword_table::lookup (char const *s) const
{
Keyword_ent e;
e.name_ = s;
- int idx = binary_search (table_, e, tabcmp);
- if (idx >= 0)
+ vsize idx = binary_search (table_, e, tabcmp);
+ if (idx != VPOS)
return table_[idx].tokcode_;
else
- return -1;
+ return VPOS;
}
lv_tie);
lv_tie->set_parent (lv_column_, Y_AXIS);
- lv_ties_.push (lv_tie);
+ lv_ties_.push_back (lv_tie);
}
problem.set_manual_tie_configuration (manual_configs);
Ties_configuration base = problem.generate_optimal_chord_configuration ();
- for (int i = 0; i < lv_ties.size(); i++)
+ for (vsize i = 0; i < lv_ties.size(); i++)
{
Tie::set_control_points (lv_ties[i], problem.common_x_refpoint (), base[i],
problem.details_);
void
minimise_least_squares (Real *coef, Real *offset,
- Array<Offset> const &input)
+ std::vector<Offset> const &input)
{
Real sx = 0.0;
Real sy = 0.0;
Real sqx = 0.0;
Real sxy = 0.0;
- for (int i = 0; i < input.size ();i++)
+ for (vsize i = 0; i < input.size ();i++)
{
Real x = input[i][X_AXIS];
Real y = input[i][Y_AXIS];
contain a lot of noteheads, superlinear performance is too slow.
*/
extract_item_set (me, "note-heads", heads);
- for (int i = heads.size (); i--;)
+ for (vsize i = heads.size (); i--;)
{
Item *h = heads[i];
extract_grob_set (me, "note-heads", heads);
- if (heads.is_empty ())
+ if (heads.empty ())
return SCM_EOL;
// find size of note heads.
{
Axis a = Axis (i);
common[a] = common_refpoint_of_array (heads, me, a);
- for (int i = heads.size (); i--;)
+ for (vsize i = heads.size (); i--;)
if (Grob *g = unsmob_grob (me->get_object ("accidental-grob")))
common[a] = common[a]->common_refpoint (g, a);
}
Ledger_requests reqs;
- for (int i = heads.size (); i--;)
+ for (vsize i = heads.size (); i--;)
{
Item *h = dynamic_cast<Item *> (heads[i]);
// create ledgers for note heads
Real ledgerlinethickness
= Staff_symbol::get_ledger_line_thickness (staff);
- for (int i = heads.size (); i--;)
+ for (vsize i = heads.size (); i--;)
{
Item *h = dynamic_cast<Item *> (heads[i]);
{
yyinput ();
}
- char_count_stack_.top () += n;
+ char_count_stack_.back () += n;
if (unpack_identifier (sval) != SCM_UNDEFINED)
{
protected:
virtual Spanner *create_ligature_spanner ();
virtual void typeset_ligature (Spanner *ligature,
- Array<Grob_info> primitives);
+ std::vector<Grob_info> primitives);
DECLARE_ACKNOWLEDGER (rest);
DECLARE_ACKNOWLEDGER (note_column);
public:
}
void
-Ligature_bracket_engraver::typeset_ligature (Spanner *, Array<Grob_info>)
+Ligature_bracket_engraver::typeset_ligature (Spanner *, std::vector<Grob_info>)
{
// no real ligature to typeset; the LigatureBracket just does it
}
*
* A concrete ligature engraver must subclass this class and provide
* functions create_ligature_spanner () and typeset_ligature
- * (Spanner *, Array<Grob_info>). Subclasses of this class basically
+ * (Spanner *, std::vector<Grob_info>). Subclasses of this class basically
* fall into two categories.
*
* The first category consists of engravers that engrave ligatures in
{
if (ligature_)
{
- primitives_.push (info);
+ primitives_.push_back (info);
if (info.grob () && (brew_ligature_primitive_proc != SCM_EOL))
{
info.grob ()->set_property ("stencil", brew_ligature_primitive_proc);
}
typedef void (*Void_fptr) ();
-Array<Void_fptr> *scm_init_funcs_;
+std::vector<Void_fptr> *scm_init_funcs_;
void add_scm_init_func (void (*f) ())
{
if (!scm_init_funcs_)
- scm_init_funcs_ = new Array<Void_fptr>;
+ scm_init_funcs_ = new std::vector<Void_fptr>;
- scm_init_funcs_->push (f);
+ scm_init_funcs_->push_back (f);
}
void
ly_init_ly_module (void *)
{
- for (int i = scm_init_funcs_->size (); i--;)
+ for (vsize i = scm_init_funcs_->size (); i--;)
(scm_init_funcs_->elem (i)) ();
if (be_verbose_global)
}
SCM
-ly_string_array_to_scm (Array<std::string> a)
+ly_string_array_to_scm (std::vector<std::string> a)
{
SCM s = SCM_EOL;
- for (int i = a.size () - 1; i >= 0; i--)
- s = scm_cons (ly_symbol2scm (a[i].c_str ()), s);
+ for (vsize i = a.size (); i ; i--)
+ s = scm_cons (ly_symbol2scm (a[i - 1].c_str ()), s);
return s;
}
void
Lily_lexer::LexerError (char const *s)
{
- if (include_stack_.is_empty ())
+ if (include_stack_.empty ())
message (_f ("error at EOF: %s", s) + "\n");
else
{
char const *start = here_str0 ();
lexloc->set (get_source_file (),
start, start + count);
- char_count_stack_.top () += count;
+ char_count_stack_.back () += count;
}
#include "ly-smobs.icc"
scm_set_current_module (mod);
- if (!define_spots_.is_empty ())
+ if (!define_spots_.empty ())
{
- define_spots_.top ().warning (_ ("braces don't match"));
+ define_spots_.back ().warning (_ ("braces don't match"));
error_level_ = 1;
}
do_yyparse ();
scm_set_current_module (mod);
- if (!define_spots_.is_empty ())
+ if (!define_spots_.empty ())
{
- if (define_spots_.is_empty ()
+ if (define_spots_.empty ()
&& !error_level_)
programming_error ("define_spots_ don't match, but error_level_ not set.");
}
#include "lilypond-input-version.hh"
#include "string-convert.hh"
-#include "array.hh"
+#include "std-vector.hh"
Lilypond_version::Lilypond_version (int major, int minor, int patch)
{
minor_ = 0;
patch_ = 0;
- Array<std::string> version;
+ std::vector<std::string> version;
version = String_convert::split (str, '.');
if (version.size () > 0 && isdigit (version[0][0]))
Real length, Real width)
{
Real angle = (end - begin).arg ();
- Array<Offset> points;
+ std::vector<Offset> points;
- points.push (Offset (0, 0));
- points.push (Offset (-length, width));
- points.push (Offset (-length, -width));
+ points.push_back (Offset (0, 0));
+ points.push_back (Offset (-length, width));
+ points.push_back (Offset (-length, -width));
- for (int i = 0; i < points.size (); i++)
+ for (vsize i = 0; i < points.size (); i++)
points[i] = points[i] * complex_exp (Offset (0, angle)) + end;
return Lookup::round_filled_polygon (points, thick);
* shrinked polygon). --jr
*/
Stencil
-Lookup::round_filled_polygon (Array<Offset> const &points,
+Lookup::round_filled_polygon (std::vector<Offset> const &points,
Real blotdiameter)
{
/* TODO: Maybe print a warning if one of the above limitations
#ifndef NDEBUG
/* remove consecutive duplicate points */
- for (int i = 0; i < points.size (); i++)
+ for (vsize i = 0; i < points.size (); i++)
{
int next_i = (i + 1) % points.size ();
Real d = (points[i] - points[next_i]).length ();
return Line_interface::make_line (blotdiameter, points[0], points[1]);
/* shrink polygon in size by 0.5 * blotdiameter */
- Array<Offset> shrunk_points;
- shrunk_points.set_size (points.size ());
+ std::vector<Offset> shrunk_points;
+ shrunk_points.resize (points.size ());
bool ccw = 1; // true, if three adjacent points are counterclockwise ordered
- for (int i = 0; i < points.size (); i++)
+ for (vsize i = 0; i < points.size (); i++)
{
int i0 = i;
int i1 = (i + 1) % points.size ();
/* build scm expression and bounding box */
SCM shrunk_points_scm = SCM_EOL;
Box box;
- for (int i = 0; i < shrunk_points.size (); i++)
+ for (vsize i = 0; i < shrunk_points.size (); i++)
{
SCM x = scm_from_double (shrunk_points[i][X_AXIS]);
SCM y = scm_from_double (shrunk_points[i][Y_AXIS]);
Lookup::repeat_slash (Real w, Real s, Real t)
{
#if 0 /* TODO */
- Array<Offset> points;
+ std::vector<Offset> points;
Real blotdiameter = 0.0;
Offset p1 (0, 0);
= left_point + (robust_scm2double (minlen, 0));
if (heads.size ())
- right_point = max (right_point, heads.top ()->extent (common, X_AXIS)[RIGHT]);
+ right_point = max (right_point, heads.back ()->extent (common, X_AXIS)[RIGHT]);
Real h = sl * robust_scm2double (me->get_property ("thickness"), 0);
Real pad = 2* h;
{
if (event->is_mus_type ("lyric-event"))
{
- events_.push (event);
+ events_.push_back (event);
return true;
}
return false;
*/
/* Names of header fields to be dumped to a separate file. */
-Array<std::string> dump_header_fieldnames_global;
+std::vector<std::string> dump_header_fieldnames_global;
/* Name of initialisation file. */
std::string init_name_global;
USER_NAME, GROUP_NAME, JAIL, DIR, JAIL_MAX
};
- Array<std::string> components = String_convert::split (jail_spec, ',');
+ std::vector<std::string> components = String_convert::split (jail_spec, ',');
if (components.size () != JAIL_MAX)
{
error (_f ("expected %d arguments with jail, found: %d", JAIL_MAX,
case 'H':
dump_header_fieldnames_global
- .push (option_parser->optional_argument_str0_);
+ .push_back (option_parser->optional_argument_str0_);
break;
case 'I':
global_path.append (option_parser->optional_argument_str0_);
extract_grob_set (me, "stems", stems);
- Array<Direction> dirs;
- for (int i = 0; i < stems.size (); i++)
+ std::vector<Direction> dirs;
+ for (vsize i = 0; i < stems.size (); i++)
{
- dirs.push (to_dir (stems[i]->get_property ("default-direction")));
+ dirs.push_back (to_dir (stems[i]->get_property ("default-direction")));
}
int last_nonneutral = -1;
protected:
virtual Spanner *create_ligature_spanner ();
- virtual void build_ligature (Spanner *ligature, Array<Grob_info> primitives);
+ virtual void build_ligature (Spanner *ligature, std::vector<Grob_info> primitives);
public:
TRANSLATOR_DECLARATIONS (Mensural_ligature_engraver);
private:
- void transform_heads (Array<Grob_info> primitives);
- void propagate_properties (Spanner *ligature, Array<Grob_info> primitives);
- void fold_up_primitives (Array<Grob_info> primitives);
+ void transform_heads (std::vector<Grob_info> primitives);
+ void propagate_properties (Spanner *ligature, std::vector<Grob_info> primitives);
+ void fold_up_primitives (std::vector<Grob_info> primitives);
};
Mensural_ligature_engraver::Mensural_ligature_engraver ()
}
void
-Mensural_ligature_engraver::transform_heads (Array<Grob_info> primitives)
+Mensural_ligature_engraver::transform_heads (std::vector<Grob_info> primitives)
{
if (primitives.size () < 2)
{
bool prev_semibrevis = false;
Item *prev_primitive = NULL;
- for (int i = 0, s = primitives.size (); i < s; i++)
+ for (vsize i = 0, s = primitives.size (); i < s; i++)
{
Grob_info info = primitives[i];
Item *primitive = dynamic_cast<Item *> (info.grob ());
*/
void
Mensural_ligature_engraver::propagate_properties (Spanner *ligature,
- Array<Grob_info> primitives)
+ std::vector<Grob_info> primitives)
{
Real thickness
= robust_scm2double (ligature->get_property ("thickness"), 1.4);
Real half_flexa_width = 0.5 * (flexa_width + thickness);
- for (int i = 0; i < primitives.size (); i++)
+ for (vsize i = 0; i < primitives.size (); i++)
{
Item *primitive = dynamic_cast<Item *> (primitives[i].grob ());
int output = scm_to_int (primitive->get_property ("primitive"));
}
void
-Mensural_ligature_engraver::fold_up_primitives (Array<Grob_info> primitives)
+Mensural_ligature_engraver::fold_up_primitives (std::vector<Grob_info> primitives)
{
Item *first = 0;
Real distance = 0;
- for (int i = 0; i < primitives.size (); i++)
+ for (vsize i = 0; i < primitives.size (); i++)
{
Item *current = dynamic_cast<Item *> (primitives[i].grob ());
if (i == 0)
void
Mensural_ligature_engraver::build_ligature (Spanner *ligature,
- Array<Grob_info> primitives)
+ std::vector<Grob_info> primitives)
{
transform_heads (primitives);
propagate_properties (ligature, primitives);
Moment stop_mom = note->get_length () + ptr->audio_column_->at_mom ();
bool play_start = true;
- for (int i = 0; i < stop_note_queue.size (); i++)
+ for (vsize i = 0; i < stop_note_queue.size (); i++)
{
/* if this pith already in queue */
if (stop_note_queue[i].val->get_pitch () == note->get_pitch ())
return log (x) / log (2.0);
}
-Array<std::string>
+std::vector<std::string>
split_string (std::string s, char c)
{
- Array<std::string> rv;
+ std::vector<std::string> rv;
while (s.length ())
{
ssize i = s.find (c);
if (i == NPOS)
i = s.length ();
- rv.push (s.substr (0, i));
+ rv.push_back (s.substr (0, i));
s = s.substr (i, s.length () - i);
}
}
else if (event->is_mus_type ("multi-measure-text-event"))
{
- text_events_.push (event);
+ text_events_.push_back (event);
return true;
}
return false;
Spanner *sp
= make_spanner ("MultiMeasureRestNumber", rest_ev_->self_scm ());
- numbers_.push (sp);
+ numbers_.push_back (sp);
if (text_events_.size ())
{
- for (int i = 0; i < text_events_.size (); i++)
+ for (vsize i = 0; i < text_events_.size (); i++)
{
Music *e = text_events_[i];
if (is_direction (dir))
sp->set_property ("direction", dir);
- numbers_.push (sp);
+ numbers_.push_back (sp);
}
/*
do
{
Grob *last = 0;
- for (int i = 0; i < numbers_.size (); i++)
+ for (vsize i = 0; i < numbers_.size (); i++)
{
if (scm_from_int (d) == numbers_[i]->get_property ("direction"))
{
while (flip (&d) != DOWN);
}
- for (int i = 0; i < numbers_.size (); i++)
+ for (vsize i = 0; i < numbers_.size (); i++)
{
Side_position_interface::add_support (numbers_[i], mmrest_);
numbers_[i]->set_parent (mmrest_, Y_AXIS);
if (last_rest_)
{
add_bound_item (last_rest_, last_command_item_);
- for (int i = 0; i < last_numbers_.size (); i++)
+ for (vsize i = 0; i < last_numbers_.size (); i++)
add_bound_item (last_numbers_[i], last_command_item_);
}
if (mmrest_)
{
add_bound_item (mmrest_, last_command_item_);
- for (int i = 0; i < numbers_.size (); i++)
+ for (vsize i = 0; i < numbers_.size (); i++)
add_bound_item (numbers_[i], last_command_item_);
last_command_item_ = 0;
class New_fingering_engraver : public Engraver
{
- Array<Finger_tuple> fingerings_;
- Array<Finger_tuple> articulations_;
- Array<Finger_tuple> string_numbers_;
+ std::vector<Finger_tuple> fingerings_;
+ std::vector<Finger_tuple> articulations_;
+ std::vector<Finger_tuple> string_numbers_;
Link_array<Grob> heads_;
Grob *stem_;
void add_fingering (Grob *, Music *, Music *);
void add_script (Grob *, Music *, Music *);
void add_string (Grob *, Music *, Music *);
- void position_scripts (SCM orientations, Array<Finger_tuple> *);
+ void position_scripts (SCM orientations, std::vector<Finger_tuple> *);
};
void
}
}
- heads_.push (inf.grob ());
+ heads_.push_back (inf.grob ());
}
void
{
ft.script_ = g;
- articulations_.push (ft);
+ articulations_.push_back (ft);
ft.script_->set_parent (head, X_AXIS);
}
ft.note_event_ = hevent;
ft.head_ = head;
- fingerings_.push (ft);
+ fingerings_.push_back (ft);
}
void
ft.note_event_ = hevent;
ft.head_ = head;
- string_numbers_.push (ft);
+ string_numbers_.push_back (ft);
}
void
New_fingering_engraver::position_scripts (SCM orientations,
- Array<Finger_tuple> *scripts)
+ std::vector<Finger_tuple> *scripts)
{
- for (int i = 0; i < scripts->size (); i++)
+ for (vsize i = 0; i < scripts->size (); i++)
if (stem_ && to_boolean (scripts->elem (i).script_->get_property ("add-stem-support")))
Side_position_interface::add_support (scripts->elem (i).script_, stem_);
to the note head, and write a more flexible function for
positioning the fingerings, setting both X and Y coordinates.
*/
- for (int i = 0; i < scripts->size (); i++)
+ for (vsize i = 0; i < scripts->size (); i++)
(*scripts)[i].position_ = scm_to_int ((*scripts)[i].head_->get_property ("staff-position"));
- for (int i = scripts->size (); i--;)
- for (int j = heads_.size (); j--;)
+ for (vsize i = scripts->size (); i--;)
+ for (vsize j = heads_.size (); j--;)
Side_position_interface::add_support ((*scripts)[i].script_, heads_[j]);
- Array<Finger_tuple> up, down, horiz;
- for (int i = scripts->size (); i--;)
+ std::vector<Finger_tuple> up, down, horiz;
+ for (vsize i = scripts->size (); i--;)
{
SCM d = (*scripts)[i].finger_event_->get_property ("direction");
if (to_dir (d))
{
- ((to_dir (d) == UP) ? up : down).push ((*scripts)[i]);
+ ((to_dir (d) == UP) ? up : down).push_back ((*scripts)[i]);
scripts->del (i);
}
}
if (left_p || right_p)
{
if (up_p && !up.size () && scripts->size ())
- up.push (scripts->pop ());
+ {
+ up.push_back (scripts->back ());
+ scripts->pop_back ();
+ }
if (down_p && !down.size () && scripts->size ())
{
- down.push ((*scripts)[0]);
+ down.push_back ((*scripts)[0]);
scripts->del (0);
}
scripts->clear ();
}
- for (int i = 0; i < horiz.size (); i++)
+ for (vsize i = 0; i < horiz.size (); i++)
{
Finger_tuple ft = horiz[i];
Grob *f = ft.script_;
int finger_prio = 200;
Direction d = DOWN;
- Drul_array< Array<Finger_tuple> > vertical (down, up);
+ Drul_array< std::vector<Finger_tuple> > vertical (down, up);
do
{
- for (int i = 0; i < vertical[d].size (); i++)
+ for (vsize i = 0; i < vertical[d].size (); i++)
{
Finger_tuple ft = vertical[d][i];
Grob *f = ft.script_;
string_numbers_.clear ();
}
- for (int i = articulations_.size (); i--;)
+ for (vsize i = articulations_.size (); i--;)
{
Grob *script = articulations_[i].script_;
- for (int j = heads_.size (); j--;)
+ for (vsize j = heads_.size (); j--;)
Side_position_interface::add_support (script, heads_[j]);
if (stem_ && to_dir (script->get_property ("side-relative-direction")))
void
check_meshing_chords (Grob *me,
- Drul_array<Array<Real> > *offsets,
- Drul_array<Array<Slice> > const &extents,
+ Drul_array<std::vector<Real> > *offsets,
+ Drul_array<std::vector<Slice> > const &extents,
Drul_array<Link_array<Grob> > const &clash_groups)
{
Grob *nu = Note_column::first_head (cu);
Grob *nd = Note_column::first_head (cd);
- Array<int> ups = Stem::note_head_positions (Note_column::get_stem (cu));
- Array<int> dps = Stem::note_head_positions (Note_column::get_stem (cd));
+ std::vector<int> ups = Stem::note_head_positions (Note_column::get_stem (cu));
+ std::vector<int> dps = Stem::note_head_positions (Note_column::get_stem (cd));
/* Too far apart to collide. */
- if (ups[0] > dps.top () + 1)
+ if (ups[0] > dps.back () + 1)
return;
// FIXME: what's this?
- bool merge_possible = (ups[0] >= dps[0]) && (ups.top () >= dps.top ());
+ bool merge_possible = (ups[0] >= dps[0]) && (ups.back () >= dps.back ());
/* Do not merge notes typeset in different style. */
if (!ly_is_equal (nu->get_property ("style"),
bool distant_half_collide = false;
bool full_collide = false;
- int i = 0, j = 0;
- while (i < ups.size () && j < dps.size ())
+ for (vsize i = 0, j = 0; i < ups.size () && j < dps.size (); )
{
if (abs (ups[i] - dps[j]) == 1)
{
}
else if (ups[i] == dps[j])
full_collide = true;
- else if (ups[i] > dps[0] && ups[i] < dps.top ())
+ else if (ups[i] > dps[0] && ups[i] < dps.back ())
merge_possible = false;
- else if (dps[j] > ups[0] && dps[j] < ups.top ())
+ else if (dps[j] > ups[0] && dps[j] < ups.back ())
merge_possible = false;
if (ups[i] < dps[j])
Real shift_amount = 1;
- bool touch = (ups[0] >= dps.top ());
+ bool touch = (ups[0] >= dps.back ());
if (touch)
shift_amount *= -1;
Direction d = UP;
do
{
- for (int i = 0; i < clash_groups[d].size (); i++)
+ for (vsize i = 0; i < clash_groups[d].size (); i++)
(*offsets)[d][i] += d * shift_amount;
}
while ((flip (&d)) != UP);
Direction d = UP;
do
{
- for (int i = cg[d].size(); i--; )
+ for (vsize i = cg[d].size(); i--; )
{
/*
Trigger positioning
Link_array<Grob> done;
Real left_most = 1e6;
- Array<Real> amounts;
+ std::vector<Real> amounts;
for (; scm_is_pair (hand); hand = scm_cdr (hand))
{
Grob *s = unsmob_grob (scm_caar (hand));
Real amount = scm_to_double (scm_cdar (hand)) * wid;
- done.push (s);
- amounts.push (amount);
+ done.push_back (s);
+ amounts.push_back (amount);
if (amount < left_most)
left_most = amount;
}
if (!done.find (s))
{
- done.push (s);
- amounts.push (amount);
+ done.push_back (s);
+ amounts.push_back (amount);
if (amount < left_most)
left_most = amount;
}
}
- for (int i = 0; i < amounts.size (); i++)
+ for (vsize i = 0; i < amounts.size (); i++)
done[i]->translate_axis (amounts[i] - left_most, X_AXIS);
return SCM_BOOL_T;
Drul_array<Link_array<Grob> > clash_groups;
extract_grob_set (me, "elements", elements);
- for (int i = 0; i < elements.size (); i++)
+ for (vsize i = 0; i < elements.size (); i++)
{
Grob *se = elements[i];
if (Note_column::has_interface (se))
- clash_groups[Note_column::dir (se)].push (se);
+ clash_groups[Note_column::dir (se)].push_back (se);
}
Direction d = UP;
Drul_array < Link_array<Grob>
> clash_groups)
{
- Drul_array < Array<int> > shifts;
+ Drul_array < std::vector<int> > shifts;
SCM tups = SCM_EOL;
Direction d = UP;
do
{
- Array<int> &shift (shifts[d]);
+ std::vector<int> &shift (shifts[d]);
Link_array<Grob> &clashes (clash_groups[d]);
- for (int i = 0; i < clashes.size (); i++)
+ for (vsize i = 0; i < clashes.size (); i++)
{
SCM sh
= clashes[i]->get_property ("horizontal-shift");
if (scm_is_number (sh))
- shift.push (scm_to_int (sh));
+ shift.push_back (scm_to_int (sh));
else
- shift.push (0);
+ shift.push_back (0);
}
- for (int i = 1; i < shift.size (); i++)
+ for (vsize i = 1; i < shift.size (); i++)
{
if (shift[i - 1] == shift[i])
{
}
while ((flip (&d)) != UP);
- Drul_array<Array<Slice> > extents;
- Drul_array<Array<Real> > offsets;
+ Drul_array<std::vector<Slice> > extents;
+ Drul_array<std::vector<Real> > offsets;
d = UP;
do
{
- for (int i = 0; i < clash_groups[d].size (); i++)
+ for (vsize i = 0; i < clash_groups[d].size (); i++)
{
Slice s (Note_column::head_positions_interval (clash_groups[d][i]));
s[LEFT]--;
s[RIGHT]++;
- extents[d].push (s);
- offsets[d].push (d * 0.5 * i);
+ extents[d].push_back (s);
+ offsets[d].push_back (d * 0.5 * i);
}
}
while ((flip (&d)) != UP);
do
{
- for (int i = 1; i < clash_groups[d].size (); i++)
+ for (vsize i = 1; i < clash_groups[d].size (); i++)
{
Slice prev = extents[d][i - 1];
prev.intersect (extents[d][i]);
if (prev.length () > 0
|| (extents[-d].size () && d * (extents[d][i][-d] - extents[-d][0][d]) < 0))
- for (int j = i; j < clash_groups[d].size (); j++)
+ for (vsize j = i; j < clash_groups[d].size (); j++)
offsets[d][j] += d * 0.5;
}
}
do
{
- for (int i = 0; i < clash_groups[d].size (); i++)
+ for (vsize i = 0; i < clash_groups[d].size (); i++)
tups = scm_cons (scm_cons (clash_groups[d][i]->self_scm (),
scm_from_double (offsets[d][i])),
tups);
SCM tups = SCM_EOL;
extract_grob_set (me, "elements", elements);
- for (int i = 0; i < elements.size (); i++)
+ for (vsize i = 0; i < elements.size (); i++)
{
Grob *se = elements[i];
iv.set_empty ();
extract_grob_set (me, "note-heads", heads);
- for (int i = 0; i < heads.size (); i++)
+ for (vsize i = 0; i < heads.size (); i++)
{
Grob *se = heads[i];
{
extract_grob_set (me, "note-heads", heads);
Grob *acc = 0;
- for (int i = 0; i < heads.size (); i++)
+ for (vsize i = 0; i < heads.size (); i++)
{
Grob *h = heads[i];
acc = h ? unsmob_grob (h->get_object ("accidental-grob")) : 0;
{
if (m->is_mus_type ("note-event"))
{
- note_evs_.push (m);
+ note_evs_.push_back (m);
return true;
}
else if (m->is_mus_type ("busy-playing-event"))
void
Note_heads_engraver::process_music ()
{
- for (int i = 0; i < note_evs_.size (); i++)
+ for (vsize i = 0; i < note_evs_.size (); i++)
{
Music *ev = note_evs_[i];
Item *note = make_item ("NoteHead", ev->self_scm ());
d->set_parent (note, Y_AXIS);
- dots_.push (d);
+ dots_.push_back (d);
}
Pitch *pit = unsmob_pitch (ev->get_property ("pitch"));
note->set_property ("style", style);
}
- notes_.push (note);
+ notes_.push_back (note);
}
}
{
if (m->is_mus_type ("note-event"))
{
- events_.push (m);
+ events_.push_back (m);
return true;
}
return false;
Note_name_engraver::process_music ()
{
std::string s;
- for (int i = 0; i < events_.size (); i++)
+ for (vsize i = 0; i < events_.size (); i++)
{
if (i)
s += " ";
{
Item *t = make_item ("NoteName", events_[0]->self_scm ());
t->set_property ("text", scm_makfrom0str (s.c_str ()));
- texts_.push (t);
+ texts_.push_back (t);
}
}
Audio_note *p = new Audio_note (*pitp, n->get_length (), - transposing);
Audio_element_info info (p, n);
announce_element (info);
- notes_.push (p);
+ notes_.push_back (p);
}
}
note_evs_.clear ();
// why don't grace notes show up here?
// --> grace notes effectively do not get delayed
Moment now = now_mom ();
- for (int i = 0; i < notes_.size (); i++)
+ for (vsize i = 0; i < notes_.size (); i++)
play_element (notes_[i]);
notes_.clear ();
note_evs_.clear ();
{
if (ev->is_mus_type ("note-event"))
{
- note_evs_.push (ev);
+ note_evs_.push_back (ev);
return true;
}
else if (ev->is_mus_type ("busy-playing-event"))
do
{
Link_array<Grob> const &items (ly_scm2link_array (props [d]));
- for (int i = items.size (); i--;)
+ for (vsize i = items.size (); i--;)
{
Item *it = dynamic_cast<Item *> (items[i]);
Item *mincol = 0;
int min_rank = INT_MAX;
bool prune = false;
- for (int i = 0; a && i < a->size (); i++)
+ for (vsize i = 0; a && i < a->size (); i++)
{
Item *ri = a->item (i);
Item *col = ri->get_column ();
if (prune && a)
{
Link_array<Grob> &right = a->array_reference ();
- for (int i = right.size (); i--;)
+ for (vsize i = right.size (); i--;)
{
if (dynamic_cast<Item *> (right[i])->get_column () != mincol)
right.del (i);
do
{
Link_array<Grob> const &items (ly_scm2link_array (props [d]));
- for (int i = 0; i < items.size (); i++)
+ for (vsize i = 0; i < items.size (); i++)
{
Item *it = dynamic_cast<Item *> (items[i]);
{
extract_grob_set (b, "note-heads", heads);
common = common_refpoint_of_array (heads, common, X_AXIS);
- for (int i = 0; i < heads.size (); i++)
+ for (vsize i = 0; i < heads.size (); i++)
{
Grob *h = heads[i];
Grob *dots = Rhythmic_head::get_dots (h);
if (Note_column::has_interface (b))
{
extract_grob_set (b, "note-heads", heads);
- for (int i = 0; i < heads.size (); i++)
+ for (vsize i = 0; i < heads.size (); i++)
{
Grob *h = heads[i];
ext.unite (h->extent (common, X_AXIS));
{
if (m->is_mus_type ("layout-instruction"))
{
- props_.push (m);
+ props_.push_back (m);
return true;
}
return false;
void
Output_property_engraver::acknowledge_grob (Grob_info inf)
{
- for (int i = props_.size (); i--;)
+ for (vsize i = props_.size (); i--;)
{
Music *o = props_[i];
Context *d = inf.context ();
0.0);
Real size = text_size * pow (2.0, step / 6.0);
- pango_font_description_set_size (description,
- gint (size * PANGO_SCALE));
+ pango_font_description_set_size (description, gint (size * PANGO_SCALE));
return description;
}
dump_fields ()
{
SCM fields = SCM_EOL;
- for (int i = dump_header_fieldnames_global.size (); i--;)
+ for (vsize i = dump_header_fieldnames_global.size (); i--;)
fields
= scm_cons (ly_symbol2scm (dump_header_fieldnames_global[i].c_str ()),
fields);
void
Paper_column_engraver::acknowledge_item (Grob_info gi)
{
- items_.push (gi.item ());
+ items_.push_back (gi.item ());
}
void
void
Paper_column_engraver::stop_translation_timestep ()
{
- for (int i = 0; i < items_.size (); i++)
+ for (vsize i = 0; i < items_.size (); i++)
{
Item *elem = items_[i];
if (!elem->get_parent (X_AXIS)
Link_array<Grob> &array (ga->array_reference ());
- for (int i = array.size (); i--;)
+ for (vsize i = array.size (); i--;)
{
Grob *g = array[i];
system->unprotect ();
}
-Array<Column_x_positions>
+std::vector<Column_x_positions>
Paper_score::calc_breaking ()
{
Break_algorithm *algorithm = 0;
- Array<Column_x_positions> sol;
+ std::vector<Column_x_positions> sol;
algorithm = new Gourlay_breaking;
algorithm->set_pscore (this);
doubly, also done in Score_engraver */
Link_array<Grob> pc (system_->columns ());
pc[0]->set_property ("breakable", SCM_BOOL_T);
- pc.top ()->set_property ("breakable", SCM_BOOL_T);
+ pc.back ()->set_property ("breakable", SCM_BOOL_T);
system_->pre_processing ();
- Array<Column_x_positions> breaking = calc_breaking ();
+ std::vector<Column_x_positions> breaking = calc_breaking ();
system_->break_into_pieces (breaking);
paper_systems_ = system_->get_paper_systems ();
output_header_track (midi_stream);
message (_ ("Track...") + " ");
int channel = 0;
- for (int i = 0; i < audio_staffs_.size (); i++)
+ for (vsize i = 0; i < audio_staffs_.size (); i++)
{
Audio_staff *s = audio_staffs_[i];
if (be_verbose_global)
Performance::add_element (Audio_element *p)
{
if (Audio_staff *s = dynamic_cast<Audio_staff *> (p))
- audio_staffs_.push (s);
+ audio_staffs_.push_back (s);
audio_element_list_ = new Killing_cons<Audio_element> (p, audio_element_list_);
}
void
Performer_group::announce_element (Audio_element_info info)
{
- announce_infos_.push (info);
+ announce_infos_.push_back (info);
Translator_group *t
= context ()->get_parent_context ()->implementation ();
void
Performer_group::acknowledge_audio_elements ()
{
- for (int j = 0; j < announce_infos_.size (); j++)
+ for (vsize j = 0; j < announce_infos_.size (); j++)
{
Audio_element_info info = announce_infos_[j];
}
else if (d == STOP)
{
- if (slurs_.is_empty ())
+ if (slurs_.empty ())
return false;
events_[STOP] = m;
Phrasing_slur_engraver::acknowledge_note_column (Grob_info info)
{
Grob *e = info.grob ();
- for (int i = slurs_.size (); i--;)
+ for (vsize i = slurs_.size (); i--;)
Slur::add_column (slurs_[i], e);
- for (int i = end_slurs_.size (); i--;)
+ for (vsize i = end_slurs_.size (); i--;)
Slur::add_column (end_slurs_[i], e);
}
if (Tie::has_interface (e)
|| avoid == ly_symbol2scm ("inside"))
{
- for (int i = slurs_.size (); i--;)
+ for (vsize i = slurs_.size (); i--;)
Slur::add_extra_encompass (slurs_[i], e);
- for (int i = end_slurs_.size (); i--;)
+ for (vsize i = end_slurs_.size (); i--;)
Slur::add_extra_encompass (end_slurs_[i], e);
}
else if (avoid == ly_symbol2scm ("outside")
slurs_.clear ();
}
- if (events_[START] && slurs_.is_empty ())
+ if (events_[START] && slurs_.empty ())
{
Music *ev = events_[START];
if (updown)
set_grob_direction (slur, updown);
- slurs_.push (slur);
+ slurs_.push_back (slur);
}
}
if (broken[d])
{
if (orig
- && ((d == RIGHT && me->get_break_index () != orig->broken_intos_.size () - 1)
+ && ((d == RIGHT
+ && me->get_break_index () != orig->broken_intos_.size () - 1)
|| (d == LEFT && me->get_break_index ())))
height[d] = 0.0;
else
if (previous_.size ())
// add extra space below the previous already-occuring pedal
Side_position_interface::add_support (p->line_spanner_,
- previous_.top ());
- previous_.push (p->line_spanner_);
+ previous_.back ());
+ previous_.push_back (p->line_spanner_);
}
}
// position new pedal spanner below the current one
*/
if (previous_.size ())
- Side_position_interface::add_support (p->line_spanner_, previous_.top ());
+ Side_position_interface::add_support (p->line_spanner_, previous_.back ());
- previous_.push (p->line_spanner_);
+ previous_.push_back (p->line_spanner_);
}
}
Audio_piano_pedal *a = new Audio_piano_pedal;
a->type_string_ = std::string (p->name_);
a->dir_ = STOP;
- audios_.push (a);
+ audios_.push_back (a);
Audio_element_info info(a, p->event_drul_[STOP]);
announce_element (info);
}
Audio_piano_pedal *a = new Audio_piano_pedal;
a->type_string_ = std::string (p->name_);
a->dir_ = START;
- audios_.push (a);
+ audios_.push_back (a);
Audio_element_info info(a, p->event_drul_[START]);
announce_element (info);
}
void
Piano_pedal_performer::stop_translation_timestep ()
{
- for (int i = 0; i < audios_.size (); i++)
+ for (vsize i = 0; i < audios_.size (); i++)
play_element (audios_[i]);
audios_.clear ();
}
void
Pitched_trill_engraver::acknowledge_dots (Grob_info info)
{
- heads_.push (info.grob ());
+ heads_.push_back (info.grob ());
}
void
Pitched_trill_engraver::acknowledge_note_head (Grob_info info)
{
- heads_.push (info.grob ());
+ heads_.push_back (info.grob ());
}
void
Pitched_trill_engraver::stop_translation_timestep ()
{
if (trill_group_)
- for (int i = 0; i < heads_.size (); i++)
+ for (vsize i = 0; i < heads_.size (); i++)
Side_position_interface::add_support (trill_group_, heads_[i]);
heads_.clear ();
{
Grob_array *arr = unsmob_grob_array (elt->internal_get_object (symbol));
Link_array<Item> items;
- for (int i = 0; arr && i < arr->size (); i++)
- items.push (arr->item (i));
+ for (vsize i = 0; arr && i < arr->size (); i++)
+ items.push_back (arr->item (i));
return items;
}
SCM alist = ly_hash2alist (option_hash);
SCM convertor = ly_lily_module_constant ("scm->string");
- Array<std::string> opts;
+ std::vector<std::string> opts;
for (SCM s = alist; scm_is_pair (s); s = scm_cdr (s))
{
std::string ("\n")
+ String_convert::char_string (' ', HELP_INDENT));
- opts.push (opt_spec + opt_help + "\n");
+ opts.push_back (opt_spec + opt_help + "\n");
}
std::string help ("Options supported by ly:set-option\n\n");
opts.sort (string_compare);
- for (int i = 0; i < opts.size (); i++)
+ for (vsize i = 0; i < opts.size (); i++)
help += opts[i];
help += std::string ("\n");
char *suffixes[] = {"ly", "ps", "scm", 0 };
- Array<std::string> dirs;
+ std::vector<std::string> dirs;
for (char **s = suffixes; *s; s++)
{
std::string path = prefix_directory + to_string ('/') + std::string (*s);
- dirs.push (path);
+ dirs.push_back (path);
}
- dirs.push (prefix_directory + "/fonts/otf/");
- dirs.push (prefix_directory + "/fonts/type1/");
- dirs.push (prefix_directory + "/fonts/svg/");
+ dirs.push_back (prefix_directory + "/fonts/otf/");
+ dirs.push_back (prefix_directory + "/fonts/type1/");
+ dirs.push_back (prefix_directory + "/fonts/svg/");
- for (int i = 0; i < dirs.size (); i++)
+ for (vsize i = 0; i < dirs.size (); i++)
global_path.prepend (dirs[i]);
}
Rest_collision_engraver::process_acknowledged ()
{
if (rest_collision_
- || note_columns_.is_empty ()
+ || note_columns_.empty ()
|| !rest_count_
|| (note_columns_.size () == rest_count_
&& rest_count_ < 2))
rest_collision_ = make_item ("RestCollision", SCM_EOL);
- for (int i = 0; i < note_columns_.size (); i++)
+ for (vsize i = 0; i < note_columns_.size (); i++)
Rest_collision::add_column (rest_collision_, note_columns_[i]);
}
void
Rest_collision_engraver::acknowledge_note_column (Grob_info i)
{
- note_columns_.push (i.grob ());
+ note_columns_.push_back (i.grob ());
if (Note_column::has_rests (i.grob ()))
rest_count_++;
}
Link_array<Grob> rests;
Link_array<Grob> notes;
- for (int i = 0; i < elts.size (); i++)
+ for (vsize i = 0; i < elts.size (); i++)
{
Grob *e = elts[i];
if (unsmob_grob (e->get_object ("rest")))
if (st && unsmob_grob (st->get_object ("beam")))
continue;
- rests.push (e);
+ rests.push_back (e);
}
else
- notes.push (e);
+ notes.push_back (e);
}
/*
center one should be centered on the staff.
*/
Drul_array<Link_array<Grob> > ordered_rests;
- for (int i = 0; i < rests.size (); i++)
+ for (vsize i = 0; i < rests.size (); i++)
{
Grob *r = Note_column::get_rest (rests[i]);
Direction d = get_grob_direction (r);
if (d)
- ordered_rests[d].push (rests[i]);
+ ordered_rests[d].push_back (rests[i]);
else
rests[d]->warning (_ ("can't resolve rest collision: rest direction not set"));
}
common = common_refpoint_of_array (ordered_rests[UP], common, Y_AXIS);
Real diff
- = (ordered_rests[DOWN].top ()->extent (common, Y_AXIS)[UP]
- - ordered_rests[UP].top ()->extent (common, Y_AXIS)[DOWN]) / staff_space;
+ = (ordered_rests[DOWN].back ()->extent (common, Y_AXIS)[UP]
+ - ordered_rests[UP].back ()->extent (common, Y_AXIS)[DOWN]) / staff_space;
if (diff > 0)
{
int amount_down = (int) ceil (diff / 2);
diff -= amount_down;
- Note_column::translate_rests (ordered_rests[DOWN].top (),
+ Note_column::translate_rests (ordered_rests[DOWN].back (),
-2 * amount_down);
if (diff > 0)
- Note_column::translate_rests (ordered_rests[UP].top (),
+ Note_column::translate_rests (ordered_rests[UP].back (),
2 * int (ceil (diff)));
}
do
{
- for (int i = ordered_rests[d].size () -1; i-- > 0;)
+ for (vsize i = ordered_rests[d].size () -1; i-- > 0;)
{
Real last_y = ordered_rests[d][i + 1]->extent (common, Y_AXIS)[d];
Real y = ordered_rests[d][i]->extent (common, Y_AXIS)[-d];
Grob *rcol = 0;
Direction dir = CENTER;
- for (int i = rests.size (); !rcol && i--;)
+ for (vsize i = rests.size (); !rcol && i--;)
if (Note_column::dir (rests[i]))
{
dir = Note_column::dir (rests[i]);
Real minimum_dist = robust_scm2double (me->get_property ("minimum-distance"), 1.0) * staff_space;
Interval notedim;
- for (int i = 0; i < notes.size (); i++)
+ for (vsize i = 0; i < notes.size (); i++)
notedim.unite (notes[i]->extent (common, Y_AXIS));
Real dist
add_spacing_item (note_column_);
}
- for (int i = 0; i < rheads_.size (); i++)
+ for (vsize i = 0; i < rheads_.size (); i++)
{
if (!rheads_[i]->get_parent (X_AXIS))
Note_column::add_head (note_column_, rheads_[i]);
}
- rheads_.set_size (0);
+ rheads_.resize (0);
}
if (note_column_)
void
Rhythmic_column_engraver::acknowledge_rhythmic_head (Grob_info i)
{
- rheads_.push (i.grob ());
+ rheads_.push_back (i.grob ());
}
void
void
Score_engraver::announce_grob (Grob_info info)
{
- announce_infos_.push (info);
+ announce_infos_.push_back (info);
pscore_->root_system ()->typeset_grob (info.grob ());
- elems_.push (info.grob ());
+ elems_.push_back (info.grob ());
}
void
Score_engraver::typeset_all ()
{
- for (int i = 0; i < elems_.size (); i++)
+ for (vsize i = 0; i < elems_.size (); i++)
{
Grob *elem = elems_[i];
void
Score_performer::announce_element (Audio_element_info info)
{
- announce_infos_.push (info);
+ announce_infos_.push_back (info);
}
void
/* UGR, FIXME, these are default \layout blocks once again. They
suck. */
- for (int i = 0; !score_def && i < sc->defs_.size (); i++)
+ for (vsize i = 0; !score_def && i < sc->defs_.size (); i++)
if (sc->defs_[i]->c_variable ("is-layout") == SCM_BOOL_T)
score_def = sc->defs_[i];
? score->header_
: default_header;
- for (int i = 0; i < score->defs_.size (); i++)
+ for (vsize i = 0; i < score->defs_.size (); i++)
default_rendering (score->get_music (), score->defs_[i]->self_scm (),
default_paper, header, basename, key->self_scm ());
- if (score->defs_.is_empty ())
+ if (score->defs_.empty ())
{
default_rendering (score->get_music (),
default_layout,
Score *sc = (Score *) SCM_CELL_WORD_1 (s);
scm_gc_mark (sc->header_);
- for (int i = sc->defs_.size (); i--;)
+ for (vsize i = sc->defs_.size (); i--;)
scm_gc_mark (sc->defs_[i]->self_scm ());
return sc->music_;
}
else
music_ = SCM_EOL;
- for (int i = 0, n = s.defs_.size (); i < n; i++)
+ for (vsize i = 0, n = s.defs_.size (); i < n; i++)
{
Output_def *copy = s.defs_[i]->clone ();
- defs_.push (copy);
+ defs_.push_back (copy);
copy->unprotect ();
}
header_ = ly_make_anonymous_module (false);
void
Score::add_output_def (Output_def *def)
{
- defs_.push (def);
+ defs_.push_back (def);
}
{
if (scol_)
{
- for (int i = 0; i < scripts_.size (); i++)
+ for (vsize i = 0; i < scripts_.size (); i++)
if (Side_position_interface::get_axis (scripts_[i]) == Y_AXIS)
Script_column::add_staff_sided (scol_, scripts_[i]);
}
if (thing)
{
if (!Item::is_breakable (thing))
- scripts_.push (thing);
+ scripts_.push_back (thing);
}
}
Link_array<Grob> staff_sided;
extract_grob_set (me, "scripts", scripts);
- for (int i = 0; i < scripts.size (); i++)
+ for (vsize i = 0; i < scripts.size (); i++)
{
Grob *sc = scripts[i];
*/
if (sc->get_property_data (ly_symbol2scm ("X-offset")) !=
Side_position_interface::x_aligned_side_proc)
- staff_sided.push (sc);
+ staff_sided.push_back (sc);
}
- for (int i = 0; i < staff_sided.size (); i++)
+ for (vsize i = 0; i < staff_sided.size (); i++)
{
Grob *g = staff_sided[i];
Direction d = get_grob_direction (g);
class Script_engraver : public Engraver
{
- Array<Script_tuple> scripts_;
+ std::vector<Script_tuple> scripts_;
Spanner *slur_;
protected:
Script_tuple t;
t.event_ = m;
- scripts_.push (t);
+ scripts_.push_back (t);
return true;
}
return false;
void
Script_engraver::process_music ()
{
- for (int i = 0; i < scripts_.size (); i++)
+ for (vsize i = 0; i < scripts_.size (); i++)
{
Music *music = scripts_[i].event_;
{
if (info.music_cause ())
{
- for (int i = 0; i < scripts_.size (); i++)
+ for (vsize i = 0; i < scripts_.size (); i++)
{
Grob *e = scripts_[i].script_;
As the note head to put it on is not known now, postpone this
decision to Script_interface::calc_direction (). */
- for (int i = 0; i < scripts_.size (); i++)
+ for (vsize i = 0; i < scripts_.size (); i++)
{
Grob *e = scripts_[i].script_;
Real padding = robust_scm2double (me->get_property ("padding"), 0.1);
extract_grob_set (me, "elements", elts);
- for (int i = elts.size ();
+ for (vsize i = elts.size ();
i-- > 1;)
{
Item *r = dynamic_cast<Item *> (elts[i]);
sep_span_->set_bound (RIGHT, unsmob_grob (ccol));
sep_span_ = 0;
- for (int i = 0; i < last_spacings_.note_spacings_.size (); i++)
+ for (vsize i = 0; i < last_spacings_.note_spacings_.size (); i++)
{
Pointer_group_interface::add_grob (last_spacings_.note_spacings_[i],
ly_symbol2scm ("right-items"),
if (Note_spacing::has_interface (it))
{
- current_spacings_.note_spacings_.push (it);
+ current_spacings_.note_spacings_.push_back (it);
return;
}
Paper_column *pc = item->get_column ();
extract_grob_set (me, "conditional-elements", elts);
- for (int i = 0; i < elts.size (); i++)
+ for (vsize i = 0; i < elts.size (); i++)
{
Item *il = dynamic_cast<Item *> (elts[i]);
if (pc != il->get_column ())
Interval w;
extract_grob_set (me, "elements", elts);
- for (int i = 0; i < elts.size (); i++)
+ for (vsize i = 0; i < elts.size (); i++)
{
Item *il = dynamic_cast<Item *> (elts[i]);
if (pc != il->get_column ())
Grob *last_grob = 0;
extract_grob_set (me, "elements", elts);
- for (int i = elts.size (); i--;)
+ for (vsize i = elts.size (); i--;)
{
Grob *break_item = elts[i];
if (!scm_is_symbol (break_item->get_property ("break-align-symbol")))
dim.unite (staff_extents);
}
- for (int i = 0; i < support.size (); i++)
+ for (vsize i = 0; i < support.size (); i++)
{
Grob *e = support[i];
if (e)
else
spacer.my_solve_linelen ();
- Array<Real> posns;
- posns.push (0.0);
- for (int i = 0; i < spacer.springs_.size (); i++)
+ std::vector<Real> posns;
+ posns.push_back (0.0);
+ for (vsize i = 0; i < spacer.springs_.size (); i++)
{
Real l = spacer.springs_[i].length ((is_ragged) ? 0.0 : spacer.force_);
- posns.push (posns.top () + l);
+ posns.push_back (posns.back () + l);
}
SCM force_return = SCM_BOOL_F;
force_return = scm_from_double (spacer.force_);
if (is_ragged
- && posns.top () > spacer.line_len_)
+ && posns.back () > spacer.line_len_)
force_return = SCM_BOOL_F;
SCM retval = SCM_EOL;
- for (int i = posns.size (); i--;)
+ for (vsize i = posns.size (); i--;)
retval = scm_cons (scm_from_double (posns[i]), retval);
retval = scm_cons (force_return, retval);
Simple_spacer::active_blocking_force () const
{
Real bf = -infinity_f;
- for (int i = 0; i < springs_.size (); i++)
+ for (vsize i = 0; i < springs_.size (); i++)
if (springs_[i].is_active_)
bf = max (bf, springs_[i].block_force_);
return bf;
Real max_block_force = -infinity_f;
int max_i = -1;
- for (int i = 0; i < springs_.size (); i++)
+ for (vsize i = 0; i < springs_.size (); i++)
{
if (springs_[i].block_force_ > max_block_force)
{
Simple_spacer::set_active_states ()
{
/* float comparison is safe, since force is only copied. */
- for (int i = 0; i < springs_.size (); i++)
+ for (vsize i = 0; i < springs_.size (); i++)
if (springs_[i].is_active_
&& springs_[i].block_force_ >= force_)
{
Simple_spacer::configuration_length () const
{
Real l = 0.;
- for (int i = 0; i < springs_.size (); i++)
+ for (vsize i = 0; i < springs_.size (); i++)
l += springs_[i].length (force_);
return l;
We used to have a penalty for compression, no matter what, but that
fucked up wtk1-fugue2 (taking 3 full pages.)
*/
- positions->config_.push (spacer_->indent_);
- for (int i = 0; i < spacer_->springs_.size (); i++)
+ positions->config_.push_back (spacer_->indent_);
+ for (vsize i = 0; i < spacer_->springs_.size (); i++)
{
Real l = spacer_->springs_[i].length ((ragged) ? 0.0 : spacer_->force_);
- positions->config_.push (positions->config_.top () + l);
+ positions->config_.push_back (positions->config_.back () + l);
/*
we have l>= 0 here, up to rounding errors
*/
if (ragged)
{
positions->satisfies_constraints_
- = positions->config_.top () < spacer_->line_len_;
+ = positions->config_.back () < spacer_->line_len_;
}
else
positions->satisfies_constraints_ = spacer_->is_active ();
active_count_++;
}
- springs_.push (desc);
+ springs_.push_back (desc);
}
static int
Link_array<Grob> cols (icols);
cols.clear ();
- for (int i = 0; i < icols.size (); i++)
+ for (vsize i = 0; i < icols.size (); i++)
if (scm_is_pair (icols[i]->get_object ("between-cols")))
- loose_cols_.push (icols[i]);
+ loose_cols_.push_back (icols[i]);
else
- cols.push (icols[i]);
+ cols.push_back (icols[i]);
spaced_cols_ = cols;
- for (int i = 0; i < cols.size () - 1; i++)
+ for (vsize i = 0; i < cols.size () - 1; i++)
{
Spring_smob *spring = 0;
spacer_->add_spring (ideal, inverse_hooke);
}
- for (int i = 0; i < cols.size () - 1; i++)
+ for (vsize i = 0; i < cols.size () - 1; i++)
{
for (SCM s = Spaceable_grob::get_minimum_distances (cols[i]);
scm_is_pair (s); s = scm_cdr (s))
skyline[...].width_ forms a partition of the real interval, where
the segments are adjacent, and ascending. Hence we have
- skyline.top ().width_[RIGHT] = inf
+ skyline.back ().width_[RIGHT] = inf
skyline[0].width_[LEFT] = -inf
*/
binsearch.
*/
void
-insert_extent_into_skyline (Array<Skyline_entry> *line, Box b, Axis line_axis,
+insert_extent_into_skyline (std::vector<Skyline_entry> *line, Box b, Axis line_axis,
Direction d)
{
Interval extent = b[line_axis];
/*
Intersect each segment of LINE with EXTENT, and if non-empty, insert relevant segments.
*/
- for (int i = line->size (); i--;)
+ for (vsize i = line->size (); i--;)
{
Interval w = line->elem (i).width_;
w.intersect (extent);
}
void
-merge_skyline (Array<Skyline_entry> *a1,
- Array<Skyline_entry> const &a2,
+merge_skyline (std::vector<Skyline_entry> *a1,
+ std::vector<Skyline_entry> const &a2,
Direction dir)
{
- for (int i = 0; i < a2.size (); i++)
+ for (vsize i = 0; i < a2.size (); i++)
{
Box b;
b[X_AXIS] = a2[i].width_;
}
}
-Array<Skyline_entry>
+std::vector<Skyline_entry>
empty_skyline (Direction d)
{
- Array<Skyline_entry> skyline;
+ std::vector<Skyline_entry> skyline;
Interval i;
i.set_empty ();
Skyline_entry e;
e.width_ = i;
e.height_ = -d * infinity_f;
- skyline.push (e);
+ skyline.push_back (e);
return skyline;
}
-Array<Skyline_entry>
-extents_to_skyline (Array<Box> const &extents, Axis a, Direction d)
+std::vector<Skyline_entry>
+extents_to_skyline (std::vector<Box> const &extents, Axis a, Direction d)
{
- Array<Skyline_entry> skyline = empty_skyline (d);
+ std::vector<Skyline_entry> skyline = empty_skyline (d);
/*
This makes a cubic algorithm (array insertion is O (n),
We could do a lot better (n log (n), using a balanced tree) but
that seems overkill for now.
*/
- for (int j = extents.size (); j--;)
+ for (vsize j = extents.size (); j--;)
insert_extent_into_skyline (&skyline, extents[j], a, d);
return skyline;
This is an O (n) algorithm.
*/
Real
-skyline_meshing_distance (Array<Skyline_entry> const &buildings,
- Array<Skyline_entry> const &clouds)
+skyline_meshing_distance (std::vector<Skyline_entry> const &buildings,
+ std::vector<Skyline_entry> const &clouds)
{
int i = buildings.size () -1;
int j = clouds.size () -1;
}
void
-heighten_skyline (Array<Skyline_entry> *buildings, Real ground)
+heighten_skyline (std::vector<Skyline_entry> *buildings, Real ground)
{
- for (int i = 0; i < buildings->size (); i++)
+ for (vsize i = 0; i < buildings->size (); i++)
buildings->elem_ref (i).height_ += ground;
}
Real
-skyline_height (Array<Skyline_entry> const &buildings,
+skyline_height (std::vector<Skyline_entry> const &buildings,
Real airplane,
Direction sky_dir)
{
/*
Ugh! linear, should be O(log n).
*/
- for (int i = 0; i < buildings.size (); i++)
+ for (vsize i = 0; i < buildings.size (); i++)
if (buildings[i].width_.contains (airplane))
h = sky_dir * max (sky_dir * h,
sky_dir * buildings[i].height_);
Bezier bez)
{
Offset horiz (1, 0);
- Array<Real> ts = bez.solve_derivative (horiz);
+ std::vector<Real> ts = bez.solve_derivative (horiz);
/* TODO: handle case of broken slur. */
- if (!ts.is_empty ()
+ if (!ts.empty ()
&& (state.extremes_[LEFT].staff_ == state.extremes_[RIGHT].staff_)
&& state.extremes_[LEFT].staff_ && state.extremes_[RIGHT].staff_)
{
Real
fit_factor (Offset dz_unit, Offset dz_perp,
- Bezier curve, Direction d, Array<Offset> const &avoid)
+ Bezier curve, Direction d, std::vector<Offset> const &avoid)
{
Real fit_factor = 0.0;
Offset x0 = curve.control_[0];
curve_xext.add_point (curve.control_[0][X_AXIS]);
curve_xext.add_point (curve.control_[3][X_AXIS]);
- for (int i = 0; i < avoid.size (); i++)
+ for (vsize i = 0; i < avoid.size (); i++)
{
Offset z = (avoid[i] - x0);
Offset p (dot_product (z, dz_unit),
void
Slur_configuration::generate_curve (Slur_score_state const &state,
Real r_0, Real h_inf,
- Array<Offset> const &avoid)
+ std::vector<Offset> const &avoid)
{
Offset dz = attachment_[RIGHT]- attachment_[LEFT];;
Offset dz_unit = dz;
Distances for heads that are between slur and line between
attachment points.
*/
- Array<Real> convex_head_distances;
- for (int j = 0; j < state.encompass_infos_.size (); j++)
+ std::vector<Real> convex_head_distances;
+ for (vsize j = 0; j < state.encompass_infos_.size (); j++)
{
Real x = state.encompass_infos_[j].x_;
if (state.dir_ * head_dy < 0)
{
demerit += state.parameters_.head_encompass_penalty_;
- convex_head_distances.push (0.0);
+ convex_head_distances.push_back (0.0);
}
else
{
= state.dir_ * max (state.dir_ * state.encompass_infos_[j].get_point (state.dir_), state.dir_ * line_y);
Real d = fabs (closest - y);
- convex_head_distances.push (d);
+ convex_head_distances.push_back (d);
}
}
{
Real avg_distance = 0.0;
Real min_dist = infinity_f;
- for (int j = 0; j < convex_head_distances.size (); j++)
+ for (vsize j = 0; j < convex_head_distances.size (); j++)
{
min_dist = min (min_dist, convex_head_distances[j]);
avg_distance += convex_head_distances[j];
Slur_configuration::score_extra_encompass (Slur_score_state const &state)
{
Real demerit = 0.0;
- for (int j = 0; j < state.extra_encompass_infos_.size (); j++)
+ for (vsize j = 0; j < state.extra_encompass_infos_.size (); j++)
{
Drul_array<Offset> attachment = attachment_;
Extra_collision_info const &info (state.extra_encompass_infos_[j]);
Slur_engraver::acknowledge_note_column (Grob_info info)
{
Grob *e = info.grob ();
- for (int i = slurs_.size (); i--;)
+ for (vsize i = slurs_.size (); i--;)
Slur::add_column (slurs_[i], e);
- for (int i = end_slurs_.size (); i--;)
+ for (vsize i = end_slurs_.size (); i--;)
Slur::add_column (end_slurs_[i], e);
}
void
Slur_engraver::acknowledge_extra_object (Grob_info info)
{
- if (slurs_.is_empty ()
- && end_slurs_.is_empty ())
+ if (slurs_.empty () && end_slurs_.empty ())
return ;
Grob *e = info.grob ();
if (Tie::has_interface (e)
|| avoid == ly_symbol2scm ("inside"))
{
- for (int i = slurs_.size (); i--;)
+ for (vsize i = slurs_.size (); i--;)
Slur::add_extra_encompass (slurs_[i], e);
- for (int i = end_slurs_.size (); i--;)
+ for (vsize i = end_slurs_.size (); i--;)
Slur::add_extra_encompass (end_slurs_[i], e);
}
else if (avoid == ly_symbol2scm ("outside")
slurs_.clear ();
}
- if (events_[START] && slurs_.is_empty ())
+ if (events_[START] && slurs_.empty ())
{
Music *ev = events_[START];
if (updown && !double_slurs)
set_grob_direction (slur, updown);
- slurs_.push (slur);
+ slurs_.push_back (slur);
if (double_slurs)
{
set_grob_direction (slur, DOWN);
slur = make_spanner ("Slur", events_[START]->self_scm ());
set_grob_direction (slur, UP);
- slurs_.push (slur);
+ slurs_.push_back (slur);
}
}
set_melisma (slurs_.size ());
columns_
= internal_extract_grob_array (me, ly_symbol2scm ("note-columns"));
- if (columns_.is_empty ())
+ if (columns_.empty ())
{
me->suicide ();
return;
= get_y_attachment_range ();
configurations_ = enumerate_attachments (end_ys);
- for (int i = 0; i < columns_.size (); i++)
- encompass_infos_.push (get_encompass_info (columns_[i]));
+ for (vsize i = 0; i < columns_.size (); i++)
+ encompass_infos_.push_back (get_encompass_info (columns_[i]));
extra_encompass_infos_ = get_extra_encompass_infos ();
valid_ = true;
else
#endif
{
- for (int i = 0; i < configurations_.size (); i++)
+ for (vsize i = 0; i < configurations_.size (); i++)
configurations_[i]->score (*this);
- for (int i = 0; i < configurations_.size (); i++)
+ for (vsize i = 0; i < configurations_.size (); i++)
{
if (configurations_[i]->score_ < opt)
{
int opt_idx = -1;
Real mindist = 1e6;
- for (int i = 0; i < configurations_.size (); i++)
+ for (vsize i = 0; i < configurations_.size (); i++)
{
Real d = fabs (configurations_[i]->attachment_[LEFT][Y_AXIS] - ins[LEFT])
+ fabs (configurations_[i]->attachment_[RIGHT][Y_AXIS] - ins[RIGHT]);
x = extremes_[d].bound_->extent (common_[X_AXIS], X_AXIS)[d];
else
x = slur_->get_broken_left_end_align ();
- Grob *col = (d == LEFT) ? columns_[0] : columns_.top ();
+ Grob *col = (d == LEFT) ? columns_[0] : columns_.back ();
if (extremes_[-d].bound_ != col)
{
return y;
}
-Array<Offset>
+std::vector<Offset>
Slur_score_state::generate_avoid_offsets () const
{
- Array<Offset> avoid;
+ std::vector<Offset> avoid;
Link_array<Grob> encompasses = columns_;
- for (int i = 0; i < encompasses.size (); i++)
+ for (vsize i = 0; i < encompasses.size (); i++)
{
if (extremes_[LEFT].note_column_ == encompasses[i]
|| extremes_[RIGHT].note_column_ == encompasses[i])
Encompass_info inf (get_encompass_info (encompasses[i]));
Real y = dir_ * (max (dir_ * inf.head_, dir_ * inf.stem_));
- avoid.push (Offset (inf.x_, y + dir_ * parameters_.free_head_distance_));
+ avoid.push_back (Offset (inf.x_, y + dir_ * parameters_.free_head_distance_));
}
extract_grob_set (slur_, "encompass-objects", extra_encompasses);
- for (int i = 0; i < extra_encompasses.size (); i++)
+ for (vsize i = 0; i < extra_encompasses.size (); i++)
{
if (Slur::has_interface (extra_encompasses[i]))
{
small_slur->relative_coordinate (common_[Y_AXIS], Y_AXIS));
z[Y_AXIS] += dir_ * parameters_.free_slur_distance_;
- avoid.push (z);
+ avoid.push_back (z);
}
else if (extra_encompasses[i]->get_property ("avoid-slur") == ly_symbol2scm ("inside"))
{
if (!xe.is_empty ()
&& !ye.is_empty ())
- avoid.push (Offset (xe.center(), ye[dir_]));
+ avoid.push_back (Offset (xe.center(), ye[dir_]));
}
}
return avoid;
Real r_0 = robust_scm2double (slur_->get_property ("ratio"), 0.33);
Real h_inf = staff_space_ * scm_to_double (slur_->get_property ("height-limit"));
- Array<Offset> avoid = generate_avoid_offsets ();
- for (int i = 0; i < configurations_.size (); i++)
+ std::vector<Offset> avoid = generate_avoid_offsets ();
+ for (vsize i = 0; i < configurations_.size (); i++)
configurations_[i]->generate_curve (*this, r_0, h_inf, avoid);
}
s.attachment_ = os;
s.index_ = scores.size ();
- scores.push (new Slur_configuration (s));
+ scores.push_back (new Slur_configuration (s));
os[RIGHT][Y_AXIS] += dir_ * staff_space_ / 2;
}
return scores;
}
-Array<Extra_collision_info>
+std::vector<Extra_collision_info>
Slur_score_state::get_extra_encompass_infos () const
{
extract_grob_set (slur_, "encompass-objects", encompasses);
- Array<Extra_collision_info> collision_infos;
- for (int i = encompasses.size (); i--;)
+ std::vector<Extra_collision_info> collision_infos;
+ for (vsize i = encompasses.size (); i--;)
{
if (Slur::has_interface (encompasses[i]))
{
xext,
yext,
parameters_.extra_object_collision_penalty_);
- collision_infos.push (info);
+ collision_infos.push_back (info);
}
}
else
ye.widen (thickness_ * 0.5);
xe.widen (thickness_ * 1.0);
Extra_collision_info info (g, xp, xe, ye, penalty);
- collision_infos.push (info);
+ collision_infos.push_back (info);
}
}
Grob *me = unsmob_grob (smob);
extract_grob_set (me, "note-columns", encompasses);
- if (encompasses.is_empty ())
+ if (encompasses.empty ())
{
me->suicide ();
return SCM_BOOL_F;
}
Direction d = DOWN;
- for (int i = 0; i < encompasses.size (); i++)
+ for (vsize i = 0; i < encompasses.size (); i++)
{
if (Note_column::dir (encompasses[i]) < 0)
{
// FIXME uncached
Stencil *m = me->get_stencil ();
- return m ? ly_interval2scm (m->extent (Y_AXIS)) : ly_interval2scm (Interval ());
+ return m ? ly_interval2scm (m->extent (Y_AXIS))
+ : ly_interval2scm (Interval ());
}
/*
{
Grob *me = unsmob_grob (smob);
extract_grob_set (me, "note-columns", encompasses);
- if (encompasses.is_empty ())
+ if (encompasses.empty ())
{
me->suicide ();
return SCM_EOL;
length_ = 0;
int c;
- Array<char> chs; // ugh.
+#if STD_VECTOR
+ std::vector<char> &chs = *new std::vector<char>; // ugh. ugh.
+#else
+ std::vector<char> chs; // ugh.
+#endif
+
while ((c = fgetc (stdin)) != EOF)
- chs.push (c);
+ chs.push_back (c);
- chs.push (0);
+ chs.push_back (0);
length_ = chs.size ();
contents_str0_ = chs.remove_array ();
}
for (int i = 0; i < length_; i++)
if (contents_str0_[i] == '\n')
- newline_locations_.push (contents_str0_ + i);
+ newline_locations_.push_back (contents_str0_ + i);
}
Source_file::Source_file (std::string filename_string)
for (int i = 0; i < length_; i++)
if (contents_str0_[i] == '\n')
- newline_locations_.push (contents_str0_ + i);
+ newline_locations_.push_back (contents_str0_ + i);
}
void
such a borderline case.)
*/
- if (lns.is_empty () || rns.is_empty ())
+ if (lns.empty () || rns.empty ())
return false;
Item *l_neighbor = dynamic_cast<Item *> (lns[0]);
in any case, we don't want to move bar lines.
*/
extract_grob_set (c, "elements", elts);
- for (int i = elts.size (); i--;)
+ for (vsize i = elts.size (); i--;)
{
Grob *g = elts[i];
if (g && Break_align_interface::has_interface (g))
{
extract_grob_set (g, "elements", gelts);
- for (int j = gelts.size (); j--;)
+ for (vsize j = gelts.size (); j--;)
{
Grob *h = gelts[j];
{
Link_array<Grob> newcols;
- for (int i = 0; i < cols->size (); i++)
+ for (vsize i = 0; i < cols->size (); i++)
{
Grob *c = cols->elem (i);
extract_grob_set (c, "right-neighbors", rns_arr);
extract_grob_set (c, "left-neighbors", lns_arr);
- SCM lns = lns_arr.size () ? lns_arr.top ()->self_scm () : SCM_BOOL_F;
- SCM rns = rns_arr.size () ? rns_arr.top ()->self_scm () : SCM_BOOL_F;
+ SCM lns = lns_arr.size () ? lns_arr.back ()->self_scm () : SCM_BOOL_F;
+ SCM rns = rns_arr.size () ? rns_arr.back ()->self_scm () : SCM_BOOL_F;
/*
Either object can be non existent, if the score ends
Item *rc = dynamic_cast<Item *> (d == LEFT ? c : next_door[RIGHT]);
extract_grob_set (lc, "spacing-wishes", wishes);
- for (int k = wishes.size (); k--;)
+ for (vsize k = wishes.size (); k--;)
{
Grob *sp = wishes[k];
if (Note_spacing::left_column (sp) != lc
r.add_to_cols ();
}
else
- newcols.push (c);
+ newcols.push_back (c);
}
*cols = newcols;
void
Spacing_spanner::set_explicit_neighbor_columns (Link_array<Grob> const &cols)
{
- for (int i = 0; i < cols.size (); i++)
+ for (vsize i = 0; i < cols.size (); i++)
{
SCM right_neighbors = Grob_array::make_array ();
Grob_array *rn_arr = unsmob_grob_array (right_neighbors);
int min_rank = 100000; // inf.
extract_grob_set (cols[i], "spacing-wishes", wishes);
- for (int k = wishes.size (); k--;)
+ for (vsize k = wishes.size (); k--;)
{
Item *wish = dynamic_cast<Item *> (wishes[k]);
extract_grob_set (rc, "left-neighbors", lns_arr);
if (lns_arr.size ())
{
- Item *it = dynamic_cast<Item *> (lns_arr.top ());
+ Item *it = dynamic_cast<Item *> (lns_arr.back ());
maxrank = Paper_column::get_rank (it->get_column ());
}
void
Spacing_spanner::set_implicit_neighbor_columns (Link_array<Grob> const &cols)
{
- for (int i = 0; i < cols.size (); i++)
+ for (vsize i = 0; i < cols.size (); i++)
{
Item *it = dynamic_cast<Item *> (cols[i]);
if (!Item::is_breakable (it) && !Paper_column::is_musical (it))
sloppy with typing left/right-neighbors should take list, but paper-column found instead.
*/
extract_grob_set (cols[i], "left-neighbors", lns);
- if (lns.is_empty () && i)
+ if (lns.empty () && i)
{
SCM ga_scm = Grob_array::make_array ();
Grob_array *ga = unsmob_grob_array (ga_scm);
cols[i]->set_object ("left-neighbors", ga_scm);
}
extract_grob_set (cols[i], "right-neighbors", rns);
- if (rns.is_empty () && i < cols.size () - 1)
+ if (rns.empty () && i < cols.size () - 1)
{
SCM ga_scm = Grob_array::make_array ();
Grob_array *ga = unsmob_grob_array (ga_scm);
class Spacing_engraver : public Engraver
{
PQueue<Rhythmic_tuple> playing_durations_;
- Array<Rhythmic_tuple> now_durations_;
- Array<Rhythmic_tuple> stopped_durations_;
+ std::vector<Rhythmic_tuple> now_durations_;
+ std::vector<Rhythmic_tuple> stopped_durations_;
Moment now_;
Spanner *spacing_;
{
Moment len = r->get_length ();
Rhythmic_tuple t (i, now_mom () + len);
- now_durations_.push (t);
+ now_durations_.push_back (t);
}
}
}
Moment shortest_playing;
shortest_playing.set_infinite (1);
- for (int i = 0; i < playing_durations_.size (); i++)
+ for (vsize i = 0; i < playing_durations_.size (); i++)
{
Music *mus = playing_durations_[i].info_.music_cause ();
if (mus)
Moment starter;
starter.set_infinite (1);
- for (int i = 0; i < now_durations_.size (); i++)
+ for (vsize i = 0; i < now_durations_.size (); i++)
{
Moment m = now_durations_[i].info_.music_cause ()->get_length ();
if (m.to_bool ())
while (playing_durations_.size () && playing_durations_.front ().end_ < now_)
playing_durations_.delmin ();
while (playing_durations_.size () && playing_durations_.front ().end_ == now_)
- stopped_durations_.push (playing_durations_.get ());
+ stopped_durations_.push_back (playing_durations_.get ());
}
ADD_ACKNOWLEDGER (Spacing_engraver, staff_spacing);
if (!left->get_system ())
left = left->find_prebroken_piece (RIGHT);
- clique.push (left);
+ clique.push_back (left);
}
- clique.push (loose);
+ clique.push_back (loose);
divide_over++;
loose = right = re->get_column ();
if (!right->get_system ())
right = right->find_prebroken_piece (LEFT);
- clique.push (right);
+ clique.push_back (right);
Grob *common = right->common_refpoint (left, X_AXIS);
- Item *finished_right_column = clique.top ();
+ Item *finished_right_column = clique.back ();
- for (int j = clique.size () - 2; j > 0; j--)
+ for (vsize j = clique.size () - 2; j > 0; j--)
{
int count = 0;
Real total_space = 0.0;
Real total_fixed = 0.0;
extract_grob_set (col, "spacing-wishes", wishes);
- for (int i = 0; i < wishes.size (); i++)
+ for (vsize i = 0; i < wishes.size (); i++)
{
Grob *spacing = wishes[i];
Real space = 0.0;
/*
ascending in duration
*/
- Array<Rational> durations;
- Array<int> counts;
+ std::vector<Rational> durations;
+ std::vector<int> counts;
Rational shortest_in_measure;
shortest_in_measure.set_infinite (1);
- for (int i = 0; i < cols.size (); i++)
+ for (vsize i = 0; i < cols.size (); i++)
{
if (Paper_column::is_musical (cols[i]))
{
else if (!shortest_in_measure.is_infinity ()
&& Item::is_breakable (cols[i]))
{
- int j = 0;
+ vsize j = 0;
for (; j < durations.size (); j++)
{
if (durations[j] > shortest_in_measure)
if (durations.size () == j)
{
- durations.push (shortest_in_measure);
- counts.push (1);
+ durations.push_back (shortest_in_measure);
+ counts.push_back (1);
}
shortest_in_measure.set_infinite (1);
int max_idx = -1;
int max_count = 0;
- for (int i = durations.size (); i--;)
+ for (vsize i = durations.size (); i--;)
{
if (counts[i] >= max_count)
{
{
Paper_column *next = 0;
Paper_column *next_next = 0;
- for (int i = cols.size (); i--;)
+ for (vsize i = cols.size (); i--;)
{
Paper_column *col = dynamic_cast<Paper_column *> (cols[i]);
if (next)
happens after the current note (this is set in the grob
property SPACING-SEQUENCE.
*/
- for (int i = 0; i < neighbors.size (); i++)
+ for (vsize i = 0; i < neighbors.size (); i++)
{
Grob *wish = neighbors[i];
{
extract_grob_set (l, "spacing-wishes", wishes);
- for (int i = 0; i < wishes.size (); i++)
+ for (vsize i = 0; i < wishes.size (); i++)
{
Item *spacing_grob = dynamic_cast<Item *> (wishes[i]);
Span_arpeggio_engraver::acknowledge_arpeggio (Grob_info info)
{
if (info.origin_contexts (this).size ()) // huh? what's this test for?
- arpeggios_.push (info.grob ());
+ arpeggios_.push_back (info.grob ());
}
void
we do this very late, to make sure we also catch `extra'
side-pos support like accidentals.
*/
- for (int j = 0; j < arpeggios_.size (); j++)
+ for (vsize j = 0; j < arpeggios_.size (); j++)
{
extract_grob_set (arpeggios_[j], "stems", stems);
- for (int i = stems.size (); i--;)
+ for (vsize i = stems.size (); i--;)
Pointer_group_interface::add_grob (span_arpeggio_, ly_symbol2scm ("stems"),
stems[i]);
extract_grob_set (arpeggios_[j], "side-support-elements", sses);
- for (int i = sses.size (); i--;)
+ for (vsize i = sses.size (); i--;)
Pointer_group_interface::add_grob (span_arpeggio_, ly_symbol2scm ("side-support-elements"),
sses[i]);
if (depth && Bar_line::has_interface (i.grob ()))
{
Item *it = dynamic_cast<Item *> (i.grob ());
- bars_.push (it);
+ bars_.push_back (it);
if (bars_.size () >= 2 && !spanbar_)
{
{
if (spanbar_)
{
- for (int i = 0; i < bars_.size (); i++)
+ for (vsize i = 0; i < bars_.size (); i++)
Span_bar::add_bar (spanbar_, bars_[i]);
SCM vissym = ly_symbol2scm ("break-visibility");
spanbar_ = 0;
}
- bars_.set_size (0);
+ bars_.resize (0);
}
#include "translator.icc"
std::string glyph_string = ly_scm2string (glyph);
/* compose span_bar_mol */
- Array<Interval> extents;
+ std::vector<Interval> extents;
Grob *model_bar = 0;
- for (int i = elements.size (); i--;)
+ for (vsize i = elements.size (); i--;)
{
Grob *bar = elements[i];
Interval ext = bar->extent (refp, Y_AXIS);
if (ext.is_empty ())
continue;
- extents.push (ext);
+ extents.push_back (ext);
model_bar = bar;
}
extents.sort (&Interval::left_comparison);
Stencil span_bar;
- for (int i = 1; i < extents.size (); i++)
+ for (vsize i = 1; i < extents.size (); i++)
{
Interval prev_extent = extents[i - 1];
Interval ext = extents[i];
{
Grob *me = unsmob_grob (smob);
extract_grob_set (me, "elements", elements);
- if (elements.is_empty ())
+ if (elements.empty ())
me->suicide ();
return SCM_UNSPECIFIED;
Grob *me = unsmob_grob (smob);
extract_grob_set (me, "elements", elements);
SCM gl = SCM_EOL;
- for (int i = elements.size ();
+ for (vsize i = elements.size ();
i-- && !scm_is_string (gl);)
gl = elements[i]->get_property ("glyph-name");
Real last_volume_;
Music *span_start_event_;
Drul_array<Music *> span_events_;
- Array<Audio_dynamic_tuple> dynamic_tuples_;
- Array<Audio_dynamic_tuple> finished_dynamic_tuples_;
+ std::vector<Audio_dynamic_tuple> dynamic_tuples_;
+ std::vector<Audio_dynamic_tuple> finished_dynamic_tuples_;
Direction dir_;
Direction finished_dir_;
};
: span_events_[STOP]);
announce_element (info);
Audio_dynamic_tuple a = { audio_, now_mom () };
- dynamic_tuples_.push (a);
+ dynamic_tuples_.push_back (a);
}
if (span_events_[STOP])
dynamic_tuples_.clear ();
Audio_dynamic_tuple a = { audio_, now_mom () };
- dynamic_tuples_.push (a);
+ dynamic_tuples_.push_back (a);
}
if (span_events_[STOP])
- finished_dynamic_tuples_.top ().audio_->volume_ = last_volume_;
+ finished_dynamic_tuples_.back ().audio_->volume_ = last_volume_;
if (span_events_[START])
dynamic_tuples_[0].audio_->volume_ = last_volume_;
if (finished_dynamic_tuples_.size () > 1)
{
Real start_volume = finished_dynamic_tuples_[0].audio_->volume_;
- Real dv = finished_dynamic_tuples_.top ().audio_->volume_
+ Real dv = finished_dynamic_tuples_.back ().audio_->volume_
- start_volume;
/*
urg.
// urg. 20%: about two volume steps
dv = (Real)finished_dir_ * 0.2;
if (!start_volume)
- start_volume = finished_dynamic_tuples_.top
- ().audio_->volume_ - dv;
+ start_volume = finished_dynamic_tuples_.back ().audio_->volume_
+ - dv;
}
Moment start_mom = finished_dynamic_tuples_[0].mom_;
- Moment dt = finished_dynamic_tuples_.top ().mom_ - start_mom;
- for (int i = 0; i < finished_dynamic_tuples_.size (); i++)
+ Moment dt = finished_dynamic_tuples_.back ().mom_ - start_mom;
+ for (vsize i = 0; i < finished_dynamic_tuples_.size (); i++)
{
Audio_dynamic_tuple *a = &finished_dynamic_tuples_[i];
Real volume = start_volume + dv * (Real) (a->mom_ - start_mom).main_part_
assert (span->get_system ());
span->get_system ()->typeset_grob (span);
- broken_intos_.push (span);
+ broken_intos_.push_back (span);
}
}
while ((flip (&d)) != LEFT);
Link_array<Item> break_points = root->broken_col_range (left, right);
break_points.insert (left, 0);
- break_points.push (right);
+ break_points.push_back (right);
- for (int i = 1; i < break_points.size (); i++)
+ for (vsize i = 1; i < break_points.size (); i++)
{
Drul_array<Item *> bounds;
bounds[LEFT] = break_points[i - 1];
else
{
bounds[LEFT]->get_system ()->typeset_grob (span);
- broken_intos_.push (span);
+ broken_intos_.push_back (span);
}
}
}
broken_intos_.sort (Spanner::compare);
- for (int i = broken_intos_.size ();i--;)
+ for (vsize i = broken_intos_.size ();i--;)
broken_intos_[i]->break_index_ = i;
}
while (flip (&d) != LEFT)
;
- for (int i = broken_intos_.size (); i--;)
+ for (vsize i = broken_intos_.size (); i--;)
scm_gc_mark (broken_intos_[i]->self_scm ());
}
*compound_space = 0.0;
int wish_count = 0;
- for (int i = right_items.size (); i--;)
+ for (vsize i = right_items.size (); i--;)
{
Grob *g = right_items[i];
wish_count ++;
extract_grob_set (g, "elements", elts);
- for (int j = elts.size (); j--;)
+ for (vsize j = elts.size (); j--;)
{
Real space = 0.0;
Real fixed = 0.0;
Item *me_item = dynamic_cast<Item *> (me);
extract_grob_set (me, "left-items", items);
- for (int i = items.size (); i--;)
+ for (vsize i = items.size (); i--;)
{
Grob *cand = items[i];
if (cand && Separation_item::has_interface (cand))
Stanza_number_align_engraver::acknowledge_lyric_syllable (Grob_info gi)
{
Grob *h = gi.grob ();
- lyrics_.push (h);
+ lyrics_.push_back (h);
}
void
Stanza_number_align_engraver::acknowledge_stanza_number (Grob_info gi)
{
Grob *h = gi.grob ();
- stanza_numbers_.push (h);
+ stanza_numbers_.push_back (h);
}
void
Stanza_number_align_engraver::stop_translation_timestep ()
{
- for (int i = lyrics_.size (); i--;)
- for (int j = stanza_numbers_.size (); j--;)
+ for (vsize i = lyrics_.size (); i--;)
+ for (vsize j = stanza_numbers_.size (); j--;)
Side_position_interface::add_support (stanza_numbers_[j], lyrics_[i]);
stanza_numbers_.clear ();
Drul_array<Grob *> exthead (0, 0);
extract_grob_set (me, "note-heads", heads);
- for (int i = heads.size (); i--;)
+ for (vsize i = heads.size (); i--;)
{
Grob *n = heads[i];
int p = Staff_symbol_referencer::get_rounded_position (n);
}
/* The positions, in ascending order. */
-Array<int>
+std::vector<int>
Stem::note_head_positions (Grob *me)
{
- Array<int> ps;
+ std::vector<int> ps;
extract_grob_set (me, "note-heads", heads);
- for (int i = heads.size (); i--;)
+ for (vsize i = heads.size (); i--;)
{
Grob *n = heads[i];
int p = Staff_symbol_referencer::get_rounded_position (n);
- ps.push (p);
+ ps.push_back (p);
}
ps.sort (integer_compare);
Real ss = Staff_symbol_referencer::staff_space (me);
int durlog = duration_log (me);
- Array<Real> a;
+ std::vector<Real> a;
/* WARNING: IN HALF SPACES */
Real length = robust_scm2double (me->get_property ("length"), 7);
}
Real w = hed->extent (hed, X_AXIS)[dir];
- for (int i = 0; i < heads.size (); i++)
+ for (vsize i = 0; i < heads.size (); i++)
heads[i]->translate_axis (w - heads[i]->extent (heads[i], X_AXIS)[dir],
X_AXIS);
bool parity = true;
Real lastpos = Real (Staff_symbol_referencer::get_position (heads[0]));
- for (int i = 1; i < heads.size (); i++)
+ for (vsize i = 1; i < heads.size (); i++)
{
Real p = Staff_symbol_referencer::get_position (heads[i]);
Real dy = fabs (lastpos- p);
extract_grob_set (me, "rests", rests);
if (rests.size ())
{
- Grob *rest = rests.top ();
+ Grob *rest = rests.back ();
r = rest->extent (rest, X_AXIS).center ();
}
}
delimiter_ = make_spanner_from_properties (engraver, type,
SCM_EOL, ly_symbol2string (type).c_str ());
- for (int i = 0 ; i < children_.size (); i++)
+ for (vsize i = 0 ; i < children_.size (); i++)
{
children_[i]->create_grobs (engraver, default_type);
}
Bracket_nesting_group::add_support (Grob *g)
{
Side_position_interface::add_support (g, delimiter_);
- for (int i = 0 ; i < children_.size (); i++)
+ for (vsize i = 0 ; i < children_.size (); i++)
{
children_[i]->add_support (g);
}
Bracket_nesting_group::~Bracket_nesting_group ()
{
- for (int i = 0 ; i < children_.size (); i++)
+ for (vsize i = 0 ; i < children_.size (); i++)
delete children_[i];
}
Bracket_nesting_group::set_bound (Direction d, Grob *g)
{
delimiter_->set_bound (d, g);
- for (int i = 0 ; i < children_.size (); i++)
+ for (vsize i = 0 ; i < children_.size (); i++)
{
children_[i]->set_bound (d, g);
}
if (parent)
Side_position_interface::add_support (delimiter_, parent);
- for (int i = 0 ; i < children_.size (); i++)
+ for (vsize i = 0 ; i < children_.size (); i++)
{
children_[i]->set_nesting_support (delimiter_);
}
{
Bracket_nesting_group *node = new Bracket_nesting_group;
node->from_list (entry);
- children_.push (node);
+ children_.push_back (node);
}
else if (entry == ly_symbol2scm ("SystemStartBrace")
|| entry == ly_symbol2scm ("SystemStartBracket")
symbol_ = entry;
else
{
- children_.push (new Bracket_nesting_staff (0));
+ children_.push_back (new Bracket_nesting_staff (0));
}
}
}
bool
Bracket_nesting_group::add_staff (Grob *grob)
{
- for (int i = 0; i < children_.size (); i++)
+ for (vsize i = 0; i < children_.size (); i++)
{
if (children_[i]->add_staff (grob))
{
if (!succ)
{
- nesting_->children_.push (new Bracket_nesting_staff (0));
+ nesting_->children_.push_back (new Bracket_nesting_staff (0));
nesting_->add_staff (staff);
}
}
Interval ext;
int non_empty_count = 0;
- for (int i = elts.size (); i--;)
+ for (vsize i = elts.size (); i--;)
{
Spanner *sp = dynamic_cast<Spanner *> (elts[i]);
System::spanner_count () const
{
int k = 0;
- for (int i = all_elements_->size (); i--;)
+ for (vsize i = all_elements_->size (); i--;)
if (dynamic_cast<Spanner *> (all_elements_->grob (i)))
k++;
return k;
void
System::derived_mark () const
{
- if (!all_elements_->is_empty ())
+ if (!all_elements_->empty ())
{
Grob **ptr = &all_elements_->array_reference ().elem_ref (0);
Grob **end = ptr + all_elements_->size ();
static void
fixup_refpoints (Link_array<Grob> const &grobs)
{
- for (int i = grobs.size (); i--;)
+ for (vsize i = grobs.size (); i--;)
grobs[i]->fixup_refpoint ();
}
SCM
System::get_paper_systems ()
{
- for (int i = 0; i < all_elements_->size (); i++)
+ for (vsize i = 0; i < all_elements_->size (); i++)
{
Grob *g = all_elements_->grob (i);
if (g->internal_has_interface (ly_symbol2scm ("only-prebreak-interface")))
fixups must be done in broken line_of_scores, because new elements
are put over there. */
int count = 0;
- for (int i = 0; i < broken_intos_.size (); i++)
+ for (vsize i = 0; i < broken_intos_.size (); i++)
{
Grob *se = broken_intos_[i];
extract_grob_set (se, "all-elements", all_elts);
- for (int j = 0; j < all_elts.size (); j++)
+ for (vsize j = 0; j < all_elts.size (); j++)
{
Grob *g = all_elts[j];
g->fixup_refpoint ();
*/
fixup_refpoints (all_elements_->array ());
- for (int i = 0; i < all_elements_->size (); i++)
+ for (vsize i = 0; i < all_elements_->size (); i++)
all_elements_->grob (i)->handle_broken_dependencies ();
handle_broken_dependencies ();
}
void
-System::break_into_pieces (Array<Column_x_positions> const &breaking)
+System::break_into_pieces (std::vector<Column_x_positions> const &breaking)
{
- for (int i = 0; i < breaking.size (); i++)
+ for (vsize i = 0; i < breaking.size (); i++)
{
System *system = dynamic_cast<System *> (clone (i));
system->rank_ = i;
pscore_->typeset_system (system);
system->set_bound (LEFT, c[0]);
- system->set_bound (RIGHT, c.top ());
- for (int j = 0; j < c.size (); j++)
+ system->set_bound (RIGHT, c.back ());
+ for (vsize j = 0; j < c.size (); j++)
{
c[j]->translate_axis (breaking[i].config_[j], X_AXIS);
dynamic_cast<Paper_column *> (c[j])->system_ = system;
}
set_loose_columns (system, &breaking[i]);
- broken_intos_.push (system);
+ broken_intos_.push_back (system);
}
}
p->rank_
= ga->size ()
- ? Paper_column::get_rank (ga->array ().top ()) + 1
+ ? Paper_column::get_rank (ga->array ().back ()) + 1
: 0;
ga->add (p);
void
System::pre_processing ()
{
- for (int i = 0; i < all_elements_->size (); i++)
+ for (vsize i = 0; i < all_elements_->size (); i++)
all_elements_->grob (i)->discretionary_processing ();
if (be_verbose_global)
array, and should be processed before the original is potentially
killed.
*/
- for (int i = all_elements_->size (); i--;)
+ for (vsize i = all_elements_->size (); i--;)
all_elements_->grob (i)->handle_prebroken_dependencies ();
fixup_refpoints (all_elements_->array ());
- for (int i = 0; i < all_elements_->size (); i++)
+ for (vsize i = 0; i < all_elements_->size (); i++)
apply_tweaks (all_elements_->grob (i), false);
- for (int i = 0; i < all_elements_->size (); i++)
+ for (vsize i = 0; i < all_elements_->size (); i++)
{
Grob *g = all_elements_->grob (i);
(void) g->get_property ("before-line-breaking");
message (_ ("Calculating line breaks..."));
progress_indication (" ");
- for (int i = 0; i < all_elements_->size (); i++)
+ for (vsize i = 0; i < all_elements_->size (); i++)
{
Grob *e = all_elements_->grob (i);
(void) e->get_property ("springs-and-rods");
void
System::post_processing ()
{
- for (int i = 0; i < all_elements_->size (); i++)
+ for (vsize i = 0; i < all_elements_->size (); i++)
{
Grob *g = all_elements_->grob (i);
all_elts_sorted.default_sort ();
all_elts_sorted.uniq ();
this->get_stencil ();
- for (int i = all_elts_sorted.size (); i--;)
+ for (vsize i = all_elts_sorted.size (); i--;)
{
Grob *g = all_elts_sorted[i];
g->get_stencil ();
/* Output stencils in three layers: 0, 1, 2. Default layer: 1. */
for (int i = 0; i < LAYER_COUNT; i++)
- for (int j = all_elements_->size (); j--;)
+ for (vsize j = all_elements_->size (); j--;)
{
Grob *g = all_elements_->grob (j);
Stencil st = g->get_print_stencil ();
Interval staff_refpoints;
staff_refpoints.set_empty ();
extract_grob_set (this, "spaceable-staves", staves);
- for (int i = staves.size (); i--;)
+ for (vsize i = staves.size (); i--;)
{
Grob *g = staves[i];
staff_refpoints.add_point (g->relative_coordinate (this, Y_AXIS));
right = right->get_column ();
extract_grob_set (this, "columns", cols);
- int i = 0;
+ vsize i = 0;
while (i < cols.size ()
&& cols[i] != left)
i++;
{
Paper_column *c = dynamic_cast<Paper_column *> (cols[i]);
if (Item::is_breakable (c) && !c->system_)
- ret.push (c);
+ ret.push_back (c);
i++;
}
for (int i = 0; i <= last_breakable; i++)
{
if (Paper_column::is_used (ro_columns[i]))
- columns.push (ro_columns[i]);
+ columns.push_back (ro_columns[i]);
}
return columns;
{
if (m->is_mus_type ("note-event"))
{
- note_events_.push (m);
+ note_events_.push_back (m);
return true;
}
else if (m->is_mus_type ("string-number-event"))
{
- tabstring_events_.push (m);
+ tabstring_events_.push_back (m);
return true;
}
else if (m->is_mus_type ("busy-playing-event"))
Tab_note_heads_engraver::process_music ()
{
int j = 0;
- for (int i = 0; i < note_events_.size (); i++)
+ for (vsize i = 0; i < note_events_.size (); i++)
{
SCM stringTunings = get_property ("stringTunings");
int number_of_strings = ((int) ly_length (stringTunings));
d->set_parent (note, Y_AXIS);
- dots_.push (d);
+ dots_.push_back (d);
}
SCM scm_pitch = event->get_property ("pitch");
note->set_property ("text", text);
note->set_property ("staff-position", scm_from_int (pos));
- notes_.push (note);
+ notes_.push_back (note);
}
}
{
if (m->is_mus_type ("text-script-event"))
{
- evs_.push (m);
+ evs_.push_back (m);
return true;
}
return false;
void
Text_engraver::acknowledge_rhythmic_head (Grob_info inf)
{
- for (int i = 0; i < texts_.size (); i++)
+ for (vsize i = 0; i < texts_.size (); i++)
{
Grob *t = texts_[i];
Side_position_interface::add_support (t, inf.grob ());
void
Text_engraver::acknowledge_stem (Grob_info inf)
{
- for (int i = 0; i < texts_.size (); i++)
+ for (vsize i = 0; i < texts_.size (); i++)
Side_position_interface::add_support (texts_[i], inf.grob ());
}
void
Text_engraver::acknowledge_stem_tremolo (Grob_info info)
{
- for (int i = 0; i < texts_.size (); i++)
+ for (vsize i = 0; i < texts_.size (); i++)
Side_position_interface::add_support (texts_[i], info.grob ());
}
{
if (texts_.size ())
return;
- for (int i = 0; i < evs_.size (); i++)
+ for (vsize i = 0; i < evs_.size (); i++)
{
Music *r = evs_[i];
SCM mark = r->get_property ("text");
text->set_property ("text", mark);
- texts_.push (text);
+ texts_.push_back (text);
}
}
{
for (int i = 0; i < TFM_SIZE; i++)
- ascii_to_metric_idx_.push (-1);
+ ascii_to_metric_idx_.push_back (-1);
read_header ();
read_params ();
Tex_font_char_metric tfm_char = read_char_metric (i);
if (tfm_char.exists_)
ascii_to_metric_idx_[tfm_char.code_] = char_metrics_.size ();
- char_metrics_.push (tfm_char);
+ char_metrics_.push_back (tfm_char);
}
}
#define KERN_FLAG 128
void
-Tex_font_metric_reader::read_lig_kern_program (Array<Tfm_ligature> *ligatures, Array<Tfm_kern> *kerns)
+Tex_font_metric_reader::read_lig_kern_program (std::vector<Tfm_ligature> *ligatures, std::vector<Tfm_kern> *kerns)
{
bool end_b;
kern_element.kern = get_U32_fix_scaled ();
input_.set_pos (old_pos);
- kerns->push (kern_element);
+ kerns->push_back (kern_element);
}
else
{
Tfm_ligature ligature_element;
ligature_element.character = next_char;
ligature_element.ligature = remainder;
- ligatures->push (ligature_element);
+ ligatures->push_back (ligature_element);
}
}
while (!end_b);
int
Tex_font_metric::count () const
{
- for (int i = ascii_to_metric_idx_.size (); i--;)
+ for (vsize i = ascii_to_metric_idx_.size (); i--;)
if (ascii_to_metric_idx_[i] != -1)
return i + 1;
return 0;
Ties_configuration base = problem.generate_optimal_chord_configuration ();
- for (int i = 0; i < base.size(); i++)
+ for (vsize i = 0; i < base.size(); i++)
{
Tie::set_control_points (ties[i], problem.common_x_refpoint (),
base[i],
{
Music *event_;
Link_array<Grob> now_heads_;
- Array<Head_event_tuple> heads_to_tie_;
+ std::vector<Head_event_tuple> heads_to_tie_;
Link_array<Grob> ties_;
Spanner *tie_column_;
Tie_engraver::derived_mark () const
{
Engraver::derived_mark ();
- for (int i = 0; i < heads_to_tie_.size (); i++)
+ for (vsize i = 0; i < heads_to_tie_.size (); i++)
scm_gc_mark (heads_to_tie_[i].tie_definition_);
}
Tie_engraver::acknowledge_note_head (Grob_info i)
{
Grob *h = i.grob ();
- now_heads_.push (h);
- for (int i = heads_to_tie_.size (); i--;)
+ now_heads_.push_back (h);
+ for (vsize i = heads_to_tie_.size (); i--;)
{
Grob *th = heads_to_tie_[i].head_;
Music *right_mus = unsmob_music (h->get_property ("cause"));
Tie::set_head (p, LEFT, th);
Tie::set_head (p, RIGHT, h);
- ties_.push (p);
+ ties_.push_back (p);
heads_to_tie_.del (i);
}
}
tie_column_ = make_spanner ("TieColumn", ties_[0]->self_scm ());
if (tie_column_)
- for (int i = ties_.size (); i--;)
+ for (vsize i = ties_.size (); i--;)
Tie_column::add_tie (tie_column_, ties_[i]);
}
if (!to_boolean (get_property ("tieWaitForNote")))
heads_to_tie_.clear ();
- for (int i = 0; i < ties_.size (); i++)
+ for (vsize i = 0; i < ties_.size (); i++)
typeset_tie (ties_[i]);
ties_.clear ();
if (!to_boolean (get_property ("tieWaitForNote")))
heads_to_tie_.clear ();
- for (int i = 0; i < now_heads_.size (); i++)
+ for (vsize i = 0; i < now_heads_.size (); i++)
{
- heads_to_tie_.push (Head_event_tuple (now_heads_[i], event_,
+ heads_to_tie_.push_back (Head_event_tuple (now_heads_[i], event_,
start_definition));
}
}
{
Real staff_space = Staff_symbol_referencer::staff_space (bounds[0]);
- Array<Box> boxes;
+ std::vector<Box> boxes;
Grob *stem = 0;
- for (int i = 0; i < bounds.size (); i++)
+ for (vsize i = 0; i < bounds.size (); i++)
{
Grob *head = bounds[i];
if (!Note_head::has_interface (head))
(p+1) * 0.5 * staff_space);
Interval x = head->extent (x_refpoint_, X_AXIS);
- boxes.push (Box (x, y));
+ boxes.push_back (Box (x, y));
Grob *dots = Rhythmic_head::get_dots (head);
if (d == LEFT && dots)
dot_x_.unite (x);
y *= staff_space * 0.5;
- // boxes.push (Box (x, y));
+ // boxes.push_back (Box (x, y));
}
}
chord_outlines_[d].elem_ref (0).height_ = x;
}
- for (int i = 0; i < boxes.size (); i++)
+ for (vsize i = 0; i < boxes.size (); i++)
insert_extent_into_skyline (&chord_outlines_[d] ,
boxes[i], Y_AXIS, -d);
Tie_formatting_problem::from_tie (Grob *tie)
{
Link_array<Grob> ties;
- ties.push (tie);
+ ties.push_back (tie);
from_ties (ties);
details_.from_grob (tie);
void
Tie_formatting_problem::from_ties (Link_array<Grob> const &ties)
{
- if (ties.is_empty ())
+ if (ties.empty ())
return;
x_refpoint_ = ties[0];
- for (int i = 0; i < ties.size (); i++)
+ for (vsize i = 0; i < ties.size (); i++)
{
x_refpoint_ = dynamic_cast<Spanner*> (ties[i])->get_bound (LEFT)->common_refpoint (x_refpoint_, X_AXIS);
x_refpoint_ = dynamic_cast<Spanner*> (ties[i])->get_bound (RIGHT)->common_refpoint (x_refpoint_, X_AXIS);
{
Link_array<Item> bounds;
- for (int i = 0; i < ties.size (); i++)
+ for (vsize i = 0; i < ties.size (); i++)
{
Item *it = dynamic_cast<Spanner*> (ties[i])->get_bound (d);
- bounds.push (it);
+ bounds.push_back (it);
}
set_chord_outline (bounds, d);
while (flip (&d) != LEFT);
- for (int i = 0; i < ties.size (); i++)
+ for (vsize i = 0; i < ties.size (); i++)
{
Tie_specification spec;
}
while (flip (&d) != LEFT);
- specifications_.push (spec);
+ specifications_.push_back (spec);
}
}
void
Tie_formatting_problem::from_lv_ties (Link_array<Grob> const &lv_ties)
{
- if (lv_ties.is_empty ())
- return ;
+ if (lv_ties.empty ())
+ return;
details_.from_grob (lv_ties[0]);
Link_array<Item> heads;
- for (int i = 0; i < lv_ties.size (); i++)
+ for (vsize i = 0; i < lv_ties.size (); i++)
{
Tie_specification spec;
Item *head = unsmob_item (lv_ties[i]->get_object ("note-head"));
}
spec.note_head_drul_[LEFT] = head;
- heads.push (head);
- specifications_.push (spec);
+ heads.push_back (head);
+ specifications_.push_back (spec);
}
x_refpoint_ = lv_ties [0];
- for (int i = 0; i < lv_ties.size (); i++)
+ for (vsize i = 0; i < lv_ties.size (); i++)
{
x_refpoint_ = lv_ties[i]->common_refpoint (x_refpoint_, X_AXIS);
}
Real right_most = - infinity_f;
- for (int i = 0; i < chord_outlines_[LEFT].size (); i++)
+ for (vsize i = 0; i < chord_outlines_[LEFT].size (); i++)
{
right_most = max (right_most, chord_outlines_[LEFT][i].height_);
}
right_entry.width_.set_full ();
right_entry.height_ = right_most + 1.5;
- chord_outlines_[RIGHT].push (right_entry);
+ chord_outlines_[RIGHT].push_back (right_entry);
}
int region_size = 3;
for (int i = 0; i < region_size; i ++)
{
- confs.push (generate_configuration (pos + i * dir, dir));
+ confs.push_back (generate_configuration (pos + i * dir, dir));
}
- Array<Real> scores;
+ std::vector<Real> scores;
int best_idx = -1;
Real best_score = 1e6;
- for (int i = 0; i < confs.size (); i ++)
+ for (vsize i = 0; i < confs.size (); i ++)
{
Real score = 0.0;
score += score_configuration (*confs[i]);
}
Tie_configuration best = *confs[best_idx];
- for (int i = 0; i < confs.size (); i++)
+ for (vsize i = 0; i < confs.size (); i++)
delete confs[i];
return best;
return infinity_f;
}
- for (int i = 0; i < ties.size (); i++)
+ for (vsize i = 0; i < ties.size (); i++)
score += score_aptitude (ties[i], specifications_[i]);
return score;
Tie_formatting_problem::score_ties_configuration (Ties_configuration const &ties) const
{
Real score = 0.0;
- for (int i = 0; i < ties.size (); i++)
+ for (vsize i = 0; i < ties.size (); i++)
{
score += score_configuration (ties[i]);
}
Real last_edge = 0.0;
Real last_center = 0.0;
- for (int i = 0; i < ties.size (); i++)
+ for (vsize i = 0; i < ties.size (); i++)
{
Bezier b (ties[i].get_transformed_bezier (details_));
score +=
details_.outer_tie_length_symmetry_penalty_factor_
- * fabs (ties[0].attachment_x_.length () - ties.top().attachment_x_.length ());
+ * fabs (ties[0].attachment_x_.length () - ties.back ().attachment_x_.length ());
score +=
details_.outer_tie_vertical_distance_symmetry_penalty_factor_
* (fabs (specifications_[0].position_
- (ties[0].position_ * 0.5 * details_.staff_space_ + ties[0].delta_y_))
-
- fabs (specifications_.top ().position_
- - (ties.top().position_ * 0.5 * details_.staff_space_ + ties.top().delta_y_)));
+ fabs (specifications_.back ().position_
+ - (ties.back ().position_ * 0.5 * details_.staff_space_ + ties.back ().delta_y_)));
return score;
}
Tie_formatting_problem::generate_ties_configuration (Ties_configuration const &ties_config)
{
Ties_configuration copy;
- for (int i = 0; i < ties_config.size (); i++)
+ for (vsize i = 0; i < ties_config.size (); i++)
{
Tie_configuration * ptr = get_configuration (ties_config[i].position_, ties_config[i].dir_);
if (specifications_[i].has_manual_position_)
= (specifications_[i].manual_position_ - ties_config[i].position_)
* 0.5 * details_.staff_space_;
}
- copy.push (*ptr);
+ copy.push_back (*ptr);
}
return copy;
Tie_formatting_problem::generate_base_chord_configuration ()
{
Ties_configuration ties_config;
- for (int i = 0; i < specifications_.size (); i ++)
+ for (vsize i = 0; i < specifications_.size (); i ++)
{
Tie_configuration conf;
if (specifications_[i].has_manual_dir_)
{
conf.position_ = specifications_[i].position_;
}
- ties_config.push (conf);
+ ties_config.push_back (conf);
}
set_ties_config_standard_directions (&ties_config);
- for (int i = 0; i < ties_config.size (); i++)
+ for (vsize i = 0; i < ties_config.size (); i++)
if (!specifications_[i].manual_position_)
ties_config[i].position_ += ties_config[i].dir_;
Tie_formatting_problem::generate_optimal_chord_configuration ()
{
Ties_configuration base = generate_base_chord_configuration ();
- Array<Tie_configuration_variation> vars = get_variations (base);
+ std::vector<Tie_configuration_variation> vars = get_variations (base);
Ties_configuration best = base;
Real best_score = score_ties (best);
This simply is 1-opt: we have K substitions, and we try applying
exactly every one for each.
*/
- for (int i = 0; i < vars.size (); i++)
+ for (vsize i = 0; i < vars.size (); i++)
{
Ties_configuration variant = base;
variant[vars[i].index_] = *vars[i].suggestion_;
void
Tie_formatting_problem::set_ties_config_standard_directions (Ties_configuration *tie_configs)
{
- if (tie_configs->is_empty ())
+ if (tie_configs->empty ())
return ;
if (!tie_configs->elem (0).dir_)
tie_configs->elem_ref (0).dir_ = DOWN;
- if (!tie_configs->top().dir_)
- tie_configs->top().dir_ = UP;
+ if (!tie_configs->back ().dir_)
+ tie_configs->back ().dir_ = UP;
/*
Seconds
*/
- for (int i = 1; i < tie_configs->size (); i++)
+ for (vsize i = 1; i < tie_configs->size (); i++)
{
Real diff = (tie_configs->elem (i-1).position_
- tie_configs->elem (i).position_);
}
}
- for (int i = 1; i < tie_configs->size() - 1; i++)
+ for (vsize i = 1; i < tie_configs->size() - 1; i++)
{
Tie_configuration &conf = tie_configs->elem_ref (i);
if (conf.dir_)
suggestion_ = 0;
}
-Array<Tie_configuration_variation>
+std::vector<Tie_configuration_variation>
Tie_formatting_problem::get_variations (Ties_configuration const &ties)
{
Real center_distance_tolerance = 0.25;
- Array<Tie_configuration_variation> vars;
+ std::vector<Tie_configuration_variation> vars;
Real last_center = 0.0;
- for (int i = 0; i < ties.size (); i++)
+ for (vsize i = 0; i < ties.size (); i++)
{
Bezier b (ties[i].get_transformed_bezier (details_));
- ties[i].dir_,
-ties[i].dir_);
- vars.push (var);
+ vars.push_back (var);
}
if (!specifications_[i-1].has_manual_dir_)
- ties[i-1].dir_,
- ties[i-1].dir_);
- vars.push (var);
+ vars.push_back (var);
}
}
}
var.index_ = (d == DOWN) ? 0 : ties.size () - 1;
var.suggestion_ = get_configuration (ties.boundary (d, 0).position_ + d,
d);
- vars.push (var);
+ vars.push_back (var);
}
}
while (flip (&d) != DOWN);
void
Tie_formatting_problem::set_manual_tie_configuration (SCM manual_configs)
{
- int k = 0;
+ vsize k = 0;
for (SCM s = manual_configs;
- scm_is_pair (s) && k < specifications_.size(); s = scm_cdr (s))
+ scm_is_pair (s) && k < specifications_.size (); s = scm_cdr (s))
{
SCM entry = scm_car (s);
if (scm_is_pair (entry))
{
Music *event_;
Music *last_event_;
- Array<Audio_element_info> now_heads_;
- Array<Audio_element_info> heads_to_tie_;
+ std::vector<Audio_element_info> now_heads_;
+ std::vector<Audio_element_info> heads_to_tie_;
bool ties_created_;
{
if (Audio_note *an = dynamic_cast<Audio_note *> (inf.elem_))
{
- now_heads_.push (inf);
- for (int i = heads_to_tie_.size (); i--;)
+ now_heads_.push_back (inf);
+ for (vsize i = heads_to_tie_.size (); i--;)
{
Music *right_mus = inf.event_;
Engraver_dispatch_list::apply (Grob_info gi)
{
Translator *origin = gi.origin_translator ();
- for (int i = 0; i < dispatch_entries_.size (); i++)
+ for (vsize i = 0; i < dispatch_entries_.size (); i++)
{
Engraver_dispatch_entry const &e (dispatch_entries_[i]);
if (e.engraver_ == origin)
if (ptr)
{
entry.function_ = ptr;
- list->dispatch_entries_.push (entry);
+ list->dispatch_entries_.push_back (entry);
found = true;
}
}
for (int i = 0; i < TRANSLATOR_METHOD_PRECOMPUTE_COUNT; i++)
{
if (ptrs[i])
- precomputed_method_bindings_[i].push (Translator_method_binding (tr, ptrs[i]));
+ precomputed_method_bindings_[i].push_back (Translator_method_binding (tr, ptrs[i]));
}
}
void
Translator_group::precomputed_translator_foreach (Translator_precompute_index idx)
{
- Array<Translator_method_binding> &bindings (precomputed_method_bindings_[idx]);
- for (int i = 0; i < bindings.size (); i++)
+ std::vector<Translator_method_binding> &bindings (precomputed_method_bindings_[idx]);
+ for (vsize i = 0; i < bindings.size (); i++)
bindings[i].invoke ();
}
void
add_acknowledger (Engraver_void_function_engraver_grob_info ptr,
char const *func_name,
- Array<Acknowledge_information> *ack_array)
+ std::vector<Acknowledge_information> *ack_array)
{
Acknowledge_information inf;
inf.function_ = ptr;
interface_name += "-interface";
inf.symbol_ = scm_gc_protect_object (ly_symbol2scm (interface_name.c_str ()));
- ack_array->push (inf);
+ ack_array->push_back (inf);
}
Engraver_void_function_engraver_grob_info
-generic_get_acknowledger (SCM sym, Array<Acknowledge_information> const *ack_array)
+generic_get_acknowledger (SCM sym, std::vector<Acknowledge_information> const *ack_array)
{
- for (int i = 0; i < ack_array->size (); i++)
+ for (vsize i = 0; i < ack_array->size (); i++)
{
if (ack_array->elem (i).symbol_ == sym)
return ack_array->elem (i).function_;
return 0;
Drul_array<Grob*> stems (Note_column::get_stem (cols[0]),
- Note_column::get_stem (cols.top ()));
+ Note_column::get_stem (cols.back ()));
if (dynamic_cast<Item*> (stems[RIGHT])->get_column ()
!= me->get_bound (RIGHT)->get_column())
return 0;
}
- *equally_long = (beam_stems[0] == stems[LEFT] && beam_stems.top () == stems[RIGHT]);
+ *equally_long = (beam_stems[0] == stems[LEFT] && beam_stems.back () == stems[RIGHT]);
return beams[LEFT];
}
Spanner *orig_spanner = dynamic_cast<Spanner*> (me->original ());
- int neighbor_idx = me->get_break_index () - break_dir;
+ vsize neighbor_idx = me->get_break_index () - break_dir;
if (break_dir
&& d == RIGHT
&& neighbor_idx < orig_spanner->broken_intos_.size ())
- overshoot[LEFT];
}
else if (d == RIGHT
- && (columns.is_empty ()
+ && (columns.empty ()
|| (bounds[d]->get_column ()
- != dynamic_cast<Item *> (columns.top ())->get_column ())))
+ != dynamic_cast<Item *> (columns.back ())->get_column ())))
{
/*
TODO: make padding tunable?
Tuplet_bracket::get_bounds (Grob *me, Grob **left, Grob **right)
{
extract_grob_set (me, "note-columns", columns);
- int l = 0;
+ vsize l = 0;
while (l < columns.size () && Note_column::has_rests (columns[l]))
l++;
Real x0 = robust_relative_extent (lgr, commonx, X_AXIS)[LEFT];
Real x1 = robust_relative_extent (rgr, commonx, X_AXIS)[RIGHT];
- Array<Offset> points;
- points.push (Offset (x0 - x0, staff[dir]));
- points.push (Offset (x1 - x0, staff[dir]));
+ std::vector<Offset> points;
+ points.push_back (Offset (x0 - x0, staff[dir]));
+ points.push_back (Offset (x1 - x0, staff[dir]));
- for (int i = 0; i < columns.size (); i++)
+ for (vsize i = 0; i < columns.size (); i++)
{
Interval note_ext = columns[i]->extent (commony, Y_AXIS);
Real notey = note_ext[dir] - me->relative_coordinate (commony, Y_AXIS);
Real x = columns[i]->relative_coordinate (commonx, X_AXIS) - x0;
- points.push (Offset (x, notey));
+ points.push_back (Offset (x, notey));
}
/*
We assume that the smaller bracket is 1.0 space high.
*/
Real ss = Staff_symbol_referencer::staff_space (me);
- for (int i = 0; i < tuplets.size (); i++)
+ for (vsize i = 0; i < tuplets.size (); i++)
{
Interval tuplet_x (tuplets[i]->extent (commonx, X_AXIS));
Interval tuplet_y (tuplets[i]->extent (commony, Y_AXIS));
y += dir * my_height[d];
#endif
- points.push (Offset (tuplet_x[d] - x0, y));
+ points.push_back (Offset (tuplet_x[d] - x0, y));
}
while (flip (&d) != LEFT);
}
Real factor = (columns.size () > 1) ? 1 / (x1 - x0) : 1.0;
- for (int i = 0; i < points.size (); i++)
+ for (vsize i = 0; i < points.size (); i++)
{
Real x = points[i][X_AXIS];
Real tuplety = (*dy) * x * factor;
{
Drul_array<int> dirs (0, 0);
extract_grob_set (me, "note-columns", columns);
- for (int i = 0; i < columns.size (); i++)
+ for (vsize i = 0; i < columns.size (); i++)
{
Grob *nc = columns[i];
Direction d = Note_column::dir (nc);
TRANSLATOR_DECLARATIONS (Tuplet_engraver);
protected:
- Array<Tuplet_description> tuplets_;
+ std::vector<Tuplet_description> tuplets_;
Link_array<Spanner> last_tuplets_;
DECLARE_ACKNOWLEDGER (note_column);
virtual bool try_music (Music *r);
if (unsmob_moment (s))
d.span_stop_ = min (d.span_stop_, (now_mom () + *unsmob_moment (s)).main_part_);
- tuplets_.push (d);
+ tuplets_.push_back (d);
}
return true;
}
return;
tuplets_.sort (&Tuplet_description::compare);
- for (int i = 0; i < tuplets_.size (); i++)
+ for (vsize i = 0; i < tuplets_.size (); i++)
{
if (tuplets_[i].bracket_)
continue;
void
Tuplet_engraver::acknowledge_note_column (Grob_info inf)
{
- for (int j = 0; j < tuplets_.size (); j++)
+ for (vsize j = 0; j < tuplets_.size (); j++)
if (tuplets_[j].bracket_)
{
Item *i = dynamic_cast<Item *> (inf.grob ());
Moment now = now_mom ();
last_tuplets_.clear ();
- if (tuplets_.is_empty ())
+ if (tuplets_.empty ())
return;
Moment tsdmom = robust_scm2moment (get_property ("tupletSpannerDuration"), Moment (0));
bool full_length = to_boolean (get_property ("tupletFullLength"));
- for (int i = tuplets_.size (); i--;)
+ for (vsize i = tuplets_.size (); i--;)
{
Rational tsd = tsdmom.main_part_;
tuplets_[i].number_->set_bound (RIGHT,
tuplets_[i].bracket_->get_bound (LEFT));
}
- last_tuplets_.push (tuplets_[i].bracket_);
- last_tuplets_.push (tuplets_[i].number_);
+ last_tuplets_.push_back (tuplets_[i].bracket_);
+ last_tuplets_.push_back (tuplets_[i].number_);
tuplets_[i].bracket_ = 0;
tuplets_[i].number_ = 0;
{
if (to_boolean (get_property ("tupletFullLength")))
{
- for (int i = 0; i < last_tuplets_.size (); i++)
+ for (vsize i = 0; i < last_tuplets_.size (); i++)
{
Item *col = unsmob_item (get_property ("currentCommandColumn"));
last_tuplets_[i]->set_bound (RIGHT, col);
int context_info, int delta_pitch);
bool is_stacked_head (int prefix_set,
int context_info);
- Real align_heads (Array<Grob_info> primitives,
+ Real align_heads (std::vector<Grob_info> primitives,
Real flexa_width,
Real thickness);
protected:
virtual Spanner *create_ligature_spanner ();
virtual void transform_heads (Spanner *ligature,
- Array<Grob_info> primitives);
+ std::vector<Grob_info> primitives);
};
Vaticana_ligature_engraver::Vaticana_ligature_engraver ()
}
Real
-Vaticana_ligature_engraver::align_heads (Array<Grob_info> primitives,
+Vaticana_ligature_engraver::align_heads (std::vector<Grob_info> primitives,
Real flexa_width,
Real thickness)
{
Item *prev_primitive = 0;
int prev_prefix_set = 0;
- for (int i = 0; i < primitives.size (); i++)
+ for (vsize i = 0; i < primitives.size (); i++)
{
Item *primitive = dynamic_cast<Item *> (primitives[i].grob ());
int prefix_set
void
Vaticana_ligature_engraver::transform_heads (Spanner *ligature,
- Array<Grob_info> primitives)
+ std::vector<Grob_info> primitives)
{
Real flexa_width = robust_scm2double (ligature->get_property ("flexa-width"), 2);
int prev_context_info = 0;
int prev_delta_pitch = 0;
std::string prev_glyph_name = "";
- for (int i = 0; i < primitives.size (); i++)
+ for (vsize i = 0; i < primitives.size (); i++)
{
Item *primitive = dynamic_cast<Item *> (primitives[i].grob ());
Link_array<Grob> &arr = ga->array_reference ();
Grob *added = arr.pop ();
- for (int i = 0; i < arr.size (); i++)
+ for (vsize i = 0; i < arr.size (); i++)
{
if (arr[i] == before_grob)
{
bool broken_first_bracket = orig_span && (orig_span->broken_intos_[0] == (Spanner *)me);
- bool broken_last_bracket = orig_span && (orig_span->broken_intos_.top () == (Spanner *)me);
+ bool broken_last_bracket = orig_span && (orig_span->broken_intos_.back () == (Spanner *)me);
bool no_vertical_start = orig_span && !broken_first_bracket;
bool no_vertical_end = orig_span && !broken_last_bracket;
extract_grob_set (me, "bars", bars);
- Grob *endbar = bars.size () ? bars.top () : 0;
+ Grob *endbar = bars.size () ? bars.back () : 0;
SCM glyph = endbar ? endbar->get_property ("glyph") : SCM_EOL;
std::string str;