]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 0.0.30 release/0.0.30
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 12 Feb 1997 09:27:36 +0000 (10:27 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 12 Feb 1997 09:27:36 +0000 (10:27 +0100)
189 files changed:
Documentation/CodingStyle.pod
Documentation/README.pod
Documentation/error.pod
Documentation/lilyinput.pod
Makefile
NEWS
Sources.make
TODO
Variables.make
clearlily
configure
flower/Makefile
flower/NEWS
flower/Variables.make
flower/assoc.hh
flower/associter.hh
flower/choleski.hh
flower/compare.hh
flower/cursor.hh
flower/cursor.inl
flower/dataf.cc
flower/dstream.cc
flower/dstream.hh
flower/interval.hh
flower/lgetopt.hh
flower/list.hh
flower/matrix.hh
flower/path.cc
flower/path.hh
flower/pcursor.hh
flower/plist.hh
flower/scalar.hh
flower/smat.cc
flower/string.hh
flower/stringutil.hh
flower/textdb.hh
flower/textstr.hh
flower/tvsmat.hh
flower/varray.hh
flower/vector.hh
flower/vsmat.hh
genheader
hdr/beam.hh
hdr/break.hh
hdr/clef.hh
hdr/clefitem.hh
hdr/colhpos.hh
hdr/command.hh
hdr/complexcolumn.hh [new file with mode: 0644]
hdr/complexstaff.hh
hdr/complexwalker.hh
hdr/dimen.hh
hdr/directionalspanner.hh
hdr/grouping.hh
hdr/headreg.hh [new file with mode: 0644]
hdr/inputcommands.hh
hdr/inputmusic.hh
hdr/inputscore.hh
hdr/inputstaff.hh
hdr/item.hh
hdr/key.hh
hdr/keyitem.hh
hdr/lexer.hh
hdr/linepstaff.hh [deleted file]
hdr/linespace.hh
hdr/localkeyitem.hh
hdr/localkeyreg.hh [new file with mode: 0644]
hdr/lookup.hh
hdr/lyriccolumn.hh
hdr/lyricitem.hh
hdr/lyricstaff.hh
hdr/lyricwalker.hh
hdr/melodicstaff.hh [deleted file]
hdr/meter.hh
hdr/molecule.hh
hdr/notehead.hh
hdr/paper.hh
hdr/pcol.hh
hdr/proto.hh
hdr/pscore.hh
hdr/pstaff.hh
hdr/qlp.hh
hdr/qlpsolve.hh
hdr/register.hh
hdr/request.hh
hdr/rest.hh
hdr/rhythmstaff.hh [deleted file]
hdr/sccol.hh
hdr/score.hh
hdr/scoreline.hh
hdr/script.hh
hdr/scriptdef.hh
hdr/scriptreg.hh [new file with mode: 0644]
hdr/simplestaff.hh [deleted file]
hdr/simplewalker.hh [deleted file]
hdr/slur.hh
hdr/slurreg.hh [new file with mode: 0644]
hdr/sourcefile.hh
hdr/spanner.hh
hdr/staff.hh
hdr/staffcommands.hh
hdr/staffelem.hh
hdr/staffline.hh
hdr/staffsym.hh [new file with mode: 0644]
hdr/staffwalker.hh
hdr/stcol.hh
hdr/stem.hh
hdr/stembeamreg.hh [new file with mode: 0644]
hdr/tex.hh
hdr/textdef.hh
hdr/textitem.hh
hdr/textreg.hh [new file with mode: 0644]
hdr/textspanner.hh
hdr/timedescription.hh
hdr/tstream.hh
hdr/voice.hh
hdr/voicegroup.hh
init/table_sixteen.ini
input/error.ly
input/maartje.ly
input/scsii-menuetto.ly
input/wohltemperirt.ly
lilyponddefs.tex
src/beam.cc
src/calcideal.cc
src/clef.cc
src/clefitem.cc
src/complexprint.cc
src/complexstaff.cc
src/complexwalker.cc
src/dimen.cc
src/directionalspanner.cc
src/groupregs.cc
src/headreg.cc [new file with mode: 0644]
src/inputcommands.cc
src/inputmusic.cc
src/inputscore.cc
src/inputstaff.cc
src/keyitem.cc
src/lexer.l
src/linepstaff.cc [deleted file]
src/linespace.cc
src/localkeyitem.cc
src/localkeyreg.cc [new file with mode: 0644]
src/lookup.cc
src/lyriccolumn.cc
src/lyricstaff.cc
src/lyricwalker.cc
src/melodicstaff.cc [deleted file]
src/molecule.cc
src/mylexer.cc
src/note.cc
src/notehead.cc
src/notename.cc
src/paper.cc
src/parser.y
src/pscore.cc
src/pstaff.cc
src/qlp.cc
src/qlpsolve.cc
src/register.cc
src/request.cc
src/rhythmstaff.cc [deleted file]
src/sccol.cc
src/score.cc
src/scriptdef.cc
src/scriptreg.cc [new file with mode: 0644]
src/simpleprint.cc [deleted file]
src/simplestaff.cc [deleted file]
src/simplewalker.cc [deleted file]
src/slur.cc
src/slurreg.cc [new file with mode: 0644]
src/sourcefile.cc
src/spanner.cc
src/staff.cc
src/staffline.cc
src/staffsym.cc [new file with mode: 0644]
src/staffwalker.cc
src/stcol.cc
src/stembeamreg.cc [new file with mode: 0644]
src/texbeam.cc
src/texslur.cc
src/textreg.cc [new file with mode: 0644]
src/textspanner.cc
src/tstream.cc
src/voice.cc
src/voicegroup.cc
src/voiceregs.cc
src/wordwrap.cc

index 460935f859cab1a3a64e64636be460fd3293651c..2b86193338b7ad38209442f2f0df23a32f14b79c 100644 (file)
@@ -40,23 +40,23 @@ the C<type> is a Hungarian notation postfix for $C<Type>$.
 =head2 COMMENTS
 
 The source is commented in the DOC++ style.  Check out doc++ at
-F<http://www.ZIB-Berlin.DE/VisPar/doc++/doc++.html>
+http://www.zib.de/Visual/software/doc++/index.html
 
        /// short description
        class Class {
-               ///
-               Data data_member_;
+               /// short description
                /**
-                       ..
+                       long description
                */
 
+               Data data_member_;
                /****************/
 
                /// short memo
-               member();
                /**
                        long doco of member()
                */
+               member();
        };
        /**
                Class documentation.
index 973bab25c1da95d5b25a5bcec8644770a5650e25..d8f0d1eae778eca5e0316646f65dc9f1e3f1d55a 100644 (file)
@@ -25,7 +25,7 @@ customizable notenames, customizable fontset
 multiple staffs in one score
 
 =item *
-multiple stafftypes (melodic, rhythmic)
+multiple stafftypes (melodic, rhythmic) [broken from  pl28 on]
 
 =item *
 beams, slurs, chords, super/subscripts (accents and text),
@@ -43,7 +43,6 @@ a different file.
 clef changes, meter changes, cadenza-mode, declaring markings
 in the music, repeat bars
 
-
 =back
 
 =head1 DESIGN CONSIDERATIONS
@@ -258,9 +257,8 @@ coding C++
 
 =head1 EXAMPLES
 
-At this time, LilyPond is only suited for Quick & Dirty jobs (the
-output quality of multistaff material still is too low). If you're not
-discouraged; this is what I type in my xterm:
+At this time, LilyPond output looks nice, but is not of production
+quality. If you're not discouraged; this is what I type in my xterm:
 
        lilypond someinput.ly
        tex test
index 1888beaf98cbeca1594431d1055e0673dbc2a14f..0a73c5b627ba9001788aee9489de23dd14eb4c9e 100644 (file)
@@ -10,6 +10,8 @@ A correctly parsed F<input.ly> does not guarantuee output. A lot
 (most) of the checking is done B<after> parsing (some checks even are
 done after the break calc!); I'm sorry.
 
+[outdated]
+
 The parser's job is to construct appropriate objects. It will B<only>
 detect parse errors.
 
index 6e086690716801b831a307f7295113936c5c5619..dfdd59794832ec97a7b3c6f41a545bd67e316efe 100644 (file)
@@ -39,7 +39,7 @@ than in "command" mode, eg,
 
        identifier = score { .. }
 
-So you have to signal that to the tokenizer. This is done with
+So you have to signal this to the tokenizer. This is done with
 '$'. '$' is a delimiter, which used by the tokenizer only. The same
 goes for lyrics, it has a '@' delimiter.
 
index 10ad8c1642fd81fb2f7248f877002dc001955e5e..7af694d132eecc3397b107daf6cedff27495439b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ $(exe): $(obs)
        $(CXX) -o $@ $^ $(LOADLIBES)
 
 
-.PHONY: clean
+.PHONY: clean docxx
 
 clean:
        rm -f $(exe) $(DOCDIR)/* core $(obs) $(ALLDEPS)
@@ -30,9 +30,8 @@ doc:
        $(MAKE) -C Documentation doc
 
 # doc++ documentation of classes
-docpp: $(progdocs)
-       -mkdir $(DOCDIR)
-       doc++ -p -I -d $(DOCDIR) $^
+docxx: $(progdocs)     
+       doc++ -p -d $(DOCDIR) $^
 
 $(OBJECTDIR)/%.o: $(CCDIR)/%.cc
        $(DODEP)\
diff --git a/NEWS b/NEWS
index 932246fcb996871212198d939e562306601c19e8..0646a2661dfd79318f529327b3d7563908d90e32 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,27 @@
+pl 30
+
+Features
+       - better multivoice spacing
+       - move rest in multivoice staff
+       - errors in TeX output now warnings
+       - progress indicator
+       - music processing speedup.
+Internal
+       - make spanner for staffsym; scrap Line_pstaff
+       - scrap simplestaff (Rhythmic_staff temporarily disabled)
+       - docxx 3.0 format comments
+       - split register source files
+       - hardcoded dimensions compile time
+       - Lookup::tex_hairpin
+Bugs
+       - non G-clef clefs
+       - script junking (2x)
+       - empty files
+       - beam::center (plet position!)
+       
 pl 29
-       - multiplatform Makefile
-       - context errors: bugfixes
+       - multiplatform Makefile (JN)
+       - context errors: bugfixes (JN)
 
 pl 28
 
@@ -9,8 +30,8 @@ Internal
 Doc
        - Request_register
 Bugfix
-       - Script.cc : float exception
-       - Request::Request(Request) copying of definition pointer
+       - Script.cc : float exception (MB)
+       - Request::Request(Request) copying of definition pointer (JN)
        - cleaned dependencies for broken spanners
        - stupid typo in Staff_elem::post_processing()
        - init of hpos in PCol::PCol
index c40a11e55fbd6528bc3d5ef9557bcd6737999119..e7e7a22782eeceeae3f1822b72da4cc243b5bebf 100644 (file)
@@ -2,47 +2,55 @@
 # sourcefiles to be shipped. Also for dependencies
 
 hdr=   bar.hh beam.hh boxes.hh break.hh clef.hh clefitem.hh\
-       colhpos.hh command.hh complexwalker.hh complexstaff.hh\
+       colhpos.hh command.hh  complexcolumn.hh \
+       complexwalker.hh complexstaff.hh\
        const.hh debug.hh dimen.hh directionalspanner.hh\
-       getcommand.hh glob.hh  grouping.hh idealspacing.hh\
+       getcommand.hh glob.hh  grouping.hh headreg.hh idealspacing.hh\
        identifier.hh identparent.hh inputcommand.hh inputcommands.hh\
        inputmusic.hh inputscore.hh inputstaff.hh item.hh key.hh keyitem.hh\
-       keyword.hh leastsquares.hh lexer.hh linespace.hh linepstaff.hh\
-       localkeyitem.hh lookup.hh \
+       keyword.hh leastsquares.hh lexer.hh linespace.hh \
+       localkeyitem.hh localkeyreg.hh lookup.hh \
        lyriccolumn.hh  lyricitem.hh lyricstaff.hh lyricwalker.hh\
-       main.hh melodicstaff.hh meter.hh misc.hh\
+       main.hh  meter.hh misc.hh\
        molecule.hh moment.hh notehead.hh notename.hh offset.hh paper.hh\
        parseconstruct.hh pcol.hh proto.hh pscore.hh pstaff.hh qlp.hh\
-       qlpsolve.hh register.hh request.hh rest.hh rhythmstaff.hh\
+       qlpsolve.hh register.hh request.hh rest.hh \
        sccol.hh score.hh\
-       scoreline.hh script.hh scriptdef.hh simplestaff.hh simplewalker.hh\
-       slur.hh source.hh sourcefile.hh spanner.hh staff.hh staffcommands.hh\
-       staffelem.hh staffline.hh\
+       scoreline.hh script.hh scriptdef.hh scriptreg.hh \
+       slur.hh slurreg.hh source.hh sourcefile.hh\
+       spanner.hh staff.hh staffcommands.hh\
+       staffelem.hh staffline.hh staffsym.hh stembeamreg.hh\
        stcol.hh stem.hh staffwalker.hh symbol.hh symtable.hh\
-       tex.hh textdef.hh\
-       textitem.hh textspanner.hh timedescription.hh tstream.hh voice.hh\
+       tex.hh textdef.hh \
+       textitem.hh textreg.hh textspanner.hh timedescription.hh \
+       tstream.hh voice.hh\
        voicegroup.hh
 
 mycc=bar.cc beam.cc boxes.cc break.cc calcideal.cc clef.cc\
-       clefitem.cc colhpos.cc command.cc complexstaff.cc complexwalker.cc \
-        complexprint.cc debug.cc dimen.cc\
+       clefitem.cc colhpos.cc command.cc\
+       complexstaff.cc complexwalker.cc \
+       complexprint.cc debug.cc dimen.cc\
        directionalspanner.cc\
-       getcommands.cc grouping.cc groupregs.cc idealspacing.cc identifier.cc\
+       getcommands.cc grouping.cc groupregs.cc headreg.cc\
+       idealspacing.cc identifier.cc\
        inputcommand.cc inputcommands.cc inputmusic.cc inputscore.cc\
        inputstaff.cc item.cc key.cc keyitem.cc keyword.cc\
-       leastsquares.cc lexerinit.cc linespace.cc linepstaff.cc\
-       localkeyitem.cc lookup.cc\
+       leastsquares.cc lexerinit.cc linespace.cc \
+       localkeyitem.cc localkeyreg.cc lookup.cc\
        lyriccolumn.cc lyricitem.cc lyricstaff.cc lyricwalker.cc\
-       main.cc melodicstaff.cc meter.cc\
-       misc.cc molecule.cc mylexer.cc note.cc notehead.cc notename.cc\
+       main.cc  meter.cc\
+       misc.cc molecule.cc mylexer.cc note.cc notehead.cc  notename.cc\
        paper.cc pcol.cc pscore.cc pstaff.cc qlp.cc qlpsolve.cc\
-       register.cc request.cc rest.cc rhythmstaff.cc sccol.cc score.cc\
-       scoreline.cc scores.cc script.cc scriptdef.cc simpleprint.cc\
-       simplestaff.cc simplewalker.cc slur.cc source.cc sourcefile.cc\
+       register.cc request.cc rest.cc  sccol.cc score.cc\
+       scoreline.cc scores.cc script.cc scriptdef.cc scriptreg.cc \
+        slur.cc\
+       slurreg.cc source.cc sourcefile.cc\
        spanner.cc staff.cc\
-       staffcommands.cc staffelem.cc staffline.cc stcol.cc stem.cc\
+       staffcommands.cc staffelem.cc staffline.cc staffsym.cc\
+       stembeamreg.cc\
+       stcol.cc stem.cc\
        staffwalker.cc symbol.cc symtable.cc  tex.cc texbeam.cc\
-       texslur.cc textdef.cc textitem.cc textspanner.cc\
+       texslur.cc textdef.cc textitem.cc textreg.cc textspanner.cc\
        timedescription.cc tstream.cc voice.cc voiceregs.cc voicegroup.cc\
        warn.cc windhoos-suck-suck-suck-thank-you-cygnus.cc wordwrap.cc\
        template1.cc template2.cc template3.cc template4.cc\
diff --git a/TODO b/TODO
index a931f47d05d5458d61ec1aa18d460e67360a4ef9..44068657a7177b73dced4765fdae983dc282031c 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,19 +1,19 @@
-
-       ./input/standchen.ly.rej
-
-       ./src/stem.cc.rej
-
-       * scrap simplestaff
+This is an assorted collection of stuff that will be done, might be
+done, or is an idea that I want to think about
 
 BUGS
        * first clef isn't printed
 
-       * accidental placement for other clefs
+       * key undo
+
+       * key print if 
 
 SEVERELY LACKING:
 
        * grace notes
 
+       * dynamics (hairpins) 
+
 INPUTLANGUAGE
 
        * lose the $ and @ ?
@@ -26,12 +26,11 @@ INPUTLANGUAGE
 
 SMALLISH PROJECTS
 
+       * binsearch for notenames
+
        * stafftypes: voice names/ instrument names.
 
-       * make spanner for staffsym
-       
-       * Lookup::tex_glissando, Lookup::tex_bracket,
-       Lookup::tex_cresc, Lookup::tex_decresc (use texbeam.cc as an
+       * Lookup::tex_glissando, Lookup::tex_bracket,  (use texbeam.cc as an
        example.)
 
        * Decent TeX titledefs (\tempo, \metron, etc. )
@@ -64,11 +63,12 @@ DOC
 
        * beam generation.
 
-
        * all errors
 
 FUTURE
 
+       * warning: beam(): Beam too narrow: beam gen not per stem
+
        * put scripts on barcommands 
 
        * glissando
@@ -95,9 +95,6 @@ IDEAS
 
        * itemcolumns
 
-       * dependencies: -> implement children more elegantly. Handle
-       spanner with broken deps.
-
        * use an embedded language: scheme, lisp, S-lang, Perl, ?
 
        * y -dims in internote?
@@ -113,7 +110,7 @@ IDEAS
 
        * Spacing_request for manually adjusting spacing
 
-       * Staff_group.
+       * Staff_group, Score_request_register.
 
        * SHIT: meters/bars should be aligned, which is difficult if
        we get different keychanges in different staffs.
@@ -123,3 +120,5 @@ IDEAS
        * MusixTeX output possible?
 
        * PostScript output (esp. Beams, Slurs, etc)
+
+       * caching breakpoints
\ No newline at end of file
index c53033674cc3810022852d14ac1f4aa303540627..38280146fd2dc66dea5b4c60b50de2a4453f537e 100644 (file)
@@ -1,8 +1,12 @@
+# -*-make-*-
+
 # version info
 MAJVER=0
 MINVER=0
-PATCHLEVEL=29
+PATCHLEVEL=30
+
 include Site.make
+
 ####
 #### USER CONFIGURABLE
 ####
@@ -23,7 +27,8 @@ EXTRACXXFLAGS=-pipe -Wall -W   -Wmissing-prototypes
 # ElectricFence is a memory debugger which uses the 
 # VM hardware to trap malloc/free errors.
 #
-#EXTRALIB+=-lefence
+
+EXTRALIB= #+=-lefence
 
 ####
 #### END USER CONFIGURABLE part.
@@ -47,18 +52,13 @@ CXXVER=`$(CXX) --version`
 
 # directories
 TOPDIR  := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
+
 OBJECTDIR=objects
 HEADERDIR=hdr
 CCDIR=src
 INITDIR=init
 DEPDIR=deps
 INPUTDIR=input
-#vpath %.cc $(CCDIR)
-#vpath %.hh $(HEADERDIR)
-#vpath %.y $(CCDIR)
-#vpath %.l $(CCDIR)
-#vpath %.o $(OBJECTDIR)
-#vpath %.dep $(DEPDIR)
 
 # 
 #
@@ -71,11 +71,12 @@ obs=$(addprefix $(OBJECTDIR)/,$(cc:.cc=.o))
 ALLDEPS=$(addprefix $(DEPDIR)/,$(cc:.cc=.dep))
 STABLEOBS=$(addprefix $(OBJECTDIR)/,$(stablecc:.cc=.o)) 
 HEADERS=$(addprefix $(HEADERDIR)/,$(hdr)) 
-progdocs=$(HEADERS) $(addprefix $(CCDIR)/, $(mycc))
+progdocs=$(HEADERS) #$(CCSOURCE)
+
 #dist
 .EXPORT_ALL_VARIABLES:
 
-DOCDIR=docdir
+DOCDIR=docxx
 
 PACKAGENAME=lilypond
 DNAME=$(PACKAGENAME)-$(VERSION)
index 40b79c3aaae41dddcc43dacf4fe472e5480c7a29..983454dad3ac2eebac5ac4d17e7471ec5242dda0 100755 (executable)
--- a/clearlily
+++ b/clearlily
@@ -1,4 +1,8 @@
 #!/bin/sh
 
 # unclobber current dir.
-rm -v *.aux *.log `grep -li "^% Creator: LilyPond" *.out *.uit` *.orig *~
+rm -vf *.aux *.log `grep -li "^% Creator: LilyPond" *.out` *.orig *~
+
+# docxx mess
+rm -vf *.class  HIER*.html dxxgifs.tex gifs.db icon?.gif logo.gif down.gif \
+    aindex.html index.html
index 6ecf9b11043ace96008bf891c461cf8f310002a2..2857ad2aa4ee85a66ac059fb273620d179c6c171 100755 (executable)
--- a/configure
+++ b/configure
@@ -3,7 +3,7 @@
 PREFIX=${PREFIX:-.}
 echo using PREFIX=$PREFIX
 
-NEEDFLOWERVER=1.0.25
+NEEDFLOWERVER=1.0.26
 flowertar=flower-$NEEDFLOWERVER
 here=`pwd`
 cd ..
index 1b8b0013f8ecfc61b0056b987662007c0075cfee..9c692641150bde2f5e9c4bec672a6021d00d8db6 100644 (file)
@@ -17,6 +17,10 @@ realclean: clean
 fversion.hh: Variables.make make_version
        make_version $(MAJVER) $(MINVER) $(PATCHLEVEL) "$(CXX) `$(CXXVER)`" > $@
 
+.PHONY: docxx
+docxx: $(hh) $(cc) $(templatecc) $(inl)
+       -mkdir docxx
+       doc++ -p -d docxx $(hh) $(cc) $(templatecc) $(inl)
 
 dist:
        -mkdir $(DDIR)
index aac5b758ffcc954869628fce47237d7187f4eb1d..6f4fd129cd2aaaa005a5a48ef64726926e8c1dd4 100644 (file)
@@ -1,9 +1,14 @@
+pl 26
+       - docxx 3.0
 
 pl 25
        - merge sstack and Array
+
 pl 24
        - small fix in vector print
+
 pl 23
        - win32 patches (JN)
+
 pl 22
        - Array::add -> Array::push
\ No newline at end of file
index 90d8cc8dc6a5eddba64d59c889fc62b9351e0719..0dc6c79705610f0195050e2c525070d88ce71c06 100644 (file)
@@ -1,6 +1,7 @@
 MAJVER=1
 MINVER=0
-PATCHLEVEL=25
+PATCHLEVEL=26
+
 PACKAGENAME=flower
 
 #PROFILEFLAG=-pg
index 4e0594519f631c5b4c59b528f010623194ca34ba..154a0242a22749c3ec7494d432168cfad114b332 100644 (file)
@@ -12,11 +12,13 @@ struct Assoc_ent_ {
 };
 
 /// hungarian: map
+/** mindblowingly stupid Associative array implementation
+ */
 template<class K, class V>
 struct Assoc {
     Array< Assoc_ent_<K,V> > arr;
 
-    /****************/
+    /* ************** */
     
     int find(K key) const {
        for (int i = 0; i < arr.size(); i++) {
@@ -60,7 +62,7 @@ public:
        int i = find_creat(key);
        arr[i].val = val;
     }
-    /**
+    /*
     should create "set" template
     */
     V& operator[](K key) {
@@ -71,7 +73,5 @@ public:
        return arr[find(key)].val;
     }
 };
-/** mindblowingly stupid Associative array implementation
- */
 
 #endif
index bb312b8e9e1df5c94980c817e5e7492b5e76e85d..34b88df22d005f302072a3bb2d470daecb44cd0c 100644 (file)
@@ -35,8 +35,5 @@ struct Assoc_iter {
     K key() { return assoc_.arr[i].key; }
     V &val() { return assoc_.arr[i].val; }    
 };
-/*
-  Iterator
- */
 
 #endif
index c6cb91723be6651b93827d351cad814ac24a5159..14cf5e2326d8f4bbdf2fae00faaa87d13921a70d 100644 (file)
@@ -3,6 +3,13 @@
 
 #include "matrix.hh"
 
+/**
+    structure for using the LU decomposition of a positive definite .
+
+    #P# is split  into
+
+    LD transpose(L)
+    */
 struct Choleski_decomposition {
 
     /// lower triangle of Choleski decomposition
@@ -11,36 +18,27 @@ struct Choleski_decomposition {
     /// diagonal 
     Vector D;
     ///Create decomposition of P
-    Choleski_decomposition(Matrix P);
     /**
     PRE
     P needs to be symmetric positive definite
     */
     
+    Choleski_decomposition(Matrix P);
     Vector solve(Vector rhs) const;
-    Vector operator * (Vector rhs) const { return solve (rhs); }
-    /**
+        /**
     solve Px = rhs
     */
-
-    Matrix inverse() const;
-    /**
+Vector operator * (Vector rhs) const { return solve (rhs); }
+  /**
     return the inverse of the matrix P.
     */
 
-    Matrix original() const;
+    Matrix inverse() const;
     /**
     return P,  calc'ed from L and D
     */
+    Matrix original() const;
+  
         
 };
-/**
-    structure for using the LU decomposition of a positive definite .
-
-    #P# is split  into
-
-    LD transpose(L)
-    */
-    
-
 #endif
index f0e886e539a6a8692f197f3a941f04afd492884e..30a1998ad34671935bacd51d834abeb8e617c207 100644 (file)
@@ -29,6 +29,10 @@ operator op(type t1, type t2)\
 #endif
 
 /// handy notations for a signed comparison
+/**
+    make the operators{<,<=,==,>=,>} and the MAX and MIN of two.
+    Please fill a & in the type argument if necessary.    
+    */
 #define template_instantiate_compare(type, function, prefix) \
 prefix one_operator(type, function, >)\
 prefix one_operator(type, function, >=)\
@@ -41,10 +45,6 @@ prefix inline type max(type t1, type t2) {  return (t1 > t2 )? t1 : t2; }\
 prefix inline type min(type t1, type t2) {  return (t1 < t2 )? t1 : t2; }\
   \
 prefix  bool operator<(type t1, type t2) /* stupid fix to allow ; */
-     /**
-    make the operators{<,<=,==,>=,>} and the MAX and MIN of two.
-    Please fill a & in the type argument if necessary.    
-    */
 
 
     
index 14847706882b267e51abd65f758aacdc8ce99b7b..d8274d2493c422cfbb70f82fef6863a77794e6d8 100644 (file)
@@ -6,14 +6,22 @@
 #include "link.hh"
 template<class T> class List;
 
-///
+/// iterator to List
+/** 
+  add and insert extend the list
+  items are always stored as copies in List, but:
+  List<String> :  copies of String stored 
+  List<String*> : copies of String* stored!
+
+    the operations add and insert actually delegate the work to List class.
+ */
 template<class T>
 class Cursor 
 {
  public:
-    Cursor( const List<T>& list, Link<T>* pointer = 0 );
     /** this isn't true, actually, #list# surely isn't const, but I get
       tired of the warning messages.  */
+    Cursor( const List<T>& list, Link<T>* pointer = 0 );
     
     Cursor( const Cursor<T>& cursor );
 
@@ -49,7 +57,6 @@ class Cursor
     bool backward();
 
     /// put (copy) after me in List
-    void add( const T& thing );
     /**
       analogously to editor. ok() interpreted as at end
       of line.
@@ -61,9 +68,9 @@ class Cursor
       cursor points to same object, cursor.next() is newly added
       object.
       */
+    void add( const T& thing );
 
     /// put (copy) before me in List
-    void insert( const T& thing );
     /**
       analogously to editor. ok() interpreted as at begin of
       line.
@@ -76,6 +83,7 @@ class Cursor
       is newly inserted object.
       */
     
+    void insert( const T& thing );
     ///
     void backspace();
 
@@ -90,14 +98,6 @@ private:
     List<T>& list_;
     Link<T>* pointer_;
 };
-/** 
-  add and insert extend the list
-  items are always stored as copies in List, but:
-  List<String> :  copies of String stored 
-  List<String*> : copies of String* stored!
-
-    the operations add and insert actually delegate the work to List class.
- */
 
 
 /*
index 278d865bffe115879d89f520ff86f8bc188a46c8..54d3703e60732ddc3d9c7bd1653f658c558a78f1 100644 (file)
@@ -2,7 +2,7 @@
 #ifndef CURSOR_INL
 #define CURSOR_INL
 #include <assert.h>
-//#include "list.hh"
+
 
 template<class T>
 inline
index d050e278c54850b8b3db273eec0548ff8a5c04d0..e3c42ad45f24abd4133b8619c711c7ef2b7df7e5 100644 (file)
@@ -79,6 +79,9 @@ Data_file::get_word()
 }
 
 /// get a char.
+/**
+   Only class member who uses text_file::get
+   */
 char
 Data_file::data_get() {
     char c =  get(); 
@@ -91,9 +94,6 @@ Data_file::data_get() {
 
     return c;
 }
-/**
-   Only class member who uses text_file::get
-   */
 
 /// read line, gobble '\n'    
 String Data_file::get_line()     
index 02b218d3cf44c76606c722cb6afcff9188daba57..b045a0f455bf4d53cf4a5fff7c89cd7693e52bb6 100644 (file)
@@ -58,7 +58,9 @@ Dstream::silence(String s)
        return false;
     return (*silent)[s];
 }
-///
+
+/** only output possibility. Delegates all conversion to String class.
+ */
 Dstream &
 Dstream::operator<<(String s)
 {
@@ -93,8 +95,6 @@ Dstream::operator<<(String s)
     return *this;    
 }
 
-/** only output possibility. Delegates all conversion to String class.
- */
 
 Dstream::Dstream(ostream *r, const char * cfg_nm )
 {
index e38f30128f80ce52fd4534162425ce2a18719cee..0143eb05104fa4490c07d1e077b70cc46cafd52b 100644 (file)
@@ -11,6 +11,20 @@ template<class K,class V>
 struct Assoc;
 
 /// debug stream
+ /**
+   a class for providing debug output of nested structures,
+   with indents according to \{\}()[].
+
+   One can turn on and off specific messages using the Assoc silent.
+   This can be done automatically:
+
+   #define DEBUG  dstream_.identify_as(__PRETTY_FUNCTION__) 
+
+   DEBUG << "a message\n";
+   
+   Init for the class names which should be silent can be given in a rc file. 
+   
+  */
 class Dstream
 {
     ostream *os;
@@ -23,29 +37,15 @@ public:
 
     bool silence(String);
     
-    Dstream(ostream *r, const char  * rcfile);
     /**
       if rcfile == 0, then do not read any rc file
       */
       
+    Dstream(ostream *r, const char  * rcfile);
     virtual ~Dstream();
     Dstream &identify_as(String s);
     
     Dstream &operator << (String s);
 };
- /**
-   a class for providing debug output of nested structures,
-   with indents according to \{\}()[].
-
-   One can turn on and off specific messages using the Assoc silent.
-   This can be done automatically:
-
-   #define DEBUG  dstream_.identify_as(__PRETTY_FUNCTION__) 
-
-   DEBUG << "a message\n";
-   
-   Init for the class names which should be silent can be given in a rc file. 
-   
-  */
 #endif
 
index acf437ad0ac98b7ff4da2b37e87c5b1099641e75..9cff84fb3cc65d01d3377cd87840bd77a86dcde9 100644 (file)
 
 
 /// a T interval
+/**
+  this represents the closed interval [left,right].
+  No invariants. T must be a totally ordered ring
+  */
 template<class T>
 struct Interval_t {
     T left, right;
 
-    /****************/
+    /* ************** */
     
     T center() { return (left + right) / T(2);}
     void translate(T t) {
@@ -43,11 +47,11 @@ struct Interval_t {
     T max()const { return right;}
     T min()const{ return left; }
     T &min(){ return left; }
-    void unite(Interval_t<T> h);
     /**
       PRE
       *this and h are comparable
       */
+    void unite(Interval_t<T> h);
     void intersect(Interval_t<T> h);
 
     T length() const;
@@ -68,10 +72,6 @@ struct Interval_t {
     String str() const;    
     bool elt_q(T r);
 };
-/**
-  this represents the closed interval [left,right].
-  No invariants. T must be a totally ordered ring
-  */
 
 /// partial ordering
 template<class T>
index 0ff3e084198ff8cbdbe4f1e13aa5dc247866adaf..67deb700bc703fd24e17ed14849ee75d2c3c08ba 100644 (file)
@@ -15,15 +15,16 @@ struct long_option_init {
 };
 
 
-///
+///  C++ for version of long_getopt.
+/** For processing GNU style command line arguments.  No pointer
+  (return values, arguments) contents are copied.  */
 class Getopt_long {
 public:
-    ///
+    /** errorcodes: no error, argument expected, no argument expected,
+      unknown option, illegal argument (eg. int expected).  */
     enum Errorcod { E_NOERROR = 0, E_ARGEXPECT, E_NOARGEXPECT, E_UNKNOWNOPTION,
                E_ILLEGALARG } ;
 
-    /** errorcodes: no error, argument expected, no argument expected,
-      unknown option, illegal argument (eg. int expected).  */
 
 private:
 
@@ -48,12 +49,12 @@ private:
     void report(Errorcod c);
 public:
     /// what to do with  errors
-    void seterror(ostream *os);
     /**
        report messages on  #*os#, and abort.
        if #os# is null, then do not report nor abort, just set #error#
       */
        
+    void seterror(ostream *os);
     /// argument. Set to 0 if not present
     char* optarg;
 
@@ -73,18 +74,14 @@ public:
     Getopt_long(int c,  char **v, long_option_init *lo);
 
     /// get the next option
-    long_option_init *operator()();
     /**
-      RETURN: pointer to next option found.
+      @return pointer to next option found.
       0 if error occurred, or next argument is no option.
       */
+    long_option_init *operator()();
 
     char *current_arg();
     char * get_next_arg();
     Errorcod error;
 };
-/**
-  C++ for version of long_getopt. For processing GNU style command line arguments.
-  No pointer  (return values, arguments) contents are copied.
-  */
 #endif
index 4a4aab2f5b28ecf9e5b398457e9e2658816e5008..4f3c1aa825e4b8c8976a8540ca9b855b9a633488 100644 (file)
@@ -6,6 +6,27 @@ template<class T> class Cursor;
 template<class T> class Link;
 
 /// all-purpose doubly linked list
+/**
+  a doubly linked list; 
+  List can be seen as all items written down on paper,
+  from top to bottom
+
+  class Cursor is used to extend List
+
+   items are always stored as copies in List, but:
+   #List<String># :  copies of #String# stored 
+   #List<String*># : copies of #String*# stored! 
+   (do not use, use \Ref{PointerList} #<String*># instead.)
+   {\bf note:} 
+   retrieving "invalid" cursors, i.e. 
+   #top()/bottom()# from empty list, #find()# without success,
+    results in a nonvalid Cursor ( #!ok()# )
+
+
+    INVARIANTEN!
+*/
+
 template<class T>
 class List
 {
@@ -30,8 +51,7 @@ class List
     void concatenate(List<T> const &s);
     
     /// make *this empty
-    void set_empty();
-    /**
+     /**
 
       POST:
       size == 0
@@ -39,15 +59,14 @@ class List
       WARNING:
       contents lost, and not deleted.
       */
-    
+     void set_empty();
+  
     /// add after after_me
     void add( const T& thing, Cursor<T> &after_me );
 
     /// put thing before #before_me#
     void insert( const T& thing, Cursor<T> &before_me );
-    
-    void remove( Cursor<T> me );
-    /** Remove link pointed to by me. Destructor of contents called
+     /** Remove link pointed to by me. Destructor of contents called
       (nop for pointers)
 
       POST
@@ -56,34 +75,15 @@ class List
 
       WARNING: do not use #me# after calling
       */
+    void remove( Cursor<T> me );
+   
 
-    /****************/
+    /* ************** */
     
     int size_;
     Link<T>* top_;
     Link<T>* bottom_;
 };
-/**
-  a doubly linked list; 
-  List can be seen as all items written down on paper,
-  from top to bottom
-
-  class Cursor is used to extend List
-
-   items are always stored as copies in List, but:
-   #List<String># :  copies of #String# stored 
-   #List<String*># : copies of #String*# stored! 
-   (do not use, use \Ref{PointerList} #<String*># instead.)
-   {\bf note:} 
-   retrieving "invalid" cursors, i.e. 
-   #top()/bottom()# from empty list, #find()# without success,
-    results in a nonvalid Cursor ( #!ok()# )
-
-
-    INVARIANTEN!
-*/
-
 
 #include "list.inl"
 #include "cursor.hh"
index 5283dc71ef45df9d30588b6e26957167abba05b9..73a9f0487e5a221e7207705a082001409417d71e 100644 (file)
@@ -6,6 +6,16 @@
 #include "vector.hh"
 
 /// a Real matrix
+/** This is a class for a nonsquare block of #Real#s.  The
+    implementation of sparse matrices is done in the appropriate #smat#
+    class. Matrix only does the mathematical actions (adding,
+    multiplying, etc.)
+
+    
+    TODO
+    implement ref counting?  */
+
+
 class Matrix {
     virtual_smat *dat;
     
@@ -15,11 +25,11 @@ public:
     int rows() const { return dat->rows(); }
 
     /// return the size of a matrix
-    int dim() const;
     /**
-      PRE
+      @pre
       the matrix needs to be square.
     */
+    int dim() const;
      
     // Matrix() { dat = 0; } 
     ~Matrix() { delete dat; }
@@ -40,7 +50,6 @@ public:
     void operator/=(Real a) { (*this) *= 1/a; }
     
     /// add a row
-    void insert_row(Vector v,int k);
     /**
       add a row to the matrix before  row k
 
@@ -48,25 +57,26 @@ public:
       v.dim() == cols()
       0 <= k <= rows()
     */
+    void insert_row(Vector v,int k);
     ///
-    void delete_row(int k) { dat->delete_row(k); }
     /**
       delete a row from this matrix.
 
       PRE
       0 <= k < rows();
     */
+    void delete_row(int k) { dat->delete_row(k); }
     void delete_column(int k) { dat->delete_column(k); }
-    ///
-    Matrix(int n);
+
     /**
       square n matrix, initialised to null
     */
-    ///
-    Matrix(int n, int m);
+    Matrix(int n);
+
     /**
       n x m matrix, init to 0
     */
+    Matrix(int n, int m);
     Matrix(const Matrix &m);
 
     /// dyadic product: v * w.transpose
@@ -98,18 +108,18 @@ public:
 
     Real norm() const;
     /// swap
-    void swap_columns(int c1, int c2);
     /**
       PRE
       0 <= c1,c2 < cols()
     */
+    void swap_columns(int c1, int c2);
 
     /// swap
-    void swap_rows(int c1, int c2);
     /**
       PRE
       0 <= c1,c2 < rows()
     */
+    void swap_rows(int c1, int c2);
 
 
     Vector row(int ) const;
@@ -119,16 +129,6 @@ public:
     void print() const;
 };
 
-/** This is a class for a nonsquare block of #Real#s.  The
-    implementation of sparse matrices is done in the appropriate #smat#
-    class. Matrix only does the mathematical actions (adding,
-    multiplying, etc.)
-
-    
-    TODO
-    implement ref counting?  */
-
-
 inline Vector
 operator *(Vector &v, const Matrix& m) { return m.left_multiply(v); }
 Matrix operator *(const Matrix& m1,const Matrix &m2);
index 2fd7eea3cb5b1321f66e92310d0c32bf11b8342c..2737d1cd154173d19d293971d493af9d0bb75f07 100644 (file)
@@ -8,7 +8,10 @@
 #define PATHSEP '/'
 #endif
 
-
+/**
+   INPUT: path the original full filename
+   OUTPUT: 4 components of the path. They can be empty
+*/
 void
 split_path(String path, 
           String &drive, String &dirs, String &filebase, String &extension)
@@ -45,11 +48,6 @@ split_path(String path,
        filebase = path;
        }
 }
-/**
-   INPUT: path the original full filename
-   OUTPUT: 4 components of the path. They can be empty
-*/
-
 
 File_path::File_path(String pref)
 {
@@ -58,7 +56,11 @@ File_path::File_path(String pref)
 }
 
 
-///
+///find a file
+/**
+  It will search in the current dir, in the construction-arg, and
+  in any other added path, in this order.
+  */
 String
 File_path::find(String nm)
 {
@@ -75,7 +77,3 @@ File_path::find(String nm)
      }
      return "";
 }
-/**
-  It will search in the current dir, in the construction-arg, and
-  in any other added path, in this order.
-  */
index 781e86f970da53430856ee4416b3aa8da1fd3684..4a36730dcd34b840aa1aeffb2879db1af9a280d5 100644 (file)
@@ -5,6 +5,15 @@
 
 
 ///   searching directory for file.
+/**
+
+   Abstraction of PATH variable. An interface for searching input files.
+   Search a number of dirs for a file.
+
+   Should use kpathsea?
+   
+*/
+
 class File_path : private Array<String>
 {
 public:
@@ -18,15 +27,6 @@ public:
     Array<String>::push;
     void add(String str) { push(str); }
 };
-/**
-
-   Abstraction of PATH variable. An interface for searching input files.
-   Search a number of dirs for a file.
-
-   Should use kpathsea?
-   
-*/
-
 /// split path into its components
 void split_path(String path, String &drive, String &dirs, String &filebase, String &extension);
 
index a6b99c9097526d771aa099289d1e0ec8541b850b..8498aa9e0d38bd52b132cdad61662339dfa2dd32 100644 (file)
 
 
 /// cursor to go with PointerList
+/**
+  don't create PointerList<void*>'s.
+  This cursor is just an interface class for Cursor. It takes care of the
+  appropriate type casts
+ */
 template<class T>
 struct PCursor : private Cursor<void *> {
     friend class IPointerList<T>;
@@ -53,11 +58,6 @@ public:
        return Cursor<void*>::compare(a,b);
     }
 };
-/**
-  don't create PointerList<void*>'s.
-  This cursor is just an interface class for Cursor. It takes care of the
-  appropriate type casts
- */
 
 
 
index f5913c1299b33a2268b736d424581fef62ec6117..61b51d97e3cfc81986bb8bd3ff5b1a062e46747d 100644 (file)
 #include "list.hh"
 
 /// Use for list of pointers, e.g. PointerList<AbstractType*>.
+/**
+  This class does no deletion of the pointers, but it knows how to
+  copy itself (shallow copy). We could have derived it from List<T>,
+  but this design saves a lot of code dup; for all PointerLists in the
+  program only one parent List<void*> is instantiated.  */
 template<class T>
 class PointerList : public List<void *>
 {
@@ -24,19 +29,8 @@ class PointerList : public List<void *>
     void concatenate(PointerList<T> const &s) { List<void*>::concatenate(s); }
     PointerList() {}
 };
-/**
-  This class does no deletion of the pointers, but it knows how to
-  copy itself (shallow copy). We could have derived it from List<T>,
-  but this design saves a lot of code dup; for all PointerLists in the
-  program only one parent List<void*> is instantiated.  */
 
 ///  pl. which deletes pointers given to it.
-template<class T>
-struct IPointerList : public PointerList<T> {
-    IPointerList(const IPointerList&) { set_empty(); }
-    IPointerList() { }
-    ~IPointerList();
-};
 /**
   NOTE:
   
@@ -48,6 +42,12 @@ struct IPointerList : public PointerList<T> {
   You have to copy this yourself, or use the macro PointerList__copy
   
   */
+template<class T>
+struct IPointerList : public PointerList<T> {
+    IPointerList(const IPointerList&) { set_empty(); }
+    IPointerList() { }
+    ~IPointerList();
+};
 
 #define IPointerList__copy(T, to, from, op)   \
   for (PCursor<T> _pc_(from); _pc_.ok(); _pc_++)\
index bff21618c62de4db000573427b79e69145ad90ca..0213a92f0d9013df8116769c2499da8c348ce9f5 100644 (file)
@@ -24,9 +24,9 @@ struct Scalar : public String {
     operator Real();
     operator int();
     ///
-    operator bool() const;
     /** perl -like string to bool conversion
      */
+    operator bool() const;
 
 };
 
index f2143507b654766ecdd99557c6079237f0c8dc98..d89e3bc285e9c2482af7ae844dad4252a8eb0b19 100644 (file)
@@ -182,7 +182,7 @@ Full_storage::clone()
 {
     return new Full_storage(*this);
 }
-/****************************************************************/
+
 
 virtual_smat *
 virtual_smat::get_full(int n, int m)
index 7ed274979d8df163dba37c1c9931bcb228ca381d..e58f6146997405e7471a6e24316909e100c089c3 100644 (file)
 #include "stringutil.hh"
 
 /// the smart string class.
+/** 
+
+  Intuitive string class. provides 
+
+  ref counting through #String_handle#
+
+  conversion from bool, int, double, char *, char.
+
+  conversion to int, upcase, downcase
+
+
+  printable. 
+
+  indexing (pos, posAny, lastPos)
+
+  cutting (left, right, mid)
+
+  concat (+=, +)
+
+  signed comparison (<, >, ==, etc)
+
+  No operator[] is provided, since this would be enormously  slow. If needed,
+  convert to const char *. 
+*/
 class String
 {
 protected:
@@ -27,8 +51,8 @@ protected:
 
 public:
     /// init to ""
-    String() {  }                  
     /** needed because other constructors are provided.*/
+    String() {  }                  
     String(Rational);
     /// String s = "abc";
     String( const char* source ); 
@@ -95,11 +119,11 @@ public:
     int lastPos( const char* string ) const;
 
     /// index of leftmost c
-    int pos(char c ) const;
     /**
     RETURN:
     0 if not found, else index + 1
     */
+    int pos(char c ) const;
     int pos(const char* string ) const;
     int posAny(const char* string ) const;
 
@@ -117,30 +141,6 @@ public:
     int len() const;
 
 };
-/** 
-
-  Intuitive string class. provides 
-
-  ref counting thru #String_handle#
-
-  conversion from bool, int, double, char *, char.
-
-  conversion to int, upcase, downcase
-
-
-  printable. 
-
-  indexing (pos, posAny, lastPos)
-
-  cutting (left, right, mid)
-
-  concat (+=, +)
-
-  signed comparison (<, >, ==, etc)
-
-  No operator[] is provided, since this would be enormously  slow. If needed,
-  convert to const char *. 
-*/
 
 #include "compare.hh"
 
index d7f70816173dddbf4715bad6bc7bba70d0ab262c..6a7feb126ab44e17e985cae8672944f521759d1b 100644 (file)
@@ -8,7 +8,12 @@
 
 const INITIALMAX=8;
 class String_handle;
+
 /// Internal String struct
+/**
+   the data itself. Handles simple tasks (resizing, resetting)
+   */
+
 class StringData {
     // GNU malloc: storage overhead is 8 bytes anyway.
 
@@ -43,6 +48,10 @@ friend class String_handle;
     }
 
 
+    /** POST: maxlen >= j.
+      IN: j, maximum stringlength.    
+      contents thrown away.
+    */
     void setmax(int j) {       
        OKW();
        if (j > maxlen) {
@@ -54,11 +63,11 @@ friend class String_handle;
            length = 0;
        }
     }
+    
     /** POST: maxlen >= j.
-      IN: j, maximum stringlength.    
-      contents thrown away.
-    */
-    ///
+      IN: j, maximum stringlength.
+      contents are kept if it grows.
+      */
     void remax(int j) {
        OKW();
        if (j > maxlen) {
@@ -70,10 +79,6 @@ friend class String_handle;
        //    length = strlen(string);
        }
     }
-    /** POST: maxlen >= j.
-      IN: j, maximum stringlength.
-      contents are kept if it grows.
-      */    
     /// check if writeable.
     void OKW() {
 
@@ -153,13 +158,13 @@ friend class String_handle;
     }
 };
 
-/**
-   the data itself. Handles simple tasks (resizing, resetting)
-   */
 
 
-/****************************************************************/
 /// ref. counting for strings
+/**
+   handles ref. counting, and provides a very thin
+   interface using char *
+ */
 class String_handle {
     StringData* data;
     
@@ -229,11 +234,6 @@ public:
     void trunc(int j) { copy(); data->trunc(j); }
     int len() const { return data->length; }
 };
-/**
-   handles ref. counting, and provides a very thin
-   interface using char *
- */
-
 
 #ifdef NDEBUG
 #if (NDEBUG == BLONDE)
index afb04f0725772e1927b23a928416e47e6b44c5c3..cdc889853936e6b3cec33ef29e4cc33f02bd9da1 100644 (file)
@@ -3,8 +3,7 @@
 
 #include "textstr.hh"
 
-/**: do "#" comments, read quote enclosed  fields */
-
+/** do "#" comments, read quote enclosed  fields */
 /// a "const" Array. Contents can't be changed.
 class Text_record : Array<String>  
 {
@@ -28,6 +27,9 @@ public:
     Array<String>::size;           
 };
 
+/**
+    add a subrec/fieldsep/record separator
+    */
 /// abstraction for a datafile
 class Text_db : private Data_file
 {
@@ -50,8 +52,4 @@ public:
     }
 };
 
-
-/**
-    add a subrec/fieldsep/record separator
-    */
 #endif
index c89f58cf8db52c29d6b37f7e45ba980cdf152a44..489682effdee2969795d929d479ce56f74b32c06 100644 (file)
@@ -1,3 +1,4 @@
+
 #ifndef TEXTSTR_HH
 #define TEXTSTR_HH
 
@@ -7,13 +8,21 @@
 #include "varray.hh"
 
 /// line counting input stream.
+/**
+ a stream for textfiles. linecounting. Thin interface getchar and
+ ungetchar.  (ungetc is unlimited) 
+
+ should protect get and unget against improper use
+*/
+
+
 class Text_stream
 {
     int line_no;
 
     // could just have used streams. 
     FILE *f;  
-       Array<char> pushback;
+    Array<char> pushback;
     String name;
     
  public:
@@ -61,14 +70,6 @@ class Text_stream
     /// GNU format message.
     void message(String s); 
 };
-/**
- a stream for textfiles. linecounting. Thin interface getchar and
- ungetchar.  (ungetc is unlimited) 
-
- should protect get and unget against improper use
-*/
-
-
 /// read a data file
 class Data_file : private Text_stream
 {
index 32f981d2e93d89d9e1f3eb54c1237ebf700507c4..847c650b48d57d4254c05b6b30e202adf3259731 100644 (file)
@@ -3,6 +3,17 @@
 #include "varray.hh"
 
 /// a  matrix storage baseclass.
+/** base class for interface with matrix storageclasses.  There are no
+    iterators for matrixclasses, since matrices are (like arrays)
+    explicitly int-indexed.
+
+    Iteration is provided by *_next, *_ok, which update and check both
+    index variables simultaneously.
+
+    TODO
+    determine type of product matrix.
+
+*/
 class virtual_smat {
     
 
@@ -17,11 +28,11 @@ public:
     virtual int cols() const = 0;
     
     /// set the size. contents lost
-    virtual void set_size(int i, int j) = 0;
     /**      
       PRE
       i >=0, j>=0
     */
+    virtual void set_size(int i, int j) = 0;
     
     /// set the size to square dimen. contents lost
     virtual void set_size(int i) = 0;
@@ -29,8 +40,7 @@ public:
       PRE
       i>=0
     */
-    /// set the size to i
-    virtual void resize(int i, int j) = 0;
+    /// set the size to i,j 
     /**
 
       keep contents. If enlarged contents unspecified
@@ -39,18 +49,18 @@ public:
       i>=0, j>=0
     
     */
+    virtual void resize(int i, int j) = 0;
 
     /// set the size to square dimen. contents kept
-    virtual void resize(int i) = 0;
     /**    
     Keep contents. If enlarged contents are unspecified
     
     PRE
     i>=0  
     */
+    virtual void resize(int i) = 0;
     
     /// access an element
-    virtual Real& elem(int i,int j) = 0;
     /**
     access an element.
 
@@ -58,6 +68,7 @@ public:
     in the 0-part of a sparse matrix.
     */
 
+    virtual Real& elem(int i,int j) = 0;
     /// access a element, no modify
     virtual const Real& elem(int i, int j) const = 0;
 
@@ -67,51 +78,50 @@ public:
 #endif
 
     /// add a row
-    virtual void insert_row(int k)=0;
     /**
     add a row to the matrix before  row k. Contents
     of added row are unspecified
 
       0 <= k <= rows()
     */
-
+  virtual void insert_row(int k)=0;
+  
     /// delete a row 
-    virtual void delete_row(int k)=0;
-      /**
+          /**
       delete a row from this matrix.
 
       PRE
       0 <= k < rows();
-    */
+    */virtual void delete_row(int k)=0;
+
     virtual ~virtual_smat() { }
     virtual virtual_smat *clone()=0;
 
 
     /// is there a next?
-    virtual bool mult_ok(int i, int j) const=0;
-    /**
+      /**
       at end of matrix? when doing loop
 
       for(i=0; i<h; i++)
         for(j=0; j<w; j++)
           ...
 
-    */
+    */ virtual bool mult_ok(int i, int j) const=0;
     /// iterate
-    virtual void mult_next(int &i, int &j) const  = 0;
-    /**
+       /**
       walk through matrix (regular multiply)
       get next j for row i, or get next row i and reset j.
       this will make sparse matrix implementation easy.
     
       PRE
       mult_ok(i,j)
-     */
-    virtual bool trans_ok(int i, int j) const=0;
-    /**
+     */virtual void mult_next(int &i, int &j) const  = 0;
+  /**
       valid matrix entry. return false if at end of row
     */
-    virtual void trans_next(int &i, int &j) const  = 0;
+    virtual bool trans_ok(int i, int j) const=0;
+   
     /**
       walk through matrix (transposed multiply).
       Get next i (for column j)
@@ -119,22 +129,12 @@ public:
       PRE
       ver_ok(i,j)
      */
+    virtual void trans_next(int &i, int &j) const  = 0;
 
     /// generate a "Full_storage" matrix    
     virtual_smat<Real> *get_full(int n, int m);
 
 };
     
-/** base class for interface with matrix storageclasses.  There are no
-    iterators for matrixclasses, since matrices are (like arrays)
-    explicitly int-indexed.
-
-    Iteration is provided by *_next, *_ok, which update and check both
-    index variables simultaneously.
-
-    TODO
-    determine type of product matrix.
-
-*/
 
 #endif
index 229fdf3c4567728973d0412132e9bb22ab938c99..0daafb84f817721c4d7cd198ba0f31741afaceb0 100644 (file)
@@ -16,6 +16,15 @@ inline void arrcpy(T*dest, T*src, int count) {
 }
 
 ///scaleable array/stack template, for T with def ctor.
+/**
+
+  This template implements a scaleable vector. With (or without) range
+  checking. It may be flaky for objects with complicated con- and
+  destructors. The type T should have a default constructor. It is
+  best suited for simple types, such as int, double or String
+
+  It uses stack terminology, (push, pop, top), and  can be used as a stack.
+  */
 template<class T>
 class Array {
 protected:
@@ -166,14 +175,5 @@ public:
        return r;
     }
 };
-/**
-
-  This template implements a scaleable vector. With (or without) range
-  checking. It may be flaky for objects with complicated con- and
-  destructors. The type T should have a default constructor. It is
-  best suited for simple types, such as int, double or String
-
-  It uses stack terminology, (push, pop, top), and  can be used as a stack.
-  */
 
 #endif
index c039d5ce89276d024cf6d187b5b4e3122a633f76..266254dbb82834be54cf56da1d6ebd73b0a196eb 100644 (file)
@@ -10,6 +10,9 @@ class String;
 void set_matrix_debug(Dstream&ds);
 
 /// a row of numbers
+/**
+    a vector. Storage is handled in Array, Vector only does the mathematics.
+ */
 class Vector  {
     Array<Real> dat;
 public:
@@ -75,9 +78,6 @@ public:
     /// set to j-th element of unit-base
     void set_unit(int j) ;
 };
-/**
-    a vector. Storage is handled in Array, Vector only does the mathematics.
- */
 
 inline Vector
 operator+(Vector a, Vector const &b) {
index 3112ae9b253f40ed9959f014b4874a468d19f61f..8765cbfe9491aa3e3926ddb8cf2a29ebe7bab29d 100644 (file)
@@ -17,12 +17,12 @@ public:
     virtual int cols() const = 0;
     
     /// set the size. contents lost
-    virtual void set_size(int i, int j) = 0;
     /**      
       PRE
       i >=0, j>=0
     */
     
+    virtual void set_size(int i, int j) = 0;
     /// set the size to square dimen. contents lost
     virtual void set_size(int i) = 0;
     /**
index 6e5b278ab3eba06ca195c20d6a9bd0b590eab2f7..de9e7bf1e3dd931a5229e2f18d82b5ef72fa37e6 100755 (executable)
--- a/genheader
+++ b/genheader
@@ -1,22 +1,31 @@
-#!/bin/sh
-def=`echo $1 | sed s/\\\./_/ | tr a-z A-Z`
+#!/usr/bin/perl -w
 
-cat << HERE
-/*
-  $1 -- part of LilyPond
+die "arg needed\n" if (!($#ARGV+1));
+my $fn = $ARGV[0];
+my $hh_q = ($fn =~ /hh$/ );
+my $MAILADRESS=$ENV{MAILADRESS};
+my @pw=(getpwuid($<));
+my $username=$pw[6];
+my $what="implement ";
+$what = "declare " if ($hh_q);
+my $headstr ="/*
+  $fn -- $what
 
-  (c) 1997 $USERNAME <$MAILADRESS>
-*/
+  source file of the LilyPond music typesetter
 
-HERE
+  (c) 1997 $username <$MAILADRESS>
+*/\n";
+
+my $startdef= $fn;
+$startdef =~ s/\./_/;
+$startdef =~ tr/a-z/A-Z/;
+my $terminatestr="\n";
+if ($hh_q) {
+    $headstr .= "\n\n#ifndef $startdef\n#define $startdef\n";
+    $terminatestr .= "#endif // $startdef\n"  
+}
+
+print $headstr, $terminatestr;
 
-if [ $1 != `basename .hh` ]
-then
-cat <<EOF
-#ifndef $def
-#define $def
 
 
-#endif // $def
-EOF
-fi
index 68a9f49cff95f8badba13ea4c52a772615613657..68f5087f459c884a16443657b78afee8cc469dcd 100644 (file)
 #include "directionalspanner.hh"
 #include "plist.hh"
 
-/// a beam connects multiple stems 
+/** 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<Stem*> stems;
     Real slope;
     Real left_pos;
-    /// dir: -1 below heads, +1 above heads.
+   
 
-    /****************/
+    /* *************** */
     const char * name() const;
     
     virtual Interval width()const;    
@@ -41,8 +43,6 @@ private:
     void solve_slope();
     Molecule*brew_molecule_p()const;
 };
-/** Beam adjusts the stems its owns to make sure that they reach the
-  beam and that point in the correct direction */
 
 #endif // BEAM_HH
 
index 9ecb484e5b156d253db8aee2f87f3bfa03118015..7d17470228d7a59756f25a1e6a9a91aae358f377 100644 (file)
@@ -14,7 +14,7 @@ struct Break_algorithm {
     PScore &pscore_;
     Real linelength;
 
-    /****************/
+    /* *************** */
 
     Break_algorithm(PScore&);
 
index 2c56cb497e73a21fe1a4275cc050703fd3391e5e..7325c542a685793620ba01aaca2b8bf96ba4aeb2 100644 (file)
@@ -9,12 +9,15 @@
 #include "scalar.hh"
 #include "varray.hh"
 
-struct Clef {
-    int c0_pos;
-    String clef_type;
+/// where is c-0 in the staff?
+class Clef {
+
+public:
+    int c0_position_i_;
+    String clef_type_str_;
 
     Clef();
-    void read(Array<Scalar> args);    
+    void set_type(String);
 };
 #endif // CLEF_HH
 
index c07087e0734e59f029ccd7f3b24a1e0a942035e9..b7ea93caaa8e5453b416ea8ea210399973748a4c 100644 (file)
@@ -17,7 +17,7 @@ struct Clef_item : Item {
     bool change;
 
 
-    /****************/
+    /* *************** */
 
     Clef_item();
     void read(Clef);
index d06657485f2334ca73ac5adffcd7a49172cf6887..5398417ab134202630b22b9f3a5c3dc4950c574c 100644 (file)
@@ -16,7 +16,7 @@ struct Col_hpositions {
     Array<Real> config;
     Real energy;
 
-    /****************/
+    /* ************** */
     void OK()const;
 
     Col_hpositions();
index d4dda9411c4735844e9e6ad6bd7ddd92ddffda17..2408ac0698939fd5d7ca3990aeaad89e396f3604 100644 (file)
@@ -5,6 +5,7 @@
 #include "varray.hh"
 #include "scalar.hh"
 
+/// what kind of command?
 enum Commandcode {
        NOP,
        INTERPRET,
@@ -13,24 +14,6 @@ enum Commandcode {
 };
 
 /// set a nonrythmical symbol
-struct Command {
-    Commandcode code;
-
-    /// analogous to argv[]
-    Array<Scalar> args;
-
-    ///
-    int priority;
-    /** in what order relative to other TYPESET commands (eg, bar
-       should precede meter). Highest priority first. */
-    
-    /****************/
-    
-    Command();
-//    Command(Moment w);
-    bool isbreak()const;
-    void print() const;
-};
 
 /**
     A nonrhythmical "thing" in a  staff is called a "command".
@@ -81,5 +64,22 @@ struct Command {
     
     */
 
+struct Command {
+    Commandcode code;
+
+    /// analogous to argv[]
+    Array<Scalar> args;
+
+
+    /** in what order relative to other TYPESET commands (eg, bar
+       should precede meter). Highest priority first. */
+    int priority;
+    
+    /* *************** */
+    
+    Command();
+    bool isbreak()const;
+    void print() const;
+};
 
 #endif
diff --git a/hdr/complexcolumn.hh b/hdr/complexcolumn.hh
new file mode 100644 (file)
index 0000000..50ad5fc
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+  complexcolumn.hh -- declare Complex_column
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef COMPLEXCOLUMN_HH
+#define COMPLEXCOLUMN_HH
+
+/// column of Complex_staff: store one request
+struct Complex_column : Staff_column {
+
+    Array<Request*> first_l_arr_;
+    Array<Request*> second_l_arr_;
+
+    Complex_staff* staff_l_;
+    
+    /* *************** */
+
+    Slur_req *find_slur(Voice *);
+
+    void typeset_item(Item *, int=1);
+    void typeset_item_directional(Item *, int dir, int=1);
+    Molecule *create_command_mol(Command *com);
+
+    void take_request(Request *rq);   
+    virtual void setup_requests();
+
+    Complex_column(Score_column*s,Complex_staff*rs);
+};
+
+#endif // COMPLEXCOLUMN_HH
index 17d489be960119b90e2aba006ed6df33f056c197..6c7dbdb18d01d659aba66bc43a90a00f0428e695 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  complexstaff.hh -- part of LilyPond
+  complexstaff.hh -- declare Complex_staff
 
   (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
 #include "stcol.hh"
 #include "staff.hh"
 #include "staffwalker.hh"
-
-/// column of Complex_staff: store one request
-struct Complex_column : Staff_column {
-
-    Array<Request*> first_l_arr_;
-    Array<Request*> second_l_arr_;
-
-    Complex_staff* staff_l_;
-    
-    /****************/
-
-    Slur_req *find_slur(Voice *);
-
-    void typeset_item(Item *, int=1);
-    void typeset_item_directional(Item *, int dir, int=1);
-    Molecule *create_command_mol(Command *com);
-
-    void take_request(Request *rq);   
-    virtual void setup_requests();
-
-    Complex_column(Score_column*s,Complex_staff*rs);
-};
+#include "complexcolumn.hh"
 
 
 /// Complex  staff: one voicegroup  at a time
 struct Complex_staff : Staff {
     /// indirection to the PStaff.
-    PStaff *theline_l_;
+    PStaff *pstaff_l_;
 
-    /****************/
+    /* *************** */
     Staff_column*create_col(Score_column*);    
     virtual Item *get_TYPESET_item(Command*);
     virtual void set_output(PScore *);
index fcdb84ef962521d08b688f189b40bd50f28a7630..2ada9fe642b4322e207119a31531d6ed565095ee 100644 (file)
@@ -7,7 +7,6 @@
 #ifndef COMPLEXWALKER_HH
 #define COMPLEXWALKER_HH
 
-// this SUX
 #include "proto.hh"
 #include "grouping.hh"
 #include "voicegroup.hh"
@@ -16,6 +15,7 @@
 #include "key.hh"
 #include "clef.hh"
 #include "register.hh"
+#include "localkeyreg.hh"
 
 struct Complex_walker: Staff_walker {
     Local_key local_key_;
@@ -32,29 +32,27 @@ struct Complex_walker: Staff_walker {
 
     IPointerList<Voice_registers *> voice_reg_list_;
     IPointerList<Voice_group_registers*> group_reg_list_;
-    Assoc<const Voice *, Voice_group_registers *> voice_group_map_;
+    Assoc<Voice *, Voice_group_registers *> voice_group_map_;
 
     Local_key_register local_key_reg_;
     Array<Staff_elem_info> announce_info_arr_;
     
-    /****************/
-    void  do_change_group(const Voice * v, String group_id_str);
-
-    Voice_registers *find_voice_reg(Voice*v_l);
+    /* *************** */
+    Voice_registers *find_voice_reg(Voice*v_l)const;
     Voice_registers *get_voice_reg(Voice*v_l);
     
     /// search and return. return 0 if not found.
-    Voice_group_registers *find_voice_group(Voice* v_l);
+    Voice_group_registers *find_voice_group(Voice* v_l)const;
     /// search. Create if necessary
     Voice_group_registers *get_voice_group(Voice* v_l);
     /// search and return. return 0 if not found
-    Voice_group_registers *find_voice_group(const char* id);
+    Voice_group_registers *find_voice_group(const char* id)const;
     /// Create if necessary
     Voice_group_registers *get_voice_group(const char*);
+
+    Array<Voice_registers *> get_voice_regs(Voice_group_registers *) const;
     
     void regs_process_requests();
-    void do_announces();
-    void try_request(Request*req);
     void typeset_element(Staff_elem *elem_p);
     void announce_element(Staff_elem_info);
     virtual void do_TYPESET_command(Command*);
@@ -66,6 +64,10 @@ struct Complex_walker: Staff_walker {
     Complex_walker(Complex_staff*);
     Complex_column *col();
     Complex_staff *staff();
+private:
+    void  do_change_group( Voice * v, String group_id_str);
+    void do_announces();
+    void try_request(Request*req);
 };
 
 
index 4ee17ea140a3ed52b209eaf577d2ea2812fb3ec3..a3f4e8876b65498635004344a3b93a8adaec51a6 100644 (file)
@@ -4,9 +4,18 @@
 #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);
-Real convert_dimen(Real, String);
 String print_dimen(Real);
-
+Real convert_dimen(Real, String);
 #endif
 
index f0e4716432acffd22637aa3c0f6f63a4d105a506..8868bbfd6def48ba8c9d492a66c5950b73eb962a 100644 (file)
@@ -12,7 +12,7 @@
 struct Directional_spanner : Spanner{
     
     /// -1 below heads, +1 above heads.
-    int dir;
+    int dir_i_;
 
     /// offset of "center" relative to left-column/0-pos of staff
     virtual Offset center() const=0;
index aea2fd393f5f48bedd115e6292d4449cff649992..70d95ef55d1f74d2ada3ee4d5cfb002b13d4570e 100644 (file)
 
 typedef Interval_t<Moment> MInterval;
 
-/// data structure which represents rhythmic units 
+/** data structure which represents rhythmic units   this is a tree. It groupes notes according to rules
+ */
 struct Rhythmic_grouping {
     Array<Rhythmic_grouping*> children;
     MInterval *interval_;
     
-    /****************/
+    /* *************** */
 
     Array<MInterval> intervals();
     MInterval interval()const;
@@ -51,9 +52,4 @@ private:
     void junk();
     void copy(Rhythmic_grouping const&);
 };
-/**
-  this is a tree. It groupes notes according to rules
-  
- */
-
 #endif
diff --git a/hdr/headreg.hh b/hdr/headreg.hh
new file mode 100644 (file)
index 0000000..d5eb6fa
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+  headreg.hh -- part of LilyPond
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef HEADREG_HH
+#define HEADREG_HH
+#include "register.hh"
+
+struct Notehead_register : Request_register {
+    Item* note_p_;
+    int dir_i_;
+    /* *************** */
+    Notehead_register(Complex_walker*);
+    virtual bool try_request(Request *req_l) ;
+    virtual void process_request();
+    virtual void do_pre_move_process();
+    void set_dir(int);
+};
+
+
+#endif // HEADREG_HH
index bd6054f6e9d84ff6f84b52a08fc32d884a7b3f07..d40885407afd8e074cf54e739ca56b69d02f4035 100644 (file)
@@ -16,7 +16,7 @@
 struct Commands_at : public IPointerList<Input_command*> {
     Time_description tdescription_;
     
-    /****************/
+    /* *************** */
 
     Moment when();
     void parse(Staff_commands_at*);
@@ -30,7 +30,7 @@ struct Commands_at : public IPointerList<Input_command*> {
 
 struct Input_cursor : public PCursor<Commands_at*>
 {
-    /****************/
+    /* *************** */
     Input_cursor(PCursor<Commands_at*>);
     Moment when()const;
     void find_moment(Moment w);
@@ -42,7 +42,7 @@ struct Input_cursor : public PCursor<Commands_at*>
 struct Input_commands : public IPointerList<Commands_at*> {    
     Input_cursor ptr;
     
-    /****************/
+    /* *************** */
 
     void find_moment(Moment);
     void add(Input_command c,Assoc<String,Moment> &marks_assoc_r);
index 7d0dd618ba819c6ee7e3442ede9bff0d12287688..0a1d95cfc6ee7baf8e4ff101d9efd28194bf7e47 100644 (file)
@@ -16,7 +16,18 @@ struct Voice_list : public PointerList<Voice*> {
     void translate_time(Moment dt);
 };
 
-/// ABC for input structures
+/**
+
+  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;
     virtual Moment length()const=0;
@@ -30,23 +41,12 @@ struct Input_music {
     virtual Input_music *clone() const = 0;
     virtual Simple_music *simple() { return 0; }
 };
-/**
-
-  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)
-
-  */
-
 
 /// 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); }
@@ -63,7 +63,7 @@ struct Simple_music : Input_music {
 /// Complex_music consists of multiple voices
 struct Complex_music : Input_music {
     IPointerList<Input_music*> elts;
-    /****************/
+    /* *************** */
     virtual void set_default_group(String g);
     void add(Input_music*);
     Complex_music();
@@ -73,11 +73,19 @@ struct Complex_music : Input_music {
  
 };
 
-/// multiple stuff  after each other
+
+/**
+  voice like.
+
+  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;
@@ -87,19 +95,18 @@ struct Music_voice : Complex_music {
     }
     virtual void print() const ;
 };
-/**
-  voice like.
 
-  different music forms which start after each other ( concatenated,
-  stacked "horizontally )
- */
+/**
+  Multiple musicstuff stacked on top of each other
+  chord like :
 
-/// Multiple musicstuff stacked on top of each other
+  - 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;
@@ -111,12 +118,6 @@ struct Music_general_chord : Complex_music {
     
     virtual void print() const ;
 };
-/**
-  chord like :
-
-  - different music forms which start at the same time ( stacked "vertically" )
-  
-  */
 
 struct Multi_voice_chord : Music_general_chord {
     void set_default_group(String);
index 94ff0458147ad44e01ee56c0a942172dc2105fa6..ef0d9d6a889f9763577cbe92dc093ae7555a1975 100644 (file)
@@ -17,7 +17,7 @@ struct Input_score {
     IPointerList<Input_staff*> staffs_;
     IPointerList<Input_command*> commands_;
     
-    /****************************************************************/
+    /* *************************************************************** */
     Input_score();
     Input_score(Input_score const&);
     void add(Array<Input_command*> &s);
@@ -28,7 +28,5 @@ struct Input_score {
     void print() const;
     Score*parse();
 };
-/**
-        
-    */
+
 #endif
index 647ffaf8a5829676af83dd0aaa9362a617bef14c..c1252ad01d21df2d0bf716f67e32c22ca2a95830 100644 (file)
@@ -20,7 +20,7 @@ struct Input_staff {
     IPointerList<Input_command*> commands_;
     IPointerList<Input_music*> music_;
 
-    /****************/
+    /* *************** */
 
     void add(Input_music*m);
     Input_staff(Input_staff const&);
index 68f1402c5b84d62191d60278299ecfad3c601e1a..e934f279f7374a639b8c0d47d34270c5727bb952 100644 (file)
@@ -6,24 +6,27 @@
 #include "string.hh"
 #include "staffelem.hh"
 
-/// a horizontally fixed size element of the score
+/**
+ 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;
     const char*name()const;
 };
-/** 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. 
-  
-*/
 
 
 #endif
index a0ea3e833d4ea58a2757a4c5f20357c29cd4fe03..fa41082fd87b0e0c911f7a8b51d3f8b9217c84af 100644 (file)
@@ -13,7 +13,7 @@
 class Key {
     Array<int> accidentals;
 
-    /****************/
+    /* *************** */
 
 public:
     Array<int> read(Array<Scalar> );
index 71a7dba2b1faa830e03d04e9d5514bdb426245b2..1d1d2e37f06ba1eae122d92ac4d927b9fe9fe4d3 100644 (file)
@@ -12,7 +12,7 @@
 
 struct Clef;
 
-/// 
+///   An item which places accidentals at the start of the line
 struct Keyitem : Item {
     const char * name() const;
     Array<int> pitch;
@@ -20,7 +20,7 @@ struct Keyitem : Item {
     int c_position;
 
     
-    /****************/
+    /* *************** */
     
     Keyitem(int cposition);
     void add(int pitch, int acc);
@@ -31,8 +31,5 @@ struct Keyitem : Item {
 
     Molecule* brew_molecule_p()const;
 };
-/**
-  An item which places accidentals at the start of the line
-  */
 
 #endif // KEYITEM_HH
index 9e5cf1b3039248ceaf2bff58da1c35f30bd33d2e..e2909d8879aa4daf1142802e0176e463ae531725 100644 (file)
@@ -33,7 +33,7 @@ struct My_flex_lexer : yyFlexLexer {
     Notename_tab * defaulttab;
     char const* data_ch_c_l_m;
     int errorlevel_i_;
-    /****************/
+    /* *************** */
     int ret_notename(int *p, String text, int octave_mod);    
     char const* here_ch_c_l();
     void set(Notename_tab *n);
diff --git a/hdr/linepstaff.hh b/hdr/linepstaff.hh
deleted file mode 100644 (file)
index 3e88f8c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "pstaff.hh"
-
-struct Linestaff : PStaff {
-    
-    int nolines;
-
-/****************/
-    
-    void brew_molecule_p(Real width);
-    Linestaff(int, PScore*);   
-};
index e23d334ca6345fc101d9ef46690363953bdc06fb..b9027754ce3bac7e58dca9a87511e85231584462 100644 (file)
@@ -13,7 +13,7 @@ struct Colinfo {
     const Real* fixpos;
     Interval width;
     
-    /****************/
+    /* *************** */
     Colinfo();
     void operator=(Colinfo const&);
     Colinfo(Colinfo const&);
@@ -27,7 +27,25 @@ struct Colinfo {
 };
 
 
-/// spacing for one line.
+/** 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<const Idealspacing*> ideals;
     Array<Colinfo> cols;
@@ -51,26 +69,28 @@ class Spacing_problem {
     void make_constraints(Mixed_qp& lp) const;
 
 public:
-    /// solve the spacing problem
+    /** solve the spacing problem
+          return the column positions, and the energy (last element)
+         */
     Array<Real> solve() const;
-    /**
-    return the column positions, and the energy (last element)
-    */
+
     /// add a idealspacing to the problem.
-    void add_ideal(const Idealspacing *i);
-    
     /**
+      
+      
     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
-    void add_column(const PCol *, bool fixed=false, Real fixpos=0.0);
-    /** columns have to be added left to right. The column contains
+       /** 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;
@@ -82,23 +102,4 @@ public:
 };
 
 
-/** 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.
-*/
 #endif
index 0da7e06858f368724f683872d82c1c17165b36a6..492a23f345eaad5f2c4b99bc30135bbe1dd91832 100644 (file)
@@ -20,7 +20,7 @@ struct Local_key_item : Item {
     Array<Item*> group;
     int c0_position;           // move into walker
 
-    /****************/
+    /* *************** */
     
     Local_key_item(int c0position);
     void add(Item*);
diff --git a/hdr/localkeyreg.hh b/hdr/localkeyreg.hh
new file mode 100644 (file)
index 0000000..742d9cb
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+  localkeyreg.hh -- part of LilyPond
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef LOCALKEYREG_HH
+#define LOCALKEYREG_HH
+#include "register.hh"
+
+struct Local_key_register : Request_register {
+    Local_key_item* key_item_p_;
+
+    /* *************** */
+    
+    virtual bool try_request(Request*);
+    virtual void process_request();
+    virtual void acknowledge_element(Staff_elem_info);
+    virtual void do_pre_move_process();
+    Local_key_register(Complex_walker*);
+};
+
+#endif // LOCALKEYREG_HH
index ac479b8549b3db534f899c04de87956b7fc1514e..540bf664f7eb2160100604d7c88fd8087d147e28 100644 (file)
@@ -11,7 +11,7 @@
 struct Lookup {
     Symtables *symtables_;
     String texsetting;
-    /****************/
+    /* *************** */
     void add(String, Symtable*);
 
     Real internote();
@@ -19,14 +19,16 @@ struct Lookup {
     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);
-    Symbol streepjes(int pos);
+
     /**
       pos == 3 : 3 lines above staff (extending below note)
 
       pos == -3: below staff
       */
+    Symbol streepjes(int pos);
 
     Symbol meter(Array<Scalar>);
     Symbol stem(Real y1_pos, Real y2_pos);
@@ -44,7 +46,7 @@ struct Lookup {
     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 &);
index 145ff7fc08a2dc69ac2e9be209adf02fe1cae758..118b9f34bdb5beca83d4d521211307e878b8338f 100644 (file)
@@ -26,10 +26,10 @@ struct Lyric_column : Staff_column {
     Array<Word_info> winfo_array_;
     Lyric_staff* lstaff_l_;
     
-    void typeset_item(Item *, int=1);
+    void typeset_item(Item *);
     virtual void setup_requests();
 
-    Lyric_column(Score_column*s,Lyric_staff*rs);
+    Lyric_column(Score_column* s,Lyric_staff*rs);
 };
 
 #endif // LYRICSTAFF_HH
index 7fda46142ea804d8bd2c30ff7dbb0bdc7e3a2ea7..5dcd90c8897d20b8c0dc35006e5a0ecc3662de27 100644 (file)
@@ -9,7 +9,7 @@
 #include "textitem.hh"
   
 struct Lyric_item : Text_item {
-    /****************/
+    /* *************** */
     Lyric_item(Lyric_req* lreq_l, int voice_count_i);
     virtual void do_pre_processing();    
 };
index 6959636c60f42ce70a69c92c4537b33ee3100038..22fb8958b6cc8cf25b31cbbc9e4af39ef510a175 100644 (file)
 
 /// (lstaff)
 struct Lyric_staff : Staff {
-    PStaff* line_pstaff_p_;
+    PStaff* pstaff_l_;
 
     Staff_column* create_col(Score_column*);
-    
-//    virtual Item *get_TYPESET_item(Command*);
-    virtual void set_output(PScore *);
-//    virtual Local_key_item* get_local_key_item();
 
+    virtual void set_output(PScore *);
     void process_commands(PCursor<Command*> &where);
     virtual void walk();
 
index 870efbb040e2dcc96fb913217421f6a538d094e4..fcf0c9186bd6481bc97b78dc27f7e241651ae9a9 100644 (file)
@@ -16,7 +16,7 @@ struct Lyric_item; // put into proto
 struct Lyric_walker: Staff_walker {
     Array<Lyric_item*> litem_l_array_;
 
-    /****************/
+    /* *************** */
     
     virtual void do_TYPESET_command(Command*);
     virtual void do_INTERPRET_command(Command*);
diff --git a/hdr/melodicstaff.hh b/hdr/melodicstaff.hh
deleted file mode 100644 (file)
index cec7351..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-  rhythmstaf.hh -- part of LilyPond
-
-  (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef MELODICSTAFF_HH
-#define MELODICSTAFF_HH
-
-#include "simplestaff.hh"
-
-/// five line staff, no multiple voices
-struct Melodic_staff : public Simple_staff
-{
-    
-    /****************/
-
-    virtual Rest *get_rest(Rest_req *rq);
-    virtual void set_output(PScore *);
-
-    virtual Item* get_TYPESET_item(Command*);
-    virtual Stem * get_stem(Stem_req *rq);
-    virtual Notehead * get_notehead(Note_req *rq, int bot);
-    virtual Local_key_item* get_local_key_item();
-};
-
-#endif // MELODICSTAFF_HH
-
-
index 835b661bae2eb29c963d51668c773f50a0963505..22a256c93c74e2129e3d0799fc27a35de960cc5f 100644 (file)
@@ -12,7 +12,7 @@
 struct Meter: Item {
     const char * name() const;
     Array<Scalar> args;
-    /****************/
+    /* *************** */
     
     Meter(Array<Scalar> args) ;
     Molecule*brew_molecule_p() const;
index 9f20458fef68a156b285bbd8af9560b4c22e10f0..084321ce4e809be9a755ee93a95acad107f975f6 100644 (file)
@@ -11,7 +11,7 @@ struct Atom {
     Offset off;
     Symbol sym;
 
-    /****************/
+    /* *************** */
     
     void translate(Offset o) {
        off += o;
@@ -26,11 +26,13 @@ struct Atom {
     String TeXstring() const;
 };
 
-/// a group of #Atom#s
+
+/** a group of individually translated symbols. You can add molecules
+    to the top, to the right, etc.  */
 struct Molecule {
     IPointerList<Atom*> ats;   // change to List<Atom>? 
 
-    /****************/
+    /* *************** */
     
     Molecule() { }
     Molecule(Atom a) { add(a) ; }
@@ -52,6 +54,4 @@ struct Molecule {
 private:
     void operator=(const Molecule&);
 };
-/** a group of individually translated symbols. You can add molecules
-    to the top, to the right, etc.  */
 #endif
index 66bed0360e53de71b19d9833bd848dbc51192928..b3b7d3ad23b8b43c8e29f3b06def58b925a5a82d 100644 (file)
@@ -8,7 +8,15 @@
 #define NOTEHEAD_HH
 #include "item.hh"
 
-/// ball at the end of the stem
+/**
+ ball at the end of the stem
+takes care of:
+
+  * help lines  
+  * proper placing of dots 
+
+  */
+
 struct Notehead : Item {
     const char * name() const;
     const char* defined_ch_c_l_m; //sorry, trying to find error in martien.ly
@@ -21,24 +29,17 @@ struct Notehead : Item {
     int balltype;
     int x_dir;
     
-    /****************/
+    /* *************** */
     
     void set_rhythmic(Rhythmic_req *);
-    Notehead(int staff_size);
+
     /**
       position of top line (5 linestaff: 8)
       */
-
+    Notehead(int staff_size);
     void do_print()const;
     static int compare(Notehead*&a, Notehead*&b) ;
     Molecule* brew_molecule_p()const;
 };
-/**
-  takes care of:
-
-  * help lines  
-  * proper placing of dots 
-
-  */
 #endif // NOTEHEAD_HH
 
index 6da51df33e01000006c4aed17f7c640f82a9bc93..da9ebd12ed2f65a68d7f9991eb0f5af868fa217c 100644 (file)
@@ -3,7 +3,15 @@
 #include "string.hh"
 #include "moment.hh"
 
-/// symbols, dimensions and constants
+
+/** 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 Paperdef {
     Lookup *lookup_p_;
     String outfile;
@@ -16,7 +24,7 @@ struct Paperdef {
     /// ideal = geometric_ ^ log2(duration)
     Real geometric_;
     
-    /****************/
+    /* *************** */
     void reinit();
     Paperdef(Lookup*);
     void set(Lookup*);
@@ -30,9 +38,4 @@ struct Paperdef {
     void print() const;
     Real duration_to_dist(Moment);
 };
-/** 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
- */
index 1d3ff34ca849c02d56a8e58014df01abfebe0fc2..0e8ed3e6776002ec6b567805b8935eb5a4673960 100644 (file)
@@ -7,26 +7,34 @@
 #include "item.hh"
 
 /// stuff grouped vertically.
-struct PCol {
+/**
+    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<const Item*> its;
     PointerList<const Spanner*> stoppers, starters;
     
 
     /// prebreak is put before end of line.
-    PCol *prebreak_p_;
     /**
     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_;
-    /**  \See{prebreak}
-    */
     
-    PCol *daddy_l_;
     /** 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_;
@@ -36,7 +44,7 @@ struct PCol {
 
     PScore * pscore_l_;
 
-    /****************/
+    /* *************** */
     /// which  one (left =0)
     int rank() const;
 
@@ -53,12 +61,12 @@ struct PCol {
     PCol(PCol * parent);
 
     /// which col comes first?
-    static int compare(const PCol &c1, const PCol &c2);
     /**
     signed compare on columns.
 
     return < 0 if c1 < c2.
-    */
+    */static int compare(const PCol &c1, const PCol &c2);
+    
 
     void OK() const;
     void set_breakable();
@@ -66,17 +74,7 @@ struct PCol {
 private:
     PCol(PCol const&){}
 };
-/**
-    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}
-  */
+
 
 #include "compare.hh"
 instantiate_compare(PCol &, PCol::compare);
index 1ef4d8d9f24adc48afd4d4e4dac9d3fab8b7985a..eac46fbecabb296323d80689b84ba85620b024d1 100644 (file)
@@ -65,6 +65,7 @@ struct Music_general_chord;
 struct Music_voice;
 struct Note_req;
 struct Notehead;
+struct Notehead_register;
 struct Notename_tab;
 struct Offset;
 struct Output;
@@ -84,12 +85,14 @@ struct Score;
 struct Score_column;
 struct Script_def;
 struct Script;
+struct Script_register;
 struct Script_req;
 struct Simple_music;
 struct Slur;
+struct Slur_register;
 struct Slur_req;
-class Source;
-class Source_file;
+struct Source;
+struct Source_file;
 struct Spacing_req ;
 struct Span_req;
 struct Spanner;
@@ -101,6 +104,7 @@ struct Staff_commands;
 struct Staff_commands_at ;
 struct Staff_elem;
 struct Staff_elem_info;
+struct Staff_symbol;
 struct Staff_walker;
 struct Stem;
 struct Stem_req;
@@ -114,7 +118,9 @@ struct Terminate_voice_req;
 struct Text_item ;
 struct Text_def;
 struct Text_gob;
+struct Text_register;
 struct Text_req;
+
 struct Time_description;
 struct Voice;
 struct Voice_element;
index 3b47c65e44580bcfc820606f08f8a7a0c1b37aea..f4b3f788d9b458c88f86f578777c71062255f5af 100644 (file)
@@ -9,7 +9,10 @@
 #include "pstaff.hh"
 
 /// all stuff which goes onto paper
-struct PScore {
+/** 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 {
     Paperdef *paper_l_;
     
     /// the columns, ordered left to right
@@ -33,7 +36,7 @@ struct PScore {
     /// broken spanners
     IPointerList<Spanner*> broken_spans;
 
-    /****************/
+    /* *************** */
     /* CONSTRUCTION */
     
     PScore(Paperdef*);
@@ -42,8 +45,12 @@ struct PScore {
 
     void add(PStaff *);
     
-    /// add item
-    void typeset_item(Item *,  PCol *,PStaff*,int=1);
+     /// 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*);
@@ -91,8 +98,5 @@ private:
     /// delete unused columns
     void clean_cols();
 };
-/** 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.
- */
+
 #endif
index 2c79427f7868680f01fb730a0524578e41621406..50a7f0c7198db08da99a7736994df038b6ddb61a 100644 (file)
@@ -8,18 +8,16 @@
 
 /// items grouped horizontally
 struct PStaff {
-    Molecule * stafsym_p_;
     PScore * pscore_l_;
     
     
     PointerList<const Spanner*> spans;
     PointerList<Item*> its;
 
-    /****************/
-    virtual void brew_molecule_p(Real width)=0; // maybe overkill
+    /* *************** */
     void add(Item*i);
     PStaff(PScore*);
-    virtual ~PStaff();
+
 private:
     PStaff(PStaff const&);
 };
index db5438499d6beaf75723159e637fcbe6ef8e369d..6e82aa9c40fa717135191392102abbaceafff6f8 100644 (file)
@@ -14,20 +14,19 @@ public:
     Vector lin;
     Real const_term;
 
-    ///
-    void assert_solution(Vector sol) const;
+
     /**
       use a KKT method to assert optimality of sol
       */
-    /// solve the problem using a projected gradient method
+     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();
     }
-    /** return the number of variables in the problem */
-    ///
-    void add_inequality_cons(Vector c, double r);
+
     /**
       add a constraint
 
@@ -38,14 +37,15 @@ public:
       c.dim() == dim();
        
       */
-    ///
-    Ineq_constrained_qp(int novars);
+    void add_inequality_cons(Vector c, double r);
+    
     /** set up matrices to go with the problem. */
-
-    Real eval(Vector v);
+    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;
@@ -54,6 +54,15 @@ public:
 };
 
 /// 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<int> eq_cons;
     Array<Real> eq_consrhs;
@@ -65,8 +74,7 @@ public:
     Vector solve(Vector start) const;
     void add_fixed_var(int i , Real value);
     
-    ///
-    void add_equality_cons(Vector c, double r);
+
     /**
       add a constraint,
 
@@ -75,15 +83,6 @@ public:
       PRE
       c.dim()==dim();
      */
-
+    void add_equality_cons(Vector c, double r);
 };
-/**
-  problem definition of a quadratic optimisation problem with linear
-  inequality and equality constraints
-
-
-    x^T QUAD x /2 + b^T x 
-*/
-
-
 #endif
index b9789bfc4aac1f042b06b24b993210f7ad3e8271..aefcc767e7d75b3ec53d0205f0a1802c1252c635 100644 (file)
@@ -2,6 +2,18 @@
 #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;
     
@@ -18,23 +30,23 @@ public:
     Real rhs(int k) const { return opt->consrhs[k]; }
     
     /// drop constraint
-    void drop (int k);
     /** drop constraint k from the active set. k is the index of the
     constraint in #active#
     
     */
+    void drop (int k);
     
     ///     add constraint j
-    void add(int 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.
@@ -48,19 +60,10 @@ public:
     void OK();
 };
 
-/**
-    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.
-    
+/**
+    loop through the inactive constraints.
   */
-
-///
 class Inactive_iter {
     int j;
     Active_constraints const* ac;
@@ -73,6 +76,3 @@ public:
     Real rhs() const { return ac->rhs(constraint_id()); }
     bool ok() const { return j < ac->inactive.size(); }
 };
-/**
-    loop through the inactive constraints.
-  */
index e2b5167d8d0d405f70967708fc86bf5213606ff4..0c47e35cd1979bd2ed7a8c6a04c7bc0b9e03c2e2 100644 (file)
 #define REGISTER_HH
 #include "proto.hh"
 #include "varray.hh"
+#include "request.hh"
 
 /// data container.
 struct Staff_elem_info {
     Staff_elem * elem_p_;
     Request*req_l_;
     const Voice * voice_l_;
-    Voice_group_registers * group_regs_l_;
+    Voice_group_registers * group_regs_l_; 
     Request_register * origin_reg_l_;
 
-    /****/
+    /* *** */
     Staff_elem_info(Staff_elem*, Request*, Request_register*);
     Staff_elem_info();
 };
 
 /// Hungarian postfix: reg
+/**
+  a struct which processes requests, and creates the Staff_elems  
+  */
 struct Request_register {
     Complex_walker * walk_l_;
     Array<Request*> accepted_req_arr_;
     
-    /****************/
-
+    /* *************** */
+    /**
+      Warning: you can't copy a Request_register
+      */
+    Request_register(Request_register const &);
     Request_register(Complex_walker*);
     Request_register();
     virtual ~Request_register(){}
 
-    /// take note of item/spaanner
+    /** take note of item/spaanner
+       put item in spanner. Adjust local key; etc.
+      */
     virtual void acknowledge_element(Staff_elem_info){}
     /**
-      put item in spanner. Adjust local key; etc.
+      Announce element to  walker
+      */
+    void announce_element(Staff_elem_info);
+
+    /**
+      invoke walker method to typeset element
       */
+    void typeset_element(Staff_elem*elem_p);
     
-    ///
-    virtual bool try_request(Request *req_l) =0;
     /**
       try to fit the request in this register
 
-      RETURN
-      false: request noted, but not taken.
+      @return
+      false: not noted,  not taken.
 
       true: request swallowed. Don't try to put elsewhere
 
       (may be we could use C++ exceptions.. :-)
       */
-
+    virtual bool try_request(Request *req_l) =0;
+    
     /// make items/spanners with the requests you got
     virtual void process_request()=0;
-
+    Paperdef * paper() const;
     /// typeset any spanners. Empty accepted_req_arr_
     void pre_move_processing();
     void post_move_processing();
-    
+    virtual void set_dir(int){}
 protected:
     /// virtual, called by pre_move_process()
     virtual void do_pre_move_process(){}
     virtual void do_post_move_process(){}
 };
-/**
-  a struct which processes requests, and creates the Staff_elems  
-  */
 
-struct Notehead_register : Request_register {
-    Item* note_p_;
-    /****************/
-    Notehead_register(Complex_walker*);
-    virtual bool try_request(Request *req_l) ;
-    virtual void process_request();
-    virtual void do_pre_move_process();
-};
-
-struct Slur_register : Request_register {
-    Array<Slur_req*> requests_arr_;
-    Array<Slur *> slur_l_stack_;
-    Array<Slur*> end_slur_l_arr_;
-    
-    /****************/
-    ~Slur_register();
-    Slur_register(Complex_walker*);
-    virtual bool try_request(Request*);
-    virtual void process_request();
-    virtual void acknowledge_element(Staff_elem_info);
-    virtual void do_pre_move_process();
-};
-
-struct Stem_beam_register : Request_register {
-    Stem * stem_p_;
-    Beam * beam_p_;
-    Beam_req * beam_req_l_;
-    Stem_req * stem_req_l_;
-    Beam_req * start_req_l_;
-    bool end_beam_b_;
-    Rhythmic_grouping *current_grouping;
-    int default_dir_i_;
-    
-    /****************/
-    Stem_beam_register(Complex_walker*);
-    ~Stem_beam_register();
-    void set_dir(int dir_i_);
-    virtual bool try_request(Request*);
-    virtual void process_request();
-    virtual void acknowledge_element(Staff_elem_info);
-    virtual void do_pre_move_process();
-    virtual void do_post_move_process();
-};
-
-struct   Script_register : Request_register {
-    Script * script_p_;
-    
-    /****************/
-    void set_dir(int dir_i_);
-    Script_register(Complex_walker*);
-    virtual bool try_request(Request*);
-    virtual void process_request();
-    virtual void acknowledge_element(Staff_elem_info);
-    virtual void do_pre_move_process();
-};
-
-struct Text_register : Request_register{
-    Text_item * text_p_;
-
-    /****************/
-    void set_dir(int dir_i_);
-    Text_register(Complex_walker*);
-    virtual bool try_request(Request*);
-    virtual void process_request();
-    virtual void do_pre_move_process();
-};
-
-
-struct Local_key_register : Request_register {
-    Local_key_item* key_item_p_;
-
-    /****************/
-    
-    virtual bool try_request(Request*);
-    virtual void process_request();
-    virtual void acknowledge_element(Staff_elem_info);
-    virtual void do_pre_move_process();
-    Local_key_register(Complex_walker*);
-};
 
 #endif // REGISTER_HH
 
index 44d42e5301ac57ffe40ea1c0533444d0c9f6ae12..d07bbd346995a6795d0b4c417cb87fcd9f97b1c3 100644 (file)
@@ -7,11 +7,16 @@
 #include "moment.hh"
 
 /// Hungarian postfix: req
+/**
+ a voice element wants something printed.
+see lilygut page
+ */
+
 struct Request {
     Voice_element*elt_l_;
     char const* defined_ch_c_l_m;
     
-    /****************/
+    /* *************** */
     Request();
     Request(Request const&);
     virtual ~Request(){}
@@ -47,11 +52,6 @@ struct Request {
 protected:
     virtual void do_print()const ;
 };
-/**
- a voice element wants something printed.
-see lilygut page
- */
-
 
 #define REQUESTMETHODS(T,accessor)     \
 virtual T * accessor() { return this;}\
@@ -83,7 +83,7 @@ struct Rhythmic_req : virtual Request {
     int balltype;
     int dots;
     Moment plet_factor;
-    /****************/
+    /* *************** */
     static int compare(const Rhythmic_req &, const Rhythmic_req &);
     Moment duration() const;
     Rhythmic_req();
@@ -95,7 +95,7 @@ struct Spacing_req :virtual Request {
     Moment next;
     Real distance;
     Real strength;
-    /****************/
+    /* *************** */
     Spacing_req();
     REQUESTMETHODS(Spacing_req, spacing);
 };
@@ -109,7 +109,7 @@ struct Blank_req : Spacing_req, Rhythmic_req {
 struct Text_req : virtual Request {
     int dir_i_;
     Text_def *tdef_p_;
-    /****************/
+    /* *************** */
     Text_req(int d, Text_def*);
     ~Text_req();
     Text_req(Text_req const&);
@@ -152,25 +152,29 @@ struct Note_req : Rhythmic_req, virtual Melodic_req {
 
 
 ///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.
+*/
+
 struct Rest_req : Rhythmic_req {
 
  REQUESTMETHODS(Rest_req,rest);
 };
+/// attach a stem to the noteball
 /**
-Why a request? It might be a good idea to not typeset the rest, if the paper is too crowded.
-*/
+  Rhythmic_req parent needed to  determine if it will fit inside a beam.
+  */
 
-/// attach a stem to the noteball
 struct Stem_req : Rhythmic_req {
     int dir_i_;
     Stem_req(int s, int dots);
     REQUESTMETHODS(Stem_req,stem);
 };
-/**
-  Rhythmic_req parent needed to  determine if it will fit inside a beam.
-  */
 
 /// requests to start or stop something.
+/**
+ This type of request typically results in the creation of a #Spanner#
+*/
 struct Span_req : Request {
     /// should the spanner start or stop, or is it unwanted?
     enum {
@@ -182,25 +186,22 @@ struct Span_req : Request {
     Span_req();
   
 };
-/**
- This type of request typically results in the creation of a #Spanner#
-*/
 
 
 ///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();
 };
 
-/**   if #nplet# is set, the staff will try to put an
-appropriate number over the beam
-    */
-
 /// a slur
 struct Slur_req : Span_req {
  REQUESTMETHODS(Slur_req,slur);
@@ -209,32 +210,32 @@ struct Slur_req : Span_req {
 
 
 ///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 : Request {
     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&);
 };
-/** eg upbow, downbow. Why a request? These symbols may conflict with
-slurs and brackets, so this also a request */
 
 
 /// designate this spot with a name.
 struct Mark_req : Request {
     String mark_str_;
-    /****************/
+    /* *************** */
     Mark_req(String);
     REQUESTMETHODS(Mark_req,mark);
 };
 
 struct Staff_command_req : Request {
     Input_command * com_p_;
-    /****************/
+    /* *************** */
     Staff_command_req(Staff_command_req const&);
     ~Staff_command_req();
     Staff_command_req(Input_command*);
@@ -280,9 +281,6 @@ struct Subtle_req {
 };
 
 /// helper in the hierarchy
-struct Dynamic:Subtle_req {
-
-};
 /** 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
@@ -295,6 +293,9 @@ struct Dynamic:Subtle_req {
     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 {
     
index 02c6e0bff63f450899bfe898a70caf4291c104f3..d03bd0c96f800657721f890a6066000c51bc8f19 100644 (file)
@@ -8,13 +8,12 @@
 #define REST_HH
 #include "item.hh"
 
-/// ball at the end of the stem
 struct Rest : Item {
 
     int dots;
     int balltype;
 
-    /****************/
+    /* *************** */
 
 
     Rest(int dur,int dots);
@@ -22,12 +21,5 @@ struct Rest : Item {
     const char * name() const;
     Molecule* brew_molecule_p()const;
 };
-/**
-  takes care of:
-
-  * help lines  
-  * proper placing of dots 
-
-  */
 #endif 
 
diff --git a/hdr/rhythmstaff.hh b/hdr/rhythmstaff.hh
deleted file mode 100644 (file)
index 0508224..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-  rhythmstaf.hh -- part of LilyPond
-
-  (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef RHYTHMSTAF_HH
-#define RHYTHMSTAF_HH
-
-#include "simplestaff.hh"
-
-/// all notes on one line
-struct Rhythmic_staff : public Simple_staff
-{
-
-    /****************/
-    
-    virtual Item *get_TYPESET_item(Command*);    
-    virtual Stem *get_stem(Stem_req *rq);
-    virtual Notehead * get_notehead(Note_req *rq, int b);   
-    virtual void set_output(PScore *);
-};
-
-#endif // RHYTHMSTAF_HH
-
-
index 75f1bcd89b43683fca64f5236ed51f20bea6a106..1d2f4022bbb9bd90de0ab062be548ded4a5042e3 100644 (file)
 #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)
+
+    */
+
 struct Score_column {
 
     /// indirection to column
@@ -19,10 +29,10 @@ struct Score_column {
     /// length of notes/rests in this column
     Array<Moment> durations;
     
-    /// 
+
     bool musical_;
     
-    /****************/
+    /* *************** */
     Moment when() {  return when_; }
     Score_column(Moment when);       
     static int compare(Score_column & c1, Score_column &c2);
@@ -35,15 +45,6 @@ struct Score_column {
 private:
     Moment when_;
 };
-/**
-
-    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)
-
-    */
 
 instantiate_compare(Score_column&, Score_column::compare);
 
index 64e282861454d06dc711ede99aa67d699bc0c16a..cd5a56c5e73279b4952efc41eaa542b55dec3ea9 100644 (file)
@@ -5,6 +5,7 @@
 #include "plist.hh"
 #include "moment.hh"
 #include "assoc.hh"
+#include "string.hh"
 
 /// the total music def of one movement
 struct Score {
@@ -20,7 +21,8 @@ struct Score {
     int errorlevel_i_;
     
     Assoc<String, Moment> markers_assoc_;
-    /****************************************************************/
+
+    /* *************************************************************** */
 
     /// construction
     Score(Paperdef*);
@@ -40,28 +42,26 @@ struct Score {
 
     // utils:
     PCursor<Score_column*> create_cols(Moment);
+
+    /// find a column. The cursor is given to try a little efficiency.
     PCursor<Score_column *> find_col(Moment,bool);
+    
     /// when does the last *musical* element finish?
     Moment last() const;
 
 private:
     Score(Score const&){}
-    ///
-    void do_cols();
+
     /**
       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();
-    /** add the score wide commands (bars, breaks) to each staff so
-    they can process (typeset) them if needed */
 };
-/**
-        
-    */
 #endif
index 3c6ee0de0494e3ba33ed50c2551695adf9098182..f4e19870338fd72db780dd6f805ec9f79185858b 100644 (file)
@@ -19,7 +19,7 @@ Line_of_score {
     IPointerList<Line_of_staff*> staffs;
     PScore * pscore_l_;        // needed to generate staffs
 
-    /****************/
+    /* *************** */
     void process() ;
     Line_of_score(Array<PCol *> sv,  PScore *);
 
index 2a10e7d49ee4dbde69ad3b2c86fa9ad5530dd37d..9c48c75e248d5d33b631436df1965d1985f6b526 100644 (file)
@@ -19,7 +19,7 @@ struct Script : Item {
     Stem *stem_l_;
     Array<Item *> support;
 
-    /****************/
+    /* *************** */
     const char * name() const;    
     Molecule*  brew_molecule_p()const;
     virtual void do_post_processing();
index 423860a89505245232fd5e291139fe4582373e3a..3c22681d23d4eb3121d5a7274c8b0799c6fb4e45 100644 (file)
@@ -14,7 +14,7 @@ struct Script_def{
     bool invertsym;
     String symidx;
 
-    /****************/
+    /* *************** */
     int compare(Script_def const &);
     void print() const;
     Script_def(String, int, int ,bool);
diff --git a/hdr/scriptreg.hh b/hdr/scriptreg.hh
new file mode 100644 (file)
index 0000000..7295342
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+  scriptreg.hh -- part of LilyPond
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef SCRIPTREG_HH
+#define SCRIPTREG_HH
+
+#include "register.hh"
+
+
+struct   Script_register : Request_register {
+    Script * script_p_;
+    int dir_i_;
+    /* *************** */
+    void set_dir(int dir_i_);
+    Script_register(Complex_walker*);
+    virtual bool try_request(Request*);
+    virtual void process_request();
+    virtual void acknowledge_element(Staff_elem_info);
+    virtual void do_pre_move_process();
+};
+
+#endif // SCRIPTREG_HH
diff --git a/hdr/simplestaff.hh b/hdr/simplestaff.hh
deleted file mode 100644 (file)
index f0ff167..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
-  simplestaff.hh -- part of LilyPond
-
-  (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef SIMPLESTAFF_HH
-#define SIMPLESTAFF_HH
-
-#include "key.hh"
-#include "stcol.hh"
-#include "staff.hh"
-#include "staffwalker.hh"
-
-/*
-   mega-stupido staffs and cols: they do notes one at each moment.   
-   */
-
-struct Simple_staff;
-struct Note_info {
-    Rhythmic_req *rq;
-    Array<Script_req*> scripts;
-    Note_info();
-    Note_info(Rhythmic_req*);
-};
-
-/// column of Simple_staff: store one request
-struct Simple_column : Staff_column {
-
-    Array<Note_info> notes;
-    Array<Slur_req *> slurs;
-    Stem_req *stem_;
-    Moment stem_requester_len;
-    Beam_req *beam_;
-    Simple_staff* staff_l_;
-    Text_req *text_;
-    
-    /****************/
-    Slur_req  * find_slur(Voice *);
-    void typeset_item(Item *, int=1);
-    void typeset_item_directional(Item *, int dir, int=1);
-
-    Molecule *create_command_mol(Command *com);
-
-    void take_request(Request *rq);   
-    virtual void setup_requests();
-
-    Simple_column(Score_column*s,Simple_staff*rs);
-};
-
-
-/// Simple  staff: one voicegroup  at a time
-struct Simple_staff : Staff {
-    /// indirection to the PStaff.
-    PStaff *theline_l_;
-
-    /****************/
-    Staff_column*create_col(Score_column*);
-    
-    virtual Item *get_TYPESET_item(Command*);
-    virtual Stem *get_stem(Stem_req *rq)=0;
-    virtual Notehead *get_notehead(Note_req *rq, int b)=0;
-    virtual Rest *get_rest(Rest_req *rq);
-    virtual void set_output(PScore *);
-    virtual Local_key_item* get_local_key_item();
-
-    void process_commands( PCursor<Command*> &where);
-    virtual void walk();
-
-    Simple_staff();
-};
-
-#endif // SIMPLESTAFF_HH
-
-
-
-
diff --git a/hdr/simplewalker.hh b/hdr/simplewalker.hh
deleted file mode 100644 (file)
index a438446..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-  simplewalker.hh -- part of LilyPond
-
-  (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef SIMPLEWALKER_HH
-#define SIMPLEWALKER_HH
-
-#include "proto.hh"
-#include "grouping.hh"
-
-
-struct Simple_walker: Staff_walker {
-    Stem *stem_;
-    Array<Notehead *>noteheads;
-    Local_key local_key_;
-    Key key_;
-    Array<int> *oldkey_undo;
-    Array<int> typesetkey;
-    Beam *beam_;
-    Local_key_item *local_key_item_;
-    bool wantkey;              // urgh
-    int processed_bar_priority;
-    bool processed_key;
-    bool processed_clef;
-    Clef clef_;
-    Rhythmic_grouping default_grouping;
-    Rhythmic_grouping *current_grouping;
-    Array<Slur_req*> pending_slur_reqs;
-    Array<Slur*>  pending_slurs;
-
-    /****************/
-
-    virtual void do_TYPESET_command(Command*);
-    virtual void do_INTERPRET_command(Command*);
-    virtual void process_requests();
-    virtual void do_post_move();
-    ~Simple_walker();
-    Simple_walker(Simple_walker const& c);
-    void do_note(Note_info);
-    Simple_walker(Simple_staff*);
-    Simple_column *col();
-    Simple_staff *staff();
-
-    void do_local_key(Note_req*, Notehead*);
-    int find_slur(const Voice*v);
-};
-
-
-#endif // SIMPLEWALKER_HH
-
-
index c9524ba6f5311a7071a74ff57ca8e563e27a2eb5..c3e6a93c7619701a678908b7179dd5b5cbe39eff 100644 (file)
 struct Slur : Directional_spanner {
 
     Array<Notehead*> encompass;
-    //int dir;
 
-    bool open_left,open_right;                 
+    bool open_left, open_right;                        
 
-    /****************/
+    /* *************** */
     Offset center() const;
     Slur();
     void do_post_processing();
diff --git a/hdr/slurreg.hh b/hdr/slurreg.hh
new file mode 100644 (file)
index 0000000..701b60a
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+  slurreg.hh -- declare Slur_register
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef SLURREG_HH
+#define SLURREG_HH
+
+#include "register.hh"
+
+struct Slur_register : Request_register {
+    Array<Slur_req*> requests_arr_;
+    Array<Slur *> slur_l_stack_;
+    Array<Slur*> end_slur_l_arr_;
+    int dir_i_;
+    /* *************** */
+    ~Slur_register();
+    Slur_register(Complex_walker*);
+    virtual bool try_request(Request*);
+    virtual void process_request();
+    virtual void acknowledge_element(Staff_elem_info);
+    virtual void do_pre_move_process();
+    virtual void set_dir(int);
+};
+
+#endif // SLURREG_HH
index 1e1e2a86922e00c3faa30111fd1a3f06ee1a3940..38a420248b3bde368d7c9e7a6e5380288e2080d3 100644 (file)
@@ -9,11 +9,10 @@
 class Source_file
 {
 public:
-    ///
-    Source_file( String &filename_str );
     /**
       RETURN path to opened file.
      */
+    Source_file( String &filename_str );
     ~Source_file();
     char const* ch_c_l();
     String error_str( char const* pos_ch_c_l );
index 144b110e29df0b5e64bb4362d5d56f7b2c24d948..097a592cd608bf7edc898301375220060ebd3ceb 100644 (file)
 #include "staffelem.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;
@@ -25,29 +43,11 @@ struct Spanner:Staff_elem {
     virtual Spanner* spanner() { return this; }
 protected:
     /// clone a piece of  this spanner.
-    virtual Spanner *do_break_at( PCol *c1,  PCol *c2) const=0; 
     /**
  
     PRE
     c1 >= start, c2  <= stop
     */
+    virtual Spanner *do_break_at( PCol *c1,  PCol *c2) const=0; 
 };
-/** 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.
-
-    */
 #endif
index cee6d27a19a15db3d7ac2049e42edd713f6c2f47..6f43293b264c6baa188181a1b8401b1eee200059 100644 (file)
@@ -16,7 +16,7 @@ struct Staff {
     PScore *pscore_l_;
     String define_spot_str_;
 
-    /****************************************************************/
+    /* *************************************************************** */
 
     void add(PointerList<Voice*> &s);
     void do_commands(PointerList<Input_command*> score_wide,
@@ -34,10 +34,10 @@ struct Staff {
     Paperdef*paper()const;
     
     /// interpret all requests and add items to #destination#.
-    void process();
     /**
     This routines calls virtual functions from Staff, to delegate the
     interpretation of requests to a derived class of Staff */
+    void process();
 
     
     void setup_staffcols();
@@ -51,13 +51,13 @@ struct Staff {
     /// remove unused cols
     void clean_cols() ;
     
-    Staff_column * get_col(Moment,bool);
+    Staff_column *get_col(Moment,bool); // ugh
 
     Staff();
 
-    /****************************************************************
+    /* 
       VIRTUALS
-    ****************************************************************/
+      */
 
     virtual void set_output(PScore * destination)=0;
     virtual void walk()=0;    
index 1a25b9bdb4cee95c4569fa03dbab95498cbe0693..1caead811eafd3e070a82a88cebce9285b716850 100644 (file)
@@ -14,7 +14,7 @@
 struct Staff_commands_at : public IPointerList<Command*> {
     Time_description tdescription_;
     
-    /****************/
+    /* *************** */
     
     bool is_breakable();
     Moment when();
index ba3df695bfe4a99655842c35846c3593e4c8c403..3928c994e919bc2806a11e52253f62d95ca8991c 100644 (file)
 #include "offset.hh"
 #include "molecule.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
@@ -25,7 +31,7 @@ struct Staff_elem {
     ///  the pstaff it is in
     PStaff *pstaff_l_;
 
-    /****************/
+    /* *************** */
     Staff_elem(Staff_elem const&);
     String TeXstring () const ;
     virtual void print() const;
@@ -65,21 +71,14 @@ private:
     /// member: the symbols
     Molecule *output;          // should scrap, and use temp var?
 
-    /// 
-    Offset offset_;
+
     /**
       This is  needed, because #output# may still be
       NULL.
       */
+    Offset offset_;
     Array<Staff_elem*> dependencies;
 };
-/** 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.
-
-  */
-
 #define NAME_METHOD(c) const char *c::name()const{ return #c; } struct c
 #endif // STAFFELEM_HH
 
index f44754a5d216af1970cb5199406ebb4bfefdaa0c..9fbe3ec9177a1964c56c3c7b4815c452a4784ed9 100644 (file)
@@ -20,7 +20,7 @@ struct Line_of_staff {
     Line_of_score  * line_of_score_l_;
     PStaff *pstaff_l_;
 
-    /****************/
+    /* *************** */
     
     String TeXstring() const;
     Line_of_staff(Line_of_score*, PStaff *);
diff --git a/hdr/staffsym.hh b/hdr/staffsym.hh
new file mode 100644 (file)
index 0000000..294a021
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+  staffsym.hh -- declare Staff_symbol
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#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_;
+
+    const char *name()const;
+    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
index efac63e7b030681d507398383fe4942fceed7a63..3b78c29c6b75493dfdc4c6ca0238ef6a40cbee39 100644 (file)
 
 #include "staff.hh"
 
+/**
+  manage run-time info when walking staffcolumns such as: key,
+  meter, pending beams & slurs
+  */
 struct Staff_walker : public PCursor<Staff_column*> {
     Staff * staff_l_;
     PScore * pscore_l_;
 
     int break_status;
     
-    /****************/
+    /* *************** */
 
     int priority() const;              // Command
     Moment when() const;    
@@ -26,9 +30,9 @@ struct Staff_walker : public PCursor<Staff_column*> {
     void process_command(Command *);
     void operator++(int);
 
-    /****************
+    /* ***************
       VIRTUAL
-     ****************/
+     *************** */
 
     /// every time ++ is called
     virtual void do_pre_move(){}
@@ -39,10 +43,6 @@ struct Staff_walker : public PCursor<Staff_column*> {
 private:
     Staff_walker(Staff_walker const&);
 };
-/**
-  manage run-time info when walking staffcolumns such as: key,
-  meter, pending beams & slurs
-  */
 
 #endif // STAFFWALKER_HH
 
index 0984f88022b2cfc64ca244f0ac0ce60c0f1211ab..0ae5244d8a6751d9c8a366bb81f69f2ad26c9bd3 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  stcol.hh -- part of LilyPond
+  stcol.hh -- declare Staff_column
 
   (c) 1996,97 Han-Wen Nienhuys
 */
@@ -23,22 +23,22 @@ struct Staff_column {
 
     Time_description *tdescription_;
     
-    /****************/
+    /* *************** */
     
-    Staff_column(Score_column*s); 
-    bool mus() const;
+    Staff_column(Score_column*); 
+    bool musical_b() const;
     Moment when() const;
     void add(Voice_element*ve);
     void OK() const;
-    /****************************************************************
+    /*
       VIRTUAL
-    ****************************************************************/
+    */
 
     virtual void setup_requests()=0;
 
     virtual ~Staff_column();
 private:
-    Staff_column(Staff_column const&){}
+    Staff_column(Staff_column const&);
 };
 
 
index e4c3794a8c0e60562852a9b8df9dc855770ae9e7..962d1f4ba3ffba7d302383fff19846115a1bde23 100644 (file)
 #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 {
 /*
     /// rhythmical length
@@ -29,27 +39,27 @@ struct Stem : Item {
     int staff_center;
 
     // extent of the stem (positions)
-    Real bot, top;
     /**
       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
-    int dir;
     /**
        -1 stem points down, +1: stem points up
        */
 
+    int dir;
     Real stem_xoffset;
     
     Array<Notehead*> heads;
 
-    /****************/
+    /* *************** */
     Stem(int center); //, Moment duration);
     
     /// ensure that this Stem also encompasses the Notehead #n#
@@ -70,14 +80,4 @@ struct Stem : Item {
 
     Molecule* brew_molecule_p() const;
 };
-/**
-  takes care of:
-
-  \begin{itemize}
-  \item the rule
-  \item the flag
-  \item up/down position.
-  \end{itemize}
-  */
-
 #endif
diff --git a/hdr/stembeamreg.hh b/hdr/stembeamreg.hh
new file mode 100644 (file)
index 0000000..3d9d602
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+  stembeamreg.hh -- part of LilyPond
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#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(Complex_walker*);
+    ~Stem_beam_register();
+    void set_dir(int dir_i_);
+    virtual bool try_request(Request*);
+    virtual void process_request();
+    virtual void acknowledge_element(Staff_elem_info);
+    virtual void do_pre_move_process();
+    virtual void do_post_move_process();
+};
+#endif // STEMBEAMREG_HH
index c33f30e202d5884479b61299f86d35ea54c8c4f6..baff1c634d275b08c567cc1e5c022be12c12077c 100644 (file)
@@ -6,14 +6,14 @@
 #include "scalar.hh"
 
 /// parameter substitution in TeXstrings
-String
-substitute_args(String source, Array<String> args);
 /**
-  this structure provides a simple macro mechanism:
+  this function provides a simple macro mechanism:
 
   if source == "tex%bla%", then
-  eval({"X","Y"})  == "texXblaY"
+  substitute_args(source, {"X","Y"})  == "texXblaY"
   */
+String
+substitute_args(String source, Array<String> args);
 
 /// parameter substitution in TeXstrings
 String
index 4e95c93a6e66f2189dcca80419a19073e19867f1..8100ed45d88992c1dfa89a349e297f02b4c1ab67 100644 (file)
@@ -17,7 +17,7 @@ struct Text_def  {
     char const* defined_ch_c_l_m;
   
 
-    /*****************/
+    /* ****************/
     virtual ~Text_def() {};
     bool compare(const Text_def&);
     Text_def();
index c563fc80ca7f6a2ff070348098b518b79bac41eb..c7df9069d96c11420b39e81616801b90335d717b 100644 (file)
@@ -16,7 +16,7 @@ struct Text_item : Item {
     int dir_i_;
     Text_def* tdef_l_;
     
-    /****************/
+    /* ***************/
     const char * name() const;    
     virtual void set_default_pos();
     Molecule* brew_molecule_p() const;
diff --git a/hdr/textreg.hh b/hdr/textreg.hh
new file mode 100644 (file)
index 0000000..3dd2172
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+  textreg.hh -- part of LilyPond
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef TEXTREG_HH
+#define TEXTREG_HH
+#include "register.hh"
+
+struct Text_register : Request_register{
+    Text_item * text_p_;
+    int dir_i_;
+    /* *************** */
+    void set_dir(int dir_i);
+    Text_register(Complex_walker*);
+    virtual bool try_request(Request*);
+    virtual void process_request();
+    virtual void do_pre_move_process();
+};
+
+#endif // TEXTREG_HH
index 8bfb9aab6b63ad7a483048bdb654b01880a478df..40ae5ffa640706156a141e6fa495347a83f33900 100644 (file)
 #include "textdef.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 tpos;
+    Offset text_off_;
     Directional_spanner*support;
 
-    /****************/
+    /* *************** */
 
     const char * name() const;
     virtual    void do_pre_processing();
     virtual    void do_post_processing();
-    Molecule* brew_molecule_p()const;
     virtual    Interval height() const ;
-    void do_print() 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*);
 };
-/**
-  Use for triplets, eentweetjes, ottava, etc.
-  */
-
 #endif // TEXTSPANNER_HH
 
index 5fb77497938b5e4de71b779b42c3646b15b6d83b..4eb5db119464916f1e8b8b362de77f1ab399280c 100644 (file)
@@ -29,7 +29,7 @@ struct Time_description {
     /// idem
     int bars;
 
-    /****************/
+    /* *************** */
     void set_cadenza(bool);
     void OK() const;
     Time_description(Moment, const Time_description*);
index e75d27a4b3a5ae7ac2cb0b542d05ba1b3b16afc8..27ec95cd165f9a8a2b748839af4806e8c3d168b3 100644 (file)
@@ -5,6 +5,11 @@
 #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;
@@ -21,9 +26,4 @@ struct Tex_stream {
 private:
     Tex_stream(Tex_stream const&);
 };
-/**
-  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.
-  */
 #endif
index 03ea55b9ee21201bf6e8b82e75e574e26033da45..20538ae861743767f2ac9fdf7301772f095f9d8a 100644 (file)
@@ -6,11 +6,18 @@
 #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
+
+    */
+
 struct Voice {
     IPointerList<Voice_element *> elts;
     Moment start;
 
-    /****************/
+    /* *************** */
     Moment when(const Voice_element*)const;
     Moment last() const;
     Voice();
@@ -19,21 +26,16 @@ struct Voice {
     void print() const;
     void set_default_group(String id);
 };
-/**
-
-    Voice is a ordered row of Voice_elements. It is strictly horizontal:
-    you cannot have two rhythmic elements running parallel in a Voice
-
-    */
-
 /// one horizontal bit. 
+/** Apart from being a container for the requests, Voice_element is nothing
+    */
 struct Voice_element {
     Moment duration;
     char const* defined_ch_c_l_m;
     const Voice *voice_l_;
     IPointerList<Request*> reqs;
 
-    /****************/
+    /* *************** */
     
     void add(Request*);
     Voice_element();
@@ -41,6 +43,4 @@ struct Voice_element {
     void print ()const;
     void set_default_group(String id);
 };
-/** Apart from being a container for the requests, Voice_element is nothing
-    */
 #endif
index a6f370ec803110aa0cb5cc42a965d0df7d68222e..2240433c468a79b0d322332cc9a958af88614dd2 100644 (file)
@@ -8,21 +8,21 @@
 #define VOICEGROUP_HH
 
 #include "proto.hh"
-#include "register.hh"
-#include "varray.hh"
 #include "string.hh"
 
 struct Voice_registers {
-    Notehead_register head_reg_;
-    Slur_register slur_reg_;
+    Notehead_register *head_reg_;
+    Slur_register *slur_reg_;
     Voice *voice_l_;
 
-    /****************/
+    /* *************** */
+    void set_dir(int i);
     static bool acceptable_request(Request*);
     void pre_move_processing();
     void post_move_processing();
-    void announce_element(Staff_elem_info info);
+    void acknowledge_element(Staff_elem_info info);
     Voice_registers(Complex_walker*,Voice*);
+    ~Voice_registers();
     bool try_request(Request*);
     void process_requests();
 };
@@ -30,18 +30,20 @@ struct Voice_registers {
 
 struct Voice_group_registers {
     String group_id_str_;
-    Text_register text_reg_;
-    Stem_beam_register stem_beam_reg_;
-    Script_register script_reg_;
+    Text_register* text_reg_;
+    Stem_beam_register* stem_beam_reg_;
+    Script_register *script_reg_;
     Complex_walker * walk_l_;
     int dir_i_;
     
-    /****************/
+    /* *************** */
+    void set_dir(int i);
     static bool acceptable_request(Request*);
     void pre_move_processing();
     void post_move_processing();
-    void announce_element(Staff_elem_info info);
+    void acknowledge_element(Staff_elem_info info);
     Voice_group_registers(Complex_walker*, String id = "");
+    ~Voice_group_registers();
     void process_requests();
     bool try_request(Request*);
 };
index e87778753c854354729f73b266974c398f07572c..7c61810970ad32dbbb93c97dbcdb589ce6c4b17d 100644 (file)
@@ -77,7 +77,7 @@ symboltables {
        "||"    "\finishbar"    0pt     2pt     -8pt    8pt
        ":|"    "\repeatbar"    -4pt    0pt     -8pt    8pt
        "|:"    "\startrepeat"  0pt     4pt     -8pt    8pt
-       ":|:"   "\repeatbarstartrepeat" 0pt     8pt     -8pt    8pt
+       ":|:"   "\repeatbarstartrepeat" 0pt     16pt    -8pt    8pt
 
      }
 
@@ -101,6 +101,8 @@ symboltables {
             "linestaf" "\linestafsym{%}{%}"
             "stem"     "\stem{%}{%}"           
             "fill"     "\hbox{}"
+            "crescendo" "\crescendosym{%}"     0pt     0pt     -3pt    3pt
+            "decrescendo" "\decrescendosym{%}" 0pt     0pt     -3pt    3pt
      }
 
      "dots" = table {
index 9aa92d0710327365ca9df97aaf941adcb3e15b2a..82e5d190c68bd8e25712a3cc3d042650ad6b229a 100644 (file)
@@ -13,6 +13,7 @@ mwa = music {
        a b ,c
        a b c-*
        a b c&
+       { a-. b-. }
        $
 }
 
@@ -22,6 +23,9 @@ bla = music {
        @
 }
 
+
+include "this-is-hopefully-a-nonexisting-file"
+
 score {
        staff { 
                lyric music { bla }
index aad85a0fc6e5a291080893f701f24f2a860b3271..0f96005edff5e538639e54c0cf43a31e38253e7d 100644 (file)
@@ -65,7 +65,7 @@ score {
                geometric 1.4
                unitspace 3.0 cm
        }
-       staff { ritme }
+%      staff { ritme }%broken for now
        staff { melody }
        commands {
                meter 4* 4
index d9b570bf0bb21cf793474a57fe82df716f5fa78c..2e7358db481ce9ef595b1606d3e4dd4462efe69c 100644 (file)
@@ -69,7 +69,7 @@ ii_menuetto = music {
 %%11
 %      { a4\stemup( f2\stemdown } ) 'd4\stemup
 %      { 'cis4\stemup-. e4\stemdown }
-       { \music { a4 'd4 'cis4-. } \music { f2 e4 } } |
+       { \multivoice \music {\stem{1} a4(\stem{1}) 'd4 'cis4-. } \music { \stem{-1} f2 e4 } } |
 %%12
 %      { 'g^4 d\stemdown } (^  'f 'e ) 'f 'd^3(^ ) ='c ] |
        { [ 'g^"4" d } 'f 'e 'f 'd^"3"( ) 'c ] |
@@ -77,7 +77,10 @@ ii_menuetto = music {
 %      { bes2\stemup g4\stemdown } ( )  f4
 %      { 'c4\stemup e4\stemdown }
 %      { bes2 g4 } f4 { 'c4 e4 } | % \clef "alto" |
-       { \music { bes2 'c4 } \music { g4 f4 e4 } } |
+       { \multivoice
+               \music { \stem{1} bes2 'c4 }
+               \music { \stem{-1} g4(\stem{-1}) f4 e4 }% ugh
+       } |
 %%%14
 %%     [ { a( f } ) g a f ] { 'd4-\upbow e4 `bes4\stemdown } |
        { [ a f } g a f ] { 'd4-\upbow e4 `bes4 } |
@@ -104,7 +107,7 @@ ii_menuetto = music {
 %%%21
 %%     { 'd4\stemup g2\stemdown } (^ ) 'cis4\stemup { 'd4\stemup =f4\stemdown } |
 %      { 'd4 g2 } 'cis4 { 'd4 f4 } |
-       { \music { 'd4 'cis4 'd4 } \music { g2 f4 } } |
+       { \multivoice \music {\stem{1}  'd4(\stem{1} ) 'cis4 'd4 } \music { \stem{-1} g2 f4 } } |
 %%%22
 %%     [ { g(  cis } )f g e ] { f4 d4 } |
        { [ g cis } f g e ] { f4 d4 } |
@@ -146,160 +149,8 @@ score {
                symboltables { table_sixteen }
                width 195mm
 %              unitspace 12mm % this should do, really
-               unitspace 8mm  % to get lily to use only three lines
-               output "scsii-menuetto.out"
-       }
-}
-% scsii-menuetto.ly
-%
-% Solo Cello Suites
-% J. S. Bach
-%
-% Suite II part v
-% Menuetto I
-%
-% Copyright (c) 1995,1996,1997 Jan Nieuwenhuizen <jan@digicash.com>
-% 
-% The purpose of this file is to demonstrate features of LilyPond.
-% (there is an accompanying LaTeX file, scsii-menuetto.tex)
-%
-
-% \lefttitle{Menuetto}
-% \tempo{Moderato}
-% \metron{4=120}
-%
-% \meter{3/4}
-% \key\F               % key is F ( f-major )
-% \clef\alto           % use alto clef
-% \duration8           % default duration is 'eight note
-%
-% \verb{\nobarnumbers} % issue MusiXTeX command
-% \barnumbering0
-% \slope{30}           % Fool MusiXTeX into 30 / 10 steeper beam
-% \stemlength3         % shorter stemlength
-%              % because piece is set very tightly
-%%1            % double comments are included in .tex file
-ii_menuetto = music {
-       $
-       \octave{}
-       \duration{8}
-       { a2 f2 d2_"\f" } bes4-.  |
-%%2
-       { [ bes^"1" e c_"2"_"4" }
-%      (^ )
-       a bes-. g-. ] a4-.^"4" |
-%%3
-%      { d4 `bes4-.\stemup } stemup: 2 voices?
-       { d4 `bes4-. } g4-. [ f-. e-. ] |
-%%4
-%      { f `a } (^ e ) d cis-. `b-. `a-. ]
-%      [ f ( e ) d cis-. `b-. `a-. ]
-       { [ f `a } e d cis-. `b-. `a-. ]
-%%5
-       { a2 f2 d2 } bes4-. | %   @bes4-. |
-%%6
-%      {  bes( e  }  ) a
-       { [ bes e } a bes-. g-. ]
-       'c4-. | % ='c4-. |
-%%7
-       { a4-. f4}
-%      { 'd4-.-\upbow f4 `bes4\stemdown }
-       { 'd4-.-\upbow f4 `bes4 }
-%      { 'e4-.-\downbow g4 `g4\stemdown } |
-       { 'e4-.-\downbow g4 `g4 } |
-%%8
-%      { 'cis2.-\upbow e2. `a2.\stemdown } :||:
-       { 'cis2.-\upbow e2. `a2. } | % :||:
-%%9
-%      \clef "violin"
-%      { 'e2 a2_f\stemdown }
-       { 'e2 a2_"\f" }
-       [ 'd( 'e16 )'f16 ] |
-%%10
-%      [ { 'e( g } ) 'd 'cis_{ }_{ }_2 'e
-       { [ 'e g } 'd 'cis_"2" 'e a( )g ] |
-%%11
-%      { a4\stemup( f2\stemdown } ) 'd4\stemup
-%      { 'cis4\stemup-. e4\stemdown }
-       { \music { a4 'd4 'cis4-. } \music { f2 e4 } } |
-%%12
-%      { 'g^4 d\stemdown } (^  'f 'e ) 'f 'd^3(^ ) ='c ] |
-       { [ 'g^"4" d } 'f 'e 'f 'd^"3"( ) 'c ] |
-% %13
-%      { bes2\stemup g4\stemdown } ( )  f4
-%      { 'c4\stemup e4\stemdown }
-%      { bes2 g4 } f4 { 'c4 e4 } | % \clef "alto" |
-       { \music { bes2 'c4 } \music { g4 f4 e4 } } |
-%%%14
-%%     [ { a( f } ) g a f ] { 'd4-\upbow e4 `bes4\stemdown } |
-       { [ a f } g a f ] { 'd4-\upbow e4 `bes4 } |
-%%%15
-%%     { 'c4-\downbow f4 `a4\stemdown } [ bes( )a g a ] |
-%      { 'c4-\downbow f4 `a4 } [ bes( )a g a ] |
-%%%16
-       [ f( e )f a-. g-. bes-. ] |
-%% \tighten            % use one line less
-%% \newline            % start new line
-%%     |
-%%%17
-%%     { a2^0^\tr fis2_3 } bes4 |
-       { a2^"0" fis2_"3" } bes4 |
-%%%18
-%%     [ { 'c( es } ) bes 'c a ] fis4^\tr |
-       { [ 'c es } bes 'c a ] fis4 |
-%%%19
-%%     { 'd4-\downbow g4 `bes4\stemdown } { 'c4-\upbow g4 c4\stemdown } [ { bes d } a ] |
-       { 'd4-\downbow g4 `bes4 } { 'c4-\upbow g4 c4 } { [ bes d } a ] |
-%%%20
-%%     [ { 'c( d `g } bes a ) bes g ( ) bes ] |
-       { [ 'c d `g } bes a bes g( )bes ] |
-%%%21
-%%     { 'd4\stemup g2\stemdown } (^ ) 'cis4\stemup { 'd4\stemup =f4\stemdown } |
-%      { 'd4 g2 } 'cis4 { 'd4 f4 } |
-       { \music { 'd4 'cis4 'd4 } \music { g2 f4 } } |
-%%%22
-%%     [ { g(  cis } )f g e ] { f4 d4 } |
-       { [ g cis } f g e ] { f4 d4 } |
-%%%23
-%%     [ `g g ] { e4.\stemup^\tr `a4.\stemdown } d\stemup-\upbow |
-       [ `g g ] { e4. `a4. } d-\upbow |
-%%%24
-%%     { d2.^{fine}  `a2. `d2.\stemup_{ }_{ }_{3 mins.}}       s4 :||
-%%     { \textstyle "italic" d2.^"fine" `a2. \textstyle "roman" `d2._"3 mins."} | % :||
-       { d2.^"fine" `a2. `d2._"3 mins."} | % :||
-%% \tighten            % use one line less
-       $
-}
-
-score {
-       staff { 
-               melodic
-               music { ii_menuetto }
-               commands {
-                       key $bes$
-                       clef "alto"     
-                       skip 8:0
-                       clef "violin"
-                       skip 5:0
-                       clef "alto"
-                       skip 12:0
-               }
-       }
-       commands {
-               meter 3*4
-               skip 8:0
-               bar ":|:"
-%              clef "violin"
-               skip 5:0
-%              \clef "alto" 
-               skip 12:0
-               bar ":||"
-       }
-       paper {
-               symboltables { table_sixteen }
-               width 195mm
-%              unitspace 12mm % this should do, really
-               unitspace 8mm  % to get lily to use only three lines
+               unitspace 9mm  % to get lily to use only three lines
+               geometric 1.4
                output "scsii-menuetto.out"
        }
 }
index ae48f898cccc1abba847b31faddab1c31138b7cb..aa8120ade856641fcd066b2dbc64ba76a5bb0626 100644 (file)
@@ -7,7 +7,7 @@
 
 dux = music { $
        \duration { \last } 
-       \stem{-1}  r8 ['c16 b] ['c8 g] [as 'c16 b] ['c8 'd] |
+        r8-"dux" \stem{-1} ['c16 b] ['c8 g] [as 'c16 b] ['c8 'd] |
        [g 'c16 b] ['c8 'd] [f16 g] as4 [g16 f] |
        [es 'c b a] [ g f es d] [c8 'es 'd 'c] |
        [bes a bes 'c] [fis g a fis] |
@@ -21,7 +21,7 @@ comes = music { $
        r1 r1
        \stem{1}
        \octave {'}
-       r8 [g16 fis] [g8 c] [es g16 f] [g8 a]|
+       r8-"comes" [g16 fis] [g8 c] [es g16 f] [g8 a]|
        [d8 g16 fis] [g8 a] [c16 d] es4 [d16 c] |
        [`bes8 es16 d] [es8 `g8] [`as f16 es] [f8 `a] |
        [`bes8 g16 f] [g8 `b] [c8 d16 es] f4( |
@@ -32,8 +32,8 @@ $}
 
 bassdux = music { $
        r1 r1 r1 r1 r1 r1
-       \stem{1}        \octave { }
-       r8 [c16 B] [c8 G] [As c16 Bes] [c8 d] |
+       \octave { }
+       r8 [c16 B] [c8 G] [As c16 B] [c8 d] |
        [G c16 B] [c8 d] [F16 G] As4 [G16 F] | $
 }
 
@@ -62,7 +62,7 @@ score {
                meter 4*4
                skip 8:0
        }
-       paper { unitspace 2.5cm
-               geometric 1.1
+       paper { %unitspace 2.5cm
+               %geometric 1.4
        }
 }
\ No newline at end of file
index fd0d0ed0bafe4623857c3d3fef1c83ab02491299..586aabb88d36355106f7e00f754d9f8e0f2227a8 100644 (file)
@@ -71,8 +71,8 @@
 }
 
 \def\musixcalc{
-       \interlinedist=\fontdimen5\musicfnt
-       \smallspace=.3\interlinedist
+        \interlinedist=\fontdimen5\musicfnt
+        \smallspace=.3\interlinedist
         \interstaffrule=\balkhoog
         \advance\interstaffrule by-\staffrulethickness
         \divide\interstaffrule by 4
 
 \def\beamslope#1#2{{\count0=#2\advance\count0 by#1\musicfnt\char\count0}}
 \def\rulesym#1#2{\vrule height #1 width #2}
-
+\def\crescendosym#1{\count0=84\advance\count0 by #1}
+\def\decrescendosym#1{\count0=116\advance\count0 by #1}
 \def\settext#1{\textfont #1}
 \def\setitalic#1{\italicfont #1}
index 02e3d3d94fd1f74d73962ec25d9418f5c547873f..f31a15d0172330f30a79cd402475d59556f8ef43 100644 (file)
@@ -21,7 +21,6 @@ struct Stem_info {
     Real miny;
     int no_beams;
 
-    ///////////////
     
     Stem_info(){}
     Stem_info(const Stem*);
@@ -37,7 +36,7 @@ Stem_info::Stem_info(const Stem*s)
 
 }
 
-/****************/
+/* *************** */
 
 Offset
 Beam::center()const
@@ -45,7 +44,7 @@ Beam::center()const
     assert(status >= POSTCALCED);
 
     Real w=(paper()->note_width() + width().length())/2.0;
-    return Offset(w, (left_pos + w* slope)*paper()->interline());
+    return Offset(w, (left_pos + w* slope)*paper()->internote());
 }
 
 
@@ -53,7 +52,6 @@ Beam::Beam()
 {
     slope = 0;
     left_pos = 0.0;
-    dir =0;
 }
 
 void
@@ -73,9 +71,9 @@ Beam::set_default_dir()
        int d = i->get_default_dir();
        dirs[(d+1)/2] ++;
     }
-    dir =  (dirs[0] > dirs[1]) ? -1 : 1;
+    dir_i_ =  (dirs[0] > dirs[1]) ? -1 : 1;
     for (iter_top(stems,i); i.ok(); i++) {
-       i->dir = dir;
+       i->dir = dir_i_;
     }
 }
 
@@ -108,12 +106,12 @@ Beam::solve_slope()
            dy = my -y; 
     }
     left_pos += dy;
-    left_pos *= dir;    
-    slope *= dir;
+    left_pos *= dir_i_;    
+    slope *= dir_i_;
 
                                // URG
     Real sl = slope*paper()->internote();
-    paper()->lookup_p_->beam(sl, convert_dimen(20,"pt"));
+    paper()->lookup_p_->beam(sl, 20 PT);
     slope = sl /paper()->internote();
 }
 
@@ -184,7 +182,7 @@ Beam::do_pre_processing()
     left  = (*stems.top())   ->pcol_l_;
     right = (*stems.bottom())->pcol_l_;    
     assert(stems.size()>1);
-    if (!dir)
+    if (!dir_i_)
        set_default_dir();
 
 }
@@ -209,7 +207,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
     Real dy=paper()->internote()*2;
     Real stemdx = paper()->rule_thickness();
     Real sl = slope*paper()->internote();
-    paper()->lookup_p_->beam(sl, convert_dimen(20,"pt"));
+    paper()->lookup_p_->beam(sl, 20 PT);
 
     Molecule leftbeams;
     Molecule rightbeams;
@@ -223,7 +221,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
        a.translate(Offset (-w, -w * sl));
        for (int j = 0; j  < lhalfs; j++) {
            Atom b(a);
-           b.translate(Offset(0, -dir * dy * (lwholebeams+j)));
+           b.translate(Offset(0, -dir_i_ * dy * (lwholebeams+j)));
            leftbeams.add( b );
        }
     }
@@ -238,7 +236,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
        int j = 0;
        for (; j  < rwholebeams; j++) {
            Atom b(a);
-           b.translate(Offset(0, -dir * dy * j));
+           b.translate(Offset(0, -dir_i_ * dy * j));
            rightbeams.add( b ); 
        }
        w /= 4;
@@ -246,7 +244,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
        
        for (; j  < rwholebeams + rhalfs; j++) {
            Atom b(a);
-           b.translate(Offset(0, -dir * dy * j));
+           b.translate(Offset(0, -dir_i_ * dy * j));
            rightbeams.add(b ); 
        }
        
index 7fcf65d762afa9f6dbbd8d791639e038b151a17c..7ec06433e9883e60663e4b4bc97226e7b7a8481f 100644 (file)
@@ -1,15 +1,13 @@
 #include "idealspacing.hh"
-#include "tstream.hh"
 #include "score.hh"
 #include "pscore.hh"
-#include "staff.hh"
 #include "paper.hh"
 #include "sccol.hh"
-#include "debug.hh"
+//#include "debug.hh"
 #include "dimen.hh"
 
 
-/*
+/**
   this needs A LOT of rethinking.
 
   generate springs between columns.
@@ -28,18 +26,14 @@ Score::calc_idealspacing()
            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++;
                assert( j->when()== d+i->when());
                
-               pscore_p_->connect(i->pcol_l_, j->pcol_l_, dist);
-#if 0          
-               if (!j->musical_ && (j+1).ok() 
-                   && ) {
-                   j++;
-                   pscore_p_->connect(i->pcol_l_, j->pcol_l_,  dist);
-               }
-#endif 
+               pscore_p_->connect(i->pcol_l_, j->pcol_l_, dist, strength);
            }
        } else if (j.ok()) {
            
@@ -48,8 +42,7 @@ Score::calc_idealspacing()
              */
            
            Moment d = j->when() - i->when();
-           Real dist = (d) ? paper_p_->duration_to_dist(d) :
-               convert_dimen(2,"pt"); // todo
+           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);
        }
index d0fcbe09d9672c811eb20412e348388601fc095b..bf7b924159d7cd272ce11fd479ec39b2dd329d3e 100644 (file)
@@ -1,23 +1,32 @@
+/*
+  clef.cc -- implement  Clef
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>,
+  Mats Bengtsson <matsb@s3.kth.se>
+*/
+
 #include "clef.hh"
+#include "debug.hh"
 
 Clef::Clef()
 {
-    clef_type= "violin";
-    c0_pos = -2;
+    set_type("violin");
 }
 
-void
-Clef::read(Array<Scalar>args)
+void 
+Clef::set_type(String type_str)
 {
-    clef_type = args[0];
-    if (clef_type == "violin") {
-       c0_pos=-2;
-    } else if (clef_type == "alto") {
-       c0_pos = 4;
-    } else if (clef_type == "tenor") {
-       c0_pos = 6;
-    } else if (clef_type == "bass") {
-       c0_pos = 10;
+    clef_type_str_  = type_str;
+    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
-       assert(false);
+       error("unknown clef type `"+clef_type_str_+"\'");
 }
index 2b451a804d9f16b484b97200aee8675fdb36b3bb..0e0054acd34e4821793affad8737c2039f0b939f 100644 (file)
@@ -29,7 +29,7 @@ Clef_item::read(String t)
 void
 Clef_item::read(Clef k)
 {
-    read(k.clef_type);
+    read(k.clef_type_str_);
 }
 
 Molecule*
@@ -40,7 +40,7 @@ Clef_item::brew_molecule_p()const
        t += "_change";
     Symbol s = paper()->lookup_p_->clef(t);
     Molecule*output = new Molecule(Atom(s));
-    output->translate(Offset(0, paper()->interline()/2 * y_off));
+    output->translate(Offset(0, paper()->internote() * y_off));
     return output;
 }
 
index 372d86db103aa8ba1a7a41e0e89ba9dd2a09ede4..ec38b575e1d5b79784663a674d25d6065c69b043 100644 (file)
@@ -6,7 +6,7 @@
 #include "complexstaff.hh"
 #include "sccol.hh"
 #include "debug.hh"
-#include "linepstaff.hh"
+
 #include "clefitem.hh"
 #include "bar.hh"
 #include "meter.hh"
@@ -38,7 +38,7 @@ Complex_staff::get_TYPESET_item(Command *com)
 
 
 Interval
-citemlist_width(const Array<Item*> &its)
+itemlist_width(const Array<Item*> &its)
 {
     Interval iv ;
     iv.set_empty();
@@ -56,14 +56,14 @@ Complex_column::typeset_item(Item *i, int breakst)
     assert(i);
     
     staff_l_->pscore_l_->typeset_item(i, score_column_l_->pcol_l_,
-                                 staff_l_->theline_l_,breakst);
+                                 staff_l_->pstaff_l_,breakst);
     
     if (breakst == BREAK_PRE - BREAK_PRE) {
        
         Array<Item*> to_move(
-           staff_l_->pscore_l_->select_items(staff_l_->theline_l_,
+           staff_l_->pscore_l_->select_items(staff_l_->pstaff_l_,
                                          score_column_l_->pcol_l_->prebreak_p_));
-       Interval column_wid = citemlist_width(to_move);
+       Interval column_wid = itemlist_width(to_move);
        assert(!column_wid.empty());
 
        for (int j=0; j < to_move.size(); j++) {
@@ -84,22 +84,22 @@ Complex_column::typeset_item_directional(Item *i, int dir, int breakst) // UGH!
     else if (breakst == 2)
        c = c->postbreak_p_;
     
-    Array<Item*> to_move(staff_l_->pscore_l_->select_items(staff_l_->theline_l_,
+    Array<Item*> to_move(staff_l_->pscore_l_->select_items(staff_l_->pstaff_l_,
                                                      c));    
     typeset_item(i, breakst);
 
-    Interval column_wid = citemlist_width(to_move);
+    Interval column_wid = itemlist_width(to_move);
     if (column_wid.empty())
        column_wid = Interval(0,0);
     i->translate(Offset(column_wid[dir] - i->width()[-dir], 0));
 }
 
 void
-Complex_staff::set_output(PScore* ps )
+Complex_staff::set_output(PScore* pscore_l )
 {
-    theline_l_ = new Linestaff(NO_LINES,ps); // theline_l_ is added to pscore later.
-    pscore_l_ = ps;
-    pscore_l_->add(theline_l_);
+    pstaff_l_ = new PStaff(pscore_l); // pstaff_l_ is added to pscore later.
+    pscore_l_ = pscore_l;
+    pscore_l_->add(pstaff_l_);
 }
 
 
index 7e21bf225213e2ff5b825ed90d808bb8e6c5a9bc..d5d44362d9d5fce98d027fbcc60dcabef5cd9bc2 100644 (file)
@@ -8,19 +8,20 @@
 #include "complexstaff.hh"
 #include "sccol.hh" 
 #include "complexwalker.hh"
-#include "main.hh"
+#include "score.hh"
+#include "pscore.hh"
+#include "staffsym.hh"
 
 
-
-Complex_column::Complex_column(Score_column*s, Complex_staff *rs)
+Complex_column::Complex_column(Score_column*s, Complex_staff *staff_l)
     : Staff_column(s)
 {
-    staff_l_ = rs;
+    staff_l_ = staff_l;
 }
 
 Complex_staff::Complex_staff()
 {
-    theline_l_ = 0;
+    pstaff_l_ = 0;
 }
 
 void
@@ -57,7 +58,21 @@ void
 Complex_staff::walk()
 {
     for (Complex_walker sc(this); sc.ok(); sc++) {
-       sc.col()->setup_requests();// TODO
+       sc.col()->setup_requests();
        sc.process();
     }
+    Staff_symbol *span_p = new Staff_symbol(5);
+
+       
+    Score_column* col_last
+       =score_l_->find_col(score_l_->last(), false);
+    Score_column* col_first=
+       score_l_->find_col(0, false);
+    col_first->pcol_l_->set_breakable();
+    col_last->pcol_l_->set_breakable();
+       
+    span_p->set_extent( col_first->pcol_l_->postbreak_p_,
+                      col_last->pcol_l_->prebreak_p_);
+
+    pscore_l_->typeset_spanner(span_p, pstaff_l_);
 }
index 378f486a08265f6452b613cf350d7fabcdabf0d1..ba8253205b8b9c832c998061345c3bd83960476b 100644 (file)
@@ -5,26 +5,49 @@
 #include "clef.hh"
 #include "pscore.hh"
 #include "complexstaff.hh"
-#include "sccol.hh"
 #include "debug.hh"
 #include "keyitem.hh"
 #include "clefitem.hh"
 #include "voicegroup.hh"
-#include "register.hh"
+#include "localkeyreg.hh"
 #include "complexwalker.hh"
 #include "misc.hh"
 
+Rhythmic_grouping
+parse_grouping(Array<Scalar> const &a)
+{
+    Array<int> r;
+    Array<Moment> grouplen_arr;
+    for (int i= 0 ; i < a.size()/2; ) {
+       r.push(a[i++]);
+       grouplen_arr.push(Moment(1,(int) a[i++]));
+    }
+    Moment here =0;
+
+    Array<Rhythmic_grouping*> children;
+    for (int i=0; i < r.size(); i++) {
+       
+       Moment last = here;
+       here += grouplen_arr[i] * Rational(r[i]);
+       children.push(
+           new Rhythmic_grouping(MInterval(last, here), r[i] ));
+    }
+    return Rhythmic_grouping(children);
+}
+
 void
-Complex_walker::do_INTERPRET_command(Command*com)
+Complex_walker::do_INTERPRET_command(Command*com_l)
 {
-    Array<Scalar> args(com->args);
+    Array<Scalar> args(com_l->args);
     args.del(0);
-    if (com->args[0] == "GROUPING") {  
+    String com = com_l->args[0];
+    
+    if (com == "GROUPING") {   
        default_grouping = parse_grouping(args);
-    }else if (com->args[0] == "NEWMEASURE") {
+    }else if (com == "NEWMEASURE") {
        local_key_.reset(key_);
 
-    } else if (com->args[0] == "KEY") {
+    } else if (com == "KEY") {
        
        if (col()->when() > Moment(0)) {
            assert(!oldkey_undo);
@@ -33,10 +56,10 @@ Complex_walker::do_INTERPRET_command(Command*com)
        
        typesetkey = key_.read(args);
        local_key_.reset(key_); 
-    } else if (com->args[0] == "CLEF") {
-       clef_.read(args);
+    } else if (com == "CLEF") {
+       clef_.set_type(args[0]);
     } else {
-       WARN << " ignoring INTERPRET command: " << com->args[0]<< "\n";
+       WARN << " ignoring INTERPRET command: " << com<< "\n";
     }
 }
 
@@ -101,17 +124,17 @@ Complex_walker::do_announces()
     for (int i = 0; i < announce_info_arr_.size(); i++){
        Staff_elem_info info = announce_info_arr_[i];
        for (iter_top(voice_reg_list_,j); j.ok(); j++) {
-           j->announce_element(info);
+           j->acknowledge_element(info);
        }
        for (iter_top ( group_reg_list_, j); j.ok(); j++) {
-           j->announce_element(info);
+           j->acknowledge_element(info);
        }
        local_key_reg_.acknowledge_element(info);
     }
 }
 
 Voice_registers *
-Complex_walker::find_voice_reg(Voice*v_l)
+Complex_walker::find_voice_reg(Voice*v_l)const
 {
    for (iter_top(voice_reg_list_, i); i.ok(); i++) {
        if (i->voice_l_ == v_l)
@@ -133,7 +156,7 @@ Complex_walker::get_voice_reg(Voice*v_l)
 }
 
 Voice_group_registers *
-Complex_walker::find_voice_group(Voice* v_l)
+Complex_walker::find_voice_group(Voice* v_l)const
 {
     if (!voice_group_map_.elt_query(v_l))
        return 0;
@@ -141,7 +164,7 @@ Complex_walker::find_voice_group(Voice* v_l)
 }
 
 Voice_group_registers *
-Complex_walker::find_voice_group(const char *id)
+Complex_walker::find_voice_group(const char *id)const
 {
     for (iter_top(group_reg_list_, i); i.ok(); i++)
        if (i->group_id_str_ == id)
@@ -176,7 +199,7 @@ Complex_walker::get_voice_group(const char* id)
 }
 
 void 
-Complex_walker::do_change_group(const Voice * v, String group_id_str)
+Complex_walker::do_change_group(Voice * v, String group_id_str)
 {
     voice_group_map_[v] = get_voice_group(group_id_str);
 }
@@ -196,12 +219,6 @@ Complex_walker::try_request(Request*req)
     } else if (Voice_group_registers::acceptable_request(req)){
        Voice_group_registers* reg_l = get_voice_group(voice_l);
        b = reg_l->try_request(req);
-#if 0
-       if (!b) {
-           bool please_b = get_voice_group("")->try_request(req);         
-           b |= please_b;
-       }
-#endif
     } 
 
     if (!b)
@@ -243,13 +260,13 @@ Complex_walker::typeset_element(Staff_elem *elem_p)
     if (!elem_p)
        return;
     if (elem_p->spanner())
-       pscore_l_->typeset_spanner(elem_p->spanner(), staff()->theline_l_);
+       pscore_l_->typeset_spanner(elem_p->spanner(), staff()->pstaff_l_);
     else
        col()->typeset_item(elem_p->item()); 
 }
 
 Complex_walker::Complex_walker(Complex_staff*s)
-    : Staff_walker(s, s->theline_l_->pscore_l_),
+    : Staff_walker(s, s->pstaff_l_->pscore_l_),
       local_key_reg_(this)      
 {
     oldkey_undo = 0;
@@ -294,3 +311,13 @@ Complex_walker::do_post_move()
        j->post_move_processing();
     local_key_reg_.post_move_processing();
 }
+
+Array<Voice_registers*>
+Complex_walker::get_voice_regs(Voice_group_registers* group_regs_l) const
+    return l_arr;
+{
+    for (Assoc_iter<Voice*,Voice_group_registers*> i(voice_group_map_); i.ok(); i++) {
+       if (i.val() == group_regs_l)
+           l_arr.push(find_voice_reg(i.key()));
+    }
+}
index eb53756b45201a60689f3cbb1cda4045edf4d2a5..93077bd87b5b92e81ee4d05fd4739683ff2b5fa0 100644 (file)
@@ -15,7 +15,6 @@ parse_dimen(String dim)
     return convert_dimen(dim.fvalue(), unit); 
 }
 
-const Real CM_TO_PT=72/2.54;
 
 Real
 convert_dimen(Real quant, String unit)
@@ -27,7 +26,7 @@ convert_dimen(Real quant, String unit)
     if (unit == "mm")
        return quant*CM_TO_PT/10;
     if (unit == "in")
-       return quant * 72;
+       return quant * INCH_TO_PT;
     error ("unknown length unit: `" + unit+"'");
 }
 
index 49bb67d7252b2d195136c219b2dc1690cebd5d0b..e7ce9c7ddc5714727d5d5fc4f8298c53dfb8ffeb 100644 (file)
@@ -2,5 +2,5 @@
 
 Directional_spanner::Directional_spanner()
 {
-    dir = 0;
+    dir_i_ = 0;
 }
index 9367c92cd50ae04cff393edc4643c791596d5ad5..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,244 +0,0 @@
-#include "script.hh"
-#include "request.hh"
-#include "beam.hh"
-#include "stem.hh"
-#include "register.hh"
-#include "grouping.hh"
-#include "complexwalker.hh"
-#include "debug.hh"
-#include "complexstaff.hh"
-#include "textspanner.hh"
-#include "textitem.hh"
-
-Stem_beam_register::Stem_beam_register(Complex_walker*w)
-    :Request_register(w)
-{
-    do_post_move_process();
-    current_grouping = 0;
-    beam_p_ = 0;
-    set_dir(0);
-    start_req_l_ = 0;
-}
-
-bool
-Stem_beam_register::try_request(Request*req_l)
-{
-    if ( req_l->beam() ) {
-       if (bool(beam_p_ ) == bool(req_l->beam()->spantype == Span_req::START))
-           return false;
-       
-       if (beam_req_l_ && Beam_req::compare(*beam_req_l_ , *req_l->beam()))
-           return false;
-       
-       beam_req_l_ = req_l->beam();
-       return true;
-    }
-    
-    if ( req_l->stem() ) {
-       if (current_grouping && !current_grouping->child_fit_query(
-           walk_l_->col()->tdescription_->whole_in_measure))
-           return false;
-
-       if (stem_req_l_ && Stem_req::compare(*stem_req_l_, *req_l->stem()))
-           return false;
-
-       stem_req_l_ = req_l->stem();
-       return true;
-    }
-    return false;
-}
-
-void
-Stem_beam_register::process_request()
-{
-    if (beam_req_l_) {
-       if (beam_req_l_->spantype == Span_req::STOP) {
-           end_beam_b_ = true;
-           start_req_l_ = 0;
-       } else {
-           beam_p_ = new Beam;
-           start_req_l_ = beam_req_l_;
-//         walk_l_->announce_element(Staff_elem_info(beam_p_, ))
-           current_grouping = new Rhythmic_grouping;
-           if (beam_req_l_->nplet) {
-               Text_spanner* t = new Text_spanner();
-               t->set_support(beam_p_);
-               t->spec.align_i_ = 0;
-               t->spec.text_str_ = beam_req_l_->nplet;
-               walk_l_->typeset_element(t);
-           }
-            
-       }
-    }
-
-    if (stem_req_l_) {
-       stem_p_ = new Stem(4);
-       if (current_grouping)
-           current_grouping->add_child(
-               walk_l_->col()->tdescription_->whole_in_measure,
-               stem_req_l_->duration());
-
-       stem_p_->flag = stem_req_l_->balltype;
-
-       if (beam_p_) {
-           if (stem_req_l_->balltype<= 4)
-               warning( "stem doesn't fit in Beam",
-                        stem_req_l_->defined_ch_c_l_m);
-           else
-               beam_p_->add(stem_p_);
-           stem_p_->print_flag = false;
-       } else {
-           stem_p_->print_flag = true;
-       }
-       
-       walk_l_->announce_element(Staff_elem_info(stem_p_,
-                                                 stem_req_l_,  this));
-    }
-}
-
-void
-Stem_beam_register::acknowledge_element(Staff_elem_info info)
-{
-    if (!stem_p_)
-       return;
-
-    if (info.elem_p_->name() == String("Notehead") &&
-       stem_req_l_->duration() == info.req_l_->rhythmic()->duration())
-       
-       stem_p_->add((Notehead*)info.elem_p_);
-}
-
-void
-Stem_beam_register::do_pre_move_process()
-{
-    if (stem_p_) {
-       if (default_dir_i_)
-           stem_p_->dir = default_dir_i_;
-       
-       walk_l_->typeset_element(stem_p_);
-       stem_p_ = 0;
-    }
-    if (beam_p_ && end_beam_b_) {
-       walk_l_->default_grouping.extend(current_grouping->interval());
-       beam_p_->set_grouping(walk_l_->default_grouping, *current_grouping);
-       walk_l_->typeset_element(beam_p_);
-       delete current_grouping;
-       current_grouping = 0;
-       beam_p_ = 0;
-    }
-    end_beam_b_ = false;
-}
-void
-Stem_beam_register::do_post_move_process()
-{
-    stem_p_ = 0;
-    beam_req_l_ = 0;
-    stem_req_l_ = 0;
-    end_beam_b_ = false;
-}
-
-Stem_beam_register::~Stem_beam_register()
-{
-    if (beam_p_)
-       warning("unterminated beam", start_req_l_->defined_ch_c_l_m);
-}
-
-void
-Stem_beam_register::set_dir(int i)
-{
-    default_dir_i_ = i;
-}
-/****************/
-
-Script_register::Script_register(Complex_walker*w)
-    : Request_register(w)
-{
-    script_p_ = 0;
-}
-
-bool
-Script_register::try_request(Request *r_l)
-{
-    if (!r_l->script())
-       return false ;
-
-    if (accepted_req_arr_.size()
-       && Script_req::compare(
-           *accepted_req_arr_[0]->script(), *r_l->script()))
-       
-       return false;
-
-    accepted_req_arr_.push(r_l);
-    
-    return true;
-}
-void
-Script_register::process_request()
-{
-    if (accepted_req_arr_.size() ) {
-       script_p_ = new Script(accepted_req_arr_[0]->script(), 10);
-       walk_l_->announce_element(
-           Staff_elem_info(script_p_, accepted_req_arr_[0], this));
-    }
-}
-
-void
-Script_register::acknowledge_element(Staff_elem_info info)
-{
-    if (!script_p_)
-       return;
-    if (info.elem_p_->name() == String("Stem"))
-       script_p_->set_stem((Stem*)info.elem_p_);
-    else if (info.req_l_->rhythmic())
-       script_p_->set_support(info.elem_p_->item());
-}
-
-void
-Script_register::do_pre_move_process()
-{
-    if (script_p_){
-       walk_l_->typeset_element(script_p_);
-       script_p_ = 0;
-    }
-}
-/******************/
-
-
-Text_register::Text_register(Complex_walker*w)
-    : Request_register(w)
-{
-    text_p_ = 0;
-}
-
-bool
-Text_register::try_request(Request*req_l)
-{
-    if (!req_l->text())
-       return false;
-    if (accepted_req_arr_.size() &&
-       Text_req::compare(*req_l->text(), *accepted_req_arr_[0]->text()))
-
-       return false;
-
-    accepted_req_arr_.push(req_l);
-    return true;
-}
-
-void
-Text_register::process_request()
-{
-    
-    if (accepted_req_arr_.size()) {
-       text_p_ = new Text_item(accepted_req_arr_[0]->text(), 10);
-       walk_l_->announce_element(Staff_elem_info(text_p_,
-                                                 accepted_req_arr_[0], this));
-    }
-}
-void
-Text_register::do_pre_move_process()
-{
-    if (text_p_) {
-       walk_l_->typeset_element(text_p_);
-       text_p_ = 0;
-    }
-}
diff --git a/src/headreg.cc b/src/headreg.cc
new file mode 100644 (file)
index 0000000..ecb2407
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+  headreg.cc -- part of LilyPond
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+#include "rest.hh"
+#include "notehead.hh"
+#include "headreg.hh"
+#include "paper.hh"
+#include "complexwalker.hh"
+
+
+Notehead_register::Notehead_register(Complex_walker*w_l)
+    :Request_register(w_l)
+{
+    note_p_ = 0;
+    set_dir(0);
+}
+
+bool
+Notehead_register::try_request(Request *req_l) 
+{
+    if (req_l->note() || req_l->rest())
+       accepted_req_arr_.push(req_l);
+    else
+       return false;
+
+    return true;
+}
+void
+Notehead_register::set_dir(int d)
+{
+    dir_i_ = d;
+}
+
+void
+Notehead_register::process_request()
+{
+    if (!accepted_req_arr_.size())
+       return;
+    
+    Request* req_l = accepted_req_arr_.top();
+    if (req_l->note()) {
+       Notehead*n_p = new Notehead(8); // ugh
+       note_p_ = n_p;
+       n_p->set_rhythmic(req_l->rhythmic());
+       n_p->position = req_l->note()->height() +
+           walk_l_->clef_.c0_position_i_;
+    } else {
+       note_p_ = new Rest ( req_l->rhythmic()->balltype,
+                            req_l->rhythmic()->dots);
+       if (req_l->rhythmic()->balltype <= 2)
+           note_p_->translate(
+               Offset(0,
+                      6 * paper()->internote()));
+    }
+    Staff_elem_info itinf(note_p_,req_l,this);
+    announce_element(itinf);
+}
+
+void
+Notehead_register::do_pre_move_process()
+{
+    if (note_p_) {
+       if (dir_i_ && note_p_->name() == String("Rest"))
+           note_p_->translate(Offset(0, 4*dir_i_ * paper()->internote()));
+       typeset_element(note_p_);
+       note_p_ = 0;
+    }
+}
index 093938737553b680a0ee2563e5ae32662b4b6019..36e421c7b668687644e6e75c6493dbb18a45159d 100644 (file)
@@ -82,7 +82,7 @@ Commands_at::parse(Staff_commands_at*s)
        }
     }
 }
-/****************/
+/* *************** */
 
 void
 Input_cursor::find_moment(Moment w)
@@ -118,7 +118,7 @@ Input_cursor::find_moment(Moment w)
 
 
 
-/****************/
+/* *************** */
 void
 Input_commands::find_moment(Moment m)
 {
@@ -225,7 +225,7 @@ Input_commands::print() const
     }
 #endif
 }
-/****************/
+/* *************** */
 
 Moment
 Input_cursor::when()const
index 4afb6f855683374e2eb8b3c31f82d2cd5c72398b..447d84e41a460136281c93798595d945c49c89be 100644 (file)
@@ -37,7 +37,7 @@ Simple_music::print() const
     mtor << "}\n";
 }
 
-/****************/
+/* *************** */
 
 void
 Complex_music::add(Input_music*v)
@@ -74,7 +74,7 @@ Complex_music::set_default_group(String g)
     for (iter_top(elts,i); i.ok(); i++)
            i->set_default_group(g);
 }
-/****************************************************************/
+/* *************************************************************** */
 
 void
 Music_voice::print() const
@@ -134,7 +134,7 @@ Music_voice::translate_time(Moment t)
 
     
     
-/****************/
+/* *************** */
 
 void
 Music_general_chord::add_elt(Voice_element*v)
@@ -180,7 +180,7 @@ Music_general_chord::convert()const
     return l;
 }
 
-/****************/
+/* *************** */
 
 void
 Multi_voice_chord::set_default_group(String g)
@@ -193,7 +193,7 @@ Multi_voice_chord::set_default_group(String g)
 }
 
 
-/****************/
+/* *************** */
 
 void
 Voice_list::translate_time(Moment x)
index ef684047c4e06e210d9474288fa2b02b9afc5e8d..cb9086b1a3ebcc313fd70ec10a93d8c13f567aa8 100644 (file)
@@ -26,6 +26,7 @@ Input_score::set(Paperdef*p)
     delete paper_;
     paper_ = p;
 }
+
 Input_score::Input_score(Input_score const&)
 {
     assert(false);
@@ -53,9 +54,7 @@ Input_score::parse()
 
 Input_score::~Input_score()
 {
-    // TODO!
-//should fix paper/symtabs to allow this deletion.
-//    delete paper_;
+    delete paper_;
 }
 
 Input_score::Input_score()
index 27e9a55732a462a1be2696009483dd4d19d3b978..d79aac1021f2f47c18173330a77183d8c766c6f4 100644 (file)
@@ -5,12 +5,10 @@
 #include "inputstaff.hh"
 #include "inputcommand.hh"
 #include "staffcommands.hh"
-#include "melodicstaff.hh"
-#include "rhythmstaff.hh"
-#include "lyricstaff.hh"
 #include "staff.hh"
 #include "complexstaff.hh"
 #include "lexer.hh"
+#include "lyricstaff.hh"
 
 void
 Input_staff::add(Array<Input_command*> &s)
@@ -37,13 +35,16 @@ Staff*
 Input_staff::parse(Score*score_l)
 {
     Staff *p=0;
-
+#if 0
     if (type == "simple")
        p = new Melodic_staff;
-    else if (type == "melodic")
-       p = new Complex_staff;
     else if (type == "rhythmic")
        p = new Rhythmic_staff;
+    else
+#endif
+       
+       if (type == "melodic")
+       p = new Complex_staff;
     else if (type == "lyric")
        p = new Lyric_staff;
     else
index 017570d749fa01be41e17a91920cd6f20a352507..85bf74c620b00e4795a3673181875d3b43df57b3 100644 (file)
@@ -8,7 +8,9 @@
 
 const int FLAT_TOP_PITCH=2; /* fes,ges,as and bes typeset in lower octave */
 const int SHARP_TOP_PITCH=4; /*  ais and bis typeset in lower octave */
+
 NAME_METHOD(Keyitem);
+
 Keyitem::Keyitem(int c)
 {
     c_position = c;
@@ -28,7 +30,8 @@ Keyitem::read(Array<int> s)
 void 
 Keyitem::read(const Clef& c)
 {
-    c_position=(c.c0_pos+70)%7;
+    int octaves =(abs(c.c0_position_i_) / 7) +1 ;
+    c_position=(c.c0_position_i_ + 7*octaves)%7;
 }
 
 
@@ -48,7 +51,7 @@ Molecule*
 Keyitem::brew_molecule_p()const
 {
     Molecule*output = new Molecule;
-    Real inter = paper()->interline()/2;
+    Real inter = paper()->internote();
     
     for (int i =0; i < pitch.size(); i++) {
        Symbol s= paper()->lookup_p_->accidental(acc[i]);
index 0771cafcde864e89880e08155405d98733b84c2b..f0652ac6c78d757f15cee3b22b9a7c8d72089438 100644 (file)
@@ -9,6 +9,7 @@
 #include "parser.hh"
 #include "debug.hh"
 #include "inputscore.hh"
+#include "parseconstruct.hh"
 #include "main.hh"
 
 %}
@@ -220,7 +221,8 @@ include           {
 <incl>[ \t]*      { /* eat the whitespace */ }
 <incl>\"[^"]*\"+   { /* got the include file name */
    String s (YYText()+1);
-       s = s.left(s.len()-1);
+   s = s.left(s.len()-1);
+   defined_ch_c_l = here_ch_c_l() - String( YYText() ).len() - 1;
    new_input(s);
    yy_pop_state();
 }
diff --git a/src/linepstaff.cc b/src/linepstaff.cc
deleted file mode 100644 (file)
index ef2c55d..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#include "linepstaff.hh"
-#include "molecule.hh"
-#include "symbol.hh"
-#include "lookup.hh"
-#include "dimen.hh"
-#include "paper.hh"
-#include "pscore.hh"
-
-Linestaff::Linestaff(int l, PScore *s)
-    : PStaff(s)
-{
-    nolines = l;
-}
-
-void
-Linestaff::brew_molecule_p(Real width)
-{
-    Atom a  = pscore_l_->paper_l_->lookup_p_->linestaff(nolines,width);
-    stafsym_p_ = new Molecule(a);
-}
-
-
-
-
-
-
-
index b70e2a26f5683472f03878c6f12dda46d2d4cef2..a7bfa1df9bd45ea6573ef12512d0b0e9174d161c 100644 (file)
@@ -8,7 +8,7 @@
 
 const Real COLFUDGE=1e-3;
 
-//#define COLFUDGE 1e-3
+
 bool
 Spacing_problem::contains(const PCol *w)
 {
@@ -239,7 +239,7 @@ Spacing_problem::print() const
     
 }
 
-/*****************/
+/* **************** */
 
 void
 Colinfo::print() const
index c61f1b91afa3a3366aa63748bac5f83adef7c4f6..6fa9b1dfe3162cb6a8aba97f76a6e5ad5beb2733 100644 (file)
@@ -45,9 +45,10 @@ Local_key_item::brew_molecule_p()const
     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()->interline()/2;
+               Real dy =lastoct*7*paper()->internote();
                octmol->translate(Offset(0, dy));
                output->add(*octmol);
                delete octmol;
@@ -57,14 +58,14 @@ Local_key_item::brew_molecule_p()const
        lastoct = accs[i].octave;
        Symbol s =paper()->lookup_p_->accidental(accs[i].acc);   
        Atom a(s);
-       Real dy = (accs[i].name + c0_position) * paper()->interline()/2;
+       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()->interline()/2;
+       Real dy =lastoct*7*paper()->internote();
        octmol->translate(Offset(0, dy));
        output->add(*octmol);
        delete octmol;
diff --git a/src/localkeyreg.cc b/src/localkeyreg.cc
new file mode 100644 (file)
index 0000000..bbd4993
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+  localkeyreg.cc -- implement Local_key_register
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "localkeyreg.hh"
+#include "localkeyitem.hh"
+#include "complexwalker.hh"
+
+Local_key_register::Local_key_register(Complex_walker*w)
+    : Request_register(w)
+{
+    key_item_p_ = 0;    
+}
+bool
+Local_key_register::try_request(Request*)
+
+{
+    return false;
+}
+
+void
+Local_key_register::process_request()
+{
+}
+void
+Local_key_register::do_pre_move_process()
+{
+    if (key_item_p_) {
+       walk_l_->typeset_element(key_item_p_);
+       key_item_p_ = 0;
+    }
+}
+void
+Local_key_register::acknowledge_element(Staff_elem_info info)
+{    
+    if (info.req_l_->melodic()) {
+       Melodic_req * melodic_l_ = info.req_l_->melodic();
+
+       if( melodic_l_->forceacc ||
+           walk_l_->local_key_.oct(melodic_l_->octave).acc(melodic_l_->notename)
+           != melodic_l_->accidental) {
+           Item * support_l_ = info.elem_p_->item();
+       
+
+           if (!key_item_p_) {
+               key_item_p_ = new Local_key_item(walk_l_->clef_.c0_position_i_);
+               key_item_p_->c0_position = walk_l_->clef_.c0_position_i_;
+           }
+           
+           key_item_p_->add(melodic_l_);
+           key_item_p_->add(support_l_);
+           walk_l_->local_key_.oct(melodic_l_->octave)
+               .set(melodic_l_->notename, melodic_l_->accidental);
+       }
+    }
+}
index be3466e092458ed7e92ba204d29c410e1b7fd188..96932e00234d9546ad894b8f5bfe8a878499f47b 100644 (file)
@@ -42,7 +42,7 @@ Lookup::text(String style, String text, int dir)
     return s;
 }
 
-/****************/
+/* *************** */
 
 Real
 Lookup::internote()
@@ -137,7 +137,21 @@ Lookup::streepjes(int i)
     return ret;
 }
 
-
+Symbol
+Lookup::hairpin(Real &wid, bool decresc)
+{
+    int idx = rint(wid / 6 PT);
+    if(!idx) idx ++;
+    wid = idx*6 PT;
+    String idxstr = (decresc)? "decrescendosym" : "crescendosym";
+    Symbol ret=(*symtables_)("param")->lookup(idxstr);
+       
+    Array<String> 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) 
@@ -162,9 +176,8 @@ Symbol
 Lookup::meter(Array<Scalar> a)
 {
     Symbol s;
-    s.dim.x = Interval( convert_dimen(0,"pt"),
-                       convert_dimen(10,"pt"));
-    s.dim.y = Interval(0, convert_dimen(20,"pt") );    // todo
+    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;    
index c016957eb64f846d198fd2b7ef7bf2f3838921a2..c54ebc2b397ad5bc10c3146db8e94c47d94c0da0 100644 (file)
@@ -9,7 +9,7 @@
 #include "pscore.hh"
 #include "main.hh"
 
-Lyric_column::Lyric_column(Score_column*s, Lyric_staff* lstaff_l)
+Lyric_column::Lyric_column(Score_column* s, Lyric_staff* lstaff_l)
     : Staff_column(s)
 {
     lstaff_l_ = lstaff_l;
@@ -33,28 +33,11 @@ Lyric_column::setup_requests()
     }
 }
 
-Interval itemlist_width(const Array<Item*> &its);
-
 void
-Lyric_column::typeset_item(Item *i, int breakst)
-{
-    assert(i);
-    
+Lyric_column::typeset_item(Item *i)
+{    
     lstaff_l_->pscore_l_->typeset_item(i, score_column_l_->pcol_l_,
-                                 lstaff_l_->line_pstaff_p_,breakst);
-    
-    if (breakst == BREAK_PRE - BREAK_PRE) {
-       
-        Array<Item*> to_move(
-           lstaff_l_->pscore_l_->select_items(lstaff_l_->line_pstaff_p_,
-                                         score_column_l_->pcol_l_->prebreak_p_));
-       Interval column_wid = itemlist_width(to_move);
-       assert(!column_wid.empty());
-
-       for (int j=0; j < to_move.size(); j++) {
-           to_move[j]->translate(Offset(-column_wid.right, 0));
-       }
-    }
+                                 lstaff_l_->pstaff_l_);
 }    
 
 Word_info::Word_info()
index 3afea78a8fbb1018a5c3874fca8bc8ab1341ec22..279db7ff87b83a08161ed31354acf0adcff33fa4 100644 (file)
@@ -6,16 +6,13 @@
 #include "command.hh"
 #include "lyricstaff.hh"
 #include "lyriccolumn.hh"
-#include "linepstaff.hh"
 #include "sccol.hh" 
 #include "lyricwalker.hh"
 #include "pscore.hh"
 
-
-
 Lyric_staff::Lyric_staff()
 {
-    line_pstaff_p_ = 0;
+    pstaff_l_=0;
 }
 
 Staff_column*
@@ -25,18 +22,18 @@ Lyric_staff::create_col(Score_column*s)
 }
 
 void
-Lyric_staff::set_output(PScore*ps)
+Lyric_staff::set_output(PScore*pscore_l)
 {
-    line_pstaff_p_ = new Linestaff(0,ps);
-    pscore_l_ = ps;
-    pscore_l_->add(line_pstaff_p_);
+    pstaff_l_ = new PStaff(pscore_l);
+    pscore_l_ = pscore_l;
+    pscore_l_->add(pstaff_l_);
 }
 
 void
 Lyric_staff::walk()
 {
     for (Lyric_walker lcols(this); lcols.ok(); lcols++) {
-       lcols.lcol_l()->setup_requests();// TODO
+       lcols.lcol_l()->setup_requests();
        lcols.process();
     }
 }
index d28c488b7273081afc32e945b665672d7b6195af..160b83ae9e46d2336d6f4be9174d8f46e30b298b 100644 (file)
@@ -1,17 +1,9 @@
-//
-//  what about 
-//      #include "flower.hh"
-//      #include "lily.hh"
-//
-//  or should we first devide lily/src up ?
-// HWN: huh?
-
 #include "request.hh"
 #include "voice.hh"
 #include "pscore.hh"
 #include "lyricstaff.hh"
 #include "lyricwalker.hh"
-#include "sccol.hh"
+//#include "sccol.hh"
 #include "debug.hh"
 #include "lyricitem.hh"
 
@@ -23,13 +15,11 @@ Lyric_walker::do_word(Word_info)
 void
 Lyric_walker::do_INTERPRET_command(Command* )
 {
-//    WARN << "command for Lyrics found\n";
 }
 
 void
 Lyric_walker::do_TYPESET_command(Command* )
 {
-//    WARN << "command for Lyrics found\n";
 }
 
 void
@@ -44,7 +34,7 @@ Lyric_walker::process_requests()
 }
 
 Lyric_walker::Lyric_walker(Lyric_staff* lstaff_l)
-    : Staff_walker(lstaff_l, lstaff_l->line_pstaff_p_->pscore_l_)
+    : Staff_walker(lstaff_l, lstaff_l->pstaff_l_->pscore_l_)
 {
     reset();
 }
diff --git a/src/melodicstaff.cc b/src/melodicstaff.cc
deleted file mode 100644 (file)
index df760d6..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-#include "melodicstaff.hh"
-#include "keyitem.hh"
-#include "stem.hh"
-#include "rest.hh"
-#include "notehead.hh"
-#include "paper.hh"
-#include "molecule.hh"
-#include "linepstaff.hh"
-//#include "rhythmstaff.hh"
-#include "sccol.hh" 
-#include "localkeyitem.hh"
-#include "request.hh"
-
-const int NO_LINES=5;
-
-
-void
-Melodic_staff::set_output(PScore*ps)
-{
-    theline_l_ = new Linestaff(NO_LINES,ps); // theline_l_ is added to pscore later.
-    Simple_staff::set_output(ps);
-}
-
-
-Notehead*
-Melodic_staff::get_notehead(Note_req *rq, int bottom)
-{        
-    Notehead *n =new Notehead((NO_LINES-1)*2);
-    n->set_rhythmic(rq->rhythmic());
-    n->position = rq->note()->height() + bottom;
-    n->defined_ch_c_l_m = rq->defined_ch_c_l_m;
-    return n;
-}
-
-Item *
-Melodic_staff::get_TYPESET_item(Command*com)
-{
-    if (com->args[0] == "KEY") {
-       return new Keyitem(NO_LINES);   // urgh. depends on clef.
-    } else
-       return Simple_staff::get_TYPESET_item(com);
-}
-
-Stem *
-Melodic_staff::get_stem(Stem_req*rq)
-{
-    Stem * s = new Stem(NO_LINES-1);
-    s->flag = rq->balltype;
-    return s;
-}
-
-Rest*
-Melodic_staff::get_rest(Rest_req*rq)
-{
-    Rest*r = Simple_staff::get_rest(rq);
-    if (rq->balltype <= 2)
-       r->translate(Offset(0, NO_LINES * paper()->internote()));
-    return r;
-}
-
-Local_key_item*
-Melodic_staff::get_local_key_item()
-{
-    return new Local_key_item(-2);
-}
-
index 1e09658fee90d91b4632870ea0f31aef385a8383..c52fdc7b329b324a974f625bc2fce765b85095bc 100644 (file)
@@ -39,7 +39,7 @@ Atom::TeXstring() const
     return substitute_args(s, a);
 }
 
-/****************/
+/* *************** */
 
 String
 Molecule::TeXstring() const
index 4575fa78d365fdd12f673a77bab7d109f0e55834..de6fcc7238c90ad370eae012f44424c1d76bc4a5 100644 (file)
@@ -16,24 +16,24 @@ static Keyword_ent the_key_tab[]={
     "bar", BAR,
     "cadenza", CADENZA,
     "clef", CLEF,
-    "cm", CM,
+    "cm", CM_T,
     "command", COMMAND,
     "commands", COMMANDS,
     "duration", DURATIONCOMMAND,
     "geometric", GEOMETRIC,
     "goto", GOTO,
-    "in", IN,
+    "in", IN_T,
     "key", KEY,
     "mark", MARK,
     "meter", METER,
-    "mm", MM,
+    "mm", MM_T,
     "multivoice", MULTIVOICE,
     "octave", OCTAVECOMMAND,
     "output", OUTPUT,
     "partial", PARTIAL,
     "paper", PAPER,
     "plet", PLET,
-    "pt", PT,
+    "pt", PT_T,
     "score", SCORE,
     "script", SCRIPT,
     "skip", SKIP,
index 226b10a6015942e9e5938d1c2bff95831d84019a..5c9daee9fd8050985ff403d66c338fb3d7cdfe4e 100644 (file)
@@ -1,7 +1,7 @@
 /*
   could use cleanup
  */
-  #include <ctype.h>
+#include <ctype.h>
 #include "lexer.hh"
 #include "string.hh"
 #include "real.hh"
@@ -121,7 +121,7 @@ get_note_element(String pitch, int * notename, int * duration )
     parse_pitchmod(pitch, i, oct, forceacc);
     rq->notename =notename[0];
     rq->accidental = notename[1];
-    rq->octave = oct;
+    rq->octave = oct + notename[2];
     rq->forceacc = forceacc;
     rq->balltype = dur;
     rq->dots = dots;
@@ -289,7 +289,9 @@ Request*
 get_script_req(int d , Script_def*def)
 {
     Script_req* script_req_p = new Script_req(d, def);
-    script_req_p->defined_ch_c_l_m = defined_ch_c_l;
+//    script_req_p->defined_ch_c_l_m = req_defined_ch_c_l;
+    // all terminal symbols, rather set directly here:
+    script_req_p->defined_ch_c_l_m = lexer->here_ch_c_l();
     return script_req_p;
 }
 
index fc250288c93ce46152842c28fee3d58bb14da522..d96b4d0599b076dcdea3d27f8ea130e2170ad73f 100644 (file)
@@ -19,6 +19,7 @@ Notehead::Notehead(int ss)
     extremal = 0;
     defined_ch_c_l_m = 0;
 }
+
 void
 Notehead::set_rhythmic(Rhythmic_req*r_req_l)
 {
index f22f44d7b9ab957b12f15b7c3b6b481bfd4d070a..e6d62644b2f12b6adb22342b77d21d8a895ac81f 100644 (file)
@@ -28,7 +28,7 @@ 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)
 {
index 09fd19aad43efbf79ed6face06b89a6d40426a8f..ec5fde415db6c0ce28a2e0d3926903b39db67ef3 100644 (file)
@@ -20,14 +20,13 @@ Paperdef::duration_to_dist(Moment d)
 Real
 Paperdef::rule_thickness()const
 {
-    return convert_dimen(0.4, "pt");
+    return 0.4 PT;
 }
 
 Paperdef::Paperdef(Lookup *l)
 {
     lookup_p_ = l;
-
-    linewidth = convert_dimen(15,"cm");                // in cm for now
+    linewidth = 15 *CM_TO_PT;          // in cm for now
     whole_width = 8 * note_width();
     geometric_ = sqrt(2);
 }
@@ -72,7 +71,7 @@ Paperdef::note_width()const
 Real
 Paperdef::standard_height() const
 {
-    return convert_dimen(20,"pt");
+    return 20 PT;
 }
 
 void
index 09e4bd310aa9a101b1cabb12c40693d1c188378f..71926f60ca6d4d5267c7fd9fbf5f67d628aa3cce 100644 (file)
@@ -64,7 +64,7 @@ int fatal_error_i = 0;
 }
 
 %token VOICE STAFF SCORE TITLE  BAR  OUTPUT MULTIVOICE
-%token CM IN PT MM PAPER WIDTH METER UNITSPACE SKIP COMMANDS COMMAND
+%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
@@ -78,7 +78,7 @@ int fatal_error_i = 0;
 %token <string> STRING
 
 %token <i> DOTS INT
-%type <consstr> unit
+%type <real> unit
 %type <intvec> pitch_list 
 %type <c> open_request_parens close_request_parens
 %type <id> declaration
@@ -517,7 +517,9 @@ mudela_text:
        ;
 
 script_req:
-       script_dir mudela_script        { $$ = get_script_req($1, $2); }
+       script_dir mudela_script        { 
+               $$ = get_script_req($1, $2);
+       }
        ;
 
 mudela_script:
@@ -704,14 +706,14 @@ int_list:         {
 
 
 dim:
-       real unit       { $$ = convert_dimen($1,$2); }
+       real unit       { $$ = $1*$2; }
        ;
 
 
-unit:  CM              { $$ = "cm"; }
-       |IN             { $$ = "in"; }
-       |MM             { $$ = "mm"; }
-       |PT             { $$ = "pt"; }
+unit:  CM_T            { $$ = 1 CM; }
+       |IN_T           { $$ = 1 INCH; }
+       |MM_T           { $$ = 1 MM; }
+       |PT_T           { $$ = 1 PT; }
        ;
        
 /*
index 728b083f4e353c36ec0fc91b00aebae8aa1c081a..a022f5e087a710b2fedce5ad9e8cbc526c19cf60 100644 (file)
@@ -15,16 +15,11 @@ Idealspacing*
 PScore::get_spacing(PCol*l, PCol*r)
 {
     assert(l!=r);
-    for (iter_top(suz,ic); ic.ok(); ic++) {
-       if (ic->left == l && ic->right == r){
-           return ic;
-       }
-    }
-    
-    Idealspacing*ip =new Idealspacing(l,r);
-    suz.bottom().add(ip);
 
-    return ip;
+    Idealspacing*i_p =new Idealspacing(l,r);
+    suz.bottom().add(i_p);
+
+    return i_p;
 }
 
 
@@ -53,11 +48,10 @@ PScore::do_connect(PCol *c1, PCol *c2, Real d, Real h)
     if (!c1 || !c2 )
        return;
     Idealspacing*s_l=get_spacing(c1,c2);
-       
-    if (!s_l->hooke){
-       s_l->hooke = h;
-       s_l->space =d;
-    }
+
+    
+    s_l->hooke = h;
+    s_l->space =d;
 }
 
 void
@@ -73,7 +67,7 @@ void
 PScore::typeset_item(Item *i, PCol *c, PStaff *s, int breakstat)
 {
     assert(c && i && s);
-//    assert(!breakstat != 4 || c->breakable() );
+
     if (breakstat == 0) {
        typeset_item(i, c->prebreak_p_, s);
        return;
@@ -254,10 +248,10 @@ void
 PScore::process()
 {
     clean_cols();
-    *mlog << "Preprocessing" << endl;
+    *mlog << "Preprocessing ... " <<flush;
     preprocess();
-    *mlog << "Calculating" << endl;
+    *mlog << "\nCalculating column positions ... " <<flush;
     calc_breaking();
-    *mlog << "Postprocessing" << endl;
+    *mlog << "\nPostprocessing ..." << endl;
     postprocess();
 }
index 3c7d82deae661a64019b1747739fe247444d418a..ce7f7b0da082b5abd472b1a38a36ac14141ef7c9 100644 (file)
@@ -1,19 +1,13 @@
 #include "pstaff.hh"
 #include "molecule.hh"
 
-PStaff::~PStaff()
-{
-    delete stafsym_p_;
-}
-
 PStaff::PStaff(PScore*ps)
 {
     pscore_l_=ps;
-    stafsym_p_ = 0;
 }
 
 void
-PStaff::add(Item *i )
+PStaff::add(Item *i)
 {
     its.bottom().add(i);
     i->pstaff_l_ = this;
index 280f0db4ccde40d992b57b9880e770dfe101cdd9..1e3e2f67d495cf59dade64ff5ee47ae4beda1571 100644 (file)
@@ -116,7 +116,7 @@ Ineq_constrained_qp::print() const
 #endif
 }
 
-/****************/
+/* *************** */
 
 /*
     eliminate appropriate variables, until we have a Ineq_constrained_qp
index dd9c4043a2983b89c5b89a587623e6d7ad123308..ed49c2a02f8a5d2c6e3e0962a8a1f69dd78756ce 100644 (file)
@@ -142,7 +142,7 @@ Active_constraints::find_active_optimum(Vector g)
     return H*g;
 }
 
-/****************************************************************/
+/* *************************************************************** */
 
 int
 min_elt_index(Vector v)
@@ -159,6 +159,19 @@ min_elt_index(Vector v)
 }
 
 ///the numerical solving
+/** Mordecai Avriel, Nonlinear Programming: analysis and methods (1976)
+    Prentice Hall.
+
+    Section 13.3
+
+    This is a "projected gradient" algorithm. Starting from a point x
+    the next point is found in a direction determined by projecting
+    the gradient onto the active constraints.  (well, not really the
+    gradient. The optimal solution obeying the active constraints is
+    tried. This is why H = Q^-1 in initialisation) )
+
+
+    */
 Vector
 Ineq_constrained_qp::solve(Vector start) const 
 {    
@@ -248,17 +261,4 @@ Ineq_constrained_qp::solve(Vector start) const
     return x;
 } 
 
-/** Mordecai Avriel, Nonlinear Programming: analysis and methods (1976)
-    Prentice Hall.
-
-    Section 13.3
-
-    This is a "projected gradient" algorithm. Starting from a point x
-    the next point is found in a direction determined by projecting
-    the gradient onto the active constraints.  (well, not really the
-    gradient. The optimal solution obeying the active constraints is
-    tried. This is why H = Q^-1 in initialisation) )
-
-
-    */
     
index d9d3e8a41b5ae3ed200bbb34e9bfaf2d3431ceb2..7eeeb46ada77dfcc07de9dea3a25537d1111d91e 100644 (file)
@@ -1,9 +1,18 @@
+/*
+  register.cc -- implement  Staff_elem_info, Request_register
+
+  Sourcefile of LilyPond musictypesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
 #include "voice.hh"
 #include "request.hh"
 #include "register.hh"
 #include "notehead.hh"
 #include "complexwalker.hh"
 #include "localkeyitem.hh"
+#include "complexstaff.hh"
 
 Staff_elem_info::Staff_elem_info(Staff_elem*s_l, Request*r_l,
                                 Request_register *reg_l)
@@ -14,6 +23,7 @@ Staff_elem_info::Staff_elem_info(Staff_elem*s_l, Request*r_l,
     group_regs_l_ = 0;
     origin_reg_l_ = reg_l;
 }
+
 Staff_elem_info::Staff_elem_info()
 {
     elem_p_ = 0;
@@ -23,7 +33,8 @@ Staff_elem_info::Staff_elem_info()
     origin_reg_l_ = 0;
     req_l_ = 0;
 }
-/****************/
+
+/* *************** */
 
 Request_register::Request_register()
 {
@@ -47,54 +58,25 @@ Request_register::post_move_processing()
     do_post_move_process();
 }
 
-
-/****************/
-
-Local_key_register::Local_key_register(Complex_walker*w)
-    : Request_register(w)
+Request_register::Request_register(Request_register const&)
 {
-    key_item_p_ = 0;    
-}
-bool
-Local_key_register::try_request(Request*)
-
-{
-    return false;
+    assert(false);
 }
 
 void
-Local_key_register::process_request()
+Request_register::announce_element(Staff_elem_info i)
 {
+    walk_l_->announce_element(i);
 }
+
 void
-Local_key_register::do_pre_move_process()
+Request_register::typeset_element(Staff_elem*p)
 {
-    if (key_item_p_) {
-       walk_l_->typeset_element(key_item_p_);
-       key_item_p_ = 0;
-    }
+    walk_l_->typeset_element(p);
 }
-void
-Local_key_register::acknowledge_element(Staff_elem_info info)
-{    
-    if (info.req_l_->melodic()) {
-       Melodic_req * melodic_l_ = info.req_l_->melodic();
-
-       if( melodic_l_->forceacc ||
-           walk_l_->local_key_.oct(melodic_l_->octave).acc(melodic_l_->notename)
-           != melodic_l_->accidental) {
-           Item * support_l_ = info.elem_p_->item();
-       
 
-           if (!key_item_p_) {
-               key_item_p_ = new Local_key_item(walk_l_->clef_.c0_pos);
-               key_item_p_->c0_position = walk_l_->clef_.c0_pos;
-           }
-           
-           key_item_p_->add(melodic_l_);
-           key_item_p_->add(support_l_);
-           walk_l_->local_key_.oct(melodic_l_->octave)
-               .set(melodic_l_->notename, melodic_l_->accidental);
-       }
-    }
+Paperdef*
+Request_register::paper()const
+{
+    return walk_l_->staff()->paper();
 }
index 0a5c8dc3d842fdd9661cddf86e8e53f5226d648e..951a509bc41a2e9b97f4d8e9fa0a6c7130d05a97 100644 (file)
@@ -19,7 +19,7 @@ Stem_req::Stem_req(int s, int d)
     dir_i_ = 0;
 }
 
-/****************/
+/* *************** */
 void
 Barcheck_req::do_print() const    
 {
@@ -28,7 +28,7 @@ Barcheck_req::do_print() const
 #endif
 }
 
-/****************/
+/* *************** */
 
 void
 Request::print() const
@@ -65,7 +65,7 @@ Request::Request(Request const&src)
     elt_l_ = 0;
     defined_ch_c_l_m = src.defined_ch_c_l_m;
 }
-/****************/
+/* *************** */
 Spacing_req::Spacing_req()
 {
     next = 0;
@@ -82,7 +82,7 @@ Blank_req::do_print()const
 {
     Spacing_req::do_print();
 }
-/****************/
+/* *************** */
 Melodic_req::Melodic_req()
 {
     notename = 0;
@@ -103,11 +103,11 @@ Melodic_req::height() const
     return  notename + octave*7;
 }
 
-/****************/
+/* *************** */
 int
 Rhythmic_req::compare(const Rhythmic_req &r1, const Rhythmic_req &r2)
 {
-    return r1.duration() - r2.duration();
+    return sign(r1.duration() - r2.duration());
 }
 Rhythmic_req::Rhythmic_req(int b, int d)
 {
@@ -139,7 +139,7 @@ Moment
 Rhythmic_req::duration() const {    
     return wholes(balltype,dots)*plet_factor;
 }
-/****************/
+/* *************** */
 
 Lyric_req::Lyric_req(Text_def* def_p)
     :Text_req(0, def_p)
@@ -154,30 +154,30 @@ Lyric_req::do_print() const
     Rhythmic_req::do_print();
     Text_req::do_print();
 }
-/****************/
+/* *************** */
 void
 Note_req::do_print() const
 {
     Melodic_req::do_print();
     Rhythmic_req::do_print();
 }
-/****************/
+/* *************** */
 void
 Rest_req::do_print() const
 {
         Rhythmic_req::do_print();
 }
 
-/****************/
+/* *************** */
 Beam_req::Beam_req()
 {
     nplet = 0;
 }
 
 void Beam_req::do_print()const{}
-/****************/
+/* *************** */
 void Slur_req::do_print()const{}
-/****************/
+/* *************** */
 int
 Span_req:: compare(const Span_req &r1, const Span_req &r2)
 {
@@ -188,7 +188,7 @@ Span_req::Span_req()
 {
     spantype = NOSPAN;
 }
-/****************/
+/* *************** */
 void
 Group_feature_req::do_print() const
 {
@@ -207,7 +207,7 @@ void
 Terminate_voice_req::do_print()const
 {
 }
-/****************/
+/* *************** */
 Script_req::Script_req(int d , Script_def*def)
 {
     dir_i_ = d;
@@ -222,6 +222,7 @@ Script_req::compare(const Script_req &d1, const Script_req &d2)
 }
 
 Script_req::Script_req(Script_req const &s)
+    : Request( s )
 {
     dir_i_ = s.dir_i_;
     scriptdef_p_ = new Script_def(*s.scriptdef_p_);
@@ -239,7 +240,7 @@ Script_req::~Script_req()
 {
     delete scriptdef_p_;
 }
-/****************/
+/* *************** */
 int
 Text_req:: compare(const Text_req &r1, const Text_req &r2)
 {
@@ -274,7 +275,7 @@ Text_req::do_print() const
 
 
 
-/****************/
+/* *************** */
 
 Mark_req::Mark_req(String s)
 {
@@ -288,7 +289,7 @@ Mark_req::do_print()const
     mtor<< " `" << mark_str_ << "\'\n";
 #endif
 }
-/****************/
+/* *************** */
 Staff_command_req::Staff_command_req(Input_command * p)
 {
     com_p_ = p;
diff --git a/src/rhythmstaff.cc b/src/rhythmstaff.cc
deleted file mode 100644 (file)
index 519ea18..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#include "molecule.hh"
-#include "score.hh"
-#include "request.hh"
-#include "notehead.hh"
-#include "stem.hh"
-#include "linepstaff.hh"
-#include "rhythmstaff.hh"
-#include "paper.hh"
-#include "sccol.hh" 
-#include "rest.hh"
-
-void
-Rhythmic_staff::set_output(PScore*ps)
-{
-    theline_l_ = new Linestaff(1,ps);
-    Simple_staff::set_output(ps);
-}
-
-Item *
-Rhythmic_staff::get_TYPESET_item(Command *com)
-{
-    if (com->args[0] == "KEY" || com->args[0] == "CLEF"||
-       com->args[0] == "CURRENTCLEF")
-       return 0;
-    Item *i = Simple_staff::get_TYPESET_item(com);
-    if (!i) return 0;
-    i->translate(Offset(0,
-                       -score_l_->paper_p_->standard_height()/2));
-    return i;
-}
-
-Notehead*
-Rhythmic_staff::get_notehead(Note_req *rq, int)
-{
-    Notehead *n =new Notehead(1);
-    n->set_rhythmic(rq->rhythmic());
-    n->position = 0;
-    return n;
-}
-
-Stem *
-Rhythmic_staff::get_stem(Stem_req*rq)
-{
-    Stem * s = new Stem(0);
-    s->flag = rq->balltype;
-    return s;    
-}
index 14c52796de10c48ae0a58c453c99c41d4be7e6e1..2d826094da5f51b725cb62553594b150e0e47a26 100644 (file)
@@ -54,6 +54,7 @@ Score_column::preprocess()
 void
 Score_column::add_duration(Moment d)
 {
+    assert(d);
     for (int i = 0; i< durations.size(); i++) {
        if (d == durations[i])
            return ;
index 0f697655b24b2f46ec14d6dae35421cda423bc52..ab9a9d9a93d374718b565365ac7e3c0755e0c4e2 100644 (file)
 void
 Score::process()
 {
-    *mlog << "\nProcessing music" << endl;
+    *mlog << "\nProcessing music ..." << flush;
     
     assert (paper_p_);
     if (last() == Moment(0)) {
        warning("Need to have music in a score.", defined_ch_c_l_);
     }
+
     // distribute commands to disciples
     pscore_p_ = new PScore(paper_p_);
     for (iter_top(staffs_,i); i.ok(); i++) {
-       i->truncate_cols(last());
        i->set_output(pscore_p_);
+       i->truncate_cols(last());
        i->process();
     }
 
@@ -34,6 +35,7 @@ Score::process()
 
     // debugging
     OK();
+    *mlog << endl;
     pscore_p_->process();    
 }
 
@@ -88,9 +90,10 @@ Score::create_cols(Moment w)
 }
 
 PCursor<Score_column*>
-Score::find_col(Moment w,bool mus)
-{
-    iter_top(cols_,i);
+Score::find_col(Moment w, bool mus)
+{   iter_top( cols_,i);
+       
+    
     for (; i.ok(); i++) {
        if (i->when() == w && i->musical_ == mus)
            return i;
@@ -112,6 +115,7 @@ Score::do_cols()
     }
     clean_cols();    // can't move clean_cols() farther up.
 }
+
 Moment
 Score::last() const
 {    
@@ -157,10 +161,10 @@ Score::print() const
 #endif
 }
 
-Score::Score(Paperdef*p)
+Score::Score(Paperdef*paper_p)
 {
     pscore_p_=0;
-    paper_p_ = p;              // ?? safe?
+    paper_p_ = paper_p;
     errorlevel_i_ = 0;
     defined_ch_c_l_ = 0;
 }
index 1e11de72c29934611a0ee275584e9e97afb2c432..508ae6a24ba939b5f1816c21ecdf93c1878fc75b 100644 (file)
@@ -17,7 +17,7 @@ Script_def::print() const
 int
 Script_def::compare(Script_def const & c)
 {
-    return (symidx == c.symidx &&
+    return !(symidx == c.symidx &&
        stemdir == c.stemdir&&
        staffdir == c.staffdir&&
        invertsym == c.invertsym);
diff --git a/src/scriptreg.cc b/src/scriptreg.cc
new file mode 100644 (file)
index 0000000..88375db
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+  scriptreg.cc -- implement Script_register
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "scriptreg.hh"
+#include "script.hh"
+#include "request.hh"
+#include "complexwalker.hh"
+
+Script_register::Script_register(Complex_walker*w)
+    : Request_register(w)
+{
+    script_p_ = 0;
+}
+
+bool
+Script_register::try_request(Request *r_l)
+{
+    if (!r_l->script())
+       return false ;
+
+    if (accepted_req_arr_.size()
+       && Script_req::compare(*accepted_req_arr_[0]->script(), *r_l->script()))
+       
+       return false;
+
+    accepted_req_arr_.push(r_l);
+    
+    return true;
+}
+
+void
+Script_register::process_request()
+{
+    if (accepted_req_arr_.size() ) {
+       script_p_ = new Script(accepted_req_arr_[0]->script(), 10);
+       announce_element(
+           Staff_elem_info(script_p_, accepted_req_arr_[0], this));
+    }
+}
+
+void
+Script_register::acknowledge_element(Staff_elem_info info)
+{
+    if (!script_p_)
+       return;
+    if (info.elem_p_->name() == String("Stem"))
+       script_p_->set_stem((Stem*)info.elem_p_);
+    else if (info.req_l_->rhythmic())
+       script_p_->set_support(info.elem_p_->item());
+}
+
+void
+Script_register::do_pre_move_process()
+{
+    if (script_p_){
+       script_p_->dir = dir_i_;
+       typeset_element(script_p_);
+       script_p_ = 0;
+    }
+}
+
+void
+Script_register::set_dir(int i)
+{
+    dir_i_ = i;
+}
diff --git a/src/simpleprint.cc b/src/simpleprint.cc
deleted file mode 100644 (file)
index 7ded4a9..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-#include "clefitem.hh"
-#include "request.hh"
-#include "pscore.hh"
-#include "paper.hh"
-#include "simplestaff.hh"
-#include "sccol.hh"
-#include "rest.hh"
-#include "debug.hh"
-#include "bar.hh"
-#include "meter.hh"
-
-Item *
-Simple_staff::get_TYPESET_item(Command *com)
-{
-    Item *s=0;
-    Array<Scalar> arg( com->args);
-    String type =arg[0];
-    arg.del(0);
-    if (type ==  "BAR" ) {
-       s = new Bar(com->args[1]);      
-    } else if (type == "METER") {
-       s = new Meter(arg);
-    } else if (type == "CLEF" || type == "CURRENTCLEF") {
-       Clef_item * c = new Clef_item;
-       s = c;
-       c->change = (type == "CLEF");   
-    }else{
-       WARN << "ignoring TYPESET command for " << type << '\n';
-    }
-    return s;
-}
-
-
-Interval
-itemlist_width(const Array<Item*> &its)
-{
-    Interval iv ;
-    iv.set_empty();
-     
-    for (int j =0; j < its.size(); j++){
-       iv.unite (its[j]->width());
-
-    }
-    return iv;
-}
-
-void
-Simple_column::typeset_item(Item *i, int breakst)
-{
-    assert(i);
-    
-    staff_l_->pscore_l_->typeset_item(i, score_column_l_->pcol_l_,
-                                 staff_l_->theline_l_,breakst);
-    
-    if (breakst == BREAK_PRE - BREAK_PRE) {
-       
-        Array<Item*> to_move(
-           staff_l_->pscore_l_->select_items(staff_l_->theline_l_,
-                                         score_column_l_->pcol_l_->prebreak_p_));
-       Interval column_wid = itemlist_width(to_move);
-       assert(!column_wid.empty());
-
-       for (int j=0; j < to_move.size(); j++) {
-           to_move[j]->translate(Offset(-column_wid.right, 0));
-       }
-    }
-}    
-
-void
-Simple_column::typeset_item_directional(Item *i, int dir, int breakst) // UGH!
-{
-    assert(i);
-    PCol * c=score_column_l_->pcol_l_;
-    if (breakst == 0)
-       c = c->prebreak_p_;
-    else if (breakst == 2)
-       c = c->postbreak_p_;
-    
-    Array<Item*> to_move(staff_l_->pscore_l_->select_items(staff_l_->theline_l_,
-                                                     c));    
-    typeset_item(i, breakst);
-
-    Interval column_wid = itemlist_width(to_move);
-    if (column_wid.empty())
-       column_wid = Interval(0,0);
-    i->translate(Offset(column_wid[dir] - i->width()[-dir], 0));
-}
-
-void
-Simple_staff::set_output(PScore* ps )
-{
-    pscore_l_ = ps;
-    pscore_l_->add(theline_l_);
-}
-
-
-Rest*
-Simple_staff::get_rest(Rest_req*rq)
-{
-    int b = rq->rhythmic()->balltype;
-    int d = rq->rhythmic()->dots;
-    return new Rest(b, d);  
-}
-
-Local_key_item*
-Simple_staff::get_local_key_item()
-{
-    return 0;
-}
-
diff --git a/src/simplestaff.cc b/src/simplestaff.cc
deleted file mode 100644 (file)
index 4f7b5bd..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-#include "request.hh"
-#include "voice.hh"
-#include "staffwalker.hh"
-#include "debug.hh"
-#include "clef.hh"
-#include "staff.hh"
-#include "command.hh"
-#include "simplestaff.hh"
-#include "sccol.hh" 
-#include "simplewalker.hh"
-
-
-
-Simple_column::Simple_column(Score_column*s, Simple_staff *rs)
-    : Staff_column(s)
-{
-    stem_requester_len = 0;
-    stem_ = 0;    
-    staff_l_ = rs;
-    beam_ = 0;
-    text_=0;
-
-}
-
-Simple_staff::Simple_staff()
-{
-    theline_l_ = 0;
-}
-
-
-
-void
-Simple_column::setup_requests()
-{
-    for (int i = 0 ; i < v_elts.size(); i ++)
-       for (iter_top(v_elts[i]->reqs,j); j.ok(); j++) {
-           Request *rq= j;
-           if (rq->barcheck()) {
-               if (tdescription_->whole_in_measure) {
-                   warning( "Barcheck failed", rq->defined_ch_c_l_m );
-               }
-           }
-           if (rq->rhythmic()){
-               notes.push(rq->rhythmic());
-           }
-           if (rq->script()) {
-               notes.top().scripts.push(rq->script());
-           }
-           if (rq->stem()) {
-               stem_ = rq->stem();
-               stem_requester_len = v_elts[i]->duration;
-           }
-           if (rq->text()) {
-               text_ = rq->text();
-           }
-           if (rq->beam()) {
-               beam_ = rq->beam();
-           }
-           if (rq->slur()) {
-               slurs.push(rq->slur());
-           }
-       }
-}
-
-Staff_column*
-Simple_staff::create_col(Score_column*s)
-{
-    return new Simple_column(s,this);
-}
-
-void
-Simple_staff::walk()
-{
-    for (Simple_walker sc(this); sc.ok(); sc++) {
-       sc.col()->setup_requests();// TODO
-       sc.process();
-    }
-}
-Note_info::Note_info()
-{
-    rq =0;
-}
-Note_info::Note_info(Rhythmic_req*r) {
-    rq = r;
-}
diff --git a/src/simplewalker.cc b/src/simplewalker.cc
deleted file mode 100644 (file)
index f99d9f5..0000000
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
-  UGR!! CHAOS RULEZ
-  */
-#include "textspanner.hh"
-#include "script.hh"
-#include "request.hh"
-#include "voice.hh"
-#include "clef.hh"
-#include "beam.hh"
-#include "pscore.hh"
-#include "simplestaff.hh"
-#include "simplewalker.hh"
-#include "sccol.hh"
-#include "stem.hh"
-#include "notehead.hh"
-#include "rest.hh"
-#include "debug.hh"
-#include "keyitem.hh"
-#include "clefitem.hh"
-#include "slur.hh"
-#include "localkeyitem.hh"
-#include "textitem.hh"
-#include "misc.hh"
-
-Rhythmic_grouping
-parse_grouping(Array<Scalar> const &a)
-{
-    Array<int> r;
-    Array<Moment> grouplen_arr;
-    for (int i= 0 ; i < a.size()/2; ) {
-       r.push(a[i++]);
-       grouplen_arr.push(Moment(1,(int) a[i++]));
-    }
-    Moment here =0;
-
-    Array<Rhythmic_grouping*> children;
-    for (int i=0; i < r.size(); i++) {
-       
-       Moment last = here;
-       here += grouplen_arr[i] * Rational(r[i]);
-       children.push(
-           new Rhythmic_grouping(MInterval(last, here), r[i] ));
-    }
-    return Rhythmic_grouping(children);
-}
-
-
-
-void
-Simple_walker::do_INTERPRET_command(Command*com)
-{
-    Array<Scalar> args(com->args);
-    args.del(0);
-    if (com->args[0] == "GROUPING") {  
-       default_grouping = parse_grouping(args);
-    }else if (com->args[0] == "NEWMEASURE") {
-       local_key_.reset(key_);
-
-    } else if (com->args[0] == "KEY") {
-       
-       if (col()->when() > Moment(0)) {
-           assert(!oldkey_undo);
-           oldkey_undo = new Array<int>( key_.oldkey_undo(args));
-       }
-       
-       typesetkey = key_.read(args);
-       local_key_.reset(key_); 
-    } else if (com->args[0] == "CLEF") {
-       clef_.read(args);
-    } else {
-       WARN << " ignoring INTERPRET command: " << com->args[0]<< '\n';
-    }
-}
-
-void
-Simple_walker::do_TYPESET_command(Command*com)
-{
-    /* ignore these commands if non-default versions have been
-      processed.  */
-    if (com->args[0] == "CURRENTKEY") 
-       if (processed_key) 
-           return;
-       else
-           com->args[0] = "KEY"; // urgh
-    
-    if (com->args[0] == "CURRENTCLEF") {
-       if (processed_clef) 
-           return;
-    }
-    if (com->args[0] == "BAR") {
-       
-       if (processed_bar_priority > com->priority)
-           return;
-       else
-           processed_bar_priority = com->priority;
-    }
-
-    Item* i = staff()->get_TYPESET_item(com);
-    if (!i)
-       return;
-
-    if (com->args[0] == "KEY") {
-       ((Keyitem*) i)->read(clef_);
-       if (oldkey_undo) {
-           ((Keyitem*) i)->read(*oldkey_undo);
-           delete oldkey_undo;
-           oldkey_undo = 0;
-       }
-       processed_key = true;
-       
-       ((Keyitem*) i)->read(typesetkey); // ugh        
-    }
-
-    if (com->args[0] == "CLEF"||com->args[0] == "CURRENTCLEF") {
-       processed_clef =true;
-       Clef_item*c=(Clef_item*)i;
-       c->read(clef_);
-       c->change = (break_status != BREAK_POST - BREAK_PRE);
-    }
-    col()->typeset_item_directional(i, 1, break_status);
-}
-
-void
-Simple_walker::do_local_key(Note_req*n,Notehead* head_p)
-{
-    if ( local_key_.oct(n->octave).acc(n->notename) != n->accidental) {
-       if (!local_key_item_) {
-           local_key_item_ = staff()->get_local_key_item();
-           local_key_item_->c0_position = clef_.c0_pos;
-       }
-       local_key_item_->add(head_p);
-       local_key_item_->add(n->octave, n->notename, n->accidental);
-       local_key_.oct(n->octave).set(n->notename, n->accidental);
-    }
-}
-
-void
-Simple_walker::do_note(Note_info n)
-{
-    Simple_column*c = col();
-    Simple_staff *s = staff();
-    Item*rhythmic=0;
-    if (n.rq->note()) {
-       Note_req * req = n.rq->note() ;
-       const Voice *v = req->elt_l_->voice_l_;
-
-       Notehead*n = s->get_notehead(req, clef_.c0_pos);
-       rhythmic=n;
-       if (stem_)
-           stem_->add(n);
-       
-       if (current_grouping) {
-           current_grouping->add_child(
-               c->tdescription_->whole_in_measure, req->duration());
-       }
-       noteheads.push(n);
-       int sidx =find_slur(v);
-       if (sidx >= 0) {
-           pending_slurs[sidx]->add(n);
-       }
-
-       if (wantkey)
-           do_local_key(req,n);
-    } else if (n.rq->rest()) {
-       rhythmic = s->get_rest(n.rq->rest());
-       c->typeset_item(rhythmic);
-    }
-    for (int i= 0; i < n.scripts.size(); i ++) {
-       Script * s_p =new Script(n.scripts[i], 10);
-       s_p->set_support(rhythmic);
-       s_p->set_stem(stem_);
-       c->typeset_item(s_p);   // UGR
-    }
-}
-
-void
-Simple_walker::process_requests()
-{
-    Simple_column*c = col();
-    Simple_staff *s = staff();
-
-    if (c->beam_ && c->beam_->spantype == Span_req::START) {
-       if (beam_)
-           error("Too many beams (t = " +String(c->when())+")");
-       beam_ = new Beam;
-       assert(!current_grouping);
-       current_grouping = new Rhythmic_grouping;
-    }
-    
-    for (int i=0; i < c->slurs.size(); i++) {
-       Slur_req*sl = c->slurs[i];
-
-       if (sl->spantype == Span_req::START) {
-           if  (find_slur(sl->elt_l_->voice_l_)>=0)
-               error( "Too many slurs in voice", sl->defined_ch_c_l_m );
-           pending_slur_reqs.push(sl);
-           pending_slurs.push(new Slur);
-       }
-    }
-    
-    if (c->text_) {
-       c->typeset_item(new Text_item(c->text_, 10)); // UGR
-    }
-
-    if (c->stem_) {
-       stem_ = s->get_stem(c->stem_->stem());
-    }
-    
-    for (int i = 0; i <  c->notes.size(); i ++)  {
-       do_note(c->notes[i]);
-    }
-    
-    if (beam_) {
-       if (!stem_)
-           WARN <<"beamed note should have a stem (t = " 
-                 <<String(c->when())<<")\n";
-       else
-           beam_->add(stem_);
-
-
-    }
-    if (stem_) {
-       c->typeset_item(stem_);
-       /* needed, otherwise placement of
-          local_key fucks up */
-    }
-
-    if (c->beam_&& c->beam_->spantype == Span_req::STOP) {
-       if (!beam_) {
-           error( "No beam to end", c->beam_->defined_ch_c_l_m );
-       }
-       default_grouping.extend(current_grouping->interval());
-       beam_->set_grouping(default_grouping, *current_grouping);
-       pscore_l_->typeset_spanner(beam_, s->theline_l_);
-
-       if (c->beam_->nplet) {
-           Text_spanner* t = new Text_spanner;
-           t->set_support(beam_);
-           t->spec.align_i_ = 0;
-           t->spec.text_str_ = c->beam_->nplet;
-           pscore_l_->typeset_spanner(t, s->theline_l_);
-       }
-
-       beam_ = 0;
-       delete current_grouping;
-       current_grouping =0;
-    }
-    for (int i = 0; i < noteheads.size(); i++) {
-       c->typeset_item(noteheads[i]);
-    }
-    noteheads.set_size(0);
-    if (local_key_item_) {
-       c->typeset_item(local_key_item_);
-       local_key_item_ = 0;    
-    }
-    if (stem_) {
-       stem_ = 0;
-    }
-    for (int i=0; i < c->slurs.size(); i++) {
-       Slur_req *sl = c->slurs[i];
-
-       if (sl->spantype == Span_req::STOP) {
-           int idx = find_slur(sl->elt_l_->voice_l_);
-           if (idx < 0)
-               error( "can't find slur end", sl->defined_ch_c_l_m );
-           
-           pscore_l_->typeset_spanner(pending_slurs[idx],
-                                    s->theline_l_);
-           pending_slurs.del(idx);
-           pending_slur_reqs.del(idx);
-       }       
-    }
-    
-}
-Simple_walker::Simple_walker(Simple_walker const&)
-    : Staff_walker(0, 0)
-{
-    assert(false);
-}
-
-Simple_walker::~Simple_walker()
-{
-    if (pending_slurs.size())
-       WARN << "destructing " << pending_slurs.size() << " Pending slurs ";
-    if (beam_)
-       WARN << "destructing Beam\n";
-    if (local_key_item_)
-       WARN<<"destructing Local_key_item\n";
-    if (stem_)
-       WARN<< "destructing Stem\n";
-    delete local_key_item_;
-    delete stem_;
-    delete beam_;    
-    
-}
-    
-Simple_walker::Simple_walker(Simple_staff*s)
-    : Staff_walker(s, s->theline_l_->pscore_l_)
-{
-    stem_ = 0;
-    beam_ =0;
-    oldkey_undo = 0;
-    current_grouping = 0;
-    Local_key_item * i = s->get_local_key_item();
-    wantkey  =i;
-    delete i;
-    local_key_item_ = 0;
-    do_post_move();
-}
-
-
-
-Simple_staff*
-Simple_walker::staff()
-{
-    return (Simple_staff*) staff_l_;
-}
-
-Simple_column*
-Simple_walker::col()
-{
-    return (Simple_column*) *(*this);
-}
-
-void
-Simple_walker::do_post_move()
-{
-    processed_clef =false;    
-    processed_key = false;
-    processed_bar_priority = 0;
-}
-
-int
-Simple_walker::find_slur(const Voice *v)
-{
-    for (int i=0; i < pending_slur_reqs.size(); i++) {
-       if (pending_slur_reqs[i]->elt_l_->voice_l_== v)
-           return i;
-    }
-    return -1;
-}
-
-    
index 5b7f99d16ed4fb157de1cf6d1431f93cf71dc939..856ca990352b46f0c5af5c180812eed76f1b5ca6 100644 (file)
 #include "molecule.hh"
 #include "debug.hh"
 #include "boxes.hh"
+
 NAME_METHOD(Slur);
+
 Slur::Slur()
 {
-    dir = 0;
     open_right=open_left=false;
 }
 
@@ -50,9 +51,9 @@ Slur::set_default_dir()
     /* should consult stems */
     Real meanpos = sumpos/Real(encompass.size());
     if (meanpos < 5)           // todo
-       dir = -1;
+       dir_i_ = -1;
     else
-       dir = 1;    
+       dir_i_ = 1;    
 }
 
 void
@@ -85,7 +86,8 @@ Slur::do_break_at(PCol*l, PCol*r) const
 void
 Slur::do_post_processing()
 {
-    set_default_dir();
+    if (!dir_i_)
+       set_default_dir();
 }
 
 Molecule*
@@ -104,12 +106,12 @@ Slur::brew_molecule_p() const
     Notehead *rnote_p =encompass.top();
     int lpos_i = lnote_p->position;
     int rpos_i = rnote_p->position;
-    Offset  left_off(lnote_p->x_dir, lpos_i + 2*dir);
-    Offset right_off(lnote_p->x_dir, rpos_i + 2*dir);
+    Offset  left_off(lnote_p->x_dir, lpos_i + 2*dir_i_);
+    Offset right_off(lnote_p->x_dir, rpos_i + 2*dir_i_);
     if (!lnote_p->extremal)
-       left_off += Offset(0.5, -dir);
+       left_off += Offset(0.5, -dir_i_);
     if (!rnote_p->extremal)
-       right_off+= Offset(-0.5, -dir);
+       right_off+= Offset(-0.5, -dir_i_);
     
     int dy = int(right_off.y - left_off.y);
     
@@ -120,7 +122,7 @@ Slur::brew_molecule_p() const
     w+= (right_off.x - left_off.x) * nw_f ;
     Real round_w = w;          // slur lookup rounds the slurwidth .
     
-    Symbol sl = paper()->lookup_p_->slur(dy , round_w, dir);
+    Symbol sl = paper()->lookup_p_->slur(dy , round_w, dir_i_);
 
     Real error = w-round_w;
     
diff --git a/src/slurreg.cc b/src/slurreg.cc
new file mode 100644 (file)
index 0000000..05a7564
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+  slurreg.cc -- implement Slur_register
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "complexwalker.hh"
+#include "slurreg.hh"
+#include "slur.hh"
+#include "debug.hh"
+void
+Slur_register::set_dir(int i)
+{
+    dir_i_ = i;
+}
+
+Slur_register::Slur_register(Complex_walker* w)
+    : Request_register(w)
+{
+    set_dir(0);
+}
+
+bool
+Slur_register::try_request(Request *req_l)
+{
+    if(!req_l->slur())
+       return false;
+
+    accepted_req_arr_.push(req_l);
+    return true;
+}
+
+void
+Slur_register::acknowledge_element(Staff_elem_info info)
+{
+    if (info.elem_p_->name() == String("Notehead")) { 
+       Notehead *head_p =(Notehead*) info.elem_p_ ;// ugh
+       for (int i = 0; i < slur_l_stack_.size(); i++)
+           slur_l_stack_[i]->add(head_p );
+       for (int i = 0; i < end_slur_l_arr_.size(); i++)
+           end_slur_l_arr_[i]->add(head_p);
+    }
+}
+/*
+  abracadabra
+  */
+void
+Slur_register::process_request()
+{
+    Array<Slur*> start_slur_l_arr_;
+    for (int i=0; i< accepted_req_arr_.size(); i++) {
+       Slur_req* slur_req_l = accepted_req_arr_[i]->slur();
+       // end slur: move the slur to other array
+       if (slur_req_l->spantype == Span_req::STOP) {
+           if (slur_l_stack_.empty())
+               warning("can't find slur to end",
+                     slur_req_l->defined_ch_c_l_m);
+           else {
+               end_slur_l_arr_.push(slur_l_stack_.pop());
+               requests_arr_.pop();
+           }
+       } else  if (slur_req_l->spantype == Span_req::START) {
+           // push a new slur onto stack.
+           //(use temp. array to wait for all slur STOPs)
+           Slur * s_p =new Slur;
+           requests_arr_.push(slur_req_l);
+           start_slur_l_arr_.push(s_p);
+           announce_element(Staff_elem_info(s_p, slur_req_l, this));
+       }
+    }
+    for (int i=0; i < start_slur_l_arr_.size(); i++)
+       slur_l_stack_.push(start_slur_l_arr_[i]);
+}
+
+void
+Slur_register::do_pre_move_process()
+{
+    for (int i = 0; i < end_slur_l_arr_.size(); i++) {
+       if (dir_i_) 
+           end_slur_l_arr_[i]->dir_i_ = dir_i_;
+       typeset_element(end_slur_l_arr_[i]);
+    }
+    end_slur_l_arr_.set_size(0);
+}
+
+Slur_register::~Slur_register()
+{
+    for (int i=0; i < requests_arr_.size(); i++) {
+       warning("unterminated slur", requests_arr_[i]->defined_ch_c_l_m);
+    }
+}
index 1fe2aa3d53cab26beb474293efbebd2d2192992a..ac164fd94ab84b37a2071bb668eecdde3a13f1e8 100644 (file)
@@ -17,6 +17,9 @@
 #include "string.hh"
 #include "proto.hh"
 #include "plist.hh"
+#include "lexer.hh"
+#include "debug.hh"
+#include "parseconstruct.hh"
 #include "main.hh"                     // find_file
 
 #include "sourcefile.hh"
@@ -143,12 +146,13 @@ Source_file::line_i( char const* pos_ch_c_l )
 void
 Source_file::map()
 {
+    if ( fildes_i_m == -1 )
+       return;
+
     data_caddr_m = (caddr_t)mmap( (void*)0, size_off_m, PROT_READ, MAP_SHARED, fildes_i_m, 0 );
 
-    if ( (int)data_caddr_m == -1 ) {
-       cerr << "lilypond: can't map: " << name_str_m << ": " << strerror( errno ) << endl;
-       assert( 0 );
-    }
+    if ( (int)data_caddr_m == -1 )
+       warning( String( "can't map: " ) + name_str_m + String( ": " ) + strerror( errno ), defined_ch_c_l ); //lexer->here_ch_c_l() );
 }
 
 String
@@ -160,12 +164,15 @@ Source_file::name_str()
 void
 Source_file::open()
 {
-    name_str_m = find_file( name_str_m );
+    String name_str = find_file( name_str_m );
+    if ( name_str != "" ) 
+        name_str_m = name_str;
+
     fildes_i_m = ::open( name_str_m, O_RDONLY );       
-    
+           
     if ( fildes_i_m == -1 ) {
-       cerr << "lilypond: can't open: " << name_str_m << ": " << strerror( errno ) << endl;
-       assert( 0 );
+       warning( String( "can't open: " ) + name_str_m + String( ": " ) + strerror( errno ), defined_ch_c_l ); // lexer->here_ch_c_l() );
+        return;
     }
 
     struct stat file_stat;
index ad5b2e2552126351f48dc0fad6fa2672f84eeecb..15efb59071a9862f4554a425439155b85c67e747 100644 (file)
@@ -3,6 +3,7 @@
 #include "pcol.hh"
 
 NAME_METHOD(Spanner);
+
 void
 Spanner::do_print()const
 {
index d6ddda8f3b6dcdd7e07c4898e16cf6e989daa5ac..be98be9fc2a0c01e5e39740fe52460936d20d123 100644 (file)
@@ -77,18 +77,21 @@ Staff::clean_cols()
 Staff_column *
 Staff::get_col(Moment w, bool mus)
 {
-    Score_column* sccol_l = score_l_->find_col(w,mus);
-    
-    iter_top(cols,i);
+    iter_top(cols,i);    
     for (; i.ok(); i++) {
-
-       if (*i->score_column_l_ > *sccol_l) // too far
+       if (i->when() == w) {
+           if (i->musical_b() == mus) {
+               assert( score_l_->find_col(w,mus).ptr() == i->score_column_l_);
+               return i;
+           }
+           else if (!mus)
+               break;
+       } else if (i->when() > w)
            break;
-       if (sccol_l == i->score_column_l_)
-           return i;
     }
-
     /* post: *sc > *->score_column_l_ || !i.ok() */
+
+    Score_column* sccol_l = score_l_->find_col(w,mus);
     Staff_column* newst = create_col(sccol_l);
 
     if (!i.ok()) {
@@ -98,6 +101,7 @@ Staff::get_col(Moment w, bool mus)
     
     if (mus) {
        i.insert(newst);
+       
        return newst;
     }
 
@@ -136,18 +140,22 @@ void
 Staff::setup_staffcols()
 {    
     for (iter_top(voices,i); i.ok(); i++) {
+
        Moment now = i->start;
        for (iter_top(i->elts,j); j.ok(); j++) {
-
-           Staff_column *s_l=get_col(now,true);
+           
+           Staff_column *s_l= get_col(now, true);
+           assert(now == s_l->when());
            s_l->add(j);
            now += j->duration;     
        }
-       
     }
+    OK();
     set_time_descriptions();
 }
 
+
+
 void
 Staff::set_time_descriptions()
 {
@@ -182,7 +190,7 @@ Staff::OK() const
     i++;
     for (; i.ok(); j++,i++) {
        if ( j->when() == i->when())
-           assert(!j->mus() && i->mus());
+           assert(!j->musical_b() && i->musical_b());
        else
            assert(j->when () < i->when() );
     }
index 429874410e5b5fa94d5daee6fc3ebf87bc1072a9..a7fcbbeb01216643b6e80e47bf98008a3ba36cf8 100644 (file)
@@ -23,14 +23,11 @@ String
 Line_of_staff::TeXstring() const
 {
     String s("%line_of_staff\n");
+    
     s+=make_vbox(height());
     // the staff itself: eg lines, accolades
     s += "\\hbox{";
     {                          
-       ((PStaff*)pstaff_l_)->
-           brew_molecule_p(line_of_score_l_->pscore_l_->paper_l_->linewidth);
-
-       s+=pstaff_l_->stafsym_p_->TeXstring();
        iter_top(line_of_score_l_->cols,cc);
        Real lastpos=cc->hpos;
 
@@ -67,7 +64,6 @@ Line_of_staff::Line_of_staff(Line_of_score * sc, PStaff*st)
     PCol *linestop = sc->cols.bottom();
     
     for (iter_top(pstaff_l_->spans,i); i.ok(); i++) {
-
        PCol *brokenstart = &max(*linestart, *i->left);
        PCol *brokenstop = &min(*linestop, *i->right);
        if ( *brokenstart < *brokenstop) {
@@ -82,7 +78,8 @@ Line_of_staff::Line_of_staff(Line_of_score * sc, PStaff*st)
 Interval
 Line_of_staff::height() const
 {
-    Interval y = pstaff_l_->stafsym_p_->extent().y;
+    Interval y(0,0);
+
     iter_top(line_of_score_l_->cols,cc);
     
     // all items in the current line & staff.
@@ -105,7 +102,9 @@ Line_of_staff::height() const
 void
 Line_of_staff::process()
 {
+#if 0
     if (!pstaff_l_->stafsym_p_)
        pstaff_l_->brew_molecule_p(line_of_score_l_->pscore_l_->
                                 paper_l_->linewidth);
+#endif
 }
diff --git a/src/staffsym.cc b/src/staffsym.cc
new file mode 100644 (file)
index 0000000..2e2d9f3
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+  staffsym.cc -- implement Staff_symbol
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+#include "staffsym.hh"
+#include "lookup.hh"
+#include "paper.hh"
+#include "debug.hh"
+
+NAME_METHOD(Staff_symbol);
+
+Staff_symbol::Staff_symbol(int l)
+{
+    no_lines_i_ = l;
+}
+
+void
+Staff_symbol::do_print()const
+{
+    mtor << "lines: " << no_lines_i_;
+}
+
+Molecule*
+Staff_symbol::brew_molecule_p() const
+{
+    Atom a  = paper()->lookup_p_->linestaff(no_lines_i_, width().length());
+    return new Molecule(a);
+}
+
+Spanner*
+Staff_symbol::do_break_at(PCol*p1, PCol*p2)const
+{
+    Staff_symbol *span_p=new Staff_symbol(*this);
+    return span_p;
+}
+
+void
+Staff_symbol::set_extent(PCol*p1, PCol*p2)
+{
+    assert(p1&&p2);
+    left = p1;
+    right = p2;
+}
index 3bf94ceabaebfc63b8a2a97dd749244f51c8b640..eac45b5b13fcd1c94e5a15565be44cea30dfb7fe 100644 (file)
@@ -2,6 +2,7 @@
 #include "staffwalker.hh"
 #include "stcol.hh"
 #include "sccol.hh"
+#include "debug.hh"
 
 Staff_walker::~Staff_walker() {}
 Staff_walker::Staff_walker(Staff_walker const &s)
@@ -29,7 +30,7 @@ Staff_walker::process()
 {
     break_status = BREAK_END - BREAK_PRE;
 
-    if (ptr()->mus()) {
+    if (ptr()->musical_b()) {
        process_requests();
     } else if (ptr()->staff_commands_p_)
        for (iter_top(*ptr()->staff_commands_p_,i); i.ok(); i++) {
@@ -66,6 +67,11 @@ void
 Staff_walker::operator++(int i)
 {
     do_pre_move();
+    if (ptr()->musical_b() && ptr()->tdescription_
+       && !ptr()->tdescription_->whole_in_measure) {
+       *mlog << "[" << ptr()->tdescription_->bars<<"]"<< flush;
+    }
     PCursor<Staff_column*>::operator++(i);
+
     do_post_move();
 }
index 89a572408a621779b6b7be9eaeb80e2956238c3d..07124096624fd8bb9830b22ef42b4e7fc16c21cc 100644 (file)
@@ -16,7 +16,7 @@ Staff_column::OK() const
 }
 
 bool
-Staff_column::mus() const
+Staff_column::musical_b() const
 {
     return score_column_l_->musical_;
 }
@@ -38,10 +38,11 @@ Staff_column::add(Voice_element*ve)
     v_elts.push(ve);
 }
 
-Staff_column::Staff_column(Score_column *s_l)
+Staff_column::Staff_column(Score_column * cur)
+
 {
     tdescription_ =0;
-    score_column_l_ = s_l;
+  score_column_l_=cur;
     staff_commands_p_ = 0;
 }
 
diff --git a/src/stembeamreg.cc b/src/stembeamreg.cc
new file mode 100644 (file)
index 0000000..506bde3
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+  stembeamreg.cc -- part of LilyPond
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "stembeamreg.hh"
+#include "beam.hh"
+#include "stem.hh"
+#include "grouping.hh"
+#include "textspanner.hh"
+#include "complexwalker.hh"
+#include "complexstaff.hh"
+#include "debug.hh"
+
+Stem_beam_register::Stem_beam_register(Complex_walker*w)
+    :Request_register(w)
+{
+    do_post_move_process();
+    current_grouping = 0;
+    beam_p_ = 0;
+    set_dir(0);
+    start_req_l_ = 0;
+}
+
+bool
+Stem_beam_register::try_request(Request*req_l)
+{
+    if ( req_l->beam() ) {
+       if (bool(beam_p_ ) == bool(req_l->beam()->spantype == Span_req::START))
+           return false;
+       
+       if (beam_req_l_ && Beam_req::compare(*beam_req_l_ , *req_l->beam()))
+           return false;
+       
+       beam_req_l_ = req_l->beam();
+       return true;
+    }
+    
+    if ( req_l->stem() ) {
+       if (current_grouping && !current_grouping->child_fit_query(
+           walk_l_->col()->tdescription_->whole_in_measure))
+           return false;
+
+       if (stem_req_l_ && Stem_req::compare(*stem_req_l_, *req_l->stem()))
+           return false;
+
+       stem_req_l_ = req_l->stem();
+       return true;
+    }
+    return false;
+}
+
+void
+Stem_beam_register::process_request()
+{
+    if (beam_req_l_) {
+       if (beam_req_l_->spantype == Span_req::STOP) {
+           end_beam_b_ = true;
+           start_req_l_ = 0;
+       } else {
+           beam_p_ = new Beam;
+           start_req_l_ = beam_req_l_;
+
+           current_grouping = new Rhythmic_grouping;
+           if (beam_req_l_->nplet) {
+               Text_spanner* t = new Text_spanner();
+               t->set_support(beam_p_);
+               t->spec.align_i_ = 0;
+               t->spec.text_str_ = beam_req_l_->nplet;
+               typeset_element(t);
+           }
+            
+       }
+    }
+
+    if (stem_req_l_) {
+       stem_p_ = new Stem(4);
+       if (current_grouping)
+           current_grouping->add_child(
+               walk_l_->col()->tdescription_->whole_in_measure,
+               stem_req_l_->duration());
+
+       stem_p_->flag = stem_req_l_->balltype;
+
+       if (beam_p_) {
+           if (stem_req_l_->balltype<= 4)
+               warning( "stem doesn't fit in Beam",
+                        stem_req_l_->defined_ch_c_l_m);
+           else
+               beam_p_->add(stem_p_);
+           stem_p_->print_flag = false;
+       } else {
+           stem_p_->print_flag = true;
+       }
+       
+       announce_element(Staff_elem_info(stem_p_,
+                                                 stem_req_l_,  this));
+    }
+}
+
+void
+Stem_beam_register::acknowledge_element(Staff_elem_info info)
+{
+    if (!stem_p_)
+       return;
+
+    if (info.elem_p_->name() == String("Notehead") &&
+       stem_req_l_->duration() == info.req_l_->rhythmic()->duration())
+       
+       stem_p_->add((Notehead*)info.elem_p_);
+}
+
+void
+Stem_beam_register::do_pre_move_process()
+{
+    if (stem_p_) {
+       if (default_dir_i_)
+           stem_p_->dir = default_dir_i_;
+       
+       typeset_element(stem_p_);
+       stem_p_ = 0;
+    }
+    if (beam_p_ && end_beam_b_) {
+       walk_l_->default_grouping.extend(current_grouping->interval());
+       beam_p_->set_grouping(walk_l_->default_grouping, *current_grouping);
+       typeset_element(beam_p_);
+       delete current_grouping;
+       current_grouping = 0;
+       beam_p_ = 0;
+    }
+    end_beam_b_ = false;
+}
+void
+Stem_beam_register::do_post_move_process()
+{
+    stem_p_ = 0;
+    beam_req_l_ = 0;
+    stem_req_l_ = 0;
+    end_beam_b_ = false;
+}
+
+Stem_beam_register::~Stem_beam_register()
+{
+    if (beam_p_)
+       warning("unterminated beam", start_req_l_->defined_ch_c_l_m);
+}
+
+void
+Stem_beam_register::set_dir(int i)
+{
+    default_dir_i_ = i;
+}
index a3b38dde9ea1c96a19c95be52e809a52e0d98c5e..c9f3c954812171495e0b53087f68f7a62b90a731 100644 (file)
@@ -23,7 +23,7 @@ Lookup::beam_element(int sidx, int widx, Real slope)
     args.push(widx);
     bs.tex = substitute_args(bs.tex,args);
     int w = 2 << widx;
-    Real width = convert_dimen(w,"pt");
+    Real width = w PT;
     bs.dim.x = Interval(0,width);
     bs.dim.y = Interval(0,width*slope);
     return bs;
@@ -34,7 +34,7 @@ static int
 slope_index(Real &s)
 {
     if (abs(s) > 0.5) {
-       WARN << "beam steeper than 0.5\n";
+       WARN << "beam steeper than 0.5 (" << s << ")\n";
        s = sign(s) * 0.5;
     }
 
@@ -65,12 +65,12 @@ Lookup::beam(Real &slope, Real width)
 {        
     int sidx = slope_index(slope);
     if (!slope)
-       return rule_symbol(convert_dimen(2,"pt"), width);
-    if (width < convert_dimen(2,"pt")) {
-       WARN<<"Beam too narrow.\n";
-       width = convert_dimen(2,"pt");
+       return rule_symbol(2 PT, width);
+    if (width < 2 PT) {
+       WARN<<"Beam too narrow. (" << print_dimen(width) <<")\n";
+       width = 2 PT;
     }
-    Real elemwidth = convert_dimen(64,"pt");
+    Real elemwidth = 64 PT;
     int widx = 5;
 
     Molecule m;
index a3a29db4444f557bd4795c7adea80347bc0fbc6e..71cded95299cdebe83f02da7c43dadc746320640 100644 (file)
@@ -28,9 +28,11 @@ char direction_char(int y_sign)
 Symbol
 Lookup::half_slur_middlepart(Real &dx, int dir)
 {
-    if (dx >= convert_dimen(400,"pt")) // todo
-       error ("halfslur too large");
-    int    widx = int(floor(dx / 4.0));
+    if (dx >= 400 PT) {// todo
+       WARN<<"halfslur too large" <<print_dimen(dx)<< "shrinking (ugh)\n";
+       dx = 400 PT;
+    }
+    int widx = int(floor(dx / 4.0));
     dx = widx * 4.0;
     if (widx) widx --;
     else {
@@ -39,7 +41,7 @@ Lookup::half_slur_middlepart(Real &dx, int dir)
 
     Symbol s;
     
-    s.dim.y = Interval(min(0,0), max(0,0));
+    s.dim.y = Interval(min(0,0), max(0,0)); // todo
     s.dim.x = Interval(0,dx);
 
     String f =  String("\\hslurchar");
@@ -61,22 +63,23 @@ Lookup::half_slur_middlepart(Real &dx, int dir)
 Symbol
 Lookup::half_slur(int dy, Real &dx, int dir, int xpart)
 {
+    Real orig_dx = dx;
     if (!xpart)
        return half_slur_middlepart(dx, dir);
 
     int widx;
                
-    if (dx >= convert_dimen(96,"pt")) {
-       WARN << "Slur half too wide.";
-       dx =  convert_dimen(96,"pt");
+    if (dx >= 96 PT) {
+       WARN << "Slur half too wide." << print_dimen(orig_dx) << " shrinking (ugh)\n";
+       dx =  96 PT;
     }
-    
+
     widx = int(rint(dx/12.0));
     dx = widx*12.0;
     if (widx)
        widx --;
     else {
-       WARN <<  "slur too narrow\n";
+       WARN <<  "slur too narrow " << print_dimen(orig_dx)<<"\n";
     }
        
     Symbol s;
@@ -109,36 +112,36 @@ Lookup::half_slur(int dy, Real &dx, int dir, int xpart)
 
 Symbol
 Lookup::slur (int dy , Real &dx, int dir)
-{                              // ugh. assuming pt here.
-    assert(dx >=0);
+{
+    assert(dx >=0 && abs(dir) <= 1);
     int y_sign = sign(dy);
 
     bool large = dy > 16;
 
     if (y_sign) {
-       large |= dx>= convert_dimen(4*16, "pt");
+       large |= dx>= 4*16 PT;
     } else
-       large |= dx>= convert_dimen(4*54, "pt");
+       large |= dx>= 4*54 PT;
     
     if (large) {
        return big_slur(dy, dx, dir);
     }
-    
+    Real orig_dx = dx;
     int widx = int(floor(dx/4.0)); // slurs better too small..
     dx = 4.0 * widx;
     if (widx)
        widx --;
     else {
-       WARN <<  "slur too narrow\n";
+       WARN <<  "slur too narrow: " << print_dimen(orig_dx) << "\n";
     }
 
     int hidx = dy;
     if (hidx <0)
        hidx = -hidx;
     hidx --; 
-    if (hidx > 16)
-       error("slur to steep");
-    
+    if (hidx > 16) {
+       WARN<<"slur to steep: " << dy << " shrinking (ugh)\n";
+    }
     
     Symbol s;
     s.dim.x = Interval(0,dx);
@@ -152,8 +155,11 @@ Lookup::slur (int dy , Real &dx, int dir)
        if (dir < 0)
            idx += 128;
     } else {
-       if (dx >= convert_dimen(4*54, "pt"))
-           error("slur too wide");
+       if (dx >= 4*54 PT) {
+           WARN << "slur too wide: " << print_dimen(dx) <<
+               " shrinking (ugh)\n";
+           dx = 4*54 PT;
+       }
        idx = widx;
        if (dir < 0)
            idx += 54;          
@@ -172,7 +178,7 @@ Lookup::slur (int dy , Real &dx, int dir)
 Symbol
 Lookup::big_slur(int dy , Real &dx, int dir)
 {
-    assert(dx >= convert_dimen(24,"pt"));
+    assert(dx >= 24 PT);
     Real slur_extra =abs(dy)  /2.0 + 2; 
     int l_dy = int(Real (dy)/2 + slur_extra*dir);
     int r_dy =  dy - l_dy;
diff --git a/src/textreg.cc b/src/textreg.cc
new file mode 100644 (file)
index 0000000..309bf6f
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+  textreg.cc -- implement Text_register
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "textreg.hh"
+#include "textitem.hh"
+
+Text_register::Text_register(Complex_walker*w)
+    : Request_register(w)
+{
+    text_p_ = 0;
+    set_dir(0);
+}
+
+bool
+Text_register::try_request(Request*req_l)
+{
+    if (!req_l->text())
+       return false;
+    if (accepted_req_arr_.size() &&
+       Text_req::compare(*req_l->text(), *accepted_req_arr_[0]->text()))
+
+       return false;
+
+    accepted_req_arr_.push(req_l);
+    return true;
+}
+
+void
+Text_register::process_request()
+{
+    
+    if (accepted_req_arr_.size()) {
+       text_p_ = new Text_item(accepted_req_arr_[0]->text(), 10);
+       announce_element(Staff_elem_info(text_p_, accepted_req_arr_[0], this));
+    }
+}
+void
+Text_register::do_pre_move_process()
+{
+    if (text_p_) {
+       text_p_->dir_i_ = dir_i_;
+       typeset_element(text_p_);
+       text_p_ = 0;
+    }
+}
+void
+Text_register::set_dir(int i)
+{
+    dir_i_ = i;
+}
index 021b81fbbbb52ac9a2aebbcf770d79971e833cba..b6d90cbef4a5fd61b195e5881dc8091b229db46f 100644 (file)
@@ -3,6 +3,7 @@
 #include "textspanner.hh"
 #include "textdef.hh"
 #include "debug.hh"
+#include "paper.hh"
 
 NAME_METHOD(Text_spanner);
 
@@ -29,20 +30,20 @@ Text_spanner::do_post_processing()
 {
     switch(spec.align_i_) {
     case 0:
-       tpos = support->center();
+       text_off_ = support->center() +
+           Offset(0,support->dir_i_ * paper()->internote() * 4); // todo
        break;
     default:
        assert(false);
        break;
-    }
-    
-    
+    }    
 }
+
 Molecule*
 Text_spanner::brew_molecule_p() const
 {
     Atom tsym (spec.create_atom(paper()));
-    tsym.translate(tpos);
+    tsym.translate(text_off_);
 
     Molecule*output = new Molecule;
     output->add( tsym );
index 05e2e9c93e5839c24aed96aa2d221ff26abad767..d56c58a3c404e23cc07d2f228286a95a50d3b08d 100644 (file)
@@ -72,4 +72,4 @@ Tex_stream::operator<<(String s)
 }
 
 
-/****************************************************************/
+/* *************************************************************** */
index 2e7b0b5111351ebbecb1096595b0d0a0cbb09f53..8bccb12d8d1b8003408d9e303fef6c6a2a863200 100644 (file)
@@ -49,7 +49,7 @@ Voice::last() const
        l  += i->duration;
     return l;
 }
-/****************************************************************/
+/* *************************************************************** */
 void
 Voice_element::print() const
 {
index f3088d73e2604c2813d958c073aafe4378c06a3b..35de10df4f4713a514455e6889fdb4bdf774f34f 100644 (file)
@@ -1,76 +1,94 @@
 #include "request.hh"
-#include "complexwalker.hh"
-#include "complexstaff.hh"
 #include "voicegroup.hh"
 #include "register.hh"
+#include "textreg.hh"
+#include "stembeamreg.hh"
+#include "scriptreg.hh"
+#include "complexwalker.hh"
+
 
 static int temp_id_count;
 
 Voice_group_registers::Voice_group_registers(Complex_walker*w_l, String id)
-    : text_reg_(w_l),
-      stem_beam_reg_(w_l),
-      script_reg_(w_l)
 {
     walk_l_ = w_l;
+    text_reg_=new Text_register(w_l);
+    stem_beam_reg_= new Stem_beam_register(w_l);
+    script_reg_ = new Script_register(w_l);
     if (id=="")
        id = __FUNCTION__ + String(temp_id_count++);
     group_id_str_ = id;
     dir_i_ = 0;
 }
 
+Voice_group_registers::~Voice_group_registers()
+{
+    delete text_reg_;
+    delete stem_beam_reg_;
+    delete script_reg_;
+}
 void
 Voice_group_registers::pre_move_processing()
 {
-    stem_beam_reg_.pre_move_processing();
-    script_reg_.pre_move_processing();
-    text_reg_.pre_move_processing();  
+    stem_beam_reg_->pre_move_processing();
+    script_reg_->pre_move_processing();
+    text_reg_->pre_move_processing();  
 }
 
 void
 Voice_group_registers::post_move_processing()
 {
-    stem_beam_reg_.post_move_processing();
-    text_reg_.post_move_processing();
-    script_reg_.post_move_processing();
+    stem_beam_reg_->post_move_processing();
+    text_reg_->post_move_processing();
+    script_reg_->post_move_processing();
 }
 
 bool
 Voice_group_registers::try_request(Request*r_l)
 {
     if (r_l->groupfeature()) {
-       dir_i_ = r_l->groupfeature()->stemdir_i_;
+       set_dir(r_l->groupfeature()->stemdir_i_);
        return true;
     } 
-    bool b = stem_beam_reg_.try_request(r_l);
+    bool b = stem_beam_reg_->try_request(r_l);
     if (!b)
-       b|= script_reg_.try_request(r_l);
+       b|= script_reg_->try_request(r_l);
     if (!b)
-       b|=  text_reg_.try_request(r_l);
+       b|=  text_reg_->try_request(r_l);
 
     return b;
 }
     
 void
-Voice_group_registers::announce_element(Staff_elem_info i)
+Voice_group_registers::acknowledge_element(Staff_elem_info i)
 {
     if (i.group_regs_l_!= this)
        return;
        
-    stem_beam_reg_.acknowledge_element(i);
-    script_reg_.acknowledge_element(i);
-    text_reg_.acknowledge_element(i);
+    stem_beam_reg_->acknowledge_element(i);
+    script_reg_->acknowledge_element(i);
+    text_reg_->acknowledge_element(i);
 }
 
-
 void
-Voice_group_registers::process_requests()
+Voice_group_registers::set_dir(int i)
 {
-    stem_beam_reg_.process_request();
-    if (dir_i_)
-       stem_beam_reg_.set_dir (dir_i_);
+    stem_beam_reg_->set_dir(i);
+    script_reg_->set_dir(i);
+    text_reg_->set_dir(i);
     
-    script_reg_.process_request();
-    text_reg_.process_request();
+    Array<Voice_registers*> vr_arr (walk_l_->get_voice_regs(this));
+    for (int j=0; j<vr_arr.size(); j++) {
+       if (vr_arr[j])
+           vr_arr[j]->set_dir(i);
+}
+}
+void
+Voice_group_registers::process_requests()
+{
+    stem_beam_reg_->process_request();    
+    script_reg_->process_request();
+    text_reg_->process_request();
 }
 
 
index fa95ae9e18c943828269b6796e7a4bde346b9fde..f7d63bd76f8ba1194b9706d4487a40ff09a4b35e 100644 (file)
@@ -1,56 +1,56 @@
-#include "rest.hh"
-#include "notehead.hh"
-#include "paper.hh"
-#include "debug.hh"
-#include "slur.hh"
 #include "request.hh"
-#include "complexwalker.hh"
-#include "complexstaff.hh"
 #include "voicegroup.hh"
 #include "register.hh"
+#include "slurreg.hh"
+#include "headreg.hh"
 
 Voice_registers::Voice_registers(Complex_walker*c_l, Voice *v_p)
-    : head_reg_(c_l), slur_reg_(c_l)
 {
     voice_l_ = v_p;
+    head_reg_ = new Notehead_register(c_l);
+    slur_reg_ = new Slur_register(c_l);
+}
+Voice_registers::~Voice_registers()
+{
+    delete head_reg_;
+    delete slur_reg_;
 }
-
 bool
 Voice_registers::try_request(Request * r_l)
 {
-    bool b = head_reg_.try_request(r_l);
+    bool b = head_reg_->try_request(r_l);
     if (!b)
-       b = slur_reg_.try_request(r_l);
+       b = slur_reg_->try_request(r_l);
     return b;
 }
 
 void
-Voice_registers::announce_element(Staff_elem_info i)
+Voice_registers::acknowledge_element(Staff_elem_info i)
 {
     if (i.voice_l_ != voice_l_)
        return;
-    if (i.origin_reg_l_ != &slur_reg_)
-       slur_reg_.acknowledge_element(i);
+    if (i.origin_reg_l_ != slur_reg_)
+       slur_reg_->acknowledge_element(i);
 }
 
 void
 Voice_registers::pre_move_processing()
 {
-    head_reg_.pre_move_processing();
-    slur_reg_.pre_move_processing();
+    head_reg_->pre_move_processing();
+    slur_reg_->pre_move_processing();
 }
 void
 Voice_registers::post_move_processing()
 {
-    head_reg_.post_move_processing();
-    slur_reg_.post_move_processing();
+    head_reg_->post_move_processing();
+    slur_reg_->post_move_processing();
 }
 
 void
 Voice_registers::process_requests()
 {
-    head_reg_.process_request();
-    slur_reg_.process_request();
+    head_reg_->process_request();
+    slur_reg_->process_request();
 }
 
 bool
@@ -59,128 +59,10 @@ Voice_registers::acceptable_request(Request*r)
     return (r->rest() || r->note() || r->slur());
     
 }
-/****************/
-
-Notehead_register::Notehead_register(Complex_walker*w_l)
-    :Request_register(w_l)
-{
-    note_p_ = 0;
-}
-
-bool
-Notehead_register::try_request(Request *req_l) 
-{
-    if (req_l->note() || req_l->rest())
-       accepted_req_arr_.push(req_l);
-    else
-       return false;
-
-    return true;
-}
-
-void
-Notehead_register::process_request()
-{
-    if (!accepted_req_arr_.size())
-       return;
-    
-    Request* req_l = accepted_req_arr_.top();
-    if (req_l->note()) {
-       Notehead*n_p = new Notehead(8); // ugh
-       note_p_ = n_p;
-       n_p->set_rhythmic(req_l->rhythmic());
-       n_p->position = req_l->note()->height() + -2;
-    } else {
-       note_p_ = new Rest ( req_l->rhythmic()->balltype,
-                            req_l->rhythmic()->dots);
-       if (req_l->rhythmic()->balltype <= 2)
-           note_p_->translate(
-               Offset(0,
-                      6 * walk_l_->staff()->paper()->internote()));
-    }
-    Staff_elem_info itinf(note_p_,req_l,this);
-    walk_l_->announce_element(itinf);
-}
-
-void
-Notehead_register::do_pre_move_process()
-{
-    if (note_p_) {
-       walk_l_->typeset_element(note_p_);
-       note_p_ = 0;
-    }
-}
-
-/****************/
-
-Slur_register::Slur_register(Complex_walker* w)
-    : Request_register(w)
-{
-}
-
-bool
-Slur_register::try_request(Request *req_l)
-{
-    if(!req_l->slur())
-       return false;
-
-    accepted_req_arr_.push(req_l);
-    return true;
-}
 
 void
-Slur_register::acknowledge_element(Staff_elem_info info)
-{
-    if (info.elem_p_->name() == String("Notehead")) { 
-       Notehead *head_p =(Notehead*) info.elem_p_ ;// ugh
-       for (int i = 0; i < slur_l_stack_.size(); i++)
-           slur_l_stack_[i]->add(head_p );
-       for (int i = 0; i < end_slur_l_arr_.size(); i++)
-           end_slur_l_arr_[i]->add(head_p);
-    }
-}
-/*
-  abracadabra
-  */
-void
-Slur_register::process_request()
-{
-    Array<Slur*> start_slur_l_arr_;
-    for (int i=0; i< accepted_req_arr_.size(); i++) {
-       Slur_req* slur_req_l = accepted_req_arr_[i]->slur();
-       // end slur: move the slur to other array
-       if (slur_req_l->spantype == Span_req::STOP) {
-           if (slur_l_stack_.empty())
-               warning("can't find slur to end",
-                     slur_req_l->defined_ch_c_l_m);
-           else {
-               end_slur_l_arr_.push(slur_l_stack_.pop());
-               requests_arr_.pop();
-           }
-       } else  if (slur_req_l->spantype == Span_req::START) {
-           // push a new slur onto stack.
-           //(use temp. array to wait for all slur STOPs)
-           Slur * s_p =new Slur;
-           requests_arr_.push(slur_req_l);
-           start_slur_l_arr_.push(s_p);
-           walk_l_->announce_element(Staff_elem_info(s_p, slur_req_l, this));
-       }
-    }
-    for (int i=0; i < start_slur_l_arr_.size(); i++)
-       slur_l_stack_.push(start_slur_l_arr_[i]);
-}
-
-void
-Slur_register::do_pre_move_process()
-{
-    for (int i = 0; i < end_slur_l_arr_.size(); i++)
-       walk_l_->typeset_element(end_slur_l_arr_[i]);
-    end_slur_l_arr_.set_size(0);
-}
-
-Slur_register::~Slur_register()
+Voice_registers::set_dir(int i)
 {
-    for (int i=0; i < requests_arr_.size(); i++) {
-       warning("unterminated slur", requests_arr_[i]->defined_ch_c_l_m);
-    }
+    head_reg_->set_dir(i);
+    slur_reg_->set_dir(i);
 }
index 469d2d1d293205919a0ce4b9b9020c37a4c0083a..90d4d542dc7504ab23a8efa956d61c42cd210353 100644 (file)
@@ -2,13 +2,12 @@
 #include "pscore.hh"
 #include "debug.hh"
 
-/* el stupido. This should be done more accurately:
+/** el stupido. This should be done more accurately:
 
    It would be nice to have a Dynamic Programming type of algorithm
    similar to TeX's
    
     */
-
 Array<Col_hpositions>
 Word_wrap::solve()
 {
@@ -64,7 +63,8 @@ Word_wrap::solve()
            curcol ++;
            break_idx_i++;
        }
-       mtor << "Adding cols~, next breakpoint " << break_idx_i << '\n';
+
+       *mlog << "[" <<break_idx_i<<"]"<<flush;
        breaking.push(minimum);
     }