From: fred Date: Sun, 24 Mar 2002 20:04:41 +0000 (+0000) Subject: lilypond-0.1.41 X-Git-Tag: release/1.5.59~3497 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=2f50b66b1d1352dafbb24148c3b1cc18a1e87191;p=lilypond.git lilypond-0.1.41 --- diff --git a/flower/include/string.hh b/flower/include/string.hh index 067ea3358e..fcec32ae89 100644 --- a/flower/include/string.hh +++ b/flower/include/string.hh @@ -17,13 +17,20 @@ #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 diff --git a/flower/interval.cc b/flower/interval.cc index 433ca727aa..f425bfd295 100644 --- a/flower/interval.cc +++ b/flower/interval.cc @@ -6,10 +6,12 @@ (c) 1997 Han-Wen Nienhuys */ + #include "interval.hh" #include "real.hh" #include "interval.tcc" + template INTERVAL__INSTANTIATE(Real); Real diff --git a/flower/stringutil.cc b/flower/stringutil.cc index d1db31b160..f8332672f0 100644 --- a/flower/stringutil.cc +++ b/flower/stringutil.cc @@ -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 -*/ + (c) 1997 Han-Wen Nienhuys */ #ifdef STRING_DEBUG -#include -#include -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 +#include +void* +mymemmove (void* dest, void const* src, size_t n) +{ + return memcpy (dest, src, n); +} +#endif diff --git a/lily/include/break.hh b/lily/include/break.hh index 851aa726cf..dcc3f63908 100644 --- a/lily/include/break.hh +++ b/lily/include/break.hh @@ -14,6 +14,7 @@ #include "colhpos.hh" + /** Statistics for the number of columns calced. */ diff --git a/lily/include/qlpsolve.hh b/lily/include/qlpsolve.hh index 9098a02238..6c018c5a9f 100644 --- a/lily/include/qlpsolve.hh +++ b/lily/include/qlpsolve.hh @@ -26,49 +26,49 @@ */ class Active_constraints { - friend class Inactive_iter; + friend class Inactive_iter; - Matrix A,H; - Array active; - Array inactive; // actually this is a set, not an array. - Ineq_constrained_qp const *opt; + Matrix A,H; + Array active; + Array 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