]> git.donarmstrong.com Git - lilypond.git/commitdiff
* flower/include/std-vector.hh[STD_VECTOR]: Do not include
authorJan Nieuwenhuizen <janneke@gnu.org>
Fri, 3 Feb 2006 15:50:05 +0000 (15:50 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Fri, 3 Feb 2006 15:50:05 +0000 (15:50 +0000)
array.hh, parray.hh at all.  Getting ready to flip the
configure default.

* lily/include/lily-proto.hh (Link_array__char_): Bugfix.

* lily/source-file.cc (file::get_line): Help binary_search_bounds
a bit.

* lily/include/lily-proto.hh (Link_array__char_): Bugfix.

ChangeLog
flower/include/std-vector.hh
flower/test-std.cc
lily/include/lily-proto.hh
lily/source-file.cc

index 27cc759899546256916797b3aa4a81003824709e..9ccc5d06aad6fa291d88d019e85f5a61ec671bcc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2006-02-03  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * flower/include/std-vector.hh[STD_VECTOR]: Do not include
+       array.hh, parray.hh at all.  Getting ready to flip the
+       configure default.
+
+       * lily/include/lily-proto.hh (Link_array__char_): Bugfix.
+
+       * lily/source-file.cc (file::get_line): Help binary_search_bounds
+       a bit.
+
+       * lily/include/lily-proto.hh (Link_array__char_): Bugfix.
+
 2006-02-03  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
        * flower/include/array.hh: typo. 
index 3fa220184e376699a4cf413f1824d44f5bc65591..e8367ae8a625e7068b5b70c1fe6beac96cd06c4f 100644 (file)
@@ -125,31 +125,6 @@ namespace std {
     while (*hi - *lo > 1);
   }
 
-  template<class T>
-  void
-  binary_search_bounds (vector<T> const &table,
-                       T const *key, int (*compare) (T *const &, T *const &),
-                       int *lo,
-                       int *hi)
-  {
-    int cmp;
-    int result;
-
-    /* binary search */
-    do
-      {
-       cmp = (*lo + *hi) / 2;
-
-       result = (*compare) ((T *) key, table[cmp]);
-
-       if (result < 0)
-         *hi = cmp;
-       else
-         *lo = cmp;
-      }
-    while (*hi - *lo > 1);
-  }
-  
 #if 0
   template<typename T>
   vsize
@@ -310,11 +285,11 @@ namespace std {
 
 }
 
-#endif /* STD_VECTOR */
-
 #include "array.hh"
 #include "parray.hh"
 
+#endif /* !STD_VECTOR */
+
 using namespace std;
 
 #endif /* STD_VECTOR_HH */
index 6e53f987adb6389657323b85a68c1018ed8fc480..e6f0da3d3e5f4c4dcafeafc36235550d47aee13c 100644 (file)
@@ -179,6 +179,16 @@ BOOST_AUTO_UNIT_TEST (vector_search)
 test_suite*
 init_unit_test_suite (int, char**)
 {
+  vsize i = 0;
+  vsize j = 0;
+  vector<int> v;
+  binary_search_bounds (v, 1, &default_compare, &i, &j);
+  //binary_search_bounds (v, 1, &default_compare, 0, 0);
+  
+  //Link_array<char> w;
+  vector<char*> w;
+  binary_search_bounds (w, (char*)1, &default_compare, &i, &j);
+  
   test_suite *test = BOOST_TEST_SUITE("std::Flower");
   test->add (BOOST_TEST_CASE (vector_erase));
   test->add (BOOST_TEST_CASE (vector_slice));
index ccbd17722683c104fecef15b75170c0bf145c498..30603aff77c20c5dba3c43d8105c6f026ff2d3ae 100644 (file)
@@ -180,11 +180,7 @@ typedef void (*Translator_void_method_ptr) (Translator *);
 
 /* FIXME: when Link_array is dropped, do grand s/r to vector<TYPE*>.  */
 #if STD_VECTOR
-
-// FIXME: does not work with sourc-file.cc
-// #define Link_array__char_ std::vector<char*>
-
-#define Link_array__char_ Link_array<char>
+#define Link_array__char_ std::vector<char*>
 #define Link_array__Grob_ std::vector<Grob*>
 #define Link_array__Accidental_placement_entry_ std::vector<Accidental_placement_entry*>
 #define Link_array__Audio_item_ std::vector<Audio_item*>
index 041308dbc8999ebd583a0ff0cdb3aa33130fdc0a..d9c022b1579e5961fc02717065ca2766743b745e 100644 (file)
@@ -313,8 +313,8 @@ Source_file::get_line (char const *pos_str0) const
   if (!newline_locations_.size ())
     return 1;
 
-  int lo = 0;
-  int hi = newline_locations_.size ();
+  vsize lo = 0;
+  vsize hi = newline_locations_.size ();
 
   if (newline_locations_[lo] > pos_str0)
     return 1;
@@ -323,7 +323,7 @@ Source_file::get_line (char const *pos_str0) const
     return hi;
 
   binary_search_bounds (newline_locations_,
-                       pos_str0,
+                       (char const*)pos_str0,
                        default_compare,
                        &lo, &hi);