]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.41
authorfred <fred>
Sun, 24 Mar 2002 20:04:41 +0000 (20:04 +0000)
committerfred <fred>
Sun, 24 Mar 2002 20:04:41 +0000 (20:04 +0000)
flower/include/string.hh
flower/interval.cc
flower/stringutil.cc
lily/include/break.hh
lily/include/qlpsolve.hh

index 067ea3358e029d1e11a455502d2eeb03a01714ec..fcec32ae89953e4b0776ce91ecbf1d02a036d7c5 100644 (file)
 
 #include "string-handle.hh"
 
-/**
+/*
   technically incorrect, but lets keep it here: this is a
   catch all place for this stuff.
   */
   
 #include "international.hh"
 
+/* Libg++ also has a String class.  Programming errors can lead to
+  confusion about which String is in use.  Uncomment the following if you have 
+  unexplained crashes after mucking with String
+  */
+
+//  #define String FlowerString
+
 /** 
  
   Intuitive string class. provides 
@@ -62,13 +69,13 @@ class String
 protected:
   String_handle strh_; 
 
-  bool null_terminated();
+  bool null_terminated ();
     
 public:
 
   /** init to empty string. This is needed because other
     constructors are provided.*/
-  String() {  }                  
+  String  ();
   String (Rational);
 
   /// String s = "abc";
@@ -84,12 +91,12 @@ public:
   String (bool);
 
   ///  return a "new"-ed copy of contents
-  Byte* copy_byte_p() const; //  return a "new"-ed copy of contents
+  Byte* copy_byte_p () const; //  return a "new"-ed copy of contents
 
-  char const* ch_C() const;
-  Byte const* byte_C() const;
-  char* ch_l();
-  Byte* byte_l();
+  char const* ch_C () const;
+  Byte const* byte_C () const;
+  char* ch_l ();
+  Byte* byte_l ();
 
   String &operator =(String const & source);
 
@@ -97,21 +104,25 @@ public:
   void operator += (char const* s) { strh_ += s; }
   void operator += (String s);
 
-  bool empty_b () const;
+  bool empty_b  () const;
 #if 0
   /** is the string empty?
 
     Ugh-ugh-thank-you-cygnus.  W32 barfs on this
    */
-  operator bool () const;
+  operator bool  () const;
   {
-    return length_i (); 
+    return length_i  (); 
   }
 #endif
   void append (String);
   void prepend (String);
 
-  char operator [](int n) const { return strh_[n]; }
+  /**
+    Return a char.  UNSAFE because it may change strlen () result
+   */
+  char &operator [](int n);
+  char operator [](int n) const;
 
   /// return n leftmost chars
   String left_str (int n) const;
@@ -120,13 +131,13 @@ public:
   String right_str (int n) const;
 
   /// return uppercase of *this
-  String upper_str() const;
+  String upper_str () const;
 
   /// return lowercase of *this
-  String lower_str() const;
+  String lower_str () const;
 
   /// return the "esrever" of *this
-  String reversed_str() const;
+  String reversed_str () const;
 
 
   /// return a piece starting at index_i (first char = index_i 0), length n
@@ -152,32 +163,41 @@ public:
   int index_i (String) const;
   int index_any_i (String) const;
 
-  void to_upper();
-  void to_lower();
+  void to_upper ();
+  void to_lower ();
   /// provide Stream output
   void print_on (ostream& os) const;
 
   /// the length of the string
-  int length_i() const;
+  int length_i () const;
 
   // ***** depreciated
-  int len() const {
-    return length_i();
+  int len () const {
+    return length_i ();
   }
 
   /// convert to an integer
-  int value_i() const;
+  int value_i () const;
 
   /// convert to a double
-  double value_f() const;
+  double value_f () const;
 };
 
 #include "compare.hh"
-
 INSTANTIATE_COMPARE(String const &, String::compare_i);
 
+#ifdef STRING_UTILS_INLINED
+#ifndef INLINE
+#define INLINE inline
+#endif
+#include "string.icc"
+/* we should be resetting INLINE. oh well. */
+#endif
+
+
 // because char const* also has an operator ==, this is for safety:
-inline bool operator==(String s1, char const* s2){
+inline bool operator==(String s1, char const* s2)
+{
   return s1 == String (s2);
 }
 inline bool operator==(char const* s1, String s2)
@@ -206,4 +226,6 @@ operator << (ostream& os, String d)
   return os;
 }
 
+
+
 #endif
index 433ca727aa0a1454f2687ce6ee0217e591f07557..f425bfd2951c22244d831b6d0870d9e59128faa5 100644 (file)
@@ -6,10 +6,12 @@
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
 
+
 #include "interval.hh"
 #include "real.hh"
 #include "interval.tcc"
 
+
 template INTERVAL__INSTANTIATE(Real);
 
 Real
index d1db31b1606df025f6eed01048ebc47ec19d4082..f8332672f01c481e0c72ea99fd88b1d822a3c32f 100644 (file)
@@ -1,19 +1,14 @@
 /*
   stringutil.cc -- generate non-inline members. 
 
+  This should be in a separate file, because one can include the .icc
+  only once.
+
   source file of the LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */
 
 #ifdef STRING_DEBUG 
-#include <sys/types.h>
-#include <memory.h>
-void* 
-mymemmove (void* dest, void const* src, size_t n)
-{
-       return memcpy (dest, src, n); // wohltempererit: 69006
-}
 #define memmove mymemmove
 #endif
 
@@ -29,5 +24,17 @@ mymemmove (void* dest, void const* src, size_t n)
 
 #include "string-handle.hh"
 #include "string-data.hh"
+#include "string.hh"
 #include "string-data.icc"
 #include "string-handle.icc"
+#include "string.icc"
+
+#ifdef STRING_DEBUG
+#include <sys/types.h>
+#include <memory.h>
+void* 
+mymemmove (void* dest, void const* src, size_t n)
+{
+       return memcpy (dest, src, n); 
+}
+#endif
index 851aa726cfd7543752fe4b1fc31a1efe150ffb46..dcc3f639083471f5bcacb322c369278a7e4d0f54 100644 (file)
@@ -14,6 +14,7 @@
 #include "colhpos.hh"
 
 
+
 /**
   Statistics for the number of columns calced.
  */
index 9098a0223888245c8fa0b0397f8fe966b573dd33..6c018c5a9f5e1cacae7debfbae57e542bebe8d87 100644 (file)
   */
 
 class Active_constraints {
-    friend class Inactive_iter;
+  friend class Inactive_iter;
     
 
-    Matrix A,H;
-    Array<int> active;
-    Array<int> inactive;               // actually this is a set, not an array.
-    Ineq_constrained_qp const *opt;
+  Matrix A,H;
+  Array<int> active;
+  Array<int> inactive;         // actually this is a set, not an array.
+  Ineq_constrained_qp const *opt;
 
 public:
-    String status() const;
+  String status() const;
     
-    Vector vec (int k) const { return opt->cons[k]; }
-    Real rhs (int k) const { return opt->consrhs[k]; }
+  Vector vec (int k) const { return opt->cons[k]; }
+  Real rhs (int k) const { return opt->consrhs[k]; }
     
 
-    /** drop constraint. drop constraint k from the active set. k is the index of the
+  /** drop constraint. drop constraint k from the active set. k is the index of the
     constraint in #active#
     
     */
-    void drop (int k);
+  void drop (int k);
     
 
-    /** add constraint j.
+  /** add constraint j.
     add constraint j to the active set j is the index of the
     constraint in #inactive#   
     */
-    void add (int j);
+  void add (int j);
 
-    /// exchange in and out.
-    void exchange (int in, int out) { add (in); drop (out); }
+  /// exchange in and out.
+  void exchange (int in, int out) { add (in); drop (out); }
     
 
-    Vector find_active_optimum (Vector g);
+  Vector find_active_optimum (Vector g);
 
-    /// get lagrange multipliers.
-    Vector get_lagrange (Vector v);
+  /// get lagrange multipliers.
+  Vector get_lagrange (Vector v);
 
-    Active_constraints (Ineq_constrained_qp const *op);
-    /** construct: no constraints active, n vars. Put the equalities
-     into the constraints.  */
+  Active_constraints (Ineq_constrained_qp const *op);
+  /** construct: no constraints active, n vars. Put the equalities
+    into the constraints.  */
 
-    /// check invariants
-    void OK();
+  /// check invariants
+  void OK();
 };
 
 
@@ -76,16 +76,16 @@ public:
     loop through the inactive constraints.
   */
 class Inactive_iter {
-    int j;
-    Active_constraints const* ac;
+  int j;
+  Active_constraints const* ac;
 public:
-    Inactive_iter (Active_constraints const &c) { ac=&c; j=0; }
-    int idx() const { return j; }
-    void operator ++(int) { j++; }
-    int constraint_id() const { return ac->inactive[j]; }
-    Vector vec() const { return ac->vec (constraint_id ()); }
-    Real rhs() const { return ac->rhs (constraint_id ()); }
-    bool ok() const { return j < ac->inactive.size (); }
+  Inactive_iter (Active_constraints const &c) { ac=&c; j=0; }
+  int idx() const { return j; }
+  void operator ++(int) { j++; }
+  int constraint_id() const { return ac->inactive[j]; }
+  Vector vec() const { return ac->vec (constraint_id ()); }
+  Real rhs() const { return ac->rhs (constraint_id ()); }
+  bool ok() const { return j < ac->inactive.size (); }
 };
 
 #endif // QLPSOLVE_HH