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 )
18 midi_lexer_l_g = this;
19 input_file_p_ = new Input_file( filename_str );
20 switch_streams( input_file_p_->is );
24 My_midi_lexer::~My_midi_lexer()
31 My_midi_lexer::error( char const* sz_l )
33 if ( !input_file_p_ ) {
34 // *mlog << "error at EOF" << sz_l << '\n';
35 cerr << "error at EOF" << sz_l << '\n';
37 char const* ch_c_l = here_ch_c_l();
40 while ( ( *ch_c_l == ' ' ) || ( *ch_c_l == '\t' ) || ( *ch_c_l == '\n' ) )
45 // ::error( sz_l, ch_c_l );
46 ::error( sz_l, ch_c_l );
51 My_midi_lexer::here_ch_c_l()
53 return input_file_p_->sourcefile_l_->ch_c_l() + yyin->tellg();
57 My_midi_lexer::varint2_i( String str )
61 for ( int i = 0; i < str.length_i(); i++ ) {
65 if ( ! ( byte & 0x80 ) )
68 cout << "\nvarint2_i:" << String_convert::bin2hex_str( str ) << endl;
69 assert( 0 ); // illegal varint
74 My_midi_lexer::close_i()