From: janneke <janneke>
Date: Thu, 16 Feb 2006 14:20:42 +0000 (+0000)
Subject: *** empty log message ***
X-Git-Tag: release/2.7.38^2~125
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=fce09311673a7ebdfc137243b2c1ab742257ae60;p=lilypond.git

*** empty log message ***
---

diff --git a/ChangeLog b/ChangeLog
index 557374fa5a..55face2c01 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-02-16  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* flower/include/std-vector.hh[!HAVE_STL_DATA_METHOD]: Add copy
+	constructor.
+
+	* lily/std-string.cc:
+	* lily/include/std-vector.hh (split_string): Move and rename from
+	lily/include/misc.hh, lily/misc.cc.  Update callers.
+
 2006-02-16  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
 	* lily/include/pango-font.hh: HAVE_PANGO_FT2 iso. HAVE_PANGO_16
diff --git a/flower/file-path.cc b/flower/file-path.cc
index 0b1b979b6b..3fc8500072 100644
--- a/flower/file-path.cc
+++ b/flower/file-path.cc
@@ -36,24 +36,11 @@ File_path::directories () const
   return dirs_;
 }
 
-/*
-  TODO: use split_string.
-  
- */
-
 #include <algorithm>
 void
 File_path::parse_path (string p)
 {
-  ssize len;
-  while ((len = p.length ()))
-    {
-      ssize i = p.find (PATHSEP);
-      if (i == NPOS)
-	i = len;
-      append (p.substr (0, i));
-      p = p.substr (min (len, i + 1));
-    }
+  concat (dirs_, string_split (p, PATHSEP));
 }
 
 bool
diff --git a/flower/include/std-vector.hh b/flower/include/std-vector.hh
index 5269af6e20..34bd866c35 100644
--- a/flower/include/std-vector.hh
+++ b/flower/include/std-vector.hh
@@ -65,21 +65,25 @@ namespace std {
   public:
     typedef typename __vector<T>::iterator iterator;
     typedef typename __vector<T>::const_iterator const_iterator;
-    
+
     vector<T, A> () : __vector<T, A> ()
     {
     }
-    
+
+    vector<T, A> (vector<T, A> const& v) : __vector<T, A> (v)
+    {
+    }
+
     vector<T, A> (const_iterator b, const_iterator e) : __vector<T, A> (b, e)
     {
     }
-    
+
     T*
     data ()
     {
       return &(*this)[0];
     }
-    
+
     T const*
     data () const
     {
@@ -127,7 +131,7 @@ concat (vector<T> &v, vector<T> const& w)
 {
   v.insert (v.end (), w.begin (), w.end ());
 }
-  
+
 template<class T>
 void
 binary_search_bounds (vector<T> const &table,
@@ -268,7 +272,7 @@ vector_sort (vector<T> &v, int (*compare) (T const &, T const &),
   vector_sort (v, compare, last + 1, upper);
 }
 #endif
-  
+
 template<typename T>
 void
 reverse (vector<T> &v)
@@ -323,4 +327,6 @@ junk_pointers (vector<T> &v)
 }
 #endif /* HAVE_BOOST_LAMBDA */
 
+vector<string> string_split (string str, char c);
+
 #endif /* STD_VECTOR_HH */
diff --git a/flower/std-string.cc b/flower/std-string.cc
index 0fdc96f5f6..855193ecb0 100644
--- a/flower/std-string.cc
+++ b/flower/std-string.cc
@@ -99,3 +99,23 @@ string_compare (string const &a, string const &b)
 {
   return a.compare (b);
 }
+
+#include "std-vector.hh"
+vector<string>
+string_split (string str, char c)
+{
+  vector<string> a;
+  ssize i = str.find (c);
+  while (i != NPOS)
+    {
+      string s = str.substr (0, i);
+      a.push_back (s);
+      while (str[++i] == c)
+	;
+      str = str.substr (i);
+      i = str.find (c);
+    }
+  if (str.length ())
+    a.push_back (str);
+  return a;
+}
diff --git a/lily/general-scheme.cc b/lily/general-scheme.cc
index 5c672a858d..558d111f86 100644
--- a/lily/general-scheme.cc
+++ b/lily/general-scheme.cc
@@ -224,7 +224,7 @@ LY_DEFINE (ly_output_formats, "ly:output-formats",
 	   "Formats passed to --format as a list of strings, "
 	   "used for the output.")
 {
-  vector<string> output_formats = split_string (output_format_global, ',');
+  vector<string> output_formats = string_split (output_format_global, ',');
 
   SCM lst = SCM_EOL;
   int output_formats_count = output_formats.size ();
diff --git a/lily/include/misc.hh b/lily/include/misc.hh
index c7dd1e51a9..be9b2c4f2c 100644
--- a/lily/include/misc.hh
+++ b/lily/include/misc.hh
@@ -28,8 +28,6 @@ sign (int i)
   else return 0;
 }
 
-vector<string> split_string (string s, char c);
-
 inline Real
 linear_interpolate (Real x, Real x1, Real x2, Real y1, Real y2)
 {
diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc
index 19fe4b0132..065ea388ee 100644
--- a/lily/lily-guile.cc
+++ b/lily/lily-guile.cc
@@ -373,7 +373,7 @@ parse_symbol_list (char const *symbols)
   string s = symbols;
   replace_all (s, '\n', ' ');
   replace_all (s, '\t', ' ');
-  return ly_string_array_to_scm (split_string (s, ' '));
+  return ly_string_array_to_scm (string_split (s, ' '));
 }
 
 SCM
diff --git a/lily/lilypond-version.cc b/lily/lilypond-version.cc
index 6c453fab74..c9c0559225 100644
--- a/lily/lilypond-version.cc
+++ b/lily/lilypond-version.cc
@@ -26,7 +26,7 @@ Lilypond_version::Lilypond_version (string str)
   patch_ = 0;
   
   vector<string> version;
-  version = split_string (str, '.');
+  version = string_split (str, '.');
 
   if (version.size () > 0 && isdigit (version[0][0]))
     major_ = String_convert::dec2int (version[0]);
diff --git a/lily/main.cc b/lily/main.cc
index 8e73ac95f3..8fb2ab27e5 100644
--- a/lily/main.cc
+++ b/lily/main.cc
@@ -300,7 +300,7 @@ do_chroot_jail ()
       USER_NAME, GROUP_NAME, JAIL, DIR, JAIL_MAX
     };
 
-  vector<string> components = split_string (jail_spec, ',');
+  vector<string> components = string_split (jail_spec, ',');
   if (components.size () != JAIL_MAX)
     {
       error (_f ("expected %d arguments with jail, found: %d", JAIL_MAX,
diff --git a/lily/misc.cc b/lily/misc.cc
index 5c3293073c..54da3d0f55 100644
--- a/lily/misc.cc
+++ b/lily/misc.cc
@@ -9,7 +9,6 @@
 
 
 #include "misc.hh"
-#include "std-string.hh"
 
 /*
   Return the 2-log, rounded down
@@ -35,52 +34,6 @@ log_2 (double x)
   return log (x) / log (2.0);
 }
 
-vector<string>
-split_string (string str, char c)
-{
-  vector<string> a;
-  ssize i = str.find (c);
-  while (i != NPOS)
-    {
-      string s = str.substr (0, i);
-      a.push_back (s);
-      while (str[++i] == c)
-	;
-      str = str.substr (i);
-      i = str.find (c);
-    }
-  if (str.length ())
-    a.push_back (str);
-  return a;
-}
-
-#if 0
-vector<string>
-split_string (string s, char c)
-{
-  vector<string> rv;
-  while (s.length ())
-    {
-      ssize i = s.find (c);
-
-      if (i == 0)
-	{
-	  s = s.substr (1, s.length () -1);
-	  continue;
-	}
-
-      if (i == NPOS)
-	i = s.length ();
-
-      rv.push_back (s.substr (0, i));
-      s = s.substr (i, s.length () - i);
-    }
-
-  return rv;
-}
-#endif
-
-
 Real
 directed_round (Real f, Direction d)
 {