From 62f3db10041195989b22522b3758aff1ff96b640 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:32:42 +0000 Subject: [PATCH] lilypond-0.0.33 --- Documentation/README.pod | 51 +++++++++++---------- Makefile | 3 +- src/inputstaff.cc | 19 ++++++-- src/parser.y | 95 ++++++++++++++++++++++++++++++---------- 4 files changed, 117 insertions(+), 51 deletions(-) diff --git a/Documentation/README.pod b/Documentation/README.pod index 87e2b65fbe..a837d6a070 100644 --- a/Documentation/README.pod +++ b/Documentation/README.pod @@ -21,6 +21,9 @@ music. LilyPond has these features: ASCII script input, with identifiers (for music reuse), customizable notenames, customizable fontset +=item * +MIDI output lets you check if you have entered the correct notes. + =item * Multiple staffs in one score. Each staff can have a different meters. @@ -33,7 +36,7 @@ triplets, general n-plet (triplet, quadruplets, etc.), lyrics =item * multiple voices within one staff; beams optionally shared -between voices. (well, more than 2 voices won't look pretty) +between voices. (well, more than 2 voices won't look pretty --yet.) =item * multiple scores within one input file. Each score is output to @@ -95,8 +98,6 @@ LilyPond does not display notes directly, nor will it be rehacked to be used interactively. LilyPond writes output to a file. It will not be extended to play music, or to recognize music. -It will output MIDI, though (at some stage) - =item * LilyPond is intended to run on Unix platforms, but it should be portable to any platform which can run TeX and the GNU tools @@ -115,21 +116,21 @@ broken systems. =over 5 -=item B<-I,--include>=F +=item B<-I,--include>=F, add F to the search path for input files. -=item B<-d,--debug>, +=item B<-d,--debug>, Turn debugging info. LilyPond will read the file F<.dstreamrc>, which tells for what functions and classes may produce copious debugging output. -=item B<-w,--warranty>, +=item B<-w,--warranty>, Show the warranty with which LilyPond comes. (It comes with B!) -=item B<-o,--output=>F, +=item B<-o,--output=>F, Set the default output file to F. @@ -139,10 +140,10 @@ Show a summary of usage =item B<-i,--init=>F -set init file (default: F) +set init file to F (default: F) -=item B<--include, -I> -add to file search path. +=item B<--include, -I>=F +add F to the search path for input files. =back @@ -157,7 +158,7 @@ the GNU General Public License, which is in the file F =head1 PREREQUISITES -Compilation: +For compilation you need. =over 5 @@ -174,17 +175,18 @@ or better recommended. I doubt if it will compile with AT&T CC. GNU make. =item * -flex (2.5.1 or better) +Flex (2.5.1 or better) =item * Bison. =item * The "Flower" library, which should be available from the same -source you got this from. +source you got this from. The version of flower lib should match the +one which is found in the F script. =item * -perl. The Makefile uses perl for trivial operations, and you +Perl. The Makefile uses Perl for trivial operations, and you could tinker with it to use sed or awk. =back @@ -194,14 +196,16 @@ LilyPond does use a lot of resources. For operation you need the following: =over 5 =item * -a fast computer (well; full page of music typically takes 1 -minute on my 486/66, using the DEBUG compile) +a fast computer (a full page of music typically takes 1 minute +on my 486/66, using the DEBUG compile. It's lot slower than most +MusiXTeX preprocessors) =item * TeX =item * -The MusixTeX fonts. (I use version T.59) +The MusixTeX fonts. (I use version those found in MusixTeX +Taupin version T.59) =back @@ -216,7 +220,7 @@ Do: make You might want to edit Variables.make to tailor the compilation flags. -why G++ >= 2.7? LilyPond & flower lib uses: +why G++ >= 2.7? LilyPond & FlowerLib uses: =over 5 @@ -298,15 +302,15 @@ This is what the output looks like over here: hw:~/musix/spacer$ xdvi test& [1] 855 -Check out F, it has some comments +Check out the input files, some of them have comments =head1 PROBLEMS -If LilyPond bombs out, then please recompile using B<-g>, and send a -copy of the input which causes the error and a gdb stacktrace of the -crash. It also helps if you can print the values of the objects. So if -your trace is +If LilyPond bombs out, then please recompile using with debugging info +turned on, and send a copy of the input which causes the error and a +gdb stacktrace of the crash. It also helps if you can print the values +of the objects. So if your trace is (gdb) backtrace 12 #0 Interval::operator+= (this=0x11fffec60..) @@ -346,7 +350,6 @@ among others: lilygut, lilyinput, error, faq, LilyPond has no connection with the music package RoseGarden, other than the names being similar :-) - =head1 HISTORY (for a detailed changelog, see F) diff --git a/Makefile b/Makefile index f34bcbc4ca..830b08c360 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,8 @@ distclean: clean all: kompijl doc -win32: # value of $(OSTYPE) on windhoos; "make $OSTYPE" if u use bash :-) +# value of $(OSTYPE) on windhoos; "make $OSTYPE" if u use bash :-) +win32: $(MAKE) -C . CXX=g++ doc: diff --git a/src/inputstaff.cc b/src/inputstaff.cc index 116624574c..7fbc37dbac 100644 --- a/src/inputstaff.cc +++ b/src/inputstaff.cc @@ -1,11 +1,20 @@ +/* + inputstaff.cc -- implement Input_staff + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + #include "debug.hh" #include "score.hh" #include "inputmusic.hh" #include "inputstaff.hh" #include "staff.hh" #include "complexstaff.hh" -#include "lexer.hh" #include "lyricstaff.hh" +#include "midistaff.hh" +#include "lexer.hh" Input_staff::Input_staff(String s) @@ -29,8 +38,12 @@ Input_staff::parse(Score*score_l, Input_music *default_score_wide) p = new Complex_staff; else if (type == "lyric") p = new Lyric_staff; - else - error( "Unknown staff-type `" + type +"\'", defined_ch_c_l_); + else if (type == "midi") + p = new Midi_staff; + else { + error( "Unknown staff-type `" + type +"\'", defined_ch_c_l_ ); + exit( 1 ); + } p->score_l_ = score_l; diff --git a/src/parser.y b/src/parser.y index 6c471fc95f..f761069e3e 100644 --- a/src/parser.y +++ b/src/parser.y @@ -5,6 +5,7 @@ #include "misc.hh" #include "lexer.hh" #include "paperdef.hh" +#include "mididef.hh" #include "inputscore.hh" #include "main.hh" #include "keyword.hh" @@ -38,6 +39,7 @@ int fatal_error_i = 0; String *string; const char *consstr; Paperdef *paper; + Mididef* midi; Input_music *music; Music_general_chord *chord; Music_voice *mvoice; @@ -69,6 +71,7 @@ int fatal_error_i = 0; %token PARTIAL MUSIC GROUPING CADENZA %token END SYMBOLTABLES TEXID TABLE NOTENAMES SCRIPT TEXTSTYLE PLET %token GOTO +%token MIDI TEMPO %token IDENTIFIER %token PITCHMOD DURATION RESTNAME @@ -79,10 +82,11 @@ int fatal_error_i = 0; %token DOTS INT %type unit %type pitch_list -%type open_request_parens close_request_parens +%type open_request_parens close_request_parens close_plet_parens %type declaration %type declarable_identifier %type paper_block paper_body +%type midi_block midi_body %type dim real %type default_duration explicit_duration notemode_duration mudela_duration %type notename @@ -214,6 +218,7 @@ score_body: { $$->set($4); } | score_body paper_block { $$->set($2); } + | score_body midi_block { $$->set($2); } | score_body error { } @@ -252,6 +257,30 @@ paper_body: } ; +/* + MIDI +*/ +midi_block: + MIDI + + '{' midi_body '}' { $$ = $3; } + ; + +midi_body: { + $$ = new Mididef; + } + | midi_body OUTPUT STRING { + $$->outfile_str_ = *$3; + delete $3; + } + | midi_body TEMPO mudela_duration ':' int { + $$->set_tempo( wholes( $3[0], $3[1] ), $5 ); + } + | midi_body error { + + } + ; + /* STAFFs */ @@ -271,6 +300,9 @@ staff_init: $$ = new Input_staff(*$1); delete $1; } + | MIDI { + $$ = new Input_staff("midi"); + } ; staff_body: @@ -340,7 +372,6 @@ music_chord_body: ; - /* VOICE ELEMENTS */ @@ -349,26 +380,32 @@ full_element: pre_requests voice_elt post_requests { add_requests($2, post_reqs); $$ = $2; } - | lyrics_elt + | pre_requests lyrics_elt post_requests { + add_requests($2, pre_reqs); + add_requests($2, post_reqs); + $$ = $2; + } | command_elt ; command_elt: - command_req { +/* empty */ { $$ = new Voice_element; - $$->add($1); - $1-> defined_ch_c_l_ = lexer->here_ch_c_l(); + $$-> defined_ch_c_l_ = lexer->here_ch_c_l(); + } +/* cont: */ + command_req { + $2-> defined_ch_c_l_ = $$->defined_ch_c_l_; + $$->add($2); + } -/* can't do this, since "| |" has shift/reduce conflict. : - command_elt command_req { .. } -*/ ; command_req: '|' { $$ = new Barcheck_req; } - | BAR STRING { + | BAR STRING { $$ = new Bar_req(*$2); delete $2; } @@ -377,18 +414,18 @@ command_req: m->set($3,$5); $$ = m; } - | SKIP duration_length { + | SKIP '{' duration_length '}' { Skip_req * skip_p = new Skip_req; - skip_p->duration_ = *$2; - delete $2; + skip_p->duration_ = *$3; + delete $3; $$ = skip_p; } - | CADENZA int { - $$ = new Cadenza_req($2); + | CADENZA '{' int '}' { + $$ = new Cadenza_req($3); } - | PARTIAL duration_length { - $$ = new Partial_measure_req(*$2); - delete $2; + | PARTIAL '{' duration_length '}' { + $$ = new Partial_measure_req(*$3); + delete $3; } | STEM '{' int '}' { $$ = get_stemdir_req($3); @@ -416,6 +453,11 @@ post_requests: $2->defined_ch_c_l_ = lexer->here_ch_c_l(); post_reqs.push($2); } + | post_requests close_plet_parens INT '/' INT { + post_reqs.push( get_request($2) ); + req_defined_ch_c_l = lexer->here_ch_c_l(); + post_reqs.push( get_plet_request( $2, $3, $5 ) ); + } ; post_request: @@ -426,6 +468,13 @@ post_request: | textscript_req ; +close_plet_parens: + ']' { + req_defined_ch_c_l = lexer->here_ch_c_l(); + $$ = ']'; + } + ; + close_request_parens: '(' { $$='('; @@ -529,7 +578,7 @@ voice_command: set_default_octave(*$3); delete $3; } - | TEXTSTYLE STRING { + | TEXTSTYLE STRING { set_text_style(*$2); delete $2; } @@ -743,16 +792,16 @@ parse_file(String init, String s) lexer = new My_flex_lexer; #ifdef YYDEBUG - yydebug = !monitor.silence("InitParser") && check_debug; - lexer->set_debug( !monitor.silence("InitLexer") && check_debug); + yydebug = !monitor->silence("InitParser") && check_debug; + lexer->set_debug( !monitor->silence("InitLexer") && check_debug); #endif lexer->new_input(init); yyparse(); #ifdef YYDEBUG - yydebug = !monitor.silence("Parser") && check_debug; - lexer->set_debug( !monitor.silence("Lexer") && check_debug); + yydebug = !monitor->silence("Parser") && check_debug; + lexer->set_debug( !monitor->silence("Lexer") && check_debug); #endif lexer->new_input(s); -- 2.39.5