From 0505ebfe07188748acc17575c88704f398bfa67b Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 6 Feb 2006 17:17:03 +0000 Subject: [PATCH] make sure vsize and VPOS are defined for binary_search_bounds(). --- ChangeLog | 3 + flower/include/array.icc | 107 ----------------------------------- flower/include/std-vector.hh | 13 ++++- input/bach-schenker.ly | 3 + 4 files changed, 16 insertions(+), 110 deletions(-) delete mode 100644 flower/include/array.icc diff --git a/ChangeLog b/ChangeLog index bfaf9b7e86..1176dcf804 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2006-02-06 Han-Wen Nienhuys + * flower/include/std-vector.hh: make sure vsize and VPOS are + defined for binary_search_bounds(). + * flower/std-string.cc (std): add to_string(long unsigned). * configure.in (gui_b): excise std_string option. diff --git a/flower/include/array.icc b/flower/include/array.icc deleted file mode 100644 index 33f44a6778..0000000000 --- a/flower/include/array.icc +++ /dev/null @@ -1,107 +0,0 @@ -/* - (c) 1995--2006 Han-Wen Nienhuys - - Distributed under GNU GPL -*/ - -#if 0 -#include "std-vector.hh" -#ifdef INLINE -#undef INLINE -#endif - -#define INLINE -#endif - -/* - functions with loops don't inline -*/ - -template INLINE void -arrcpy (T *dest, T const *src, vsize count) -{ - for (vsize i_shadows_local = 0; i_shadows_local < count; i_shadows_local++) -#ifdef __powerpc__ - { - /* - urg: wierd egcs-1.1.2-12c (stock LinuxPPC R5) bug on ppc - bug report filed - fixed in egcs-1.1.2-12f - ftp://dev.linuxppc.org/users/fsirl/R5/RPMS/ppc/ - */ - *dest = *src; - dest++, src++; - } -#else - *dest++ = *src++; -#endif -} - -template INLINE -void -Array::OK () const -{ -#if !STD_VECTOR - assert (max_ >= size_ && size_ >= 0); -#else - assert (max_ >= size_); -#endif - if (max_) - assert (array_); -} - -template INLINE -Array::Array (const_iterator b, const_iterator e) -{ - vsize n = e - b; - array_ = new T[n]; - max_ = size_ = n; - arrcpy (array_, b, n); -} - -template -void -binary_search_bounds (Array 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); -} - -/* - lookup with binsearch, return array index. -*/ -template -vsize -binary_search (Array 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; -} diff --git a/flower/include/std-vector.hh b/flower/include/std-vector.hh index b10299b744..d7056b62c4 100644 --- a/flower/include/std-vector.hh +++ b/flower/include/std-vector.hh @@ -50,6 +50,13 @@ int default_compare (T *const &a, T *const &b) #undef vector namespace std { + + #ifndef VSIZE + #define VSIZE + typedef size_t vsize; + #define VPOS UINT_MAX + #endif + /* Interface without pointer arithmetic (iterator) semantics. */ template class vector : public __vector @@ -85,10 +92,10 @@ namespace std { void binary_search_bounds (vector const &table, T const *key, int (*compare) (T *const &, T *const &), - unsigned *lo, - unsigned *hi) + vsize *lo, + vsize *hi) { - int cmp; + vsize cmp; int result; /* binary search */ diff --git a/input/bach-schenker.ly b/input/bach-schenker.ly index db643bb982..bafec344be 100644 --- a/input/bach-schenker.ly +++ b/input/bach-schenker.ly @@ -10,6 +10,9 @@ } +%% See http://www.shaffermusic.com/doc/schenker/index.html for more information +%% + \version "2.7.32" -- 2.39.5