2 // my-midi-lexer.cc -- implement My_midi_lexer
4 // copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
7 #include "input-file.hh"
8 #include "source-file.hh"
9 #include "my-midi-lexer.hh"
14 return midi_lexer_l_g
->yylex();
17 My_midi_lexer
* midi_lexer_l_g
;
19 My_midi_lexer::My_midi_lexer( String filename_str
)
21 input_file_p_
= new Input_file( filename_str
);
22 switch_streams( input_file_p_
->is
);
23 midi_lexer_l_g
= this;
27 My_midi_lexer::~My_midi_lexer()
34 My_midi_lexer::error( char const* sz_l
)
36 if ( !input_file_p_
) {
37 // *mlog << "error at EOF" << sz_l << '\n';
38 cerr
<< "error at EOF" << sz_l
<< '\n';
40 char const* ch_c_l
= here_ch_c_l();
43 while ( ( *ch_c_l
== ' ' ) || ( *ch_c_l
== '\t' ) || ( *ch_c_l
== '\n' ) )
48 // ::error( sz_l, ch_c_l );
49 ::error( sz_l
, ch_c_l
);
54 My_midi_lexer::here_ch_c_l()
56 return input_file_p_
->sourcefile_l_
->ch_c_l() + yyin
->tellg();
60 My_midi_lexer::varint2_i( String str
)
64 for ( int i
= 0; i
< str
.length_i(); i
++ ) {
68 if ( ! ( byte
& 0x80 ) )
71 cout
<< "\nvarint2_i:" << String_convert::bin2hex_str( str
) << endl
;
72 assert( 0 ); // illegal varint
77 My_midi_lexer::close_i()