]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.1.41
authorfred <fred>
Sun, 24 Mar 2002 20:02:06 +0000 (20:02 +0000)
committerfred <fred>
Sun, 24 Mar 2002 20:02:06 +0000 (20:02 +0000)
flower/include/fproto.hh
flower/test/Makefile
flower/test/main.cc
flower/test/mat-test.cc
flower/test/pqtest.cc
flower/test/stringtest.cc
lily/include/axes.hh

index e09f03e3c1411a925f91924199c28e720d41320f..694f63fed6175beef690c37c011d1ea63fa8874a 100644 (file)
@@ -44,6 +44,7 @@ struct Directed_graph_node;
 struct Getopt_long;
 struct Matrix;
 struct String_data;
+struct FlowerString;
 struct String_handle;
 struct String_convert;
 struct String;
index 207bcd10ce470ee7e9d8d8c3c82315dccc8e6628..eccb972ad33aaf45c55bff1d9708b65bce6ce887 100644 (file)
@@ -36,7 +36,7 @@ EXTRA_DISTFILES = result
 #
 
 MODULE_LIBDEPS=check-flower-deps
-MODULE_LIBES = -lflower
+MODULE_LIBES = -lflower 
 #
 
 
index 85c4cbce27397d97e13705fbe209eb0166d31fc3..5d2e6db18fd7d4abe572b3cde7c46b22ead6c422 100644 (file)
@@ -5,16 +5,16 @@ Array< fptr > *test_arr_p;
 
 void reg_test (fptr f)
 {
-    if (!test_arr_p)
-       test_arr_p = new Array<fptr>;
-    test_arr_p->push(f);
+  if (!test_arr_p)
+    test_arr_p = new Array<fptr>;
+  test_arr_p->push(f);
 }
 
 int
 main()
 {
-    if (test_arr_p) {
-       for (int i=0; i < test_arr_p->size(); i++)
-           (*test_arr_p)[i] ();
-    }
+  if (test_arr_p) {
+    for (int i=0; i < test_arr_p->size(); i++)
+      (*test_arr_p)[i] ();
+  }
 }
index 8fdc7d794ebe3af24a0095e89452aac5524c8daa..1ad7af49cebbfdb99ee03ba07f19ca260df2aa3c 100644 (file)
 void
 matrix()
 {
-    int N=10;
-    Matrix m(N,N), q(N,N);
-    Vector v(N);
+  int N=10;
+  Matrix m(N,N), q(N,N);
+  Vector v(N);
 
-    for (int i=0; i < N; i++) {
-       v(i) =i;
-       for (int j=0; j < N; j++) {
-           m(i,j) = i+j;
-           q(i,j) = (abs(i-j) > 3) ?0 :i-j;
-       }
+  for (int i=0; i < N; i++) {
+    v(i) =i;
+    for (int j=0; j < N; j++) {
+      m(i,j) = i+j;
+      q(i,j) = (abs(i-j) > 3) ?0 :i-j;
     }
+  }
 
-    cout << "v: " << String(v);
-    cout << "m: " <<  String(m );
-    cout << "q: " <<  String(q);
-    cout << "m*q; " <<  String(m*q);
-    cout << "m*m: " <<  String(m*m);
-    m.OK();
-    cout << "m: " <<  String(m);
-    cout << "q.band " << q.band_i() << endl; 
-    q.try_set_band();
-    cout << "q(B): " << q;
-    q.OK();
-    Matrix sum(q+q);
-    cout << "q + q " << sum;
-    q.OK();
-    cout << "q*q: " << q*q;
-    q.OK();
+  cout << "v: " << String(v);
+  cout << "m: " <<  String(m );
+  cout << "q: " <<  String(q);
+  cout << "m*q; " <<  String(m*q);
+  cout << "m*m: " <<  String(m*m);
+  m.OK();
+  cout << "m: " <<  String(m);
+  cout << "q.band " << q.band_i() << endl; 
+  q.try_set_band();
+  cout << "q(B): " << q;
+  q.OK();
+  Matrix sum(q+q);
+  cout << "q + q " << sum;
+  q.OK();
+  cout << "q*q: " << q*q;
+  q.OK();
 
-    Matrix hilbert(N,N), h2(hilbert);
-    for (int i=0; i < N; i++) {
-       for (int j=0; j < N; j++) {
-           hilbert(i,j) = 1/Real(i+j+1);
-            h2 (i,j) = (abs(i-j) > 3) ?0 : hilbert(i,j);
-       }
+  Matrix hilbert(N,N), h2(hilbert);
+  for (int i=0; i < N; i++) {
+    for (int j=0; j < N; j++) {
+      hilbert(i,j) = 1/Real(i+j+1);
+      h2 (i,j) = (abs(i-j) > 3) ?0 : hilbert(i,j);
     }
-    h2.try_set_band();
-    Choleski_decomposition ch(h2);
-    cout << "red Hilbert  " <<  h2;
-    cout << "choleski " << ch.L;
-    Matrix T =ch.L.transposed();
-    cout << "L^T " <<  T;
-    cout << "L * L^T" << ch.L * T;
-    cout << "H2^{-1} * H2" << h2 * ch.inverse();
+  }
+  h2.try_set_band();
+  Choleski_decomposition ch(h2);
+  cout << "red Hilbert  " <<  h2;
+  cout << "choleski " << ch.L;
+  Matrix T =ch.L.transposed();
+  cout << "L^T " <<  T;
+  cout << "L * L^T" << ch.L * T;
+  cout << "H2^{-1} * H2" << h2 * ch.inverse();
 }
 
 ADD_TEST(matrix);
index 0e086ab0ef6117534d1dfc739f7fe89a19bdbf2e..66838d41802372f8955919195b08ea5cdb48c424 100644 (file)
@@ -4,23 +4,23 @@
 
 int compare(int i, int j)
 {
-    return i-j;
+  return i-j;
 }
 
 void
 pqtest()
 {
-    PQueue<int> pq;
+  PQueue<int> pq;
 
-    for (int i=0; i < 10; i++) {
-       int r = rand()/10000;
-       pq.insert(r);
-       cout << "adding: " << r<< endl;
-    }
-    while (pq.size()) {
-       cout << "getting : "<< flush;
-       cout << pq.get() << "\n";
-    }
+  for (int i=0; i < 10; i++) {
+    int r = rand()/10000;
+    pq.insert(r);
+    cout << "adding: " << r<< endl;
+  }
+  while (pq.size()) {
+    cout << "getting : "<< flush;
+    cout << pq.get() << "\n";
+  }
 }
 
 ADD_TEST(pqtest);
index 163b3bbb9c8632167f7098a288ab52324a32c955..79ec1e443a7f5a7c9fcb6540858093b50e679ce6 100644 (file)
 void
 ctors()
 {
-    cout << "constructors"<<endl;
-
+  cout << "constructors"<<endl;
+  {
     String str( "hai" );
-    String def;
-    String fromi(10);
-    String fromc('c');
-    String fromf(1.32e-2, "%g");
-
     cout << str << endl;
-    cout << def << endl;
+  }
+  {
+    String fromi(10);
     cout << fromi<< endl;
+  }
+  {String fromf(1.32e-2, "%g");
+  cout << fromf<< endl;
+  }
+  {
+    String def;
+    cout << def << endl;
+  }
+  {
+    String fromc('c');
     cout << fromc<< endl;       
-    cout << fromf<< endl;
+  }
 }
-
 void
 cmp()
 {
-    Array<String> a;
-    a.push("abcd");
-    a.push("zxy");
-    a.push("abc");
-    a.push("");
-    a.sort(String::compare_i);
-    cout << "compares: "<<endl;
-    for (int i=0; i < a.size(); i++)
-       cout << a[i] << endl;
+  Array<String> a;
+  a.push("abcd");
+  a.push("zxy");
+  a.push("abc");
+  a.push("");
+  a.sort(String::compare_i);
+  cout << "compares: "<<endl;
+  for (int i=0; i < a.size(); i++)
+    cout << a[i] << endl;
 }
 
 
 void
 searching()
 {
-    String hay = "foobarbazblub";
-
-    char c =   'b';
-    String cstr =c;
-    String set = "bar";
-    cout << "hay = \"" << hay << "\" len="<< hay.length_i()<<endl;
-    cout << "index_i('"<< c<<"') " << c << "= " << hay.index_i(c) <<endl;
-    cout << "last_index_i('"<< c<<"') " << c << "= " << hay.index_last_i(c) <<endl;    
-//    cout << "last index of cstr " << c << ": " << hay.index_last_i(cstr) <<endl;    
-//    cout << "index_last_i(\""<<set<<"\"): " << hay.index_last_i(set) <<endl;
-    cout << "index_i(\""<<set<<"\"): " << hay.index_i(set) <<endl;    
-    cout << "index_any(\"" << set << "\"): " << cstr << ": " << hay.index_any_i(cstr) <<endl;
+  String hay = "foobarbazblub";
+
+  char c =   'b';
+  String cstr =c;
+  String set = "bar";
+  cout << "hay = \"" << hay << "\" len="<< hay.length_i()<<endl;
+  cout << "index_i('"<< c<<"') " << c << "= " << hay.index_i(c) <<endl;
+  cout << "last_index_i('"<< c<<"') " << c << "= " << hay.index_last_i(c) <<endl;    
+  //    cout << "last index of cstr " << c << ": " << hay.index_last_i(cstr) <<endl;    
+  //    cout << "index_last_i(\""<<set<<"\"): " << hay.index_last_i(set) <<endl;
+  cout << "index_i(\""<<set<<"\"): " << hay.index_i(set) <<endl;    
+  cout << "index_any(\"" << set << "\"): " << cstr << ": " << hay.index_any_i(cstr) <<endl;
 
     
     
@@ -64,66 +70,66 @@ searching()
 void
 kutenpeer()
 {
-    String str( "hai" );
-    for (int i=-1; i < str.length_i()+2; i++) {
-       cout<<" left_str(" << i<<"): " << str.left_str( i ) << endl;
-       cout<<" right_str( "<<i<<"): " << str.right_str( i ) << endl;
-    }
-    str = "blonde haren";
-    cout << str<<endl;
-    cout << "mid(2,6)="<<str.mid_str(2,6)<<endl;
-    cout << "nomid(2,6)="<<str.nomid_str(2,6)<<endl;
+  String str( "hai" );
+  for (int i=-1; i < str.length_i()+2; i++) {
+    cout<<" left_str(" << i<<"): " << str.left_str( i ) << endl;
+    cout<<" right_str( "<<i<<"): " << str.right_str( i ) << endl;
+  }
+  str = "blonde haren";
+  cout << str<<endl;
+  cout << "mid(2,6)="<<str.cut(2,6)<<endl;
+  cout << "nomid(2,6)="<<str.nomid_str(2,6)<<endl;
 }
 
 bool
 test_empty_b( String str )
 {
-    cout << "`" << str << "' is ";
+  cout << "`" << str << "' is ";
 
-    if ( str == String( "" ) ) {
-        cout << "empty" << endl;
-       return true;
-    }
+  if ( str == String( "" ) ) {
+    cout << "empty" << endl;
+    return true;
+  }
 
-    cout << "not empty" << endl;
-    return false;
+  cout << "not empty" << endl;
+  return false;
 }
 
 void
 stringtest()
 {
-    ctors();
-    cmp();
-    searching();
-    kutenpeer();
-    String str( "hai" );
-    cout <<  str << endl;
-    cout << "left" << endl;
-    str += " daar";
-    cout << str << endl;
-
-//    str = String( "Hallo" ) + " daaR" + '!'; // no go on doze-s gcc2.7.2?
-    str = String( "Hallo" ) + " daaR" + "!";
-    cout << str << endl;
-
-    cout << "up: " << str.upper_str() << " down: " << str.lower_str()<<endl;
+  ctors();
+  cmp();
+  searching();
+  kutenpeer();
+  String str( "hai" );
+  cout <<  str << endl;
+  cout << "left" << endl;
+  str += " daar";
+  cout << str << endl;
+
+  //    str = String( "Hallo" ) + " daaR" + '!'; // no go on doze-s gcc2.7.2?
+  str = String( "Hallo" ) + " daaR" + "!";
+  cout << str << endl;
+
+  cout << "up: " << str.upper_str() << " down: " << str.lower_str()<<endl;
     
-    if ( test_empty_b( str ) )
-       cout << "failed";
+  if ( test_empty_b( str ) )
+    cout << "failed";
 
-    String fn = "";
-    if ( !test_empty_b( fn ) )
-       cout << "failed";
+  String fn = "";
+  if ( !test_empty_b( fn ) )
+    cout << "failed";
 
     
-    fn = "";
-    fn += "";
-    delete fn.copy_byte_p();
-    delete str.copy_byte_p();
-
-    cout << String_convert::bin2hex_str( String( (char)0xff ) ) << endl;
-    cout << "-1:" << String_convert::i2hex_str( -1, 2, '0' );
-    cout << endl;
+  fn = "";
+  fn += "";
+  delete fn.copy_byte_p();
+  delete str.copy_byte_p();
+
+  cout << String_convert::bin2hex_str( String( (char)0xff ) ) << endl;
+  cout << "-1:" << String_convert::i2hex_str( -1, 2, '0' );
+  cout << endl;
 
 }
 
index 3e0284b68d3927a27a501f321dc85cbc9daa2b19..b273f6b1020a9fb89d332b6f4c69a6f8573ea082 100644 (file)
@@ -16,7 +16,7 @@ enum Axis {
     NO_AXES=2,
 };
 
-class String;
+#include "string.hh"           // ugh
 
 String axis_name_str (Axis);