From: fred Date: Sun, 24 Mar 2002 19:55:26 +0000 (+0000) Subject: lilypond-0.1.10 X-Git-Tag: release/1.5.59~4022 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c7e3b321ebeb84e509f56397194b8db896204f1a;p=lilypond.git lilypond-0.1.10 --- diff --git a/bin/genheader.in b/bin/genheader.in index 9b6bb4d6cb..8643a3794f 100644 --- a/bin/genheader.in +++ b/bin/genheader.in @@ -6,7 +6,7 @@ my $fn; sub do_init { - $MAILADRESS=$ENV{MAILADRESS}; + $MAILADDRESS=$ENV{MAILADDRESS}; @pw=(getpwuid($<)); $username=$pw[6]; @@ -34,7 +34,7 @@ sub source file of $PROJECT - (c) 1997 $username <$MAILADRESS> + (c) 1997 $username <$MAILADDRESS> */\n"; print $headstr; } diff --git a/flower/include/string-convert.hh b/flower/include/string-convert.hh index 63785ac28d..1d3f5d0300 100644 --- a/flower/include/string-convert.hh +++ b/flower/include/string-convert.hh @@ -21,7 +21,8 @@ public: static String bin2dec_str (String bin_str); static String bin2hex_str (String bin_str); static String dec2bin_str (String str); - static int bin2_i (String str); + static int bin2_i (String bin_str); + static unsigned bin2_u (String bin_str); static String char_str (char c, int n); static int dec2_i (String dec_str); static double dec2_f (String dec_str); diff --git a/flower/string-convert.cc b/flower/string-convert.cc index c105169cee..5acdb4c88f 100644 --- a/flower/string-convert.cc +++ b/flower/string-convert.cc @@ -40,15 +40,21 @@ String_convert::bin2hex_str (String bin_str) int String_convert::bin2_i (String bin_str) { - assert (bin_str.length_i() <= 4); + return bin2_u (bin_str); +} + +unsigned +String_convert::bin2_u (String bin_str) +{ + assert (bin_str.length_i() <= (int)sizeof(unsigned)); - int result_i = 0; + unsigned result_u = 0; for ( int i = 0; i < bin_str.length_i(); i++) { - result_i <<= 8; - result_i += (Byte)bin_str[ i ]; + result_u <<= 8; + result_u += (Byte)bin_str[ i ]; } - return result_i; + return result_u; } // breendet imp from String diff --git a/lib/binary-source-file.cc b/lib/binary-source-file.cc index 666012f0c6..8c4aac4474 100644 --- a/lib/binary-source-file.cc +++ b/lib/binary-source-file.cc @@ -27,7 +27,7 @@ Binary_source_file::~Binary_source_file() } String -Binary_source_file::error_str( char const* pos_ch_c_l ) +Binary_source_file::error_str( char const* pos_ch_c_l ) const { assert( this ); if ( !in_b( pos_ch_c_l ) ) @@ -53,7 +53,7 @@ Binary_source_file::error_str( char const* pos_ch_c_l ) } int -Binary_source_file::line_i( char const* pos_ch_c_l ) +Binary_source_file::line_i( char const* pos_ch_c_l ) const { if ( !in_b( pos_ch_c_l ) ) return 0; diff --git a/lib/include/binary-source-file.hh b/lib/include/binary-source-file.hh index bc8279f6ab..63127ea9ad 100644 --- a/lib/include/binary-source-file.hh +++ b/lib/include/binary-source-file.hh @@ -13,8 +13,8 @@ public: Binary_source_file( String& filename_str ); virtual ~Binary_source_file(); - virtual String error_str( char const* pos_ch_c_l ); - virtual int line_i( char const* pos_ch_c_l ); + virtual String error_str( char const* pos_ch_c_l ) const; + virtual int line_i( char const* pos_ch_c_l ) const; }; #endif // BINARY_SOURCE_FILE_HH // diff --git a/lib/include/source.hh b/lib/include/source.hh index 1d199671ff..fc0ca2728d 100644 --- a/lib/include/source.hh +++ b/lib/include/source.hh @@ -12,12 +12,13 @@ class Sources { public: + Sources(); + Source_file * get_file_l( String &filename ); Source_file* sourcefile_l( char const* ch_C ); void set_path(File_path*p_C); - Sources(); void set_binary(bool); - ~Sources(); + private: const File_path * path_C_; void add( Source_file* sourcefile_p ); diff --git a/lib/source-file.cc b/lib/source-file.cc index a67b466300..4ac7017f05 100644 --- a/lib/source-file.cc +++ b/lib/source-file.cc @@ -57,12 +57,14 @@ Source_file::name_str()const { return name_str_; } + Source_file::~Source_file() { delete istream_p_; istream_p_ = 0; delete storage_p_; } + String Source_file::error_str( char const* pos_ch_C )const { diff --git a/lib/source.cc b/lib/source.cc index e60041553c..dd1c5f27d6 100644 --- a/lib/source.cc +++ b/lib/source.cc @@ -17,6 +17,18 @@ #include "source.hh" #include "path.hh" +Sources::Sources() +{ + path_C_= 0; + binary_b_ = false; +} + +void +Sources::set_binary(bool bo) +{ + binary_b_ = bo; +} + void Sources::set_path(File_path *f_C) { @@ -47,12 +59,6 @@ Sources::get_file_l(String &file_str ) //UGH return f_p; } -Sources::Sources() -{ - path_C_= 0; - binary_b_ = false; -} - void Sources::add( Source_file* sourcefile_p ) { @@ -74,5 +80,3 @@ Sources::sourcefile_l( char const* ch_C ) return 0; } -Sources::~Sources() -{} diff --git a/lily/include/command-request.hh b/lily/include/command-request.hh index 1a78f14d75..f5adca4428 100644 --- a/lily/include/command-request.hh +++ b/lily/include/command-request.hh @@ -53,7 +53,6 @@ class Timing_req : public Command_req { public: REQUESTMETHODS(Timing_req, timing); virtual Tempo_req * tempo(){return 0; } - Tempo_req(); }; diff --git a/mi2mu/Makefile b/mi2mu/Makefile index 7100902c8f..85bcfed18e 100644 --- a/mi2mu/Makefile +++ b/mi2mu/Makefile @@ -75,7 +75,8 @@ DEPFILES = $(wildcard $(depdir)/*.dep) -include /dev/null $(DEPFILES) # localclean: - rm -f $(outdir)/{midi-parser,midi-lexer}.* +# obsoliet +# rm -f $(outdir)/{midi-parser,midi-lexer}.* localinstall: installexe diff --git a/mi2mu/TODO b/mi2mu/TODO index e9cb89c143..e522176955 100644 --- a/mi2mu/TODO +++ b/mi2mu/TODO @@ -6,16 +6,6 @@ grep for TODO and ugh/ugr IMPORTANT - * fix parser: either - - parse into midi-items (merge with lily/midi-*) and pass - these nealy up, same for track and score. look at all - tracks a time (vertically through score), creating columns - and mudela items in time-order (no searching for columns). - or - - junk lex/yacc altogether, parse on byte level, straight - from memore, vertically through score. there might be no - need for midi-items, here. - * get rid of (last few?) midi-specifics in mudela-* * find / remove trend (tempo) of mudela columns @@ -64,16 +54,8 @@ PROJECTS BUGS - * mi2mu nonexist.midi ? - * output of 0 duration c'0 - * no output on certain midis - - * silly progress indicator upon mudela output - - * check for illegal track names, e.g. "Piano________ = \melodic" - * array memleaks(?): use Link_array / create Pointer_array? * fix "#undef MEVENT_LIST" source tree: Array diff --git a/mi2mu/VERSION b/mi2mu/VERSION index 22b9eff149..bbbdde49e2 100644 --- a/mi2mu/VERSION +++ b/mi2mu/VERSION @@ -1,6 +1,6 @@ MAJOR_VERSION = 0 MINOR_VERSION = 0 -PATCH_LEVEL = 19 +PATCH_LEVEL = 20 # use to send patches, always empty for released version: MY_PATCH_LEVEL = # diff --git a/mi2mu/include/mi2mu-proto.hh b/mi2mu/include/mi2mu-proto.hh index 5aa6579ae3..da4d89ba54 100644 --- a/mi2mu/include/mi2mu-proto.hh +++ b/mi2mu/include/mi2mu-proto.hh @@ -10,7 +10,10 @@ #ifndef MI2MU_PROTO_HH #define MI2MU_PROTO_HH - +class Midi_parser; +struct Midi_parser_info; +class Midi_score_parser; +class Midi_track_parser; class Mudela_stream; class Mudela_item; class Mudela_key; @@ -21,8 +24,6 @@ class Mudela_text; class Mudela_score; class Mudela_staff; class Mudela_voice; -class My_midi_lexer; -class My_midi_parser; class Mudela_column; #endif // MI2MU_PROTO_HH diff --git a/mi2mu/include/midi-score-parser.hh b/mi2mu/include/midi-score-parser.hh new file mode 100644 index 0000000000..f9c8b646d8 --- /dev/null +++ b/mi2mu/include/midi-score-parser.hh @@ -0,0 +1,33 @@ +/* + midi-score-parser.hh -- declare + + source file of the GNU LilyPond music typesetter + + (c) 1997 Jan Nieuwenhuizen +*/ + + +#ifndef MIDI_SCORE_PARSER_HH +#define MIDI_SCORE_PARSER_HH + +#include "midi-parser.hh" +#include "proto.hh" +#include "mi2mu-proto.hh" +#include "parray.hh" + +class Midi_score_parser : public Midi_parser +{ +public: + Mudela_score* parse (String filename_str, Sources*); + +private: + void open (String filename_str, Sources*); + + void parse_header (); + // why the #*&$#{%) has Link_array another behaviour than Link_list?? + // int find_earliest_i (Link_array& tracks); + int find_earliest_i (Link_array& tracks); + Mudela_score* parse_score (); +}; + +#endif // MIDI_SCORE_PARSER_HH diff --git a/mi2mu/include/midi-track-parser.hh b/mi2mu/include/midi-track-parser.hh new file mode 100644 index 0000000000..021197c737 --- /dev/null +++ b/mi2mu/include/midi-track-parser.hh @@ -0,0 +1,44 @@ +/* + midi-track-parser.hh -- declare + + source file of the GNU LilyPond music typesetter + + (c) 1997 Jan Nieuwenhuizen +*/ + + +#ifndef MIDI_TRACK_PARSER_HH +#define MIDI_TRACK_PARSER_HH + +#include "proto.hh" +#include "plist.hh" +#include "moment.hh" +#include "mi2mu-proto.hh" +#include "midi-parser.hh" + +class Midi_track_parser : public Midi_parser +{ +public: + + Midi_track_parser (Midi_parser_info* info_l); + ~Midi_track_parser (); + + Moment at_mom (); + Mudela_staff* parse (Mudela_column* col_l); + +private: + bool eot (); + void note_end (Mudela_column* col_l, int channel_i, int pitch_i, int aftertouch_i ); + void note_end_all (Mudela_column* col_l) ; + void parse_delta_time (); + Mudela_item* parse_event (Mudela_column* col_l); + void parse_header (); + + Moment at_mom_; + Byte running_byte_; + Link_list open_note_l_list_; + Mudela_staff* mudela_staff_p_; + Midi_parser_info* track_info_p_; +}; + +#endif // MIDI_TRACK_PARSER_HH diff --git a/mi2mu/include/mudela-score.hh b/mi2mu/include/mudela-score.hh index 6d752fe1d6..d1102f0808 100644 --- a/mi2mu/include/mudela-score.hh +++ b/mi2mu/include/mudela-score.hh @@ -20,7 +20,8 @@ public: void add_item (Mudela_item* mudela_item_p); void add_staff (Mudela_staff* mudela_staff_p); - Mudela_column* mudela_column_l (Moment mom); + Mudela_column* find_column_l (Moment mom); + Mudela_column* get_column_l (Moment mom); void output (String filename_str); void process(); @@ -36,10 +37,9 @@ private: void quantify_durations(); void settle_columns(); - Pointer_list mudela_column_p_list_; Pointer_list mudela_staff_p_list_; -// Link_array column_l_array_; - // huh? + // wants Pointer_array! +// Pointer_list mudela_column_p_list_; Link_array column_l_array_; // ugh, ugh, ugh diff --git a/mi2mu/mudela-staff.cc b/mi2mu/mudela-staff.cc index 3f1373a4ac..b8535618b9 100644 --- a/mi2mu/mudela-staff.cc +++ b/mi2mu/mudela-staff.cc @@ -3,6 +3,7 @@ // // copyright 1997 Jan Nieuwenhuizen +#include #include #include "moment.hh" #include "duration-convert.hh" @@ -14,9 +15,9 @@ #include "mudela-staff.hh" #include "mudela-stream.hh" #include "mudela-voice.hh" -#include "my-midi-parser.hh" #include "mudela-score.hh" +extern Mudela_score* mudela_score_l_g; Mudela_staff::Mudela_staff (int number_i, String copyright_str, String track_name_str, String instrument_str) { @@ -60,7 +61,7 @@ Mudela_staff::eat_voice (Link_list& items) { Moment dur = i->at_mom() - mom; // ugh, need score - Mudela_column* start = midi_parser_l_g->mudela_score_p_->mudela_column_l (mom); + Mudela_column* start = mudela_score_l_g->find_column_l (mom); voice_p->add_item (new Mudela_skip (start, dur)); mom = i->at_mom(); }