]> git.donarmstrong.com Git - lilypond.git/commitdiff
make sure vsize and VPOS are
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 6 Feb 2006 17:17:03 +0000 (17:17 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 6 Feb 2006 17:17:03 +0000 (17:17 +0000)
defined for binary_search_bounds().

ChangeLog
flower/include/array.icc [deleted file]
flower/include/std-vector.hh
input/bach-schenker.ly

index bfaf9b7e86eefdf6dc9be321a19138ff18237cbb..1176dcf804aa1e8560b5b35dd67e6a99bd925a19 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2006-02-06  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * 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 (file)
index 33f44a6..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
-  (c) 1995--2006  Han-Wen Nienhuys  <hanwen@xs4all.nl>
-
-  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<class T> 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<class T> INLINE
-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 (const_iterator b, const_iterator e)
-{
-  vsize n = e - b;
-  array_ = new T[n];
-  max_ = size_ = n;
-  arrcpy (array_, b, n);
-}
-
-template<class T>
-void
-binary_search_bounds (Array<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);
-}
-
-/*
-  lookup with binsearch, return array index.
-*/
-template<class T>
-vsize
-binary_search (Array<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;
-}
index b10299b74467d42d19a01972b21fb8c7f4f9e97d..d7056b62c42c26761ac9520c8773944607fcc96f 100644 (file)
@@ -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<typename T>
   class vector : public __vector<T>
@@ -85,10 +92,10 @@ namespace std {
   void
   binary_search_bounds (vector<T*> 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 */
index db643bb982bd77b622418189243971517a555cb2..bafec344beaeb9188a924dd3529b3a07573de223 100644 (file)
@@ -10,6 +10,9 @@
  
 }
 
+%% See http://www.shaffermusic.com/doc/schenker/index.html for more information
+%% 
+
 
 \version "2.7.32"