summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/CodingStyle44
-rw-r--r--Documentation/Makefile3
-rw-r--r--Documentation/breaking38
-rw-r--r--Make.variables71
-rw-r--r--Makefile80
-rw-r--r--README31
-rw-r--r--Sources.make19
-rw-r--r--flower/Makefile6
-rw-r--r--flower/README4
-rw-r--r--flower/TODO2
-rw-r--r--flower/dstream.cc5
-rw-r--r--flower/list.cc40
-rw-r--r--flower/list.hh18
-rw-r--r--flower/list.inl7
-rw-r--r--flower/pcursor.hh7
-rw-r--r--flower/plist.hh4
-rw-r--r--hdr/Makefile8
-rw-r--r--hdr/bar.hh18
-rw-r--r--hdr/beam.hh44
-rw-r--r--hdr/boxes.hh (renamed from boxes.hh)5
-rw-r--r--hdr/command.hh (renamed from command.hh)11
-rw-r--r--hdr/const.hh (renamed from const.hh)0
-rw-r--r--hdr/debug.hh (renamed from debug.hh)0
-rw-r--r--hdr/dimen.hh (renamed from dimen.hh)0
-rw-r--r--hdr/glob.hh (renamed from glob.hh)0
-rw-r--r--hdr/globvars.hh (renamed from globvars.hh)0
-rw-r--r--hdr/identifier.hh (renamed from identifier.hh)0
-rw-r--r--hdr/item.hh (renamed from item.hh)21
-rw-r--r--hdr/keyword.hh (renamed from keyword.hh)0
-rw-r--r--hdr/leastsquares.hh19
-rw-r--r--hdr/lexer.hh (renamed from lexer.hh)3
-rw-r--r--hdr/linespace.hh (renamed from linespace.hh)6
-rw-r--r--hdr/linestaff.hh (renamed from linestaff.hh)0
-rw-r--r--hdr/lookup.hh (renamed from lookupsyms.hh)8
-rw-r--r--hdr/main.hh (renamed from main.hh)0
-rw-r--r--hdr/melodicstaff.hh27
-rw-r--r--hdr/meter.hh18
-rw-r--r--hdr/misc.hh (renamed from misc.hh)0
-rw-r--r--hdr/molecule.hh (renamed from molecule.hh)0
-rw-r--r--hdr/notehead.hh (renamed from notehead.hh)0
-rw-r--r--hdr/notename.hh (renamed from notename.hh)0
-rw-r--r--hdr/paper.hh (renamed from paper.hh)10
-rw-r--r--hdr/parseconstruct.hh (renamed from parseconstruct.hh)9
-rw-r--r--hdr/pcol.hh (renamed from pcol.hh)2
-rw-r--r--hdr/proto.hh (renamed from proto.hh)5
-rw-r--r--hdr/pscore.hh (renamed from pscore.hh)20
-rw-r--r--hdr/pstaff.hh (renamed from pstaff.hh)0
-rw-r--r--hdr/qlp.hh (renamed from qlp.hh)0
-rw-r--r--hdr/qlpsolve.hh (renamed from qlpsolve.hh)0
-rw-r--r--hdr/request.hh (renamed from request.hh)82
-rw-r--r--hdr/rest.hh33
-rw-r--r--hdr/rhythmstaff.hh27
-rw-r--r--hdr/sccol.hh (renamed from sccol.hh)10
-rw-r--r--hdr/scommands.hh (renamed from scommands.hh)8
-rw-r--r--hdr/score.hh (renamed from score.hh)0
-rw-r--r--hdr/scoreline.hh (renamed from line.hh)28
-rw-r--r--hdr/simplestaff.hh (renamed from simplestaff.hh)42
-rw-r--r--hdr/spanner.hh (renamed from spanner.hh)28
-rw-r--r--hdr/staff.hh (renamed from staff.hh)2
-rw-r--r--hdr/staffline.hh29
-rw-r--r--hdr/stcol.hh (renamed from stcol.hh)9
-rw-r--r--hdr/stem.hh (renamed from stem.hh)34
-rw-r--r--hdr/swalker.hh34
-rw-r--r--hdr/symbol.hh (renamed from symbol.hh)0
-rw-r--r--hdr/symtable.hh (renamed from symtable.hh)0
-rw-r--r--hdr/tex.hh (renamed from tex.hh)0
-rw-r--r--hdr/tstream.hh (renamed from tstream.hh)0
-rw-r--r--hdr/voice.hh (renamed from voice.hh)0
-rw-r--r--item.cc52
-rw-r--r--kortjakje.ly40
-rw-r--r--lilyponddefs.tex20
-rw-r--r--maartje.ly15
-rwxr-xr-xmake_patch9
-rw-r--r--melodicstaff.cc78
-rw-r--r--melodicstaff.hh32
-rw-r--r--objects/Makefile2
-rw-r--r--rhythmstaff.cc76
-rw-r--r--rhythmstaff.hh36
-rw-r--r--simpleprint.cc75
-rw-r--r--simplestaff.cc91
-rw-r--r--spanner.cc33
-rw-r--r--src/Makefile8
-rw-r--r--src/bar.cc18
-rw-r--r--src/beam.cc179
-rw-r--r--src/boxes.cc (renamed from boxes.cc)0
-rw-r--r--src/break.cc (renamed from break.cc)19
-rw-r--r--src/calcideal.cc (renamed from calcideal.cc)0
-rw-r--r--src/command.cc (renamed from command.cc)0
-rw-r--r--src/debug.cc (renamed from debug.cc)0
-rw-r--r--src/dimen.cc (renamed from dimen.cc)0
-rw-r--r--src/getcommands.cc (renamed from getcommands.cc)0
-rw-r--r--src/identifier.cc (renamed from identifier.cc)2
-rw-r--r--src/item.cc73
-rw-r--r--src/keyword.cc (renamed from keyword.cc)0
-rw-r--r--src/leastsquares.cc25
-rw-r--r--src/lexer.l (renamed from lexer.l)47
-rw-r--r--src/linespace.cc (renamed from linespace.cc)21
-rw-r--r--src/linestaff.cc (renamed from linestaff.cc)2
-rw-r--r--src/lookup.cc (renamed from lookupsyms.cc)2
-rw-r--r--src/main.cc (renamed from main.cc)15
-rw-r--r--src/melodicstaff.cc59
-rw-r--r--src/meter.cc20
-rw-r--r--src/misc.cc (renamed from misc.cc)0
-rw-r--r--src/molecule.cc (renamed from molecule.cc)21
-rw-r--r--src/note.cc (renamed from note.cc)81
-rw-r--r--src/notehead.cc (renamed from notehead.cc)6
-rw-r--r--src/notename.cc (renamed from notename.cc)0
-rw-r--r--src/paper.cc (renamed from paper.cc)10
-rw-r--r--src/parser.y (renamed from parser.y)75
-rw-r--r--src/pcol.cc (renamed from pcol.cc)3
-rw-r--r--src/pscore.cc (renamed from pscore.cc)51
-rw-r--r--src/pstaff.cc (renamed from pstaff.cc)0
-rw-r--r--src/qlp.cc (renamed from qlp.cc)0
-rw-r--r--src/qlpsolve.cc (renamed from qlpsolve.cc)0
-rw-r--r--src/request.cc (renamed from request.cc)28
-rw-r--r--src/rest.cc47
-rw-r--r--src/rhythmstaff.cc62
-rw-r--r--src/sccol.cc (renamed from sccol.cc)0
-rw-r--r--src/scommands.cc (renamed from scommands.cc)17
-rw-r--r--src/score.cc (renamed from score.cc)0
-rw-r--r--src/scoreline.cc43
-rw-r--r--src/scores.cc (renamed from scores.cc)0
-rw-r--r--src/simpleprint.cc55
-rw-r--r--src/simplestaff.cc66
-rw-r--r--src/simplewalker.cc106
-rw-r--r--src/spanner.cc54
-rw-r--r--src/staff.cc (renamed from staff.cc)7
-rw-r--r--src/staffline.cc (renamed from line.cc)60
-rw-r--r--src/stcol.cc (renamed from stcol.cc)0
-rw-r--r--src/stem.cc156
-rw-r--r--src/swalker.cc32
-rw-r--r--src/symbol.cc (renamed from symbol.cc)0
-rw-r--r--src/symtable.cc (renamed from symtable.cc)4
-rw-r--r--src/table.cc (renamed from table.cc)3
-rw-r--r--src/template1.cc (renamed from template1.cc)4
-rw-r--r--src/template2.cc (renamed from template2.cc)2
-rw-r--r--src/template3.cc (renamed from template3.cc)0
-rw-r--r--src/tex.cc (renamed from tex.cc)0
-rw-r--r--src/texbeam.cc99
-rw-r--r--src/tstream.cc (renamed from tstream.cc)0
-rw-r--r--src/version.cc (renamed from version.cc)0
-rw-r--r--src/voice.cc (renamed from voice.cc)1
-rw-r--r--src/warn.cc (renamed from warn.cc)0
-rw-r--r--stem.cc99
-rw-r--r--suzan.ly8
-rw-r--r--symbol.ini15
146 files changed, 2284 insertions, 959 deletions
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index c5d730c0a6..2c621ee06c 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -1,3 +1,5 @@
+-*-text-*-
+
CODING STANDARDS:
Functions and methods do not return errorcodes, but use assert for
@@ -19,14 +21,15 @@ INDENTATION, in emacs:
CLASSES and TYPES:
This_is_a_class
+ AClass_name (for Abbreviation_class_name)
DATA MEMBERS
- Class:member
+ Class::member
-if the member's name resembles its type, then we use
+if the member's name resembles its type, then I use
- Class Fubular { ..}
+ class Fubular { ..}
Class::fubular_
@@ -52,4 +55,37 @@ class Class {
Class documentation.
*/
-Unfortunately most of the code isn't really documented that good. \ No newline at end of file
+Unfortunately most of the code isn't really documented that good.
+
+CLASSNAMES (2)
+
+A lot of classes in LilyPond start with 'P', this is to distinguish
+certain parts of LilyPond: the P stands for Printer, and the P-classes
+are supposed to be more lowlevel than the others. Example:
+
+ Staff uses PStaff, PScore and PCol to do the typesetting of
+symbols. Staff is are the "brains" for PStaff
+
+NB: in PCursor (which is part of the library) P stands for PointerCursor
+
+
+MEMBERS(2)
+
+Standard methods:
+
+ ///check that *this satisfies its invariants, abort if not.
+ void OK() const
+
+ /// print *this (and substructures) to debugging log
+ void print() const
+
+ /// add some data to *this;
+ add( .. )
+ /**
+ Presence of these methods usually imply that it is not feasible to this
+ via a constructor
+ */
+
+ /// replace some data of *this
+ set( .. )
+
diff --git a/Documentation/Makefile b/Documentation/Makefile
index da2847045e..e8adae90d7 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -1,4 +1,5 @@
-DOCFILES=CodingStyle algorithms Makefile
+DOCFILES=CodingStyle algorithms Makefile breaking
+
dist:
ln $(DOCFILES) $(DDIR)/Documentation/ \ No newline at end of file
diff --git a/Documentation/breaking b/Documentation/breaking
new file mode 100644
index 0000000000..ea1ada7e10
--- /dev/null
+++ b/Documentation/breaking
@@ -0,0 +1,38 @@
+[Source files: command.hh, scommands.cc]
+
+BREAKING, PREBREAK POSTBREAK, etc.
+
+So what's the deal with PREBREAK and POSTBREAK and all this
+stuff?
+
+Let's take text as an example. In German some compound
+words change their spelling if they are broken: "backen" becomes
+"bak-ken". TeX has a mechanism to deal with this, you would define
+the spelling of "backen" in TeX in this way
+
+ \discretionary{bak-}{ken}{backen}
+
+These 3 arguments are called "prebreak", "postbreak" and "nobreak"
+text.
+
+The same problem exists when typesetting music. If a line of music is
+broken, the next line usually gets a clef. So in TeX terms, the clef
+is a postbreak. The same thing happens with meter signs: Normally the
+meter follows the bar. If a line is broken at that bar, the bar along
+with the meter stays on the "last" line, but the next line also gets a
+meter sign after the clef. Using the previous notation,
+
+ \discretionary{bar meter}{clef meter}{ bar meter }
+
+In Lilypond, we have the same concepts (and the same
+terminology). Each (nonrhythmic) symbol is typeset using a Command
+(code: TYPESET). At a breakpoint, TYPESET commands can be grouped
+using separators (in lower case):
+
+ BREAK_PRE, typeset(bar), typeset(meter),
+ BREAK_MID, typeset(bar), typeset(meter),
+ BREAK_POST, typeset(clef), typeset(meter), BREAK_END
+
+The BREAK command sequence is terminated with BREAK_END, so other
+commands (like INTERPRET) may follow this sequence.
+
diff --git a/Make.variables b/Make.variables
new file mode 100644
index 0000000000..3d83d00ba7
--- /dev/null
+++ b/Make.variables
@@ -0,0 +1,71 @@
+####
+#### USER CONFIGURABLE
+####
+
+# speedy
+#DEFINES=-DNDEBUG -DNPRINT -O2
+
+# lots of debugging info
+DEFINES=-g
+
+# turn off -pipe if linker doesn't support it
+EXTRACXXFLAGS=-pipe -Wall -W -pedantic
+
+####
+#### EN USER CONFIGURABLE part.
+####
+
+# version info
+MAJVER=0
+MINVER=0
+PATCHLEVEL=9
+VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL)
+
+# directories
+TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
+OBJECTDIR=objects
+HEADERDIR=hdr
+CCDIR=src
+
+vpath %.cc $(CCDIR)
+vpath %.hh $(HEADERDIR)
+vpath %.y $(CCDIR)
+vpath %.l $(CCDIR)
+vpath %.o $(OBJECTDIR)
+
+#
+#
+include Sources.make
+progdocs=$(hdr) $(mycc)
+gencc=parser.cc lexer.cc
+cc=$(mycc) $(gencc)
+obs=$(cc:.cc=.o)
+
+
+#dist
+.EXPORT_ALL_VARIABLES:
+
+DOCDIR=docdir
+
+PACKAGENAME=lilypond
+DNAME=$(PACKAGENAME)-$(VERSION)
+
+# distribution files.
+othersrc=lexer.l parser.y
+SCRIPTS=make_version make_patch genheader
+IFILES=dimen.tex symbol.ini kortjakje.ly maartje.ly\
+ lilyponddefs.tex test.tex .dstreamrc
+OFILES=Makefile Make.variables Sources.make COPYING README
+DFILES=$(OFILES) $(IFILES) $(SCRIPTS)
+
+#compiling
+LOADLIBES=-L$(FLOWERDIR) -lflower
+FLOWERDIR=../flower
+
+CXXFLAGS=$(DEFINES) -I$(HEADERDIR) -I$(FLOWERDIR) $(EXTRACXXFLAGS)
+FLEX=flex
+BISON=bison
+exe=$(PACKAGENAME)
+OUTPUT_OPTION=$< -o $@
+DDIR=$(TOPDIR)/$(DNAME)
+SUBDIRS=Documentation $(OBJECTDIR) $(CCDIR) $(HEADERDIR)
diff --git a/Makefile b/Makefile
index 2d8fa8a3ca..8f05ad90f8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,55 +1,13 @@
-MAJVER=0
-MINVER=0
-PATCHLEVEL=8
-
-TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
-
-#
-#
-
-include Sources.make
-progdocs=$(hdr) $(mycc)
-gencc=parser.cc lexer.cc
-cc=$(mycc) $(gencc)
-obs=$(cc:.cc=.o)
-
-
-#dist
-.EXPORT_ALL_VARIABLES:
-
-DOCDIR=docdir
-VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL)
-PACKAGENAME=lilypond
-DNAME=$(PACKAGENAME)-$(VERSION)
-othersrc=lexer.l parser.y
-SCRIPTS=make_version make_patch genheader
-IFILES=dimen.tex symbol.ini suzan.ly maartje.ly\
- lilyponddefs.tex test.tex .dstreamrc
-OFILES=Makefile Sources.make COPYING README
-DFILES=$(hdr) $(mycc) $(othersrc) $(OFILES) $(IFILES) $(SCRIPTS)
-
-#compiling
-LOADLIBES=-L$(FLOWERDIR) -lflower
-FLOWERDIR=../flower
-# speedy
-#DEFINES=-DNDEBUG -DNPRINT -O2
-# lots of debugging info
-DEFINES=-g
-
-CXXFLAGS=$(DEFINES) -I$(FLOWERDIR) -pipe -Wall -W -pedantic
-FLEX=flex
-BISON=bison
-exe=$(PACKAGENAME)
-
-##################################################################
+include Make.variables
$(exe): $(obs)
- $(CXX) -o $@ $(obs) $(LOADLIBES)
+ $(CXX) -o $@ $^ $(LOADLIBES)
+
clean:
rm -f $(exe) *.o $(DOCDIR)/* core
distclean: clean
- rm -f TAGS depend version.hh $(gencc) .GENERATE *~
+ rm -f depend version.hh $(gencc) .GENERATE *~
all: kompijl doc
@@ -58,8 +16,13 @@ doc:
-mkdir $(DOCDIR)
doc++ -p -I -d $(DOCDIR) $(progdocs)
-depend: Sources.make .GENERATE
- $(CXX) $(CXXFLAGS) -MM $(cc) > $@
+depend: Sources.make .GENERATE
+ touch depend
+ $(MAKE) realdepend
+
+
+$(OBJECTDIR)/%.o: $(CCDIR)/%.cc
+ $(CXX) -c $(CXXFLAGS) $(OUTPUT_OPTION)
# hack to create these sources once, before the dependencies
.GENERATE:
@@ -68,25 +31,26 @@ depend: Sources.make .GENERATE
$(MAKE) $(gencc)
rm -f depend
+realdepend: $(cc)
+ $(CXX) $(CXXFLAGS) -MM $^ | perl -ne 's/^(.+)\.o/'$(OBJECTDIR)'\/\1.o/; print;' > depend
+
include depend
-parser.cc: parser.y
+$(CCDIR)/parser.cc: parser.y
$(BISON) -d $<
- mv parser.tab.h parser.hh
- mv parser.tab.c parser.cc
+ mv $(CCDIR)/parser.tab.h $(HEADERDIR)/parser.hh
+ mv $(CCDIR)/parser.tab.c $(CCDIR)/parser.cc
parser.hh: parser.cc
version.o: $(obs) version.hh
version.hh: Makefile make_version
- make_version $(MAJVER) $(MINVER) $(PATCHLEVEL) > $@
+ make_version $(MAJVER) $(MINVER) $(PATCHLEVEL) > $(HEADERDIR)/$@
-lexer.cc: lexer.l
+src/lexer.cc: lexer.l
$(FLEX) -+ -t $< > $@
-DDIR=$(TOPDIR)/$(DNAME)
-SUBDIRS=Documentation
dist:
-mkdir $(DDIR)
ln $(DFILES) $(DDIR)/
@@ -98,7 +62,7 @@ dist:
rm -rf $(DDIR)/
-TAGS: $(mycc) $(hdr) Sources.make
- etags -CT $(mycc) $(hdr)
-
+TAGS:
+ $(MAKE) -C $(HEADERDIR) TAGS
+ $(MAKE) -C $(CCDIR) TAGS \ No newline at end of file
diff --git a/README b/README
index fd1c616b3a..cfee5ea3c9 100644
--- a/README
+++ b/README
@@ -6,7 +6,11 @@ This is a beta version of LilyPond (a music typesetter). This release is
preliminary, please do not distribute. Please send your helpful comments and
patches to me,
- hanwen@stack.urc.tue.nl
+ hanwen@stack.urc.tue.nl
+
+LilyPond is updated very frequently, the latest version is always available at:
+
+ ftp://pcnov095.win.tue.nl/pub/lilypond
PREREQUISITES
@@ -18,6 +22,14 @@ COMPILING
You will need GNU C++ v2.7 or better and GNU make. If you actually
want to use this, you'd better use the "speedy" compilation flags in
the Makefile.
+Do:
+
+ tar zxf flower-1.11.9.tar.gz
+ mv flower-1.11.9 flower
+ cd flower; make; cd ..
+ tar zxf lilypond-1.2.13.tar.gz
+ cd lilypond-1.2.13
+ make
why G++ >= 2.7? LilyPond & flower lib uses builtin bool and typeof.
@@ -32,20 +44,22 @@ what I type in my xterm:
This is what the output looks like over here.
-hw:~/musix/spacer$ lilypond maartje.ly
-LilyPond version 0.0.6 compiled on Nov 2 1996 at 01:25:29
-Parsing ... [maartje.ly]
+hw:~/musix/spacer$ lilypond kortjakje.ly
+LilyPond version 0.0.9 compiled on Nov 7 1996 at 23:38:21
+Parsing ... [kortjakje.ly]
+Processing ... Calculating ...
output to lelie.uit...
+
hw:~/musix/spacer$ tex test
This is TeX, Version 3.14159 (C version 6.1)
(test.tex
Hyphenation patterns for english, dutch, loaded.
(lilyponddefs.tex) (lelie.uit) [1] )
-Output written on test.dvi (1 page, 1964 bytes).
+Output written on test.dvi (1 page, 3076 bytes).
Transcript written on test.log.
+
hw:~/musix/spacer$ xdvi test&
-[1] 3130
-hw:~/musix/spacer$
+[1] 1667
PROBLEMS
@@ -59,7 +73,8 @@ HOW DOES IT WORK
* Use The Source, Luke. If you don't know C++, you can try editing
.dstreamrc for copious debugging output.
-* see also the subdir Documentation
+* also the subdir Documentation/ it contains some in depth matter
+on LilyPond algorithms
* The source is commented in the DOC++ style.
Check out doc++ at
diff --git a/Sources.make b/Sources.make
index 6e860c07d4..2894394f94 100644
--- a/Sources.make
+++ b/Sources.make
@@ -2,29 +2,32 @@
# sourcefiles to be shipped. Also for dependencies
hdr= qlp.hh linespace.hh qlpsolve.hh\
- pcol.hh proto.hh pstaff.hh line.hh\
+ pcol.hh proto.hh pstaff.hh scoreline.hh staffline.hh\
const.hh glob.hh molecule.hh boxes.hh pscore.hh item.hh tex.hh\
request.hh voice.hh command.hh staff.hh linestaff.hh \
tstream.hh rhythmstaff.hh\
parseconstruct.hh debug.hh globvars.hh keyword.hh\
misc.hh score.hh notename.hh lexer.hh symtable.hh\
- symbol.hh main.hh dimen.hh paper.hh lookupsyms.hh\
+ symbol.hh main.hh dimen.hh paper.hh lookup.hh\
sccol.hh stcol.hh scommands.hh melodicstaff.hh\
identifier.hh simplestaff.hh spanner.hh stem.hh\
- notehead.hh
+ notehead.hh leastsquares.hh beam.hh rest.hh\
+ swalker.hh bar.hh meter.hh
mycc= qlp.cc qlpsolve.cc \
- break.cc linespace.cc molecule.cc line.cc\
- pscore.cc tex.cc item.cc pcol.cc staff.cc rhythmstaff.cc\
- score.cc note.cc main.cc misc.cc \
+ break.cc linespace.cc molecule.cc staffline.cc\
+ pscore.cc tex.cc item.cc pcol.cc staff.cc \
+ rhythmstaff.cc score.cc note.cc main.cc misc.cc\
symbol.cc request.cc notename.cc voice.cc\
keyword.cc linestaff.cc table.cc command.cc\
warn.cc debug.cc symtable.cc boxes.cc\
pstaff.cc tstream.cc\
calcideal.cc scores.cc identifier.cc \
- dimen.cc paper.cc lookupsyms.cc scommands.cc\
+ dimen.cc paper.cc lookup.cc scommands.cc\
sccol.cc stcol.cc getcommands.cc simplestaff.cc\
melodicstaff.cc simpleprint.cc stem.cc\
- spanner.cc notehead.cc\
+ spanner.cc notehead.cc leastsquares.cc beam.cc\
+ texbeam.cc rest.cc swalker.cc scoreline.cc\
+ simplewalker.cc bar.cc meter.cc\
template1.cc template2.cc template3.cc\
version.cc \ No newline at end of file
diff --git a/flower/Makefile b/flower/Makefile
index dffea2fb37..b39b1f213d 100644
--- a/flower/Makefile
+++ b/flower/Makefile
@@ -1,6 +1,6 @@
MAJVER=1
MINVER=0
-PATCHLEVEL=8
+PATCHLEVEL=10
PACKAGENAME=flower
VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL)
@@ -13,6 +13,7 @@ include Sources.make
obs=$(cc:.cc=.o)
staticlib=libflower.a
+
$(staticlib): $(obs)
$(AR) cr libflower.a $(obs)
@@ -24,8 +25,10 @@ depend: Sources.make
clean:
rm -f $(obs) $(staticlib)
+
realclean: clean
rm -f depend
+
DFILES=$(hh) $(cc) $(inl) $(templatecc) Makefile Sources.make TODO README
DDIR=$(DNAME)
@@ -34,6 +37,7 @@ dist:
ln $(DFILES) $(DDIR)/
tar cfz $(DNAME).tar.gz $(DDIR)/*
rm -rf $(DDIR)/
+
TAGS:
etags -CT $(inl) $(cc) $(hh)
diff --git a/flower/README b/flower/README
index d33c68f3df..6706447fcf 100644
--- a/flower/README
+++ b/flower/README
@@ -1,5 +1,7 @@
This library contains some general purpose routines which aren't
-standardised yet. It was written by:
+standardised libraries yet. It may be replaced by STL in time
+
+It was written by:
Han-Wen Nienhuys <hanwen@stack.nl>
diff --git a/flower/TODO b/flower/TODO
index ef0ab6bac6..9d4ade3bcd 100644
--- a/flower/TODO
+++ b/flower/TODO
@@ -1,7 +1,5 @@
* PCursor -> Pointer_cursor / PointerCursor ?
- * remove List::List(element)
-
* efficient copy cons for List
* extend Interval
diff --git a/flower/dstream.cc b/flower/dstream.cc
index 8540e734cf..6cfc62eb3d 100644
--- a/flower/dstream.cc
+++ b/flower/dstream.cc
@@ -114,7 +114,10 @@ Dstream::Dstream(ostream *r, const char * cfg_nm )
Text_db cfg(fn);
while (! cfg.eof()){
Text_record r( cfg++);
- assert(r.sz() == 2);
+ if (r.sz() != 2) {
+ r.message("not enough fields in Dstream init.");
+ continue;
+ }
(*silent)[r[0]] = r[1].to_bool();
}
diff --git a/flower/list.cc b/flower/list.cc
index ce5e366cc8..55e1e20507 100644
--- a/flower/list.cc
+++ b/flower/list.cc
@@ -36,7 +36,6 @@ List<T>::OK() const
template<class T>
-inline
List<T>::~List()
{
Cursor<T> next(*this);
@@ -48,14 +47,17 @@ List<T>::~List()
}
template<class T>
-inline void
-List<T>::add( const T& thing, Cursor<T> after_me )
+void
+List<T>::add( const T& thing, Cursor<T> &after_me )
{
if (!size_) { // not much choice if list is empty
bottom_ = top_ = new Link<T>( thing );
+ if (!after_me.ok())
+ after_me = bottom();
} else { // add at aprioprate place
- Link<T> *p = ( after_me.ok() ) ?
- after_me.pointer() : bottom().pointer();
+ if (!after_me.ok())
+ after_me = bottom();
+ Link<T> *p =after_me.pointer();
p->add(thing);
if (p == bottom_) // adjust bottom_ if necessary.
bottom_ = p->next();
@@ -75,23 +77,37 @@ List<T>::add( const T& thing, Cursor<T> after_me )
*/
template<class T>
-inline void
-List<T>::insert( const T& thing, Cursor<T> before_me )
+void
+List<T>::insert( const T& thing, Cursor<T> &before_me )
{
if (!size_) {
bottom_ = top_ = new Link<T>( thing );
+ if (!before_me.ok())
+ before_me = top();
+
} else {
- Link<T> *p =
- (before_me.ok())?
- before_me.pointer() : top().pointer();
+ if (!before_me.ok())
+ before_me = top();
+
+ Link<T> *p = before_me.pointer() ;
p->insert(thing);
if (p == top_)
top_ = p->previous();
}
-
- size_++;
+ size_++;
}
+
+template<class T>
+void
+List<T>::concatenate(List<T> const&s)
+{
+ Cursor<T> b(bottom());
+ for (Cursor<T> c(s); c.ok(); c++) {
+ b.add(c);
+ b++;
+ }
+}
#endif
diff --git a/flower/list.hh b/flower/list.hh
index 1516e16642..117e1862e4 100644
--- a/flower/list.hh
+++ b/flower/list.hh
@@ -1,5 +1,3 @@
-// list.hh
-
#ifndef __LIST_HH
#define __LIST_HH
@@ -7,7 +5,7 @@ class ostream;
template<class T> class Cursor;
template<class T> class Link;
-/// all purpose list
+/// all-purpose doubly linked list
template<class T>
class List
{
@@ -15,11 +13,7 @@ class List
List(List const&src);
/// construct empty list
- List();
-
- /// construct list from first item.
- List( const T& thing );
-
+ List();
virtual ~List();
Cursor<T> bottom();
@@ -30,6 +24,10 @@ class List
protected:
friend class Cursor<T>;
friend class Link<T>;
+
+ void concatenate(List<T> const &s);
+
+
/// make *this empty
void set_empty();
/**
@@ -37,10 +35,10 @@ class List
*/
/// add after after_me
- void add( const T& thing, Cursor<T> 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 insert( const T& thing, Cursor<T> &before_me );
virtual void remove( Cursor<T> me );
/**
Remove link pointed to by me.
diff --git a/flower/list.inl b/flower/list.inl
index d71e947050..c3ee7e2948 100644
--- a/flower/list.inl
+++ b/flower/list.inl
@@ -19,13 +19,6 @@ List<T>::set_empty()
}
template<class T>
-inline
-List<T>::List( const T& thing )
-{
- set_empty();
- add( thing, Cursor<T>( *this, bottom_ ) );
-}
-template<class T>
inline void
List<T>::remove( Cursor<T> me )
{
diff --git a/flower/pcursor.hh b/flower/pcursor.hh
index 5e535300d7..c9cc53411f 100644
--- a/flower/pcursor.hh
+++ b/flower/pcursor.hh
@@ -24,6 +24,7 @@ struct PCursor : public Cursor<void *> {
PCursor<T> operator +( int no) const {
return PCursor<T> (Cursor<void*>::operator+(no));
}
+
PCursor(const PointerList<T> & l) : Cursor<void*> (l) {}
PCursor( const Cursor<void*>& cursor ) : Cursor<void*>(cursor) { }
@@ -34,13 +35,17 @@ struct PCursor : public Cursor<void *> {
T operator ->() const { return ptr(); }
operator T() { return ptr(); }
T operator *() { return ptr(); }
+ void add(const T& p ) { Cursor<void*>::add((void*) p); }
+ void insert(const T& p ) { Cursor<void*>::insert((void*) p);}
private:
// Cursor<void*>::operator void*;
// sigh
};
/**
-don't create PointerList<void*>'s
+ don't create PointerList<void*>'s.
+ This cursor is just an interface class for Cursor. It takes care of the
+ appropriate type casts
*/
diff --git a/flower/plist.hh b/flower/plist.hh
index 78df40cb17..ea2c0ecdae 100644
--- a/flower/plist.hh
+++ b/flower/plist.hh
@@ -16,8 +16,8 @@ class PointerList : public List<void *>
public:
PCursor<T> top() { return PCursor<T> (List<void*>::top()); }
PCursor<T> bottom() { return PCursor<T> (List<void*>::bottom()); }
-
- PointerList( const T& thing ) : List<void*>( thing ) { }
+ void concatenate(PointerList<T> const &s) { List<void*>::concatenate(s); }
+// PointerList( const T& thing ) : List<void*>( thing ) { }
PointerList() {}
};
diff --git a/hdr/Makefile b/hdr/Makefile
new file mode 100644
index 0000000000..81a8f4595c
--- /dev/null
+++ b/hdr/Makefile
@@ -0,0 +1,8 @@
+default:
+ $(MAKE) -C ..
+
+dist:
+ ln Makefile $(hdr) $(DDIR)/$(HEADERDIR)
+
+TAGS: $(hdr)
+ etags -CT $(hdr)
diff --git a/hdr/bar.hh b/hdr/bar.hh
new file mode 100644
index 0000000000..187fadfe78
--- /dev/null
+++ b/hdr/bar.hh
@@ -0,0 +1,18 @@
+/*
+ bar.hh -- part of LilyPond
+
+ (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef BAR_HH
+#define BAR_HH
+#include "item.hh"
+
+struct Bar: Item {
+ String type;
+
+ Bar(String type);
+ void preprocess();
+};
+#endif // BAR_HH
+
diff --git a/hdr/beam.hh b/hdr/beam.hh
new file mode 100644
index 0000000000..4cbc2ea0c2
--- /dev/null
+++ b/hdr/beam.hh
@@ -0,0 +1,44 @@
+/*
+ beam.hh -- part of LilyPond
+
+ (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef BEAM_HH
+#define BEAM_HH
+#include "proto.hh"
+#include "spanner.hh"
+#include "list.hh"
+
+/// a beam connects multiple stems
+struct Beam: public Spanner {
+ List<Stem*> stems;
+ Real slope;
+ Real left_pos;
+ /// -1 below heads, +1 above heads.
+ int dir;
+
+ /****************/
+
+ virtual Interval width()const;
+
+ Spanner *broken_at(const PCol *, const PCol *) const;
+ Beam();
+ void add(Stem*);
+ void process();
+ void calculate();
+ void set_default_dir();
+ void preprocess();
+ Interval height()const;
+ void print() const;
+
+ void set_stemlens();
+private:
+ void solve_slope();
+ void brew_molecule();
+};
+/** Beam adjusts the stems its owns to make sure that they reach the
+ beam and that point in the correct direction */
+
+#endif // BEAM_HH
+
diff --git a/boxes.hh b/hdr/boxes.hh
index 5d0be85452..15beb8c372 100644
--- a/boxes.hh
+++ b/hdr/boxes.hh
@@ -59,6 +59,11 @@ struct Interval {
min =m;
max = M;
}
+ Interval &operator += (Real r) {
+ min += r;
+ max +=r;
+ return *this;
+ }
};
diff --git a/command.hh b/hdr/command.hh
index 3e90067075..e13669f46c 100644
--- a/command.hh
+++ b/hdr/command.hh
@@ -1,7 +1,7 @@
#ifndef COMMAND_HH
#define COMMAND_HH
-#include "glob.hh"
+#include "glob.hh"
#include "vray.hh"
#include "string.hh"
@@ -11,6 +11,7 @@ enum Commandcode {
TYPESET,
BREAK_PRE,BREAK_MIDDLE, BREAK_POST, BREAK_END
};
+
/// set a nonrythmical symbol
struct Command {
Commandcode code;
@@ -18,7 +19,11 @@ struct Command {
Real when;
/// analogous to argv[]
svec<String> args;
+
+ ///
int priority;
+ /** in what order relative to other TYPESET commands (eg, bar
+ should precede meter). Highest priority first. */
/****************/
@@ -53,7 +58,8 @@ struct Command {
they change the interpretation of other commands or requests.
example: shift output vertically, set the key.
\item[BREAK_XXX] These commands group TYPESET commands in
- prebreak and postbreak commands. \See{Col}.
+ prebreak and postbreak commands. See Documentation/breaking
+
Staff can insert additional commands in a sequence of BREAK_XXX
commands, eg. key change commands
@@ -73,6 +79,7 @@ struct Command {
Commands can be freely copied, they do not have virtual methods.
+
*/
diff --git a/const.hh b/hdr/const.hh
index dce593b4a0..dce593b4a0 100644
--- a/const.hh
+++ b/hdr/const.hh
diff --git a/debug.hh b/hdr/debug.hh
index fb3a070593..fb3a070593 100644
--- a/debug.hh
+++ b/hdr/debug.hh
diff --git a/dimen.hh b/hdr/dimen.hh
index 4ee17ea140..4ee17ea140 100644
--- a/dimen.hh
+++ b/hdr/dimen.hh
diff --git a/glob.hh b/hdr/glob.hh
index 7b8bb557d4..7b8bb557d4 100644
--- a/glob.hh
+++ b/hdr/glob.hh
diff --git a/globvars.hh b/hdr/globvars.hh
index 8b13789179..8b13789179 100644
--- a/globvars.hh
+++ b/hdr/globvars.hh
diff --git a/identifier.hh b/hdr/identifier.hh
index 9cb80386c0..9cb80386c0 100644
--- a/identifier.hh
+++ b/hdr/identifier.hh
diff --git a/item.hh b/hdr/item.hh
index b450ab59ea..33b60831c1 100644
--- a/item.hh
+++ b/hdr/item.hh
@@ -7,14 +7,24 @@
/// a horizontally fixed size element of the score
struct Item {
- const PCol * col;
- Molecule *output;
-
+ /// indirection to the column it is in
+ PCol * pcol_;
+
+ /// indirection to the pstaff it is in
PStaff *pstaff_;
- /** needed for knowing at which staff to output this item
- */
+
+ /// member: the symbols
+ Molecule *output;
+ ///
+ Offset offset_;
+ /**
+ This is needed, because #output# may still be
+ NULL.
+ */
/****************/
+
+ void translate(Offset);
/// do calculations after determining horizontal spacing
virtual void postprocess();
@@ -32,6 +42,7 @@ struct Item {
Item();
void print()const;
virtual ~Item();
+ Paperdef *paper() const;
};
/** Item is the datastructure for printables whose width is known
before the spacing is calculated
diff --git a/keyword.hh b/hdr/keyword.hh
index df4547ad76..df4547ad76 100644
--- a/keyword.hh
+++ b/hdr/keyword.hh
diff --git a/hdr/leastsquares.hh b/hdr/leastsquares.hh
new file mode 100644
index 0000000000..71586d8d5c
--- /dev/null
+++ b/hdr/leastsquares.hh
@@ -0,0 +1,19 @@
+/*
+ leastsquare.hh -- part of LilyPond
+
+ (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef LEASTSQUARE_HH
+#define LEASTSQUARE_HH
+#include "vray.hh"
+#include "boxes.hh"
+
+struct Least_squares {
+ svec<Offset> input;
+ void minimise(Real &coef, Real &offset);
+};
+
+
+#endif // LEASTSQUARE_HH
+
diff --git a/lexer.hh b/hdr/lexer.hh
index ec7c9b929f..e2537da410 100644
--- a/lexer.hh
+++ b/hdr/lexer.hh
@@ -6,11 +6,12 @@
void new_input(String s);
bool close_input();
int yylex();
-void yyerror(char *s);
+void yyerror(const char *s);
int lookup_keyword(String s);
Identifier* lookup_identifier(String s);
void add_identifier(Identifier*i);
void delete_identifiers();
+void kill_lexer();
#endif
diff --git a/linespace.hh b/hdr/linespace.hh
index b9d850c602..54704508e6 100644
--- a/linespace.hh
+++ b/hdr/linespace.hh
@@ -9,13 +9,13 @@
/// helper struct for #Spacing_problem#
struct Colinfo {
- const PCol *col;
+ const PCol *pcol_;
bool fixed;
Real fixpos;
Colinfo();
void print() const;
- Real minright()const { return col->width().max; }
- Real minleft()const { return -col->width().min; }
+ Real minright() const { return pcol_->width().max; }
+ Real minleft() const { return -pcol_->width().min; }
};
diff --git a/linestaff.hh b/hdr/linestaff.hh
index 891269dd9d..891269dd9d 100644
--- a/linestaff.hh
+++ b/hdr/linestaff.hh
diff --git a/lookupsyms.hh b/hdr/lookup.hh
index 1ec0d04d10..6bf89c0093 100644
--- a/lookupsyms.hh
+++ b/hdr/lookup.hh
@@ -15,13 +15,19 @@ struct Lookup {
Parametric_symbol *linestaff(int n);
Parametric_symbol *meter(String);
Parametric_symbol *stem();
+
+ 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 rule_symbol(Real height, Real width);
+
Symbol ball(int);
Symbol flag(int);
Symbol rest(int);
diff --git a/main.hh b/hdr/main.hh
index 58928f5142..58928f5142 100644
--- a/main.hh
+++ b/hdr/main.hh
diff --git a/hdr/melodicstaff.hh b/hdr/melodicstaff.hh
new file mode 100644
index 0000000000..b447102de6
--- /dev/null
+++ b/hdr/melodicstaff.hh
@@ -0,0 +1,27 @@
+/*
+ rhythmstaf.hh -- part of LilyPond
+
+ (c) 1996 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 void set_output(PScore *);
+ virtual Melodic_staff*clone()const;
+
+ virtual Stem * get_stem(Stem_req *rq);
+ virtual Notehead * get_notehead(Note_req *rq);
+};
+
+#endif // MELODICSTAFF_HH
+
+
diff --git a/hdr/meter.hh b/hdr/meter.hh
new file mode 100644
index 0000000000..6af8817265
--- /dev/null
+++ b/hdr/meter.hh
@@ -0,0 +1,18 @@
+/*
+ meter.hh -- part of LilyPond
+
+ (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef METER_HH
+#define METER_HH
+#include "item.hh"
+
+struct Meter: Item {
+ svec<String> args;
+
+ Meter(svec<String> args) ;
+ void preprocess();
+};
+#endif // METER_HH
+
diff --git a/misc.hh b/hdr/misc.hh
index 64c8ca4102..64c8ca4102 100644
--- a/misc.hh
+++ b/hdr/misc.hh
diff --git a/molecule.hh b/hdr/molecule.hh
index 0c69f74040..0c69f74040 100644
--- a/molecule.hh
+++ b/hdr/molecule.hh
diff --git a/notehead.hh b/hdr/notehead.hh
index b694e95af8..b694e95af8 100644
--- a/notehead.hh
+++ b/hdr/notehead.hh
diff --git a/notename.hh b/hdr/notename.hh
index ef04a0da7c..ef04a0da7c 100644
--- a/notename.hh
+++ b/hdr/notename.hh
diff --git a/paper.hh b/hdr/paper.hh
index ffe4f795a8..84932a36ab 100644
--- a/paper.hh
+++ b/hdr/paper.hh
@@ -2,14 +2,16 @@
#include "real.hh"
#include "string.hh"
+/// symbols, dimensions and constants
struct Paperdef {
Lookup *lookup_;
String outfile;
Real linewidth;
+
/// how much space does a whole note take (ideally?)
Real whole_width;
- // ideal = geometric_ ^ log2(duration)
+ /// ideal = geometric_ ^ log2(duration)
Real geometric_;
/****************/
@@ -17,9 +19,15 @@ struct Paperdef {
Paperdef();
~Paperdef();
Real interline()const;
+ Real rule_thickness()const;
Real standard_height()const;
Real note_width() const;
void print() const;
Real duration_to_dist(Real);
};
+/** 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
+ */
diff --git a/parseconstruct.hh b/hdr/parseconstruct.hh
index ea5c2fe55a..259303e1a8 100644
--- a/parseconstruct.hh
+++ b/hdr/parseconstruct.hh
@@ -1,6 +1,10 @@
-
#include "proto.hh"
+template<class T>
+struct svec;
+
+void set_default_duration(String);
+void set_default_pitch(String);
Staff * get_new_rhythmstaff();
Voice_element * get_note_element(String,String);
Voice_element* get_rest_element(String,String);
@@ -9,4 +13,5 @@ Staff * get_new_melodicstaff();
Command* get_meterchange_command( int,int);
Command* get_meter_command( Real,int,int);
Command* get_skip_command( int,Real);
-
+Request* get_request(char);
+void add_requests( Voice_element*v, svec<Request*>&req);
diff --git a/pcol.hh b/hdr/pcol.hh
index f28617190a..fa9516edb4 100644
--- a/pcol.hh
+++ b/hdr/pcol.hh
@@ -41,7 +41,7 @@ struct PCol {
/****************************************************************/
- void add(const Item*i);
+ void add(Item*i);
Interval width() const;
~PCol();
diff --git a/proto.hh b/hdr/proto.hh
index 268eda6b53..d674ca429a 100644
--- a/proto.hh
+++ b/hdr/proto.hh
@@ -85,6 +85,9 @@ class Parametric_symbol;
struct Lookup;
struct Symtables;
struct Symtable;
-
+struct Stem;
+struct Notehead;
+struct Beam;
+struct Rest;
#endif // PROTO_HH
diff --git a/pscore.hh b/hdr/pscore.hh
index 91436b369e..70e783c889 100644
--- a/pscore.hh
+++ b/hdr/pscore.hh
@@ -61,6 +61,10 @@ struct PScore {
void add(PStaff *);
/// add item
void typeset_item(Item *, PCol *,PStaff*,int=1);
+
+ /// add an Spanner
+ void typeset_spanner(Spanner*, PStaff*);
+
/// add to bottom of pcols
void add(PCol*);
/**
@@ -73,13 +77,23 @@ struct PScore {
get the spacing between c1 and c2, create one if necessary.
*/
-
+ /// return argument as a cursor.
PCursor<PCol *> find_col(PCol *);
+
+ /// delete unused columns
void clean_cols();
- void problem_OK()const ;
- void OK()const ;
+
+
+ /// check if the spacing/breaking problem is well-stated
+ void problem_OK() const;
+
+ /// invarinants
+ void OK()const;
PScore(Paperdef*);
void print() const;
+
+ /// does curline fit on the paper?
+ bool feasible(svec<const PCol *> curline) const;
};
/** notes, signs, symbols in a score can be grouped in two ways:
horizontally (staffwise), and vertically (columns). #PScore#
diff --git a/pstaff.hh b/hdr/pstaff.hh
index bf33c6b437..bf33c6b437 100644
--- a/pstaff.hh
+++ b/hdr/pstaff.hh
diff --git a/qlp.hh b/hdr/qlp.hh
index b539fe6b86..b539fe6b86 100644
--- a/qlp.hh
+++ b/hdr/qlp.hh
diff --git a/qlpsolve.hh b/hdr/qlpsolve.hh
index 4d29bcc4a0..4d29bcc4a0 100644
--- a/qlpsolve.hh
+++ b/hdr/qlpsolve.hh
diff --git a/request.hh b/hdr/request.hh
index 04664966b3..1911f20219 100644
--- a/request.hh
+++ b/hdr/request.hh
@@ -11,13 +11,15 @@ struct Request {
/****************/
+ Request();
+
virtual void print()const ;
virtual Note_req *note() {return 0;}
virtual Stem_req *stem() {return 0;}
virtual Rest_req *rest() {return 0;}
+ virtual Span_req *span() {return 0;}
+ virtual Beam_req *beam() { return 0 ; }
virtual Rhythmic_req*rhythmic() { return 0;}
- Request(Voice_element*);
- Request();
virtual Real duration() const { return 0.0; }
virtual Request* clone() const =0;
};
@@ -61,7 +63,7 @@ struct Rhythmic_req : Request {
/****************/
Real duration() const;
- Rhythmic_req(Voice_element*);
+ Rhythmic_req();
Rhythmic_req*rhythmic() { return this;}
void print ()const;
Request*clone() const;
@@ -78,7 +80,7 @@ struct Note_req : Rhythmic_req {
// return height from central c (in halflines)
int height()const;
- Note_req(Voice_element*v);
+ Note_req();
Note_req*note() { return this;}
virtual void print() const;
Request*clone() const;
@@ -96,8 +98,9 @@ based on ottava commands and the appropriate clef.
///Put a rest on the staff.
struct Rest_req : Rhythmic_req {
+
void print()const;
- Rest_req(Voice_element*v) : Rhythmic_req(v) { }
+
Rest_req * rest() { return this;}
Request*clone() const ;
};
@@ -109,11 +112,50 @@ Why a request? It might be a good idea to not typeset the rest, if the paper is
struct Stem_req : Request {
/// 4,8,16, ..
int stem_number;
+
virtual Stem_req *stem() {return this;}
- Stem_req(Voice_element*v, int s) : Request(v) { stem_number = s; }
+ Stem_req(int s) { stem_number = s; }
Request*clone() const;
};
+/// requests to start or stop something.
+struct Span_req : Request {
+ /// should the spanner start or stop, or is it unwanted?
+ enum {
+ NOSPAN, START, STOP
+ } spantype ;
+
+ Span_req*span() { return this; }
+ Span_req();
+ virtual Request*clone()const;
+};
+/**
+ This type of request typically results in the creation of a #Spanner#
+*/
+
+
+///Start / stop a beam at this note.
+struct Beam_req : Span_req {
+ int nplet;
+
+ /****************/
+
+ Beam_req();
+ virtual Beam_req * beam() { return this; }
+ virtual Request*clone()const;
+};
+/** Staff will have to combine this with the stem_request, since the
+ number of flags that a stem wants to carry will determine the
+ number of beams. if #nplet# is set, the staff will try to put an
+ appropriate number over the beam
+
+ */
+
+/// a slur
+struct Slur_req : Span_req {
+ virtual Request*clone()const;
+};
+
#if 0
@@ -151,29 +193,6 @@ enum Loudness {
FFF, FF, F, MF, MP, P, PP, PPP
} ;
-/// requests to start or stop something.
-struct Span_req : Request {
- /// should the spanner start or stop, or is it unwanted?
- enum {
- NOSPAN, START, STOP
- } spantype ;
-};
-/**
- This type of request typically results in the creation of a #Spanner#
-*/
-
-
-///Start / stop a beam at this note.
-struct Beam_req : Span_req {
- int nplet;
-};
-/** Staff will have to combine this with the stem_request, since the
- number of flags that a stem wants to carry will determine the
- number of beams. if #nplet# is set, the staff will try to put an
- appropriate number over the beam
-
- [what to do if the nplet fields of start and stop conflict?]
- */
///Start / stop a slur or a bracket.
struct Bracket_req : Span_req {
@@ -184,11 +203,6 @@ Start/stop a bracket at this note. if #nplet# is set, the staff will
try to put an appropriate number over the bracket
*/
-/// a slur
-struct Slur_req : Span_req {
-
-};
-
/// helper in the hierarchy
struct Dynamic {
Real subtime;
diff --git a/hdr/rest.hh b/hdr/rest.hh
new file mode 100644
index 0000000000..c5d0d7f995
--- /dev/null
+++ b/hdr/rest.hh
@@ -0,0 +1,33 @@
+/*
+ rest.hh -- part of LilyPond
+
+ (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef REST_HH
+#define REST_HH
+#include "item.hh"
+
+/// ball at the end of the stem
+struct Rest : public Item
+{
+ int dots;
+ int balltype;
+
+ /****************/
+
+ void preprocess();
+ Rest(int dur,int dots);
+ void print()const;
+private:
+ void brew_molecole();
+};
+/**
+ takes care of:
+
+ * help lines
+ * proper placing of dots
+
+ */
+#endif
+
diff --git a/hdr/rhythmstaff.hh b/hdr/rhythmstaff.hh
new file mode 100644
index 0000000000..46c35107d2
--- /dev/null
+++ b/hdr/rhythmstaff.hh
@@ -0,0 +1,27 @@
+/*
+ rhythmstaf.hh -- part of LilyPond
+
+ (c) 1996 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);
+ virtual void set_output(PScore *);
+ virtual Rhythmic_staff*clone()const;
+};
+
+#endif // RHYTHMSTAF_HH
+
+
diff --git a/sccol.hh b/hdr/sccol.hh
index 21a341d17f..f18b659e7e 100644
--- a/sccol.hh
+++ b/hdr/sccol.hh
@@ -10,16 +10,20 @@
struct Score_column {
+
+ /// indirection to column
PCol * pcol;
+ /// length of notes/rests in this column
svec<Real> durations;
+
Real when;
///
bool musical;
-
- Score_column(Real when);
-
+ /****************/
+
+ Score_column(Real when);
static int compare(Score_column & c1, Score_column &c2) {
return sgn(c1.when - c2.when);
}
diff --git a/scommands.hh b/hdr/scommands.hh
index 9106f2bfcc..ae908d7647 100644
--- a/scommands.hh
+++ b/hdr/scommands.hh
@@ -9,6 +9,7 @@
#include "vray.hh"
#include "plist.hh"
+/// the list of commands in Score
struct Score_commands : public PointerList<Command*> {
void process_add(Command);
Score_commands*parse(Real last)const;
@@ -27,7 +28,12 @@ struct Score_commands : public PointerList<Command*> {
PCursor<Command*> last);
};
/** the list of commands in Score. Put in a separate class, since it
- otherwise clutters the methods of Score. */
+ otherwise clutters the methods of Score.
+
+ This class serves two purposes: it stores the commands (via
+ parser_add()) in the yacc parser. at a later stage, some 'high
+ level' commands are converted (method: parse())
+ */
#endif
diff --git a/score.hh b/hdr/score.hh
index 176d7fa47a..176d7fa47a 100644
--- a/score.hh
+++ b/hdr/score.hh
diff --git a/line.hh b/hdr/scoreline.hh
index 641ddf257d..3da47d30dc 100644
--- a/line.hh
+++ b/hdr/scoreline.hh
@@ -1,17 +1,14 @@
-#ifndef LINE_HH
-#define LINE_HH
-
/*
- horizontal structures for broken scores.
+ scoreline.hh -- part of LilyPond
+
+ (c) 1996 Han-Wen Nienhuys
*/
-#include "real.hh"
+#ifndef SCORELINE_HH
+#define SCORELINE_HH
#include "plist.hh"
+#include "proto.hh"
#include "vray.hh"
-#include "glob.hh"
-#include "pstaff.hh"
-
-
/// the columns of a score that form one line.
struct
@@ -32,17 +29,4 @@ Line_of_score {
bool element(const PCol *c);
};
-/// one broken line of staff.
-struct Line_of_staff {
- PointerList<Spanner *> brokenspans;
- Line_of_score const * scor;
- const PStaff *pstaff_;
-
- /****************/
-
- String TeXstring() const;
- Line_of_staff(Line_of_score*, PStaff *);
- Interval height() const;
-};
-
#endif
diff --git a/simplestaff.hh b/hdr/simplestaff.hh
index c965765adb..c5c025a166 100644
--- a/simplestaff.hh
+++ b/hdr/simplestaff.hh
@@ -9,6 +9,7 @@
#include "stcol.hh"
#include "staff.hh"
+#include "swalker.hh"
/*
mega-stupido staffs and cols: they do notes one at each moment.
*/
@@ -18,44 +19,61 @@ struct Simple_staff;
/// column of Simple_staff: store one request
struct Simple_column : Staff_column {
- Request *the_note;
+ svec<Rhythmic_req *> notes;
Stem_req *stem_;
-
+ Beam_req *beam_;
Simple_staff* staff_;
/****************/
- virtual void typeset_stem(Stem_req *rq)=0;
- virtual void typeset_req(Request *rq)=0;
- virtual void typeset_command(Command *, int brs)=0;
+
virtual void typeset_item(Item *, int=1);
Molecule *create_command_mol(Command *com);
- Molecule *create_req_mol(Request *rq);
- void take_request(Request *rq);
-
- virtual void process_commands( );
+
+ void take_request(Request *rq);
virtual void process_requests();
Simple_column(Score_column*s,Simple_staff*rs);
};
-/// Simple staff: one note at a time
+/// Simple staff: one voicegroup at a time
struct Simple_staff : Staff {
/// indirection to the PStaff.
PStaff *theline;
/****************/
+ 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)=0;
+ virtual Rest *get_rest(Rest_req *rq);
virtual void set_output(PScore *);
void process_commands( PCursor<Command*> &where);
- void grant_requests();
-// virtual Staff*clone()const;
+ virtual void walk();
Simple_staff();
};
+struct Simple_walker: Staff_walker {
+ Stem *stem_;
+ svec<Notehead *>noteheads;
+ Beam *beam_;
+
+ /****************/
+
+ virtual void process_command(Command*);
+ virtual void process_requests();
+ Simple_walker(Simple_staff*);
+ Simple_column *col();
+ Simple_staff *staff();
+};
+
+
#endif // SIMPLESTAFF_HH
+
diff --git a/spanner.hh b/hdr/spanner.hh
index 1908d2f013..3940cebf60 100644
--- a/spanner.hh
+++ b/hdr/spanner.hh
@@ -10,20 +10,34 @@
/// a symbol which is attached between two columns.
struct Spanner {
- const PCol *left, *right;
- Parametric_symbol *strets;
+ PCol *left, *right;
PStaff * pstaff_;
+ Molecule *output ;
+
+ /****************/
+
+ String TeXstring () const ;
+ Spanner();
+ Paperdef*paper() const;
+
+ virtual Interval height()const=0;
+ /**
+ PRE:
+ processed
+ */
+ virtual Interval width()const;
+ virtual void process();
+ virtual void preprocess();
+
+
/// clone a piece of this spanner.
- virtual Spanner *broken_at(const PCol *c1, const PCol *c2) const;
+ virtual Spanner *broken_at(const PCol *c1, const PCol *c2) const=0;
/**
PRE
c1 >= start, c2 <= stop
*/
- /****************/
- String TeXstring () const ;
- Spanner();
- virtual void process();
+ virtual void print() const;
};
/** Spanner should know about the items which it should consider:
e.g. slurs should be steep enough to "enclose" all those items. This
diff --git a/staff.hh b/hdr/staff.hh
index f2c7294de0..ee95864fa9 100644
--- a/staff.hh
+++ b/hdr/staff.hh
@@ -57,7 +57,7 @@ struct Staff {
****************************************************************/
virtual Staff*clone()const=0;
virtual void set_output(PScore * destination)=0;
- virtual void grant_requests()=0;
+ virtual void walk()=0;
virtual Staff_column * create_col(Score_column * )=0;
virtual ~Staff() { }
};
diff --git a/hdr/staffline.hh b/hdr/staffline.hh
new file mode 100644
index 0000000000..a04078923c
--- /dev/null
+++ b/hdr/staffline.hh
@@ -0,0 +1,29 @@
+/*
+ staffline.hh -- horizontal structures for broken scores.
+
+ (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef STAFFLINE_HH
+#define STAFFLINE_HH
+
+#include "real.hh"
+#include "plist.hh"
+#include "vray.hh"
+#include "glob.hh"
+#include "pstaff.hh"
+
+/// one broken line of staff.
+struct Line_of_staff {
+ PointerList<Spanner *> brokenspans;
+ Line_of_score const * scor;
+ const PStaff *pstaff_;
+
+ /****************/
+
+ String TeXstring() const;
+ Line_of_staff(Line_of_score*, PStaff *);
+ Interval height() const;
+};
+
+#endif
diff --git a/stcol.hh b/hdr/stcol.hh
index 1d8b09c61e..17469a4db5 100644
--- a/stcol.hh
+++ b/hdr/stcol.hh
@@ -11,11 +11,16 @@
/// store simultaneous requests
struct Staff_column {
+ /// indirection
Score_column *score_column;
/// fields to collect data vertically.
svec<Voice_element *> v_elts;
+
+ /// idem
svec<Command *> s_commands;
+
+ /****************/
Staff_column(Score_column*s);
bool mus() const;
@@ -24,9 +29,9 @@ struct Staff_column {
/****************************************************************
VIRTUAL
****************************************************************/
- //virtual Staff_column *clone() const=0;
+
virtual void process_requests()=0;
- virtual void process_commands()=0;
+
virtual ~Staff_column() { }
};
diff --git a/stem.hh b/hdr/stem.hh
index acbebe0d92..6b7bc55d7d 100644
--- a/stem.hh
+++ b/hdr/stem.hh
@@ -1,5 +1,5 @@
/*
- stem.hh -- part of LilyPond
+ stem.hh --
(c) 1996 Han-Wen Nienhuys
*/
@@ -13,22 +13,44 @@ struct Stem : public Item {
// heads the stem encompasses (positions)
int minnote, maxnote;
+ /// false if in beam
+ bool print_flag;
+
+ /// needed for determining direction/length
int staff_center;
// extent of the stem (positions)
- int bot, top;
-
+ Real bot, top;
+ /**
+ fractional, since Beam has to adapt them.
+ */
+
+ 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
+ */
+
+ Real stem_xoffset;
/****************/
-
+
+ /// ensure that this Stem also encompasses the Notehead #n#
+ void add(Notehead*n);
+ Real hpos()const;
+ void set_stemend(Real);
+ void set_default_dir();
+ void set_default_stemlen();
+ void set_default_extents();
void postprocess();
Stem(int center);
void print() const;
Interval width() const;
private:
- void calculate();
+
void brew_molecole();
};
/**
diff --git a/hdr/swalker.hh b/hdr/swalker.hh
new file mode 100644
index 0000000000..c00923ff99
--- /dev/null
+++ b/hdr/swalker.hh
@@ -0,0 +1,34 @@
+
+/*
+ swalker.hh -- part of LilyPond
+
+ (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef SWALKER_HH
+#define SWALKER_HH
+
+#include "staff.hh"
+
+struct Staff_walker : public PCursor<Staff_column*> {
+ Staff * staff_;
+ PScore * pscore_;
+
+ int break_status;
+
+ /****************/
+ int priority() const; // Command
+ Real when() const;
+ virtual ~Staff_walker();
+ Staff_walker(Staff*, PScore*);
+ void process() ;
+ virtual void process_command(Command *)=0;
+ virtual void process_requests()=0;
+};
+/**
+ manage run-time info when walking staffcolumns such as: key,
+ meter, pending beams & slurs
+ */
+
+#endif // SWALKER_HH
+
diff --git a/symbol.hh b/hdr/symbol.hh
index 4f26e04e66..4f26e04e66 100644
--- a/symbol.hh
+++ b/hdr/symbol.hh
diff --git a/symtable.hh b/hdr/symtable.hh
index a1443a7d3b..a1443a7d3b 100644
--- a/symtable.hh
+++ b/hdr/symtable.hh
diff --git a/tex.hh b/hdr/tex.hh
index 546797a7c1..546797a7c1 100644
--- a/tex.hh
+++ b/hdr/tex.hh
diff --git a/tstream.hh b/hdr/tstream.hh
index 9474dd69a8..9474dd69a8 100644
--- a/tstream.hh
+++ b/hdr/tstream.hh
diff --git a/voice.hh b/hdr/voice.hh
index 7180ece99e..7180ece99e 100644
--- a/voice.hh
+++ b/hdr/voice.hh
diff --git a/item.cc b/item.cc
deleted file mode 100644
index f10187bbb2..0000000000
--- a/item.cc
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "line.hh"
-#include "symbol.hh"
-#include "molecule.hh"
-#include "pcol.hh"
-
-void
-Item::postprocess()
-{
- // default: do nothing
-}
-
-
-void
-Item::preprocess()
-{
- // default: do nothing
-}
-
-String
-Item::TeXstring() const
-{
- return output->TeXstring();
-}
-
-Interval
-Item::width() const
-{
- return output->extent().x;
-}
-
-Interval
-Item::height() const
-{
- return output->extent().y;
-}
-
-Item::~Item()
-{
- delete output;
-}
-
-Item::Item()
-{
- col = 0;
- output = 0;
- pstaff_ = 0;
-}
-void
-Item::print() const
-{
- output->print();
-}
diff --git a/kortjakje.ly b/kortjakje.ly
new file mode 100644
index 0000000000..4c555c88eb
--- /dev/null
+++ b/kortjakje.ly
@@ -0,0 +1,40 @@
+% "Ah, je vous dirai, maman" (Mozart)
+%
+% bare bones version. (written down from memory :-)
+
+melodie = voice {
+ $ \octave c
+ %%% theme
+ c c g g a a g2 f f e e d d c2
+ %%% var 1
+ c r8 c8 ( ) g r8 g8 ( ) a r8 a8 ( ) g r4
+ f r8 f8 ( ) e4 r8 e8 ( ) d4 r8 d8 ( ) c4 r4
+ $
+}
+
+begeleiding = voice {
+ $ \octave ``c
+ %%% theme
+ `c c e c f c e c d `b c `a `f `g `c2
+ %%%% var 1
+ r8 e8() c r8 e8() c r8 f8()c r8 e8()c
+ r8 d8()`b r8 c8()`a r8 `a8()`f r8 `e8()`c
+ $
+}
+
+
+score {
+ melodicstaff {
+ voice { melodie }
+ }
+ melodicstaff {
+ voice { begeleiding }
+ }
+ paper {
+ unitspace 2.5cm
+ }
+ commands {
+ meter 2 4
+ skip 16:0
+ }
+} \ No newline at end of file
diff --git a/lilyponddefs.tex b/lilyponddefs.tex
index 41748636de..9cf064fee8 100644
--- a/lilyponddefs.tex
+++ b/lilyponddefs.tex
@@ -43,9 +43,13 @@
\mdef\doubledot{'01}
\mdef\tripledot{'02}
\mdef\mussepline{155}
-\mdef\ieigthflag{45}
-\mdef\isixteenthflag{46}
-\mdef\ithirtysecondflag{47}
+
+
+\mdef\deigthflag{45}
+\mdef\dsixteenthflag{46}
+\mdef\dthirtysecondflag{47}
+
+% pointing up
\mdef\ueigthflag{40}
\mdef\usixteenthflag{41}
\mdef\uthirtysecondflag{42}
@@ -55,10 +59,10 @@
\def\generalmeter#1#2{\vbox to 0pt{\vss\rm\hbox{#1}\hbox{#2}}}
\def\lineseparator{\vbox{\mussepline\vskip -5pt\mussepline}}
-\def\beauty{
- \par\vskip 10pt\par
- \hskip -5pt\lineseparator% \hbox to 1cm{\kern -5mm\hrulefill}
- \vskip 10pt
+\def\beauty{%
+ \par\vskip 10pt plus 30pt minus 10pt\par
+ \hskip -5pt\lineseparator
+ \par\vskip 10pt plus 30pt minus 10pt\par
}
\def\interstaffline{%
@@ -114,3 +118,5 @@
}
+\def\beamslope#1#2{{\count0=#2\advance\count0 by#1\musicfnt\char\count0}}
+\def\rulesym#1#2{\vrule height #1 width #2} \ No newline at end of file
diff --git a/maartje.ly b/maartje.ly
index e12fc345e6..4c32f09c9a 100644
--- a/maartje.ly
+++ b/maartje.ly
@@ -2,20 +2,29 @@ ritme = rhythmstaff {
voice { $ c2 r32 r32 r16 r8 r4 c2 c2 c2 c2 c2
c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 $ }
}
+
melody=
melodicstaff {
- voice { $ ''c2.. r8 r4 r8 r16 r32 r32 d8 e8 f8 g8 ''fis1 a8 b8 'c8 c8 ''c8 ```c8 c4 c4 c4 c4 $ }
+ voice { $
+ ''c2.. r8 r4 r8 r16 r32 r32
+ [d8 e8 f8 g8] [d8 e8 f8 g8]
+ ''fis1
+ a8 b8 'c8 'd8 ''c8 ```c8 c4 c4 c4 c4
+ \duration 16 `b16 `a16 `g16 `f16 \duration 4
+ c `b `a `g `f `e `d `c ``b ``a ``g ``f ``e ``d ``c$
+ }
}
score {
paper {
- unitspace 3 cm
+ geometric 1.4
+ unitspace 3.0 cm
}
staff { ritme }
staff { melody }
% staff { melody }
commands {
meter 4 4
- skip 3:0
+ skip 2:0
meter 2 4
skip 19:0
}
diff --git a/make_patch b/make_patch
index 2e9246f4d7..8747fe6b84 100755
--- a/make_patch
+++ b/make_patch
@@ -3,29 +3,30 @@ old=$1
new=$2
nm=$3-
-newarc=$nm$new.tar.gz
-oldarc=$nm$old.tar.gz
+newarc=../releases/$nm$new.tar.gz
+oldarc=../releases/$nm$old.tar.gz
if [ ! -x $nm$new ]
then
echo untarring ..
- tar zfxv $nm$new.tar.gz
if [ ! -f $newarc ]
then
echo cant find $newarc
exit
fi
+ tar zfxv $newarc
fi
if [ ! -x $nm$old ]
then
echo untarring
- tar zfxv $nm$old.tar.gz
+
if [ ! -f $oldarc ]
then
echo cant find oldarc
exit
fi
+ tar zfxv $oldarc
fi
#(cd $nm$old; touch depend; make clean)
diff --git a/melodicstaff.cc b/melodicstaff.cc
deleted file mode 100644
index 2937f45dfe..0000000000
--- a/melodicstaff.cc
+++ /dev/null
@@ -1,78 +0,0 @@
-#include "melodicstaff.hh"
-#include "stem.hh"
-#include "notehead.hh"
-#include "paper.hh"
-#include "molecule.hh"
-#include "linestaff.hh"
-#include "rhythmstaff.hh"
-#include "sccol.hh"
-
-const int NO_LINES=5;
-const int BOTTOM_POSITION=2; // e is on bottom line of 5-staff...
-
-void
-Melodic_staff::set_output(PScore*ps)
-{
- theline = new Linestaff(NO_LINES,ps);
- Simple_staff::set_output(ps);
-}
-
-void
-Melodic_column::typeset_command(Command *com, int breakst)
-{
- Molecule*m=create_command_mol(com);
- Item *i =new Item;
- i->output = m;
- typeset_item(i, breakst);
-}
-
-void
-Melodic_column::typeset_req(Request *rq)
-{
- Item *i ;
- if (rq->note()) {
- Notehead *n =new Notehead((NO_LINES-1)*2);
- n->balltype = rq->rhythmic()->balltype;
- n->dots = rq->rhythmic()->dots;
- n->position = rq->note()->height() - BOTTOM_POSITION;
- i = n;
- } else if (rq->rest()) {
- i =new Item;
- Molecule*m=create_req_mol(rq);
- i->output=m;
- }
- typeset_item(i);
-}
-
-
-void
-Melodic_column::typeset_stem(Stem_req*rq)
-{
- Stem * s = new Stem(NO_LINES);
- int n = the_note->note()->height()-BOTTOM_POSITION;
- s->minnote =s->maxnote=n;
- s->flag = rq->stem_number;
- typeset_item(s);
-}
-
-/*
- creation
- */
-Staff *
-get_new_melodicstaff()
-{
- return new Melodic_staff;
-}
-
-
-Staff_column*
-Melodic_staff::create_col(Score_column*s)
-{
- return new Melodic_column(s,this);
-}
-
-Melodic_staff*
-Melodic_staff::clone()const
-{
- return new Melodic_staff(*this);
-}
diff --git a/melodicstaff.hh b/melodicstaff.hh
deleted file mode 100644
index 5c417b84a5..0000000000
--- a/melodicstaff.hh
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- rhythmstaf.hh -- part of LilyPond
-
- (c) 1996 Han-Wen Nienhuys
-*/
-
-#ifndef MELODICSTAFF_HH
-#define MELODICSTAFF_HH
-
-#include "simplestaff.hh"
-
-/// five line staff, no multiple voices
-struct Melodic_staff : public Simple_staff
-{
- Staff_column * create_col(Score_column*);
- virtual void set_output(PScore *);
- virtual Melodic_staff*clone()const;
-};
-
-struct Melodic_column : public Simple_column {
- virtual void typeset_req(Request *rq);
- virtual void typeset_stem(Stem_req *rq);
- virtual void typeset_command(Command *, int brs);
- // virtual void typeset_item(Item*, int=1);
- Melodic_column(Score_column*s,Simple_staff*rs) :
- Simple_column(s,rs) { }
-// virtual Melodic_column*clone()const;
-};
-
-#endif // MELODICSTAFF_HH
-
-
diff --git a/objects/Makefile b/objects/Makefile
new file mode 100644
index 0000000000..701ad6d5b9
--- /dev/null
+++ b/objects/Makefile
@@ -0,0 +1,2 @@
+dist:
+ ln Makefile $(DDIR)/objects/ \ No newline at end of file
diff --git a/rhythmstaff.cc b/rhythmstaff.cc
deleted file mode 100644
index 98d17d522c..0000000000
--- a/rhythmstaff.cc
+++ /dev/null
@@ -1,76 +0,0 @@
-#include "molecule.hh"
-#include "notehead.hh"
-#include "stem.hh"
-#include "linestaff.hh"
-#include "rhythmstaff.hh"
-#include "paper.hh"
-#include "sccol.hh"
-
-
-void
-Rhythmic_staff::set_output(PScore*ps)
-{
- theline = new Linestaff(1,ps);
- Simple_staff::set_output(ps);
-}
-
-
-void
-Rhythmic_column::typeset_command(Command *com, int breakst)
-{
- Item *i =new Item;
- Molecule*m = create_command_mol(com);
- i->output=m;
- m->translate(Offset(0,
- -staff_->score_->paper_->standard_height()/2));
- typeset_item(i, breakst);
-}
-
-void
-Rhythmic_column::typeset_req(Request *rq)
-{
- Item *i ;
- if (rq->note()) {
- Notehead *n =new Notehead(1);
- n->balltype = rq->rhythmic()->balltype;
- n->dots = rq->rhythmic()->dots;
- n->position = 0;
- i = n;
- } else if (rq->rest()) {
- i =new Item;
- Molecule*m=create_req_mol(rq);
- i->output=m;
- }
- typeset_item(i);
-}
-
-void
-Rhythmic_column::typeset_stem(Stem_req*rq)
-{
- Stem * s = new Stem(0);
- s->minnote = s->maxnote = 0;
- s->flag = rq->stem_number;
- typeset_item(s);
-}
-
-/*
- creation
- */
-Staff *
-get_new_rhythmstaff()
-{
- return new Rhythmic_staff;
-}
-
-
-Staff_column*
-Rhythmic_staff::create_col(Score_column*s)
-{
- return new Rhythmic_column(s,this);
-}
-
-Rhythmic_staff*
-Rhythmic_staff::clone() const
-{
- return new Rhythmic_staff(*this);
-}
diff --git a/rhythmstaff.hh b/rhythmstaff.hh
deleted file mode 100644
index 130f6483b9..0000000000
--- a/rhythmstaff.hh
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- rhythmstaf.hh -- part of LilyPond
-
- (c) 1996 Han-Wen Nienhuys
-*/
-
-#ifndef RHYTHMSTAF_HH
-#define RHYTHMSTAF_HH
-
-#include "simplestaff.hh"
-
-/// all notes on one line
-struct Rhythmic_staff : public Simple_staff
-{
- // Rhythmic_staff();
- Staff_column * create_col(Score_column*);
- virtual void set_output(PScore *);
- virtual Rhythmic_staff*clone()const;
-};
-
-/// this does the typesetting
-struct Rhythmic_column : public Simple_column {
- virtual void typeset_req(Request *rq);
- virtual void typeset_stem(Stem_req *rq);
- virtual void typeset_command(Command *, int brs);
-
-
-// virtual void typeset_item(Item *rq, int=1);
- Rhythmic_column(Score_column*s,Simple_staff*rs) :
- Simple_column(s,rs) { }
-// virtual Rhythmic_column*clone()const;
-};
-
-#endif // RHYTHMSTAF_HH
-
-
diff --git a/simpleprint.cc b/simpleprint.cc
deleted file mode 100644
index b069978dce..0000000000
--- a/simpleprint.cc
+++ /dev/null
@@ -1,75 +0,0 @@
-#include "lookupsyms.hh"
-#include "request.hh"
-#include "pscore.hh"
-#include "paper.hh"
-#include "simplestaff.hh"
-#include "molecule.hh"
-#include "sccol.hh"
-
-Molecule *
-Simple_column::create_req_mol(Request *rq)
-{
- assert(rq->rest());
- Symbol s;
- int dots=0;
- if (rq->rest())
- s = staff_->paper()->lookup_->rest(rq->rest()->balltype);
-
- if (rq->rhythmic())
- dots=rq->rhythmic()->dots;
-
-
- Molecule *m = new Molecule(Atom(s));
- if (dots) {
- Symbol d = staff_->paper()->lookup_->dots(dots);
- Molecule dm;
- dm.add(Atom(d));
- m->add_right(dm);
- }
- return m;
-}
-
-Molecule *
-Simple_column::create_command_mol(Command *com)
-{
- Symbol s;
-
- if (com -> args[0] == "BAR" ) {
- s = staff_->paper()->lookup_->bar(com->args[1]);
- } else if (com->args[0] == "METER") {
- Parametric_symbol *p = staff_->paper()->lookup_->meter("general");
- svec<String> arg( com->args);
- arg.del(0);
- s = p->eval(arg);
- } else
- assert(false);
-
- Molecule * m =new Molecule(Atom(s));
- {
- Interval wid;
- svec<Item*> sv(staff_->pscore_->
- select_items(staff_->theline, score_column->pcol));
- for (int j=0; j<sv.sz(); j++) {
- wid.unite(sv[j]->output->extent().x);
- }
- if (!wid.empty())
- m->translate(Offset(wid.max,0));
- }
-
- return m;
-}
-
-void
-Simple_column::typeset_item(Item *i, int breakst)
-{
- // ugh
- staff_->pscore_->typeset_item(i, score_column->pcol,
- staff_->theline,breakst);
-}
-
-void
-Simple_staff::set_output(PScore* ps )
-{
- pscore_ = ps;
- pscore_->add(theline);
-}
diff --git a/simplestaff.cc b/simplestaff.cc
deleted file mode 100644
index 97250b48cb..0000000000
--- a/simplestaff.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-#include "request.hh"
-#include "debug.hh"
-#include "staff.hh"
-#include "command.hh"
-#include "simplestaff.hh"
-#include "sccol.hh"
-
-
-
-
-Simple_column::Simple_column(Score_column*s, Simple_staff *rs)
- : Staff_column(s)
-{
- the_note = 0;
- stem_ = 0;
- staff_ = rs;
-}
-
-Simple_staff::Simple_staff()
-{
- theline = 0;
-}
-
-void
-Simple_column::process_commands( )
-{
- int breakstat = BREAK_END - BREAK_PRE;
- for (int i = 0 ; i < s_commands.sz(); i++) {
- Command *com = s_commands[i];
- switch (com->code){
- case INTERPRET:
- break;
- case BREAK_PRE:
- case BREAK_MIDDLE:
- case BREAK_POST:
- case BREAK_END:
- score_column->set_breakable();
- breakstat = com->code- BREAK_PRE;
- break;
-
- case TYPESET:
- typeset_command ( com , breakstat);
- break;
- default :
- break;
- }
- }
-}
-/**
- accept:
-
- BREAK: all
- TYPESET: bar, meter,
-
- */
-
-
-
-void
-Simple_column::process_requests()
-{
- for (int i = 0 ; i < v_elts.sz(); i ++)
- for (PCursor<Request *> rqc(v_elts[i]->reqs); rqc.ok(); rqc++) {
- Request *rq= rqc;
- if (rq->rhythmic()){
- if (the_note){
- WARN << "too many notes.\n";
- }
- the_note = rq;
-
- }
- if (rq->stem()) {
- stem_ = rq->stem();
- }
-
- }
-}
-
-void
-Simple_staff::grant_requests()
-{
- for (PCursor<Staff_column*> cc(cols); cc.ok(); cc++) {
- Simple_column *rp = (Simple_column*)*cc;
- if (rp->the_note)
- rp->typeset_req( rp->the_note);
- if (rp->stem_)
- rp->typeset_stem(rp->stem_->stem());
- }
-}
-
-
diff --git a/spanner.cc b/spanner.cc
deleted file mode 100644
index be30c04659..0000000000
--- a/spanner.cc
+++ /dev/null
@@ -1,33 +0,0 @@
-
-#include "spanner.hh"
-#include "line.hh"
-
-#include "symbol.hh"
-#include "molecule.hh"
-#include "pcol.hh"
-
-String
-Spanner::TeXstring() const
-{
- assert(right->line);
- Real w = left->hpos - right->hpos;
- return strets->eval(w).tex;
-}
-
-// todo.
-Spanner *
-Spanner::broken_at(const PCol *c1, const PCol *c2) const
-{
- Spanner *sp = new Spanner(*this);
- sp->left = c1;
- sp->right = c2;
- return sp;
-}
-
-Spanner::Spanner()
-{
- pstaff_=0;
- strets=0;
- left = right = 0;
-}
-
diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 0000000000..65374e807e
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,8 @@
+default:
+ $(MAKE) -C ..
+
+dist:
+ ln Makefile $(mycc) $(othersrc) $(DDIR)/src
+
+TAGS: $(mycc)
+ etags -CT $(mycc)
diff --git a/src/bar.cc b/src/bar.cc
new file mode 100644
index 0000000000..bb66f2b777
--- /dev/null
+++ b/src/bar.cc
@@ -0,0 +1,18 @@
+#include "bar.hh"
+#include "string.hh"
+#include "molecule.hh"
+#include "paper.hh"
+#include "lookup.hh"
+
+
+Bar::Bar( String t)
+{
+ type = t;
+}
+void
+Bar::preprocess()
+{
+ Symbol s = paper()->lookup_->bar(type);
+ output = new Molecule(Atom(s));
+}
+
diff --git a/src/beam.cc b/src/beam.cc
new file mode 100644
index 0000000000..49214c91f2
--- /dev/null
+++ b/src/beam.cc
@@ -0,0 +1,179 @@
+#include "beam.hh"
+#include "debug.hh"
+#include "symbol.hh"
+#include "molecule.hh"
+#include "leastsquares.hh"
+#include "pcol.hh"
+#include "stem.hh"
+#include "paper.hh"
+#include "lookup.hh"
+
+
+struct Stem_info {
+ Real x;
+ Real idealy;
+ Real miny;
+ int no_beams;
+
+ Stem_info(){}
+ Stem_info(const Stem*);
+};
+Stem_info::Stem_info(const Stem*s)
+{
+ x = s->hpos();
+ int dir = s->dir;
+ idealy = MAX(dir*s->top, dir*s->bot);
+ miny = MAX(dir*s->minnote, dir*s-> maxnote);
+ assert(miny <= idealy);
+ no_beams = s->flag;
+}
+
+/****************/
+
+Beam::Beam()
+{
+ slope = 0;
+ left_pos = 0.0;
+ dir =0;
+}
+
+void
+Beam::add(Stem*s)
+{
+ stems.bottom().add(s);
+ s->print_flag = false;
+}
+
+void
+Beam::set_default_dir()
+{
+ int dirs[2];
+ dirs[0]=0; dirs[1] =0;
+ for (PCursor<Stem*> sc(stems); sc.ok(); sc++) {
+ sc->set_default_dir();
+ dirs[(sc->dir+1)/2] ++;
+ }
+ dir = (dirs[0] > dirs[1]) ? -1 : 1;
+ for (PCursor<Stem*> sc(stems); sc.ok(); sc++) {
+ sc->dir = dir;
+ }
+}
+
+void
+Beam::solve_slope()
+{
+ svec<Stem_info> sinfo;
+ for (PCursor<Stem* >sc(stems); sc.ok(); sc++) {
+ sc->set_default_extents();
+ Stem_info i(sc);
+ sinfo.add(i);
+ }
+ Real leftx = sinfo[0].x;
+ Least_squares l;
+ for (int i=0; i < sinfo.sz(); i++) {
+ sinfo[i].x -= leftx;
+ l.input.add(Offset(sinfo[i].x, sinfo[i].idealy));
+ }
+
+ l.minimise(slope, left_pos);
+ Real dy = 0.0;
+ for (int i=0; i < sinfo.sz(); i++) {
+ Real y = sinfo[i].x * slope + left_pos;
+ Real my = sinfo[i].miny;
+
+ if (my - y > dy)
+ dy = my -y;
+ }
+ left_pos += dy;
+ left_pos *= dir;
+ slope *= dir;
+
+ {Real inter =paper()->interline()/2;
+ Real unitslope = slope*inter;
+
+ // set beamslope, for setting stems correctly
+ // ignoring return.
+ Symbol sy = paper()->lookup_->beam(unitslope, width().length());
+ slope =unitslope / inter;
+ }
+}
+
+void
+Beam::set_stemlens()
+{
+ PCursor<Stem*> s(stems);
+ Real x0 = s->hpos();
+ for (; s.ok() ; s++) {
+ Real x = s->hpos()-x0;
+ s->set_stemend(left_pos + slope * x);
+ }
+}
+
+void
+Beam::calculate()
+{
+ assert(stems.size()>1);
+ if (!dir)
+ set_default_dir();
+
+ solve_slope();
+ set_stemlens();
+}
+
+void
+Beam::process()
+{
+ calculate();
+ brew_molecule();
+}
+
+
+// todo.
+Spanner *
+Beam::broken_at(const PCol *, const PCol *) const
+{
+ return new Beam(*this);
+}
+
+void
+Beam::preprocess()
+{
+ left = (*stems.top()) ->pcol_;
+ right = (*stems.bottom())->pcol_;
+}
+
+Interval
+Beam::height() const
+{
+ return output->extent().y;
+}
+
+Interval
+Beam::width() const
+{
+ Beam * me = (Beam*) this; // ugh
+ return Interval( (*me->stems.top()) ->hpos(),
+ (*me->stems.bottom()) ->hpos() );
+}
+
+void
+Beam::brew_molecule()
+{
+ Real inter=paper()->interline()/2;
+ Real sl = slope*inter;
+ Real w = width().length() + paper()->rule_thickness();
+ Symbol s = paper()->lookup_->beam(sl,w);
+
+ Atom a(s);
+
+ Real dx = width().min -left->hpos;
+ a.translate(Offset(dx,left_pos*inter));
+ output = new Molecule(a);
+}
+
+void
+Beam::print()const
+{
+ mtor << "Beam, slope " <<slope << "left ypos " << left_pos<<'\n';
+}
+
diff --git a/boxes.cc b/src/boxes.cc
index ebfc08abfe..ebfc08abfe 100644
--- a/boxes.cc
+++ b/src/boxes.cc
diff --git a/break.cc b/src/break.cc
index 7d5a02a10e..de9a704984 100644
--- a/break.cc
+++ b/src/break.cc
@@ -5,7 +5,7 @@
#include "paper.hh"
#include "linespace.hh"
#include "debug.hh"
-#include "line.hh"
+#include "scoreline.hh"
#include "pscore.hh"
// construct an appropriate Spacing_problem and solve it.
@@ -27,6 +27,14 @@ PScore::solve_line(svec<const PCol *> curline) const
return the_sol;
}
+bool
+PScore::feasible(svec<const PCol *> curline) const
+{
+ Real l =0;
+ for (int i=0; i < curline.sz(); i++)
+ l +=curline[i]->width().length();
+ return l < paper_->linewidth;
+}
void
PScore::problem_OK() const
@@ -98,11 +106,16 @@ PScore::calc_breaking()
curcol++;
}
current.add(breakpoints[i]->prebreak );
+ if (!feasible(current.line)) {
+ if (!minimum.line.sz())
+ error("sorry, this measure is too long");
+ break;
+ }
current.setsol(solve_line(current.line));
current.print();
- if (current.energy < minimum.energy) {
- minimum = current;
+ if (current.energy < minimum.energy) {
+ minimum = current;
} else { // we're one col too far.
i--;
while (curcol != breakpoints[i])
diff --git a/calcideal.cc b/src/calcideal.cc
index 8099e0e4c7..8099e0e4c7 100644
--- a/calcideal.cc
+++ b/src/calcideal.cc
diff --git a/command.cc b/src/command.cc
index 23edf1ec36..23edf1ec36 100644
--- a/command.cc
+++ b/src/command.cc
diff --git a/debug.cc b/src/debug.cc
index d55c901945..d55c901945 100644
--- a/debug.cc
+++ b/src/debug.cc
diff --git a/dimen.cc b/src/dimen.cc
index eb53756b45..eb53756b45 100644
--- a/dimen.cc
+++ b/src/dimen.cc
diff --git a/getcommands.cc b/src/getcommands.cc
index 1f9362c59c..1f9362c59c 100644
--- a/getcommands.cc
+++ b/src/getcommands.cc
diff --git a/identifier.cc b/src/identifier.cc
index 5405d5f710..024fe06486 100644
--- a/identifier.cc
+++ b/src/identifier.cc
@@ -2,7 +2,7 @@
#include "identifier.hh"
#include "staff.hh"
#include "lexer.hh"
-#include "parser.hh"
+
Identifier::Identifier(String n)
:name (n)
diff --git a/src/item.cc b/src/item.cc
new file mode 100644
index 0000000000..914c924a99
--- /dev/null
+++ b/src/item.cc
@@ -0,0 +1,73 @@
+#include "pstaff.hh"
+#include "pscore.hh"
+#include "symbol.hh"
+#include "molecule.hh"
+#include "pcol.hh"
+
+void
+Item::translate(Offset O)
+{
+ offset_ += O;
+}
+
+void
+Item::postprocess()
+{
+ // default: do nothing
+}
+
+
+void
+Item::preprocess()
+{
+ // default: do nothing
+}
+
+String
+Item::TeXstring() const
+{
+ Item * me = (Item*) this;
+ output->translate(offset_); // ugh?
+ me ->offset_ = Offset(0,0); // URRGGH!
+ return output->TeXstring();
+}
+
+Interval
+Item::width() const
+{
+ Interval i =output->extent().x ;
+ return i+=offset_.x;
+}
+
+Interval
+Item::height() const
+{
+ Interval i =output->extent().y;
+ return i+=offset_.y;
+}
+
+Item::~Item()
+{
+ delete output;
+}
+
+Item::Item()
+{
+ pcol_ = 0;
+ output = 0;
+ pstaff_ = 0;
+}
+void
+Item::print() const
+{
+ assert(output);
+ output->print();
+}
+
+Paperdef*
+Item::paper() const
+{
+ assert(pstaff_);
+ return pstaff_->pscore_->paper_;
+}
+
diff --git a/keyword.cc b/src/keyword.cc
index 14903cfb61..14903cfb61 100644
--- a/keyword.cc
+++ b/src/keyword.cc
diff --git a/src/leastsquares.cc b/src/leastsquares.cc
new file mode 100644
index 0000000000..1e1c91cee3
--- /dev/null
+++ b/src/leastsquares.cc
@@ -0,0 +1,25 @@
+#include "leastsquares.hh"
+
+void
+Least_squares::minimise(Real &coef, Real &offset)
+{
+ Real sx = 0.0;
+ Real sy = 0.0;
+ Real sqx =0.0;
+ Real sxy = 0.0;
+
+ for (int i=0; i < input.sz();i++) {
+ Real x=input[i].x;
+ Real y = input[i].y;
+ sx += x;
+ sy += y;
+ sqx += sqr(x);
+ sxy += x*y;
+ }
+ int N = input.sz();
+
+
+ coef = (N * sxy - sx*sy )/(N*sqx - sqr(sx));
+ offset = (sy - coef * sx)/N;
+
+}
diff --git a/lexer.l b/src/lexer.l
index 220b07ccf8..1e3443e56e 100644
--- a/lexer.l
+++ b/src/lexer.l
@@ -25,6 +25,8 @@ const int DOTPRINT=50; // every 50 lines dots
%x incl
%x quote
+
+NOTECOMMAND \\{WORD}
OPTSIGN !?
NOTENAMEI A|B|C|D|E|F|G|As|Bes|Ces|Des|Es|Fes|Ges|Ais|Bis|Cis|Dis|Eis|Fis|Gis
NOTENAMEII a|b|c|d|e|f|g|as|bes|ces|des|es|fes|ges|ais|bis|cis|dis|eis|fis|gis
@@ -45,6 +47,17 @@ REAL [0-9]+(\.[0-9]*)?
BEGIN(notes); return '$';
}
+<notes>{NOTECOMMAND} {
+ String c = YYText() +1;
+ int l = lookup_keyword(c);
+ if (l == -1) {
+ String e("unknown NOTECOMMAND: \\");
+ e += c;
+ yyerror(e);
+ }
+ return l;
+}
+
<notes>{RESTNAME} {
const char *s = YYText();
yylval.string = new String (s);
@@ -61,6 +74,8 @@ REAL [0-9]+(\.[0-9]*)?
yylval.string = new String (YYText());
return DURATION;
}
+<notes>\| {
+}
<notes>[:space:]+ {
}
<notes>[ \t\n]+ {
@@ -71,8 +86,18 @@ REAL [0-9]+(\.[0-9]*)?
<notes>\$ {
BEGIN(INITIAL); return '$';
}
+<notes>[\[){] { /* parens () are NO mistake */
+ yylval.c = YYText()[0];
+ return OPEN_REQUEST_PARENS;
+}
+<notes>[\]()}] { /* parens () are NO mistake */
+ yylval.c = YYText()[0];
+ return CLOSE_REQUEST_PARENS;
+}
+
<notes>. {
- error("lexer error: illegal character found: " + String(YYText()));
+ String s("lexer error: illegal character found: " + String(YYText()));
+ yyerror(s);
}
\" {
@@ -178,9 +203,9 @@ close_input()
cout << "]" << flush;
- if (include_stack.empty())
- return false ;
- else
+ if (include_stack.empty()) {
+ return false ;
+ } else
lexer->switch_streams(include_stack.top());
return true;
}
@@ -191,18 +216,14 @@ yylex() {
}
void
-yyerror(char *s)
+yyerror(const char *s)
{
*mlog << "error in line " << lexer->lineno() << ": " << s << '\n';
exit(1);
}
-
-#if 0
-
-<notes>{NOTENAME} {
- yylval.string = new String (YYText());
- return NOTENAME;
+void
+kill_lexer()
+{
+ delete lexer;
}
-
-#endif
diff --git a/linespace.cc b/src/linespace.cc
index 17c16ef4ef..6b16c9afab 100644
--- a/linespace.cc
+++ b/src/linespace.cc
@@ -10,7 +10,7 @@ bool
Spacing_problem::contains(const PCol *w)
{
for (int i=0; i< cols.sz(); i++)
- if (cols[i].col == w)
+ if (cols[i].pcol_ == w)
return true;
return false;
}
@@ -19,7 +19,7 @@ int
Spacing_problem::col_id(const PCol *w)const
{
for (int i=0; i< cols.sz(); i++)
- if (cols[i].col == w)
+ if (cols[i].pcol_ == w)
return i;
assert(false);
}
@@ -29,16 +29,21 @@ Spacing_problem::OK() const
{
#ifndef NDEBUG
Union_find connected(cols.sz());
-
+ svec<int> fixed;
for (int i=0; i < ideals.sz(); i++) {
assert(ideals[i]->hooke > 0);
int l = col_id(ideals[i]->left);
int r = col_id(ideals[i]->right);
connected.connect(l,r);
}
-
+ for (int i = 0; i < cols.sz(); i++)
+ if (cols[i].fixed)
+ fixed.add(i);
for (int i = 0; i < cols.sz(); i++) {
- assert( connected.equiv(0,i));
+ bool c=false;
+ for (int j =0; j<fixed.sz(); j++)
+ c |= connected.equiv(j,i);
+ assert(c);
}
#endif
}
@@ -197,7 +202,7 @@ Spacing_problem::add_column(const PCol *col, bool fixed, Real fixpos)
c.fixed=fixed;
c.fixpos=fixpos;
assert(col);
- c.col=col;
+ c.pcol_=col;
cols.add(c);
}
@@ -246,7 +251,7 @@ Colinfo::print() const
mtor << "column { ";
if (fixed)
mtor << "fixed at " << fixpos<<", ";
- assert(col);
+ assert(pcol_);
mtor << "[" << minleft() << ", " << minright() << "]";
mtor <<"}\n";
#endif
@@ -255,5 +260,5 @@ Colinfo::print() const
Colinfo::Colinfo()
{
fixed=false;
- col=0;
+ pcol_=0;
}
diff --git a/linestaff.cc b/src/linestaff.cc
index 7cd081dc49..a52954e6f4 100644
--- a/linestaff.cc
+++ b/src/linestaff.cc
@@ -1,6 +1,6 @@
#include "linestaff.hh"
#include "symbol.hh"
-#include "lookupsyms.hh"
+#include "lookup.hh"
#include "dimen.hh"
#include "paper.hh"
#include "pscore.hh"
diff --git a/lookupsyms.cc b/src/lookup.cc
index e6ad52ca5a..d0ce3cb743 100644
--- a/lookupsyms.cc
+++ b/src/lookup.cc
@@ -1,4 +1,4 @@
-#include "lookupsyms.hh"
+#include "lookup.hh"
#include "debug.hh"
#include "symtable.hh"
#include "dimen.hh"
diff --git a/main.cc b/src/main.cc
index 3c33fd959d..c45de7a683 100644
--- a/main.cc
+++ b/src/main.cc
@@ -10,10 +10,18 @@ extern void parse_file(String s);
long_option_init theopts[] = {
1, "output", 'o',
0, "warranty", 'w',
+ 0, "help", 'h',
0,0,0
};
-
+void
+help()
+{
+ cout <<
+ "--help, -h This help\n"
+ "--warranty, -w show warranty & copyright\n"
+ "--output, -o set default output\n";
+}
void notice()
{
cout <<
@@ -21,7 +29,6 @@ void notice()
"Copyright (C) 1996 by\n"
" Han-Wen Nienhuys <hanwen@stack.urc.tue.nl>\n"
"\n"
- "\n"
" This program is free software; you can redistribute it and/or\n"
"modify it under the terms of the GNU General Public License version 2\n"
"as published by the Free Software Foundation.\n"
@@ -53,6 +60,10 @@ main (int argc, char **argv)
notice();
exit(0);
break;
+ case 'h':
+ help();
+ exit(0);
+ break;
default:
assert(false);
break;
diff --git a/src/melodicstaff.cc b/src/melodicstaff.cc
new file mode 100644
index 0000000000..17916d2f22
--- /dev/null
+++ b/src/melodicstaff.cc
@@ -0,0 +1,59 @@
+#include "melodicstaff.hh"
+#include "stem.hh"
+#include "rest.hh"
+#include "notehead.hh"
+#include "paper.hh"
+#include "molecule.hh"
+#include "linestaff.hh"
+#include "rhythmstaff.hh"
+#include "sccol.hh"
+
+const int NO_LINES=5;
+const int BOTTOM_POSITION=2; // e is on bottom line of 5-staff...
+
+void
+Melodic_staff::set_output(PScore*ps)
+{
+ theline = new Linestaff(NO_LINES,ps);
+ Simple_staff::set_output(ps);
+}
+
+
+Notehead*
+Melodic_staff::get_notehead(Note_req *rq)
+{
+ int b = rq->rhythmic()->balltype;
+ int d = rq->rhythmic()->dots;
+
+ Notehead *n =new Notehead((NO_LINES-1)*2);
+ n->balltype =b;
+ n->dots = d;
+ n->position = rq->note()->height() - BOTTOM_POSITION;
+ return n;
+}
+
+
+Stem *
+Melodic_staff::get_stem(Stem_req*rq)
+{
+ Stem * s = new Stem(NO_LINES-1);
+ s->flag = rq->stem_number;
+ return s;
+}
+
+/*
+ creation
+ */
+Staff *
+get_new_melodicstaff()
+{
+ return new Melodic_staff;
+}
+
+
+
+Melodic_staff*
+Melodic_staff::clone()const
+{
+ return new Melodic_staff(*this);
+}
diff --git a/src/meter.cc b/src/meter.cc
new file mode 100644
index 0000000000..0afa8ea1a1
--- /dev/null
+++ b/src/meter.cc
@@ -0,0 +1,20 @@
+#include "string.hh"
+#include "molecule.hh"
+#include "meter.hh"
+#include "paper.hh"
+#include "lookup.hh"
+
+
+Meter::Meter(svec<String> a)
+ :args(a)
+{
+}
+void
+Meter::preprocess()
+{
+ Parametric_symbol *p = paper()->lookup_->meter("general");
+ Symbol s = p->eval(args);
+ delete p;
+ output = new Molecule(Atom(s));
+}
+
diff --git a/misc.cc b/src/misc.cc
index 54746fd836..54746fd836 100644
--- a/misc.cc
+++ b/src/misc.cc
diff --git a/molecule.cc b/src/molecule.cc
index 8fca34836b..e8c4d2adec 100644
--- a/molecule.cc
+++ b/src/molecule.cc
@@ -4,6 +4,7 @@
#include "molecule.hh"
#include "symbol.hh"
#include "debug.hh"
+#include "tex.hh"
void
Atom::print() const
@@ -74,7 +75,11 @@ Molecule::add(const Molecule &m)
void
Molecule::add_right(const Molecule &m)
{
- Real xof=extent().x.max - m.extent().x.min;
+ if (!ats.size()) {
+ add(m);
+ return;
+ }
+ Real xof=extent().x.max - m.extent().x.min;
Molecule toadd(m);
toadd.translate(Offset(xof, 0.0));
add(toadd);
@@ -83,6 +88,10 @@ Molecule::add_right(const Molecule &m)
void
Molecule::add_left(const Molecule &m)
{
+ if (!ats.size()) {
+ add(m);
+ return;
+ }
Real xof=extent().x.min - m.extent().x.max;
Molecule toadd(m);
toadd.translate(Offset(xof, 0.0));
@@ -93,7 +102,11 @@ Molecule::add_left(const Molecule &m)
void
Molecule::add_top(const Molecule &m)
{
- Real yof=extent().y.max - m.extent().y.min;
+ if (!ats.size()) {
+ add(m);
+ return;
+ }
+ Real yof=extent().y.max - m.extent().y.min;
Molecule toadd(m);
toadd.translate(Offset(0,yof));
add(toadd);
@@ -102,6 +115,10 @@ Molecule::add_top(const Molecule &m)
void
Molecule::add_bot(const Molecule &m)
{
+ if (!ats.size()) {
+ add(m);
+ return;
+ }
Real yof=extent().y.min- m.extent().y.max;
Molecule toadd(m);
toadd.translate(Offset(0,yof));
diff --git a/note.cc b/src/note.cc
index b897ce0e66..0041bb7238 100644
--- a/note.cc
+++ b/src/note.cc
@@ -1,12 +1,14 @@
#include <ctype.h>
+
#include "string.hh"
#include "real.hh"
#include "debug.hh"
#include "request.hh"
#include "voice.hh"
#include "notename.hh"
+#include "vray.hh"
-int default_duration = 4;
+int default_duration = 4, default_dots=0, default_octave=0;
void
parse_duration(const char *a, int &j, int &intdur, int &dots)
@@ -17,17 +19,17 @@ parse_duration(const char *a, int &j, int &intdur, int &dots)
durstr += a[j++];
}
- dots=0;
+ dots=default_dots;
while (a[j] == '.')
{
j++;
dots++;
}
+
intdur = (durstr.len()) ?
durstr.value():default_duration;
-
mtor << "dur " << intdur << "dots " << dots<<eol;
}
@@ -38,13 +40,13 @@ parse_pitch( const char *a, int &j, int &oct, bool & overide_acc,
int & large, int & small)
{
// octave
- oct =0;
+ oct =default_octave;
while (1)
{
if (a[j] == '\'')
oct ++;
- else if (a[j] == '`')
+ else if (a[j] == '`')
oct --;
else
break;
@@ -93,10 +95,10 @@ get_note_element(String pitch, String durstr)
parse_duration(durstr, i, dur, dots);
i=0;
- Note_req * rq = new Note_req( v);
+ Note_req * rq = new Note_req;
if (dur >= 2) {
- Stem_req * st = new Stem_req(v, dur);
+ Stem_req * st = new Stem_req(dur);
v->add(st);
}
@@ -131,11 +133,74 @@ get_rest_element(String, String durstr)
parse_duration(durstr, i, dur, dots);
i=0;
- Rest_req * rq = new Rest_req(v);
+ Rest_req * rq = new Rest_req;
rq->balltype = dur;
rq->dots = dots;
rq->print();
v->add(rq);
+
return v;
}
+
+void
+set_default_duration(String d)
+{
+ int i=0;
+ parse_duration(d, i, default_duration, default_dots);
+}
+
+
+void
+set_default_pitch(String d)
+{
+ int i=0;
+ bool b;
+ int l,s;
+ parse_pitch(d, i, default_octave, b, l,s);
+}
+
+Request*
+get_request(char c)
+{
+ Request* ret=0;
+ switch (c) {
+ case '[':
+ case ']':
+ ret = new Beam_req;
+ break;
+
+ case ')':
+ case '(':
+ ret = new Slur_req;
+ break;
+ default:
+ assert(false);
+ break;
+ }
+
+ switch (c) {
+ case '(':
+ case '[':
+ ret->span()->spantype = Span_req::START;
+ break;
+ case ')':
+ case ']':
+ ret->span()->spantype = Span_req::STOP;
+ break;
+ default:
+ assert(false);
+ break;
+ }
+
+ return ret;
+}
+
+void
+add_requests(Voice_element *v, svec<Request*> &req)
+{
+ for (int i = 0; i < req.sz(); i++) {
+ v->add(req[i]);
+ }
+ req.set_size(0);
+}
diff --git a/notehead.cc b/src/notehead.cc
index fe026b1036..a103e69b3d 100644
--- a/notehead.cc
+++ b/src/notehead.cc
@@ -1,10 +1,8 @@
#include "notehead.hh"
#include "dimen.hh"
#include "debug.hh"
-#include "pstaff.hh"
-#include "pscore.hh"
#include "paper.hh"
-#include "lookupsyms.hh"
+#include "lookup.hh"
#include "molecule.hh"
@@ -35,7 +33,7 @@ Notehead::brew_molecole()
assert(pstaff_);
assert(!output);
- Paperdef *p = pstaff_->pscore_->paper_;
+ Paperdef *p = paper();
Real dy = p->interline()/2;
Symbol s = p->lookup_->ball(balltype);
diff --git a/notename.cc b/src/notename.cc
index 8ebc4df244..8ebc4df244 100644
--- a/notename.cc
+++ b/src/notename.cc
diff --git a/paper.cc b/src/paper.cc
index 89f9a9fe5c..8cd98339d4 100644
--- a/paper.cc
+++ b/src/paper.cc
@@ -2,7 +2,7 @@
#include "paper.hh"
#include "debug.hh"
-#include "lookupsyms.hh"
+#include "lookup.hh"
#include "dimen.hh"
#include "textdb.hh"
@@ -20,13 +20,17 @@ Paperdef::duration_to_dist(Real d)
{
return whole_width * pow(geometric_, log2(d));
}
-
+Real
+Paperdef::rule_thickness()const
+{
+ return convert_dimen(0.4, "pt");
+}
Paperdef::Paperdef()
{
lookup_ = new Lookup();
parse();
linewidth = convert_dimen(15,"cm"); // in cm for now
- whole_width= 6*note_width();
+ whole_width= 8*note_width();
geometric_ = PHI;
}
diff --git a/parser.y b/src/parser.y
index 3ce26028b1..691d306e78 100644
--- a/parser.y
+++ b/src/parser.y
@@ -17,6 +17,7 @@
#define YYDEBUG 1
#endif
+svec<Request*> pre_reqs, post_reqs;
%}
@@ -32,19 +33,25 @@
Score *score;
const char *consstr;
Paperdef *paper;
+ Request* request;
int i;
+ char c;
}
%token VOICE STAFF SCORE TITLE RHYTHMSTAFF BAR NOTENAME OUTPUT
%token CM IN PT MM PAPER WIDTH METER UNITSPACE SKIP COMMANDS
-%token MELODICSTAFF GEOMETRIC START
+%token MELODICSTAFF GEOMETRIC START_T DURATIONCOMMAND OCTAVECOMMAND
-%type <consstr> unit
%token <id> IDENTIFIER
%token <string> NEWIDENTIFIER
%token <string> PITCH DURATION RESTNAME
%token <real> REAL
%token <string> STRING
+%token <i> OPEN_REQUEST_PARENS CLOSE_REQUEST_PARENS
+
+
+%type <consstr> unit
+
%type <id> declaration
%type <paper> paper_block paper_body
%type <real> dim
@@ -56,6 +63,8 @@
%type <staff> melodicstaff_block melodicstaff_body staffdecl
%type <i> int
%type <scommands> score_commands_block score_commands_body
+%type <request> post_request pre_request
+
%%
@@ -167,7 +176,7 @@ voice_block:
voice_body:
IDENTIFIER { $$ = new Voice(*$1->voice()); }
| voice_elts_dollar { $$ = $1; }
- | voice_body START REAL { $$->start = $3; }
+ | voice_body START_T REAL { $$->start = $3; }
;
@@ -181,17 +190,66 @@ voice_elts:
/* empty */ {
$$ = new Voice;
}
- | voice_elts voice_elt {
- $$->add($2);
+ | voice_elts pre_requests voice_elt post_requests {
+ add_requests($3, pre_reqs);
+ add_requests($3, post_reqs);
+ $$->add($3);
}
+
+ | voice_elts voice_command { }
;
-voice_elt:
- PITCH DURATION { $$ = get_note_element(*$1, *$2);
+post_requests:
+ {
+ assert(post_reqs.empty());
+ }
+ | post_requests post_request {
+ post_reqs.add($2);
+ }
+ ;
+post_request:
+ CLOSE_REQUEST_PARENS { $$ = get_request($1); }
+ ;
+
+pre_requests:
+ | pre_requests pre_request {
+ pre_reqs.add($2);
}
- | RESTNAME DURATION { $$ = get_rest_element(*$1, *$2);
+ ;
+pre_request:
+ OPEN_REQUEST_PARENS { $$ = get_request($1); }
+ ;
+/*
+*/
+voice_command:
+ DURATIONCOMMAND DURATION {
+ set_default_duration(*$2);
+ delete $2;
+ }
+ | OCTAVECOMMAND PITCH {
+ set_default_pitch(*$2);
+ delete $2;
+ }
+ ;
+
+voice_elt:
+ PITCH DURATION {
+ $$ = get_note_element(*$1, *$2);
+ delete $1;
+ delete $2;
+ }
+ | RESTNAME DURATION {
+ $$ = get_rest_element(*$1, *$2);
+ delete $1;
+ delete $2;
+ }
+ | PITCH { $$ = get_note_element(*$1, "");
+ delete $1;
+ }
+ | RESTNAME { $$ = get_rest_element(*$1, "");
+ delete $1;
}
;
@@ -229,5 +287,6 @@ parse_file(String s)
new_input(s);
yyparse();
delete_identifiers();
+ kill_lexer();
*mlog << "\n";
}
diff --git a/pcol.cc b/src/pcol.cc
index 1ae06519ac..902f57bab2 100644
--- a/pcol.cc
+++ b/src/pcol.cc
@@ -109,9 +109,10 @@ PCol::~PCol()
}
void
-PCol::add(const Item *i)
+PCol::add( Item *i)
{
its.bottom().add(i);
+ i->pcol_ = this;
used = true;
}
diff --git a/pscore.cc b/src/pscore.cc
index 3f6f289d26..8d7067760f 100644
--- a/pscore.cc
+++ b/src/pscore.cc
@@ -1,12 +1,14 @@
// utility functions for PScore
#include "debug.hh"
+#include "spanner.hh"
#include "paper.hh"
#include "molecule.hh"
#include "dimen.hh"
-#include "line.hh"
+#include "scoreline.hh"
#include "pscore.hh"
#include "tstream.hh"
+
void
PScore::clean_cols()
{
@@ -21,7 +23,8 @@ PScore::clean_cols()
void
PScore::add(PStaff *s)
{
- staffs.bottom().add(s);
+ assert(s->pscore_ == this);
+ staffs.bottom().add(s);
}
void
@@ -38,21 +41,41 @@ PScore::typeset_item(Item *i, PCol *c, PStaff *s, int breakstat)
typeset_item(i, c->postbreak, s);
return;
}
+
+
+ its.bottom().add(i);
+ s->add(i);
+ c->add(i);
+
+ /* first do this, because i->width() may follow the 0-pointer */
+ i->preprocess();
+
+
if (c->daddy && c == c->daddy->prebreak) { // makeshift.
+
Interval iv (i->width());
if (!iv.empty()) {
svec<Item*> col_its (select_items(s, c));
for (int j =0; j < col_its.sz(); j++)
- col_its[j]->output->translate(Offset(-iv.length(),0));
- i->output->translate (Offset(-iv.max, 0));
+ col_its[j]->translate(Offset(-iv.length(),0));
+ i->translate (Offset(-iv.max, 0));
}
}
- its.bottom().add(i);
- s->add(i);
- c->add(i);
- i->preprocess();
+
+}
+
+void
+PScore::typeset_spanner(Spanner*sp, PStaff*ps)
+{
+ sp->preprocess();
+ sp->pstaff_ = ps;
+ spanners.bottom().add(sp);
+ ps->spans.bottom().add(sp);
+ sp->left->starters.bottom().add(sp);
+ sp->right->stoppers.bottom().add(sp);
}
+
void
PScore::add_line(svec<const PCol *> curline, svec<Real> config)
{
@@ -80,6 +103,10 @@ PScore::get_spacing(PCol*l, PCol*r)
return ip;
}
+
+/*
+ return all breakable columns
+ */
svec<const PCol *>
PScore::find_breaks() const
{
@@ -87,7 +114,7 @@ PScore::find_breaks() const
for (PCursor<PCol *> c(cols); c.ok(); c++)
if (c->breakable())
retval.add(c);
-
+
return retval;
}
@@ -115,6 +142,7 @@ PScore::output(Tex_stream &ts)
}
}
+
svec<Item*>
PScore::select_items(PStaff*ps , PCol*pc)
{
@@ -142,7 +170,7 @@ void
PScore::print() const
{
#ifndef NPRINT
- mtor << "PScore { paper ";
+ mtor << "PScore { ";
paper_->print();
mtor << "\ncolumns: ";
for (PCursor<PCol*> cc(cols); cc.ok(); cc++)
@@ -168,6 +196,9 @@ PScore::preprocess()
void
PScore::postprocess()
{
+ for (PCursor<Spanner*> ic(spanners); ic.ok(); ic++) {
+ ic->process();
+ }
for (PCursor<Item*> ic(its); ic.ok(); ic++){
ic->postprocess();
}
diff --git a/pstaff.cc b/src/pstaff.cc
index 255fceeadd..255fceeadd 100644
--- a/pstaff.cc
+++ b/src/pstaff.cc
diff --git a/qlp.cc b/src/qlp.cc
index 3dd8e4227e..3dd8e4227e 100644
--- a/qlp.cc
+++ b/src/qlp.cc
diff --git a/qlpsolve.cc b/src/qlpsolve.cc
index 13bd30e89b..13bd30e89b 100644
--- a/qlpsolve.cc
+++ b/src/qlpsolve.cc
diff --git a/request.cc b/src/request.cc
index 35a9ae9718..9928f62bed 100644
--- a/request.cc
+++ b/src/request.cc
@@ -8,7 +8,9 @@ RCONS(Rest_req);
RCONS(Rhythmic_req);
RCONS(Stem_req);
RCONS(Note_req);
-
+RCONS(Span_req);
+RCONS(Slur_req);
+RCONS(Beam_req);
void
Request::print() const
@@ -18,13 +20,12 @@ Request::print() const
#endif
}
-Request::Request(Voice_element*v)
+Request::Request()
{
- elt = v;
+ elt = 0;
}
-Note_req::Note_req(Voice_element*v)
- : Rhythmic_req(v)
+Note_req::Note_req()
{
name = 'c';
octave = 0;
@@ -41,8 +42,7 @@ Note_req::height() const
return s + octave*7;
}
-Rhythmic_req::Rhythmic_req(Voice_element*v)
- :Request(v)
+Rhythmic_req::Rhythmic_req()
{
balltype = 1;
dots = 0;
@@ -65,11 +65,6 @@ Note_req::print() const
Rhythmic_req::print();
}
-Request::Request()
-{
- elt = 0;
-}
-
void
Rest_req::print() const
{
@@ -95,3 +90,12 @@ Rhythmic_req::duration() const {
return wholes( balltype,dots);
}
+Beam_req::Beam_req()
+{
+ nplet = 0;
+}
+
+Span_req::Span_req()
+{
+ spantype = NOSPAN;
+}
diff --git a/src/rest.cc b/src/rest.cc
new file mode 100644
index 0000000000..e448df37bd
--- /dev/null
+++ b/src/rest.cc
@@ -0,0 +1,47 @@
+#include "rest.hh"
+#include "dimen.hh"
+#include "debug.hh"
+#include "paper.hh"
+#include "lookup.hh"
+#include "molecule.hh"
+
+
+Rest::Rest(int t, int d)
+{
+ balltype = t;
+ dots = d;
+}
+
+void
+Rest::print()const
+{
+ mtor << "Rest "<<balltype<< "dots " << dots;
+ Item::print();
+}
+
+void
+Rest::preprocess()
+{
+ brew_molecole();
+}
+
+void
+Rest::brew_molecole()
+{
+ assert(pstaff_);
+ assert(!output);
+ Paperdef *p =paper();
+
+ Symbol s;
+ s = p->lookup_->rest(balltype);
+
+ Molecule *m = new Molecule(Atom(s));
+ if (dots) {
+ Symbol d =p->lookup_->dots(dots);
+ Molecule dm;
+ dm.add(Atom(d));
+ m->add_right(dm);
+ }
+ output = m;
+}
+
diff --git a/src/rhythmstaff.cc b/src/rhythmstaff.cc
new file mode 100644
index 0000000000..e584254bfd
--- /dev/null
+++ b/src/rhythmstaff.cc
@@ -0,0 +1,62 @@
+#include "molecule.hh"
+#include "notehead.hh"
+#include "stem.hh"
+#include "linestaff.hh"
+#include "rhythmstaff.hh"
+#include "paper.hh"
+#include "sccol.hh"
+#include "rest.hh"
+
+void
+Rhythmic_staff::set_output(PScore*ps)
+{
+ theline = new Linestaff(1,ps);
+ Simple_staff::set_output(ps);
+}
+
+Item *
+Rhythmic_staff::get_TYPESET_item(Command *com)
+{
+ Item *i = Simple_staff::get_TYPESET_item(com);
+ i->translate(Offset(0,
+ -score_->paper_->standard_height()/2));
+ return i;
+}
+
+Notehead*
+Rhythmic_staff::get_notehead(Note_req *rq)
+{
+ int b = rq->rhythmic()->balltype;
+ int d = rq->rhythmic()->dots;
+
+ Notehead *n =new Notehead(1);
+ n->balltype = b;
+ n->dots =d;
+ n->position = 0;
+ return n;
+}
+
+Stem *
+Rhythmic_staff::get_stem(Stem_req*rq)
+{
+ Stem * s = new Stem(0);
+ s->flag = rq->stem_number;
+ return s;
+}
+
+/*
+ creation
+ */
+Staff *
+get_new_rhythmstaff()
+{
+ return new Rhythmic_staff;
+}
+
+
+
+Rhythmic_staff*
+Rhythmic_staff::clone() const
+{
+ return new Rhythmic_staff(*this);
+}
diff --git a/sccol.cc b/src/sccol.cc
index 1dfc8f2176..1dfc8f2176 100644
--- a/sccol.cc
+++ b/src/sccol.cc
diff --git a/scommands.cc b/src/scommands.cc
index 8f86ff6fad..7b8c8ed9c5 100644
--- a/scommands.cc
+++ b/src/scommands.cc
@@ -69,6 +69,7 @@ Score_commands::set_breakable(Real when)
add_seq(seq);
}
+
bool
Score_commands::is_breakable(Real w)
{
@@ -94,10 +95,10 @@ Score_commands::insert_between(Command victim, PCursor<Command*> firstc,
c++;
}
last.insert(new Command(victim));
-
}
+
void
-Score_commands::add_command_to_break(Command pre, Command mid,Command post)
+Score_commands::add_command_to_break(Command pre, Command mid, Command post)
{
Real w = pre.when;
PCursor<Command*> c ( first(w)), f(c), l(c);
@@ -216,6 +217,9 @@ Score_commands::print() const
}
}
+/*
+ TODO
+ */
Score_commands*
Score_commands::parse(Real l) const
{
@@ -238,13 +242,14 @@ Score_commands::parse(Real l) const
for (PCursor<Command*> cc(*this); cc.ok() && cc->when <= l; cc++) {
assert (cc->code==INTERPRET);
if (cc->args[0] == "METER") {
- beats_per_meas=cc->args[1].value();
- int one_beat =cc->args[2].value ();
+ beats_per_meas = cc->args[1].value();
+ int one_beat = cc->args[2].value();
measlen = beats_per_meas/Real(one_beat);
- nc->process_add(*get_meter_command(wholes,beats_per_meas, one_beat));
+ nc->process_add(*get_meter_command(wholes, beats_per_meas, one_beat));
}
if (cc->args[0] == "SKIP") {
- stoppos = wholes + cc->args[1].value() * measlen + cc->args[2].fvalue();
+ stoppos = wholes + cc->args[1].value() * measlen +
+ cc->args[2].fvalue();
wholes += (measlen-inbar); // skip at least 1 measure
barcount++;
while (wholes <= stoppos) {
diff --git a/score.cc b/src/score.cc
index 1df13365f2..1df13365f2 100644
--- a/score.cc
+++ b/src/score.cc
diff --git a/src/scoreline.cc b/src/scoreline.cc
new file mode 100644
index 0000000000..7e40c6a76a
--- /dev/null
+++ b/src/scoreline.cc
@@ -0,0 +1,43 @@
+#include "scoreline.hh"
+#include "staffline.hh"
+#include "dimen.hh"
+#include "spanner.hh"
+#include "symbol.hh"
+#include "paper.hh"
+#include "pcol.hh"
+#include "pscore.hh"
+
+
+String
+Line_of_score::TeXstring() const
+{
+ String s("\\vbox{%<- line of score\n");
+ for (PCursor<Line_of_staff*> sc(staffs); sc.ok(); sc++){
+ s += sc->TeXstring();
+ if ((sc+1).ok())
+ s+= "\\interstaffline\n";
+ }
+ s += "}";
+ return s;
+}
+
+
+Line_of_score::Line_of_score(svec<const PCol *> sv,
+ const PScore *ps)
+{
+ score = ps;
+ for (int i=0; i< sv.sz(); i++) {
+ PCol *p=(PCol *) sv[i];
+ cols.bottom().add(p);
+ p->line=this;
+ }
+
+ for (PCursor<PStaff*> sc(score->staffs); sc.ok(); sc++)
+ staffs.bottom().add(new Line_of_staff(this, sc));
+}
+/* construct a line with the named columns. Make the line field
+ in each column point to this
+
+ #sv# isn't really const!!
+ */
+
diff --git a/scores.cc b/src/scores.cc
index 04efd6e4b1..04efd6e4b1 100644
--- a/scores.cc
+++ b/src/scores.cc
diff --git a/src/simpleprint.cc b/src/simpleprint.cc
new file mode 100644
index 0000000000..395396e22b
--- /dev/null
+++ b/src/simpleprint.cc
@@ -0,0 +1,55 @@
+#include "lookup.hh"
+#include "request.hh"
+#include "beam.hh"
+#include "pscore.hh"
+#include "paper.hh"
+#include "simplestaff.hh"
+#include "molecule.hh"
+#include "sccol.hh"
+#include "stem.hh"
+#include "notehead.hh"
+#include "rest.hh"
+#include "debug.hh"
+#include "bar.hh"
+#include "meter.hh"
+
+Item *
+Simple_staff::get_TYPESET_item(Command *com)
+{
+ Item *s;
+ if (com -> args[0] == "BAR" ) {
+ s = new Bar(com->args[1]);
+ } else if (com->args[0] == "METER") {
+ svec<String> arg( com->args);
+ arg.del(0);
+ s = new Meter(arg);
+ } else
+ assert(false);
+
+ return s;
+}
+
+void
+Simple_column::typeset_item(Item *i, int breakst)
+{
+ assert(i);
+ // ugh
+ staff_->pscore_->typeset_item(i, score_column->pcol,
+ staff_->theline,breakst);
+}
+
+void
+Simple_staff::set_output(PScore* ps )
+{
+ pscore_ = ps;
+ pscore_->add(theline);
+}
+
+
+Rest*
+Simple_staff::get_rest(Rest_req*rq)
+{
+ int b = rq->rhythmic()->balltype;
+ int d = rq->rhythmic()->dots;
+ return new Rest(b, d);
+}
diff --git a/src/simplestaff.cc b/src/simplestaff.cc
new file mode 100644
index 0000000000..5150d5478a
--- /dev/null
+++ b/src/simplestaff.cc
@@ -0,0 +1,66 @@
+#include "request.hh"
+#include "swalker.hh"
+#include "debug.hh"
+#include "staff.hh"
+#include "command.hh"
+#include "simplestaff.hh"
+#include "sccol.hh"
+
+
+
+
+Simple_column::Simple_column(Score_column*s, Simple_staff *rs)
+ : Staff_column(s)
+{
+ stem_ = 0;
+ staff_ = rs;
+ beam_ = 0;
+}
+
+Simple_staff::Simple_staff()
+{
+ theline = 0;
+}
+
+/**
+ accept:
+
+ BREAK: all
+ TYPESET: bar, meter,
+
+ */
+
+
+
+void
+Simple_column::process_requests()
+{
+ for (int i = 0 ; i < v_elts.sz(); i ++)
+ for (PCursor<Request *> rqc(v_elts[i]->reqs); rqc.ok(); rqc++) {
+ Request *rq= rqc;
+ if (rq->rhythmic()){
+ notes.add( rq->rhythmic());
+ }
+ if (rq->stem()) {
+ stem_ = rq->stem();
+ }
+
+ if (rq->beam()) {
+ beam_ = rq->beam();
+ }
+ }
+}
+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()->process_requests();// TODO
+ sc.process();
+ }
+}
+
diff --git a/src/simplewalker.cc b/src/simplewalker.cc
new file mode 100644
index 0000000000..ad9019ac33
--- /dev/null
+++ b/src/simplewalker.cc
@@ -0,0 +1,106 @@
+#include "request.hh"
+#include "beam.hh"
+#include "pscore.hh"
+#include "simplestaff.hh"
+#include "sccol.hh"
+#include "stem.hh"
+#include "notehead.hh"
+#include "rest.hh"
+#include "debug.hh"
+
+void
+Simple_walker::process_command(Command*com)
+{
+ switch (com->code){
+ case BREAK_PRE:
+ case BREAK_MIDDLE:
+ case BREAK_POST:
+ case BREAK_END:
+ (*this)->score_column->set_breakable();
+ break_status = com->code- BREAK_PRE;
+ break;
+ case INTERPRET:
+ break;
+
+ case TYPESET:
+ {
+ Item* i = staff()->get_TYPESET_item(com);
+ col()->typeset_item(i, break_status);
+ }
+ break;
+
+ default :
+ break;
+ }
+}
+
+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");
+ beam_ = new Beam;
+ }
+
+ if (c->stem_) {
+ stem_ = s->get_stem(c->stem_->stem());
+ c->typeset_item(stem_);
+ }
+
+ for (int i = 0; i < c->notes.sz(); i ++) {
+ Rhythmic_req*rq = c->notes[i];
+ if (rq->note()) {
+ Notehead*n = s->get_notehead(rq->note());
+ stem_->add(n);
+ noteheads.add(n);
+ }
+
+ if (rq->rest()) {
+ c->typeset_item( s->get_rest(rq->rest()) );
+ }
+ }
+
+
+ if (beam_) {
+ beam_->add(stem_);
+ }
+
+ if (c->beam_&& c->beam_->spantype == Span_req::STOP) {
+ pscore_->typeset_spanner(beam_, s->theline);
+ beam_ = 0;
+ }
+ for (int i = 0; i < noteheads.sz(); i++) {
+ c->typeset_item(noteheads[i]);
+ }
+ noteheads.set_size(0);
+
+ if (stem_) {
+ stem_ = 0;
+ }
+}
+
+Simple_walker::Simple_walker(Simple_staff*s)
+ : Staff_walker(s, s->theline->pscore_)
+{
+ stem_ = 0;
+ beam_ =0;
+}
+
+
+
+Simple_staff*
+Simple_walker::staff()
+{
+ return (Simple_staff*) staff_;
+}
+
+Simple_column*
+Simple_walker::col()
+{
+ return (Simple_column*) *(*this);
+}
+
+
diff --git a/src/spanner.cc b/src/spanner.cc
new file mode 100644
index 0000000000..16c3ff19cb
--- /dev/null
+++ b/src/spanner.cc
@@ -0,0 +1,54 @@
+#include "pstaff.hh"
+#include "debug.hh"
+#include "pscore.hh"
+#include "spanner.hh"
+#include "symbol.hh"
+#include "molecule.hh"
+#include "pcol.hh"
+
+String
+Spanner::TeXstring() const
+{
+
+ assert(output);
+ return output->TeXstring();
+}
+
+Spanner::Spanner()
+{
+ pstaff_=0;
+ left = right = 0;
+}
+
+void
+Spanner::process()
+{
+}
+
+void
+Spanner::preprocess()
+{
+}
+
+Interval
+Spanner::width()const
+{
+ return Interval(0,right->hpos - left->hpos);
+}
+
+Paperdef*
+Spanner::paper()const
+{
+ assert(pstaff_);
+ return pstaff_->pscore_->paper_;
+}
+void
+Spanner::print()const
+{
+#ifndef NPRINT
+ mtor << "Spanner { Output ";
+ output->print();
+
+ mtor << "}\n";
+#endif
+}
diff --git a/staff.cc b/src/staff.cc
index 8b5c0782c5..3a32801b2f 100644
--- a/staff.cc
+++ b/src/staff.cc
@@ -1,4 +1,5 @@
#include "staff.hh"
+#include "swalker.hh"
#include "stcol.hh"
#include "sccol.hh"
#include "debug.hh"
@@ -125,11 +126,7 @@ Staff::process()
{
setup_staffcols();
OK();
- for (PCursor<Staff_column*> sc(cols); sc.ok(); sc++) {
- sc->process_commands();
- sc->process_requests();
- }
- grant_requests();
+ walk();
}
void
diff --git a/line.cc b/src/staffline.cc
index 293214dc30..c83e904bc6 100644
--- a/line.cc
+++ b/src/staffline.cc
@@ -1,4 +1,5 @@
-#include "line.hh"
+#include "staffline.hh"
+#include "scoreline.hh"
#include "dimen.hh"
#include "spanner.hh"
#include "symbol.hh"
@@ -8,8 +9,7 @@
static String
make_vbox(Interval i)
-{
-
+{
String s("\\vbox to ");
s += print_dimen(i.length());
s += "{\\vskip "+print_dimen(i.max)+" ";
@@ -57,19 +57,22 @@ Line_of_staff::TeXstring() const
Line_of_staff::Line_of_staff(Line_of_score * sc, PStaff*st)
{
-
scor=sc;
pstaff_=st;
+#if 0
+ const PCol *linestart = sc->cols.top();
+ const PCol *linestop = sc->cols.bottom();
- const PCol *linestart= sc->cols.top();
- const PCol *linestop=sc->cols.bottom();
-
for (PCursor<const Spanner*> sp(pstaff_->spans); sp.ok(); sp++) {
const PCol *brokenstart = &MAX(*linestart, *sp->left);
const PCol *brokenstop = &MIN(*linestop, *sp->right);
+// if (*brokenstop < *brokenstart)
+ brokenspans.bottom().add(sp->broken_at(0,0));
+ }
+#endif
+ for (PCursor<const Spanner*> sp(pstaff_->spans); sp.ok(); sp++) {
- if (*brokenstop < *brokenstart)
- brokenspans.bottom().add(sp->broken_at(brokenstop, brokenstart));
+ brokenspans.bottom().add(sp->broken_at(0,0));
}
}
@@ -93,45 +96,12 @@ Line_of_staff::height() const
// spanners.
for (PCursor<const Spanner *> sc(cc->starters); sc.ok(); sc++)
- if (sc->pstaff_ == pstaff_)
- assert(false);
+ if (sc->pstaff_ == pstaff_) {
+ y.unite(sc->height());
+ }
}
}
return y;
}
-/****************************************************************/
-String
-Line_of_score::TeXstring() const
-{
- String s("\\vbox{%<- line of score\n");
- for (PCursor<Line_of_staff*> sc(staffs); sc.ok(); sc++){
- s += sc->TeXstring();
- if ((sc+1).ok())
- s+= "\\interstaffline\n";
- }
- s += "}";
- return s;
-}
-
-/// testing this entry
-Line_of_score::Line_of_score(svec<const PCol *> sv,
- const PScore *ps)
-{
- score = ps;
- for (int i=0; i< sv.sz(); i++) {
- PCol *p=(PCol *) sv[i];
- cols.bottom().add(p);
- p->line=this;
- }
-
- for (PCursor<PStaff*> sc(score->staffs); sc.ok(); sc++)
- staffs.bottom().add(new Line_of_staff(this, sc));
-}
-/** construct a line with the named columns. Make the line field
- in each column point to this
-
- #sv# isn't really const!!
- */
-
diff --git a/stcol.cc b/src/stcol.cc
index 799daed316..799daed316 100644
--- a/stcol.cc
+++ b/src/stcol.cc
diff --git a/src/stem.cc b/src/stem.cc
new file mode 100644
index 0000000000..fdb47f9755
--- /dev/null
+++ b/src/stem.cc
@@ -0,0 +1,156 @@
+#include "stem.hh"
+#include "dimen.hh"
+#include "debug.hh"
+#include "paper.hh"
+#include "notehead.hh"
+#include "lookup.hh"
+#include "molecule.hh"
+#include "pcol.hh"
+
+const int STEMLEN=7;
+static int
+ABS(int i) {
+ return (i < 0)?-i:i;
+}
+
+
+Stem::Stem(int c)
+{
+ minnote = 1000; // invalid values
+ maxnote = -1000;
+ bot = top = 0;
+ flag = 4;
+ dir =0;
+ staff_center=c;
+ stemlen=0;
+ print_flag=true;
+ stem_xoffset=0;
+}
+
+
+void
+Stem::set_stemend(Real se)
+{
+ // todo: margins
+ assert((dir > 0 && se >= maxnote) || (se <= minnote && dir <0));
+
+ top = (dir < 0) ? maxnote : se;
+ bot = (dir < 0) ? se : minnote;
+ flag = dir*ABS(flag);
+}
+
+void
+Stem::add(Notehead *n)
+{
+ if (n->balltype == 1)
+ return;
+ int p = n->position;
+ if ( p < minnote)
+ minnote = p;
+ if ( p> maxnote)
+ maxnote = p;
+}
+void
+Stem::print()const
+{
+ mtor << "Stem minmax=["<< minnote<<","<<maxnote<<"], flag: "<<flag;
+ Item::print();
+}
+
+void
+Stem::set_default_dir()
+{
+ Real mean = (minnote+maxnote)/2;
+ dir = (mean > staff_center) ? -1: 1;
+}
+
+void
+Stem::set_default_stemlen()
+{
+ if (!dir)
+ set_default_dir();
+
+ int stafftop = 2*staff_center;
+ stemlen = STEMLEN + (maxnote - minnote);
+
+ // uhh... how about non 5-line staffs?
+ if (maxnote < -2 && dir == 1){
+ int t = staff_center - staff_center/2;
+ stemlen = t - minnote +2;
+ } else if (minnote > stafftop + 2 && dir == -1) {
+ int t = staff_center + staff_center/2;
+ stemlen = maxnote -t +2;
+ }
+
+ assert(stemlen);
+}
+
+
+void
+Stem::set_default_extents()
+{
+ assert(minnote<=maxnote);
+
+ if (!stemlen)
+ set_default_stemlen();
+
+ set_stemend((dir< 0) ? maxnote-stemlen: minnote +stemlen);
+ if (dir > 0){
+ stem_xoffset = paper()->note_width();
+ }
+}
+
+void
+Stem::postprocess()
+{
+ set_default_extents();
+ brew_molecole();
+}
+
+Interval
+Stem::width()const
+{
+ if (!print_flag || ABS(flag) <= 4)
+ return Interval(0,0); // TODO!
+ Paperdef*p= paper();
+ return p->lookup_->flag(flag).dim.x;
+}
+
+void
+Stem::brew_molecole()
+{
+ assert(pstaff_);
+ assert(bot!=top);
+ assert(!output);
+
+ Paperdef *p =paper();
+ Parametric_symbol *stem = p->lookup_->stem();
+
+ Real dy = p->interline()/2;
+ String y1 =print_dimen( dy * bot);
+ String y2 = print_dimen(dy * top);
+ Symbol ss =stem->eval(y1,y2);
+ delete stem;
+
+ output = new Molecule(Atom(ss));
+
+ if (print_flag&&ABS(flag) > 4){
+ Symbol fl = p->lookup_->flag(flag);
+ Molecule m(fl);
+ if (flag < -4){
+ output->add_bot(m);
+ } else if (flag > 4) {
+ output->add_top(m);
+ } else
+ assert(false);
+ }
+
+ output->translate(Offset(stem_xoffset,0));
+
+}
+
+Real
+Stem::hpos()const
+{
+ return pcol_->hpos + stem_xoffset;
+}
diff --git a/src/swalker.cc b/src/swalker.cc
new file mode 100644
index 0000000000..db48fd1f82
--- /dev/null
+++ b/src/swalker.cc
@@ -0,0 +1,32 @@
+#include "request.hh"
+#include "swalker.hh"
+#include "stcol.hh"
+
+Staff_walker::~Staff_walker() {}
+
+Staff_walker::Staff_walker(Staff * s, PScore*ps )
+ : PCursor<Staff_column*> (s->cols)
+{
+ staff_ = s;
+ pscore_ = ps;
+ break_status = BREAK_END - BREAK_PRE;
+}
+
+Real
+Staff_walker::when() const
+{
+ return (* (PCursor<Staff_column*> *) this)->when();
+}
+
+void
+Staff_walker::process()
+{
+ break_status = BREAK_END - BREAK_PRE;
+
+ for (int i = 0 ; i < (*this)->s_commands.sz(); i++) {
+ process_command((*this)->s_commands[i]);
+ }
+
+ process_requests();
+}
+
diff --git a/symbol.cc b/src/symbol.cc
index 907f1d7282..907f1d7282 100644
--- a/symbol.cc
+++ b/src/symbol.cc
diff --git a/symtable.cc b/src/symtable.cc
index e963b64d12..a28d14670c 100644
--- a/symtable.cc
+++ b/src/symtable.cc
@@ -39,7 +39,9 @@ Symtables::read(Text_db &symini)
if (r[0] == "end")
break;
- assert(r.sz() == 6);
+ if (r.sz() != 6)
+ error("Not enough fields in symbol init");
+
int i=0;
String id=r[i++];
String tex=r[i++];
diff --git a/table.cc b/src/table.cc
index 58d1c425e1..1f302259e9 100644
--- a/table.cc
+++ b/src/table.cc
@@ -14,6 +14,7 @@ static Keyword_ent the_key_tab[]={
"bar", BAR,
"output", OUTPUT,
"cm", CM,
+ "start", START_T,
"pt", PT,
"in", IN,
"mm", MM,
@@ -22,9 +23,11 @@ static Keyword_ent the_key_tab[]={
"meter", METER,
"unitspace", UNITSPACE,
"skip", SKIP,
+ "octave", OCTAVECOMMAND,
"commands", COMMANDS,
"staff", STAFF,
"geometric", GEOMETRIC,
+ "duration", DURATIONCOMMAND,
0,0
} ;
diff --git a/template1.cc b/src/template1.cc
index ece4e2ff18..fd2431130e 100644
--- a/template1.cc
+++ b/src/template1.cc
@@ -1,4 +1,3 @@
-#include "line.hh"
#include "plist.hh"
#include "pcol.hh"
@@ -6,6 +5,8 @@
#include "request.hh"
#include "command.hh"
#include "spanner.hh"
+#include "scoreline.hh"
+#include "staffline.hh"
#include "list.cc"
#include "plist.cc"
@@ -13,6 +14,7 @@
#define PLC_instantiate(a) PL_instantiate(a); PL_instantiate(const a)
+L_instantiate(Stem*);
PLC_instantiate(Line_of_score);
PLC_instantiate(Line_of_staff);
PLC_instantiate(Item);
diff --git a/template2.cc b/src/template2.cc
index 5e0431c42a..01695c863f 100644
--- a/template2.cc
+++ b/src/template2.cc
@@ -1,4 +1,4 @@
-#include "line.hh"
+
#include "symbol.hh"
#include "voice.hh"
diff --git a/template3.cc b/src/template3.cc
index 92921bb29a..92921bb29a 100644
--- a/template3.cc
+++ b/src/template3.cc
diff --git a/tex.cc b/src/tex.cc
index ae9dc1b5f3..ae9dc1b5f3 100644
--- a/tex.cc
+++ b/src/tex.cc
diff --git a/src/texbeam.cc b/src/texbeam.cc
new file mode 100644
index 0000000000..e21efba0be
--- /dev/null
+++ b/src/texbeam.cc
@@ -0,0 +1,99 @@
+/*
+
+ Code to generate beams for TeX
+
+ */
+
+ #include <math.h>
+#include "symbol.hh"
+#include "molecule.hh"
+#include "tex.hh"
+#include "symtable.hh"
+#include "dimen.hh"
+#include "lookup.hh"
+
+Symbol
+Lookup::beam_element(int sidx, int widx, Real slope)
+{
+ Symbol bs=(*symtables_)("beamslopes")->lookup("slope");
+
+ svec<String> args;
+ args.add(sidx);
+ args.add(widx);
+ bs.tex = substitute_args(bs.tex,args);
+ int w = 2 << widx;
+ Real width = convert_dimen(w,"pt");
+ bs.dim.x = Interval(0,width);
+ bs.dim.y = Interval(0,width*slope);
+ return bs;
+}
+
+// ugh.. hard wired tex-code.
+static int
+slope_index(Real &s)
+{
+ assert(ABS(s) < 0.45);
+ int i = int(rint(s * 20.0));
+
+ s = i/20.0;
+ if (s>0)
+ return 6*i +122;
+ else
+ return -6 * i+ 188;
+}
+
+Symbol
+Lookup::rule_symbol(Real height, Real width)
+{
+ Symbol bs=(*symtables_)("beamslopes")->lookup("horizontal");
+ svec<String> args;
+ args.add(print_dimen(height));
+ args.add(print_dimen(width));
+ bs.tex = substitute_args(bs.tex,args);
+ bs.dim.x = Interval(0,width);
+ bs.dim.y = Interval(0,height);
+ return bs;
+}
+
+Symbol
+Lookup::beam(Real &slope, Real width)
+{
+ int sidx = slope_index(slope);
+ if (!slope)
+ return rule_symbol(convert_dimen(2,"pt"), width);
+
+ Real w = width;
+ Real elemwidth = convert_dimen(64,"pt");
+ int widx = 5;
+
+ Molecule m;
+ Real dy=0;
+ Real minwid =convert_dimen(2,"pt");
+ assert(w > minwid);
+ while (w > minwid) {
+ while (elemwidth > w) {
+ widx --;
+ elemwidth /= 2.0;
+ }
+
+ Atom a(beam_element(sidx, widx, slope));
+ a.translate(Offset(0, dy));
+ m.add_right(a);
+ dy += elemwidth*slope;
+ w -= elemwidth;
+ }
+
+ widx = 0;
+ Atom a(beam_element(sidx, widx, slope));
+ a.translate(Offset(width -minwid, (width-minwid) * slope));
+ m.add(a);
+
+ Symbol ret;
+ ret.tex = m.TeXstring();
+ ret.dim.y = Interval(0,width*slope);
+ ret.dim.x = Interval(0,width);
+
+ return ret;
+}
+
+
diff --git a/tstream.cc b/src/tstream.cc
index 05e2e9c93e..05e2e9c93e 100644
--- a/tstream.cc
+++ b/src/tstream.cc
diff --git a/version.cc b/src/version.cc
index 401273b6b1..401273b6b1 100644
--- a/version.cc
+++ b/src/version.cc
diff --git a/voice.cc b/src/voice.cc
index 379cbae23a..14883e1499 100644
--- a/voice.cc
+++ b/src/voice.cc
@@ -56,6 +56,7 @@ Voice_element::add(Request*r)
assert (!duration);
duration = r->duration();
}
+ r->elt = this;
reqs.bottom().add(r);
}
diff --git a/warn.cc b/src/warn.cc
index 426173ee0c..426173ee0c 100644
--- a/warn.cc
+++ b/src/warn.cc
diff --git a/stem.cc b/stem.cc
deleted file mode 100644
index fd6634c6bf..0000000000
--- a/stem.cc
+++ /dev/null
@@ -1,99 +0,0 @@
-#include "stem.hh"
-#include "dimen.hh"
-#include "debug.hh"
-#include "pstaff.hh"
-#include "pscore.hh"
-#include "paper.hh"
-#include "lookupsyms.hh"
-#include "molecule.hh"
-
-const int STEMLEN=7;
-
-Stem::Stem(int c)
-{
- minnote = maxnote = 0;
- bot = top = 0;
- flag = 4;
- staff_center=c;
-}
-
-void
-Stem::print()const
-{
- mtor << "Stem minmax=["<< minnote<<","<<maxnote<<"], flag: "<<flag;
- Item::print();
-}
-
-void
-Stem::calculate()
-{
- assert(minnote<=maxnote);
- int stafftop = 2*staff_center;
-
- if (maxnote < -2){
- bot = minnote;
- top = staff_center - staff_center/2; // uhh... how about non 5-line staffs?
-
- }else if (minnote > stafftop + 2) {
- top = maxnote;
- bot = staff_center + staff_center/2;
- flag = -flag;
- }else {
- Real mean = (minnote+maxnote)/2;
-
- top = (mean > staff_center) ? maxnote : maxnote+STEMLEN;
- bot = (mean > staff_center) ? minnote-STEMLEN : minnote;
- flag = (mean > staff_center) ? -flag : flag;
- }
-}
-
-void
-Stem::postprocess()
-{
- calculate();
- brew_molecole();
-}
-
-Interval
-Stem::width()const
-{
- if (ABS(flag) <= 4)
- return Interval(0,0); // TODO!
- Paperdef*p= pstaff_->pscore_->paper_;
- return p->lookup_->flag(flag).dim.x;
-}
-
-void
-Stem::brew_molecole()
-{
- assert(pstaff_);
- assert(bot!=top);
- assert(!output);
-
- Paperdef *p = pstaff_->pscore_->paper_;
- Parametric_symbol *stem = p->lookup_->stem();
-
- Real dy = p->interline()/2;
- String y1 =print_dimen( dy * bot);
- String y2 = print_dimen(dy * top);
- Symbol ss =stem->eval(y1,y2);
- delete stem;
-
- output = new Molecule(Atom(ss));
-
- if (ABS(flag) > 4){
- Symbol fl = p->lookup_->flag(flag);
- Molecule m(fl);
- if (flag < -4){
- output->add_bot(m);
- } else if (flag > 4) {
- output->add_top(m);
- } else
- assert(false);
- }
-
- if (flag > 0){
- Real dx = pstaff_->pscore_->paper_->note_width(); // ugh
- output->translate(Offset(dx,0));
- }
-}
diff --git a/suzan.ly b/suzan.ly
deleted file mode 100644
index 59eb0c7489..0000000000
--- a/suzan.ly
+++ /dev/null
@@ -1,8 +0,0 @@
-% testje
-
-score{
- rhythmstaff {
- voice { $ c2 c2 c4. c8 c4 c4 c4 c4 c4 c4 c2 c2$ }
- }
- commands { meter 2 4 skip 2:0 meter 4 4 skip 2:0}
-}
diff --git a/symbol.ini b/symbol.ini
index ea303b04f1..e1e2f3f2a0 100644
--- a/symbol.ini
+++ b/symbol.ini
@@ -14,8 +14,8 @@ table balls
end
table streepjes
- toplines \toplines{%} -6pt 6pt 0pt 0pt
- botlines \botlines{%} -6pt 6pt 0pt 0pt
+ toplines \toplines{%} -7pt 7pt 0pt 0pt
+ botlines \botlines{%} -7pt 7pt 0pt 0pt
end
table bars
@@ -56,9 +56,14 @@ table flags
8 \eigthflag 0pt 5pt 0pt 0pt
16 \sixteenthflag 0pt 5pt 0pt 0pt
32 \thirtysecondflag 0pt 5pt 0pt 0pt
- -8 \ieigthflag -5pt 0pt 0pt 0pt
- -16 \isixteenthflag -5pt 0pt 0pt 0pt
- -32 \ithirtysecondflag -5pt 0pt 0pt 0pt
+ -8 \deigthflag 0pt 5pt 0pt 0pt
+ -16 \dsixteenthflag 0pt 5pt 0pt 0pt
+ -32 \dthirtysecondflag 0pt 5pt 0pt 0pt
+end
+
+table beamslopes
+ slope \beamslope{%}{%} 0pt 0pt 0pt 0pt
+ horizontal \rulesym{%}{%} 0pt 0pt 0pt 0pt
end
end # symboltables \ No newline at end of file