From 37a590823d3e84d379493e0e9f54952d67a67c05 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Fri, 31 Jan 1997 18:34:06 +0100 Subject: [PATCH] release: 0.0.26 --- .dstreamrc | 4 +- Documentation/Makefile | 2 +- Documentation/faq.pod | 19 +- Documentation/lelie_logo.png | Bin 0 -> 10285 bytes Documentation/lilygut.pod | 12 +- Initial.make | 4 +- Makefile | 4 +- NEWS | 12 ++ Sources.make | 22 ++- TODO | 35 ++-- Variables.make | 8 +- configure | 16 +- deps/Makefile | 6 +- flower/Makefile | 2 +- flower/Variables.make | 4 +- flower/assoc.hh | 2 +- flower/path.hh | 2 +- flower/smat.cc | 4 +- flower/sstack.hh | 1 - flower/textdb.cc | 2 +- flower/varray.hh | 2 +- hdr/accidental.hh | 3 +- hdr/bar.hh | 1 + hdr/beam.hh | 3 +- hdr/clefitem.hh | 1 + hdr/complexstaff.hh | 53 ++++++ hdr/complexwalker.hh | 65 +++++++ hdr/debug.hh | 2 +- hdr/grouping.hh | 5 +- hdr/item.hh | 6 +- hdr/keyitem.hh | 1 + hdr/localkeyitem.hh | 8 +- hdr/lyriccolumn.hh | 8 +- hdr/lyricwalker.hh | 2 +- hdr/melodicstaff.hh | 2 +- hdr/meter.hh | 1 + hdr/notehead.hh | 8 +- hdr/parseconstruct.hh | 3 - hdr/proto.hh | 64 ++++--- hdr/register.hh | 150 +++++++++++++++ hdr/request.hh | 101 +++++------ hdr/rest.hh | 8 +- hdr/rhythmstaff.hh | 2 +- hdr/script.hh | 15 +- hdr/simplestaff.hh | 5 +- hdr/simplewalker.hh | 6 +- hdr/slur.hh | 4 +- hdr/spanner.hh | 11 +- hdr/staff.hh | 2 + hdr/staffelem.hh | 9 +- hdr/staffwalker.hh | 7 +- hdr/stcol.hh | 2 +- hdr/stem.hh | 12 +- hdr/textitem.hh | 1 + hdr/textspanner.hh | 8 +- hdr/voice.hh | 11 +- input/Makefile | 2 +- input/maartje.ly | 8 +- input/pavane.ly | 63 +++---- input/scales.ly | 4 +- input/{standchen.lily => standchen.ly} | 0 input/twinkle.ly | 8 +- ltest.tex | 15 ++ src/bar.cc | 7 +- src/beam.cc | 17 +- src/break.cc | 4 +- src/clefitem.cc | 3 + src/complexmelodicstaff.cc | 31 ++++ src/complexprint.cc | 98 ++++++++++ src/complexstaff.cc | 58 ++++++ src/complexwalker.cc | 241 +++++++++++++++++++++++++ src/getcommands.cc | 22 +-- src/grouping.cc | 45 ++--- src/groupregs.cc | 131 ++++++++++++++ src/inputcommand.cc | 50 ++--- src/inputscore.cc | 2 +- src/inputstaff.cc | 10 +- src/item.cc | 8 +- src/key.cc | 8 +- src/keyitem.cc | 6 +- src/lexer.l | 42 ++--- src/lexerinit.cc | 16 -- src/linespace.cc | 8 +- src/localkeyitem.cc | 32 +++- src/lookup.cc | 12 +- src/lyriccolumn.cc | 15 +- src/lyricstaff.cc | 7 +- src/lyricwalker.cc | 4 +- src/main.cc | 6 +- src/melodicstaff.cc | 23 +-- src/meter.cc | 2 +- src/molecule.cc | 6 +- src/mylexer.cc | 3 - src/note.cc | 12 +- src/notehead.cc | 16 +- src/parser.y | 54 +++--- src/pscore.cc | 2 +- src/qlp.cc | 10 +- src/qlpsolve.cc | 8 +- src/register.cc | 99 ++++++++++ src/request.cc | 117 +++++++----- src/rest.cc | 5 +- src/rhythmstaff.cc | 22 +-- src/sccol.cc | 2 +- src/scores.cc | 2 +- src/script.cc | 35 +++- src/simplestaff.cc | 25 +-- src/simplewalker.cc | 89 +++++---- src/slur.cc | 14 +- src/spanner.cc | 24 +-- src/staff.cc | 21 ++- src/staffcommands.cc | 4 +- src/staffelem.cc | 7 + src/staffwalker.cc | 14 +- src/stcol.cc | 2 +- src/stem.cc | 17 +- src/template6.cc | 7 + src/tex.cc | 2 +- src/texbeam.cc | 8 +- src/textitem.cc | 2 + src/textspanner.cc | 27 +-- src/voice.cc | 13 +- src/voicegroup.cc | 60 ++++++ src/voiceregs.cc | 169 +++++++++++++++++ src/warn.cc | 4 +- src/wordwrap.cc | 2 +- 126 files changed, 1959 insertions(+), 706 deletions(-) create mode 100644 Documentation/lelie_logo.png create mode 100644 hdr/complexstaff.hh create mode 100644 hdr/complexwalker.hh create mode 100644 hdr/register.hh rename input/{standchen.lily => standchen.ly} (100%) create mode 100644 ltest.tex create mode 100644 src/complexmelodicstaff.cc create mode 100644 src/complexprint.cc create mode 100644 src/complexstaff.cc create mode 100644 src/complexwalker.cc create mode 100644 src/groupregs.cc create mode 100644 src/register.cc create mode 100644 src/template6.cc create mode 100644 src/voicegroup.cc create mode 100644 src/voiceregs.cc diff --git a/.dstreamrc b/.dstreamrc index da11eb77db..5ca2fa850c 100644 --- a/.dstreamrc +++ b/.dstreamrc @@ -13,10 +13,10 @@ Idealspacing 1 # yydebug InitParser 1 -Parser 0 - +Parser 1 # FlexLexer debug +InitLexer 1 Lexer 1 parse_duration 1 diff --git a/Documentation/Makefile b/Documentation/Makefile index ab7466ffe5..f8b08366bc 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -3,7 +3,7 @@ PODS=README.pod CodingStyle.pod lilygut.pod lilyinput.pod error.pod\ TXTS=$(PODS:.pod=.txt) MANS=$(PODS:.pod=.1) HTMLS=$(PODS:.pod=.html) -DISTFILES=$(PODS) Makefile +DISTFILES=$(PODS) Makefile lelie_logo.png #lelieblond.gif default: diff --git a/Documentation/faq.pod b/Documentation/faq.pod index 0b841b9705..2544a71338 100644 --- a/Documentation/faq.pod +++ b/Documentation/faq.pod @@ -5,17 +5,6 @@ FAQ - LilyPond FAQs =head1 DESCRIPTION - -Q: I want to enter meterchanges inside the music. - -A: You can't; a meterchange is scorewide (well, staffwide in some -modern music). If allowed inside the music, we get complicated and -conflicting situations if two voices asked for (possibly different) -meterchanges. - -You can mark certain spots, though: please check out F - - Q: Why are [] around the notes, and () inbetween? A: [] designate beams, a note can only be in one beam at the same @@ -24,3 +13,11 @@ time. () is a slur, which connects notes. You need to be able to specify a()a()a +Q: I want a DOS/NT/W95 port. + +A: I haven't had time to find a GCC crosscompiler to DOS/win (in rpm, +please :). No, I'm not considering compilation in W95, but feel free to give it a try. + +Q: Why GPL? + +A: Yes. diff --git a/Documentation/lelie_logo.png b/Documentation/lelie_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..deaaa9d45c27f0125078ccb396719eccca360e0a GIT binary patch literal 10285 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 S#7Q^|h)|Z-kgG*nKKmaqOD3iO literal 0 HcmV?d00001 diff --git a/Documentation/lilygut.pod b/Documentation/lilygut.pod index 20d5f0364b..eae32d2e01 100644 --- a/Documentation/lilygut.pod +++ b/Documentation/lilygut.pod @@ -69,9 +69,7 @@ which is put into a percussion-Staff, will be typeset as the rythm of that voice. After C made up her mind, the resultant items and -spanners are put on the PScore, and pointers to these items are -stored in the C. This construction enables the -beams/stems to look up the balls it has to connect to. +spanners are put on the PScore. =over 5 @@ -191,10 +189,10 @@ commands (like INTERPRET) may follow this sequence. =head1 SPACING -I think my way is the most elegant algorithm i've seen so far. Some -terminology: I call a vertical group of symbols (notes) which start at -the same time a "column". Each line of a score has notes in it, -grouped in columns. The difference in starting time between those +I think my method is the most elegant algorithm i've seen so far. +Some terminology: I call a vertical group of symbols (notes) which +start at the same time a "column". Each line of a score has notes in +it, grouped in columns. The difference in starting time between those columns makes it possible to determine ideal distances between those columns. diff --git a/Initial.make b/Initial.make index 1c2d8abb10..416a7fcb6e 100644 --- a/Initial.make +++ b/Initial.make @@ -7,6 +7,6 @@ include Generate.make alldeps: #$(ALLDEPS) touch $(DEPDIR)/dummy.dep -$(DEPDIR)/%.dep: $(CCDIR)/%.cc - $(DODEP) $(CXX) -E $(CXXFLAGS) $^ > /dev/null +#$(DEPDIR)/%.dep: $(CCDIR)/%.cc +# $(DODEP) $(CXX) -E $(CXXFLAGS) $^ > /dev/null diff --git a/Makefile b/Makefile index c2b59dc66a..75f56e1ccd 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ clean: done distclean: clean - rm -f version.hh $(gencc) .GENERATE *~ deps/*.dep + rm -f version.hh $(gencc) .GENERATE *~ $(ALLDEPS) all: kompijl doc @@ -34,7 +34,7 @@ $(OBJECTDIR)/%.o: $(CCDIR)/%.cc include $(DEPDIR)/*.dep -version.o: $(obs) version.hh +$(OBJECTDIR)/version.o: $(obs) $(HEADERDIR)/version.hh include Generate.make diff --git a/NEWS b/NEWS index fd677144a6..1ed9d91e5f 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,15 @@ +pl 26 + - Documentation/lelie_logo.png + - 8-bit chars for input (see ltest.tex) (MB) + - quotes around string now optional +Bugfixes: + - unmatched ] (MB) +Internal: + - print/name methods of Staff_elem + - added Request_register + - Voice_group_registers, Voice_registers, *_register + - Complex_staff + pl 25 - other clefs added, keys typeset properly (MB) diff --git a/Sources.make b/Sources.make index 573861e9b7..e4e9834da6 100644 --- a/Sources.make +++ b/Sources.make @@ -2,7 +2,8 @@ # sourcefiles to be shipped. Also for dependencies hdr= accidental.hh bar.hh beam.hh boxes.hh break.hh clef.hh clefitem.hh\ - command.hh const.hh debug.hh dimen.hh directionalspanner.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\ identifier.hh identparent.hh inputcommand.hh inputcommands.hh\ inputmusic.hh inputscore.hh inputstaff.hh item.hh key.hh keyitem.hh\ @@ -12,15 +13,19 @@ hdr= accidental.hh bar.hh beam.hh boxes.hh break.hh clef.hh clefitem.hh\ main.hh melodicstaff.hh meter.hh misc.hh\ molecule.hh moment.hh notehead.hh notename.hh offset.hh paper.hh\ parseconstruct.hh pcol.hh proto.hh pscore.hh pstaff.hh qlp.hh\ - qlpsolve.hh request.hh rest.hh rhythmstaff.hh sccol.hh score.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\ - stcol.hh stem.hh staffwalker.hh symbol.hh symtable.hh tex.hh textdef.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 mycc=bar.cc beam.cc boxes.cc break.cc calcideal.cc clef.cc\ - clefitem.cc command.cc debug.cc dimen.cc directionalspanner.cc\ - getcommands.cc grouping.cc idealspacing.cc identifier.cc\ + clefitem.cc command.cc complexstaff.cc complexwalker.cc \ + complexmelodicstaff.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\ inputstaff.cc item.cc key.cc keyitem.cc keyword.cc\ leastsquares.cc lexerinit.cc linespace.cc linepstaff.cc\ @@ -29,12 +34,13 @@ mycc=bar.cc beam.cc boxes.cc break.cc calcideal.cc clef.cc\ main.cc melodicstaff.cc meter.cc\ misc.cc molecule.cc mylexer.cc note.cc notehead.cc notename.cc\ paper.cc pcol.cc pscore.cc pstaff.cc qlp.cc qlpsolve.cc\ - request.cc rest.cc rhythmstaff.cc sccol.cc score.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\ staffcommands.cc staffelem.cc staffline.cc stcol.cc stem.cc\ staffwalker.cc symbol.cc symtable.cc table.cc tex.cc texbeam.cc\ texslur.cc textdef.cc textitem.cc textspanner.cc\ - timedescription.cc tstream.cc voice.cc warn.cc wordwrap.cc\ + timedescription.cc tstream.cc voice.cc voiceregs.cc voicegroup.cc\ + warn.cc wordwrap.cc\ template1.cc template2.cc template3.cc template4.cc\ - template5.cc version.cc \ No newline at end of file + template5.cc template6.cc version.cc \ No newline at end of file diff --git a/TODO b/TODO index 01f9c087c5..9f422946dc 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,5 @@ BUGS - * first clef + * first clef isn't printed SEVERELY LACKING: @@ -7,9 +7,7 @@ SEVERELY LACKING: INPUTLANGUAGE - * lexer condition stack - - * lose the $ and @? + * lose the $ and @ ? * figured bass? @@ -23,7 +21,7 @@ SMALLISH PROJECTS * make spanner for staffsym - * Lyric_req : Text_req, Rhythmic_req + * Lyric_req: Text_req, Rhythmic_req * Lookup::tex_glissando, Lookup::tex_bracket, Lookup::tex_cresc, Lookup::tex_decresc (use texbeam.cc as an @@ -35,7 +33,7 @@ SMALLISH PROJECTS * C meter iso 4/4 - * textspanner: dir of beam. + * textspanner: center position * script-spacing @@ -43,13 +41,19 @@ SMALLISH PROJECTS * space rest. - * use (char *) iso. String for communication between lexer and parser. + * use (char *) iso. String for communication between lexer and + parser. * As vs. as notename. * configure idealspacing: arithmetic spacing - * fix symbols in parser.o: `Warning: size of symbol' + * fix linking: `Warning: size of symbol' + +BIGGISH PROJECT + + * merge musical & non-musical column. Scrap Commands in favour + of Requests, and do multiparralel meters DOC @@ -58,11 +62,10 @@ DOC * all errors FUTURE - * Command_req - - * scrap stem_request? - * put requests on barcommands + * syntax: grouping 2*4 3*8. + + * put scripts on barcommands * glissando @@ -80,14 +83,18 @@ FUTURE * QLP for beams? - * stacked slurs. - * revise calcideal * eentje/tweetje IDEAS + * voice terminate req. + + * keep input in mem, store char* to define spots + + * enter Requests directly + * itemcolumns * check out PMX diff --git a/Variables.make b/Variables.make index 5026391222..e71edf9753 100644 --- a/Variables.make +++ b/Variables.make @@ -37,13 +37,10 @@ endif # version info MAJVER=0 MINVER=0 -PATCHLEVEL=25 +PATCHLEVEL=26 VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL) CXXVER=`$(CXX) --version` -#flower version -NEEDEFLOWERVER=1.0.20 - # directories TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi) OBJECTDIR=objects @@ -84,7 +81,8 @@ 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 test.tex .dstreamrc dimen.tex +IFILES= standchen.tex titledefs.tex pavane.tex lilyponddefs.tex \ + ltest.tex test.tex .dstreamrc dimen.tex DFILES=$(MAKFILES) $(OFILES) $(IFILES) $(SCRIPTS) #compiling diff --git a/configure b/configure index 1f7f7b5238..b10d461235 100755 --- a/configure +++ b/configure @@ -1,15 +1,18 @@ #!/bin/sh +PREFIX=${PREFIX:-.} +echo using PREFIX=$PREFIX -NEEDFLOWERVER=1.0.21 +NEEDFLOWERVER=1.0.22 flowertar=flower-$NEEDFLOWERVER here=`pwd` -if [ -x ../flower ] +cd .. +if [ -x flower ] then echo Found flowerdir else - cd ../ - if [ ! -f $flowertar ] + + if [ ! -d $flowertar ] then echo "can't find $flowertar" exit 1; @@ -19,11 +22,10 @@ else fi echo Compiling Library -cd flower; make +(cd flower;make) + cd $here -PREFIX="." echo '#define LIBDIR "'$PREFIX'/"'> hdr/config.hh -touch depend make -f Initial.make diff --git a/deps/Makefile b/deps/Makefile index 00140e7826..790d7b06f2 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -1,6 +1,10 @@ DISTFILES=Makefile + +default: + + dist: ln $(DISTFILES) $(DDIR)/$(SUBDIR) clean: - rm *.dep + rm -f *.dep diff --git a/flower/Makefile b/flower/Makefile index ed618974eb..1b8b0013f8 100644 --- a/flower/Makefile +++ b/flower/Makefile @@ -9,7 +9,7 @@ depend: Sources.make $(CXX) -MM $(cc) > depend clean: - rm -f $(obs) $(staticlib) + rm -f $(obs) $(staticlib) fversion.hh realclean: clean rm -f depend diff --git a/flower/Variables.make b/flower/Variables.make index 0c389c10ef..c417e74140 100644 --- a/flower/Variables.make +++ b/flower/Variables.make @@ -1,6 +1,6 @@ MAJVER=1 MINVER=0 -PATCHLEVEL=21 +PATCHLEVEL=22 PACKAGENAME=flower #PROFILEFLAG=-pg @@ -33,5 +33,5 @@ obs=$(cc:.cc=.o) staticlib=libflower.a ALLSOURCES=$(hh) $(cc) $(inl) $(templatecc) DFILES=$(ALLSOURCES) Makefile Variables.make make_version\ - Sources.make TODO README + Sources.make TODO README NEWS DDIR=$(DNAME) diff --git a/flower/assoc.hh b/flower/assoc.hh index c21c4fc6bc..4e0594519f 100644 --- a/flower/assoc.hh +++ b/flower/assoc.hh @@ -43,7 +43,7 @@ struct Assoc { Assoc_ent_ ae; ae.free = false; ae.key = key; - arr.add(ae); + arr.push(ae); return arr.size() -1; } public: diff --git a/flower/path.hh b/flower/path.hh index fceaeed647..3ff83d3b72 100644 --- a/flower/path.hh +++ b/flower/path.hh @@ -15,7 +15,7 @@ public: File_path(String); /// add to end of path. - Array:: add; + Array:: push; }; /** diff --git a/flower/smat.cc b/flower/smat.cc index 9c3b8e2a97..f2143507b6 100644 --- a/flower/smat.cc +++ b/flower/smat.cc @@ -157,7 +157,7 @@ Full_storage::row(int n) const { Array r; for (int j = 0; j < w; j++) - r.add(els[n][j]); + r.push(els[n][j]); return r; } @@ -167,7 +167,7 @@ Full_storage::column(int n) const Array r; for (int i = 0; i { Array::pop(); return l; } - void push(T l) { add(l); } }; /** Same as for #Array# goes here. diff --git a/flower/textdb.cc b/flower/textdb.cc index d94b64ab79..eefea16240 100644 --- a/flower/textdb.cc +++ b/flower/textdb.cc @@ -32,7 +32,7 @@ Text_db::get_record() while ((s = get_word()) != "") { - fields.add(s); + fields.push(s); gobble_white(); } diff --git a/flower/varray.hh b/flower/varray.hh index bfc6b984fa..40e76a3dc7 100644 --- a/flower/varray.hh +++ b/flower/varray.hh @@ -91,7 +91,7 @@ public: } /// add to the end of array - void add(T x) { + void push(T x) { if (size_ == max) remax(2*max + 1); diff --git a/hdr/accidental.hh b/hdr/accidental.hh index a1c5d80d30..d388a3f097 100644 --- a/hdr/accidental.hh +++ b/hdr/accidental.hh @@ -9,11 +9,12 @@ #include "item.hh" struct Accidental : Item { +const char * name() const; int type,pos; void preprocess(); Accidental(int type, int position); - void print()const; + void do_print()constt; private: void brew_molecule(); }; diff --git a/hdr/bar.hh b/hdr/bar.hh index 2df42d6503..a6cd8d4d04 100644 --- a/hdr/bar.hh +++ b/hdr/bar.hh @@ -9,6 +9,7 @@ #include "item.hh" struct Bar: Item { + const char * name() const; String type; Bar(String type); diff --git a/hdr/beam.hh b/hdr/beam.hh index 548641aecb..68a9f49cff 100644 --- a/hdr/beam.hh +++ b/hdr/beam.hh @@ -18,6 +18,7 @@ struct Beam: public Directional_spanner { /// dir: -1 below heads, +1 above heads. /****************/ + const char * name() const; virtual Interval width()const; Offset center() const; @@ -30,7 +31,7 @@ struct Beam: public Directional_spanner { void do_pre_processing(); void do_post_processing(); - void print() const; + void do_print() const; void set_grouping(Rhythmic_grouping def, Rhythmic_grouping current); void set_stemlens(); ~Beam(); diff --git a/hdr/clefitem.hh b/hdr/clefitem.hh index 9dbfffe5cd..c07087e073 100644 --- a/hdr/clefitem.hh +++ b/hdr/clefitem.hh @@ -11,6 +11,7 @@ struct Clef_item : Item { + const char * name() const; String type; int y_off; bool change; diff --git a/hdr/complexstaff.hh b/hdr/complexstaff.hh new file mode 100644 index 0000000000..4413add60e --- /dev/null +++ b/hdr/complexstaff.hh @@ -0,0 +1,53 @@ +/* + complexstaff.hh -- part of LilyPond + + (c) 1996,1997 Han-Wen Nienhuys +*/ + +#ifndef COMPLEXSTAF_HH +#define COMPLEXSTAF_HH + + +#include "key.hh" +#include "stcol.hh" +#include "staff.hh" +#include "staffwalker.hh" + +/// column of Complex_staff: store one request +struct Complex_column : Staff_column { + + Array todo_l_arr_; + Complex_staff* staff_l_; + + /****************/ + + Slur_req *find_slur(Voice *); + + void typeset_item(Item *, int=1); + void typeset_item_directional(Item *, int dir, int=1); + Molecule *create_command_mol(Command *com); + + void take_request(Request *rq); + virtual void setup_requests(); + + Complex_column(Score_column*s,Complex_staff*rs); +}; + + +/// Complex staff: one voicegroup at a time +struct Complex_staff : Staff { + /// indirection to the PStaff. + PStaff *theline_l_; + + /****************/ + Staff_column*create_col(Score_column*); + virtual Item *get_TYPESET_item(Command*); + virtual void set_output(PScore *); + void process_commands( PCursor &where); + virtual void walk(); + + Complex_staff(); +}; + +#endif // COMPLEXSTAF_HH + diff --git a/hdr/complexwalker.hh b/hdr/complexwalker.hh new file mode 100644 index 0000000000..111945c762 --- /dev/null +++ b/hdr/complexwalker.hh @@ -0,0 +1,65 @@ +/* + complexwalker.hh -- part of LilyPond + + (c) 1996,97 Han-Wen Nienhuys +*/ + +#ifndef COMPLEXWALKER_HH +#define COMPLEXWALKER_HH + +#include "proto.hh" +#include "grouping.hh" +#include "voicegroup.hh" +#include "assoc.hh" +#include "staffwalker.hh" +#include "key.hh" +#include "clef.hh" + +struct Complex_walker: Staff_walker { + Local_key local_key_; + Key key_; + Array *oldkey_undo; + Array typesetkey; + + int processed_bar_priority; + bool processed_key; + bool processed_clef; + Clef clef_; + Rhythmic_grouping default_grouping; + + + IPointerList voice_reg_list_; +// Assoc voice_reg_map_; + //IPointerList voice_reg_list_; + //Assoc group_reg_map_; + Voice_group_registers group_regs_; + Local_key_register local_key_reg_; + Array announce_info_arr_; + + /****************/ + Voice_registers *find_voice_reg(Voice*v_l); + + void regs_process_requests(); + void do_announces(); + void try_request(Request*req); + void typeset_element(Staff_elem *elem_p); + void announce_element(Staff_elem_info); + virtual void do_TYPESET_command(Command*); + virtual void do_INTERPRET_command(Command*); + virtual void process_requests(); + 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 + + diff --git a/hdr/debug.hh b/hdr/debug.hh index 0e35476b39..a5a7d8d378 100644 --- a/hdr/debug.hh +++ b/hdr/debug.hh @@ -11,7 +11,7 @@ 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); // warnings -void warning(String s); +//void warning(String s); #define WARN warnout << "warning: "<<__FUNCTION__ << "(): " extern ostream &warnout ; diff --git a/hdr/grouping.hh b/hdr/grouping.hh index 6f89456d8b..aea2fd393f 100644 --- a/hdr/grouping.hh +++ b/hdr/grouping.hh @@ -14,8 +14,7 @@ typedef Interval_t MInterval; /// data structure which represents rhythmic units -struct Rhythmic_grouping { - +struct Rhythmic_grouping { Array children; MInterval *interval_; @@ -34,7 +33,7 @@ struct Rhythmic_grouping { ~Rhythmic_grouping(); void add_child(Moment start, Moment len); - + bool child_fit_query(Moment start); void split(Rhythmic_grouping r); void split(Array); void split(int n); diff --git a/hdr/item.hh b/hdr/item.hh index 9b234819ec..68f1402c5b 100644 --- a/hdr/item.hh +++ b/hdr/item.hh @@ -6,16 +6,16 @@ #include "string.hh" #include "staffelem.hh" - /// a horizontally fixed size element of the score struct Item : Staff_elem { /// indirection to the column it is in PCol * pcol_l_; /****************/ - + virtual Item *item() { return this; } Item(); - void print()const; + void do_print()const; + const char*name()const; }; /** Item is the datastructure for printables whose width is known before the spacing is calculated diff --git a/hdr/keyitem.hh b/hdr/keyitem.hh index dca7d72135..71a7dba2b1 100644 --- a/hdr/keyitem.hh +++ b/hdr/keyitem.hh @@ -14,6 +14,7 @@ struct Clef; /// struct Keyitem : Item { + const char * name() const; Array pitch; Array acc; int c_position; diff --git a/hdr/localkeyitem.hh b/hdr/localkeyitem.hh index b4cf832c3e..0da7e06858 100644 --- a/hdr/localkeyitem.hh +++ b/hdr/localkeyitem.hh @@ -15,15 +15,17 @@ struct Local_acc { }; struct Local_key_item : Item { + const char * name() const; Array accs; - Array group; + Array group; int c0_position; // move into walker /****************/ Local_key_item(int c0position); - void add(int oct, int pitch, int acc, Notehead*); - + void add(Item*); + void add(int oct, int pitch, int acc); + void add(Melodic_req*); void do_pre_processing(); Molecule* brew_molecule_p()const; }; diff --git a/hdr/lyriccolumn.hh b/hdr/lyriccolumn.hh index 368dadf1bc..145ff7fc08 100644 --- a/hdr/lyriccolumn.hh +++ b/hdr/lyriccolumn.hh @@ -10,7 +10,6 @@ #include "key.hh" #include "stcol.hh" #include "staff.hh" -#include "staffwalker.hh" struct Lyric_staff; @@ -28,12 +27,7 @@ struct Lyric_column : Staff_column { Lyric_staff* lstaff_l_; void typeset_item(Item *, int=1); -// void typeset_item_directional(Item *, int dir, int=1); - -// Molecule *create_command_mol(Command *com); - -// void take_request(Request *rq); - virtual void process_requests(); + virtual void setup_requests(); Lyric_column(Score_column*s,Lyric_staff*rs); }; diff --git a/hdr/lyricwalker.hh b/hdr/lyricwalker.hh index 846b9a578c..870efbb040 100644 --- a/hdr/lyricwalker.hh +++ b/hdr/lyricwalker.hh @@ -17,7 +17,7 @@ struct Lyric_walker: Staff_walker { Array litem_l_array_; /****************/ - + virtual void do_TYPESET_command(Command*); virtual void do_INTERPRET_command(Command*); virtual void process_requests(); diff --git a/hdr/melodicstaff.hh b/hdr/melodicstaff.hh index e3a5ff1f61..cec73517d7 100644 --- a/hdr/melodicstaff.hh +++ b/hdr/melodicstaff.hh @@ -19,7 +19,7 @@ struct Melodic_staff : public Simple_staff virtual void set_output(PScore *); virtual Item* get_TYPESET_item(Command*); - virtual Stem * get_stem(Stem_req *rq,Moment); + virtual Stem * get_stem(Stem_req *rq); virtual Notehead * get_notehead(Note_req *rq, int bot); virtual Local_key_item* get_local_key_item(); }; diff --git a/hdr/meter.hh b/hdr/meter.hh index 1557ce4709..835b661bae 100644 --- a/hdr/meter.hh +++ b/hdr/meter.hh @@ -10,6 +10,7 @@ #include "varray.hh" struct Meter: Item { + const char * name() const; Array args; /****************/ diff --git a/hdr/notehead.hh b/hdr/notehead.hh index a032ca1273..5f4c47d2d9 100644 --- a/hdr/notehead.hh +++ b/hdr/notehead.hh @@ -9,8 +9,8 @@ #include "item.hh" /// ball at the end of the stem -struct Notehead : public Item -{ +struct Notehead : Item { + const char * name() const; int position; /// -1 = lowest, 0 = inside, 1 = top int extremal; @@ -22,13 +22,13 @@ struct Notehead : public Item /****************/ - + void set_rhythmic(Rhythmic_req *); Notehead(int staff_size); /** position of top line (5 linestaff: 8) */ - void print()const; + void do_print()const; static int compare(Notehead*&a, Notehead*&b) ; Molecule* brew_molecule_p()const; }; diff --git a/hdr/parseconstruct.hh b/hdr/parseconstruct.hh index 9bc9434ffc..7b0545b784 100644 --- a/hdr/parseconstruct.hh +++ b/hdr/parseconstruct.hh @@ -14,12 +14,9 @@ void set_default_duration(int *); void get_default_duration(int *); void set_default_octave(String); void set_plet(int,int); -Staff * get_new_rhythmstaff(); Voice_element * get_note_element(String,int * ,int *); Voice_element* get_rest_element(String,int *); Voice_element* get_word_element(Text_def*, int*); -Staff * get_new_melodicstaff(); -Staff * get_new_lyricstaff(); void add_requests( Voice_element*v, Array&req); Request* get_request(char); void set_text_style(String); diff --git a/hdr/proto.hh b/hdr/proto.hh index 0d32486ed4..94304768da 100644 --- a/hdr/proto.hh +++ b/hdr/proto.hh @@ -19,21 +19,34 @@ struct Beam; struct Beam_req; struct Box; struct Bracket_req; +struct CNote_info; struct Chord; struct Clef; struct Clef_item; +struct Col_configuration; struct Colinfo; struct Command; +struct Commands_at ; +struct Complex_column; +struct Complex_music; +struct Complex_staff; +struct Complex_walker; struct Cresc_req; struct Decresc_req; struct Dynamic; struct Idealspacing; struct Identifier; +struct Input_command; struct Input_commands; +struct Input_file; +struct Input_music; +struct Input_score; +struct Input_staff; struct Item; struct Key; struct Keyitem; struct Keyword; +struct Keyword_table; struct Line_of_score; struct Line_of_staff; struct Linestaff; @@ -41,13 +54,16 @@ struct Local_key; struct Local_key_item; struct Lookup; struct Lyric_req; +struct Lyric_req; struct Mark_req; +struct Melodic_req; struct Mixed_qp; struct Molecule; -struct Rational; -typedef Rational Moment; +struct Music_general_chord; +struct Music_voice; struct Note_req; struct Notehead; +struct Notename_tab; struct Offset; struct Output; struct PCol; @@ -55,22 +71,30 @@ struct PScore; struct PStaff; struct Paperdef; struct Parametric_symbol; +struct Rational; struct Request; +struct Request_register; struct Rest; struct Rest_req; +struct Rhythmic_grouping; struct Rhythmic_req; struct Score; struct Score_column; -struct Staff_commands; +struct Script_def; struct Script_req; +struct Simple_music; struct Slur; struct Slur_req; struct Span_req; struct Spanner; struct Staff; -struct Staff_command_req; -struct Col_configuration; struct Staff_column; +struct Staff_command_req; +struct Staff_commands; +struct Staff_commands_at ; +struct Staff_elem; +struct Staff_elem_info; +struct Staff_walker; struct Stem; struct Stem_req; struct String; @@ -78,31 +102,15 @@ struct Symbol; struct Symtable; struct Symtables; struct Tex_stream; +struct Text_def; struct Text_gob; +struct Text_req; +struct Time_description; struct Voice; struct Voice_element; -struct Voicegroup; - +struct Voice_group_registers; struct Voice_list; -struct Input_music; -struct Simple_music; -struct Complex_music; -struct Music_voice; -struct Music_general_chord; - -struct Input_score; -struct Input_staff; -struct Input_command; -struct Notename_tab; -struct Input_file; -struct Keyword_table; -struct Rhythmic_grouping; -struct Staff_commands_at ; -struct Commands_at ; -struct Time_description; -struct Script_def; -struct Text_def; -struct Text_req; -struct Lyric_req; -struct Melodic_req; +struct Voice_registers; +struct Voicegroup; +typedef Rational Moment; #endif // PROTO_HH diff --git a/hdr/register.hh b/hdr/register.hh new file mode 100644 index 0000000000..e94faca7cf --- /dev/null +++ b/hdr/register.hh @@ -0,0 +1,150 @@ +/* + register.hh -- part of LilyPond + + (c) 1996,1997 Han-Wen Nienhuys +*/ + +#ifndef REGISTER_HH +#define REGISTER_HH +#include "proto.hh" +#include "sstack.hh" + +/// 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_; + + /****/ + Staff_elem_info(Staff_elem*, Request*, Request_register*); + Staff_elem_info(); +}; + +/// Hungarian postfix: reg +struct Request_register { + Complex_walker * walk_l_; + Array accepted_req_arr_; + + /****************/ + + Request_register(Complex_walker*); + Request_register(); + virtual ~Request_register(){} + + /// take note of item/spaanner + virtual void acknowledge_element(Staff_elem_info){} + /** + put item in spanner. Adjust local key; etc. + */ + + /// + virtual bool try_request(Request *req_l) =0; + /** + try to fit the request in this register + + RETURN + false: request noted, but not taken. + + true: request swallowed, now owned by this + + (may be we could use C++ exceptions.. :-) + */ + + /// make items/spanners with the requests you got + virtual void process_request()=0; + + /// typeset any spanners. Empty accepted_req_arr_ + void pre_move_processing(); + void post_move_processing(); + +protected: + /// virtual, called by pre_move_process() + virtual void do_pre_move_process(){} + virtual void do_post_move_process(){} +}; +/** + a struct which processes requests, and creates the Staff_elems + */ + +struct Notehead_register : Request_register { + Item* note_l_; + /****************/ + Notehead_register(Complex_walker*); + virtual bool try_request(Request *req_l) ; + virtual void process_request(); + virtual void do_pre_move_process(); +}; + +struct Slur_register : Request_register { + sstack slur_l_stack_; + Array end_slur_l_arr_; + + + /****************/ + ~Slur_register(); + Slur_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(); +}; + +struct Stem_beam_register : Request_register { + Stem * stem_p_; + Beam * beam_p_; + Beam_req * beam_req_l_; + Stem_req * stem_req_l_; + bool end_beam_b_; + Rhythmic_grouping *current_grouping; + + /****************/ + Stem_beam_register(Complex_walker*); + ~Stem_beam_register(); + virtual bool try_request(Request*); + virtual void process_request(); + virtual void acknowledge_element(Staff_elem_info); + virtual void do_pre_move_process(); + virtual void do_post_move_process(); +}; + +#if 0 +struct Script_register : Request_register { + Script * script_p_; + /****************/ + Script_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(); +}; + +struct Text_register:Request_register{ + Text_item * text_p_; + + /****************/ + 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_; + + /****************/ + + virtual bool try_request(Request*); + virtual void process_request(); + virtual void acknowledge_element(Staff_elem_info); + virtual void do_pre_move_process(); + Local_key_register(Complex_walker*); +}; + +#endif // REGISTER_HH + diff --git a/hdr/request.hh b/hdr/request.hh index c401fcdd9d..2cc9decef1 100644 --- a/hdr/request.hh +++ b/hdr/request.hh @@ -11,14 +11,15 @@ struct Request { Voice_element*elt_l_; /****************/ - Request(); Request(Request const&); virtual ~Request(){} - virtual void print()const ; - virtual Moment duration() const { return 0.0; } + virtual const char * name() const { return "Request";} virtual Request* clone() const =0; + void print()const ; + + virtual Moment duration() const { return 0; } /* accessors for children */ virtual Barcheck_req *barcheck() { return 0; } @@ -35,17 +36,23 @@ struct Request { virtual Melodic_req *melodic() { return 0; } virtual Mark_req * mark() { return 0; } virtual Staff_command_req* command() { return 0;} +protected: + virtual void do_print()const ; }; - /** a voice element wants something printed. see lilygut page */ + + +#define REQUESTMETHODS(T,accessor) \ +virtual T * accessor() { return this;}\ +virtual const char* name()const { return #T; }\ +virtual Request *clone() const { return new T(*this); } \ +virtual void do_print() const struct Barcheck_req : Request { - virtual Barcheck_req *barcheck() { return this; } - void print ()const; - Request*clone() const; + REQUESTMETHODS(Barcheck_req,barcheck); }; /// a request with a duration @@ -54,12 +61,11 @@ struct Rhythmic_req : virtual Request { int dots; Moment plet_factor; /****************/ - + static int compare(const Rhythmic_req &, const Rhythmic_req &); Moment duration() const; Rhythmic_req(); - Rhythmic_req*rhythmic() { return this;} - void print ()const; - Request*clone() const; + Rhythmic_req(int,int); + REQUESTMETHODS(Rhythmic_req, rhythmic); }; @@ -68,29 +74,24 @@ struct Text_req : virtual Request { int dir_i_; Text_def *tdef_p_; /****************/ - Text_req* text() { return this; } - virtual void print() const; - Request *clone()const; - Text_req(int d, Text_def*); ~Text_req(); Text_req(Text_req const&); + REQUESTMETHODS(Text_req,text); }; struct Lyric_req : public Rhythmic_req, Text_req { Lyric_req(Text_def* t_p); - void print() const; - Lyric_req* lreq_l() { return this; } - Request* clone() const; + REQUESTMETHODS(Lyric_req, lreq_l); }; struct Melodic_req :virtual Request { /// 0 is c - int name; + int notename; int octave; int accidental; bool forceacc; @@ -98,19 +99,17 @@ struct Melodic_req :virtual Request // return height from central c (in halflines) int height()const; Melodic_req(); - Melodic_req*melodic() { return this;} - virtual void print() const; - Request*clone() const; + + REQUESTMETHODS(Melodic_req,melodic); }; /// Put a note of specified type, height, and with accidental on the staff. struct Note_req : Rhythmic_req, virtual Melodic_req { - Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); } - Note_req*note() { return this;} - virtual void print() const; - Request*clone() const; -}; + + Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); } + REQUESTMETHODS(Note_req, note); + }; /** */ @@ -118,25 +117,20 @@ struct Note_req : Rhythmic_req, virtual Melodic_req { ///Put a rest on the staff. struct Rest_req : Rhythmic_req { - void print()const; - - Rest_req * rest() { return this;} - Request*clone() const ; + REQUESTMETHODS(Rest_req,rest); }; /** Why a request? It might be a good idea to not typeset the rest, if the paper is too crowded. */ /// attach a stem to the noteball -struct Stem_req : Request { - /// 4,8,16, .. - int stem_number; - - virtual Stem_req *stem() {return this;} - Stem_req(int s) { stem_number = s; } - Request*clone() const; - virtual void print() const; +struct Stem_req : Rhythmic_req { + Stem_req(int s, int dots); + REQUESTMETHODS(Stem_req,stem); }; +/** + Rhythmic_req parent needed to determine if it will fit inside a beam. + */ /// requests to start or stop something. struct Span_req : Request { @@ -144,11 +138,11 @@ struct Span_req : Request { enum { NOSPAN, START, STOP } spantype ; + static int compare(const Span_req &r1, const Span_req &r2); + REQUESTMETHODS(Span_req,span); - virtual void print() const; - Span_req*span() { return this; } Span_req(); - virtual Request*clone()const; + }; /** This type of request typically results in the creation of a #Spanner# @@ -160,20 +154,19 @@ struct Beam_req : Span_req { int nplet; /****************/ - + REQUESTMETHODS(Beam_req,beam); + Beam_req(); - virtual Beam_req * beam() { return this; } - virtual Request*clone()const; }; + /** if #nplet# is set, the staff will try to put an appropriate number over the beam */ /// a slur struct Slur_req : Span_req { + REQUESTMETHODS(Slur_req,slur); - virtual Request*clone()const; - virtual Slur_req*slur() { return this; } }; @@ -183,10 +176,8 @@ struct Script_req : Request { Script_def *scriptdef; /****************/ - Script_req*script() { return this; } - virtual void print() const; - Request *clone()const; Script_req(int d, Script_def*); + REQUESTMETHODS(Script_req,script); ~Script_req(); Script_req(Script_req const&); }; @@ -199,19 +190,16 @@ struct Mark_req : Request { String mark_str_; /****************/ Mark_req(String); - Mark_req* mark() { return this; } - virtual void print() const; - Request *clone() const; + REQUESTMETHODS(Mark_req,mark); }; struct Staff_command_req : Request { Input_command * com_p_; - Staff_command_req* command() { return this;} + /****************/ Staff_command_req(Staff_command_req const&); ~Staff_command_req(); Staff_command_req(Input_command*); - Request*clone()const; - void print()const; + REQUESTMETHODS(Staff_command_req,command); }; #if 0 @@ -243,7 +231,6 @@ enum Loudness { struct Bracket_req : Span_req { int nplet; // print a number over the beam. }; - /** Start/stop a bracket at this note. if #nplet# is set, the staff will try to put an appropriate number over the bracket diff --git a/hdr/rest.hh b/hdr/rest.hh index d3f944f57e..02c6e0bff6 100644 --- a/hdr/rest.hh +++ b/hdr/rest.hh @@ -9,8 +9,8 @@ #include "item.hh" /// ball at the end of the stem -struct Rest : public Item -{ +struct Rest : Item { + int dots; int balltype; @@ -18,8 +18,8 @@ struct Rest : public Item Rest(int dur,int dots); - void print()const; - + void do_print()const; + const char * name() const; Molecule* brew_molecule_p()const; }; /** diff --git a/hdr/rhythmstaff.hh b/hdr/rhythmstaff.hh index 741be45e78..0508224a3a 100644 --- a/hdr/rhythmstaff.hh +++ b/hdr/rhythmstaff.hh @@ -16,7 +16,7 @@ struct Rhythmic_staff : public Simple_staff /****************/ virtual Item *get_TYPESET_item(Command*); - virtual Stem *get_stem(Stem_req *rq,Moment); + virtual Stem *get_stem(Stem_req *rq); virtual Notehead * get_notehead(Note_req *rq, int b); virtual void set_output(PScore *); }; diff --git a/hdr/script.hh b/hdr/script.hh index be21a60829..27fddc5894 100644 --- a/hdr/script.hh +++ b/hdr/script.hh @@ -10,17 +10,17 @@ #include "scriptdef.hh" #include "item.hh" -struct Script : Item{ +struct Script : Item { int dir; int symdir; int pos; int staffsize; - Script_def*specs_l_; - Stem * stem_l_; - Item * support; + Script_def *specs_l_; + Stem *stem_l_; + Array support; /****************/ - + const char * name() const; void set_symdir(); void set_default_dir(); void set_default_pos(); @@ -28,7 +28,10 @@ struct Script : Item{ Molecule* brew_molecule_p()const; virtual void do_post_processing(); virtual void do_pre_processing(); - Script(Script_req*, Item*,int,Stem*p=0); + Script(Script_req*, int); + void set_support(Item*); + void set_stem(Stem*); + Interval support_height()const; virtual Interval width() const; }; diff --git a/hdr/simplestaff.hh b/hdr/simplestaff.hh index 531f994d6e..f0ff1679e2 100644 --- a/hdr/simplestaff.hh +++ b/hdr/simplestaff.hh @@ -34,7 +34,6 @@ struct Simple_column : Staff_column { Beam_req *beam_; Simple_staff* staff_l_; Text_req *text_; - Lyric_req* lreq_p_; /****************/ Slur_req * find_slur(Voice *); @@ -44,7 +43,7 @@ struct Simple_column : Staff_column { Molecule *create_command_mol(Command *com); void take_request(Request *rq); - virtual void process_requests(); + virtual void setup_requests(); Simple_column(Score_column*s,Simple_staff*rs); }; @@ -59,7 +58,7 @@ struct Simple_staff : Staff { Staff_column*create_col(Score_column*); virtual Item *get_TYPESET_item(Command*); - virtual Stem *get_stem(Stem_req *rq, Moment)=0; + virtual Stem *get_stem(Stem_req *rq)=0; virtual Notehead *get_notehead(Note_req *rq, int b)=0; virtual Rest *get_rest(Rest_req *rq); virtual void set_output(PScore *); diff --git a/hdr/simplewalker.hh b/hdr/simplewalker.hh index 192419ef2e..a43844622b 100644 --- a/hdr/simplewalker.hh +++ b/hdr/simplewalker.hh @@ -10,6 +10,7 @@ #include "proto.hh" #include "grouping.hh" + struct Simple_walker: Staff_walker { Stem *stem_; Arraynoteheads; @@ -34,8 +35,9 @@ struct Simple_walker: Staff_walker { virtual void do_TYPESET_command(Command*); virtual void do_INTERPRET_command(Command*); virtual void process_requests(); - virtual void reset(); - + virtual void do_post_move(); + ~Simple_walker(); + Simple_walker(Simple_walker const& c); void do_note(Note_info); Simple_walker(Simple_staff*); Simple_column *col(); diff --git a/hdr/slur.hh b/hdr/slur.hh index 26bb2ff36e..c9524ba6f5 100644 --- a/hdr/slur.hh +++ b/hdr/slur.hh @@ -21,7 +21,6 @@ struct Slur : Directional_spanner { /****************/ Offset center() const; Slur(); - void print() const; void do_post_processing(); void do_pre_processing(); void add(Notehead*); @@ -30,7 +29,8 @@ struct Slur : Directional_spanner { Spanner* do_break_at( PCol*, PCol*) const; void process(); private: -Molecule*brew_molecule_p()const; + Molecule*brew_molecule_p()const; + const char * name() const; }; #endif // SLUR_HH diff --git a/hdr/spanner.hh b/hdr/spanner.hh index d04f0736a6..144b110e29 100644 --- a/hdr/spanner.hh +++ b/hdr/spanner.hh @@ -19,9 +19,10 @@ struct Spanner:Staff_elem { Spanner(); virtual Interval width()const; - void print()const; - + void do_print()const; + const char* name()const; Spanner *broken_at(PCol *c1, PCol *c2) const; + virtual Spanner* spanner() { return this; } protected: /// clone a piece of this spanner. virtual Spanner *do_break_at( PCol *c1, PCol *c2) const=0; @@ -31,9 +32,9 @@ protected: c1 >= start, c2 <= stop */ }; -/** - A spanner is a symbol whose final appearance can only be calculated - after the breaking problem is solved. +/** A spanner is a symbol which spans across several columns, so its + final appearance can only be calculated after the breaking problem + is solved. Examples diff --git a/hdr/staff.hh b/hdr/staff.hh index d02f944373..cee6d27a19 100644 --- a/hdr/staff.hh +++ b/hdr/staff.hh @@ -15,7 +15,9 @@ struct Staff { Score *score_l_; PScore *pscore_l_; String define_spot_str_; + /****************************************************************/ + void add(PointerList &s); void do_commands(PointerList score_wide, PointerList staff_wide); diff --git a/hdr/staffelem.hh b/hdr/staffelem.hh index 3eed7dfba7..c7751b6ecc 100644 --- a/hdr/staffelem.hh +++ b/hdr/staffelem.hh @@ -40,8 +40,13 @@ struct Staff_elem { void pre_processing(); void post_processing(); void molecule_processing(); - + virtual const char *name() const; // to find out derived classes. + virtual Spanner* spanner() { return 0; } + virtual Item * item() { return 0; } protected: + + /// do printing of derived info. + virtual void do_print() const=0; /// generate the molecule virtual Molecule* brew_molecule_p()const=0; ///executed directly after the item is added to the PScore @@ -69,5 +74,7 @@ private: accomplished with the dependencies field of struct Staff_elem. */ + +#define NAME_METHOD(c) const char *c::name()const{ return #c; } struct c #endif // STAFFELEM_HH diff --git a/hdr/staffwalker.hh b/hdr/staffwalker.hh index d9945229f2..efac63e7b0 100644 --- a/hdr/staffwalker.hh +++ b/hdr/staffwalker.hh @@ -11,8 +11,8 @@ #include "staff.hh" struct Staff_walker : public PCursor { - Staff * staff_; - PScore * pscore_; + Staff * staff_l_; + PScore * pscore_l_; int break_status; @@ -31,7 +31,8 @@ struct Staff_walker : public PCursor { ****************/ /// every time ++ is called - virtual void reset(){} + virtual void do_pre_move(){} + virtual void do_post_move(){} virtual void process_requests()=0; virtual void do_TYPESET_command(Command*)=0; virtual void do_INTERPRET_command(Command*)=0 ; diff --git a/hdr/stcol.hh b/hdr/stcol.hh index b9e3a9bba8..0984f88022 100644 --- a/hdr/stcol.hh +++ b/hdr/stcol.hh @@ -34,7 +34,7 @@ struct Staff_column { VIRTUAL ****************************************************************/ - virtual void process_requests()=0; + virtual void setup_requests()=0; virtual ~Staff_column(); private: diff --git a/hdr/stem.hh b/hdr/stem.hh index 8788d5a53d..046538ae16 100644 --- a/hdr/stem.hh +++ b/hdr/stem.hh @@ -11,10 +11,11 @@ #include "moment.hh" /// the rule attached to the ball -struct Stem : public Item { +struct Stem : Item { +/* /// rhythmical length Moment note_length; - + */ // heads the stem encompasses (positions) int minnote, maxnote; @@ -49,20 +50,19 @@ struct Stem : public Item { Array heads; /****************/ - Stem(int center, Moment duration); + Stem(int center); //, Moment duration); /// ensure that this Stem also encompasses the Notehead #n# void add(Notehead*n); + const char * name() const; Real hpos()const; - void print() const; + void do_print() const; void set_stemend(Real); void set_default_dir(); void set_default_stemlen(); void set_default_extents(); void set_noteheads(); - - void do_pre_processing(); Interval width() const; diff --git a/hdr/textitem.hh b/hdr/textitem.hh index bd4ea924d2..ebf7656276 100644 --- a/hdr/textitem.hh +++ b/hdr/textitem.hh @@ -11,6 +11,7 @@ #include "item.hh" struct Text_item : Item { + const char * name() const; int pos_i_; int staffsize_i_; int dir_i_; diff --git a/hdr/textspanner.hh b/hdr/textspanner.hh index 81c8b87c32..8bfb9aab6b 100644 --- a/hdr/textspanner.hh +++ b/hdr/textspanner.hh @@ -16,14 +16,18 @@ struct Text_spanner : Spanner { Text_def spec; Offset tpos; Directional_spanner*support; + /****************/ + + const char * name() const; virtual void do_pre_processing(); virtual void do_post_processing(); Molecule* brew_molecule_p()const; virtual Interval height() const ; - void print() const; + void do_print() const; virtual Spanner* do_break_at(PCol*,PCol*)const; - Text_spanner(Directional_spanner*); + Text_spanner(); + void set_support(Directional_spanner*); }; /** Use for triplets, eentweetjes, ottava, etc. diff --git a/hdr/voice.hh b/hdr/voice.hh index f63f905a0d..867827f029 100644 --- a/hdr/voice.hh +++ b/hdr/voice.hh @@ -25,15 +25,10 @@ struct Voice { */ -struct Voicegroup { - /// don't know how to identify these. -}; - /// one horizontal bit. struct Voice_element { Moment duration; - const Voicegroup *group; - const Voice *voice_; + const Voice *voice_l_; IPointerList reqs; /****************/ @@ -43,8 +38,6 @@ struct Voice_element { Voice_element(Voice_element const & src ); void print ()const; }; -/** Apart from being a container for the requests, Voice_element is - glue between related items and spanners, between requests and - (voice)groups +/** Apart from being a container for the requests, Voice_element is nothing */ #endif diff --git a/input/Makefile b/input/Makefile index cf9a3c5d6a..eaae8fd3ef 100644 --- a/input/Makefile +++ b/input/Makefile @@ -1,7 +1,7 @@ default: ; DISTFILES=Makefile kortjakje.ly pavane.ly maartje.ly\ - cadenza.ly scales.ly standchen.lily twinkle.ly + cadenza.ly scales.ly standchen.ly twinkle.ly dist: ln $(DISTFILES) $(DDIR)/$(SUBDIR) diff --git a/input/maartje.ly b/input/maartje.ly index 7755894eff..1a7925955f 100644 --- a/input/maartje.ly +++ b/input/maartje.ly @@ -4,9 +4,8 @@ % % - - -ritme = staff {rhythmic +ritme = staff { + rhythmic music {$ c8 |[a8() a8. a8 a16 a16 a16] c4. @@ -25,6 +24,7 @@ ritme = staff {rhythmic melody= staff { melodic +% complex music{$ c8 |r4 r4 r4 r4 @@ -56,7 +56,7 @@ staff { melodic skip 2:0 key skip 5:0 - clef "bass" + clef bass } } diff --git a/input/pavane.ly b/input/pavane.ly index 6bd02b32e1..01d6545e64 100644 --- a/input/pavane.ly +++ b/input/pavane.ly @@ -12,56 +12,57 @@ horn = staff { - melodic +% melodic + complex music{ $ \octave { ' } \duration { 8} % 1 - d2( [)d e cis `b] | - `a4 [`b cis] [cis `b] `b4 | - fis2( [)fis g e d] | + d2(( [)d e cis `b] | + `a4 [`b cis] [cis `b] )`b4 | + fis2(( [)fis g e d] | cis4 [d e(] [)e fis d cis] | `b4 [cis d(] [)d e cis `b] | - cis2 r2^"c\'edez" | + )cis2 r2^"c\'edez" | r4 fis2 fis4 | - fis2^"en mesure" ()[fis e a fis]| - fis4-- e4-- d4-- e4-- | + fis2^"en mesure" (()[fis e a fis]| + fis4-- e4-- d4-- )e4-- | `b2()[`b^"un peu retenu" `a( d cis]| % 11 )`b [`fis^"en \'elargissant"-- `a-- `b--] cis4-- `b4--| `fis2 r2 | - cis4^"1er mouvement" d4^"tr\`es lontain" ()[d cis d e] + cis4^"1er mouvement"( d4^"tr\`es lontain" ()[d cis d e] \octave { } - | a4 gis2. | - a4 b4()[b a b 'cis] | - fis4 e4 cis2 | - e4 fis4 () [fis e fis gis] | - cis4 `b4()`b8 r8 r4^"tr\`es soutenu" | + | a4 )gis2. | + a4 (b4()[b a b 'cis] | + fis4 e4 )cis2 | + e4( fis4 () [fis e fis gis] | + cis4 `b4())`b8 r8 r4^"tr\`es soutenu" | \command { \meter 2 *4 } r4 r4 | \command { \meter 4 *4 } - 'cis4_"\dyn ppp" 'd4 () ['d 'cis 'd 'e] | - a4 gis2. | - a4 b4()[b a b 'cis] | - fis4 e4 cis2 | - e4_"\dyn pp" fis4()[fis e fis gis] | - cis4_"\dyn mf" `b4()`b8 r8 r4^"un peu plus lent" | + 'cis4_"\dyn ppp"( 'd4 () ['d 'cis 'd 'e] | + a4 )gis2. | + a4 (b4()[b a b 'cis] | + fis4 e4 )cis2 | + e4_"\dyn pp"( fis4()[fis e fis gis] | + cis4_"\dyn mf" `b4())`b8 r8 r4^"un peu plus lent" | r1 | r2 r4 r4 %^\fermata %% cut 'n paste. \octave { ' } - | d2^"Reprenez le mouvement"( [)d e cis `b] | - `a4 [`b cis] [cis `b] `b4 | - fis2( [)fis g e d] | + | d2^"Reprenez le mouvement"( ([)d e cis `b] | + `a4 [`b cis] [cis `b] )`b4 | + fis2(( [)fis g e d] | cis4 [d e(] [)e fis d cis] | `b4 [cis d(] [)d e cis `b] | - cis2 r2^"c\'edez" | + )cis2 r2^"c\'edez" | r4 fis2 fis4 | - fis2^"en mesure"()[fis e a fis] | + fis2(^"en mesure"()[fis e a fis] | fis4-- e4-- d4-- e4-- | `b2() [`b `a-. d-. cis-.] | - `b-. [`fis^"large" `a `b] cis4 `b4 `fis2 r2 | + )`b-. [`fis^"large" `a `b] cis4 `b4 `fis2 r2 | %% mark B r1^"1er mouvement" @@ -80,18 +81,18 @@ staff { \command { \meter 4 *4 } \octave { ' } - |d2( [)d e cis `b] | - `a4 [`b cis] [cis `b] `b4 | - fis2( [)fis g e d] | + |d2(( [)d e cis `b] | + `a4 [`b cis] [cis `b] )`b4 | + fis2( ([)fis g e d] | cis4 [d e(] [)e fis d cis] | `b4 [cis d(] [)d e cis `b] | - cis2 r2^"c\'edez" | + )cis2 r2^"c\'edez" | r4 fis2 fis4 | - fis2()[fis e a fis] | + fis2(()[fis e a fis] | fis4-- e4-- d4-- e4-- \octave{ } | b2()[b a 'd 'cis] | - b [fis a b ] 'cis4 b4 | + )b [fis a b ] 'cis4 b4 | fis2 r2 | r1-\fermata $} diff --git a/input/scales.ly b/input/scales.ly index 92229d02e2..63742f53c9 100644 --- a/input/scales.ly +++ b/input/scales.ly @@ -54,9 +54,9 @@ 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 diff --git a/input/standchen.lily b/input/standchen.ly similarity index 100% rename from input/standchen.lily rename to input/standchen.ly diff --git a/input/twinkle.ly b/input/twinkle.ly index f866678bc8..8664faed17 100644 --- a/input/twinkle.ly +++ b/input/twinkle.ly @@ -104,13 +104,15 @@ text3 = music { } mstaf = staff { - melodic +% melodic + complex music { melodie } commands { clef "violin" } } bass_staf = staff { - melodic +% melodic + complex music { begeleiding } commands { clef "bass" } } @@ -148,7 +150,7 @@ score { staff { english_staf } staff { bass_staf } paper { - unitspace 2.5cm % a whole note takes 2.5 cm ideally. + unitspace 2.5cm } commands { meter 2 * 4 diff --git a/ltest.tex b/ltest.tex new file mode 100644 index 0000000000..ce39b7c222 --- /dev/null +++ b/ltest.tex @@ -0,0 +1,15 @@ +% Mats Bengtsson +\documentclass[a4paper, 10pt]{article} + +% Allow for 8-bit characters: +\usepackage[latin1]{inputenc} +\usepackage[T1]{fontenc} + +\begin{document} +\input lilyponddefs +\input titledefs + +\def\settext#1{\normalfont #1} % Allow for 8-bit characters + +\input lelie.out +\end{document} diff --git a/src/bar.cc b/src/bar.cc index b18c500e62..4b3a0716eb 100644 --- a/src/bar.cc +++ b/src/bar.cc @@ -4,17 +4,18 @@ #include "paper.hh" #include "lookup.hh" +NAME_METHOD(Bar); Bar::Bar( String t) { type = t; } + Molecule* Bar::brew_molecule_p()const { Symbol s = paper()->lookup_p_->bar(type); -Molecule* output = new Molecule(Atom(s)); -return output; - + Molecule* output = new Molecule(Atom(s)); + return output; } diff --git a/src/beam.cc b/src/beam.cc index c36ca67436..abf94d157b 100644 --- a/src/beam.cc +++ b/src/beam.cc @@ -11,6 +11,8 @@ #include "lookup.hh" #include "grouping.hh" +NAME_METHOD(Beam); + struct Stem_info { Real x; Real idealy; @@ -60,7 +62,7 @@ void Beam::add(Stem*s) { stems.bottom().add(s); - s->dependencies.add(this); + s->dependencies.push(this); s->print_flag = false; } @@ -89,13 +91,13 @@ Beam::solve_slope() for (iter_top(stems,i); i.ok(); i++) { i->set_default_extents(); Stem_info info(i); - sinfo.add(info); + sinfo.push(info); } Real leftx = sinfo[0].x; Least_squares l; for (int i=0; i < sinfo.size(); i++) { sinfo[i].x -= leftx; - l.input.add(Offset(sinfo[i].x, sinfo[i].idealy)); + l.input.push(Offset(sinfo[i].x, sinfo[i].idealy)); } l.minimise(slope, left_pos); @@ -152,12 +154,12 @@ Beam::set_grouping(Rhythmic_grouping def, Rhythmic_grouping cur) for (; s.ok(); s++) { int f = intlog2(abs(s->flag))-2; assert(f>0); - flags.add(f); + flags.push(f); } int fi =0; b= cur.generate_beams(flags, fi); b.insert(0,0); - b.add(0); + b.push(0); assert(stems.size() == b.size()/2); } @@ -276,12 +278,11 @@ Beam::brew_molecule_p() const return out; } void -Beam::print()const +Beam::do_print()const { #ifndef NPRINT - mtor << "{ slope " < retval; for (iter_top(pscore_.cols,c); c.ok(); c++) if (c->breakable()) - retval.add(c); + retval.push(c); return retval; } @@ -82,7 +82,7 @@ Col_configuration::Col_configuration() void Col_configuration::add( PCol*c) { - cols.add(c); + cols.push(c); } void diff --git a/src/clefitem.cc b/src/clefitem.cc index 8b10b60107..2b451a804d 100644 --- a/src/clefitem.cc +++ b/src/clefitem.cc @@ -5,11 +5,14 @@ #include "lookup.hh" #include "clef.hh" +NAME_METHOD(Clef_item); + Clef_item::Clef_item() { change = true; read("violin"); } + void Clef_item::read(String t) { diff --git a/src/complexmelodicstaff.cc b/src/complexmelodicstaff.cc new file mode 100644 index 0000000000..66aa63ea07 --- /dev/null +++ b/src/complexmelodicstaff.cc @@ -0,0 +1,31 @@ +#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 new file mode 100644 index 0000000000..f266f7bed7 --- /dev/null +++ b/src/complexprint.cc @@ -0,0 +1,98 @@ +#include "request.hh" +#include "pscore.hh" +#include "paper.hh" +#include "complexstaff.hh" +#include "sccol.hh" +#include "debug.hh" + +#include "clefitem.hh" +#include "bar.hh" +#include "meter.hh" + +Item * +Complex_staff::get_TYPESET_item(Command *com) +{ + Item *s=0; + Array arg( com->args); + String type =arg[0]; + arg.del(0); + if (type == "BAR" ) { + s = new Bar(com->args[1]); + } else if (type == "METER") { + s = new Meter(arg); + } else if (type == "CLEF" || type == "CURRENTCLEF") { + Clef_item * c = new Clef_item; + s = c; + c->change = (type == "CLEF"); + }else{ + WARN << "ignoring TYPESET command for " << type << '\n'; + } + return s; +} + + +Interval +citemlist_width(const Array &its) +{ + Interval iv ; + iv.set_empty(); + + for (int j =0; j < its.size(); j++){ + iv.unite (its[j]->width()); + + } + return iv; +} + +void +Complex_column::typeset_item(Item *i, int breakst) +{ + assert(i); + + staff_l_->pscore_l_->typeset_item(i, score_column_l_->pcol_l_, + staff_l_->theline_l_,breakst); + + if (breakst == BREAK_PRE - BREAK_PRE) { + + Array to_move( + staff_l_->pscore_l_->select_items(staff_l_->theline_l_, + score_column_l_->pcol_l_->prebreak_p_)); + Interval column_wid = citemlist_width(to_move); + assert(!column_wid.empty()); + + for (int j=0; j < to_move.size(); j++) { + to_move[j]->translate(Offset(-column_wid.right, 0)); + } + } +} +/* + UGGGG + */ +void +Complex_column::typeset_item_directional(Item *i, int dir, int breakst) // UGH! +{ + assert(i); + PCol * c=score_column_l_->pcol_l_; + if (breakst == 0) + c = c->prebreak_p_; + else if (breakst == 2) + c = c->postbreak_p_; + + Array to_move(staff_l_->pscore_l_->select_items(staff_l_->theline_l_, + c)); + typeset_item(i, breakst); + + Interval column_wid = citemlist_width(to_move); + if (column_wid.empty()) + column_wid = Interval(0,0); + i->translate(Offset(column_wid[dir] - i->width()[-dir], 0)); +} + +void +Complex_staff::set_output(PScore* ps ) +{ + pscore_l_ = ps; + pscore_l_->add(theline_l_); +} + + diff --git a/src/complexstaff.cc b/src/complexstaff.cc new file mode 100644 index 0000000000..ffa667ea85 --- /dev/null +++ b/src/complexstaff.cc @@ -0,0 +1,58 @@ +#include "request.hh" +#include "voice.hh" +#include "staffwalker.hh" +#include "debug.hh" +#include "clef.hh" +#include "staff.hh" +#include "command.hh" +#include "complexstaff.hh" +#include "sccol.hh" +#include "complexwalker.hh" + + + +Complex_column::Complex_column(Score_column*s, Complex_staff *rs) + : Staff_column(s) +{ + staff_l_ = rs; +} + +Complex_staff::Complex_staff() +{ + theline_l_ = 0; +} + +void +Complex_column::setup_requests() +{ + for (int i = 0 ; i < v_elts.size(); i ++) + for (iter_top(v_elts[i]->reqs,j); j.ok(); j++) { + + if (j->barcheck()) { + if (tdescription_->whole_in_measure) { + error("Barcheck failed, " + tdescription_->str()); + } + continue; + } + if (j->mark()) + continue; + if (j->command()) + continue; + todo_l_arr_.push(j); + } +} + +Staff_column* +Complex_staff::create_col(Score_column*s) +{ + return new Complex_column(s,this); +} + +void +Complex_staff::walk() +{ + for (Complex_walker sc(this); sc.ok(); sc++) { + sc.col()->setup_requests();// TODO + sc.process(); + } +} diff --git a/src/complexwalker.cc b/src/complexwalker.cc new file mode 100644 index 0000000000..5cc1b5b6a5 --- /dev/null +++ b/src/complexwalker.cc @@ -0,0 +1,241 @@ +#include "associter.hh" +#include "script.hh" +#include "request.hh" +#include "voice.hh" +#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); +} + +void +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); + }else if (com->args[0] == "NEWMEASURE") { + local_key_.reset(key_); + + } else if (com->args[0] == "KEY") { + + if (col()->when() > Moment(0)) { + assert(!oldkey_undo); + oldkey_undo = new Array( key_.oldkey_undo(args)); + } + + typesetkey = key_.read(args); + local_key_.reset(key_); + } else if (com->args[0] == "CLEF") { + clef_.read(args); + } else { + WARN << " ignoring INTERPRET command: " << com->args[0]<< "\n"; + } +} + +void +Complex_walker::do_TYPESET_command(Command*com) +{ + /* ignore these commands if non-default versions have been + processed. */ + if (com->args[0] == "CURRENTKEY") + if (processed_key) + return; + else + com->args[0] = "KEY"; // urgh + + if (com->args[0] == "CURRENTCLEF") { + if (processed_clef) + return; + } + if (com->args[0] == "BAR") { + + if (processed_bar_priority > com->priority) + return; + else + processed_bar_priority = com->priority; + } + + Item* i = staff()->get_TYPESET_item(com); + if (!i) + return; + + if (com->args[0] == "KEY") { + ((Keyitem*) i)->read(clef_); + if (oldkey_undo) { + ((Keyitem*) i)->read(*oldkey_undo); + delete oldkey_undo; + oldkey_undo = 0; + } + processed_key = true; + + ((Keyitem*) i)->read(typesetkey); // ugh + } + + if (com->args[0] == "CLEF"||com->args[0] == "CURRENTCLEF") { + processed_clef =true; + Clef_item*c=(Clef_item*)i; + c->read(clef_); + c->change = (break_status != BREAK_POST - BREAK_PRE); + } + col()->typeset_item_directional(i, 1, break_status); +} + +void +Complex_walker::announce_element(Staff_elem_info info) +{ + 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); + local_key_reg_.acknowledge_element(info); + } +} + +Voice_registers * +Complex_walker::find_voice_reg(Voice*v_l) +{ + for (iter_top(voice_reg_list_, i); i.ok(); i++) { + if (i->voice_l_ == v_l) + return i; + } + + Voice_registers *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; +} + +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); + + b = vregs_l->try_request(req); + + } else { + b = group_regs_.try_request(req); + if (!b) + b = local_key_reg_.try_request(req); + } + if (!b) + WARN<< "junking request: " <name() <<"\n"; +} + +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]); + } + + regs_process_requests(); + do_announces(); +} + +void +Complex_walker::regs_process_requests() +{ + for (iter_top(voice_reg_list_,j); j.ok(); j++) { + j->process_requests(); + } + group_regs_.process_requests(); + local_key_reg_.process_request(); +} + +void +Complex_walker::typeset_element(Staff_elem *elem_p) +{ + if (elem_p->spanner()) + pscore_l_->typeset_spanner(elem_p->spanner(), staff()->theline_l_); + else + col()->typeset_item(elem_p->item()); +} + +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; + do_post_move(); +} + +Complex_staff* +Complex_walker::staff() +{ + return (Complex_staff*) staff_l_; +} + +Complex_column* +Complex_walker::col() +{ + return (Complex_column*) *(*this); +} + +void +Complex_walker::do_pre_move() +{ + for (iter_top(voice_reg_list_,i); i.ok(); i++) { + i->pre_move_processing(); + } + group_regs_.pre_move_processing(); + local_key_reg_.pre_move_processing(); +} + +void +Complex_walker::do_post_move() +{ + processed_clef =false; + processed_key = false; + processed_bar_priority = 0; + + for (iter_top(voice_reg_list_,i); i.ok(); i++) { + i->post_move_processing(); + } + announce_info_arr_.set_size(0); + group_regs_.post_move_processing(); + local_key_reg_.post_move_processing(); +} diff --git a/src/getcommands.cc b/src/getcommands.cc index a11e2c0fe3..61a3f59f62 100644 --- a/src/getcommands.cc +++ b/src/getcommands.cc @@ -21,9 +21,9 @@ get_meter_command(int n, int m) Command*c = new Command; c->code = TYPESET; - c->args.add( "METER"); - c->args.add( n ); - c->args.add( m ); + c->args.push( "METER"); + c->args.push( n ); + c->args.push( m ); c->priority = 40; return c; } @@ -33,8 +33,8 @@ get_defaultbar_command() { Command c; c.code = TYPESET; - c.args.add("BAR"); - c.args.add("default"); + c.args.push("BAR"); + c.args.push("default"); return c; } @@ -45,21 +45,21 @@ split_bar_command(Command &pre_com, Command &no_break_com, Command &post_com, Command c; c.code = TYPESET; c.priority = (s=="default") ? 100: 110; - c.args.add("BAR"); + c.args.push("BAR"); if(s=="default") s = "|"; if (s == ":|:") { no_break_com=post_com=pre_com = c; - pre_com.args.add( ":|"); - no_break_com.args.add( s); - post_com.args.add( "|:"); + pre_com.args.push( ":|"); + no_break_com.args.push( s); + post_com.args.push( "|:"); }else if (s=="|:") { - c.args.add(s); + c.args.push(s); no_break_com=post_com=c; } else { - c.args.add(s); + c.args.push(s); pre_com= no_break_com= c; } } diff --git a/src/grouping.cc b/src/grouping.cc index 4f02b75378..06f906ff91 100644 --- a/src/grouping.cc +++ b/src/grouping.cc @@ -67,10 +67,10 @@ Rhythmic_grouping::intervals() MInterval i(interval()); MInterval r1(i), r2(i); r1.right = r2.left = i.center(); - r.add(r1); r.add(r2); + r.push(r1); r.push(r2); } else { for (int i=0; i < children.size(); i++) - r.add(children[i]->interval()); + r.push(children[i]->interval()); } return r; } @@ -124,12 +124,12 @@ Rhythmic_grouping::split(Array splitpoints) } else { if (i == starti) { - ch.add(children[i]); + ch.push(children[i]); } else { Rhythmic_grouping *newchild=new Rhythmic_grouping( children.subvec(starti, i+1)); - ch.add(newchild); + ch.push(newchild); } i ++; j++; @@ -154,7 +154,7 @@ Rhythmic_grouping::Rhythmic_grouping(MInterval t, int n) Moment dt = t.length()/n; MInterval basic = MInterval(t.left, t.left+dt); for (int i= 0; i < n; i++) - children.add(new Rhythmic_grouping( dt*i + basic )); + children.push(new Rhythmic_grouping( dt*i + basic )); } @@ -174,7 +174,7 @@ Rhythmic_grouping::copy(Rhythmic_grouping const&s) { interval_ = (s.interval_)? new MInterval(*s.interval_) : 0; for (int i=0; i < s.children.size(); i++) - children.add(new Rhythmic_grouping(*s.children[i])); + children.push(new Rhythmic_grouping(*s.children[i])); } void @@ -213,21 +213,22 @@ Rhythmic_grouping::print()const #endif } +bool +Rhythmic_grouping::child_fit_query(Moment start) +{ + if (children.size()) + return ( children.last()->interval().right== start); + + return true; +} + void Rhythmic_grouping::add_child(Moment start, Moment len) { Moment stop = start+len; - for (int i=0; i < children.size(); i ++) { - MInterval j=children[i]->interval(); - if (j.left == start && j.right==stop) { - return; - } - } - - if (children.size()) - assert ( children.last()->interval().right== start); - children.add(new Rhythmic_grouping(MInterval(start, stop))); + assert(child_fit_query(start)); + children.push(new Rhythmic_grouping(MInterval(start, stop))); } Rhythmic_grouping::Rhythmic_grouping() @@ -255,12 +256,12 @@ Rhythmic_grouping::generate_beams(Array flags, int &flagidx) Array child_beams; if (children[i]->interval_) { int f = flags[flagidx++]; - child_beams.add(f); + child_beams.push(f); } else { child_beams = children[i]-> generate_beams(flags, flagidx); } - children_beams.add(child_beams); + children_beams.push(child_beams); } Array beams; int lastm, m, nextm; @@ -275,15 +276,15 @@ Rhythmic_grouping::generate_beams(Array flags, int &flagidx) if (children_beams[i].size() == 1) { if (add_right) - beams.add(m); + beams.push(m); if (add_left) - beams.add(m); + beams.push(m); } else { if (add_left) - beams.add(lastm beam() ) { + if (bool(beam_p_ ) == bool(req_l->beam()->spantype == Span_req::START)) + return false; + + if (beam_req_l_ && Beam_req::compare(*beam_req_l_ , *req_l->beam())) + return false; + + beam_req_l_ = req_l->beam(); + return true; + } + + if ( req_l->stem() ) { + if (current_grouping && !current_grouping->child_fit_query( + walk_l_->col()->tdescription_->whole_in_measure)) + return false; + + if (stem_req_l_ && Stem_req::compare(*stem_req_l_, *req_l->stem())) + return false; + + stem_req_l_ = req_l->stem(); + return true; + } + return false; +} + +void +Stem_beam_register::process_request() +{ + if (beam_req_l_) { + if (beam_req_l_->spantype == Span_req::STOP) + end_beam_b_ = true; + else { + beam_p_ = new Beam; +// walk_l_->announce_element(Staff_elem_info(beam_p_, )) + current_grouping = new Rhythmic_grouping; + if (beam_req_l_->nplet) { + Text_spanner* t = new Text_spanner(); + t->set_support(beam_p_); + t->spec.align_i_ = 0; + t->spec.text_str_ = beam_req_l_->nplet; + walk_l_->typeset_element(t); + } + + } + } + + if (stem_req_l_) { + stem_p_ = new Stem(4); + if (current_grouping) + current_grouping->add_child( + walk_l_->col()->tdescription_->whole_in_measure, + stem_req_l_->duration()); + + stem_p_->flag = stem_req_l_->balltype; + + if (beam_p_) { + beam_p_->add(stem_p_); + stem_p_->print_flag = false; + } else { + stem_p_->print_flag = true; + } + + walk_l_->announce_element(Staff_elem_info(stem_p_, + stem_req_l_, this)); + } +} + +void +Stem_beam_register::acknowledge_element(Staff_elem_info info) +{ + if (!stem_p_) + return; + + if (info.elem_p_->name() == String("Notehead") && + stem_req_l_->duration() == info.req_l_->rhythmic()->duration()) + + stem_p_->add((Notehead*)info.elem_p_); +} + +void +Stem_beam_register::do_pre_move_process() +{ + if (stem_p_) { + walk_l_->typeset_element(stem_p_); + stem_p_ = 0; + } + if (beam_p_ && end_beam_b_) { + walk_l_->default_grouping.extend(current_grouping->interval()); + beam_p_->set_grouping(walk_l_->default_grouping, *current_grouping); + walk_l_->typeset_element(beam_p_); + delete current_grouping; + current_grouping = 0; + beam_p_ = 0; + } + end_beam_b_ = false; +} +void +Stem_beam_register::do_post_move_process() +{ + stem_p_ = 0; + beam_req_l_ = 0; + stem_req_l_ = 0; + end_beam_b_ = false; +} + +Stem_beam_register::~Stem_beam_register() +{ + if (beam_p_) + error("unterminated beam"); +} diff --git a/src/inputcommand.cc b/src/inputcommand.cc index 02e7e72813..251adedc85 100644 --- a/src/inputcommand.cc +++ b/src/inputcommand.cc @@ -39,8 +39,8 @@ Input_command* get_partial_command(Moment u) { Input_command*c = new Input_command; - c->args.add("PARTIAL"); - c->args.add(u); + c->args.push("PARTIAL"); + c->args.push(u); return c; } @@ -48,8 +48,8 @@ Input_command* get_goto_command(String s) { Input_command*c = new Input_command; - c->args.add("GOTO"); - c->args.add(s); + c->args.push("GOTO"); + c->args.push(s); return c; } @@ -58,17 +58,17 @@ get_cadenza_toggle(int i) { Input_command*c = new Input_command; - c->args.add("CADENZA"); - c->args.add(i); + c->args.push("CADENZA"); + c->args.push(i); return c; } Input_command* get_grouping_command(Arraya ) { Input_command*c = new Input_command; - c->args.add("GROUPING"); + c->args.push("GROUPING"); for (int i=0; i < a.size(); i ++) - c->args.add(a[i]); + c->args.push(a[i]); return c; } @@ -77,9 +77,9 @@ Input_command* get_key_interpret_command(Arraya ) { Input_command*c = new Input_command; - c->args.add("KEY"); + c->args.push("KEY"); for (int i=0; i < a.size(); i ++) { - c->args.add(a[i]); + c->args.push(a[i]); } return c; } @@ -88,7 +88,7 @@ Input_command* get_reset_command() { Input_command*c = new Input_command; - c->args.add("RESET"); + c->args.push("RESET"); return c; } @@ -97,9 +97,9 @@ get_meterchange_command(int n, int m) { Input_command*c = new Input_command; - c->args.add( "METER"); - c->args.add( n ); - c->args.add( m ); + c->args.push( "METER"); + c->args.push( n ); + c->args.push( m ); return c; } @@ -108,7 +108,7 @@ Input_command * get_newmeasure_command() { Input_command*c = new Input_command; - c->args.add( "NEWMEASURE"); + c->args.push( "NEWMEASURE"); return c; } @@ -117,9 +117,9 @@ get_skip_command(int n, Moment m) { Input_command*c = new Input_command; - c->args.add( "SKIP"); - c->args.add( n ); - c->args.add( m ); + c->args.push( "SKIP"); + c->args.push( n ); + c->args.push( m ); return c; } @@ -143,8 +143,8 @@ Input_command* get_clef_interpret_command(String w) { Input_command*c = new Input_command; - c->args.add("CLEF"); - c->args.add(w); + c->args.push("CLEF"); + c->args.push(w); return c; } @@ -152,8 +152,8 @@ Input_command* get_bar_command(String w) { Input_command*c = new Input_command; - c->args.add("BAR"); - c->args.add(w); + c->args.push("BAR"); + c->args.push(w); return c; } @@ -163,12 +163,12 @@ get_default_grouping(int count) Array s; if (!(count % 3 )) { for (int i=0; i < count/3; i++) - s.add(3); + s.push(3); } else if (!(count %2)) { for (int i=0; i < count/2; i++) - s.add(2); + s.push(2); }else { - s.add(2); + s.push(2); s.concat(get_default_grouping(count-2)); } return s; diff --git a/src/inputscore.cc b/src/inputscore.cc index 28e1f71599..6ea13d9b5d 100644 --- a/src/inputscore.cc +++ b/src/inputscore.cc @@ -40,7 +40,7 @@ Input_score::parse() Array parsed_staffs; for (iter_top(staffs_,i); i.ok(); i++) { Staff* staf_p=i->parse(s_p); - parsed_staffs.add(staf_p); + parsed_staffs.push(staf_p); s_p->add(staf_p); } int j = 0; diff --git a/src/inputstaff.cc b/src/inputstaff.cc index 70d91c669f..3c3909468d 100644 --- a/src/inputstaff.cc +++ b/src/inputstaff.cc @@ -8,6 +8,7 @@ #include "melodicstaff.hh" #include "rhythmstaff.hh" #include "lyricstaff.hh" +#include "complexmelodicstaff.hh" #include "staff.hh" void @@ -34,13 +35,18 @@ Staff* Input_staff::parse(Score*score_l) { Staff *p=0; - - if (type == "melodic") + + if (type == "complex") + p = new Complex_melodic_staff; + else if (type == "melodic") p = new Melodic_staff; else if (type == "rhythmic") p = new Rhythmic_staff; else if (type == "lyric") p = new Lyric_staff; + else + error("Unknown staff-type `" + type +"\'"); + p->score_l_ = score_l; p->define_spot_str_ = define_spot_str_; diff --git a/src/item.cc b/src/item.cc index 11096c95c0..3ea6c0445e 100644 --- a/src/item.cc +++ b/src/item.cc @@ -1,18 +1,18 @@ #include "debug.hh" #include "item.hh" +NAME_METHOD(Item); + Item::Item() { pcol_l_ = 0; } void -Item::print() const +Item::do_print() const { #ifndef NPRINT - mtor << "item " ; - Staff_elem::print(); + mtor << "(unknown)"; #endif - } diff --git a/src/key.cc b/src/key.cc index cd7f400737..232ce9a94f 100644 --- a/src/key.cc +++ b/src/key.cc @@ -48,8 +48,8 @@ Key::read(Array s) int small = s[i++]; accidentals[large]=small; - newkey.add(large); - newkey.add(small); + newkey.push(large); + newkey.push(small); } return newkey; } @@ -70,8 +70,8 @@ Key::oldkey_undo(Arrays) } for (int i=0; i < newkey.size(); i++) if (accidentals[i] && accidentals[i] != newkey[i]) { - oldkey.add(i); - oldkey.add(0); + oldkey.push(i); + oldkey.push(0); } diff --git a/src/keyitem.cc b/src/keyitem.cc index 9ae9c22289..017570d749 100644 --- a/src/keyitem.cc +++ b/src/keyitem.cc @@ -8,7 +8,7 @@ const int FLAT_TOP_PITCH=2; /* fes,ges,as and bes typeset in lower octave */ const int SHARP_TOP_PITCH=4; /* ais and bis typeset in lower octave */ - +NAME_METHOD(Keyitem); Keyitem::Keyitem(int c) { c_position = c; @@ -39,8 +39,8 @@ Keyitem::add(int p, int a) (a>0 && p>SHARP_TOP_PITCH)) { p=p-7; /* Typeset below c_position */ } - pitch.add(p); - acc.add(a); + pitch.push(p); + acc.push(a); } diff --git a/src/lexer.l b/src/lexer.l index dbe7755601..4446661d8e 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -17,6 +17,8 @@ %option yylineno %option debug %option yyclass="My_flex_lexer" +%option stack + %x notes %x incl %x quote @@ -30,7 +32,8 @@ N [0-9] AN {AA}|{N} PUNCT [?!,.:;] ACCENT [\\'"^] -TEX {AA}|-|{PUNCT}|{ACCENT} +NATIONAL [\241-\377] +TEX {AA}|-|{PUNCT}|{ACCENT}|{NATIONAL} WORD {A}{AN}* ALPHAWORD {A}+ @@ -49,11 +52,11 @@ COMMENT [%#].*\n %% \$ { - BEGIN(notes); + yy_push_state(notes); } \@ { - BEGIN(lyrics); + yy_push_state(lyrics); } {RESTNAME} { @@ -86,9 +89,8 @@ COMMENT [%#].*\n return IDENTIFIER; } String *sp = new String( c); - yylval.string=sp; - return NEWIDENTIFIER; + return STRING; } {PITCHMOD} { @@ -111,13 +113,9 @@ COMMENT [%#].*\n } \$ { - BEGIN(INITIAL); + yy_pop_state(); } -[{}] { - return YYText()[0]; - -} -\"[^\"]*\" { +\"[^"]*\" { String s (YYText()+1); s = s.left(s.len()-1); yylval.string = new String(s); @@ -128,14 +126,14 @@ COMMENT [%#].*\n } \" { - BEGIN(quote); + yy_push_state(quote); } -[^\"]* { +[^"]* { yylval.string = new String (YYText()); } \" { mtor << "quoted string\n"; - BEGIN(INITIAL); + yy_pop_state(); return STRING; } @@ -155,7 +153,7 @@ COMMENT [%#].*\n return l; /* let's try passing tex's typesetting macros like \ss \alpha \c */ - String* str_p = new String(YYText()); + String* str_p = new String(YYText());//huh? return STRING; /* and skip identifiers... @@ -167,10 +165,10 @@ COMMENT [%#].*\n String *sp = new String( c); yylval.string=sp; - return NEWIDENTIFIER; + return STRING; */ } -\"[^\"]*\" { +\"[^"]*\" { String s (YYText()+1); s = s.left(s.len()-1); yylval.string = new String(s); @@ -204,7 +202,7 @@ COMMENT [%#].*\n [ \t\n]+ { } @ { - BEGIN(INITIAL); + yy_pop_state(); } <> { @@ -215,13 +213,15 @@ COMMENT [%#].*\n } -include { BEGIN(incl); } +include { + yy_push_state(incl); +} [ \t]* { /* eat the whitespace */ } \"[^"]*\"+ { /* got the include file name */ String s (YYText()+1); s = s.left(s.len()-1); new_input(s); - BEGIN(INITIAL); + yy_pop_state(); } @@ -239,7 +239,7 @@ include { BEGIN(incl); } String *sp = new String( c); mtor << "new id: " << *sp << eol; yylval.string=sp; - return NEWIDENTIFIER; + return STRING; } {REAL} { diff --git a/src/lexerinit.cc b/src/lexerinit.cc index cd2dc79719..cc69a4a6bb 100644 --- a/src/lexerinit.cc +++ b/src/lexerinit.cc @@ -22,22 +22,6 @@ busy_parsing() return lexer; } -void -kill_lexer() -{ - delete lexer; - lexer = 0; -} - -void -set_lexer() -{ - if (!lexer) { - lexer = new My_flex_lexer; - lexer->set_debug( !monitor.silence("Lexer") && check_debug); - } -} - Input_file::Input_file(String s) { name = s; diff --git a/src/linespace.cc b/src/linespace.cc index 8ce517a7a2..b70e2a26f5 100644 --- a/src/linespace.cc +++ b/src/linespace.cc @@ -42,7 +42,7 @@ Spacing_problem::OK() const } for (int i = 0; i < cols.size(); i++) if (cols[i].fixed()) - fixed.add(i); + fixed.push(i); for (int i = 0; i < cols.size(); i++) { bool c=false; for (int j =0; j posns(sol); - posns.add(lp.eval(sol)); + posns.push(lp.eval(sol)); return posns; } @@ -197,7 +197,7 @@ void Spacing_problem::add_column(const PCol *col, bool fixed, Real fixpos) { Colinfo c(col,(fixed)? &fixpos : 0); - cols.add(c); + cols.push(c); } void @@ -209,7 +209,7 @@ Spacing_problem::add_ideal(const Idealspacing *i) if (!contains(l) || !contains(r)) { return; } - ideals.add(i); + ideals.push(i); } void diff --git a/src/localkeyitem.cc b/src/localkeyitem.cc index b210dbdac3..383f875d42 100644 --- a/src/localkeyitem.cc +++ b/src/localkeyitem.cc @@ -3,22 +3,33 @@ #include "scalar.hh" #include "lookup.hh" #include "paper.hh" +#include "request.hh" #include "notehead.hh" + +NAME_METHOD(Local_key_item); Local_key_item::Local_key_item(int i) { c0_position = i; } - void -Local_key_item::add (int o, int p , int a,Notehead*head_p) +Local_key_item::add(Item*head_l) +{ + group.push(head_l); + dependencies.push(head_l); +} +void +Local_key_item::add(Melodic_req*m_l) +{ + add(m_l->octave, m_l->notename, m_l->accidental); +} +void +Local_key_item::add (int o, int p , int a) { Local_acc l; l.octave = o; l.name = p; l.acc = a; - accs.add(l); - group.add(head_p); - dependencies.add(head_p); + accs.push(l); } void @@ -26,11 +37,11 @@ Local_key_item::do_pre_processing() { accs.sort(Local_acc::compare); } + Molecule* Local_key_item::brew_molecule_p()const { - - Molecule* output = new Molecule; + Molecule* output = new Molecule; Molecule*octmol = 0; int lastoct = -100; for (int i = 0; i < accs.size(); i++) { @@ -58,6 +69,13 @@ Local_key_item::brew_molecule_p()const output->add(*octmol); delete octmol; } + + Interval head_width; + for (int i = 0; i < group.size(); i++) { + head_width.unite(group[i]->width()); + } + output->translate(Offset(-output->extent().x.right + head_width.left ,0)); + return output; } diff --git a/src/lookup.cc b/src/lookup.cc index befa542706..a9c5d18731 100644 --- a/src/lookup.cc +++ b/src/lookup.cc @@ -33,7 +33,7 @@ Lookup::text(String style, String text, int dir) { Array a; - a.add(text); + a.push(text); Symbol tsym = (*symtables_)("style")->lookup(style); a[0] = substitute_args(tsym.tex,a); @@ -132,7 +132,7 @@ Lookup::streepjes(int i) Symbol ret = (*symtables_)("streepjes")->lookup(idx); Array a; - a.add(arg); + a.push(arg); ret.tex = substitute_args(ret.tex, a); return ret; @@ -149,8 +149,8 @@ Lookup::linestaff(int lines, Real wid) s.dim.y = Interval(0,dy); Array a; - a.add(lines); - a.add(print_dimen(wid)); + a.push(lines); + a.push(print_dimen(wid)); s.tex = (*symtables_)("param")->lookup("linestaf").tex; s.tex = substitute_args(s.tex, a); @@ -182,8 +182,8 @@ Lookup::stem(Real y1,Real y2) s.dim.y = Interval(y1,y2); Array a; - a.add(print_dimen(y1)); - a.add(print_dimen(y2)); + a.push(print_dimen(y1)); + a.push(print_dimen(y2)); String src = (*symtables_)("param")->lookup("stem").tex; s.tex = substitute_args(src,a); diff --git a/src/lyriccolumn.cc b/src/lyriccolumn.cc index 6420c4b3d9..45f30836ed 100644 --- a/src/lyriccolumn.cc +++ b/src/lyriccolumn.cc @@ -3,14 +3,12 @@ #include "staffwalker.hh" #include "debug.hh" #include "staff.hh" -#include "command.hh" -//#include "simplestaff.hh" +//#include "command.hh" #include "lyricstaff.hh" #include "lyriccolumn.hh" #include "sccol.hh" -//#include "simplewalker.hh" #include "pscore.hh" -#include "paper.hh" +//#include "paper.hh" Lyric_column::Lyric_column(Score_column*s, Lyric_staff* lstaff_l) @@ -20,7 +18,7 @@ Lyric_column::Lyric_column(Score_column*s, Lyric_staff* lstaff_l) } void -Lyric_column::process_requests() +Lyric_column::setup_requests() { for (int i = 0 ; i < v_elts.size(); i ++) { for (iter_top(v_elts[i]->reqs,j); j.ok(); j++) { @@ -30,13 +28,8 @@ Lyric_column::process_requests() error("Barcheck failed, " + tdescription_->str()); } } -#if 0 - if (req_l->rhythmic()){ - notes.add(rq->rhythmic()); - } -#endif if (req_l->lreq_l()) { - winfo_array_.add(req_l->lreq_l()); + winfo_array_.push(req_l->lreq_l()); } } } diff --git a/src/lyricstaff.cc b/src/lyricstaff.cc index 51b802e077..3afea78a8f 100644 --- a/src/lyricstaff.cc +++ b/src/lyricstaff.cc @@ -36,12 +36,7 @@ void Lyric_staff::walk() { for (Lyric_walker lcols(this); lcols.ok(); lcols++) { - lcols.lcol_l()->process_requests();// TODO + lcols.lcol_l()->setup_requests();// TODO lcols.process(); } } -Staff * -get_new_lyricstaff() -{ - return new Lyric_staff; -} diff --git a/src/lyricwalker.cc b/src/lyricwalker.cc index bd8ac0e40d..d28c488b72 100644 --- a/src/lyricwalker.cc +++ b/src/lyricwalker.cc @@ -6,8 +6,6 @@ // or should we first devide lily/src up ? // HWN: huh? -#include "textspanner.hh" -#include "script.hh" #include "request.hh" #include "voice.hh" #include "pscore.hh" @@ -56,7 +54,7 @@ Lyric_walker::Lyric_walker(Lyric_staff* lstaff_l) Lyric_staff* Lyric_walker::lstaff_l() { - return (Lyric_staff*)staff_; + return (Lyric_staff*)staff_l_; } Lyric_column* diff --git a/src/main.cc b/src/main.cc index 67ccf5dfeb..8ac50296ee 100644 --- a/src/main.cc +++ b/src/main.cc @@ -41,7 +41,9 @@ void notice() "LilyPond, a music typesetter.\n" "Copyright (C) 1996,97 by\n" " Han-Wen Nienhuys \n" + "Contributors\n" " Jan-Nieuwenhuizen \n" + " Mats Bengtsson \n" "\n" " This program is free software; you can redistribute it and/or\n" "modify it under the terms of the GNU General Public License version 2\n" @@ -62,7 +64,7 @@ static File_path * path =0; struct Main_init { Main_init() { path = new File_path(LIBDIR); - path->add(String(LIBDIR)+"init/"); + path->push(String(LIBDIR)+"init/"); debug_init(); } ~Main_init() { @@ -86,7 +88,7 @@ main (int argc, char **argv) exit(0); break; case 'I': - path->add(oparser.optarg); + path->push(oparser.optarg); break; case 'h': help(); diff --git a/src/melodicstaff.cc b/src/melodicstaff.cc index e533fd3143..849a64b209 100644 --- a/src/melodicstaff.cc +++ b/src/melodicstaff.cc @@ -6,7 +6,7 @@ #include "paper.hh" #include "molecule.hh" #include "linepstaff.hh" -#include "rhythmstaff.hh" +//#include "rhythmstaff.hh" #include "sccol.hh" #include "localkeyitem.hh" #include "request.hh" @@ -25,12 +25,8 @@ Melodic_staff::set_output(PScore*ps) Notehead* Melodic_staff::get_notehead(Note_req *rq, int bottom) { - int b = rq->rhythmic()->balltype; - int d = rq->rhythmic()->dots; - Notehead *n =new Notehead((NO_LINES-1)*2); - n->balltype =b; - n->dots = d; + n->set_rhythmic(rq->rhythmic()); n->position = rq->note()->height() + bottom; return n; } @@ -45,22 +41,13 @@ Melodic_staff::get_TYPESET_item(Command*com) } Stem * -Melodic_staff::get_stem(Stem_req*rq, Moment dur) +Melodic_staff::get_stem(Stem_req*rq) { - Stem * s = new Stem(NO_LINES-1, dur); - s->flag = rq->stem_number; + Stem * s = new Stem(NO_LINES-1); + s->flag = rq->balltype; return s; } -/* - creation - */ -Staff * -get_new_melodicstaff() -{ - return new Melodic_staff; -} - Rest* Melodic_staff::get_rest(Rest_req*rq) { diff --git a/src/meter.cc b/src/meter.cc index ba653dae2a..bd3f763c00 100644 --- a/src/meter.cc +++ b/src/meter.cc @@ -3,7 +3,7 @@ #include "meter.hh" #include "paper.hh" #include "lookup.hh" - +NAME_METHOD(Meter); Meter::Meter(Arraya) :args(a) { diff --git a/src/molecule.cc b/src/molecule.cc index 682204880d..1e09658fee 100644 --- a/src/molecule.cc +++ b/src/molecule.cc @@ -33,9 +33,9 @@ Atom::TeXstring() const // whugh.. Hard coded... String s("\\placebox{%}{%}{%}"); Array a; - a.add(print_dimen(off.y)); - a.add(print_dimen(off.x)); - a.add(sym.tex); + a.push(print_dimen(off.y)); + a.push(print_dimen(off.x)); + a.push(sym.tex); return substitute_args(s, a); } diff --git a/src/mylexer.cc b/src/mylexer.cc index d2e4b18ff8..acda945d3f 100644 --- a/src/mylexer.cc +++ b/src/mylexer.cc @@ -22,9 +22,7 @@ static Keyword_ent the_key_tab[]={ "goto", GOTO, "in", IN, "key", KEY, - "lyric", LYRIC, "mark", MARK, - "melodic", MELODIC, "meter", METER, "mm", MM, "octave", OCTAVECOMMAND, @@ -33,7 +31,6 @@ static Keyword_ent the_key_tab[]={ "paper", PAPER, "plet", PLET, "pt", PT, - "rhythmic", RHYTHMIC, "score", SCORE, "script", SCRIPT, "skip", SKIP, diff --git a/src/note.cc b/src/note.cc index 0cd2c478a6..f53b002d86 100644 --- a/src/note.cc +++ b/src/note.cc @@ -82,18 +82,19 @@ get_note_element(String pitch, int * notename, int * duration ) int dur = duration[0]; int dots=duration[1]; - - Note_req * rq = new Note_req; if (dur >= 2) { - Stem_req * st = new Stem_req(dur); + Stem_req * st = new Stem_req(dur,dots); + st->plet_factor = Moment(default_plet_dur, default_plet_type); v->add(st); } + Note_req * rq = new Note_req; + int oct; bool forceacc; parse_pitchmod(pitch, i, oct, forceacc); - rq->name =notename[0]; + rq->notename =notename[0]; rq->accidental = notename[1]; rq->octave = oct; rq->forceacc = forceacc; @@ -174,6 +175,7 @@ get_request(char c) case '|': ret = new Barcheck_req; break; + case '[': case ']': { @@ -184,6 +186,7 @@ get_request(char c) } break; + case ')': case '(': ret = new Slur_req; @@ -204,7 +207,6 @@ get_request(char c) break; default: - break; } diff --git a/src/notehead.cc b/src/notehead.cc index 859e41fad9..fb4e80719b 100644 --- a/src/notehead.cc +++ b/src/notehead.cc @@ -5,7 +5,9 @@ #include "paper.hh" #include "lookup.hh" #include "molecule.hh" +#include "request.hh" +NAME_METHOD(Notehead); Notehead::Notehead(int ss) { @@ -16,14 +18,19 @@ Notehead::Notehead(int ss) dots = 0; extremal = 0; } - void -Notehead::print()const +Notehead::set_rhythmic(Rhythmic_req*r_req_l) +{ + balltype = r_req_l->balltype; + dots = r_req_l->dots; +} + +void +Notehead::do_print()const { #ifndef NPRINT - mtor << "Head "<< balltype << ", position = "<< position + mtor << "balltype "<< balltype << ", position = "<< position << "dots " << dots; - Item::print(); #endif } @@ -64,7 +71,6 @@ Notehead::brew_molecule_p() const return out; out->add(sm); } - out->translate(Offset(0,dy*position)); } diff --git a/src/parser.y b/src/parser.y index aa3b4f2f37..f36d153113 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(); + %} @@ -63,13 +64,12 @@ Paperdef*default_paper(); %token VOICE STAFF SCORE TITLE BAR NOTENAME OUTPUT %token CM IN PT MM PAPER WIDTH METER UNITSPACE SKIP COMMANDS COMMAND %token GEOMETRIC START_T DURATIONCOMMAND OCTAVECOMMAND -o%token KEY CLEF MULTI TABLE CHORD VOICES -%token PARTIAL RHYTHMIC MELODIC MUSIC LYRIC GROUPING CADENZA +%token KEY CLEF MULTI TABLE CHORD VOICES +%token PARTIAL MUSIC GROUPING CADENZA %token END SYMBOLTABLES TEXID TABLE NOTENAMES SCRIPT TEXTSTYLE PLET %token MARK GOTO %token IDENTIFIER -%token NEWIDENTIFIER %token PITCHMOD DURATION RESTNAME %token NOTENAME %token REAL @@ -135,7 +135,7 @@ add_declaration: declaration { ; declarable_identifier: - NEWIDENTIFIER { $$ = $1; } + STRING { $$ = $1; } | IDENTIFIER { $$ = new String($1->name); } ; @@ -212,10 +212,10 @@ score_commands_block: score_commands_body: { $$ = new Array; } | score_commands_body score_command { - $$->add($2); + $$->push($2); } | score_commands_body position_command { - $$->add($2); + $$->push($2); } ; @@ -226,10 +226,10 @@ staff_commands_block: COMMANDS '{' staff_commands_body '}' { staff_commands_body: /* empty */ { $$ = new Array; } | staff_commands_body staff_command { - $$->add($2); + $$->push($2); } | staff_commands_body position_command { - $$->add($2); + $$->push($2); } ; @@ -324,14 +324,9 @@ staff_block: staff_init: IDENTIFIER { $$ = $1->staff(true); } - | RHYTHMIC { - $$ = new Input_staff("rhythmic"); - } - | MELODIC { - $$ = new Input_staff( "melodic"); - } - | LYRIC { - $$ = new Input_staff( "lyric"); + | STRING { + $$ = new Input_staff(*$1); + delete $1; } ; @@ -415,7 +410,7 @@ post_requests: assert(post_reqs.empty()); } | post_requests post_request { - post_reqs.add($2); + post_reqs.push($2); } ; @@ -424,14 +419,15 @@ post_request: | script_req | textscript_req ; + close_request_parens: '(' { $$='('; } - |']' { $$ = ']' } + |']' { $$=']'; } ; open_request_parens: - ')' {$$=')'} - |'[' {$$='['} + ')' { $$=')'; } + |'[' { $$='['; } ; script_definition: @@ -481,7 +477,7 @@ script_dir: pre_requests: | pre_requests pre_request { - pre_reqs.add($2); + pre_reqs.push($2); } ; @@ -554,8 +550,8 @@ pitch_list: { $$ = new Array; } | pitch_list NOTENAME { - $$->add($2[0]); - $$->add($2[1]); + $$->push($2[0]); + $$->push($2[1]); } ; @@ -573,7 +569,7 @@ int_list: $$ = new Array; } | int_list int { - $$->add($2); + $$->push($2); } ; @@ -657,22 +653,26 @@ void parse_file(String s) { *mlog << "Parsing ... "; + lexer = new My_flex_lexer; #ifdef YYDEBUG yydebug = !monitor.silence("InitParser") && check_debug; + lexer->set_debug( !monitor.silence("InitLexer") && check_debug); #endif - set_lexer(); lexer->new_input("symbol.ini"); yyparse(); #ifdef YYDEBUG yydebug = !monitor.silence("Parser") && check_debug; + lexer->set_debug( !monitor.silence("Lexer") && check_debug); #endif lexer->new_input(s); yyparse(); - kill_lexer(); + delete lexer; + lexer = 0; + assert(define_spots.empty()); } diff --git a/src/pscore.cc b/src/pscore.cc index 8251135cde..83f71f440c 100644 --- a/src/pscore.cc +++ b/src/pscore.cc @@ -143,7 +143,7 @@ PScore::select_items(PStaff*ps, PCol*pc) assert(ps && pc); for (iter_top(pc->its,i); i.ok(); i++){ if (i->pstaff_l_ == ps) - ret.add((Item*)(const Item*)i); + ret.push((Item*)(const Item*)i); } return ret; } diff --git a/src/qlp.cc b/src/qlp.cc index 5aa8e9f45e..280f0db4cc 100644 --- a/src/qlp.cc +++ b/src/qlp.cc @@ -12,15 +12,15 @@ Mixed_qp::add_equality_cons(Vector , double ) void Mixed_qp::add_fixed_var(int i, Real r) { - eq_cons.add(i); - eq_consrhs.add(r); + eq_cons.push(i); + eq_consrhs.push(r); } void Ineq_constrained_qp::add_inequality_cons(Vector c, double r) { - cons.add(c); - consrhs.add(r); + cons.push(c); + consrhs.push(r); } Ineq_constrained_qp::Ineq_constrained_qp(int novars): @@ -96,7 +96,7 @@ Ineq_constrained_qp::assert_solution(Vector sol) const Real R=cons[i] * sol- consrhs[i]; assert(R> -EPS); if (R < EPS) - binding.add(i); + binding.push(i); } // KKT check... // todo diff --git a/src/qlpsolve.cc b/src/qlpsolve.cc index 8482bfd875..dd9c4043a2 100644 --- a/src/qlpsolve.cc +++ b/src/qlpsolve.cc @@ -34,7 +34,7 @@ Active_constraints::OK() Array allcons; for (int i=0; i < opt->cons.size(); i++) - allcons.add(0); + allcons.push(0); for (int i=0; i < active.size(); i++) { int j = active[i]; allcons[j]++; @@ -61,7 +61,7 @@ Active_constraints::add(int k) { // add indices int cidx=inactive[k]; - active.add(cidx); + active.push(cidx); inactive.swap(k,inactive.size()-1); inactive.pop(); @@ -98,7 +98,7 @@ Active_constraints::drop(int k) int q=active.size()-1; // drop indices - inactive.add(active[k]); + inactive.push(active[k]); active.swap(k,q); A.swap_rows(k,q); active.pop(); @@ -128,7 +128,7 @@ Active_constraints::Active_constraints(Ineq_constrained_qp const *op) opt(op) { for (int i=0; i < op->cons.size(); i++) - inactive.add(i); + inactive.push(i); Choleski_decomposition chol(op->quad); H=chol.inverse(); } diff --git a/src/register.cc b/src/register.cc new file mode 100644 index 0000000000..4391855b13 --- /dev/null +++ b/src/register.cc @@ -0,0 +1,99 @@ +#include "voice.hh" +#include "request.hh" +#include "register.hh" +#include "notehead.hh" +#include "complexwalker.hh" +#include "localkeyitem.hh" + +Staff_elem_info::Staff_elem_info(Staff_elem*s_l, Request*r_l, + Request_register *reg_l) +{ + elem_p_ = s_l; + voice_l_ = r_l->elt_l_->voice_l_; + req_l_ = r_l; + group = 0; + origin_reg_l_ = reg_l; +} +Staff_elem_info::Staff_elem_info() +{ + elem_p_ = 0; + voice_l_ = 0; + group = 0; + origin_reg_l_ = 0; + req_l_ = 0; +} +/****************/ + +Request_register::Request_register() +{ + walk_l_=0; +} + +Request_register::Request_register(Complex_walker*w_l) +{ + walk_l_=w_l; +} + +void +Request_register::pre_move_processing() +{ + do_pre_move_process(); + accepted_req_arr_.set_size(0); +} +void +Request_register::post_move_processing() +{ + do_post_move_process(); +} + + +/****************/ + +Local_key_register::Local_key_register(Complex_walker*w) + : Request_register(w) +{ + key_item_p_ = 0; +} +bool +Local_key_register::try_request(Request*) + +{ + return false; +} + +void +Local_key_register::process_request() +{ +} +void +Local_key_register::do_pre_move_process() +{ + if (key_item_p_) { + walk_l_->typeset_element(key_item_p_); + key_item_p_ = 0; + } +} +void +Local_key_register::acknowledge_element(Staff_elem_info info) +{ + if (info.req_l_->melodic()) { + Melodic_req * melodic_l_ = info.req_l_->melodic(); + + if( melodic_l_->forceacc || + walk_l_->local_key_.oct(melodic_l_->octave).acc(melodic_l_->notename) + != melodic_l_->accidental) { + Item * support_l_ = info.elem_p_->item(); + + + if (!key_item_p_) { + key_item_p_ = new Local_key_item(-2); + key_item_p_->c0_position = walk_l_->clef_.c0_pos; + } + + key_item_p_->add(melodic_l_); + key_item_p_->add(support_l_); + walk_l_->local_key_.oct(melodic_l_->octave) + .set(melodic_l_->notename, melodic_l_->accidental); + } + } +} diff --git a/src/request.cc b/src/request.cc index c6ff787c66..323932a6a9 100644 --- a/src/request.cc +++ b/src/request.cc @@ -6,51 +6,50 @@ #include "inputcommand.hh" -#define VIRTUALCONS(T,R) R *T::clone() const { return new T(*this); } struct T -#define RCONS(T) VIRTUALCONS(T, Request) - -RCONS(Rest_req); -RCONS(Barcheck_req); -RCONS(Text_req); -RCONS(Rhythmic_req); -RCONS(Lyric_req); -RCONS(Mark_req); -RCONS(Stem_req); -RCONS(Script_req); -RCONS(Note_req); -RCONS(Melodic_req); -RCONS(Span_req); -RCONS(Slur_req); -RCONS(Beam_req); -RCONS(Staff_command_req); - void -Stem_req::print() const +Stem_req::do_print() const +{ + Rhythmic_req::do_print(); +} + +Stem_req::Stem_req(int s, int d) + : Rhythmic_req(s,d) { - mtor << "Stem\n"; } + /****************/ void -Barcheck_req::print() const +Barcheck_req::do_print() const { #ifndef NPRINT - mtor << "Barcheck\n"; + #endif } + /****************/ + void -Request::print() const +Request::print() const + +{ + mtor << name() << " {"; + do_print(); + mtor << "}\n"; +} + + +void +Request::do_print() const { #ifndef NPRINT - mtor << "Req{ unknown }\n"; #endif } void -Span_req::print() const +Span_req::do_print() const { #ifndef NPRINT - mtor << "Span_req {" << spantype << "}\n"; + mtor << spantype ; #endif } @@ -65,25 +64,37 @@ Request::Request(Request const&) /****************/ Melodic_req::Melodic_req() { - name = 0; + notename = 0; octave = 0; accidental = 0; forceacc = false; } void -Melodic_req::print() const +Melodic_req::do_print() const { - mtor << "note: " << name << " oct: "<< octave; + mtor << "notename: " << notename << " oct: "<< octave; } int Melodic_req::height() const { - return name + octave*7; + return notename + octave*7; } /****************/ +int +Rhythmic_req::compare(const Rhythmic_req &r1, const Rhythmic_req &r2) +{ + return r1.duration() - r2.duration(); +} +Rhythmic_req::Rhythmic_req(int b, int d) +{ + plet_factor = 1; + balltype = b; + dots = d; +} + Rhythmic_req::Rhythmic_req() { plet_factor = 1; @@ -92,9 +103,9 @@ Rhythmic_req::Rhythmic_req() } void -Rhythmic_req::print() const +Rhythmic_req::do_print() const { - mtor << "rhythmic: " << balltype ; + mtor << "ball: " << balltype ; int d =dots; while (d--) mtor << '.'; @@ -117,32 +128,41 @@ Lyric_req::Lyric_req(Text_def* def_p) } void -Lyric_req::print() const -{ - mtor << "lyric: "; - Rhythmic_req::print(); - Text_req::print(); +Lyric_req::do_print() const +{ + Rhythmic_req::do_print(); + Text_req::do_print(); } /****************/ void -Note_req::print() const +Note_req::do_print() const { - Melodic_req::print(); - Rhythmic_req::print(); + Melodic_req::do_print(); + Rhythmic_req::do_print(); } /****************/ void -Rest_req::print() const +Rest_req::do_print() const { - mtor << "rest, " ; - Rhythmic_req::print(); + Rhythmic_req::do_print(); } + /****************/ Beam_req::Beam_req() { nplet = 0; } + +void Beam_req::do_print()const{} /****************/ +void Slur_req::do_print()const{} +/****************/ +int +Span_req:: compare(const Span_req &r1, const Span_req &r2) +{ + return r1.spantype - r2.spantype; +} + Span_req::Span_req() { spantype = NOSPAN; @@ -161,7 +181,7 @@ Script_req::Script_req(Script_req const &s) } void -Script_req::print() const +Script_req::do_print() const { mtor << " dir " << dir ; scriptdef->print(); @@ -193,7 +213,7 @@ Text_req::Text_req(int dir_i, Text_def* tdef_p) } void -Text_req::print() const +Text_req::do_print() const { mtor << " dir " << dir_i_ ; tdef_p_->print(); @@ -209,10 +229,10 @@ Mark_req::Mark_req(String s) } void -Mark_req::print()const +Mark_req::do_print()const { #ifndef NDEBUG - mtor<< "Mark `" << mark_str_ << "\'\n"; + mtor<< " `" << mark_str_ << "\'\n"; #endif } /****************/ @@ -229,9 +249,8 @@ Staff_command_req::Staff_command_req(Staff_command_req const&src) com_p_ = new Input_command(*src.com_p_); } void -Staff_command_req::print()const +Staff_command_req::do_print()const { - mtor << "Command request: " ; com_p_->print(); } diff --git a/src/rest.cc b/src/rest.cc index 215b102fed..b8d3065415 100644 --- a/src/rest.cc +++ b/src/rest.cc @@ -11,12 +11,15 @@ Rest::Rest(int t, int d) balltype = t; dots = d; } +NAME_METHOD(Rest); void -Rest::print()const +Rest::do_print()const { +#ifndef NPRINT mtor << "Rest "<rhythmic()->balltype; - int d = rq->rhythmic()->dots; - Notehead *n =new Notehead(1); - n->balltype = b; - n->dots =d; + n->set_rhythmic(rq->rhythmic()); n->position = 0; return n; } Stem * -Rhythmic_staff::get_stem(Stem_req*rq, Moment l) +Rhythmic_staff::get_stem(Stem_req*rq) { - Stem * s = new Stem(0,l); - s->flag = rq->stem_number; + Stem * s = new Stem(0); + s->flag = rq->balltype; return s; } - -/* - creation - */ -Staff * -get_new_rhythmstaff() -{ - return new Rhythmic_staff; -} - diff --git a/src/sccol.cc b/src/sccol.cc index bbd0dba1ae..14c52796de 100644 --- a/src/sccol.cc +++ b/src/sccol.cc @@ -58,5 +58,5 @@ Score_column::add_duration(Moment d) if (d == durations[i]) return ; } - durations.add(d); + durations.push(d); } diff --git a/src/scores.cc b/src/scores.cc index bdd5371645..6ebbf18a17 100644 --- a/src/scores.cc +++ b/src/scores.cc @@ -25,7 +25,7 @@ do_scores() void add_score(Input_score * s) { - score_array_global.add(s); + score_array_global.push(s); } diff --git a/src/script.cc b/src/script.cc index eab30f9cbb..a6c3ee8039 100644 --- a/src/script.cc +++ b/src/script.cc @@ -5,15 +5,27 @@ #include "molecule.hh" #include "lookup.hh" -Script::Script(Script_req* rq, Item*i , int staflen, Stem*st_l) +NAME_METHOD(Script); + +void +Script::set_stem(Stem*st_l) { - dependencies.add(st_l); - dependencies.add(i); - + stem_l_ = st_l; + dependencies.push(st_l); +} + +void +Script::set_support(Item*i) +{ + support.push(i); + dependencies.push(i); +} + +Script::Script(Script_req* rq, int staflen) +{ staffsize =staflen; specs_l_ = rq->scriptdef; - support= i; - stem_l_ = st_l; + stem_l_ = 0; pos = 0; symdir=1; dir =rq->dir; @@ -37,6 +49,13 @@ Script::set_default_dir() } } +Interval +Script::support_height() const return r; +{ + for (int i=0; i < support.size(); i++) + r.unite(support[i]->height()); +} + void Script::set_default_pos() { @@ -46,12 +65,12 @@ Script::set_default_pos() int d = specs_l_->staffdir; Real y ; if (!d) { - Interval v= support->height(); + Interval v= support_height(); y = v[dir] -dy[-dir] + 2*dir*inter_f; } else { Real y = (d > 0) ? staffsize + 2: -2; // ug y *=inter_f; - Interval v= support->height(); + Interval v= support_height(); if (d > 0) { y = y >? v.max(); diff --git a/src/simplestaff.cc b/src/simplestaff.cc index e4e4986ef1..20f291fa8a 100644 --- a/src/simplestaff.cc +++ b/src/simplestaff.cc @@ -19,7 +19,7 @@ Simple_column::Simple_column(Score_column*s, Simple_staff *rs) staff_l_ = rs; beam_ = 0; text_=0; - lreq_p_ = 0; + } Simple_staff::Simple_staff() @@ -27,18 +27,10 @@ Simple_staff::Simple_staff() theline_l_ = 0; } -/** - accept: - - BREAK: all - TYPESET: bar, meter, -Scalar - */ - void -Simple_column::process_requests() +Simple_column::setup_requests() { for (int i = 0 ; i < v_elts.size(); i ++) for (iter_top(v_elts[i]->reqs,j); j.ok(); j++) { @@ -49,10 +41,10 @@ Simple_column::process_requests() } } if (rq->rhythmic()){ - notes.add(rq->rhythmic()); + notes.push(rq->rhythmic()); } if (rq->script()) { - notes.last().scripts.add(rq->script()); + notes.last().scripts.push(rq->script()); } if (rq->stem()) { stem_ = rq->stem(); @@ -61,16 +53,11 @@ Simple_column::process_requests() if (rq->text()) { text_ = rq->text(); } -#if 0 - if (rq->lreq_l()) { - lreq_p_ = rq->lreq_l(); - } -#endif if (rq->beam()) { beam_ = rq->beam(); } if (rq->slur()) { - slurs.add(rq->slur()); + slurs.push(rq->slur()); } } } @@ -85,7 +72,7 @@ void Simple_staff::walk() { for (Simple_walker sc(this); sc.ok(); sc++) { - sc.col()->process_requests();// TODO + sc.col()->setup_requests();// TODO sc.process(); } } diff --git a/src/simplewalker.cc b/src/simplewalker.cc index 8ac89bd2d0..05bc76c9b6 100644 --- a/src/simplewalker.cc +++ b/src/simplewalker.cc @@ -20,14 +20,14 @@ #include "slur.hh" #include "localkeyitem.hh" #include "textitem.hh" -#include "lyricitem.hh" + Rhythmic_grouping parse_grouping(Array a, Moment one_beat) { Array r; for (int i= 0 ; i < a.size(); i++) - r.add(a[i]); + r.push(a[i]); Moment here =0.0; Array children; @@ -35,7 +35,7 @@ parse_grouping(Array a, Moment one_beat) Moment last = here; here += one_beat * r[i]; - children.add( + children.push( new Rhythmic_grouping(MInterval(last, here), r[i] ) ); } @@ -120,14 +120,14 @@ Simple_walker::do_TYPESET_command(Command*com) void Simple_walker::do_local_key(Note_req*n,Notehead* head_p) { - if ( local_key_.oct(n->octave).acc(n->name) != n->accidental) { + if ( local_key_.oct(n->octave).acc(n->notename) != n->accidental) { if (!local_key_item_) { local_key_item_ = staff()->get_local_key_item(); local_key_item_->c0_position = clef_.c0_pos; } - - local_key_item_->add(n->octave, n->name, n->accidental, head_p); - local_key_.oct(n->octave).set(n->name, n->accidental); + local_key_item_->add(head_p); + local_key_item_->add(n->octave, n->notename, n->accidental); + local_key_.oct(n->octave).set(n->notename, n->accidental); } } @@ -136,10 +136,10 @@ Simple_walker::do_note(Note_info n) { Simple_column*c = col(); Simple_staff *s = staff(); - Item*rhythmic=0; + Item*rhythmic=0; if (n.rq->note()) { Note_req * req = n.rq->note() ; - const Voice *v = req->elt_l_->voice_; + const Voice *v = req->elt_l_->voice_l_; Notehead*n = s->get_notehead(req, clef_.c0_pos); rhythmic=n; @@ -150,7 +150,7 @@ Simple_walker::do_note(Note_info n) current_grouping->add_child( c->tdescription_->whole_in_measure, req->duration()); } - noteheads.add(n); + noteheads.push(n); int sidx =find_slur(v); if (sidx >= 0) { pending_slurs[sidx]->add(n); @@ -158,12 +158,16 @@ Simple_walker::do_note(Note_info n) if (wantkey) do_local_key(req,n); - }else if (n.rq->rest()) { + } else if (n.rq->rest()) { rhythmic = s->get_rest(n.rq->rest()); c->typeset_item(rhythmic); } - for (int i= 0; i < n.scripts.size(); i ++) - c->typeset_item(new Script(n.scripts[i], rhythmic, 10, stem_)); // UGR + for (int i= 0; i < n.scripts.size(); i ++) { + Script * s_p =new Script(n.scripts[i], 10); + s_p->set_support(rhythmic); + s_p->set_stem(stem_); + c->typeset_item(s_p); // UGR + } } void @@ -172,7 +176,7 @@ Simple_walker::process_requests() Simple_column*c = col(); Simple_staff *s = staff(); - if (c->beam_&& c->beam_->spantype == Span_req::START) { + if (c->beam_ && c->beam_->spantype == Span_req::START) { if (beam_) error("Too many beams (t = " +String(c->when())+")"); @@ -185,10 +189,10 @@ Simple_walker::process_requests() Slur_req*sl = c->slurs[i]; if (sl->spantype == Span_req::START) { - if (find_slur(sl->elt_l_->voice_ )>=0) + if (find_slur(sl->elt_l_->voice_l_)>=0) error_t("Too many slurs in voice", *col()->tdescription_); - pending_slur_reqs.add(sl); - pending_slurs.add(new Slur); + pending_slur_reqs.push(sl); + pending_slurs.push(new Slur); } } @@ -196,12 +200,8 @@ Simple_walker::process_requests() c->typeset_item(new Text_item(c->text_, 10)); // UGR } -// if (c->lreq_p_) { -// c->typeset_item(new Lyric_item(c->lreq_p_, 10)); // UGR -// } - if (c->stem_) { - stem_ = s->get_stem(c->stem_->stem(), c->stem_requester_len); + stem_ = s->get_stem(c->stem_->stem()); } for (int i = 0; i < c->notes.size(); i ++) { @@ -224,15 +224,19 @@ Simple_walker::process_requests() } if (c->beam_&& c->beam_->spantype == Span_req::STOP) { + if (!beam_) { + error_t("No beam to end", *col()->tdescription_); + } default_grouping.extend(current_grouping->interval()); beam_->set_grouping(default_grouping, *current_grouping); - pscore_->typeset_spanner(beam_, s->theline_l_); + pscore_l_->typeset_spanner(beam_, s->theline_l_); if (c->beam_->nplet) { - Text_spanner* t = new Text_spanner(beam_); + Text_spanner* t = new Text_spanner; + t->set_support(beam_); t->spec.align_i_ = 0; t->spec.text_str_ = c->beam_->nplet; - pscore_->typeset_spanner(t, s->theline_l_); + pscore_l_->typeset_spanner(t, s->theline_l_); } beam_ = 0; @@ -245,7 +249,7 @@ Simple_walker::process_requests() noteheads.set_size(0); if (local_key_item_) { - c->typeset_item_directional(local_key_item_, -1); + c->typeset_item(local_key_item_); local_key_item_ = 0; } if (stem_) { @@ -255,11 +259,11 @@ Simple_walker::process_requests() Slur_req *sl = c->slurs[i]; if (sl->spantype == Span_req::STOP) { - int idx = find_slur(sl->elt_l_->voice_); + int idx = find_slur(sl->elt_l_->voice_l_); if (idx < 0) error_t("can't find slur to end; ", *c->tdescription_); - pscore_->typeset_spanner(pending_slurs[idx], + pscore_l_->typeset_spanner(pending_slurs[idx], s->theline_l_); pending_slurs.del(idx); pending_slur_reqs.del(idx); @@ -267,7 +271,28 @@ Simple_walker::process_requests() } } +Simple_walker::Simple_walker(Simple_walker const&) + : Staff_walker(0, 0) +{ + assert(false); +} +Simple_walker::~Simple_walker() +{ + if (pending_slurs.size()) + WARN << "destructing " << pending_slurs.size() << " Pending slurs "; + if (beam_) + WARN << "destructing Beam\n"; + if (local_key_item_) + WARN<<"destructing Local_key_item\n"; + if (stem_) + WARN<< "destructing Stem\n"; + delete local_key_item_; + delete stem_; + delete beam_; + +} + Simple_walker::Simple_walker(Simple_staff*s) : Staff_walker(s, s->theline_l_->pscore_l_) { @@ -279,7 +304,7 @@ Simple_walker::Simple_walker(Simple_staff*s) wantkey =i; delete i; local_key_item_ = 0; - reset(); + do_post_move(); } @@ -287,7 +312,7 @@ Simple_walker::Simple_walker(Simple_staff*s) Simple_staff* Simple_walker::staff() { - return (Simple_staff*) staff_; + return (Simple_staff*) staff_l_; } Simple_column* @@ -297,7 +322,7 @@ Simple_walker::col() } void -Simple_walker::reset() +Simple_walker::do_post_move() { processed_clef =false; processed_key = false; @@ -308,7 +333,7 @@ int Simple_walker::find_slur(const Voice *v) { for (int i=0; i < pending_slur_reqs.size(); i++) { - if (pending_slur_reqs[i]->elt_l_->voice_ == v) + if (pending_slur_reqs[i]->elt_l_->voice_l_== v) return i; } return -1; diff --git a/src/slur.cc b/src/slur.cc index d4a3d0d96d..2cdddfec47 100644 --- a/src/slur.cc +++ b/src/slur.cc @@ -7,7 +7,7 @@ #include "molecule.hh" #include "debug.hh" #include "boxes.hh" - +NAME_METHOD(Slur); Slur::Slur() { dir = 0; @@ -30,8 +30,8 @@ Slur::center() const void Slur::add(Notehead*n) { - encompass.add(n); - dependencies.add(n); + encompass.push(n); + dependencies.push(n); } void @@ -50,12 +50,6 @@ Slur::set_default_dir() dir = 1; } -void -Slur::print()const -{ - mtor << "Slur.\n"; -} - void Slur::do_pre_processing() { @@ -72,7 +66,7 @@ Slur::do_break_at(PCol*l, PCol*r) const ret->encompass.set_size(0); for (int i =0; i < encompass.size(); i++) { if (encompass[i]->pcol_l_->line_l_==l->line_l_) - ret->encompass.add(encompass[i]); + ret->encompass.push(encompass[i]); } if (right != r) ret->open_right = true; diff --git a/src/spanner.cc b/src/spanner.cc index f6b4f92e80..ce3cb49162 100644 --- a/src/spanner.cc +++ b/src/spanner.cc @@ -2,6 +2,12 @@ #include "spanner.hh" #include "pcol.hh" +NAME_METHOD(Spanner); +void +Spanner::do_print()const +{ + mtor << " (unknown) "; +} Spanner* Spanner::broken_at(PCol*c1, PCol *c2)const { @@ -9,7 +15,7 @@ Spanner::broken_at(PCol*c1, PCol *c2)const Spanner *span_p = do_break_at(c1,c2); me_p->calc_children = true; - me_p->dependencies.add(span_p); + me_p->dependencies.push(span_p); span_p->calc_children = false; // should handle in ctor @@ -28,20 +34,10 @@ Spanner::Spanner() Interval Spanner::width()const { - Real r =right->hpos, - l= left->hpos; + Real r = right->hpos; + Real l = left->hpos; + assert(*left < *right); assert(r>=l); return Interval(0, r-l); } - -void -Spanner::print() const -{ -#ifndef NPRINT - mtor << "Spanner { "; - Staff_elem::print(); - mtor << "}\n"; -#endif -} - diff --git a/src/staff.cc b/src/staff.cc index 69fc3123b8..df46046c14 100644 --- a/src/staff.cc +++ b/src/staff.cc @@ -77,19 +77,19 @@ Staff::clean_cols() Staff_column * Staff::get_col(Moment w, bool mus) { - Score_column* sc = score_l_->find_col(w,mus); + Score_column* sccol_l = score_l_->find_col(w,mus); iter_top(cols,i); for (; i.ok(); i++) { - if (*i->score_column_l_ > *sc) // too far + if (*i->score_column_l_ > *sccol_l) // too far break; - if (sc == i->score_column_l_) + if (sccol_l == i->score_column_l_) return i; } /* post: *sc > *->score_column_l_ || !i.ok() */ - Staff_column* newst = create_col(sc); + Staff_column* newst = create_col(sccol_l); if (!i.ok()) { cols.bottom().add(newst); @@ -121,8 +121,8 @@ Staff::get_marks(Array&s_arr, Array&m_arr) for (iter_top(i->elts,j); j.ok(); j++) { for (iter_top(j->reqs, k); k.ok(); k++) { if (k->mark()) { // ugh. 4 levels - s_arr.add(k->mark()->mark_str_); - m_arr.add(now); + s_arr.push(k->mark()->mark_str_); + m_arr.push(now); } } now += j->duration; @@ -176,6 +176,15 @@ Staff::OK() const #ifndef NDEBUG cols.OK(); voices.OK(); + iter_top(cols, i); + iter_top(cols, j); + i++; + for (; i.ok(); j++,i++) { + if ( j->when() == i->when()) + assert(!j->mus() && i->mus()); + else + assert(j->when () < i->when() ); + } assert(score_l_); #endif } diff --git a/src/staffcommands.cc b/src/staffcommands.cc index 82286bd7d6..d1bbc45c42 100644 --- a/src/staffcommands.cc +++ b/src/staffcommands.cc @@ -156,14 +156,14 @@ Staff_commands_at::add(Command c) { /* every line a currentkey. */ Command kc; kc.code =TYPESET; - kc.args.add( "CURRENTKEY"); + kc.args.push( "CURRENTKEY"); kc.priority = 60; add(kc); } { /* every line a currentclef. */ Command kc; kc.code =TYPESET; - kc.args.add( "CURRENTCLEF"); + kc.args.push( "CURRENTCLEF"); kc.priority = 80; add(kc); } diff --git a/src/staffelem.cc b/src/staffelem.cc index 4be3cee0bf..0ef1900203 100644 --- a/src/staffelem.cc +++ b/src/staffelem.cc @@ -3,6 +3,7 @@ #include "pstaff.hh" #include "molecule.hh" #include "staffelem.hh" +#include "debug.hh" String Staff_elem::TeXstring() const @@ -73,11 +74,17 @@ void Staff_elem::print()const { #ifndef NPRINT + mtor << name() << "{\n"; + do_print(); if (output) output->print(); + + mtor << "}\n"; #endif } +NAME_METHOD(Staff_elem); + Staff_elem::Staff_elem() { calc_children = false; diff --git a/src/staffwalker.cc b/src/staffwalker.cc index 5967242dbb..3bf94ceaba 100644 --- a/src/staffwalker.cc +++ b/src/staffwalker.cc @@ -13,8 +13,8 @@ Staff_walker::Staff_walker(Staff_walker const &s) Staff_walker::Staff_walker(Staff * s, PScore*ps ) : PCursor (s->cols) { - staff_ = s; - pscore_ = ps; + staff_l_ = s; + pscore_l_ = ps; break_status = BREAK_END - BREAK_PRE; } @@ -28,12 +28,13 @@ void Staff_walker::process() { break_status = BREAK_END - BREAK_PRE; - if (ptr()->staff_commands_p_) + + if (ptr()->mus()) { + process_requests(); + } else if (ptr()->staff_commands_p_) for (iter_top(*ptr()->staff_commands_p_,i); i.ok(); i++) { process_command(i); } - - process_requests(); } @@ -64,6 +65,7 @@ Staff_walker::process_command(Command*com) void Staff_walker::operator++(int i) { + do_pre_move(); PCursor::operator++(i); - reset(); + do_post_move(); } diff --git a/src/stcol.cc b/src/stcol.cc index 9d070aa4cc..89a572408a 100644 --- a/src/stcol.cc +++ b/src/stcol.cc @@ -35,7 +35,7 @@ Staff_column::add(Voice_element*ve) score_column_l_->add_duration(d); } - v_elts.add(ve); + v_elts.push(ve); } Staff_column::Staff_column(Score_column *s_l) diff --git a/src/stem.cc b/src/stem.cc index 85c4c15e2b..2e602c1cae 100644 --- a/src/stem.cc +++ b/src/stem.cc @@ -9,10 +9,10 @@ #include "misc.hh" const int STEMLEN=7; - -Stem::Stem(int c, Moment len) +NAME_METHOD(Stem); +Stem::Stem(int c) //, Moment len) { - note_length = len; +// note_length = len; beams_left = 0; beams_right = 0; minnote = 1000; // invalid values @@ -27,16 +27,11 @@ Stem::Stem(int c, Moment len) } void -Stem::print() const +Stem::do_print() const { #ifndef NPRINT - mtor << "{\n"; mtor << "flag "<< flag << " print_flag " << print_flag << "min,max [" << minnote << ", " << maxnote << "]"; - - - Item::print(); - mtor << "}\n"; #endif } void @@ -63,8 +58,8 @@ Stem::add(Notehead *n) minnote = p; if ( p> maxnote) maxnote = p; - heads.add(n); - n->dependencies.add(this); + heads.push(n); + n->dependencies.push(this); } diff --git a/src/template6.cc b/src/template6.cc new file mode 100644 index 0000000000..c3867aeeb0 --- /dev/null +++ b/src/template6.cc @@ -0,0 +1,7 @@ +#include "register.hh" +#include "voicegroup.hh" + +#include "pcursor.tcc" +#include "plist.tcc" + +IPL_instantiate(Voice_registers); diff --git a/src/tex.cc b/src/tex.cc index 9a10c993ea..1a5c4a08c5 100644 --- a/src/tex.cc +++ b/src/tex.cc @@ -36,7 +36,7 @@ substitute_args(String source, Array args) { Array sv; for (int i = 0 ; i < args.size(); i++) - sv.add(args[i]); + sv.push(args[i]); return substitute_args(source, sv); } diff --git a/src/texbeam.cc b/src/texbeam.cc index bded0d7751..4c59ce3263 100644 --- a/src/texbeam.cc +++ b/src/texbeam.cc @@ -19,8 +19,8 @@ Lookup::beam_element(int sidx, int widx, Real slope) Symbol bs=(*symtables_)("beamslopes")->lookup("slope"); Array args; - args.add(sidx); - args.add(widx); + args.push(sidx); + args.push(widx); bs.tex = substitute_args(bs.tex,args); int w = 2 << widx; Real width = convert_dimen(w,"pt"); @@ -52,8 +52,8 @@ Lookup::rule_symbol(Real height, Real width) { Symbol bs=(*symtables_)("beamslopes")->lookup("horizontal"); Array args; - args.add(print_dimen(height)); - args.add(print_dimen(width)); + args.push(print_dimen(height)); + args.push(print_dimen(width)); bs.tex = substitute_args(bs.tex,args); bs.dim.x = Interval(0,width); bs.dim.y = Interval(0,height); diff --git a/src/textitem.cc b/src/textitem.cc index 8be0d378cc..13790d740e 100644 --- a/src/textitem.cc +++ b/src/textitem.cc @@ -5,6 +5,8 @@ #include "molecule.hh" #include "lookup.hh" +NAME_METHOD(Text_item); + Text_item::Text_item(Text_req* treq_l, int staffsize_i) { staffsize_i_ = staffsize_i; diff --git a/src/textspanner.cc b/src/textspanner.cc index 86eac612cb..d4de8fb824 100644 --- a/src/textspanner.cc +++ b/src/textspanner.cc @@ -4,10 +4,23 @@ #include "textdef.hh" #include "debug.hh" -Text_spanner::Text_spanner(Directional_spanner*d) +NAME_METHOD(Text_spanner); + +void +Text_spanner::set_support(Directional_spanner*d) { support = d; - dependencies.add(d); + dependencies.push(d); +} +Text_spanner::Text_spanner() +{ + support = 0; +} + +void +Text_spanner::do_print() const +{ + spec.print(); } void @@ -35,14 +48,6 @@ Text_spanner::brew_molecule_p() const return output; } -void -Text_spanner::print() const // todo -{ -#ifndef NDEBUG - mtor << "Text_spanner\n"; -#endif -} - void Text_spanner::do_pre_processing() { @@ -60,5 +65,5 @@ Text_spanner::height()const Spanner* Text_spanner::do_break_at(PCol*c1, PCol*c2)const { - return new Text_spanner(*this); + return new Text_spanner(*this); // todo } diff --git a/src/voice.cc b/src/voice.cc index 334d1b4a5f..818e723b42 100644 --- a/src/voice.cc +++ b/src/voice.cc @@ -18,7 +18,7 @@ Voice::Voice() void Voice::add(Voice_element*v) { - v->voice_ = this; + v->voice_l_ = this; elts.bottom().add(v); } @@ -59,9 +59,10 @@ void Voice_element::add(Request*r) { if (r->rhythmic()) { - assert (!duration); + assert (!duration || duration == r->duration()); duration = r->duration(); } + r->elt_l_ = this; reqs.bottom().add(r); } @@ -69,15 +70,15 @@ Voice_element::add(Request*r) Voice_element::Voice_element() { - voice_ = 0; - group = 0; + voice_l_ = 0; +// group = 0; duration = 0.0; } Voice_element::Voice_element(Voice_element const&src) { - voice_=src.voice_; + voice_l_=0; for (iter_top(src.reqs, i); i.ok(); i++) add(i->clone()); - group=src.group; +// group=src.group; } diff --git a/src/voicegroup.cc b/src/voicegroup.cc new file mode 100644 index 0000000000..5dfe5a8a27 --- /dev/null +++ b/src/voicegroup.cc @@ -0,0 +1,60 @@ +#include "request.hh" +#include "complexwalker.hh" +#include "complexstaff.hh" +#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) +{ + walk_l_ = w_l; +} + +void +Voice_group_registers::pre_move_processing() +{ + stem_beam_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(); +} +bool +Voice_group_registers::try_request(Request*r_l) +{ + 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) + return; + */ + stem_beam_reg_.acknowledge_element(i); +// text_reg_.announce_element(i); + // script_reg_.announce_element(i); +} + + +void +Voice_group_registers::process_requests() +{ + stem_beam_reg_.process_request(); +} + diff --git a/src/voiceregs.cc b/src/voiceregs.cc new file mode 100644 index 0000000000..b13fd01652 --- /dev/null +++ b/src/voiceregs.cc @@ -0,0 +1,169 @@ +#include "rest.hh" +#include "notehead.hh" +#include "paper.hh" +#include "debug.hh" +#include "slur.hh" +#include "request.hh" +#include "complexwalker.hh" +#include "complexstaff.hh" +#include "voicegroup.hh" +#include "register.hh" + +Voice_registers::Voice_registers(Complex_walker*c_l, Voice *v_p) + : head_reg_(c_l), slur_reg_(c_l) +{ + voice_l_ = v_p; +} + +bool +Voice_registers::try_request(Request * r_l) +{ + bool b = head_reg_.try_request(r_l); + if (!b) + b = slur_reg_.try_request(r_l); + return b; +} + +void +Voice_registers::announce_element(Staff_elem_info i) +{ + if (i.voice_l_ != voice_l_) + return; + if (i.origin_reg_l_ != &slur_reg_) + slur_reg_.acknowledge_element(i); +} + +void +Voice_registers::pre_move_processing() +{ + head_reg_.pre_move_processing(); + slur_reg_.pre_move_processing(); +} +void +Voice_registers::post_move_processing() +{ + head_reg_.post_move_processing(); + slur_reg_.post_move_processing(); +} + +void +Voice_registers::process_requests() +{ + head_reg_.process_request(); + slur_reg_.process_request(); +} + +/****************/ + +Notehead_register::Notehead_register(Complex_walker*w_l) + :Request_register(w_l) +{ + note_l_ = 0; +} + +bool +Notehead_register::try_request(Request *req_l) +{ + if (req_l->note() || req_l->rest()) + accepted_req_arr_.push(req_l); + else + return false; + + return true; +} + +void +Notehead_register::process_request() +{ + Request* req_l = accepted_req_arr_.last(); + if (req_l->note()) { + Notehead*n_p = new Notehead(8); // ugh + note_l_ = 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, + req_l->rhythmic()->dots); + if (req_l->rhythmic()->balltype <= 2) + note_l_->translate( + Offset(0, + 5 * walk_l_->staff()->paper()->internote())); + } + Staff_elem_info itinf(note_l_,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; + } +} + +/****************/ +/****************/ + +Slur_register::Slur_register(Complex_walker* w) + : Request_register(w) +{ +} + +bool +Slur_register::try_request(Request *req_l) +{ + if(!req_l->slur()) + return false; + + accepted_req_arr_.push(req_l); + return true; +} + +void +Slur_register::acknowledge_element(Staff_elem_info info) +{ + if (info.elem_p_->name() == String("Notehead")) { + Notehead *head_p =(Notehead*) info.elem_p_ ;// ugh + for (int i = 0; i < slur_l_stack_.size(); i++) + slur_l_stack_[i]->add(head_p ); + for (int i = 0; i < end_slur_l_arr_.size(); i++) + end_slur_l_arr_[i]->add(head_p); + } +} + +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(); + 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()); + + } else if (slur_req_l->spantype == Span_req::START) { + Slur * s_p =new Slur; + start_slur_l_arr_.push(s_p); + walk_l_->announce_element(Staff_elem_info(s_p, slur_req_l, this)); + } + } + for (int i=0; i < start_slur_l_arr_.size(); i++) + slur_l_stack_.push(start_slur_l_arr_[i]); +} + +void +Slur_register::do_pre_move_process() +{ + for (int i = 0; i < end_slur_l_arr_.size(); i++) + walk_l_->typeset_element(end_slur_l_arr_[i]); + end_slur_l_arr_.set_size(0); +} + +Slur_register::~Slur_register() +{ + if (slur_l_stack_.size()) + error("unterminated slur"); +} diff --git a/src/warn.cc b/src/warn.cc index 87f7152e41..b44471201b 100644 --- a/src/warn.cc +++ b/src/warn.cc @@ -5,13 +5,13 @@ ostream &warnout (cerr); ostream *mlog(&cerr); - +/* void warning(String s) { WARN << s; } - +*/ void error(String s) diff --git a/src/wordwrap.cc b/src/wordwrap.cc index d0bfd5b74f..e390500d82 100644 --- a/src/wordwrap.cc +++ b/src/wordwrap.cc @@ -59,7 +59,7 @@ Word_wrap::solve() i++; } mtor << "Adding cols~, next breakpoint " << i << '\n'; - breaking.add(minimum); + breaking.push(minimum); } return breaking; -- 2.39.2