]> git.donarmstrong.com Git - lilypond.git/commitdiff
*** empty log message ***
authorJan Nieuwenhuizen <janneke@gnu.org>
Thu, 16 Feb 2006 14:20:42 +0000 (14:20 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Thu, 16 Feb 2006 14:20:42 +0000 (14:20 +0000)
ChangeLog
flower/file-path.cc
flower/include/std-vector.hh
flower/std-string.cc
lily/general-scheme.cc
lily/include/misc.hh
lily/lily-guile.cc
lily/lilypond-version.cc
lily/main.cc
lily/misc.cc

index 557374fa5aae8b030a83b961478636d91a635bd7..55face2c01e7473b6bd4d639dff0a4f1d7426635 100644 (file)
--- 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
index 0b1b979b6b3292c703ef138d9d1acd048a6f4b51..3fc85000729af83694f6b4397d5b0111bb71586e 100644 (file)
@@ -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
index 5269af6e209d2fb9aa70325bf2434b3ca9ae4391..34bd866c354ae4d0e4f24ad89fa6d694b8605724 100644 (file)
@@ -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 */
index 0fdc96f5f6d78b5fbf6c890f79be1bb886cb2d70..855193ecb07b0a8849e66dec01f5a3e21224b0f0 100644 (file)
@@ -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;
+}
index 5c672a858d1f75599a45d43dc419fffbe49057bd..558d111f8617b7b61147504ec8dbf658446b76ed 100644 (file)
@@ -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 ();
index c7dd1e51a97d7d99ddb19ae577e4a6823714bcd5..be9b2c4f2c51c7ca1ac07c3665f394937cac00ce 100644 (file)
@@ -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)
 {
index 19fe4b0132f9fa87f3837f822e05935b5d4cb6a9..065ea388eedf3054a4f063adb5586350f1cf09f9 100644 (file)
@@ -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
index 6c453fab74df84a0140d65eec0836174f5ac9317..c9c055922576d1ce345b7ac34c8c169861686bb6 100644 (file)
@@ -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]);
index 8e73ac95f3f4ad036aee00ec86508a87da6d1e54..8fb2ab27e51ec68af69c4f8e12166931ab422705 100644 (file)
@@ -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,
index 5c3293073c1950d4d33bd8c1683d655874acd9b0..54da3d0f5566a035e3d804655cc3f79f90f985f8 100644 (file)
@@ -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)
 {