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))
40 #include "mi2mu-proto.hh"
42 struct Midi_parser_info
50 Byte
const* end_byte_L_
;
51 Source_file
* source_l_
;
52 Mudela_score
* score_l_
;
63 Midi_parser_info
* info_l_
;
66 // Byte const* inline_forward_byte_L (int n)
67 Byte
const* inline_forward_byte_L (char const* fun
, int n
)
69 if (info_l_
->byte_L_
+ n
< info_l_
->end_byte_L_
)
71 Byte
const* p
= info_l_
->byte_L_
;
72 info_l_
->byte_L_
+= n
;
75 // exit (__FUNCTION__": unexpected EOF");
76 exit (String (fun
) + ": unexpected EOF");
81 // Byte inline_next_byte ()
82 Byte
inline_next_byte (char const* fun
)
84 if (info_l_
->byte_L_
< info_l_
->end_byte_L_
)
85 return *info_l_
->byte_L_
++;
86 // exit (__FUNCTION__": unexpected EOF");
87 exit (String (fun
) + ": unexpected EOF");
91 // Byte inline_peek_byte ()
92 Byte
inline_peek_byte (char const* fun
)
94 if (info_l_
->byte_L_
< info_l_
->end_byte_L_
)
95 return *info_l_
->byte_L_
;
96 // exit (__FUNCTION__": unexpected EOF");
97 exit (String (fun
) + ": unexpected EOF");
103 String
get_str (int);
104 unsigned get_u (int);
108 String
message (String
);
109 void warning (String
);
112 #endif // MIDI_PARSER_HH