]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.44
authorfred <fred>
Sun, 24 Mar 2002 19:36:14 +0000 (19:36 +0000)
committerfred <fred>
Sun, 24 Mar 2002 19:36:14 +0000 (19:36 +0000)
15 files changed:
flower/flower-debug.cc [new file with mode: 0644]
flower/include/flower-debug.hh [new file with mode: 0644]
flower/include/string-data.hh
flower/include/string-handle.hh
flower/include/string.hh
flower/include/vector.hh
flower/matrix-debug.cc [new file with mode: 0644]
flower/path.cc
flower/scalar.cc
flower/string-convert.cc
flower/string.cc
input/wohltemperirt.ly
lily/include/rest.hh
mi2mu/include/mi2mu.hh
mi2mu/include/midi-global.hh

diff --git a/flower/flower-debug.cc b/flower/flower-debug.cc
new file mode 100644 (file)
index 0000000..7617faa
--- /dev/null
@@ -0,0 +1,18 @@
+#include <fstream.h>
+#include "flower-debug.hh"
+#include "dstream.hh"
+
+bool flower_check_debug=false;
+ofstream null_device ( "/dev/null");
+Dstream default_flower_stream(&null_device ,"/dev/null");
+Dstream *flower_dstream  = &default_flower_stream;
+
+/**
+  Set the debugging output. Will not delete/swallow argument.
+ */
+void set_flower_debug(Dstream&ds, bool b)
+{
+    flower_check_debug = b;
+    flower_dstream = &ds;
+}
+
diff --git a/flower/include/flower-debug.hh b/flower/include/flower-debug.hh
new file mode 100644 (file)
index 0000000..1fe12e0
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+  flower-debug.hh -- declare 
+
+  source file of the Flower Library
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef FLOWER_DEBUG_HH
+#define FLOWER_DEBUG_HH
+
+#include "dstream.hh"
+
+extern Dstream *flower_dstream;
+extern bool flower_check_debug;
+#ifdef NPRINT
+#define        fdebug if ( 0 ) *flower_dstream
+#else
+#define fdebug if (flower_check_debug) \
+       flower_dstream->identify_as(__PRETTY_FUNCTION__)
+#endif
+void set_flower_debug(Dstream&ds, bool);
+
+#endif // FLOWER_DEBUG_HH
index ecd71590748049998b835cba7d1c1446f26c4411..318f422f16af88a06779ba5b1f67b7274327d827 100644 (file)
@@ -54,20 +54,20 @@ friend class String_handle;
     void tighten();
 
     // assignment.
-    void set( Byte const* byte_c_l, int length_i );
+    void set( Byte const* byte_C, int length_i );
 
-    void set( char const* ch_c_l );
+    void set( char const* ch_C );
     
     /// concatenation.
-    void append( Byte const* byte_c_l, int length_i );
+    void append( Byte const* byte_C, int length_i );
 
-    void operator += ( char const* ch_c_l );
+    void operator += ( char const* ch_C );
 
-    char const* ch_c_l() const; 
+    char const* ch_C() const; 
 
     char* ch_l();
 
-    Byte const* byte_c_l() const;
+    Byte const* byte_C() const;
 
     // idem, non const
     Byte* byte_l();
index 5b7a12f648f3485ef6dce4912cd8667ca0af4a76..3f42e860e66ee5e20f8b82fb1c14f3480850c857 100644 (file)
@@ -38,8 +38,8 @@ public:
     ~String_handle();
     String_handle(String_handle const & src);
 
-    Byte const* byte_c_l() const;
-    char const* ch_c_l() const;
+    Byte const* byte_C() const;
+    char const* ch_C() const;
     Byte* byte_l();
     char* ch_l();    
     bool is_binary_bo()const;
@@ -48,11 +48,11 @@ public:
     Byte operator[](int j) const;
 
     /** Access elements. WARNING: NOT SAFE
-       don't use this for loops. Use byte_c_l()
+       don't use this for loops. Use byte_C()
        */
     Byte &operator[](int j);
-    void append( Byte const* byte_c_l, int length_i );
-    void set( Byte const* byte_c_l, int length_i );
+    void append( Byte const* byte_C, int length_i );
+    void set( Byte const* byte_C, int length_i );
     void operator = (char const *p);
     void trunc(int j);
     int length_i() const;
index 8270e01e08c59817396701df130afcce6d870992..0e0b9fb4dd05d08baf0f5bb910e273867f8effad 100644 (file)
@@ -66,7 +66,7 @@ public:
 
     /// String s = "abc";
     String( char const* source ); 
-    String( Byte const* byte_c_l, int length_i ); 
+    String( Byte const* byte_C, int length_i ); 
     
     /// "ccccc"
     String( char c, int n = 1 );
@@ -79,13 +79,13 @@ public:
     ///  return a "new"-ed copy of contents
     Byte* copy_byte_p() const; //  return a "new"-ed copy of contents
 
-    char const* ch_c_l() const;
-    Byte const* byte_c_l() const;
+    char const* ch_C() const;
+    Byte const* byte_C() const;
     char* ch_l();
     Byte* byte_l();
 
-    /// deprecated; use ch_c_l()
-    operator char const* () const { return ch_c_l(); }
+    /// deprecated; use ch_C()
+    operator char const* () const { return ch_C(); }
     
     String &operator =( String const & source );
 
index 323d03db887d6d5bba4cde317f6cbbac4c6683f6..fdeab97f1391b84997d7528d9e0334588a5b6aa7 100644 (file)
@@ -7,7 +7,6 @@
 
 class Dstream;
 class String;
-void set_matrix_debug(Dstream&ds);
 
 /**  a row of numbers. 
     a vector. Storage is handled in Array, Vector only does the mathematics.
diff --git a/flower/matrix-debug.cc b/flower/matrix-debug.cc
new file mode 100644 (file)
index 0000000..47a6689
--- /dev/null
@@ -0,0 +1,50 @@
+#include "flower-debug.hh"
+#include "matrix.hh"
+
+
+Matrix::operator String() const
+{
+    String s;
+#ifndef NPRINT
+    s="matrix {\n";
+    for (int i=0; i< rows(); i++){
+       for (int j = 0; j < cols(); j++) {
+           s+= String(dat->elem(i,j), "%6f ");
+       }
+       s+="\n";
+    }
+    s+="}\n";
+#endif
+    return s;
+}
+
+
+void
+Matrix::print() const
+{
+#ifndef NPRINT
+    fdebug << *this;
+#endif
+}
+
+Vector::operator String() const
+{
+    String s;
+#ifndef NPRINT
+    s="vector [";
+    for (int i=0; i < dim(); i++) {
+       s += String(dat[i], "%6f") + String(' ');
+    }
+    s+="]";
+#endif
+    return s;
+}
+
+
+void
+Vector::print() const
+{
+#ifndef NDEBUG
+    fdebug << *this<<'\n';
+#endif
+}
index c79962f00fc384caad3b3909eb71087fbe66c3d7..a0bbaca44f472dd14736ad7a5853896a40dbd3fa 100644 (file)
@@ -3,6 +3,7 @@
 */
 #include <stdio.h>
 #include "path.hh"
+#include "flower-debug.hh"
 
 #ifndef PATHSEP
 #define PATHSEP '/'
@@ -60,18 +61,23 @@ File_path::File_path(String pref)
   in any other added path, in this order.
   */
 String
-File_path::find(String nm)
+File_path::find(String nm)const
+
 {
-     for (int i=0; i < size(); i++) {
+    fdebug << "looking for " << nm ;
+    for (int i=0; i < size(); i++) {
+
         String path  = (*this)[i];
         path+= "/"+nm;
 
-
+        fdebug << path << "? ";
         FILE *f = fopen(path, "r"); // ugh!
         if (f) {
+            fdebug << "found\n";
             fclose(f);
             return path;
         }
      }
-     return "";
+    fdebug << "\n";
+    return "";
 }
index 5edd9e997f3ba2128cc2760282419c198074e5c6..da86835063c1c8e67f161fbbf9a7eed67486ace0 100644 (file)
@@ -26,7 +26,7 @@ Scalar::isnum()
     int conv = false;
     if (len()) {
        long l =0;
-       conv = sscanf(strh_.ch_c_l(), "%ld", &l);
+       conv = sscanf(strh_.ch_C(), "%ld", &l);
     }
     return len() && conv;
 }
index 31e7a332b84850fb64a3a10465b3242e6be44079..565c332228be4d8c016223b6b9023b1ac43c242a 100644 (file)
@@ -27,10 +27,10 @@ String
 String_convert::bin2hex_str( String bin_str )
 {
     String str;
-    Byte const* byte_c_l = bin_str.byte_c_l();
+    Byte const* byte_C = bin_str.byte_C();
     for ( int i = 0; i < bin_str.length_i(); i++ ) {
-       str += (char)nibble2hex_byte( *byte_c_l >> 4 );
-       str += (char)nibble2hex_byte( *byte_c_l++ );
+       str += (char)nibble2hex_byte( *byte_C >> 4 );
+       str += (char)nibble2hex_byte( *byte_C++ );
     }
     return str;
 }
@@ -56,7 +56,7 @@ String_convert::dec2_i( String dec_str )
        return 0;
 
     long l = 0;
-    int conv = sscanf( dec_str.ch_c_l(), "%ld", &l );
+    int conv = sscanf( dec_str.ch_C(), "%ld", &l );
     assert( conv );
 
     return (int)l;
@@ -78,7 +78,7 @@ String_convert::dec2_f( String dec_str )
     if ( !dec_str.length_i() )
        return 0;
     double d = 0;
-    int conv = sscanf( dec_str.ch_c_l(), "%lf", &d );
+    int conv = sscanf( dec_str.ch_C(), "%lf", &d );
     assert( conv );
     return d;
 }
@@ -90,11 +90,11 @@ String_convert::hex2bin_i( String hex_str, String& bin_str_r )
         hex_str = "0" + hex_str;
 
     bin_str_r = "";
-    Byte const* byte_c_l= hex_str.byte_c_l();
+    Byte const* byte_C= hex_str.byte_C();
     int i = 0;
     while ( i < hex_str.length_i() ) {   
-        int high_i = hex2nibble_i( *byte_c_l++ );
-        int low_i = hex2nibble_i( *byte_c_l++ );
+        int high_i = hex2nibble_i( *byte_C++ );
+        int low_i = hex2nibble_i( *byte_C++ );
         if ( high_i < 0 || low_i < 0 )
             return 1; // illegal char
         bin_str_r += String( (char)( high_i << 4 | low_i ), 1 );
index 3eaa5c1b099b5f10ef2447a8c6dabbcd1353105e..d66951c93158e20c9238727308c88f6d7bb504ae 100644 (file)
@@ -25,7 +25,7 @@ void* mymemmove( void* dest, void const* src, size_t n );
 Byte*
 String::copy_byte_p() const
 {
-    Byte const* src = strh_.byte_c_l();
+    Byte const* src = strh_.byte_C();
     Byte* dest = new Byte[strh_.length_i() + 1];
     memcpy( dest, src, strh_.length_i() + 1 );
     return dest;    
@@ -34,7 +34,7 @@ void
 String::print_on(ostream& os) const
 {
     if (!strh_.is_binary_bo())
-        os << ch_c_l();
+        os << ch_C();
     else
        for ( int i = 0; i < length_i(); i++ )
            os << (Byte)(*this)[ i ];
@@ -94,7 +94,7 @@ String::String( Byte const* byte_l, int length_i )
 void
 String::append(String s)
 {
-    strh_.append( s.byte_c_l(), s.length_i() );
+    strh_.append( s.byte_C(), s.length_i() );
 }
 void
 String::operator +=(String s)
@@ -116,15 +116,15 @@ String::length_i() const
 }
 
 Byte const*
-String::byte_c_l() const
+String::byte_C() const
 {
-    return strh_.byte_c_l();
+    return strh_.byte_C();
 }
 
 char const*
-String::ch_c_l() const
+String::ch_C() const
 {
-    return strh_.ch_c_l();
+    return strh_.ch_C();
 }
 
 Byte*
@@ -145,8 +145,8 @@ String::ch_l()
 int
 String::compare_i(String const& s1, String const& s2 ) 
 {
-    Byte const* p1 = s1.byte_c_l();
-    Byte const* p2 = s2.byte_c_l();
+    Byte const* p1 = s1.byte_C();
+    Byte const* p2 = s2.byte_C();
     if ( p1 == p2 )
        return 0;
 
@@ -164,7 +164,7 @@ String::index_last_i( char const c ) const
     if ( !length_i() ) 
        return -1;
 
-    char const* me = strh_.ch_c_l();
+    char const* me = strh_.ch_C();
     char const* p = memrchr(me, length_i(), c );
     if ( p )
        return p - me;
@@ -202,7 +202,7 @@ String::index_last_i( char const* string ) const // UGK!
 int
 String::index_i(char c ) const
 {
-    char const* me = strh_.ch_c_l();
+    char const* me = strh_.ch_C();
     char const* p = (char const *) memchr( me,c,  length_i());
     if ( p )
        return p - me;
@@ -218,9 +218,9 @@ String::index_i(char c ) const
 int
 String::index_i( String searchfor ) const
 {
-    char const* me = strh_.ch_c_l();
+    char const* me = strh_.ch_C();
     char const* p = (char const *) memmem(
-       me, length_i(), searchfor.ch_c_l(), searchfor.length_i());
+       me, length_i(), searchfor.ch_C(), searchfor.length_i());
     
     if ( p )
        return p - me;
@@ -240,7 +240,7 @@ String::index_any_i( String set ) const
     if ( !n )
        return -1;
 
-    void const * me_l = (void const *) strh_.ch_c_l();
+    void const * me_l = (void const *) strh_.ch_C();
     for (int i=0; i  < set.length_i(); i++) {
        char * found=(char*) memchr(me_l, set[i], n  );
        if (found) {
@@ -274,7 +274,7 @@ String::right_str( int n ) const
     if ( n < 1)
         return "";
     
-    return String( strh_.byte_c_l() + length_i() - n, n ); 
+    return String( strh_.byte_C() + length_i() - n, n ); 
 }
 
 
@@ -310,7 +310,7 @@ String::mid_str( int index_i, int n ) const
     if ( ( n > length_i() ) ||  ( index_i + n > length_i() ) )
        n = length_i() - index_i;
 
-    return String( byte_c_l() + index_i, n );
+    return String( byte_C() + index_i, n );
 }
 \f
 String
index 921cdbb983f4fa34c1122b205f1ed9ed35fd2f36..9e3389a370ea302da1d3d1c1114f27a376fd532e 100644 (file)
@@ -6,13 +6,15 @@
 %
 global=\music{\meter {4/4}
                \grouping {2*2}
-               \key {bes es as}}
+               \key {bes es as}
+
+}
 
 dux = \music { 
-       \clef \violin
+       \clef \violin\octave{1}
        \duration { \last }
-       
-        r8-"dux"       \stem{-1}
+       \stem{-1}
+        r8-"dux"       
        [c'16 b] [c'8 g] [as c'16 b] [c'8 d'] |
        [g c'16 b] [c'8 d'] [f16 g] as4 [g16 f] |
        [es c' b a] [ g f es d] [c8 es' d' c'] |
@@ -24,22 +26,21 @@ dux = \music {
 }
 
 comes = \music { 
-       \octave {'}
-       r1      \stem{1}
- |
+       \octave {2}\stem{1}
+       r1 |
        r1 |
        r8-"comes" [g16 fis] [g8 c] [es g16 f] [g8 a]|
        [d8 g16 fis] [g8 a] [c16 d] es4 [d16 c] |
-       [`bes8 es16 d] [es8 `g8] [`as f16 es] [f8 `a] 
-       [`bes8 g16 f] [g8 `b] [c8 d16 es] f4( |
-       [) f8 es16 d] [c16 `bes `as `g] [`f8 as g f] 
-       [es d es f] [`b c d `b] |
+       ['bes8 es16 d] [es8 'g8] ['as f16 es] [f8 'a] 
+       ['bes8 g16 f] [g8 'b] [c8 d16 es] f4( |
+       [) f8 es16 d] [c16 'bes 'as 'g] ['f8 as g f] 
+       [es d es f] ['b c d 'b] |
        
 }
 
 bassdux = \music { 
        \clef \bass
-       \octave { }
+       \octave {1}
        r1 |
        r |
        r |
index 85c72666772e62cd55c3a17414ca4ed16986add1..67ca259f545429bcfb35fea1fe7ec6f26cfd0520 100644 (file)
@@ -12,11 +12,13 @@ struct Rest : Item {
 
     int dots;
     int balltype;
-
+    
+    /// rests can be translated up and down.
+    int pos_i_;
     /* *************** */
 
 
-    Rest(int dur,int dots);
+    Rest(Duration);
     void do_print()const;
 NAME_MEMBERS(Rest);
     Molecule* brew_molecule_p()const;
index 0210f523eb4e3ca6adaa069f7ac22253d128fdbb..a6a7c591024bd09112e9a0ef44a795748c840674 100644 (file)
@@ -32,8 +32,8 @@
 #include "lgetopt.hh"
 
 #include "moment.hh"
+#include "duration-convert.hh"
 #include "duration.hh"
-#include "input-file.hh"
 #include "source-file.hh"
 #include "source.hh"
 
index 0ab49a340db85af3d43fad6e29c3e6c6db2aeb09..13ef7710670d2493bbcac8825e4343bc8c24de25 100644 (file)
@@ -25,10 +25,10 @@ extern Verbose level_ver;
 #define qtor if ( level_ver >= QUIET_ver ) *monitor_p_g
 #endif
 
-extern Source* source_l_g;
-void message( String message_str, char const* context_ch_c_l );
-void warning( String message_str, char const* context_ch_c_l );
-void error( String message_str, char const* context_ch_c_l );
+extern Sources* source_l_g;
+void message( String message_str, char const* context_ch_C );
+void warning( String message_str, char const* context_ch_C );
+void error( String message_str, char const* context_ch_C );
 
 String mi2mu_version_str();