2 midi-parser.hh -- declare Midi_parser
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
10 #ifndef MIDI_PARSER_HH
11 #define MIDI_PARSER_HH
13 // must, gcc 2.7.2{,.1} hits ico on midi-track-parser.cc:134 (@Midi_note)
18 #define next_byte() (inline_next_byte (__FUNCTION__))
19 #define peek_byte() (inline_peek_byte (__FUNCTION__))
20 #define forward_byte_L(n) (inline_forward_byte_L (__FUNCTION__, n))
25 ((info_l_->byte_L_ < info_l_->end_byte_L_ ?\
27 : (Byte const)exit (__FUNCTION__": unexpected EOF")));
30 ((info_l_->byte_L_ < info_l_->end_byte_L_ ?\
32 : (Byte const)exit (__FUNCTION__": unexpected EOF")));
34 #define forward_byte_L(n) (inline_forward_byte_L (__FUNCTION__, n))
41 struct Midi_parser_info
49 Byte const* end_byte_L_;
50 Source_file* source_l_;
61 Midi_parser_info* info_l_;
64 // Byte const* inline_forward_byte_L (int n)
65 Byte const* inline_forward_byte_L (char const* fun, int n)
67 if (info_l_->byte_L_ + n < info_l_->end_byte_L_ )
69 Byte const* p = info_l_->byte_L_;
70 info_l_->byte_L_ += n;
73 // exit (__FUNCTION__": unexpected EOF");
74 exit (String (fun) + ": unexpected EOF");
79 // Byte inline_next_byte ()
80 Byte inline_next_byte (char const* fun)
82 if (info_l_->byte_L_ < info_l_->end_byte_L_)
83 return *info_l_->byte_L_++;
84 // exit (__FUNCTION__": unexpected EOF");
85 exit (String (fun) + ": unexpected EOF");
89 // Byte inline_peek_byte ()
90 Byte inline_peek_byte (char const* fun)
92 if (info_l_->byte_L_ < info_l_->end_byte_L_)
93 return *info_l_->byte_L_;
94 // exit (__FUNCTION__": unexpected EOF");
95 exit (String (fun) + ": unexpected EOF");
101 String get_str (int);
102 unsigned get_u (int);
106 String message (String);
107 void warning (String);
110 #endif // MIDI_PARSER_HH