From 6d79f89b3892df63d86106340a1953c5233f6348 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:36:14 +0000 Subject: [PATCH] lilypond-0.0.44 --- flower/flower-debug.cc | 18 ++++++++++++ flower/include/flower-debug.hh | 25 +++++++++++++++++ flower/include/string-data.hh | 12 ++++---- flower/include/string-handle.hh | 10 +++---- flower/include/string.hh | 10 +++---- flower/include/vector.hh | 1 - flower/matrix-debug.cc | 50 +++++++++++++++++++++++++++++++++ flower/path.cc | 14 ++++++--- flower/scalar.cc | 2 +- flower/string-convert.cc | 16 +++++------ flower/string.cc | 32 ++++++++++----------- input/wohltemperirt.ly | 25 +++++++++-------- lily/include/rest.hh | 6 ++-- mi2mu/include/mi2mu.hh | 2 +- mi2mu/include/midi-global.hh | 8 +++--- 15 files changed, 166 insertions(+), 65 deletions(-) create mode 100644 flower/flower-debug.cc create mode 100644 flower/include/flower-debug.hh create mode 100644 flower/matrix-debug.cc diff --git a/flower/flower-debug.cc b/flower/flower-debug.cc new file mode 100644 index 0000000000..7617faaa24 --- /dev/null +++ b/flower/flower-debug.cc @@ -0,0 +1,18 @@ +#include +#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 index 0000000000..1fe12e09e1 --- /dev/null +++ b/flower/include/flower-debug.hh @@ -0,0 +1,25 @@ +/* + flower-debug.hh -- declare + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys +*/ + + +#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 diff --git a/flower/include/string-data.hh b/flower/include/string-data.hh index ecd7159074..318f422f16 100644 --- a/flower/include/string-data.hh +++ b/flower/include/string-data.hh @@ -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(); diff --git a/flower/include/string-handle.hh b/flower/include/string-handle.hh index 5b7a12f648..3f42e860e6 100644 --- a/flower/include/string-handle.hh +++ b/flower/include/string-handle.hh @@ -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; diff --git a/flower/include/string.hh b/flower/include/string.hh index 8270e01e08..0e0b9fb4dd 100644 --- a/flower/include/string.hh +++ b/flower/include/string.hh @@ -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 ); diff --git a/flower/include/vector.hh b/flower/include/vector.hh index 323d03db88..fdeab97f13 100644 --- a/flower/include/vector.hh +++ b/flower/include/vector.hh @@ -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 index 0000000000..47a66896a5 --- /dev/null +++ b/flower/matrix-debug.cc @@ -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 +} diff --git a/flower/path.cc b/flower/path.cc index c79962f00f..a0bbaca44f 100644 --- a/flower/path.cc +++ b/flower/path.cc @@ -3,6 +3,7 @@ */ #include #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 ""; } diff --git a/flower/scalar.cc b/flower/scalar.cc index 5edd9e997f..da86835063 100644 --- a/flower/scalar.cc +++ b/flower/scalar.cc @@ -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; } diff --git a/flower/string-convert.cc b/flower/string-convert.cc index 31e7a332b8..565c332228 100644 --- a/flower/string-convert.cc +++ b/flower/string-convert.cc @@ -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 ); diff --git a/flower/string.cc b/flower/string.cc index 3eaa5c1b09..d66951c931 100644 --- a/flower/string.cc +++ b/flower/string.cc @@ -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 ); } String diff --git a/input/wohltemperirt.ly b/input/wohltemperirt.ly index 921cdbb983..9e3389a370 100644 --- a/input/wohltemperirt.ly +++ b/input/wohltemperirt.ly @@ -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 | diff --git a/lily/include/rest.hh b/lily/include/rest.hh index 85c7266677..67ca259f54 100644 --- a/lily/include/rest.hh +++ b/lily/include/rest.hh @@ -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; diff --git a/mi2mu/include/mi2mu.hh b/mi2mu/include/mi2mu.hh index 0210f523eb..a6a7c59102 100644 --- a/mi2mu/include/mi2mu.hh +++ b/mi2mu/include/mi2mu.hh @@ -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" diff --git a/mi2mu/include/midi-global.hh b/mi2mu/include/midi-global.hh index 0ab49a340d..13ef771067 100644 --- a/mi2mu/include/midi-global.hh +++ b/mi2mu/include/midi-global.hh @@ -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(); -- 2.39.5