From ed8b75cbe4b36fea416ab67837da668737037c68 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:30:49 +0000 Subject: [PATCH] lilypond-0.0.29 --- Documentation/faq.pod | 16 +- input/scsii-menuetto.ly | 152 ++++++++++ input/standchen.ly | 285 +++++++++--------- src/Makefile | 3 + src/complexstaff.cc | 4 +- src/complexwalker.cc | 3 +- src/groupregs.cc | 2 +- src/inputcommands.cc | 7 +- src/inputstaff.cc | 5 +- src/lexer.l | 4 +- src/lexerinit.cc | 8 +- src/lyriccolumn.cc | 4 +- src/mylexer.cc | 31 +- src/note.cc | 66 ++-- src/parser.y | 54 ++-- src/pscore.cc | 6 +- src/score.cc | 3 +- src/simplestaff.cc | 5 +- src/sourcefile.cc | 28 +- src/template6.cc | 4 +- src/timedescription.cc | 2 +- src/voiceregs.cc | 6 +- src/warn.cc | 10 +- ...indhoos-suck-suck-suck-thank-you-cygnus.cc | 58 +++- 24 files changed, 517 insertions(+), 249 deletions(-) diff --git a/Documentation/faq.pod b/Documentation/faq.pod index 2544a71338..df28977c5c 100644 --- a/Documentation/faq.pod +++ b/Documentation/faq.pod @@ -8,15 +8,25 @@ FAQ - LilyPond FAQs Q: Why are [] around the notes, and () inbetween? A: [] designate beams, a note can only be in one beam at the same -time. () is a slur, which connects notes. You need to be able to specify +time. () is a slur, which connects notes. You need to be able to +specify a()a()a Q: I want a DOS/NT/W95 port. -A: I haven't had time to find a GCC crosscompiler to DOS/win (in rpm, -please :). No, I'm not considering compilation in W95, but feel free to give it a try. +A0: Reconsider. Try Linux. It-s fun! + +A1: Currently (patchlevel 27), LilyPond (and flowerLib) compiles, links +and runs on windhoos-nt, using the cygnus gnu port (release b17.1). +I (JCN) only had to make a minor workaround for missing library calls. +Have a look at http://www.cygnus.com/gnu-win32. To make LilyPond type +make $OS. (I am not promising to maintain this platform, it is just that +when having to use doze, i-m sometimes too lazy to reboot.) + +A2: I haven't had time to find a GCC crosscompiler to DOS/win (in rpm, +please :). Q: Why GPL? diff --git a/input/scsii-menuetto.ly b/input/scsii-menuetto.ly index 8401484811..d9b570bf0b 100644 --- a/input/scsii-menuetto.ly +++ b/input/scsii-menuetto.ly @@ -119,6 +119,158 @@ ii_menuetto = music { $ } +score { + staff { + melodic music { ii_menuetto } + commands { + key $bes$ + clef "alto" + skip 8:0 + clef "violin" + skip 5:0 + clef "alto" + skip 12:0 + } + } + commands { + meter 3*4 + skip 8:0 + bar ":|:" +% clef "violin" + skip 5:0 +% \clef "alto" + skip 12:0 + bar ":||" + } + paper { + symboltables { table_sixteen } + width 195mm +% unitspace 12mm % this should do, really + unitspace 8mm % to get lily to use only three lines + output "scsii-menuetto.out" + } +} +% scsii-menuetto.ly +% +% Solo Cello Suites +% J. S. Bach +% +% Suite II part v +% Menuetto I +% +% Copyright (c) 1995,1996,1997 Jan Nieuwenhuizen +% +% The purpose of this file is to demonstrate features of LilyPond. +% (there is an accompanying LaTeX file, scsii-menuetto.tex) +% + +% \lefttitle{Menuetto} +% \tempo{Moderato} +% \metron{4=120} +% +% \meter{3/4} +% \key\F % key is F ( f-major ) +% \clef\alto % use alto clef +% \duration8 % default duration is 'eight note +% +% \verb{\nobarnumbers} % issue MusiXTeX command +% \barnumbering0 +% \slope{30} % Fool MusiXTeX into 30 / 10 steeper beam +% \stemlength3 % shorter stemlength +% % because piece is set very tightly +%%1 % double comments are included in .tex file +ii_menuetto = music { + $ + \octave{} + \duration{8} + { a2 f2 d2_"\f" } bes4-. | +%%2 + { [ bes^"1" e c_"2"_"4" } +% (^ ) + a bes-. g-. ] a4-.^"4" | +%%3 +% { d4 `bes4-.\stemup } stemup: 2 voices? + { d4 `bes4-. } g4-. [ f-. e-. ] | +%%4 +% { f `a } (^ e ) d cis-. `b-. `a-. ] +% [ f ( e ) d cis-. `b-. `a-. ] + { [ f `a } e d cis-. `b-. `a-. ] +%%5 + { a2 f2 d2 } bes4-. | % @bes4-. | +%%6 +% { bes( e } ) a + { [ bes e } a bes-. g-. ] + 'c4-. | % ='c4-. | +%%7 + { a4-. f4} +% { 'd4-.-\upbow f4 `bes4\stemdown } + { 'd4-.-\upbow f4 `bes4 } +% { 'e4-.-\downbow g4 `g4\stemdown } | + { 'e4-.-\downbow g4 `g4 } | +%%8 +% { 'cis2.-\upbow e2. `a2.\stemdown } :||: + { 'cis2.-\upbow e2. `a2. } | % :||: +%%9 +% \clef "violin" +% { 'e2 a2_f\stemdown } + { 'e2 a2_"\f" } + [ 'd( 'e16 )'f16 ] | +%%10 +% [ { 'e( g } ) 'd 'cis_{ }_{ }_2 'e + { [ 'e g } 'd 'cis_"2" 'e a( )g ] | +%%11 +% { a4\stemup( f2\stemdown } ) 'd4\stemup +% { 'cis4\stemup-. e4\stemdown } + { \music { a4 'd4 'cis4-. } \music { f2 e4 } } | +%%12 +% { 'g^4 d\stemdown } (^ 'f 'e ) 'f 'd^3(^ ) ='c ] | + { [ 'g^"4" d } 'f 'e 'f 'd^"3"( ) 'c ] | +% %13 +% { bes2\stemup g4\stemdown } ( ) f4 +% { 'c4\stemup e4\stemdown } +% { bes2 g4 } f4 { 'c4 e4 } | % \clef "alto" | + { \music { bes2 'c4 } \music { g4 f4 e4 } } | +%%%14 +%% [ { a( f } ) g a f ] { 'd4-\upbow e4 `bes4\stemdown } | + { [ a f } g a f ] { 'd4-\upbow e4 `bes4 } | +%%%15 +%% { 'c4-\downbow f4 `a4\stemdown } [ bes( )a g a ] | +% { 'c4-\downbow f4 `a4 } [ bes( )a g a ] | +%%%16 + [ f( e )f a-. g-. bes-. ] | +%% \tighten % use one line less +%% \newline % start new line +%% | +%%%17 +%% { a2^0^\tr fis2_3 } bes4 | + { a2^"0" fis2_"3" } bes4 | +%%%18 +%% [ { 'c( es } ) bes 'c a ] fis4^\tr | + { [ 'c es } bes 'c a ] fis4 | +%%%19 +%% { 'd4-\downbow g4 `bes4\stemdown } { 'c4-\upbow g4 c4\stemdown } [ { bes d } a ] | + { 'd4-\downbow g4 `bes4 } { 'c4-\upbow g4 c4 } { [ bes d } a ] | +%%%20 +%% [ { 'c( d `g } bes a ) bes g ( ) bes ] | + { [ 'c d `g } bes a bes g( )bes ] | +%%%21 +%% { 'd4\stemup g2\stemdown } (^ ) 'cis4\stemup { 'd4\stemup =f4\stemdown } | +% { 'd4 g2 } 'cis4 { 'd4 f4 } | + { \music { 'd4 'cis4 'd4 } \music { g2 f4 } } | +%%%22 +%% [ { g( cis } )f g e ] { f4 d4 } | + { [ g cis } f g e ] { f4 d4 } | +%%%23 +%% [ `g g ] { e4.\stemup^\tr `a4.\stemdown } d\stemup-\upbow | + [ `g g ] { e4. `a4. } d-\upbow | +%%%24 +%% { d2.^{fine} `a2. `d2.\stemup_{ }_{ }_{3 mins.}} s4 :|| +%% { \textstyle "italic" d2.^"fine" `a2. \textstyle "roman" `d2._"3 mins."} | % :|| + { d2.^"fine" `a2. `d2._"3 mins."} | % :|| +%% \tighten % use one line less + $ +} + score { staff { melodic diff --git a/input/standchen.ly b/input/standchen.ly index 87c317b403..d10b99a27b 100644 --- a/input/standchen.ly +++ b/input/standchen.ly @@ -128,7 +128,7 @@ melodie = music { $ { a2 fis2_"\pp" } { a4 fis4 } %%33 %#% { b2(^ g2 } [v { 'd8.( b8. } { b16 ) ) g16 } ] - { b2( g2 } { [ 'd8. b8. } { b16 g16 ] } + { b2 g2 } { [ 'd8. b8. } { b16 g16 ] } %%34 %#% { a4. fis4. } [ { a_. fis_.( } { a_. fis_. } { a_. ) fis_. } ] { a4. fis4. } { [ a_. fis_. } { a_. fis_. } { a_. fis_. ] } @@ -359,165 +359,158 @@ begeleiding = music { $ { `d2.^\fermata ``d2. } $ } + tekst1 = music { - @ - \duration{4} - _ _ _ - _ _ _ - _ _ _ - _ _ _ - % 5 - \plet{ 2/3 } Lei- se8 \plet{ 1/1 } fleh-4. en8 - \plet{ 2/3 } mei- ne8 \plet{ 1/1 } Lie- der8 _8 - Durch4. die8 \plet{ 2/3 } Nacht zu8 \plet{ 1/1 } - dir;2 _ - _ _ _ - _ _ _ - % 11 - \plet{ 2/3 } In den8 \plet{ 1/1 } stil-4. len8 - \plet{ 2/3 } Hain her-8 \plet{ 1/1 } nie-4. der,8 - Lieb4. chen,8 \plet{ 2/3 } komm zu8 \plet{ 1/1 } - mir!2 _ - _ _ _ - _ _ _ - - % 17 - Fl\"us-8. ternd16 schlan-4. ke8 - Wip-8. fel16 rau-4. schen8 - \plet{ 2/3 } In des8 \plet{ 1/1 } Mon-4. des8 - Licht;2. - _ _ _ - _ _ _ - - % 23 - Des8. Ver-16 r\"a-4. ters8 - feind-8. lich16 Lau-4. schen8 - \plet{ 2/3 } F\"urch- te,8 \plet{ 1/1 } Hol-4. de,8 - nicht.2. - _ _ _ - _ _ _ - - % volta 1 - % 29 - _ _ _ _ _ _ - _ _ _ _ _ _ - _ _ _ _ _ _ - _ _ _ _ _ _ - - % volta 2 - % 37 - La\ss8. auch16 dir8. die16 Brust8. be-16 - we- gen, _ - Lieb-4. chen,8 h\"o-8. re16 - mich!2 _ - _ _ _ - _ _ _ - Be-8. bend16 harr' ich8 _8 - dir8. ent-16 ge- gen!8 _8 - \plet{ 2/3 } Komm, be-8 \plet{ 1/1 } gl\"u4. cke8 - mich!2. - % 47 - _ _ _ _ _ _ - _ _ _ _ _ _ - _ _ _ _ _ _ - _ _ _ _ _ _ - _ _ _ _ _ _ - % 57 - _ _ _ _ _ _ - @ - } - - tekst2 = music { - @ - \duration{4} - _ _ _ - _ _ _ - _ _ _ - _ _ _ - % 5 - \plet{ 2/3 } H\"orst die8 \plet{ 1/1 } Nach-4. ti-8 - \plet{ 2/3 } gal- len8 \plet{ 1/1 } schla- gen?8 _8 - Ach!4. sie8 \plet{ 2/3 } fleh- en8 \plet{ 1/1 } - dich,2 _ - _ _ _ - _ _ _ - - % 11 - \plet{ 2/3 } Mit der8 \plet{ 1/1 } T\"o-4. ne8 - \plet{ 2/3 } s\"u\ss- en8 \plet{ 1/1 } Kla-4. gen8 - Fleh-4. en8 \plet{ 2/3 } sie f\"ur8 \plet{ 1/1 } - mich.2 _ - _ _ _ - _ _ _ - - % 17 ok tot hier - Sie-8. ver-16 stehn4. des8 - Bus-8. ens16 Seh-4. nen,8 - \plet{ 2/3 } Ken- nen8 \plet{ 1/1 } Lieb-4. es-8 - schmerz,2. - _ _ _ - _ _ _ - - % 23 - R\"uh-8. ren16 mit4. den8 - Sil-8. ber-16 t\"o-4. nen8 - \plet{ 2/3 } Jed- es8 \plet{ 1/1 } wei-4. che8 - Herz.2. - _ _ _ - _ _ _ - - % volta 1 - % 29 - _ _ _ _ _ _ - _ _ _ _ _ _ - _ _ _ _ _ _ - _ _ _ _ _ _ - - % volta 2 - % 37 - % _ _ _ _ _ _ - % _ _ _ _ _ _ - % _ _ _ _ _ _ - % _ _ _ _ _ _ - % _ _ _ _ _ _ - % 47 - % _ _ _ _ _ _ - % _ _ _ _ _ _ - % _ _ _ _ _ _ - % _ _ _ _ _ _ - % _ _ _ _ _ _ - % 57 - % _ _ _ _ _ _ - @ - } - + @ + \duration{4} + _ _ _ + _ _ _ + _ _ _ + _ _ _ +% 5 + \plet{ 2/3 } Lei- se8 \plet{ 1/1 } fleh-4. en8 + \plet{ 2/3 } mei- ne8 \plet{ 1/1 } Lie- der8 _8 + Durch4. die8 \plet{ 2/3 } Nacht zu8 \plet{ 1/1 } + dir;2 _ + _ _ _ + _ _ _ +% 11 + \plet{ 2/3 } In den8 \plet{ 1/1 } stil-4. len8 + \plet{ 2/3 } Hain her-8 \plet{ 1/1 } nie-4. der,8 + Lieb4. chen,8 \plet{ 2/3 } komm zu8 \plet{ 1/1 } + mir!2 _ + _ _ _ + _ _ _ + +% 17 + Fl\"us-8. ternd16 schlan-4. ke8 + Wip-8. fel16 rau-4. schen8 + \plet{ 2/3 } In des8 \plet{ 1/1 } Mon-4. des8 + Licht;2. + _ _ _ + _ _ _ + +% 23 + Des8. Ver-16 r\"a-4. ters8 + feind-8. lich16 Lau-4. schen8 + \plet{ 2/3 } F\"urch- te,8 \plet{ 1/1 } Hol-4. de,8 + nicht.2. + _ _ _ + _ _ _ + +% volta 1 +% 29 + _ _ _ _ _ _ + _ _ _ _ _ _ + _ _ _ _ _ _ + _ _ _ _ _ _ + +% volta 2 +% 37 + La\ss8. auch16 dir8. die16 Brust8. be-16 + we- gen, _ + Lieb-4. chen,8 h\"o-8. re16 + mich!2 _ + Be-8. bend16 harr' ich8 _8 + dir8. ent-16 ge- gen!8 _8 + \plet{ 2/3 } Komm, be-8 \plet{ 1/1 } gl\"u4. cke8 + mich!2. + _ _ _ _ _ _ +% 47 + _ _ _ _ _ _ + _ _ _ _ _ _ + _ _ _ _ _ _ + _ _ _ _ _ _ + _ _ _ _ _ _ +% 57 + _ _ _ _ _ _ + @ +} + +tekst2 = music { + @ + \duration{4} + _ _ _ + _ _ _ + _ _ _ + _ _ _ +% 5 + \plet{ 2/3 } H\"orst die8 \plet{ 1/1 } Nach-4. ti-8 + \plet{ 2/3 } gal- len8 \plet{ 1/1 } schla- gen?8 _8 + Ach!4. sie8 \plet{ 2/3 } fleh- en8 \plet{ 1/1 } + dich,2 _ + _ _ _ + _ _ _ + +% 11 + \plet{ 2/3 } Mit der8 \plet{ 1/1 } T\"o-4. ne8 + \plet{ 2/3 } s\"u\ss- en8 \plet{ 1/1 } Kla-4. gen8 + Fleh-4. en8 \plet{ 2/3 } sie f\"ur8 \plet{ 1/1 } + mich.2 _ + _ _ _ + _ _ _ + +% 17 ok tot hier + Sie-8. ver-16 stehn4. des8 + Bus-8. ens16 Seh-4. nen,8 + \plet{ 2/3 } Ken- nen8 \plet{ 1/1 } Lieb-4. es-8 + schmerz,2. + _ _ _ + _ _ _ + +% 23 + R\"uh-8. ren16 mit4. den8 + Sil-8. ber-16 t\"o-4. nen8 + \plet{ 2/3 } Jed- es8 \plet{ 1/1 } wei-4. che8 + Herz.2. + _ _ _ + _ _ _ + +% volta 1 +% 29 + _ _ _ _ _ _ + _ _ _ _ _ _ + _ _ _ _ _ _ + _ _ _ _ _ _ + +% volta 2 +% 37 +% _ _ _ _ _ _ +% _ _ _ _ _ _ +% _ _ _ _ _ _ +% _ _ _ _ _ _ +% _ _ _ _ _ _ +% 47 +% _ _ _ _ _ _ +% _ _ _ _ _ _ +% _ _ _ _ _ _ +% _ _ _ _ _ _ +% _ _ _ _ _ _ +% 57 +% _ _ _ _ _ _ + @ +} + score { - paper { - symboltables { table_sixteen } - output "standchen.uit" - unitspace 2.4 cm - % unitspace 4.0 cm % leaves all text stand free - geometric 1.4 + staff { + lyric + music { tekst1 } + music { tekst2 } } staff { - melodic + melodic music { melodie } commands { key $bes$ clef "violin" } } - staff { - lyric - music { tekst1 } - music { tekst2 } - } staff { - melodic + melodic music { begeleiding } commands { key $bes$ - clef "bass" + clef "bass" } } commands { diff --git a/src/Makefile b/src/Makefile index 55fba019b2..8c88c5dbc7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,6 +1,9 @@ default: $(MAKE) -C .. +win32: + $(MAKE) -C .. Windows_NT + DISTFILES=Makefile $(mycc) $(othersrc) dist: ln $(DISTFILES) $(DDIR)/$(SUBDIR) diff --git a/src/complexstaff.cc b/src/complexstaff.cc index 8f961b7d7b..7e21bf2252 100644 --- a/src/complexstaff.cc +++ b/src/complexstaff.cc @@ -8,6 +8,7 @@ #include "complexstaff.hh" #include "sccol.hh" #include "complexwalker.hh" +#include "main.hh" @@ -30,7 +31,8 @@ Complex_column::setup_requests() if (j->barcheck()) { if (tdescription_->whole_in_measure) { - error( "Barcheck failed", j->defined_ch_c_l_m ); + warning( "Barcheck failed", j->defined_ch_c_l_m ); +// staff_l_->the_line_->pscore_l_->heu errorlevel_i_ |= 1; } continue; } diff --git a/src/complexwalker.cc b/src/complexwalker.cc index 87e3729a07..378f486a08 100644 --- a/src/complexwalker.cc +++ b/src/complexwalker.cc @@ -205,8 +205,7 @@ Complex_walker::try_request(Request*req) } if (!b) - warning("junking request: " + String(req->name()), - req->defined_ch_c_l_m); + warning("junking request: " + String(req->name()), req->defined_ch_c_l_m); } void diff --git a/src/groupregs.cc b/src/groupregs.cc index ae790ab9c6..9367c92cd5 100644 --- a/src/groupregs.cc +++ b/src/groupregs.cc @@ -82,7 +82,7 @@ Stem_beam_register::process_request() if (beam_p_) { if (stem_req_l_->balltype<= 4) - warning( "stem doesn't fit in Beam.", + warning( "stem doesn't fit in Beam", stem_req_l_->defined_ch_c_l_m); else beam_p_->add(stem_p_); diff --git a/src/inputcommands.cc b/src/inputcommands.cc index d9f6910cf5..0939387375 100644 --- a/src/inputcommands.cc +++ b/src/inputcommands.cc @@ -7,6 +7,7 @@ #include "stcol.hh" #include "staff.hh" #include "assoc.hh" +#include "lexer.hh" void Commands_at::print() const @@ -181,8 +182,10 @@ Input_commands::add(Input_command c, Assoc &marks_assoc_r) } else if (s=="GOTO") { ptr = top(); String m(c.args[1]); - if (!marks_assoc_r.elt_query(m)) - error("Unknown marker: `" +m + "\'"); + if (!marks_assoc_r.elt_query(m)) { + warning( "Unknown marker: `" +m + "\'", 0 ); + return; + } ptr.find_moment(marks_assoc_r[m]); } else { diff --git a/src/inputstaff.cc b/src/inputstaff.cc index 8a56643f5c..27e9a55732 100644 --- a/src/inputstaff.cc +++ b/src/inputstaff.cc @@ -10,6 +10,7 @@ #include "lyricstaff.hh" #include "staff.hh" #include "complexstaff.hh" +#include "lexer.hh" void Input_staff::add(Array &s) @@ -46,8 +47,8 @@ Input_staff::parse(Score*score_l) else if (type == "lyric") p = new Lyric_staff; else - error("Unknown staff-type `" + type +"\'"); - + error( "Unknown staff-type `" + type +"\'", 0 ); + p->score_l_ = score_l; p->define_spot_str_ = ""; // todo diff --git a/src/lexer.l b/src/lexer.l index 00b4c70c15..0771cafcde 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -270,9 +270,7 @@ include { //ignore } . { -// error( "lexer error: illegal character '"+String(YYText()[0])+ "' encountered"); - error( String( "illegal character: " ) + String( YYText()[0] ) + ": ", - here_ch_c_l() ); + error( String( "illegal character: " ) + String( YYText()[0] ), here_ch_c_l() ); return YYText()[0]; } diff --git a/src/lexerinit.cc b/src/lexerinit.cc index 92b52ad8b2..5840b3c62e 100644 --- a/src/lexerinit.cc +++ b/src/lexerinit.cc @@ -15,12 +15,6 @@ yylex() { return lexer->yylex(); } -void -yyerror(const char *s) -{ - lexer->LexerError(s); -} - bool busy_parsing() { @@ -34,6 +28,7 @@ Input_file::Input_file(String s) String pf(s); if (pf=="") { is = &cin; + defined_ch_c_l_m = 0; sourcefile_l_ = 0; } else { @@ -41,6 +36,7 @@ Input_file::Input_file(String s) source_global_l->add( sourcefile_p ); sourcefile_l_ = sourcefile_p; is = sourcefile_l_->istream_l(); + defined_ch_c_l_m = sourcefile_l_->ch_c_l(); } cout << "["<barcheck()) { if (tdescription_->whole_in_measure) { - error( "Barcheck failed ", req_l->defined_ch_c_l_m ); + warning( "Barcheck failed ", req_l->defined_ch_c_l_m ); } } if (req_l->lreq_l()) { diff --git a/src/mylexer.cc b/src/mylexer.cc index 9465279c4a..4575fa78d3 100644 --- a/src/mylexer.cc +++ b/src/mylexer.cc @@ -7,10 +7,10 @@ #include "keyword.hh" #include "assoc.hh" #include "lexer.hh" -#include "sstack.hh" #include "debug.hh" #include "notename.hh" #include "sourcefile.hh" +#include "parseconstruct.hh" static Keyword_ent the_key_tab[]={ "bar", BAR, @@ -70,7 +70,7 @@ My_flex_lexer::ret_notename(int *p, String text, int octave_mod) if (p[0] < 0) { errorlevel_i_ |= 1; - warning( String( "notename does not exist: " ) +YYText() + ": ", ch_c_l ); + warning( String( "notename does not exist: " ) + YYText(), ch_c_l ); p[0] = p[1] = 0; } return NOTENAME; @@ -103,7 +103,7 @@ My_flex_lexer::lookup_identifier(String s) char const* My_flex_lexer::here_ch_c_l() { - return data_ch_c_l_m + yyin->tellg(); + return data_ch_c_l_m ? data_ch_c_l_m + yyin->tellg() : 0; } void @@ -137,11 +137,14 @@ My_flex_lexer::LexerError(const char *s) *mlog << "error at EOF" << s << '\n'; } else { char const* ch_c_l = here_ch_c_l(); - ch_c_l--; - while ( ( *ch_c_l == ' ' ) || ( *ch_c_l == '\t' ) || ( *ch_c_l == '\n' ) ) - ch_c_l--; - ch_c_l++; - error( s, ch_c_l ); + if ( ch_c_l ) { + ch_c_l--; + while ( ( *ch_c_l == ' ' ) || ( *ch_c_l == '\t' ) || ( *ch_c_l == '\n' ) ) + ch_c_l--; + ch_c_l++; + } + errorlevel_i_ |= 1; + warning( s, ch_c_l ); } } @@ -149,13 +152,20 @@ My_flex_lexer::LexerError(const char *s) void My_flex_lexer::new_input(String s) { - if (!include_stack.empty()) + if (!include_stack.empty()) { include_stack.top()->line = lineno(); + // should this be saved at all? + include_stack.top()->defined_ch_c_l_m = defined_ch_c_l; + } Input_file *newin = new Input_file(s); include_stack.push(newin); switch_streams(newin->is); - data_ch_c_l_m = newin->sourcefile_l_->ch_c_l(); + if ( newin->sourcefile_l_ ) + data_ch_c_l_m = newin->sourcefile_l_->ch_c_l(); + else + data_ch_c_l_m = 0; + yylineno = 1; } @@ -171,6 +181,7 @@ My_flex_lexer::close_input() Input_file *i = include_stack.top(); switch_streams(i->is); yylineno = i->line; + defined_ch_c_l = i->defined_ch_c_l_m; } delete old; return ok; diff --git a/src/note.cc b/src/note.cc index 9519371175..226b10a601 100644 --- a/src/note.cc +++ b/src/note.cc @@ -98,15 +98,17 @@ Voice_element * get_note_element(String pitch, int * notename, int * duration ) { Voice_element*v = new Voice_element; + v->defined_ch_c_l_m = defined_ch_c_l; int i=0; int dur = duration[0]; int dots=duration[1]; if (dur >= 2) { - Stem_req * st = new Stem_req(dur,dots); - st->plet_factor = Moment(default_plet_dur, default_plet_type); - v->add(st); + Stem_req * stem_req_p = new Stem_req(dur,dots); + stem_req_p->plet_factor = Moment(default_plet_dur, default_plet_type); + stem_req_p->defined_ch_c_l_m = defined_ch_c_l; + v->add(stem_req_p); } if ( !defined_ch_c_l ) @@ -128,7 +130,6 @@ get_note_element(String pitch, int * notename, int * duration ) rq->print(); v->add(rq); - v->defined_ch_c_l_m = defined_ch_c_l; return v; } @@ -137,7 +138,7 @@ Voice_element* get_word_element(Text_def* tdef_p, int* duration) { Voice_element* velt_p = new Voice_element; - + velt_p->defined_ch_c_l_m = defined_ch_c_l; int dur = duration[0]; int dots=duration[1]; @@ -155,6 +156,7 @@ get_word_element(Text_def* tdef_p, int* duration) lreq_p->dots = dots; lreq_p->plet_factor = Moment(default_plet_dur, default_plet_type); lreq_p->print(); + lreq_p->defined_ch_c_l_m = defined_ch_c_l; velt_p->add(lreq_p); @@ -164,16 +166,19 @@ get_word_element(Text_def* tdef_p, int* duration) Voice_element * get_rest_element(String, int * duration ) { - Voice_element*v = new Voice_element; + Voice_element* velt_p = new Voice_element; + velt_p->defined_ch_c_l_m = defined_ch_c_l; - Rest_req * rq = new Rest_req; - rq->plet_factor = Moment(default_plet_dur, default_plet_type); - rq->balltype = duration[0]; - rq->dots = duration[1]; - rq->print(); - v->add(rq); + Rest_req * rest_req_p = new Rest_req; + rest_req_p->plet_factor = Moment(default_plet_dur, default_plet_type); + rest_req_p->balltype = duration[0]; + rest_req_p->dots = duration[1]; + rest_req_p->print(); + rest_req_p->defined_ch_c_l_m = defined_ch_c_l; - return v; + velt_p->add(rest_req_p); + + return velt_p; } void @@ -283,45 +288,58 @@ get_scriptdef(char c) Request* get_script_req(int d , Script_def*def) { - return new Script_req(d, def); + Script_req* script_req_p = new Script_req(d, def); + script_req_p->defined_ch_c_l_m = defined_ch_c_l; + return script_req_p; } Request* get_text_req(int d , Text_def*def) { - return new Text_req(d, def); + Text_req* text_req_p = new Text_req(d, def); + text_req_p->defined_ch_c_l_m = defined_ch_c_l; + return text_req_p; } Voice_element* get_mark_element(String s) { Voice_element*v_p = new Voice_element; - v_p->add( new Mark_req(s)); - + v_p->defined_ch_c_l_m = defined_ch_c_l; + Mark_req* mark_req_p = new Mark_req(s); + mark_req_p->defined_ch_c_l_m = defined_ch_c_l; + v_p->add(mark_req_p); return v_p; } Voice_element* get_command_element(Input_command*com_p) { - Voice_element *v_p = new Voice_element; - v_p->add(new Staff_command_req(com_p)); - return v_p; + Voice_element *velt_p = new Voice_element; + velt_p->defined_ch_c_l_m = defined_ch_c_l; + Staff_command_req* scommand_req_p = new Staff_command_req(com_p); + scommand_req_p->defined_ch_c_l_m = defined_ch_c_l; + velt_p->add(scommand_req_p); + return velt_p; } Voice_element* get_barcheck_element() { - Voice_element*v_p = new Voice_element; - v_p->add( new Barcheck_req); - - return v_p; + Voice_element* velt_p = new Voice_element; + velt_p->defined_ch_c_l_m = req_defined_ch_c_l; + Barcheck_req* barcheck_req_p = new Barcheck_req; + barcheck_req_p->defined_ch_c_l_m = req_defined_ch_c_l; + velt_p->add(barcheck_req_p); + return velt_p; } Voice_element* get_stemdir_element(int d) { Voice_element*v_p = new Voice_element; + v_p->defined_ch_c_l_m = req_defined_ch_c_l; Group_feature_req * gfreq_p = new Group_feature_req; gfreq_p->stemdir_i_ =d; + gfreq_p->defined_ch_c_l_m = req_defined_ch_c_l; v_p->add(gfreq_p); return v_p; } diff --git a/src/parser.y b/src/parser.y index 3f01afb423..09e4bd310a 100644 --- a/src/parser.y +++ b/src/parser.y @@ -19,10 +19,11 @@ #endif Array pre_reqs, post_reqs; -sstack define_spots; +Array define_spots; Paperdef*default_paper(); char const* defined_ch_c_l; char const* req_defined_ch_c_l; +int fatal_error_i = 0; %} @@ -171,7 +172,7 @@ declaration: delete $1; } | declarable_identifier error '}' { - warning( "parse error", lexer->here_ch_c_l() ); +// warning( "parse error", lexer->here_ch_c_l() ); } ; @@ -224,7 +225,7 @@ score_body: { score_commands_block: COMMANDS '{' score_commands_body '}' { $$ =$3;} | COMMANDS '{' error '}' { - warning( "parse error", lexer->here_ch_c_l() ); +// warning( "parse error", lexer->here_ch_c_l() ); } ; @@ -325,7 +326,7 @@ paper_body: | paper_body UNITSPACE dim { $$->whole_width = $3; } | paper_body GEOMETRIC REAL { $$->geometric_ = $3; } | paper_body error { - warning( "parse error", lexer->here_ch_c_l() ); +// warning( "parse error", lexer->here_ch_c_l() ); } ; @@ -361,7 +362,7 @@ staff_body: delete $2; } | staff_body error { - warning( "parse error", lexer->here_ch_c_l() ); +// warning( "parse error", lexer->here_ch_c_l() ); } ; @@ -392,7 +393,7 @@ music_voice_body: $$->add($2); } | music_voice_body error { - warning( "parse error", lexer->here_ch_c_l() ); +// warning( "parse error", lexer->here_ch_c_l() ); } ; @@ -416,7 +417,7 @@ music_chord_body: $$ ->add_elt($2); } | music_chord_body error { - warning( "parse error", lexer->here_ch_c_l() ); +// warning( "parse error", lexer->here_ch_c_l() ); } ; @@ -436,8 +437,12 @@ full_element: pre_requests voice_elt post_requests { } | COMMAND '{' staff_command '}' { $$=get_command_element($3); } | COMMAND '{' score_command '}' { $$=get_command_element($3); } - | '|' { $$ = get_barcheck_element(); } + | '|' { + req_defined_ch_c_l = lexer->here_ch_c_l(); + $$ = get_barcheck_element(); + } | STEM '{' int '}' { + req_defined_ch_c_l = lexer->here_ch_c_l(); $$ = get_stemdir_element($3); } | lyrics_elt @@ -459,8 +464,8 @@ post_requests: post_request: close_request_parens { - $$ = get_request($1); req_defined_ch_c_l = lexer->here_ch_c_l(); + $$ = get_request($1); } | script_req | textscript_req @@ -468,23 +473,23 @@ post_request: close_request_parens: '(' { - $$='('; req_defined_ch_c_l = lexer->here_ch_c_l(); + $$='('; } | ']' { - $$ = ']'; req_defined_ch_c_l = lexer->here_ch_c_l(); + $$ = ']'; } ; open_request_parens: ')' { - $$=')'; req_defined_ch_c_l = lexer->here_ch_c_l(); + $$=')'; } | '[' { - $$='['; req_defined_ch_c_l = lexer->here_ch_c_l(); + $$='['; } ; @@ -505,9 +510,9 @@ textscript_req: mudela_text: STRING { + defined_ch_c_l = lexer->here_ch_c_l(); $$ = get_text(*$1); delete $1; - defined_ch_c_l = lexer->here_ch_c_l(); } ; @@ -530,6 +535,10 @@ mudela_script: warning( "too many staccato dots", lexer->here_ch_c_l() ); $$ = get_scriptdef('.'); } + | error { + $$ = get_scriptdef('.'); + yyerrok; + } ; script_dir: @@ -546,8 +555,8 @@ pre_requests: pre_request: open_request_parens { - $$ = get_request($1); defined_ch_c_l = lexer->here_ch_c_l(); + $$ = get_request($1); } ; @@ -622,12 +631,12 @@ default_duration: ; pitchmod: { - $$ = new String; defined_ch_c_l = lexer->here_ch_c_l(); + $$ = new String; } | PITCHMOD { - $$ = $1; defined_ch_c_l = lexer->here_ch_c_l(); + $$ = $1; } ; @@ -770,6 +779,17 @@ dinterval: dim dim { %% +void +yyerror(const char *s) +{ +// if ( YYRECOVERING() ) +// return; + lexer->LexerError(s); + + if ( fatal_error_i ) + exit( fatal_error_i ); +} + void parse_file(String init, String s) { diff --git a/src/pscore.cc b/src/pscore.cc index 89a58be790..728b083f4e 100644 --- a/src/pscore.cc +++ b/src/pscore.cc @@ -254,10 +254,10 @@ void PScore::process() { clean_cols(); - *mlog << "Preprocessing ... "; + *mlog << "Preprocessing" << endl; preprocess(); - *mlog << "Calculating ... "; + *mlog << "Calculating" << endl; calc_breaking(); - *mlog << "Postprocessing ... "; + *mlog << "Postprocessing" << endl; postprocess(); } diff --git a/src/score.cc b/src/score.cc index f784f30efa..0f697655b2 100644 --- a/src/score.cc +++ b/src/score.cc @@ -12,7 +12,7 @@ void Score::process() { - *mlog << "\nProcessing music ... "; + *mlog << "\nProcessing music" << endl; assert (paper_p_); if (last() == Moment(0)) { @@ -35,7 +35,6 @@ Score::process() // debugging OK(); pscore_p_->process(); - *mlog << "\n"; } // remove empty cols. diff --git a/src/simplestaff.cc b/src/simplestaff.cc index 30ef3e84e1..4f7b5bd2e2 100644 --- a/src/simplestaff.cc +++ b/src/simplestaff.cc @@ -37,15 +37,14 @@ Simple_column::setup_requests() Request *rq= j; if (rq->barcheck()) { if (tdescription_->whole_in_measure) { -// error("Barcheck failed, " + tdescription_->str()); - error( "Barcheck failed", rq->defined_ch_c_l_m ); + warning( "Barcheck failed", rq->defined_ch_c_l_m ); } } if (rq->rhythmic()){ notes.push(rq->rhythmic()); } if (rq->script()) { - notes.last().scripts.push(rq->script()); + notes.top().scripts.push(rq->script()); } if (rq->stem()) { stem_ = rq->stem(); diff --git a/src/sourcefile.cc b/src/sourcefile.cc index f279fae129..1fe2aa3d53 100644 --- a/src/sourcefile.cc +++ b/src/sourcefile.cc @@ -45,6 +45,7 @@ Source_file::~Source_file() char const* Source_file::ch_c_l() { + assert( this ); return (char const*)data_caddr_m; } @@ -60,6 +61,7 @@ Source_file::close() String Source_file::error_str( char const* pos_ch_c_l ) { + assert( this ); if ( !in_b( pos_ch_c_l ) ) return ""; @@ -78,13 +80,13 @@ Source_file::error_str( char const* pos_ch_c_l ) } end_ch_c_l--; -// String( char const* p, int size ) is missing!? +// String( char const* p, int length ) is missing!? // String line_str( begin_ch_c_l, end_ch_c_l - begin_ch_c_l ); - int size_i = end_ch_c_l - begin_ch_c_l; - char* ch_p = new char[ size_i ]; - strncpy( ch_p, begin_ch_c_l, size_i ); - ch_p[ size_i ] = 0; + int length_i = end_ch_c_l - begin_ch_c_l; + char* ch_p = new char[ length_i + 1 ]; + strncpy( ch_p, begin_ch_c_l, length_i ); + ch_p[ length_i ] = 0; String line_str( ch_p ); delete ch_p; @@ -106,15 +108,21 @@ Source_file::error_str( char const* pos_ch_c_l ) bool Source_file::in_b( char const* pos_ch_c_l ) { - return ( pos_ch_c_l >= ch_c_l() ) && ( pos_ch_c_l < ch_c_l() + size_off_m ); + return ( pos_ch_c_l && ( pos_ch_c_l >= ch_c_l() ) && ( pos_ch_c_l < ch_c_l() + size_off_m ) ); } istream* Source_file::istream_l() { assert( fildes_i_m ); - if ( !istream_p_m ) - istream_p_m = new istrstream( ch_c_l(), size_off_m ); + if ( !istream_p_m ) { + if ( size_off_m ) // can-t this be done without such a hack? + istream_p_m = new istrstream( ch_c_l(), size_off_m ); + else { + istream_p_m = new istrstream( "", 0 ); + istream_p_m->set(ios::eofbit); + } + } return istream_p_m; } @@ -124,7 +132,7 @@ Source_file::line_i( char const* pos_ch_c_l ) if ( !in_b( pos_ch_c_l ) ) return 0; - int i = 0; + int i = 1; char const* scan_ch_c_l = ch_c_l(); while ( scan_ch_c_l < pos_ch_c_l ) if ( *scan_ch_c_l++ == '\n' ) @@ -135,7 +143,7 @@ Source_file::line_i( char const* pos_ch_c_l ) void Source_file::map() { - data_caddr_m = (caddr_t)mmap( (void*)0, size_off_m, PROT_READ, MAP_FILE | MAP_SHARED, fildes_i_m, 0 ); + data_caddr_m = (caddr_t)mmap( (void*)0, size_off_m, PROT_READ, MAP_SHARED, fildes_i_m, 0 ); if ( (int)data_caddr_m == -1 ) { cerr << "lilypond: can't map: " << name_str_m << ": " << strerror( errno ) << endl; diff --git a/src/template6.cc b/src/template6.cc index 880a5fb6e0..1f94149abf 100644 --- a/src/template6.cc +++ b/src/template6.cc @@ -1,8 +1,8 @@ +#include "proto.hh" +#include "plist.tcc" #include "register.hh" #include "voicegroup.hh" -#include "pcursor.tcc" -#include "plist.tcc" IPL_instantiate(Voice_registers); IPL_instantiate(Voice_group_registers); diff --git a/src/timedescription.cc b/src/timedescription.cc index 1a66b44a44..5026656c2b 100644 --- a/src/timedescription.cc +++ b/src/timedescription.cc @@ -10,7 +10,7 @@ Time_description::str()const s+= "at "; s+=when; s+="\nmeter " + String(whole_per_measure/one_beat) +":" + - String(Rational(1/one_beat)); + String(Rational(Rational(1)/one_beat)); s+= "\nposition "+String( bars) + ":"+ whole_in_measure +"\n}\n"; return s; } diff --git a/src/voiceregs.cc b/src/voiceregs.cc index a70a01a419..fa95ae9e18 100644 --- a/src/voiceregs.cc +++ b/src/voiceregs.cc @@ -84,7 +84,7 @@ Notehead_register::process_request() if (!accepted_req_arr_.size()) return; - Request* req_l = accepted_req_arr_.last(); + Request* req_l = accepted_req_arr_.top(); if (req_l->note()) { Notehead*n_p = new Notehead(8); // ugh note_p_ = n_p; @@ -151,7 +151,7 @@ Slur_register::process_request() // end slur: move the slur to other array if (slur_req_l->spantype == Span_req::STOP) { if (slur_l_stack_.empty()) - warning("can't find slur to end; ", + warning("can't find slur to end", slur_req_l->defined_ch_c_l_m); else { end_slur_l_arr_.push(slur_l_stack_.pop()); @@ -181,6 +181,6 @@ Slur_register::do_pre_move_process() Slur_register::~Slur_register() { for (int i=0; i < requests_arr_.size(); i++) { - warning("unterminated slur: ", requests_arr_[i]->defined_ch_c_l_m); + warning("unterminated slur", requests_arr_[i]->defined_ch_c_l_m); } } diff --git a/src/warn.cc b/src/warn.cc index f8688d7227..a7d9ba18be 100644 --- a/src/warn.cc +++ b/src/warn.cc @@ -24,7 +24,7 @@ error(String s) if (busy_parsing()) yyerror(s); else - cerr << "\nerror: " << s << "\n"; + cerr << "error: " << s << "\n"; exit(1); } @@ -50,14 +50,16 @@ message( String message_str, char const* context_ch_c_l ) String str = "lilypond: "; Source_file* sourcefile_l = source_global_l->sourcefile_l( context_ch_c_l ); if ( sourcefile_l ) { - str += sourcefile_l->file_line_no_str(context_ch_c_l); + str += sourcefile_l->file_line_no_str(context_ch_c_l) + String(": "); } str += message_str; if ( sourcefile_l ) { - str += "\n"; + str += ":\n"; str += sourcefile_l->error_str( context_ch_c_l ); } - cerr << endl << str << endl; + if ( busy_parsing() ) + cerr << endl; + cerr << str << endl; } void diff --git a/src/windhoos-suck-suck-suck-thank-you-cygnus.cc b/src/windhoos-suck-suck-suck-thank-you-cygnus.cc index 8ed1d6b990..caecb610da 100644 --- a/src/windhoos-suck-suck-suck-thank-you-cygnus.cc +++ b/src/windhoos-suck-suck-suck-thank-you-cygnus.cc @@ -4,6 +4,7 @@ #ifdef _WIN32 #include +#include #include /* @@ -25,16 +26,42 @@ LPVOID MapViewOfFile( DWORD dwNumberOfBytesToMap // number of bytes to map ); + +io.h: +long _get_osfhandle( int filehandle ); */ +// cygnus's gnu-win32-b17.1 does not have _get_osfhandle +// however, after some hacking, it turns out that: + +static const int OSF_OFFSET_i = 72; +static const int OSF_BASE_i = -3; +static const int OSF_FACTOR_i = 8; +// let-s hope bill doesn-t change his mind any time soon :-) + +// so that, while waiting for cygnus's mmap, we can write: + +// #define HAVE_GET_OSFHANDLE // no we still cannot; works only with cl.exe +long +_get_osfhandle( int filedes_i ) +{ + return (long)( OSF_OFFSET_i + ( filedes_i + OSF_BASE_i ) * OSF_FACTOR_i ); +} + +#ifdef HAVE_GET_OSFHANDLE + +#include + caddr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset) { (void)flags; (void)prot; - HANDLE file_handle = CreateFileMapping( fd, (void*)0, PAGE_READONLY, + (void)addr; + HANDLE osf = (HANDLE)_get_osfhandle( fd ); + HANDLE file_handle = CreateFileMapping( osf, (void*)0, PAGE_READONLY, 0, len, 0 ); - return (caddr_t)MapViewOfFile( file_handle, addr, 0, offset, len ); + return (caddr_t)MapViewOfFile( file_handle, FILE_MAP_READ, 0, offset, len ); } @@ -45,4 +72,31 @@ munmap(caddr_t addr, size_t len) return UnmapViewOfFile( addr ); } +#else // ! HAVE_GET_OSFHANDLE // + +caddr_t +mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset) +{ + (void)flags; + (void)prot; + (void)addr; + (void)offset; + char* ch_p = new char[ len ]; + if ( ch_p ) + read( fd, (void*)ch_p, len ); + return ch_p; +} + + +int +munmap(caddr_t addr, size_t len) +{ + (void)len; + delete (char*)addr; + return 0; +} + +#endif // !HAVE_GET_OSFHANDLE // + + #endif // _WIN32 // -- 2.39.5