]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-0.0.39
authorfred <fred>
Tue, 4 Mar 1997 20:13:45 +0000 (20:13 +0000)
committerfred <fred>
Tue, 4 Mar 1997 20:13:45 +0000 (20:13 +0000)
m2m/include/my-midi-lexer.hh [new file with mode: 0644]
m2m/include/my-midi-parser.hh [new file with mode: 0644]

diff --git a/m2m/include/my-midi-lexer.hh b/m2m/include/my-midi-lexer.hh
new file mode 100644 (file)
index 0000000..032bf67
--- /dev/null
@@ -0,0 +1,43 @@
+//
+// my-midi-lexer.hh -- declare My_midi_lexer
+//
+// copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
+
+#ifndef MY_MIDI_LEXER_HH
+#define MY_MIDI_LEXER_HH
+
+#include <FlexLexer.h>
+#include "proto.hh"
+// #include "fproto.hh"
+#include "varray.hh"
+#include "string.hh"
+
+int yylex();
+void yyerror(const char *s);
+// bool busy_parsing();
+// void kill_lexer();
+// void set_lexer();
+
+/// (midi_lexer)
+class My_midi_lexer : yyFlexLexer {
+public:
+       My_midi_lexer( String filename_str );
+       ~My_midi_lexer();
+
+       int close_i();
+       void error( char const* sz_l );
+       char const* here_ch_c_l();
+       static int varint2_i( String str );
+       int yylex();
+
+private:
+       Input_file* input_file_p_;
+
+public: // ugh
+       int errorlevel_i_;
+};
+
+extern My_midi_lexer* midi_lexer_l_g;
+
+#endif // MY_MIDI_LEXER_HH
+
diff --git a/m2m/include/my-midi-parser.hh b/m2m/include/my-midi-parser.hh
new file mode 100644 (file)
index 0000000..6faf128
--- /dev/null
@@ -0,0 +1,62 @@
+//
+// my-midi-parser.hh -- declare My_midi_parser
+//
+// copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
+
+#ifndef MY_MIDI_PARSER_HH
+#define MY_MIDI_PARSER_HH
+
+// #include "proto.hh"
+// #include "string.hh"
+
+int yyparse();
+
+/// (midi_parser)
+class My_midi_parser {
+public:
+       My_midi_parser( String filename_str );
+       ~My_midi_parser();
+
+       void add_score( Midi_score* midi_score_p );
+       void error( char const* sz_l );
+       int parse();
+       void forward( int i );
+       Moment mom();
+       void note_begin( int channel_i, int pitch_i, int dyn_i );
+       Midi_event* note_end_midi_event_p( int channel_i, int pitch_i, int dyn_i );
+       int output_mudela( String filename_str );
+       void reset();
+       void set_division_4( int division_4_i );
+       void set_key( int accidentals_i, int minor_i );
+       void set_tempo( int useconds_i );
+       void set_time( int num_i, int den_i, int clocks_i, int count_32_i );
+
+       int track_i_;
+       String filename_str_;
+       String copyright_str_;
+       String instrument_str_;
+       String track_name_str_;
+
+       Midi_key* midi_key_p_;
+       Midi_tempo* midi_tempo_p_;
+       Midi_time* midi_time_p_;
+
+private:
+       Int64 now_i64_; // 31 bits yields tipically about 1000 bars
+
+       static int const CHANNELS_i = 16;
+       static int const PITCHES_i = 128;
+       Int64 running_i64_i64_a_[ CHANNELS_i ][ PITCHES_i ];
+
+       Midi_score* midi_score_p_;
+       int division_1_i_;
+
+       char const* defined_ch_c_l_;
+       int fatal_error_i_;
+       My_midi_lexer* midi_lexer_p_;
+};
+
+extern My_midi_parser* midi_parser_l_g;
+
+#endif // MY_MIDI_PARSER_HH
+