]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 0.0.20 release/0.0.20
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 23 Dec 1996 10:29:38 +0000 (11:29 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 23 Dec 1996 10:29:38 +0000 (11:29 +0100)
117 files changed:
.dstreamrc
Documentation/CodingStyle [deleted file]
Documentation/CodingStyle.pod [new file with mode: 0644]
Documentation/Makefile
Documentation/README.pod [new file with mode: 0644]
Documentation/algorithms [deleted file]
Documentation/breaking [deleted file]
Documentation/commands [deleted file]
Documentation/design [deleted file]
Documentation/inputformat [deleted file]
Documentation/lilygut.pod [new file with mode: 0644]
Documentation/lilyinput.pod [new file with mode: 0644]
Documentation/literature [deleted file]
Documentation/pointers [deleted file]
Documentation/slurfont [deleted file]
Makefile
NEWS
README
Sources.make
Variables.make
cadenza.ly [new file with mode: 0644]
flower/Sources.make
flower/Variables.make
flower/dstream.cc
flower/interval.tcc
flower/path.cc [new file with mode: 0644]
flower/path.hh [new file with mode: 0644]
flower/pcursor.hh
flower/plist.hh
flower/plist.tcc
flower/scalar.cc
flower/scalar.hh
flower/smat.cc
flower/sstack.hh
hdr/beam.hh
hdr/boxes.hh
hdr/command.hh
hdr/directionalspanner.hh [new file with mode: 0644]
hdr/grouping.hh
hdr/inputcommand.hh
hdr/inputcommands.hh
hdr/inputmusic.hh
hdr/leastsquares.hh
hdr/linespace.hh
hdr/lookup.hh
hdr/melodicstaff.hh
hdr/misc.hh
hdr/moment.hh
hdr/offset.hh [new file with mode: 0644]
hdr/paper.hh
hdr/proto.hh
hdr/request.hh
hdr/rhythmstaff.hh
hdr/sccol.hh
hdr/score.hh
hdr/simplestaff.hh
hdr/simplewalker.hh
hdr/slur.hh
hdr/spanner.hh
hdr/staff.hh
hdr/staffcommands.hh
hdr/stcol.hh
hdr/stem.hh
hdr/swalker.hh
hdr/textspanner.hh [new file with mode: 0644]
hdr/timedescription.hh [new file with mode: 0644]
hdr/voice.hh
init/Makefile [new file with mode: 0644]
init/dutch.ini [new file with mode: 0644]
init/english.ini [new file with mode: 0644]
init/table_sixteen.ini [new file with mode: 0644]
init/table_twenty.ini [new file with mode: 0644]
lilyponddefs.tex
maartje.ly
src/beam.cc
src/boxes.cc
src/calcideal.cc
src/directionalspanner.cc [new file with mode: 0644]
src/grouping.cc
src/inputcommand.cc
src/inputcommands.cc
src/inputmusic.cc
src/lexer.l
src/linespace.cc
src/lookup.cc
src/melodicstaff.cc
src/misc.cc
src/molecule.cc
src/moment.cc [deleted file]
src/mylexer.cc
src/notehead.cc
src/paper.cc
src/parser.y
src/pcol.cc
src/pscore.cc
src/qlpsolve.cc
src/request.cc
src/rhythmstaff.cc
src/sccol.cc
src/score.cc
src/simpleprint.cc
src/simplewalker.cc
src/slur.cc
src/spanner.cc
src/staff.cc
src/staffcommands.cc
src/staffline.cc
src/stcol.cc
src/stem.cc
src/swalker.cc
src/template5.cc [new file with mode: 0644]
src/texbeam.cc
src/texslur.cc
src/textspanner.cc [new file with mode: 0644]
src/timedescription.cc [new file with mode: 0644]
src/voice.cc
symbol.ini

index 1d35c0489b9ad46b6d5c417542a1e08c7dc37676..0fb28ce927ac4651c7b19b4450dd7bc6ea1b258c 100644 (file)
@@ -1,6 +1,6 @@
 # class name           silence?
 
-My_flex_lexer          1
+My_flex_lexer          0
 yyFlexLexer            1
 PCol                   1
 Score_column           1
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
deleted file mode 100644 (file)
index 0669c20..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
--*-text-*-
-
-CODING STANDARDS:
-
-Functions and methods do not return errorcodes, but use assert for
-checking status. 
-
-INDENTATION, in emacs:
-
-
-(add-hook 'c-mode-hook
-         '(lambda ()(setq c-basic-offset 4)))
-
-
-(add-hook 'c++-mode-hook
-         '(lambda() (c-set-style "Stroustrup")
-            )
-         )
-
-
-CLASSES and TYPES:
-
-       This_is_a_class
-       AClass_name     (for Abbreviation_class_name)
-
-DATA MEMBERS
-
-       Class::member
-
-if the member's name resembles its type, then I use
-
-       class Fubular { ..}
-
-       Class::fubular_
-
-COMMENTS
-
-/// short description
-class Class {
-       ///
-       Data data_member_;
-       /**
-               ..
-       */
-
-       /****************/
-
-       /// short memo
-       member();
-       /**
-               long doco of member()
-       */
-};
-/**
-       Class documentation.
-*/
-
-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  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/CodingStyle.pod b/Documentation/CodingStyle.pod
new file mode 100644 (file)
index 0000000..a0ffcaf
--- /dev/null
@@ -0,0 +1,99 @@
+=head1 NAME
+
+CodingStyle - standards while programming for LilyPond
+
+=head1 DESCRIPTION
+
+Please use these standards while doing programming for LilyPond
+
+
+
+Functions and methods do not return errorcodes, but use assert for
+checking status. 
+
+=head2 INDENTATION
+
+in emacs:
+
+
+       (add-hook 'c-mode-hook
+                 '(lambda ()(setq c-basic-offset 4)))
+
+
+       (add-hook 'c++-mode-hook
+                 '(lambda() (c-set-style "Stroustrup")
+                    )
+                 )
+
+
+=head2 CLASSES and TYPES:
+
+       This_is_a_class
+       AClass_name     (for Abbreviation_class_name)
+
+=head2 DATA MEMBERS
+
+       Class::member
+
+if the member's name resembles its type, then I use
+
+       class Fubular { ..}
+
+       Class::fubular_
+
+=head2 COMMENTS
+
+       /// short description
+       class Class {
+               ///
+               Data data_member_;
+               /**
+                       ..
+               */
+
+               /****************/
+
+               /// short memo
+               member();
+               /**
+                       long doco of member()
+               */
+       };
+       /**
+               Class documentation.
+       */
+
+Unfortunately most of the code isn't really documented that good.
+
+=head2 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  the "brains" for PStaff
+
+NB: in PCursor (which is part of the library) P stands for PointerCursor
+
+
+=head2 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( .. )
+
index 7aa470764b3bc1d677724b30d97caa32c1d8d275..5eb21d58ce3c3c1c88e10fc91bf3b1b05f696a64 100644 (file)
@@ -1,6 +1,23 @@
+PODS=README.pod CodingStyle.pod lilygut.pod lilyinput.pod
+TXTS=$(PODS:.pod=.txt)
+MANS=$(PODS:.pod=.1)
+DOCFILES=$(PODS) Makefile 
 
-DOCFILES=commands CodingStyle algorithms Makefile breaking\
-       slurfont pointers design literature inputformat
+
+default:
+       $(MAKE) -C .. doc
+
+doc: $(TXTS)
 
 dist:
-       ln $(DOCFILES) $(DDIR)/Documentation/
\ No newline at end of file
+       ln $(DOCFILES) $(DDIR)/Documentation/
+clean:
+       rm -f $(TXTS) $(MANS)
+
+%.txt: %.1
+       groff -man -Tascii $< > $@
+
+%.1: %.pod
+       pod2man --center="LilyPond documentation" --section="0"\
+               --release="LilyPond $(MAJVER).$(MINVER).$(PATCHLEVEL)" $< > $@
+
diff --git a/Documentation/README.pod b/Documentation/README.pod
new file mode 100644 (file)
index 0000000..f7226fa
--- /dev/null
@@ -0,0 +1,165 @@
+=head1 NAME
+
+Lilypond - a music typesetter
+
+=head1 SYNOPSIS
+
+       lilypond [options] [inputfiles]
+
+=head1 DESCRIPTION
+
+LilyPond typesets music. It translates script files (mudela files or
+F<.ly>'s) into TeX input.
+
+=head1 OPTIONS
+
+=item  B<-d,--debug>
+debugging
+
+=item  B<-w,--warranty>
+warranty
+
+=item  B<-o,--output>
+default output file
+
+=item  B<-h,--help>
+help
+
+=head1 LICENSE
+
+GNU GPL. See file COPYING
+
+=head1 PREREQUISITES
+
+Compilation:
+
+=over 5
+
+=item  - Unix (any decent Linux distribution is fine)
+
+=item  - GNU C++ v2.7  or better (with libg++ )
+
+=item  - GNU make.
+
+=item  - flex (2.5.1 or better)
+
+=item  - bison/yacc
+
+=item  - The "flower" library, which should be available from the
+       same source you got this from.
+
+=item  - perl
+
+=back
+
+Operation:
+
+=over 5
+
+=item  - TeX
+
+=item  - the MusixTeX fonts
+
+=back
+
+The Makefile uses  perl for trivial operations,  and you could  tinker
+with it to use sed or awk.
+
+=head1 COMPILING
+
+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
+       typeof
+       operator <?, operator >?
+       the new for-scope
+       class Rational (libg++)
+
+=head1 AUTHOR
+
+Han-Wen Nienhuys <hanwen@stack.nl>, <jan@digicash.com>
+
+=head1 EXAMPLES
+
+At this time, LilyPond is only suited for Quick & Dirty jobs (the
+output quality still is too low). If you're not discouraged; this is
+what I type in my xterm:
+
+       lilypond someinput.ly
+       tex test
+       xdvi test&
+
+This is what the output looks like over here:
+
+       hw:~/musix/spacer$ lilypond maartje.ly
+       LilyPond 0.0.17/FlowerLib 1.0.14. Compile: Dec 17 1996, 11:33:54 (g++ 2.7.2)
+       Parsing ... [symbol.ini][maartje.ly]
+       Processing ... Calculating ... Postprocessing ... 
+       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] [2] )
+       Output written on test.dvi (2 pages, 8072 bytes).
+       Transcript written on test.log.
+
+       hw:~/musix/spacer$ xdvi test&
+       [1] 1468
+
+Check out kortjakje.ly, it has some comments
+
+
+=head1 PROBLEMS
+
+If LilyPond bombs out, then please recompile using B<-g>, and send a gdb
+stacktrace of the crash. It also helps if you can print the values of the objects. So if you trace is
+
+       (gdb) backtrace 12
+       #0  Interval::operator+= (this=0x11fffec60..)
+           at ../flower/interval.hh:50
+       #1  0x12005195c in Item::width (this=0x14008a680) at src/item.cc:39
+       #2  0x12008fdbc in itemlist_width (its=0x11fffed58 ..
+         :
+         :
+
+Than it would help if you send a dump of the Interval and the Item
+(use: 'print *this' or use LilyPond print() methods).
+
+This is a beta version of LilyPond. Please send your helpful comments
+and patches to me,
+
+LilyPond is updated very frequently, the latest version is always available at:
+
+F<ftp://pcnov095.win.tue.nl/pub/lilypond>
+
+
+=head1 FILES
+
+F<symbol.ini> The initialisation file with symbol tables etc.
+
+=head1 HOW DOES IT WORK
+
+=over 5
+
+Use The Source, Luke. If you don't know C++, you can try editing
+the file F<.dstreamrc> for copious debugging output. (use B<-d>)
+
+the subdir Documentation/ contains some more-in-depth matter on LilyPond
+
+The source is commented in the DOC++ style.
+Check out doc++ at
+
+       http://www.ZIB-Berlin.DE/VisPar/doc++/doc++.html
+
+=back
diff --git a/Documentation/algorithms b/Documentation/algorithms
deleted file mode 100644 (file)
index f422332..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-Date: Tue, 5 Nov 1996 00:01:32 +0100
-From: Werner Icking <Werner.Icking@gmd.de>
-To: hanwen@stack.urc.tue.nl
-Cc: dsimons@logicon.com
-Subject: Re: font sizes.
-
-> Date: Mon, 4 Nov 1996 22:37:54 +0100 (MET)
-> From: Han-Wen Nienhuys <hanwen@stack.urc.tue.nl>
-> >
-> >There were different schemes when music was typeset by hand. If I remember
-> >right Harder uses another scheme that Gomberg. Both scheme may be used
-> 
-> Who are Harder and Gomberg? Do you have references?
-
-Both are mentioned in the master thesis by Steinbach & Schofer who
-invented M(u)TeX, the grandmother of all M...TeXs. The Musiclibrary
-in Bonn has the harder (printed in 1948?) and there are not many books
-I liked more to own. 
-
-The master thesis should be available at the CTAN archives under MuTeX
-or MTEX maybe subdirectory DIPL (for Diplom). I have the TEX-source 
-and I may pack it to ftp.gmd.de if you are interested and can't find it
-on CTAN.
-================================================================
-
-[breaking lines]
->
->Incidentally, I use a different approach in PMX, starting with the 
->total number of systems for the piece instead of assuming a starting 
->physical value for \elemskip.  That's equivalent to setting the 
->physical length of the whole piece if laid out in one long line.  
->Knowing the total amount of scalable and fixed space I compute a 
->starting physical value for \elemskip.  I use that to get how many 
->bars go in the first line.  Then I force a line break there, remove 
->those bars and their scalable and fixed space from the accounting, and 
->start over with the second line, etc.
-
-
-Since you are getting into technical details, I will show mine too: I
-think my way  is the most elegant algorithm i've seen so far.  Some
-terminology: I call a vertical group of symbols (notes) which start at
-the same time a "column".  Each line of a score has notes in it,
-grouped in columns. The difference in starting time between those
-columns makes it possible to determine ideal distances between those
-columns.
-
-Example:
-
-        time ----->
-
-        col1    col2    col3    col4
-
-
-voice1  1               1
-
-voice2  2       2       2       2
-
-
-(1 is a whole note, 2 a half note.)
-
-time_difference (col1 , col2) = 0.5 wholes,
-time_difference (col1 , col3) = 1 wholes,
-time_difference (col2 , col3) = 0.5 wholes,
-etc.
-
-these differences are translated into ideal distances (these translations
-have been the subject of discussion in this thread).
-
-        distance (col1,col2) = 10 pt
-        distance (col1,col3) = 14.1 pt
-        distance (col2,col3) = 10 pt
-        etc.
-
-as you can see, these distance are conflicting. So instead of
-satisfying all those ideals simultaneously, a compromise is sought.
-
-This is Columbus' egg: LilyPond attaches "springs" to each
-column-pair.  each spring has an equilibrium-position which is equal to
-the above mentioned distance, so
-
-        spring (col1, col2) and spring(col2,col3) try to push column 1
-and 3 away (to a distance of 20pt) from each other, whereas the spring
-between col 1 and col 3 tries to pull those two together (to a
-distance of 14.1 pt). The net result of this pushing and pulling is an
-equilibrium situation (the pushing cancels the pulling), which can be
-calculated as the solution of Quadratic program: it is the solution
-with minimum potential energy, for you physicists out there.
-
-This algorithm for doing one line, gives a "badness" parameter for
-each line (the potential energy). Now one can use TeX's algorithm for
-making paragraphs (using this new version of "badness"): one should
-try to minimise the overall badness of a paragraph. LilyPond also uses the
-concept of pre- and post-breaks.
-
-(actually, it is a bit more complicated: each column also has a
-minimum distance to other columns, to prevent symbols from running
-into symbols of other columns.)
-
diff --git a/Documentation/breaking b/Documentation/breaking
deleted file mode 100644 (file)
index ea1ada7..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-[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/Documentation/commands b/Documentation/commands
deleted file mode 100644 (file)
index 00d5856..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-This table decribes the proper order for the different commands:
-
-
-interpret
-       which           priority
-       ========================
-       
-       key             200
-       clef            190
-       meter           180             
-       bar             170
-
-typeset
-
-       which           priority
-       ========================
-
-       bar             100
-       clef            90
-       currentclef     80
-       key             70
-       currentkey      60
-       meter           40
-       
\ No newline at end of file
diff --git a/Documentation/design b/Documentation/design
deleted file mode 100644 (file)
index e1a317a..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-LilyPond is a "5-pass" system:
-
-1. Parsing:
-
-No difficult algorithms. Associated datastructures have prefix Input
-(eg Input_score, Input_command)
-
-2. Processing:
-
-Requests are processed and granted. In this step data-structures for
-3. are created and filled with data: PScore, PCol, PStaff
-
-3. Calculation:
-
-This step uses structures which have names starting with 'P'.
-linebreaks and horizontal positions of PCols are determined. Line_of_*
-generated.
-
-4. Postprocesing:
-
-Some items and all spanners need computation after the PCol positions
-are determined.
-
-5. Output
-
-Very simple, just walk all Line_of_* and follow the links over there
\ No newline at end of file
diff --git a/Documentation/inputformat b/Documentation/inputformat
deleted file mode 100644 (file)
index d82c02b..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-General format of a construct:
-
-       BLOCKNAME {  <info to go with this block>   }
-
-Some types allow declarations:
-
-       IDENTIFIER = BLOCKNAME {
-               <info to go with this block>
-       }
-
-       ..
-
-       BLOCKNAME {
-               IDENTIFIER
-               ...
-       }
-
-
-In musicmode, eg,
-
-       ''!c8.-"text"_v
-
-a lot of characters parse differently
-than in "command" mode, eg,
-
-       identifier = score { .. }
-
-So you have to signal that to the tokenizer. This is done with
-'$'. '$' is a delimiter, which used by the tokenizer only.
-
-* musicmode: The brace still is used to group grammatical groups.
-* musicmode: "word" are preceded by a '\' (backslash)
-
-This means you can write some stuff in a zillion ways:
-
-1.     $\var = \blockname { ... } $
-
-2.     var = blockname { $ ... $ } 
-
-3.     var = $ $ $\blockname {  ... $ } 
-
-COMMENTS
-
-not really crystallized; you can use '#' or '%' as line comment
-
-OTHER
-
-A correctly parsed .ly does not guarantuee output. A lot (most) of the
-checking is done *after* parsing (some checks even are done after the
-break calc!);  I'm sorry.
-
-The parser's job is to construct appropriate objects. It will *only*
-detect parse errors.
-
-LilyPond first reads 'symbol.ini', which contains declarations crucial
-to proper operation of LilyPond (symbol tables, note names)
-
-This language looks a lot like Rayce's which in turn owes a lot to the
-POVRay raytracer. Now, I know, musictypesetting and Raytracing do not
-necessarily require the same input format, but I was just to lazy to
-make up a new/better input format. Suggestions welcome.
diff --git a/Documentation/lilygut.pod b/Documentation/lilygut.pod
new file mode 100644 (file)
index 0000000..5707dcf
--- /dev/null
@@ -0,0 +1,260 @@
+=head1 NAME
+
+LilyGuts - doco to the internals of LilyPond
+
+=head1 DESCRIPTION
+
+This page documents some aspects of the internals of LilyPond
+
+=head1 OVERVIEW
+
+LilyPond is a "5-pass" system:
+
+=over 5
+
+=item 1. Parsing:
+
+No difficult algorithms. Associated datastructures have prefix Input
+(eg Input_score, Input_command)
+
+=item 2. Processing:
+
+Requests are processed and granted. In this step data-structures for
+3. are created and filled with data: PScore, PCol, PStaff
+
+=item 3. Calculation:
+
+This step uses structures which have names starting with 'P'.
+linebreaks and horizontal positions of PCols are determined. Line_of_*
+generated.
+
+=item 4. Postprocesing:
+
+Some items and all spanners need computation after the PCol positions
+are determined.
+
+=item 5. Output
+
+Very simple, just walk all Line_of_* and follow the links over there
+
+=back
+
+=head1 COMMANDS
+
+This table decribes the proper order for the different commands:
+
+
+=head2 interpret
+
+       which           priority
+       ========================
+       
+       key             200
+       clef            190
+       meter           180             
+       bar             170
+
+=head2 typeset
+
+       which           priority
+       ========================
+
+       bar             100
+       clef            90
+       currentclef     80
+       key             70
+       currentkey      60
+       meter           40
+
+
+
+=head1 BREAKING
+
+[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.
+
+=head1 SPACING
+
+I think my way is the most elegant algorithm i've seen so far.  Some
+terminology: I call a vertical group of symbols (notes) which start at
+the same time a "column".  Each line of a score has notes in it,
+grouped in columns. The difference in starting time between those
+columns makes it possible to determine ideal distances between those
+columns.
+
+Example:
+
+               time ----->
+
+               col1    col2    col3    col4
+
+
+       voice1  1               1
+
+       voice2  2       2       2       2
+
+
+       (1 is a whole note, 2 a half note.)
+
+       time_difference (col1 , col2) = 0.5 wholes,
+       time_difference (col1 , col3) = 1 wholes,
+       time_difference (col2 , col3) = 0.5 wholes,
+       etc.
+
+these differences are translated into ideal distances (these translations
+have been the subject of discussion in this thread).
+
+        distance (col1,col2) = 10 pt
+        distance (col1,col3) = 14.1 pt
+        distance (col2,col3) = 10 pt
+        etc.
+
+as you can see, these distance are conflicting. So instead of
+satisfying all those ideals simultaneously, a compromise is sought.
+
+This is Columbus' egg: LilyPond attaches "springs" to each
+column-pair.  each spring has an equilibrium-position which is equal to
+the above mentioned distance, so
+
+        spring (col1, col2) and spring(col2,col3) try to push column 1
+and 3 away (to a distance of 20pt) from each other, whereas the spring
+between col 1 and col 3 tries to pull those two together (to a
+distance of 14.1 pt). The net result of this pushing and pulling is an
+equilibrium situation (the pushing cancels the pulling), which can be
+calculated as the solution of Quadratic program: it is the solution
+with minimum potential energy, for you physicists out there.
+
+This algorithm for doing one line, gives a "badness" parameter for
+each line (the potential energy). Now one can use TeX's algorithm for
+making paragraphs (using this new version of "badness"): one should
+try to minimise the overall badness of a paragraph. LilyPond also uses the
+concept of pre- and post-breaks.
+
+(actually, it is a bit more complicated: each column also has a
+minimum distance to other columns, to prevent symbols from running
+into symbols of other columns.)
+
+=head1 POINTERS
+
+This describes the ownership of certain classes in LilyPond. +
+signifies a "list of". (This is not complete)
+
+       Score:
+               Paperdef
+               Staff+
+               Score_commands
+               Score_columns+
+               PScore
+
+       Staff:
+               Voice
+               Staff_column+
+               Command+
+
+
+       Voice:
+               Voice_element
+
+       Voice_element:
+               Request+
+
+
+       PScore:
+               PStaff+
+               PCol+
+               Idealspacing+
+               Item+
+               Spanner+
+               Spanner+ (broken)
+
+=head1 SEE ALSO
+
+=head2 References
+
+Herbert Chlapik, 
+
+W.A. Hegazy and J. S. Gourlay. Optimal line breaking in music. In
+``Document Manipulation and Typography'', J.C. van Vliet (ed) 1988.
+
+Ross, Ted. ``Teach yourself the art of music engraving and processing'' 
+(3rd edition). Hansen House, Miami Beach, FL.
+       Hansen House
+       1820 West Ave.
+       Miami, FL  33139
+       (305) 532-5461
+[This is about *engraving* i.e. professional music typesetting, and includes 
+some good spacing tables]
+Read, Gardner. ``Modern Rhythmic Notation.'' Indiana University Press, 1978.
+
+Read, Gardner. ``Music Notation'' (2nd edition). Taplinger Publishing,
+New York.
+[This is as close to the ``standard'' reference work for music notation issues
+as one is likely to get.]
+
+
+=head2  Further reading
+
+(of varying usefulness):
+
+Donato, Anthony. Preparing Music Manuscript. Englewood Cliffs:
+Prentice-Hall, 1963.
+
+Donemus. "Uitgeven van muziek". Donemus Amsterdam, 1900
+Heussenstamm, George. The Norton Manual of Music Notation. New York:
+Norton, 1987.
+Karkoshka, Erdhard. Notation in New Music. Trans. Ruth Koenig. New York:
+Praeger    Publishers, 1972.  Out of print.
+
+Roelofs, Ren\'e. ``Een Geautomatiseerd Systeem voor het Afdrukken van
+Muziek'' afstudeerscriptie Bestuurlijke informatica, no 45327, Erasmus
+universiteit Rotterdam, 1991.  (``An automated system for printing
+music'' Master's Thesis Management and Computer Science.)
+
+C. Roemer,  The Art of Music Copying. Roerick music co., Sherman Oaks (CA), 1973.
+
+Rosecrans, Glen. Music Notation Primer. New York: Passantino, 1979.
+Stone, Kurt. Music Notation in the Twentieth Century. New York: Norton, 1980.
+
+
diff --git a/Documentation/lilyinput.pod b/Documentation/lilyinput.pod
new file mode 100644 (file)
index 0000000..99c58aa
--- /dev/null
@@ -0,0 +1,77 @@
+=head1 NAME
+
+LilyInput -  LilyPond input format
+
+=head1 DESCRIPTION
+
+This page documents the the LilyPond input format, mudela.
+
+=head2 Overview
+
+General format of a construct:
+
+       BLOCKNAME {  <info to go with this block>   }
+
+Some types allow declarations:
+
+       IDENTIFIER = BLOCKNAME {
+               <info to go with this block>
+       }
+
+       ..
+
+       BLOCKNAME {
+               IDENTIFIER
+               ...
+       }
+
+
+In musicmode, eg,
+
+       ''!c8.-"text"_v
+
+a lot of characters parse differently
+than in "command" mode, eg,
+
+       identifier = score { .. }
+
+So you have to signal that to the tokenizer. This is done with
+'$'. '$' is a delimiter, which used by the tokenizer only.
+
+=item *
+musicmode: The brace still is used to group grammatical groups.
+
+=item *
+musicmode: "word" are preceded by a '\' (backslash)
+
+This means you can write some stuff in a zillion ways:
+
+=item 1.
+       $\var = \blockname { ... } $
+
+=item 2.
+       var = blockname { $ ... $ } 
+
+=item 3.
+       var = $ $ $\blockname {  ... $ } 
+
+=head2 Comments
+
+Not really crystallized; you can use '#' or '%' as line comment
+
+=head2 other
+
+A correctly parsed .ly does not guarantuee output. A lot (most) of the
+checking is done B<after> parsing (some checks even are done after the
+break calc!);  I'm sorry.
+
+The parser's job is to construct appropriate objects. It will *only*
+detect parse errors.
+
+LilyPond first reads 'symbol.ini', which contains declarations crucial
+to proper operation of LilyPond (symbol tables, note names).
+
+This language looks a lot like Rayce's which in turn owes a lot to the
+POVRay raytracer. Now, I know, musictypesetting and Raytracing do not
+necessarily require the same input format, but I was just to lazy to
+make up a new and/or better input format. Suggestions welcome.
diff --git a/Documentation/literature b/Documentation/literature
deleted file mode 100644 (file)
index 0085806..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-\chapter{References \& Further reading}
-
-Herbert Chlapik, 
-
-Ren\'e Roelofs, ``Een Geautomatiseerd Systeem voor het Afdrukken van
-Muziek'' afstudeerscriptie Bestuurlijke informatica, no 45327, Erasmus
-universiteit Rotterdam, 1991.  (``An automated system for printing
-music'' Master's Thesis Management and Computer Science.)
-
-G. Read, ``Modern Rhythmic Notation.'' Indiana University Press, 1978.
-
-C. Roemer,  The Art of Music Copying. Roerick music co., Sherman Oaks (CA), 1973.
-
-Donemus, Uitgeven van muziek. Donemus Amsterdam, 1900
-
-W.A. Hegazy and J. S. Gourlay. Optimal line breaking in music. In
-``Document Manipulation and Typography'',J.C. van Vliet (ed) 1988.
-
-\begin{verbatim}
-Date: Thu, 03 Aug 1995 22:55:48 -0700
-From: Mark Basinski <basinski@arizona.edu>
-To: Han-Wen Nienhuys <hanwen@stack.urc.tue.nl>
-Newsgroups: comp.music, comp.text.tex
-Subject: Re: [WANTED] references on typesetting music
-(A copy of this message has also been posted to the following newsgroups:
-comp.music, comp.text.tex)
-In article <3vqr50$den@turtle.stack.urc.tue.nl>, hanwen@stack.urc.tue.nl
-(Han-Wen Nienhuys) wrote:
-> I am currently typesetting music with a preprocessor to the TeX package
-> MusiXTeX, and I want to enhance this preprocessor with an some sort of
-> algorithm to do spacing. Currently the output looks nice, but there are some
-> flaws in the spacing when I combine accidentals, slurs, triplets and strange
-> pitchjumps and so on. Therefore I am interested in all literature on
-> typesetting music.  The FAQS for comp.music did not have any references.
-> 
-Probably the best 2 reference books are:
-1) ``Teach yourself the art of music engraving and processing'' by Ted Ross   
-(3rd edition), published by Hansen House, Miami Beach, FL.
-Hansen House
-1820 West Ave.
-Miami, FL  33139
-(305) 532-5461
-This is about *engraving* i.e. professional music typesetting, and includes 
-some good spacing tables
-2) ``Music Notation'' by Gardner Read (2nd edition), published by Taplinger
-Publishing, New York.
-This is as close to the ``standard'' reference work for music notation issues
-as one is likely to get.
-Some others (of varying usefulness):
-Donato, Anthony. Preparing Music Manuscript. Englewood Cliffs:
-Prentice-Hall, 1963.
-Heussenstamm, George. The Norton Manual of Music Notation. New York:
-Norton, 1987.
-Karkoshka, Erdhard. Notation in New Music. Trans. Ruth Koenig. New York:
-Praeger    Publishers, 1972.  Out of print.
-Roemer, Clinton. The Art of Music Copying. Roerick Music. Sherman Oaks, 1973.
-Rosecrans, Glen. Music Notation Primer. New York: Passantino, 1979.
-Stone, Kurt. Music Notation in the Twentieth Century. New York: Norton, 1980.
-\end{verbatim}
diff --git a/Documentation/pointers b/Documentation/pointers
deleted file mode 100644 (file)
index 45e2479..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-This describes the ownership of certain classes in LilyPond. +
-signifies a "list of". (This is not complete)
-
-Score:
-       Paperdef
-       Staff+
-       Score_commands
-       Score_columns+
-       PScore
-               
-Staff:
-       Voice
-       Staff_column+
-       Command+
-
-
-Voice:
-       Voice_element
-
-Voice_element:
-       Request+
-
-
-PScore:
-       PStaff+
-       PCol+
-       Idealspacing+
-       Item+
-       Spanner+
-       Spanner+ (broken)
-       
diff --git a/Documentation/slurfont b/Documentation/slurfont
deleted file mode 100644 (file)
index fda65e1..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-How are slur fonts organised?
-
-xhslu20: see xslhu20
-
-xslhu20: half slurs, pointing up
-       right
-               width in steps of 12pt (12pt-96pt)
-                       height in 16 steps
-       left
-               idem
-       
-xslhd20: half slurs, pointing down, idem
-
-xslu20: whole slurs, ascending
-       pointing up
-               height (dy) in 8 steps
-                       width in 16 steps of 4pt (8 pt - 64pt)
-       pointing down
-               height (dy) in 8 steps
-                       width in steps of 4pt (8 pt - 64pt)
-       
-xsld20: whole slurs, descending        
-       pointing up
-               height (dy) in 8 steps
-                       width in steps of 4pt (8 pt - 60pt)
-       pointing down
-               height (dy) in 8 steps
-                       width in steps of 4pt (8 pt - 60pt)
-       
-
-xslhz: middlepieces for half-slurs
-       pointing up
-               width in 100 steps of 4 pt (4 pt to 400pt)
-       pointing down
-               idem
-
-xslz:  horizontal slurs
-       pointing up
-               width in 54 steps of 4pt
-       pointing down
-               idem
-
-xtie: same as xslhz.
index d0bdffd022c59dbb3af398ca6be2fe2d5f45246a..cb118a3ea268d68a09b933a68e4893ab8b461005 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 include Variables.make 
 
 .SUFFIXES:
-.SUFFIXES: .cc .o .hh .y .l
+.SUFFIXES: .cc .o .hh .y .l .pod .txt .1
 
 $(exe): $(obs)
        $(CXX) -o $@ $^ $(LOADLIBES)
@@ -18,7 +18,10 @@ distclean: clean
 all: kompijl doc
 
 # doc++ documentation of classes
-doc: $(progdocs)
+doc:
+       $(MAKE) -C Documentation doc
+
+docpp: $(progdocs)
        -mkdir $(DOCDIR)
        doc++ -p -I -d $(DOCDIR) $^
 
diff --git a/NEWS b/NEWS
index ab7f8437f6f37f8d046c86bac1f2cab71c173a72..27be7f4bd25a3d8aaa15d27d68cf7aeb028479e2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+pl 20:
+       - Rational for time measurement
+       - updated doco to .pod
+       - directionalspanner/textspanner
+       - include files
+
 pl 19:
        - struct Moment
        - grouping code: LilyPond can set advanced multibeams.
diff --git a/README b/README
index c936c13e294415127fa531c0335f0f7ee0222d18..94d352fc5098dab4ef2700c7c0c3027e16bf79b8 100644 (file)
--- a/README
+++ b/README
@@ -1,116 +1,7 @@
--*-text-*-
+Please refer to the directory Documentation/.
 
-last update: 96/17/12, 0.0.17
+To generate the pretty-printed docs, do a:
 
-LICENSE
+       make doc
 
-See file COPYING
-
-INTRODUCTION
-
-This is a beta version of LilyPond (a music typesetter). Please send
-your helpful comments and patches to me,
-
-       hanwen@stack.nl
-
-LilyPond is updated very frequently, the latest version is always available at:
-
-       ftp://pcnov095.win.tue.nl/pub/lilypond
-
-PREREQUISITES
-
-Compilation:
-
-       - Unix (any decent Linux distribution is fine)
-       - GNU C++ v2.7  or better
-       - GNU make.
-       - flex (2.5.1 or better)
-       - bison/yacc
-       - The "flower" library, which should be available from the
-       same source you got this from.
-       - perl
-
-Operation:
-
-       - TeX
-       - the MusixTeX fonts
-
-The Makefile uses  perl for trivial operations,  and you could  tinker
-with it to use sed or awk.
-
-COMPILING
-
-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
-       typeof
-       operator <?, operator >?
-       new for-scope
-
-USING
-
-At this time, LilyPond is only suited for Quick & Dirty jobs (the
-output quality still is too low). If you're not discouraged; this is
-what I type in my xterm:
-
-       lilypond someinput.ly
-       tex test
-       xdvi test&
-
-This is what the output looks like over here:
-
-       hw:~/musix/spacer$ lilypond maartje.ly
-       LilyPond 0.0.17/FlowerLib 1.0.14. Compile: Dec 17 1996, 11:33:54 (g++ 2.7.2)
-       Parsing ... [symbol.ini][maartje.ly]
-       Processing ... Calculating ... Postprocessing ... 
-       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] [2] )
-       Output written on test.dvi (2 pages, 8072 bytes).
-       Transcript written on test.log.
-
-       hw:~/musix/spacer$ xdvi test&
-       [1] 1468
-
-Check out kortjakje.ly, it has some comments
-
-
-PROBLEMS
-
-If LilyPond bombs out, then please recompile using -g, and send a gdb
-stacktrace of the crash. It also helps if you can print the values of the objects. So if you trace is
-
-(gdb) backtrace 12
-#0  Interval::operator+= (this=0x11fffec60, r=-1.7976931348623157e+308)
-    at ../flower/interval.hh:50
-#1  0x12005195c in Item::width (this=0x14008a680) at src/item.cc:39
-#2  0x12008fdbc in itemlist_width (its=0x11fffed58) at src/simpleprint.cc:40
-  :
-  :
-
-Than it would help if you send a dump of the Interval and the Item (use: 'print *this' or use LilyPond print() methods)
-
-HOW DOES IT WORK
-
-* Use The Source, Luke. If you don't know C++, you can try editing
-.dstreamrc for copious debugging output. (use -d)
-
-* the subdir Documentation/ contains some more-in-depth matter on LilyPond
-
-* The source is commented in the DOC++ style.
-Check out doc++ at
-
-       http://www.ZIB-Berlin.DE/VisPar/doc++/doc++.html
+in the top-level dir
\ No newline at end of file
index 53977c778b5f0974791a512f9a00d6e47e87d6fb..a04e3dd03c858316b908a46df354e83225a04329 100644 (file)
@@ -9,20 +9,22 @@ hdr=    qlp.hh linespace.hh qlpsolve.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 lookup.hh\
+       spanner.hh  beam.hh directionalspanner.hh slur.hh textspanner.hh\
        sccol.hh stcol.hh staffcommands.hh melodicstaff.hh\
-       identifier.hh simplestaff.hh spanner.hh stem.hh\
-       notehead.hh leastsquares.hh beam.hh rest.hh\
+       identifier.hh simplestaff.hh  stem.hh\
+       notehead.hh leastsquares.hh  rest.hh\
        swalker.hh bar.hh meter.hh accidental.hh\
        key.hh keyitem.hh localkeyitem.hh simplewalker.hh\
-       clef.hh clefitem.hh slur.hh inputcommands.hh\
-       getcommand.hh inputmusic.hh \
+       clef.hh clefitem.hh  inputcommands.hh\
+       getcommand.hh inputmusic.hh timedescription.hh\
        inputscore.hh inputstaff.hh identparent.hh\
-       inputcommand.hh grouping.hh moment.hh
+       inputcommand.hh grouping.hh moment.hh offset.hh
+
 
 mycc=   qlp.cc qlpsolve.cc leastsquares.cc\
        inputcommands.cc inputmusic.cc  \
-       inputscore.cc inputstaff.cc\
-       moment.cc\
+       inputscore.cc inputstaff.cc inputcommand.cc\
+       timedescription.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\
@@ -34,15 +36,16 @@ mycc=   qlp.cc qlpsolve.cc leastsquares.cc\
        dimen.cc paper.cc lookup.cc staffcommands.cc\
        sccol.cc stcol.cc getcommands.cc simplestaff.cc\
        melodicstaff.cc simpleprint.cc\
-       spanner.cc \
+       spanner.cc textspanner.cc directionalspanner.cc \
        notehead.cc  stem.cc \
        rest.cc bar.cc meter.cc keyitem.cc localkeyitem.cc clefitem.cc\
        swalker.cc scoreline.cc\
        simplewalker.cc\
        texbeam.cc texslur.cc clef.cc key.cc slur.cc beam.cc\
-       idealspacing.cc inputcommand.cc grouping.cc identifier.cc\
+       idealspacing.cc  grouping.cc identifier.cc\
        lexerinit.cc mylexer.cc\
        template1.cc template2.cc template3.cc template4.cc\
+       template5.cc\
        version.cc
 
 
index 32bffdfc979440e60c249879aa712bef39977030..ac306c783272cadc95db05c376accca872ccb72c 100644 (file)
@@ -5,14 +5,14 @@
 #PROFILEFLAG=-pg
 OPTIFLAG=-DNDEBUG -DNPRINT -O2
 DEBUGFLAG=-g
+
 # turn off -pipe if linker doesn't support it
 EXTRACXXFLAGS=-pipe -Wall -W   -Wmissing-prototypes 
-#      -Woverloaded-virtual
 
 #
 # -lefence = ElectricFence.
 #
-# ElectricFence is memory debugger which uses the 
+# ElectricFence is memory debugger which uses the 
 # VM hardware to trap malloc/free errors.
 #
 #EXTRALIB+=-lefence
@@ -37,7 +37,7 @@ endif
 # version info
 MAJVER=0
 MINVER=0
-PATCHLEVEL=19
+PATCHLEVEL=20
 VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL)
 CXXVER=`$(CXX) --version`
 
@@ -49,7 +49,7 @@ TOPDIR  := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
 OBJECTDIR=objects
 HEADERDIR=hdr
 CCDIR=src
-
+INITDIR=init
 vpath %.cc $(CCDIR)
 vpath %.hh $(HEADERDIR)
 vpath %.y $(CCDIR)
@@ -77,7 +77,7 @@ DNAME=$(PACKAGENAME)-$(VERSION)
 othersrc=lexer.l parser.y
 SCRIPTS=make_version make_patch genheader
 IFILES=dimen.tex symbol.ini kortjakje.ly pavane.ly  maartje.ly\
-       lilyponddefs.tex test.tex .dstreamrc
+       lilyponddefs.tex test.tex .dstreamrc cadenza.ly
 OFILES=Makefile Variables.make Sources.make COPYING README NEWS
 DFILES=$(OFILES) $(IFILES) $(SCRIPTS)
 
@@ -91,4 +91,4 @@ BISON=bison
 exe=$(PACKAGENAME)
 OUTPUT_OPTION=$< -o $@
 DDIR=$(TOPDIR)/$(DNAME)
-SUBDIRS=Documentation $(OBJECTDIR) $(CCDIR) $(HEADERDIR)
+SUBDIRS=Documentation $(OBJECTDIR) $(CCDIR) $(HEADERDIR) $(INITDIR)
diff --git a/cadenza.ly b/cadenza.ly
new file mode 100644 (file)
index 0000000..0ed6601
--- /dev/null
@@ -0,0 +1,35 @@
+%
+% Cadenza to Mozart Horn/3
+%
+
+cad = music { $
+       \duration { 8}
+       'c4. g8 ['e()'d 'c b]
+       [b()c] g c [c e g 'c]
+       \octave{'}
+       e4. e [g ()f e d]
+
+       \duration{16}
+       dis4()e4 r8 [c d] [e f g gis]
+       \duration{4}
+       a `f()`e g
+       f `d()`cis e
+       \duration{8}    
+       d4 r8 `a [`b cis]
+       \duration{16}
+       [d cis d e]
+       f4()[f e d c] `b4
+       \octave{} ['c8 b8] % triplet!
+       g2 [g c e g] ['c e g 'c]\octave{'} 
+       [e `g c e] g4 %()% BUG!
+       [g8.( e g8. )e]
+       a4. g8 [f8 e8 d8 c8]
+       `g2 d2
+       c4 $}
+
+score {
+       staff { melodic
+               music { cad }
+       }
+       commands { meter 4 4 skip 13:0 }
+}
\ No newline at end of file
index eae2acaf4d80773fae6738a15eb9759d07746c90..c0097bdcf82497e99d974ee82eed5422a22aea9a 100644 (file)
@@ -1,7 +1,7 @@
 
 cc=lgetopt.cc   string.cc dataf.cc textdb.cc unionfind.cc  \
        smat.cc matrix.cc choleski.cc vector.cc dstream.cc\
-       matdebug.cc  scalar.cc
+       matdebug.cc  scalar.cc path.cc
 
 templatecc=cursor.tcc list.tcc tsmat.tcc plist.tcc interval.tcc\
        pcursor.tcc
@@ -13,5 +13,6 @@ hh=cursor.hh pcursor.hh lgetopt.hh link.hh list.hh dstream.hh \
        smat.hh vsmat.hh  vector.hh  real.hh choleski.hh\
        tsmat.hh tvsmat.hh plist.hh associter.hh fproto.hh\
        interval.hh scalar.hh sstack.hh rational.hh iterate.hh\
+       path.hh
        
 
index c1801c14c4d851e3b5a0719f8a4f13827e7ab736..8bf3820ffcce7dcef21044dc3d6bcb680140d9b4 100644 (file)
@@ -1,6 +1,6 @@
 MAJVER=1
 MINVER=0
-PATCHLEVEL=19
+PATCHLEVEL=20
 PACKAGENAME=flower
 
 #PROFILEFLAG=-pg
index fc50506195400dab8130746a5d8c4ff6374e4f3d..44e2057059637ece5fde0e6a104d3677702201f5 100644 (file)
@@ -118,7 +118,7 @@ Dstream::Dstream(ostream *r, const char * cfg_nm )
             r.message("not enough fields in Dstream init.");
             continue;
         }
-        (*silent)[r[0]] = Scalar(r[1]).to_bool();
+        (*silent)[r[0]] = bool(Scalar(r[1]));
     }
 
 }
index 46b4fc7e1603f2bb7346f5af0d6ec3e857eb5404..0a1a027acd277a6a376b65a5e849eda437b3f731 100644 (file)
@@ -4,10 +4,9 @@
 #include "string.hh"
 
 
-
 template<class T>
 int
-Interval__compare(const Interval_t<T>&a,Interval_t<T> const&b)
+_Interval__compare(const Interval_t<T>&a,Interval_t<T> const&b)
 {
     if (a.left == b.left && a.right == b.right)
        return 0;
@@ -18,16 +17,30 @@ Interval__compare(const Interval_t<T>&a,Interval_t<T> const&b)
     if (a.left >= b.left && a.right <= b.right)
        return -1;
 
-    assert(false);             // not comparable
+    return -2;
+}
+
 
-    return 0;
+template<class T>
+int
+Interval__compare(const Interval_t<T>&a,Interval_t<T> const&b)
+{
+    int i = _Interval__compare(a,b);
+    if (i < -1)
+       assert(false);
+    return i;
 }
 
+#ifdef AIX
+const Real INFTY = 1e8;        // ARGh. AIX sucks
+#else
 const Real INFTY = HUGE;
+#endif
 
 template<class T>
 void
-Interval_t<T>::set_empty() {
+Interval_t<T>::set_empty()
+{
     left = INFTY;
     right = -INFTY;
 }
diff --git a/flower/path.cc b/flower/path.cc
new file mode 100644 (file)
index 0000000..2fd7eea
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+   path.cc - manipulation of paths and filenames.
+*/
+#include <stdio.h>
+#include "path.hh"
+
+#ifndef PATHSEP
+#define PATHSEP '/'
+#endif
+
+
+void
+split_path(String path, 
+          String &drive, String &dirs, String &filebase, String &extension)
+{
+    // peel off components, one by one.
+    int di = path.pos(':');
+    if (di) 
+       {
+       drive = path.left(di);
+       path = path.right(path.len() - di);
+       } 
+    else
+       drive = "";
+    
+    di = path.lastPos(PATHSEP);
+    if (di) 
+       {
+       dirs = path.left(di);
+       path = path.right(path.len()-di);
+       }
+    else
+       dirs = "";
+    
+    di = path.lastPos('.');
+    if (di) 
+       {
+       di --; // don't forget '.'
+       filebase = path.left(di);
+       extension =path.right(path.len()-di);   
+       } 
+    else 
+       {
+       extension = "";   
+       filebase = path;
+       }
+}
+/**
+   INPUT: path the original full filename
+   OUTPUT: 4 components of the path. They can be empty
+*/
+
+
+File_path::File_path(String pref)
+{
+    add(".");
+    add(pref);
+}
+
+
+///
+String
+File_path::find(String nm)
+{
+     for (int i=0; i < size(); i++) {
+        String path  = (*this)[i];
+        path+= "/"+nm;
+
+
+        FILE *f = fopen(path, "r"); // ugh!
+        if (f) {
+            fclose(f);
+            return path;
+        }
+     }
+     return "";
+}
+/**
+  It will search in the current dir, in the construction-arg, and
+  in any other added path, in this order.
+  */
diff --git a/flower/path.hh b/flower/path.hh
new file mode 100644 (file)
index 0000000..fceaeed
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef PATH_HH
+#define PATH_HH
+#include "string.hh"
+#include "varray.hh"
+
+
+///   searching directory for file.
+class File_path : private Array<String>
+{
+public:
+    /// locate a file in the search path
+    String find(String nm);
+
+    /// construct using prefix. Normally argv[0].
+    File_path(String);
+
+    /// add to end of path.
+    Array<String>:: add;
+};
+/**
+
+   Abstraction of PATH variable. An interface for searching input files.
+   Search a number of dirs for a file.
+
+   Should use kpathsea?
+   
+*/
+
+/// split path into its components
+void split_path(String path, String &drive, String &dirs, String &filebase, String &extension);
+
+#endif
index 383a450a1ae4a2f4ce0eac353a9d9722b856c903..a6b99c9097526d771aa099289d1e0ec8541b850b 100644 (file)
@@ -18,8 +18,8 @@ struct PCursor : private Cursor<void *> {
     void junk();
 public:
     Cursor<void*>::ok;
-    void del() { junk(); Cursor<void*>::del(); }
-    void backspace() { junk(); Cursor<void*>::backspace(); }
+    Cursor<void*>::del;
+    Cursor<void*>::backspace;
     T get() {
        T p = ptr();
        Cursor<void*>::del();
index 0aedfba60b6134aedc714a09cf07a3366949db4c..f5913c1299b33a2268b736d424581fef62ec6117 100644 (file)
@@ -24,7 +24,8 @@ class PointerList : public List<void *>
     void concatenate(PointerList<T> const &s) { List<void*>::concatenate(s); }
     PointerList() {}
 };
-/** This class does no deletion of the pointers, but it knows how to
+/**
+  This class does no deletion of the pointers, but it knows how to
   copy itself (shallow copy). We could have derived it from List<T>,
   but this design saves a lot of code dup; for all PointerLists in the
   program only one parent List<void*> is instantiated.  */
@@ -47,6 +48,7 @@ struct IPointerList : public PointerList<T> {
   You have to copy this yourself, or use the macro PointerList__copy
   
   */
+
 #define IPointerList__copy(T, to, from, op)   \
   for (PCursor<T> _pc_(from); _pc_.ok(); _pc_++)\
       to.bottom().add(_pc_->op)\
@@ -57,8 +59,10 @@ template<class T>
 void PL_copy(IPointerList<T*> &dst,IPointerList<T*> const&src);
 
 
-#define PL_instantiate(a)  template class PointerList<a*>
-#define IPL_instantiate(a) PL_instantiate(a); template class IPointerList<a*>
+#define PL_instantiate(a)  template class PointerList<a*>; \
+       template class PCursor<a*>;
+#define IPL_instantiate(a) PL_instantiate(a); \
+       template class IPointerList<a*>
 
 #include "plist.inl"
 
index 69986035d2a018b330215ed14e793fdb897e6caa..1dea8cefc123354cf27221f0a2bdd45413233acc 100644 (file)
@@ -5,7 +5,7 @@ IPointerList<T>::~IPointerList()
 {
     PCursor<T> c( *this );
     while (c.ok()) {
-       c.del();
+       delete c.get();
     }
 }
 
index f981bc101f83a5b5f01f4fbc3cb44eb8fea52dfc..d8e6f9e74b927876f92c384d339daba951be650d 100644 (file)
@@ -43,8 +43,8 @@ Scalar::operator int()
     return value();
 }
 
-bool
-Scalar::to_bool() const
+
+Scalar::operator bool() const
 {
     if (!len())
        return false;
index 67ae85beda708216c08118fc572012ffd68d66d6..bff21618c62de4db000573427b79e69145ad90ca 100644 (file)
@@ -24,7 +24,7 @@ struct Scalar : public String {
     operator Real();
     operator int();
     ///
-    bool to_bool() const;
+    operator bool() const;
     /** perl -like string to bool conversion
      */
 
index c2177d4c9916110a03b782c08de969ce38da4a71..9c3b8e2a979eb8a9b76b0d8764ac7262cd81d7fc 100644 (file)
@@ -14,7 +14,7 @@ Full_storage::operator=(Full_storage const &fs)
 void
 Full_storage::OK() const
 {
-    #ifndef NDEBUG
+#ifndef NDEBUG
     //    static Real dummy;           
     assert(maxh >= h && maxw >= w);
     assert(h >= 0 && w >= 0);
@@ -29,7 +29,7 @@ Full_storage::OK() const
        }
        #endif
     }
-    #endif
+#endif
 }
 void
 Full_storage::resize_cols(int newh)
index fb4d68c3a5f295da8beae35bb482f368645f7f3a..11c39a0f41fb891372f621310f8b18b149ae2701 100644 (file)
@@ -12,7 +12,7 @@
 /// A simple stack based on Array.
 template<class T>
 struct sstack : Array<T> { 
-    T top() { return last(); }
+    T top()const { return last(); }
     T pop() {
        assert(!empty());
        T l = last();
index 0032b67e172dd2711c90b1331ee65ecc628eb11c..e376f00978066da6a4a2c0d61709eee112ed1780 100644 (file)
@@ -7,23 +7,23 @@
 #ifndef BEAM_HH
 #define BEAM_HH
 #include "proto.hh"
-#include "spanner.hh"
+#include "directionalspanner.hh"
 #include "plist.hh"
 
 /// a beam connects multiple stems 
-struct Beam: public Spanner {
+struct Beam:  public Directional_spanner {
     PointerList<Stem*> stems;
     Real slope;
     Real left_pos;
-    /// -1 below heads, +1 above heads.
-    int dir;   
+    /// dir: -1 below heads, +1 above heads.
+
 
     Rhythmic_grouping *group;
 
     /****************/
     
     virtual Interval width()const;    
-
+    Offset center() const;
     Spanner *broken_at(PCol *,  PCol *) const;
     Beam();
     void add(Stem*);
index 5bc2cb2e735197da924d7c75b832e598a5234c8a..d817dc42e89d3c634922e79b4d8145553b470eca 100644 (file)
@@ -8,35 +8,8 @@
 #include "fproto.hh"
 #include "real.hh"
 #include "interval.hh"
-
-
-/// 2d vector 
-struct Offset {
-    Real x,y;
-
-    Offset operator+(Offset o)const {
-       Offset r(*this);
-       r+=o;
-       return r;
-    }
-    
-    Offset operator+=(Offset o) {
-       x+=o.x;
-       y+=o.y;
-       return *this;
-    }
-    Offset(Real ix , Real iy) {
-       x=ix;
-       y=iy;
-    }
-    Offset() {
-       x=0.0;
-       y=0.0;
-    }
-};
-
-
-/// a 4-tuple of #Real#s
+#include "offset.hh"
+/// a square subset of Real^2
 struct Box {
     Interval x, y;
     
@@ -48,7 +21,6 @@ struct Box {
        x.unite(b.x);
        y.unite(b.y);
     }
-    Box(svec<Real> &);
     Box();
     Box(Interval ix, Interval iy);
 };
index 26e47ffa1f244eb0b44ec0c987589be15a67632a..43d016bbeeaeb6c73fd64922db455cf1ef54b203 100644 (file)
@@ -16,7 +16,6 @@ enum Commandcode {
 struct Command {
     Commandcode code;
 
-//    Real when;
     /// analogous to argv[]
     svec<Scalar> args;
 
@@ -28,7 +27,7 @@ struct Command {
     /****************/
     
     Command();
-//    Command(Real w);
+//    Command(Moment w);
     bool isbreak()const;
     void print() const;
 };
diff --git a/hdr/directionalspanner.hh b/hdr/directionalspanner.hh
new file mode 100644 (file)
index 0000000..3c734b3
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+  directionalspanner.hh -- part of LilyPond
+
+  (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef DIRECTIONALSPANNER_HH
+#define DIRECTIONALSPANNER_HH
+
+#include "spanner.hh"
+
+struct Directional_spanner : Spanner{
+    
+    /// -1 below heads, +1 above heads.
+    int dir;
+
+    /// offset of "center" relative to left-column/0-pos of staff
+    virtual Offset center() const=0;
+    virtual void set_default_dir()=0;
+    Directional_spanner();
+    
+};
+
+#endif // DIRECTIONALSPANNER_HH
+
index da1ddd2ce34d03ca7ce632dcf2c9c04903dbcfd0..d1c9bac139080fbcd707e4917f683a65d6dc249b 100644 (file)
@@ -7,34 +7,36 @@
 #ifndef GROUPING_HH
 #define GROUPING_HH
 
+#include "moment.hh"
 #include "interval.hh"
 #include "vray.hh"
 
+typedef Interval_t<Moment> MInterval;
 
 /// data structure which represents rhythmic units 
 struct Rhythmic_grouping {    
     
     svec<Rhythmic_grouping*> children;
-    Interval *interval_;
+    MInterval *interval_;
     
     /****************/
 
-    svec<Interval> intervals();
-    Interval interval()const;
-    Real length() const;
-    void intersect(Interval);
+    svec<MInterval> intervals();
+    MInterval interval()const;
+    Moment length() const;
+    void intersect(MInterval);
     
     void operator=(Rhythmic_grouping const&);
     Rhythmic_grouping(Rhythmic_grouping const&);
-    Rhythmic_grouping(Interval, int n=1);
+    Rhythmic_grouping(MInterval, int n=1);
     Rhythmic_grouping();
     Rhythmic_grouping(svec<Rhythmic_grouping*>);
     ~Rhythmic_grouping();
 
-    void add_child(Real start, Real len);
+    void add_child(Moment start, Moment len);
 
     void split(Rhythmic_grouping r);
-    void split(svec<Interval>);
+    void split(svec<MInterval>);
     void split(int n);
 
     void print() const;
index fff2f1a1f3e0714bd3bbb7091c6e259f019a7236..639b6542e1e6582e127905f84f152fa0b8102d52 100644 (file)
@@ -9,13 +9,14 @@
 #include "proto.hh"
 #include "scalar.hh"
 #include "vray.hh"
+#include "moment.hh"
 
 struct Input_command {
     /// analogous to argv[]
     svec<Scalar> args;
     void print()const;
     Input_command();
-    Input_command(Real);
+
     operator Command();
 };
 
@@ -23,9 +24,8 @@ Input_command* get_meterchange_command( int,int);
 Input_command* get_key_interpret_command(svec<int >);
 Input_command* get_clef_interpret_command(String w);
 Input_command *get_reset_command();
-Input_command *get_partial_command(Real u);
-Input_command *get_skip_command(int,Real);
-Input_command *get_grouping_command(Real,svec<int>);
+Input_command *get_partial_command(Moment u);
+Input_command *get_skip_command(int,Moment);
 Input_command *get_grouping_command(svec<int>);
 Input_command *get_bar_command( );
 
index 527986e6ea626864ef870220f4c9c2e0fd39eebf..e2c487f2042b9ee43d98998d867409f1497609ea 100644 (file)
 #include "proto.hh"
 #include "plist.hh"
 #include "real.hh"
-#include "moment.hh"
+#include "timedescription.hh"
 
 struct Commands_at : public IPointerList<Input_command*> {
-    Moment moment_;
+    Time_description tdescription_;
     
     /****************/
 
-    Real when();
+    Moment when();
     void     parse(Staff_commands_at*);
     void print() const;
-    Real barleft();
+    Moment barleft();
     void add(Input_command*);
-    void setpartial(Real);
+    void setpartial(Moment);
     Commands_at(const Commands_at&);
-    Commands_at(Real, Commands_at*prev);
+    Commands_at(Moment, Commands_at*prev);
 };
 
 struct Input_cursor : public PCursor<Commands_at*>
 {
     /****************/
     Input_cursor(PCursor<Commands_at*>);
-    Real when()const;
-    void find_moment(Real w);
+    Moment when()const;
+    void find_moment(Moment w);
     void prev() { operator --(0); }
     void next() { operator ++(0); }    
 };
@@ -44,9 +44,9 @@ struct Input_commands : public IPointerList<Commands_at*> {
     
     /****************/
 
-    void find_moment(Real);
+    void find_moment(Moment);
     void add(Input_command c);
-    void do_skip(int bars, Real wholes);
+    void do_skip(int bars, Moment wholes);
         
     Input_commands();
     Input_commands(Input_commands const&);
@@ -56,10 +56,5 @@ struct Input_commands : public IPointerList<Commands_at*> {
     Staff_commands *parse() const;
 };
 
-
-
-void
-interpret_meter(Input_command *c, int &beats_per_meas, int& one_beat,
-               Real& whole_per_measure);
 #endif // INPUTCOMMANDS_HH
 
index d3286135f8c2774073edbe86e70afdce0d21e14f..5b6da2968aa7538bceae3d7e56b4c095021fe3bc 100644 (file)
 #include "plist.hh"
 #include "proto.hh"
 #include "voice.hh"
+#include "moment.hh"
 
 struct Voice_list : public PointerList<Voice*> {
-    void translate_time(Real dt);
+    void translate_time(Moment dt);
 };
 
 /// ABC for input structures
 struct Input_music {
     virtual Voice_list convert()=0;
-    virtual Real length()=0;
-    virtual void translate_time(Real dt)=0;
+    virtual Moment length()=0;
+    virtual void translate_time(Moment dt)=0;
     virtual ~Input_music(){}
     virtual void print() const =0;
     // virtual void transpose(...) const =0;
@@ -47,9 +48,9 @@ struct Simple_music : Input_music {
     /****/
     virtual Simple_music*simple() { return this; }  
     void add(Voice_element*);
-    virtual Real length();
+    virtual Moment length();
     virtual Voice_list convert();
-    virtual void translate_time(Real dt);
+    virtual void translate_time(Moment dt);
     virtual void print() const;
     virtual Input_music *clone() const {
        return new Simple_music(*this);
@@ -74,8 +75,8 @@ struct Music_voice : Complex_music {
  
     
     /****************/
-    Real length();
-    virtual void translate_time(Real dt);
+    Moment length();
+    virtual void translate_time(Moment dt);
     virtual Voice_list convert();
     void add_elt(Voice_element*);
     virtual Input_music *clone() const {
@@ -97,9 +98,9 @@ struct Music_general_chord : Complex_music {
 
     /****************/
 
-    virtual Real length();
+    virtual Moment length();
     virtual Voice_list convert();
-    virtual void translate_time(Real dt);
+    virtual void translate_time(Moment dt);
     void add_elt(Voice_element*);
     virtual Input_music *clone() const {
        return new Music_general_chord(*this);
index 71586d8d5ca13dfaa03ad7d95a450cfc90a215ca..105efd0aa714ed3d3869450edb2a0a2687b796d7 100644 (file)
@@ -7,7 +7,7 @@
 #ifndef LEASTSQUARE_HH
 #define LEASTSQUARE_HH
 #include "vray.hh"
-#include "boxes.hh"
+#include "offset.hh"
 
 struct Least_squares {
     svec<Offset> input;
index 54704508e6183aa25c20a9c177141a39c5825cda..8a8742142c9a52deab4b4a34f2cbe3cad7375bcb 100644 (file)
@@ -14,8 +14,8 @@ struct Colinfo {
     Real fixpos;
     Colinfo();
     void print() const;
-    Real minright() const { return pcol_->width().max; }
-    Real minleft() const { return -pcol_->width().min; }
+    Real minright() const { return pcol_->width().right; }
+    Real minleft() const { return -pcol_->width().left; }
 };
 
 
index ecb55bd03c126bb30cfbdb2a7404faf38001c0f9..5f3a3e786054eb11cc54f21d6d604d706bfed006 100644 (file)
@@ -42,7 +42,8 @@ struct Lookup {
     Symbol half_slur(int dy, Real &dx, int dir, int xpart);
     Symbol half_slur_middlepart(Real &dx, int dir);
     Symbol big_slur(int dy, Real &dx, int dir);
-    
+    Symbol text(String style, String text, int align = 1);
+
 
 
     Lookup();
index 45785e4c020292c16b69b1f5865bd0e48c254d0c..db7dd88b8311bea4277519d242dc4e26281ce9a3 100644 (file)
@@ -19,7 +19,7 @@ struct Melodic_staff : public Simple_staff
     virtual void set_output(PScore *);
 
     virtual Item* get_TYPESET_item(Command*);
-    virtual Stem * get_stem(Stem_req *rq,Real);
+    virtual Stem * get_stem(Stem_req *rq,Moment);
     virtual Notehead * get_notehead(Note_req *rq, int bot);
     virtual Local_key_item* get_local_key_item();
 };
index 376f048c0ecb2b83260f9e0eda0994a2b6a8f139..fa8787674814708e5495751e033da6e94ebc15f3 100644 (file)
@@ -2,16 +2,22 @@
 #define MISC_HH
 
 #include "real.hh"
+#include "moment.hh"
 
-Real wholes(int dur, int dots);
+Moment wholes(int dur, int dots);
     
 double log_2(double x) ;
 int intlog2(int d);
 inline int
-ABS(int i)
-{
+abs(int i){
     return (i < 0)?-i:i;
 }
+inline int
+sign(int i) {
+    if (i<0) return -1;
+    else if (i) return 1;
+    else return 0;
+}
 
 
 #endif
index 83910b1a3106a5e9ca84cbc1a5bb4835952a8aca..332774138486bc6fd3f6bd52e32716f3ebe90768 100644 (file)
@@ -1,36 +1,13 @@
 /*
-  moment.hh -- part of LilyPond
-
   (c) 1996 Han-Wen Nienhuys
 */
 
 #ifndef MOMENT_HH
 #define MOMENT_HH
 
-#include "real.hh"
-
-
-struct Moment {
-    Real when;
-    /// current measure info
-    Real whole_per_measure;
-
-    /// where am i 
-    Real whole_in_measure;
-
-    /// how long is one beat?
-    Real one_beat;
+#include "rational.hh"
 
-    /// idem
-    int bars;
-    /****************/
-    void OK() const;
-    Moment(Real, const Moment*);
-    void print() const;
-    void setpartial(Real p);
-    Real barleft();
-    void set_meter(int,int);
-};
+typedef Rational Moment;
 
-#endif // MOMENT_HH
+#endif // 
 
diff --git a/hdr/offset.hh b/hdr/offset.hh
new file mode 100644 (file)
index 0000000..b186700
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+  offset.hh -- part of LilyPond
+
+  (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef OFFSET_HH
+#define OFFSET_HH
+#include "real.hh"
+
+/// 2d vector 
+struct Offset {
+    Real x,y;
+
+    Offset operator+(Offset o)const {
+       Offset r(*this);
+       r+=o;
+       return r;
+    }
+    
+    Offset operator+=(Offset o) {
+       x+=o.x;
+       y+=o.y;
+       return *this;
+    }
+    Offset(Real ix , Real iy) {
+       x=ix;
+       y=iy;
+    }
+    Offset() {
+       x=0.0;
+       y=0.0;
+    }
+};
+
+#endif // OFFSET_HH
+
+
index b03d1f76210abbacf90e9c1c184a261c7820ecb8..34c6ce3e20268453c8a766cce085ad5810dd7cda 100644 (file)
@@ -1,6 +1,7 @@
 #include "proto.hh"
 #include "real.hh"
 #include "string.hh"
+#include "moment.hh"
 
 /// symbols, dimensions and constants
 struct Paperdef {
@@ -26,7 +27,7 @@ struct Paperdef {
     Real standard_height()const;
     Real note_width() const;
     void print() const;
-    Real duration_to_dist(Real);
+    Real duration_to_dist(Moment);
 };
 /** This struct takes care of all kinds of symbols, dimensions and
  constants. Most of them are related to the point-size of the fonts,
index 217b2f7f588dfc928817b5174e0cc2907968228e..c20d981f151f5bbf132e885a164aed67d0599854 100644 (file)
@@ -30,7 +30,6 @@ struct Dynamic;
 struct Idealspacing;
 struct Identifier;
 struct Input_commands;
-struct Interval;
 struct Item;
 struct Key;
 struct Keyitem;
@@ -95,5 +94,6 @@ struct Keyword_table;
 struct Rhythmic_grouping;
 struct Staff_commands_at ;
 struct Commands_at ;
-struct Moment;
+struct Time_description;
+
 #endif // PROTO_HH
index d8ee21ccc780cecaa538084cd952592c6ab52d16..279947a21cab04c7bdea14633bea6d86f279e25a 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "glob.hh"
 #include "string.hh"
+#include "moment.hh"
 
 /// a voice element wants something printed
 struct Request {
@@ -21,7 +22,7 @@ struct Request {
     virtual Beam_req *beam() { return 0 ; }
     virtual Slur_req *slur() { return 0 ; }
     virtual  Rhythmic_req*rhythmic() { return 0;}
-    virtual Real duration() const { return 0.0; }
+    virtual Moment duration() const { return 0.0; }
     virtual Request* clone() const =0;
 };
 
@@ -63,7 +64,7 @@ struct Rhythmic_req : Request {
     
     /****************/
 
-    Real duration() const;
+    Moment duration() const;
     Rhythmic_req();
     Rhythmic_req*rhythmic() { return this;}
     void print ()const;
@@ -207,7 +208,7 @@ try to put an appropriate number over the bracket
 
 /// helper in the hierarchy
 struct Dynamic {
-    Real subtime;
+    Moment subtime;
 };
 /** Each dynamic is bound to one note ( a crescendo spanning multiple
     notes is thought to be made of two "dynamics": a start and a stop).
index 8591e3c1a0a53c14e3eff190844516bbf2503e48..978594dcd38230f868a0b1146fc5e1890ac03d32 100644 (file)
@@ -16,7 +16,7 @@ struct Rhythmic_staff : public Simple_staff
     /****************/
     
     virtual Item *get_TYPESET_item(Command*);    
-    virtual Stem *get_stem(Stem_req *rq,Real);
+    virtual Stem *get_stem(Stem_req *rq,Moment);
     virtual Notehead * get_notehead(Note_req *rq, int b);   
     virtual void set_output(PScore *);
 };
index b61a02682f10aefd1cc01f281ad02ab2763bad6f..8c1d82b3aede30e62d7dd7a39e4a46f833a5b6aa 100644 (file)
@@ -6,8 +6,9 @@
 
 #ifndef SCCOL_HH
 #define SCCOL_HH
-#include "pcol.hh"
+#include "proto.hh"
 #include "vray.hh"
+#include "moment.hh"
 
 
 struct Score_column {
@@ -16,24 +17,20 @@ struct Score_column {
     PCol * pcol_;
 
     /// length of notes/rests in this column
-    svec<Real> durations;
+    svec<Moment> durations;
     
-    Real when;
+    Moment when;
 
     /// 
     bool musical;
     
     /****************/
     
-    Score_column(Real when);       
-    static int compare(Score_column & c1, Score_column &c2) {
-       return sgn(c1.when - c2.when);
-    }
-    void add_duration(Real );
+    Score_column(Moment when);       
+    static int compare(Score_column & c1, Score_column &c2);
+    void add_duration(Moment );
     void preprocess();
-    void set_breakable() {
-        pcol_->set_breakable();
-    }
+    void set_breakable();
     bool used();
     void print() const;
 };
index fbcfde1fc06d63daf9d9bb2f1504ec8ba9372d0a..5363b475cb44d7c7a3114139bc82d32f044de8d8 100644 (file)
@@ -3,7 +3,7 @@
 #include "vray.hh"
 #include "proto.hh"
 #include "plist.hh"
-
+#include "moment.hh"
 
 /// the total music def of one movement
 struct Score {
@@ -25,12 +25,12 @@ struct Score {
 
 
     void OK() const;
-    PCursor<Score_column *> find_col(Real,bool);
+    PCursor<Score_column *> find_col(Moment,bool);
     void process();
     void output(String fn);
-    PCursor<Score_column*> create_cols(Real);
+    PCursor<Score_column*> create_cols(Moment);
     void print() const;
-    Real last() const;
+    Moment last() const;
     
 private:
     void do_pcols();    
index faf1002d53a01dc03874e2a0ad851ee95e35ddc0..d05179b1bab7ba21d9bfcfe90f1f2245b403e7dd 100644 (file)
@@ -24,7 +24,7 @@ struct Simple_column : Staff_column {
     svec<Rhythmic_req *> notes;
     svec<Slur_req *> slurs;
     Stem_req *stem_;
-    Real stem_requester_len;
+    Moment stem_requester_len;
     Beam_req *beam_;
     Simple_staff* staff_;
 
@@ -52,7 +52,7 @@ struct Simple_staff : Staff {
     Staff_column*create_col(Score_column*);
     
     virtual Item *get_TYPESET_item(Command*);
-    virtual Stem *get_stem(Stem_req *rq, Real)=0;
+    virtual Stem *get_stem(Stem_req *rq, Moment)=0;
     virtual Notehead *get_notehead(Note_req *rq, int b)=0;
     virtual Rest *get_rest(Rest_req *rq);
     virtual void set_output(PScore *);
index 6394bc79db2183ae02a0d5afe384f092649c17ab..261394c20648532587b5a059ef9f87a82977fa03 100644 (file)
@@ -25,7 +25,7 @@ struct Simple_walker: Staff_walker {
     Clef clef_;
     Rhythmic_grouping default_grouping;
     Rhythmic_grouping *current_grouping;
-    Real inbar;
+//    Real inbar;                      // whuh?
     
     svec<Slur_req*> pending_slur_reqs;
     svec<Slur*>  pending_slurs;
index 10b588457174d17beb4bf0acfd68ecb94d641ac7..df144a88ee8ddd761efe5143337d7cd68ee56945 100644 (file)
@@ -7,19 +7,20 @@
 #ifndef SLUR_HH
 #define SLUR_HH
 
-#include "spanner.hh"
+#include "directionalspanner.hh"
 #include "fproto.hh"
 #include "vray.hh"
 
-struct Slur : Spanner {
+struct Slur : Directional_spanner {
 
     svec<Notehead*> encompass;
-    int dir;
+    //int dir;
 
     bool open_left,open_right;                 
 
     /****************/
-
+    Offset center() const;
+    void calculate();
     void print()const;    
     void preprocess();
     void add(Notehead*);
index cfaca3dec95263d4a575e404c27be9e1ebe8fa04..86d63527ae962d50ee4535af507715bbded3e545 100644 (file)
@@ -6,7 +6,9 @@
 
 #ifndef SPANNER_HH
 #define SPANNER_HH
+
 #include "proto.hh"
+#include "interval.hh"
 
 /// a symbol which is attached between two columns.
 struct Spanner {
@@ -18,14 +20,19 @@ struct Spanner {
 
     String TeXstring () const ;
     Spanner();
-    Paperdef*paper() const;
+    Paperdef *paper() const;
     virtual ~Spanner();
     virtual Interval height()const=0;
     /**
       PRE:
       processed
       */
-    virtual Interval width()const;
+  /// do calcs
+    virtual void calculate();
+    /**
+      It is safe to call calculate multiple times on one object
+      */
+   virtual Interval width()const;
     virtual void process();
     virtual void preprocess();
 
index 9f1ba1f498e48e7273125848bf7a0fe0836e741b..5414fc3f8b3aa905d1733672f60388801d3c01e3 100644 (file)
@@ -21,7 +21,7 @@ struct Staff {
 
     /****************************************************************/
     void add(PointerList<Voice*> &s);
-    void process_commands(Real l);
+    void process_commands(Moment l);
 
     Staff(const Staff&src);
     void add_voice(Voice *v);
@@ -37,9 +37,9 @@ struct Staff {
 
     void OK() const;
     void print() const;
-    Real last() const;
+    Moment last() const;
     void clean_cols() ;
-    Staff_column * get_col(Real,bool);
+    Staff_column * get_col(Moment,bool);
 
     Staff();
 
index 2fb564eb625b3093dc60c27a269ab5dd36c9c617..633b73285cfb9e739d466a8940fb88b6ccc7e312 100644 (file)
@@ -8,17 +8,17 @@
 #include "command.hh"
 #include "vray.hh"
 #include "plist.hh"
-#include "moment.hh"
+#include "timedescription.hh"
 
 
 struct Staff_commands_at : public IPointerList<Command*> {
-    Moment moment_;
+    Time_description tdescription_;
     
     /****************/
     
     bool is_breakable();
-    Real when();
-    Staff_commands_at(Moment);
+    Moment when();
+    Staff_commands_at(Time_description);
     void set_breakable();
     void add_command_to_break(Command pre, Command mid,Command post);
     void print() const;
@@ -31,12 +31,12 @@ struct Staff_commands_at : public IPointerList<Command*> {
 /// the list of commands in Score
 struct Staff_commands : public IPointerList<Staff_commands_at*>
 {
-    Staff_commands_at*find(Real);
+    Staff_commands_at*find(Moment);
     void add(Staff_commands_at*);
-    void clean(Real last);
+    void clean(Moment last);
     void OK() const;
     void print() const;
-    Real last() const;
+    Moment last() const;
 };
 /** the list of commands in Score. Put in a separate class, since it
   otherwise clutters the methods of Score.
index 823e9e9126a9f34a674bfb7ef67ba4bac5083210..9e7501edc752f3eb4f22946a16bb355e0cdf7fc6 100644 (file)
@@ -8,6 +8,7 @@
 #define STCOL_HH
 #include "proto.hh"
 #include "vray.hh"
+#include "moment.hh"
 
 /// store simultaneous requests
 struct Staff_column {
@@ -20,13 +21,13 @@ struct Staff_column {
     /// idem
     Staff_commands_at *s_commands;
 
-    Moment *moment_;
+    Time_description *tdescription_;
     
     /****************/
     
     Staff_column(Score_column*s); 
     bool mus() const;
-    Real when() const;
+    Moment when() const;
     void add(Voice_element*ve);
 
     /****************************************************************
index ff64a3af91b521c3872dcd16a3224be272dc75c3..768b614118622cd539a1712b3b49d807a4ba37de 100644 (file)
@@ -8,11 +8,12 @@
 #define STEM_HH
 #include "item.hh"
 #include "vray.hh"
+#include "moment.hh"
 
 /// the rule attached to the ball
 struct Stem : public Item {
     /// rhythmical length
-    Real note_length;
+    Moment note_length;
     
     // heads the stem encompasses (positions)
     int minnote, maxnote;
@@ -60,7 +61,7 @@ struct Stem : public Item {
     void set_noteheads();
     void postprocess();
     void preprocess();
-    Stem(int center, Real duration);
+    Stem(int center, Moment duration);
 
     Interval width() const;
 private:
index da132dd9d6275c51fb0e26548ea8c241275f78a4..0d66a55fb4c91e9b5e95ea0d9a7abca4f58cc1e2 100644 (file)
@@ -19,7 +19,7 @@ struct Staff_walker : public PCursor<Staff_column*> {
     /****************/
 
     int priority() const;              // Command
-    Real when() const;    
+    Moment when() const;    
     virtual ~Staff_walker();
     Staff_walker(Staff*, PScore*);
     void process() ;
diff --git a/hdr/textspanner.hh b/hdr/textspanner.hh
new file mode 100644 (file)
index 0000000..6a0aa3e
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+  textspanner.hh -- part of LilyPond
+
+  (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef TEXTSPANNER_HH
+#define TEXTSPANNER_HH
+
+#include "string.hh"
+#include "directionalspanner.hh"
+
+/// a spanner which puts texts on top of other spanners.
+struct Text_spanner : Spanner {
+    int align;
+    String text;
+    String style;
+    Directional_spanner*support;
+    /****************/
+    virtual    void process();
+    virtual    void preprocess();
+    virtual    Interval height() const;
+    virtual Spanner* broken_at(PCol*,PCol*)const;
+    Text_spanner(Directional_spanner*);
+};
+/**
+  Use for triplets, eentweetjes, ottava, etc.
+  */
+
+#endif // TEXTSPANNER_HH
+
diff --git a/hdr/timedescription.hh b/hdr/timedescription.hh
new file mode 100644 (file)
index 0000000..2cdbc8d
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+  moment.hh -- part of LilyPond
+
+  (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef tdes_HH
+#define tdes_HH
+
+#include "real.hh"
+#include "moment.hh"
+
+struct Time_description {
+    Rational when;
+    /// current measure info
+    Rational whole_per_measure;
+
+    /// where am i 
+    Rational whole_in_measure;
+
+    /// how long is one beat?
+    Rational one_beat;
+
+    /// idem
+    int bars;
+    /****************/
+    void OK() const;
+    Time_description(Rational, const Time_description*);
+    void print() const;
+    void setpartial(Rational p);
+    Rational barleft();
+    void set_meter(int,int);
+};
+
+#endif // Time_description_HH
+
index c716c650dc45eb7e1df060296806a14ce6040fae..f63f905a0d68ae2977f4698411d6945f2d179c03 100644 (file)
@@ -3,15 +3,16 @@
 
 #include "proto.hh"
 #include "plist.hh"
+#include "moment.hh"
 
 /// class for  horizontal stuff.
 struct Voice {
     IPointerList<Voice_element *> elts;
-    Real start;
+    Moment start;
 
     /****************/
-    Real when(const Voice_element*)const;
-    Real last() const;
+    Moment when(const Voice_element*)const;
+    Moment last() const;
     Voice();
     Voice(Voice const&);
     void add(Voice_element*);
@@ -30,7 +31,7 @@ struct Voicegroup {
 
 /// one horizontal bit. 
 struct Voice_element {
-    Real duration;
+    Moment duration;
     const Voicegroup *group;
     const Voice *voice_;
     IPointerList<Request*> reqs;
diff --git a/init/Makefile b/init/Makefile
new file mode 100644 (file)
index 0000000..9e9b75f
--- /dev/null
@@ -0,0 +1,5 @@
+DFILES=dutch.ini table_sixteen.ini table_twenty.ini\
+       english.ini
+
+dist:
+       ln Makefile $(DFILES) $(DDIR)/$(INITDIR)
diff --git a/init/dutch.ini b/init/dutch.ini
new file mode 100644 (file)
index 0000000..d573656
--- /dev/null
@@ -0,0 +1,11 @@
+dutch_names = 
+notenames {
+       "ceses" 0 -2 "ces" 0 -1         "c" 0 0         "cis" 0 1 "cisis" 0 2
+       "deses" 1 -2 "des" 1 -1         "d" 1 0         "dis" 1 1 "disis" 1 2
+       "eses"  2 -2 "es"  2 -1         "e" 2 0         "eis" 2 1 "eisis" 2 2
+       "feses" 3 -2 "fes" 3 -1         "f" 3 0         "fis" 3 1 "fisis" 3 2
+       "geses" 4 -2 "ges" 4 -1         "g" 4 0         "gis" 4 1 "gisis" 4 2
+       "ases"  5 -2 "as"  5 -1         "a" 5 0         "ais" 5 1 "aisis" 5 2
+       "beses" 6 -2 "bes" 6 -1         "b" 6 0         "bis" 6 1 "bisis" 6 2
+}
+
diff --git a/init/english.ini b/init/english.ini
new file mode 100644 (file)
index 0000000..d876d29
--- /dev/null
@@ -0,0 +1,13 @@
+
+%
+% f = flat, s = sharp.
+%
+english_names = notenames {
+       "cff" 0 -2 "cf" 0 -1    "c" 0 0         "cs" 0 1 "css" 0 2
+       "dff" 1 -2 "df" 1 -1    "d" 1 0         "ds" 1 1 "dss" 1 2
+       "eff" 2 -2 "ef" 2 -1    "e" 2 0         "es" 2 1 "ess" 2 2
+       "fff" 3 -2 "ff" 3 -1    "f" 3 0         "fs" 3 1 "fss" 3 2
+       "gff" 4 -2 "gf" 4 -1    "g" 4 0         "gs" 4 1 "gss" 4 2
+       "aff" 5 -2 "af" 5 -1    "a" 5 0         "as" 5 1 "ass" 5 2
+       "bff" 6 -2 "bf" 6 -1    "b" 6 0         "bs" 6 1 "bss" 6 2
+}
diff --git a/init/table_sixteen.ini b/init/table_sixteen.ini
new file mode 100644 (file)
index 0000000..8b506b8
--- /dev/null
@@ -0,0 +1,99 @@
+table_sixteen=
+symboltables {
+       
+   texid       "\musixsixteendefs"
+
+   % index TeXstring,  xmin xmax ymin ymax
+
+
+     "style" = table {
+               "roman" "\settext{%}" 0pt 0pt 0pt 0pt
+               "italic"        "\setitalic{%}" 0pt 0pt 0pt 0pt
+     }
+     "align" = table {
+               "-1"    "\leftalign{%}" 0pt 0pt 0pt 0pt
+               "0"     "\centeralign{%}" 0pt 0pt 0pt 0pt
+               "1"     "\rightalign{%}" 0pt 0pt 0pt 0pt
+       }
+
+     "clefs" = table {
+            "violin"   "\violinclef"           0pt     12.8pt  -10pt   18pt
+            "bass"     "\bassclef"             0pt     11.2pt  0pt     16pt
+            "viola"    "\violaclef"            0pt     12.8pt  0pt     16pt
+            "violin_change"    "\cviolinclef"  0pt     11.2pt  -12pt   12pt
+            "bass_change"      "\cbassclef"    0pt     12.8pt  0pt     16pt
+            "viola_change"     "\cviolaclef"   0pt     11.2pt  0pt     16pt
+     }
+
+     "balls" = table {
+            "1"        "\wholeball"    0pt     6pt     -2 pt   2pt
+            "2"        "\halfball"     0pt     5pt     -2 pt   2pt
+            "4"        "\quartball"    0pt     5pt     -2 pt   2pt
+     }
+
+     "slur" = table {
+            "whole"    "\slurchar%{%}" 0pt     0pt     0pt     0pt
+            "half"     "\hslurchar%{%}"        0pt     0pt     0pt     0pt
+     }
+     "accidentals" = table {
+            "-2"       "\flatflat"     0pt     10.2pt  -2.5pt 7.5pt
+            "-1"       "\flat"         0pt     6pt     -2.5pt 7.5pt
+            "0"        "\natural"      0pt     6pt     -7.5pt 7.5pt
+            "1"        "\sharp"                0pt     6pt     -7.5pt 7.5pt
+            "2"        "\sharpsharp"   0pt     6pt     -2.5pt 7.5pt
+     }
+
+     "streepjes" = table {
+            "toplines" "\toplines{%}"  -3pt    9pt 0pt 0pt
+            "botlines" "\botlines{%}"  -3pt    9pt 0pt 0pt
+     }
+
+     "bars" = table {
+            "empty"    "\emptybar"     0pt     0pt     0pt     0pt
+            "|"        "\maatstreep"   0pt     5pt     -12pt   12pt
+            "||"       "\finishbar"    0pt     2pt     -12pt   12pt
+     }
+
+     "rests" = table {
+            "1"        "\wholerest"            -5pt    1pt     -1pt    1pt
+            "2"        "\halfrest"             -5pt    1pt     -1pt    1pt
+            "4"        "\quartrest"            -5pt    2pt     -5pt    5pt
+            "8"        "\eighthrest"           0pt     5pt     0pt     8pt
+            "16"       "\sixteenthrest"                0pt     6pt     0pt     12pt
+            "32"       "\thirtysecondrest"     0pt     6pt     0pt     16pt
+     }
+
+     "meters" = table {
+            "C"        "\fourfourmeter"                0pt     10pt    -5pt    5pt
+            "C2"       "\allabreve"            0pt     10pt    -5pt    5pt
+     }
+
+     % dims ignored for this table
+     "param" = table {
+            "meter"    "\generalmeter{%}{%}"   -3pt    10pt    -5pt    5pt
+            "linestaf" "\linestafsym{%}{%}"
+            "stem"     "\stem{%}{%}"           
+            "fill"     "\hbox{}"
+     }
+
+     "dots" = table {
+            "1"        "\lsingledot"           0pt     2pt     -1pt    1pt
+            "2"        "\ldoubledot"           0pt     5pt     -1pt    1pt
+            "3"        "\ltripledot"           0pt     8pt     -1pt    1pt
+     }
+
+     "flags" = table {
+            "8"        "\eigthflag"            0pt     4pt     0pt     0pt     
+            "16"       "\sixteenthflag"                0pt     4pt     0pt     0pt
+            "32"       "\thirtysecondflag"     0pt     4pt     0pt     0pt
+            "-8"       "\deigthflag"           0pt     4pt     0pt     0pt
+            "-16"      "\dsixteenthflag"               0pt     4pt     0pt     0pt
+            "-32"      "\dthirtysecondflag"    0pt     4pt     0pt     0pt
+     }
+
+     "beamslopes" = table {
+            "slope"    "\beamslope{%}{%}" 
+            "horizontal"       "\rulesym{%}{%}"        
+     }
+
+}
diff --git a/init/table_twenty.ini b/init/table_twenty.ini
new file mode 100644 (file)
index 0000000..1b49eab
--- /dev/null
@@ -0,0 +1,103 @@
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+table_twenty = symboltables {
+
+    texid      "\musixtwentydefs"
+
+     "style" = table {
+               "roman" "\settext{%}" 0pt 0pt 0pt 0pt
+               "italic"        "\setitalic{%}" 0pt 0pt 0pt 0pt
+     }
+     "align" = table {
+               "-1"    "\leftalign{%}" 0pt 0pt 0pt 0pt
+               "0"     "\centeralign{%}" 0pt 0pt 0pt 0pt
+               "1"     "\rightalign{%}" 0pt 0pt 0pt 0pt
+       }
+
+
+    % index TeXstring,         xmin xmax ymin ymax
+    % be careful with editing this:
+    % the "index" entry is hardwired into lilypond.
+
+    "clefs" = table {
+           "violin"    "\violinclef"   0pt     16pt    -12.5pt 22.5pt
+           "bass"      "\bassclef"             0pt     16pt    0pt     20pt
+           "viola"     "\violaclef"            0pt     16pt    0pt     20pt
+           "violin_change"     "\cviolinclef"  0pt     16pt    -12.5pt 22.5pt
+           "bass_change"       "\cbassclef"    0pt     16pt    0pt     20pt
+           "viola_change"      "\cviolaclef"   0pt     16pt    0pt     20pt
+    }
+
+    "balls" = table {
+           "1" "\wholeball"    0pt     7.5pt   -2.5pt  2.5pt
+           "2" "\halfball"     0pt     6pt     -2.5pt  2.5pt
+           "4" "\quartball"    0pt     6pt     -2.5pt  2.5pt
+    }
+
+    "slur" = table {
+           "whole"     "\slurchar%{%}" 0pt     0pt     0pt     0pt
+           "half"      "\hslurchar%{%}"        0pt     0pt     0pt     0pt
+    }
+    "accidentals" = table {
+           "-2"        "\flatflat"     0pt     10.2pt  -2.5pt 7.5pt
+           "-1"        "\flat"         0pt     6pt     -2.5pt 7.5pt
+           "0" "\natural"      0pt     6pt     -7.5pt 7.5pt
+           "1" "\sharp"                0pt     6pt     -7.5pt 7.5pt
+           "2" "\sharpsharp"   0pt     6pt     -2.5pt 7.5pt
+    }
+
+    "streepjes" = table {
+           "toplines"  "\toplines{%}"  -3pt    9pt 0pt 0pt
+           "botlines"  "\botlines{%}"  -3pt    9pt 0pt 0pt
+    }
+
+    "bars" = table {
+           "empty"     "\emptybar"     0pt     0pt     0pt     0pt
+           "|" "\maatstreep"   0pt     5pt     -12pt   12pt
+           "||"        "\finishbar"    0pt     2pt     -12pt   12pt
+    }
+
+    "rests" = table {
+           "1" "\wholerest"            -5pt    1pt     -1pt    1pt
+           "2" "\halfrest"             -5pt    1pt     -1pt    1pt
+           "4" "\quartrest"            -5pt    2pt     -5pt    5pt
+           "8" "\eighthrest"           0pt     5pt     0pt     8pt
+           "16"        "\sixteenthrest"                0pt     6pt     0pt     12pt
+           "32"        "\thirtysecondrest"     0pt     6pt     0pt     16pt
+    }
+
+    "meters" = table {
+           "C" "\fourfourmeter"                0pt     10pt    -5pt    5pt
+           "C2"        "\allabreve"            0pt     10pt    -5pt    5pt
+    }
+
+    % dims ignored for this table
+    "param" = table {
+           "meter"     "\generalmeter{%}{%}"   -3pt    10pt    -5pt    5pt
+           "linestaf"  "\linestafsym{%}{%}"    
+           "stem"      "\stem{%}{%}"           
+            "fill"     "\hbox{}"
+    }
+
+    "dots" = table {
+           "1" "\lsingledot"           0pt     8pt     -1pt    1pt
+           "2" "\ldoubledot"           0pt     12pt    -1pt    1pt
+           "3" "\ltripledot"           0pt     16pt    -1pt    1pt
+    }
+
+    "flags" = table {
+           "8" "\eigthflag"            0pt     5pt     0pt     0pt     
+           "16"        "\sixteenthflag"                0pt     5pt     0pt     0pt
+           "32"        "\thirtysecondflag"     0pt     5pt     0pt     0pt
+           "-8"        "\deigthflag"           0pt     5pt     0pt     0pt
+           "-16"       "\dsixteenthflag"               0pt     5pt     0pt     0pt
+           "-32"       "\dthirtysecondflag"    0pt     5pt     0pt     0pt
+    }
+
+    "beamslopes" = table {
+           "slope"     "\beamslope{%}{%}"
+           "horizontal"        "\rulesym{%}{%}"        
+    }
+
+}
index 0c70462bc0a87a8c7b14816fde2e75ddbf2f3299..da2c971f2f430e31cd17e6714ef7a5fc85223bc3 100644 (file)
@@ -23,6 +23,7 @@
        \font\hslurdfont=xslhd20
        \font\hslurhfont=xslhz20
        \font\musicfnt=musix20
+       \font\italicfont=cmti10
        \balkhoog=20pt
        \notewidth=6pt
        \staffrulethickness=0.4pt
@@ -31,6 +32,7 @@
 }
 \def\musixsixteendefs{
        \font\textfont=cmr8
+       \font\italicfont=cmti8
        \font\slurufont=xslu16
        \font\slurdfont=xsld16
        \font\slurhfont=xslz20 % sigh
        \vskip 10pt
 }
 \def\ugly{\nointerlineskip\par
-\vskip 40pt\par\vbox{\hbox to 0pt{\vrule width30pt height1pt\hss}}\par\vskip 40pt
+\vskip 40pt\par\vbox{\leftalign{\vrule width30pt height1pt}}\par\vskip 40pt
 }
 \def\interscoreline{\beauty}
 
 %
 % a staffsymbol with #1 lines, width #2
 % bottom at baseline
-\def\linestafsym#1#2{\hbox to 0pt{\vbox to 0pt{\vss\lines{#1}{#2}}\hss}}
+\def\linestafsym#1#2{\leftalign{\vbox to 0pt{\vss\lines{#1}{#2}}}}
 
 \def\vcenter#1{\vbox to 0pt{\vss #1\vss}}
 \def\topalign#1{\vbox to 0pt{#1\vss}}
 \def\stem#1#2{\vrule height#2 depth-#1}
 
 \def\placebox#1#2#3{%
-       \vbox to 0pt{\vss\hbox{\raise #1\hbox to 0pt{\kern #2{}#3\hss}}}%
+       \vbox to 0pt{\vss\hbox{\raise #1\leftalign{\kern #2{}#3}}}%
 }
 
 
 \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
+\def\rulesym#1#2{\vrule height #1 width #2}
+
+\def\settext#1{\textfont #1}
+\def\setitalic#1{\italicfont #1}
+
+\def\centeralign#1{\hbox to 0pt{\hss#1\hss}}
+\def\leftalign#1{\hbox to 0pt{#1\hss}}
index 2ce1ab655a2fda9bc12c148d25fb641c8a721013..d0ca0dfb75d3387b74b6eafc00bbb6a0052b36b9 100644 (file)
@@ -1,9 +1,9 @@
 ritme = staff {rhythmic
        music {$
        c8
-       [a8 a8. a8 a16 a16 a16] c4.
+       [a8() a8. a8 a16 a16 a16] c4.
                
-       %[c8( )'a8 c8 c8]
+       %[c8( )'a8() c8 c8]% BUG!
        c2 c2
        
        [fis16 'dis16( fis16 'dis16 ][fis16) 'dis16 fis16 'dis16]
@@ -61,11 +61,9 @@ score {
        paper {
                geometric 1.4
                unitspace 3.0 cm
-%              symboltables { table_sixteen}
        }
        staff { ritme }
        staff { melody }
-%      staff { melody }
        commands {
                meter 4 4
                partial 8
index 9cb43f57313e0d4f83a7896e2a164e2ba04f2f91..85d5cc4812d58dab92f001d9e83976f1d9360754 100644 (file)
@@ -27,13 +27,23 @@ 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);
+    idealy  = max(dir*s->top, dir*s->bot);
+    miny = max(dir*s->minnote, dir*s-> maxnote);
     assert(miny <= idealy);
     no_beams = s->flag;
 }
 
 /****************/
+Offset
+Beam::center()const
+{
+    if(!dir)
+        ((Beam*)this)->calculate();
+    Real w=width().length()/2;
+    return Offset(w,
+                  (left_pos + w* slope)*paper()->interline());
+}
+
 
 Beam::Beam()
 {
@@ -143,7 +153,7 @@ Beam::set_grouping(Rhythmic_grouping def, Rhythmic_grouping cur)
        PCursor<Stem*> s(stems);
        svec<int> flags;
        for (; s.ok(); s++) {
-           int f = intlog2(ABS(s->flag))-2;
+           int f = intlog2(abs(s->flag))-2;
            assert(f>0);
            flags.add(f);
        }
index b280e45f921dbf287812dcd86db74b9933a07a35..d6564663a1e63710df939c2ffbfb60a0eed5c601 100644 (file)
@@ -2,14 +2,6 @@
 #include "const.hh"
 #include "vray.hh"
 
-Box::Box(svec<Real> &s)
-{
-    assert(s.sz() == 4);
-    x.min = s[0];
-    x.max = s[1];
-    y.min = s[2];
-    y.max = s[3];
-}
 
 Box::Box()
 {        
index 9db9472113b986bdcfd5eea28135ff45eb381734..faf88d6ead48fdde8b0929668011a566d28dbe52 100644 (file)
@@ -45,12 +45,12 @@ Score::calc_idealspacing()
        if (i->musical) {
            assert(j.ok());
            for (int n=0; n < i->durations.sz(); n++) {
-               Real d = i->durations[n];
+               Moment d = i->durations[n];
                Real dist = paper_->duration_to_dist(d);
                while (j->when < d + i->when)
                    j++;
                
-               assert( distance(j->when, d+i->when) < 1e-8);
+               assert( j->when== d+i->when);
 
                connect(i->pcol_, j->pcol_, dist);
                if (!j->musical && (j+1).ok() 
@@ -65,7 +65,7 @@ Score::calc_idealspacing()
              the last col is breakable, and therefore in use
              */
            
-           Real d = j->when - i->when;
+           Moment d = j->when - i->when;
            Real dist = (d) ? paper_->duration_to_dist(d) :
                convert_dimen(2,"pt"); // todo
            
diff --git a/src/directionalspanner.cc b/src/directionalspanner.cc
new file mode 100644 (file)
index 0000000..49bb67d
--- /dev/null
@@ -0,0 +1,6 @@
+#include "directionalspanner.hh"
+
+Directional_spanner::Directional_spanner()
+{
+    dir = 0;
+}
index 4c77034bd18582f0671244af3df6171d83de32c2..3252178849d0b0bcff1b36372ad2a23ddb8b558a 100644 (file)
@@ -10,26 +10,26 @@ Rhythmic_grouping::OK()const
     for (int i= 0; i < children.sz(); i++) {
        children[i]->OK();
        if (i>0)
-           assert(children[i-1]->interval().max ==
-                  children[i]->interval().min);
+           assert(children[i-1]->interval().right ==
+                  children[i]->interval().left);
     }
 }
 
-Real
+Moment
 Rhythmic_grouping::length() const
 {
     return interval().length();
 }
 
-Interval
+MInterval
 Rhythmic_grouping::interval()const
 {
     if (interval_)
        return *interval_;
     else
        return
-           Interval(children[0]->interval().min,
-                    children.last()->interval().max);
+           MInterval(children[0]->interval().left,
+                    children.last()->interval().right);
 }
 
 void
@@ -50,14 +50,14 @@ Rhythmic_grouping::split(Rhythmic_grouping r)
 }
 
 
-svec<Interval>
+svec<MInterval>
 Rhythmic_grouping::intervals()
 {
-    svec<Interval> r;
+    svec<MInterval> r;
     if (interval_ || children.sz() == 1) {
-       Interval i(interval());
-       Interval r1(i), r2(i);
-       r1.max = r2.min = i.center();
+       MInterval i(interval());
+       MInterval r1(i), r2(i);
+       r1.right = r2.left = i.center();
        r.add(r1); r.add(r2);
     } else {
        for (int i=0; i < children.sz(); i++)
@@ -66,20 +66,20 @@ Rhythmic_grouping::intervals()
     return r;
 }
 
-Rhythmic_grouping::Rhythmic_grouping(Interval t, int n)
+Rhythmic_grouping::Rhythmic_grouping(MInterval t, int n)
 {
     if (n == 1 || !n) {
-       interval_ = new Interval(t);
+       interval_ = new MInterval(t);
        return;
     }
-    Real dt = t.length()/n;
-    Interval basic = Interval(t.min, t.min+dt);
+    Moment dt = t.length()/n;
+    MInterval basic = MInterval(t.left, t.left+dt);
     for (int i= 0; i < n; i++)
        children.add(new Rhythmic_grouping( dt*i + basic ));
 }
 
 void
-Rhythmic_grouping::intersect(Interval t)
+Rhythmic_grouping::intersect(MInterval t)
 {
     if (interval_) {
        interval_->intersect(t);
@@ -87,8 +87,8 @@ Rhythmic_grouping::intersect(Interval t)
     }
     
     for (int i=0; i < children.sz(); i++) {
-       Interval inter = intersection(t, children[i]->interval());
-       if (inter.empty() || inter.length() < 1e-8) {
+       MInterval inter = intersection(t, children[i]->interval());
+       if (inter.empty() || inter.length() <= 0) {
            delete children[i];
            children[i] =0;
        } else {
@@ -105,7 +105,7 @@ Rhythmic_grouping::intersect(Interval t)
 }
 
 void
-Rhythmic_grouping::split(svec<Interval> splitpoints)
+Rhythmic_grouping::split(svec<MInterval> splitpoints)
 {
     //check on splitpoints..
     int j = 0, i=0, starti = 0, startj = 0;
@@ -115,11 +115,11 @@ Rhythmic_grouping::split(svec<Interval> splitpoints)
        if  ( i >= children.sz() || j >= splitpoints.sz())
            break;
        
-       assert( distance(
-           children[starti]->interval().min, splitpoints[startj].min)<1e-8);
-               if (children[i]->interval().max < splitpoints[j].max - 1e-8) {
+       assert( 
+           children[starti]->interval().left== splitpoints[startj].left);
+               if (children[i]->interval().right < splitpoints[j].right) {
            i ++;
-       } else if (children[i]->interval().max > splitpoints[j].max + 1e-8) {
+       } else if (children[i]->interval().right > splitpoints[j].right ) {
            j ++;
        } else {
 
@@ -157,7 +157,7 @@ Rhythmic_grouping::~Rhythmic_grouping()
 void
 Rhythmic_grouping::copy(Rhythmic_grouping const&s)
 {
-    interval_ =  (s.interval_)? new Interval(*s.interval_) : 0;
+    interval_ =  (s.interval_)? new MInterval(*s.interval_) : 0;
     for (int i=0; i < s.children.sz(); i++)
        children.add(new Rhythmic_grouping(*s.children[i]));
 }
@@ -199,20 +199,20 @@ Rhythmic_grouping::print()const
 }
 
 void
-Rhythmic_grouping::add_child(Real start, Real len)
+Rhythmic_grouping::add_child(Moment start, Moment len)
 {
-    Real stop = start+len;
+    Moment stop = start+len;
     for (int i=0; i < children.sz(); i ++) {
-       Interval j=children[i]->interval();
-       if (distance (j.min, start)<1e-8 && distance (j.max, stop)<1e-8) {
+       MInterval j=children[i]->interval();
+       if (j.left == start && j.right==stop) {
            return;
        }
     }
     
     if (children.sz())
-       assert ( distance(children.last()->interval().max , start) < 1e-8);
+       assert ( children.last()->interval().right== start);
 
-    children.add(new Rhythmic_grouping(Interval(start, stop)));
+    children.add(new Rhythmic_grouping(MInterval(start, stop)));
 }
 
 Rhythmic_grouping::Rhythmic_grouping()
index e38eb872179719da604e6b686f932d8cca2074a9..fda5ceefcf5b85d853e0b5393a737251c5c1463c 100644 (file)
@@ -6,9 +6,6 @@ Input_command::Input_command()
 {
 }
 
-Input_command::Input_command(Real )
-{
-}
 
 Input_command::operator Command()
 {
@@ -39,7 +36,7 @@ Input_command::operator Command()
 
 
 Input_command*
-get_partial_command(Real u)
+get_partial_command(Moment u)
 {
     Input_command*c = new Input_command;
     c->args.add("PARTIAL");
@@ -47,14 +44,6 @@ get_partial_command(Real u)
     return c;
 }
 
-Input_command*
-get_grouping_command(Real r,svec<int>a ) 
-{
-    Input_command*c = get_grouping_command(a);
-    c->args.insert(r,1);
-    return c;
-}
-
 Input_command*
 get_grouping_command(svec<int>a ) 
 {
@@ -109,7 +98,7 @@ get_bar_command()
 }
 
 Input_command *
-get_skip_command(int n, Real m)
+get_skip_command(int n, Moment m)
 {
     Input_command*c = new Input_command;
     
index 59d8eeaae76ad21be738a51cca901a1efecdb77a..e1d40465614488dba2792e45ef822bc04f2fc765 100644 (file)
@@ -10,21 +10,21 @@ Commands_at::print() const
 {
 #ifndef NPRINT
     mtor << "Commands_at {";
-    moment_.print();
+    tdescription_.print();
     for (PCursor<Input_command *> cc(*this); cc.ok(); cc++) 
        cc->print();
     mtor << "}\n";
 #endif
 }
-Real
+Moment
 Commands_at::when()
 {
-    return moment_.when;
+    return tdescription_.when;
 }
-Commands_at::Commands_at(Real dt, Commands_at* prev)
-    : moment_(dt, (prev)? &prev->moment_ : 0)
+Commands_at::Commands_at(Moment dt, Commands_at* prev)
+    : tdescription_(dt, (prev)? &prev->tdescription_ : 0)
 {
-    if (prev&& !moment_.whole_in_measure) {
+    if (prev&& !tdescription_.whole_in_measure) {
        bottom().add(get_bar_command());
     }
 }
@@ -38,15 +38,14 @@ Commands_at::add(Input_command *i)
     if (i->args[0] == "METER") { 
        int l = i->args[1];
        int o = i->args[2];
-       moment_.set_meter(l,o);
-       bottom().add(get_grouping_command( moment_.one_beat,
-                                          get_default_grouping(l)));
+       tdescription_.set_meter(l,o);
+       bottom().add(get_grouping_command( get_default_grouping(l)));
 
     }
 }
 
 Commands_at::Commands_at(Commands_at const&src) :
-    moment_(src.moment_)
+    tdescription_(src.tdescription_)
 {
     IPointerList<Input_command*> &me(*this);
     const IPointerList<Input_command*> &that(src);
@@ -55,21 +54,21 @@ Commands_at::Commands_at(Commands_at const&src) :
 }
 
 void
-Commands_at::setpartial(Real p)
+Commands_at::setpartial(Moment p)
 {
-    moment_.setpartial(p);
+    tdescription_.setpartial(p);
 }
 
-Real
+Moment
 Commands_at::barleft()
 {
-    return  moment_.barleft();
+    return  tdescription_.barleft();
 }
 
 void
 Commands_at::parse(Staff_commands_at*s)
 {
-    s->moment_ = moment_;
+    s->tdescription_ = tdescription_;
     for (PCursor<Input_command *> cc(*this); cc.ok(); cc++) {
        if (cc->args.sz() &&  cc->args[0] !="") {
            Command c = **cc;
@@ -81,13 +80,13 @@ Commands_at::parse(Staff_commands_at*s)
 /****************/
 
 void
-Input_cursor::find_moment(Real w)
+Input_cursor::find_moment(Moment w)
 {
-    Real last = when();
+    Moment last = when();
     while  (1) {
        if (! ok() ) {
            *this = list().bottom();
-           Real dt = (w - when()) <? ptr()->barleft();
+           Moment dt = (w - when()) <? ptr()->barleft();
 
            Commands_at * c = new Commands_at(dt, *this);
            assert(c->when() <= w);
@@ -103,7 +102,7 @@ Input_cursor::find_moment(Real w)
     }
 
     prev();
-    Real dt = (w - when());
+    Moment dt = (w - when());
     Commands_at * c = new Commands_at(dt, *this);
     add(c);
     next();
@@ -130,10 +129,10 @@ Input_commands::Input_commands()
 }
 
 void
-Input_commands::do_skip(int bars, Real wholes)
+Input_commands::do_skip(int bars, Moment wholes)
 {
     while (bars > 0) {
-       Real b = ptr->barleft();
+       Moment b = ptr->barleft();
        ptr.find_moment(ptr->when() + b);
        bars --;        
     }
@@ -150,7 +149,7 @@ Input_commands::add(Input_command c)
        ptr->setpartial(c.args[1]);
     } else if (c.args[0] == "GROUPING") {
        Input_command *ic = new Input_command(c);
-       ic->args.insert(ptr->moment_.one_beat, 1);
+       ic->args.insert(ptr->tdescription_.one_beat, 1);
        ptr->add(ic);
     } else if (c.args[0] == "METER") {
        int beats_per_meas = c.args[1];
@@ -159,7 +158,7 @@ Input_commands::add(Input_command c)
        ptr->add(ch);           
     } else if (c.args[0] == "SKIP") {
        int bars = c.args[1] ;
-       Real wholes= c.args[2];
+       Moment wholes= c.args[2];
        do_skip(bars, wholes);
     } else if (c.args[0] == "RESET") {
        ptr= top();
@@ -180,7 +179,7 @@ Input_commands::parse() const
 
        Staff_commands_at* s= nc->find(i->when());
        if (!s){
-           s = new Staff_commands_at(i->moment_);
+           s = new Staff_commands_at(i->tdescription_);
            nc->add(s);
        }
        if (!i->when()) {   /* all pieces should start with a breakable. */
@@ -208,7 +207,7 @@ Input_commands::print() const
 }
 /****************/
 
-Real
+Moment
 Input_cursor::when()const
 {
     return (*this)->when(); 
index db2e3c57d5b0e0bf8e8a5c8db3ca7d8f72b441d6..b007562d1c178c880f4d455d6ec0e0305d55346b 100644 (file)
@@ -8,13 +8,13 @@ Simple_music::add(Voice_element*v)
     voice_.add(v);
 }
 
-Real
+Moment
 Simple_music::length()
 {
     return voice_.last();
 }
 void
-Simple_music::translate_time(Real t)
+Simple_music::translate_time(Moment t)
 {
     voice_.start += t;
 }
@@ -93,10 +93,10 @@ Music_voice::add_elt(Voice_element*v)
     s->add(v);             
 }
 
-Real
+Moment
 Music_voice::length()
 {
-    Real l = 0.0;
+    Moment l = 0.0;
     
     for (PCursor<Input_music*> i(elts); i.ok(); i++)
        l += i->length();
@@ -108,10 +108,10 @@ Voice_list
 Music_voice::convert()
 {
     Voice_list l;
-    Real here = 0.0;
+    Moment here = 0.0;
     
     for (PCursor<Input_music*> i(elts); i.ok(); i++) {
-       Real len = i->length(); 
+       Moment len = i->length();       
        Voice_list k(i->convert());
        k.translate_time(here); 
        l.concatenate(k);
@@ -122,7 +122,7 @@ Music_voice::convert()
 }
 
 void
-Music_voice::translate_time(Real t)
+Music_voice::translate_time(Moment t)
 {
     elts.bottom()->translate_time(t);
 }
@@ -148,16 +148,16 @@ Music_general_chord::print() const
 }
 
 void
-Music_general_chord::translate_time(Real t)
+Music_general_chord::translate_time(Moment t)
 {
     for (PCursor<Input_music*> i(elts); i.ok(); i++) 
        i->translate_time(t);    
 }
 
-Real
+Moment
 Music_general_chord::length()
 {
-    Real l =0.0;
+    Moment l =0.0;
     
     for (PCursor<Input_music*> i(elts); i.ok(); i++) 
        l = l >? i->length();
@@ -179,7 +179,7 @@ Music_general_chord::convert()
 /****************/
 
 void
-Voice_list::translate_time(Real x)
+Voice_list::translate_time(Moment x)
 {
     for (PCursor<Voice*> i(*this); i.ok(); i++)
        i->start += x;    
index 0b17abac663d3a0bdd3aef64337e24c9b83c0f57..4968c89de65b611430fbb7390b98168951fdb282 100644 (file)
@@ -144,6 +144,17 @@ DOTS               \.+
          yyterminate(); // can't move this, since it actually rets a YY_NULL
 }
 
+
+include           { BEGIN(incl); }
+<incl>[ \t]*      { /* eat the whitespace */ }
+<incl>\"[^"]*\"+   { /* got the include file name */
+   String s (YYText()+1);
+       s = s.left(s.len()-1);
+   new_input(s);
+   BEGIN(INITIAL);
+}
+
+
 {WORD}         {
        mtor << "word: " << YYText()<<eol;
        String c = YYText();
index e403c2dcc034e96764eadfa85b93724d88d359c0..784c1f30ad5125f724cc409045db61de49f9068b 100644 (file)
@@ -56,7 +56,7 @@ Spacing_problem::check_constraints(Vector v) const
     // mtor << "checking solution " << v << '\n';
     for (int i=0; i < dim; i++) {
 
-       if (cols[i].fixed&& ABS(cols[i].fixpos - v(i)) > COLFUDGE) {
+       if (cols[i].fixed&& abs(cols[i].fixpos - v(i)) > COLFUDGE) {
            return false;
        }
        if (!i) 
index baa037b9709a456aebd7733fe1fde78da86cf51b..d7a3f721e965db80cf7985a4c06a0bb79cb4e2e0 100644 (file)
@@ -28,6 +28,19 @@ Lookup::add(String s, Symtable*p)
     symtables_->add(s, p);
 }
 
+Symbol
+Lookup::text( String style, String text , int dir)
+{
+    svec<String> a;
+    a.add((*symtables_)("style")->lookup(style).tex);
+    Symbol s = (*symtables_)("align")->lookup(dir);
+    a[0] =  substitute_args( text,a);
+
+    s.tex = substitute_args(s.tex,a);
+    return s;
+}
+
 /****************/
 
 Real
index 493e67f05e8d75d3cffc5d17fdcaf0715c47d8d8..b20e3a6bf2375878d5a20cac4931f133da0556bc 100644 (file)
@@ -45,7 +45,7 @@ Melodic_staff::get_TYPESET_item(Command*com)
 }
 
 Stem *
-Melodic_staff::get_stem(Stem_req*rq, Real dur)
+Melodic_staff::get_stem(Stem_req*rq, Moment dur)
 {
     Stem * s = new Stem(NO_LINES-1, dur);
     s->flag = rq->stem_number;
index ff99029ec72927268f8601ee7272493549841e70..5618f8ae2a2b766b5519274fe54fcdfcd3982dd4 100644 (file)
@@ -1,17 +1,18 @@
 #include "misc.hh"
 #include "glob.hh"
+#include "moment.hh"
 
 #include <math.h>
 
-Real
+Moment
 wholes(int dur, int dots)
 {
     if (!dur)
        return 0.0;
 
     // stupid Intel: doesn't crash if !dur
-    Real f = 1.0/Real(dur);
-    Real delta = f;
+    Moment f = 1/Moment(dur);
+    Moment delta = f;
 
     while (dots--) {
        delta /= 2.0;
index fb72eb6bf0600f0d5adb73c97abe841288d8be80..68b8791c18d1e67767a204806831a825a702ee81 100644 (file)
@@ -82,7 +82,7 @@ Molecule::add_right(const Molecule &m)
        add(m);
        return;
     }
-   Real xof=extent().x.max - m.extent().x.min;
+   Real xof=extent().x.right - m.extent().x.left;
     Molecule toadd(m);
     toadd.translate(Offset(xof, 0.0));
     add(toadd);
@@ -95,7 +95,7 @@ Molecule::add_left(const Molecule &m)
        add(m);
        return;
     }
-    Real xof=extent().x.min - m.extent().x.max;
+    Real xof=extent().x.left - m.extent().x.right;
     Molecule toadd(m);
     toadd.translate(Offset(xof, 0.0));
     add(toadd);
@@ -109,7 +109,7 @@ Molecule::add_top(const Molecule &m)
        add(m);
        return;
     }
-  Real yof=extent().y.max - m.extent().y.min;
+  Real yof=extent().y.right - m.extent().y.left;
     Molecule toadd(m);
     toadd.translate(Offset(0,yof));
     add(toadd);
@@ -122,7 +122,7 @@ Molecule::add_bottom(const Molecule &m)
        add(m);
        return;
     }
-    Real yof=extent().y.min- m.extent().y.max;
+    Real yof=extent().y.left- m.extent().y.right;
     Molecule toadd(m);
     toadd.translate(Offset(0,yof));
     add(toadd);
diff --git a/src/moment.cc b/src/moment.cc
deleted file mode 100644 (file)
index 19f8571..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#include "moment.hh"
-#include "debug.hh"
-
-void
-Moment::print() const
-{    
-    mtor << " at "<<when<<'\n'; 
-    mtor << "meeter " << whole_per_measure << "/" << 1/one_beat 
-        << "\nposition "<< bars << ":" << whole_in_measure <<'\n';
-}
-void
-Moment::OK() const
-{
-    assert(whole_in_measure < whole_per_measure && 0 <= whole_in_measure);
-    assert(one_beat);
-}
-Moment::Moment(Real dt, Moment const *prev)
-{
-    if (prev) {
-       assert(dt >0);
-       *this = *prev;
-       when += + dt;
-       whole_in_measure += dt;
-       while ( whole_in_measure >= whole_per_measure ) {
-           whole_in_measure -= whole_per_measure;
-           bars ++;
-       }
-    } else {                           // default 4/4
-       whole_per_measure = 1;
-       whole_in_measure =0;
-       one_beat = 0.25;
-       when = 0.0;
-       bars = 0;
-    }  
-}
-
-void
-Moment::set_meter(int l, int o)
-{
-    assert(o);
-    one_beat = 1/Real(o);
-    whole_per_measure = Real(l) * one_beat;
-}
-
-void
-Moment::setpartial(Real p)
-{
-    if (when)
-       error_t ("Partial measure only allowed at beginning.", when);
-    if (p<0||p > whole_per_measure)
-       error_t ("Partial measure has incorrect size", when);
-    whole_in_measure = whole_per_measure - p;
-}
-Real
-Moment::barleft()
-{
-return    whole_per_measure-whole_in_measure;
-}
index 0a912e33897147bd0cdff691a89962061cef796e..699a46d9faceee80fe2a55883af9c88770502c63 100644 (file)
@@ -1,3 +1,4 @@
+#include "interval.hh"
 #include "identparent.hh"
 #include "associter.hh"
 #include "lexer.hh"
index 88cb621181307e9f3f328d39a465af37218363cd..203c5928300ba70ce5dfd5ba5b80b982a7907a68 100644 (file)
@@ -1,3 +1,5 @@
+#include "misc.hh"
+
 #include "notehead.hh"
 #include "dimen.hh" 
 #include "debug.hh"
@@ -60,7 +62,7 @@ Notehead::brew_molecole()
     output->translate(Offset(x_dir * p->note_width(),0));
     bool streepjes = (position<-1)||(position > staff_size+1);
     if (streepjes) {
-       int dir = sgn(position);
+       int dir = sign(position);
        int s =(position<-1) ? -((-position)/2): (position-staff_size)/2;
        Symbol str = p->lookup_->streepjes(s);
        Molecule sm;
index 2879d90c91fa267a3de568c08404a7af6153f5a5..82b858387680f6415dd9f521f23bf2289b40b854 100644 (file)
@@ -12,7 +12,7 @@ const Real PHI = (1+sqrt(5))/2;
 
 // see  Roelofs, p. 57
 Real
-Paperdef::duration_to_dist(Real d)
+Paperdef::duration_to_dist(Moment d)
 {
     return whole_width * pow(geometric_, log_2(d));
 }
index bc38c27e1489538a63b9d5db495dd315dbe5b31d..402bc95f74dbe75077cb61a982291f33d0386b2d 100644 (file)
@@ -437,7 +437,7 @@ pitch_list:                 {
 int:
        REAL                    {
                $$ = int($1);
-               if (ABS($1-Real(int($$))) > 1e-8)
+               if ( distance($1,Real(int($$)) ) > 1e-8)
                        error("expecting integer number");
        }
        | INT
index 951be6fa5f612e38f109962f1f066674bf015b03..7dc4c22c5ab3dbc3696a93f70e50938409881dc3 100644 (file)
@@ -43,7 +43,7 @@ PCol::print() const
     } else if (daddy) {
        mtor<<'\n' << ((this == daddy->prebreak) ? "prebreak" : "postbreak");
     }
-    mtor << "extent: " << width().min << ", " << width().max << "\n";
+    mtor << "extent: " << width().str() << "\n";
     mtor << "}\n";
 #endif 
 }
index a34d86b0ba6ebe6118f00a8dd2f67fee3c398838..c808ecc3fe1601332e7be161811de3684d088677 100644 (file)
@@ -59,7 +59,7 @@ PScore::typeset_item(Item *i, PCol *c, PStaff *s, int breakstat)
            svec<Item*> col_its (select_items(s, c));
            for (int j =0; j < col_its.sz(); j++)
                col_its[j]->translate(Offset(-iv.length(),0));
-           i->translate (Offset(-iv.max, 0));
+           i->translate (Offset(-iv.right, 0));
        }
     }
     
index 21af7cdcb0b5be79ae0756777fd03f35b41171c0..88b703bbbbad7965b56c9dfb6d7eee5e90d703f7 100644 (file)
@@ -68,7 +68,7 @@ Active_constraints::add(int k)
     Vector Ha = H*a;
     Real aHa = a*Ha;
     Vector addrow(Ha.dim());
-    if (ABS(aHa) > EPS) {
+    if (abs(aHa) > EPS) {
        /*
          a != 0, so if Ha = O(EPS), then
          Ha * aH / aHa = O(EPS^2/EPS)
@@ -203,7 +203,7 @@ Ineq_constrained_qp::solve(Vector start) const
                }
            }
            Real unbounded_alfa = 1.0;
-           Real optimal_step = MIN(minalf, unbounded_alfa);
+           Real optimal_step = min(minalf, unbounded_alfa);
 
            Vector deltax=direction * optimal_step;
            x += deltax;            
index 7821ba240c19cb02bc9e1b52ad7b94a27dbaa34b..2645d5dc9075abd57c10909308f43e36ad1c782f 100644 (file)
@@ -71,7 +71,7 @@ Rest_req::print() const
 }
 
 
-Real
+Moment
 Rhythmic_req::duration() const {    
     return wholes( balltype,dots);
 }
index a446bd33ecbe70846e2660236b39d3dcbcf8ffdc..9142986abce6dd65af07115de91d12fd73da98bd 100644 (file)
@@ -43,7 +43,7 @@ Rhythmic_staff::get_notehead(Note_req *rq, int)
 }
 
 Stem *
-Rhythmic_staff::get_stem(Stem_req*rq, Real l)
+Rhythmic_staff::get_stem(Stem_req*rq, Moment l)
 {
     Stem * s = new Stem(0,l);
     s->flag = rq->stem_number;
index be242059af5d2f8193ca0126021bce5eb79239a4..ec8784a9bdf4bdf1dda20800336bc2c65136c806 100644 (file)
@@ -1,7 +1,18 @@
-#include "sccol.hh"
 #include "debug.hh"
+#include "pcol.hh"
+#include "sccol.hh"
+
+int
+Score_column::compare(Score_column & c1, Score_column &c2)
+{
+       return sign(c1.when - c2.when);
+}
 
-Score_column::Score_column(Real w)
+void
+Score_column::set_breakable() {
+    pcol_->set_breakable();
+}
+Score_column::Score_column(Moment w)
 {
     when = w;
     pcol_ = new PCol(0);
@@ -28,18 +39,18 @@ Score_column::print() const
 }
 
 int
-Real_compare(Real &a , Real& b)
+Tdescription_compare(Moment &a , Moment& b)
 {
-    return sgn(a-b);
+    return sign(a-b);
 }
 
 void
 Score_column::preprocess()
 {
-    durations.sort(Real_compare);
+    durations.sort(Tdescription_compare);
 }
 void
-Score_column::add_duration(Real d)
+Score_column::add_duration(Moment d)
 {
     for (int i = 0; i< durations.sz(); i++) {
        if (d == durations[i])
index 5a65809c5ac73255bd00c89119f647ce760728f0..1593f7be162074892807336c19ef3d5076ebd3d8 100644 (file)
@@ -68,7 +68,7 @@ Score::clean_cols()
   */
 // todo
 PCursor<Score_column*>
-Score::create_cols(Real w)
+Score::create_cols(Moment w)
 {
     Score_column* c1 = new Score_column(w);
     Score_column* c2 = new Score_column(w);
@@ -98,7 +98,7 @@ Score::create_cols(Real w)
 }
 
 PCursor<Score_column*>
-Score::find_col(Real w,bool mus)
+Score::find_col(Moment w,bool mus)
 {
     PCursor<Score_column*> i(cols_);
     for (; i.ok(); i++) {
@@ -121,12 +121,12 @@ Score::do_pcols()
        pscore_->add(i->pcol_);
     }
 }
-Real
+Moment
 Score::last() const
 {    
-    Real l = 0;
+    Moment l = 0;
     for (PCursor<Staff*> i(staffs_); i.ok(); i++) {
-       l = MAX(l, i->last());
+       l = l>? i->last();
     }
     return l;
 }
index 833afe2108a609a25b4e9a042051d149b0cf2726..4c0aa4b15cf11f2c40c15391e63854dde2ab9426 100644 (file)
@@ -26,7 +26,6 @@ Simple_staff::get_TYPESET_item(Command *com)
        c->change = (type == "CLEF");   
     }else{
        WARN << "ignoring TYPESET command for " << type << '\n';
-
     }
     return s;
 }
@@ -35,9 +34,13 @@ Simple_staff::get_TYPESET_item(Command *com)
 Interval
 itemlist_width(const svec<Item*> &its)
 {
-    Interval iv;
-    for (int j =0; j < its.sz(); j++)
-       iv.unite(its[j]->width());
+    Interval iv ;
+    iv.set_empty();
+     
+    for (int j =0; j < its.sz(); j++){
+       iv.unite (its[j]->width());
+
+    }
     return iv;
 }
 
@@ -58,7 +61,7 @@ Simple_column::typeset_item(Item *i, int breakst)
        assert(!column_wid.empty());
 
        for (int j=0; j < to_move.sz(); j++) {
-           to_move[j]->translate(Offset(-column_wid.max, 0));
+           to_move[j]->translate(Offset(-column_wid.right, 0));
        }
     }
 }    
@@ -102,6 +105,6 @@ Simple_staff::get_rest(Rest_req*rq)
 Local_key_item*
 Simple_staff::get_local_key_item()
 {
-    return   0;
+    return 0;
 }
 
index 9f5f0033f228733cea65b171b1176cac150487df..458e071c9aa86dd9d00bbefc6849edf80f6cc8f2 100644 (file)
 #include "localkeyitem.hh"
 
 Rhythmic_grouping
-parse_grouping(svec<Scalar> a)
+parse_grouping(svec<Scalar> a, Moment one_beat)
 {
-    Real one_beat =a[0];
-    a.del(0);
+    
     svec<int> r;
     for (int i= 0 ; i < a.sz(); i++)
        r.add(a[i]);
-    Real here =0.0;
+    Moment here =0.0;
 
     svec<Rhythmic_grouping*> children;
     for (int i=0; i < r.sz(); i++) {
        
-       Real last = here;
+       Moment last = here;
        here += one_beat * r[i];
        children.add(
-           new Rhythmic_grouping(Interval(last, here), r[i] )
+           new Rhythmic_grouping(MInterval(last, here), r[i] )
            );
     }
     return Rhythmic_grouping(children);
@@ -48,7 +47,7 @@ Simple_walker::do_INTERPRET_command(Command*com)
     svec<Scalar> args(com->args);
     args.del(0);
     if (com->args[0] == "GROUPING") {  
-       default_grouping = parse_grouping(args);
+       default_grouping = parse_grouping(args, col()->tdescription_->one_beat);
     }else if (com->args[0] == "BAR") {
        local_key_.reset(key_);
 
@@ -136,7 +135,7 @@ Simple_walker::do_note(Rhythmic_req*rq)
        stem_->add(n);
        if (current_grouping) {
            current_grouping->add_child(
-               c->moment_->whole_in_measure, rq->duration());
+               c->tdescription_->whole_in_measure, rq->duration());
        }
        noteheads.add(n);
        int sidx =find_slur(v);
@@ -170,7 +169,7 @@ Simple_walker::process_requests()
 
        if (sl->spantype == Span_req::START) {
            if  (find_slur(sl->elt->voice_ )>=0)
-               error("Too many slurs in voice");
+               error_t("Too many slurs in voice", col()->when());
            pending_slur_reqs.add(sl);
            pending_slurs.add(new Slur);
        }
index f795dc82847a037200f1e30ddbea44528f1a89f7..b16aae1f0a0adf0d728b7b1113735332ed4a2f4a 100644 (file)
@@ -7,6 +7,24 @@
 #include "molecule.hh"
 #include "debug.hh"
 #include "boxes.hh"
+void
+Slur::calculate()
+{
+    set_default_dir();
+}
+
+Offset
+Slur::center() const
+{
+        int pos1 = encompass.last()->position;
+    int pos2 = encompass[0]->position;
+
+    int dy =  pos1-pos2;
+
+    Real w = width().length();
+
+    return Offset(w/2,dy * paper()->internote());
+}
 
 void
 Slur::add(Notehead*n)
index a550227ea6958541863d796c26926156f986e3f3..9a8c1dc36fb4b243f74108b0de2e192d91a9429e 100644 (file)
@@ -5,7 +5,10 @@
 #include "symbol.hh"
 #include "molecule.hh"
 #include "pcol.hh"
-
+void
+Spanner::calculate()
+{
+}
 String
 Spanner::TeXstring() const
 {
index 03e22a03981201e8cb23b8800f385b5f82241987..ef0ff53e58707641c35eeb0a9b1b00f0e0186be9 100644 (file)
@@ -15,7 +15,7 @@ Staff::add(PointerList<Voice*> &l)
 }
 
 void
-Staff::process_commands(Real l)
+Staff::process_commands(Moment l)
 {
     if (staff_commands_)
        staff_commands_->clean(l);
@@ -40,7 +40,7 @@ Staff::clean_cols()
 }
 
 Staff_column *
-Staff::get_col(Real w, bool mus)
+Staff::get_col(Moment w, bool mus)
 {
     Score_column* sc = score_->find_col(w,mus);
     assert(sc->when == w);
@@ -89,7 +89,7 @@ void
 Staff::setup_staffcols()
 {    
     for (PCursor<Voice*> i(voices); i.ok(); i++) {
-       Real now = i->start;
+       Moment now = i->start;
        for (PCursor<Voice_element *> ve(i->elts); ve.ok(); ve++) {
 
            Staff_column *sc=get_col(now,true);
@@ -99,22 +99,22 @@ Staff::setup_staffcols()
     }
 
     for (PCursor<Staff_commands_at*> cc(*staff_commands_); cc.ok(); cc++) {
-       Staff_column *sc=get_col(cc->moment_.when,false);
+       Staff_column *sc=get_col(cc->tdescription_.when,false);
        sc->s_commands = cc;
-       sc->moment_ = new Moment(cc->moment_);
+       sc->tdescription_ = new Time_description(cc->tdescription_);
     }
 
     PCursor<Staff_commands_at*> cc(*staff_commands_);
     for (PCursor<Staff_column*> i(cols); i.ok(); i++) {
        while  ((cc+1).ok() && (cc+1)->when() < i->when())
            cc++;
-       
-       if(!i->moment_) {
-           if (cc->moment_.when == i->when())
-               i->moment_ = new Moment(cc->moment_);
+
+       if(!i->tdescription_) {
+           if (cc->tdescription_.when == i->when())
+               i->tdescription_ = new Time_description(cc->tdescription_);
            else
-               i->moment_ = new Moment(
-                   i->when() - cc->when() ,&cc->moment_);
+               i->tdescription_ = new Time_description(
+                   i->when() - cc->when() ,&cc->tdescription_);
        }
     }
 }
@@ -138,12 +138,12 @@ Staff::OK() const
 }
 
 
-Real
+Moment
 Staff::last() const
 {
-    Real l = 0.0;
+    Moment l = 0.0;
     for (PCursor<Voice*> i(voices); i.ok(); i++) {
-       l = MAX(l, i->last());
+       l = l >? i->last();
     }
     return l;
 }
index a0bb71f84c86f0f576a17f6411090291c67ef9cf..8a2e945e770ea843eb1af3fbb22d565c67766a09 100644 (file)
@@ -2,10 +2,10 @@
 #include "debug.hh"
 #include "parseconstruct.hh"
 
-Real
+Moment
 Staff_commands_at::when()
 {
-    return moment_.when;
+    return tdescription_.when;
 }
 void
 Staff_commands_at::print() const
@@ -13,7 +13,7 @@ Staff_commands_at::print() const
 #ifndef NPRINT
     PCursor<Command*> i (*this);
     mtor << "Commands at: " ;
-    moment_.print();
+    tdescription_.print();
     
     for (; i.ok(); i++)
        i->print();
@@ -28,8 +28,8 @@ Staff_commands_at::OK()const
            assert(i->priority >= (i+1)->priority);
 }
 
-Staff_commands_at::Staff_commands_at(Moment m)
-    :moment_(m)
+Staff_commands_at::Staff_commands_at(Time_description m)
+    :tdescription_(m)
 {
     
 }
@@ -105,7 +105,11 @@ Staff_commands_at::add_command_to_break(Command pre, Command mid,Command post)
     
     insert_between(post, f, l);
 }
-  
+
+
+/*
+  should move this stuff into inputlanguage.
+  */
 void
 Staff_commands_at::add(Command c)
 {
@@ -207,7 +211,7 @@ Staff_commands::OK() const
 {
 #ifndef NDEBUG
     for (PCursor<Staff_commands_at*> i(*this); i.ok() && (i+1).ok(); i++) {
-       assert(i->moment_.when <= (i+1)->moment_.when);
+       assert(i->tdescription_.when <= (i+1)->tdescription_.when);
        i->OK();
     }
 #endif
@@ -224,13 +228,13 @@ Staff_commands::print() const
 }
 
 Staff_commands_at*
-Staff_commands::find(Real w)
+Staff_commands::find(Moment w)
 {
     PCursor<Staff_commands_at*> i(bottom());
     for (; i.ok() ; i--) {
-       if (i->moment_.when == w)
+       if (i->tdescription_.when == w)
            return i;
-       if (i->moment_.when < w)
+       if (i->tdescription_.when < w)
            break;
     }
     return 0;
@@ -241,7 +245,7 @@ Staff_commands::add(Staff_commands_at*p)
 {
     PCursor<Staff_commands_at*> i(bottom());
     for (; i.ok() ; i--) {
-       if (i->moment_.when < p->moment_.when)
+       if (i->tdescription_.when < p->tdescription_.when)
            break;
     }
     if (!i.ok()) 
@@ -253,16 +257,16 @@ Staff_commands::add(Staff_commands_at*p)
 }
 
 void
-Staff_commands::clean(Real l)
+Staff_commands::clean(Moment l)
 {
     PCursor<Staff_commands_at*> i(bottom());
-    for (; i->moment_.when > l; i=bottom()) {
+    for (; i->tdescription_.when > l; i=bottom()) {
        remove(i);
     }
     
     Staff_commands_at*p = find(l);
     if (!p) {
-       p = new Staff_commands_at(Moment(l - i->when(), &i->moment_));
+       p = new Staff_commands_at(Time_description(l - i->when(), &i->tdescription_));
        add(p);
     }
     if (!p->is_breakable()) {
index afb8085b1a63ee0f0cac4b490e50d504baf937af..c3e33fff06f4a073486fba40ec01d4639213c9d2 100644 (file)
@@ -13,7 +13,7 @@ make_vbox(Interval i)
 {    
     String s("\\vbox to ");
     s += print_dimen(i.length());
-    s += "{\\vskip "+print_dimen(i.max)+" ";
+    s += "{\\vskip "+print_dimen(i.right)+" ";
     return s;
 }
 
@@ -68,8 +68,8 @@ Line_of_staff::Line_of_staff(Line_of_score * sc, PStaff*st)
     
     for (PCursor<const Spanner*> sp(pstaff_->spans); sp.ok(); sp++) {
 
-       PCol *brokenstart = &MAX(*linestart, *sp->left);
-       PCol *brokenstop = &MIN(*linestop, *sp->right);
+       PCol *brokenstart = &max(*linestart, *sp->left);
+       PCol *brokenstop = &min(*linestop, *sp->right);
        if ( *brokenstart < *brokenstop) {
            line_of_score_->pscore_-> // higghl
                add_broken(sp->broken_at(brokenstart,brokenstop));
index d4ba8cec339589edd3bb5445d8c49f28684a279a..9ed22dfe47eceeee6a150d87c014e2705aaddf9a 100644 (file)
@@ -1,7 +1,7 @@
-#include "stcol.hh"
-#include "sccol.hh"
 #include "voice.hh"
-#include "moment.hh"
+#include "timedescription.hh"
+#include "sccol.hh"
+#include "stcol.hh"
 
 bool
 Staff_column::mus() const
@@ -9,7 +9,7 @@ Staff_column::mus() const
     return score_column->musical;
 }
 
-Real
+Moment
 Staff_column::when() const
 {
     return score_column->when;
@@ -18,7 +18,7 @@ Staff_column::when() const
 void
 Staff_column::add(Voice_element*ve)
 {
-    Real d= ve->duration;
+    Moment d= ve->duration;
     if (d){
        score_column->add_duration(d);
     }
@@ -30,10 +30,10 @@ Staff_column::Staff_column(Score_column*s)
 {
     score_column = s;
     s_commands = 0;
-    moment_ = 0;
+    tdescription_ = 0;
 }
 
 Staff_column::~Staff_column()
 {
-    delete moment_;
+    delete tdescription_;
 }
index 03b91b93165e25d31578f40220f507f0cbb39ac8..496425e10fb5feb97eed27b5092cf0cab58f26aa 100644 (file)
@@ -10,7 +10,7 @@
 
 const int STEMLEN=7;
 
-Stem::Stem(int c, Real len)
+Stem::Stem(int c, Moment len)
 {
     note_length = len;
     beams_left = 0;
@@ -48,7 +48,7 @@ Stem::set_stemend(Real se)
     
     top = (dir < 0) ? maxnote           : se;
     bot = (dir < 0) ? se  : minnote;
-    flag = dir*ABS(flag);
+    flag = dir*abs(flag);
 }
 
 void
@@ -116,7 +116,7 @@ Stem::set_noteheads()
     int parity=0;
     int lastpos = heads[0]->position;
     for (int i=1; i < heads.sz(); i ++) {
-       if (ABS(lastpos- heads[i]->position) == 1) {
+       if (abs(lastpos- heads[i]->position) == 1) {
            if (parity)
                heads[i]->x_dir = (stem_xoffset>0) ? 1:-1;
            parity = !parity;
@@ -138,7 +138,7 @@ Stem::postprocess()
 Interval
 Stem::width()const
 {
-    if (!print_flag || ABS(flag) <= 4)
+    if (!print_flag || abs(flag) <= 4)
        return Interval(0,0);   // TODO!
     Paperdef*p= paper();
     Interval r(p->lookup_->flag(flag).dim.x);
@@ -161,7 +161,7 @@ Stem::brew_molecole()
     
     output = new Molecule(Atom(ss));
 
-    if (print_flag&&ABS(flag) > 4){
+    if (print_flag&&abs(flag) > 4){
        Symbol fl = p->lookup_->flag(flag);
        Molecule m(fl);
        if (flag < -4){         
index 98d58324c345b51f92b080be485ec74d8fa97da2..130543dd97ac4f9db456583269defb44b002be0a 100644 (file)
@@ -13,7 +13,7 @@ Staff_walker::Staff_walker(Staff * s, PScore*ps )
     break_status = BREAK_END - BREAK_PRE;
 }
 
-Real
+Moment
 Staff_walker::when() const
 {
     return (* (PCursor<Staff_column*> *) this)->when();
diff --git a/src/template5.cc b/src/template5.cc
new file mode 100644 (file)
index 0000000..2d278a4
--- /dev/null
@@ -0,0 +1,8 @@
+#include "proto.hh"
+#include "string.hh"
+#include "moment.hh"
+#include "real.hh"
+#include "interval.cc"
+
+Interval__instantiate(Real);
+Interval__instantiate(Rational);
index 5c082be66992d5eea6fe644ee8f4f19edbd95850..713bc1f4737ef6b2089ad305f3f4f7c776d077d6 100644 (file)
@@ -33,9 +33,9 @@ Lookup::beam_element(int sidx, int widx, Real slope)
 static int
 slope_index(Real &s)
 {
-    if (ABS(s) > 0.5) {
+    if (abs(s) > 0.5) {
        WARN << "beam steeper than 0.5";
-       s = sgn(s) * 0.5;
+       s = sign(s) * 0.5;
     }
 
     int i = int(rint(s *  20.0));
index eab9822940842a201bc1660efc10047fc42371b8..a58a2cf94ca6169529e7d37f340ec8f18022cb2d 100644 (file)
@@ -1,5 +1,5 @@
 #include <math.h>
-
+#include "misc.hh"
 #include "lookup.hh"
 #include "molecule.hh"
 #include "dimen.hh"
@@ -39,7 +39,7 @@ Lookup::half_slur_middlepart(Real &dx, int dir)
 
     Symbol s;
     
-    s.dim.y = Interval(MIN(0,0), MAX(0,0));
+    s.dim.y = Interval(min(0,0), max(0,0));
     s.dim.x = Interval(0,dx);
 
     String f =  String("\\hslurchar");
@@ -81,7 +81,7 @@ Lookup::half_slur(int dy, Real &dx, int dir, int xpart)
        
     Symbol s;
     s.dim.x = Interval(0,dx);
-    s.dim.y = Interval(MIN(0,dy), MAX(0,dy));
+    s.dim.y = Interval(min(0,dy), max(0,dy));
 
 
     String f = String("\\hslurchar");
@@ -111,7 +111,7 @@ Symbol
 Lookup::slur (int dy , Real &dx, int dir)
 {                              // ugh. assuming pt here.
     assert(dx >=0);
-    int y_sign = sgn(dy);
+    int y_sign = sign(dy);
 
     bool large = dy > 16;
 
@@ -142,7 +142,7 @@ Lookup::slur (int dy , Real &dx, int dir)
     
     Symbol s;
     s.dim.x = Interval(0,dx);
-    s.dim.y = Interval(MIN(0,dy), MAX(0,dy));
+    s.dim.y = Interval(min(0,dy), max(0,dy));
 
     String f = String("\\slurchar") + direction_char(y_sign);
 
@@ -173,7 +173,7 @@ Symbol
 Lookup::big_slur(int dy , Real &dx, int dir)
 {
     assert(dx >= convert_dimen(24,"pt"));
-    Real slur_extra =ABS(dy)  /2.0 + 2; 
+    Real slur_extra =abs(dy)  /2.0 + 2; 
     int l_dy = int(Real (dy)/2 + slur_extra*dir);
     int r_dy =  dy - l_dy;
     
diff --git a/src/textspanner.cc b/src/textspanner.cc
new file mode 100644 (file)
index 0000000..e33efbb
--- /dev/null
@@ -0,0 +1,57 @@
+#include "paper.hh"
+#include "molecule.hh"
+#include "lookup.hh"
+#include "boxes.hh"
+#include "textspanner.hh"
+
+Text_spanner::Text_spanner(Directional_spanner*d)
+{
+    support = d;
+    align = 0;
+    style = "roman";
+}
+
+void
+Text_spanner::process()
+{
+    Offset tpos;
+
+    switch(align) {
+    case 0:
+       tpos = support->center();
+       break;
+    default:
+       assert(false);
+       break;
+    }
+    
+    Paperdef *pap_p = paper();
+    
+    Atom tsym (pap_p->lookup_->text(style, text, -align));
+    tsym.translate(tpos);
+    output = new Molecule;
+    output->add( tsym );    
+}
+
+void
+Text_spanner::preprocess()
+{
+    right = support->right;
+    left = support->left;
+    assert(left && right);
+}
+
+Interval
+Text_spanner::height()const
+{
+    return output->extent().y;
+}
+
+Spanner*
+Text_spanner::broken_at(PCol*c1, PCol*c2)const
+{
+    Text_spanner *n=new Text_spanner(*this);
+    n->left = c1;
+    n->right = c2;
+    return n;
+}
diff --git a/src/timedescription.cc b/src/timedescription.cc
new file mode 100644 (file)
index 0000000..459c15a
--- /dev/null
@@ -0,0 +1,58 @@
+#include "timedescription.hh"
+#include "debug.hh"
+
+void
+Time_description::print() const
+{    
+    mtor << "Time_description { at "<<when<<'\n'; 
+    mtor << "meter " << whole_per_measure << ":" << 1/one_beat 
+        << "\nposition "<< bars << ":" << whole_in_measure <<"\n}\n";
+}
+void
+Time_description::OK() const
+{
+    assert(whole_in_measure < whole_per_measure && 0 <= whole_in_measure);
+    assert(one_beat);
+}
+Time_description::Time_description(Moment dt, Time_description const *prev)
+{
+    if (prev) {
+       assert(dt >0);
+       *this = *prev;
+       when += + dt;
+       whole_in_measure += dt;
+       while ( whole_in_measure >= whole_per_measure ) {
+           whole_in_measure -= whole_per_measure;
+           bars ++;
+       }
+    } else {                           // default 4/4
+       whole_per_measure = 1;
+       whole_in_measure =0;
+       one_beat = 0.25;
+       when = 0.0;
+       bars = 0;
+    }  
+}
+
+void
+Time_description::set_meter(int l, int o)
+{
+    assert(o);
+    one_beat = 1/Moment(o);
+    whole_per_measure = Moment(l) * one_beat;
+}
+
+void
+Time_description::setpartial(Moment p)
+{
+    if (when)
+       error_t ("Partial measure only allowed at beginning.", when);
+    if (p<0||p > whole_per_measure)
+       error_t ("Partial measure has incorrect size", when);
+    whole_in_measure = whole_per_measure - p;
+}
+Moment
+Time_description::barleft()
+{
+return    whole_per_measure-whole_in_measure;
+}
index 8a1c136d04b32389fef812191696ca85a5c559d0..2f2bbaec53b3d914c6057ff53be5e8a5bcebe1df 100644 (file)
@@ -30,10 +30,10 @@ Voice::print() const
 #endif
 }
 
-Real
+Moment
 Voice::last() const
 {
-    Real l =start;
+    Moment l =start;
     for (PCursor<Voice_element*> vec(elts); vec.ok(); vec++)
        l  += vec->duration;
     return l;
index ed7b4f23be3f8b33cfddeff189315ae72a2e7780..fd28f9ea0fbfc4060a807bc708075e23955b9046 100644 (file)
 % It has a lot of hard-wired stringconstants
 %
 
-table_sixteen = symboltables {
-       
-   texid       "\musixsixteendefs"
+include "init/dutch.ini"
+include "init/table_sixteen.ini"
 
-   % index TeXstring,  xmin xmax ymin ymax
-
-
-     "clefs" = table {
-            "violin"   "\violinclef"           0pt     12.8pt  -10pt   18pt
-            "bass"     "\bassclef"             0pt     11.2pt  0pt     16pt
-            "viola"    "\violaclef"            0pt     12.8pt  0pt     16pt
-            "violin_change"    "\cviolinclef"  0pt     11.2pt  -12pt   12pt
-            "bass_change"      "\cbassclef"    0pt     12.8pt  0pt     16pt
-            "viola_change"     "\cviolaclef"   0pt     11.2pt  0pt     16pt
-     }
-
-     "balls" = table {
-            "1"        "\wholeball"    0pt     6pt     -2 pt   2pt
-            "2"        "\halfball"     0pt     5pt     -2 pt   2pt
-            "4"        "\quartball"    0pt     5pt     -2 pt   2pt
-     }
-
-     "slur" = table {
-            "whole"    "\slurchar%{%}" 0pt     0pt     0pt     0pt
-            "half"     "\hslurchar%{%}"        0pt     0pt     0pt     0pt
-     }
-     "accidentals" = table {
-            "-2"       "\flatflat"     0pt     10.2pt  -2.5pt 7.5pt
-            "-1"       "\flat"         0pt     6pt     -2.5pt 7.5pt
-            "0"        "\natural"      0pt     6pt     -7.5pt 7.5pt
-            "1"        "\sharp"                0pt     6pt     -7.5pt 7.5pt
-            "2"        "\sharpsharp"   0pt     6pt     -2.5pt 7.5pt
-     }
-
-     "streepjes" = table {
-            "toplines" "\toplines{%}"  -3pt    9pt 0pt 0pt
-            "botlines" "\botlines{%}"  -3pt    9pt 0pt 0pt
-     }
-
-     "bars" = table {
-            "empty"    "\emptybar"     0pt     0pt     0pt     0pt
-            "|"        "\maatstreep"   0pt     5pt     -12pt   12pt
-            "||"       "\finishbar"    0pt     2pt     -12pt   12pt
-     }
-
-     "rests" = table {
-            "1"        "\wholerest"            -5pt    1pt     -1pt    1pt
-            "2"        "\halfrest"             -5pt    1pt     -1pt    1pt
-            "4"        "\quartrest"            -5pt    2pt     -5pt    5pt
-            "8"        "\eighthrest"           0pt     5pt     0pt     8pt
-            "16"       "\sixteenthrest"                0pt     6pt     0pt     12pt
-            "32"       "\thirtysecondrest"     0pt     6pt     0pt     16pt
-     }
-
-     "meters" = table {
-            "C"        "\fourfourmeter"                0pt     10pt    -5pt    5pt
-            "C2"       "\allabreve"            0pt     10pt    -5pt    5pt
-     }
-
-     % dims ignored for this table
-     "param" = table {
-            "meter"    "\generalmeter{%}{%}"   -3pt    10pt    -5pt    5pt
-            "linestaf" "\linestafsym{%}{%}"
-            "stem"     "\stem{%}{%}"           
-            "fill"     "\hbox{}"
-     }
-
-     "dots" = table {
-            "1"        "\lsingledot"           0pt     2pt     -1pt    1pt
-            "2"        "\ldoubledot"           0pt     5pt     -1pt    1pt
-            "3"        "\ltripledot"           0pt     8pt     -1pt    1pt
-     }
-
-     "flags" = table {
-            "8"        "\eigthflag"            0pt     4pt     0pt     0pt     
-            "16"       "\sixteenthflag"                0pt     4pt     0pt     0pt
-            "32"       "\thirtysecondflag"     0pt     4pt     0pt     0pt
-            "-8"       "\deigthflag"           0pt     4pt     0pt     0pt
-            "-16"      "\dsixteenthflag"               0pt     4pt     0pt     0pt
-            "-32"      "\dthirtysecondflag"    0pt     4pt     0pt     0pt
-     }
-
-     "beamslopes" = table {
-            "slope"    "\beamslope{%}{%}" 
-            "horizontal"       "\rulesym{%}{%}"        
-     }
-
-}
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-table_twenty = symboltables {
-
-    texid      "\musixtwentydefs"
-
-
-    % index TeXstring,         xmin xmax ymin ymax
-    % be careful with editing this:
-    % the "index" entry is hardwired into lilypond.
-
-    "clefs" = table {
-           "violin"    "\violinclef"   0pt     16pt    -12.5pt 22.5pt
-           "bass"      "\bassclef"             0pt     16pt    0pt     20pt
-           "viola"     "\violaclef"            0pt     16pt    0pt     20pt
-           "violin_change"     "\cviolinclef"  0pt     16pt    -12.5pt 22.5pt
-           "bass_change"       "\cbassclef"    0pt     16pt    0pt     20pt
-           "viola_change"      "\cviolaclef"   0pt     16pt    0pt     20pt
-    }
-
-    "balls" = table {
-           "1" "\wholeball"    0pt     7.5pt   -2.5pt  2.5pt
-           "2" "\halfball"     0pt     6pt     -2.5pt  2.5pt
-           "4" "\quartball"    0pt     6pt     -2.5pt  2.5pt
-    }
-
-    "slur" = table {
-           "whole"     "\slurchar%{%}" 0pt     0pt     0pt     0pt
-           "half"      "\hslurchar%{%}"        0pt     0pt     0pt     0pt
-    }
-    "accidentals" = table {
-           "-2"        "\flatflat"     0pt     10.2pt  -2.5pt 7.5pt
-           "-1"        "\flat"         0pt     6pt     -2.5pt 7.5pt
-           "0" "\natural"      0pt     6pt     -7.5pt 7.5pt
-           "1" "\sharp"                0pt     6pt     -7.5pt 7.5pt
-           "2" "\sharpsharp"   0pt     6pt     -2.5pt 7.5pt
-    }
-
-    "streepjes" = table {
-           "toplines"  "\toplines{%}"  -3pt    9pt 0pt 0pt
-           "botlines"  "\botlines{%}"  -3pt    9pt 0pt 0pt
-    }
-
-    "bars" = table {
-           "empty"     "\emptybar"     0pt     0pt     0pt     0pt
-           "|" "\maatstreep"   0pt     5pt     -12pt   12pt
-           "||"        "\finishbar"    0pt     2pt     -12pt   12pt
-    }
-
-    "rests" = table {
-           "1" "\wholerest"            -5pt    1pt     -1pt    1pt
-           "2" "\halfrest"             -5pt    1pt     -1pt    1pt
-           "4" "\quartrest"            -5pt    2pt     -5pt    5pt
-           "8" "\eighthrest"           0pt     5pt     0pt     8pt
-           "16"        "\sixteenthrest"                0pt     6pt     0pt     12pt
-           "32"        "\thirtysecondrest"     0pt     6pt     0pt     16pt
-    }
-
-    "meters" = table {
-           "C" "\fourfourmeter"                0pt     10pt    -5pt    5pt
-           "C2"        "\allabreve"            0pt     10pt    -5pt    5pt
-    }
-
-    % dims ignored for this table
-    "param" = table {
-           "meter"     "\generalmeter{%}{%}"   -3pt    10pt    -5pt    5pt
-           "linestaf"  "\linestafsym{%}{%}"    
-           "stem"      "\stem{%}{%}"           
-            "fill"     "\hbox{}"
-    }
-
-    "dots" = table {
-           "1" "\lsingledot"           0pt     8pt     -1pt    1pt
-           "2" "\ldoubledot"           0pt     12pt    -1pt    1pt
-           "3" "\ltripledot"           0pt     16pt    -1pt    1pt
-    }
-
-    "flags" = table {
-           "8" "\eigthflag"            0pt     5pt     0pt     0pt     
-           "16"        "\sixteenthflag"                0pt     5pt     0pt     0pt
-           "32"        "\thirtysecondflag"     0pt     5pt     0pt     0pt
-           "-8"        "\deigthflag"           0pt     5pt     0pt     0pt
-           "-16"       "\dsixteenthflag"               0pt     5pt     0pt     0pt
-           "-32"       "\dthirtysecondflag"    0pt     5pt     0pt     0pt
-    }
-
-    "beamslopes" = table {
-           "slope"     "\beamslope{%}{%}"
-           "horizontal"        "\rulesym{%}{%}"        
-    }
-
-}
 
 %
 % common dutch names for notes. "es" means flat, "is" means sharp
 %
 
-dutch_names = notenames {
-       "ceses" 0 -2 "ces" 0 -1         "c" 0 0         "cis" 0 1 "cisis" 0 2
-       "deses" 1 -2 "des" 1 -1         "d" 1 0         "dis" 1 1 "disis" 1 2
-       "eses"  2 -2 "es"  2 -1         "e" 2 0         "eis" 2 1 "eisis" 2 2
-       "feses" 3 -2 "fes" 3 -1         "f" 3 0         "fis" 3 1 "fisis" 3 2
-       "geses" 4 -2 "ges" 4 -1         "g" 4 0         "gis" 4 1 "gisis" 4 2
-       "ases"  5 -2 "as"  5 -1         "a" 5 0         "ais" 5 1 "aisis" 5 2
-       "beses" 6 -2 "bes" 6 -1         "b" 6 0         "bis" 6 1 "bisis" 6 2
-}
-
-%
-% f = flat, s = sharp.
-%
-english_names = notenames {
-       "cff" 0 -2 "cf" 0 -1    "c" 0 0         "cs" 0 1 "css" 0 2
-       "dff" 1 -2 "df" 1 -1    "d" 1 0         "ds" 1 1 "dss" 1 2
-       "eff" 2 -2 "ef" 2 -1    "e" 2 0         "es" 2 1 "ess" 2 2
-       "fff" 3 -2 "ff" 3 -1    "f" 3 0         "fs" 3 1 "fss" 3 2
-       "gff" 4 -2 "gf" 4 -1    "g" 4 0         "gs" 4 1 "gss" 4 2
-       "aff" 5 -2 "af" 5 -1    "a" 5 0         "as" 5 1 "ass" 5 2
-       "bff" 6 -2 "bf" 6 -1    "b" 6 0         "bs" 6 1 "bss" 6 2
-}
-
 default_table = symboltables { table_sixteen }
 notenames { dutch_names }