From 39b86e9e9359ee08292890bbc811eae39c3e1eac Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:41:23 +0000 Subject: [PATCH] lilypond-0.0.39 --- Documentation/make_website | 41 - deps/Makefile | 13 - deps/dummy.dep | 0 hdr/Makefile | 13 - hdr/bar-reg.hh | 31 - hdr/bar.hh | 20 - hdr/beam.hh | 51 -- hdr/binary-source-file.hh | 18 - hdr/boxes.hh | 31 - hdr/break.hh | 44 - hdr/class-name.hh | 19 - hdr/clef-item.hh | 31 - hdr/clef-reg.hh | 34 - hdr/colhpos.hh | 29 - hdr/commandrequest.hh | 117 --- hdr/complex-staff.hh | 25 - hdr/complex-walker.hh | 47 - hdr/const.hh | 12 - hdr/debug.hh | 35 - hdr/dimen.hh | 21 - hdr/directional-spanner.hh | 26 - hdr/duration.hh | 111 --- hdr/glob.hh | 9 - hdr/grouping.hh | 62 -- hdr/headreg.hh | 28 - hdr/idealspacing.hh | 30 - hdr/identifier.hh | 42 - hdr/identparent.hh | 45 - hdr/input-file.hh | 28 - hdr/input-music.hh | 140 --- hdr/input-score.hh | 46 - hdr/input-staff.hh | 35 - hdr/item.hh | 32 - hdr/key-item.hh | 31 - hdr/key-reg.hh | 35 - hdr/key.hh | 39 - hdr/keyword.hh | 27 - hdr/leastsquares.hh | 24 - hdr/lexer.hh | 51 -- hdr/lily-stream.hh | 27 - hdr/linespace.hh | 106 --- hdr/local-key-item.hh | 33 - hdr/local-key-reg.hh | 25 - hdr/lookup.hh | 57 -- hdr/lyric-item.hh | 19 - hdr/lyricstaff.hh | 24 - hdr/lyricwalker.hh | 28 - hdr/main.hh | 18 - hdr/meter-reg.hh | 29 - hdr/meter.hh | 22 - hdr/midi-def.hh | 38 - hdr/midi-event.hh | 85 -- hdr/midi-item.hh | 85 -- hdr/midi-main.hh | 27 - hdr/midi-output.hh | 21 - hdr/midi-score.hh | 27 - hdr/midi-stream.hh | 32 - hdr/midi-track.hh | 26 - hdr/midi-walker.hh | 41 - hdr/misc.hh | 26 - hdr/molecule.hh | 57 -- hdr/moment.hh | 14 - hdr/musicalrequest.hh | 198 ----- hdr/my-midi-lexer.hh | 43 - hdr/my-midi-parser.hh | 54 -- hdr/notehead.hh | 45 - hdr/notename.hh | 24 - hdr/offset.hh | 38 - hdr/paper-def.hh | 54 -- hdr/parseconstruct.hh | 39 - hdr/pcol.hh | 86 -- hdr/proto.hh | 171 ---- hdr/pscore.hh | 106 --- hdr/pstaff.hh | 25 - hdr/qlp.hh | 97 -- hdr/qlpsolve.hh | 91 -- hdr/register.hh | 107 --- hdr/registergroup.hh | 54 -- hdr/reqtodo.hh | 83 -- hdr/request.hh | 73 -- hdr/rest.hh | 25 - hdr/score-column.hh | 59 -- hdr/score-walker.hh | 37 - hdr/score.hh | 90 -- hdr/scoreline.hh | 33 - hdr/script-def.hh | 25 - hdr/script-reg.hh | 29 - hdr/script.hh | 41 - hdr/slur-reg.hh | 33 - hdr/slur.hh | 37 - hdr/source-file.hh | 40 - hdr/source.hh | 26 - hdr/spanner.hh | 54 -- hdr/staff-column.hh | 48 - hdr/staff-elem-info.hh | 43 - hdr/staff-elem.hh | 88 -- hdr/staff-walker.hh | 47 - hdr/staff.hh | 61 -- hdr/staffline.hh | 31 - hdr/staffsym.hh | 30 - hdr/stem-beam-reg.hh | 33 - hdr/stem.hh | 81 -- hdr/symbol.hh | 17 - hdr/symtable.hh | 28 - hdr/tex-stream.hh | 29 - hdr/tex.hh | 25 - hdr/text-def.hh | 29 - hdr/text-reg.hh | 26 - hdr/textitem.hh | 30 - hdr/textspanner.hh | 34 - hdr/time-description.hh | 50 -- hdr/track-column.hh | 24 - hdr/voice-element.hh | 37 - hdr/voice-group-regs.hh | 29 - hdr/voice-regs.hh | 31 - hdr/voice.hh | 35 - hdr/walkregs.hh | 50 -- objects/Makefile | 6 - src/Makefile | 15 - src/bar-reg.cc | 79 -- src/bar.cc | 28 - src/beam.cc | 295 ------- src/binary-source-file.cc | 64 -- src/boxes.cc | 15 - src/break.cc | 77 -- src/calcideal.cc | 53 -- src/clef-item.cc | 54 -- src/clef-reg.cc | 107 --- src/colhpos.cc | 35 - src/commandrequest.cc | 149 ---- src/complex-staff.cc | 37 - src/complex-walker.cc | 108 --- src/debug.cc | 59 -- src/dimen.cc | 39 - src/directional-spanner.cc | 6 - src/duration.cc | 249 ------ src/grouping.cc | 350 -------- src/groupregs.cc | 0 src/headreg.cc | 76 -- src/idealspacing.cc | 31 - src/identifier.cc | 56 -- src/input-file.cc | 47 - src/input-music.cc | 252 ------ src/input-score.cc | 102 --- src/input-staff.cc | 88 -- src/item.cc | 18 - src/key-item.cc | 70 -- src/key-reg.cc | 99 --- src/key.cc | 38 - src/keyword.cc | 79 -- src/leastsquares.cc | 35 - src/lexer.l | 281 ------ src/lexerinit.cc | 30 - src/lily-stream.cc | 72 -- src/linespace.cc | 288 ------ src/local-key-item.cc | 93 -- src/local-key-reg.cc | 69 -- src/lookup.cc | 222 ----- src/lyric-item.cc | 27 - src/lyricstaff.cc | 22 - src/lyricwalker.cc | 39 - src/main.cc | 166 ---- src/meter-reg.cc | 64 -- src/meter.cc | 18 - src/midi-def.cc | 64 -- src/midi-event.cc | 198 ----- src/midi-item.cc | 196 ----- src/midi-lexer.l | 390 -------- src/midi-main.cc | 205 ----- src/midi-output.cc | 52 -- src/midi-parser.y | 283 ------ src/midi-score.cc | 63 -- src/midi-stream.cc | 89 -- src/midi-template.cc | 29 - src/midi-track.cc | 84 -- src/midi-walker.cc | 71 -- src/misc.cc | 53 -- src/molecule.cc | 146 --- src/my-midi-lexer.cc | 81 -- src/my-midi-parser.cc | 164 ---- src/mylexer.cc | 196 ----- src/note.cc | 321 ------- src/notehead.cc | 77 -- src/notename.cc | 47 - src/paper-def.cc | 91 -- src/parser.y | 832 ------------------ src/pcol.cc | 121 --- src/pscore.cc | 257 ------ src/pstaff.cc | 14 - src/qlp.cc | 155 ---- src/qlpsolve.cc | 265 ------ src/register.cc | 88 -- src/registergroup.cc | 119 --- src/request.cc | 300 ------- src/rest.cc | 42 - src/score-column.cc | 77 -- src/score-walker.cc | 111 --- src/score.cc | 288 ------ src/scoreline.cc | 51 -- src/scores.cc | 48 - src/script-def.cc | 24 - src/script-reg.cc | 76 -- src/script.cc | 129 --- src/slur-reg.cc | 99 --- src/slur.cc | 135 --- src/source-file.cc | 207 ----- src/source.cc | 36 - src/spanner.cc | 43 - src/staff-column.cc | 166 ---- src/staff-elem-info.cc | 38 - src/staff-elem.cc | 200 ----- src/staff-walker.cc | 109 --- src/staff.cc | 144 --- src/staffline.cc | 110 --- src/staffsym.cc | 46 - src/stem-beam-reg.cc | 156 ---- src/stem.cc | 200 ----- src/symbol.cc | 21 - src/symtable.cc | 61 -- src/template1.cc | 24 - src/template2.cc | 27 - src/template3.cc | 15 - src/template4.cc | 13 - src/template5.cc | 9 - src/template6.cc | 10 - src/tex-stream.cc | 87 -- src/tex.cc | 44 - src/texbeam.cc | 106 --- src/texslur.cc | 208 ----- src/text-def.cc | 31 - src/text-reg.cc | 59 -- src/textitem.cc | 51 -- src/textspanner.cc | 71 -- src/time-description.cc | 119 --- src/track-column.cc | 35 - src/version.cc | 11 - src/voice-group-regs.cc | 85 -- src/voice-regs.cc | 65 -- src/voice.cc | 85 -- src/voiceelt.cc | 95 -- src/walkregs.cc | 174 ---- src/warn.cc | 81 -- ...indhoos-suck-suck-suck-thank-you-cygnus.cc | 102 --- src/wordwrap.cc | 78 -- 244 files changed, 18753 deletions(-) delete mode 100755 Documentation/make_website delete mode 100644 deps/Makefile delete mode 100644 deps/dummy.dep delete mode 100644 hdr/Makefile delete mode 100644 hdr/bar-reg.hh delete mode 100644 hdr/bar.hh delete mode 100644 hdr/beam.hh delete mode 100644 hdr/binary-source-file.hh delete mode 100644 hdr/boxes.hh delete mode 100644 hdr/break.hh delete mode 100644 hdr/class-name.hh delete mode 100644 hdr/clef-item.hh delete mode 100644 hdr/clef-reg.hh delete mode 100644 hdr/colhpos.hh delete mode 100644 hdr/commandrequest.hh delete mode 100644 hdr/complex-staff.hh delete mode 100644 hdr/complex-walker.hh delete mode 100644 hdr/const.hh delete mode 100644 hdr/debug.hh delete mode 100644 hdr/dimen.hh delete mode 100644 hdr/directional-spanner.hh delete mode 100644 hdr/duration.hh delete mode 100644 hdr/glob.hh delete mode 100644 hdr/grouping.hh delete mode 100644 hdr/headreg.hh delete mode 100644 hdr/idealspacing.hh delete mode 100644 hdr/identifier.hh delete mode 100644 hdr/identparent.hh delete mode 100644 hdr/input-file.hh delete mode 100644 hdr/input-music.hh delete mode 100644 hdr/input-score.hh delete mode 100644 hdr/input-staff.hh delete mode 100644 hdr/item.hh delete mode 100644 hdr/key-item.hh delete mode 100644 hdr/key-reg.hh delete mode 100644 hdr/key.hh delete mode 100644 hdr/keyword.hh delete mode 100644 hdr/leastsquares.hh delete mode 100644 hdr/lexer.hh delete mode 100644 hdr/lily-stream.hh delete mode 100644 hdr/linespace.hh delete mode 100644 hdr/local-key-item.hh delete mode 100644 hdr/local-key-reg.hh delete mode 100644 hdr/lookup.hh delete mode 100644 hdr/lyric-item.hh delete mode 100644 hdr/lyricstaff.hh delete mode 100644 hdr/lyricwalker.hh delete mode 100644 hdr/main.hh delete mode 100644 hdr/meter-reg.hh delete mode 100644 hdr/meter.hh delete mode 100644 hdr/midi-def.hh delete mode 100644 hdr/midi-event.hh delete mode 100644 hdr/midi-item.hh delete mode 100644 hdr/midi-main.hh delete mode 100644 hdr/midi-output.hh delete mode 100644 hdr/midi-score.hh delete mode 100644 hdr/midi-stream.hh delete mode 100644 hdr/midi-track.hh delete mode 100644 hdr/midi-walker.hh delete mode 100644 hdr/misc.hh delete mode 100644 hdr/molecule.hh delete mode 100644 hdr/moment.hh delete mode 100644 hdr/musicalrequest.hh delete mode 100644 hdr/my-midi-lexer.hh delete mode 100644 hdr/my-midi-parser.hh delete mode 100644 hdr/notehead.hh delete mode 100644 hdr/notename.hh delete mode 100644 hdr/offset.hh delete mode 100644 hdr/paper-def.hh delete mode 100644 hdr/parseconstruct.hh delete mode 100644 hdr/pcol.hh delete mode 100644 hdr/proto.hh delete mode 100644 hdr/pscore.hh delete mode 100644 hdr/pstaff.hh delete mode 100644 hdr/qlp.hh delete mode 100644 hdr/qlpsolve.hh delete mode 100644 hdr/register.hh delete mode 100644 hdr/registergroup.hh delete mode 100644 hdr/reqtodo.hh delete mode 100644 hdr/request.hh delete mode 100644 hdr/rest.hh delete mode 100644 hdr/score-column.hh delete mode 100644 hdr/score-walker.hh delete mode 100644 hdr/score.hh delete mode 100644 hdr/scoreline.hh delete mode 100644 hdr/script-def.hh delete mode 100644 hdr/script-reg.hh delete mode 100644 hdr/script.hh delete mode 100644 hdr/slur-reg.hh delete mode 100644 hdr/slur.hh delete mode 100644 hdr/source-file.hh delete mode 100644 hdr/source.hh delete mode 100644 hdr/spanner.hh delete mode 100644 hdr/staff-column.hh delete mode 100644 hdr/staff-elem-info.hh delete mode 100644 hdr/staff-elem.hh delete mode 100644 hdr/staff-walker.hh delete mode 100644 hdr/staff.hh delete mode 100644 hdr/staffline.hh delete mode 100644 hdr/staffsym.hh delete mode 100644 hdr/stem-beam-reg.hh delete mode 100644 hdr/stem.hh delete mode 100644 hdr/symbol.hh delete mode 100644 hdr/symtable.hh delete mode 100644 hdr/tex-stream.hh delete mode 100644 hdr/tex.hh delete mode 100644 hdr/text-def.hh delete mode 100644 hdr/text-reg.hh delete mode 100644 hdr/textitem.hh delete mode 100644 hdr/textspanner.hh delete mode 100644 hdr/time-description.hh delete mode 100644 hdr/track-column.hh delete mode 100644 hdr/voice-element.hh delete mode 100644 hdr/voice-group-regs.hh delete mode 100644 hdr/voice-regs.hh delete mode 100644 hdr/voice.hh delete mode 100644 hdr/walkregs.hh delete mode 100644 objects/Makefile delete mode 100644 src/Makefile delete mode 100644 src/bar-reg.cc delete mode 100644 src/bar.cc delete mode 100644 src/beam.cc delete mode 100644 src/binary-source-file.cc delete mode 100644 src/boxes.cc delete mode 100644 src/break.cc delete mode 100644 src/calcideal.cc delete mode 100644 src/clef-item.cc delete mode 100644 src/clef-reg.cc delete mode 100644 src/colhpos.cc delete mode 100644 src/commandrequest.cc delete mode 100644 src/complex-staff.cc delete mode 100644 src/complex-walker.cc delete mode 100644 src/debug.cc delete mode 100644 src/dimen.cc delete mode 100644 src/directional-spanner.cc delete mode 100644 src/duration.cc delete mode 100644 src/grouping.cc delete mode 100644 src/groupregs.cc delete mode 100644 src/headreg.cc delete mode 100644 src/idealspacing.cc delete mode 100644 src/identifier.cc delete mode 100644 src/input-file.cc delete mode 100644 src/input-music.cc delete mode 100644 src/input-score.cc delete mode 100644 src/input-staff.cc delete mode 100644 src/item.cc delete mode 100644 src/key-item.cc delete mode 100644 src/key-reg.cc delete mode 100644 src/key.cc delete mode 100644 src/keyword.cc delete mode 100644 src/leastsquares.cc delete mode 100644 src/lexer.l delete mode 100644 src/lexerinit.cc delete mode 100644 src/lily-stream.cc delete mode 100644 src/linespace.cc delete mode 100644 src/local-key-item.cc delete mode 100644 src/local-key-reg.cc delete mode 100644 src/lookup.cc delete mode 100644 src/lyric-item.cc delete mode 100644 src/lyricstaff.cc delete mode 100644 src/lyricwalker.cc delete mode 100644 src/main.cc delete mode 100644 src/meter-reg.cc delete mode 100644 src/meter.cc delete mode 100644 src/midi-def.cc delete mode 100644 src/midi-event.cc delete mode 100644 src/midi-item.cc delete mode 100644 src/midi-lexer.l delete mode 100644 src/midi-main.cc delete mode 100644 src/midi-output.cc delete mode 100644 src/midi-parser.y delete mode 100644 src/midi-score.cc delete mode 100644 src/midi-stream.cc delete mode 100644 src/midi-template.cc delete mode 100644 src/midi-track.cc delete mode 100644 src/midi-walker.cc delete mode 100644 src/misc.cc delete mode 100644 src/molecule.cc delete mode 100644 src/my-midi-lexer.cc delete mode 100644 src/my-midi-parser.cc delete mode 100644 src/mylexer.cc delete mode 100644 src/note.cc delete mode 100644 src/notehead.cc delete mode 100644 src/notename.cc delete mode 100644 src/paper-def.cc delete mode 100644 src/parser.y delete mode 100644 src/pcol.cc delete mode 100644 src/pscore.cc delete mode 100644 src/pstaff.cc delete mode 100644 src/qlp.cc delete mode 100644 src/qlpsolve.cc delete mode 100644 src/register.cc delete mode 100644 src/registergroup.cc delete mode 100644 src/request.cc delete mode 100644 src/rest.cc delete mode 100644 src/score-column.cc delete mode 100644 src/score-walker.cc delete mode 100644 src/score.cc delete mode 100644 src/scoreline.cc delete mode 100644 src/scores.cc delete mode 100644 src/script-def.cc delete mode 100644 src/script-reg.cc delete mode 100644 src/script.cc delete mode 100644 src/slur-reg.cc delete mode 100644 src/slur.cc delete mode 100644 src/source-file.cc delete mode 100644 src/source.cc delete mode 100644 src/spanner.cc delete mode 100644 src/staff-column.cc delete mode 100644 src/staff-elem-info.cc delete mode 100644 src/staff-elem.cc delete mode 100644 src/staff-walker.cc delete mode 100644 src/staff.cc delete mode 100644 src/staffline.cc delete mode 100644 src/staffsym.cc delete mode 100644 src/stem-beam-reg.cc delete mode 100644 src/stem.cc delete mode 100644 src/symbol.cc delete mode 100644 src/symtable.cc delete mode 100644 src/template1.cc delete mode 100644 src/template2.cc delete mode 100644 src/template3.cc delete mode 100644 src/template4.cc delete mode 100644 src/template5.cc delete mode 100644 src/template6.cc delete mode 100644 src/tex-stream.cc delete mode 100644 src/tex.cc delete mode 100644 src/texbeam.cc delete mode 100644 src/texslur.cc delete mode 100644 src/text-def.cc delete mode 100644 src/text-reg.cc delete mode 100644 src/textitem.cc delete mode 100644 src/textspanner.cc delete mode 100644 src/time-description.cc delete mode 100644 src/track-column.cc delete mode 100644 src/version.cc delete mode 100644 src/voice-group-regs.cc delete mode 100644 src/voice-regs.cc delete mode 100644 src/voice.cc delete mode 100644 src/voiceelt.cc delete mode 100644 src/walkregs.cc delete mode 100644 src/warn.cc delete mode 100644 src/windhoos-suck-suck-suck-thank-you-cygnus.cc delete mode 100644 src/wordwrap.cc diff --git a/Documentation/make_website b/Documentation/make_website deleted file mode 100755 index d1ec8d4a26..0000000000 --- a/Documentation/make_website +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/perl -w -sub - set_hrefs -{ - while () { - s#href=([A-Za-z.]+)#href=$base/$1#g; - print HTMLOUT $_; - } -} - -local $base="lilypond/"; -local @examples=("wohltemperirt"); - -system 'pod2html'; - -print "resetting refs.\n"; - -foreach $a (<*.html>) -{ - rename $a, "$a~"; - open HTMLIN, "$a~"; - open HTMLOUT, ">$a"; - set_hrefs; -} - -foreach $a (@examples) { - $texfile="test"; - system "ln ../input/$a.ly ./$a.ly.txt"; - system "cd ..; lilypond input/$a; tex $texfile;". - "dvips -o $texfile.ps $texfile;"; - - # generate the pixmap at twice the size, then rescale (for antialiasing) - if ( ! -f "$a.gif" ) { - system "mv ../$texfile.ps $a.ps; ". - "mv ../lelie.midi $a.midi; ". - "gs -q -sDEVICE=ppmraw -sOutputFile=- -r200 -dNOPAUSE $a.ps -c quit |pnmscale 0.5| ppmtogif > $a.gif"; - } -} - -system "tar hcf website.tar *.html *.gif lelie_logo.png *.ps *.ly.txt *.midi docxx/;" . - "gzip -f9 website.tar;" diff --git a/deps/Makefile b/deps/Makefile deleted file mode 100644 index 79265b1c0f..0000000000 --- a/deps/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -DISTFILES=Makefile dummy.dep - - - -dummy.dep: - touch dummy.dep - - -dist: $(DISTFILES) - ln $(DISTFILES) $(DDIR)/$(SUBDIR) - -clean: - true diff --git a/deps/dummy.dep b/deps/dummy.dep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/hdr/Makefile b/hdr/Makefile deleted file mode 100644 index aab2511d4f..0000000000 --- a/hdr/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -default: - $(MAKE) -C .. -DISTFILES=Makefile $(allhdr) -dist: - ln $(DISTFILES) $(DDIR)/$(SUBDIR) - - -TAGS: $(hdr) - $(TAGSACTION) $^ - -clean: - rm -f parser.hh - rm -f midi-parser.hh diff --git a/hdr/bar-reg.hh b/hdr/bar-reg.hh deleted file mode 100644 index c73e5d1f4f..0000000000 --- a/hdr/bar-reg.hh +++ /dev/null @@ -1,31 +0,0 @@ -/* - bar-reg.hh -- declare Bar_register - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef BARREG_HH -#define BARREG_HH -#include "register.hh" - -/** - generate bars. Either user ("|:"), or default (new measure) - */ -class Bar_register : public Request_register { - void split_bar(Bar *& pre, Bar * no, Bar * &post); -public: - Bar_req * bar_req_l_; - Bar * bar_p_; - - virtual bool try_request(Request *req_l); - virtual void process_requests(); - virtual void pre_move_processing(); - virtual void post_move_processing(); - Bar_register(); - NAME_MEMBERS(Bar_register); -}; - -#endif // BARREG_HH diff --git a/hdr/bar.hh b/hdr/bar.hh deleted file mode 100644 index 3727358d96..0000000000 --- a/hdr/bar.hh +++ /dev/null @@ -1,20 +0,0 @@ -/* - bar.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef BAR_HH -#define BAR_HH -#include "item.hh" - -struct Bar: Item { - String type; - - Bar(String type); -NAME_MEMBERS(Bar); - void do_print() const; - Molecule*brew_molecule_p()const; -}; -#endif // BAR_HH - diff --git a/hdr/beam.hh b/hdr/beam.hh deleted file mode 100644 index 8eb2f148b5..0000000000 --- a/hdr/beam.hh +++ /dev/null @@ -1,51 +0,0 @@ -/* - beam.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef BEAM_HH -#define BEAM_HH -#include "proto.hh" -#include "directional-spanner.hh" -#include "plist.hh" - -/** a beam connects multiple stems Beam adjusts the stems its owns to - make sure that they reach the beam and that point in the correct - direction */ -struct Beam: public Directional_spanner { - PointerList stems; - /// the slope of the beam in posns / point (dimension) - Real slope; - - /// position of leftmost end of beam - Real left_pos; - - - /* *************** */ -NAME_MEMBERS(Beam); - - virtual Interval width()const; - Offset center() const; - Spanner *do_break_at(PCol *, PCol *) const; - Beam(); - void add(Stem*); - - - void set_default_dir(); - void do_pre_processing(); - void do_post_processing(); - - void do_print() const; - void set_grouping(Rhythmic_grouping def, Rhythmic_grouping current); - void set_stemlens(); - ~Beam(); - -private: - Molecule stem_beams(Stem *here, Stem *next, Stem *prev)const; - void solve_slope(); - Molecule*brew_molecule_p()const; -}; - -#endif // BEAM_HH - diff --git a/hdr/binary-source-file.hh b/hdr/binary-source-file.hh deleted file mode 100644 index 1af35631be..0000000000 --- a/hdr/binary-source-file.hh +++ /dev/null @@ -1,18 +0,0 @@ -// -// binary-source-file.hh -- declare Binary_source_file -// -// copyright 1997 Jan Nieuwenhuizen - -#ifndef BINARY_SOURCE_FILE_HH -#define BINARY_SOURCE_FILE_HH - -class Binary_source_file : public Source_file { -public: - Binary_source_file( String& filename_str ); - virtual ~Binary_source_file(); - - virtual String error_str( char const* pos_ch_c_l ); - virtual int line_i( char const* pos_ch_c_l ); -}; - -#endif // BINARY_SOURCE_FILE_HH // diff --git a/hdr/boxes.hh b/hdr/boxes.hh deleted file mode 100644 index 22a2eec3a5..0000000000 --- a/hdr/boxes.hh +++ /dev/null @@ -1,31 +0,0 @@ -/* - some 2D geometrical concepts -*/ - -#ifndef BOXES_HH -#define BOXES_HH - -#include "fproto.hh" -#include "real.hh" -#include "interval.hh" -#include "offset.hh" - -/// a square subset of Real^2 -struct Box { - Interval x, y; - - void translate(Offset o) { - x.translate(o.x); - y.translate(o.y); - } - /// smallest box enclosing #b# - void unite(Box b) { - x.unite(b.x); - y.unite(b.y); - } - Box(); - Box(Interval ix, Interval iy); -}; - - -#endif diff --git a/hdr/break.hh b/hdr/break.hh deleted file mode 100644 index 886e2d788b..0000000000 --- a/hdr/break.hh +++ /dev/null @@ -1,44 +0,0 @@ -/* - break.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef BREAK_HH -#define BREAK_HH -#include "varray.hh" -#include "proto.hh" -#include "colhpos.hh" - -/** Class representation of an algorithm which decides where to put - the column, and where to break lines. */ -struct Break_algorithm { - PScore &pscore_; - Real linelength; - - /* *************** */ - - Break_algorithm(PScore&); - - /// check if the spacing/breaking problem is well-stated - void problem_OK()const; - - /// search all pcols which are breakable. - Line_of_cols find_breaks() const; - - /// helper: solve for the columns in #curline#. - Col_hpositions solve_line(Line_of_cols) const; - - /// does curline fit on the paper? - bool feasible(Line_of_cols)const; - - virtual Array solve()=0; -}; - -/// wordwrap type algorithm: move to next line if current is optimal. -struct Word_wrap : Break_algorithm { - virtual Array solve(); - Word_wrap(PScore&); -}; -#endif // BREAK_HH - diff --git a/hdr/class-name.hh b/hdr/class-name.hh deleted file mode 100644 index 26da52dc0e..0000000000 --- a/hdr/class-name.hh +++ /dev/null @@ -1,19 +0,0 @@ -/* - class-name.hh -- declare - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef CLASS_NAME_HH -#define CLASS_NAME_HH - -/// a macro to declare the classes name as a static and virtual function. -#define NAME_MEMBERS(c) \ -static const char *static_name(){ return #c; }\ -virtual const char *name() const{ return c::static_name(); } \ -int a_stupid_nonexistent_function_to_allow_the_semicolon_come_out() - -#endif // CLASS-NAME_HH diff --git a/hdr/clef-item.hh b/hdr/clef-item.hh deleted file mode 100644 index 341204f8ea..0000000000 --- a/hdr/clef-item.hh +++ /dev/null @@ -1,31 +0,0 @@ - -/* - clef-item.hh -- declare Clef_item - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef CLEFITEM_HH -#define CLEFITEM_HH -#include "item.hh" - - -struct Clef_item : Item { - String type; - int y_off; - - /// is this a change clef (smaller size)? - bool change; - - - /* *************** */ -NAME_MEMBERS(Clef_item); - Clef_item(); - void read(Clef_register const&); - void read(String); - Molecule* brew_molecule_p()const; -}; - -#endif // CLEFITEM_HH - - diff --git a/hdr/clef-reg.hh b/hdr/clef-reg.hh deleted file mode 100644 index cc3a8a90e9..0000000000 --- a/hdr/clef-reg.hh +++ /dev/null @@ -1,34 +0,0 @@ -/* - clef.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef CLEF_HH -#define CLEF_HH - -#include "scalar.hh" -#include "varray.hh" -#include "register.hh" - -/// where is c-0 in the staff? -class Clef_register : public Request_register { - Clef_item *clef_p_; - Clef_change_req * clef_req_l_; - -public: - int c0_position_i_; - String clef_type_str_; - - /* ************** */ - virtual void process_requests(); - virtual void pre_move_processing(); - virtual void post_move_processing(); - virtual bool try_request(Request*); - Clef_register(); - NAME_MEMBERS(Clef_register); - void read_req(Clef_change_req*); - bool set_type(String); -}; -#endif // CLEF_HH - diff --git a/hdr/colhpos.hh b/hdr/colhpos.hh deleted file mode 100644 index 5398417ab1..0000000000 --- a/hdr/colhpos.hh +++ /dev/null @@ -1,29 +0,0 @@ -/* - colhpos.hh -- part of LilyPond - - (c) 1997 Han-Wen Nienhuys -*/ - -#ifndef COLHPOS_HH -#define COLHPOS_HH -#include "varray.hh" -#include "proto.hh" - -typedef Array Line_of_cols; - -struct Col_hpositions { - Line_of_cols cols; - Array config; - Real energy; - - /* ************** */ - void OK()const; - - Col_hpositions(); - void add( PCol*c); - void print() const; -}; - - -#endif // COLHPOS_HH - diff --git a/hdr/commandrequest.hh b/hdr/commandrequest.hh deleted file mode 100644 index 71b8331661..0000000000 --- a/hdr/commandrequest.hh +++ /dev/null @@ -1,117 +0,0 @@ -/* - commandrequest.hh -- declare Non musical requests - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef COMMANDREQUEST_HH -#define COMMANDREQUEST_HH - -#include "request.hh" -#include "varray.hh" - -/** Request which are assumed to be "happening" before the - musical requests. */ -struct Command_req : virtual Request { - REQUESTMETHODS(Command_req, command); - - virtual Measure_grouping_req * measuregrouping() { return 0; } - virtual Clef_change_req * clefchange() { return 0; } - virtual Key_change_req * keychange() { return 0; } - virtual Partial_measure_req * partial() { return 0; } - virtual Meter_change_req * meterchange() { return 0; } - virtual Bar_req *bar() { return 0; } - virtual Cadenza_req *cadenza() { return 0; } - virtual Timing_req*timing() { return 0; } -}; - - -/** Baseclass for meter/partial req. It has to be handled by - Staff_{walker,column} baseclass. */ -struct Timing_req : Command_req { - REQUESTMETHODS(Timing_req, timing); -}; - - -struct Partial_measure_req : Timing_req { - Moment duration_; - - Partial_measure_req(Moment); - REQUESTMETHODS(Partial_measure_req, partial); -}; - -/** - todo: allow C meter - */ -struct Meter_change_req : Timing_req { - int beats_i_, one_beat_i_; - - Meter_change_req(); - void set(int,int); - REQUESTMETHODS(Meter_change_req, meterchange); -}; - -/// toggle Cadenza mode -struct Cadenza_req : Timing_req { - /// turn on? - bool on_b_; - Cadenza_req(bool); - REQUESTMETHODS(Cadenza_req,cadenza); -}; - -/// check if we're at start of a measure. -struct Barcheck_req : Timing_req { - - REQUESTMETHODS(Barcheck_req,barcheck); -}; - -struct Measure_grouping_req: Timing_req { - Array beat_i_arr_; - Array elt_length_arr_; - - REQUESTMETHODS(Measure_grouping_req, measuregrouping); -}; - -struct Group_change_req : Command_req { - String newgroup_str_; - REQUESTMETHODS(Group_change_req, groupchange); -}; - -/** draw a (repeat)-bar. This something different than #Barcheck_req#, - the latter should only happen at the start of a measure. */ -struct Bar_req : Command_req { - String type_str_; - Bar_req(String); - int compare(const Bar_req&)const; - REQUESTMETHODS(Bar_req,bar); -}; -struct Terminate_voice_req : Command_req { - REQUESTMETHODS(Terminate_voice_req,terminate); -}; - -struct Group_feature_req : Command_req { - int stemdir_i_; - Group_feature_req(); - REQUESTMETHODS(Group_feature_req, groupfeature); -}; - - -struct Key_change_req : Command_req { - Array melodic_p_arr_; - - Key_change_req(); - Key_change_req(Key_change_req const&); - ~Key_change_req(); - REQUESTMETHODS(Key_change_req, keychange); -}; - -struct Clef_change_req : Command_req { - String clef_str_; - Clef_change_req(String); - REQUESTMETHODS(Clef_change_req, clefchange); -}; - -#endif // COMMANDREQUEST_HH diff --git a/hdr/complex-staff.hh b/hdr/complex-staff.hh deleted file mode 100644 index 0a37e3a5f7..0000000000 --- a/hdr/complex-staff.hh +++ /dev/null @@ -1,25 +0,0 @@ -/* - complex-staff.hh -- declare Complex_staff - - (c) 1996,1997 Han-Wen Nienhuys -*/ - -#ifndef COMPLEXSTAF_HH -#define COMPLEXSTAF_HH - - -#include "key.hh" -#include "staff.hh" -#include "staff-walker.hh" - -/// -struct Complex_staff : Staff { - - /* *************** */ - - virtual void set_output(PScore *); - virtual Staff_walker *get_walker_p(); -}; - -#endif // COMPLEXSTAF_HH - diff --git a/hdr/complex-walker.hh b/hdr/complex-walker.hh deleted file mode 100644 index 861cee77f8..0000000000 --- a/hdr/complex-walker.hh +++ /dev/null @@ -1,47 +0,0 @@ -/* - complex-walker.hh -- declare Complex_walker - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef COMPLEXWALKER_HH -#define COMPLEXWALKER_HH - -#include "proto.hh" -#include "staff-walker.hh" -#include "staff-elem-info.hh" - -/** - A staff walker which uses registers to decide what to print - */ -class Complex_walker: public Staff_walker { - bool try_command_request(Command_req *req_l); - void do_announces(); - void try_request(Request*req); - - - -public: - int c0_position_i_; - Walker_registers *walk_regs_p_; - - /* *************** */ - - void regs_process_requests(); - void typeset_element(Staff_elem *elem_p); - void announce_element(Staff_elem_info); - virtual void process_requests(); - virtual void do_post_move(); - virtual void do_pre_move(); - - Complex_walker(Complex_staff*); - ~Complex_walker(); - - Complex_staff *staff(); -private: -}; - - -#endif // COMPLEXWALKER_HH - - diff --git a/hdr/const.hh b/hdr/const.hh deleted file mode 100644 index 9c2f3f9ccc..0000000000 --- a/hdr/const.hh +++ /dev/null @@ -1,12 +0,0 @@ -/* - global constants - */ -#ifndef CONST_HH -#define CONST_HH -#include -#include "real.hh" - -const Real EPS=1e-7; // qlpsolve.hh -const int MAXITER=100; // qlpsolve.hh -const Real INFTY=HUGE_VAL; -#endif diff --git a/hdr/debug.hh b/hdr/debug.hh deleted file mode 100644 index 92715dbfdc..0000000000 --- a/hdr/debug.hh +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef DEBUG_HH -#define DEBUG_HH - -#include -#include -#include "dstream.hh" -#include "real.hh" -#include "proto.hh" - -void message( String message_str, char const* context_ch_c_l ); -void warning( String message_str, char const* context_ch_c_l ); -void error( String message_str, char const* context_ch_c_l ); -void error(String s); // errors -void error_t(const String& s, Time_description const & t_tdes); -void error_t(String const &s, const Moment &when); -// warnings -//void warning(String s); -#define WARN warnout << "warning: "<<__FUNCTION__ << "(): " -extern ostream &warnout ; - -// progress -extern ostream *mlog; - -// debugging -extern Dstream *monitor; // monitor - -#ifdef NPRINT -#define mtor if (0) *monitor // clever hack -#else -#define mtor if (check_debug) monitor->identify_as(__PRETTY_FUNCTION__) -#endif - -extern bool check_debug; - -#endif diff --git a/hdr/dimen.hh b/hdr/dimen.hh deleted file mode 100644 index a3f4e8876b..0000000000 --- a/hdr/dimen.hh +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef DIMEN_HH -#define DIMEN_HH - -#include "real.hh" -#include "string.hh" - -const Real INCH_TO_PT=72.0; -const Real CM_TO_PT=INCH_TO_PT/2.54; -const Real MM_TO_PT=CM_TO_PT/10; -const Real PT_TO_PT =1.0; - -#define PT *PT_TO_PT -#define MM *MM_TO_PT -#define CM *CM_TO_PT -#define INCH *INCH_TO_PT - -Real parse_dimen(String); -String print_dimen(Real); -Real convert_dimen(Real, String); -#endif - diff --git a/hdr/directional-spanner.hh b/hdr/directional-spanner.hh deleted file mode 100644 index 9399b71c4d..0000000000 --- a/hdr/directional-spanner.hh +++ /dev/null @@ -1,26 +0,0 @@ -/* - directional-spanner.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef DIRECTIONALSPANNER_HH -#define DIRECTIONALSPANNER_HH - -#include "spanner.hh" - -/// a spanner which can be pointing "up" or "down" -struct Directional_spanner : Spanner{ - - /// -1 below heads, +1 above heads. - int dir_i_; - - /// offset of "center" relative to left-column/0-pos of staff - virtual Offset center() const=0; - virtual void set_default_dir()=0; - Directional_spanner(); - -}; - -#endif // DIRECTIONALSPANNER_HH - diff --git a/hdr/duration.hh b/hdr/duration.hh deleted file mode 100644 index ff92cf23f3..0000000000 --- a/hdr/duration.hh +++ /dev/null @@ -1,111 +0,0 @@ -// -// duration.hh -- declare Duration, Plet, Duration_convert Duration_iterator -// -// copyright 1997 Jan Nieuwenhuizen - -// split into 4? - -#ifndef DURATION_HH -#define DURATION_HH - -/// (dur) -struct Duration { - // actually i hate it when other people use default arguments, - // because it makes you easily loose track of what-s really - // happening; in the routine-s implementation you-re not aware - // of this defaultness (who sets this stupid value?). - Duration( int type_i = 1, int dots_i = 0, Plet* plet_p = 0 ); - Duration( Duration const& dur_c_r ); - ~Duration(); - - Duration const& operator =( Duration const& dur_c_r ); - - void set_plet( Plet* plet_l ); // handiger: newt zelf - -// int i_; // balltype -> type! - int type_i_; - int dots_i_; - Plet* plet_p_; -}; - -/// (plet) -struct Plet { - Plet( int replace_i, int type_i ); - Plet( Plet const& plet_c_r ); - -// int i_; - int iso_i_; // 2/3; 2 is not duration, maar of count! - int type_i_; -}; - -/** - Duration_convert handles all conversions to -n fro Duration (dur). - That is including (integer + division) representation for MIDI, - and conversion from unexact time representation (best guess :-). - - A Moment (mom) is a Rational that holds the time fraction - compared to a whole note (before also called wholes). - - SUGGESTION: currently a moment in time is called moment too; - let-s typedef Rational When too, so that we get - When Staff_column::when(), Moment Voice_element::mom(). -*/ -struct Duration_convert { - /// Most used division in MIDI, all fine with me. - static int const division_1_c_i = 384; - - /// Return (integer, division) representation. - static int dur2_i( Duration dur, int division_1_i = division_1_c_i ); - - /// Return Moment representation (fraction of whole note). - static Moment dur2_mom( Duration dur ); - - /// Return Mudela string representation. - static String dur2_str( Duration dur ); - - /// Return Moment from (integer, division) representation. - static Moment i2_mom( int i, int division_1_i = division_1_c_i ); - - /// Return Moment (fraction of whole) representation, best guess. - static Duration mom2_dur( Moment mom ); - - /// Return plet factor (not a Moment: should use Rational?). - static Moment plet_factor_mom( Duration dur ); - - /** Return synchronisation factor for mom, so that - mom2_dur( mom / sync_f ) will return the duration dur. - */ - static Real sync_f( Duration dur, Moment mom ); -}; - -/// (iter_dur) -struct Duration_iterator { - /// start at shortest: 128:2/3 - Duration_iterator(); - - // **** what about these three here ? - /// return forward_dur(); - Duration operator ++(int); - - /// return ok() - operator bool(); - - /// return dur() - Duration operator ()(); - // **** - - /// return current dur - Duration dur(); - - /// return dur(), step to next - Duration forward_dur(); - - /// durations left? - bool ok(); - -private: - Duration cursor_dur_; -}; - -#endif // DURATION_HH - diff --git a/hdr/glob.hh b/hdr/glob.hh deleted file mode 100644 index 7b8bb557d4..0000000000 --- a/hdr/glob.hh +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef GLOB_HH -#define GLOB_HH -#include -#include -#include "real.hh" - -#include "proto.hh" -#include "const.hh" -#endif diff --git a/hdr/grouping.hh b/hdr/grouping.hh deleted file mode 100644 index 06b4421b0a..0000000000 --- a/hdr/grouping.hh +++ /dev/null @@ -1,62 +0,0 @@ -/* - grouping.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef GROUPING_HH -#define GROUPING_HH - -#include "moment.hh" -#include "interval.hh" -#include "varray.hh" - -typedef Interval_t MInterval; - -/** data structure which represents rhythmic units this is a tree. It groupes notes according to rules - */ -struct Rhythmic_grouping { - Array children; - MInterval *interval_; - - /* *************** */ - - Array intervals(); - MInterval interval()const; - Moment length() const; - void intersect(MInterval); - - void operator=(Rhythmic_grouping const&); - Rhythmic_grouping(Rhythmic_grouping const&); - Rhythmic_grouping(MInterval, int n=1); - Rhythmic_grouping(); - Rhythmic_grouping(Array); - ~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); - - void print() const; - void OK() const; - - Array generate_beams(Array, int&); - - /** multiply self to span #i#. - In implementation, this isn't really const, but conceptually it is. - */ - void extend(MInterval i) const; - void translate(Moment); -private: - void init(); - void junk(); - void copy(Rhythmic_grouping const&); -}; - - -Rhythmic_grouping parse_grouping(Array beat_i_arr, Array elt_length_arr); - - -#endif diff --git a/hdr/headreg.hh b/hdr/headreg.hh deleted file mode 100644 index eaa2d6f9d7..0000000000 --- a/hdr/headreg.hh +++ /dev/null @@ -1,28 +0,0 @@ -/* - headreg.hh -- part of LilyPond - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef HEADREG_HH -#define HEADREG_HH -#include "register.hh" - -struct Notehead_register : Request_register { - Item* note_p_; - Rhythmic_req * note_req_l_; - int dir_i_; - - /* *************** */ - Notehead_register(); - virtual bool try_request(Request *req_l) ; - virtual void process_requests(); - virtual void pre_move_processing(); - virtual void post_move_processing(); - void set_feature(Features); - NAME_MEMBERS(Notehead_register); -}; - - -#endif // HEADREG_HH diff --git a/hdr/idealspacing.hh b/hdr/idealspacing.hh deleted file mode 100644 index 05f58ba9c8..0000000000 --- a/hdr/idealspacing.hh +++ /dev/null @@ -1,30 +0,0 @@ -/* - idealspacing.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef IDEALSPACING_HH -#define IDEALSPACING_HH -#include "proto.hh" - -/// ideal spacing between two columns -struct Idealspacing { - - /// the ideal distance - Real space; - - /// Hooke's constant: how strong are the "springs" attached to columns - Real hooke; - - /// the two columns - const PCol *left, *right; - - void print()const; - void OK() const ; - Idealspacing(const PCol *left,const PCol *right); -}; - - -#endif // IDEALSPACING_HH - diff --git a/hdr/identifier.hh b/hdr/identifier.hh deleted file mode 100644 index 1aa7f7d0c4..0000000000 --- a/hdr/identifier.hh +++ /dev/null @@ -1,42 +0,0 @@ - -/* - identifier.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef IDENTIFIER_HH -#define IDENTIFIER_HH -#include "identparent.hh" -#include "symtable.hh" -#include "input-staff.hh" -#include "input-music.hh" -#include "notename.hh" -#include "lookup.hh" -#include "script-def.hh" - -#define make_id_class(Idclass, Class, accessor) \ -struct Idclass : Identifier {\ - virtual const char *classname() { return #Class; }\ - Idclass(String s, Class*st):Identifier(s) { data = st; }\ - virtual Class* accessor(bool copy) {\ - if (copy)\ - return new Class(* (Class*) data);\ - else\ - return (Class*) data;\ - }\ - ~Idclass() { delete accessor(false); }\ - virtual void do_print()const; \ -}\ - -make_id_class(Real_id, Real, real); -make_id_class(Script_id, Script_def, script); -make_id_class(Lookup_id, Lookup, lookup); -make_id_class(Symtables_id, Symtables, symtables); -make_id_class(Staff_id, Input_staff, staff); -make_id_class(M_chord_id, Music_general_chord, mchord); -make_id_class(M_voice_id, Music_voice, mvoice); -make_id_class(Notetab_id, Notename_tab, notename_tab); - -#endif // IDENTIFIER_HH - diff --git a/hdr/identparent.hh b/hdr/identparent.hh deleted file mode 100644 index 3e6d566ee7..0000000000 --- a/hdr/identparent.hh +++ /dev/null @@ -1,45 +0,0 @@ -/* - identparent.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef IDENTPARENT_HH -#define IDENTPARENT_HH - -#include "proto.hh" -#include "string.hh" - -/* boolean argument to accesor is copy_b..*/ -#define IDACCESSOR( Input_staff, staff)\ - virtual Input_staff * staff(bool) { error(#Input_staff); return 0; } - -struct Identifier { - void *data; - String name; - - Identifier(String n) : name(n) { } - virtual ~Identifier() {} - - void print()const; - virtual const char*classname() { return "new Identifier"; } - void error(String); - IDACCESSOR(Input_staff, staff) - IDACCESSOR(Input_music, music) - IDACCESSOR(Music_voice, mvoice) - IDACCESSOR(Script_def, script) - IDACCESSOR(Symtables, symtables) - IDACCESSOR(Music_general_chord, mchord) - IDACCESSOR(Lookup,lookup) - IDACCESSOR(Real,real) - IDACCESSOR(Notename_tab, notename_tab) -protected: - virtual void do_print()const=0; -private: - Identifier(Identifier const&){} - -}; -#endif // IDENTPARENT_HH - - - diff --git a/hdr/input-file.hh b/hdr/input-file.hh deleted file mode 100644 index a01ea75076..0000000000 --- a/hdr/input-file.hh +++ /dev/null @@ -1,28 +0,0 @@ -/* - input-file.hh -- declare Input_file - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#ifndef INPUT_FILE_HH -#define INPUT_FILE_HH -#include -#include "proto.hh" -#include "fproto.hh" -#include "varray.hh" -#include "string.hh" - -struct Input_file { - istream* is; - char const* defined_ch_c_l_; - Source_file* sourcefile_l_; - int line; - String name; - - Input_file(String); - ~Input_file(); -}; - -#endif // INPUT_FILE_HH diff --git a/hdr/input-music.hh b/hdr/input-music.hh deleted file mode 100644 index 1d7a8caa66..0000000000 --- a/hdr/input-music.hh +++ /dev/null @@ -1,140 +0,0 @@ -/* - input-music.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef INPUTMUSIC_HH -#define INPUTMUSIC_HH - -#include "plist.hh" -#include "proto.hh" -#include "voice.hh" -#include "moment.hh" - -struct Voice_list : public PointerList { - void translate_time(Moment dt); -}; - -/** - - A set voices. - Input_music is anything that can simply be regarded as/converted to - a set of voices "cooperating" or independant. It has some basic - characteristics that real music has too: - - - it is rhythmic (it has a length, and can be translated horizontally) - - a pitch (it can be transposed) - - */ -struct Input_music { - virtual Voice_list convert()const=0; - void check_plet(Voice_element* velt_l); - virtual Moment length()const=0; - virtual void translate_time(Moment dt)=0; - virtual ~Input_music(){} - virtual void print() const =0; - virtual void set_default_group(String)=0; - virtual bool find_plet_start_bo(char c, Moment& moment_r) = 0; - virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i) = 0; - // virtual void transpose(...) const =0; - - - virtual Input_music *clone() const = 0; - virtual Simple_music *simple() { return 0; } -}; - -/// Simple music consists of one voice -struct Simple_music : Input_music { - Voice voice_; - - /* *** */ - virtual Simple_music*simple() { return this; } - void add(Voice_element*); - virtual void set_default_group(String g) { voice_.set_default_group(g); } - virtual Moment length()const; - virtual Voice_list convert()const; - virtual void translate_time(Moment dt); - virtual void print() const; - virtual bool find_plet_start_bo(char c, Moment& moment_r); - virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i); - virtual Input_music *clone() const { - return new Simple_music(*this); - } - -}; - -/// Complex_music consists of multiple voices -struct Complex_music : Input_music { - IPointerList elts; - /* *************** */ - virtual void set_default_group(String g); - void add(Input_music*); - Complex_music(); - Complex_music(Complex_music const &); - virtual void print() const ; - void concatenate(Complex_music*); - virtual bool find_plet_start_bo(char c, Moment& moment_r); - virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i); - -}; - - -/** - A voice like list of music. - - different music forms which start after each other ( concatenated, - stacked "horizontally ) - - */ - -struct Music_voice : Complex_music { - - - /* *************** */ - Moment length()const; - virtual void translate_time(Moment dt); - virtual Voice_list convert()const; - void add_elt(Voice_element*); - virtual Input_music *clone() const { - return new Music_voice(*this); - } - virtual void print() const ; -}; - -/** - Multiple musicstuff stacked on top of each other - chord like : - - - different music forms which start at the same time ( stacked "vertically" ) - - */ -struct Music_general_chord : Complex_music { - - - /* *************** */ - - virtual Moment length()const; - virtual Voice_list convert()const; - virtual void translate_time(Moment dt); - void add_elt(Voice_element*); - virtual Input_music *clone() const { - return new Music_general_chord(*this); - } - - virtual void print() const ; -}; - -struct Multi_voice_chord : Music_general_chord { - void set_default_group(String); - virtual Input_music *clone() const { - return new Multi_voice_chord(*this); - } -}; -struct Voice_group_chord : Music_general_chord { - - virtual Input_music *clone() const { - return new Voice_group_chord(*this); - } -}; -#endif // INPUTMUSIC_HH diff --git a/hdr/input-score.hh b/hdr/input-score.hh deleted file mode 100644 index 4286f4b60b..0000000000 --- a/hdr/input-score.hh +++ /dev/null @@ -1,46 +0,0 @@ -/* - input-score.hh -- declare - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef INPUTSCORE_HH -#define INPUTSCORE_HH - -#include "varray.hh" -#include "proto.hh" -#include "plist.hh" -#include "string.hh" - - -/// the total music def of one movement -struct Input_score { - /// defined where? - const char* defined_ch_c_l_; - int errorlevel_i_; - - /// paper_, staffs_ and commands_ form the problem definition. - Paper_def *paper_p_; - Midi_def* midi_p_; - IPointerList staffs_; - - Input_music * score_wide_music_p_; - - /* *************************************************************** */ - Input_score(); - Input_score(Input_score const&); - - void add(Input_staff*); - ~Input_score(); - /// construction - void set(Paper_def*); - void set(Midi_def* midi_p); - void print() const; - Score*parse(); - void set(Input_music*); -}; - -#endif diff --git a/hdr/input-staff.hh b/hdr/input-staff.hh deleted file mode 100644 index 3b874a1b39..0000000000 --- a/hdr/input-staff.hh +++ /dev/null @@ -1,35 +0,0 @@ -/* - input-staff.hh -- declare Input_staff - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef INPUTSTAFF_HH -#define INPUTSTAFF_HH - -#include "string.hh" -#include "plist.hh" -#include "varray.hh" -#include "proto.hh" - -struct Input_staff { - - const char * defined_ch_c_l_; - String type; - - IPointerList music_; - Input_music * score_wide_music_p_; - - /* *************** */ - ~Input_staff(); - void add(Input_music*m); - Input_staff(Input_staff const&); - Input_staff(String); - void set_score_wide(Input_music*m); - Staff* parse(Score*, Input_music *score_wide); - void print() const; -}; - - -#endif // INPUTSTAFF_HH - diff --git a/hdr/item.hh b/hdr/item.hh deleted file mode 100644 index d1fc8c8bfa..0000000000 --- a/hdr/item.hh +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef ITEM_HH -#define ITEM_HH - -#include "glob.hh" -#include "boxes.hh" -#include "string.hh" -#include "staff-elem.hh" - -/** - a horizontally fixed size element of the score - - Item is the datastructure for printables whose width is known - before the spacing is calculated - - NB. This doesn't mean an Item has to initialize the output field before - spacing calculation. - -*/ -struct Item : Staff_elem { - /// indirection to the column it is in - PCol * pcol_l_; - - /* *************** */ - virtual Item *item() { return this; } - Item(); - void do_print()const; - - NAME_MEMBERS(Item); -}; - - -#endif diff --git a/hdr/key-item.hh b/hdr/key-item.hh deleted file mode 100644 index e56af8e682..0000000000 --- a/hdr/key-item.hh +++ /dev/null @@ -1,31 +0,0 @@ -/* - key-item.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef KEYITEM_HH -#define KEYITEM_HH - -#include "item.hh" -#include "varray.hh" - - -/// An item which places accidentals at the start of the line -struct Key_item : Item { - Array pitch; - Array acc; - int c_position; - - - /* *************** */ -NAME_MEMBERS(Key_item); - Key_item(int cposition); - void add(int pitch, int acc); - void read(const Key_register&); - void set_c_position(int); - void preprocess(); - Molecule* brew_molecule_p()const; -}; - -#endif // KEYITEM_HH diff --git a/hdr/key-reg.hh b/hdr/key-reg.hh deleted file mode 100644 index d8a96d066e..0000000000 --- a/hdr/key-reg.hh +++ /dev/null @@ -1,35 +0,0 @@ -/* - key-reg.hh -- declare Key_register - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef KEYREG_HH -#define KEYREG_HH - -#include "register.hh" -#include "key.hh" - -struct Key_register : Request_register { - Key key_; - Key_change_req * keyreq_l_; - Key_item * kit_p_; - Array accidental_idx_arr_; - bool default_key_b_; - - virtual bool try_request(Request *req_l); - virtual void process_requests(); - virtual void pre_move_processing(); - virtual void post_move_processing(); - virtual void acknowledge_element(Staff_elem_info); - Key_register(); - NAME_MEMBERS(Key_register); -private: - - void read_req(Key_change_req * r); -}; - -#endif // KEYREG_HH diff --git a/hdr/key.hh b/hdr/key.hh deleted file mode 100644 index 3d58629d5d..0000000000 --- a/hdr/key.hh +++ /dev/null @@ -1,39 +0,0 @@ -/* - key.hh -- declare Key - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef KEY_HH -#define KEY_HH - -#include "varray.hh" -#include "scalar.hh" - -/// administration of current key -class Key { - Array accidental_i_arr_; - - /* *************** */ - -public: - - Key(); - void set(int i, int acc); - int acc(int i)const { return accidental_i_arr_[i]; } -}; - -/// administration of accidentals -struct Local_key -{ - void reset(Key); - Key& oct(int); - Local_key(); - -private: - Array octaves; -}; - -#endif // KEY_HH - - diff --git a/hdr/keyword.hh b/hdr/keyword.hh deleted file mode 100644 index 152d9dc15d..0000000000 --- a/hdr/keyword.hh +++ /dev/null @@ -1,27 +0,0 @@ -/* - keyword.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef KEYWORD_HH -#define KEYWORD_HH - -/* for the keyword table */ -struct Keyword_ent -{ - const char *name; - int tokcode; -}; - -struct Keyword_table -{ - Keyword_ent *table; - int maxkey; - Keyword_table(Keyword_ent *); - int lookup(const char *s) const; -}; - - -#endif // KEYWORD_HH - diff --git a/hdr/leastsquares.hh b/hdr/leastsquares.hh deleted file mode 100644 index 35b1e1d34b..0000000000 --- a/hdr/leastsquares.hh +++ /dev/null @@ -1,24 +0,0 @@ -/* - leastsquare.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef LEASTSQUARE_HH -#define LEASTSQUARE_HH -#include "varray.hh" -#include "offset.hh" - - -/** - Least squares minimisation in 2 variables. - */ -struct Least_squares { - Array input; - void minimise(Real &coef, Real &offset); - void OK() const; -}; - - -#endif // LEASTSQUARE_HH - diff --git a/hdr/lexer.hh b/hdr/lexer.hh deleted file mode 100644 index 6a9d21a98e..0000000000 --- a/hdr/lexer.hh +++ /dev/null @@ -1,51 +0,0 @@ -/* - lexer.hh -- declare My_flex_lexer - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#ifndef LEXER_HH -#define LEXER_HH -#include -#include "proto.hh" -#include "fproto.hh" -#include "varray.hh" -#include "string.hh" - -int yylex(); -void yyerror(const char *s); -bool busy_parsing(); -void kill_lexer(); -void set_lexer(); - -/// lexer with provisions for include files. -struct My_flex_lexer : yyFlexLexer { - - Array include_stack; - Assoc *the_id_tab; - Keyword_table * keytable; - Notename_tab * defaulttab; - int errorlevel_i_; - /* *************** */ - int ret_notename(int *p, String text, int octave_mod); - char const* here_ch_c_l(); - void set(Notename_tab *n); - int lookup_keyword(String); - void lookup_notename(int &large, int &small, String s); - void LexerError(const char *); - String spot() const; - Identifier*lookup_identifier(String s); - My_flex_lexer(); - void add_identifier(Identifier*i); - ~My_flex_lexer(); - void new_input(String s); - bool close_input(); - int yylex(); - void print_declarations() const; -}; - -extern My_flex_lexer *lexer; - -#endif diff --git a/hdr/lily-stream.hh b/hdr/lily-stream.hh deleted file mode 100644 index 55ae71b6e3..0000000000 --- a/hdr/lily-stream.hh +++ /dev/null @@ -1,27 +0,0 @@ -// -// lily-stream.hh -- part of LilyPond -// -// copyright 1997 Jan Nieuwenhuizen - -// should i be named Mudela_stream? - -#ifndef LILY_STREAM_HH -#define LILY_STREAM_HH - -/// Lily output -struct Lily_stream { - ostream* os_p_; - String filename_str_; - - Lily_stream( String filename_str ); - ~Lily_stream(); - - Lily_stream& operator <<( String str ); - Lily_stream& operator <<( Midi_event& midi_event_r ); - - void header(); - void open(); -}; - -#endif // LILY_STREAM_HH - diff --git a/hdr/linespace.hh b/hdr/linespace.hh deleted file mode 100644 index 1479d1e936..0000000000 --- a/hdr/linespace.hh +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef PROBLEM_HH -#define PROBLEM_HH - -#include "glob.hh" -#include "plist.hh" -#include "varray.hh" -#include "vector.hh" -#include "interval.hh" - -/// helper struct for #Spacing_problem# -struct Colinfo { - const PCol *pcol_; - const Real* fixpos; - Interval width; - - /* *************** */ - Colinfo(); - void operator=(Colinfo const&); - Colinfo(Colinfo const&); - ~Colinfo(); - Colinfo(const PCol*,const Real*); - void print() const; - bool fixed() const { return fixpos;} - Real fixed_position()const { return *fixpos; } - Real minright() const { return width.right; } - Real minleft() const { return -width.left; } -}; - - -/** the problem, given by the columns (which include constraints) and - intercolumn spacing. The problem is: - - Generate a spacing which - \begin{itemize} - \item - Satisfies spacing constraints (notes can't be printed through each other) - \item - Looks good, ie tries to conform to an ideal spacing as much as possible. - \end{itemize} - This is converted by regarding idealspacing as "springs" attached - to columns. The equilibrium of one spring is the ideal - distance. The columns have a size, this imposes "hard" constraints - on the distances. This transforms the problem into a quadratic - programming problem with linear constraints. - - The quality is given by the total potential energy in the - springs. The lower the energy, the better the configuration. -*/ -class Spacing_problem { - Array ideals; - Array cols; - - /// the index of #c# in #cols# - int col_id(const PCol *c) const; - - /// generate an (nonoptimal) solution - Vector find_initial_solution() const; - - /// check if problem is too tight - bool check_feasible() const; - - /// does #this# contain the column #w#? - bool contains(const PCol *w); - - /// make the energy function - void make_matrices(Matrix &quad, Vector &lin,Real&) const; - - /// generate the LP constraints - void make_constraints(Mixed_qp& lp) const; - -public: - /** solve the spacing problem - - @return the column positions, and the energy (last element) - - */ - Array solve() const; - - - /** - add a idealspacing to the problem. - - One pair of columns can have no, one or more idealspacings, - since they can be "summed" if the columns to which #i# refers are - not in this problem, the spacing is ignored. - */ - void add_ideal(const Idealspacing *i); - - - /** add a col to the problem. columns have to be added left to right. The column contains - info on it's minimum width. - */ - void add_column(const PCol *, bool fixed=false, Real fixpos=0.0); - - - - bool check_constraints(Vector v) const; - - Vector try_initial_solution() const; - void OK() const; - void print() const; - void print_ideal(const Idealspacing*)const; -}; - - -#endif diff --git a/hdr/local-key-item.hh b/hdr/local-key-item.hh deleted file mode 100644 index 96bad9999e..0000000000 --- a/hdr/local-key-item.hh +++ /dev/null @@ -1,33 +0,0 @@ -/* - local-key-item.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef LOCALKEYITEM_HH -#define LOCALKEYITEM_HH -#include "item.hh" -#include "varray.hh" - -struct Local_acc { - int name , acc, octave; - static int compare(Local_acc&, Local_acc&); -}; - -struct Local_key_item : Item { -NAME_MEMBERS(Local_key_item); - Array accs; - Array support_items_; - int c0_position; - - /* *************** */ - - Local_key_item(int c0position); - void add(Item*); - void add(int oct, int pitch, int acc); - void add(Melodic_req*); - void do_pre_processing(); - Molecule* brew_molecule_p()const; -}; -#endif // LOCALKEYITEM_HH - diff --git a/hdr/local-key-reg.hh b/hdr/local-key-reg.hh deleted file mode 100644 index d0a2867a87..0000000000 --- a/hdr/local-key-reg.hh +++ /dev/null @@ -1,25 +0,0 @@ -/* - local-key-reg.hh -- declare Local_key_register - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef LOCALKEYREG_HH -#define LOCALKEYREG_HH -#include "register.hh" -#include "key.hh" - -struct Local_key_register : Request_register { - Local_key local_key_; - Local_key_item* key_item_p_; - const Key *key_c_l_; - /* *************** */ - virtual void process_requests(); - virtual void acknowledge_element(Staff_elem_info); - virtual void pre_move_processing(); - Local_key_register(); - NAME_MEMBERS(Local_key_register); -}; - -#endif // LOCALKEYREG_HH diff --git a/hdr/lookup.hh b/hdr/lookup.hh deleted file mode 100644 index 524cdf1958..0000000000 --- a/hdr/lookup.hh +++ /dev/null @@ -1,57 +0,0 @@ -/* - lilypond, (c) 1996,97 Han-Wen Nienhuys -*/ -#ifndef LOOKUPSYMS_HH -#define LOOKUPSYMS_HH - -#include "symbol.hh" -#include "fproto.hh" -#include "scalar.hh" - -/// intuitive interface to symbol table -struct Lookup { - Symtables *symtables_; - String texsetting; - /* *************** */ - void add(String, Symtable*); - void print()const; - Real internote(); - - Symbol linestaff(int n, Real w); - Symbol fill(Box b); - Symbol beam_element(int,int,Real=0); - - /// round slope to closest TeXslope - Symbol beam(Real&,Real); - - /** - pos == 3 : 3 lines above staff (extending below note) - - pos == -3: below staff - */ - Symbol streepjes(int pos); - - Symbol meter(Array); - Symbol stem(Real y1_pos, Real y2_pos); - Symbol rule_symbol(Real height, Real width); - Symbol accidental(int); - Symbol ball(int); - Symbol flag(int); - Symbol rest(int); - Symbol clef(String); - Symbol bar(String); - Symbol dots(int); - Symbol slur(int dy, Real &dx, int dir); - Symbol half_slur(int dy, Real &dx, int dir, int xpart); - Symbol half_slur_middlepart(Real &dx, int dir); - Symbol big_slur(int dy, Real &dx, int dir); - Symbol text(String style, String text, int align = 1); - Symbol script(String idx); - Symbol hairpin(Real & width, bool decresc); - - Lookup(); - Lookup(Lookup const &); - ~Lookup(); -}; - -#endif diff --git a/hdr/lyric-item.hh b/hdr/lyric-item.hh deleted file mode 100644 index dfbaf988d1..0000000000 --- a/hdr/lyric-item.hh +++ /dev/null @@ -1,19 +0,0 @@ -// -// lyric-item.hh -- part of LilyPond -// -// copyright 1997 Jan Nieuwenhuizen - -#ifndef LYRIC_ITEM_HH -#define LYRIC_ITEM_HH - -#include "textitem.hh" - -struct Lyric_item : Text_item { - /* *************** */ - Lyric_item(Lyric_req* lreq_l, int voice_count_i); - virtual void do_pre_processing(); -}; - - -#endif // LYRIC_ITEM_HH // - diff --git a/hdr/lyricstaff.hh b/hdr/lyricstaff.hh deleted file mode 100644 index fb88c5e5aa..0000000000 --- a/hdr/lyricstaff.hh +++ /dev/null @@ -1,24 +0,0 @@ -/* - lyricstaff.hh -- part of LilyPond - - copyright 1997 Jan Nieuwenhuizen - */ - -#ifndef LYRICSTAFF_HH -#define LYRICSTAFF_HH - -#include "staff.hh" - -/** - Hungarian prefix lstaff - */ -struct Lyric_staff : Staff { - virtual void set_output(PScore *); - virtual Staff_walker *get_walker_p(); -}; - -#endif // LYRICSTAFF_HH - - - - diff --git a/hdr/lyricwalker.hh b/hdr/lyricwalker.hh deleted file mode 100644 index 1a80523883..0000000000 --- a/hdr/lyricwalker.hh +++ /dev/null @@ -1,28 +0,0 @@ -// -// lyricwalker.hh -- declare Lyric_walker -// -// (c) 1996,97 Han-Wen Nienhuys, Jan Nieuwenhuizen -// - -#ifndef LYRICWALKER_HH -#define LYRICWALKER_HH - -#include "proto.hh" -#include "grouping.hh" -#include "staff-walker.hh" - -/// a simple walker which collects words, and then print them, first on top -struct Lyric_walker: Staff_walker { - Array litem_l_array_; - - /* *************** */ - virtual void process_requests(); - - Lyric_walker(Lyric_staff* lstaff_l); - Lyric_staff* lstaff_l(); -}; - - -#endif // LYRICWALKER_HH - - diff --git a/hdr/main.hh b/hdr/main.hh deleted file mode 100644 index 4a4a85e786..0000000000 --- a/hdr/main.hh +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef MAIN_HH -#define MAIN_HH -#include "proto.hh" - -void debug_init(); -void set_debug(bool); -void do_scores(); -void add_score(Input_score * s); -void set_default_output(String s); -Input_score* current_iscore_l(); -String find_file(String); -const char *get_version(); -extern Source* source_l_g; -extern bool only_midi; - -extern String default_out_fn; - -#endif diff --git a/hdr/meter-reg.hh b/hdr/meter-reg.hh deleted file mode 100644 index 6ebe18c282..0000000000 --- a/hdr/meter-reg.hh +++ /dev/null @@ -1,29 +0,0 @@ -/* - meter-reg.hh -- declare Meter_register - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef METERREG_HH -#define METERREG_HH -#include "register.hh" - -/** - generate meters. - */ -class Meter_register : public Request_register { -public: - Meter_change_req * meter_req_l_; - Meter * meter_p_; - - virtual bool try_request(Request *req_l); - virtual void process_requests(); - virtual void pre_move_processing(); - virtual void post_move_processing(); - Meter_register(); - NAME_MEMBERS(Meter_register); -}; -#endif // METERREG_HH diff --git a/hdr/meter.hh b/hdr/meter.hh deleted file mode 100644 index 928434b28a..0000000000 --- a/hdr/meter.hh +++ /dev/null @@ -1,22 +0,0 @@ -/* - meter.hh -- declare Meter - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef METER_HH -#define METER_HH -#include "item.hh" -#include "varray.hh" -#include "scalar.hh" - -struct Meter: Item { - Array args; - /* *************** */ -NAME_MEMBERS(Meter); - - Meter(Array args) ; - Molecule*brew_molecule_p() const; -}; -#endif // METER_HH - diff --git a/hdr/midi-def.hh b/hdr/midi-def.hh deleted file mode 100644 index 7a559adf58..0000000000 --- a/hdr/midi-def.hh +++ /dev/null @@ -1,38 +0,0 @@ -/* - midi-def.hh -- declare - - source file of the LilyPond music typesetter - - (c) 1997 Jan Nieuwenhuizen -*/ - - -#ifndef MIDIDEF_HH -#define MIDIDEF_HH -#include "proto.hh" -#include "real.hh" -#include "string.hh" -#include "moment.hh" - - -/** - */ -struct Midi_def { - /// output file name - String outfile_str_; - - /// duration of whole note - Real whole_seconds_f_; - - Midi_def(); - Midi_def(Midi_def const& midi_c_r); - ~Midi_def(); - - Real duration_to_seconds_f(Moment); - int get_tempo_i( Moment moment ); - void set_tempo( Moment moment, int count_per_minute_i ); - void print() const; -}; - -#endif // MIDIDEF_HH // - diff --git a/hdr/midi-event.hh b/hdr/midi-event.hh deleted file mode 100644 index 06b17221aa..0000000000 --- a/hdr/midi-event.hh +++ /dev/null @@ -1,85 +0,0 @@ -// -// midi-event.hh -- declare midi_event -// -// copyright 1997 Jan Nieuwenhuizen - -#ifndef MIDI_EVENT_HH -#define MIDI_EVENT_HH - - -// should these: -// * be Midi_items -// * be Voice_elements/requests -// * get a name-change -// ? - -/// (midi_event) -class Midi_event { -public: - Midi_event(); - virtual ~Midi_event(); - - virtual String mudela_str(); // = 0; - virtual void output_mudela( Lily_stream& lily_stream_r ); - virtual Moment mom(); - -protected: - String mudela_str_; -}; - -class Midi_key : public Midi_event { -public: - Midi_key( int accidentals_i, int minor ); - virtual ~Midi_key(); - - String notename_str( int pitch_i ); - -private: - int accidentals_i_; - int minor_i_; - int key_i_; -}; - -class Midi_note : public Midi_event { - public: - int const c0_pitch_i_c_ = 60; - - Midi_note( Midi_key* midi_key_l, Midi_time* midi_time_l, int division_1_i, int pitch_i, int time_i ); - virtual ~Midi_note(); - - virtual Moment mom(); - -private: - Duration dur_; -}; - -class Midi_tempo : public Midi_event { -public: - Midi_tempo( int useconds_per_4_i ); - virtual ~Midi_tempo(); - - int get_tempo_i( Moment moment ); - -private: - int useconds_per_4_i_; - Real seconds_per_1_f_; -}; - -class Midi_time : public Midi_event { -public: - Midi_time( int num_i, int den_i, int division_4_i, int count_32_i ); - virtual ~Midi_time(); - - Duration i2_dur( int time_i, int division_1_i ); - int clocks_1_i(); - -private: - Real sync_f_; - Duration sync_dur_; - int clocks_1_i_; - int num_i_; - int den_i_; -}; - -#endif // MIDI_EVENT_HH - diff --git a/hdr/midi-item.hh b/hdr/midi-item.hh deleted file mode 100644 index 6688e95411..0000000000 --- a/hdr/midi-item.hh +++ /dev/null @@ -1,85 +0,0 @@ -// -// midi-item.hh -- part of LilyPond -// -// copyright 1997 Jan Nieuwenhuizen - -#ifndef MIDI_ITEM_HH -#define MIDI_ITEM_HH -#include "string.hh" -#include "proto.hh" - -struct Midi_item { - /* *************** */ - static String i2varint_str( int i ); - virtual void output_midi( Midi_stream& midi_stream_r ); - virtual String str() = 0; -}; - -struct Midi_note : public Midi_item { - /* *************** */ - int const c0_pitch_i_c_ = 60; - Byte dynamic_byte_; - - /** - Generate a note-event on a channel pitch. - - @param #melreq_l# is the pitch. - */ - Midi_note( Melodic_req* melreq_l, int channel_i, bool on_b ); - - virtual String str(); - - int channel_i_; - int on_b_; - int pitch_i_; -}; - -struct Midi_duration : public Midi_item { - /* *************** */ - Midi_duration( Real seconds_f ); - - virtual String str(); - - Real seconds_f_; -}; - -struct Midi_chunk : Midi_item { - /* *************** */ - Midi_chunk(); - - void add( String str ); - void set( String header_str, String data_str, String footer_str ); - virtual String str(); - -private: - String data_str_; - String footer_str_; - String header_str_; -}; - -struct Midi_header : Midi_chunk { - /* *************** */ - Midi_header( int format_i, int tracks_i, int clocks_per_4_i ); -}; - -struct Midi_tempo : Midi_item { - /* *************** */ - Midi_tempo( int tempo_i ); - - virtual String str(); - - int tempo_i_; -}; - -struct Midi_track : Midi_chunk { - /* *************** */ - int number_i_; - Midi_track( int number_i ); - - void add( int delta_time_i, String event ); -// void add( Moment delta_time_moment, Midi_item& mitem_r ); - void add( Moment delta_time_moment, Midi_item* mitem_l ); -}; - -#endif // MIDI_ITEM_HH // - diff --git a/hdr/midi-main.hh b/hdr/midi-main.hh deleted file mode 100644 index b58e077d43..0000000000 --- a/hdr/midi-main.hh +++ /dev/null @@ -1,27 +0,0 @@ -// -// midi-main.hh -- global (sic) m2m stuff -// -// copyright 1997 Jan Nieuwenhuizen -#include "string.hh" - -#define monitor_p_g &cout -enum Verbose { QUIET_ver, BRIEF_ver, NORMAL_ver, VERBOSE_ver, DEBUG_ver }; -extern Verbose level_ver; -#ifdef NPRINT -#define dtor if ( 0 ) *monitor_p_g -#define mtor if ( 0 ) *monitor_p_g -#else -#define dtor if ( level_ver >= DEBUG_ver ) *monitor_p_g -#define vtor if ( level_ver >= VERBOSE_ver ) *monitor_p_g -#define mtor if ( level_ver >= NORMAL_ver ) *monitor_p_g -#define btor if ( level_ver >= BRIEF_ver ) *monitor_p_g -#define qtor if ( level_ver >= QUIET_ver ) *monitor_p_g -#endif - -extern Source* source_l_g; -extern bool no_triplets_bo_g; -void message( String message_str, char const* context_ch_c_l ); -void warning( String message_str, char const* context_ch_c_l ); -void error( String message_str, char const* context_ch_c_l ); - -String version_str(); diff --git a/hdr/midi-output.hh b/hdr/midi-output.hh deleted file mode 100644 index a590f5a790..0000000000 --- a/hdr/midi-output.hh +++ /dev/null @@ -1,21 +0,0 @@ -/* - midi-output.hh -- declare Midi_output - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef MIDIOUTPUT_HH -#define MIDIOUTPUT_HH -#include "pscore.hh" - -struct Midi_output { - Midi_stream* midi_stream_l_; - Midi_output(Score* score_l, Midi_def* ); - void do_staff(Staff*st_l, int count); - - Midi_def* midi_l_; -}; -#endif // MIDIOUTPUT_HH diff --git a/hdr/midi-score.hh b/hdr/midi-score.hh deleted file mode 100644 index 68707633ef..0000000000 --- a/hdr/midi-score.hh +++ /dev/null @@ -1,27 +0,0 @@ -// -// midi-score.hh -- declare midi_score -// -// copyright 1997 Jan Nieuwenhuizen - -#ifndef MIDI_SCORE_HH -#define MIDI_SCORE_HH - -/// (midi_score) -class Midi_score { -public: - Midi_score( int format_i, int tracks_i, int tempo_i ); - ~Midi_score(); - - void add_track( Midi_track* midi_track_p ); - - int output_mudela( String filename_str ); - -private: - IPointerList midi_track_p_list_; - int format_i_; - int tracks_i_; - int tempo_i_; -}; - -#endif // MIDI_SCORE_HH - diff --git a/hdr/midi-stream.hh b/hdr/midi-stream.hh deleted file mode 100644 index 6946bfdda1..0000000000 --- a/hdr/midi-stream.hh +++ /dev/null @@ -1,32 +0,0 @@ -// -// midi-stream.hh -- part of LilyPond -// -// copyright 1997 Jan Nieuwenhuizen - -#ifndef MIDI_STREAM_HH -#define MIDI_STREAM_HH - -#include -#include "string.hh" - -/// Midi output -struct Midi_stream { - ostream* os_p_; - String filename_str_; - int clocks_per_4_i_; - int tracks_i_; - - Midi_stream( String filename_str, int tracks_i, int clocks_per_4_i_ ); - ~Midi_stream(); - - Midi_stream& operator <<( String str ); - Midi_stream& operator <<( Midi_item& mitem_r ); - Midi_stream& operator <<( int i ); - - void header(); - void open(); - -//private: -// Midi_stream(Midi_stream const&); -}; -#endif // MIDI_STREAM_HH // diff --git a/hdr/midi-track.hh b/hdr/midi-track.hh deleted file mode 100644 index d1458ed0ca..0000000000 --- a/hdr/midi-track.hh +++ /dev/null @@ -1,26 +0,0 @@ -// -// midi-track.hh -- declare midi_track -// -// copyright 1997 Jan Nieuwenhuizen - -#ifndef MIDI_TRACK_HH -#define MIDI_TRACK_HH - -/// (midi_track) -class Midi_track { -public: - Midi_track( int track_i ); - ~Midi_track(); - - void add_event( Moment mom, Midi_event* midi_event_p ); - String name_str(); - void output_mudela( Lily_stream& lily_stream_r ); - Track_column* tcol_l( Moment mom ); - -private: - IPointerList tcol_p_list_; - String name_str_; -}; - -#endif // MIDI_TRACK_HH - diff --git a/hdr/midi-walker.hh b/hdr/midi-walker.hh deleted file mode 100644 index e7c26380f4..0000000000 --- a/hdr/midi-walker.hh +++ /dev/null @@ -1,41 +0,0 @@ -/* - midi-walker.hh -- declare Midi_walker - - (c) 1996,97 Han-Wen Nienhuys, Jan Nieuwenhuizen - */ - -#ifndef MIDIWALKER_HH -#define MIDIWALKER_HH - -#include "proto.hh" -#include "grouping.hh" -#include "staff-walker.hh" -#include "pcursor.hh" -#include "pqueue.hh" - - -/** - a simple walker which collects midi stuff, and then outputs. - - Should derive from Staff_walker - */ -class Midi_walker : public PCursor { - Midi_track *track_l_; - PQueue stop_notes; - Moment last_moment_; - - /* *************** */ - void do_stop_notes(Moment); - - void output_event(Midi_item&, Moment); -public: - - Midi_walker(Staff*, Midi_track*); - void process_requests(); - ~Midi_walker(); -}; - - -#endif // MIDIWALKER_HH - - diff --git a/hdr/misc.hh b/hdr/misc.hh deleted file mode 100644 index 00b742076e..0000000000 --- a/hdr/misc.hh +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef MISC_HH -#define MISC_HH - -#include "proto.hh" -#include "real.hh" -#include "moment.hh" -#include "scalar.hh" -#include "grouping.hh" - -Moment wholes(int dur, int dots); -double log_2(double x) ; -int intlog2(int d); -inline int -abs(int i){ - return (i < 0)?-i:i; -} -inline int -sign(int i) { - if (i<0) return -1; - else if (i) return 1; - else return 0; -} - -Interval itemlist_width(const Array &its); - -#endif diff --git a/hdr/molecule.hh b/hdr/molecule.hh deleted file mode 100644 index 084321ce4e..0000000000 --- a/hdr/molecule.hh +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef MOLECULE_HH -#define MOLECULE_HH - -#include "proto.hh" -#include "plist.hh" -#include "boxes.hh" -#include "symbol.hh" - -/// a symbol which can be translated, and freely copied -struct Atom { - Offset off; - Symbol sym; - - /* *************** */ - - void translate(Offset o) { - off += o; - } - - /// how big is #this#? - Box extent() const; - Atom(Symbol s); - - void print() const; - - String TeXstring() const; -}; - - -/** a group of individually translated symbols. You can add molecules - to the top, to the right, etc. */ -struct Molecule { - IPointerList ats; // change to List? - - /* *************** */ - - Molecule() { } - Molecule(Atom a) { add(a) ; } - - void add_right(const Molecule &m); - void add_left(const Molecule &m); - void add_top(const Molecule &m); - void add_bottom(const Molecule &m); - void add(Molecule const &m); - void translate(Offset); - void add(Atom a) { ats.bottom().add(new Atom(a)); } - /// how big is #this#? - Box extent() const; - - String TeXstring() const; - - Molecule(const Molecule&s); - void print() const; -private: - void operator=(const Molecule&); -}; -#endif diff --git a/hdr/moment.hh b/hdr/moment.hh deleted file mode 100644 index 0037d94078..0000000000 --- a/hdr/moment.hh +++ /dev/null @@ -1,14 +0,0 @@ -/* - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef MOMENT_HH -#define MOMENT_HH - -#include "rational.hh" -class String; -typedef Rational Moment; - - -#endif // - diff --git a/hdr/musicalrequest.hh b/hdr/musicalrequest.hh deleted file mode 100644 index 240b72afd9..0000000000 --- a/hdr/musicalrequest.hh +++ /dev/null @@ -1,198 +0,0 @@ -/* - musicalrequests.hh -- declare Musical requests - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef MUSICALREQUESTS_HH -#define MUSICALREQUESTS_HH - -#include "request.hh" - - -/** - A request which is coupled to a #Voice_element# with nonzero duration. - Base class only - */ -struct Musical_req : virtual Request { - virtual Skip_req* skip() { return 0; } - REQUESTMETHODS(Musical_req, musical); -}; - - -struct Skip_req : Musical_req { - Moment duration_; - - virtual Moment duration() const; - REQUESTMETHODS(Skip_req, skip); -}; -/** a request with a duration. - This request is used only a base class. - */ -struct Rhythmic_req : virtual Musical_req { - int balltype; - int dots; - Moment plet_factor; - /* *************** */ - static int compare(const Rhythmic_req &, const Rhythmic_req &); - virtual Moment duration() const; - Rhythmic_req(); - Rhythmic_req(int,int); - REQUESTMETHODS(Rhythmic_req, rhythmic); -}; - -struct Spacing_req :virtual Request { - Moment next; - Real distance; - Real strength; - /* *************** */ - Spacing_req(); - REQUESTMETHODS(Spacing_req, spacing); -}; - -struct Blank_req : Spacing_req, Rhythmic_req { - REQUESTMETHODS(Spacing_req, spacing); - -}; - -/// Put a text above or below (?) this staff. -struct Text_req : virtual Musical_req { - /// preferred position (above/below) - int dir_i_; - /// the characteristics of the text - Text_def *tdef_p_; - /* *************** */ - Text_req(int d, Text_def*); - ~Text_req(); - Text_req(Text_req const&); - static int compare(const Text_req&,const Text_req&); - REQUESTMETHODS(Text_req,text); -}; - -/** Put a text in lyric_staff - @see Lyric_staff - */ -struct Lyric_req : public Rhythmic_req, Text_req { - Lyric_req(Text_def* t_p); - REQUESTMETHODS(Lyric_req, lreq_l); -}; - -/// request which has some kind of pitch -struct Melodic_req :virtual Musical_req -{ - /// 0 is c, 6 is b - int notename_i_; - /// 0 is central c - int octave_i_; - - /// 0 natural, 1 sharp, etc - int accidental_i_; - - /// force/supress printing of accidental. - bool forceacc_b_; - - /// return height from central c (in halflines) - int height()const; - /// return pitch from central c (in halfnotes) - int pitch()const; - Melodic_req(); - - 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(); } - REQUESTMETHODS(Note_req, note); - }; - -/** -Put a rest on the staff. Why a request? It might be a good idea to not typeset the rest, if the paper is too crowded. -*/ -class Rest_req : public Rhythmic_req { -public: - REQUESTMETHODS(Rest_req,rest); -}; - -/** - attach a stem to the noteball. - Rhythmic_req parent needed to determine if it will fit inside a beam. - */ -struct Stem_req : Rhythmic_req { - /// preferred direction for the stem - int dir_i_; - Stem_req(int s, int dots); - REQUESTMETHODS(Stem_req,stem); -}; - -/** - Requests to start or stop something. - This type of request typically results in the creation of a #Spanner# -*/ -struct Span_req : Musical_req { - /// should the spanner start or stop, or is it unwanted? - enum { - NOSPAN, START, STOP - } spantype ; - static int compare(const Span_req &r1, const Span_req &r2); - REQUESTMETHODS(Span_req,span); - - Span_req(); - -}; - -/// request for backward plet generation -struct Plet_req : Request { - char type_c_; - int dur_i_; - int type_i_; - Plet_req(); - - REQUESTMETHODS(Plet_req,plet); -}; -/** -*/ - -/** Start / stop a beam at this note. if #nplet# is set, the staff will try to put an -appropriate number over the beam - */ -struct Beam_req : Span_req { - int nplet; - - /* *************** */ - REQUESTMETHODS(Beam_req,beam); - - Beam_req(); -}; - -/// a slur -struct Slur_req : Span_req { - REQUESTMETHODS(Slur_req,slur); - -}; - - -/**Put a script above or below this ``note''. eg upbow, downbow. Why a -request? These symbols may conflict with slurs and brackets, so this -also a request */ -struct Script_req : Musical_req { - int dir_i_; - Script_def *scriptdef_p_; - - /* *************** */ - static int compare(const Script_req &, const Script_req &); - Script_req(int d, Script_def*); - REQUESTMETHODS(Script_req,script); - ~Script_req(); - Script_req(Script_req const&); -}; - - - - -#endif // MUSICALREQUESTS_HH diff --git a/hdr/my-midi-lexer.hh b/hdr/my-midi-lexer.hh deleted file mode 100644 index 032bf6752b..0000000000 --- a/hdr/my-midi-lexer.hh +++ /dev/null @@ -1,43 +0,0 @@ -// -// my-midi-lexer.hh -- declare My_midi_lexer -// -// copyright 1997 Jan Nieuwenhuizen - -#ifndef MY_MIDI_LEXER_HH -#define MY_MIDI_LEXER_HH - -#include -#include "proto.hh" -// #include "fproto.hh" -#include "varray.hh" -#include "string.hh" - -int yylex(); -void yyerror(const char *s); -// bool busy_parsing(); -// void kill_lexer(); -// void set_lexer(); - -/// (midi_lexer) -class My_midi_lexer : yyFlexLexer { -public: - My_midi_lexer( String filename_str ); - ~My_midi_lexer(); - - int close_i(); - void error( char const* sz_l ); - char const* here_ch_c_l(); - static int varint2_i( String str ); - int yylex(); - -private: - Input_file* input_file_p_; - -public: // ugh - int errorlevel_i_; -}; - -extern My_midi_lexer* midi_lexer_l_g; - -#endif // MY_MIDI_LEXER_HH - diff --git a/hdr/my-midi-parser.hh b/hdr/my-midi-parser.hh deleted file mode 100644 index d199bc1c4e..0000000000 --- a/hdr/my-midi-parser.hh +++ /dev/null @@ -1,54 +0,0 @@ -// -// my-midi-parser.hh -- declare My_midi_parser -// -// copyright 1997 Jan Nieuwenhuizen - -#ifndef MY_MIDI_PARSER_HH -#define MY_MIDI_PARSER_HH - -// #include "proto.hh" -// #include "string.hh" - -int yyparse(); - -/// (midi_parser) -class My_midi_parser { -public: - My_midi_parser( String filename_str ); - ~My_midi_parser(); - void add_score( Midi_score* midi_score_p ); - void error( char const* sz_l ); - int parse(); - void forward( int i ); - Moment mom(); - void note_begin( int channel_i, int pitch_i, int dyn_i ); - Midi_event* note_end_midi_event_p( int channel_i, int pitch_i, int dyn_i ); - int output_mudela( String filename_str ); - void reset(); - void set_division_4( int division_4_i ); - void set_key( int accidentals_i, int minor_i ); - void set_tempo( int useconds_i ); - void set_time( int num_i, int den_i, int clocks_i, int count_32_i ); - -private: - Int64 now_i64_; // 31 bits yields tipically about 1000 bars - - static int const CHANNELS_i = 16; - static int const PITCHES_i = 128; - Int64 running_i64_i64_a_[ CHANNELS_i ][ PITCHES_i ]; - - Midi_score* midi_score_p_; - int division_1_i_; - Midi_key* midi_key_p_; - Midi_tempo* midi_tempo_p_; - Midi_time* midi_time_p_; - - char const* defined_ch_c_l_; - int fatal_error_i_; - My_midi_lexer* midi_lexer_p_; -}; - -extern My_midi_parser* midi_parser_l_g; - -#endif // MY_MIDI_PARSER_HH - diff --git a/hdr/notehead.hh b/hdr/notehead.hh deleted file mode 100644 index d7a68e7798..0000000000 --- a/hdr/notehead.hh +++ /dev/null @@ -1,45 +0,0 @@ -/* - notehead.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef NOTEHEAD_HH -#define NOTEHEAD_HH -#include "item.hh" - -/** - ball at the end of the stem -takes care of: - - * help lines - * proper placing of dots - - */ - -struct Notehead : Item { - NAME_MEMBERS(Notehead); - - int position; - /// -1 = lowest, 0 = inside, 1 = top - int extremal; - /// needed for the help-lines - int staff_size; - int dots; - int balltype; - int x_dir; - - /* *************** */ - - void set_rhythmic(Rhythmic_req *); - - /** - position of top line (5 linestaff: 8) - */ - Notehead(int staff_size); - void do_print()const; - static int compare(Notehead * const &a, Notehead *const &b) ; - Molecule* brew_molecule_p()const; -}; -#endif // NOTEHEAD_HH - diff --git a/hdr/notename.hh b/hdr/notename.hh deleted file mode 100644 index b533f4d360..0000000000 --- a/hdr/notename.hh +++ /dev/null @@ -1,24 +0,0 @@ -/* - notename.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef NOTENAME_HH -#define NOTENAME_HH - -#include "string.hh" - -struct Notename_tab { - String notetab[7*5]; - - void set(int l, int s, String nm); - void lookup(int &large, int &small, String s); -}; - -void set_notename_tab(Notename_tab*n); -void lookup_notename(int &large, int &small, String s); - - -#endif // NOTENAME_HH - diff --git a/hdr/offset.hh b/hdr/offset.hh deleted file mode 100644 index e0b62bba76..0000000000 --- a/hdr/offset.hh +++ /dev/null @@ -1,38 +0,0 @@ -/* - offset.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef OFFSET_HH -#define OFFSET_HH -#include "real.hh" - -/// 2d vector -struct Offset { - Real x,y; - - Offset operator+(Offset o)const { - Offset r(*this); - r+=o; - return r; - } - - Offset operator+=(Offset o) { - x+=o.x; - y+=o.y; - return *this; - } - Offset(Real ix , Real iy) { - x=ix; - y=iy; - } - Offset() { - x=0.0; - y=0.0; - } -}; - -#endif // OFFSET_HH - - diff --git a/hdr/paper-def.hh b/hdr/paper-def.hh deleted file mode 100644 index ae557258b0..0000000000 --- a/hdr/paper-def.hh +++ /dev/null @@ -1,54 +0,0 @@ -/* - paper-def.hh -- declare - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef Paper_def_HH -#define Paper_def_HH -#include "proto.hh" -#include "real.hh" -#include "string.hh" -#include "moment.hh" - - -/** symbols, dimensions and constants - - This struct takes care of all kinds of symbols, dimensions and - constants. Most of them are related to the point-size of the fonts, - so therefore, the lookup table for symbols is also in here. - - see TODO - */ -struct Paper_def { - Lookup *lookup_p_; - String outfile; - - Real linewidth; - - /// how much space does a whole note take (ideally?) - Real whole_width; - - /// ideal = geometric_ ^ log2(duration) - Real geometric_; - - /* *************** */ - void reinit(); - Paper_def(Lookup*); - void set(Lookup*); - ~Paper_def(); - Paper_def(Paper_def const&); - Real interline()const; - Real internote()const; - Real rule_thickness()const; - Real standard_height()const; - Real note_width() const; - void print() const; - Real duration_to_dist(Moment); -}; - -#endif // Paper_def_HH - diff --git a/hdr/parseconstruct.hh b/hdr/parseconstruct.hh deleted file mode 100644 index 7b9e3e3ec2..0000000000 --- a/hdr/parseconstruct.hh +++ /dev/null @@ -1,39 +0,0 @@ -/* - parseconstruct.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef PARSECONSTRUCT_HH -#define PARSECONSTRUCT_HH - -#include "proto.hh" - -extern char const* defined_ch_c_l; -extern char const* req_defined_ch_c_l; -void set_default_duration(int *); -void last_duration(int n); -void set_duration_mode(String s); -void get_default_duration(int *); -void set_default_octave(String); -void set_plet(int,int); -Voice_element * get_note_element(String,int * ,int *); -Voice_element* get_rest_element(String,int *); -Voice_element* get_word_element(Text_def*, int*); -void add_requests( Voice_element*v, Array&req); -Request* get_request(char); -void set_text_style(String); -Script_def* get_scriptdef(char); -Text_def*get_text(String s); -Request* get_plet_request( char c, int dur_i, int type_i ); -Request*get_script_req(int d , Script_def*def); -Request*get_text_req(int d , Text_def*def); -Request* get_stemdir_req(int); - - - - -Request*get_grouping_req(Array i_arr); - -#endif // PARSECONSTRUCT_HH - diff --git a/hdr/pcol.hh b/hdr/pcol.hh deleted file mode 100644 index 4fac246e49..0000000000 --- a/hdr/pcol.hh +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef COLS_HH -#define COLS_HH - -#include "glob.hh" -#include "boxes.hh" -#include "plist.hh" -#include "item.hh" - - -/** - stuff grouped vertically. - This is a class to address items vertically. It contains the data for: - \begin{itemize} - \item - unbroken score - \item - broken score - \item - the linespacing problem - \end{itemize} - */ - -struct PCol { - PointerList its; - PointerList stoppers, starters; - - - - /** prebreak is put before end of line. - if broken here, then (*this) column is discarded, and prebreak - is put at end of line, owned by Col - */ - PCol *prebreak_p_; - - /// postbreak at beginning of the new line - PCol *postbreak_p_; - - /** if this column is pre or postbreak, then this field points to - the parent. */ - PCol *daddy_l_; - - /// if lines are broken then this column is in #line# - const Line_of_score *line_l_; - - /// if lines are broken then this column x-coord #hpos# - Real hpos; - - PScore * pscore_l_; - - /* *************** */ - /// which one (left =0) - int rank() const; - - /// does this column have items - bool used_b() const; - - void add(Item *i); - - /// Can this be broken? true eg. for bars. - bool breakable_b()const; - - Interval width() const; - ~PCol(); - PCol(PCol * parent); - - /** - which col comes first?. - signed compare on columns. - - @return < 0 if c1 < c2. - */static int compare(const PCol &c1, const PCol &c2); - - - void OK() const; - void set_breakable(); - void print()const; -private: - PCol(PCol const&){} -}; - - -#include "compare.hh" -instantiate_compare(PCol &, PCol::compare); - - -#endif diff --git a/hdr/proto.hh b/hdr/proto.hh deleted file mode 100644 index 5a47fc459a..0000000000 --- a/hdr/proto.hh +++ /dev/null @@ -1,171 +0,0 @@ -/* - proto.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef PROTO_HH -#define PROTO_HH - -#include "fproto.hh" -#include "real.hh" - -/// (i64) -typedef long long Int64; - -struct Absdynamic_req; -struct Accidental; -struct Atom; -struct Bar; -struct Bar_register; -struct Barcheck_req; -struct Bar_req; -struct Beam; -struct Beam_req; -struct Box; -struct Bracket_req; -struct Cadenza_req; -struct Chord; -struct Clef_change_req; -struct Clef_register; -struct Clef_item; -struct Col_hpositions; -struct Colinfo; -struct Complex_music; -struct Complex_staff; -struct Complex_walker; -struct Cresc_req; -struct Directional_spanner; -struct Decresc_req; -struct Duration; -struct Duration_iterator; -struct Durational_req; -struct Dynamic; -struct Group_change_req; -struct Group_feature_req; -struct Idealspacing; -struct Identifier; -struct Input_file; -struct Input_music; -struct Input_score; -struct Input_staff; -struct Item; -struct Key; -struct Key_register; -struct Key_change_req; -struct Key_item; -struct Keyword; -struct Keyword_table; -struct Lily_stream; -struct Line_of_score; -struct Line_of_staff; -struct Linestaff; -struct Local_key; -struct Local_key_register; -struct Local_key_item; -struct Lookup; -struct Lyric_item; -struct Lyric_req; -struct Melodic_req; -struct Measure_grouping_req; -struct Meter_change_req; -struct Meter; -struct Meter_register; -struct Midi_def; -struct Midi_duration; -struct Midi_event; -struct Midi_header; -struct Midi_item; -struct Midi_key; -struct Midi_note; -struct Midi_output; -struct Midi_pitch; -struct Midi_staff; -struct Midi_stream; -struct Midi_tempo; -struct Midi_time; -struct Midi_track; -struct Midi_walker; -struct Mixed_qp; -class My_midi_lexer; -class My_midi_parser; -class Midi_event; -class Midi_score; -class Midi_track; -struct Molecule; -struct Musical_req; -struct Music_general_chord; -struct Music_voice; -struct Command_req; -struct Note_req; -struct Notehead; -struct Notehead_register; -struct Notename_tab; -struct Offset; -struct Output; -struct PCol; -struct Plet_req; -struct Plet; -struct PScore; -struct PStaff; -struct Paper_def; -struct Partial_measure_req; -struct Rational; -struct Register_group_register; -struct Request; -struct Request_register; -struct Rest; -struct Rest_req; -struct Rhythmic_grouping; -struct Rhythmic_grouping_req; -struct Rhythmic_req; -struct Score; -struct Score_column; -struct Score_walker; -struct Script_def; -struct Script; -struct Script_register; -struct Script_req; -struct Simple_music; -struct Skip_req; -struct Slur; -struct Slur_register; -struct Slur_req; -struct Source; -struct Source_file; -struct Spacing_req ; -struct Span_req; -struct Spanner; -struct Blank_req; -struct Staff; -struct Staff_column; -struct Staff_elem; -struct Staff_elem_info; -struct Staff_symbol; -struct Staff_walker; -struct Stem; -struct Stem_req; -struct Stem_beam_register; -struct String; -struct Symbol; -struct Symtable; -struct Symtables; -struct Tex_stream; -struct Terminate_voice_req; -struct Text_item ; -struct Text_def; -struct Text_gob; -struct Text_register; -struct Text_req; -struct Timing_req; -struct Time_description; -struct Track_column; -struct Voice; -struct Voice_element; -struct Voice_group_registers; -struct Voice_list; -struct Voice_registers; -struct Voicegroup; -struct Walker_registers; -typedef Rational Moment; -#endif // PROTO_HH diff --git a/hdr/pscore.hh b/hdr/pscore.hh deleted file mode 100644 index b7ad49c0e1..0000000000 --- a/hdr/pscore.hh +++ /dev/null @@ -1,106 +0,0 @@ -// the breaking problem for a score. - -#ifndef PSCORE_HH -#define PSCORE_HH - -#include "colhpos.hh" -#include "varray.hh" -#include "pcol.hh" -#include "pstaff.hh" - - -/** all stuff which goes onto paper. notes, signs, symbols in a score can be grouped in two ways: - horizontally (staffwise), and vertically (columns). #PScore# - contains the items, the columns and the staffs. - */ - -struct PScore { - Paper_def *paper_l_; - - /// the columns, ordered left to right - IPointerList cols; - - /// the idealspacings, no particular order - IPointerList suz; - - /// the staffs ordered top to bottom - IPointerList staffs; - - /// all symbols in score. No particular order. - IPointerList its; - - /// if broken, the different lines - IPointerList lines; - - /// crescs etc; no particular order - IPointerList spanners; - - /// broken spanners - IPointerList broken_spans; - - /* *************** */ - /* CONSTRUCTION */ - - PScore(Paper_def*); - /// add a line to the broken stuff. Positions given in #config# - void set_breaking(Array); - - void add(PStaff *); - - - /** add an item. - add the item in specified containers. If breakstatus is set - properly, add it to the {pre,post}break of the pcol. - */ - void typeset_item(Item *item_p, PCol *pcol_l,PStaff*pstaf_l,int breakstatus=1); - - /// add a Spanner - void typeset_spanner(Spanner*, PStaff*); - - /// add to bottom of pcols - void add(PCol*); - void add_broken(Spanner*); - - /* INSPECTION */ - Array select_items(PStaff*, PCol*); - - /** - @return argument as a cursor of the list - */ - PCursor find_col(const PCol *)const; - - /* MAIN ROUTINES */ - void process(); - - /// last deed of this struct - void output(Tex_stream &ts); - - /* UTILITY ROUTINES */ - - /// get the spacing between c1 and c2, create one if necessary. - Idealspacing* get_spacing(PCol *c1, PCol *c2); - - /// connect c1 and c2 - void do_connect(PCol *c1, PCol *c2, Real distance_f, Real strength_f); - - /// connect c1 and c2 and any children of c1 and c2 - void connect(PCol* c1, PCol *c2, Real distance_f,Real strength_f= 1.0); - - /* STANDARD ROUTINES */ - void OK()const; - void print() const; -private: - /// before calc_breaking - void preprocess(); - - /// calculate where the lines are to be broken, and use results - void calc_breaking(); - - /// after calc_breaking - void postprocess(); - - /// delete unused columns - void clean_cols(); -}; - -#endif diff --git a/hdr/pstaff.hh b/hdr/pstaff.hh deleted file mode 100644 index 50a7f0c719..0000000000 --- a/hdr/pstaff.hh +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef PSTAFF_HH -#define PSTAFF_HH - -#include "proto.hh" -#include "plist.hh" -#include "item.hh" -#include "symbol.hh" - -/// items grouped horizontally -struct PStaff { - PScore * pscore_l_; - - - PointerList spans; - PointerList its; - - /* *************** */ - void add(Item*i); - PStaff(PScore*); - -private: - PStaff(PStaff const&); -}; - -#endif diff --git a/hdr/qlp.hh b/hdr/qlp.hh deleted file mode 100644 index ccfba72bb8..0000000000 --- a/hdr/qlp.hh +++ /dev/null @@ -1,97 +0,0 @@ -/* - qlp.hh -- declare Ineq_constrained_qp, Mixed_qp - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#ifndef QLP_HH -#define QLP_HH - -#include "matrix.hh" - -/// inequality constrained quadratic program -class Ineq_constrained_qp { - friend class Active_constraints; - - Array cons; - Array consrhs; -public: - Matrix quad; - Vector lin; - Real const_term; - - - /** - use a KKT method to assert optimality of sol - */ - void assert_solution(Vector sol) const; - /// solve the problem using a projected gradient method - Vector solve(Vector start) const; - - /** - @return the number of variables in the problem - */ - int dim() const{ - return lin.dim(); - } - - /** - add a constraint - - - c*vars >= r - - PRE - c.dim() == dim(); - - */ - void add_inequality_cons(Vector c, double r); - - /** set up matrices to go with the problem. */ - Ineq_constrained_qp(int novars); - - /** - evaluate the quadratic function for input #v# - */ - Real eval(Vector v); - - void eliminate_var(int idx, Real value); - void OK()const; - void print() const; - -}; - - -/** - Quadratic programming with mixed linear constraints. - problem definition of a quadratic optimisation problem with linear - inequality and equality constraints - - - x^T QUAD x /2 + b^T x -*/ -class Mixed_qp :public Ineq_constrained_qp { - Array eq_cons; - Array eq_consrhs; -public: - Mixed_qp(int n); - void OK() const; - void print() const; - - Vector solve(Vector start) const; - void add_fixed_var(int i , Real value); - - - /** - add a constraint, - - c*vars == r - - PRE - c.dim()==dim(); - */ - void add_equality_cons(Vector c, double r); -}; -#endif diff --git a/hdr/qlpsolve.hh b/hdr/qlpsolve.hh deleted file mode 100644 index 7c9b8da341..0000000000 --- a/hdr/qlpsolve.hh +++ /dev/null @@ -1,91 +0,0 @@ -/* - qlpsolve.hh -- declare Active_constraints, Inactive_iter - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef QLPSOLVE_HH -#define QLPSOLVE_HH -#include "qlp.hh" -#include "matrix.hh" - - -/** - This class represents the set of active (binding) constraints - which can be active while the QLP algorithm is in a feasible - point. The active constraints are numbered. - If the constraints are of the form - - A^T*x >= b - - then the binding constraints are those where the >= is equality. - - */ - -class Active_constraints { - friend class Inactive_iter; - - - Matrix A,H; - Array active; - Array inactive; // actually this is a set, not an array. - const Ineq_constrained_qp *opt; - -public: - String status()const; - - Vector vec(int k) const { return opt->cons[k]; } - Real rhs(int k) const { return opt->consrhs[k]; } - - - /** drop constraint. drop constraint k from the active set. k is the index of the - constraint in #active# - - */ - void drop (int k); - - - /** add constraint j. - add constraint j to the active set j is the index of the - constraint in #inactive# - */ - void add(int j); - - /// exchange in and out. - void exchange(int in, int out) { add(in); drop (out); } - - - Vector find_active_optimum(Vector g); - - /// get lagrange multipliers. - Vector get_lagrange(Vector v); - - Active_constraints(Ineq_constrained_qp const *op); - /** construct: no constraints active, n vars. Put the equalities - into the constraints. */ - - /// check invariants - void OK(); -}; - - -/** - loop through the inactive constraints. - */ -class Inactive_iter { - int j; - Active_constraints const* ac; -public: - Inactive_iter(Active_constraints const &c) { ac=&c; j=0; } - int idx() const { return j; } - void operator ++(int) { j++; } - int constraint_id() const { return ac->inactive[j]; } - Vector vec() const { return ac->vec(constraint_id()); } - Real rhs() const { return ac->rhs(constraint_id()); } - bool ok() const { return j < ac->inactive.size(); } -}; - -#endif // QLPSOLVE_HH diff --git a/hdr/register.hh b/hdr/register.hh deleted file mode 100644 index da80db38fe..0000000000 --- a/hdr/register.hh +++ /dev/null @@ -1,107 +0,0 @@ -/* - register.hh -- part of LilyPond - - (c) 1996,1997 Han-Wen Nienhuys -*/ - -#ifndef REGISTER_HH -#define REGISTER_HH - -#include "proto.hh" -#include "varray.hh" -#include "request.hh" -#include "staff-elem-info.hh" - -/** - a struct which processes requests, and creates the #Staff_elem#s. - It may use derived classes. Hungarian postfix: register - */ -class Request_register { - friend class Register_group_register; - /** - You cannot copy a Request_register - */ - Request_register(const Request_register&){} -protected: - - /// utility - virtual Paper_def * paper() const; - - /** - try to fit the request in this register - - @return - false: not noted, not taken. - - true: request swallowed. Don't try to put the request elsewhere. - - - Default: always return false - */ - virtual bool try_request(Request *req_l); - - /// make items/spanners with the requests you got - virtual void process_requests(){} - - /** typeset any items/spanners. Default: do nothing - */ - virtual void pre_move_processing(){} - /** reset any appropriate data. Default: do nothing - */ - virtual void post_move_processing(){} - - /** - Is this request eligible to be processed? Default: return false. - */ - virtual bool acceptable_request_b(Request*) const; - - /** - typeset a "command" item. Default: pass on to daddy. - If the column is not breakable, #pre_p# and #post_p# are junked - */ - virtual void typeset_breakable_item(Item * pre_p , - Item * nobreak_p, Item * post_p); - /** - Invoke walker method to typeset element. Default: pass on to daddy. - */ - virtual void typeset_element(Staff_elem*elem_p); - - /** - take note of item/spanner - put item in spanner. Adjust local key; etc. - - Default: ignore the info - */ - virtual void acknowledge_element(Staff_elem_info) {} - /** - Announce element. Default: pass on to daddy. Utility - */ - virtual void announce_element(Staff_elem_info); - /** - Set features of the register(s). Default: ignore features. - */ - virtual void set_feature(Features){} - /** - Does this equal or contain a certain register? - */ - virtual bool contains_b(Request_register*reg_l); - /** - Get information on the staff. Default: ask daddy. - */ - virtual Staff_info get_staff_info(); - - virtual void do_print()const; -public: - /** Every Request_register (except for the 'top' which is directly - inside the Staff_walker, is a element of a group. */ - Register_group_register * daddy_reg_l_; - - Request_register(); - virtual ~Request_register(){} - NAME_MEMBERS(Request_register); - void print() const; -}; - - -#endif // REGISTER_HH - diff --git a/hdr/registergroup.hh b/hdr/registergroup.hh deleted file mode 100644 index 6d6e76a15b..0000000000 --- a/hdr/registergroup.hh +++ /dev/null @@ -1,54 +0,0 @@ -/* - registergroup.hh -- declare - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef REGISTERGROUP_HH -#define REGISTERGROUP_HH - - -#include "plist.hh" -#include "staff-elem-info.hh" -#include "register.hh" - -/** - Group a number of registers. Usually delegates everything to its contents. - Postfix: group - */ -class Register_group_register : public Request_register { -protected: - IPointerList reg_list_; - virtual void do_print()const; -public: - - /** - Junk #reg_l#. - - Pre: - #reg_l# is in #reg_list_# - */ - virtual void terminate_register(Request_register * reg_l); - - /** - Remove #reg_l# from the list, and return it. - */ - Request_register * get_register_p(Request_register*reg_l); - virtual void set_feature(Features i); - virtual bool acceptable_request_b(Request*); - virtual void pre_move_processing(); - virtual void post_move_processing(); - virtual void acknowledge_element(Staff_elem_info info); - virtual bool try_request(Request*); - virtual void process_requests(); - virtual ~Register_group_register(); - virtual void add(Request_register* reg_p); - virtual bool contains_b(Request_register*); -}; - -#endif // REGISTERGROUP_HH - - diff --git a/hdr/reqtodo.hh b/hdr/reqtodo.hh deleted file mode 100644 index eaed606453..0000000000 --- a/hdr/reqtodo.hh +++ /dev/null @@ -1,83 +0,0 @@ -#if 0 - - - -/**Draw a (Guitar) chord above or below this ``note''. -Why a request? -Because everything else is done in requests. -*/ -struct Chord : Request { - // don't know how this looks. -}; - - -/// for absolute dynamics -enum Loudness { - FFF, FF, F, MF, MP, P, PP, PPP -} ; - - -/** -Start/stop a bracket at this note. if #nplet# is set, the staff will -try to put an appropriate number over the bracket -*/ -struct Bracket_req : Span_req { - int nplet; // print a number over the beam. -}; - -struct Subtle_req { - Moment subtime; -}; - - -/** helper in the hierarchy. Each dynamic is bound to one note ( a - crescendo spanning multiple notes is thought to be made of two - "dynamics": a start and a stop). Dynamic changes can occur in a - smaller time than the length of its note, therefore fore each - Dynamic request carries a time, measured from the start of its - note. - - This subfield would come in handy, if mpp96 was adapted for midi - support. - - Dynamic should have been derived from request, but I don't want to - fuss with virtual baseclasses. */ - -struct Dynamic:Subtle_req { - -}; -/// do a crescendo -struct Cresc_req : Span_req, Dynamic { - -}; - -/// do a decrescendo -struct Decresc_req : Span_req, Dynamic { - -}; - -/// do a dynamic like "fff" or "mp" -struct Absdynamic_req : Request, Dynamic { - Loudness loudness; -}; - -struct Grace_req : Subtle_req { - -}; - -struct Grace_turn_req : Grace_turn { - -}; - -struct Grace_note : Melodic_req { - -}; - -struct Grace_notes { - -}; - -struct Glissando_req : Span_req { - -}; -#endif diff --git a/hdr/request.hh b/hdr/request.hh deleted file mode 100644 index 1936d5a2ab..0000000000 --- a/hdr/request.hh +++ /dev/null @@ -1,73 +0,0 @@ -/* - request.hh -- declare Request baseclasses. - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#ifndef REQUEST_HH -#define REQUEST_HH -// LilyPond's second egg of columbus! - -#include "glob.hh" -#include "string.hh" -#include "moment.hh" -#include "class-name.hh" - -/** - a voice element wants something printed. - Hungarian postfix: req - @see lilygut manpage - */ -class Request { -public: - Voice_element*elt_l_; - char const* defined_ch_c_l_; - - /* *************** */ - Voice * voice_l(); - Request(); - Request(Request const&); - virtual ~Request(){} - - NAME_MEMBERS(Request); - virtual Request* clone() const { return new Request(*this); } - void print()const ; - - virtual Moment duration() const { return 0; } - - /* accessors for children - maybe checkout RTTI - */ - virtual Barcheck_req *barcheck() { return 0; } - virtual Note_req *note() { return 0;} - virtual Script_req *script() { return 0;} - virtual Stem_req *stem() { return 0;} - virtual Text_req*text() { return 0; } - virtual Rest_req *rest() { return 0; } - virtual Span_req *span() { return 0; } - virtual Beam_req *beam() { return 0 ; } - virtual Plet_req* plet() { return 0; } - virtual Slur_req *slur() { return 0 ; } - virtual Rhythmic_req*rhythmic() { return 0; } - virtual Lyric_req* lreq_l() { return 0; } - virtual Melodic_req *melodic() { return 0; } - virtual Terminate_voice_req *terminate() {return 0;} - virtual Group_change_req * groupchange() { return 0;} - virtual Group_feature_req * groupfeature() { return 0; } - virtual Spacing_req * spacing() { return 0; } - virtual Blank_req * blank() { return 0; } - virtual Musical_req *musical() { return 0; } - virtual Command_req * command() { return 0; } -protected: - virtual void do_print()const ; -}; - -#define REQUESTMETHODS(T,accessor) \ -virtual T * accessor() { return this;}\ -NAME_MEMBERS(T);\ -virtual Request *clone() const { return new T(*this); } \ -virtual void do_print() const - -#endif diff --git a/hdr/rest.hh b/hdr/rest.hh deleted file mode 100644 index 85c7266677..0000000000 --- a/hdr/rest.hh +++ /dev/null @@ -1,25 +0,0 @@ -/* - rest.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef REST_HH -#define REST_HH -#include "item.hh" - -struct Rest : Item { - - int dots; - int balltype; - - /* *************** */ - - - Rest(int dur,int dots); - void do_print()const; -NAME_MEMBERS(Rest); - Molecule* brew_molecule_p()const; -}; -#endif - diff --git a/hdr/score-column.hh b/hdr/score-column.hh deleted file mode 100644 index e961d04920..0000000000 --- a/hdr/score-column.hh +++ /dev/null @@ -1,59 +0,0 @@ -/* - sccol.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef SCCOL_HH -#define SCCOL_HH -#include "proto.hh" -#include "varray.hh" -#include "moment.hh" - - -/** - - When typesetting hasn't started on PScore yet, the columns which - contain data have a rhythmical position. Score_column is the type - with a rhythmical time attached to it. The calculation of - idealspacing is done with data in these columns. (notably: the - #durations# field) - - */ - -class Score_column { - friend class Score; - friend class Score_walker; - - bool musical_b_; - Moment when_; - void set_breakable(); -public: - /// indirection to column - PCol * pcol_l_; - - /// length of notes/rests in this column - Array durations; - - /* *************** */ - - Moment when() { return when_; } - Score_column(Moment when); - static int compare(Score_column & c1, Score_column &c2); - void add_duration(Moment ); - void preprocess(); - bool breakable_b(); - bool musical_b() { return musical_b_; } - bool used_b(); - void print() const; - - -}; - -instantiate_compare(Score_column&, Score_column::compare); - -#endif // SCCOL_HH - - - - diff --git a/hdr/score-walker.hh b/hdr/score-walker.hh deleted file mode 100644 index b3d304256e..0000000000 --- a/hdr/score-walker.hh +++ /dev/null @@ -1,37 +0,0 @@ -/* - score-walker.hh -- declare Score_walker - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef SCOREWALKER_HH -#define SCOREWALKER_HH -#include "pcursor.hh" -#include "proto.hh" -#include "varray.hh" - - -/** - walk through the score_columns, and while doing so, walk all staffs in a score. - */ -class Score_walker : public PCursor -{ - Score* score_l_; - /// walkers for the individual staves. - Array walker_p_arr_; - Array disallow_break_walk_l_arr; - int disallow_break_count_; - void reinit(); -public: - void allow_break(Staff_walker*w); - Score_walker(Score*); - ~Score_walker(); - Moment when(); - void operator++(int); - /// process staff walkers. - void process(); -}; -#endif // SCOREWALKER_HH diff --git a/hdr/score.hh b/hdr/score.hh deleted file mode 100644 index a865ed02f3..0000000000 --- a/hdr/score.hh +++ /dev/null @@ -1,90 +0,0 @@ -/* - score.hh -- declare Score - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef SCORE_HH -#define SCORE_HH - -#include "varray.hh" -#include "proto.hh" -#include "plist.hh" -#include "moment.hh" -#include "assoc.hh" -#include "string.hh" - -/// the total music def of one movement -struct Score { - /// paper_, staffs_ and commands_ form the problem definition. - Paper_def *paper_p_; - Midi_def *midi_p_; - IPointerList staffs_; - - /// "runtime" fields for setting up spacing - IPointerList cols_; - PScore *pscore_p_; - - const char *defined_ch_c_l_; - int errorlevel_i_; - - /* *************************************************************** */ - - /// construction - Score(); - ~Score(); - void add(Staff*); - - /// do everything except outputting to file - void process(); - - /// output to file - void output(String fn); - - - /// - void set(Midi_def* midi_p); - /// - void set(Paper_def* midi_p); - - // standard - void OK() const; - void print() const; - - /// find a column. - PCursor find_col(Moment,bool); - - /// when does the last *musical* element finish? - Moment last() const; - -private: - void paper_output(); - void setup_music(); - void process_music(); - /// do midi stuff - void midi(); - - /// do paper stuff - void paper(); - - // utils: - PCursor create_cols(Moment); - - Score(Score const&){} - - /** - make the pcol_l_ fields of each Score_column point to the correct PCol, - remove any unnecessary Score_column's - */ - void do_cols(); - - /// remove unused cols - void clean_cols(); - - /// add #Idealspacings# to #pscore_# - void calc_idealspacing(); -}; -#endif diff --git a/hdr/scoreline.hh b/hdr/scoreline.hh deleted file mode 100644 index f4e1987033..0000000000 --- a/hdr/scoreline.hh +++ /dev/null @@ -1,33 +0,0 @@ -/* - scoreline.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef SCORELINE_HH -#define SCORELINE_HH -#include "proto.hh" -#include "plist.hh" -#include "varray.hh" - -/// the columns of a score that form one line. -struct -Line_of_score { - PointerList cols; - - // need to store height of each staff. - IPointerList staffs; - PScore * pscore_l_; // needed to generate staffs - - /* *************** */ - void process() ; - Line_of_score(Array sv, PScore *); - - String TeXstring() const; - - // is #c# contained in #*this#? - bool element(const PCol *c); -}; - -#endif - diff --git a/hdr/script-def.hh b/hdr/script-def.hh deleted file mode 100644 index 8b5be32561..0000000000 --- a/hdr/script-def.hh +++ /dev/null @@ -1,25 +0,0 @@ -/* - script-def.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef SCRIPTDEF_HH -#define SCRIPTDEF_HH -#include "string.hh" -struct Script_def{ - int stemdir; - int staffdir; - - bool invertsym; - String symidx; - - /* *************** */ - int compare(Script_def const &); - void print() const; - Script_def(String, int, int ,bool); -}; - - -#endif // SCRIPTDEF_HH - diff --git a/hdr/script-reg.hh b/hdr/script-reg.hh deleted file mode 100644 index 33592cae03..0000000000 --- a/hdr/script-reg.hh +++ /dev/null @@ -1,29 +0,0 @@ -/* - script-reg.hh -- part of LilyPond - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef SCRIPTREG_HH -#define SCRIPTREG_HH - -#include "register.hh" - - -struct Script_register : Request_register { - Script * script_p_; - Script_req * script_req_l_; - int dir_i_; - /* *************** */ - void set_feature(Features dir_i_); - Script_register(); - virtual bool try_request(Request*); - virtual void process_requests(); - virtual void acknowledge_element(Staff_elem_info); - virtual void pre_move_processing(); - virtual void post_move_processing(); - NAME_MEMBERS(Script_register); -}; - -#endif // SCRIPTREG_HH diff --git a/hdr/script.hh b/hdr/script.hh deleted file mode 100644 index df408f0435..0000000000 --- a/hdr/script.hh +++ /dev/null @@ -1,41 +0,0 @@ -/* - script.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef SCRIPT_HH -#define SCRIPT_HH - -#include "script-def.hh" -#include "item.hh" - -struct Script : Item { - int dir; - int symdir; - int pos; - int staffsize; - Script_def *specs_l_; - Stem *stem_l_; - Array support; - - /* *************** */ - NAME_MEMBERS(Script); - Molecule *brew_molecule_p()const; - virtual void do_post_processing(); - virtual void do_pre_processing(); - Script(Script_req*, int staffsize); - void set_support(Item*); - void set_stem(Stem*); - Interval support_height()const; - virtual Interval width() const; -private: - void set_symdir(); - void set_default_dir(); - void set_default_index(); - Symbol symbol()const; -}; - - -#endif // SCRIPT_HH - diff --git a/hdr/slur-reg.hh b/hdr/slur-reg.hh deleted file mode 100644 index e357c8795e..0000000000 --- a/hdr/slur-reg.hh +++ /dev/null @@ -1,33 +0,0 @@ -/* - slur-reg.hh -- declare Slur_register - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef SLURREG_HH -#define SLURREG_HH - -#include "register.hh" - -struct Slur_register : Request_register { - Array requests_arr_; - Array new_slur_req_l_arr_; - Array slur_l_stack_; - Array end_slur_l_arr_; - - int dir_i_; - - /* *************** */ - ~Slur_register(); - Slur_register(); - virtual bool try_request(Request*); - virtual void process_requests(); - virtual void acknowledge_element(Staff_elem_info); - virtual void pre_move_processing(); - virtual void post_move_processing(); - virtual void set_feature(Features); - NAME_MEMBERS(Slur_register); -}; - -#endif // SLURREG_HH diff --git a/hdr/slur.hh b/hdr/slur.hh deleted file mode 100644 index 87f1fe855e..0000000000 --- a/hdr/slur.hh +++ /dev/null @@ -1,37 +0,0 @@ -/* - slur.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef SLUR_HH -#define SLUR_HH - -#include "directional-spanner.hh" -#include "fproto.hh" -#include "varray.hh" - -struct Slur : Directional_spanner { - - Array encompass; - - bool open_left, open_right; - - /* *************** */ - Offset center() const; - Slur(); - void do_post_processing(); - void do_pre_processing(); - void add(Notehead*); - void set_default_dir(); - - Spanner* do_break_at( PCol*, PCol*) const; - void process(); -private: - Molecule*brew_molecule_p()const; - NAME_MEMBERS(Slur); -}; - -#endif // SLUR_HH - - diff --git a/hdr/source-file.hh b/hdr/source-file.hh deleted file mode 100644 index 7f7168eb7e..0000000000 --- a/hdr/source-file.hh +++ /dev/null @@ -1,40 +0,0 @@ -// -// source-file.hh -- declare Source_file -// -// copyright 1997 Jan Nieuwenhuizen - -#ifndef SOURCE_FILE_HH -#define SOURCE_FILE_HH - -/// class for reading and mapping a file. -class Source_file -{ -public: - /** Ugh! filename gets changed! The path to the opened file may - change, since it might be searched in multiple directories. */ - Source_file( String& filename_str_r ); - virtual ~Source_file(); - - char const* ch_c_l(); - virtual String error_str( char const* pos_ch_c_l ); - istream* istream_l(); - bool in_b( char const* pos_ch_c_l ); - off_t length_off(); - virtual int line_i( char const* pos_ch_c_l ); - String name_str(); - String file_line_no_str( char const* ch_c_l ); - -private: - void close(); - void map(); - void open(); - void unmap(); - - istream* istream_p_; - int fildes_i_; - String name_str_; - off_t size_off_; - caddr_t data_caddr_; -}; - -#endif // SOURCE_FILE_HH // diff --git a/hdr/source.hh b/hdr/source.hh deleted file mode 100644 index 6c79b75a99..0000000000 --- a/hdr/source.hh +++ /dev/null @@ -1,26 +0,0 @@ -// -// source.hh -- part of LilyPond -// -// copyright 1997 Jan Nieuwenhuizen - -#ifndef SOURCE_HH -#define SOURCE_HH - -class Source -{ -public: - Source(); - ~Source(); - - void add( Source_file* sourcefile_p ); - Source_file* sourcefile_l( char const* ch_c_l ); - -private: - IPointerList sourcefile_p_iplist_; -}; - - -// ugh -extern Source* source_l_g; - -#endif // SOURCE_HH // diff --git a/hdr/spanner.hh b/hdr/spanner.hh deleted file mode 100644 index 43a3567fa5..0000000000 --- a/hdr/spanner.hh +++ /dev/null @@ -1,54 +0,0 @@ -/* - spanner.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef SPANNER_HH -#define SPANNER_HH - -#include "proto.hh" -#include "staff-elem.hh" - - -/** a symbol which is attached between two columns. 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 - - - (de)crescendo - - slur - - beam - - bracket - - - Spanner should know about the items which it should consider: - e.g. slurs should be steep enough to "enclose" all those items. This - is absolutely necessary for beams, since they have to adjust the - length of stems of notes they encompass. - - */ -struct Spanner:Staff_elem { - PCol *left, *right; - - - /* *************** */ - - Spanner(); - virtual Interval width()const; - void do_print()const; - - Spanner *broken_at(PCol *c1, PCol *c2) const; - virtual Spanner* spanner() { return this; } -protected: - - /** - clone a piece of this spanner. - PRE - c1 >= start, c2 <= stop - */ - virtual Spanner *do_break_at( PCol *c1, PCol *c2) const=0; - NAME_MEMBERS(Spanner); -}; -#endif diff --git a/hdr/staff-column.hh b/hdr/staff-column.hh deleted file mode 100644 index dd6303ea8c..0000000000 --- a/hdr/staff-column.hh +++ /dev/null @@ -1,48 +0,0 @@ -/* - staff-column.hh -- declare Staff_column - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef STAFFCOLUMN_HH -#define STAFFCOLUMN_HH -#include "proto.hh" -#include "varray.hh" -#include "moment.hh" - -/// store simultaneous requests -class Staff_column { - - Staff_column(Staff_column const&); - -public: - Array creationreq_l_arr_; - Array musicalreq_l_arr_; - Array commandreq_l_arr_; - Staff * staff_l_; - - /// fields to collect timing data vertically. - Array timing_req_l_arr_; - Score_column *musical_column_l_, *command_column_l_; - - /* *************** */ - - Staff_column(); - - Moment when() const; - void set_cols(Score_column *c1, Score_column *c2); - void add(Voice_element*ve); - void OK() const; - ~Staff_column(); - void typeset_breakable_items(Array &pre_p_arr, - Array &nobreak_p_arr, - Array &post_p_arr); - void typeset_musical_item(Item *i); -protected: - void setup_one_request(Request*); -}; - - - -#endif // STAFFCOLUMN_HH - diff --git a/hdr/staff-elem-info.hh b/hdr/staff-elem-info.hh deleted file mode 100644 index 9c6264a86b..0000000000 --- a/hdr/staff-elem-info.hh +++ /dev/null @@ -1,43 +0,0 @@ -/* - staff-elem-info.hh -- declare Staff_elem_info - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef STAFFELEMINFO_HH -#define STAFFELEMINFO_HH - -#include "proto.hh" -#include "varray.hh" -/// data container. -struct Staff_elem_info { - Staff_elem * elem_p_; - Request*req_l_; - const Voice * voice_l_; - Array origin_reg_l_arr_; - - - /* *** */ - Staff_elem_info(Staff_elem*, Request*); - Staff_elem_info(); -}; - -struct Staff_info { - int *c0_position_i_; - Staff_walker *walk_l_; - const Time_description *time_c_l_; - const Rhythmic_grouping *rhythmic_c_l_; -}; - - -struct Features { - bool initialiser_b_; - int direction_i_; - - Features(); - static Features dir(int); -}; -#endif // STAFFELEMINFO_HH diff --git a/hdr/staff-elem.hh b/hdr/staff-elem.hh deleted file mode 100644 index e2fce84582..0000000000 --- a/hdr/staff-elem.hh +++ /dev/null @@ -1,88 +0,0 @@ -/* - staff-elem.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef STAFFELEM_HH -#define STAFFELEM_HH -#include "varray.hh" -#include "proto.hh" -#include "offset.hh" -#include "molecule.hh" -#include "class-name.hh" - - -/** Both Spanner and Item are Staff_elem's. Most Staff_elem's depend - on other Staff_elem's, eg, Beam needs to know and set direction of - Stem. So the Beam has to be calculated *before* Stem. This is - accomplished with the dependencies field of struct Staff_elem. - - */ -struct Staff_elem { - enum Status { - ORPHAN, // not yet added to pstaff - VIRGIN, // added to pstaff - PRECALCING, - PRECALCED, // calcs before spacing done - POSTCALCING, - POSTCALCED, // after spacing calcs done - OUTPUT, // molecule has been output - } status; - - /// the pstaff it is in - PStaff *pstaff_l_; - - /* *************** */ - Staff_elem(Staff_elem const&); - String TeXstring () const ; - virtual void print() const; - virtual Interval width() const; - virtual Interval height() const; - Paper_def *paper() const; - virtual ~Staff_elem(); - Staff_elem(); - NAME_MEMBERS(Staff_elem); - void translate(Offset); - void add_processing(); - void pre_processing(); - void post_processing(); - void molecule_processing(); - - virtual Spanner* spanner() { return 0; } - virtual Item * item() { return 0; } - void add_dependency(Staff_elem* ); - void substitute_dependency(Staff_elem* old, Staff_elem * newdep); - -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 - virtual void do_add_processing(); - /// do calculations before determining horizontal spacing - virtual void do_pre_processing(); - - /// do calculations after determining horizontal spacing - virtual void do_post_processing(); - - Array dependants; - -private: - /// member: the symbols - Molecule *output; // should scrap, and use temp var? - - - /** - This is needed, because #output# may still be - NULL. - */ - Offset offset_; - Array dependencies; -}; - - -#endif // STAFFELEM_HH - diff --git a/hdr/staff-walker.hh b/hdr/staff-walker.hh deleted file mode 100644 index fb0d098e07..0000000000 --- a/hdr/staff-walker.hh +++ /dev/null @@ -1,47 +0,0 @@ -/* - staff-walker.hh -- declare Staff_walker - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef STAFFWALKER_HH -#define STAFFWALKER_HH - -#include "proto.hh" -#include "time-description.hh" -#include "pcursor.hh" - -/** - manage run-time info when walking staffcolumns such as: key, - meter, pending beams & slurs - */ -struct Staff_walker : public PCursor { - Staff * staff_l_; - PScore * pscore_l_; - Score_walker *score_walk_l_; - Time_description time_; - Rhythmic_grouping *default_grouping; - - /* *************** */ - - Moment when() const; - virtual ~Staff_walker(); - Staff_walker(Staff*, PScore*); - void process() ; - - void operator++(int); - void allow_break(); - -protected: - /// every time before ++ is called - virtual void do_pre_move(){} - /// every time after ++ is called - virtual void do_post_move(){} - virtual void process_requests()=0; -private: - void process_timing_reqs(); - Staff_walker(Staff_walker const&); -}; - -#endif // STAFFWALKER_HH - diff --git a/hdr/staff.hh b/hdr/staff.hh deleted file mode 100644 index 959859b6e4..0000000000 --- a/hdr/staff.hh +++ /dev/null @@ -1,61 +0,0 @@ -/* - staff.hh -- declare Staff - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#ifndef STAFF_HH -#define STAFF_HH - -#include "plist.hh" -#include "proto.hh" -#include "moment.hh" - -/// base class for a collection of voices. -class Staff { - Staff(const Staff&src); - - /// synchronous horizontal stuff - IPointerList voice_list_; - Staff_column *get_col(Moment, PCursor * last= 0); - -public: - - /// runtime field - IPointerList cols_; - - Score *score_l_; - PScore *pscore_l_; - PStaff *pstaff_l_; - - /* *************************************************************** */ - - void add(const PointerList &s); - - void add_voice(Voice *v); - Paper_def*paper()const; - - void setup_staffcols(); - - void OK() const; - void print() const; - - /// when does the last *musical* element finish? - Moment last() const; - -// /// extract midi info -// Midi_track* midi_track_p(); - - /// remove unused cols - void clean_cols() ; - Staff(); - - virtual void set_output(PScore * destination)=0; - virtual Staff_walker *get_walker_p()=0; - virtual ~Staff() { } -protected: - -}; -#endif diff --git a/hdr/staffline.hh b/hdr/staffline.hh deleted file mode 100644 index 9fbe3ec917..0000000000 --- a/hdr/staffline.hh +++ /dev/null @@ -1,31 +0,0 @@ -/* - staffline.hh -- horizontal structures for broken scores. - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef STAFFLINE_HH -#define STAFFLINE_HH - -#include "proto.hh" -#include "real.hh" -#include "plist.hh" -#include "varray.hh" -#include "glob.hh" -#include "pstaff.hh" - -/// one broken line of staff. -struct Line_of_staff { - - Line_of_score * line_of_score_l_; - PStaff *pstaff_l_; - - /* *************** */ - - String TeXstring() const; - Line_of_staff(Line_of_score*, PStaff *); - Interval height() const; - void process(); -}; - -#endif diff --git a/hdr/staffsym.hh b/hdr/staffsym.hh deleted file mode 100644 index bcec2bfaff..0000000000 --- a/hdr/staffsym.hh +++ /dev/null @@ -1,30 +0,0 @@ -/* - staffsym.hh -- declare Staff_symbol - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef STAFFSYM_HH -#define STAFFSYM_HH -#include "spanner.hh" -/** - This spanner draws the lines of a pstaff. - The bottom line is position 0. - */ -class Staff_symbol : public Spanner -{ -public: - /// this many lines. - int no_lines_i_; - - NAME_MEMBERS(Staff_symbol); - Staff_symbol(int lines); - virtual Molecule* brew_molecule_p() const; - void set_extent(PCol* p1, PCol* p2); - virtual void do_print()const; - virtual Spanner *do_break_at( PCol *c1, PCol *c2) const; -}; -#endif // STAFFSYM_HH diff --git a/hdr/stem-beam-reg.hh b/hdr/stem-beam-reg.hh deleted file mode 100644 index dddba269a4..0000000000 --- a/hdr/stem-beam-reg.hh +++ /dev/null @@ -1,33 +0,0 @@ -/* - stem-beam-reg.hh -- part of LilyPond - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef STEMBEAMREG_HH -#define STEMBEAMREG_HH -#include "register.hh" - -struct Stem_beam_register : Request_register { - Stem * stem_p_; - Beam * beam_p_; - Beam_req * beam_req_l_; - Stem_req * stem_req_l_; - Beam_req * start_req_l_; - bool end_beam_b_; - Rhythmic_grouping *current_grouping; - int default_dir_i_; - - /* *************** */ - Stem_beam_register(); - ~Stem_beam_register(); - virtual void set_feature(Features dir_i_); - virtual bool try_request(Request*); - virtual void process_requests(); - virtual void acknowledge_element(Staff_elem_info); - virtual void pre_move_processing(); - virtual void post_move_processing(); - NAME_MEMBERS(Stem_beam_register); -}; -#endif // STEMBEAMREG_HH diff --git a/hdr/stem.hh b/hdr/stem.hh deleted file mode 100644 index 34776ea49c..0000000000 --- a/hdr/stem.hh +++ /dev/null @@ -1,81 +0,0 @@ -/* - stem.hh -- declare Stem - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef STEM_HH -#define STEM_HH -#include "item.hh" -#include "varray.hh" -#include "moment.hh" - - -/**the rule attached to the ball. - takes care of: - - \begin{itemize} - \item the rule - \item the flag - \item up/down position. - \end{itemize} - */ - -struct Stem : Item { - /// heads that the stem encompasses (positions) - int minnote, maxnote; - - /// false if in beam - bool print_flag; - - int beams_left; - int beams_right; - - /// needed for determining direction/length - int staff_center; - - - /**extent of the stem (positions). - fractional, since Beam has to adapt them. - */ - - Real bot, top; - Real stemlen; - - /// flagtype? 4 none, 8 8th flag, 0 = beam. - int flag; - - - /** - geen gedonder, jij gaat onder. - -1 stem points down, +1: stem points up - */ - - int dir; - Real stem_xoffset; - - Array heads; - - /* *************** */ - Stem(int center); //, Moment duration); - - /// ensure that this Stem also encompasses the Notehead #n# - void add(Notehead*n); - - NAME_MEMBERS(Stem); - - Real hindex()const; - void do_print() const; - void set_stemend(Real); - int get_default_dir(); - void set_default_dir(); - void set_default_stemlen(); - void set_default_extents(); - void set_noteheads(); - void do_pre_processing(); - - Interval width() const; - - Molecule* brew_molecule_p() const; -}; -#endif diff --git a/hdr/symbol.hh b/hdr/symbol.hh deleted file mode 100644 index c166fa5bcf..0000000000 --- a/hdr/symbol.hh +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef SYMBOL_HH -#define SYMBOL_HH - -#include "string.hh" -#include "boxes.hh" -#include "proto.hh" - -struct Symbol { - String tex; - Box dim; - - Symbol (String, Box); - Symbol(); - String str()const; // for printing. -}; - -#endif diff --git a/hdr/symtable.hh b/hdr/symtable.hh deleted file mode 100644 index f96d02c1ec..0000000000 --- a/hdr/symtable.hh +++ /dev/null @@ -1,28 +0,0 @@ -/* - lilypond, (c) 1996,97 Han-Wen Nienhuys -*/ -#ifndef SYMTABLE_HH -#define SYMTABLE_HH -#include "assoc.hh" -#include "string.hh" -#include "symbol.hh" - -struct Symtable : public Assoc { - Symbol lookup(String)const; - void print()const; -}; - - -struct Symtables : private Assoc { - - Symtable* operator()(String s); - ~Symtables(); - Symtables(); - Symtables(Symtables const&); - Assoc::add; - void print()const; -}; - - -#endif - diff --git a/hdr/tex-stream.hh b/hdr/tex-stream.hh deleted file mode 100644 index 4d5805c556..0000000000 --- a/hdr/tex-stream.hh +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef TSTREAM__HH -#define TSTREAM__HH - -#include -#include "string.hh" - - -/** TeX output. - Use this class for writing to a TeX file. - It counts braces to prevent nesting errors, and - it will add a comment sign before each newline. - */ -struct Tex_stream { - bool outputting_comment; - ostream *os; - int nest_level; - - /// open a file for writing - Tex_stream(String filename); - void header(); - /// delegate conversion to string class. - Tex_stream &operator<<(String); - - /// close the file - ~Tex_stream(); -private: - Tex_stream(Tex_stream const&); -}; -#endif diff --git a/hdr/tex.hh b/hdr/tex.hh deleted file mode 100644 index af45ba7d27..0000000000 --- a/hdr/tex.hh +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef TEX_HH -#define TEX_HH - -#include "string.hh" -#include "boxes.hh" -#include "scalar.hh" - -/** parameter substitution in TeXstrings. - this function provides a simple macro mechanism: - - if source == "tex%bla%", then - substitute_args(source, {"X","Y"}) == "texXblaY" - */ -String -substitute_args(String source, Array args); - -/// parameter substitution in TeXstrings -String -substitute_args(String source, Array args); - -/// #h# is in points -String vstrut(Real h); - - -#endif diff --git a/hdr/text-def.hh b/hdr/text-def.hh deleted file mode 100644 index cc9c3c95b3..0000000000 --- a/hdr/text-def.hh +++ /dev/null @@ -1,29 +0,0 @@ -/* - text-def.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef TEXTDEF_HH -#define TEXTDEF_HH - -#include "string.hh" -#include "proto.hh" - -struct Text_def { - int align_i_; - String text_str_; - String style_str_; - char const* defined_ch_c_l_; - - - /* ****************/ - virtual ~Text_def() {}; - bool compare(const Text_def&); - Text_def(); - virtual void print() const; - virtual Atom create_atom(Paper_def*) const; -}; - -#endif // TEXTDEF_HH - diff --git a/hdr/text-reg.hh b/hdr/text-reg.hh deleted file mode 100644 index 59317e5bcd..0000000000 --- a/hdr/text-reg.hh +++ /dev/null @@ -1,26 +0,0 @@ -/* - text-reg.hh -- part of LilyPond - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef TEXTREG_HH -#define TEXTREG_HH -#include "register.hh" - -struct Text_register : Request_register{ - Text_item * text_p_; - Text_req * text_req_l_; - int dir_i_; - /* *************** */ - virtual void set_feature(Features ); - Text_register(); - virtual bool try_request(Request*); - virtual void process_requests(); - virtual void pre_move_processing(); - virtual void post_move_processing(); - NAME_MEMBERS(Text_register); -}; - -#endif // TEXTREG_HH diff --git a/hdr/textitem.hh b/hdr/textitem.hh deleted file mode 100644 index ae0b556308..0000000000 --- a/hdr/textitem.hh +++ /dev/null @@ -1,30 +0,0 @@ -/* - text.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef TEXT_ITEM_HH -#define TEXT_ITEM_HH - -#include "text-def.hh" -#include "item.hh" - -struct Text_item : Item { - int pos_i_; - int staffsize_i_; - int dir_i_; - Text_def* tdef_l_; - - /* ***************/ - NAME_MEMBERS(Text_item); - virtual void set_default_index(); - Molecule* brew_molecule_p() const; - void do_pre_processing(); - - Text_item(Text_req*,int); -}; - - -#endif // TEXT_HH - diff --git a/hdr/textspanner.hh b/hdr/textspanner.hh deleted file mode 100644 index dbdea979ad..0000000000 --- a/hdr/textspanner.hh +++ /dev/null @@ -1,34 +0,0 @@ -/* - textspanner.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef TEXTSPANNER_HH -#define TEXTSPANNER_HH - -#include "string.hh" -#include "directional-spanner.hh" -#include "text-def.hh" - -/** a spanner which puts texts on top of other spanners. Use for - triplets, eentweetjes, ottava, etc. */ -struct Text_spanner : Spanner { - Text_def spec; - Offset text_off_; - Directional_spanner*support; - - /* *************** */ - - NAME_MEMBERS(Text_spanner); - virtual void do_pre_processing(); - virtual void do_post_processing(); - virtual Interval height() const ; - virtual Molecule* brew_molecule_p()const; - virtual void do_print() const; - virtual Spanner* do_break_at(PCol*,PCol*)const; - Text_spanner(); - void set_support(Directional_spanner*); -}; -#endif // TEXTSPANNER_HH - diff --git a/hdr/time-description.hh b/hdr/time-description.hh deleted file mode 100644 index 7e366ec4c2..0000000000 --- a/hdr/time-description.hh +++ /dev/null @@ -1,50 +0,0 @@ -/* - moment.hh -- part of LilyPond - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef tdes_HH -#define tdes_HH - -#include "moment.hh" - -/// full info on where we are -struct Time_description { - Moment when_; - - /// if true, no bars needed, no reduction of whole_in_measure - bool cadenza_b_; - - /// current measure info - Moment whole_per_measure_; - - /// where am i - Moment whole_in_measure_; - - /// how long is one beat? - Moment one_beat_; - - /// idem - int bars_i_; - - /* *************** */ - void set_cadenza(bool); - void OK() const; - Time_description(); - void add(Moment dt); - String str()const; - void print() const; - void setpartial(Moment p); - Moment barleft(); - void set_meter(int,int); - static int compare (Time_description&, Time_description&); -}; - -#include "compare.hh" - - -instantiate_compare(Time_description&,Time_description::compare); - -#endif // Time_description_HH - diff --git a/hdr/track-column.hh b/hdr/track-column.hh deleted file mode 100644 index 1d86755a9f..0000000000 --- a/hdr/track-column.hh +++ /dev/null @@ -1,24 +0,0 @@ -// -// track-column.hh -- declare Track_column -// -// copyright 1997 Jan Nieuwenhuizen - -#ifndef TRACK_COLUMN_HH -#define TRACK_COLUMN_HH - -/// (tcol) -class Track_column { -public: - Track_column( Moment mom ); - ~Track_column(); - - void add_event( Midi_event* midi_event_p ); - Moment mom(); - -//private: - IPointerList midi_event_p_list_; - Moment mom_; -}; - -#endif // TRACK_COLUMN_HH - diff --git a/hdr/voice-element.hh b/hdr/voice-element.hh deleted file mode 100644 index 0c5b6b1328..0000000000 --- a/hdr/voice-element.hh +++ /dev/null @@ -1,37 +0,0 @@ -/* - voice-element.hh -- declare Voice_element - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef VOICE_ELEMENT_HH -#define VOICE_ELEMENT_HH - -#include "proto.hh" -#include "plist.hh" -#include "moment.hh" - -/** one horizontal bit. Voice_element is nothing but a container for - *the requests, */ -struct Voice_element { - Moment duration; - char const* defined_ch_c_l_; - const Voice *voice_l_; - IPointerList reqs; - - /* *************** */ - - Voice_element(); - Voice_element(Voice_element const & src ); - - void add(Request*); - bool find_plet_start_bo(char c, Moment& moment_r); - void print ()const; - void set_default_group(String id); - void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i); -}; - -#endif // VOICE-ELEMENT_HH diff --git a/hdr/voice-group-regs.hh b/hdr/voice-group-regs.hh deleted file mode 100644 index 7c1b4ed78a..0000000000 --- a/hdr/voice-group-regs.hh +++ /dev/null @@ -1,29 +0,0 @@ -/* - voice-group-regs.hh -- declare Voice_group_registers - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef VOICEGROUPREGS_HH -#define VOICEGROUPREGS_HH - -#include "registergroup.hh" - -struct Voice_group_registers : Register_group_register { - String group_id_str_; - Array voice_regs_l_; - - /* *************** */ - - NAME_MEMBERS(Voice_group_registers); - static bool static_acceptable_request_b(Request*); - virtual void terminate_register(Request_register*); - virtual void do_print() const; - virtual void add(Request_register*); - Voice_group_registers(String id); - virtual bool try_request(Request*); -}; -#endif // VOICEGROUPREGS_HH diff --git a/hdr/voice-regs.hh b/hdr/voice-regs.hh deleted file mode 100644 index 82070a704e..0000000000 --- a/hdr/voice-regs.hh +++ /dev/null @@ -1,31 +0,0 @@ -/* - voice-regs.hh -- declare Voice_registers - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef VOICEREGS_HH -#define VOICEREGS_HH - -#include "registergroup.hh" - -class Voice_registers : public Register_group_register { - - -public: - Voice *voice_l_; - /* *************** */ - - NAME_MEMBERS(Voice_registers); - virtual bool acceptable_request_b(Request*); - virtual void acknowledge_element(Staff_elem_info info); - virtual bool try_request(Request*); - Voice_registers(Voice*); - virtual void do_print() const; -}; - - -#endif // VOICEREGS_HH diff --git a/hdr/voice.hh b/hdr/voice.hh deleted file mode 100644 index 06e6e1da27..0000000000 --- a/hdr/voice.hh +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef VOICE_HH -#define VOICE_HH - -#include "proto.hh" -#include "plist.hh" -#include "moment.hh" - -/** class for horizontal stuff. - - Voice is a ordered row of Voice_elements. It is strictly - horizontal: you cannot have two rhythmic elements running parallel - in a Voice. For proper processing, each Voice should have - Group_change_req as a first element. - - */ - -struct Voice { - IPointerList elts; - Moment start; - - /* *************** */ - Voice(); - Voice(Voice const&); - - Moment when(const Voice_element*)const; - Moment last() const; - - void add(Voice_element*); - bool find_plet_start_bo(char c, Moment& moment_r); - void print() const; - void set_default_group(String id); - void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i); -}; - -#endif diff --git a/hdr/walkregs.hh b/hdr/walkregs.hh deleted file mode 100644 index 643ce57605..0000000000 --- a/hdr/walkregs.hh +++ /dev/null @@ -1,50 +0,0 @@ -/* - walkregs.hh -- declare Walker_registers - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#ifndef WALKREGS_HH -#define WALKREGS_HH - - -#include "registergroup.hh" - -/** - Top level registers: the interface to Complex_walker. - - [sigh. Sometimes I wish C++ could do better late binding.] - */ -struct Walker_registers : Register_group_register { - Array prebreak_item_p_arr_; - Array nobreak_item_p_arr_; - Array postbreak_item_p_arr_; - Array announce_info_arr_; - Array group_l_arr_; - Complex_walker * walk_l_; - - /* *************** */ - void change_group(Group_change_req * greq_l, - Voice_registers *voice_regs_l, - Voice_group_registers * old_group); - Voice_group_registers * get_group(String id); - void typeset_musical_item(Staff_elem * elem_p); - Walker_registers(Complex_walker*); - void do_announces(); - void terminate_register(Request_register * reg); - virtual bool try_request(Request * r); - virtual Staff_info get_staff_info(); - - virtual void announce_element(Staff_elem_info); - virtual void acknowledge_element(Staff_elem_info); - virtual void typeset_breakable_item(Item * pre_p , Item * nobreak_p, Item * post_p); - virtual void typeset_element(Staff_elem*elem_p); - virtual void pre_move_processing(); - virtual void post_move_processing(); - virtual Paper_def * paper() const; -}; - -#endif // WALKREGS_HH diff --git a/objects/Makefile b/objects/Makefile deleted file mode 100644 index 479dbfe1c2..0000000000 --- a/objects/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -DISTFILES=Makefile -dist: - ln $(DISTFILES) $(DDIR)/$(SUBDIR) - -clean: - rm *.o \ No newline at end of file diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index f49e05d64d..0000000000 --- a/src/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -default: - $(MAKE) -C .. - -win32: - $(MAKE) -C .. Windows_NT - -DISTFILES=Makefile $(allcc) $(othersrc) -dist: - ln $(DISTFILES) $(DDIR)/$(SUBDIR) - -TAGS: $(allcc) - $(TAGSACTION) $^ - -clean: - rm -f $(gencc) diff --git a/src/bar-reg.cc b/src/bar-reg.cc deleted file mode 100644 index b72eca8755..0000000000 --- a/src/bar-reg.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* - bar-reg.cc -- implement Bar_register - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#include "bar-reg.hh" -#include "bar.hh" -#include "commandrequest.hh" -#include "score-column.hh" -#include "time-description.hh" - -Bar_register::Bar_register() -{ - post_move_processing(); -} - -bool -Bar_register::try_request(Request*r_l) -{ - Command_req* c_l = r_l->command(); - if (!c_l|| !c_l->bar()) - return false; - - assert(!bar_req_l_); - bar_req_l_ = c_l->bar(); - - return true; -} - -void -Bar_register::process_requests() -{ - if (bar_req_l_ ) { - bar_p_ = new Bar(bar_req_l_->type_str_); - } else if (!get_staff_info().time_c_l_->whole_in_measure_) { - bar_p_ = new Bar("|"); - } - - if (bar_p_){ - announce_element(Staff_elem_info(bar_p_, bar_req_l_) ); - } -} - -void -Bar_register::split_bar(Bar *& pre, Bar * no, Bar * &post) -{ - String s= no->type; - if (s == ":|:") { - pre = new Bar(":|"); - post = new Bar("|:"); - }else if (s=="|:") { - post = new Bar(s); - } else { - pre = new Bar(*no); - } -} - -void -Bar_register::pre_move_processing() -{ - if (bar_p_) { - Bar * post_p =0; - Bar * pre_p =0; - split_bar(pre_p, bar_p_, post_p); - - typeset_breakable_item(pre_p, bar_p_, post_p); - bar_p_ =0; - } -} - -void -Bar_register::post_move_processing() -{ - bar_req_l_ = 0; - bar_p_ =0; -} diff --git a/src/bar.cc b/src/bar.cc deleted file mode 100644 index 32a7cd5fe6..0000000000 --- a/src/bar.cc +++ /dev/null @@ -1,28 +0,0 @@ -#include "bar.hh" -#include "string.hh" -#include "molecule.hh" -#include "paper-def.hh" -#include "lookup.hh" -#include "debug.hh" - - - -Bar::Bar( String t) -{ - type = t; -} - -void -Bar::do_print()const -{ - mtor << type; -} - -Molecule* -Bar::brew_molecule_p()const -{ - Symbol s = paper()->lookup_p_->bar(type); - Molecule*output = new Molecule(Atom(s)); - return output; -} - diff --git a/src/beam.cc b/src/beam.cc deleted file mode 100644 index 64f3e3cf77..0000000000 --- a/src/beam.cc +++ /dev/null @@ -1,295 +0,0 @@ -#include "varray.hh" - -#include "dimen.hh" -#include "beam.hh" -#include "misc.hh" -#include "debug.hh" -#include "symbol.hh" -#include "molecule.hh" -#include "leastsquares.hh" -#include "pcol.hh" -#include "stem.hh" -#include "paper-def.hh" -#include "lookup.hh" -#include "grouping.hh" - - - -struct Stem_info { - Real x; - Real idealy; - Real miny; - int no_beams; - - - Stem_info(){} - Stem_info(const Stem*); -}; - -Stem_info::Stem_info(const Stem*s) -{ - x = s->hindex(); - int dir = s->dir; - idealy = max(dir*s->top, dir*s->bot); - miny = max(dir*s->minnote, dir*s-> maxnote); - assert(miny <= idealy); - -} - -/* *************** */ - -Offset -Beam::center()const -{ - assert(status >= POSTCALCED); - - Real w=(paper()->note_width() + width().length())/2.0; - return Offset(w, (left_pos + w* slope)*paper()->internote()); -} - - -Beam::Beam() -{ - slope = 0; - left_pos = 0.0; -} - -void -Beam::add(Stem*s) -{ - stems.bottom().add(s); - s->add_dependency(this); - s->print_flag = false; -} - -void -Beam::set_default_dir() -{ - int dirs[2]; - dirs[0]=0; dirs[1] =0; - for (iter_top(stems,i); i.ok(); i++) { - int d = i->get_default_dir(); - dirs[(d+1)/2] ++; - } - dir_i_ = (dirs[0] > dirs[1]) ? -1 : 1; - for (iter_top(stems,i); i.ok(); i++) { - i->dir = dir_i_; - } -} - -/* - should use minimum energy formulation (cf linespacing) - */ -void -Beam::solve_slope() -{ - Array sinfo; - for (iter_top(stems,i); i.ok(); i++) { - i->set_default_extents(); - Stem_info info(i); - 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.push(Offset(sinfo[i].x, sinfo[i].idealy)); - } - - l.minimise(slope, left_pos); - Real dy = 0.0; - for (int i=0; i < sinfo.size(); i++) { - Real y = sinfo[i].x * slope + left_pos; - Real my = sinfo[i].miny; - - if (my - y > dy) - dy = my -y; - } - left_pos += dy; - left_pos *= dir_i_; - slope *= dir_i_; - - // URG - Real sl = slope*paper()->internote(); - paper()->lookup_p_->beam(sl, 20 PT); - slope = sl /paper()->internote(); -} - -void -Beam::set_stemlens() -{ - iter_top(stems,s); - Real x0 = s->hindex(); - for (; s.ok() ; s++) { - Real x = s->hindex()-x0; - s->set_stemend(left_pos + slope * x); - } -} - - -void -Beam::do_post_processing() -{ - solve_slope(); - set_stemlens(); -} - -void -Beam::set_grouping(Rhythmic_grouping def, Rhythmic_grouping cur) -{ - def.OK(); - cur.OK(); - assert(cur.children.size() == stems.size()); - - cur.split(def); - - Array b; - { - iter_top(stems,s); - Array flags; - for (; s.ok(); s++) { - int f = intlog2(abs(s->flag))-2; - assert(f>0); - flags.push(f); - } - int fi =0; - b= cur.generate_beams(flags, fi); - b.insert(0,0); - b.push(0); - assert(stems.size() == b.size()/2); - } - - iter_top(stems,s); - for (int i=0; i < b.size() && s.ok(); i+=2, s++) { - s->beams_left = b[i]; - s->beams_right = b[i+1]; - } -} - - -// todo. -Spanner * -Beam::do_break_at( PCol *, PCol *) const -{ - Beam *beam_p= new Beam(*this); - - return beam_p; -} - -void -Beam::do_pre_processing() -{ - left = (*stems.top()) ->pcol_l_; - right = (*stems.bottom())->pcol_l_; - assert(stems.size()>1); - if (!dir_i_) - set_default_dir(); - -} - - -Interval -Beam::width() const -{ - Beam * me = (Beam*) this; // ugh - return Interval( (*me->stems.top()) ->hindex(), - (*me->stems.bottom()) ->hindex() ); -} - -/* - beams to go with one stem. - */ -Molecule -Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const -{ - assert( !next || next->hindex() > here->hindex() ); - assert( !prev || prev->hindex() < here->hindex() ); - Real dy=paper()->internote()*2; - Real stemdx = paper()->rule_thickness(); - Real sl = slope*paper()->internote(); - paper()->lookup_p_->beam(sl, 20 PT); - - Molecule leftbeams; - Molecule rightbeams; - - /* half beams extending to the left. */ - if (prev) { - int lhalfs= lhalfs = here->beams_left - prev->beams_right ; - int lwholebeams= here->beams_left beams_right ; - Real w = (here->hindex() - prev->hindex())/4; - Symbol dummy; - Atom a(dummy); - if (lhalfs) // generates warnings if not - a = paper()->lookup_p_->beam(sl, w); - a.translate(Offset (-w, -w * sl)); - for (int j = 0; j < lhalfs; j++) { - Atom b(a); - b.translate(Offset(0, -dir_i_ * dy * (lwholebeams+j))); - leftbeams.add( b ); - } - } - - if (next){ - int rhalfs = here->beams_right - next->beams_left; - int rwholebeams = here->beams_right beams_left; - - Real w = next->hindex() - here->hindex(); - Atom a = paper()->lookup_p_->beam(sl, w + stemdx); - - int j = 0; - for (; j < rwholebeams; j++) { - Atom b(a); - b.translate(Offset(0, -dir_i_ * dy * j)); - rightbeams.add( b ); - } - - w /= 4; - if (rhalfs) - a = paper()->lookup_p_->beam(sl, w); - - for (; j < rwholebeams + rhalfs; j++) { - Atom b(a); - b.translate(Offset(0, -dir_i_ * dy * j)); - rightbeams.add(b ); - } - - } - leftbeams.add(rightbeams); - return leftbeams; -} - - -Molecule* -Beam::brew_molecule_p() const return out; -{ - Real inter=paper()->internote(); - out = new Molecule; - Real x0 = stems.top()->hindex(); - - for (iter_top(stems,i); i.ok(); i++) { - PCursor p(i-1); - PCursor n(i+1); - Stem * prev = p.ok() ? p.ptr() : 0; - Stem * next = n.ok() ? n.ptr() : 0; - - Molecule sb = stem_beams(i, next, prev); - Real x = i->hindex()-x0; - sb.translate(Offset(x, (x * slope + left_pos)* inter)); - out->add(sb); - } - out->translate(Offset(x0 - left->hpos,0)); -} - -void -Beam::do_print()const -{ -#ifndef NPRINT - mtor << "slope " < // INT_MAX -#include - -#include "proto.hh" -#include "plist.hh" -#include "string.hh" -#include "debug.hh" -#include "source-file.hh" -#include "binary-source-file.hh" -#include "string-convert.hh" - -Binary_source_file::Binary_source_file( String& filename_str ) - : Source_file( filename_str ) -{ -} - -Binary_source_file::~Binary_source_file() -{ -} - -String -Binary_source_file::error_str( char const* pos_ch_c_l ) -{ - assert( this ); - if ( !in_b( pos_ch_c_l ) ) - return ""; - - char const* begin_ch_c_l = pos_ch_c_l - 8 >? ch_c_l(); - char const* end_ch_c_l = pos_ch_c_l + 7 breakable_b()) - retval.push(c); - assert(retval.top() == pscore_.cols.bottom().ptr()); - return retval; -} - -// construct an appropriate Spacing_problem and solve it. -Col_hpositions -Break_algorithm::solve_line(Line_of_cols curline) const -{ - Spacing_problem sp; - - sp.add_column(curline[0], true, 0.0); - for (int i=1; i< curline.size()-1; i++) - sp.add_column(curline[i]); - sp.add_column(curline.top(), true, linelength); - - // misschien moeven uit Spacing_problem? - for (iter_top(pscore_.suz,i); i.ok(); i++) { - sp.add_ideal(i); - } - Array the_sol=sp.solve(); - Col_hpositions col_hpos; - col_hpos.cols = curline; - col_hpos.energy = the_sol.pop(); - col_hpos.config = the_sol; - col_hpos.OK(); - return col_hpos; -} - -Break_algorithm::Break_algorithm(PScore&s) - :pscore_(s) -{ - linelength = s.paper_l_->linewidth; -} - -bool -Break_algorithm::feasible(Line_of_cols curline) const -{ - Real l =0; - for (int i=0; i < curline.size(); i++) - l +=curline[i]->width().length(); - return l < linelength; -} - -void -Break_algorithm::problem_OK() const -{ - if (!pscore_.cols.size()) - error("Score does not have any columns"); -#ifndef NDEBUG - iter_top(pscore_.cols,start); - PCursor end (pscore_.cols.bottom()); - - assert(start->breakable_b()); - assert(end->breakable_b()); -#endif -} diff --git a/src/calcideal.cc b/src/calcideal.cc deleted file mode 100644 index 5ead08dd39..0000000000 --- a/src/calcideal.cc +++ /dev/null @@ -1,53 +0,0 @@ -#include "idealspacing.hh" -#include "score.hh" -#include "pscore.hh" -#include "paper-def.hh" -#include "score-column.hh" -#include "dimen.hh" - - -/** - this needs A LOT of rethinking. - - generate springs between columns. - - */ -void -Score::calc_idealspacing() -{ - iter_top(cols_,i); - - for (; i.ok(); i++) { - assert(i->used_b()); - PCursor j(i+1); - if (i->musical_b()) { - assert(j.ok()); - for (int n=0; n < i->durations.size(); n++) { - Moment d = i->durations[n]; - Real dist = paper_p_->duration_to_dist(d); - Real strength = i->durations[0]/i->durations[n]; - assert(strength <= 1.0); - - while (j->when() < d + i->when()) - j++; - Moment delta_desired = j->when() - (d+i->when()); - dist += paper_p_->duration_to_dist(delta_desired); - - pscore_p_->connect(i->pcol_l_, j->pcol_l_, dist, strength); - } - } else if (j.ok()) { - - /* attach i to the next column in use. This exists, since - the last col is breakable, and therefore in use - */ - - Moment d = j->when() - i->when(); - Real dist = (d) ? paper_p_->duration_to_dist(d) : 2 PT; // todo - - pscore_p_->connect(i->pcol_l_, j->pcol_l_, dist, (d) ? 1.0:1.0); - } - // !j.ok() might hold if we're at the last col. - } -} - - diff --git a/src/clef-item.cc b/src/clef-item.cc deleted file mode 100644 index 528623eed6..0000000000 --- a/src/clef-item.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - clef-item.cc -- implement Clef_item - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#include "clef-item.hh" -#include "string.hh" -#include "molecule.hh" -#include "paper-def.hh" -#include "lookup.hh" -#include "clef-reg.hh" - - - -Clef_item::Clef_item() -{ - change = true; - read("violin"); -} - -void -Clef_item::read(String t) -{ - type = t; - if (type == "violin") - y_off = 2; - if (type == "alto") - y_off = 4; - if (type == "tenor") - y_off = 6; - if (type == "bass") - y_off = 6; -} -void -Clef_item::read(Clef_register const &k) -{ - read(k.clef_type_str_); -} - -Molecule* -Clef_item::brew_molecule_p()const -{ - String t = type; - if (change) - t += "_change"; - Symbol s = paper()->lookup_p_->clef(t); - Molecule*output = new Molecule(Atom(s)); - output->translate(Offset(0, paper()->internote() * y_off)); - return output; -} - diff --git a/src/clef-reg.cc b/src/clef-reg.cc deleted file mode 100644 index 2d9dcc112b..0000000000 --- a/src/clef-reg.cc +++ /dev/null @@ -1,107 +0,0 @@ -/* - clef.cc -- implement Clef_register - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys , - Mats Bengtsson -*/ - -#include "clef-reg.hh" -#include "clef-item.hh" -#include "debug.hh" -#include "commandrequest.hh" -#include "time-description.hh" -#include "staff-column.hh" - -Clef_register::Clef_register() -{ - clef_p_ = 0; - - /* ugly hack to prevent segfault (daddy_reg_l_ == 0 at construction) */ - clef_type_str_ = ""; -} - -bool -Clef_register::set_type(String s) -{ - clef_type_str_ = s; - if (clef_type_str_ == "violin") { - c0_position_i_= -2; - } else if (clef_type_str_ == "alto") { - c0_position_i_= 4; - } else if (clef_type_str_ == "tenor") { - c0_position_i_= 6; - } else if (clef_type_str_ == "bass") { - c0_position_i_= 10; - }else - return false; - *get_staff_info().c0_position_i_ = c0_position_i_; - - return true; -} - -void -Clef_register::read_req(Clef_change_req*c_l) -{ - if (!set_type(c_l->clef_str_)) - error("unknown clef type ", c_l->defined_ch_c_l_); -} - -bool -Clef_register::try_request(Request * r_l) -{ - Command_req* creq_l= r_l->command(); - if (!creq_l || !creq_l->clefchange()) - return false; - - clef_req_l_ = creq_l->clefchange(); - - // do it now! Others have to read c0_pos. - read_req(creq_l->clefchange()); - return true; -} - -void -Clef_register::process_requests() -{ - const Time_description *time_l = get_staff_info().time_c_l_; - if (!clef_req_l_ && (!time_l->whole_in_measure_|| !time_l->when_)) { - clef_p_ = new Clef_item; - clef_p_->change = false; - } else if (clef_req_l_) { - clef_p_ = new Clef_item; - clef_p_->change = true; - } - if (clef_p_) { - clef_p_->read(*this); - announce_element(Staff_elem_info(clef_p_, - clef_req_l_)); - } -} - -void -Clef_register::pre_move_processing() -{ - if (!clef_p_) - return; - if (clef_p_->change) { - Clef_item* post_p = new Clef_item(*clef_p_); - post_p->change = false; - typeset_breakable_item(new Clef_item(*clef_p_), - clef_p_, post_p); - } else { - typeset_breakable_item(0, 0, clef_p_); - } - clef_p_ = 0; -} - -void -Clef_register::post_move_processing() -{ - clef_req_l_ = 0; - /* not in ctor, since the reg might not be linked in.*/ - if (clef_type_str_ == "") { - set_type("violin"); - } -} diff --git a/src/colhpos.cc b/src/colhpos.cc deleted file mode 100644 index 530e4d4483..0000000000 --- a/src/colhpos.cc +++ /dev/null @@ -1,35 +0,0 @@ -#include "colhpos.hh" -#include "real.hh" -#include "debug.hh" -#include "const.hh" -#include "vector.hh" - -Col_hpositions::Col_hpositions() -{ - energy = INFTY; -} - -void -Col_hpositions::add( PCol*c) -{ - cols.push(c); -} - -void -Col_hpositions::print() const -{ -#ifndef NPRINT - mtor << "energy : " << energy << '\n'; - mtor << "line of " << config.size() << " cols\n"; - Vector v(config); - mtor << v; -#endif -} - -void -Col_hpositions::OK()const -{ -#ifndef NDEBUG - assert(config.size() == cols.size()); -#endif -} diff --git a/src/commandrequest.cc b/src/commandrequest.cc deleted file mode 100644 index 5cf0912417..0000000000 --- a/src/commandrequest.cc +++ /dev/null @@ -1,149 +0,0 @@ -/* - commandrequest.cc -- implement Nonmusical reqs - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#include "commandrequest.hh" -#include "debug.hh" -#include "musicalrequest.hh" - - -void -Cadenza_req::do_print()const -{ - mtor << on_b_; -} - -Cadenza_req::Cadenza_req(bool b) -{ - on_b_ =b; -} -/* *************** */ - - -int -Bar_req::compare(const Bar_req &c1)const -{ - return type_str_ == c1.type_str_; -} - -void -Bar_req::do_print() const -{ - mtor << type_str_; -} - -Bar_req::Bar_req(String s) -{ - type_str_ = s; -} - -Partial_measure_req::Partial_measure_req(Moment m) -{ - duration_ =m; -} -/* *************** */ -Meter_change_req::Meter_change_req() -{ - beats_i_ = 0; - one_beat_i_ =0; -} -void -Meter_change_req::set(int b,int o) -{ - beats_i_=b; - one_beat_i_=o; -} - -void -Timing_req::do_print()const{} - -void -Command_req::do_print()const{} -/* *************** */ -void -Barcheck_req::do_print() const{} - -/* *************** */ -void -Clef_change_req::do_print() const -{ - mtor << clef_str_ ; -} - -Clef_change_req::Clef_change_req(String s) -{ - clef_str_ = s; -} -/* *************** */ -void -Group_feature_req::do_print() const -{ - mtor << "stemdir " << stemdir_i_; -} - -Group_feature_req::Group_feature_req() -{ - stemdir_i_ = 0; -} - -void -Group_change_req::do_print()const -{ - mtor << "id : " << newgroup_str_; -} -/* *************** */ -void -Terminate_voice_req::do_print()const -{ -} - -/* *************** */ -void -Partial_measure_req::do_print() const -{ - mtor << duration_; -} - -void -Meter_change_req::do_print() const -{ - mtor << beats_i_ << "*" << one_beat_i_; -} - -/* *************** */ - -void -Measure_grouping_req::do_print() const -{ - for (int i=0; i < elt_length_arr_.size(); i++) { - mtor << beat_i_arr_[i] <<"*" << elt_length_arr_[i]<<" "; - } -} -/* *************** */ -void -Key_change_req::do_print() const -{ - for (int i=0; i < melodic_p_arr_.size(); i++) { - melodic_p_arr_[i]->print(); - } -} - -Key_change_req::Key_change_req() -{ -} -Key_change_req::Key_change_req(Key_change_req const&c) -{ - for (int i=0; i < c.melodic_p_arr_.size(); i++) { - melodic_p_arr_.push( c.melodic_p_arr_[i]->clone()->melodic() ); - } -} - -Key_change_req::~Key_change_req() -{ - for (int i=0; i < melodic_p_arr_.size(); i++) - delete melodic_p_arr_[i]; -} diff --git a/src/complex-staff.cc b/src/complex-staff.cc deleted file mode 100644 index bb13274449..0000000000 --- a/src/complex-staff.cc +++ /dev/null @@ -1,37 +0,0 @@ -#include "complex-staff.hh" -#include "complex-walker.hh" -#include "score.hh" -#include "pscore.hh" -#include "staffsym.hh" -#include "score-column.hh" - -const NO_LINES = 5; - -/** Aside from putting fields right, this generates the staff symbol. - */ -void -Complex_staff::set_output(PScore* pscore_l ) -{ - pstaff_l_ = new PStaff(pscore_l); - pscore_l_ = pscore_l; - pscore_l_->add(pstaff_l_); - - Staff_symbol *span_p = new Staff_symbol(NO_LINES); - - Score_column* col_last - =score_l_->find_col(score_l_->last(), false); - Score_column* col_first= - score_l_->find_col(0, false); - - span_p->set_extent(col_first->pcol_l_->postbreak_p_, - col_last->pcol_l_->prebreak_p_); - - pscore_l_->typeset_spanner(span_p, pstaff_l_); -} - - -Staff_walker * -Complex_staff::get_walker_p() -{ - return new Complex_walker(this); -} diff --git a/src/complex-walker.cc b/src/complex-walker.cc deleted file mode 100644 index 9fbd0525e6..0000000000 --- a/src/complex-walker.cc +++ /dev/null @@ -1,108 +0,0 @@ -/* - complex-walker.cc -- implement Complex_walker - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#include "musicalrequest.hh" -#include "staff-column.hh" -#include "voice.hh" -#include "pscore.hh" -#include "complex-staff.hh" -#include "debug.hh" -#include "voice-group-regs.hh" -#include "voice-regs.hh" -#include "complex-walker.hh" -//#include "misc.hh" -#include "commandrequest.hh" -#include "walkregs.hh" - -void -Complex_walker::do_post_move() -{ - walk_regs_p_->post_move_processing(); -} - -void -Complex_walker::do_pre_move() -{ - walk_regs_p_->pre_move_processing(); -} - -void -Complex_walker::do_announces() -{ - walk_regs_p_->do_announces(); -} - -bool -Complex_walker::try_command_request(Command_req *req_l) -{ - return walk_regs_p_->try_request(req_l); -} - -void -Complex_walker::try_request(Request*req) -{ - walk_regs_p_->try_request(req); -} - -void -Complex_walker::process_requests() -{ - Staff_column*c =ptr(); - - for (int i=0; i < c->creationreq_l_arr_.size(); i++) { - try_request(c->creationreq_l_arr_[i]); - } - for (int i=0; i < c->commandreq_l_arr_.size(); i++) { - try_request(c->commandreq_l_arr_[i]); - } - - for (int i=0; i < c->musicalreq_l_arr_.size(); i++) { - try_request(c->musicalreq_l_arr_[i]); - } - - regs_process_requests(); - do_announces(); -} - -void -Complex_walker::regs_process_requests() -{ - walk_regs_p_->process_requests(); -} - -void -Complex_walker::typeset_element(Staff_elem *elem_p) -{ - if (!elem_p) - return; - if (elem_p->spanner()) - pscore_l_->typeset_spanner(elem_p->spanner(), staff()->pstaff_l_); - else - ptr()->typeset_musical_item(elem_p->item()); -} - -Complex_walker::Complex_walker(Complex_staff*s) - : Staff_walker(s, s->pstaff_l_->pscore_l_) -{ - walk_regs_p_ = new Walker_registers(this); - do_post_move(); -} - - -Complex_walker::~Complex_walker() -{ -} - -Complex_staff* -Complex_walker::staff() -{ - return (Complex_staff*) staff_l_; -} - - - diff --git a/src/debug.cc b/src/debug.cc deleted file mode 100644 index 01a35bd140..0000000000 --- a/src/debug.cc +++ /dev/null @@ -1,59 +0,0 @@ -#include -#include -#include -#include -#include "debug.hh" -#include "dstream.hh" -#include "vector.hh" - -Dstream *monitor=0; -ostream * nulldev =0; - -struct _Dinit { - _Dinit() { - nulldev = new ofstream("/dev/null"); - monitor = new Dstream(&cout,".dstreamrc"); - } - ~_Dinit() { - delete nulldev; - delete monitor; - } -} dinit; - - - -/* - want to do a stacktrace . - */ -void -mynewhandler() -{ - assert(false); -} - -void -float_handler(int) -{ - cerr << "Floating point exception .. \n"<< flush; - assert(false); -} - -void -debug_init() -{ -#ifndef NDEBUG - set_new_handler(&mynewhandler); -#endif - set_matrix_debug(*monitor); - signal(SIGFPE, float_handler); -} - -bool check_debug=false; - -void -set_debug(bool b) -{ - check_debug =b; -} - - diff --git a/src/dimen.cc b/src/dimen.cc deleted file mode 100644 index 9489ae9a1e..0000000000 --- a/src/dimen.cc +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include "dimen.hh" -#include "debug.hh" -#include "string.hh" - -Real -parse_dimen(String dim) -{ - int i=dim.length_i()-1; - const char *s = dim; - while (i > 0 && (isspace(s[i]) || isalpha(s[i])) ){ - i--; - } - String unit(s + i+1); - return convert_dimen(dim.value_f(), unit); -} - - -Real -convert_dimen(Real quant, String unit) -{ - if (unit == "cm") - return quant * CM_TO_PT; - if (unit == "pt") - return quant; - if (unit == "mm") - return quant*CM_TO_PT/10; - if (unit == "in") - return quant * INCH_TO_PT; - error ("unknown length unit: `" + unit+"'"); -} - -String -print_dimen(Real r) -{ - String s(r); - s += "pt "; - return s; -} diff --git a/src/directional-spanner.cc b/src/directional-spanner.cc deleted file mode 100644 index 7e2bb7c878..0000000000 --- a/src/directional-spanner.cc +++ /dev/null @@ -1,6 +0,0 @@ -#include "directional-spanner.hh" - -Directional_spanner::Directional_spanner() -{ - dir_i_ = 0; -} diff --git a/src/duration.cc b/src/duration.cc deleted file mode 100644 index a7a1c5dfcf..0000000000 --- a/src/duration.cc +++ /dev/null @@ -1,249 +0,0 @@ -// -// duration.cc -- implement Duration, Plet, Duration_convert, Duration_iterator -// -// copyright 1997 Jan Nieuwenhuizen - -// split into 4? - -#include "proto.hh" // ugh, these all for midi-main.hh -#include "plist.hh" -#include "string.hh" -#include "source-file.hh" -#include "source.hh" -#include "midi-main.hh" // *tors - -#include "string.hh" -#include "moment.hh" -#include "duration.hh" - -Duration::Duration( int type_i, int dots_i = 0, Plet* plet_l ) -{ - type_i_ = type_i; - dots_i_ = dots_i; - plet_p_ = 0; - set_plet( plet_l ); -} - -Duration::Duration( Duration const& dur_c_r ) -{ - type_i_ = 0; - dots_i_ = 0; - plet_p_ = 0; - *this = dur_c_r; -} - -Duration::~Duration() -{ - delete plet_p_; -} - -Duration const& -Duration::operator =( Duration const& dur_c_r ) -{ - if ( &dur_c_r == this ) - return *this; - - type_i_ = dur_c_r.type_i_; - dots_i_ = dur_c_r.dots_i_; - set_plet( dur_c_r.plet_p_ ); - - return *this; -} - -void -Duration::set_plet( Plet* plet_l ) -{ - delete plet_p_; - plet_p_ = 0; - if ( plet_l ) - plet_p_ = new Plet( *plet_l ); -} - -Plet::Plet( int iso_i, int type_i ) -{ - iso_i_ = iso_i; - type_i_ = type_i; -} - -Plet::Plet( Plet const& plet_c_r ) -{ - iso_i_ = plet_c_r.iso_i_; - type_i_ = plet_c_r.type_i_; -} - -String -Duration_convert::dur2_str( Duration dur ) -{ - String str( dur.type_i_ ); - str += String( '.', dur.dots_i_ ); - if ( dur.plet_p_ ) - str += String( "*" ) + String( dur.plet_p_->iso_i_ ) - + String( "/" ) + String( dur.plet_p_->type_i_ ); - return str; -} - -int -Duration_convert::dur2_i( Duration dur, int division_1_i ) -{ - return dur2_mom( dur ) * Moment( division_1_i ); -} - -Moment -Duration_convert::dur2_mom( Duration dur ) -{ - if ( !dur.type_i_ ) - return 0; - - Moment mom = Moment( 1 , dur.type_i_ ); - - Moment delta = mom; - while ( dur.dots_i_-- ) { - delta /= 2.0; - mom += delta; - } - - return mom * plet_factor_mom( dur ); -} - -Duration -Duration_convert::mom2_dur( Moment mom ) -{ - /* this is cute, - but filling an array using Duration_iterator - might speed things up, a little - */ - Duration_iterator iter_dur; - assert( iter_dur ); - while ( iter_dur ) { - Duration lower_dur = iter_dur++; - Duration upper_dur( 0 ); - if ( iter_dur ) - upper_dur = iter_dur(); - Moment lower_mom = dur2_mom( lower_dur ); - Moment upper_mom = dur2_mom( upper_dur ); - if ( mom == lower_mom ) - return lower_dur; - if ( mom == upper_mom ) // don-t miss last (sic) - return upper_dur; - if ( ( mom >= lower_mom ) && ( mom <= upper_mom ) ) { - warning( String( "duration not exact: " ) + String( (Real)mom ) , 0 ); - if ( abs( mom - lower_mom ) < abs( mom - upper_mom ) ) - return lower_dur; - else - return upper_dur; - } - lower_dur = upper_dur; - } - return Duration( 0 ); -} - -Moment -Duration_convert::plet_factor_mom( Duration dur ) -{ - if ( !dur.plet_p_ ) - return 1; - return Moment( dur.plet_p_->iso_i_, dur.plet_p_->type_i_ ); -} - -Real -Duration_convert::sync_f( Duration dur, Moment mom ) -{ - return mom / dur2_mom( dur ); -} - -Moment -Duration_convert::i2_mom( int time_i, int division_1_i ) -{ - if ( !time_i ) - return Moment( 0 ); - - if ( division_1_i > 0 ) - return Moment( time_i, division_1_i ); - else - return Moment( -division_1_i, time_i ); -} - -Duration_iterator::Duration_iterator() -{ - cursor_dur_.type_i_ = 128; - cursor_dur_.set_plet( 0 ); -} - -Duration -Duration_iterator::operator ++(int) -{ - return forward_dur(); -} - -Duration -Duration_iterator::operator ()() -{ - return dur(); -} - -Duration_iterator::operator bool() -{ - return ok(); -} - -Duration -Duration_iterator::dur() -{ - return cursor_dur_; -} - -Duration -Duration_iterator::forward_dur() -{ - // should do smart table? guessing: - // duration wholes - // 16 0.0625 - // 32.. 0.0703 - // 8:2/3 0.0833 - // 16. 0.0938 - // 8 0.1250 - // 16.. 0.1406 - // 4:2/3 0.1667 - // 8. 0.1875 - - assert( ok() ); - - Duration dur = cursor_dur_; - - if ( !cursor_dur_.dots_i_ && !cursor_dur_.plet_p_ ) { - cursor_dur_.type_i_ *= 2; - cursor_dur_.dots_i_ = 2; - } - else if ( cursor_dur_.dots_i_ == 2 ) { - assert( !cursor_dur_.plet_p_ ); - cursor_dur_.dots_i_ = 0; - cursor_dur_.type_i_ /= 4; - cursor_dur_.set_plet( &Plet( 2, 3 ) ); - } - else if ( cursor_dur_.plet_p_ - && ( cursor_dur_.plet_p_->iso_i_ == 2 ) - && ( cursor_dur_.plet_p_->type_i_ == 3 ) ) { - assert( !cursor_dur_.dots_i_ ); - cursor_dur_.set_plet( 0 ); - cursor_dur_.type_i_ *= 2; - cursor_dur_.dots_i_ = 1; - } - else if ( cursor_dur_.dots_i_ == 1 ) { - assert( !cursor_dur_.plet_p_ ); - cursor_dur_.dots_i_ = 0; - cursor_dur_.type_i_ /= 2; - } - - // ugh - if ( no_triplets_bo_g && cursor_dur_.plet_p_ && ok() ) - forward_dur(); - - return dur; -} - -bool -Duration_iterator::ok() -{ - return ( cursor_dur_.type_i_ - && !( ( cursor_dur_.type_i_ == 1 ) && ( cursor_dur_.dots_i_ > 2 ) ) ); -} diff --git a/src/grouping.cc b/src/grouping.cc deleted file mode 100644 index bc665a19c0..0000000000 --- a/src/grouping.cc +++ /dev/null @@ -1,350 +0,0 @@ -/* - grouping.cc -- implement Rhythmic_grouping - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#include "debug.hh" -#include "grouping.hh" -#include "interval.hh" - -void -Rhythmic_grouping::init() -{ - interval_ = 0; - children.set_size(0); -} - -void -Rhythmic_grouping::OK()const -{ -#ifndef NDEBUG - assert(bool(children.size()) != bool(interval_)); - - for (int i= 0; i < children.size(); i++) { - children[i]->OK(); - if (i>0) - assert(children[i-1]->interval().right == - children[i]->interval().left); - } -#endif -} - -Moment -Rhythmic_grouping::length() const -{ - return interval().length(); -} - -MInterval -Rhythmic_grouping::interval()const -{ - if (interval_) - return *interval_; - else - return - MInterval(children[0]->interval().left, - children.top()->interval().right); -} - -void -Rhythmic_grouping::split(Rhythmic_grouping r) -{ - if (interval_) - return ; - - r.intersect(interval()); - split(r.intervals()); - - for (int i= 0; i < children.size(); i++) { - if (!children[i]->interval_) { - Rhythmic_grouping here(r); - children[i]->split(here); - } - } -} - - -Array -Rhythmic_grouping::intervals() -{ - Array r; - if (interval_ || children.size() == 1) { - MInterval i(interval()); - MInterval r1(i), r2(i); - r1.right = r2.left = i.center(); - r.push(r1); r.push(r2); - } else { - for (int i=0; i < children.size(); i++) - r.push(children[i]->interval()); - } - return r; -} - -void -Rhythmic_grouping::intersect(MInterval t) -{ - if (interval_) { - interval_->intersect(t); - return; - } - - for (int i=0; i < children.size(); i++) { - MInterval inter = intersection(t, children[i]->interval()); - if (inter.empty() || inter.length() <= Rational( 0 )) { - delete children[i]; - children[i] =0; - } else { - children[i]->intersect(t); - } - } - for (int i=0; i < children.size(); ) { - if (!children[i]) - children.del(i); - else - i++; - } - -} - -/** - Put our children in branches of #this#. - The min and max time intervals coincide with elements of #splitpoints# - - I really should be documenting what is happening here, but I find - that difficult, since I don't really understand what's going on here. - - */ -void -Rhythmic_grouping::split(Array splitpoints) -{ - //check on splitpoints.. - int j = 0, i = 0, starti = 0, startj = 0; - - Array ch; - while (1) { - if ( i >= children.size() || j >= splitpoints.size()) - break; - - assert( - children[starti]->interval().left== splitpoints[startj].left); - if (children[i]->interval().right < splitpoints[j].right) { - i ++; - } else if (children[i]->interval().right > splitpoints[j].right ) { - j ++; - } else { - - if (i == starti) { - ch.push(children[i]); - } else { - Rhythmic_grouping *newchild=new Rhythmic_grouping( - children.subvec(starti, i+1)); - - ch.push(newchild); - } - i ++; - j++; - starti = i; - startj = j; - - - } - } - if (ch.size() != 1) - children = ch; - } - - -Rhythmic_grouping::Rhythmic_grouping(MInterval t, int n) -{ - init(); - if (n == 1 || !n) { - interval_ = new MInterval(t); - return; - } - Moment dt = t.length()/Rational(n); - MInterval basic = MInterval(t.left, t.left+dt); - for (int i= 0; i < n; i++) - children.push(new Rhythmic_grouping( dt*Rational(i) + basic )); -} - - -Rhythmic_grouping::Rhythmic_grouping(Array r) - :children(r) -{ - interval_ =0; -} - -Rhythmic_grouping::~Rhythmic_grouping() -{ - junk(); -} - -void -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.push(new Rhythmic_grouping(*s.children[i])); -} - -void -Rhythmic_grouping::operator=(Rhythmic_grouping const &s) -{ - junk(); - copy(s); -} - -Rhythmic_grouping::Rhythmic_grouping(Rhythmic_grouping const&s) -{ - init(); - copy(s); -} - -void -Rhythmic_grouping::junk() -{ - delete interval_; - for (int i=0; i < children.size(); i++) - delete children[i]; - init(); -} - -void -Rhythmic_grouping::print()const -{ -#ifndef NPRINT - mtor << "{ \n"; - if (interval_) - mtor<<" Interval "<< interval_->str(); - for (int i=0; i < children.size(); i++) { - children[i]->print(); - } - mtor << "}\n"; -#endif -} - -bool -Rhythmic_grouping::child_fit_query(Moment start) -{ - if (children.size()) - return ( children.top()->interval().right== start); - - return true; -} - -void -Rhythmic_grouping::add_child(Moment start, Moment len) -{ - Moment stop = start+len; - - assert(child_fit_query(start)); - children.push(new Rhythmic_grouping(MInterval(start, stop))); -} - -Rhythmic_grouping::Rhythmic_grouping() -{ - interval_ =0; -} - -int -min_elt(Array v) -{ - int i = 1000; // ugh - for (int j = 0 ; j < v.size(); j++) - i = i -Rhythmic_grouping::generate_beams(Array flags, int &flagidx) -{ - assert (!interval_) ; - - Array< Array > children_beams; - for (int i=0; i < children.size(); i++) { - Array child_beams; - if (children[i]->interval_) { - int f = flags[flagidx++]; - child_beams.push(f); - } else { - child_beams = children[i]-> - generate_beams(flags, flagidx); - } - children_beams.push(child_beams); - } - Array beams; - int lastm, m, nextm; - for (int i=0; i < children_beams.size(); i++) { - bool add_left = (i >0); - bool add_right = (i < children_beams.size() -1); - - if (!i) - m = min_elt(children_beams[i]); - if (add_right) - nextm = min_elt(children_beams[i+1]); - - if (children_beams[i].size() == 1) { - if (add_right) - beams.push(m); - if (add_left) - beams.push(m); - } else { - if (add_left) - beams.push(lastm translate(m); -} - -void -Rhythmic_grouping::extend(MInterval m)const -{ - assert(m.left >= interval().left); - while (m.right >interval().right ) { - Array a(children); - for (int i=0; i < a.size(); i++) { - a[i] =new Rhythmic_grouping(*children[i]); - a[i]->translate(children.top()->interval().right); - } - ((Rhythmic_grouping*)this)->children.concat(a); - } - assert(m.right <= interval().right); - OK(); -} - -Rhythmic_grouping -parse_grouping(Array beat_i_arr, Array elt_length_arr) -{ - Moment here =0; - assert(beat_i_arr.size() == elt_length_arr.size()); - - Array children; - for (int i=0; i < beat_i_arr.size(); i++) { - Moment last = here; - here += elt_length_arr[i] * Moment(beat_i_arr[i]); - children.push( - new Rhythmic_grouping(MInterval(last, here), - beat_i_arr[i] )); - } - return Rhythmic_grouping(children); -} - diff --git a/src/groupregs.cc b/src/groupregs.cc deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/headreg.cc b/src/headreg.cc deleted file mode 100644 index dc5d72d572..0000000000 --- a/src/headreg.cc +++ /dev/null @@ -1,76 +0,0 @@ -/* - headreg.cc -- part of LilyPond - - (c) 1997 Han-Wen Nienhuys -*/ -#include "rest.hh" -#include "notehead.hh" -#include "headreg.hh" -#include "paper-def.hh" -#include "complex-walker.hh" -#include "musicalrequest.hh" - -Notehead_register::Notehead_register() -{ - note_p_ = 0; - set_feature(Features::dir(0)); - post_move_processing(); -} - -bool -Notehead_register::try_request(Request *req_l) -{ - if (req_l->note() || req_l->rest()) - note_req_l_=req_l->rhythmic(); - else - return false; - - return true; -} -void -Notehead_register::set_feature(Features d) -{ - if(d.direction_i_ || d.initialiser_b_) - dir_i_ = d.direction_i_; -} - -void -Notehead_register::process_requests() -{ - if (!note_req_l_) - return; - - - if (note_req_l_->note()) { - Notehead*n_p = new Notehead(8); // ugh - note_p_ = n_p; - n_p->set_rhythmic(note_req_l_->rhythmic()); - n_p->position = note_req_l_->note()->height() + - *get_staff_info().c0_position_i_; - } else { - note_p_ = new Rest ( note_req_l_->rhythmic()->balltype, - note_req_l_->rhythmic()->dots); - if (note_req_l_->rhythmic()->balltype <= 2) - note_p_->translate( - Offset(0, - 6 * paper()->internote())); - } - Staff_elem_info itinf(note_p_,note_req_l_); - announce_element(itinf); -} - -void -Notehead_register::pre_move_processing() -{ - if (note_p_) { - if (dir_i_ && note_p_->name() == Rest::static_name()) - note_p_->translate(Offset(0, 4*dir_i_ * paper()->internote())); - typeset_element(note_p_); - note_p_ = 0; - } -} -void -Notehead_register::post_move_processing() -{ - note_req_l_ = 0; -} diff --git a/src/idealspacing.cc b/src/idealspacing.cc deleted file mode 100644 index 3ceaff1e6d..0000000000 --- a/src/idealspacing.cc +++ /dev/null @@ -1,31 +0,0 @@ -#include "idealspacing.hh" -#include "pcol.hh" -#include "pscore.hh" -#include "pstaff.hh" -#include "debug.hh" - -void -Idealspacing::print() const -{ -#ifndef NPRINT - mtor << "idealspacing {" ; - mtor << "distance "<rank() << " right " << right->rank() << "}\n"; -#endif -} - -Idealspacing::Idealspacing(const PCol * l,const PCol * r) -{ - space = 0.0; - hooke = 0.0; - left = l; - right = r; -} - -void -Idealspacing::OK() const -{ -#ifndef NDEBUG - assert(hooke >= 0 && left && right); -#endif -} diff --git a/src/identifier.cc b/src/identifier.cc deleted file mode 100644 index 59f1ff5d83..0000000000 --- a/src/identifier.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* - identifier.cc -- implement identifier and derived classes - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#include - -#include "identifier.hh" -#include "lexer.hh" -#include "debug.hh" - -void -Identifier::error(String expect) -{ - String e("Wrong identifier type: "); - e += String(classname()) + "(expected " + expect + ")"; - ::error(e); -} - -void -Identifier::print()const -{ - mtor << "identifier \'" << name << "\'="; - do_print(); -} - -/* ugh. */ -#define DEFAULT_PRINT(Class, Content_type, accessor) \ -void \ -Class::do_print() const { \ - ((Class*)this)->accessor(false)->print(); \ -} \ -class Class - -DEFAULT_PRINT(Script_id, Script_def, script); -DEFAULT_PRINT(Lookup_id, Lookup, lookup); -DEFAULT_PRINT(Symtables_id, Symtables, symtables); -DEFAULT_PRINT(Staff_id, Input_staff, staff); -DEFAULT_PRINT(M_chord_id, Music_general_chord, mchord); -DEFAULT_PRINT(M_voice_id, Music_voice, mvoice); - -void -Real_id::do_print() const -{ - Identifier::print(); - mtor << *((Real_id*)this)->real(false)<< "\n"; -} - -void -Notetab_id::do_print() const -{ - mtor << "unknown" << "\n"; -} diff --git a/src/input-file.cc b/src/input-file.cc deleted file mode 100644 index a0f1018be6..0000000000 --- a/src/input-file.cc +++ /dev/null @@ -1,47 +0,0 @@ -/* - input-file.cc -- implement Input_file - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys Jan Nieuwenhuizen -*/ - -#include -#include -#include "proto.hh" -#include "plist.hh" -#include "input-file.hh" -#include "debug.hh" -#include "source-file.hh" -#include "binary-source-file.hh" -#include "source.hh" - -Input_file::Input_file(String s) -{ - name = s; - line = 1; - String pf(s); - if ( pf == "" ) { - is = &cin; - defined_ch_c_l_ = 0; - sourcefile_l_ = 0; - } - else { - Source_file* sourcefile_p = 0; - // ugh, very dirty, need to go away - if ( ( pf.right_str( 3 ).lower_str() == "mid" ) || ( pf.right_str( 4 ).lower_str() == "midi" ) ) - sourcefile_p = new Binary_source_file( pf ); - else - sourcefile_p = new Source_file( pf ); - source_l_g->add( sourcefile_p ); - sourcefile_l_ = sourcefile_p; - is = sourcefile_l_->istream_l(); - defined_ch_c_l_ = sourcefile_l_->ch_c_l(); - } - cout << "[" << pf << flush; -} - -Input_file::~Input_file() -{ - cout << "]" << flush; -} diff --git a/src/input-music.cc b/src/input-music.cc deleted file mode 100644 index f1047e8bf9..0000000000 --- a/src/input-music.cc +++ /dev/null @@ -1,252 +0,0 @@ -#include "debug.hh" -#include "input-music.hh" -#include "voice.hh" -#include "musicalrequest.hh" -#include "voice-element.hh" - -void -Input_music::check_plet(Voice_element* velt_l) -{ - for (iter_top(velt_l->reqs,i); i.ok(); i++) - if ( i->plet() ) { - Moment start_moment = 0; - if ( !find_plet_start_bo( i->plet()->type_c_, start_moment ) ) { - error( "begin of plet not found", i->defined_ch_c_l_ ); - break; - } - Moment moment = 0; - set_plet_backwards( moment, start_moment, i->plet()->dur_i_, i->plet()->type_i_ ); - i.del(); - break; - } -} - -void -Simple_music::add(Voice_element*v) -{ - voice_.add(v); -} - -Moment -Simple_music::length()const -{ - return voice_.last(); -} -void -Simple_music::translate_time(Moment t) -{ - voice_.start += t; -} - -Voice_list -Simple_music::convert()const -{ - Voice_list l; - l.bottom().add(new Voice(voice_)); - return l; -} - - -void -Simple_music::print() const -{ - mtor << "Simple_music {"; - voice_.print(); - mtor << "}\n"; -} -bool -Simple_music::find_plet_start_bo(char c, Moment& moment_r) -{ - return voice_.find_plet_start_bo(c, moment_r); -} -void -Simple_music::set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i) -{ - voice_.set_plet_backwards(now_moment_r, until_moment, num_i, den_i); -} - -/* *************** */ - -void -Complex_music::add(Input_music*v) -{ - elts.bottom().add(v); -} - -void -Complex_music::print() const -{ - for (iter_top(elts,i); i.ok(); i++) - i->print(); -} - -void -Complex_music::concatenate(Complex_music*h) -{ - for (iter_top(h->elts,i); i.ok(); i++) - add(i->clone()); -} - -Complex_music::Complex_music() -{ -} - -Complex_music::Complex_music(Complex_music const&s) -{ - for (iter_top(s.elts,i); i.ok(); i++) - add(i->clone()); -} -void -Complex_music::set_default_group(String g) -{ - for (iter_top(elts,i); i.ok(); i++) - i->set_default_group(g); -} -bool -Complex_music::find_plet_start_bo(char c, Moment& moment_r) -{ - for (iter_bot(elts,i); i.ok(); i--) { - if ( i->find_plet_start_bo(c, moment_r) ) - return true; - } - return false; -} -void -Complex_music::set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i) -{ - for (iter_bot(elts,i); i.ok(); i--) { - i->set_plet_backwards(now_moment_r, until_moment, num_i, den_i); - } -} -/* *************************************************************** */ - -void -Music_voice::print() const -{ - mtor << "Music_voice {"; - Complex_music::print(); - mtor << "}\n"; -} - -void -Music_voice::add_elt(Voice_element*v) -{ - PCursor c(elts.bottom()); - if (!c.ok() || !c->simple()) { - Simple_music*vs = new Simple_music; - - c.add(vs); - } - - c = elts.bottom(); - Simple_music *s = c->simple(); - s->add(v); - - check_plet(v); -} - -Moment -Music_voice::length()const -{ - Moment l = 0; - - for (iter_top(elts,i); i.ok(); i++) - l += i->length(); - return l; -} - - -Voice_list -Music_voice::convert()const -{ - Voice_list l; - Moment here = 0; - - for (iter_top(elts,i); i.ok(); i++) { - Moment len = i->length(); - Voice_list k(i->convert()); - k.translate_time(here); - l.concatenate(k); - here +=len; - } - return l; -} - -void -Music_voice::translate_time(Moment t) -{ - elts.bottom()->translate_time(t); -} - - - -/* *************** */ - -void -Music_general_chord::add_elt(Voice_element*v) -{ - Simple_music*vs = new Simple_music; - vs->add(v); - elts.bottom().add(vs); - - check_plet(v); -} - -void -Music_general_chord::print() const -{ - mtor << "Music_general_chord {"; - Complex_music::print(); - mtor << "}\n"; -} - -void -Music_general_chord::translate_time(Moment t) -{ - for (iter_top(elts,i); i.ok(); i++) - i->translate_time(t); -} - -Moment -Music_general_chord::length()const -{ - Moment l =0; - - for (iter_top(elts,i); i.ok(); i++) - l = l >? i->length(); - return l; -} - -Voice_list -Music_general_chord::convert()const -{ - Voice_list l; - for (iter_top(elts,i); i.ok(); i++) { - Voice_list k(i->convert()); - l.concatenate(k); - } - return l; -} - -/* *************** */ - -void -Multi_voice_chord::set_default_group(String g) -{ - int j=0; - for (iter_top(elts, i); i.ok(); i++) { - i->set_default_group(g + String(j)); - j++; - } -} - - -/* *************** */ - -void -Voice_list::translate_time(Moment x) -{ - for (iter_top(*this,i); i.ok(); i++) - i->start += x; -} - diff --git a/src/input-score.cc b/src/input-score.cc deleted file mode 100644 index f39d47a4b1..0000000000 --- a/src/input-score.cc +++ /dev/null @@ -1,102 +0,0 @@ -/* - input-score.cc -- implement Input_score - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#include "debug.hh" -#include "input-score.hh" -#include "input-staff.hh" -#include "input-music.hh" -#include "score.hh" -#include "paper-def.hh" -#include "midi-def.hh" -#include "staff.hh" - - -void -Input_score::add(Input_staff*s) -{ - staffs_.bottom().add(s); -} - -void -Input_score::set(Paper_def*p) -{ - delete paper_p_; - paper_p_ = p; -} - -void -Input_score::set(Midi_def* midi_p) -{ - delete midi_p_; - midi_p_ = midi_p; -} - -Input_score::Input_score(Input_score const&s) -{ - paper_p_ = (s.paper_p_)? new Paper_def(*s.paper_p_) :0; - midi_p_ = (s.midi_p_)? new Midi_def(*s.midi_p_) : 0; - defined_ch_c_l_ = s.defined_ch_c_l_; - errorlevel_i_ = s.errorlevel_i_; - score_wide_music_p_ = (s.score_wide_music_p_) ? - s.score_wide_music_p_->clone():0; -} - -Score* -Input_score::parse() -{ - Score *s_p = new Score; - s_p->defined_ch_c_l_= defined_ch_c_l_; - s_p->errorlevel_i_ = errorlevel_i_; - if (midi_p_) - s_p->set(new Midi_def(*midi_p_)); - if (paper_p_) - s_p->set( new Paper_def(*paper_p_)); - - for (iter_top(staffs_,i); i.ok(); i++) { - Staff* staf_p=i->parse(s_p, score_wide_music_p_); - s_p->add(staf_p); - } - - return s_p; -} - -void -Input_score::set(Input_music *m_p) -{ - delete score_wide_music_p_; - score_wide_music_p_ =m_p; -} - - -Input_score::~Input_score() -{ - delete paper_p_; - delete score_wide_music_p_; - delete midi_p_; -} - -Input_score::Input_score() -{ - score_wide_music_p_ =0; - defined_ch_c_l_=0; - paper_p_= 0; - midi_p_ = 0; - errorlevel_i_ = 0; -} - -void -Input_score::print()const -{ -#ifndef NPRINT - mtor << "Input_score {\n"; - for (iter_top(staffs_,i); i.ok(); i++) { - i->print(); - } - mtor << "}\n"; -#endif -} diff --git a/src/input-staff.cc b/src/input-staff.cc deleted file mode 100644 index 9e3958e97e..0000000000 --- a/src/input-staff.cc +++ /dev/null @@ -1,88 +0,0 @@ -/* - input-staff.cc -- implement Input_staff - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#include "debug.hh" -#include "score.hh" -#include "input-music.hh" -#include "input-staff.hh" -#include "staff.hh" -#include "complex-staff.hh" -#include "lyricstaff.hh" - -#include "lexer.hh" - - -Input_staff::Input_staff(String s) -{ - score_wide_music_p_ =0; - type= s; - defined_ch_c_l_ = 0; -} - -void -Input_staff::add(Input_music*m) -{ - music_.bottom().add(m); -} - -Staff* -Input_staff::parse(Score*score_l, Input_music *default_score_wide) -{ - Staff *p=0; - if (type == "melodic") - p = new Complex_staff; - else if (type == "lyric") - p = new Lyric_staff; - else { - error( "Unknown staff-type `" + type +"\'", defined_ch_c_l_ ); - exit( 1 ); - } - - p->score_l_ = score_l; - - for (iter_top(music_,i); i.ok(); i++) { - Voice_list vl = i->convert(); - p->add(vl); - } - Voice_list vl = (score_wide_music_p_) ? score_wide_music_p_->convert() - : default_score_wide->convert(); - p->add(vl); - return p; -} - -Input_staff::Input_staff(Input_staff const&s) -{ - for (iter_top(s.music_,i); i.ok(); i++) - add(i->clone()); - defined_ch_c_l_ = s.defined_ch_c_l_; - type = s.type; - score_wide_music_p_ = (s.score_wide_music_p_) ? - s.score_wide_music_p_->clone() : 0; -} - -void -Input_staff::print() const -{ -#ifndef NPRINT - mtor << "Input_staff {\n"; - for (iter_top(music_,i); i.ok(); i++) - i->print(); - mtor << "}\n"; -#endif -} -void -Input_staff::set_score_wide(Input_music *m_p) -{ - delete score_wide_music_p_; - score_wide_music_p_ = m_p; -} - -Input_staff::~Input_staff() -{ - delete score_wide_music_p_; -} diff --git a/src/item.cc b/src/item.cc deleted file mode 100644 index e653c46ac6..0000000000 --- a/src/item.cc +++ /dev/null @@ -1,18 +0,0 @@ -#include "debug.hh" -#include "item.hh" - - - -Item::Item() -{ - pcol_l_ = 0; -} - -void -Item::do_print() const -{ -#ifndef NPRINT - mtor << "(unknown)"; -#endif -} - diff --git a/src/key-item.cc b/src/key-item.cc deleted file mode 100644 index 963b1bc578..0000000000 --- a/src/key-item.cc +++ /dev/null @@ -1,70 +0,0 @@ -#include "key-item.hh" -#include "key.hh" -#include "debug.hh" -#include "molecule.hh" -#include "paper-def.hh" -#include "lookup.hh" -//#include "clef-reg.hh" -#include "key-reg.hh" - -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 */ - - - -Key_item::Key_item(int c) -{ - set_c_position(c); -} - -void -Key_item::read(const Key_register& key_reg_r) -{ - const Array &idx_arr =key_reg_r.accidental_idx_arr_; - for (int i = 0 ; i< idx_arr.size(); i++) { - int note = idx_arr[i]; - int acc = key_reg_r.key_.acc(note); - - add(note, acc); - } -} - -void -Key_item::set_c_position(int c0) -{ - int octaves =(abs(c0) / 7) +1 ; - c_position=(c0 + 7*octaves)%7; -} - - -void -Key_item::add(int p, int a) -{ - if ((a<0 && p>FLAT_TOP_PITCH) || - (a>0 && p>SHARP_TOP_PITCH)) { - p -= 7; /* Typeset below c_position */ - } - pitch.push(p); - acc.push(a); -} - - -Molecule* -Key_item::brew_molecule_p()const -{ - Molecule*output = new Molecule; - Real inter = paper()->internote(); - - for (int i =0; i < pitch.size(); i++) { - Symbol s= paper()->lookup_p_->accidental(acc[i]); - Atom a(s); - a.translate(Offset(0,(c_position + pitch[i]) * inter)); - Molecule m(a); - output->add_right(m); - } - Molecule m(paper()->lookup_p_->fill(Box( - Interval(0, paper()->note_width()), - Interval(0,0)))); - output->add_right(m); - return output; -} diff --git a/src/key-reg.cc b/src/key-reg.cc deleted file mode 100644 index 84b0e268c6..0000000000 --- a/src/key-reg.cc +++ /dev/null @@ -1,99 +0,0 @@ -/* - key-reg.cc -- implement Key_register - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys - - todo: key undo - - */ -#include "time-description.hh" -#include "key-reg.hh" -#include "key-item.hh" -#include "commandrequest.hh" -#include "staff-column.hh" -#include "local-key-reg.hh" -#include "musicalrequest.hh" - -Key_register::Key_register() -{ - post_move_processing(); -} - -bool -Key_register::try_request(Request * req_l) -{ - Command_req* creq_l= req_l->command(); - if (!creq_l|| !creq_l->keychange()) - return false; - - assert(!keyreq_l_); // todo - keyreq_l_ = creq_l->keychange(); - read_req(keyreq_l_); - return true; -} - -void -Key_register::acknowledge_element(Staff_elem_info info) -{ - Command_req * r_l = info.req_l_->command() ; - if (r_l && r_l->clefchange() && !kit_p_) { - int c0_i= *get_staff_info().c0_position_i_; - kit_p_ = new Key_item(c0_i); - kit_p_->read(*this); - announce_element(Staff_elem_info(kit_p_, keyreq_l_)); - } -} - -void -Key_register::process_requests() -{ - const Time_description *time_l = get_staff_info().time_c_l_; - - if (!keyreq_l_ && - (!time_l->whole_in_measure_|| !time_l->when_)) { - default_key_b_ = true; - } - - if ( default_key_b_ || keyreq_l_) { - int c0_i= *get_staff_info().c0_position_i_; - kit_p_ = new Key_item(c0_i); - kit_p_->read(*this); - announce_element(Staff_elem_info(kit_p_, keyreq_l_)); - } -} - -void -Key_register::pre_move_processing() -{ - if (kit_p_) { - if (default_key_b_) - typeset_breakable_item(0,0,kit_p_); - else - typeset_breakable_item( - new Key_item(*kit_p_), kit_p_, new Key_item(*kit_p_)); - kit_p_ = 0; - } -} - - - -void -Key_register::read_req(Key_change_req * r) -{ - accidental_idx_arr_.set_size(0); - for (int i = 0; i < r->melodic_p_arr_.size(); i ++) { - int n_i=r->melodic_p_arr_[i]->notename_i_; - key_.set(n_i, r->melodic_p_arr_[i]->accidental_i_); - accidental_idx_arr_.push(n_i); - } -} - -void -Key_register::post_move_processing() -{ - keyreq_l_ = 0; - default_key_b_ = false; - kit_p_ = 0; -} diff --git a/src/key.cc b/src/key.cc deleted file mode 100644 index 7e23464ccf..0000000000 --- a/src/key.cc +++ /dev/null @@ -1,38 +0,0 @@ -#include "key.hh" - -const int OCTAVES=14; // ugh.. -const int ZEROOCTAVE=7; - -Key::Key() -{ - accidental_i_arr_.set_size(7); - for (int i= 0; i < 7 ; i++) - accidental_i_arr_[i] = 0; -} - -Local_key::Local_key() -{ - octaves.set_size(OCTAVES); -} - -Key& -Local_key::oct(int i) -{ - return octaves[i+ZEROOCTAVE]; -} - -void -Key::set(int i, int a) -{ - assert(a > -3 && a < 3); - accidental_i_arr_[i]=a; -} - - -void -Local_key::reset(Key k) -{ - for (int i= 0; i < OCTAVES ; i++) - octaves[i] = k; -} - diff --git a/src/keyword.cc b/src/keyword.cc deleted file mode 100644 index 14903cfb61..0000000000 --- a/src/keyword.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* - keyword.cc -- keywords and identifiers - */ - -#include - -#include "glob.hh" -#include "lexer.hh" -//#include "mudobs.hh" -//#include "gram.hh" - -/* for the keyword table */ -struct Keyword_ent -{ - const char *name; - int tokcode; -}; - -struct Keyword_table -{ - Keyword_ent *table; - int maxkey; - Keyword_table(Keyword_ent *); - int lookup(const char *s) const; -}; - - -/* for qsort */ -int - tabcmp(const void * p1, const void * p2) -{ - return strcmp(((const Keyword_ent *) p1)->name, - ((const Keyword_ent *) p2)->name); -} - -Keyword_table::Keyword_table(Keyword_ent *tab) -{ - table = tab; - - /* count keywords */ - for (maxkey = 0; table[maxkey].name; maxkey++); - - /* sort them */ - qsort(table, maxkey, sizeof(Keyword_ent), tabcmp); -} - -/* - lookup with binsearch, return tokencode. -*/ -int -Keyword_table::lookup(const char *s)const -{ - int lo, - hi, - cmp, - result; - lo = 0; - hi = maxkey; - - /* binary search */ - do - { - cmp = (lo + hi) / 2; - - result = strcmp(s, table[cmp].name); - - if (result < 0) - hi = cmp; - else - lo = cmp; - } - while (hi - lo > 1); - if (!strcmp(s, table[lo].name)) - { - return table[lo].tokcode; - } else - return -1; /* not found */ -} - diff --git a/src/leastsquares.cc b/src/leastsquares.cc deleted file mode 100644 index cf9ec478e4..0000000000 --- a/src/leastsquares.cc +++ /dev/null @@ -1,35 +0,0 @@ -#include "leastsquares.hh" -void -Least_squares::OK() const -{ - assert( input.size() > 1 ); - Real dx = 0.0; - for (int i=1; i < input.size(); i++) - dx += abs (input[i-1].x - input[i].x); - - assert(dx); -} -void -Least_squares::minimise(Real &coef, Real &offset) -{ - OK(); - Real sx = 0.0; - Real sy = 0.0; - Real sqx =0.0; - Real sxy = 0.0; - - for (int i=0; i < input.size();i++) { - Real x=input[i].x; - Real y = input[i].y; - sx += x; - sy += y; - sqx += sqr(x); - sxy += x*y; - } - int N = input.size(); - - - coef = (N * sxy - sx*sy )/(N*sqx - sqr(sx)); - offset = (sy - coef * sx)/N; - -} diff --git a/src/lexer.l b/src/lexer.l deleted file mode 100644 index 3f86adcd54..0000000000 --- a/src/lexer.l +++ /dev/null @@ -1,281 +0,0 @@ -%{ // -*-Fundamental-*- - -#include - -#include "string.hh" -#include "notename.hh" -#include "lexer.hh" -#include "varray.hh" -#include "parser.hh" -#include "debug.hh" -#include "input-score.hh" -#include "parseconstruct.hh" -#include "main.hh" -#include "string-convert.hh" - -%} - -%option c++ -%option noyywrap -%option nodefault -%option yylineno -%option debug -%option yyclass="My_flex_lexer" -%option stack - -%x notes -%x incl -%x quote -%x lyrics - - - -A [a-zA-Z] -AA {A}|_ -N [0-9] -AN {AA}|{N} -PUNCT [?!,.:;] -ACCENT [\\'"^] -NATIONAL [\241-\377] -TEX {AA}|-|{PUNCT}|{ACCENT}|{NATIONAL} - -WORD {A}{AN}* -ALPHAWORD {A}+ -INT -?{N}+ -REAL {INT}?(\.{N}*)? - -OPTSIGN !? -PITCHMOD ['`]*{OPTSIGN} -RESTNAME r|s|p -NOTECOMMAND \\{WORD} -NOTENAME [a-z]+ -UNOTENAME [A-Z][a-z]* -DOTS \.+ -LYRICS {TEX}+ -COMMENT [%#].*\n - -%% - -\$ { - yy_push_state(notes); -} - -\@ { - yy_push_state(lyrics); -} - -{RESTNAME} { - const char *s = YYText(); - yylval.string = new String (s); - mtor << "rest:"<< yylval.string; - return RESTNAME; -} -{UNOTENAME} { - int *p=yylval.ii; - return ret_notename(p, YYText(), -1); -} - -{NOTENAME} { - int *p=yylval.ii; - return ret_notename(p, YYText(), 0); -} - -{NOTECOMMAND} { - String c = YYText() +1; - mtor << "\\word: " << YYText()+1<{PITCHMOD} { - const char *s = YYText(); - mtor << "pitchmod:"<< YYText()<{DOTS} { - yylval.i = strlen(YYText()); - return DOTS; -} -{INT} { - yylval.i = String_convert::dec2_i( String( YYText() ) ); - return INT; -} -{COMMENT} { -} -[ \t\n]+ { - -} -\$ { - yy_pop_state(); -} -\"[^"]*\" { - String s (YYText()+1); - s = s.left_str(s.length_i()-1); - yylval.string = new String(s); - return STRING; -} -. { - return yylval.c = YYText()[0]; -} - -\" { - yy_push_state(quote); -} -[^"]* { - yylval.string = new String (YYText()); -} -\" { - mtor << "quoted string\n"; - yy_pop_state(); - return STRING; -} - -{DOTS} { - yylval.i = strlen(YYText()); - return DOTS; -} -{INT} { - yylval.i = String_convert::dec2_i( String( YYText() ) ); - return INT; -} -{NOTECOMMAND} { - String c = YYText() +1; - mtor << "\\word: " << YYText()+1<\"[^"]*\" { - String s (YYText()+1); - s = s.left_str(s.length_i()-1); - yylval.string = new String(s); - return STRING; -} -{LYRICS} { - String s (YYText()); - int i = 0; - while ((i=s.index_i("_")) != -1) // change word binding "_" to " " - *(s.ch_l() + i) = ' '; - if ((i=s.index_i("\\,")) != -1) // change "\," to TeX's "\c " - { - *(s.ch_l() + i + 1) = 'c'; - s = s.left_str(i+2) + " " + s.right_str(s.length_i()-i-2); - } - yylval.string = new String(s); - return STRING; -} -\| { - return YYText()[0]; -} -{COMMENT} { - -} -[{}] { - return YYText()[0]; -} -[()\[\]|/.^>_-] { - return yylval.c = YYText()[0]; -} -[ \t\n]+ { -} -@ { - yy_pop_state(); -} - -<> { - mtor << "<>"; - - if (! close_input()) - yyterminate(); // can't move this, since it actually rets a YY_NULL -} - - -include { - yy_push_state(incl); -} -[ \t]* { /* eat the whitespace */ } -\"[^"]*\"+ { /* got the include file name */ - String s (YYText()+1); - s = s.left_str(s.length_i()-1); - defined_ch_c_l = here_ch_c_l() - String( YYText() ).length_i() - 1; - new_input(s); - yy_pop_state(); -} - - -{WORD} { - mtor << "word: " << YYText()< -*/ - -#include -#include -#include "proto.hh" -#include "plist.hh" -#include "lexer.hh" -#include "debug.hh" -#include "main.hh" -#include "source-file.hh" -#include "source.hh" - -My_flex_lexer *lexer=0; - -int -yylex() { - return lexer->yylex(); -} - -bool -busy_parsing() -{ - return lexer; -} diff --git a/src/lily-stream.cc b/src/lily-stream.cc deleted file mode 100644 index 4b79481424..0000000000 --- a/src/lily-stream.cc +++ /dev/null @@ -1,72 +0,0 @@ -// -// lily-stream.cc -// -// source file of the LilyPond music typesetter -// -// (c) 1997 Jan Nieuwenhuizen - -// should i be named Mudela_stream? - -#include -#include - -#include "proto.hh" -#include "plist.hh" -#include "string.hh" - -#include "moment.hh" -#include "source-file.hh" -#include "source.hh" -#include "midi-main.hh" // *tors - -#include "duration.hh" -#include "midi-event.hh" -#include "lily-stream.hh" - -Lily_stream::Lily_stream( String filename_str ) -{ - filename_str_ = filename_str; - os_p_ = 0; - open(); - header(); -} - -Lily_stream::~Lily_stream() -{ - delete os_p_; -} - -Lily_stream& -Lily_stream::operator <<( String str ) -{ - *os_p_ << str; - return *this; -} - -Lily_stream& -Lily_stream::operator <<( Midi_event& midi_event_r ) -{ - midi_event_r.output_mudela( *this ); - return *this; -} - -void -Lily_stream::header() -{ - *os_p_ << "% Creator: " << version_str() << "\n"; - *os_p_ << "% Automatically generated, at "; - time_t t( time( 0 ) ); - *os_p_ << ctime( &t ); - *os_p_ << "% from input file: "; -// *os_p_ << midi_parser_l_g-> - *os_p_ << "\n\n"; -} - -void -Lily_stream::open() -{ - os_p_ = new ofstream( filename_str_ ); - if ( !*os_p_ ) - error ( "can't open `" + filename_str_ + "\'", 0 ); -} - diff --git a/src/linespace.cc b/src/linespace.cc deleted file mode 100644 index a7bfa1df9b..0000000000 --- a/src/linespace.cc +++ /dev/null @@ -1,288 +0,0 @@ -#include -#include "linespace.hh" -#include "pcol.hh" -#include "debug.hh" -#include "qlp.hh" -#include "unionfind.hh" -#include "idealspacing.hh" - -const Real COLFUDGE=1e-3; - - -bool -Spacing_problem::contains(const PCol *w) -{ - for (int i=0; i< cols.size(); i++) - if (cols[i].pcol_ == w) - return true; - return false; -} - -int -Spacing_problem::col_id(const PCol *w)const -{ - for (int i=0; i< cols.size(); i++) - if (cols[i].pcol_ == w) - return i; - assert(false); - return -1; -} - -void -Spacing_problem::OK() const -{ -#ifndef NDEBUG - Union_find connected(cols.size()); - Array fixed; - for (int i=0; i < ideals.size(); i++) { - assert(ideals[i]->hooke > 0); - int l = col_id(ideals[i]->left); - int r = col_id(ideals[i]->right); - connected.connect(l,r); - } - for (int i = 0; i < cols.size(); i++) - if (cols[i].fixed()) - fixed.push(i); - for (int i = 0; i < cols.size(); i++) { - bool c=false; - for (int j =0; j COLFUDGE) - return false; - - if (!i) - continue; - - Real mindist=cols[i-1].minright() - +cols[i].minleft(); - - // ugh... compares - Real dif =v(i) - v(i-1)- mindist; - bool b = (dif > - COLFUDGE); - - - if (!b) - return false; - - } - return true; -} - -bool -Spacing_problem::check_feasible() const -{ - Vector sol(try_initial_solution()); - return check_constraints(sol); -} - -// generate a solution which obeys the min distances and fixed positions -Vector -Spacing_problem::try_initial_solution() const -{ - int dim=cols.size(); - Vector initsol(dim); - for (int i=0; i < dim; i++) { - if (cols[i].fixed()) { - initsol(i)=cols[i].fixed_position(); - } else { - Real mindist=cols[i-1].minright() - +cols[i].minleft(); - assert(mindist >= 0.0); - initsol(i)=initsol(i-1)+mindist; - - //nog niet - //if (i>0) - // assert(initsol(i) > initsol(i-1)); - } - } - - return initsol; -} -Vector -Spacing_problem::find_initial_solution() const -{ - Vector v(try_initial_solution()); - assert(check_constraints(v)); - return v; -} - -// generate the matrices -void -Spacing_problem::make_matrices(Matrix &quad, Vector &lin, Real &c) const -{ - quad.fill(0); - lin.fill(0); - c = 0; - for (int j=0; j < ideals.size(); j++){ - Idealspacing const*i=ideals[j]; - int l = col_id(i->left); - int r = col_id(i->right); - - quad(r,r) += i->hooke; - quad(r,l) -= i->hooke; - quad(l,r) -= i->hooke; - quad(l,l) += i->hooke; - - lin(r) -= i->space*i->hooke; - lin(l) += i->space*i->hooke; - - c += sqr(i->space); - } -} - -// put the constraints into the LP problem -void -Spacing_problem::make_constraints(Mixed_qp& lp) const -{ - int dim=cols.size(); - for (int j=0; j < dim; j++) { - Colinfo *c=&(cols[j]); - if (c->fixed()) { - lp.add_fixed_var(j,c->fixed_position()); - } - if (j > 0){ - Vector c1(dim); - - c1(j)=1.0 ; - c1(j-1)=-1.0 ; - lp.add_inequality_cons(c1, cols[j-1].minright() + - cols[j].minleft()); - } - } -} - -Array -Spacing_problem::solve() const -{ - print(); - OK(); - assert(check_feasible()); - - /* optimalisatiefunctie */ - Mixed_qp lp(cols.size()); - make_matrices(lp.quad,lp.lin, lp.const_term); - make_constraints(lp); - Vector start=find_initial_solution(); - Vector sol(lp.solve(start)); - if (!check_constraints(sol)) { - WARN << "solution doesn't satisfy constraints.\n" ; - } - - - Array posns(sol); - posns.push(lp.eval(sol)); - return posns; -} - -/* - add one column to the problem. -*/ -void -Spacing_problem::add_column(const PCol *col, bool fixed, Real fixpos) -{ - Colinfo c(col,(fixed)? &fixpos : 0); - cols.push(c); -} - -void -Spacing_problem::add_ideal(const Idealspacing *i) -{ - const PCol *l =i->left; - const PCol *r= i->right; - - if (!contains(l) || !contains(r)) { - return; - } - ideals.push(i); -} - -void -Spacing_problem::print_ideal(const Idealspacing*id)const -{ -#ifndef NPRINT - int l = col_id(id->left); - int r = col_id(id->right); - - mtor << "between " << l <<","<print(); -#endif -} - -void -Spacing_problem::print() const -{ -#ifndef NPRINT - for (int i=0; i < cols.size(); i++) { - mtor << "col " << i<<' '; - cols[i].print(); - } - for (int i=0; i < ideals.size(); i++) { - print_ideal(ideals[i]); - } -#endif - -} - -/* **************** */ - -void -Colinfo::print() const -{ -#ifndef NPRINT - mtor << "column { "; - if (fixed()) - mtor << "fixed at " << fixed_position()<<", "; - assert(pcol_); - mtor << "[" << minleft() << ", " << minright() << "]"; - mtor <<"}\n"; -#endif -} - -Colinfo::Colinfo(Colinfo const&c) -{ - fixpos = (c.fixpos)?new Real(*c.fixpos):0; - pcol_ = c.pcol_; - width = c.width; -} - -Colinfo::Colinfo(const PCol*col_p, const Real*fixed_r_p ) -{ - fixpos = (fixed_r_p)? new Real(*fixed_r_p) : 0; - pcol_ = col_p; - width = pcol_->width(); -} - -Colinfo::~Colinfo() -{ - delete fixpos; -} - -Colinfo::Colinfo() -{ - pcol_=0; - fixpos = 0; -} -void -Colinfo::operator=(Colinfo const&c ) -{ - delete fixpos; - fixpos = (c.fixpos)?new Real(*c.fixpos):0; - pcol_ = c.pcol_; - width = c.width; -} diff --git a/src/local-key-item.cc b/src/local-key-item.cc deleted file mode 100644 index 425982120c..0000000000 --- a/src/local-key-item.cc +++ /dev/null @@ -1,93 +0,0 @@ -#include "local-key-item.hh" -#include "molecule.hh" -#include "scalar.hh" -#include "lookup.hh" -#include "paper-def.hh" -#include "musicalrequest.hh" -#include "notehead.hh" -#include "misc.hh" - - - -Local_key_item::Local_key_item(int i) -{ - c0_position = i; -} - -void -Local_key_item::add(Item*head_l) -{ - support_items_.push(head_l); - add_dependency(head_l); -} - -void -Local_key_item::add(Melodic_req*m_l) -{ - add(m_l->octave_i_, m_l->notename_i_, m_l->accidental_i_); -} -void -Local_key_item::add (int o, int p , int a) -{ - Local_acc l; - l.octave = o; - l.name = p; - l.acc = a; - accs.push(l); -} - -void -Local_key_item::do_pre_processing() -{ - accs.sort(Local_acc::compare); -} - -Molecule* -Local_key_item::brew_molecule_p()const -{ - Molecule* output = new Molecule; - Molecule*octmol = 0; - int lastoct = -100; - for (int i = 0; i < accs.size(); i++) { - // do one octave - if (accs[i].octave != lastoct) { - if (octmol){ - Real dy =lastoct*7*paper()->internote(); - octmol->translate(Offset(0, dy)); - output->add(*octmol); - delete octmol; - } - octmol= new Molecule; - } - lastoct = accs[i].octave; - Symbol s =paper()->lookup_p_->accidental(accs[i].acc); - Atom a(s); - Real dy = (accs[i].name + c0_position) * paper()->internote(); - a.translate(Offset(0,dy)); - - octmol->add_right(a); - } - - if (octmol){ - Real dy =lastoct*7*paper()->internote(); - octmol->translate(Offset(0, dy)); - output->add(*octmol); - delete octmol; - } - - Interval head_width=itemlist_width(support_items_); - output->translate(Offset(-output->extent().x.right + head_width.left ,0)); - - return output; -} - -int -Local_acc::compare(Local_acc&a, Local_acc&b) -{ - if (a.octave - b.octave) - return a.octave - b.octave; - if (a.name - b.name) - return a.name - b.name; - - assert(false); -}; diff --git a/src/local-key-reg.cc b/src/local-key-reg.cc deleted file mode 100644 index b71f14e920..0000000000 --- a/src/local-key-reg.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - local-key-reg.cc -- implement Local_key_register - - (c) 1997 Han-Wen Nienhuys -*/ - -#include "musicalrequest.hh" -#include "commandrequest.hh" -#include "local-key-reg.hh" -#include "local-key-item.hh" -#include "complex-walker.hh" -#include "key-reg.hh" -#include "debug.hh" -#include "key-item.hh" - -Local_key_register::Local_key_register() -{ - key_item_p_ = 0; - key_c_l_ = 0; -} - -void -Local_key_register::pre_move_processing() -{ - if (key_item_p_) { - 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_b_ || - local_key_.oct(melodic_l_->octave_i_).acc(melodic_l_->notename_i_) - != melodic_l_->accidental_i_) { - Item * support_l_ = info.elem_p_->item(); - - - if (!key_item_p_) { - key_item_p_ = new Local_key_item(*get_staff_info().c0_position_i_); - } - - key_item_p_->add(melodic_l_); - key_item_p_->add(support_l_); - local_key_.oct(melodic_l_->octave_i_) - .set(melodic_l_->notename_i_, melodic_l_->accidental_i_); - } - } else if (info.elem_p_->name()==Key_item::static_name()) { - Key_register * key_reg_l = - (Key_register*)info.origin_reg_l_arr_[0]; - key_c_l_ = &key_reg_l->key_; - local_key_.reset(*key_c_l_); - } -} - -void -Local_key_register::process_requests() -{ - const Time_description * time_c_l_ = get_staff_info().time_c_l_; - if (! time_c_l_->whole_in_measure_){ - if (key_c_l_) - local_key_.reset(*key_c_l_); - else if( time_c_l_->when_ >0) - warning ("Help me! can't figure current key", 0); - } -} diff --git a/src/lookup.cc b/src/lookup.cc deleted file mode 100644 index ffd668e75d..0000000000 --- a/src/lookup.cc +++ /dev/null @@ -1,222 +0,0 @@ -/* - lookup.cc -- implement simple Lookup methods. - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#include "lookup.hh" -#include "debug.hh" -#include "symtable.hh" -#include "dimen.hh" -#include "tex.hh" -#include "scalar.hh" - -Lookup::Lookup() -{ - texsetting = "\\unknowntexsetting"; - symtables_ = new Symtables; -} - -Lookup::Lookup(Lookup const &s) -{ - texsetting = s.texsetting; - symtables_ = new Symtables(*s.symtables_); -} -Lookup::~Lookup() -{ - delete symtables_; -} - -void -Lookup::add(String s, Symtable*p) -{ - symtables_->add(s, p); -} - -void -Lookup::print()const -{ - mtor << "Lookup: " << texsetting << " {\n"; - symtables_->print(); - mtor << "}\n"; -} - -Symbol -Lookup::text(String style, String text, int dir) -{ - Array a; - - a.push(text); - Symbol tsym = (*symtables_)("style")->lookup(style); - a[0] = substitute_args(tsym.tex,a); - - Symbol s = (*symtables_)("align")->lookup(dir); - s.tex = substitute_args(s.tex,a); - s.dim.y = tsym.dim.y; - return s; -} - - -Real -Lookup::internote() -{ - return ball(4).dim.y.length()/2; -} - -Symbol -Lookup::ball(int j) -{ - if (j > 4) - j = 4; - - Symtable * st = (*symtables_)("balls"); - return st->lookup(String(j)); -} - -Symbol -Lookup::rest(int j) -{ - return (*symtables_)("rests")->lookup(String(j)); -} - -Symbol -Lookup::fill(Box b) -{ - Symbol s( (*symtables_)("param")->lookup("fill")); - s.dim = b; - return s; -} - -Symbol -Lookup::accidental(int j) -{ - return (*symtables_)("accidentals")->lookup(String(j)); -} - - -Symbol -Lookup::bar(String s) -{ - return (*symtables_)("bars")->lookup(s); -} - -Symbol -Lookup::script(String s) -{ - return (*symtables_)("scripts")->lookup(s); -} - -Symbol -Lookup::clef(String s) -{ - return (*symtables_)("clefs")->lookup(s); -} - -Symbol -Lookup::dots(int j) -{ - if (j>3) - error("max 3 dots"); // todo - return (*symtables_)("dots")->lookup(j); -} - -Symbol -Lookup::flag(int j) -{ - return (*symtables_)("flags")->lookup(j); -} - -Symbol -Lookup::streepjes(int i) -{ - assert(i); - - int arg; - String idx; - - if (i < 0) { - idx = "botlines"; - arg = -i; - } else { - arg = i; - idx = "toplines"; - } - Symbol ret = (*symtables_)("streepjes")->lookup(idx); - - Array a; - a.push(arg); - ret.tex = substitute_args(ret.tex, a); - - return ret; -} - -Symbol -Lookup::hairpin(Real &wid, bool decresc) -{ - int idx = int(rint(wid / 6 PT)); - if(!idx) idx ++; - wid = idx*6 PT; - String idxstr = (decresc)? "decrescendosym" : "crescendosym"; - Symbol ret=(*symtables_)("param")->lookup(idxstr); - - Array a; - a.push(idx); - ret.tex = substitute_args(ret.tex, a); - ret.dim.x = Interval(0,wid); - return ret; -} - -Symbol -Lookup::linestaff(int lines, Real wid) -{ - Symbol s; - s.dim.x = Interval(0,wid); - Real dy = (lines >0) ? (lines-1)*internote()*2 : 0; - s.dim.y = Interval(0,dy); - - Array a; - a.push(lines); - a.push(print_dimen(wid)); - - s.tex = (*symtables_)("param")->lookup("linestaf").tex; - s.tex = substitute_args(s.tex, a); - - return s; -} - - -Symbol -Lookup::meter(Array a) -{ - Symbol s; - s.dim.x = Interval( 0 PT, 10 PT); - s.dim.y = Interval(0, 20 PT); // todo - String src = (*symtables_)("param")->lookup("meter").tex; - s.tex = substitute_args(src,a); - return s; -} - - -Symbol -Lookup::stem(Real y1,Real y2) -{ - if (y1 > y2) { - Real t = y1; - y1 = y2; - y2 = t; - } - Symbol s; - - s.dim.x = Interval(0,0); - s.dim.y = Interval(y1,y2); - - Array a; - a.push(print_dimen(y1)); - a.push(print_dimen(y2)); - - String src = (*symtables_)("param")->lookup("stem").tex; - s.tex = substitute_args(src,a); - return s; -} diff --git a/src/lyric-item.cc b/src/lyric-item.cc deleted file mode 100644 index c0adac7b63..0000000000 --- a/src/lyric-item.cc +++ /dev/null @@ -1,27 +0,0 @@ -#include "musicalrequest.hh" -#include "paper-def.hh" -#include "lyric-item.hh" -#include "stem.hh" -#include "molecule.hh" -#include "lookup.hh" -#include "text-def.hh" -#include "source-file.hh" -#include "source.hh" -#include "debug.hh" -#include "main.hh" - -Lyric_item::Lyric_item(Lyric_req* lreq_l, int voice_count_i) - : Text_item(lreq_l,0) -{ - pos_i_ = -voice_count_i * 4 ; // 4 fontsize dependant. TODO - dir_i_ = -1; -} - -void -Lyric_item::do_pre_processing() -{ - - // test context-error - if ( tdef_l_->text_str_.index_i( "Gates" ) >=0)// :-) - warning( "foul word", tdef_l_->defined_ch_c_l_ ); -} diff --git a/src/lyricstaff.cc b/src/lyricstaff.cc deleted file mode 100644 index abefcd2048..0000000000 --- a/src/lyricstaff.cc +++ /dev/null @@ -1,22 +0,0 @@ -#include "musicalrequest.hh" -#include "voice.hh" -#include "staff-walker.hh" -#include "debug.hh" -#include "staff.hh" -#include "lyricstaff.hh" -#include "lyricwalker.hh" -#include "pscore.hh" - -void -Lyric_staff::set_output(PScore*pscore_l) -{ - pstaff_l_ = new PStaff(pscore_l); - pscore_l_ = pscore_l; - pscore_l_->add(pstaff_l_); -} - -Staff_walker* -Lyric_staff::get_walker_p() -{ - return new Lyric_walker(this); -} diff --git a/src/lyricwalker.cc b/src/lyricwalker.cc deleted file mode 100644 index 6abc2192a9..0000000000 --- a/src/lyricwalker.cc +++ /dev/null @@ -1,39 +0,0 @@ -/* - lyricwalker.cc -- implement Lyric_walker - - source file of the LilyPond music typesetter - - (c) 1997 Jan Nieuwenhuizen -*/ - -#include "musicalrequest.hh" -#include "voice.hh" -#include "pscore.hh" -#include "lyricstaff.hh" -#include "lyricwalker.hh" -#include "debug.hh" -#include "lyric-item.hh" -#include "staff-column.hh" - -void -Lyric_walker::process_requests() -{ - allow_break(); - - int req_count=0; - for (int i = 0; i < ptr()->musicalreq_l_arr_.size(); i++) { - Lyric_req * lreq_l = ptr()->musicalreq_l_arr_[i]->lreq_l(); - if (!lreq_l) - continue; - Item *lp = new Lyric_item(lreq_l,req_count++); - ptr()->typeset_musical_item( lp); - } -} - -Lyric_walker::Lyric_walker(Lyric_staff* lstaff_l) - : Staff_walker(lstaff_l, lstaff_l->pstaff_l_->pscore_l_) -{ - -} - - diff --git a/src/main.cc b/src/main.cc deleted file mode 100644 index 058db492d9..0000000000 --- a/src/main.cc +++ /dev/null @@ -1,166 +0,0 @@ -#include -#include -#include "proto.hh" -#include "plist.hh" -#include "lgetopt.hh" -#include "misc.hh" -#include "string.hh" -#include "main.hh" -#include "path.hh" -#include "config.hh" -#include "source-file.hh" -#include "source.hh" - -Source source; -Source* source_l_g = &source; -bool only_midi = false; -extern void parse_file(String,String); - - -void -destill_inname( String &name_str_r); -Long_option_init theopts[] = { - 1, "output", 'o', - 0, "warranty", 'w', - 0, "help", 'h', - 0, "debug", 'd', - 1, "init", 'i', - 1, "include", 'I', - 0, "midi", 'M', - 0,0,0 -}; - -void -help() -{ - cout << - "--help, -h This help\n" - "--warranty, -w show warranty & copyright\n" - "--output, -o set default output\n" - "--debug, -d enable debug output\n" - "--init, -i set init file\n" - "--include, -I add to file search path.\n" - "--midi, -M midi output only\n" - ; - -} - -void -notice() -{ - cout << - "\n" - "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" - "as published by the Free Software Foundation.\n" - "\n" - " This program is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" - "General Public License for more details.\n" - "\n" - " You should have received a copy (refer to the file COPYING) of the\n" - "GNU General Public License along with this program; if not, write to\n" - "the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,\n" - "USA.\n"; -} - -static File_path * path =0; -struct Main_init { - Main_init() { - path = new File_path(LIBDIR); - path->push(String(LIBDIR)+"init/"); - debug_init(); - } - ~Main_init() { - delete path; - } -} main_init; - -int -main (int argc, char **argv) -{ - Getopt_long oparser(argc, argv,theopts); - cout << get_version(); - String init_str("symbol.ini"); - - while (Long_option_init * opt = oparser()) { - switch ( opt->shortname){ - case 'o': - set_default_output(oparser.optarg); - break; - case 'w': - notice(); - exit(0); - break; - case 'I': - path->push(oparser.optarg); - break; - case 'i': - init_str = oparser.optarg; - break; - case 'h': - help(); - exit(0); - break; - case 'd': - set_debug(true); - break; - case 'M': - only_midi = true; - break; - default: - assert(false); - break; - } - } - - int p=0; - char *arg ; - while ( (arg= oparser.get_next_arg()) ) { - String f(arg); - destill_inname(f); - parse_file(init_str,f); - do_scores(); - p++; - } - if (!p) { - parse_file(init_str, ""); - do_scores(); - } - - return 0; -} - -String -find_file(String f) -{ - return path->find(f); -} - -/// make input file name: add default extension. "" is stdin. -void -destill_inname( String &name_str_r) -{ - if ( name_str_r.length_i() ) - { - if( name_str_r[ 0 ] != '-' ) - { - String a,b,c,d; - split_path(name_str_r,a,b,c,d); - - // add extension if not present. - if (d == "") - d = ".ly"; - name_str_r = a+b+c+d; - } - } else name_str_r = ""; -} - diff --git a/src/meter-reg.cc b/src/meter-reg.cc deleted file mode 100644 index a27737c076..0000000000 --- a/src/meter-reg.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* - meter-reg.cc -- implement Meter_register - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - -#include "meter-reg.hh" -#include "meter.hh" -#include "commandrequest.hh" - -Meter_register::Meter_register() - -{ - post_move_processing(); -} - -bool -Meter_register::try_request(Request*r_l) -{ - Command_req* creq_l= r_l->command(); - if (!creq_l || !creq_l->meterchange()) - return false; - - assert(!meter_req_l_); - meter_req_l_ = r_l->command()->meterchange(); - - return true; -} - -void -Meter_register::process_requests() -{ - if (meter_req_l_ ) { - Array args; - args.push(meter_req_l_->beats_i_); - args.push(meter_req_l_->one_beat_i_); - - meter_p_ = new Meter(args); - } - - if (meter_p_) - announce_element(Staff_elem_info(meter_p_, meter_req_l_) ); -} - -void -Meter_register::pre_move_processing() -{ - if (meter_p_) { - Meter * post_p =new Meter(*meter_p_); - Meter * pre_p =new Meter(*meter_p_); - - typeset_breakable_item(pre_p, meter_p_, post_p); - meter_p_ =0; - } -} - -void -Meter_register::post_move_processing() -{ - meter_req_l_ = 0; - meter_p_ =0; -} diff --git a/src/meter.cc b/src/meter.cc deleted file mode 100644 index 94f6b6c5e9..0000000000 --- a/src/meter.cc +++ /dev/null @@ -1,18 +0,0 @@ -#include "scalar.hh" -#include "molecule.hh" -#include "meter.hh" -#include "paper-def.hh" -#include "lookup.hh" - -Meter::Meter(Arraya) - :args(a) -{ -} - -Molecule* -Meter::brew_molecule_p()const -{ - Symbol s = paper()->lookup_p_->meter(args); - return new Molecule(Atom(s)); -} - diff --git a/src/midi-def.cc b/src/midi-def.cc deleted file mode 100644 index 5430823ed2..0000000000 --- a/src/midi-def.cc +++ /dev/null @@ -1,64 +0,0 @@ -// -// midi-def.cc -- implement midi output -// -// source file of the LilyPond music typesetter -// -// (c) 1997 Jan Nieuwenhuizen - -#include -#include "misc.hh" -#include "midi-def.hh" -#include "debug.hh" - -// classes, alphasorted -// statics -// constructors -// destructor -// routines, alphasorted - -Midi_def::Midi_def() -{ - set_tempo( Moment( 1, 4 ), 60 ); - outfile_str_ = "lelie.midi"; -} - -Midi_def::Midi_def( Midi_def const& midi_c_r ) -{ - whole_seconds_f_ = midi_c_r.whole_seconds_f_; - outfile_str_ = midi_c_r.outfile_str_; -} - -Midi_def::~Midi_def() -{ -} - -Real -Midi_def::duration_to_seconds_f( Moment moment ) -{ - if (!moment) - return 0; - - return whole_seconds_f_ * moment; -} - -int -Midi_def::get_tempo_i( Moment moment ) -{ - return Moment( whole_seconds_f_ ) * Moment( 60 ) * moment; -} - -void -Midi_def::print() const -{ -#ifndef NPRINT - mtor << "Midi {4/min: " << Real( 60 ) / ( whole_seconds_f_ * 4 ); - mtor << "out: " << outfile_str_; - mtor << "}\n"; -#endif -} - -void -Midi_def::set_tempo( Moment moment, int count_per_minute_i ) -{ - whole_seconds_f_ = Moment( count_per_minute_i ) / Moment( 60 ) / moment; -} diff --git a/src/midi-event.cc b/src/midi-event.cc deleted file mode 100644 index 36d6694779..0000000000 --- a/src/midi-event.cc +++ /dev/null @@ -1,198 +0,0 @@ -// -// midi-event.cc -- implement Midi_event -// -// copyright 1997 Jan Nieuwenhuizen - -#include - -#include "proto.hh" -#include "plist.hh" // all for midi-main.hh -#include "string.hh" -#include "source.hh" -#include "source-file.hh" -#include "midi-main.hh" // *tors -#include "moment.hh" -#include "duration.hh" -#include "midi-event.hh" -#include "lily-stream.hh" - -Midi_event::Midi_event() -{ -} - -Midi_event::~Midi_event() -{ -} - -Moment -Midi_event::mom() -{ - return Moment( 0 ); -} - -String -Midi_event::mudela_str() -{ - return mudela_str_; -} - -void -Midi_event::output_mudela( Lily_stream& lily_stream_r ) -{ - lily_stream_r << mudela_str_ << String( " " ); -} - -Midi_key::Midi_key( int accidentals_i, int minor_i ) -{ - accidentals_i_ = accidentals_i; - minor_i_ = minor_i; - if ( !minor_i_ ) - key_i_ = ( ( accidentals_i % 7 )[ "cgdaebf" ] - 'a' + 2 ) % 7; - else - key_i_ = ( ( -accidentals_i % 7 )[ "fbeadg" ] - 'a' + 2 ) % 7; - mudela_str_ = String( "% \\key\\" ); - if ( !minor_i_ ) - mudela_str_ += String( (char)( key_i_ - 2 + 'A' ) ); - else - mudela_str_ += String( (char)( key_i_ - 2 + 'a' ) ); -} - -String -Midi_key::notename_str( int pitch_i ) -{ - // this may seem very smart, - // but it-s only an excuse not to read a notename table - - // major scale: do-do - // minor scale: la-la ( = + 5 ) - static int notename_i_a[ 12 ] = { 0, 0, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6 }; - int notename_i = notename_i_a[ ( minor_i_ * 5 + pitch_i ) % 12 ]; - - static int accidentals_i_a[ 12 ] = { 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0 }; - int accidental_i = accidentals_i_a[ minor_i_ * 5 + pitch_i % 12 ]; - if ( accidentals_i_ < 0 ) { - accidental_i = - accidental_i; - notename_i = ( notename_i + 1 ) % 7; - } - - String notename_str = (char)( ( ( notename_i + key_i_ - 2 ) % 7 ) + 'a' ); - while ( accidental_i-- > 0 ) - notename_str += "is"; - accidental_i++; - while ( accidental_i++ < 0 ) - if ( ( notename_str == "a" ) || ( notename_str == "e" ) ) - notename_str += "s"; - else - notename_str += "es"; - accidental_i--; - String octave_str; - - octave_str += String( '\'', ( pitch_i - Midi_note::c0_pitch_i_c_ ) / 12 ); - octave_str += String( '`', ( Midi_note::c0_pitch_i_c_ - pitch_i ) / 12 ); - return octave_str + notename_str; -} - -Midi_key::~Midi_key() -{ -} - -Midi_note::Midi_note( Midi_key* midi_key_l, Midi_time* midi_time_l, int division_1_i, int pitch_i, int time_i ) -{ - dur_ = midi_time_l->i2_dur( time_i, division_1_i ); - - if ( dur_.plet_p_ ) - mudela_str_ += String( "\\plet{ " ) - + String_convert::i2dec_str( dur_.plet_p_->iso_i_, 0, 0 ) - + "/" - + String_convert::i2dec_str( dur_.plet_p_->type_i_, 0, 0 ) - + " } "; - - mudela_str_ += midi_key_l->notename_str( pitch_i ); - - Duration dur = dur_; - dur.set_plet( 0 ); - mudela_str_ += Duration_convert::dur2_str( dur ); - - if ( dur_.plet_p_ ) - mudela_str_ += String( " \\plet{ 1/1 }" ); -} - -Midi_note::~Midi_note() -{ -} - -Moment -Midi_note::mom() -{ - return Duration_convert::dur2_mom( dur_ ); -} - -Midi_tempo::Midi_tempo( int useconds_per_4_i ) -{ - useconds_per_4_i_ = useconds_per_4_i; - seconds_per_1_f_ = (Real)useconds_per_4_i_ * 4 / 1e6; - mudela_str_ = "% \\Tempo: "; - mudela_str_ += String( useconds_per_4_i_ ); - mudela_str_ += String( ": " ) - + String( get_tempo_i( Moment( 1, 4 ) ) ) - + String( " 4 per minute" ); -} - -Midi_tempo::~Midi_tempo() -{ -} - -int -Midi_tempo::get_tempo_i( Moment moment ) -{ - return Moment( 60 ) / moment / Moment( seconds_per_1_f_ ); -} - -Midi_time::Midi_time( int num_i, int den_i, int clocks_4_i, int count_32_i ) - : sync_dur_( 8 ) -{ - sync_f_ = 1.0; - if ( count_32_i != 8 ) - warning( String( "#32 in quarter: " ) + String( count_32_i ), 0 ); - num_i_ = num_i; - den_i_ = 2 << den_i; - clocks_1_i_ = clocks_4_i * 4; - mudela_str_ = "% \\Time: "; - mudela_str_ += String( num_i_ ) + "/" + String( den_i_ ) - + ", " + String( clocks_1_i_ ) - + ": " + String( count_32_i ); -} - -Midi_time::~Midi_time() -{ -} - -Duration -Midi_time::i2_dur( int time_i, int division_1_i ) -{ - Moment mom = Duration_convert::i2_mom( time_i, division_1_i ); - mom /= sync_f_; - - dtor << "\n% (" << time_i << ", " << mom << "): " - << sync_f_ << endl; - - Duration dur = Duration_convert::mom2_dur( mom ); - if ( !dur.type_i_ ) { - vtor << "\n% resyncing(" << time_i << ", " << mom << "): " - << sync_f_ << " -> "; - mom *= sync_f_; - sync_f_ = Duration_convert::sync_f( sync_dur_, mom ); - vtor << sync_f_ << endl; - mom /= sync_f_; - dur = Duration_convert::mom2_dur( mom ); - } - - return dur; -} - -int -Midi_time::clocks_1_i() -{ - return clocks_1_i_; -} - diff --git a/src/midi-item.cc b/src/midi-item.cc deleted file mode 100644 index 9d121cfcd8..0000000000 --- a/src/midi-item.cc +++ /dev/null @@ -1,196 +0,0 @@ -// -// midi-item.cc -// -// source file of the LilyPond music typesetter -// -// (c) 1997 Jan Nieuwenhuizen - -#include -#include "plist.hh" -#include "pcol.hh" -#include "debug.hh" -#include "misc.hh" -#include "request.hh" -#include "musicalrequest.hh" -#include "voice.hh" -#include "midi-item.hh" -#include "midi-stream.hh" -#include "string-convert.hh" - -Midi_chunk::Midi_chunk() -{ -} - -void -Midi_chunk::add( String str ) -{ - data_str_ += str; -} - -void -Midi_chunk::set( String header_str, String data_str, String footer_str ) -{ - data_str_ = data_str; - footer_str_ = footer_str; - header_str_ = header_str; -} - -String -Midi_chunk::str() -{ - String str = header_str_; - String length_str = String_convert::i2hex_str( data_str_.length_i() + footer_str_.length_i(), 8, '0' ); - length_str = String_convert::hex2bin_str( length_str ); - str += length_str; - str += data_str_; - str += footer_str_; - return str; -} - -Midi_duration::Midi_duration( Real seconds_f ) -{ - seconds_f_ = seconds_f; -} - -String -Midi_duration::str() -{ - return String( ""; -} - -Midi_header::Midi_header( int format_i, int tracks_i, int clocks_per_4_i ) -{ - String str; - - String format_str = String_convert::i2hex_str( format_i, 4, '0' ); - str += String_convert::hex2bin_str( format_str ); - - String tracks_str = String_convert::i2hex_str( tracks_i, 4, '0' ); - str += String_convert::hex2bin_str( tracks_str ); - - String tempo_str = String_convert::i2hex_str( clocks_per_4_i, 4, '0' ); - str += String_convert::hex2bin_str( tempo_str ); - - set( "MThd", str, "" ); -} - -String -Midi_item::i2varint_str( int i ) -{ - int buffer_i = i & 0x7f; - while ( (i >>= 7) > 0 ) { - buffer_i <<= 8; - buffer_i |= 0x80; - buffer_i += (i & 0x7f); - } - - String str; - while ( 1 ) { - str += (char)buffer_i; - if ( buffer_i & 0x80 ) - buffer_i >>= 8; - else - break; - } - return str; -} - -void -Midi_item::output_midi( Midi_stream& midi_stream_r ) -{ - midi_stream_r << str(); -} - - -Midi_note::Midi_note( Melodic_req* melreq_l, int channel_i, bool on_bo ) -{ - assert(melreq_l); - pitch_i_ = melreq_l->pitch() + c0_pitch_i_c_; - channel_i_ = channel_i; - - // poor man-s staff dynamics: - dynamic_byte_ = (melreq_l)? 0x64 - 0x10 * channel_i_:0; - on_b_ = on_bo; -} - -String -Midi_note::str() -{ - if ( pitch_i_ != INT_MAX ) { - Byte status_byte = ( on_b_ ? 0x90 : 0x80 ) + channel_i_; - String str = String( (char)status_byte ); - str += (char)pitch_i_; - // poor man-s staff dynamics: - str += (char)dynamic_byte_; - return str; - } - return String( "" ); -} - -Midi_tempo::Midi_tempo( int tempo_i ) -{ - tempo_i_ = tempo_i; -} - -String -Midi_tempo::str() -{ - int useconds_per_4_i = 60 * (int)1e6 / tempo_i_; - String str = "ff5103"; - str += String_convert::i2hex_str( useconds_per_4_i, 6, '0' ); - return String_convert::hex2bin_str( str ); -} - -Midi_track::Midi_track( int number_i ) -{ -// 4D 54 72 6B MTrk -// 00 00 00 3B chunk length (59) -// 00 FF 58 04 04 02 18 08 time signature -// 00 FF 51 03 07 A1 20 tempo - -// FF 59 02 sf mi Key Signature -// sf = -7: 7 flats -// sf = -1: 1 flat -// sf = 0: key of C -// sf = 1: 1 sharp -// sf = 7: 7 sharps -// mi = 0: major key -// mi = 1: minor key - - number_i_ = number_i; - - char const* data_ch_c_l = "00" "ff58" "0404" "0218" "08" -// "00" "ff51" "0307" "a120" -// why a key at all, in midi? -// key: C - "00" "ff59" "02" "00" "00" -// key: F (scsii-menuetto) -// "00" "ff59" "02" "ff" "00" - ; - - String data_str; - // only for format 0 (currently using format 1)? - data_str += String_convert::hex2bin_str( data_ch_c_l ); - - char const* footer_ch_c_l = "00" "ff2f" "00"; - String footer_str = String_convert::hex2bin_str( footer_ch_c_l ); - - set( "MTrk", data_str, footer_str ); -} - -void -Midi_track::add( int delta_time_i, String event_str ) -{ - assert(delta_time_i >= 0); - Midi_chunk::add( i2varint_str( delta_time_i ) + event_str ); -} - -void -Midi_track::add( Moment delta_time_moment, Midi_item* mitem_l ) -{ - // use convention of 384 clocks per 4 - // use Duration_convert - int delta_time_i = delta_time_moment * Moment( 384 ) / Moment( 1, 4 ); - add( delta_time_i, mitem_l->str() ); -} - diff --git a/src/midi-lexer.l b/src/midi-lexer.l deleted file mode 100644 index 49f74ead0e..0000000000 --- a/src/midi-lexer.l +++ /dev/null @@ -1,390 +0,0 @@ -%{ -// midi-lexer.l - -//#include - -#include "string.hh" -#include "proto.hh" -#include "midi-main.hh" -#include "my-midi-lexer.hh" -#include "midi-parser.hh" - -%} - -%option c++ -%option noyywrap -%option nodefault -%option yylineno -%option debug -%option yyclass="My_midi_lexer" -%option stack - -%x data -%x event -%x int8 -%x int16 -%x int32 -%x meta_event -%x track - -INT8 [\x00-\xff] -INT16 {INT8}{INT8} -INT32 {INT16}{INT16} -INT7_8UNSET [\x00-\x7f] -INT7_8SET [\x80-\xff] -VARINT {INT7_8SET}{0,3}{INT7_8UNSET} - -HEADER MThd -TRACK MTrk - -XRUNNING_STATUS [\x30-\x4f] -RUNNING_STATUS [\x00-\x5f] -DATA_ENTRY [\x60-\x79] -ALL_NOTES_OFF [\x7a-\x7f] -NOTE_OFF [\x80-\x8f] -NOTE_ON [\x90-\x9f] -POLYPHONIC_AFTERTOUCH [\xa0-\xaf] -CONTROLMODE_CHANGE [\xb0-\xbf] -PROGRAM_CHANGE [\xc0-\xcf] -CHANNEL_AFTERTOUCH [\xd0-\xdf] -PITCHWHEEL_RANGE [\xe0-\xef] - -SYSEX_EVENT1 [\xf0] -SYSEX_EVENT2 [\xf7] - -META_EVENT [\xff] - -SEQUENCE [\x00][\x02] -TEXT [\x01] -COPYRIGHT [\x02] -TRACK_NAME [\x03] -INSTRUMENT_NAME [\x04] -LYRIC [\x05] -MARKER [\x06] -CUE_POINT [\x07] - -END_OF_TRACK [\x2f][\x00] -TEMPO [\x51][\x03] -SMPTE_OFFSET [\x54][\x05] -TIME [\x58][\x04] -KEY [\x59][\x02] -SSME [\0x7f][\x03] - -%% - -{HEADER}/{INT32} { // using /{INT32}; longer match than {INT32} - dtor << "lex: header" << endl; - yy_push_state( int16 ); - yy_push_state( int16 ); - yy_push_state( int16 ); - yy_push_state( int32 ); - return HEADER; -} - -{TRACK}/{INT32} { // using /{INT32}; longer match than {INT32} - dtor << "lex: track" << endl; - yy_push_state( track ); - yy_push_state( int32 ); - return TRACK; -} -{INT8} { - error( String( "top level: illegal byte: " ) - + String_convert::bin2hex_str( String( *YYText() ) ) ); - exit( 1 ); -} -{INT32} { - dtor << "lex: int32" << endl; - assert( YYLeng() == 4 ); - String str( (Byte const*)YYText(), YYLeng() ); - yylval.i = String_convert::bin2_i( str ); - yy_pop_state(); - return INT32; -} -{INT16} { - dtor << "lex: int16" << endl; - assert( YYLeng() == 2 ); - String str( (Byte const*)YYText(), YYLeng() ); - yylval.i = String_convert::bin2_i( str ); - yy_pop_state(); - return INT16; -} -{INT8} { - dtor << "lex: int8" << endl; - assert( YYLeng() == 1 ); -// yylval.byte = *(Byte*)YYText(); - yylval.i = *(Byte*)YYText(); - yy_pop_state(); - return INT8; -} - -{VARINT} { - String str( (Byte const*)YYText(), YYLeng() ); - yylval.i = My_midi_lexer::varint2_i( str ); - dtor << String( "lex: track: varint(" ) - + String( yylval.i ) + "): " - + String_convert::bin2hex_str( str ) << endl; - yy_push_state( event ); - return VARINT; -} -{INT8} { - error( String( "track: illegal byte: " ) - + String_convert::bin2hex_str( String( *YYText() ) ) ); - exit( 1 ); -} -{RUNNING_STATUS} { -// yylval.byte = *(Byte*)YYText(); - yylval.i = *(Byte*)YYText(); - dtor << String ( "lex: running status: " ) + String( yylval.i ) << endl; - yy_pop_state(); -// yy_push_state( int8 ); - yy_push_state( int8 ); - return RUNNING_STATUS; -} -{DATA_ENTRY} { -// yylval.byte = *(Byte*)YYText(); - yylval.i = *(Byte*)YYText(); - dtor << String ( "lex: undefined data entry: " ) + String( yylval.i ) << endl; - yy_pop_state(); - yy_push_state( int8 ); - return DATA_ENTRY; -} -{ALL_NOTES_OFF} { - dtor << "lex: all note off" << endl; -// yylval.byte = *(Byte*)YYText(); - yylval.i = *(Byte*)YYText(); - dtor << String ( "lex: all notes off: " ) + String( yylval.i ) << endl; - yy_pop_state(); - yy_push_state( int8 ); - yy_push_state( int8 ); - return ALL_NOTES_OFF; -} -{NOTE_OFF} { - dtor << "lex: note off" << endl; -// yylval.byte = *(Byte*)YYText(); - yylval.i = *(Byte*)YYText(); - yy_pop_state(); - yy_push_state( int8 ); - yy_push_state( int8 ); - return NOTE_OFF; -} -{NOTE_ON} { - dtor << "lex: note on" << endl; -// yylval.byte = *(Byte*)YYText(); - yylval.i = *(Byte*)YYText(); - yy_pop_state(); - yy_push_state( int8 ); - yy_push_state( int8 ); - return NOTE_ON; -} -{POLYPHONIC_AFTERTOUCH} { - dtor << "lex: polyphonic aftertouch" << endl; -// yylval.byte = *(Byte*)YYText(); - yylval.i = *(Byte*)YYText(); - yy_pop_state(); - yy_push_state( int8 ); - yy_push_state( int8 ); - return POLYPHONIC_AFTERTOUCH; -} -{CONTROLMODE_CHANGE} { - dtor << "lex: controlmode change" << endl; -// yylval.byte = *(Byte*)YYText(); - yylval.i = *(Byte*)YYText(); - yy_pop_state(); - yy_push_state( int8 ); - yy_push_state( int8 ); - return CONTROLMODE_CHANGE; -} -{PROGRAM_CHANGE} { - dtor << "lex: program change" << endl; -// yylval.byte = *(Byte*)YYText(); - yylval.i = *(Byte*)YYText(); - yy_pop_state(); - yy_push_state( int8 ); - return PROGRAM_CHANGE; -} -{CHANNEL_AFTERTOUCH} { - dtor << "lex: channel aftertouch" << endl; -// yylval.byte = *(Byte*)YYText(); - yylval.i = *(Byte*)YYText(); - yy_pop_state(); - yy_push_state( int8 ); - yy_push_state( int8 ); - return CHANNEL_AFTERTOUCH; -} -{PITCHWHEEL_RANGE} { - dtor << "lex: pitchwheel range" << endl; -// yylval.byte = *(Byte*)YYText(); - yylval.i = *(Byte*)YYText(); - yy_pop_state(); - yy_push_state( int8 ); - yy_push_state( int8 ); - return PITCHWHEEL_RANGE; -} -{SYSEX_EVENT1} { // len data - dtor << "lex: sysex1" << endl; - yy_pop_state(); - yy_push_state( data ); - return SYSEX_EVENT1; -} -{SYSEX_EVENT2} { // len data - dtor << "lex: sysex2" << endl; - yy_pop_state(); -// yy_push_state( int8 ); //? - yy_push_state( data ); - return SYSEX_EVENT2; -} -{META_EVENT} { - dtor << "lex: meta" << endl; - yy_push_state( meta_event ); - return META_EVENT; -} -{INT8} { - error( String( "event: illegal byte: " ) - + String_convert::bin2hex_str( String( *YYText() ) ) ); - exit( 1 ); -} -{SEQUENCE} { // ssss sequence number - dtor << "lex: sequence" << endl; - yy_pop_state(); - yy_pop_state(); - yy_push_state( int16 ); - return SEQUENCE; -} -{TEXT} { // len data - dtor << "lex: text" << endl; - yy_pop_state(); - yy_pop_state(); - yy_push_state( data ); - return TEXT; -} -{COPYRIGHT} { - dtor << "lex: copyright" << endl; - yy_pop_state(); - yy_pop_state(); - yy_push_state( data ); - return COPYRIGHT; -} -{TRACK_NAME} { - dtor << "lex: track name" << endl; - yy_pop_state(); - yy_pop_state(); - yy_push_state( data ); - return TRACK_NAME; -} -{INSTRUMENT_NAME} { - dtor << "lex: instrument name" << endl; - yy_pop_state(); - yy_pop_state(); - yy_push_state( data ); - return INSTRUMENT_NAME; -} -{LYRIC} { - dtor << "lex: lyric" << endl; - yy_pop_state(); - yy_pop_state(); - yy_push_state( data ); - return LYRIC; -} -{MARKER} { - dtor << "lex: marker" << endl; - yy_pop_state(); - yy_pop_state(); - yy_push_state( data ); - return MARKER; -} -{CUE_POINT} { - dtor << "lex: cue point" << endl; - yy_pop_state(); - yy_pop_state(); - yy_push_state( data ); - return CUE_POINT; -} -{TEMPO} { // tttttt usec - dtor << "lex: tempo" << endl; - yy_pop_state(); - yy_pop_state(); - yy_push_state( int8 ); - yy_push_state( int8 ); - yy_push_state( int8 ); - return TEMPO; -} -{SMPTE_OFFSET} { // hr mn se fr ff - dtor << "lex: smpte offset" << endl; - yy_pop_state(); - yy_pop_state(); - yy_push_state( int8 ); - yy_push_state( int8 ); - yy_push_state( int8 ); - yy_push_state( int8 ); - yy_push_state( int8 ); - return SMPTE_OFFSET; -} -{TIME} { // nn dd cc bb - dtor << "lex: time" << endl; - yy_pop_state(); - yy_pop_state(); - yy_push_state( int8 ); - yy_push_state( int8 ); - yy_push_state( int8 ); - yy_push_state( int8 ); - return TIME; -} -{KEY} { // sf mi - dtor << "lex: key" << endl; - yy_pop_state(); - yy_pop_state(); - yy_push_state( int8 ); - yy_push_state( int8 ); - return KEY; -} -{SSME} { // len data - dtor << "lex: smme" << endl; - yy_pop_state(); - yy_pop_state(); - yy_push_state( data ); - return SSME; -} -{END_OF_TRACK} { - dtor << "lex: end of track" << endl; - yy_pop_state(); - yy_pop_state(); - yy_pop_state(); - return END_OF_TRACK; -} -{INT8} { - warning( String( "meta_event: unimplemented event: " ) - + String_convert::bin2hex_str( String( *YYText() ) ), - *this->here_ch_c_l() ); - yy_pop_state(); - yy_pop_state(); - yy_push_state( int8 ); - yy_push_state( int8 ); - return INT8; -} - -{VARINT} { - dtor << "lex: data" << endl; - String str( (Byte const*)YYText(), YYLeng() ); - int i = My_midi_lexer::varint2_i( str ); - String* str_p = new String; - while ( i-- ) - *str_p += (char)yyinput(); - yylval.str_p = str_p; - yy_pop_state(); - return DATA; -} -{INT8} { - error( String( "data: illegal byte: " ) - + String_convert::bin2hex_str( String( *YYText() ) ) ); - exit( 1 ); -} - -<> { -// mtor << "<>"; - - if ( !close_i() ) - yyterminate(); // can't move this, since it actually rets a YY_NULL -} - -%% - diff --git a/src/midi-main.cc b/src/midi-main.cc deleted file mode 100644 index 90aad5299e..0000000000 --- a/src/midi-main.cc +++ /dev/null @@ -1,205 +0,0 @@ -// -// midi-main.cc -- implement silly main() entry point -// should have Root class. -// -// copyright 1997 Jan Nieuwenhuizen - -#include -#include -#include "proto.hh" -#include "plist.hh" -#include "version.hh" -#include "fversion.hh" -#include "string.hh" -#include "lgetopt.hh" -#include "source.hh" -#include "source-file.hh" -#include "midi-main.hh" -#include "moment.hh" -#include "duration.hh" -#include "midi-event.hh" -#include "midi-track.hh" -#include "my-midi-lexer.hh" -#include "my-midi-parser.hh" - -Source source; -Source* source_l_g = &source; - -Verbose level_ver = NORMAL_ver; - -// ugh -bool no_triplets_bo_g = false; - -//ugh -char const* defined_ch_c_l = 0; - -// ugh, another global -String -find_file( String str ) -{ - return str; -} - -// ugh, copied from warn.cc, cannot use -void -message( String message_str, char const* context_ch_c_l ) -{ - String str = "m2m: "; - Source_file* sourcefile_l = source_l_g->sourcefile_l( context_ch_c_l ); - if ( sourcefile_l ) { - str += sourcefile_l->file_line_no_str(context_ch_c_l) + String(": "); - } - str += message_str; - if ( sourcefile_l ) { - str += ":\n"; - str += sourcefile_l->error_str( context_ch_c_l ); - } -// if ( busy_parsing() ) -// cerr << endl; - cerr << str << endl; -} - -void -warning( String message_str, char const* context_ch_c_l ) -{ - message( "warning: " + message_str, context_ch_c_l ); -} - -void -error( String message_str, char const* context_ch_c_l ) -{ - message( message_str, context_ch_c_l ); - // since when exits error again? - // i-d say: error: errorlevel |= 1; -> no output upon error - // warning: recovery -> output (possibly wrong) - if ( midi_lexer_l_g ) - midi_lexer_l_g->errorlevel_i_ |= 1; -} - -void -help() -{ - btor << - "--debug, -d be really verbose\n" - "--help, -h this help\n" - "--include=DIR, -I DIR add DIR to search path\n" - "--no-triplets, -n assume no triplets\n" - "--output=FILE, -o FILE set FILE as default output\n" - "--quiet, -q be quiet\n" - "--verbose, -v be verbose\n" - "--warranty, -w show warranty & copyright\n" - ; -} - -void -identify() -{ - mtor << version_str() << endl; -} - -void -notice() -{ - mtor << - "\n" - "M2m, translate midi to mudela.\n" - "Copyright (C) 1997 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" - "as published by the Free Software Foundation.\n" - "\n" - " This program is distributed in the hope that it will be useful,\n" - "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" - "General Public License for more details.\n" - "\n" - " You should have received a copy (refer to the file COPYING) of the\n" - "GNU General Public License along with this program; if not, write to\n" - "the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,\n" - "USA.\n"; -} - -// should simply have Root class... -String -version_str() -{ - return String ( "This is m2m " ) + VERSIONSTR - + "/FlowerLib " + FVERSIONSTR - + " of " + __DATE__ + " " + __TIME__; -} - -int -main( int argc_i, char* argv_sz_a[] ) -{ - long_option_init long_option_init_a[] = { - 0, "debug", 'd', - 0, "help", 'h', -// 1, "include", 'I', - 0, "no-triplets", 'n', - 1, "output", 'o', - 0, "quiet", 'q', - 0, "verbose", 'v', - 0, "warranty", 'w', - 0,0,0 - }; - Getopt_long getopt_long( argc_i, argv_sz_a, long_option_init_a ); - identify(); - - String output_str; - while ( long_option_init* long_option_init_p = getopt_long() ) - switch ( long_option_init_p->shortname ) { - case 'd': - level_ver = DEBUG_ver; - break; - case 'h': - help(); - exit( 0 ); - break; -// case 'I': -// path->push( getopt_long.optarg ); -// break; - case 'n': - no_triplets_bo_g = true; - break; - case 'o': - output_str = getopt_long.optarg; - break; - case 'q': - level_ver = QUIET_ver; - break; - case 'v': - level_ver = VERBOSE_ver; - break; - case 'w': - notice(); - exit( 0 ); - break; - default: - assert( 0 ); - break; - } - - char* arg_sz = 0; - while ( ( arg_sz = getopt_long.get_next_arg() ) ) { - My_midi_parser midi_parser( arg_sz ); - int error_i = midi_parser.parse(); - if ( error_i ) - return error_i; - if ( !output_str.length_i() ) { - output_str = String( arg_sz ) + ".ly"; - // i-m sure there-s already some routine for this - int name_i; // too bad we can-t declare local to if - if ( ( name_i = output_str.index_last_i( '/' ) ) != -1 ) - output_str = output_str.mid_str( name_i + 1, INT_MAX ); - } - error_i = midi_parser.output_mudela( output_str ); - if ( error_i ) - return error_i; - } - return 0; -} diff --git a/src/midi-output.cc b/src/midi-output.cc deleted file mode 100644 index af298f74dd..0000000000 --- a/src/midi-output.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* - midi-output.cc -- implement Midi_output - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys , Jan Nieuwehuizen -*/ - -#include "plist.hh" -#include "debug.hh" -#include "score.hh" -#include "staff.hh" -#include "midi-stream.hh" -#include "midi-def.hh" -#include "midi-output.hh" -#include "midi-walker.hh" -#include "midi-item.hh" -#include "staff-column.hh" -#include "musicalrequest.hh" - - -Midi_output:: Midi_output(Score* score_l, Midi_def* midi_l ) -{ - midi_l_ = midi_l; - - Midi_stream midi_stream(midi_l->outfile_str_, - score_l->staffs_.size(), - 384 ); -// oeps, not tempo, but clocks per 4 (384 convention) -// must set tempo in tempo request -// midi_l->get_tempo_i(Moment(1, 4))); - - midi_stream_l_ = &midi_stream; - int track_i=0; - - for (iter_top(score_l->staffs_,i); i.ok(); i++) { - do_staff(i, track_i++); - } - -} - -void -Midi_output::do_staff(Staff*st_l,int track_i) -{ - Midi_track midi_track( track_i ); - Midi_tempo midi_tempo( midi_l_->get_tempo_i( Moment( 1, 4 ) ) ); - midi_track.add( Moment( 0.0 ), &midi_tempo ); - for (Midi_walker w (st_l, &midi_track); w.ok(); w++) - w.process_requests(); - - *midi_stream_l_ << midi_track; -} diff --git a/src/midi-parser.y b/src/midi-parser.y deleted file mode 100644 index 466b5c58d5..0000000000 --- a/src/midi-parser.y +++ /dev/null @@ -1,283 +0,0 @@ -%{ - -#include - -#include "proto.hh" // ugh, these all for midi-main.hh -#include "plist.hh" -#include "string.hh" -#include "sourcefile.hh" -#include "source.hh" -#include "midi-main.hh" // *tors - -#include "my-midi-lexer.hh" -#include "my-midi-parser.hh" -#include "moment.hh" -#include "duration.hh" -#include "midi-event.hh" -#include "midi-track.hh" -#include "midi-score.hh" - -#ifndef NDEBUG -#define YYDEBUG 1 -#endif - -//ugh -static track_i = 0; - -%} - -%union { - Byte byte; - char c; - int i; - String* str_p; - Request* request_p; - Midi_event* midi_event_p; // Voice_element* ? - Midi_score* midi_score_p; // Input_score* ? - Midi_track* midi_track_p; // Input_music* ? -} - -%token HEADER TRACK -%token SYSEX_EVENT1 SYSEX_EVENT2 -%token META_EVENT -%token SEQUENCE TEXT COPYRIGHT TRACK_NAME INSTRUMENT_NAME LYRIC MARKER CUE_POINT -%token END_OF_TRACK TEMPO SMPTE_OFFSET TIME KEY SSME - -%token INT8 INT16 INT32 INT7_8UNSET INT7_8SET VARINT -%token RUNNING_STATUS DATA_ENTRY ALL_NOTES_OFF -%token NOTE_OFF NOTE_ON -%token POLYPHONIC_AFTERTOUCH CONTROLMODE_CHANGE PROGRAM_CHANGE -%token CHANNEL_AFTERTOUCH PITCHWHEEL_RANGE -%token DATA - -%type varint -%type header midi_score -%type track -%type event -%type the_event meta_event the_meta_event text_event midi_event sysex_event -%type running_status data_entry all_notes_off -%type note_off note_on -%type polyphonic_aftertouch controlmode_change program_change -%type channel_aftertouch pitchwheel_range - -%% - -midi: /* empty */ - | midi midi_score { - midi_parser_l_g->add_score( $2 ); - track_i = 0; - } - ; - -midi_score: - header { - } - | midi_score track { - $$->add_track( $2 ); - midi_parser_l_g->reset(); - } - ; - -header: - HEADER INT32 INT16 INT16 INT16 { - $$ = new Midi_score( $3, $4, $5 ); - midi_parser_l_g->set_division_4( $5 ); - } - ; - -track: - TRACK INT32 { - $$ = new Midi_track( track_i++ ); - } - | track event { - $$->add_event( midi_parser_l_g->mom(), $2 ); - } - ; - -event: - varint the_event { - $$ = $2; - if ( $2 && $2->mudela_str().length_i() ) - dtor << $2->mudela_str() << " " << flush; - } - ; - -varint: - VARINT { - midi_parser_l_g->forward( $1 ); - } - ; - -the_event: - meta_event { - } - | midi_event { - } - | sysex_event { - } - ; - -meta_event: - META_EVENT the_meta_event { - $$ = $2; - } - | - META_EVENT INT8 INT8 INT8 { - $$ = 0; - } - ; - -the_meta_event: - SEQUENCE INT16 { - } - | text_event DATA { - $$ = 0; - dtor << *$2 << endl; - delete $2; - } - | END_OF_TRACK { - $$ = 0; - } - | TEMPO INT8 INT8 INT8 { - $$ = new Midi_tempo( ( $2 << 16 ) + ( $3 << 8 ) + $4 ); - dtor << $$->mudela_str() << endl; // ?? waai not at event: - midi_parser_l_g->set_tempo( ( $2 << 16 ) + ( $3 << 8 ) + $4 ); - } - | SMPTE_OFFSET INT8 INT8 INT8 INT8 INT8 { - $$ = 0; - } - | TIME INT8 INT8 INT8 INT8 { - $$ = new Midi_time( $2, $3, $4, $5 ); - dtor << $$->mudela_str() << endl; // ?? waai not at event: - midi_parser_l_g->set_time( $2, $3, $4, $5 ); - } - | KEY INT8 INT8 { - $$ = new Midi_key( $2, $3 ); - midi_parser_l_g->set_key( $2, $3 ); - } - | SSME DATA { - $$ = 0; - delete $2; - } - ; - -text_event: - TEXT { - dtor << "\n% Text: "; - } - | COPYRIGHT { - dtor << "\n% Copyright: "; - } - | TRACK_NAME { - dtor << "\n% Track name: "; - } - | INSTRUMENT_NAME { - dtor << "\n% Instrument name: "; - } - | LYRIC { - dtor << "\n% Lyric: "; - } - | MARKER { - dtor << "\n% Marker: "; - } - | CUE_POINT { - dtor << "\n% Cue point: "; - } - ; - -midi_event: - running_status { - } - | data_entry { - } - | all_notes_off { - } - | note_off { - } - | note_on { - } - | polyphonic_aftertouch { - } - | controlmode_change { - } - | program_change { - } - | channel_aftertouch { - } - | pitchwheel_range { - } - ; - -running_status: - RUNNING_STATUS INT8 { //INT8 { - $$ = 0; - } - ; - -data_entry: - DATA_ENTRY INT8 { - $$ = 0; - } - ; - -all_notes_off: - ALL_NOTES_OFF INT8 INT8 { - $$ = 0; - } - ; - -note_off: - NOTE_OFF INT8 INT8 { - int i = $1; - i = i & ~0x80; - $$ = midi_parser_l_g->note_end_midi_event_p( $1 & ~0x80, $2, $3 ); - } - ; - -note_on: - NOTE_ON INT8 INT8 { - int i = $1; - i = i & ~0x90; - $$ = 0; - midi_parser_l_g->note_begin( $1 & ~0x90, $2, $3 ); - } - ; - -polyphonic_aftertouch: - POLYPHONIC_AFTERTOUCH INT8 INT8 { - $$ = 0; - } - ; - -controlmode_change: - CONTROLMODE_CHANGE INT8 INT8 { - $$ = 0; - } - ; - -program_change: - PROGRAM_CHANGE INT8 { - $$ = 0; - } - ; - -channel_aftertouch: - CHANNEL_AFTERTOUCH INT8 INT8 { - $$ = 0; - } - ; - -pitchwheel_range: - PITCHWHEEL_RANGE INT8 INT8 { - $$ = 0; - } - ; - -sysex_event: - SYSEX_EVENT1 DATA { - $$ = 0; - } - | SYSEX_EVENT2 DATA { // INT8 ? - $$ = 0; - } - ; diff --git a/src/midi-score.cc b/src/midi-score.cc deleted file mode 100644 index 02905b8718..0000000000 --- a/src/midi-score.cc +++ /dev/null @@ -1,63 +0,0 @@ -// -// midi-score.cc -- implement Midi_score -// -// copyright 1997 Jan Nieuwenhuizen - -#include "proto.hh" -#include "plist.hh" -#include "string.hh" -#include "moment.hh" -#include "duration.hh" -#include "source-file.hh" -#include "source.hh" -#include "midi-main.hh" // *tors -#include "midi-event.hh" -#include "lily-stream.hh" -#include "track-column.hh" -#include "midi-track.hh" -#include "midi-score.hh" - -Midi_score::Midi_score( int format_i, int tracks_i, int tempo_i ) -{ - format_i_ = format_i; - tracks_i_ = tracks_i; - tempo_i_ = tempo_i; -} - -Midi_score::~Midi_score() -{ -} - -void -Midi_score::add_track( Midi_track* midi_track_p ) -{ - midi_track_p_list_.bottom().add( midi_track_p ); -} - -int -Midi_score::output_mudela( String filename_str ) -{ - mtor << "Lily output to " << filename_str << " ..." << endl; - - Lily_stream lily_stream( filename_str ); - for ( PCursor midi_track_l_pcur( midi_track_p_list_.top() ); midi_track_l_pcur.ok(); midi_track_l_pcur++ ) { - midi_track_l_pcur->output_mudela( lily_stream ); - lily_stream << "\n"; - } - - lily_stream << "score {\n"; - - for ( PCursor midi_track_l_pcur( midi_track_p_list_.top() ); midi_track_l_pcur.ok(); midi_track_l_pcur++ ) { - lily_stream << "\tstaff { melodic music { "; - lily_stream << midi_track_l_pcur->name_str(); - lily_stream << " } }\n"; - } - - lily_stream << "\tcommands { meter { 4*4 } }\n"; - lily_stream << "\tmidi { tempo 4:60 }\n"; - - lily_stream << "}\n"; - - return 0; -} - diff --git a/src/midi-stream.cc b/src/midi-stream.cc deleted file mode 100644 index 3630831ac6..0000000000 --- a/src/midi-stream.cc +++ /dev/null @@ -1,89 +0,0 @@ -// -// midi-stream.cc -// -// source file of the LilyPond music typesetter -// -// (c) 1997 Jan Nieuwenhuizen - -#include -#include -#include "main.hh" -#include "misc.hh" -#include "midi-item.hh" -#include "midi-stream.hh" -#include "debug.hh" -#include "string-convert.hh" - -Midi_stream::Midi_stream( String filename_str, int tracks_i, int clocks_per_4_i ) -{ - filename_str_ = filename_str; - tracks_i_ = tracks_i; - clocks_per_4_i_ = clocks_per_4_i; - os_p_ = 0; - open(); - header(); -} - -Midi_stream::~Midi_stream() -{ - delete os_p_; -} - -Midi_stream& -Midi_stream::operator <<( String str ) -{ - // still debugging... - if ( check_debug ) - str = String_convert::bin2hex_str( str ); - // string now 1.0.26-2 handles binary streaming - *os_p_ << str; - return *this; -} - -Midi_stream& -Midi_stream::operator <<( Midi_item& mitem_r ) -{ - mitem_r.output_midi( *this ); - if ( check_debug ) - *os_p_ << "\n"; - return *this; -} - -Midi_stream& -Midi_stream::operator <<( int i ) -{ - // output binary string ourselves - *this << Midi_item::i2varint_str( i ); - return *this; -} - -void -Midi_stream::header() -{ -// *os_p_ << "% Creator: " << get_version(); -// *os_p_ << "% Automatically generated, at "; -// time_t t(time(0)); -// *os_p_ << ctime(&t); - -// 4D 54 68 64 MThd -// String str = "MThd"; -// 00 00 00 06 chunk length -// 00 01 format 1 -// 00 01 one track -// 00 60 96 per quarter-note - -// char const ch_c_l = "0000" "0006" "0001" "0001" "0060"; -// str += String_convert::hex2bin_str( ch_c_l ); -// *os_p_ << str; - -// *this << Midi_header( 1, 1, tempo_i_ ); - *this << Midi_header( 1, tracks_i_, clocks_per_4_i_ ); -} - -void -Midi_stream::open() -{ - os_p_ = new ofstream( filename_str_ ); - if ( !*os_p_ ) - error ("can't open `" + filename_str_ + "\'" ); -} diff --git a/src/midi-template.cc b/src/midi-template.cc deleted file mode 100644 index c2bfd01eaa..0000000000 --- a/src/midi-template.cc +++ /dev/null @@ -1,29 +0,0 @@ -// -// midi-template.cc -- implementemplate -// -// copyright 1997 Jan Nieuwenhuizen - -#include "list.tcc" -#include "cursor.tcc" - -L_instantiate(void *); - -class istream; -class ostream; -#include "proto.hh" -#include "plist.tcc" -#include "pcursor.tcc" -#include "string.hh" -#include "source-file.hh" - -#include "moment.hh" -#include "duration.hh" -#include "midi-event.hh" -#include "lily-stream.hh" -#include "track-column.hh" -#include "midi-track.hh" - -IPL_instantiate(Midi_event); -IPL_instantiate(Midi_track); -IPL_instantiate(Source_file); -IPL_instantiate(Track_column); diff --git a/src/midi-track.cc b/src/midi-track.cc deleted file mode 100644 index 6fccd518ec..0000000000 --- a/src/midi-track.cc +++ /dev/null @@ -1,84 +0,0 @@ -// -// midi-track.cc -- implement Midi_track -// -// copyright 1997 Jan Nieuwenhuizen - -#include "proto.hh" -#include "plist.hh" -#include "string.hh" -#include "source-file.hh" -#include "source.hh" -#include "midi-main.hh" // *tors - -#include "moment.hh" -#include "duration.hh" -#include "midi-event.hh" -#include "lily-stream.hh" -#include "track-column.hh" -#include "midi-track.hh" - -Midi_track::Midi_track( int track_i ) -{ - name_str_ = String( "track" ) + String( track_i ); - tcol_p_list_.bottom().add( new Track_column( Moment( 0 ) ) ); -} - -Midi_track::~Midi_track() -{ -} - -void -Midi_track::add_event( Moment mom, Midi_event* midi_event_p ) -{ - if ( ! midi_event_p ) - return; - tcol_l( mom - midi_event_p->mom() )->add_event( midi_event_p ); -} - -// too much red tape ? -String -Midi_track::name_str() -{ - return name_str_; -} - -void -Midi_track::output_mudela( Lily_stream& lily_stream_r ) -{ - lily_stream_r << name_str_ << " = music { $\n"; - lily_stream_r << "\t"; - int column_i = 8; - - for ( PCursor tcol_l_pcur( tcol_p_list_.top() ); tcol_l_pcur.ok(); tcol_l_pcur++ ) { - if ( tcol_l_pcur->midi_event_p_list_.size() > 1 ) - warning( "oeps, chord: can-t do that yet", 0 ); - if ( !tcol_l_pcur->midi_event_p_list_.size() ) - continue; - lily_stream_r << **tcol_l_pcur->midi_event_p_list_.top(); - column_i += tcol_l_pcur->midi_event_p_list_.top()->mudela_str().length_i(); - if ( column_i > 40 ) { - lily_stream_r << "\n\t"; - column_i = 8; - } - } - lily_stream_r << "\n$} % " << name_str_ << "\n"; -} - -Track_column* -Midi_track::tcol_l( Moment mom ) -{ - for ( PCursor tcol_l_pcur( tcol_p_list_.top() ); tcol_l_pcur.ok(); tcol_l_pcur++ ) { - if ( tcol_l_pcur->mom() == mom ) - return *tcol_l_pcur; - if ( tcol_l_pcur->mom() > mom ) { - Track_column* tcol_p = new Track_column( mom ); - tcol_l_pcur.insert( tcol_p ); - return tcol_p; - } - } - - Track_column* tcol_p = new Track_column( mom ); - tcol_p_list_.bottom().add( tcol_p ); - return tcol_p; -} - diff --git a/src/midi-walker.cc b/src/midi-walker.cc deleted file mode 100644 index 801ba32e12..0000000000 --- a/src/midi-walker.cc +++ /dev/null @@ -1,71 +0,0 @@ -/* - midi-walker.cc -- implement Midi_walker - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys , Jan Nieuwenhuizen -*/ - -#include "musicalrequest.hh" -#include "pscore.hh" -#include "staff.hh" -#include "midi-walker.hh" -#include "midi-item.hh" -#include "midi-stream.hh" -#include "debug.hh" -#include "staff-column.hh" - -Midi_walker::Midi_walker(Staff *st_l, Midi_track* track_l) - : PCursor(st_l->cols_) -{ - track_l_ = track_l; - last_moment_= 0; -} - -/** - output notestop events for all notes which end before #max_moment# - */ -void -Midi_walker::do_stop_notes(Moment max_moment) -{ - while (stop_notes.size() && stop_notes.front_idx() <= max_moment) { - Moment stop_moment = stop_notes.front_idx(); - Melodic_req * req_l = stop_notes.get(); - - Midi_note note(req_l, track_l_->number_i_, false); - output_event(note, stop_moment); - } -} -/** advance the track to #now#, output the item, and adjust current - "moment". */ -void -Midi_walker::output_event(Midi_item &i, Moment now) -{ - Moment delta_t = now - last_moment_ ; - last_moment_ += delta_t; - track_l_->add(delta_t, &i ); -} - -void -Midi_walker::process_requests() -{ - do_stop_notes(ptr()->when()); - for ( int i = 0; i < ptr()->musicalreq_l_arr_.size(); i++ ) { - - Rhythmic_req *n = ptr()->musicalreq_l_arr_[i]->rhythmic(); - if ( !n) - continue; - Note_req * note_l = n->note(); - if (!note_l) - continue; - - Midi_note note(note_l, track_l_->number_i_, true); - stop_notes.enter(note_l, n->duration() + ptr()->when() ); - output_event(note, ptr()->when()); - } -} - -Midi_walker::~Midi_walker() -{ - do_stop_notes( last_moment_ + Moment(10,1)); // ugh -} diff --git a/src/misc.cc b/src/misc.cc deleted file mode 100644 index 093af7f0d4..0000000000 --- a/src/misc.cc +++ /dev/null @@ -1,53 +0,0 @@ -#include - -#include "item.hh" -#include "misc.hh" -#include "glob.hh" -#include "moment.hh" - - -// depreciated, see struct Duration* -Moment -wholes(int dur, int dots) -{ - if (!dur) - return 0; - - Moment f = Rational(1)/Moment(dur); - Moment delta = f; - - while (dots--) { - delta /= 2.0; - f += delta; - } - return f; -} -int -intlog2(int d) { - int i=0; - while (!(d&1)) { - d/= 2; - i++; - } - assert(!(d/2)); - return i; -} - -double -log_2(double x) { - return log(x) /log(2.0); -} - -Interval -itemlist_width(const Array &its) -{ - Interval iv ; - iv.set_empty(); - - for (int j =0; j < its.size(); j++){ - iv.unite (its[j]->width()); - - } - return iv; -} - diff --git a/src/molecule.cc b/src/molecule.cc deleted file mode 100644 index c52fdc7b32..0000000000 --- a/src/molecule.cc +++ /dev/null @@ -1,146 +0,0 @@ -#include "varray.hh" -#include "interval.hh" -#include "dimen.hh" -#include "string.hh" -#include "molecule.hh" -#include "symbol.hh" -#include "debug.hh" -#include "tex.hh" - -void -Atom::print() const -{ - mtor << "texstring: " < a; - a.push(print_dimen(off.y)); - a.push(print_dimen(off.x)); - a.push(sym.tex); - return substitute_args(s, a); -} - -/* *************** */ - -String -Molecule::TeXstring() const -{ - String s; - for(iter_top(ats,c); c.ok(); c++) - s+=c->TeXstring(); - return s; -} - -Box -Molecule::extent() const -{ - Box b; - for(iter_top(ats,c); c.ok(); c++) - b.unite(c->extent()); - return b; -} - -void -Molecule::translate(Offset o) -{ - for (iter_top(ats,c); c.ok(); c++) - c->translate(o); -} - -void -Molecule::add(const Molecule &m) -{ - for (iter_top(m.ats,c); c.ok(); c++) { - add(**c); - } -} - -void -Molecule::add_right(const Molecule &m) -{ - if (!ats.size()) { - add(m); - return; - } - Real xof=extent().x.right - m.extent().x.left; - Molecule toadd(m); - toadd.translate(Offset(xof, 0.0)); - add(toadd); -} - -void -Molecule::add_left(const Molecule &m) -{ - if (!ats.size()) { - add(m); - return; - } - Real xof=extent().x.left - m.extent().x.right; - Molecule toadd(m); - toadd.translate(Offset(xof, 0.0)); - add(toadd); -} - - -void -Molecule::add_top(const Molecule &m) -{ - if (!ats.size()) { - add(m); - return; - } - Real yof=extent().y.right - m.extent().y.left; - Molecule toadd(m); - toadd.translate(Offset(0,yof)); - add(toadd); -} - -void -Molecule::add_bottom(const Molecule &m) -{ - if (!ats.size()) { - add(m); - return; - } - Real yof=extent().y.left- m.extent().y.right; - Molecule toadd(m); - toadd.translate(Offset(0,yof)); - add(toadd); -} - -void -Molecule::operator = (const Molecule&) -{ - assert(false); -} - -Molecule::Molecule(const Molecule&s) -{ - add(s); -} - -void -Molecule::print() const -{ - for (iter_top(ats,c); c.ok(); c++) - c->print(); -} diff --git a/src/my-midi-lexer.cc b/src/my-midi-lexer.cc deleted file mode 100644 index 4aa37d3146..0000000000 --- a/src/my-midi-lexer.cc +++ /dev/null @@ -1,81 +0,0 @@ -// -// my-midi-lexer.cc -- implement My_midi_lexer -// -// copyright 1997 Jan Nieuwenhuizen - -#include "debug.hh" -#include "input-file.hh" -#include "source-file.hh" -#include "my-midi-lexer.hh" - -int -yylex() -{ - return midi_lexer_l_g->yylex(); -} - -My_midi_lexer* midi_lexer_l_g; - -My_midi_lexer::My_midi_lexer( String filename_str ) -{ - input_file_p_ = new Input_file( filename_str ); - switch_streams( input_file_p_->is ); - midi_lexer_l_g = this; - errorlevel_i_ = 0; -} - -My_midi_lexer::~My_midi_lexer() -{ - delete input_file_p_; - midi_lexer_l_g = 0; -} - -void -My_midi_lexer::error( char const* sz_l ) -{ - if ( !input_file_p_ ) { -// *mlog << "error at EOF" << sz_l << '\n'; - cerr << "error at EOF" << sz_l << '\n'; - } else { - char const* ch_c_l = here_ch_c_l(); - if ( ch_c_l ) { - ch_c_l--; - while ( ( *ch_c_l == ' ' ) || ( *ch_c_l == '\t' ) || ( *ch_c_l == '\n' ) ) - ch_c_l--; - ch_c_l++; - } - errorlevel_i_ |= 1; -// ::error( sz_l, ch_c_l ); - ::error( sz_l, ch_c_l ); - } -} - -char const* -My_midi_lexer::here_ch_c_l() -{ - return input_file_p_->sourcefile_l_->ch_c_l() + yyin->tellg(); -} - -int -My_midi_lexer::varint2_i( String str ) -{ - int var_i = 0; - - for ( int i = 0; i < str.length_i(); i++ ) { - Byte byte = str[ i ]; - var_i <<= 7; - var_i += byte & 0x7f; - if ( ! ( byte & 0x80 ) ) - return var_i; - } - cout << "\nvarint2_i:" << String_convert::bin2hex_str( str ) << endl; - assert( 0 ); // illegal varint - return 0; -} - -int -My_midi_lexer::close_i() -{ - return 0; -} - diff --git a/src/my-midi-parser.cc b/src/my-midi-parser.cc deleted file mode 100644 index 31555f79af..0000000000 --- a/src/my-midi-parser.cc +++ /dev/null @@ -1,164 +0,0 @@ -// -// my-midi-parser.cc -- implement My_midi_parser -// -// copyright 1997 Jan Nieuwenhuizen - -#include "proto.hh" - -#include "plist.hh" // ugh -#include "string.hh" -#include "source-file.hh" -#include "source.hh" -#include "midi-main.hh" // *tors - -#include "my-midi-lexer.hh" -#include "my-midi-parser.hh" -#include "duration.hh" -#include "midi-event.hh" -#include "lily-stream.hh" -#include "track-column.hh" -#include "midi-track.hh" -#include "midi-score.hh" -#include "my-midi-lexer.hh" -#include "my-midi-parser.hh" - -void -yyerror(char const* sz_l ) -{ - midi_parser_l_g->error( sz_l ); -} - - -My_midi_parser* midi_parser_l_g; - -My_midi_parser::My_midi_parser( String filename_str ) -{ - midi_lexer_p_ = new My_midi_lexer( filename_str ); - midi_parser_l_g = this; - defined_ch_c_l_ = 0; - fatal_error_i_ = 0; - midi_key_p_ = 0; - midi_score_p_ = 0; - midi_tempo_p_ = 0; - midi_time_p_ = 0; - reset(); -} - -void -My_midi_parser::reset() -{ - delete midi_key_p_; - midi_key_p_ = new Midi_key( 0, 0 ); - // useconds per 4: 250000 === 60 4 per minute - delete midi_tempo_p_; - midi_tempo_p_ = new Midi_tempo( 250000 ); - delete midi_time_p_; - midi_time_p_ = new Midi_time( 4, 4, 384, 8 ); - - now_i64_ = 0; - - for ( int i = 0; i < CHANNELS_i; i++ ) - for ( int j = 0; j < PITCHES_i; j++ ) -// running_i64_i64_a_[ i ][ j ] = -1; - running_i64_i64_a_[ i ][ j ] = 0; -} - -My_midi_parser::~My_midi_parser() -{ - delete midi_lexer_p_; - midi_parser_l_g = 0; - delete midi_key_p_; - delete midi_tempo_p_; - delete midi_time_p_; - delete midi_score_p_; -} - -void -My_midi_parser::add_score( Midi_score* midi_score_p ) -{ - assert( !midi_score_p_ ); - midi_score_p_ = midi_score_p; -} - -void -My_midi_parser::error( char const* sz_l ) -{ - midi_lexer_l_g->error( sz_l ); - - if ( fatal_error_i_ ) - exit( fatal_error_i_ ); -} - -void -My_midi_parser::forward( int i ) -{ - now_i64_ += i; -} - -Moment -My_midi_parser::mom() -{ - return Duration_convert::i2_mom( now_i64_, division_1_i_ ); -} - -void -My_midi_parser::note_begin( int channel_i, int pitch_i, int dyn_i ) -{ - // one pitch a channel at time! - // heu, what about { < c2 > < c4 d4 > } -// assert( running_i64_i64_a_[ channel_i ][ pitch_i ] == -1 ); - running_i64_i64_a_[ channel_i ][ pitch_i ] = now_i64_; -} - -Midi_event* -My_midi_parser::note_end_midi_event_p( int channel_i, int pitch_i, int dyn_i ) -{ - Int64 start_i64 = running_i64_i64_a_[ channel_i ][ pitch_i ]; -// running_i64_i64_a_[ channel_i ][ pitch_i ] = -1; - // did we start? -// assert( start_i64 != -1 ); - return new Midi_note( midi_key_p_, midi_time_p_, division_1_i_, pitch_i, now_i64_ - start_i64 ); -} - -int -My_midi_parser::output_mudela( String filename_str ) -{ - assert( midi_score_p_ ); - return midi_score_p_->output_mudela( filename_str ); -} - -int -My_midi_parser::parse() -{ - return ::yyparse(); -} - -void -My_midi_parser::set_division_4( int division_4_i ) -{ - division_1_i_ = division_4_i * 4; - if ( division_4_i < 0 ) - warning( "seconds iso metrical time" , 0 ); -} - -void -My_midi_parser::set_key( int accidentals_i, int minor_i ) -{ - delete midi_key_p_; - midi_key_p_ = new Midi_key( accidentals_i, minor_i ); -} - -void -My_midi_parser::set_tempo( int useconds_i ) -{ - delete midi_tempo_p_; - midi_tempo_p_ = new Midi_tempo( useconds_i ); -} - -void -My_midi_parser::set_time( int num_i, int den_i, int clocks_i, int count_32_i ) -{ - delete midi_time_p_; - midi_time_p_ = new Midi_time( num_i, den_i, clocks_i, count_32_i ); -} - diff --git a/src/mylexer.cc b/src/mylexer.cc deleted file mode 100644 index 7da6dddec8..0000000000 --- a/src/mylexer.cc +++ /dev/null @@ -1,196 +0,0 @@ -#include - -#include "interval.hh" -#include "identparent.hh" -#include "assoc-iter.hh" -#include "lexer.hh" -#include "input-file.hh" -#include "parser.hh" -#include "keyword.hh" -#include "assoc.hh" -#include "lexer.hh" -#include "debug.hh" -#include "notename.hh" -#include "source-file.hh" -#include "parseconstruct.hh" - -static Keyword_ent the_key_tab[]={ - "bar", BAR, - "cadenza", CADENZA, - "clef", CLEF, - "cm", CM_T, - "command", COMMAND, - "commands", COMMANDS, - "duration", DURATIONCOMMAND, - "geometric", GEOMETRIC, - "goto", GOTO, - "in", IN_T, - "key", KEY, - "meter", METER, - "midi", MIDI, - "mm", MM_T, - "multivoice", MULTIVOICE, - "octave", OCTAVECOMMAND, - "output", OUTPUT, - "partial", PARTIAL, - "paper", PAPER, - "plet", PLET, - "pt", PT_T, - "score", SCORE, - "script", SCRIPT, - "skip", SKIP, - "staff", STAFF, - "start", START_T, - "stem", STEM, - "table", TABLE, - "symboltables", SYMBOLTABLES, - "notenames", NOTENAMES, - "tempo", TEMPO, - "texid", TEXID, - "textstyle", TEXTSTYLE, - "unitspace", UNITSPACE, - "voice", VOICE, - "voices", VOICES, - "width", WIDTH, - "music", MUSIC, - "grouping", GROUPING, - 0,0 -}; - -int -My_flex_lexer::ret_notename(int *p, String text, int octave_mod) -{ - text = text.lower_str(); - char const* ch_c_l = here_ch_c_l(); - if ( ch_c_l ) { - ch_c_l--; - while ( ( *ch_c_l == ' ' ) - || ( *ch_c_l == '\t' ) || ( *ch_c_l == '\n' ) ) - ch_c_l--; - ch_c_l++; - } - - lookup_notename(p[0], p[1], text); - p[2] = octave_mod; - mtor << "notename: "<< text <; - defaulttab = 0; - errorlevel_i_ = 0; -} - -int -My_flex_lexer::lookup_keyword(String s) -{ - return keytable->lookup(s); -} - -Identifier* -My_flex_lexer::lookup_identifier(String s) -{ - if (!the_id_tab->elt_query(s)) - return 0; - - return (*the_id_tab)[s]; -} - -char const* -My_flex_lexer::here_ch_c_l() -{ - return include_stack.top()->sourcefile_l_->ch_c_l() + yyin->tellg(); -} - -void -My_flex_lexer::add_identifier(Identifier*i) -{ - delete lookup_identifier(i->name); - (*the_id_tab)[i->name] = i; -} - -My_flex_lexer::~My_flex_lexer() -{ - delete keytable; - delete defaulttab; - for (Assoc_iter ai(*the_id_tab); ai.ok(); ai++) { - mtor << "deleting: " << ai.key()<<'\n'; - delete ai.val(); - } - delete the_id_tab; -} -void -My_flex_lexer::print_declarations()const -{ - for (Assoc_iter ai(*the_id_tab); ai.ok(); ai++) { - ai.val()->print(); - } -} - -String -My_flex_lexer::spot()const -{ - return include_stack.top()->name + ": " + String( lineno() ); -} - -void -My_flex_lexer::LexerError(const char *s) -{ - if (lexer->include_stack.empty()) { - *mlog << "error at EOF" << s << '\n'; - } else { - char const* ch_c_l = here_ch_c_l(); - if ( ch_c_l ) { - ch_c_l--; - while ( ( *ch_c_l == ' ' ) || ( *ch_c_l == '\t' ) || ( *ch_c_l == '\n' ) ) - ch_c_l--; - ch_c_l++; - } - errorlevel_i_ |= 1; - error( s, ch_c_l ); - } -} - -// set the new input to s, remember old file. -void -My_flex_lexer::new_input(String s) -{ - if (!include_stack.empty()) { - include_stack.top()->line = lineno(); - // should this be saved at all? - include_stack.top()->defined_ch_c_l_ = defined_ch_c_l; - } - - Input_file *newin = new Input_file(s); - include_stack.push(newin); - switch_streams(newin->is); - - yylineno = 1; -} - -// pop the inputstack. -bool -My_flex_lexer::close_input() -{ - Input_file *old = include_stack.pop(); - bool ok = true; - if (include_stack.empty()) { - ok = false; - } else { - Input_file *i = include_stack.top(); - switch_streams(i->is); - yylineno = i->line; - defined_ch_c_l = i->defined_ch_c_l_; - } - delete old; - return ok; -} diff --git a/src/note.cc b/src/note.cc deleted file mode 100644 index 496d892e5b..0000000000 --- a/src/note.cc +++ /dev/null @@ -1,321 +0,0 @@ -/* - could use cleanup - */ -#include -#include "lexer.hh" -#include "string.hh" -#include "real.hh" -#include "debug.hh" -#include "musicalrequest.hh" -#include "commandrequest.hh" -#include "voice.hh" -#include "notename.hh" -#include "identparent.hh" -#include "varray.hh" -#include "text-def.hh" -#include "parseconstruct.hh" -#include "input-music.hh" -#include "voice-element.hh" - -int default_duration = 4, default_dots=0, default_octave=0; -int default_plet_type = 1, default_plet_dur = 1; -String textstyle="roman"; // in lexer? - -bool last_duration_mode = false; - -void -set_duration_mode(String s) -{ - s = s.upper_str(); - last_duration_mode = (s== "LAST"); -} - -void -last_duration(int n) -{ - if (last_duration_mode) - default_duration = n; -} - -/* triplet is '2/3' */ -void -set_plet(int num,int den) -{ - assert(num >0&& den>0); - default_plet_dur = num; - default_plet_type = den; -} - -Text_def* -get_text(String s) return t; -{ - t= new Text_def; - t->text_str_= s; - t->style_str_ = textstyle; - t->defined_ch_c_l_ = defined_ch_c_l; - return t; -} - -void -set_text_style(String s) -{ - textstyle = s; -} - -void -parse_octave (const char *a, int &j, int &oct) -{ - while (1) - { - if (a[j] == '\'') - oct ++; - else if (a[j] == '`') - oct --; - else - break; - j++; - } -} - -void -parse_pitch( const char *a, Melodic_req* mel_l) -{ - int j=0; - - // octave - mel_l->octave_i_ = default_octave; - parse_octave(a,j,mel_l->octave_i_); - - // accidental - mel_l->forceacc_b_ = false; - - if (a[j] == '!'){ - mel_l->forceacc_b_ = true; - j++; - } -} - -Voice_element * -get_note_element(String pitch, int * notename, int * duration ) -{ - Voice_element*v = new Voice_element; - v->defined_ch_c_l_ = defined_ch_c_l; - - - int dur = duration[0]; - int dots = duration[1]; - - if (dur >= 2) { - Stem_req * stem_req_p = new Stem_req(dur,dots); - stem_req_p->plet_factor = Moment(default_plet_dur, default_plet_type); - stem_req_p->defined_ch_c_l_ = defined_ch_c_l; - v->add(stem_req_p); - } - - if ( !defined_ch_c_l ) - defined_ch_c_l = lexer->here_ch_c_l(); - - Note_req * rq = new Note_req; - rq->notename_i_ =notename[0]; - rq->accidental_i_ = notename[1]; - parse_pitch(pitch, rq); - rq->octave_i_ += notename[2]; - - rq->balltype = dur; - rq->dots = dots; - rq->plet_factor = Moment(default_plet_dur, default_plet_type); - rq->defined_ch_c_l_ = defined_ch_c_l; - - v->add(rq); - - return v; -} - -Voice_element* -get_word_element(Text_def* tdef_p, int* duration) -{ - Voice_element* velt_p = new Voice_element; - velt_p->defined_ch_c_l_ = defined_ch_c_l; - - int dur = duration[0]; - int dots=duration[1]; - - tdef_p->defined_ch_c_l_ = defined_ch_c_l; - - Lyric_req* lreq_p = new Lyric_req(tdef_p); - - lreq_p->balltype = dur; - lreq_p->dots = dots; - lreq_p->plet_factor = Moment(default_plet_dur, default_plet_type); - lreq_p->print(); - lreq_p->defined_ch_c_l_ = defined_ch_c_l; - - velt_p->add(lreq_p); - - return velt_p; -} - -Voice_element * -get_rest_element(String, int * duration ) -{ - Voice_element* velt_p = new Voice_element; - velt_p->defined_ch_c_l_ = defined_ch_c_l; - - Rest_req * rest_req_p = new Rest_req; - rest_req_p->plet_factor = Moment(default_plet_dur, default_plet_type); - rest_req_p->balltype = duration[0]; - rest_req_p->dots = duration[1]; - rest_req_p->print(); - rest_req_p->defined_ch_c_l_ = defined_ch_c_l; - - velt_p->add(rest_req_p); - - return velt_p; -} - -void -get_default_duration(int *p) -{ - *p++ = default_duration; - *p = default_dots; -} - -void -set_default_duration(int *p) -{ - default_duration = *p++; - default_dots = *p++; -} - - -void -set_default_octave(String d) -{ - int i=0; - default_octave=0; - parse_octave(d, i, default_octave); -} - -Request* -get_plet_request( char c, int dur_i, int type_i ) -{ - Plet_req* plet_req_p = new Plet_req; - plet_req_p->dur_i_ = dur_i; - plet_req_p->type_i_ = type_i; - plet_req_p->type_c_ = c; - return plet_req_p; -} - -Request* -get_request(char c) -{ - Request* req_p=0; - switch (c) { - case '|': - req_p = new Barcheck_req; - break; - - case '[': - case ']': - { - Beam_req*b = new Beam_req; - if (default_plet_type != 1) - b->nplet = default_plet_type; - req_p = b; - } - break; - - - case ')': - case '(': - req_p = new Slur_req; - break; - default: - assert(false); - break; - } - - switch (c) { - case '(': - case '[': - req_p->span()->spantype = Span_req::START; - break; - case ')': - case ']': - req_p->span()->spantype = Span_req::STOP; - break; - - default: - break; - } - - req_p->defined_ch_c_l_ = req_defined_ch_c_l; - return req_p; -} - -void -add_requests(Voice_element *v, Array &req) -{ - for (int i = 0; i < req.size(); i++) { - v->add(req[i]); - } - req.set_size(0); -} - -Script_def* -get_scriptdef(char c) -{ - String s; - switch (c) { - case '^' : s = "marcato"; - break; - case '+' : s = "stopped"; - break; - case '-' : s = "tenuto"; - break; - case '|': s = "staccatissimo"; - break; - case 'o' : s = ""; - break; - case '>' : s = "accent"; - break; - case 'v' : s = ""; - break; - case '.' : s = "staccato"; - break; - } - return lexer->lookup_identifier(s)->script(1); -} - -Request* -get_script_req(int d , Script_def*def) -{ - Script_req* script_req_p = new Script_req(d, def); - return script_req_p; -} - -Request* -get_text_req(int d , Text_def*def) -{ - Text_req* text_req_p = new Text_req(d, def); - return text_req_p; -} - -Request* -get_stemdir_req(int d) -{ - Group_feature_req * gfreq_p = new Group_feature_req; - gfreq_p->stemdir_i_ =d; - return gfreq_p; -} - -Request* -get_grouping_req(Array i_arr) -{ - Measure_grouping_req * mr_p = new Measure_grouping_req; - for (int i=0; i beat_i_arr_.push(i_arr[i++]); - mr_p->elt_length_arr_.push(Moment(1, i_arr[i++])); - } - return mr_p; -} diff --git a/src/notehead.cc b/src/notehead.cc deleted file mode 100644 index 722b231e68..0000000000 --- a/src/notehead.cc +++ /dev/null @@ -1,77 +0,0 @@ -#include "misc.hh" -#include "notehead.hh" -#include "dimen.hh" -#include "debug.hh" -#include "paper-def.hh" -#include "lookup.hh" -#include "molecule.hh" -#include "musicalrequest.hh" - - - -Notehead::Notehead(int ss) -{ - x_dir = 0; - staff_size=ss; - position = 0; - balltype = 0; - dots = 0; - extremal = 0; -} - -void -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 << "balltype "<< balltype << ", position = "<< position - << "dots " << dots; -#endif -} - - -int -Notehead::compare(Notehead *const &a, Notehead * const &b) -{ - return a->position - b->position; -} - -Molecule* -Notehead::brew_molecule_p() const return out; -{ - Paper_def *p = paper(); - - Real dy = p->internote(); - Symbol s = p->lookup_p_->ball(balltype); - - out = new Molecule(Atom(s)); - if (dots) { - Symbol d = p->lookup_p_->dots(dots); - Molecule dm; - dm.add(Atom(d)); - if (!(position %2)) - dm.translate(Offset(0,dy)); - out->add_right(dm); - } - out->translate(Offset(x_dir * p->note_width(),0)); - bool streepjes = (position<-1)||(position > staff_size+1); - if (streepjes) { - int dir = sign(position); - int s =(position<-1) ? -((-position)/2): (position-staff_size)/2; - Symbol str = p->lookup_p_->streepjes(s); - Molecule sm; - sm.add(Atom(str)); - if (position % 2) - sm.translate(Offset(0,-dy* dir)); - out->add(sm); - } - - out->translate(Offset(0,dy*position)); -} - diff --git a/src/notename.cc b/src/notename.cc deleted file mode 100644 index e6d62644b2..0000000000 --- a/src/notename.cc +++ /dev/null @@ -1,47 +0,0 @@ -#include "glob.hh" -#include "string.hh" -#include "notename.hh" -#include "lexer.hh" -#include "identifier.hh" - - - -void -Notename_tab::lookup(int &large, int &small, String s) -{ - large = -1; - small = 0; - - for (int i =0; i < 7*5; i++) - if (s == notetab[i]) - { - large = i /5; - small = i %5 - 2; - return; - } -} - - -void -Notename_tab::set(int l, int s, String n) -{ - assert(l < 8 && s <= 2 && s >= -2 && l >=0); - notetab[l * 5 + s +2] = n; -} -/* *************** */ -void -My_flex_lexer::set(Notename_tab *n) -{ - delete defaulttab; - defaulttab = n; -} - -void -My_flex_lexer::lookup_notename(int &large, int &small, String s) -{ - if (!defaulttab) - set(lookup_identifier("default_table")-> - notename_tab(true)); - - defaulttab->lookup(large, small, s); -} diff --git a/src/paper-def.cc b/src/paper-def.cc deleted file mode 100644 index b49a53fc8e..0000000000 --- a/src/paper-def.cc +++ /dev/null @@ -1,91 +0,0 @@ -#include -#include "misc.hh" -#include "paper-def.hh" -#include "debug.hh" -#include "lookup.hh" -#include "dimen.hh" - - - -// golden ratio -const Real PHI = (1+sqrt(5))/2; - -// see Roelofs, p. 57 -Real -Paper_def::duration_to_dist(Moment d) -{ - if (!d) - return 0; - - return whole_width * pow(geometric_, log_2(d)); -} - -Real -Paper_def::rule_thickness()const -{ - return 0.4 PT; -} - -Paper_def::Paper_def(Lookup *l) -{ - lookup_p_ = l; - linewidth = 15 *CM_TO_PT; // in cm for now - whole_width = 8 * note_width(); - geometric_ = sqrt(2); - outfile = "lelie.out"; -} - -Paper_def::~Paper_def() -{ - delete lookup_p_; -} -Paper_def::Paper_def(Paper_def const&s) -{ - lookup_p_ = new Lookup(*s.lookup_p_); - geometric_ = s.geometric_; - whole_width = s.whole_width; - outfile = s.outfile; - linewidth = s.linewidth; -} - -void -Paper_def::set(Lookup*l) -{ - assert(l != lookup_p_); - delete lookup_p_; - lookup_p_ = l; -} - -Real -Paper_def::interline() const -{ - return lookup_p_->ball(4).dim.y.length(); -} - -Real -Paper_def::internote() const -{ - return lookup_p_->internote(); -} -Real -Paper_def::note_width()const -{ - return lookup_p_->ball(4).dim.x.length( ); -} -Real -Paper_def::standard_height() const -{ - return 20 PT; -} - -void -Paper_def::print() const -{ -#ifndef NPRINT - mtor << "Paper {width: " << print_dimen(linewidth); - mtor << "whole: " << print_dimen(whole_width); - mtor << "out: " <print(); - mtor << "}\n"; -#endif -} diff --git a/src/parser.y b/src/parser.y deleted file mode 100644 index 08ea828119..0000000000 --- a/src/parser.y +++ /dev/null @@ -1,832 +0,0 @@ -%{ // -*-Fundamental-*- -#include - -#include "lookup.hh" -#include "misc.hh" -#include "lexer.hh" -#include "paper-def.hh" -#include "midi-def.hh" -#include "input-score.hh" -#include "main.hh" -#include "keyword.hh" -#include "debug.hh" -#include "parseconstruct.hh" -#include "dimen.hh" -#include "identifier.hh" -#include "commandrequest.hh" -#include "musicalrequest.hh" -#include "voice-element.hh" - -#ifndef NDEBUG -#define YYDEBUG 1 -#endif - -Array pre_reqs, post_reqs; -Array define_spots; -Paper_def*default_paper(); -char const* defined_ch_c_l; -char const* req_defined_ch_c_l; -int fatal_error_i = 0; - -%} - - -%union { - Request * request; - Real real; - Identifier *id; - Voice *voice; - Voice_element *el; - String *string; - const char *consstr; - Paper_def *paper; - Midi_def* midi; - Input_music *music; - Music_general_chord *chord; - Music_voice *mvoice; - int i; - char c; - int ii[10]; - Moment *moment; - - Array * strvec; - Array *intvec; - Array *melreqvec; - Input_staff *staff; - Input_score *score; - Symtables * symtables; - Symtable * symtable; - Symbol * symbol; - Lookup*lookup; - Interval *interval; - Box *box; - Notename_tab *notename_tab; - Script_def * script; - Text_def * textdef; -} - -%token VOICE STAFF SCORE TITLE BAR OUTPUT MULTIVOICE -%token CM_T IN_T PT_T MM_T PAPER WIDTH METER UNITSPACE SKIP COMMANDS COMMAND -%token GEOMETRIC START_T DURATIONCOMMAND OCTAVECOMMAND -%token KEY CLEF TABLE VOICES STEM -%token PARTIAL MUSIC GROUPING CADENZA -%token END SYMBOLTABLES TEXID TABLE NOTENAMES SCRIPT TEXTSTYLE PLET -%token GOTO -%token MIDI TEMPO - -%token IDENTIFIER -%token PITCHMOD DURATION RESTNAME -%token NOTENAME -%token REAL -%token STRING - -%token DOTS INT -%type unit -%type pitch_list -%type open_request_parens close_request_parens close_plet_parens -%type declaration -%type declarable_identifier -%type paper_block paper_body -%type midi_block midi_body -%type dim real -%type default_duration explicit_duration notemode_duration mudela_duration -%type notename -%type duration_length -%type voice_elt full_element lyrics_elt command_elt - -%type score_block score_body -%type staff_block staff_init staff_body -%type int -%type intastint_list -%type post_request pre_request command_req -%type pitchmod -%type music -%type music_chord music_chord_body - -%type music_voice_body music_voice - -%type dinterval -%type box -%type symtable symtable_body -%type symtables symtables_body -%type symboldef -%type notename_tab notename_tab_body -%type script_dir -%type