source file of the GNU LilyPond music typesetter
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+ (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ Jan Nieuwenhuizen <janneke@gnu.org>
*/
#include <math.h>
-#include "item.hh"
#include "misc.hh"
-#include "moment.hh"
+#include "string.hh"
+/*
+ Return the 2-log, rounded down
+*/
int
-intlog2(int d) {
- int i=0;
- while (!(d&1)) {
- d/= 2;
- i++;
+intlog2 (int d)
+{
+ assert (d);
+ int i = 0;
+ while ((d != 1))
+ {
+ d /= 2;
+ i++;
}
- assert (!(d/2));
- return i;
+
+ assert (! (d / 2));
+ return i;
}
double
-log_2(double x) {
- return log (x) /log (2.0);
+log_2 (double x)
+{
+ return log (x) / log (2.0);
}
-#if 1
-Interval
-itemlist_width (const Array<Item*> &its)
+Array<String>
+split_string (String s, char c)
{
- Interval iv ;
- iv.set_empty();
-
- for (int j =0; j < its.size(); j++){
- iv.unite (its[j]->width());
-
+ Array<String> rv;
+ while (s.length ())
+ {
+ int i = s.index (c);
+
+ if (i == 0)
+ {
+ s = s.nomid_string (0, 1);
+ continue;
+ }
+
+ if (i < 0)
+ i = s.length ();
+
+ rv.push (s.cut_string (0, i));
+ s = s.nomid_string (0, i);
}
- return iv;
-}
-#endif
+ return rv;
+}