From: Han-Wen Nienhuys Date: Tue, 4 Feb 1997 22:32:27 +0000 (+0100) Subject: release: 0.0.27 X-Git-Tag: release/0.0.27 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b9eb9a42daa13f86367bf674fbe403e29a8a1ee7;p=lilypond.git release: 0.0.27 --- diff --git a/Documentation/README.pod b/Documentation/README.pod index 17c75baa81..973bab25c1 100644 --- a/Documentation/README.pod +++ b/Documentation/README.pod @@ -1,6 +1,6 @@ =head1 NAME -Lilypond - a music typesetter +LilyPond - a music typesetter =head1 SYNOPSIS @@ -29,8 +29,11 @@ multiple stafftypes (melodic, rhythmic) =item * beams, slurs, chords, super/subscripts (accents and text), -triplets, general n-plet (triplet, -quadruplets, etc.), lyrics +triplets, general n-plet (triplet, quadruplets, etc.), lyrics + +=item * +multiple voices within one staff; beams optionally shared +between voices. =item * multiple scores within one input file. Each score is output to @@ -136,6 +139,13 @@ Set the default output file to F. Show a summary of usage +=item B<--init, -i> + +set init file (default: symbol.ini) + +=item B<--include, -I> +add to file search path. + =back =head1 @@ -196,8 +206,6 @@ The MusixTeX fonts. (I use version T.59) Do: tar zxf flower-1.11.9.tar.gz - mv flower-1.11.9 flower - cd flower; make; cd .. tar zxf lilypond-1.2.13.tar.gz cd lilypond-1.2.13 configure @@ -236,8 +244,8 @@ named return values Han-Wen Nienhuys , Main author =item * -Jan Nieuwenhuizen , Lyrics, bits of -FlowerLib, general comments. +Jan Nieuwenhuizen , Context errors, Lyrics, +bits of FlowerLib, general comments. =item * Mats Bengtsson , bugfixes, testing, general comments. @@ -260,11 +268,10 @@ discouraged; this is what I type in my xterm: This is what the output looks like over here: - hw:~/musix/spacer$ lilypond input/maartje - LilyPond 0.0.23/FlowerLib 1.0.20. Compile: Jan 20 1997, 00:51:06 (g++ 2.7.2) + hw:~/musix/spacer$ lilypond input/maartje.ly + LilyPond 0.0.27/FlowerLib 1.0.23. Compile: Feb 5 1997, 00:28:13 (g++ 2.7.2) Parsing ... [./init//symbol.ini[./init/dutch.ini][./init/script.ini][./init/table_sixteen.ini]][./input/maartje.ly] - Processing music ... warning: process_requests(): beamed note should have a stem (t = 5/8) - Preprocessing ... Calculating ... Postprocessing ... + Processing music ... Preprocessing ... Calculating ... Postprocessing ... output to lelie.out... hw:~/musix/spacer$ tex test @@ -345,9 +352,9 @@ failed, obviously). After long and hard thinking, I came up with an algorithm for the horizontal spacing of multiple staffs (april 1996) I coded it (and did not test it). After starting with this fundamental piece, I slowly -added the stages which come before spacing, and after a few months, I -had a first working version, (october 1996). I announced Patchlevel 0.0.7 -(or 8) to the mutex list after asking some technical details on -spacing; it was downloaded approximately 4 times. Then I got the hang -of it, and in the subsequent two months, I coded until it had -doubled in size (pl 23). +added the stages which come before spacing, and after. A half year +later later, I had a first working version, (october 1996). I +announced Patchlevel 0.0.7 (or 8) to the mutex list after asking some +technical details on spacing; it was downloaded approximately 4 times. +Then I got the hang of it, and in the subsequent two months, I coded +until it had doubled in size (pl 23). diff --git a/Documentation/lilyinput.pod b/Documentation/lilyinput.pod index 4e8367d3d0..6e08669071 100644 --- a/Documentation/lilyinput.pod +++ b/Documentation/lilyinput.pod @@ -32,7 +32,7 @@ In musicmode, eg, and in lyricmode, eg, - Twink- le, twink- le litt- le star,2 + Twin- kle, twin- kle lit- tle star,2 a lot of characters parse differently than in "command" mode, eg, diff --git a/Makefile b/Makefile index 75f56e1ccd..e55ebd0dc9 100644 --- a/Makefile +++ b/Makefile @@ -5,10 +5,14 @@ include Variables.make $(exe): $(obs) + strip --strip-debug $(STABLEOBS) $(CXX) -o $@ $^ $(LOADLIBES) + +.PHONY: clean + clean: - rm -f $(exe) $(DOCDIR)/* core $(obs) + rm -f $(exe) $(DOCDIR)/* core $(obs) $(ALLDEPS) for SUBDIR in $(SUBDIRS); \ do \ $(MAKE) SUBDIR=$$SUBDIR -C $$SUBDIR clean;\ diff --git a/NEWS b/NEWS index 1ed9d91e5f..3362d4ffa6 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,29 @@ +pl 27 + - preliminary WIN32 support (JN) +Features + - errors converted to warnings (JN) + - context errors (JN) + - As vs. as notename. + - WARNING: "melodic" stafftype will create the new Complex_staff! +Examples + - Lohman's Viola Quartet (JN) + - JS Bach Solo Cello suite II menuet (JN) + + +pl pre27 + +Features + - option --init + - last_duration_mode: default_duration is last duration entered + (\duration{\last}) + - syntax: grouping 2*4 3*8 + - preliminary multivoice support +Examples + - JS Bach's WTK example added. + +Internal: + - Text_reg and Script_reg + pl 26 - Documentation/lelie_logo.png - 8-bit chars for input (see ltest.tex) (MB) diff --git a/Sources.make b/Sources.make index e4e9834da6..56e9623b54 100644 --- a/Sources.make +++ b/Sources.make @@ -1,10 +1,10 @@ # -*- Makefile-*- # sourcefiles to be shipped. Also for dependencies -hdr= accidental.hh bar.hh beam.hh boxes.hh break.hh clef.hh clefitem.hh\ +hdr= bar.hh beam.hh boxes.hh break.hh clef.hh clefitem.hh\ command.hh complexwalker.hh complexstaff.hh\ const.hh debug.hh dimen.hh directionalspanner.hh\ - getcommand.hh glob.hh globvars.hh grouping.hh idealspacing.hh\ + getcommand.hh glob.hh grouping.hh idealspacing.hh\ identifier.hh identparent.hh inputcommand.hh inputcommands.hh\ inputmusic.hh inputscore.hh inputstaff.hh item.hh key.hh keyitem.hh\ keyword.hh leastsquares.hh lexer.hh linespace.hh linepstaff.hh\ @@ -16,14 +16,16 @@ hdr= accidental.hh bar.hh beam.hh boxes.hh break.hh clef.hh clefitem.hh\ qlpsolve.hh register.hh request.hh rest.hh rhythmstaff.hh\ sccol.hh score.hh\ scoreline.hh script.hh scriptdef.hh simplestaff.hh simplewalker.hh\ - slur.hh spanner.hh staff.hh staffcommands.hh staffelem.hh staffline.hh\ + slur.hh source.hh sourcefile.hh spanner.hh staff.hh staffcommands.hh\ + staffelem.hh staffline.hh\ stcol.hh stem.hh staffwalker.hh symbol.hh symtable.hh\ tex.hh textdef.hh\ - textitem.hh textspanner.hh timedescription.hh tstream.hh voice.hh + textitem.hh textspanner.hh timedescription.hh tstream.hh voice.hh\ + voicegroup.hh mycc=bar.cc beam.cc boxes.cc break.cc calcideal.cc clef.cc\ clefitem.cc command.cc complexstaff.cc complexwalker.cc \ - complexmelodicstaff.cc complexprint.cc debug.cc dimen.cc\ + complexprint.cc debug.cc dimen.cc\ directionalspanner.cc\ getcommands.cc grouping.cc groupregs.cc idealspacing.cc identifier.cc\ inputcommand.cc inputcommands.cc inputmusic.cc inputscore.cc\ @@ -36,11 +38,21 @@ mycc=bar.cc beam.cc boxes.cc break.cc calcideal.cc clef.cc\ paper.cc pcol.cc pscore.cc pstaff.cc qlp.cc qlpsolve.cc\ register.cc request.cc rest.cc rhythmstaff.cc sccol.cc score.cc\ scoreline.cc scores.cc script.cc scriptdef.cc simpleprint.cc\ - simplestaff.cc simplewalker.cc slur.cc spanner.cc staff.cc\ + simplestaff.cc simplewalker.cc slur.cc source.cc sourcefile.cc\ + spanner.cc staff.cc\ staffcommands.cc staffelem.cc staffline.cc stcol.cc stem.cc\ - staffwalker.cc symbol.cc symtable.cc table.cc tex.cc texbeam.cc\ + staffwalker.cc symbol.cc symtable.cc tex.cc texbeam.cc\ texslur.cc textdef.cc textitem.cc textspanner.cc\ timedescription.cc tstream.cc voice.cc voiceregs.cc voicegroup.cc\ - warn.cc wordwrap.cc\ + warn.cc windhoos-suck-suck-suck-thank-you-cygnus.cc wordwrap.cc\ template1.cc template2.cc template3.cc template4.cc\ - template5.cc template6.cc version.cc \ No newline at end of file + template5.cc template6.cc version.cc + +# a bit of a hack to keep exec size under control. +stablecc=request.cc bar.cc boxes.cc break.cc clef.cc getcommands.cc grouping.cc\ + item.cc keyword.cc leastsquares.cc \ + linepstaff.cc linespace.cc lookup.cc molecule.cc meter.cc\ + paper.cc parser.cc lexer.cc pstaff.cc qlp.cc qlpsolve.cc\ + template1.cc template2.cc template3.cc template4.cc\ + template5.cc template6.cc version.cc tstream.cc tex.cc\ + voice.cc wordwrap.cc spanner.cc diff --git a/TODO b/TODO index 9f422946dc..0385d4ae0c 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,15 @@ + + ./input/standchen.ly.rej + + ./src/stem.cc.rej + + * scrap simplestaff + BUGS * first clef isn't printed + * accidental placement for other clefs + SEVERELY LACKING: * grace notes @@ -13,8 +22,6 @@ INPUTLANGUAGE * transposition - * voicegroups. - * rest name configurable SMALLISH PROJECTS @@ -44,8 +51,6 @@ SMALLISH PROJECTS * use (char *) iso. String for communication between lexer and parser. - * As vs. as notename. - * configure idealspacing: arithmetic spacing * fix linking: `Warning: size of symbol' @@ -53,18 +58,18 @@ SMALLISH PROJECTS BIGGISH PROJECT * merge musical & non-musical column. Scrap Commands in favour - of Requests, and do multiparralel meters + of Requests, and do multiparallel meters DOC * beam generation. + * Request_register + * all errors FUTURE - * syntax: grouping 2*4 3*8. - * put scripts on barcommands * glissando @@ -75,8 +80,6 @@ FUTURE * implement better breaking algorithm - * check out linux -> go32 crosscompiler: dos port - * Implement all requests * merge key{item} & localkey{item} @@ -89,23 +92,15 @@ FUTURE IDEAS - * voice terminate req. - - * keep input in mem, store char* to define spots - * enter Requests directly * itemcolumns - * check out PMX - * dependencies: -> implement children more elegantly. Handle spanner with broken deps. * use an embedded language: scheme, lisp, S-lang, Perl, ? - * Broadcasts in Walker of Request and Item. - * y -dims in internote? * hack up mf sources for decent spacing info (and then maybe diff --git a/Variables.make b/Variables.make index e71edf9753..39719441bf 100644 --- a/Variables.make +++ b/Variables.make @@ -6,6 +6,9 @@ OPTIFLAG=-DNDEBUG -DNPRINT -O2 DEBUGFLAG=-g +# uncomment for windhoos +# CXX=g++ + # turn off -pipe if linker doesn't support it EXTRACXXFLAGS=-pipe -Wall -W -Wmissing-prototypes @@ -37,7 +40,7 @@ endif # version info MAJVER=0 MINVER=0 -PATCHLEVEL=26 +PATCHLEVEL=27 VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL) CXXVER=`$(CXX) --version` @@ -59,14 +62,15 @@ INPUTDIR=input # # include Sources.make -progdocs=$(hdr) $(mycc) gencc=parser.cc lexer.cc cc=$(mycc) $(gencc) CCSOURCE=$(addprefix $(CCDIR)/, $(cc)) obs=$(addprefix $(OBJECTDIR)/,$(cc:.cc=.o)) ALLDEPS=$(addprefix $(DEPDIR)/,$(cc:.cc=.dep)) - +STABLEOBS=$(addprefix $(OBJECTDIR)/,$(stablecc:.cc=.o)) +HEADERS=$(addprefix $(HEADERDIR)/,$(hdr)) +progdocs=$(HEADERS) $(addprefix $(CCDIR)/, $(mycc)) #dist .EXPORT_ALL_VARIABLES: @@ -81,12 +85,12 @@ SCRIPTS=make_version make_patch genheader clearlily MAKFILES=Makefile Variables.make Sources.make Initial.make Generate.make \ configure OFILES=COPYING README NEWS TODO -IFILES= standchen.tex titledefs.tex pavane.tex lilyponddefs.tex \ +IFILES= titledefs.tex lilyponddefs.tex \ ltest.tex test.tex .dstreamrc dimen.tex DFILES=$(MAKFILES) $(OFILES) $(IFILES) $(SCRIPTS) #compiling -LOADLIBES=-L$(FLOWERDIR) -lflower $(EXTRALIB) +LOADLIBES=-L$(FLOWERDIR) -lflower $(EXTRALIB) -lg++ FLOWERDIR=../flower CXXFLAGS=$(DEFINES) -I$(HEADERDIR) -I$(FLOWERDIR) $(EXTRACXXFLAGS) diff --git a/clearlily b/clearlily index 34eb6c982d..40b79c3aaa 100755 --- a/clearlily +++ b/clearlily @@ -1,4 +1,4 @@ #!/bin/sh # unclobber current dir. -rm -v *.aux *.log `grep -li "^% Creator: LilyPond" *.out` *.orig *~ \ No newline at end of file +rm -v *.aux *.log `grep -li "^% Creator: LilyPond" *.out *.uit` *.orig *~ diff --git a/configure b/configure index b10d461235..000f31cdc1 100755 --- a/configure +++ b/configure @@ -3,7 +3,7 @@ PREFIX=${PREFIX:-.} echo using PREFIX=$PREFIX -NEEDFLOWERVER=1.0.22 +NEEDFLOWERVER=1.0.2 flowertar=flower-$NEEDFLOWERVER here=`pwd` cd .. diff --git a/deps/Makefile b/deps/Makefile index 790d7b06f2..4a3104af2f 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -7,4 +7,4 @@ dist: ln $(DISTFILES) $(DDIR)/$(SUBDIR) clean: - rm -f *.dep + true diff --git a/flower/NEWS b/flower/NEWS index ae66f7dbc3..77591bb6cb 100644 --- a/flower/NEWS +++ b/flower/NEWS @@ -1,2 +1,4 @@ +pl 23 + - win32 patches (JN) pl 22: - Array::add -> Array::push \ No newline at end of file diff --git a/flower/TODO b/flower/TODO index 6ce4b741d2..d67ab72e9f 100644 --- a/flower/TODO +++ b/flower/TODO @@ -1,3 +1,4 @@ + * disable: const pointer->bool->string * PointerVec ? diff --git a/flower/Variables.make b/flower/Variables.make index c417e74140..67d1863f27 100644 --- a/flower/Variables.make +++ b/flower/Variables.make @@ -1,10 +1,10 @@ MAJVER=1 MINVER=0 -PATCHLEVEL=22 +PATCHLEVEL=23 PACKAGENAME=flower #PROFILEFLAG=-pg -DEBUGFLAG=-g -O2 -DNDEBUG +DEBUGFLAG= -O2 -DNDEBUG # -g OPTIFLAG=-DNDEBUG -DNPRINT -O2 ######################################### @@ -35,3 +35,4 @@ ALLSOURCES=$(hh) $(cc) $(inl) $(templatecc) DFILES=$(ALLSOURCES) Makefile Variables.make make_version\ Sources.make TODO README NEWS DDIR=$(DNAME) + diff --git a/flower/dstream.cc b/flower/dstream.cc index 44e2057059..02b218d3cf 100644 --- a/flower/dstream.cc +++ b/flower/dstream.cc @@ -118,7 +118,7 @@ Dstream::Dstream(ostream *r, const char * cfg_nm ) r.message("not enough fields in Dstream init."); continue; } - (*silent)[r[0]] = bool(Scalar(r[1])); + (*silent)[r[0]] = (bool)(int)(Scalar(r[1])); } } diff --git a/flower/dstream.hh b/flower/dstream.hh index aae52a7838..e38f30128f 100644 --- a/flower/dstream.hh +++ b/flower/dstream.hh @@ -28,6 +28,7 @@ public: if rcfile == 0, then do not read any rc file */ + virtual ~Dstream(); Dstream &identify_as(String s); Dstream &operator << (String s); diff --git a/flower/interval.hh b/flower/interval.hh index 294457db0f..acf437ad0a 100644 --- a/flower/interval.hh +++ b/flower/interval.hh @@ -19,7 +19,7 @@ struct Interval_t { /****************/ - T center() { return (left + right) /2;} + T center() { return (left + right) / T(2);} void translate(T t) { left += t; right += t; diff --git a/flower/interval.tcc b/flower/interval.tcc index 0a1a027acd..6e7b0b1279 100644 --- a/flower/interval.tcc +++ b/flower/interval.tcc @@ -34,7 +34,7 @@ Interval__compare(const Interval_t&a,Interval_t const&b) #ifdef AIX const Real INFTY = 1e8; // ARGh. AIX sucks #else -const Real INFTY = HUGE; +const Real INFTY = HUGE_VAL; #endif template diff --git a/flower/path.hh b/flower/path.hh index 3ff83d3b72..781e86f970 100644 --- a/flower/path.hh +++ b/flower/path.hh @@ -15,7 +15,8 @@ public: File_path(String); /// add to end of path. - Array:: push; + Array::push; + void add(String str) { push(str); } }; /** diff --git a/flower/real.hh b/flower/real.hh index 16f52b5092..0533af2111 100644 --- a/flower/real.hh +++ b/flower/real.hh @@ -4,7 +4,7 @@ #include #include -#include +#include typedef double Real; diff --git a/flower/string.cc b/flower/string.cc index 0804c5bbdc..eb5822cf32 100644 --- a/flower/string.cc +++ b/flower/string.cc @@ -47,7 +47,7 @@ String::String(Rational r) *this = n; if (r.denominator() != 1) { char * d = Itoa(r.denominator()); - *this += '/' + String(d); + *this += String( '/' ) + String(d); //delete d; } /* delete n; diff --git a/genheader b/genheader index f153e3e6ca..203ed196ea 100755 --- a/genheader +++ b/genheader @@ -5,7 +5,7 @@ cat << HERE /* $1 -- part of LilyPond - (c) 1996,1997 Han-Wen Nienhuys + (c) 1997 $USERNAME <$MAILADRESS> */ #ifndef $def diff --git a/hdr/Makefile b/hdr/Makefile index 2ee609e881..f23ddcf6ca 100644 --- a/hdr/Makefile +++ b/hdr/Makefile @@ -9,4 +9,4 @@ TAGS: $(hdr) etags -CT $(hdr) clean: - rm -f parser.hh \ No newline at end of file + rm -f parser.hh diff --git a/hdr/accidental.hh b/hdr/accidental.hh deleted file mode 100644 index d388a3f097..0000000000 --- a/hdr/accidental.hh +++ /dev/null @@ -1,22 +0,0 @@ -/* - accidental.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef ACCIDENTAL_HH -#define ACCIDENTAL_HH -#include "item.hh" - -struct Accidental : Item { -const char * name() const; - int type,pos; - - void preprocess(); - Accidental(int type, int position); - void do_print()constt; -private: - void brew_molecule(); -}; -#endif // ACCIDENTAL_HH - diff --git a/hdr/complexstaff.hh b/hdr/complexstaff.hh index 4413add60e..17d489be96 100644 --- a/hdr/complexstaff.hh +++ b/hdr/complexstaff.hh @@ -16,7 +16,9 @@ /// column of Complex_staff: store one request struct Complex_column : Staff_column { - Array todo_l_arr_; + Array first_l_arr_; + Array second_l_arr_; + Complex_staff* staff_l_; /****************/ diff --git a/hdr/complexwalker.hh b/hdr/complexwalker.hh index 111945c762..fcdb84ef96 100644 --- a/hdr/complexwalker.hh +++ b/hdr/complexwalker.hh @@ -7,6 +7,7 @@ #ifndef COMPLEXWALKER_HH #define COMPLEXWALKER_HH +// this SUX #include "proto.hh" #include "grouping.hh" #include "voicegroup.hh" @@ -14,6 +15,7 @@ #include "staffwalker.hh" #include "key.hh" #include "clef.hh" +#include "register.hh" struct Complex_walker: Staff_walker { Local_key local_key_; @@ -29,15 +31,26 @@ struct Complex_walker: Staff_walker { IPointerList voice_reg_list_; -// Assoc voice_reg_map_; - //IPointerList voice_reg_list_; - //Assoc group_reg_map_; - Voice_group_registers group_regs_; + IPointerList group_reg_list_; + Assoc voice_group_map_; + Local_key_register local_key_reg_; Array announce_info_arr_; /****************/ + void do_change_group(const Voice * v, String group_id_str); + Voice_registers *find_voice_reg(Voice*v_l); + Voice_registers *get_voice_reg(Voice*v_l); + + /// search and return. return 0 if not found. + Voice_group_registers *find_voice_group(Voice* v_l); + /// search. Create if necessary + Voice_group_registers *get_voice_group(Voice* v_l); + /// search and return. return 0 if not found + Voice_group_registers *find_voice_group(const char* id); + /// Create if necessary + Voice_group_registers *get_voice_group(const char*); void regs_process_requests(); void do_announces(); @@ -50,16 +63,12 @@ struct Complex_walker: Staff_walker { virtual void do_post_move(); virtual void do_pre_move(); - void do_note(CNote_info); Complex_walker(Complex_staff*); Complex_column *col(); Complex_staff *staff(); - - void do_local_key(Note_req*, Notehead*); - }; -#endif // SIMPLEWALKER_HH +#endif // COMPLEXWALKER_HH diff --git a/hdr/const.hh b/hdr/const.hh index dce593b4a0..9c2f3f9ccc 100644 --- a/hdr/const.hh +++ b/hdr/const.hh @@ -8,5 +8,5 @@ const Real EPS=1e-7; // qlpsolve.hh const int MAXITER=100; // qlpsolve.hh -const Real INFTY=HUGE; +const Real INFTY=HUGE_VAL; #endif diff --git a/hdr/debug.hh b/hdr/debug.hh index a5a7d8d378..f6855fcabe 100644 --- a/hdr/debug.hh +++ b/hdr/debug.hh @@ -7,6 +7,9 @@ #include "real.hh" #include "proto.hh" +void message( String message_str, char const* context_ch_c_l ); +void warning( String message_str, char const* context_ch_c_l ); +void error( String message_str, char const* context_ch_c_l ); void error(String s); // errors void error_t(const String& s, Time_description const & t_tdes); void error_t(String const &s, const Moment &when); diff --git a/hdr/globvars.hh b/hdr/globvars.hh deleted file mode 100644 index 8b13789179..0000000000 --- a/hdr/globvars.hh +++ /dev/null @@ -1 +0,0 @@ - diff --git a/hdr/identifier.hh b/hdr/identifier.hh index 04bee62255..0c9b252afa 100644 --- a/hdr/identifier.hh +++ b/hdr/identifier.hh @@ -19,16 +19,16 @@ struct Idclass : Identifier {\ virtual const char *classname() { return #Class; }\ Idclass(String s, Class*st):Identifier(s) { data = st; }\ - virtual Class* accessor(bool copy=false) {\ + virtual Class* accessor(bool copy) {\ if (copy)\ return new Class(* (Class*) data);\ else\ return (Class*) data;\ }\ - ~Idclass() { delete accessor(); }\ + ~Idclass() { delete accessor(false); }\ }\ - +make_id_class(Real_id, Real, real); make_id_class(Script_id, Script_def, script); make_id_class(Lookup_id, Lookup, lookup); make_id_class(Symtables_id, Symtables, symtables); diff --git a/hdr/identparent.hh b/hdr/identparent.hh index c74be844c8..da7ab7012c 100644 --- a/hdr/identparent.hh +++ b/hdr/identparent.hh @@ -9,8 +9,10 @@ #include "proto.hh" #include "string.hh" + +/* boolean argument to accesor is copy_b..*/ #define IDACCESSOR( Input_staff, staff)\ - virtual Input_staff * staff(bool = false) { error(#Input_staff); return 0; } + virtual Input_staff * staff(bool) { error(#Input_staff); return 0; } struct Identifier { void *data; @@ -27,6 +29,7 @@ struct Identifier { IDACCESSOR(Symtables, symtables) IDACCESSOR(Music_general_chord, mchord) IDACCESSOR(Lookup,lookup) + IDACCESSOR(Real,real) IDACCESSOR(Notename_tab, notename_tab) private: Identifier(Identifier const&){} diff --git a/hdr/inputcommand.hh b/hdr/inputcommand.hh index 2654d06b7c..d937f9ab8a 100644 --- a/hdr/inputcommand.hh +++ b/hdr/inputcommand.hh @@ -30,6 +30,6 @@ Input_command *get_grouping_command(Array); Input_command *get_bar_command(String); Input_command *get_newmeasure_command(); Input_command *get_goto_command(String); -Array get_default_grouping(int count); +Array get_default_grouping(int count, int onenote); #endif // INPUTCOMMAND_HH diff --git a/hdr/inputcommands.hh b/hdr/inputcommands.hh index 6457c1c686..bd6054f6e9 100644 --- a/hdr/inputcommands.hh +++ b/hdr/inputcommands.hh @@ -7,7 +7,7 @@ #ifndef INPUTCOMMANDS_HH #define INPUTCOMMANDS_HH -#include "pcursor.hh" +//#include "pcursor.hh" #include "proto.hh" #include "plist.hh" #include "real.hh" diff --git a/hdr/inputmusic.hh b/hdr/inputmusic.hh index 4ef8eebb46..7d0dd618ba 100644 --- a/hdr/inputmusic.hh +++ b/hdr/inputmusic.hh @@ -18,11 +18,12 @@ struct Voice_list : public PointerList { /// ABC for input structures struct Input_music { - virtual Voice_list convert()=0; - virtual Moment length()=0; + virtual Voice_list convert()const=0; + virtual Moment length()const=0; virtual void translate_time(Moment dt)=0; virtual ~Input_music(){} virtual void print() const =0; + virtual void set_default_group(String)=0; // virtual void transpose(...) const =0; @@ -48,8 +49,9 @@ struct Simple_music : Input_music { /****/ virtual Simple_music*simple() { return this; } void add(Voice_element*); - virtual Moment length(); - virtual Voice_list convert(); + virtual void set_default_group(String g) { voice_.set_default_group(g); } + virtual Moment length()const; + virtual Voice_list convert()const; virtual void translate_time(Moment dt); virtual void print() const; virtual Input_music *clone() const { @@ -61,7 +63,8 @@ struct Simple_music : Input_music { /// Complex_music consists of multiple voices struct Complex_music : Input_music { IPointerList elts; - + /****************/ + virtual void set_default_group(String g); void add(Input_music*); Complex_music(); Complex_music(Complex_music const &); @@ -75,9 +78,9 @@ struct Music_voice : Complex_music { /****************/ - Moment length(); + Moment length()const; virtual void translate_time(Moment dt); - virtual Voice_list convert(); + virtual Voice_list convert()const; void add_elt(Voice_element*); virtual Input_music *clone() const { return new Music_voice(*this); @@ -94,12 +97,12 @@ struct Music_voice : Complex_music { /// Multiple musicstuff stacked on top of each other struct Music_general_chord : Complex_music { - IPointerList chord_; + /****************/ - virtual Moment length(); - virtual Voice_list convert(); + virtual Moment length()const; + virtual Voice_list convert()const; virtual void translate_time(Moment dt); void add_elt(Voice_element*); virtual Input_music *clone() const { @@ -115,6 +118,16 @@ struct Music_general_chord : Complex_music { */ +struct Multi_voice_chord : Music_general_chord { + void set_default_group(String); + virtual Input_music *clone() const { + return new Multi_voice_chord(*this); + } +}; +struct Voice_group_chord : Music_general_chord { - + virtual Input_music *clone() const { + return new Voice_group_chord(*this); + } +}; #endif // INPUTMUSIC_HH diff --git a/hdr/inputscore.hh b/hdr/inputscore.hh index 973d4814da..1555456778 100644 --- a/hdr/inputscore.hh +++ b/hdr/inputscore.hh @@ -10,6 +10,7 @@ struct Input_score { /// defined where? String define_spot_str_; + int errorlevel_i_; /// paper_, staffs_ and commands_ form the problem definition. Paperdef *paper_; diff --git a/hdr/lexer.hh b/hdr/lexer.hh index 7cbbbe3747..0617b9742c 100644 --- a/hdr/lexer.hh +++ b/hdr/lexer.hh @@ -13,7 +13,8 @@ void kill_lexer(); void set_lexer(); struct Input_file { - istream*is; + istream* is; + Source_file* sourcefile_l_; int line; String name; @@ -29,9 +30,11 @@ struct My_flex_lexer : yyFlexLexer { Assoc *the_id_tab; Keyword_table * keytable; Notename_tab * defaulttab; - + char const* data_ch_c_l_m; + int errorlevel_i_; /****************/ - + int ret_notename(int *p, String text, int octave_mod); + char const* here_ch_c_l(); void set(Notename_tab *n); int lookup_keyword(String); void lookup_notename(int &large, int &small, String s); diff --git a/hdr/main.hh b/hdr/main.hh index e73ba2390b..1102833fac 100644 --- a/hdr/main.hh +++ b/hdr/main.hh @@ -7,7 +7,9 @@ void set_debug(bool); void do_scores(); void add_score(Input_score * s); void set_default_output(String s); +Input_score* current_iscore_l(); String find_file(String); const char *get_version(); +extern Source* source_l; #endif diff --git a/hdr/misc.hh b/hdr/misc.hh index fa87876748..ae288151a2 100644 --- a/hdr/misc.hh +++ b/hdr/misc.hh @@ -1,11 +1,14 @@ #ifndef MISC_HH #define MISC_HH +#include "proto.hh" #include "real.hh" #include "moment.hh" +#include "scalar.hh" Moment wholes(int dur, int dots); - + +Rhythmic_grouping parse_grouping(const Array &a); double log_2(double x) ; int intlog2(int d); inline int diff --git a/hdr/molecule.hh b/hdr/molecule.hh index 7419e203de..9f20458fef 100644 --- a/hdr/molecule.hh +++ b/hdr/molecule.hh @@ -1,6 +1,7 @@ #ifndef MOLECULE_HH #define MOLECULE_HH +#include "proto.hh" #include "plist.hh" #include "boxes.hh" #include "symbol.hh" diff --git a/hdr/notehead.hh b/hdr/notehead.hh index 5f4c47d2d9..66bed0360e 100644 --- a/hdr/notehead.hh +++ b/hdr/notehead.hh @@ -11,6 +11,7 @@ /// ball at the end of the stem struct Notehead : Item { const char * name() const; + const char* defined_ch_c_l_m; //sorry, trying to find error in martien.ly int position; /// -1 = lowest, 0 = inside, 1 = top int extremal; diff --git a/hdr/parseconstruct.hh b/hdr/parseconstruct.hh index 7b0545b784..78d4f84861 100644 --- a/hdr/parseconstruct.hh +++ b/hdr/parseconstruct.hh @@ -9,8 +9,12 @@ #include "proto.hh" +extern char const* defined_ch_c_l; +extern char const* req_defined_ch_c_l; Voice_element*get_mark_element(String); void set_default_duration(int *); +void last_duration(int n); +void set_duration_mode(String s); void get_default_duration(int *); void set_default_octave(String); void set_plet(int,int); @@ -25,6 +29,10 @@ Text_def*get_text(String s); Request*get_script_req(int d , Script_def*def); Request*get_text_req(int d , Text_def*def); Voice_element*get_command_element(Input_command*); -Voice_element*get_barcheck_element(); +Voice_element* get_barcheck_element(); +Voice_element* get_stemdir_element(int); + + + #endif // PARSECONSTRUCT_HH diff --git a/hdr/proto.hh b/hdr/proto.hh index 94304768da..4987a70547 100644 --- a/hdr/proto.hh +++ b/hdr/proto.hh @@ -34,6 +34,8 @@ struct Complex_walker; struct Cresc_req; struct Decresc_req; struct Dynamic; +struct Group_change_req; +struct Group_feature_req; struct Idealspacing; struct Identifier; struct Input_command; @@ -81,10 +83,13 @@ struct Rhythmic_req; struct Score; struct Score_column; struct Script_def; +struct Script; struct Script_req; struct Simple_music; struct Slur; struct Slur_req; +class Source; +class Source_file; struct Span_req; struct Spanner; struct Staff; @@ -97,11 +102,14 @@ struct Staff_elem_info; struct Staff_walker; struct Stem; struct Stem_req; +struct Stem_beam_register; struct String; struct Symbol; struct Symtable; struct Symtables; struct Tex_stream; +struct Terminate_voice_req; +struct Text_item ; struct Text_def; struct Text_gob; struct Text_req; diff --git a/hdr/pstaff.hh b/hdr/pstaff.hh index 87bd919c67..2c79427f78 100644 --- a/hdr/pstaff.hh +++ b/hdr/pstaff.hh @@ -1,6 +1,7 @@ #ifndef PSTAFF_HH #define PSTAFF_HH +#include "proto.hh" #include "plist.hh" #include "item.hh" #include "symbol.hh" diff --git a/hdr/register.hh b/hdr/register.hh index e94faca7cf..42574ed5bc 100644 --- a/hdr/register.hh +++ b/hdr/register.hh @@ -12,11 +12,10 @@ /// data container. struct Staff_elem_info { Staff_elem * elem_p_; -// Array requestor_l_arr_; Request*req_l_; const Voice * voice_l_; Voice_group_registers * group_regs_l_; - int group; + Request_register * origin_reg_l_; /****/ @@ -49,7 +48,7 @@ struct Request_register { RETURN false: request noted, but not taken. - true: request swallowed, now owned by this + true: request swallowed. Don't try to put elsewhere (may be we could use C++ exceptions.. :-) */ @@ -71,7 +70,7 @@ protected: */ struct Notehead_register : Request_register { - Item* note_l_; + Item* note_p_; /****************/ Notehead_register(Complex_walker*); virtual bool try_request(Request *req_l) ; @@ -80,10 +79,10 @@ struct Notehead_register : Request_register { }; struct Slur_register : Request_register { + sstack requests_arr_; sstack slur_l_stack_; Array end_slur_l_arr_; - - + /****************/ ~Slur_register(); Slur_register(Complex_walker*); @@ -98,12 +97,15 @@ struct Stem_beam_register : Request_register { Beam * beam_p_; Beam_req * beam_req_l_; Stem_req * stem_req_l_; + Beam_req * start_req_l_; bool end_beam_b_; Rhythmic_grouping *current_grouping; - + int default_dir_i_; + /****************/ Stem_beam_register(Complex_walker*); ~Stem_beam_register(); + void set_dir(int dir_i_); virtual bool try_request(Request*); virtual void process_request(); virtual void acknowledge_element(Staff_elem_info); @@ -111,10 +113,11 @@ struct Stem_beam_register : Request_register { virtual void do_post_move_process(); }; -#if 0 struct Script_register : Request_register { Script * script_p_; + /****************/ + void set_dir(int dir_i_); Script_register(Complex_walker*); virtual bool try_request(Request*); virtual void process_request(); @@ -122,17 +125,17 @@ struct Script_register : Request_register { virtual void do_pre_move_process(); }; -struct Text_register:Request_register{ +struct Text_register : Request_register{ Text_item * text_p_; /****************/ + void set_dir(int dir_i_); Text_register(Complex_walker*); virtual bool try_request(Request*); virtual void process_request(); - virtual void acknowledge_element(Staff_elem_info); virtual void do_pre_move_process(); }; -#endif + struct Local_key_register : Request_register { Local_key_item* key_item_p_; diff --git a/hdr/request.hh b/hdr/request.hh index 2cc9decef1..9a01ade3fb 100644 --- a/hdr/request.hh +++ b/hdr/request.hh @@ -9,6 +9,7 @@ /// Hungarian postfix: req struct Request { Voice_element*elt_l_; + char const* defined_ch_c_l_m; /****************/ Request(); @@ -18,7 +19,7 @@ struct Request { virtual const char * name() const { return "Request";} virtual Request* clone() const =0; void print()const ; - + virtual Moment duration() const { return 0; } /* accessors for children */ @@ -36,6 +37,9 @@ struct Request { virtual Melodic_req *melodic() { return 0; } virtual Mark_req * mark() { return 0; } virtual Staff_command_req* command() { return 0;} + virtual Terminate_voice_req *terminate() {return 0;} + virtual Group_change_req * groupchange() { return 0;} + virtual Group_feature_req * groupfeature() { return 0; } protected: virtual void do_print()const ; }; @@ -47,7 +51,7 @@ see lilygut page #define REQUESTMETHODS(T,accessor) \ virtual T * accessor() { return this;}\ -virtual const char* name()const { return #T; }\ +virtual const char* name() const { return #T; }\ virtual Request *clone() const { return new T(*this); } \ virtual void do_print() const @@ -55,6 +59,21 @@ struct Barcheck_req : Request { REQUESTMETHODS(Barcheck_req,barcheck); }; +struct Terminate_voice_req : Request { + REQUESTMETHODS(Terminate_voice_req,terminate); +}; + +struct Group_feature_req : Request { + int stemdir_i_; + Group_feature_req(); + REQUESTMETHODS(Group_feature_req, groupfeature); +}; + +struct Group_change_req : Request { + String newgroup_str_; + REQUESTMETHODS(Group_change_req, groupchange); +}; + /// a request with a duration struct Rhythmic_req : virtual Request { int balltype; @@ -64,7 +83,7 @@ struct Rhythmic_req : virtual Request { static int compare(const Rhythmic_req &, const Rhythmic_req &); Moment duration() const; Rhythmic_req(); - Rhythmic_req(int,int); + Rhythmic_req(int,int); REQUESTMETHODS(Rhythmic_req, rhythmic); }; @@ -77,6 +96,7 @@ struct Text_req : virtual Request { Text_req(int d, Text_def*); ~Text_req(); Text_req(Text_req const&); + static int compare(const Text_req&,const Text_req&); REQUESTMETHODS(Text_req,text); }; @@ -125,6 +145,7 @@ Why a request? It might be a good idea to not typeset the rest, if the paper is /// attach a stem to the noteball struct Stem_req : Rhythmic_req { + int dir_i_; Stem_req(int s, int dots); REQUESTMETHODS(Stem_req,stem); }; @@ -172,10 +193,11 @@ struct Slur_req : Span_req { ///Put a script above or below this ``note'' struct Script_req : Request { - int dir; - Script_def *scriptdef; + int dir_i_; + Script_def *scriptdef_p_; /****************/ + static int compare(const Script_req &, const Script_req &); Script_req(int d, Script_def*); REQUESTMETHODS(Script_req,script); ~Script_req(); @@ -294,11 +316,6 @@ struct Spacing_req { struct Glissando_req : Span_req { -}; -struct Stemdir_req : Request { - int which; -}; -struct Group_change_req : Request { }; #endif #endif diff --git a/hdr/score.hh b/hdr/score.hh index 152e578493..61868a4719 100644 --- a/hdr/score.hh +++ b/hdr/score.hh @@ -17,6 +17,7 @@ struct Score { PScore *pscore_p_; String define_spot_str_; + int errorlevel_i_; Assoc markers_assoc_; /****************************************************************/ diff --git a/hdr/scoreline.hh b/hdr/scoreline.hh index 26e1285c44..3c6ee0de04 100644 --- a/hdr/scoreline.hh +++ b/hdr/scoreline.hh @@ -6,8 +6,8 @@ #ifndef SCORELINE_HH #define SCORELINE_HH -#include "plist.hh" #include "proto.hh" +#include "plist.hh" #include "varray.hh" /// the columns of a score that form one line. diff --git a/hdr/script.hh b/hdr/script.hh index 27fddc5894..2a10e7d49e 100644 --- a/hdr/script.hh +++ b/hdr/script.hh @@ -21,18 +21,19 @@ struct Script : Item { /****************/ const char * name() const; - void set_symdir(); - void set_default_dir(); - void set_default_pos(); - Symbol symbol()const; Molecule* brew_molecule_p()const; virtual void do_post_processing(); virtual void do_pre_processing(); - Script(Script_req*, int); + Script(Script_req*, int staffsize); void set_support(Item*); void set_stem(Stem*); Interval support_height()const; - virtual Interval width() const; + virtual Interval width() const; +private: + void set_symdir(); + void set_default_dir(); + void set_default_pos(); + Symbol symbol()const; }; diff --git a/hdr/scriptdef.hh b/hdr/scriptdef.hh index fb1dc4317f..423860a895 100644 --- a/hdr/scriptdef.hh +++ b/hdr/scriptdef.hh @@ -15,6 +15,7 @@ struct Script_def{ String symidx; /****************/ + int compare(Script_def const &); void print() const; Script_def(String, int, int ,bool); }; diff --git a/hdr/staffline.hh b/hdr/staffline.hh index e08aabd17e..f44754a5d2 100644 --- a/hdr/staffline.hh +++ b/hdr/staffline.hh @@ -7,6 +7,7 @@ #ifndef STAFFLINE_HH #define STAFFLINE_HH +#include "proto.hh" #include "real.hh" #include "plist.hh" #include "varray.hh" diff --git a/hdr/stem.hh b/hdr/stem.hh index 046538ae16..e4c3794a8c 100644 --- a/hdr/stem.hh +++ b/hdr/stem.hh @@ -59,6 +59,7 @@ struct Stem : Item { Real hpos()const; void do_print() const; void set_stemend(Real); + int get_default_dir(); void set_default_dir(); void set_default_stemlen(); void set_default_extents(); diff --git a/hdr/textdef.hh b/hdr/textdef.hh index 6682221761..4e95c93a6e 100644 --- a/hdr/textdef.hh +++ b/hdr/textdef.hh @@ -14,10 +14,12 @@ struct Text_def { int align_i_; String text_str_; String style_str_; - + char const* defined_ch_c_l_m; + /*****************/ - + virtual ~Text_def() {}; + bool compare(const Text_def&); Text_def(); virtual void print() const; virtual Atom create_atom(Paperdef*) const; diff --git a/hdr/textitem.hh b/hdr/textitem.hh index ebf7656276..c563fc80ca 100644 --- a/hdr/textitem.hh +++ b/hdr/textitem.hh @@ -11,14 +11,13 @@ #include "item.hh" struct Text_item : Item { - const char * name() const; int pos_i_; int staffsize_i_; int dir_i_; Text_def* tdef_l_; /****************/ - + const char * name() const; virtual void set_default_pos(); Molecule* brew_molecule_p() const; void do_pre_processing(); diff --git a/hdr/voice.hh b/hdr/voice.hh index 867827f029..03ea55b9ee 100644 --- a/hdr/voice.hh +++ b/hdr/voice.hh @@ -17,6 +17,7 @@ struct Voice { Voice(Voice const&); void add(Voice_element*); void print() const; + void set_default_group(String id); }; /** @@ -28,6 +29,7 @@ struct Voice { /// one horizontal bit. struct Voice_element { Moment duration; + char const* defined_ch_c_l_m; const Voice *voice_l_; IPointerList reqs; @@ -37,6 +39,7 @@ struct Voice_element { Voice_element(); Voice_element(Voice_element const & src ); void print ()const; + void set_default_group(String id); }; /** Apart from being a container for the requests, Voice_element is nothing */ diff --git a/hdr/voicegroup.hh b/hdr/voicegroup.hh new file mode 100644 index 0000000000..a6f370ec80 --- /dev/null +++ b/hdr/voicegroup.hh @@ -0,0 +1,49 @@ +/* + voicegroup.hh -- part of LilyPond + + (c) 1996,1997 Han-Wen Nienhuys +*/ + +#ifndef VOICEGROUP_HH +#define VOICEGROUP_HH + +#include "proto.hh" +#include "register.hh" +#include "varray.hh" +#include "string.hh" + +struct Voice_registers { + Notehead_register head_reg_; + Slur_register slur_reg_; + Voice *voice_l_; + + /****************/ + static bool acceptable_request(Request*); + void pre_move_processing(); + void post_move_processing(); + void announce_element(Staff_elem_info info); + Voice_registers(Complex_walker*,Voice*); + bool try_request(Request*); + void process_requests(); +}; + + +struct Voice_group_registers { + String group_id_str_; + Text_register text_reg_; + Stem_beam_register stem_beam_reg_; + Script_register script_reg_; + Complex_walker * walk_l_; + int dir_i_; + + /****************/ + static bool acceptable_request(Request*); + void pre_move_processing(); + void post_move_processing(); + void announce_element(Staff_elem_info info); + Voice_group_registers(Complex_walker*, String id = ""); + void process_requests(); + bool try_request(Request*); +}; + +#endif diff --git a/init/Makefile b/init/Makefile index bb93a1c6fd..7aa3964262 100644 --- a/init/Makefile +++ b/init/Makefile @@ -1,5 +1,5 @@ DFILES=dutch.ini table_sixteen.ini table_twenty.ini\ - english.ini script.ini symbol.ini + english.ini script.ini symbol.ini bare.ini default: echo huh? diff --git a/init/bare.ini b/init/bare.ini new file mode 100644 index 0000000000..be63e679eb --- /dev/null +++ b/init/bare.ini @@ -0,0 +1,5 @@ + +% enough for the parsing step + +include "init/dutch.ini" +include "init/table_sixteen.ini" diff --git a/input/Makefile b/input/Makefile index eaae8fd3ef..61c04f111a 100644 --- a/input/Makefile +++ b/input/Makefile @@ -1,7 +1,11 @@ default: ; DISTFILES=Makefile kortjakje.ly pavane.ly maartje.ly\ - cadenza.ly scales.ly standchen.ly twinkle.ly + cadenza.ly scales.ly standchen.ly twinkle.ly\ + wohltemperirt.ly error.ly\ + martien.ly mlalt.ly mlvio1.ly mlvio2.ly mlcello.ly\ + standchen.tex pavane.tex scsii-menuetto.tex martien.tex + dist: ln $(DISTFILES) $(DDIR)/$(SUBDIR) diff --git a/input/cadenza.ly b/input/cadenza.ly index 1ca8ba54a5..3f32d19de3 100644 --- a/input/cadenza.ly +++ b/input/cadenza.ly @@ -6,26 +6,28 @@ cad = music { $ \duration { 8} - \textstyle "italic" + \textstyle "italic" + \command { \clef \violin } 'c4._"f" g8 \textstyle "roman" - ['e^"accel" ()'d 'c b] + + ['e^"accel" ()'d 'c b] [b()'c] g-\fermata - \mark"br1" + \command { \bar \empty } c [c_"rubato" e g 'c] \octave{'} e4. e [g ()f_"rit" e d] \duration{16} dis4()e4 - \mark"br2" + \command { \bar \empty } r8 [c d] [e f g gis] \duration{4} a-> `f()`e g f-> `d()`cis e \duration{8} d4^\fermata - \mark"br3" + \command { \bar \empty } r8 `a [`b cis] \duration{16} [d cis d e] @@ -34,10 +36,10 @@ cad = music { $ \octave{} \plet{2/3} ['d8 'c8 a8] \plet{1/1} g2 - \mark "br4" + \command { \bar \empty } [g c e g] ['c e g 'c]\octave{'} [e `g c e] g4^\fermata %()% BUG! - \mark "br5" + \command { \bar \empty } [g8.(_"a tempo" e g8. )e] a4. g8 [f8 e8 d8 c8] `g2 d2^"tr" @@ -47,20 +49,11 @@ cad = music { $ score { staff { melodic music { cad } + } commands { meter 4*4 cadenza 1 - grouping 1 - goto "br1" - bar "empty" - goto "br2" - bar "empty" - goto "br3" - bar "empty" - goto "br4" - bar "empty" - goto "br5" - bar "empty" + grouping 1*4 } } diff --git a/input/error.ly b/input/error.ly new file mode 100644 index 0000000000..49dd24665b --- /dev/null +++ b/input/error.ly @@ -0,0 +1,29 @@ +mwa = music { + $ + ab % ok, warning, still output? +% \bla % ok, fatal +% & % ok, fatal +% c d ) ] % ok, fatal + c [ d +% c ) d ] e % no location :-( + + $ +} + +bla = music { + @ + These Gates will open just like windows. + @ +} + +score { + staff { + lyric music { bla } + } + staff { + melodic music { mwa } + } + commands { + meter 2*4 + } +} diff --git a/input/kortjakje.ly b/input/kortjakje.ly index bfcfebaeb0..ba78402109 100644 --- a/input/kortjakje.ly +++ b/input/kortjakje.ly @@ -4,7 +4,9 @@ % for lyrics, see twinkle.ly % the % is a comment. - +% +% copyright: None +% % declare music (which will be in *one* staff ) for the lead voice melodie = music { diff --git a/input/maartje.ly b/input/maartje.ly index 1a7925955f..aad85a0fc6 100644 --- a/input/maartje.ly +++ b/input/maartje.ly @@ -23,8 +23,8 @@ ritme = staff { } melody= -staff { melodic -% complex +staff { + melodic music{$ c8 |r4 r4 r4 r4 diff --git a/input/martien.ly b/input/martien.ly new file mode 100644 index 0000000000..b299340b3a --- /dev/null +++ b/input/martien.ly @@ -0,0 +1,110 @@ +% martien.ly +% +% Viola Quartet +% Martien Lohman (194x-????) +% +% quite alive at the time of writing; +% copyright by ml +% +% lilypond: src/stem.cc:42: void Stem::set_stemend(double): Assertion `(dir > 0 && se >= maxnote) || (se <= minnote && dir <0)' failed. +% +% The purpose of this file is to demonstrate features of LilyPond; +% respect the copyright. +% +% \barnumbering5 +% \barnumberstyle\boxed + +include "mlalt.ly" +include "mlvio1.ly" +include "mlvio2.ly" +include "mlcello.ly" + +score { + staff { + melodic + music { alto } + commands { +% meter 2*4 + clef "alto" + key $fis$ + skip 56:0 + key $bes es as$ + skip 8:0 +% meter 6*8 + skip 8:0 +% meter 2*4 + skip 16:0 + key $fis$ + } + } + staff { + melodic + music { violin1 } + commands { +% meter 2*4 + clef "violin" + key $fis$ + skip 56:0 + key $bes es as$ + skip 8:0 +% meter 6*8 + skip 8:0 +% meter 2*4 + skip 16:0 + key $fis$ + } + } + staff { + melodic + music { violin2 } + commands { +% meter 2*4 + clef "violin" + key $fis$ + skip 56:0 + key $bes es as$ + skip 8:0 +% meter 6*8 + skip 8:0 +% meter 2*4 + skip 16:0 + key $fis$ + } + } + staff { + melodic + music { cello } + commands { +% meter 2*4 + clef "bass" + key $fis$ + skip 56:0 + key $bes es as$ + skip 8:0 +% meter 6*8 + skip 8:0 +% meter 2*4 + skip 16:0 + key $fis$ + } + } + commands { + meter 2*4 + skip 56:0 + bar "||" + skip 8:0 + meter 6*8 + bar "||" + skip 8:0 + meter 2*4 + bar "||" + skip 16:0 + bar "||" + } + paper { +% unitspace 16mm + unitspace 24mm + width 195mm + output "martien.out" + } +} diff --git a/input/martien.tex b/input/martien.tex new file mode 100644 index 0000000000..3a1b732290 --- /dev/null +++ b/input/martien.tex @@ -0,0 +1,23 @@ +\documentclass{article} %UGH +\usepackage{a4} +\oddsidemargin-1in\advance\oddsidemargin7.5mm +\evensidemargin\oddsidemargin +\textwidth\hsize\advance\textwidth-15mm +\topmargin-1in\advance\topmargin5mm +\vsize297mm % so what does a4 do, anyway? +\textheight\vsize\advance\textheight-30mm +\pagestyle{empty} +\begin{document} +\input lilyponddefs +\input titledefs +%\def\interstaffline{\vskip10pt} +%\def\interscoreline{\vskip12pt} +\def\interstaffline{\vskip1mm} +\def\interscoreline{\vskip2mm} +\vbox to 10mm{\vss} +\title{Viola Quartet} +\composer{Martien Lohman} +\instrument{} +\maketit +\input martien.out +\end{document} diff --git a/input/mlalt.ly b/input/mlalt.ly new file mode 100644 index 0000000000..9058f25dd2 --- /dev/null +++ b/input/mlalt.ly @@ -0,0 +1,212 @@ +% mlalt.ly +% +% Viola Quartet +% Martien Lohman (194x-????) +% +% Alto I +% +% quite alive at the time of writing; +% copyright by ml +% +% The purpose of this file is to demonstrate features of LilyPond; +% respect the copyright. +% +alto = music { + $ + \duration{16} + \octave{} +%1 + [ `b8. `a ] [ `g8 `b c ] | +%2 + [ d8 g8 ] d4 | +%3 + [ e fis g a ] d4 | +%4 + [ c `b `a `b ] `b4 | +%5=1 + [ `b8. `a ] [ `g8 `b c ] | +%6=2 + [ d8 g8 ] d4 | +%7 + [ c `b `a `g ] [ `fis `e `d `c ] | +%8 + [ `d8. `e ] [ `d `fis `a c ] | +%9=1 + [ `b8. `a ] [ `g8 `b c ] | +%10 + [ d8 `d8 ] d4 | +%11=4 + [ c `b `a `b ] `b4 | +%12 + [ `a8 d8 ] `b4 | +%13 + [ d8. c ] [ `b8 `a `g ] | +%14=10 + [ d8 `d8 ] d4 | +%15 + [ e8 fis8 ] [ g8 d8 ] | +%16 + \textstyle "italic" + [ c `a `fis `d ] `g4_"fine" | + \textstyle "roman" +% \scoreverb{\mulooseness=-1} +% \newline +%17 +%=1 + [ `b8. `a ] [ `g8 `b c ] | +%18=2 + [ d8 g8 ] d4 | +%19=3 + [ e fis g a ] d4 | +%20=4 + [ c `b `a `b ] `b4 | +%21=5=1 + [ `b8. `a ] [ `g8 `b c ] | +%22=6=2 + [ d8 g8 ] d4 | +%23=20=4 + [ c `b `a `b ] `b4 | +%24 + [ `a8. `g ] [ `a cis e g ] | +%first modulation +%25 + [ fis8. e ] [ d8 fis g ] | +%26 + [ a8 `a8 ] a4 | +%27 + [ g fis e fis ] fis4 | +%28 + [ e8 a8 ] fis4 | +%29 + [ a8. g ] [ fis8 e d ] | +%30 + [ a8 `a8 ] a4 | +%31 + [ b8 'cis8 ] [ 'd8 a8 ] | +%32 + [ g e cis `a ] d4 | +%variant a +%33 + [ `b8 `g `g ] [ `g8 `b c ] | +%34 + [ d8 `g `g ] `g4 | +%35 + [ e8 `g `g ] [ `g8 e fis ] | +%36 + [ g8. fis32 e32 ] d4 | +%37 + [ e8 c c ] [ c8 `b `a ] | +%38 + [ d8 `b `b ] [ `b8 `a `g ] | +%39 + [ c8 `a `a ] [ `a8 `b `a ] | +%40 + `a4 `g4 | +%41 + [ `g8 `a `g ] [ d8 e d ] | +%42 + [ `g8 `a `g ] [ g8 e8 ] | +%43 + [ d8 e d ] [ d8 c `b ] | +%44 + [ `b8. c32 `b32 ] `a4 | +%45 + \plet{ 4/6 } [ `g `a `g `a `g `a ] \plet{ 1/1 } \plet{ 4/6 } [ `g `b c d e fis ] \plet{ 1/1 } | +%46 + \plet{ 4/6 } [ g fis e d `b `g ] \plet{ 1/1 } [ `a8 `g8 ] | +%47 + \plet{ 4/6 } [ g fis e d c `b ] \plet{ 1/1 } \plet{ 4/6 } [ e d c `b `a `g ] \plet{ 1/1 } | +%48 + \plet{ 4/6 } [ d e d d `b `g ] \plet{ 1/1 } [ `a8 `g8 ] | +%theme 2 + \duration{8} +%49 + \plet{ 2/3 } [ f e d ] \plet{ 1/1 } f4 | +%50 + \plet{ 2/3 } [ e d c ] \plet{ 1/1 } e4 | +%51 + \plet{ 2/3 } [ d g `g ] \plet{ 1/1 } \plet{ 2/3 } [ `g `a `b ] \plet{ 1/1 } | +%52 + d4 e4 | +%53 + \plet{ 2/3 } [ f e d ] \plet{ 1/1 } f4 | +%54 + \plet{ 2/3 } [ e d c ] \plet{ 1/1 } e4 | +%55 + \plet{ 2/3 } [ d g `g ] \plet{ 1/1 } \plet{ 2/3 } [ `g `a `b ] \plet{ 1/1 } | +%56 + `b4 c4 | % || \key\Es +%57 + [ `b d ] [ `g `b ] | +%58 + [ c es ] [ `g c ] | +%59 + [ d f ] [ `g f ] | +%60 + [ es16 d16 es16 f16 ] g4 | +%61 + [ as f ] [ d as ] | +%62 + [ g es ] [ c `as ] | +%63 + [ `g `b ] [ es d ] | +%64 + [ c8. `g32 `es32 ] `c4 | % || \meter{6/8} +%65 + es4.( [ )es d c ] | +%66 + es2. | +%67 + d4.( [ )d c `b ] | +%68 + d2. | +%69 +% g4.\stemdown( [ ) g as g ] | + g4.( [ ) g as g ] | +%70 +% g4.\stemdown( [ ) g f es ] | + g4.( [ )g f es ] | +%71 + d2. | +%72 + c r4 r4. | % || \meter{2/4} +%73 + \duration{8} + [ `b d ] [ `g `b ] | +%74 + [ c es ] [ `g c ] | +%75 + [ d f ] [ `g f ] | +%76 + [ es16 d16 es16 f16 ] g4 | +%77 + [ as f ] [ d as ] | +%78 + [ g es ] [ c `as ] | +%79 + [ `g `b ] [ es d ] | +%80 + [ c8. `g32 `es32 ] `c4 | +%81 + g4 [ as g ] | +%82 + \duration{16} + [ g f es f ] g4 | +%83 + [ g f e f ] g4 | +%84 + [ as g f g ] as4 | +%85 + f4 [ f des c `bes ] | +%86 + `a2 | +%87 + `b2 | +%88 + \textstyle "italic" + c2_"dacapo" | + \textstyle "roman" +%\scoreverb{\mulooseness=1} +% \key\G || + $ +} diff --git a/input/mlcello.ly b/input/mlcello.ly new file mode 100644 index 0000000000..5795bb44c1 --- /dev/null +++ b/input/mlcello.ly @@ -0,0 +1,219 @@ +% mlcello.ly +% +% Viola Quartet +% Martien Lohman (194x-????) +% +% Cello +% +% quite alive at the time of writing; +% copyright by ml +% +% The purpose of this file is to demonstrate features of LilyPond; +% respect the copyright. +% +cello = music { + $ + \octave{`} + \duration{4} +%%1 + g `g | +%%2 + [ `g8. `a16 ] ``b | +%%3 + c d | +%%4 + g( [ ) g16 fis16 e16 fis16 ] | +%%5=1 + e2 | +%%6=2 + [ `g8. `a16 ] ``b | +%%7 + c d | +%%8 + `g d | +%%9=1 + `g2 | +%%10 + `g ``b | +%%11=4 + e [ g16 fis16 e16 d16( ] | +%%12 + ) d g | +%%13 + [ d8 'd8 ] g | +%%14=10 + [ d8 'd8 ] g | +%%15 + [ c8 e8 ] [ g8 `g8 ] | +%%16 + \textstyle "italic" + [ d8 'c8 ] b_"fine" + \textstyle "roman" | +% \newline +%%17=1 + g `g | +%%18=2 + [ `g8. `a16 ] ``b | +%%19=3 + c d | +%%20=4 + g( [ ) g16 fis16 e16 fis16 ] | +%%21=5=1 + e2 | +%%22=6=2 + [ `g8. `a16 ] ``b | +%%23=4 + c g | +%%24 + a `a | +%%25 + d2 | +%%first modulation +%%26 + d `fis | +%%27 + ``b [ dis16 c16 ``b16 `a16( ] | +%%28 + ) `a d | +%%29 + \duration{8} + [ `a a ] d4 | +%%30 + [ `a a ] d4 | +%%31 + [ `g ``b ] [ d `d ] | +%%32 + [ `a a ] d4 | +%%variant a +%%33 + \duration{16} + [ `g8 `g `g ] [ `g8 `g `g ] | +%%34 + [ `g8 `g `g ] g4 | +%%35 + [ c8 c c ] [ c8 'c 'c ] | +%%36 + g4 b4 | +%%37 + [ a8 a a ] [ `a8 `a `a ] | +%%38 + [ ``b8 ``b ``b ] [ ``b8 ``b ``b ] | +%%39 + [ `a8 `a `a ] [ `a8 `a `a ] | +%%40 + `d4 `g4 | +%%41 + \duration{8} + \textstyle "italic" + r_"pizz" + \textstyle "roman" + g r `g | +%%42 + r g e4 | +%%43 + r b r ``b | +%%44 + r e a4 | +%%45 + r e r e | +%%46 + r ``b [ d g ] | +%%47 + r e r `a | +%%48 + r ``b + [ `d `g ] | +%%theme 2 +%%49 + \textstyle "italic" + r4_"arco" + \plet{ 2/3 } [ `g `g `g ] \plet{ 1/1 } | + \textstyle "roman" +%%50 + r4 \plet{ 2/3 } [ c c c ] \plet{ 1/1 } | +%%51 + g2 | +%%52 + c2 | +%%53 + r4 \plet{ 2/3 } [ `g `g `g ] \plet{ 1/1 } | +%%54 + r4 \plet{ 2/3 } [ c c c ] \plet{ 1/1 } | +%%55 + g2 | +%%56 + `g4 `c4 | +% \key\`es || +%%57 + g r g r | +%%58 + c r c r | +%%59 + `g r `g r | +%%60 + c r c r | +%%61 + d4. ``b | +%%62 + c2 | +%%63 + g4 `g4 | +%%64 + c4 `c4 | +% \meter{6/8} || +%%65 + [ c c c ] c4. | +%%66 + [ `c `c `c ] `c4. | +%%67 + [ `g `g `g ] `g4. | +% \newline +%%68 + [ g g g ] g4. | +%%69 + c2. | +%%70 + c2. | +%%71 + g2. | +%%72 + 'c r4 r4. | +%%73 +% \meter{2/4} || + g r g r | +%%74 + c r c r | +%%75 + `g r `g r | +%%76 + c r c4 | +%%77 + d4. ``b | +%%78 + c2 | +%%79 + g4 `g4 | +%%80 + c4 `c4 | +%%81 + \duration{2} + `c | +%%82 + `c | +%%83 + `e | +%%84 + `f | +%%85 + `as | +%%86 + c | +%%87 + d | +%%88 + \textstyle "italic" + d_"dacapo" + \textstyle "roman" +% \key\`g || + $ +} diff --git a/input/mlvio1.ly b/input/mlvio1.ly new file mode 100644 index 0000000000..7ea613f53c --- /dev/null +++ b/input/mlvio1.ly @@ -0,0 +1,216 @@ +% mlvio1.ly +% +% Viola Quartet +% Martien Lohman (194x-????) +% +% Violin I +% +% quite alive at the time of writing; +% copyright by ml +% +% The purpose of this file is to demonstrate features of LilyPond; +% respect the copyright. +% +violin1 = music { + $ + \octave{} + \duration{4} +%1 + g [ b8. a16 ] | +%2 + g2 | +%3 + g [ a16 b16 'c16 a16 ] | +%4 + g2 | +%5=1 + g [ b8. a16 ] | +%6=2 + g2 | +%7 + e fis | +%8 + d fis | +%9=1 + g [ b8. a16 ] | +%10 + g f | +%11=4 + e d | +%12 + [ fis8 a8 ] [ g8 'd8 ] | +%13 + [ 'd8 a8 ] [ 'd8 b8 ] | +%14=10 + a b | +%15 + 'c b | +%16 + \textstyle "italic" + a g_"fine" + \textstyle "roman" | +%\newline +%17=1 + g [ b8. a16 ] | +%18=2 + g2 | +%19=3 + g [ a16 b16 'c16 a16 ] | +%20=4 + g2 | +%21=5 + g [ b8. a16 ] | +%22=6 + g2 | +%23=4 + e [ d16 c16 `b16 c16 ] | +%24 + cis 'cis | +%25 + 'd [ 'fis8. 'e16 ] | +%first modulation +%26 + 'd 'c | +%27 + b a | +%28 + [ a8 b16 'cis16 ] 'd | +%29 + 'cis 'd | +%30 + 'cis a | +%31 + [ g8 'd8( ] ) 'd | +%32 + 'cis 'c | +%variant 'a +%33 + \duration{16} [ b8 'd 'd ] [ 'd8 'd 'd ] | +%34 + [ 'g8 'd 'd ] b4 | +%35 + [ 'c8 'c 'c ] [ 'c8 'c 'c ] | +%36 + b2 | +%37 + [ 'c8 'e 'e ] [ 'e8 'd 'c ] | +%38 + [ b8 'd 'd ] [ 'd8 'd 'd ] | +%39 + [ 'e8 'c 'c ] [ 'c8 'd 'c ] | +%40 + 'c4 { b4 'd4 } | +%41 + \textstyle "italic" + \duration{8} + r_"pizz" d r g + \textstyle "roman" | +%42 + r d e4 | +%43 + r b r 'd | +%44 + r 'e 'c4 | +%45 + r b r b | +%46 + r b [ a b ] | +%47 + r b r 'c | +%48 + r 'd [ 'd b ] | +%theme 2 +%49 + \textstyle "italic" + r4_"arco" \plet{ 2/3 } [ b8 b b ] \plet{ 1/1 } + \textstyle "roman" | +%50 + r4 \plet{ 2/3 } [ g g g ] \plet{ 1/1 } | +%51 + b2 | +%52 + 'c2 | +%53 + r4 \plet{ 2/3 } [ b b b ] \plet{ 1/1 } | +%54 + r4 \plet{ 2/3 } [ g g g ] \plet{ 1/1 } | +%55 + b2 | +%56 + g2 | +% \key\Es || +%57 + f r f r | +%58 + es r 'c r | +%59 + b r b r | +%60 + 'c r 'c4 | +%61 + \duration{16} + \plet{ 4/6 } [ as f d f as 'd ] \plet{ 1/1 } \plet{ 4/6 } [ as f d `as d f ] \plet{ 1/1 } | +%62 + \plet{ 4/6 } [ g es c `g c es ] \plet{ 1/1 } \plet{ 4/6 } [ g 'c 'es 'c g es ] \plet{ 1/1 } | +%63 + \plet{ 4/6 } [ g d g bes 'd 'g ] \plet{ 1/1 } \plet{ 4/6 } [ 'f 'd bes g f d ] \plet{ 1/1 } | +%64 + \duration{8} + [ c g ] g4 | +% \meter{6/8} || +%65 + [ g g g ] g4. | +%66 + [ c c c ] c4. | +%67 + [ g g g ] g4. | +%68 + [ b8 b b ] b4. | +%69 + [ 'c g es ] 'c4. | +%70 + 'c4. 'es4. | +%71 + [ 'f 'd b ] [ g a8 b ] | +%72 + 'c r4 r4. | +% \meter{2/4} || +%73 + f r f r | +%74 + es r 'c r | +%75 + b r b r | +%76 + 'c r 'c4 | +%77 + \duration{16} + \plet{ 4/6 } [ as f d f as 'd ] \plet{ 1/1 } \plet{ 4/6 } [ as f d `as d f ] \plet{ 1/1 } | +%78 + \plet{ 4/6 } [ g es c `g c es ] \plet{ 1/1 } \plet{ 4/6 } [ f 'c 'es 'c g es ] \plet{ 1/1 } | +%79 + \plet{ 4/6 } [ g d f b 'd 'g ] \plet{ 1/1 } \plet{ 4/6 } [ 'f 'd b g f d ] \plet{ 1/1 } | +%80 + [ c8 g8 ] g4 | +%81 + \duration{2} + 'c | +%82 + 'c | +%83 + 'des | +%84 + 'c | +%85 + 'c | +%86 + es | +%87 + d | +%88 + \textstyle "italic" + a_"dacapo" + \textstyle "roman" +% \key\G || + $ +} diff --git a/input/mlvio2.ly b/input/mlvio2.ly new file mode 100644 index 0000000000..0a9df42f3f --- /dev/null +++ b/input/mlvio2.ly @@ -0,0 +1,217 @@ +% mlvio2.ly +% +% Viola Quartet +% Martien Lohman (194x-????) +% +% Violin II +% +% quite alive at the time of writing; +% copyright by ml +% +% The purpose of this file is to demonstrate features of LilyPond; +% respect the copyright. +% +violin2 = music { + $ + \octave{} + \duration{4} +%1 + d2 | +%2 + [ `b8. `a16 ] `g4 | +%3 + [ g8 e8 ] fis | +%4 + d2 | +%5=1 + e2 | +%6=2 + [ `b8. `a16 ] `g4 | +%7 + `g `a | +%8 + `b `a | +%9=1 + d2 | +%10 + `b `g | +%11=4 + `g2 | +%12 + [ d8 e16 fis16 ] g | +%13 + fis g | +%14=10 + fis d | +%15 + c d | +%16 + \textstyle "italic" + d2_"fine" | + \textstyle "roman" +% \newline +%17=1 + d2 | +%18=2 + [ `b8. `a16 ] `g4 | +%19=3 + [ g8 e8 ] fis | +%20=4 + d2 | +%21=5=1 + e2 | +%22=6=2 + [ `b8. `a16 ] `g4 | +%23=4 + `g2 | +%24 + cis e | +%25 + a2 | +%first modulation +%26 + fis d | +%27 + d2 | +%28 + [ cis8 e8 ] [ d8 a8 ] | +%29 + [ a8 e8 ] [ a8 fis8 ] | +%30 + e fis | +%31 + g fis | +%32 + a fis | +%variant a +%33 + \duration{16} + [ g8 b b ] [ b8 g a ] | +%34 + [ b8 b b ] f4 | +%35 + [ g8 e e ] [ e8 g g ] | +%36 + b4 fis4 | +%37 + [ a8 a a ] [ a8 a a ] | +%38 + [ fis8 fis fis ] [ fis8 fis fis ] | +%39 + [ e8 e e ] [ e8 e e ] | +%40 + fis4 g4 | +%41 + \duration{8} + \textstyle "italic" + r_"pizz" + \textstyle "roman" + `b r `b | +%42 + r `b `g4 | +%43 + r fis r fis | +%44 + r g e4 | +%45 + r e r g | +%46 + r fis [ fis g ] | +%47 + r g r e | +%48 + r fis [ fis d ] | +%theme 2 +%49 + \textstyle "italic" + r4_"arco" + \textstyle "roman" + \plet{ 2/3 } [ d8 d d ] \plet{ 1/1 } | +%50 + r4 \plet{ 2/3 } [ g8 g g ] \plet{ 1/1 } | +%51 + d2 | +%52 + c2 | +%53 + r4 \plet{ 2/3 } [ d8 d d ] \plet{ 1/1 } | +%54 + r4 \plet{ 2/3 } [ e e e ] \plet{ 1/1 } | +%55 + d2 | +%56 + f4 e4 | +% \key\Es || +%57 + d r `b r | +%58 + `g r es r | +%59 + g r g r | +%60 + g r es4 | +%61 + f2 | +%62 + es2 | +%63 + `b d4. | +%64 + es2 | +% \meter{6/8} || +%65 + \duration{8} + [ c c c ] c4. | +%66 + [ `g `g `g ] `g4. | +%67 + [ `b8 `b `b ] `b4. | +%68 + [ g g g ] g4. | +%69 + es2. | +%70 + [ c es g ] 'c4. | +%71 + b4 g4 d4 | +%72 + es r4 r4. | +%73 +% \meter{2/4} || + d r `b r | +%74 + `g r es r | +%75 + g r g r | +%76 + g r es4 | +%77 + \duration{2} + f | +%78 + es | +%79 + `b8 d4. | +%80 + es | +%81 + es | +%82 + es | +%83 + bes | +%84 + f | +%85 + f | +%86 + ges | +%87 +% = g | +%88 + \textstyle "italic" + fis_"dacapo" | + \textstyle "roman" +% \key\G || + $ +} diff --git a/input/pavane.ly b/input/pavane.ly index 01d6545e64..e3b1e50e06 100644 --- a/input/pavane.ly +++ b/input/pavane.ly @@ -12,11 +12,10 @@ horn = staff { -% melodic - complex + melodic music{ $ \octave { ' } - \duration { 8} + \duration { 8 } % 1 d2(( [)d e cis `b] | @@ -118,7 +117,6 @@ score { bar "|:" skip 10:0 bar ":|" - meter 4* 4 skip 13:0 bar "||" } diff --git a/input/pavane.tex b/input/pavane.tex new file mode 100644 index 0000000000..69a136237e --- /dev/null +++ b/input/pavane.tex @@ -0,0 +1,12 @@ +\documentclass{article} %UGH +\usepackage{a4} +\begin{document} +\input lilyponddefs +\input titledefs +\def\interscoreline{\vskip12pt} +\title{Pavane pour une Infante d\'efunte} +\composer{Maurice Ravel} +\instrument{Cor en Fa} +\maketit +\input pavane.out +\end{document} diff --git a/input/scales.ly b/input/scales.ly index 63742f53c9..97d8dd89cb 100644 --- a/input/scales.ly +++ b/input/scales.ly @@ -54,11 +54,11 @@ score { geometric 1.4 } commands { - meter 6* 8 + meter 6*8 skip 6:0 - meter 4* 4 + meter 4*4 skip 2:0 skip 11:0 } -} \ No newline at end of file +} diff --git a/input/scsii-menuetto.tex b/input/scsii-menuetto.tex new file mode 100644 index 0000000000..4eb7231d64 --- /dev/null +++ b/input/scsii-menuetto.tex @@ -0,0 +1,19 @@ +\documentclass{article} %UGH +\usepackage{a4} +\oddsidemargin-1in\advance\oddsidemargin7.5mm +\evensidemargin\oddsidemargin +\textwidth\hsize\advance\textwidth-15mm +\begin{document} +\input lilyponddefs +\input titledefs +\def\interscoreline{\vskip12pt} +\title{Solo Cello Suites\normalsize\\[2ex]Suite II} +% \subtitle{Suite II} +\composer{J.\ S.\ Bach} +% \lefttitle{Menuetto} +% \tempo{Moderato} +% \metron{4=120} +\instrument{Menuetto I} % heu +\maketit +\input scsii-menuetto.out +\end{document} diff --git a/input/standchen.ly b/input/standchen.ly index 81ef61d6b6..87c317b403 100644 --- a/input/standchen.ly +++ b/input/standchen.ly @@ -1,5 +1,13 @@ -% st\"andchen.lily -% Franz Schubert (? - ?) +% standchen.ly +% +% St\"andchen (Serenade) "Leise flehen meine Lieder" D.957 No.4 +% Franz Schubert (1797-1828) +% Text by Ludwig Rellstab (1799-1860) +% +% Copyright (c) 1995,1996,1997 Jan Nieuwenhuizen +% +% The purpose of this file is to demonstrate features of LilyPond. +% (there is an accompanying LaTeX file, standchen.tex) % % comments with # note missing stuff % heu, make that %#% @@ -8,16 +16,15 @@ %% LilyPond's naive idealspacing calc. %% -% %#%% %#%\title{St\"andchen} %#%\subtitle{Serenade} %#%% -%#%\composer{`franz Schubert} +%#%\composer{Franz Schubert} %#%\tempo{M\"a\ss ig} %#%% %#%\meter{3/4} -%#%\key\`f +%#%\key\F %#%\clef\treble %#%% %#%\barnumbering5 @@ -30,11 +37,14 @@ %%1 melodie = music { $ \duration{ 8 } - r_"pp" { [ d `a-| } f-| { d `a-| } f-| { d `a-| ] } +% r_"\pp" { [ d `a-| } f-| { d `a-| } f-| { d `a-| ] } + r { [ d `a-|_"\pp" } f-| { d `a-| } f-| { d `a-| ] } %%2 r { [ d `bes-| } f-| { d `bes-| } f-| { d `bes-| ] } %%3 + \textstyle "italic" r_"simile" { [ d `bes } e { d `bes } e { d `bes ] } + \textstyle "roman" %%4 r { [ `a cis } e { `a cis } e { `a cis ] } %#%:| @@ -51,18 +61,18 @@ melodie = music { $ %%9 %#% { 'a4.( 'cis4.\stemdown_p } { ) 'g 'e_{dolce} } %#% { 'g( 'e } 'f ) 'e - 'a4.( )g \plet{ 2/3 } { 'g 'e } { 'f } { 'e } \plet{ 1/1 } + 'a4.( )'g \plet{ 2/3 } { 'g 'e } { 'f } { 'e } \plet{ 1/1 } %%10 { 'f2. 'd2. } %%11 - \plet { 2/3 } [ a_"pp"( )bes a ] \plet { 1/1 } 'f4. a + \plet { 2/3 } [ a_"\pp"( )bes a ] \plet { 1/1 } 'f4. a %%12 \plet { 2/3 } [ g( ) a g ] \plet { 1/1 } 'e4. 'd %%13 'c4. bes \plet { 2/3 } [ bes( ) a g ] \plet { 1/1 } %%14 %#% a2 r { 'd(^ f_p(v } - a2 r { 'd f_"p" } + a2 r { 'd f_"\p" } %%15 %#% { ) e4. ) 'c4.\stemup_{dolce} } { bes g } { e4. 'c4._"dolce" } { bes g } @@ -70,12 +80,14 @@ melodie = music { $ %%16 { a2. f2. } %%17 + \textstyle "italic" [ a8._"cresc." 'cis16 ] 'f4. 'e + \textstyle "roman" %%18 [ 'd8. a16 ] f4. d %%19 %#% 'c\grace\stemup - \plet { 2/3 } [ bes_"pp"( ) a bes ] \plet { 1/1 } 'd4. bes + \plet { 2/3 } [ bes_"\pp"( ) a bes ] \plet { 1/1 } 'd4. bes %%20 a2. %%21 @@ -85,23 +97,23 @@ melodie = music { $ %#% =f2. f2. %%23 - [ a8._"mf" 'cis16 ] 'f4. 'e + [ a8._"\mf" 'cis16 ] 'f4. 'e %%24 [ 'd8. a16 ] fis4. d %%25 %#% 'cis\grace\stemup - \plet { 2/3 } [ b_"mf"( ) ais b ] \plet { 1/1 } 'd4. b + \plet { 2/3 } [ b_"\mf"( ) ais b ] \plet { 1/1 } 'd4. b %%26 { a2. fis2. } %#%\tighten\newline %%27 - \plet { 2/3 } [ 'e_"f"( )'dis 'e ] \plet { 1/1 } 'g4. 'cis + \plet { 2/3 } [ 'e_"\f"( )'dis 'e ] \plet { 1/1 } 'g4. 'cis %%28 { 'd2. fis2. } %#%\volta1 %%29 %#% { bes2(^++++ g2_{mf} } - { bes2 g2_"mf" } + { bes2 g2_"\mf" } %#% [v { 'd8.( bes8. } { bes16 ) )++ g16 } ] { [ 'd8. bes8. } { bes16 g16 ] } %%30 @@ -113,7 +125,7 @@ melodie = music { $ %#% [ { a cis_.( } { a e_. } { a )- g_. } ] { [ a cis_. } { a e_. } { a g_. ] } %%32 - { a2 fis2_"pp" } { a4 fis4 } + { a2 fis2_"\pp" } { a4 fis4 } %%33 %#% { b2(^ g2 } [v { 'd8.( b8. } { b16 ) ) g16 } ] { b2( g2 } { [ 'd8. b8. } { b16 g16 ] } @@ -138,36 +150,37 @@ melodie = music { $ 'cis2 r4 %%41 %#% { > 'fis4. 'cis4._f } 'e [ 'e( ) 'd >! 'cis ] \plet { 1/1 } - { 'fis4. 'cis4._"f" } 'e \plet { 2/3 } [ 'e( )'d 'cis ] \plet { 1/1 } + { 'fis4. 'cis4._"\f" } 'e \plet { 2/3 } [ 'e( )'d 'cis ] \plet { 1/1 } %%42 [ b8. 'cis16 ] 'd4^> b r %%43 %#% [^ { b8._{ }_{ }_{ }_{ }_{ }_f g2. } 'cis16 ] 'd4^> b r - [ b8._"f" 'cis16 ] 'd4^> b r + [ b8._"\f" 'cis16 ] 'd4^> b r %%44 %#% [^ { > b8. fis2 } 'cis16 ] 'd4^> b >! r -% typo? [ b8. 'cis16 ] 'd4^> b r %%45 %#% 'cis\grace\stemup - \plet { 2/3 } [ b_"p"( )ais b ] \plet { 1/1 } 'd4. b + \plet { 2/3 } [ b_"\p"( )ais b ] \plet { 1/1 } 'd4. b %%46 %#% { =a2. fis2. } { a2. fis2. } %%47 - \plet { 2/3 } [ 'e_"f"( )'dis 'e ] \plet { 1/1 } 'g4.^> 'cis + \plet { 2/3 } [ 'e_"\f"( )'dis 'e ] \plet { 1/1 } 'g4.^> 'cis %%48 %#% { fis2.(v ='d2.\stemup(^ } { fis2. 'd2. } %%49 %#% { ) 'd4 ) =f2._> } { r4 s4_{decr} } 'd4\stemup + \textstyle "italic" 'd4 r4_"decresc." 'd4 + \textstyle "roman" %%50 { bes2. e2. } %%51 { a2. cis2. } %%52 - { fis2 d2 } { a4 f4_"pp" } + { fis2 d2 } { a4 f4_"\pp" } %%53 %#% { bes2 g2 } [ { 'd8.^>( bes8. } { ) bes16 g16 } ] { bes2 g2 } { [ 'd8.^> bes8. } { bes16 g16 ] } @@ -178,7 +191,9 @@ melodie = music { $ %#% { a4. g4. } [ { a cis_.( } { a e_. } { a )- g_. } ] { a4. g4. } { [ a cis_. } { a e_. } { a g_. ] } %%56 + \textstyle "italic" { a2. fis2._"dim." } + \textstyle "roman" %%57 { a2. fis2. } %%58 @@ -482,10 +497,11 @@ score { output "standchen.uit" unitspace 2.4 cm % unitspace 4.0 cm % leaves all text stand free -geometric 1.4 + geometric 1.4 } staff { - melodic music { melodie } + melodic + music { melodie } commands { key $bes$ clef "violin" @@ -497,7 +513,8 @@ geometric 1.4 music { tekst2 } } staff { - melodic music { begeleiding } + melodic + music { begeleiding } commands { key $bes$ clef "bass" @@ -510,6 +527,14 @@ geometric 1.4 skip 32:0 bar ":|" skip 22:0 - bar "||" + bar "||" + } + paper { + symboltables { table_sixteen } + width 195mm + unitspace 20mm +% unitspace 4.0 cm % leaves all text stand free +% geometric 1.4 + output "standchen.out" } } diff --git a/input/standchen.tex b/input/standchen.tex new file mode 100644 index 0000000000..9c87c4cc90 --- /dev/null +++ b/input/standchen.tex @@ -0,0 +1,24 @@ +\documentclass{article} %UGH +\usepackage{a4} +\oddsidemargin-1in\advance\oddsidemargin7.5mm +\evensidemargin\oddsidemargin +\textwidth\hsize\advance\textwidth-15mm +\topmargin-1in\advance\topmargin5mm +\vsize297mm % so what does a4 do, anyway? +\textheight\vsize\advance\textheight-30mm +\pagestyle{empty} +\begin{document} +\input lilyponddefs +\input titledefs +%\def\interstaffline{\vskip10pt} +%\def\interscoreline{\vskip12pt} +\def\interstaffline{\vskip1mm} +\def\interscoreline{\vskip2mm} +\vbox to 10mm{\vss} +\title{St\"andchen\normalsize\\[2ex](Serenade)} +\composer{Franz Schubert (1797-1828)} +\instrument{M\"a\ss ig} % heu +%#%\tempo{M\"a\ss ig} +\maketit +\input standchen.out +\end{document} diff --git a/input/twinkle.ly b/input/twinkle.ly index 8664faed17..80b8be6eee 100644 --- a/input/twinkle.ly +++ b/input/twinkle.ly @@ -2,7 +2,7 @@ % "Altijd is Kortjakje ziek" % "Twinkle twinkle little star" % - +% Copyright: none melodie = music { $ @@ -104,15 +104,13 @@ text3 = music { } mstaf = staff { -% melodic - complex + melodic music { melodie } commands { clef "violin" } } bass_staf = staff { -% melodic - complex + melodic music { begeleiding } commands { clef "bass" } } diff --git a/input/wohltemperirt.ly b/input/wohltemperirt.ly new file mode 100644 index 0000000000..aac7654458 --- /dev/null +++ b/input/wohltemperirt.ly @@ -0,0 +1,65 @@ +% JS Bach, Das Wohltemperirtes Clavier I, Fuga II (c-minor) +% +% a 7 bar fragment +% +% Public Domain -- by HWN +% + +dux = music { $ + \duration { \last } + \stem{-1} r8 ['c16 b] ['c8 g] [as 'c16 b] ['c8 'd] | + [g 'c16 b] ['c8 'd] [f16 g] as4 [g16 f] | + [es 'c b a] [ g f es d] [c8 'es 'd 'c] | + [bes a bes 'c] [fis g a fis] | + g4 r16 [c d es] [f g as8(] [)as16 d es f ]| + [g a bes8(] [)bes16 es f g ] [as g f es] [d8 'c16 b]| + 'c4 r4 r8 ['f 'es 'd] | + r8 [as g f] [g f16 es] [f8 d] | +$} + +comes = music { $ + r1 r1 + \stem{1} + \octave {'} + r8 [g16 fis] [g8 c] [es g16 f] [g8 a]| + [d8 g16 fis] [g8 a] [c16 d] es4 [d16 c] | + [`bes8 es16 d] [es8 `g8] [`as f16 es] [f8 `a] | + [`bes8 g16 f] [g8 `b] [c8 d16 es] f4( | + [) f8 es16 d] [c16 `bes `as `g] [`f8 as g f] | + [es d es f] [`b c d `b] | + +$} + +bassdux = music { $ + r1 r1 r1 r1 r1 r1 + \stem{1} \octave { } + r8 [c16 B] [c8 G] [As c16 Bes] [c8 d] | + [G c16 B] [c8 d] [F16 G] As4 [G16 F] | $ +} + +% will make it look even uglier +basstaf = staff { melodic + music { bassdux } + commands { + clef bass + key $bes es as$ + } +} + +score { + staff { melodic + music { dux } + music { comes } + + commands { + key $bes es as$ + } + } + commands { + meter 4*4 + skip 8:0 + } + paper { unitspace 2.5cm + geometric 1.1 + } +} \ No newline at end of file diff --git a/lilyponddefs.tex b/lilyponddefs.tex index 1ad6d5e58c..fd0d0ed0ba 100644 --- a/lilyponddefs.tex +++ b/lilyponddefs.tex @@ -20,6 +20,7 @@ %% musix defs \parindent=0pt +\newdimen\smallspace \newdimen\interlinedist \newcount\n \newdimen\balkhoog @@ -41,6 +42,7 @@ \font\hslurhfont=xslhz20 \font\musicfnt=musix20 \font\italicfont=cmti10 + \font\dynfont=cmbxti10 scaled \magstep1 \balkhoog=20pt \notewidth=6pt \noteheight=5pt @@ -60,6 +62,7 @@ \font\hslurdfont=xslhd16 \font\hslurhfont=xslhz20 \font\musicfnt=musix16 + \font\dynfont=cmbxti10 \balkhoog=16pt \staffrulethickness=0.4pt \notewidth=5pt @@ -68,6 +71,8 @@ } \def\musixcalc{ + \interlinedist=\fontdimen5\musicfnt + \smallspace=.3\interlinedist \interstaffrule=\balkhoog \advance\interstaffrule by-\staffrulethickness \divide\interstaffrule by 4 @@ -79,7 +84,19 @@ \balkhalf=\balkhoog \rationalmultiply\balkhalf*1/2 } -\def\dyn{\italicfont} +% \def\dyn{\italicfont} +\def\dyn{\dynfont} +\def\dynf{f\kern-.1ex} +\def\dynm{f\kern-.15ex} +\def\dynp{p\kern-.15ex} +\def\ppp{\dynfont\dynp\dynp p} +\def\pp{\dynfont\dynp p} +\def\p{\dynfont p} +\def\mp{\dynfont\dynm p} +\def\mf{\dynfont\dynm f} +\def\f{\dynfont f} +\def\ff{\dynfont\dynf f} +\def\fff{\dynfont\dynf\dynf f} \def\slurcharh#1{{\slurhfont\char#1}} \def\slurcharu#1{{\slurufont\char#1}} @@ -124,13 +141,26 @@ \mdef\usixteenthflag{41} \mdef\uthirtysecondflag{42} -\def\maatstreep{\vrule height\balkhoog} -\def\finishbar{\vrule height\balkhoog width 1pt} \maccentdef\repeatcolon{55}{2/1} \def\emptybar{} -\def\repeatbar{\rightalign{\repeatcolon\kern 2pt\finishbar}} -\def\startrepeat{\hbox{\finishbar\kern 2pt\repeatcolon}} -\def\repeatbarstartrepeat{\hbox{\repeatbar\kern 1pt\startrepeat}} + +\def\thinbar{\vrule height\balkhoog} +%? what-s wrong with rightalign? +\def\thickbar{\vrule height\balkhoog width 2\smallspace} +\def\maatstreep{\thinbar} +% \def\finishbar{\rightalign{\thinbar\kern\smallspace\thickbar}} +\def\finishbar{\hss\rightalign{\thinbar\kern\smallspace\thickbar}} +% \def\repeatstopbar{\rightalign{\repeatcolon\hskip2\smallspace\thinbar\hskip\smallspace\thickbar}} +\def\repeatstopbar{\hss\rightalign{\repeatcolon\hskip2\smallspace\thinbar\hskip\smallspace\thickbar}} +% \def\repeatstopbar{\kern-3\smallspace\rightalign{\repeatcolon\kern2\smallspace\thinbar\kern\smallspace\thickbar}\kern3\smallspace} +\def\repeatstartbar{\hbox{\thickbar\kern\smallspace\thinbar\kern2\smallspace\repeatcolon}} +\def\repeatstopstart{\hbox{\repeatcolon\kern2\smallspace\thinbar\kern\smallspace\thickbar\kern\smallspace\thickbar\kern\smallspace\thinbar\kern2\smallspace\repeatcolon}} +\def\doublebar{\hbox{\thinbar\hskip\smallspace\thinbar}} + +%compatability +\def\repeatbar{\repeatstopbar} +\def\startrepeat{\repeatstartbar} +\def\repeatbarstartrepeat{\repeatstopstart} \def\generalmeter#1#2{\botalign{\vbox to\balkhalf{\vss \meterfont#1}% \nointerlineskip diff --git a/pavane.tex b/pavane.tex deleted file mode 100644 index 69a136237e..0000000000 --- a/pavane.tex +++ /dev/null @@ -1,12 +0,0 @@ -\documentclass{article} %UGH -\usepackage{a4} -\begin{document} -\input lilyponddefs -\input titledefs -\def\interscoreline{\vskip12pt} -\title{Pavane pour une Infante d\'efunte} -\composer{Maurice Ravel} -\instrument{Cor en Fa} -\maketit -\input pavane.out -\end{document} diff --git a/src/Makefile b/src/Makefile index 99c4f0a6b4..55fba019b2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -9,4 +9,4 @@ TAGS: $(mycc) etags -CT $(mycc) clean: - rm -f $(gencc) \ No newline at end of file + rm -f $(gencc) diff --git a/src/beam.cc b/src/beam.cc index abf94d157b..52080a39ab 100644 --- a/src/beam.cc +++ b/src/beam.cc @@ -1,3 +1,5 @@ +#include "varray.hh" + #include "dimen.hh" #include "beam.hh" #include "misc.hh" @@ -72,8 +74,8 @@ Beam::set_default_dir() int dirs[2]; dirs[0]=0; dirs[1] =0; for (iter_top(stems,i); i.ok(); i++) { - i->set_default_dir(); - dirs[(i->dir+1)/2] ++; + int d = i->get_default_dir(); + dirs[(d+1)/2] ++; } dir = (dirs[0] > dirs[1]) ? -1 : 1; for (iter_top(stems,i); i.ok(); i++) { diff --git a/src/complexmelodicstaff.cc b/src/complexmelodicstaff.cc deleted file mode 100644 index 66aa63ea07..0000000000 --- a/src/complexmelodicstaff.cc +++ /dev/null @@ -1,31 +0,0 @@ -#include "keyitem.hh" -#include "stem.hh" -#include "rest.hh" -#include "notehead.hh" -#include "paper.hh" -#include "molecule.hh" -#include "linepstaff.hh" -#include "complexmelodicstaff.hh" -#include "sccol.hh" -#include "localkeyitem.hh" -#include "request.hh" - -const int NO_LINES=5; - - -void -Complex_melodic_staff::set_output(PScore*ps) -{ - theline_l_ = new Linestaff(NO_LINES,ps); // theline_l_ is added to pscore later. - Complex_staff::set_output(ps); -} - -Item * -Complex_melodic_staff::get_TYPESET_item(Command*com) -{ - if (com->args[0] == "KEY") { - return new Keyitem(NO_LINES); // urgh. depends on clef. - } else - return Complex_staff::get_TYPESET_item(com); -} - diff --git a/src/complexprint.cc b/src/complexprint.cc index f266f7bed7..372d86db10 100644 --- a/src/complexprint.cc +++ b/src/complexprint.cc @@ -1,13 +1,16 @@ +#include "keyitem.hh" + #include "request.hh" #include "pscore.hh" #include "paper.hh" #include "complexstaff.hh" #include "sccol.hh" #include "debug.hh" - +#include "linepstaff.hh" #include "clefitem.hh" #include "bar.hh" #include "meter.hh" +const NO_LINES = 5; Item * Complex_staff::get_TYPESET_item(Command *com) @@ -16,7 +19,9 @@ Complex_staff::get_TYPESET_item(Command *com) Array arg( com->args); String type =arg[0]; arg.del(0); - if (type == "BAR" ) { + if (com->args[0] == "KEY") { + return new Keyitem(NO_LINES); // urgh. depends on clef. + } else if (type == "BAR" ) { s = new Bar(com->args[1]); } else if (type == "METER") { s = new Meter(arg); @@ -31,6 +36,7 @@ Complex_staff::get_TYPESET_item(Command *com) } + Interval citemlist_width(const Array &its) { @@ -91,6 +97,7 @@ Complex_column::typeset_item_directional(Item *i, int dir, int breakst) // UGH! void Complex_staff::set_output(PScore* ps ) { + theline_l_ = new Linestaff(NO_LINES,ps); // theline_l_ is added to pscore later. pscore_l_ = ps; pscore_l_->add(theline_l_); } diff --git a/src/complexstaff.cc b/src/complexstaff.cc index ffa667ea85..8f961b7d7b 100644 --- a/src/complexstaff.cc +++ b/src/complexstaff.cc @@ -30,7 +30,7 @@ Complex_column::setup_requests() if (j->barcheck()) { if (tdescription_->whole_in_measure) { - error("Barcheck failed, " + tdescription_->str()); + error( "Barcheck failed", j->defined_ch_c_l_m ); } continue; } @@ -38,7 +38,10 @@ Complex_column::setup_requests() continue; if (j->command()) continue; - todo_l_arr_.push(j); + if (j->groupchange()) // ugh + first_l_arr_.push(j); + else + second_l_arr_.push(j); } } diff --git a/src/complexwalker.cc b/src/complexwalker.cc index 5cc1b5b6a5..f1a73e0200 100644 --- a/src/complexwalker.cc +++ b/src/complexwalker.cc @@ -5,33 +5,14 @@ #include "clef.hh" #include "pscore.hh" #include "complexstaff.hh" -#include "complexwalker.hh" #include "sccol.hh" #include "debug.hh" #include "keyitem.hh" #include "clefitem.hh" #include "voicegroup.hh" #include "register.hh" - -Rhythmic_grouping -cparse_grouping(Array a, Moment one_beat) -{ - Array r; - for (int i= 0 ; i < a.size(); i++) - r.push(a[i]); - Moment here =0.0; - - Array children; - for (int i=0; i < r.size(); i++) { - - Moment last = here; - here += one_beat * r[i]; - children.push( - new Rhythmic_grouping(MInterval(last, here), r[i] ) - ); - } - return Rhythmic_grouping(children); -} +#include "complexwalker.hh" +#include "misc.hh" void Complex_walker::do_INTERPRET_command(Command*com) @@ -39,8 +20,7 @@ Complex_walker::do_INTERPRET_command(Command*com) Array args(com->args); args.del(0); if (com->args[0] == "GROUPING") { - default_grouping = cparse_grouping(args, - col()->tdescription_->one_beat); + default_grouping = parse_grouping(args); }else if (com->args[0] == "NEWMEASURE") { local_key_.reset(key_); @@ -111,19 +91,21 @@ Complex_walker::do_TYPESET_command(Command*com) void Complex_walker::announce_element(Staff_elem_info info) { + info.group_regs_l_ = find_voice_group((Voice*)info.voice_l_); announce_info_arr_.push(info); } void Complex_walker::do_announces() { - for (int i = 0; i < announce_info_arr_.size(); i++){ Staff_elem_info info = announce_info_arr_[i]; for (iter_top(voice_reg_list_,j); j.ok(); j++) { j->announce_element(info); } - group_regs_.announce_element(info); + for (iter_top ( group_reg_list_, j); j.ok(); j++) { + j->announce_element(info); + } local_key_reg_.acknowledge_element(info); } } @@ -131,32 +113,97 @@ Complex_walker::do_announces() Voice_registers * Complex_walker::find_voice_reg(Voice*v_l) { - for (iter_top(voice_reg_list_, i); i.ok(); i++) { + for (iter_top(voice_reg_list_, i); i.ok(); i++) { if (i->voice_l_ == v_l) return i; - } + } + return 0; +} + +Voice_registers* +Complex_walker::get_voice_reg(Voice*v_l) +{ + Voice_registers *regs_p=find_voice_reg(v_l); + if (regs_p) + return regs_p; - Voice_registers *regs_p=new Voice_registers(this,v_l); + regs_p = new Voice_registers(this,v_l); voice_reg_list_.bottom().add (regs_p); - //voice_reg_map_[v_l] = regs_p; return regs_p; } +Voice_group_registers * +Complex_walker::find_voice_group(Voice* v_l) +{ + if (!voice_group_map_.elt_query(v_l)) + return 0; + else return voice_group_map_[v_l]; +} + +Voice_group_registers * +Complex_walker::find_voice_group(const char *id) +{ + for (iter_top(group_reg_list_, i); i.ok(); i++) + if (i->group_id_str_ == id) + return i; + return 0; +} + + +Voice_group_registers * +Complex_walker::get_voice_group(Voice *v_l) +{ + Voice_group_registers *group_p = find_voice_group(v_l); + if (group_p) + return group_p; + + group_p = new Voice_group_registers(this); + group_reg_list_.bottom().add(group_p); + voice_group_map_[v_l] = group_p; + return group_p; +} + + +Voice_group_registers * +Complex_walker::get_voice_group(const char* id) +{ + Voice_group_registers *group_p = find_voice_group(id); + if (group_p) + return group_p; + group_p = new Voice_group_registers(this,id); + group_reg_list_.bottom().add(group_p); + return group_p; +} + +void +Complex_walker::do_change_group(const Voice * v, String group_id_str) +{ + voice_group_map_[v] = get_voice_group(group_id_str); +} + void Complex_walker::try_request(Request*req) { - bool b; - if (req->note() || req->rest()|| req->slur()) { - Voice *v_l = req->elt_l_->voice_l_; - Voice_registers *vregs_l = find_voice_reg(v_l); - + bool b=false; + Voice *voice_l = req->elt_l_->voice_l_; + + if (req->groupchange()) { + do_change_group(voice_l, req->groupchange()->newgroup_str_); + b = true; + } else if (Voice_registers::acceptable_request(req)) { + Voice_registers *vregs_l = get_voice_reg(voice_l); b = vregs_l->try_request(req); - - } else { - b = group_regs_.try_request(req); - if (!b) - b = local_key_reg_.try_request(req); - } + } else if (Voice_group_registers::acceptable_request(req)){ + Voice_group_registers* reg_l = get_voice_group(voice_l); + b = reg_l->try_request(req); +#if 0 + if (!b) { + bool please_b = get_voice_group("")->try_request(req); + b |= please_b; + } +#endif + } + if (!b) WARN<< "junking request: " <name() <<"\n"; } @@ -165,10 +212,13 @@ void Complex_walker::process_requests() { Complex_column*c = col(); -// Complex_staff *s = staff(); - for (int i=0; i < c->todo_l_arr_.size(); i++) { - try_request(c->todo_l_arr_[i]); + for (int i=0; i < c->first_l_arr_.size(); i++) { + try_request(c->first_l_arr_[i]); + } + + for (int i=0; i < c->second_l_arr_.size(); i++) { + try_request(c->second_l_arr_[i]); } regs_process_requests(); @@ -178,16 +228,20 @@ Complex_walker::process_requests() void Complex_walker::regs_process_requests() { - for (iter_top(voice_reg_list_,j); j.ok(); j++) { + for (iter_top(voice_reg_list_, j); j.ok(); j++) { j->process_requests(); } - group_regs_.process_requests(); + for (iter_top(group_reg_list_, j); j.ok(); j++) + j->process_requests(); + local_key_reg_.process_request(); } void Complex_walker::typeset_element(Staff_elem *elem_p) { + if (!elem_p) + return; if (elem_p->spanner()) pscore_l_->typeset_spanner(elem_p->spanner(), staff()->theline_l_); else @@ -196,7 +250,6 @@ Complex_walker::typeset_element(Staff_elem *elem_p) Complex_walker::Complex_walker(Complex_staff*s) : Staff_walker(s, s->theline_l_->pscore_l_), - group_regs_(this), local_key_reg_(this) { oldkey_undo = 0; @@ -221,14 +274,15 @@ Complex_walker::do_pre_move() for (iter_top(voice_reg_list_,i); i.ok(); i++) { i->pre_move_processing(); } - group_regs_.pre_move_processing(); + for (iter_top (group_reg_list_, j); j.ok(); j++) + j->pre_move_processing(); local_key_reg_.pre_move_processing(); } void Complex_walker::do_post_move() { - processed_clef =false; + processed_clef = false; processed_key = false; processed_bar_priority = 0; @@ -236,6 +290,7 @@ Complex_walker::do_post_move() i->post_move_processing(); } announce_info_arr_.set_size(0); - group_regs_.post_move_processing(); + for (iter_top (group_reg_list_, j); j.ok(); j++) + j->post_move_processing(); local_key_reg_.post_move_processing(); } diff --git a/src/grouping.cc b/src/grouping.cc index 06f906ff91..91c9a66d0a 100644 --- a/src/grouping.cc +++ b/src/grouping.cc @@ -84,7 +84,7 @@ Rhythmic_grouping::intersect(MInterval t) for (int i=0; i < children.size(); i++) { MInterval inter = intersection(t, children[i]->interval()); - if (inter.empty() || inter.length() <= 0) { + if (inter.empty() || inter.length() <= Rational( 0 )) { delete children[i]; children[i] =0; } else { @@ -151,10 +151,10 @@ Rhythmic_grouping::Rhythmic_grouping(MInterval t, int n) interval_ = new MInterval(t); return; } - Moment dt = t.length()/n; + Moment dt = t.length()/Rational(n); MInterval basic = MInterval(t.left, t.left+dt); for (int i= 0; i < n; i++) - children.push(new Rhythmic_grouping( dt*i + basic )); + children.push(new Rhythmic_grouping( dt*Rational(i) + basic )); } diff --git a/src/groupregs.cc b/src/groupregs.cc index 6498762449..ae790ab9c6 100644 --- a/src/groupregs.cc +++ b/src/groupregs.cc @@ -1,3 +1,4 @@ +#include "script.hh" #include "request.hh" #include "beam.hh" #include "stem.hh" @@ -7,6 +8,7 @@ #include "debug.hh" #include "complexstaff.hh" #include "textspanner.hh" +#include "textitem.hh" Stem_beam_register::Stem_beam_register(Complex_walker*w) :Request_register(w) @@ -14,6 +16,8 @@ Stem_beam_register::Stem_beam_register(Complex_walker*w) do_post_move_process(); current_grouping = 0; beam_p_ = 0; + set_dir(0); + start_req_l_ = 0; } bool @@ -48,10 +52,12 @@ void Stem_beam_register::process_request() { if (beam_req_l_) { - if (beam_req_l_->spantype == Span_req::STOP) + if (beam_req_l_->spantype == Span_req::STOP) { end_beam_b_ = true; - else { + start_req_l_ = 0; + } else { beam_p_ = new Beam; + start_req_l_ = beam_req_l_; // walk_l_->announce_element(Staff_elem_info(beam_p_, )) current_grouping = new Rhythmic_grouping; if (beam_req_l_->nplet) { @@ -75,7 +81,11 @@ Stem_beam_register::process_request() stem_p_->flag = stem_req_l_->balltype; if (beam_p_) { - beam_p_->add(stem_p_); + if (stem_req_l_->balltype<= 4) + warning( "stem doesn't fit in Beam.", + stem_req_l_->defined_ch_c_l_m); + else + beam_p_->add(stem_p_); stem_p_->print_flag = false; } else { stem_p_->print_flag = true; @@ -102,6 +112,9 @@ void Stem_beam_register::do_pre_move_process() { if (stem_p_) { + if (default_dir_i_) + stem_p_->dir = default_dir_i_; + walk_l_->typeset_element(stem_p_); stem_p_ = 0; } @@ -127,5 +140,105 @@ Stem_beam_register::do_post_move_process() Stem_beam_register::~Stem_beam_register() { if (beam_p_) - error("unterminated beam"); + warning("unterminated beam", start_req_l_->defined_ch_c_l_m); +} + +void +Stem_beam_register::set_dir(int i) +{ + default_dir_i_ = i; +} +/****************/ + +Script_register::Script_register(Complex_walker*w) + : Request_register(w) +{ + script_p_ = 0; +} + +bool +Script_register::try_request(Request *r_l) +{ + if (!r_l->script()) + return false ; + + if (accepted_req_arr_.size() + && Script_req::compare( + *accepted_req_arr_[0]->script(), *r_l->script())) + + return false; + + accepted_req_arr_.push(r_l); + + return true; +} +void +Script_register::process_request() +{ + if (accepted_req_arr_.size() ) { + script_p_ = new Script(accepted_req_arr_[0]->script(), 10); + walk_l_->announce_element( + Staff_elem_info(script_p_, accepted_req_arr_[0], this)); + } +} + +void +Script_register::acknowledge_element(Staff_elem_info info) +{ + if (!script_p_) + return; + if (info.elem_p_->name() == String("Stem")) + script_p_->set_stem((Stem*)info.elem_p_); + else if (info.req_l_->rhythmic()) + script_p_->set_support(info.elem_p_->item()); +} + +void +Script_register::do_pre_move_process() +{ + if (script_p_){ + walk_l_->typeset_element(script_p_); + script_p_ = 0; + } +} +/******************/ + + +Text_register::Text_register(Complex_walker*w) + : Request_register(w) +{ + text_p_ = 0; +} + +bool +Text_register::try_request(Request*req_l) +{ + if (!req_l->text()) + return false; + if (accepted_req_arr_.size() && + Text_req::compare(*req_l->text(), *accepted_req_arr_[0]->text())) + + return false; + + accepted_req_arr_.push(req_l); + return true; +} + +void +Text_register::process_request() +{ + + if (accepted_req_arr_.size()) { + text_p_ = new Text_item(accepted_req_arr_[0]->text(), 10); + walk_l_->announce_element(Staff_elem_info(text_p_, + accepted_req_arr_[0], this)); + } +} +void +Text_register::do_pre_move_process() +{ + if (text_p_) { + walk_l_->typeset_element(text_p_); + text_p_ = 0; + } } diff --git a/src/inputcommand.cc b/src/inputcommand.cc index 251adedc85..aab0ea4a8b 100644 --- a/src/inputcommand.cc +++ b/src/inputcommand.cc @@ -158,18 +158,24 @@ get_bar_command(String w) } Array -get_default_grouping(int count) +get_default_grouping(int count, int one_beat_note) { Array s; if (!(count % 3 )) { - for (int i=0; i < count/3; i++) + for (int i=0; i < count/3; i++) { s.push(3); + s.push(one_beat_note); + } } else if (!(count %2)) { - for (int i=0; i < count/2; i++) + for (int i=0; i < count/2; i++) { s.push(2); + s.push(one_beat_note); + } + }else { s.push(2); - s.concat(get_default_grouping(count-2)); + s.push(one_beat_note); + s.concat(get_default_grouping(count-2, one_beat_note)); } return s; } diff --git a/src/inputcommands.cc b/src/inputcommands.cc index ef2014604c..d9f6910cf5 100644 --- a/src/inputcommands.cc +++ b/src/inputcommands.cc @@ -44,7 +44,7 @@ Commands_at::add(Input_command *i) int l = i->args[1]; int o = i->args[2]; tdescription_.set_meter(l,o); - bottom().add(get_grouping_command( get_default_grouping(l))); + bottom().add(get_grouping_command( get_default_grouping(l,o))); } } diff --git a/src/inputmusic.cc b/src/inputmusic.cc index 80f0a258a7..4afb6f8556 100644 --- a/src/inputmusic.cc +++ b/src/inputmusic.cc @@ -1,6 +1,7 @@ #include "debug.hh" #include "inputmusic.hh" #include "voice.hh" +#include "request.hh" void Simple_music::add(Voice_element*v) @@ -9,7 +10,7 @@ Simple_music::add(Voice_element*v) } Moment -Simple_music::length() +Simple_music::length()const { return voice_.last(); } @@ -20,7 +21,7 @@ Simple_music::translate_time(Moment t) } Voice_list -Simple_music::convert() +Simple_music::convert()const { Voice_list l; l.bottom().add(new Voice(voice_)); @@ -67,7 +68,12 @@ Complex_music::Complex_music(Complex_music const&s) for (iter_top(s.elts,i); i.ok(); i++) add(i->clone()); } - +void +Complex_music::set_default_group(String g) +{ + for (iter_top(elts,i); i.ok(); i++) + i->set_default_group(g); +} /****************************************************************/ void @@ -94,9 +100,9 @@ Music_voice::add_elt(Voice_element*v) } Moment -Music_voice::length() +Music_voice::length()const { - Moment l = 0.0; + Moment l = 0; for (iter_top(elts,i); i.ok(); i++) l += i->length(); @@ -105,10 +111,10 @@ Music_voice::length() Voice_list -Music_voice::convert() +Music_voice::convert()const { Voice_list l; - Moment here = 0.0; + Moment here = 0; for (iter_top(elts,i); i.ok(); i++) { Moment len = i->length(); @@ -154,7 +160,7 @@ Music_general_chord::translate_time(Moment t) } Moment -Music_general_chord::length() +Music_general_chord::length()const { Moment l =0.0; @@ -164,7 +170,7 @@ Music_general_chord::length() } Voice_list -Music_general_chord::convert() +Music_general_chord::convert()const { Voice_list l; for (iter_top(elts,i); i.ok(); i++) { @@ -174,6 +180,18 @@ Music_general_chord::convert() return l; } +/****************/ + +void +Multi_voice_chord::set_default_group(String g) +{ + int j=0; + for (iter_top(elts, i); i.ok(); i++) { + i->set_default_group(g + String(j)); + j++; + } +} + /****************/ diff --git a/src/inputscore.cc b/src/inputscore.cc index 6ea13d9b5d..a5d4a31007 100644 --- a/src/inputscore.cc +++ b/src/inputscore.cc @@ -37,6 +37,7 @@ Input_score::parse() Paperdef* paper_p=new Paperdef(*paper_); Score *s_p = new Score(paper_p); s_p->define_spot_str_ = define_spot_str_; + s_p->errorlevel_i_ = errorlevel_i_; Array parsed_staffs; for (iter_top(staffs_,i); i.ok(); i++) { Staff* staf_p=i->parse(s_p); @@ -60,6 +61,7 @@ Input_score::~Input_score() Input_score::Input_score() { paper_= 0; + errorlevel_i_ = 0; } void diff --git a/src/inputstaff.cc b/src/inputstaff.cc index 3c3909468d..6cbed38956 100644 --- a/src/inputstaff.cc +++ b/src/inputstaff.cc @@ -8,8 +8,8 @@ #include "melodicstaff.hh" #include "rhythmstaff.hh" #include "lyricstaff.hh" -#include "complexmelodicstaff.hh" #include "staff.hh" +#include "complexstaff.hh" void Input_staff::add(Array &s) @@ -36,10 +36,10 @@ Input_staff::parse(Score*score_l) { Staff *p=0; - if (type == "complex") - p = new Complex_melodic_staff; - else if (type == "melodic") + if (type == "simple") p = new Melodic_staff; + else if (type == "melodic") + p = new Complex_staff; else if (type == "rhythmic") p = new Rhythmic_staff; else if (type == "lyric") diff --git a/src/lexer.l b/src/lexer.l index 4446661d8e..00b4c70c15 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -8,6 +8,8 @@ #include "varray.hh" #include "parser.hh" #include "debug.hh" +#include "inputscore.hh" +#include "main.hh" %} @@ -44,7 +46,8 @@ OPTSIGN !? PITCHMOD ['`]*{OPTSIGN} RESTNAME r|s|p NOTECOMMAND \\{WORD} -NOTENAME {ALPHAWORD} +NOTENAME [a-z]+ +UNOTENAME [A-Z][a-z]* DOTS \.+ LYRICS {TEX}+ COMMENT [%#].*\n @@ -65,16 +68,14 @@ COMMENT [%#].*\n mtor << "rest:"<< yylval.string; return RESTNAME; } +{UNOTENAME} { + int *p=yylval.ii; + return ret_notename(p, YYText(), -1); +} {NOTENAME} { int *p=yylval.ii; - lookup_notename(p[0], p[1], YYText()); - mtor << "notename: "<< YYText()<{NOTECOMMAND} { @@ -269,8 +270,9 @@ include { //ignore } . { - error("lexer error: illegal character '"+String(YYText()[0])+ - "' encountered"); +// error( "lexer error: illegal character '"+String(YYText()[0])+ "' encountered"); + 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 cc69a4a6bb..508c61e30d 100644 --- a/src/lexerinit.cc +++ b/src/lexerinit.cc @@ -1,7 +1,12 @@ -#include +#include +#include +#include "proto.hh" +#include "plist.hh" #include "lexer.hh" #include "debug.hh" #include "main.hh" +#include "sourcefile.hh" +#include "source.hh" My_flex_lexer *lexer=0; @@ -27,22 +32,20 @@ Input_file::Input_file(String s) name = s; line = 1; String pf(s); - if (pf=="") + if (pf=="") { is = &cin; + sourcefile_l_ = 0; + } else { - pf =find_file(pf); - if (pf=="") { - String e("can\'t open `" + s+"\'"); - error(e); - } - is = new ifstream( pf); + Source_file* sourcefile_p = new Source_file( pf ); + source_l->add( sourcefile_p ); + sourcefile_l_ = sourcefile_p; + is = sourcefile_l_->istream_l(); } cout << "["<barcheck()) { if (tdescription_->whole_in_measure) { - error("Barcheck failed, " + tdescription_->str()); + error( "Barcheck failed ", req_l->defined_ch_c_l_m ); } } if (req_l->lreq_l()) { diff --git a/src/lyricitem.cc b/src/lyricitem.cc index b0afc3000b..81b61552c5 100644 --- a/src/lyricitem.cc +++ b/src/lyricitem.cc @@ -5,6 +5,10 @@ #include "molecule.hh" #include "lookup.hh" #include "textdef.hh" +#include "sourcefile.hh" +#include "source.hh" +#include "debug.hh" +#include "main.hh" Lyric_item::Lyric_item(Lyric_req* lreq_l, int voice_count_i) : Text_item(lreq_l,0) @@ -17,4 +21,8 @@ void Lyric_item::do_pre_processing() { // override Text_item + + // test context-error + if ( tdef_l_->text_str_.pos( "Gates" ) )// :-) + warning( "foul word", tdef_l_->defined_ch_c_l_m ); } diff --git a/src/main.cc b/src/main.cc index 8ac50296ee..7e20c89a70 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,13 +1,20 @@ #include #include +#include "proto.hh" +#include "plist.hh" #include "lgetopt.hh" #include "misc.hh" #include "string.hh" #include "main.hh" #include "path.hh" #include "config.hh" +#include "sourcefile.hh" +#include "source.hh" -extern void parse_file(String s); +Source source; +Source* source_l = &source; + +extern void parse_file(String,String); void @@ -17,6 +24,7 @@ long_option_init theopts[] = { 0, "warranty", 'w', 0, "help", 'h', 0, "debug", 'd', + 1, "init", 'i', 1, "include", 'I', 0,0,0 }; @@ -29,6 +37,7 @@ help() "--warranty, -w show warranty & copyright\n" "--output, -o set default output\n" "--debug, -d enable debug output\n" + "--init, -i set init file\n" "--include, -I add to file search path.\n" ; @@ -42,7 +51,7 @@ void notice() "Copyright (C) 1996,97 by\n" " Han-Wen Nienhuys \n" "Contributors\n" - " Jan-Nieuwenhuizen \n" + " Jan Nieuwenhuizen \n" " Mats Bengtsson \n" "\n" " This program is free software; you can redistribute it and/or\n" @@ -77,6 +86,7 @@ main (int argc, char **argv) { Getopt_long oparser(argc, argv,theopts); cout << get_version(); + String init_str("symbol.ini"); while (long_option_init * opt = oparser()) { switch ( opt->shortname){ @@ -90,6 +100,9 @@ main (int argc, char **argv) case 'I': path->push(oparser.optarg); break; + case 'i': + init_str = oparser.optarg; + break; case 'h': help(); exit(0); @@ -108,12 +121,12 @@ main (int argc, char **argv) while ( (arg= oparser.get_next_arg()) ) { String f(arg); destill_inname(f); - parse_file(f); + parse_file(init_str,f); do_scores(); p++; } if (!p) { - parse_file(""); + parse_file(init_str, ""); do_scores(); } diff --git a/src/melodicstaff.cc b/src/melodicstaff.cc index 849a64b209..df760d6a7a 100644 --- a/src/melodicstaff.cc +++ b/src/melodicstaff.cc @@ -28,6 +28,7 @@ Melodic_staff::get_notehead(Note_req *rq, int bottom) Notehead *n =new Notehead((NO_LINES-1)*2); n->set_rhythmic(rq->rhythmic()); n->position = rq->note()->height() + bottom; + n->defined_ch_c_l_m = rq->defined_ch_c_l_m; return n; } diff --git a/src/misc.cc b/src/misc.cc index 5618f8ae2a..a8fe2c026d 100644 --- a/src/misc.cc +++ b/src/misc.cc @@ -11,7 +11,7 @@ wholes(int dur, int dots) return 0.0; // stupid Intel: doesn't crash if !dur - Moment f = 1/Moment(dur); + Moment f = Rational(1)/Moment(dur); Moment delta = f; while (dots--) { diff --git a/src/mylexer.cc b/src/mylexer.cc index acda945d3f..9465279c4a 100644 --- a/src/mylexer.cc +++ b/src/mylexer.cc @@ -1,3 +1,4 @@ +#include #include "interval.hh" #include "identparent.hh" #include "associter.hh" @@ -9,6 +10,7 @@ #include "sstack.hh" #include "debug.hh" #include "notename.hh" +#include "sourcefile.hh" static Keyword_ent the_key_tab[]={ "bar", BAR, @@ -25,6 +27,7 @@ static Keyword_ent the_key_tab[]={ "mark", MARK, "meter", METER, "mm", MM, + "multivoice", MULTIVOICE, "octave", OCTAVECOMMAND, "output", OUTPUT, "partial", PARTIAL, @@ -36,13 +39,12 @@ static Keyword_ent the_key_tab[]={ "skip", SKIP, "staff", STAFF, "start", START_T, + "stem", STEM, "table", TABLE, "symboltables", SYMBOLTABLES, "notenames", NOTENAMES, "texid", TEXID, "textstyle", TEXTSTYLE, - "chord", CHORD, - "multi", MULTI, "unitspace", UNITSPACE, "voice", VOICE, "voices", VOICES, @@ -52,11 +54,35 @@ static Keyword_ent the_key_tab[]={ 0,0 }; +int +My_flex_lexer::ret_notename(int *p, String text, int octave_mod) +{ + text.lower(); + 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++; + + lookup_notename(p[0], p[1], text); + p[2] = octave_mod; + mtor << "notename: "<< text <; defaulttab = 0; + data_ch_c_l_m = 0; + errorlevel_i_ = 0; } int @@ -74,6 +100,12 @@ My_flex_lexer::lookup_identifier(String s) return (*the_id_tab)[s]; } +char const* +My_flex_lexer::here_ch_c_l() +{ + return data_ch_c_l_m + yyin->tellg(); +} + void My_flex_lexer::add_identifier(Identifier*i) { @@ -95,7 +127,7 @@ My_flex_lexer::~My_flex_lexer() String My_flex_lexer::spot()const { - return include_stack.top()->name + ": " + lineno(); + return include_stack.top()->name + ": " + String( lineno() ); } void @@ -103,10 +135,16 @@ My_flex_lexer::LexerError(const char *s) { if (lexer->include_stack.empty()) { *mlog << "error at EOF" << s << '\n'; - }else - *mlog << spot() << ": error:" << s << '\n'; - exit(1); + } 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 ); + } } + // set the new input to s, remember old file. void My_flex_lexer::new_input(String s) @@ -117,6 +155,7 @@ My_flex_lexer::new_input(String s) 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(); yylineno = 1; } diff --git a/src/note.cc b/src/note.cc index f53b002d86..9519371175 100644 --- a/src/note.cc +++ b/src/note.cc @@ -1,4 +1,7 @@ -#include +/* + could use cleanup + */ + #include #include "lexer.hh" #include "string.hh" #include "real.hh" @@ -9,12 +12,28 @@ #include "identparent.hh" #include "varray.hh" #include "textdef.hh" - +#include "parseconstruct.hh" int default_duration = 4, default_dots=0, default_octave=0; int default_plet_type = 1, default_plet_dur = 1; String textstyle="roman"; // in lexer? +bool last_duration_mode = false; + +void +set_duration_mode(String s) +{ + s.upper(); + last_duration_mode = (s== "LAST"); +} + +void +last_duration(int n) +{ + if (last_duration_mode) + default_duration = n; +} + /* triplet is '2/3' */ void set_plet(int num,int den) { @@ -29,6 +48,7 @@ get_text(String s) return t; t= new Text_def; t->text_str_= s; t->style_str_ = textstyle; + t->defined_ch_c_l_m = defined_ch_c_l; return t; } @@ -89,6 +109,9 @@ get_note_element(String pitch, int * notename, int * duration ) v->add(st); } + if ( !defined_ch_c_l ) + defined_ch_c_l = lexer->here_ch_c_l(); + Note_req * rq = new Note_req; int oct; @@ -101,9 +124,11 @@ get_note_element(String pitch, int * notename, int * duration ) rq->balltype = dur; rq->dots = dots; rq->plet_factor = Moment(default_plet_dur, default_plet_type); + rq->defined_ch_c_l_m = defined_ch_c_l; rq->print(); v->add(rq); + v->defined_ch_c_l_m = defined_ch_c_l; return v; } @@ -117,6 +142,13 @@ get_word_element(Text_def* tdef_p, int* duration) int dur = duration[0]; int dots=duration[1]; + tdef_p->defined_ch_c_l_m = defined_ch_c_l; +#if 0 + char buf[ 21 ]; + strncpy( buf, tdef_p->defined_ch_c_l_m, 20 ); + buf[ 20 ] = 0; + cout << hex << (void*)tdef_p->defined_ch_c_l_m << dec << buf << endl; +#endif Lyric_req* lreq_p = new Lyric_req(tdef_p); lreq_p->balltype = dur; @@ -147,7 +179,7 @@ get_rest_element(String, int * duration ) void get_default_duration(int *p) { - *p++ = default_duration; + *p++ = default_duration; *p = default_dots; } @@ -170,10 +202,10 @@ set_default_octave(String d) Request* get_request(char c) { - Request* ret=0; + Request* req_p=0; switch (c) { case '|': - ret = new Barcheck_req; + req_p = new Barcheck_req; break; case '[': @@ -182,14 +214,14 @@ get_request(char c) Beam_req*b = new Beam_req; if (default_plet_type != 1) b->nplet = default_plet_type; - ret = b; + req_p = b; } break; case ')': case '(': - ret = new Slur_req; + req_p = new Slur_req; break; default: assert(false); @@ -199,18 +231,19 @@ get_request(char c) switch (c) { case '(': case '[': - ret->span()->spantype = Span_req::START; + req_p->span()->spantype = Span_req::START; break; case ')': case ']': - ret->span()->spantype = Span_req::STOP; + req_p->span()->spantype = Span_req::STOP; break; default: break; } - return ret; + req_p->defined_ch_c_l_m = req_defined_ch_c_l; + return req_p; } void @@ -282,3 +315,13 @@ get_barcheck_element() return v_p; } + +Voice_element* +get_stemdir_element(int d) +{ + Voice_element*v_p = new Voice_element; + Group_feature_req * gfreq_p = new Group_feature_req; + gfreq_p->stemdir_i_ =d; + v_p->add(gfreq_p); + return v_p; +} diff --git a/src/notehead.cc b/src/notehead.cc index fb4e80719b..fc250288c9 100644 --- a/src/notehead.cc +++ b/src/notehead.cc @@ -17,12 +17,15 @@ Notehead::Notehead(int ss) balltype = 0; dots = 0; extremal = 0; + defined_ch_c_l_m = 0; } void Notehead::set_rhythmic(Rhythmic_req*r_req_l) { balltype = r_req_l->balltype; dots = r_req_l->dots; + if ( r_req_l->defined_ch_c_l_m ) + defined_ch_c_l_m = r_req_l->defined_ch_c_l_m; } void diff --git a/src/parser.y b/src/parser.y index f36d153113..8d6ac75f0c 100644 --- a/src/parser.y +++ b/src/parser.y @@ -20,8 +20,9 @@ Array pre_reqs, post_reqs; sstack define_spots; -extern bool want_beam; Paperdef*default_paper(); +char const* defined_ch_c_l; +char const* req_defined_ch_c_l; %} @@ -61,10 +62,10 @@ Paperdef*default_paper(); Text_def * textdef; } -%token VOICE STAFF SCORE TITLE BAR NOTENAME OUTPUT +%token VOICE STAFF SCORE TITLE BAR OUTPUT MULTIVOICE %token CM IN PT MM PAPER WIDTH METER UNITSPACE SKIP COMMANDS COMMAND %token GEOMETRIC START_T DURATIONCOMMAND OCTAVECOMMAND -%token KEY CLEF MULTI TABLE CHORD VOICES +%token KEY CLEF TABLE VOICES STEM %token PARTIAL MUSIC GROUPING CADENZA %token END SYMBOLTABLES TEXID TABLE NOTENAMES SCRIPT TEXTSTYLE PLET %token MARK GOTO @@ -72,25 +73,26 @@ Paperdef*default_paper(); %token IDENTIFIER %token PITCHMOD DURATION RESTNAME %token NOTENAME -%token REAL +%token REAL %token STRING %token DOTS INT %type unit -%type pitch_list +%type pitch_list %type open_request_parens close_request_parens %type declaration %type declarable_identifier %type paper_block paper_body -%type dim -%type duration +%type dim real +%type default_duration explicit_duration notemode_duration mudela_duration +%type notename %type duration_length %type voice_elt full_element lyrics_elt %type score_command staff_command position_command %type score_block score_body %type staff_block staff_init staff_body %type int -%type int_list +%type int_list intastint_list %type score_commands_block score_commands_body %type staff_commands_block staff_commands_body %type post_request pre_request @@ -115,8 +117,8 @@ Paperdef*default_paper(); %% mudela: /* empty */ - | mudela score_block { - add_score($2); + | mudela score_block { + add_score($2); } | mudela add_declaration { } | mudela mudela_command {} @@ -164,6 +166,13 @@ declaration: $$ = new Notetab_id(*$1, $3); delete $1; } + | declarable_identifier '=' real { + $$ = new Real_id(*$1, new Real($3)); + delete $1; + } + | declarable_identifier error '}' { + warning( "parse error", lexer->here_ch_c_l() ); + } ; notename_tab: @@ -192,10 +201,16 @@ score_block: SCORE $$->define_spot_str_ = define_spots.pop(); if (!$$->paper_) $$->paper_ = default_paper(); + + /* handle error levels. */ + $$->errorlevel_i_ = lexer->errorlevel_i_; + lexer->errorlevel_i_ = 0; } ; -score_body: { $$ = new Input_score; } +score_body: { + $$ = new Input_score; + } | score_body staff_block { $$->add($2); } | score_body score_commands_block { $$->add(*$2); @@ -208,6 +223,9 @@ score_body: { $$ = new Input_score; } */ score_commands_block: COMMANDS '{' score_commands_body '}' { $$ =$3;} + | COMMANDS '{' error '}' { + warning( "parse error", lexer->here_ch_c_l() ); + } ; score_commands_body: { $$ = new Array; } @@ -244,15 +262,6 @@ staff_command: } ; -duration_length: - duration { - $$ = new Moment(wholes($1[0], $1[1])); - } - |int '*' duration { - $$ = new Moment($1 * wholes($3[0], $3[1])); - } - ; - position_command: SKIP int ':' duration_length { $$ = get_skip_command($2, *$4); @@ -264,6 +273,14 @@ position_command: } ; + +intastint_list: + /* */ { $$ =new Array; } + | intastint_list int '*' int { + $$->push($2); $$->push($4); + } + ; + score_command: BAR STRING { $$ = get_bar_command(*$2); @@ -276,7 +293,7 @@ score_command: $$ = get_partial_command(*$2); delete $2; } - | GROUPING int_list { + | GROUPING intastint_list { $$ = get_grouping_command(*$2); delete $2; } @@ -307,6 +324,9 @@ paper_body: | paper_body symtables { $$->set($2); } | paper_body UNITSPACE dim { $$->whole_width = $3; } | paper_body GEOMETRIC REAL { $$->geometric_ = $3; } + | paper_body error { + warning( "parse error", lexer->here_ch_c_l() ); + } ; /* @@ -333,12 +353,16 @@ staff_init: staff_body: staff_init | staff_body music { + $2->set_default_group( "staff_music" + String($$->music_.size())); $$->add($2); } | staff_body staff_commands_block { $$->add(*$2); delete $2; } + | staff_body error { + warning( "parse error", lexer->here_ch_c_l() ); + } ; /* @@ -352,11 +376,12 @@ music: music_voice: MUSIC '{' music_voice_body '}' { $$ = $3; } ; -music_voice_body: { +music_voice_body: + /* */ { $$ = new Music_voice; } | music_voice_body IDENTIFIER { - $$->concatenate($2->mvoice()); + $$->concatenate($2->mvoice(true)); } | music_voice_body full_element { $$->add_elt($2); @@ -366,16 +391,23 @@ music_voice_body: { | music_voice_body music { $$->add($2); } + | music_voice_body error { + warning( "parse error", lexer->here_ch_c_l() ); + } ; music_chord: '{' music_chord_body '}' { $$ = $2; } ; -music_chord_body: { - $$ = new Music_general_chord; +music_chord_body: + /* */ { + $$ = new Voice_group_chord; + } + | MULTIVOICE { + $$ = new Multi_voice_chord; } | music_chord_body IDENTIFIER { - $$->concatenate($2->mchord()); + $$->concatenate($2->mchord(true)); } | music_chord_body music { $$ -> add($2); @@ -383,6 +415,9 @@ music_chord_body: { | music_chord_body full_element { $$ ->add_elt($2); } + | music_chord_body error { + warning( "parse error", lexer->here_ch_c_l() ); + } ; @@ -402,7 +437,15 @@ 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(); } + | STEM '{' int '}' { + $$ = get_stemdir_element($3); + } | lyrics_elt +/* ++ | pre_requests voice_elt post_requests error '|' { ++ warning( "parse error", lexer->here_ch_c_l() ); ++ } ++ */ ; post_requests: @@ -415,19 +458,34 @@ post_requests: ; post_request: - close_request_parens { $$ = get_request($1); } + close_request_parens { + $$ = get_request($1); + req_defined_ch_c_l = lexer->here_ch_c_l(); + } | script_req | textscript_req ; 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(); + } ; script_definition: @@ -446,7 +504,11 @@ textscript_req: ; mudela_text: - STRING { $$ = get_text(*$1); delete $1; } + STRING { + $$ = get_text(*$1); + delete $1; + defined_ch_c_l = lexer->here_ch_c_l(); + } ; script_req: @@ -464,7 +526,8 @@ mudela_script: | '>' { $$ = get_scriptdef('>'); } | '.' { $$ = get_scriptdef('.'); } | DOTS { - if ($1>1) error("too many staccato reqs"); + if ( $1 > 1 ) + warning( "too many staccato dots", lexer->here_ch_c_l() ); $$ = get_scriptdef('.'); } ; @@ -482,16 +545,21 @@ pre_requests: ; pre_request: - open_request_parens { $$ = get_request($1); } + open_request_parens { + $$ = get_request($1); + defined_ch_c_l = lexer->here_ch_c_l(); + } ; - - voice_command: PLET '{' INT '/' INT '}' { set_plet($3,$5); } - | DURATIONCOMMAND '{' duration '}' { + | DURATIONCOMMAND '{' STRING '}' { + set_duration_mode(*$3); + delete $3; + } + | DURATIONCOMMAND '{' notemode_duration '}' { set_default_duration($3); } | OCTAVECOMMAND '{' pitchmod '}' { @@ -504,11 +572,22 @@ voice_command: } ; -duration: { - get_default_duration($$); +duration_length: + mudela_duration { + $$ = new Moment(wholes($1[0], $1[1])); } - | int { - get_default_duration($$); + |int '*' mudela_duration { + $$ = new Moment(Rational($1) * wholes($3[0], $3[1])); + } + ; + +notemode_duration: + explicit_duration + | default_duration + ; + +mudela_duration: + int { $$[0] = $1; $$[1] = 0; } @@ -516,22 +595,52 @@ duration: { $$[0] = $1; $$[1] = $2; } + ; + + +explicit_duration: + INT { + last_duration($1); + $$[0] = $1; + $$[1] = 0; + } + | INT DOTS { + last_duration($1); + $$[0] = $1; + $$[1] = $2; + } | DOTS { get_default_duration($$); $$[1] = $1; } ; -pitchmod: { $$ = new String; } - |PITCHMOD +default_duration: + { + get_default_duration($$); + } + ; + +pitchmod: { + $$ = new String; + defined_ch_c_l = lexer->here_ch_c_l(); + } + | PITCHMOD { + $$ = $1; + defined_ch_c_l = lexer->here_ch_c_l(); + } + ; + +notename: + NOTENAME ; voice_elt: - pitchmod NOTENAME duration { + pitchmod notename notemode_duration { $$ = get_note_element(*$1, $2, $3); delete $1; } - | RESTNAME duration { + | RESTNAME notemode_duration { $$ = get_rest_element(*$1, $2); delete $1; @@ -539,7 +648,7 @@ voice_elt: ; lyrics_elt: - mudela_text duration { + mudela_text notemode_duration { $$ = get_word_element($1, $2); }; @@ -556,16 +665,27 @@ pitch_list: { ; int: - REAL { + real { $$ = int($1); if ( distance($1,Real(int($$)) ) > 1e-8) - error("expecting integer number"); + error( "integer expected", lexer->here_ch_c_l() ); } - | INT ; -int_list: - /* */ { +real: + INT { + $$ = Real($1); + } + | REAL { + $$ = $1; + } + | IDENTIFIER { + $$ = * $1->real(0); + } + ; + + +int_list: { $$ = new Array; } | int_list int { @@ -573,8 +693,9 @@ int_list: } ; + dim: - REAL unit { $$ = convert_dimen($1,$2); } + real unit { $$ = convert_dimen($1,$2); } ; @@ -650,7 +771,7 @@ dinterval: dim dim { %% void -parse_file(String s) +parse_file(String init, String s) { *mlog << "Parsing ... "; lexer = new My_flex_lexer; @@ -660,7 +781,7 @@ parse_file(String s) lexer->set_debug( !monitor.silence("InitLexer") && check_debug); #endif - lexer->new_input("symbol.ini"); + lexer->new_input(init); yyparse(); #ifdef YYDEBUG diff --git a/src/register.cc b/src/register.cc index 4391855b13..d9d3e8a41b 100644 --- a/src/register.cc +++ b/src/register.cc @@ -11,14 +11,15 @@ Staff_elem_info::Staff_elem_info(Staff_elem*s_l, Request*r_l, elem_p_ = s_l; voice_l_ = r_l->elt_l_->voice_l_; req_l_ = r_l; - group = 0; + group_regs_l_ = 0; origin_reg_l_ = reg_l; } Staff_elem_info::Staff_elem_info() { elem_p_ = 0; voice_l_ = 0; - group = 0; + + group_regs_l_ = 0; origin_reg_l_ = 0; req_l_ = 0; } @@ -86,7 +87,7 @@ Local_key_register::acknowledge_element(Staff_elem_info info) if (!key_item_p_) { - key_item_p_ = new Local_key_item(-2); + key_item_p_ = new Local_key_item(walk_l_->clef_.c0_pos); key_item_p_->c0_position = walk_l_->clef_.c0_pos; } diff --git a/src/request.cc b/src/request.cc index 323932a6a9..3be4f8260e 100644 --- a/src/request.cc +++ b/src/request.cc @@ -9,12 +9,14 @@ void Stem_req::do_print() const { - Rhythmic_req::do_print(); + Rhythmic_req::do_print(); + mtor << "dir : " << dir_i_; } Stem_req::Stem_req(int s, int d) : Rhythmic_req(s,d) { + dir_i_ = 0; } /****************/ @@ -56,10 +58,12 @@ Span_req::do_print() const Request::Request() { elt_l_ = 0; + defined_ch_c_l_m = 0; } Request::Request(Request const&) { elt_l_ = 0; + defined_ch_c_l_m = 0; } /****************/ Melodic_req::Melodic_req() @@ -168,32 +172,64 @@ Span_req::Span_req() spantype = NOSPAN; } /****************/ +void +Group_feature_req::do_print() const +{ + mtor << "stemdir " << stemdir_i_; +} +Group_feature_req::Group_feature_req() +{ + stemdir_i_ = 0; +} +void +Group_change_req::do_print()const +{ + mtor << "id : " << newgroup_str_; +} +void +Terminate_voice_req::do_print()const +{ +} +/****************/ Script_req::Script_req(int d , Script_def*def) { - dir = d; - scriptdef = def; + dir_i_ = d; + scriptdef_p_ = def; +} + +int +Script_req::compare(const Script_req &d1, const Script_req &d2) +{ + return d1.dir_i_ == d2.dir_i_ && + d1.scriptdef_p_->compare(*d2.scriptdef_p_); } Script_req::Script_req(Script_req const &s) { - dir = s.dir; - scriptdef = new Script_def(*s.scriptdef); + dir_i_ = s.dir_i_; + scriptdef_p_ = new Script_def(*s.scriptdef_p_); } void Script_req::do_print() const { - mtor << " dir " << dir ; - scriptdef->print(); + mtor << " dir " << dir_i_ ; + scriptdef_p_->print(); } Script_req::~Script_req() { - delete scriptdef; + delete scriptdef_p_; } /****************/ - +int +Text_req:: compare(const Text_req &r1, const Text_req &r2) +{ + bool b1 = (r1.dir_i_ == r2.dir_i_); + bool b2 = (r1.tdef_p_ ->compare(*r2.tdef_p_)); + return b1 && b2; +} Text_req::~Text_req() { delete tdef_p_; diff --git a/src/score.cc b/src/score.cc index edd26aaf7b..feb7db93e7 100644 --- a/src/score.cc +++ b/src/score.cc @@ -160,6 +160,7 @@ Score::Score(Paperdef*p) { pscore_p_=0; paper_p_ = p; // ?? safe? + errorlevel_i_ = 0; } Score::~Score() @@ -175,6 +176,12 @@ Score::output(String s) if (paper_p_->outfile=="") paper_p_->outfile = s; + if ( errorlevel_i_ ) { + *mlog << "lilypond: warning: no output to: " << paper_p_->outfile + << " (errorlevel=" << errorlevel_i_ << ")" << endl; + return; + } + *mlog << "output to " << paper_p_->outfile << "...\n"; Tex_stream the_output(paper_p_->outfile); diff --git a/src/scores.cc b/src/scores.cc index 6ebbf18a17..06a401fd82 100644 --- a/src/scores.cc +++ b/src/scores.cc @@ -28,6 +28,16 @@ add_score(Input_score * s) score_array_global.push(s); } +#if 0 +Input_score* +current_iscore_l() +{ + if ( score_array_global.size() ) + return score_array_global.last(); // UGH + else + return 0; +} +#endif void set_default_output(String s) diff --git a/src/script.cc b/src/script.cc index a6c3ee8039..f9155ea0c4 100644 --- a/src/script.cc +++ b/src/script.cc @@ -24,11 +24,11 @@ Script::set_support(Item*i) Script::Script(Script_req* rq, int staflen) { staffsize =staflen; - specs_l_ = rq->scriptdef; + specs_l_ = rq->scriptdef_p_; stem_l_ = 0; pos = 0; symdir=1; - dir =rq->dir; + dir =rq->dir_i_; } void diff --git a/src/scriptdef.cc b/src/scriptdef.cc index cc7d70087e..1e11de72c2 100644 --- a/src/scriptdef.cc +++ b/src/scriptdef.cc @@ -14,3 +14,11 @@ Script_def::print() const mtor << "idx: " << symidx; mtor << "direction, stem: " << stemdir << " staff : " << staffdir; } +int +Script_def::compare(Script_def const & c) +{ + return (symidx == c.symidx && + stemdir == c.stemdir&& + staffdir == c.staffdir&& + invertsym == c.invertsym); +} diff --git a/src/simplestaff.cc b/src/simplestaff.cc index 20f291fa8a..30ef3e84e1 100644 --- a/src/simplestaff.cc +++ b/src/simplestaff.cc @@ -37,7 +37,8 @@ Simple_column::setup_requests() Request *rq= j; if (rq->barcheck()) { if (tdescription_->whole_in_measure) { - error("Barcheck failed, " + tdescription_->str()); +// error("Barcheck failed, " + tdescription_->str()); + error( "Barcheck failed", rq->defined_ch_c_l_m ); } } if (rq->rhythmic()){ diff --git a/src/simplewalker.cc b/src/simplewalker.cc index 05bc76c9b6..f99d9f5213 100644 --- a/src/simplewalker.cc +++ b/src/simplewalker.cc @@ -20,36 +20,39 @@ #include "slur.hh" #include "localkeyitem.hh" #include "textitem.hh" - +#include "misc.hh" Rhythmic_grouping -parse_grouping(Array a, Moment one_beat) +parse_grouping(Array const &a) { Array r; - for (int i= 0 ; i < a.size(); i++) - r.push(a[i]); - Moment here =0.0; + Array grouplen_arr; + for (int i= 0 ; i < a.size()/2; ) { + r.push(a[i++]); + grouplen_arr.push(Moment(1,(int) a[i++])); + } + Moment here =0; Array children; for (int i=0; i < r.size(); i++) { Moment last = here; - here += one_beat * r[i]; + here += grouplen_arr[i] * Rational(r[i]); children.push( - new Rhythmic_grouping(MInterval(last, here), r[i] ) - ); + new Rhythmic_grouping(MInterval(last, here), r[i] )); } return Rhythmic_grouping(children); } + + void Simple_walker::do_INTERPRET_command(Command*com) { Array args(com->args); args.del(0); if (com->args[0] == "GROUPING") { - default_grouping = parse_grouping(args, - col()->tdescription_->one_beat); + default_grouping = parse_grouping(args); }else if (com->args[0] == "NEWMEASURE") { local_key_.reset(key_); @@ -178,8 +181,7 @@ Simple_walker::process_requests() if (c->beam_ && c->beam_->spantype == Span_req::START) { if (beam_) - error("Too many beams (t = " - +String(c->when())+")"); + error("Too many beams (t = " +String(c->when())+")"); beam_ = new Beam; assert(!current_grouping); current_grouping = new Rhythmic_grouping; @@ -190,7 +192,7 @@ Simple_walker::process_requests() if (sl->spantype == Span_req::START) { if (find_slur(sl->elt_l_->voice_l_)>=0) - error_t("Too many slurs in voice", *col()->tdescription_); + error( "Too many slurs in voice", sl->defined_ch_c_l_m ); pending_slur_reqs.push(sl); pending_slurs.push(new Slur); } @@ -225,7 +227,7 @@ Simple_walker::process_requests() if (c->beam_&& c->beam_->spantype == Span_req::STOP) { if (!beam_) { - error_t("No beam to end", *col()->tdescription_); + error( "No beam to end", c->beam_->defined_ch_c_l_m ); } default_grouping.extend(current_grouping->interval()); beam_->set_grouping(default_grouping, *current_grouping); @@ -261,7 +263,7 @@ Simple_walker::process_requests() if (sl->spantype == Span_req::STOP) { int idx = find_slur(sl->elt_l_->voice_l_); if (idx < 0) - error_t("can't find slur to end; ", *c->tdescription_); + error( "can't find slur end", sl->defined_ch_c_l_m ); pscore_l_->typeset_spanner(pending_slurs[idx], s->theline_l_); diff --git a/src/source.cc b/src/source.cc new file mode 100644 index 0000000000..dbdc501a4d --- /dev/null +++ b/src/source.cc @@ -0,0 +1,36 @@ +// +// source.cc +// + +#include + +#include "string.hh" +#include "proto.hh" +#include "plist.hh" + +#include "sourcefile.hh" +#include "source.hh" + +Source::Source() +{ +} + +Source::~Source() +{ +} + +void +Source::add( Source_file* sourcefile_p ) +{ + sourcefile_p_iplist_m.bottom().add( sourcefile_p ); +} + +Source_file* +Source::sourcefile_l( char const* ch_c_l ) +{ + PCursor sourcefile_p_pcur( sourcefile_p_iplist_m.top() ); + for ( ; sourcefile_p_pcur.ok(); sourcefile_p_pcur++ ) + if ( sourcefile_p_pcur->in_b( ch_c_l ) ) + return *sourcefile_p_pcur; + return 0; +} diff --git a/src/sourcefile.cc b/src/sourcefile.cc new file mode 100644 index 0000000000..4792483056 --- /dev/null +++ b/src/sourcefile.cc @@ -0,0 +1,176 @@ +// +// sourcefile.cc +// + +#include // open, mmap +#include // open +#include // mmap +#include // INT_MAX +#include // open +#include // close, stat +#include // fdopen +#include // strerror +#include // errno +#include +#include + +#include "string.hh" +#include "proto.hh" +#include "plist.hh" +#include "main.hh" // find_file + +#include "sourcefile.hh" + +Source_file::Source_file( String &filename_str ) +{ + data_caddr_m = 0; + fildes_i_m = 0; + size_off_m = 0; + name_str_m = filename_str; + istream_p_m = 0; + + open(); + map(); + filename_str = name_str_m; +} + +Source_file::~Source_file() +{ + delete istream_p_m; + istream_p_m = 0; + unmap(); + close(); +} + +char const* +Source_file::ch_c_l() +{ + return (char const*)data_caddr_m; +} + +void +Source_file::close() +{ + if ( fildes_i_m ) { + ::close( fildes_i_m ); + fildes_i_m = 0; + } +} + +String +Source_file::error_str( char const* pos_ch_c_l ) +{ + if ( !in_b( pos_ch_c_l ) ) + return ""; + + char const* begin_ch_c_l = pos_ch_c_l; + char const* data_ch_c_l = ch_c_l(); + while ( begin_ch_c_l > data_ch_c_l ) + if ( *--begin_ch_c_l == '\n' ) { + begin_ch_c_l++; + break; + } + + char const* end_ch_c_l = pos_ch_c_l; + while ( end_ch_c_l < data_ch_c_l + size_off_m ) + if ( *end_ch_c_l++ == '\n' ) { + break; + } + end_ch_c_l--; + +// String( char const* p, int size ) 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; + String line_str( ch_p ); + delete ch_p; + + int error_col_i = 0; + char const* scan_ch_c_l = begin_ch_c_l; + while ( scan_ch_c_l < pos_ch_c_l ) + if ( *scan_ch_c_l++ == '\t' ) + error_col_i = ( error_col_i / 8 + 1 ) * 8; + else + error_col_i++; + + String str = line_str.left( pos_ch_c_l - begin_ch_c_l ) + + String( '\n' ) + + String( ' ', error_col_i ) + + line_str.mid( pos_ch_c_l - begin_ch_c_l + 1, INT_MAX ); // String::mid should take 0 arg.. + return str; +} + +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 ); +} + +istream* +Source_file::istream_l() +{ + assert( fildes_i_m ); + if ( !istream_p_m ) + istream_p_m = new istrstream( ch_c_l(), size_off_m ); + return istream_p_m; +} + +int +Source_file::line_i( char const* pos_ch_c_l ) +{ + if ( !in_b( pos_ch_c_l ) ) + return 0; + + int i = 0; + char const* scan_ch_c_l = ch_c_l(); + while ( scan_ch_c_l < pos_ch_c_l ) + if ( *scan_ch_c_l++ == '\n' ) + i++; + return i; +} + +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 ); + + if ( (int)data_caddr_m == -1 ) { + cerr << "lilypond: can't map: " << name_str_m << ": " << strerror( errno ) << endl; + assert( 0 ); + } +} + +String +Source_file::name_str() +{ + return name_str_m; +} + +void +Source_file::open() +{ + name_str_m = find_file( name_str_m ); + fildes_i_m = ::open( name_str_m, O_RDONLY ); + + if ( fildes_i_m == -1 ) { + cerr << "lilypond: can't open: " << name_str_m << ": " << strerror( errno ) << endl; + assert( 0 ); + } + + struct stat file_stat; + fstat( fildes_i_m, &file_stat ); + size_off_m = file_stat.st_size; +} + +void +Source_file::unmap() +{ + if ( data_caddr_m ) { + munmap( data_caddr_m, size_off_m ); + data_caddr_m = 0; + size_off_m = 0; + } +} diff --git a/src/staff.cc b/src/staff.cc index df46046c14..d6ddda8f3b 100644 --- a/src/staff.cc +++ b/src/staff.cc @@ -142,7 +142,8 @@ Staff::setup_staffcols() Staff_column *s_l=get_col(now,true); s_l->add(j); now += j->duration; - } + } + } set_time_descriptions(); } diff --git a/src/staffcommands.cc b/src/staffcommands.cc index d1bbc45c42..517e7d1dd7 100644 --- a/src/staffcommands.cc +++ b/src/staffcommands.cc @@ -70,9 +70,11 @@ Staff_commands_at::insert_between(Command victim, PCursor firstc, PCursor last) { PCursor c(firstc+1); - assert(firstc < last&&last.ok()); +// assert(firstc < last&&last.ok()); + assert(firstc->code < last->code && last.ok()); - while (c < last) { +// while (c < last) { + while (c->code < last->code ) { if (c->priority <= victim.priority) { c.insert(new Command(victim)); return; diff --git a/src/stem.cc b/src/stem.cc index 2e602c1cae..2e0d55474e 100644 --- a/src/stem.cc +++ b/src/stem.cc @@ -39,7 +39,8 @@ Stem::set_stemend(Real se) { // todo: margins - assert((dir > 0 && se >= maxnote) || (se <= minnote && dir <0)); + if (! ((dir > 0 && se >= maxnote) || (se <= minnote && dir <0)) ) + WARN << "Weird stem size; check for narrow beams.\n"; top = (dir < 0) ? maxnote : se; bot = (dir < 0) ? se : minnote; @@ -63,13 +64,19 @@ Stem::add(Notehead *n) } +int +Stem::get_default_dir() +{ + if (dir) + return dir; + Real mean = (minnote+maxnote)/2; + return (mean > staff_center) ? -1: 1; +} void Stem::set_default_dir() { - Real mean = (minnote+maxnote)/2; - dir = (mean > staff_center) ? -1: 1; + dir = get_default_dir(); } - void Stem::set_default_stemlen() { diff --git a/src/table.cc b/src/table.cc deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/template3.cc b/src/template3.cc index 106260039a..bc7e4885a3 100644 --- a/src/template3.cc +++ b/src/template3.cc @@ -7,6 +7,7 @@ #include "inputcommands.hh" #include "molecule.hh" #include "staffcommands.hh" +#include "sourcefile.hh" #include "plist.tcc" @@ -19,3 +20,4 @@ IPL_instantiate(Commands_at); IPL_instantiate(Staff_commands_at); IPL_instantiate(Input_staff); IPL_instantiate(Input_music); +IPL_instantiate(Source_file); diff --git a/src/template4.cc b/src/template4.cc index c3b25320be..69f7513390 100644 --- a/src/template4.cc +++ b/src/template4.cc @@ -1,3 +1,4 @@ +#include "proto.hh" #include "list.tcc" #include "cursor.tcc" diff --git a/src/template6.cc b/src/template6.cc index c3867aeeb0..880a5fb6e0 100644 --- a/src/template6.cc +++ b/src/template6.cc @@ -5,3 +5,4 @@ #include "plist.tcc" IPL_instantiate(Voice_registers); +IPL_instantiate(Voice_group_registers); diff --git a/src/texbeam.cc b/src/texbeam.cc index 4c59ce3263..a3b38dde9e 100644 --- a/src/texbeam.cc +++ b/src/texbeam.cc @@ -34,7 +34,7 @@ static int slope_index(Real &s) { if (abs(s) > 0.5) { - WARN << "beam steeper than 0.5"; + WARN << "beam steeper than 0.5\n"; s = sign(s) * 0.5; } diff --git a/src/texslur.cc b/src/texslur.cc index a58a2cf94c..a3a29db444 100644 --- a/src/texslur.cc +++ b/src/texslur.cc @@ -50,7 +50,7 @@ Lookup::half_slur_middlepart(Real &dx, int dir) idx += 128; - f+=String( "{" ) + idx + "}"; + f+=String( "{" ) + String( idx ) + "}"; s.tex = f; Atom a(s); a.translate(Offset(dx/2,0)); @@ -99,7 +99,7 @@ Lookup::half_slur(int dy, Real &dx, int dir, int xpart) if (xpart < 0) idx += 128; - f+=String( "{" ) + idx + "}"; + f+=String( "{" ) + String( idx ) + "}"; s.tex = f; @@ -144,7 +144,7 @@ Lookup::slur (int dy , Real &dx, int dir) s.dim.x = Interval(0,dx); s.dim.y = Interval(min(0,dy), max(0,dy)); - String f = String("\\slurchar") + direction_char(y_sign); + String f = String("\\slurchar") + String( direction_char(y_sign) ); int idx=-1; if (y_sign) { @@ -159,7 +159,7 @@ Lookup::slur (int dy , Real &dx, int dir) idx += 54; } - f+=String( "{" ) + idx + "}"; + f+=String( "{" ) + String( idx ) + "}"; s.tex = f; Atom a(s); diff --git a/src/textdef.cc b/src/textdef.cc index e3829c65db..5dd44d91a1 100644 --- a/src/textdef.cc +++ b/src/textdef.cc @@ -8,6 +8,13 @@ Text_def::Text_def() { align_i_ = 1; // right style_str_ = "roman"; + defined_ch_c_l_m = 0; +} +bool +Text_def::compare(const Text_def&def) +{ + return align_i_ == def.align_i_ && text_str_ == def.text_str_ + && style_str_ == def.style_str_; } Atom diff --git a/src/timedescription.cc b/src/timedescription.cc index 275a47f0d9..cabaeb00cf 100644 --- a/src/timedescription.cc +++ b/src/timedescription.cc @@ -4,9 +4,12 @@ String Time_description::str()const { String s( "Time_description { "); - s+=String( " cadenza: ") + cadenza_b_ + " at "; + if (cadenza_b_) + s+=String( " (cadenza) "); + s+= "at "; s+=when; - s+="\nmeter " + String(whole_per_measure/one_beat) +":" +(1/one_beat); + s+="\nmeter " + String(whole_per_measure/one_beat) +":" + + String(Rational(1/one_beat)); s+= "\nposition "+String( bars) + ":"+ whole_in_measure +"\n}\n"; return s; } @@ -42,7 +45,7 @@ Time_description::set_cadenza(bool b) Time_description::Time_description(Moment dt, Time_description const *prev) { if (prev) { - assert(dt >= 0); + assert(dt >= Rational(0)); *this = *prev; when += dt; whole_in_measure += dt; @@ -65,7 +68,7 @@ void Time_description::set_meter(int l, int o) { assert(o); - one_beat = 1/Moment(o); + one_beat = Rational(1)/Moment(o); whole_per_measure = Moment(l) * one_beat; if(whole_in_measure) error_t("Meterchange should be at start of measure", *this); @@ -76,7 +79,7 @@ Time_description::setpartial(Moment p) { if (when) error_t ("Partial measure only allowed at beginning.", *this); - if (p<0||p > whole_per_measure) + if (p whole_per_measure) error_t ("Partial measure has incorrect size", *this); whole_in_measure = whole_per_measure - p; } diff --git a/src/voice.cc b/src/voice.cc index 818e723b42..2e7b0b5111 100644 --- a/src/voice.cc +++ b/src/voice.cc @@ -2,6 +2,12 @@ #include "voice.hh" #include "request.hh" +void +Voice::set_default_group(String s) +{ + elts.top()->set_default_group(s); +} + Voice::Voice(Voice const&src) { for (iter_top(src.elts, i); i.ok(); i++) @@ -71,14 +77,26 @@ Voice_element::add(Request*r) Voice_element::Voice_element() { voice_l_ = 0; -// group = 0; - duration = 0.0; + duration = 0; + defined_ch_c_l_m = 0; } Voice_element::Voice_element(Voice_element const&src) { + defined_ch_c_l_m = src.defined_ch_c_l_m; + // are you sure? They can be modified after copying. voice_l_=0; for (iter_top(src.reqs, i); i.ok(); i++) add(i->clone()); -// group=src.group; + +} +void +Voice_element::set_default_group(String s) +{ + for (iter_top(reqs, i); i.ok(); i++) + if (i->groupchange()) + return ; + Group_change_req *greq = new Group_change_req; + greq->newgroup_str_ = s; + add(greq); } diff --git a/src/voicegroup.cc b/src/voicegroup.cc index 5dfe5a8a27..f3088d73e2 100644 --- a/src/voicegroup.cc +++ b/src/voicegroup.cc @@ -4,51 +4,61 @@ #include "voicegroup.hh" #include "register.hh" -Voice_group_registers::Voice_group_registers(Complex_walker*w_l) - : //text_reg_(w_l), - stem_beam_reg_(w_l) -//, script_reg_(w_l), - // stem_reg_(w_l) +static int temp_id_count; + +Voice_group_registers::Voice_group_registers(Complex_walker*w_l, String id) + : text_reg_(w_l), + stem_beam_reg_(w_l), + script_reg_(w_l) { walk_l_ = w_l; + if (id=="") + id = __FUNCTION__ + String(temp_id_count++); + group_id_str_ = id; + dir_i_ = 0; } void Voice_group_registers::pre_move_processing() { stem_beam_reg_.pre_move_processing(); -// script_reg_.pre_move_processing(); -// text_reg_.pre_move_processing(); + script_reg_.pre_move_processing(); + text_reg_.pre_move_processing(); } + void Voice_group_registers::post_move_processing() { stem_beam_reg_.post_move_processing(); + text_reg_.post_move_processing(); + script_reg_.post_move_processing(); } + bool Voice_group_registers::try_request(Request*r_l) { + if (r_l->groupfeature()) { + dir_i_ = r_l->groupfeature()->stemdir_i_; + return true; + } bool b = stem_beam_reg_.try_request(r_l); -/* if (!b) - b|= beam_reg_.try_request(r_l); if (!b) b|= script_reg_.try_request(r_l); if (!b) b|= text_reg_.try_request(r_l); - */ + return b; } void Voice_group_registers::announce_element(Staff_elem_info i) { -/* - if (i.group_regs_l_!= this) + if (i.group_regs_l_!= this) return; - */ + stem_beam_reg_.acknowledge_element(i); -// text_reg_.announce_element(i); - // script_reg_.announce_element(i); + script_reg_.acknowledge_element(i); + text_reg_.acknowledge_element(i); } @@ -56,5 +66,17 @@ void Voice_group_registers::process_requests() { stem_beam_reg_.process_request(); + if (dir_i_) + stem_beam_reg_.set_dir (dir_i_); + + script_reg_.process_request(); + text_reg_.process_request(); } + +bool +Voice_group_registers::acceptable_request(Request*r) +{ + return (r->stem() || r->beam() || r->text() || r->script() || + r->groupfeature()); +} diff --git a/src/voiceregs.cc b/src/voiceregs.cc index b13fd01652..a70a01a419 100644 --- a/src/voiceregs.cc +++ b/src/voiceregs.cc @@ -53,12 +53,18 @@ Voice_registers::process_requests() slur_reg_.process_request(); } +bool +Voice_registers::acceptable_request(Request*r) +{ + return (r->rest() || r->note() || r->slur()); + +} /****************/ Notehead_register::Notehead_register(Complex_walker*w_l) :Request_register(w_l) { - note_l_ = 0; + note_p_ = 0; } bool @@ -75,34 +81,36 @@ Notehead_register::try_request(Request *req_l) void Notehead_register::process_request() { + if (!accepted_req_arr_.size()) + return; + Request* req_l = accepted_req_arr_.last(); if (req_l->note()) { Notehead*n_p = new Notehead(8); // ugh - note_l_ = n_p; + note_p_ = n_p; n_p->set_rhythmic(req_l->rhythmic()); n_p->position = req_l->note()->height() + -2; } else { - note_l_ = new Rest ( req_l->rhythmic()->balltype, + note_p_ = new Rest ( req_l->rhythmic()->balltype, req_l->rhythmic()->dots); if (req_l->rhythmic()->balltype <= 2) - note_l_->translate( + note_p_->translate( Offset(0, - 5 * walk_l_->staff()->paper()->internote())); + 6 * walk_l_->staff()->paper()->internote())); } - Staff_elem_info itinf(note_l_,req_l,this); + Staff_elem_info itinf(note_p_,req_l,this); walk_l_->announce_element(itinf); } void Notehead_register::do_pre_move_process() { - if (note_l_) { - walk_l_->typeset_element(note_l_); - note_l_ = 0; + if (note_p_) { + walk_l_->typeset_element(note_p_); + note_p_ = 0; } } -/****************/ /****************/ Slur_register::Slur_register(Complex_walker* w) @@ -131,21 +139,29 @@ Slur_register::acknowledge_element(Staff_elem_info info) end_slur_l_arr_[i]->add(head_p); } } - +/* + abracadabra + */ void Slur_register::process_request() { Array start_slur_l_arr_; for (int i=0; i< accepted_req_arr_.size(); i++) { Slur_req* slur_req_l = accepted_req_arr_[i]->slur(); + // end slur: move the slur to other array if (slur_req_l->spantype == Span_req::STOP) { if (slur_l_stack_.empty()) - error_t("can't find slur to end; ", - *walk_l_->col()->tdescription_); - end_slur_l_arr_.push(slur_l_stack_.pop()); - + 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()); + requests_arr_.pop(); + } } else if (slur_req_l->spantype == Span_req::START) { + // push a new slur onto stack. + //(use temp. array to wait for all slur STOPs) Slur * s_p =new Slur; + requests_arr_.push(slur_req_l); start_slur_l_arr_.push(s_p); walk_l_->announce_element(Staff_elem_info(s_p, slur_req_l, this)); } @@ -164,6 +180,7 @@ Slur_register::do_pre_move_process() Slur_register::~Slur_register() { - if (slur_l_stack_.size()) - error("unterminated slur"); + for (int i=0; i < requests_arr_.size(); i++) { + warning("unterminated slur: ", requests_arr_[i]->defined_ch_c_l_m); + } } diff --git a/src/warn.cc b/src/warn.cc index b44471201b..8328f64fb7 100644 --- a/src/warn.cc +++ b/src/warn.cc @@ -2,6 +2,11 @@ #include "lexer.hh" #include "moment.hh" #include "timedescription.hh" +#include "proto.hh" +#include "plist.hh" +#include "sourcefile.hh" +#include "source.hh" +#include "main.hh" ostream &warnout (cerr); ostream *mlog(&cerr); @@ -32,10 +37,39 @@ error_t(const String& s, const Moment& r) error(e); } - void error_t(const String& s, Time_description const &t_tdes) { - String e=s+ " (at t=" + t_tdes.bars + ": " + t_tdes.whole_in_measure + ")\n"; + String e=s+ " (at t=" + String(t_tdes.bars) + ": " + String(t_tdes.whole_in_measure) + ")\n"; error(e); } + +void +message( String message_str, char const* context_ch_c_l ) +{ + String str = "lilypond: "; + Source_file* sourcefile_l = source_l->sourcefile_l( context_ch_c_l ); + if ( sourcefile_l ) { + str += sourcefile_l->name_str() + ": "; + str += String( sourcefile_l->line_i( context_ch_c_l ) ) + ": "; + } + str += message_str; + if ( sourcefile_l ) { + str += "\n"; + str += sourcefile_l->error_str( context_ch_c_l ); + } + cerr << endl << str << endl; +} + +void +warning( String message_str, char const* context_ch_c_l ) +{ + message( "warning: " + message_str, context_ch_c_l ); +} + +void +error( String message_str, char const* context_ch_c_l ) +{ + message( message_str, context_ch_c_l ); + exit( 1 ); +} diff --git a/src/windhoos-suck-suck-suck-thank-you-cygnus.cc b/src/windhoos-suck-suck-suck-thank-you-cygnus.cc new file mode 100644 index 0000000000..8ed1d6b990 --- /dev/null +++ b/src/windhoos-suck-suck-suck-thank-you-cygnus.cc @@ -0,0 +1,48 @@ +// +// windhoos.cc +// +#ifdef _WIN32 + +#include +#include + +/* +HANDLE CreateFileMapping( + HANDLE hFile, // handle to file to map + LPSECURITY_ATTRIBUTES lpFileMappingAttributes, // optional security attributes + DWORD flProtect, // protection for mapping object + DWORD dwMaximumSizeHigh, // high-order 32 bits of object size + DWORD dwMaximumSizeLow, // low-order 32 bits of object size + LPCTSTR lpName // name of file-mapping object + ); + + +LPVOID MapViewOfFile( + HANDLE hFileMappingObject, // file-mapping object to map into address space + DWORD dwDesiredAccess, // access mode + DWORD dwFileOffsetHigh, // high-order 32 bits of file offset + DWORD dwFileOffsetLow, // low-order 32 bits of file offset + DWORD dwNumberOfBytesToMap // number of bytes to map + ); + +*/ + +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, + 0, len, 0 ); + return (caddr_t)MapViewOfFile( file_handle, addr, 0, offset, len ); +} + + +int +munmap(caddr_t addr, size_t len) +{ + (void)len; + return UnmapViewOfFile( addr ); +} + +#endif // _WIN32 // diff --git a/standchen.tex b/standchen.tex deleted file mode 100644 index 5ef590b060..0000000000 --- a/standchen.tex +++ /dev/null @@ -1,13 +0,0 @@ -\documentclass{article} %UGH -\usepackage{a4} -\begin{document} -\input lilyponddefs -\input titledefs -\def\interscoreline{\vskip12pt} -\title{St\"andchen} -\composer{Franz Schubert} -\instrument{M\"a\ss ig} % heu -%#%\tempo{M\"a\ss ig} -\maketit -\input standchen.uit -\end{document}