2 midi-parser.cc -- implement Midi_parser[_info]
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1998 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "string-convert.hh"
11 #include "source-file.hh"
12 #include "midi2ly-global.hh"
13 #include "midi-parser.hh"
15 Midi_parser_info::Midi_parser_info ()
26 Midi_parser::Midi_parser ()
32 Midi_parser::exit (String str
)
40 Midi_parser::error (String str
)
42 ::message (message (str
));
46 Midi_parser::get_i (int n
)
48 assert (n
<= (int)sizeof(int));
49 return String_convert::bin2_i (get_str (n
));
53 Midi_parser::get_u (int n
)
55 assert (n
<= (int)sizeof(int));
56 return String_convert::bin2_u (get_str (n
));
60 Midi_parser::get_str (int n
)
64 warning (_ ("zero length string encountered"));
66 Byte
const* p
= forward_byte_L (n
);
71 Midi_parser::get_var_i ()
77 Byte byte
= next_byte ();
88 Midi_parser::message (String str
)
90 return String ("midi2ly: ")
91 + info_l_
->source_l_
->name_str () + ": "
92 + String_convert::i2dec_str (info_l_
->source_l_
->line_i ((char const*)info_l_
->byte_L_
), 0, 0) + ": "
94 + info_l_
->source_l_
->error_str ((char const*)info_l_
->byte_L_
);
98 Midi_parser::warning (String str
)
100 ::message (message (String (_ ("warning: ")) + str
));