+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.
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
}
-#endif /* STD_VECTOR */
-
#include "array.hh"
#include "parray.hh"
+#endif /* !STD_VECTOR */
+
using namespace std;
#endif /* STD_VECTOR_HH */
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));
/* 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*>
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;
return hi;
binary_search_bounds (newline_locations_,
- pos_str0,
+ (char const*)pos_str0,
default_compare,
&lo, &hi);