From: fred Date: Sun, 24 Mar 2002 19:36:18 +0000 (+0000) Subject: lilypond-0.0.44 X-Git-Tag: release/1.5.59~5131 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=bf94c6ab96acf6b014c4e5c33c3d4187e6d4400c;p=lilypond.git lilypond-0.0.44 --- diff --git a/flower/include/string-data.inl b/flower/include/string-data.inl index d2b925d0ce..5a3bb390ef 100644 --- a/flower/include/string-data.inl +++ b/flower/include/string-data.inl @@ -105,29 +105,29 @@ String_data::tighten() } // assignment. INLINE void -String_data::set( Byte const* byte_c_l, int length_i ) +String_data::set( Byte const* byte_C, int length_i ) { OKW(); - assert( byte_c_l && byte_c_l != data_byte_p_); + assert( byte_C && byte_C != data_byte_p_); length_i_ = length_i; remax( length_i_ ); // copies too - memcpy( data_byte_p_, byte_c_l, length_i_ ); + memcpy( data_byte_p_, byte_C, length_i_ ); data_byte_p_[ length_i_ ] = 0; } INLINE void -String_data::set( char const* ch_c_l ) +String_data::set( char const* ch_C ) { - set( (Byte const*)ch_c_l, strlen( ch_c_l ) ); + set( (Byte const*)ch_C, strlen( ch_C ) ); } /// concatenation. INLINE void -String_data::append( Byte const* byte_c_l, int length_i ) +String_data::append( Byte const* byte_C, int length_i ) { OK(); OKW(); @@ -135,22 +135,22 @@ String_data::append( Byte const* byte_c_l, int length_i ) length_i_ += length_i; remax( length_i_ ); - memcpy( data_byte_p_ + old_i, byte_c_l, length_i ); + memcpy( data_byte_p_ + old_i, byte_C, length_i ); data_byte_p_[ length_i_ ] = 0; } INLINE void -String_data::operator += ( char const* ch_c_l ) +String_data::operator += ( char const* ch_C ) { - append( (Byte const*)ch_c_l, strlen( ch_c_l ) ); + append( (Byte const*)ch_C, strlen( ch_C ) ); } INLINE char const* -String_data::ch_c_l() const +String_data::ch_C() const { return (char const*)data_byte_p_; } @@ -161,7 +161,7 @@ String_data::ch_l() } INLINE Byte const* -String_data::byte_c_l() const +String_data::byte_C() const { return data_byte_p_; } diff --git a/flower/include/string-handle.inl b/flower/include/string-handle.inl index 1f1d44ab13..63b2ab379d 100644 --- a/flower/include/string-handle.inl +++ b/flower/include/string-handle.inl @@ -72,15 +72,15 @@ String_handle::ch_l() } INLINE Byte -const* String_handle::byte_c_l() const +const* String_handle::byte_C() const { - return data->byte_c_l(); + return data->byte_C(); } INLINE char const* -String_handle::ch_c_l() const +String_handle::ch_C() const { - return (char const*)data->byte_c_l(); + return (char const*)data->byte_C(); } INLINE void @@ -107,7 +107,7 @@ String_handle::operator[](int j) const } // !NOT SAFE! -// don't use this for loops. Use byte_c_l() +// don't use this for loops. Use byte_C() INLINE Byte & String_handle::operator[](int j) { @@ -116,17 +116,17 @@ String_handle::operator[](int j) } INLINE void -String_handle::append( Byte const* byte_c_l, int length_i ) +String_handle::append( Byte const* byte_C, int length_i ) { copy(); - data->append( byte_c_l, length_i ); + data->append( byte_C, length_i ); } INLINE void -String_handle::set( Byte const* byte_c_l, int length_i ) +String_handle::set( Byte const* byte_C, int length_i ) { copy(); - data->set( byte_c_l, length_i ); + data->set( byte_C, length_i ); } INLINE void diff --git a/lib/include/binary-source-file.hh b/lib/include/binary-source-file.hh index 1af35631be..bc8279f6ab 100644 --- a/lib/include/binary-source-file.hh +++ b/lib/include/binary-source-file.hh @@ -6,6 +6,8 @@ #ifndef BINARY_SOURCE_FILE_HH #define BINARY_SOURCE_FILE_HH +#include "source-file.hh" + class Binary_source_file : public Source_file { public: Binary_source_file( String& filename_str ); diff --git a/lib/source.cc b/lib/source.cc index 8a8c528835..3247c8d82c 100644 --- a/lib/source.cc +++ b/lib/source.cc @@ -1,36 +1,72 @@ -// -// source.cc -// +/* + source.cc -- implement Source + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + #include +#include "binary-source-file.hh" #include "string.hh" #include "proto.hh" #include "plist.hh" - #include "source-file.hh" #include "source.hh" -Source::Source() +void +Sources::set_path(File_path *f_C) +{ + path_C_ = f_C; +} + +/** + open a file + + @param file_str the file to be opened, name might be changed if it + is found in a search path. + + @return 0 if no file found + */ +Source_file* +Sources::get_file_l(String &file_str ) { + if (path_C_){ + file_str = path_C_->find(file_str); + if (file_str== "") + return 0; + } + Source_file * f_p= (!binary_b_) ? + new Source_file(file_str) : new Binary_source_file(file_str); + add(f_p); + return f_p; } -Source::~Source() +Sources::Sources() { + path_C_= 0; + binary_b_ = false; } void -Source::add( Source_file* sourcefile_p ) +Sources::add( Source_file* sourcefile_p ) { sourcefile_p_iplist_.bottom().add( sourcefile_p ); } +/** + search the list for file whose map contains pointer #ch_C# + + @return 0 if not found. + */ Source_file* -Source::sourcefile_l( char const* ch_c_l ) +Sources::sourcefile_l( char const* ch_C ) { PCursor sourcefile_l_pcur( sourcefile_p_iplist_.top() ); for ( ; sourcefile_l_pcur.ok(); sourcefile_l_pcur++ ) - if ( sourcefile_l_pcur->in_b( ch_c_l ) ) + if ( sourcefile_l_pcur->in_b( ch_C ) ) return *sourcefile_l_pcur; return 0; } diff --git a/mi2mu/include/my-midi-lexer.hh b/mi2mu/include/my-midi-lexer.hh index 032bf6752b..9db1c43614 100644 --- a/mi2mu/include/my-midi-lexer.hh +++ b/mi2mu/include/my-midi-lexer.hh @@ -14,25 +14,21 @@ int yylex(); void yyerror(const char *s); -// bool busy_parsing(); -// void kill_lexer(); -// void set_lexer(); /// (midi_lexer) class My_midi_lexer : yyFlexLexer { public: - My_midi_lexer( String filename_str ); + My_midi_lexer( String &filename_str ,Sources * ); ~My_midi_lexer(); int close_i(); void error( char const* sz_l ); - char const* here_ch_c_l(); + char const* here_ch_C(); static int varint2_i( String str ); int yylex(); - + Source_file * source_file_p_ ; private: - Input_file* input_file_p_; - + int char_count_; public: // ugh int errorlevel_i_; }; diff --git a/mi2mu/include/my-midi-parser.hh b/mi2mu/include/my-midi-parser.hh index 02bbb843e8..95367f3fa0 100644 --- a/mi2mu/include/my-midi-parser.hh +++ b/mi2mu/include/my-midi-parser.hh @@ -6,55 +6,56 @@ #ifndef MY_MIDI_PARSER_HH #define MY_MIDI_PARSER_HH -// #include "proto.hh" -// #include "string.hh" int yyparse(); -/// (midi_parser) +/** + An interface to the YACC midi parser. + (midi_parser) + */ class My_midi_parser { public: - My_midi_parser( String filename_str ); - ~My_midi_parser(); - - void add_score( Midi_score* midi_score_p ); - void error( char const* sz_l ); - int parse(); - void forward( int i ); - Moment mom(); - void note_begin( int channel_i, int pitch_i, int dyn_i ); - Midi_event* note_end_midi_event_p( int channel_i, int pitch_i, int dyn_i ); - int output_mudela( String filename_str ); - void reset(); - void set_division_4( int division_4_i ); - void set_key( int accidentals_i, int minor_i ); - void set_tempo( int useconds_per_4_i ); - void set_time( int num_i, int den_i, int clocks_i, int count_32_i ); - - int bar_i_; - int track_i_; - String filename_str_; - String copyright_str_; - String instrument_str_; - String track_name_str_; - - Midi_key* midi_key_p_; - Midi_tempo* midi_tempo_p_; - Midi_time* midi_time_p_; + My_midi_parser( String filename_str,Sources * ); + ~My_midi_parser(); + + void add_score( Midi_score* midi_score_p ); + void error( char const* sz_l ); + int parse(); + void forward( int i ); + Moment mom(); + void note_begin( int channel_i, int pitch_i, int dyn_i ); + Midi_event* note_end_midi_event_p( int channel_i, int pitch_i, int dyn_i ); + int output_mudela( String filename_str ); + void reset(); + void set_division_4( int division_4_i ); + void set_key( int accidentals_i, int minor_i ); + void set_tempo( int useconds_per_4_i ); + void set_time( int num_i, int den_i, int clocks_i, int count_32_i ); + + int bar_i_; + int track_i_; + String filename_str_; + String copyright_str_; + String instrument_str_; + String track_name_str_; + + Midi_key* midi_key_p_; + Midi_tempo* midi_tempo_p_; + Midi_time* midi_time_p_; private: - I64 now_i64_; // 31 bits yields tipically about 1000 bars + I64 now_i64_; // 31 bits yields tipically about 1000 bars - static int const CHANNELS_i = 16; - static int const PITCHES_i = 128; - I64 running_i64_i64_a_[ CHANNELS_i ][ PITCHES_i ]; + static int const CHANNELS_i = 16; + static int const PITCHES_i = 128; + I64 running_i64_i64_a_[ CHANNELS_i ][ PITCHES_i ]; - Midi_score* midi_score_p_; - int division_1_i_; + Midi_score* midi_score_p_; + int division_1_i_; - char const* defined_ch_c_l_; - int fatal_error_i_; - My_midi_lexer* midi_lexer_p_; + char const* defined_ch_C_; + int fatal_error_i_; + My_midi_lexer* midi_lexer_p_; }; extern My_midi_parser* midi_parser_l_g; diff --git a/mi2mu/lily-stream.cc b/mi2mu/lily-stream.cc index 2ac5bc778d..f1b61cab5b 100644 --- a/mi2mu/lily-stream.cc +++ b/mi2mu/lily-stream.cc @@ -11,132 +11,134 @@ Lily_stream::Lily_stream( String filename_str ) { - filename_str_ = filename_str; - os_p_ = 0; - indent_i_ = 0; - comment_mode_bo_ = false; - column_i_ = 0; - wrap_column_i_ = 60; - open(); - header(); + filename_str_ = filename_str; + os_p_ = 0; + indent_i_ = 0; + comment_mode_bo_ = false; + column_i_ = 0; + wrap_column_i_ = 60; + open(); + header(); } Lily_stream::~Lily_stream() { - delete os_p_; - if ( indent_i_ ) - warning( "lily indent level: " + String( indent_i_ ), 0 ); + delete os_p_; + if ( indent_i_ ) + warning( "lily indent level: " + String( indent_i_ ), 0 ); } Lily_stream& Lily_stream::operator <<( String str ) { - static String nobreak_str = "\\`'_-.^<>*@"; - while ( str.length_i() ) { - int max_i = wrap_column_i_ - column_i_ - 1; - int i = str.length_i() - 1 *@"; + while ( str.length_i() ) { + int max_i = wrap_column_i_ - column_i_ - 1; + int i = str.length_i() - 1 8 * indent_i_ ) { - newline(); - if ( comment_mode_bo_ && ( str[ 0 ] != '%' ) ) - str = "%" + str; - continue; - } - else { // cannot break neatly... - i = max_i; - } - } + if ( !i ) { // no room left + if ( column_i_ > 8 * indent_i_ ) { + newline(); + if ( comment_mode_bo_ && ( str[ 0 ] != '%' ) ) + str = "%" + str; + continue; } - - String line = str.left_str( i + 1 ); - str = str.mid_str( i + 1, INT_MAX ); - *os_p_ << line; - column_i_ += line.length_i(); - if ( nl_i != -1 ) - newline(); - else - check_comment( line ); - if ( ( str.length_i() && ( nl_i == -1 ) ) || ( column_i_ >= wrap_column_i_ ) ) { - //brr. - if ( comment_mode_bo_ ) - str = "%" + str; - newline(); + else { // cannot break neatly... + i = max_i; } - } - return *this; + } + } + + String line = str.left_str( i + 1 ); + str = str.mid_str( i + 1, INT_MAX ); + *os_p_ << line; + column_i_ += line.length_i(); + if ( nl_i != -1 ) + newline(); + else + check_comment( line ); + if ( ( str.length_i() && ( nl_i == -1 ) ) || ( column_i_ >= wrap_column_i_ ) ) { + //brr. + if ( comment_mode_bo_ ) + str = "%" + str; + newline(); + } + } + return *this; } Lily_stream& Lily_stream::operator <<( Midi_event& midi_event_r ) { - midi_event_r.output_mudela( *this, false ); - *os_p_ << flush; - return *this; + midi_event_r.output_mudela( *this, false ); + *os_p_ << flush; + return *this; } void Lily_stream::check_comment( String str ) { - int newline_i = str.index_last_i( '\n' ); - if ( newline_i != -1 ) { - str = str.mid_str( newline_i +1, INT_MAX ); - comment_mode_bo_ = false; - } - if ( str.index_i( '%' ) != -1 ) - comment_mode_bo_ = true; + int newline_i = str.index_last_i( '\n' ); + if ( newline_i != -1 ) { + str = str.mid_str( newline_i +1, INT_MAX ); + comment_mode_bo_ = false; + } + if ( str.index_i( '%' ) != -1 ) + comment_mode_bo_ = true; } void Lily_stream::header() { - *os_p_ << "% Creator: " << mi2mu_version_str() << "\n"; - *os_p_ << "% Automatically generated, at "; - time_t t( time( 0 ) ); - *os_p_ << ctime( &t ); - *os_p_ << "% from input file: "; - *os_p_ << midi_parser_l_g->filename_str_; - *os_p_ << "\n\n"; + *os_p_ << "% Creator: " << mi2mu_version_str() << "\n"; + *os_p_ << "% Automatically generated, at "; + time_t t( time( 0 ) ); + *os_p_ << ctime( &t ); + *os_p_ << "% from input file: "; + *os_p_ << midi_parser_l_g->filename_str_; + *os_p_ << "\n\n"; } - +/* + snapnie: dit kan toch automaties? Zie ook dstream. + */ void Lily_stream::indent() { - indent_i_++; - newline(); + indent_i_++; + newline(); } void Lily_stream::newline() { - *os_p_ << endl << String( '\t', indent_i_ ); - column_i_ = indent_i_ * 8; - comment_mode_bo_ = false; + *os_p_ << endl << String( '\t', indent_i_ ); + column_i_ = indent_i_ * 8; + comment_mode_bo_ = false; } void Lily_stream::open() { - os_p_ = new ofstream( filename_str_ ); - if ( !*os_p_ ) - error ( "can't open `" + filename_str_ + "\'", 0 ); + os_p_ = new ofstream( filename_str_ ); + if ( !*os_p_ ) + error ( "can't open `" + filename_str_ + "\'", 0 ); } void Lily_stream::tnedni() { - assert( indent_i_ > 0 ); - indent_i_--; - newline(); + assert( indent_i_ > 0 ); + indent_i_--; + newline(); } diff --git a/mi2mu/main.cc b/mi2mu/main.cc index e04cb02b09..31dfe9e5e0 100644 --- a/mi2mu/main.cc +++ b/mi2mu/main.cc @@ -6,13 +6,13 @@ #include "mi2mu.hh" -Source source; -Source* source_l_g = &source; +Sources source; +Sources* source_l_g = &source; Verbose level_ver = NORMAL_ver; //ugh -char const* defined_ch_c_l = 0; +char const* defined_ch_C = 0; // ugh, another global String @@ -23,17 +23,17 @@ find_file( String str ) // ugh, copied from warn.cc, cannot use void -message( String message_str, char const* context_ch_c_l ) +message( String message_str, char const* context_ch_C ) { String str = "mi2mu: "; - Source_file* sourcefile_l = source_l_g->sourcefile_l( context_ch_c_l ); + Source_file* sourcefile_l = source_l_g->sourcefile_l( context_ch_C ); if ( sourcefile_l ) { - str += sourcefile_l->file_line_no_str(context_ch_c_l) + String(": "); + str += sourcefile_l->file_line_no_str(context_ch_C) + String(": "); } str += message_str; if ( sourcefile_l ) { str += ":\n"; - str += sourcefile_l->error_str( context_ch_c_l ); + str += sourcefile_l->error_str( context_ch_C ); } // if ( busy_parsing() ) cerr << endl; // until we have fine output manager... @@ -41,15 +41,15 @@ message( String message_str, char const* context_ch_c_l ) } void -warning( String message_str, char const* context_ch_c_l ) +warning( String message_str, char const* context_ch_C ) { - message( "warning: " + message_str, context_ch_c_l ); + message( "warning: " + message_str, context_ch_C ); } void -error( String message_str, char const* context_ch_c_l ) +error( String message_str, char const* context_ch_C ) { - message( message_str, context_ch_c_l ); + message( message_str, context_ch_C ); // since when exits error again? // i-d say: error: errorlevel |= 1; -> no output upon error // warning: recovery -> output (possibly wrong) @@ -89,7 +89,6 @@ notice() " Han-Wen Nienhuys \n" // "Contributors\n" " Jan Nieuwenhuizen \n" -// " Mats Bengtsson \n" "\n" " This program is free software; you can redistribute it and/or\n" "modify it under the terms of the GNU General Public License version 2\n" @@ -113,7 +112,6 @@ main( int argc_i, char* argv_sz_a[] ) 0, "be-blonde", 'b', 0, "debug", 'd', 0, "help", 'h', -// 1, "include", 'I', 0, "no-silly", 'n', 1, "output", 'o', 0, "quiet", 'q', @@ -137,9 +135,6 @@ main( int argc_i, char* argv_sz_a[] ) help(); exit( 0 ); break; -// case 'I': -// path->push( getopt_long.optarg ); -// break; case 'n': Duration_convert::no_double_dots_b_s = false; Duration_convert::no_triplets_b_s = true; @@ -165,20 +160,23 @@ main( int argc_i, char* argv_sz_a[] ) char* arg_sz = 0; while ( ( arg_sz = getopt_long.get_next_arg() ) ) { - My_midi_parser midi_parser( arg_sz ); + My_midi_parser midi_parser( arg_sz, & source ); + midi_parser_l_g = &midi_parser; + int error_i = midi_parser.parse(); if ( error_i ) return error_i; if ( !output_str.length_i() ) { - output_str = String( arg_sz ) + ".ly"; - // i-m sure there-s already some routine for this - int name_i; // too bad we can-t declare local to if - if ( ( name_i = output_str.index_last_i( '/' ) ) != -1 ) - output_str = output_str.mid_str( name_i + 1, INT_MAX ); + String d, dir, base, ext; + + split_path(arg_sz, d, dir, base, ext); + + output_str = base + ext + ".ly"; } error_i = midi_parser.output_mudela( output_str ); if ( error_i ) return error_i; + midi_parser_l_g = 0; } return 0; } diff --git a/mi2mu/mi2mu-version.cc b/mi2mu/mi2mu-version.cc index e1b7178851..78773e7208 100644 --- a/mi2mu/mi2mu-version.cc +++ b/mi2mu/mi2mu-version.cc @@ -6,7 +6,7 @@ #include "version.hh" -static char *s = "mi2mu " MAJOR_VERSION "." MINOR_VERSION "." MY_PATCH_LEVEL " #%d"; +static char *s = "mi2mu " MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL MY_PATCH_LEVEL " #%d"; static const int build= #include ".build" diff --git a/mi2mu/midi-event.cc b/mi2mu/midi-event.cc index 6bc15a4cf9..4ab611cd4f 100644 --- a/mi2mu/midi-event.cc +++ b/mi2mu/midi-event.cc @@ -97,20 +97,20 @@ Midi_note::mudela_str( bool command_mode_bo ) //ugh String str; - if ( dur_.plet_p_ ) + if ( dur_.plet_b() ) str += String( "\\plet{ " ) - + String_convert::i2dec_str( dur_.plet_p_->iso_i_, 0, 0 ) + + String_convert::i2dec_str( dur_.plet_.iso_i_, 0, 0 ) + "/" - + String_convert::i2dec_str( dur_.plet_p_->type_i_, 0, 0 ) + + String_convert::i2dec_str( dur_.plet_.type_i_, 0, 0 ) + " } "; str += name_str_; Duration dur = dur_; - dur.set_plet( 0 ); + dur.set_plet( 1,1 ); str += Duration_convert::dur2_str( dur ); - if ( dur_.plet_p_ ) + if ( dur_.plet_b() ) str += String( " \\plet{ 1/1 }" ); return str; @@ -162,7 +162,7 @@ Midi_text::mudela_str( bool command_mode_bo ) { (void)command_mode_bo; if ( !text_str_.length_i() - || ( text_str_.length_i() != (int)strlen( text_str_.ch_c_l() ) ) ) + || ( text_str_.length_i() != (int)strlen( text_str_.ch_C() ) ) ) return ""; return "% " + text_str_ + "\n\t"; diff --git a/mi2mu/midi-lexer.l b/mi2mu/midi-lexer.l index f83258789f..6add2613c7 100644 --- a/mi2mu/midi-lexer.l +++ b/mi2mu/midi-lexer.l @@ -1,16 +1,16 @@ -%{ +%{//-*-Fundamental-*- // midi-lexer.l #include "mi2mu.hh" #include "midi-parser.hh" +#define YY_USER_ACTION char_count_ += YYLeng(); // ugh %} %option c++ %option noyywrap %option nodefault -%option yylineno %option debug %option yyclass="My_midi_lexer" %option stack @@ -374,7 +374,7 @@ SSME [\0x7f][\x03] {U8} { warning( String( "meta_event: unimplemented event: " ) + String_convert::bin2hex_str( String( *YYText() ) ), - this->here_ch_c_l() ); + this->here_ch_C() ); yy_pop_state(); yy_pop_state(); yy_push_state( u8 ); diff --git a/mi2mu/my-midi-lexer.cc b/mi2mu/my-midi-lexer.cc index 843899567b..ba578d1dfc 100644 --- a/mi2mu/my-midi-lexer.cc +++ b/mi2mu/my-midi-lexer.cc @@ -8,71 +8,68 @@ int yylex() { - return midi_lexer_l_g->yylex(); + return midi_lexer_l_g->yylex(); } My_midi_lexer* midi_lexer_l_g = 0; -My_midi_lexer::My_midi_lexer( String filename_str ) +My_midi_lexer::My_midi_lexer( String &filename_str, Sources * sources ) { - midi_lexer_l_g = this; - input_file_p_ = new Input_file( filename_str ); - switch_streams( input_file_p_->is ); - errorlevel_i_ = 0; + source_file_p_ =sources->get_file_l(filename_str); + switch_streams( source_file_p_->istream_l() ); + errorlevel_i_ = 0; + char_count_ = 0; } My_midi_lexer::~My_midi_lexer() { - delete input_file_p_; - midi_lexer_l_g = 0; + delete source_file_p_; } void My_midi_lexer::error( char const* sz_l ) { - if ( !input_file_p_ ) { -// *mlog << "error at EOF" << sz_l << '\n'; + if ( !source_file_p_ ) { cerr << "error at EOF" << sz_l << '\n'; } else { - char const* ch_c_l = here_ch_c_l(); - if ( ch_c_l ) { - ch_c_l--; - while ( ( *ch_c_l == ' ' ) || ( *ch_c_l == '\t' ) || ( *ch_c_l == '\n' ) ) - ch_c_l--; - ch_c_l++; + char const* ch_C = here_ch_C(); + if ( ch_C ) { + ch_C--; + while ( ( *ch_C == ' ' ) || ( *ch_C == '\t' ) || ( *ch_C == '\n' ) ) + ch_C--; + ch_C++; } errorlevel_i_ |= 1; -// ::error( sz_l, ch_c_l ); - ::error( sz_l, ch_c_l ); + ::error( sz_l, ch_C ); } } char const* -My_midi_lexer::here_ch_c_l() +My_midi_lexer::here_ch_C() { - return input_file_p_->sourcefile_l_->ch_c_l() + yyin->tellg(); + return source_file_p_->ch_C() + char_count_ ; } int My_midi_lexer::varint2_i( String str ) { - int var_i = 0; + int var_i = 0; - for ( int i = 0; i < str.length_i(); i++ ) { - Byte byte = str[ i ]; - var_i <<= 7; - var_i += byte & 0x7f; - if ( ! ( byte & 0x80 ) ) - return var_i; - } - cout << "\nvarint2_i:" << String_convert::bin2hex_str( str ) << endl; - assert( 0 ); // illegal varint - return 0; + for ( int i = 0; i < str.length_i(); i++ ) { + Byte byte = str[ i ]; + var_i <<= 7; + var_i += byte & 0x7f; + if ( ! ( byte & 0x80 ) ) + return var_i; + } + cout << "\nvarint2_i:" << String_convert::bin2hex_str( str ) << endl; + assert( 0 ); // illegal varint + return 0; } int My_midi_lexer::close_i() { - return 0; + return 0; }