2 // my-midi-lexer.cc -- implement My_midi_lexer
4 // copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
11 return midi_lexer_l_g->yylex();
14 My_midi_lexer* midi_lexer_l_g = 0;
16 My_midi_lexer::My_midi_lexer( String &filename_str, Sources * sources )
18 source_file_l_ =sources->get_file_l(filename_str);
19 switch_streams( source_file_l_->istream_l() ,0 );
22 running_status_i_ = 0;
25 My_midi_lexer::~My_midi_lexer()
27 // delete source_file_p_;
31 My_midi_lexer::error( char const* sz_l )
33 if (1|| !source_file_l_ ) {
34 cerr << "error at EOF" << sz_l << '\n';
39 char const* ch_C = here_ch_C();
42 while ( ( *ch_C == ' ' ) || ( *ch_C == '\t' ) || ( *ch_C == '\n' ) )
53 My_midi_lexer::here_ch_C()
55 return source_file_l_->ch_C() + char_count_ ;
59 My_midi_lexer::varint2_i( String str )
63 for ( int i = 0; i < str.length_i(); i++ ) {
67 if ( ! ( byte & 0x80 ) )
70 cout << "\nvarint2_i:" << String_convert::bin2hex_str( str ) << endl;
71 assert( 0 ); // illegal varint
76 My_midi_lexer::close_i()