]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 0.0.3 release/0.0.3
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 28 Oct 1996 23:49:49 +0000 (00:49 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 28 Oct 1996 23:49:49 +0000 (00:49 +0100)
65 files changed:
.dstreamrc [new file with mode: 0644]
COPYING [new file with mode: 0644]
Makefile
Sources.make
boxes.cc
break.cc
choleski.cc [deleted file]
choleski.hh [deleted file]
cols.cc
const.hh
debug.cc
debug.hh
depend
dimen.tex [new file with mode: 0644]
dstream.cc [deleted file]
dstream.hh [deleted file]
flower/Makefile
flower/Sources.make
flower/TODO
flower/compare.hh
flower/cursor.cc
flower/cursor.hh
flower/pcursor.hh [new file with mode: 0644]
globvars.hh
identifier.cc [new file with mode: 0644]
keyword.hh
lexer.l
lilyponddefs.tex
line.cc
linespace.cc
maartje.ly [new file with mode: 0644]
main.cc
main.hh [new file with mode: 0644]
make_patch
matrix.cc [deleted file]
matrix.hh [deleted file]
misc.hh
molecule.cc
molecule.hh
note.cc
parser.y
pscore.cc
qlp.cc
qlpsolve.cc
real.hh [deleted file]
score.cc
score.hh
scores.cc [new file with mode: 0644]
smat.cc [deleted file]
smat.hh [deleted file]
staff.cc
symbol.ini
symtable.cc
symtable.hh
table.cc
template.cc [deleted file]
template1.cc [new file with mode: 0644]
template2.cc
template3.cc [new file with mode: 0644]
tstream.cc
tstream.hh
vector.cc [deleted file]
vector.hh [deleted file]
version.cc
vsmat.hh [deleted file]

diff --git a/.dstreamrc b/.dstreamrc
new file mode 100644 (file)
index 0000000..ec6e96f
--- /dev/null
@@ -0,0 +1,15 @@
+#class name            silence?
+
+yyFlexLexer            1
+PCol                   1
+Score                  1
+Score_column           1
+Ineq_constrained_qp    1
+Spacing_problem        1
+Colinfo                        1
+Mixed_qp               1
+PScore                 1
+Parser                 1
+Lexer                  1
+parse_duration         1
+parse_pitch            1
\ No newline at end of file
diff --git a/COPYING b/COPYING
new file mode 100644 (file)
index 0000000..a43ea21
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,339 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                          675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+       Appendix: How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) 19yy  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) 19yy name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
index 71217f39b1a7372959c5a139282987d99e5fc991..38b71b9bbbf2869630b1c69b975b8819b65f86b7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 MAJVER=0
 MINVER=0
-PATCHLEVEL=2
+PATCHLEVEL=3
 
 # 
 #
@@ -9,7 +9,7 @@ include Sources.make
 progdocs=$(hdr) $(mycc)
 gencc=parser.cc lexer.cc
 cc=$(mycc) $(gencc)
-obs=$(cc:.cc=.o)
+obs=$(cc:.cc=.o) 
 
 
 #dist
@@ -20,27 +20,28 @@ PACKAGENAME=lilypond
 DNAME=$(PACKAGENAME)-$(VERSION)
 othersrc=lexer.l parser.y
 SCRIPTS=make_version make_patch
-IFILES= symbol.ini suzan.ly  lilyponddefs.tex test.tex .dstreamrc
+IFILES=dimen.tex symbol.ini suzan.ly maartje.ly  lilyponddefs.tex test.tex .dstreamrc
 OFILES=Makefile Sources.make depend 
-DFILES=$(hdr) $(mycc) $(othersrc) $(OFILES) $(IFILES) $(SCRIPTS)
+DFILES=$(hdr) $(mycc) $(othersrc) $(OFILES) $(IFILES) $(SCRIPTS) COPYING
 
 #compiling
 LOADLIBES=-L$(FLOWERDIR) -lflower
 FLOWERDIR=../flower
-CXXFLAGS=-I$(FLOWERDIR) -pipe -Wall -g
+#DEFINES=-DNDEBUG
+CXXFLAGS=$(DEFINES) -I$(FLOWERDIR) -pipe -Wall -g
 
 exe=$(PACKAGENAME)
 
-
+##################################################################
 
 $(exe): $(obs)
-       $(CXX) -o $(exe) $(obs) $(LOADLIBES)
+       $(CXX) -o $@ $(obs) $(LOADLIBES)
 clean:
-       rm -f $(exe) *.o $(DOCDIR)/* core
+       rm -f $(exe) *.o $(DOCDIR)/* core  
+
+distclean: clean
+       rm -f TAGS depend version.hh $(gencc) .GENERATE *~
 
-realclean: clean
-       rm -f TAGS depend
-       
 all: kompijl doc
 
 # doc++ documentation of classes
@@ -48,11 +49,15 @@ doc:
        -mkdir $(DOCDIR)
        doc++ -p -I -d $(DOCDIR) $(progdocs)
 
-back:
-       zip -u ~/backs/spacer *cc *hh
+depend: Sources.make  .GENERATE
+       $(CXX) $(CXXFLAGS) -MM $(cc) > $@
 
-depend: Sources.make 
-       $(CXX) $(CXXFLAGS) -MM $(cc) > depend
+# hack to create these sources once, before the dependencies
+.GENERATE:
+       touch .GENERATE depend
+       $(MAKE) version.hh
+       $(MAKE) $(gencc)
+       rm -f depend
 
 include depend
 
@@ -66,18 +71,20 @@ parser.hh: parser.cc
 version.o: $(obs) version.hh
 
 version.hh: Makefile make_version
-       make_version $(MAJVER) $(MINVER) $(PATCHLEVEL)  > version.hh
+       make_version $(MAJVER) $(MINVER) $(PATCHLEVEL)  > $@
 
 lexer.cc: lexer.l
-       flex -+ -t lexer.l > lexer.cc
+       flex -+ -t $< > $@
 
 DDIR=$(DNAME)
 dist:
        -mkdir $(DDIR)
        ln $(DFILES) $(DDIR)/
-       tar cfz $(DNAME).tar.gz $(DDIR)/*
+       tar cfz $(DNAME).tar.gz $(DDIR)/
        rm -rf $(DDIR)/
 
 
 TAGS: $(mycc) $(hdr) Sources.make
        etags -CT $(mycc) $(hdr) 
+
+
index 4e7949f081afcc7a5579ed331828562f93fdcfd9..54ff23ac29206264e2800a71a63cd98b0f301815 100644 (file)
@@ -1,20 +1,22 @@
-hdr=matrix.hh    qlp.hh       smat.hh      vsmat.hh\
-       linespace.hh   qlpsolve.hh  vector.hh\
+hdr=    qlp.hh       \
+       linespace.hh   qlpsolve.hh\
        cols.hh   proto.hh pstaff.hh  line.hh\
        const.hh glob.hh molecule.hh  boxes.hh pscore.hh item.hh tex.hh\
        request.hh voice.hh command.hh staff.hh  linestaff.hh \
-        tstream.hh dstream.hh mtime.hh rhythmstaf.hh\
-       parseconstruct.hh real.hh debug.hh globvars.hh keyword.hh\
+        tstream.hh  mtime.hh rhythmstaf.hh\
+       parseconstruct.hh  debug.hh globvars.hh keyword.hh\
        misc.hh score.hh notename.hh lexer.hh symtable.hh\
-       choleski.hh symbol.hh
+        symbol.hh main.hh
 
-mycc=smat.cc matrix.cc choleski.cc  qlp.cc qlpsolve.cc \
+mycc=  qlp.cc qlpsolve.cc \
         break.cc linespace.cc molecule.cc line.cc\
        pscore.cc tex.cc item.cc cols.cc staff.cc rhythmstaf.cc\
-       score.cc note.cc dstream.cc main.cc misc.cc \
+       score.cc note.cc  main.cc misc.cc \
        symbol.cc request.cc notename.cc  voice.cc\
        keyword.cc linestaff.cc table.cc command.cc\
        warn.cc debug.cc symtable.cc boxes.cc\
-       pstaff.cc vector.cc tstream.cc version.cc\
-       calcideal.cc\
-       template.cc template2.cc 
+       pstaff.cc  tstream.cc version.cc\
+       calcideal.cc scores.cc identifier.cc \
+       template1.cc template2.cc template3.cc
+
+
index 3965a0659e8f7870906cc5ffafe7ca753bc67407..e55af6c6f5ac9ad02ea725ac03bfbe42c4d956d2 100644 (file)
--- a/boxes.cc
+++ b/boxes.cc
@@ -17,8 +17,7 @@ Box::Box(svec<Real> s)
 }
 
 Box::Box()
-{
-    
+{        
 }
 Box::Box(Interval ix, Interval iy)
 {
index 0647d5f3e20c27b24e02b6e3dce99d17b4a124a7..9eb55cc9f78f6f269c6141213731803753b21454 100644 (file)
--- a/break.cc
+++ b/break.cc
@@ -13,7 +13,7 @@ svec<Real>
 PScore::solve_line(svec<const PCol *> curline) const
 {
    Spacing_problem sp;
-   //   mtor << "line of " << curline.sz() << " cols\n";
+   mtor << "line of " << curline.sz() << " cols\n";
    sp.add_column(curline[0], true, 0.0);
    for (int i=1; i< curline.sz()-1; i++)
        sp.add_column(curline[i]);
diff --git a/choleski.cc b/choleski.cc
deleted file mode 100644 (file)
index 2d8c68a..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-#include "choleski.hh"
-
-Vector
-Choleski_decomposition::solve(Vector rhs)const
-{
-    int n= rhs.dim();
-    assert(n == L.dim());
-    Vector y(n);
-
-    // forward substitution
-    for (int i=0; i < n; i++) {
-       Real sum(0.0);
-       for (int j=0; j < i; j++)
-           sum += y(j) * L(i,j);
-       y(i) = (rhs(i) - sum)/L(i,i);
-    }
-    for (int i=0; i < n; i++) {
-       assert(D(i));
-       y(i) /= D(i);
-    }
-
-    // backward subst
-    Vector x(n);
-    for (int i=n-1; i >= 0; i--) {
-       Real sum(0.0);
-       for (int j=i+1; j < n; j++)
-           sum += L(j,i)*x(j);
-       x(i) = (y(i) - sum)/L(i,i);
-    }
-    return x;
-}
-
-/*
-  Standard matrix algorithm.
-  */
-
-Choleski_decomposition::Choleski_decomposition(Matrix P)
-    : L(P.dim()), D(P.dim())
-{
-    int n = P.dim();
-    assert((P-P.transposed()).norm() < EPS);
-    L.unit();
-    for (int k= 0; k < n; k++) {
-       for (int j = 0; j < k; j++){
-           Real sum(0.0);
-           for (int l=0; l < j; l++)
-               sum += L(k,l)*L(j,l)*D(l);
-           L(k,j) = (P(k,j) - sum)/D(j);
-       }
-       Real sum=0.0;
-       
-       for (int l=0; l < k; l++)
-           sum += sqr(L(k,l))*D(l);
-       Real d = P(k,k) - sum;
-       D(k) = d;
-    }
-
-#ifdef NDEBUG
-    assert((original()-P).norm() < EPS);
-#endif
-}
-     
-Matrix
-Choleski_decomposition::original() const
-{
-    Matrix T(L.dim());
-    T.set_diag(D);
-    return L*T*L.transposed();
-}
-
-Matrix
-Choleski_decomposition::inverse() const
-{
-    int n=L.dim();
-    Matrix invm(n);
-    Vector e_i(n);
-    for (int i = 0; i < n; i++) {
-       e_i.set_unit(i);
-       Vector inv(solve(e_i));
-       for (int j = 0 ; j<n; j++)
-           invm(i,j) = inv(j);
-    }
-    
-#ifdef NDEBUG
-    Matrix I1(n), I2(original());
-    I1.unit();
-    assert((I1-original()*invm).norm() < EPS);
-#endif
-    
-    return invm;
-}
-
-
-
-
diff --git a/choleski.hh b/choleski.hh
deleted file mode 100644 (file)
index c6cb917..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef CHOLESKI_HH
-#define CHOLESKI_HH
-
-#include "matrix.hh"
-
-struct Choleski_decomposition {
-
-    /// lower triangle of Choleski decomposition
-    Matrix L;
-
-    /// diagonal 
-    Vector D;
-    ///Create decomposition of P
-    Choleski_decomposition(Matrix P);
-    /**
-    PRE
-    P needs to be symmetric positive definite
-    */
-    
-    Vector solve(Vector rhs) const;
-    Vector operator * (Vector rhs) const { return solve (rhs); }
-    /**
-    solve Px = rhs
-    */
-
-    Matrix inverse() const;
-    /**
-    return the inverse of the matrix P.
-    */
-
-    Matrix original() const;
-    /**
-    return P,  calc'ed from L and D
-    */
-        
-};
-/**
-    structure for using the LU decomposition of a positive definite .
-
-    #P# is split  into
-
-    LD transpose(L)
-    */
-    
-
-#endif
diff --git a/cols.cc b/cols.cc
index e2a13f35f32b39c0f1e5ca884fb3741a1ecb8f4d..0de683cc55ade3586268e4678257e842ef880c90 100644 (file)
--- a/cols.cc
+++ b/cols.cc
@@ -11,7 +11,9 @@ Idealspacing::Idealspacing(const PCol * l,const PCol * r)
 void
 Idealspacing::OK() const
 {
+#ifndef NDEBUG
     assert(hooke >= 0 && left  && right);
+#endif    
 }
 
 Interval
@@ -31,6 +33,7 @@ int
 PCol::compare(const PCol &c1, const PCol &c2)
 {
     assert(false);
+    return 0 ;
 }
 
 void
@@ -64,8 +67,10 @@ PCol::PCol(PCol *parent) {
 
 PCol::~PCol()
 {
-    delete prebreak;
-    delete postbreak;  
+    if (prebreak)
+       delete prebreak;        // no recursion!
+    if (postbreak)
+       delete postbreak;       
 }
 
 void
index bc9d17147f318564317ef2b4a13672b6bafdc2e0..38e464c382a53978c136a5c4a583554eb932923c 100644 (file)
--- a/const.hh
+++ b/const.hh
@@ -1,8 +1,11 @@
 /*
     global constants
     */
-
+#ifndef CONST_HH
+#define CONST_HH
 #include <math.h>
+#include "real.hh"
+
 const Real CM_TO_PT=72/2.54;
 const Real VERT_TO_PT=CM_TO_PT;        // tex output
 const Real HOR_TO_PT=CM_TO_PT; // tex output
@@ -10,3 +13,4 @@ const Real HOR_TO_PT=CM_TO_PT;        // tex output
 const Real EPS=1e-7;           // qlpsolve.hh
 const int MAXITER=100;         // qlpsolve.hh
 const Real INFTY=HUGE;
+#endif
index 69c5a04a5b3e9ed58c165d2877b5a1e5f159ae6e..874937573e346bda16f067d0139aea65ee0b2a84 100644 (file)
--- a/debug.cc
+++ b/debug.cc
@@ -1,18 +1,11 @@
 #include "debug.hh"
 #include "dstream.hh"
-int debug_flags;
+#include "vector.hh"
+
+Dstream monitor(&cout,".dstreamrc");
 
 void
-set_debug(String s)
+debug_init()
 {
-    if (s.pos ('t')) {
-       debug_flags |= DEBUGTOKEN;
-       mtor << " Turning on token debug\n";
-    }
-    if (s.pos ('p')){
-       debug_flags |= DEBUGPARSER;
-       mtor << "Turning on parser debugger\n";
-    }
-}
-
-Dstream monitor(cout,".dstreamrc");
+    set_matrix_debug(monitor);
+}   
index cf2c4ada52876d1228c2d520d62847e025e5fdd8..ae75b77fa142dd32d6cd6c6e2e3a732a229e0f80 100644 (file)
--- a/debug.hh
+++ b/debug.hh
@@ -6,7 +6,7 @@
 
 
 
-#define WARN warnout << "warning: "<<__FUNCTION__ << ": "
+#define WARN warnout << "warning: "<<__FUNCTION__ << "(): "
 extern ostream &warnout ;
 extern ostream *mlog;  
 extern Dstream monitor; // monitor
diff --git a/depend b/depend
index 1bc847e241932d2174edfb85a94422ba7b466975..3c3bccbdb509d67f2b15ce24f32da1c77e05f6f9 100644 (file)
--- a/depend
+++ b/depend
-smat.o: smat.cc smat.hh ../flower/vray.hh vsmat.hh real.hh
-matrix.o: matrix.cc matrix.hh vsmat.hh ../flower/vray.hh real.hh \
- vector.hh glob.hh proto.hh const.hh ../flower/string.hh \
- ../flower/stringutil.hh debug.hh dstream.hh ../flower/assoc.hh
-choleski.o: choleski.cc choleski.hh matrix.hh vsmat.hh \
- ../flower/vray.hh real.hh vector.hh glob.hh proto.hh const.hh
-qlp.o: qlp.cc debug.hh dstream.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/assoc.hh ../flower/vray.hh qlp.hh \
- matrix.hh vsmat.hh real.hh vector.hh glob.hh proto.hh const.hh \
- choleski.hh
-qlpsolve.o: qlpsolve.cc qlpsolve.hh qlp.hh matrix.hh vsmat.hh \
- ../flower/vray.hh real.hh vector.hh glob.hh proto.hh const.hh \
- debug.hh dstream.hh ../flower/string.hh ../flower/stringutil.hh \
- ../flower/assoc.hh choleski.hh
-break.o: break.cc linespace.hh glob.hh real.hh proto.hh const.hh \
- ../flower/list.hh ../flower/list.inl ../flower/cursor.hh \
- ../flower/link.hh ../flower/link.inl ../flower/cursor.inl \
- ../flower/vray.hh cols.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
- item.hh tex.hh ../flower/compare.hh matrix.hh vsmat.hh vector.hh \
- debug.hh dstream.hh ../flower/assoc.hh line.hh pstaff.hh pscore.hh
-linespace.o: linespace.cc linespace.hh glob.hh real.hh proto.hh \
+qlp.o: qlp.cc debug.hh ../flower/dstream.hh ../flower/string.hh \
+ ../flower/stringutil.hh ../flower/assoc.hh ../flower/vray.hh const.hh \
+ ../flower/real.hh qlp.hh ../flower/matrix.hh ../flower/vsmat.hh \
+ ../flower/vector.hh ../flower/choleski.hh
+qlpsolve.o: qlpsolve.cc qlpsolve.hh qlp.hh ../flower/matrix.hh \
+ ../flower/vsmat.hh ../flower/vray.hh ../flower/real.hh \
+ ../flower/vector.hh const.hh debug.hh ../flower/dstream.hh \
+ ../flower/string.hh ../flower/stringutil.hh ../flower/assoc.hh \
+ ../flower/choleski.hh
+break.o: break.cc linespace.hh glob.hh ../flower/real.hh proto.hh \
  const.hh ../flower/list.hh ../flower/list.inl ../flower/cursor.hh \
  ../flower/link.hh ../flower/link.inl ../flower/cursor.inl \
  ../flower/vray.hh cols.hh boxes.hh ../flower/textdb.hh \
  ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
- item.hh tex.hh ../flower/compare.hh matrix.hh vsmat.hh vector.hh \
- debug.hh dstream.hh ../flower/assoc.hh qlp.hh ../flower/unionfind.hh
-molecule.o: molecule.cc glob.hh real.hh proto.hh const.hh \
+ item.hh tex.hh ../flower/compare.hh ../flower/matrix.hh \
+ ../flower/vsmat.hh ../flower/vector.hh debug.hh ../flower/dstream.hh \
+ ../flower/assoc.hh line.hh pstaff.hh pscore.hh
+linespace.o: linespace.cc linespace.hh glob.hh ../flower/real.hh \
+ proto.hh const.hh ../flower/list.hh ../flower/list.inl \
+ ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
+ ../flower/cursor.inl ../flower/vray.hh cols.hh boxes.hh \
+ ../flower/textdb.hh ../flower/textstr.hh ../flower/string.hh \
+ ../flower/stringutil.hh item.hh tex.hh ../flower/compare.hh \
+ ../flower/matrix.hh ../flower/vsmat.hh ../flower/vector.hh debug.hh \
+ ../flower/dstream.hh ../flower/assoc.hh qlp.hh ../flower/unionfind.hh
+molecule.o: molecule.cc glob.hh ../flower/real.hh proto.hh const.hh \
  ../flower/string.hh ../flower/stringutil.hh molecule.hh \
  ../flower/list.hh ../flower/list.inl ../flower/cursor.hh \
  ../flower/link.hh ../flower/link.inl ../flower/cursor.inl boxes.hh \
  ../flower/textdb.hh ../flower/textstr.hh ../flower/vray.hh item.hh \
  tex.hh symbol.hh
-line.o: line.cc line.hh real.hh ../flower/list.hh ../flower/list.inl \
- ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
- ../flower/cursor.inl ../flower/vray.hh glob.hh proto.hh const.hh \
- pstaff.hh item.hh boxes.hh ../flower/textdb.hh ../flower/textstr.hh \
- ../flower/string.hh ../flower/stringutil.hh tex.hh symbol.hh cols.hh \
- ../flower/compare.hh pscore.hh
-pscore.o: pscore.cc debug.hh dstream.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/assoc.hh ../flower/vray.hh line.hh \
- real.hh ../flower/list.hh ../flower/list.inl ../flower/cursor.hh \
- ../flower/link.hh ../flower/link.inl ../flower/cursor.inl glob.hh \
+line.o: line.cc line.hh ../flower/real.hh ../flower/list.hh \
+ ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
+ ../flower/link.inl ../flower/cursor.inl ../flower/vray.hh glob.hh \
  proto.hh const.hh pstaff.hh item.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh tex.hh pscore.hh cols.hh ../flower/compare.hh \
- tstream.hh
+ ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
+ tex.hh symbol.hh cols.hh ../flower/compare.hh pscore.hh
+pscore.o: pscore.cc debug.hh ../flower/dstream.hh ../flower/string.hh \
+ ../flower/stringutil.hh ../flower/assoc.hh ../flower/vray.hh line.hh \
+ ../flower/real.hh ../flower/list.hh ../flower/list.inl \
+ ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
+ ../flower/cursor.inl glob.hh proto.hh const.hh pstaff.hh item.hh \
+ boxes.hh ../flower/textdb.hh ../flower/textstr.hh tex.hh pscore.hh \
+ cols.hh ../flower/compare.hh tstream.hh
 tex.o: tex.cc tex.hh ../flower/string.hh ../flower/stringutil.hh \
  boxes.hh ../flower/textdb.hh ../flower/textstr.hh ../flower/vray.hh \
- real.hh symbol.hh const.hh
-item.o: item.cc line.hh real.hh ../flower/list.hh ../flower/list.inl \
- ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
- ../flower/cursor.inl ../flower/vray.hh glob.hh proto.hh const.hh \
- pstaff.hh item.hh boxes.hh ../flower/textdb.hh ../flower/textstr.hh \
- ../flower/string.hh ../flower/stringutil.hh tex.hh symbol.hh cols.hh \
- ../flower/compare.hh
-cols.o: cols.cc cols.hh glob.hh real.hh proto.hh const.hh boxes.hh \
- ../flower/textdb.hh ../flower/textstr.hh ../flower/string.hh \
../flower/real.hh symbol.hh const.hh
+item.o: item.cc line.hh ../flower/real.hh ../flower/list.hh \
+ ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
+ ../flower/link.inl ../flower/cursor.inl ../flower/vray.hh glob.hh \
+ proto.hh const.hh pstaff.hh item.hh boxes.hh ../flower/textdb.hh \
+ ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
tex.hh symbol.hh cols.hh ../flower/compare.hh
+cols.o: cols.cc cols.hh glob.hh ../flower/real.hh proto.hh const.hh \
boxes.hh ../flower/textdb.hh ../flower/textstr.hh ../flower/string.hh \
  ../flower/stringutil.hh ../flower/vray.hh ../flower/list.hh \
  ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
  ../flower/link.inl ../flower/cursor.inl item.hh tex.hh \
  ../flower/compare.hh pstaff.hh
 staff.o: staff.cc staff.hh score.hh ../flower/vray.hh cols.hh glob.hh \
- real.hh proto.hh const.hh boxes.hh ../flower/textdb.hh \
../flower/real.hh proto.hh const.hh boxes.hh ../flower/textdb.hh \
  ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
  ../flower/list.hh ../flower/list.inl ../flower/cursor.hh \
  ../flower/link.hh ../flower/link.inl ../flower/cursor.inl item.hh \
  tex.hh ../flower/compare.hh mtime.hh command.hh voice.hh request.hh \
- debug.hh dstream.hh ../flower/assoc.hh pscore.hh pstaff.hh
-rhythmstaf.o: rhythmstaf.cc request.hh glob.hh real.hh proto.hh \
- const.hh ../flower/string.hh ../flower/stringutil.hh mtime.hh \
- debug.hh dstream.hh ../flower/assoc.hh ../flower/vray.hh linestaff.hh \
- pstaff.hh ../flower/list.hh ../flower/list.inl ../flower/cursor.hh \
- ../flower/link.hh ../flower/link.inl ../flower/cursor.inl item.hh \
- boxes.hh ../flower/textdb.hh ../flower/textstr.hh tex.hh staff.hh \
- score.hh cols.hh ../flower/compare.hh command.hh voice.hh pscore.hh \
+ debug.hh ../flower/dstream.hh ../flower/assoc.hh pscore.hh pstaff.hh
+rhythmstaf.o: rhythmstaf.cc request.hh glob.hh ../flower/real.hh \
+ proto.hh const.hh ../flower/string.hh ../flower/stringutil.hh \
+ mtime.hh debug.hh ../flower/dstream.hh ../flower/assoc.hh \
+ ../flower/vray.hh linestaff.hh pstaff.hh ../flower/list.hh \
+ ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
+ ../flower/link.inl ../flower/cursor.inl item.hh boxes.hh \
+ ../flower/textdb.hh ../flower/textstr.hh tex.hh staff.hh score.hh \
+ cols.hh ../flower/compare.hh command.hh voice.hh pscore.hh \
  molecule.hh rhythmstaf.hh symbol.hh
 score.o: score.cc tstream.hh ../flower/string.hh \
  ../flower/stringutil.hh score.hh ../flower/vray.hh cols.hh glob.hh \
- real.hh proto.hh const.hh boxes.hh ../flower/textdb.hh \
../flower/real.hh proto.hh const.hh boxes.hh ../flower/textdb.hh \
  ../flower/textstr.hh ../flower/list.hh ../flower/list.inl \
  ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
  ../flower/cursor.inl item.hh tex.hh ../flower/compare.hh mtime.hh \
  command.hh pscore.hh pstaff.hh staff.hh voice.hh request.hh misc.hh \
- debug.hh dstream.hh ../flower/assoc.hh
-note.o: note.cc ../flower/string.hh ../flower/stringutil.hh real.hh \
- debug.hh dstream.hh ../flower/assoc.hh ../flower/vray.hh request.hh \
- glob.hh proto.hh const.hh mtime.hh voice.hh ../flower/list.hh \
- ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
- ../flower/link.inl ../flower/cursor.inl notename.hh
-dstream.o: dstream.cc dstream.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/assoc.hh ../flower/vray.hh \
- ../flower/textdb.hh ../flower/textstr.hh
-main.o: main.cc ../flower/lgetopt.hh misc.hh mtime.hh real.hh debug.hh \
- dstream.hh ../flower/string.hh ../flower/stringutil.hh \
- ../flower/assoc.hh ../flower/vray.hh score.hh cols.hh glob.hh \
- proto.hh const.hh boxes.hh ../flower/textdb.hh ../flower/textstr.hh \
- ../flower/list.hh ../flower/list.inl ../flower/cursor.hh \
- ../flower/link.hh ../flower/link.inl ../flower/cursor.inl item.hh \
- tex.hh ../flower/compare.hh command.hh globvars.hh
-misc.o: misc.cc misc.hh mtime.hh real.hh glob.hh proto.hh const.hh
+ debug.hh ../flower/dstream.hh ../flower/assoc.hh
+note.o: note.cc ../flower/string.hh ../flower/stringutil.hh \
+ ../flower/real.hh debug.hh ../flower/dstream.hh ../flower/assoc.hh \
+ ../flower/vray.hh request.hh glob.hh proto.hh const.hh mtime.hh \
+ voice.hh ../flower/list.hh ../flower/list.inl ../flower/cursor.hh \
+ ../flower/link.hh ../flower/link.inl ../flower/cursor.inl notename.hh
+main.o: main.cc ../flower/lgetopt.hh misc.hh mtime.hh \
+ ../flower/real.hh ../flower/string.hh ../flower/stringutil.hh main.hh \
+ proto.hh
+misc.o: misc.cc misc.hh mtime.hh ../flower/real.hh glob.hh proto.hh \
+ const.hh
 symbol.o: symbol.cc symbol.hh ../flower/string.hh \
  ../flower/stringutil.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/vray.hh real.hh
-request.o: request.cc request.hh glob.hh real.hh proto.hh const.hh \
- ../flower/string.hh ../flower/stringutil.hh mtime.hh
-notename.o: notename.cc glob.hh real.hh proto.hh const.hh \
+ ../flower/textstr.hh ../flower/vray.hh ../flower/real.hh
+request.o: request.cc request.hh glob.hh ../flower/real.hh proto.hh \
const.hh ../flower/string.hh ../flower/stringutil.hh mtime.hh
+notename.o: notename.cc glob.hh ../flower/real.hh proto.hh const.hh \
  ../flower/string.hh ../flower/stringutil.hh
-voice.o: voice.cc debug.hh dstream.hh ../flower/string.hh \
+voice.o: voice.cc debug.hh ../flower/dstream.hh ../flower/string.hh \
  ../flower/stringutil.hh ../flower/assoc.hh ../flower/vray.hh voice.hh \
- mtime.hh real.hh ../flower/list.hh ../flower/list.inl \
+ mtime.hh ../flower/real.hh ../flower/list.hh ../flower/list.inl \
  ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
  ../flower/cursor.inl request.hh glob.hh proto.hh const.hh
-keyword.o: keyword.cc glob.hh real.hh proto.hh const.hh lexer.hh
+keyword.o: keyword.cc glob.hh ../flower/real.hh proto.hh const.hh \
+ lexer.hh
 linestaff.o: linestaff.cc linestaff.hh pstaff.hh ../flower/list.hh \
  ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
- ../flower/link.inl ../flower/cursor.inl item.hh glob.hh real.hh \
- proto.hh const.hh boxes.hh ../flower/textdb.hh ../flower/textstr.hh \
- ../flower/string.hh ../flower/stringutil.hh ../flower/vray.hh tex.hh \
- symbol.hh
-table.o: table.cc glob.hh real.hh proto.hh const.hh \
- ../flower/string.hh ../flower/stringutil.hh keyword.hh parser.hh
+ ../flower/link.inl ../flower/cursor.inl item.hh glob.hh \
+ ../flower/real.hh proto.hh const.hh boxes.hh ../flower/textdb.hh \
+ ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
+ ../flower/vray.hh tex.hh symbol.hh
+table.o: table.cc glob.hh ../flower/real.hh proto.hh const.hh debug.hh \
+ ../flower/dstream.hh ../flower/string.hh ../flower/stringutil.hh \
+ ../flower/assoc.hh ../flower/vray.hh keyword.hh parser.hh
 command.o: command.cc ../flower/string.hh ../flower/stringutil.hh \
- command.hh glob.hh real.hh proto.hh const.hh mtime.hh \
+ command.hh glob.hh ../flower/real.hh proto.hh const.hh mtime.hh \
  ../flower/vray.hh
-warn.o: warn.cc debug.hh dstream.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/assoc.hh ../flower/vray.hh
-debug.o: debug.cc debug.hh dstream.hh ../flower/string.hh \
+warn.o: warn.cc debug.hh ../flower/dstream.hh ../flower/string.hh \
  ../flower/stringutil.hh ../flower/assoc.hh ../flower/vray.hh
-symtable.o: symtable.cc misc.hh mtime.hh real.hh debug.hh dstream.hh \
- ../flower/string.hh ../flower/stringutil.hh ../flower/assoc.hh \
- ../flower/vray.hh symbol.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh symtable.hh const.hh
+debug.o: debug.cc debug.hh ../flower/dstream.hh ../flower/string.hh \
+ ../flower/stringutil.hh ../flower/assoc.hh ../flower/vray.hh \
+ ../flower/vector.hh ../flower/real.hh
+symtable.o: symtable.cc misc.hh mtime.hh ../flower/real.hh debug.hh \
+ ../flower/dstream.hh ../flower/string.hh ../flower/stringutil.hh \
+ ../flower/assoc.hh ../flower/vray.hh symbol.hh boxes.hh \
+ ../flower/textdb.hh ../flower/textstr.hh symtable.hh const.hh
 boxes.o: boxes.cc boxes.hh ../flower/textdb.hh ../flower/textstr.hh \
- ../flower/string.hh ../flower/stringutil.hh ../flower/vray.hh real.hh \
- const.hh
+ ../flower/string.hh ../flower/stringutil.hh ../flower/vray.hh \
../flower/real.hh const.hh
 pstaff.o: pstaff.cc pstaff.hh ../flower/list.hh ../flower/list.inl \
  ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
- ../flower/cursor.inl item.hh glob.hh real.hh proto.hh const.hh \
- boxes.hh ../flower/textdb.hh ../flower/textstr.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/vray.hh tex.hh
-vector.o: vector.cc debug.hh dstream.hh ../flower/string.hh \
- ../flower/stringutil.hh ../flower/assoc.hh ../flower/vray.hh \
- vector.hh glob.hh real.hh proto.hh const.hh
+ ../flower/cursor.inl item.hh glob.hh ../flower/real.hh proto.hh \
+ const.hh boxes.hh ../flower/textdb.hh ../flower/textstr.hh \
+ ../flower/string.hh ../flower/stringutil.hh ../flower/vray.hh tex.hh
 tstream.o: tstream.cc tex.hh ../flower/string.hh \
  ../flower/stringutil.hh boxes.hh ../flower/textdb.hh \
- ../flower/textstr.hh ../flower/vray.hh real.hh tstream.hh debug.hh \
- dstream.hh ../flower/assoc.hh
+ ../flower/textstr.hh ../flower/vray.hh ../flower/real.hh misc.hh \
mtime.hh tstream.hh debug.hh ../flower/dstream.hh ../flower/assoc.hh
 version.o: version.cc version.hh
 calcideal.o: calcideal.cc tstream.hh ../flower/string.hh \
  ../flower/stringutil.hh score.hh ../flower/vray.hh cols.hh glob.hh \
- real.hh proto.hh const.hh boxes.hh ../flower/textdb.hh \
../flower/real.hh proto.hh const.hh boxes.hh ../flower/textdb.hh \
  ../flower/textstr.hh ../flower/list.hh ../flower/list.inl \
  ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
  ../flower/cursor.inl item.hh tex.hh ../flower/compare.hh mtime.hh \
  command.hh pscore.hh pstaff.hh staff.hh voice.hh request.hh misc.hh \
- debug.hh dstream.hh ../flower/assoc.hh
-template.o: template.cc line.hh real.hh ../flower/list.hh \
+ debug.hh ../flower/dstream.hh ../flower/assoc.hh
+scores.o: scores.cc main.hh proto.hh ../flower/real.hh score.hh \
+ ../flower/vray.hh cols.hh glob.hh const.hh boxes.hh \
+ ../flower/textdb.hh ../flower/textstr.hh ../flower/string.hh \
+ ../flower/stringutil.hh ../flower/list.hh ../flower/list.inl \
+ ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
+ ../flower/cursor.inl item.hh tex.hh ../flower/compare.hh mtime.hh \
+ command.hh
+identifier.o: identifier.cc keyword.hh lexer.hh proto.hh \
+ ../flower/real.hh parser.hh
+template1.o: template1.cc line.hh ../flower/real.hh ../flower/list.hh \
  ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
  ../flower/link.inl ../flower/cursor.inl ../flower/vray.hh glob.hh \
  proto.hh const.hh pstaff.hh item.hh boxes.hh ../flower/textdb.hh \
  ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
- tex.hh cols.hh ../flower/compare.hh request.hh mtime.hh score.hh \
command.hh staff.hh voice.hh ../flower/list.cc ../flower/cursor.cc
-template2.o: template2.cc line.hh real.hh ../flower/list.hh \
+ tex.hh cols.hh ../flower/compare.hh request.hh mtime.hh command.hh \
+ ../flower/list.cc ../flower/cursor.cc
+template2.o: template2.cc line.hh ../flower/real.hh ../flower/list.hh \
  ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
  ../flower/link.inl ../flower/cursor.inl ../flower/vray.hh glob.hh \
  proto.hh const.hh pstaff.hh item.hh boxes.hh ../flower/textdb.hh \
  ../flower/textstr.hh ../flower/string.hh ../flower/stringutil.hh \
- tex.hh symbol.hh voice.hh mtime.hh request.hh molecule.hh staff.hh \
score.hh cols.hh ../flower/compare.hh command.hh ../flower/list.cc \
+ tex.hh symbol.hh voice.hh mtime.hh request.hh staff.hh score.hh \
+ cols.hh ../flower/compare.hh command.hh ../flower/list.cc \
  ../flower/cursor.cc
-parser.o: parser.cc lexer.hh proto.hh real.hh staff.hh score.hh \
- ../flower/vray.hh cols.hh glob.hh const.hh boxes.hh \
+template3.o: template3.cc request.hh glob.hh ../flower/real.hh \
+ proto.hh const.hh ../flower/string.hh ../flower/stringutil.hh \
+ mtime.hh command.hh ../flower/vray.hh molecule.hh ../flower/list.hh \
+ ../flower/list.inl ../flower/cursor.hh ../flower/link.hh \
+ ../flower/link.inl ../flower/cursor.inl boxes.hh ../flower/textdb.hh \
+ ../flower/textstr.hh item.hh tex.hh ../flower/list.cc \
+ ../flower/cursor.cc
+parser.o: parser.cc lexer.hh proto.hh ../flower/real.hh staff.hh \
+ score.hh ../flower/vray.hh cols.hh glob.hh const.hh boxes.hh \
  ../flower/textdb.hh ../flower/textstr.hh ../flower/string.hh \
  ../flower/stringutil.hh ../flower/list.hh ../flower/list.inl \
  ../flower/cursor.hh ../flower/link.hh ../flower/link.inl \
  ../flower/cursor.inl item.hh tex.hh ../flower/compare.hh mtime.hh \
- command.hh voice.hh request.hh keyword.hh globvars.hh debug.hh \
- dstream.hh ../flower/assoc.hh parseconstruct.hh
-lexer.o: lexer.cc glob.hh real.hh proto.hh const.hh \
+ command.hh voice.hh request.hh main.hh keyword.hh debug.hh \
../flower/dstream.hh ../flower/assoc.hh parseconstruct.hh
+lexer.o: lexer.cc glob.hh ../flower/real.hh proto.hh const.hh \
  ../flower/string.hh ../flower/stringutil.hh lexer.hh keyword.hh \
- ../flower/vray.hh parser.hh debug.hh dstream.hh ../flower/assoc.hh
+ ../flower/vray.hh parser.hh debug.hh ../flower/dstream.hh \
+ ../flower/assoc.hh
diff --git a/dimen.tex b/dimen.tex
new file mode 100644 (file)
index 0000000..0be3eca
--- /dev/null
+++ b/dimen.tex
@@ -0,0 +1,49 @@
+\font\musicfnt=musix20
+\def\mb#1{{\musicfnt\musicfnt\char#1}}
+\newdimen\wid
+\newdimen\inc
+\newdimen\here
+\def\hruler#1{%
+       \wid=#1pt
+       \inc=\wid
+       \divide\inc by #1
+       \divide\wid by 2
+       \here=-\wid
+       \loop\ifdim\here<\wid\advance\here by\inc
+               \hbox to0pt{\kern\here\vrule width0.05pt height 2pt\hss}%
+       \repeat%
+}
+\def\vruler#1{%
+       \wid=#1pt
+       \inc=\wid
+       \divide\inc by #1
+       \divide\wid by 2
+       \here=-\wid
+       \loop\ifdim\here<\wid\advance\here by\inc
+               \vbox to0pt{\vskip\here\vrule width2pt height 0.05pt\vss}%
+       \repeat%
+}
+\def\twhrul{\hbox to 0pt{\hbox{\hruler{20}\vrule
+       width0.1pt height 3ptdepth 1pt}}}
+\def\twvrul{\hbox{\vbox to 20pt{\vruler{20}\vrule
+       width3pt height 0.1pt}}}
+\def\doitem#1{
+       #1 %
+        %\twvrul%doesn't work
+       \hbox to 50pt{\qquad\twhrul\mb{#1}\hss}\setbox0=\hbox{\mb{#1}} width \the\wd0\ depth \the\dp0 \ height \the\ht0}
+
+\newcount\n
+\def\charn{\n=0
+       \loop\ifnum\n<255\advance\n by1
+       \doitem{\number\n}\endgraf\repeat}
+
+
+       \charn
+
+
+
+
+
+
+\bye
\ No newline at end of file
diff --git a/dstream.cc b/dstream.cc
deleted file mode 100644 (file)
index 1326b8b..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-#include <fstream.h>
-
-#include "dstream.hh"
-#include "string.hh"
-#include "textdb.hh"
-
-
-/*
-  should use Regexp library.
-  */
-static String
-strip_pretty(String pret)
-{
-    String cl(pret.left(pret.pos('(')-1));
-    int l = cl.lastPos(' ');
-    cl = cl.right(cl.len() -l);
-    return cl;
-}
-
-static String
-strip_member(String pret)
-{
-    String cl(pret.left(pret.lastPos(':')-2));
-    return cl;
-}
-
-Dstream&
-Dstream::identify_as(String name)
-{
-    String mem(strip_pretty(name));
-    String cl(strip_member(mem));
-    
-    if(!silent.elt_query(cl))
-       silent[cl] = false;
-    local_silence = silent[cl];
-    if (classname != cl && !local_silence) {
-       classname=cl;
-       *os << "[" << classname << ":]";
-    }
-    return *this;
-}
-
-void
-Dstream::switch_output(String name,bool b)
-{
-    silent[name] = b;
-}
-
-///
-Dstream &
-Dstream::operator<<(String s)
-{
-    if (local_silence)
-       return *this;
-    
-    for (const char *cp = s  ; *cp; cp++)
-       switch(*cp) 
-           {
-           case '{':
-           case '[':
-           case '(': indentlvl += INDTAB;
-               *os << *cp;             
-               break;
-               
-           case ')':
-           case ']':
-           case '}':
-               indentlvl -= INDTAB;
-               *os << *cp              ;
-               
-               if  (indentlvl<0) indentlvl = 0;
-               break;
-               
-           case '\n':
-               *os << '\n' << String (' ', indentlvl) << flush;
-               break;        
-           default:
-               *os << *cp;
-               break;
-           }
-    return *this;    
-}
-
-/** only output possibility. Delegates all conversion to String class.
- */
-
-Dstream::Dstream(ostream &r, const char * cfg_nm )
-{
-    os = &r;
-    indentlvl = 0;
-    
-    const char * fn =cfg_nm ? cfg_nm : ".dstreamrc";
-    {
-       ifstream ifs(fn);       // can't open
-       if (!ifs)
-           return;
-    }
-    cerr << "(" << fn;
-    Text_db cfg(fn);
-    while (! cfg.eof()){            
-        Text_record  r(  cfg++);
-        assert(r.sz() == 2);
-        silent[r[0]] = r[1].to_bool();
-    }
-    cerr <<")";
-}
-
-
diff --git a/dstream.hh b/dstream.hh
deleted file mode 100644 (file)
index 2467369..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// debug_stream
-
-#ifndef DSTREAM_HH
-#define DSTREAM_HH
-
-#include "string.hh"
-#include "assoc.hh"
-
-const char eol= '\n';
-
-/// debug stream
-class Dstream
-{
-    ostream *os;
-    int indentlvl;
-    Assoc<String, bool> silent;
-    bool local_silence;
-    String classname;
-    /// indent of each level 
-    const INDTAB = 3;
-
-public:
-    Dstream(ostream &r, const char  * = 0);
-    Dstream &identify_as(String s);
-    void switch_output(String s,bool);
-    Dstream &operator << (String s);
-};
- /**
-   a class for providing debug output of nested structures,
-   with indents according to \{\}()[].
-
-   Using identify_as() one can turn on and off specific messages. Init
-   for these can be given in a rc file
-   
-  */
-#endif
-
index 9db4fbf5e872bf13de6ebc95634d7c01764594e1..aff8ac8f14f8b72be0014aac1f6cdfde46dd4f1d 100644 (file)
@@ -1,12 +1,13 @@
 MAJVER=1
 MINVER=0
-PATCHLEVEL=2
+PATCHLEVEL=3
 
 PACKAGENAME=flower
 VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL)
 DNAME=$(PACKAGENAME)-$(VERSION)
-#DEFINES=-DNDEBUG
-CXXFLAGS+=$(DEFINES) -g -Wall -W -pedantic
+DEFINES=-DNDEBUG -DNPRINT -O2
+#DEFINES=-g
+CXXFLAGS+=$(DEFINES)  -Wall -W -pedantic
 
 include Sources.make
 
index 18fb18cb24dc77560a29fc1163f486759b8ef752..6521100b3bb5ba72883175fdeaa7a77bfc716bfd 100644 (file)
@@ -5,7 +5,7 @@ cc=lgetopt.cc    string.cc dataf.cc textdb.cc unionfind.cc  \
 
 templatecc=cursor.cc list.cc tsmat.cc 
 inl=findcurs.inl link.inl list.inl
-hh=cursor.hh cursor.inl lgetopt.hh link.hh list.hh dstream.hh \
+hh=cursor.hh pcursor.hh cursor.inl lgetopt.hh link.hh list.hh dstream.hh \
        string.hh stringutil.hh vray.hh textdb.hh textstr.hh  assoc.hh\
        findcurs.hh unionfind.hh compare.hh handle.hh matrix.hh\
        smat.hh vsmat.hh  vector.hh  real.hh choleski.hh\
index c8f3e5ad5297ad7119d3058aa13f3fe08871ef7e..8d6e50591d20e791b3902b725a8306b7dd2e3188 100644 (file)
@@ -9,10 +9,6 @@
 
        * Restricted cursor/list: make sublist from a list, and use rcursor as if list is as big as the sublist.
 
-       * Cursor signedcompare
-
-       * int Cursor::op-(Cursor)
-
        * move towards gnu?
 
                parsestream.h
index 05b6e89e41d8a0e9143eed417905b11fcba2691f..47c7101c87cb9b65029b8dd4874194a836e4375c 100644 (file)
@@ -2,21 +2,24 @@
 #define COMPARE_HH
 
 /// handy notations for a signed comparison
-#define instantiate_compare(type, function)                            \
-inline bool operator>(type t1, type t2) { return function(t1, t2) > 0; }       \
- inline bool operator>=(type t1, type t2) { return function(t1, t2) >= 0; }    \
- inline bool operator==(type t1, type t2) { return function(t1, t2) == 0; }    \
- inline bool operator<=(type t1, type t2) { return function(t1, t2) <= 0; }    \
- inline bool operator<(type t1, type t2) { return function(t1, t2) < 0; } \
- inline type MAX(type t1, type t2) {  return (t1 > t2 )? t1 : t2; }\
- inline type MIN(type t1, type t2) {  return (t1 < t2 )? t1 : t2; }\
+#define template_instantiate_compare(type, function, prefix)                           \
+prefix inline bool operator>(type t1, type t2) { return function(t1, t2) > 0; }        \
+prefix inline bool operator>=(type t1, type t2) { return function(t1, t2) >= 0; }      \
+prefix inline bool operator==(type t1, type t2) { return function(t1, t2) == 0; }      \
+prefix inline bool operator<=(type t1, type t2) { return function(t1, t2) <= 0; }      \
+prefix inline bool operator<(type t1, type t2) { return function(t1, t2) < 0; } \
+prefix inline type MAX(type t1, type t2) {  return (t1 > t2 )? t1 : t2; }\
+prefix inline type MIN(type t1, type t2) {  return (t1 < t2 )? t1 : t2; }\
   \
-  bool operator<(type t1, type t2) /* stupid fix to allow ; */
+prefix  bool operator<(type t1, type t2) /* stupid fix to allow ; */
      /**
     make the operators{<,<=,==,>=,>} and the MAX and MIN of two.
     Please fill a & in the type argument if necessary.    
     */
 
+
+    
+#define instantiate_compare(type, func) template_instantiate_compare(type,func, )
      
 
      
index 10e90de91912761ed88539142a8c3a22e892fa0b..2a9f885689e57bdcfb3601bfd61603ba44abfc60 100644 (file)
@@ -1,10 +1,7 @@
-// cursor.cc
 #ifndef CURSOR_CC
 #define CURSOR_CC
 
 #include "cursor.hh"
-//#define inline
-//#include "cursor.inl"
 #include <assert.h>
 
 template<class T>
@@ -72,4 +69,27 @@ Cursor<T>::operator -( int i ) const
     return r;
 }
 
+template<class T>
+int
+Cursor<T>::operator-(Cursor<T> c) const
+{
+    assert(c.list == list);
+    int dif = 0;
+    Cursor<T> upward(c);
+    while (upward.ok() && upward.pointer_ != pointer_) {
+       upward++;
+       dif++;
+    }
+    
+    if (upward.ok())
+       return dif;
+    dif =0;
+    while (c.ok()&& c.pointer_ != pointer_) {
+       dif --;
+       c--;
+    }
+    assert(c.ok());
+    return dif;
+}
+
 #endif
index 45c02aea15e82546b24ac3d83fdd8f5a160507f6..cff93c68ce4edfdde8af8b192acf99a8b4ffe4e9 100644 (file)
@@ -24,7 +24,7 @@ class Cursor
 
     /// make cursor with #no# items further
     Cursor<T> operator +( int no) const;
-
+    int operator -(Cursor<T> op) const;
     Cursor<T> operator -=(int);
     Cursor<T> operator +=(int);
     
@@ -80,13 +80,11 @@ class Cursor
     /// access the list this came from
     const List<T>& list() const ;
     Link<T>* pointer();
-    
+
 private:
     List<T>& list_;
     Link<T>* pointer_;
 };
-
-
 /** 
   add and insert extend the list
   items are always stored as copies in List, but:
@@ -98,31 +96,32 @@ private:
 
 
 
-/// cursor which feels like a pointer
-template<class T>
-struct PCursor : public Cursor<T> {
 
-    /// make cursor with #no# items back
-    PCursor<T> operator -( int no) const {
-       return PCursor<T> (Cursor<T>::operator-(no));
-    }
 
-    /// make cursor with #no# items further
-    PCursor<T> operator +( int no) const {
-       return PCursor<T> (Cursor<T>::operator+(no));
-    }
-    PCursor(List<T> & l) : Cursor<T> (l) {}
 
-    PCursor( const Cursor<T>& cursor ) : Cursor<T>(cursor) { }
-    T operator ->() { return  *(*this); }
+/*
+  comparations.
+  */
 
-};
-/**
- HWN: I'd like an operator->(), so here it is.
 
- Cursor to go with pointer list.
- */
 
+
+
+
+
+
+
+#include "compare.hh"
+
+template<class T>
+inline  int cursor_compare(Cursor<T> a,Cursor<T>b)
+{
+    return b-a;
+}
+
+template_instantiate_compare(Cursor<T>, cursor_compare, template<class T>);
+
+#include "pcursor.hh"
 #include "list.hh"
 #include "cursor.inl"
 
diff --git a/flower/pcursor.hh b/flower/pcursor.hh
new file mode 100644 (file)
index 0000000..8b0b179
--- /dev/null
@@ -0,0 +1,26 @@
+
+
+/// cursor which feels like a pointer
+template<class T>
+struct PCursor : public Cursor<T> {
+
+    /// make cursor with #no# items back
+    PCursor<T> operator -( int no) const {
+       return PCursor<T> (Cursor<T>::operator-(no));
+    }
+
+    /// make cursor with #no# items further
+    PCursor<T> operator +( int no) const {
+       return PCursor<T> (Cursor<T>::operator+(no));
+    }
+    PCursor(List<T> & l) : Cursor<T> (l) {}
+
+    PCursor( const Cursor<T>& cursor ) : Cursor<T>(cursor) { }
+    T operator ->() { return  *(*this); }
+
+};
+/**
+ HWN: I'd like an operator->(), so here it is.
+
+ Cursor to go with pointer list.
+ */
index c79e017f71db0f4dd34f10b3c29a239c78666ba1..8b137891791fe96927ad78e64b0aad7bded08bdc 100644 (file)
@@ -1 +1 @@
-extern Score *the_score;
+
diff --git a/identifier.cc b/identifier.cc
new file mode 100644 (file)
index 0000000..9eab42e
--- /dev/null
@@ -0,0 +1,22 @@
+#include <assert.h>
+#include "keyword.hh"
+#include "lexer.hh"
+#include "parser.hh"
+
+Identifier::Identifier()
+{
+    data = 0;
+    type = IDENTIFIER;
+}
+
+
+Identifier::~Identifier()
+{
+    if (!data)
+       return;
+    switch (type) {
+    case IDENTIFIER:
+    default:
+       assert(false);
+    }
+}
index aa87a8dc1af7591d595219c9ed722753142dd3ef..42267ef57a5cb29167ffc12eed102022590763bf 100644 (file)
@@ -13,5 +13,11 @@ struct Keyword_table
     int     lookup(const char *s) const;
 };
 
-struct Identifier{
+struct Identifier
+{
+    void *data;
+    int type;
+
+    Identifier();
+    ~Identifier();
 };
diff --git a/lexer.l b/lexer.l
index 0063227f4e2112184e059ae4340af45c1edb2deb..a0da226a995ebd6ac9bf594a435ec280597812ad 100644 (file)
--- a/lexer.l
+++ b/lexer.l
@@ -23,6 +23,7 @@ const int DOTPRINT=50; // every 50 lines dots
 %option debug
 %x notes
 %x incl
+%x quote
 
 OPTSIGN                !?
 NOTENAMEI       A|B|C|D|E|F|G|As|Bes|Ces|Des|Es|Fes|Ges|Ais|Bis|Cis|Dis|Eis|Fis|Gis
@@ -46,16 +47,14 @@ REAL                [0-9]+(\.[0-9]*)?
 
 <notes>{RESTNAME}      {
        const char *s = YYText();
-       yylval.string = new String (s);
-       if (debug_flags & DEBUGTOKEN)
-               mtor << "rest:"<< yylval.string;
+       yylval.string = new String (s); 
+       mtor << "rest:"<< yylval.string;
        return RESTNAME;
 }
 <notes>{PITCH} {
        const char *s = YYText();
        yylval.string = new String (s);
-       if (debug_flags & DEBUGTOKEN)
-               mtor << "pitch:"<< yylval.string;
+       mtor << "pitch:"<< *yylval.string;
        return PITCH;
 }
 <notes>{DURATION}      {
@@ -73,9 +72,20 @@ REAL         [0-9]+(\.[0-9]*)?
        BEGIN(INITIAL); return '$';
 }
 <notes>.       {
-         cout << "SCANNER <notes> HOLE `" << YYText()<<'\''<<endl; 
-         return YYText()[0];
+       error("lexer error: illegal character found: " + String(YYText()));
+}
+
+\"             {
+       BEGIN(quote);
+}
+<quote>[^\"]*  {
+       yylval.string = new String (YYText());
+}
+<quote>\"      {
+       BEGIN(INITIAL);
+       return STRING;
 }
+
 <<EOF>> {
        if(!close_input())
                yyterminate();
@@ -91,14 +101,16 @@ REAL               [0-9]+(\.[0-9]*)?
 
 {REAL}         {
        Real r;
-       sscanf (YYText(), "%lf", &r);
+       int cnv=sscanf (YYText(), "%lf", &r);
+       assert(cnv == 1);
+       mtor  << "token (REAL)" << r;
        yylval.real = r;
        return REAL;
 }
 
 [\{\}\[\]\(\)] {
-       if (debug_flags & DEBUGTOKEN)
-           cout << "parens\n";
+
+       mtor << "parens\n";
        return YYText()[0];
 }
 [ \t\n]+       {
@@ -136,7 +148,7 @@ new_input(String s)
 
    if (!lexer) {
        lexer = new yyFlexLexer;
-       lexer->set_debug( bool(debug_flags & DEBUGPARSER));
+       lexer->set_debug( !monitor.silence("Lexer"));
    }           
    
    lexer->switch_streams(newin);
index 48d1e320592b8a698b35882eaa6c4be198fe71d6..46da68d7fbe5d629983d68f9ee0ae0cea4dae136 100644 (file)
@@ -2,17 +2,26 @@
 
 \def\musixtwentydefs{
        \font\musicfnt=musix20
+
 %      \hulplijnbreedte5pt
        %\hlijnhoogte1pt
        %\balkskip4pt
 }
+\def\interstaffline{
+%      \vskip 20pt%
+}
+\def\interscoreline{
+       \par\vskip 10pt\par
+       \hrule height 2pt width2cm
+       \vskip 10pt
+}
 \musixtwentydefs
 \def\mdef#1#2{\def#1{{\musicfnt\char#2}}}
 \mdef\quartball{'007}
 \mdef\halfball{'010}
 \mdef\wholeball{'011}
-\mdef\wholerest{'074}
-\mdef\halfrest{'072}
+\mdef\wholerest{'075}
+\mdef\halfrest{'074}
 \mdef\quartrest{'076}
 \mdef\eighthrest{'077}
 \mdef\sixteenthrest{'078}
 \mdef\singledot{'00}
 \mdef\doubledot{'01}
 \mdef\tripledot{'02}
-\def\maatstreep{\vrule height10pt width 1pt}
+\def\maatstreep{\vrule height10pt }
+\def\finishbar{\vrule height10pt width 1pt}
 \parindent0pt
 
+\def\vcenter#1{\vbox to 0pt{\vss #1\vss}}
+
+\def\cquartrest{\vcenter\quartrest}
 
diff --git a/line.cc b/line.cc
index 88e2f3eb28463badf9ddfbd45e98113345618e6a..d0a5d794bbf90ab7f5878b1cf3bcd9a07d6e8912 100644 (file)
--- a/line.cc
+++ b/line.cc
@@ -39,7 +39,7 @@ Line_of_staff::TeXstring() const
                    s += sc->TeXstring();
        }
     }
-    s+="\\hss}}";
+    s+="\\hss}\\vss}";
     return s;
 }
 
@@ -47,8 +47,11 @@ String
 Line_of_score::TeXstring() const
 {
      String s("\\vbox{");
-     for (PCursor<Line_of_staff*> sc(staffs); sc.ok(); sc++)
+     for (PCursor<Line_of_staff*> sc(staffs); sc.ok(); sc++){
         s += sc->TeXstring();
+        if ((sc+1).ok())
+            s+= "\\interstaffline\n";
+     }
      s += "}";
      return s;
 }
index 91b0e3009cca11a1f9f353cfb00e5daa4691d331..402bd4074ebe16afb1d75f6ee5945366b2fc4804 100644 (file)
@@ -27,6 +27,7 @@ Spacing_problem::col_id(const PCol *w)const
 void
 Spacing_problem::OK() const
 {
+#ifndef NDEBUG
     Union_find connected(cols.sz());
 
     for (int i=0; i < ideals.sz(); i++) {
@@ -39,6 +40,7 @@ Spacing_problem::OK() const
     for (int i = 0; i < cols.sz(); i++) {
        assert( connected.equiv(0,i));
     }
+#endif    
 }
 
 bool
@@ -164,9 +166,10 @@ Spacing_problem::make_constraints(Optimisation_problem& lp) const
 svec<Real>
 Spacing_problem::solve() const
 {
+    print();
     OK();
     assert(check_feasible());
-    print();
+
     
     /* optimalisatiefunctie */        
     Optimisation_problem lp(cols.sz());
@@ -212,16 +215,19 @@ Spacing_problem::add_ideal(const Idealspacing *i)
 void
 Spacing_problem::print_ideal(const Idealspacing*id)const
 {
+#ifndef NPRINT
     int l = col_id(id->left);
     int r = col_id(id->right);
 
     mtor << "idealspacing { between " << l <<","<<r<<'\n';
     mtor << "distance "<<id->space<< " strength " << id->hooke << "}\n";
+#endif
 }
 
 void
 Spacing_problem::print() const
 {
+    #ifndef NPRINT
     for (int i=0; i < cols.sz(); i++) {
        mtor << "col " << i<<' ';
        cols[i].print();
@@ -229,14 +235,20 @@ Spacing_problem::print() const
     for (int i=0; i < ideals.sz(); i++) {
        print_ideal(ideals[i]);
     }
+    #endif
+    
 }
 
 void
 Colinfo::print() const
 {
+#ifndef NPRINT
     mtor << "column { ";
     if (fixed)
        mtor << "fixed at " << fixpos<<", ";
     mtor << "[" << minleft() << ", " << minright() << "]";
     mtor <<"}\n";
+#endif
 }
+
+
diff --git a/maartje.ly b/maartje.ly
new file mode 100644 (file)
index 0000000..a071107
--- /dev/null
@@ -0,0 +1,19 @@
+% erg lang
+
+
+score {
+%      output "maartje.uit"
+       rhythmstaff {
+               voice { $ c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 $ }
+       }
+       rhythmstaff {
+               voice { $ c4 r4 c4 r4 c4 r4 c4 r4 c4 r4 c4 r4 c4 r4 c4 r4
+               r2 r4 r1
+       $ }
+       }
+bar 0.5
+       bar 2  bar 3
+       bar 4.5 bar 5 bar 5.5
+       bar 6 bar 7 bar 8
+}
+
diff --git a/main.cc b/main.cc
index 3758840ac6abd726bbbce72abf233f730a2f62e4..21453315654c0119aa24e9faa1d6e94dd2831fe4 100644 (file)
--- a/main.cc
+++ b/main.cc
@@ -1,26 +1,41 @@
 #include <iostream.h>
+#include <assert.h>
 #include "lgetopt.hh"
 #include "misc.hh"
-#include "debug.hh"
-#include "score.hh"
-#include "globvars.hh"
+#include "string.hh"
+#include "main.hh"
 
 extern void parse_file(String s);
-Score *the_score =0;
 
 long_option_init theopts[] = {
-    1, "debug", 'd',
     1, "output", 'o',
+    0, "warranty", 'w',
     0,0,0
 };
 
 
-String outfn="lelie.uit";
-
-void
-set_output(String s)
+void notice()
 {
-    outfn = s;
+    cout <<
+       "LilyPond, a music typesetter.
+Copyright (C) 1996 by
+  Han-Wen Nienhuys <hanwen@stack.urc.tue.nl>
+
+
+    This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License version 2
+as published by the Free Software Foundation.
+
+    This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+    You should have received a copy (refer to the file COPYING) of the
+GNU General Public License along with this program; if not, write to
+the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
+USA.
+"
 }
 
 int
@@ -28,16 +43,16 @@ main (int argc, char **argv)
 {
     Getopt_long oparser(argc, argv,theopts);
 
-    cout << get_version() 
-       << "copyright 1996 Han-Wen Nienhuys\n";
+    cout << get_version();
     
     while (long_option_init * opt = oparser()) {
        switch ( opt->shortname){
-       case 'd':
-           set_debug(oparser.optarg);
-           break;
        case 'o':
-           set_output(oparser.optarg);
+           set_default_output(oparser.optarg);
+           break;
+       case 'w':
+           notice();
+           exit(0);
            break;
        default:
            assert(false);
@@ -49,6 +64,6 @@ main (int argc, char **argv)
     if (!arg) arg = "";
     parse_file(arg);
 
-    the_score->process();
-    the_score->output(outfn);    
+    do_scores();
+    exit (0);
 }
diff --git a/main.hh b/main.hh
new file mode 100644 (file)
index 0000000..264ac3a
--- /dev/null
+++ b/main.hh
@@ -0,0 +1,8 @@
+#ifndef MAIN_HH
+#define MAIN_HH
+#include "proto.hh"
+void debug_init();
+void do_scores();
+void add_score(Score * s);
+void set_default_output(String s);
+#endif
index 08420639d6503c50472540dc925d523bb937b5fd..80548815dfad4acb8e73bc5b4f359b661f54723d 100755 (executable)
@@ -1,7 +1,19 @@
 #!/bin/sh
 old=$1
 new=$2
-nm=$3
+nm=$3-
+newarc=$nm$new.tar.gz
+oldarc=$nm$old.tar.gz
+if [ ! -f $newarc ]
+then
+       echo cant find $newarc
+       exit
+fi
+if [ ! -f $oldarc ]
+then
+       echo cant find oldarc
+       exit
+fi
 if [ ! -x  $nm$new ]
 then
    echo untarring ..
diff --git a/matrix.cc b/matrix.cc
deleted file mode 100644 (file)
index ab59a87..0000000
--- a/matrix.cc
+++ /dev/null
@@ -1,281 +0,0 @@
-#include "matrix.hh"
-#include "string.hh"
-
-
-Real
-Matrix::norm() const
-{
-    Real r =0.0;
-    for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
-       r += sqr(dat->elem(i,j));
-    return sqrt(r);
-}
-
-//inline
-Real
-Matrix::operator()(int i,int j) const
-{
-    assert(i >= 0 && j >= 0);
-    assert(i < rows() && j < cols());
-    return dat->elem(i,j);
-}
-
-//inline
-Real &
-Matrix::operator()(int i, int j)
-{
-    assert(i >= 0 && j >= 0);
-    assert(i < rows() && j < cols());
-    return dat->elem(i,j);
-}
-
-void
-Matrix::fill(Real r)
-{
-    for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
-       dat->elem(i,j)=r;
-}
-
-void
-Matrix::set_diag(Real r)
-{
-    for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))   
-       dat->elem(i,j)=(i==j) ? r: 0.0;
-}
-
-void
-Matrix::set_diag(Vector d)
-{
-    for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))   
-       dat->elem(i,j)=(i==j) ? d(i): 0.0;
-}
-
-void
-Matrix::operator+=(const Matrix&m)
-{
-    assert(m.cols() == cols());
-    assert(m.rows() == rows());
-    for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
-       dat->elem(i,j) += m(i,j);
-}
-void
-Matrix::operator-=(const Matrix&m)
-{
-    assert(m.cols() == cols());
-    assert(m.rows() == rows());
-    for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
-       dat->elem(i,j) -= m(i,j);
-}
-
-
-void
-Matrix::operator*=(Real a)
-{
-    for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
-       dat->elem(i,j) *= a;
-}
-
-void
-Matrix::operator=(const Matrix&m)
-{
-    if (&m == this)
-       return ;
-    delete dat;
-    dat = m.dat->clone();
-}
-    
-Matrix::Matrix(const Matrix &m)
-{
-    m.OK();
-    
-    dat = m.dat->clone();
-}
-
-
-Matrix::Matrix(int n, int m)
-{
-    dat = virtual_smat::get_full(n,m);
-    fill(0);
-}
-
-Matrix::Matrix(int n)
-{
-    dat = virtual_smat::get_full(n,n);
-    fill(0);
-}
-
-Matrix::Matrix(Vector v, Vector w)
-{   
-    dat = virtual_smat::get_full(v.dim(), w.dim());
-    for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
-       dat->elem(i,j)=v(i)*w(j);
-}
-
-
-Vector
-Matrix::row(int k) const
-{
-    int n=cols();
-
-    
-    Vector v(n);
-    for(int i=0; i < n; i++)
-       v(i)=dat->elem(k,i);
-
-    return v;
-}
-
-Vector
-Matrix::col(int k) const
-{
-    int n=rows();
-    Vector v(n);
-    for(int i=0; i < n; i++)
-       v(i)=dat->elem(i,k);
-    return v;
-}
-
-Vector
-Matrix::left_multiply(const Vector& v) const
-{
-     Vector dest(v.dim());
-    assert(dat->cols()==v.dim());
-    for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
-       dest(i)+= dat->elem(j,i)*v(j);
-    return dest;
-}
-
-Vector
-Matrix::operator *(const Vector& v) const
-{
-    Vector dest(rows());
-    assert(dat->cols()==v.dim());
-    for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
-       dest(i)+= dat->elem(i,j)*v(j);
-    return dest;
-}
-
-Matrix
-operator /(Matrix const& m1,Real a)
-{
-    Matrix m(m1);
-    m /= a;
-    return  m;
-}
-
-void
-Matrix::transpose()            // delegate to storage?
-{
-    for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j)) {
-       if (i >= j)
-           continue;
-       Real r=dat->elem(i,j);
-       dat->elem(i,j) = dat->elem(j,i);
-       dat->elem(j,i)=r;
-    }
-}
-
-Matrix
-Matrix::operator-() const
-{
-    OK();
-    Matrix m(*this);
-    m*=-1.0;    
-    return m;
-}
-
-Matrix
-Matrix::transposed() const
-{
-    Matrix m(*this);
-    m.transpose();
-    return m;
-}
-
-
-/* should do something smarter: bandmatrix * bandmatrix is also banded matrix.  */
-Matrix
-operator *(const Matrix &m1, const Matrix &m2)
-{
-    Matrix result(m1.rows(), m2.cols());
-    result.set_product(m1,m2);
-    return result;
-}
-
-void
-Matrix::set_product(const Matrix &m1, const Matrix &m2)
-{
-    assert(m1.cols()==m2.rows());
-    assert(cols()==m2.cols() && rows()==m1.rows());
-    
-    for (int i=0, j=0; dat->mult_ok(i,j);
-        dat->mult_next(i,j)) {
-       Real r=0.0;
-       for (int k = 0; k < m1.cols(); k++)
-           r += m1(i,k)*m2(k,j);
-       dat->elem(i,j)=r;
-    }
-}
-
-void
-Matrix::insert_row(Vector v, int k)
-{
-    assert(v.dim()==cols());
-    dat->insert_row(k);
-    for (int j=0; j < cols(); j++)
-       dat->elem(k,j)=v(j);
-}
-
-
-void
-Matrix::swap_columns(int c1, int c2)
-{
-    assert(c1>=0&& c1 < cols()&&c2 < cols() && c2 >=0);
-    for (int i=0; i< rows(); i++) {
-       Real r=dat->elem(i,c1);
-       dat->elem(i,c1) = dat->elem(i,c2);
-       dat->elem(i,c2)=r;
-    }
-}
-
-void
-Matrix::swap_rows(int c1, int c2)
-{
-    assert(c1>=0&& c1 < rows()&&c2 < rows() && c2 >=0);
-    for (int i=0; i< cols(); i++) {
-       Real r=dat->elem(c1,i);
-       dat->elem(c1,i) = dat->elem(c2,i);
-       dat->elem(c2,i)=r;
-    }
-}
-
-
-int
-Matrix::dim() const
-{
-    assert(cols() == rows());
-    return rows();
-}
-
-Matrix::operator String() const
-{
-    String s("matrix {\n");
-    for (int i=0; i< rows(); i++){
-       for (int j = 0; j < cols(); j++) {
-           s+= String(dat->elem(i,j), "%6f ");
-       }
-       s+="\n";
-    }
-    s+="}\n";
-    return s;
-}
-
-
-
-#include "debug.hh"
-void
-Matrix::print() const
-{
-    mtor << *this;
-}
diff --git a/matrix.hh b/matrix.hh
deleted file mode 100644 (file)
index e092a5f..0000000
--- a/matrix.hh
+++ /dev/null
@@ -1,141 +0,0 @@
-#ifndef MATRIX_HH
-#define MATRIX_HH
-
-
-#include "vsmat.hh"
-#include "vector.hh"
-
-/// a Real matrix
-class Matrix {
-    virtual_smat *dat;
-    
-public:
-    void OK() const { dat->OK(); }
-    int cols() const { return dat->cols(); }
-    int rows() const { return dat->rows(); }
-
-    /// return the size of a matrix
-    int dim() const;
-    /**
-      PRE
-      the matrix needs to be square.
-    */
-     
-    // Matrix() { dat = 0; } 
-    ~Matrix() { delete dat; }
-
-    /// set entries to r 
-    void fill(Real r);
-
-    /// set diagonal to d
-    void set_diag(Real d);
-
-    void set_diag(Vector d);
-    /// set unit matrix
-    void unit() { set_diag(1.0); }
-
-    void operator+=(const Matrix&m);
-        void operator-=(const Matrix&m);    
-    void operator*=(Real a);
-    void operator/=(Real a) { (*this) *= 1/a; }
-    
-    /// add a row
-    void insert_row(Vector v,int k);
-    /**
-      add a row to the matrix before  row k
-
-      PRE
-      v.dim() == cols()
-      0 <= k <= rows()
-    */
-    ///
-    void delete_row(int k) { dat->delete_row(k); }
-    /**
-      delete a row from this matrix.
-
-      PRE
-      0 <= k < rows();
-    */
-    void delete_column(int k) { dat->delete_column(k); }
-    ///
-    Matrix(int n);
-    /**
-      square n matrix, initialised to null
-    */
-    ///
-    Matrix(int n, int m);
-    /**
-      n x m matrix, init to 0
-    */
-    Matrix(const Matrix &m);
-
-    /// dyadic product: v * w.transpose
-    Matrix(Vector v, Vector w);
-    void operator=(const Matrix&m);
-
-    /// access an element
-    Real operator()(int i,int j) const;
-
-    /// access an element
-    Real &operator()(int i, int j);
-
-    /// Matrix multiply with vec (from right)
-    Vector operator *(const Vector &v) const;
-
-    /// set this to m1*m2.
-    void set_product(const Matrix &m1, const Matrix &m2);
-
-
-    Vector left_multiply(Vector const &) const;
-    
-    Matrix operator-() const;
-    
-    /// transpose this.
-    void transpose();
-    
-    /// return a transposed copy.
-    Matrix transposed() const ;
-
-    Real norm() const;
-    /// swap
-    void swap_columns(int c1, int c2);
-    /**
-      PRE
-      0 <= c1,c2 < cols()
-    */
-
-    /// swap
-    void swap_rows(int c1, int c2);
-    /**
-      PRE
-      0 <= c1,c2 < rows()
-    */
-
-
-    Vector row(int ) const;
-    Vector col(int) const;
-
-    operator String() const;
-    void print() const;
-};
-
-/** This is a class for a nonsquare block of #Real#s.  The
-    implementation of sparse matrices is done in the appropriate #smat#
-    class. Matrix only does the mathematical actions (adding,
-    multiplying, etc.)
-
-    
-    TODO
-    implement ref counting?  */
-
-
-inline Vector
-operator *(Vector &v, const Matrix& m) { return m.left_multiply(v); }
-Matrix operator *(const Matrix& m1,const Matrix &m2);
-Matrix operator /(const Matrix &m1,Real a);
-inline Matrix operator -(Matrix m1,const Matrix m2)
-{
-    m1 -= m2;
-    return m1;
-}
-#endif
diff --git a/misc.hh b/misc.hh
index a0ce0161ad30f7f647abdd495eba514ba5b14dd5..fb8889f55193300f66ce85d32273ebad2bdd3591 100644 (file)
--- a/misc.hh
+++ b/misc.hh
@@ -4,5 +4,5 @@
 int intlog2(int d);    
 Real duration_to_idealspace(Mtime d);
 class String;
-char *get_version();
+const char *get_version();
 #endif
index 3e107ae7fb301e6c4afa7191d10ceafa4f42cf6e..e1c4ac5f8d4065079c8aef9ee308c533db438cf8 100644 (file)
@@ -11,13 +11,19 @@ Atom::extent() const
     return b;
 }
 
+Atom::Atom(const Symbol * s)
+{
+    sym=s;
+}
+
 String
 Atom::TeXstring() const
 {
     // whugh.. Hard coded...
     String s("\\raise");
     s+= String(off.y * VERT_TO_PT)+"pt\\hbox to 0pt{\\kern ";
-    s+=String(off.x * HOR_TO_PT) + "pt" + sym->tex + "\\hss}";
+    s+= String(off.x * HOR_TO_PT) + "pt";
+    s+= sym->tex + "\\hss}";
     return s;
 }
 
index 6f63be3ba9cef03c0d9cb94436b460ae65ca4bcc..6709b7375074b89124e5e39e2de2a2ac71e3d438 100644 (file)
@@ -16,9 +16,7 @@ struct Atom {
     
     /// how big is #this#?
     Box extent() const;
-    Atom(const Symbol*s) {
-       sym=s;
-    }
+    Atom(const Symbol*s);
     String TeXstring() const;
 };
 
diff --git a/note.cc b/note.cc
index 538f26a28e62bdee35cda6c7f1950d1325b564b4..c51e3c33af8fa767164c51a388d1c31372d9e684 100644 (file)
--- a/note.cc
+++ b/note.cc
@@ -27,8 +27,8 @@ parse_duration(const char *a, int &j, int &intdur, int &dots)
     intdur = (durstr.len()) ?
        durstr.value():default_duration;
 
-    if (debug_flags & DEBUGTOKEN) 
-       mtor << "dur " << intdur << "dots " << dots<<eol;
+
+    mtor << "dur " << intdur << "dots " << dots<<eol;
 }
 
 
@@ -37,7 +37,7 @@ parse_pitch( const char *a, int &j, int &oct, bool & overide_acc,
             int & large, int & small)
 {
     // octave
- oct =0;
   oct =0;
     
     while (1) 
        {       
@@ -50,7 +50,8 @@ parse_pitch( const char *a, int &j, int &oct, bool & overide_acc,
        j++;
        
        }
-    if (debug_flags & DEBUGTOKEN) mtor << "oct " << oct;
+
+       mtor << "oct " << oct;
        
     // accidental
     overide_acc = false;
@@ -61,8 +62,8 @@ parse_pitch( const char *a, int &j, int &oct, bool & overide_acc,
        j++;
        }
 
-    if (debug_flags & DEBUGTOKEN)
-       mtor << "ov " << overide_acc;
+    
+    mtor << "ov " << overide_acc;
     
     // notename.
     String nm;
@@ -77,9 +78,8 @@ parse_pitch( const char *a, int &j, int &oct, bool & overide_acc,
        }
         
 
-    lookup_notename(large,small,nm);
-    if (debug_flags & DEBUGTOKEN)
-       mtor << "int "<< large <<" "<<small<<" ";    
+    lookup_notename(large,small,nm);    
+    mtor << "int "<< large <<" "<<small<<" ";    
 }
 
 
index 23987a273daef7dbde42b74ae066b0b4d4681540..cb0853b3409b32d0a06b7c20751f902afa0c9383 100644 (file)
--- a/parser.y
+++ b/parser.y
@@ -1,11 +1,11 @@
 %{ // -*-Fundamental-*-
 #include <iostream.h>
-//#include "mudobs.hh"
+
 #include "lexer.hh"
 #include "staff.hh"
 #include "score.hh"
+#include "main.hh"
 #include "keyword.hh"
-#include "globvars.hh"
 #include "debug.hh"
 #include "parseconstruct.hh"
 #define YYDEBUG 1
     Score *score;    
 }
 
-%token VOICE STAFF SCORE TITLE RHYTHMSTAFF BAR NOTENAME
+%token VOICE STAFF SCORE TITLE RHYTHMSTAFF BAR NOTENAME OUTPUT
+
 
 %token <id> IDENTIFIER
 %token <string> PITCH DURATION RESTNAME
 %token <real> REAL
-
+%token <string> STRING
 
 %type <voice> voice_block voice_body voice_elts voice_elts_dollar
 %type <el> voice_elt
 
 %%
 
-mudela:
-       score_block { 
-               delete the_score; 
-               the_score = $1;
+mudela:        /* empty */
+       | score_block { 
+               add_score($1);
        }
        ;
 
@@ -56,6 +56,9 @@ score_block: SCORE '{' score_body '}'         { $$ = $3; }
 score_body:            { $$ = new Score; } 
        | score_body staff_block        { $$->add($2); }
        | score_body score_command      { $$->add($2); }
+       | score_body OUTPUT STRING      { $$->outfile = *$3;
+               delete $3;
+       }
        ;
 
 staff_block:
@@ -115,7 +118,7 @@ void
 parse_file(String s)
 {
    *mlog << "Parsing ... ";
-   yydebug = debug_flags & DEBUGPARSER;
+   yydebug = !monitor.silence("Parser");
    new_input(s);
    yyparse();
 }
index dd8ae697bc84d94859dddfedf271a0ade405c91c..16156d1321eb9f8c30f4bd2a67907bd4c332bbae 100644 (file)
--- a/pscore.cc
+++ b/pscore.cc
@@ -7,13 +7,14 @@
 void
 PScore::clean_cols()
 {
-    for (PCursor<PCol *> c(cols); c.ok(); c++)
+    for (PCursor<PCol *> c(cols); c.ok(); )
        if (!c->used) {
-           c.remove();
-           //mtor << "removing pcol\n";
-       }
+           c.del();
+           mtor << "removing pcol\n";
+       } else
+           c++;
 }
-       
+
 
 void
 PScore::add(PStaff *s)
@@ -95,5 +96,7 @@ PScore::output(Tex_stream &ts)
     for (PCursor<Line_of_score*> lic(lines); lic.ok(); lic++) {
        ts << "% line of score no. " << l++ <<"\n";
        ts << lic->TeXstring();
+       if ((lic+1).ok())
+           ts << "\\interscoreline\n";
     }  
 }
diff --git a/qlp.cc b/qlp.cc
index 9ad72de4a030f986e8549f4a11a68f41d4819dab..c76946e8668b07a318a5f162c218b44d5e2d62ff 100644 (file)
--- a/qlp.cc
+++ b/qlp.cc
@@ -1,18 +1,22 @@
 #include "debug.hh"
+#include "const.hh"
 #include "qlp.hh"
 #include "choleski.hh"
+
 void
 Mixed_qp::add_equality_cons(Vector v, double r)
 {
     assert(false);
 }
+
 void
 Mixed_qp::add_fixed_var(int i, Real r)
 {
     eq_cons.add(i);
     eq_consrhs.add(r);
 }
-   void
+
+void
 Ineq_constrained_qp::add_inequality_cons(Vector c, double r)
 {
     cons.add(c);
@@ -26,11 +30,13 @@ Ineq_constrained_qp::Ineq_constrained_qp(int novars):
 }
 
 void
-Ineq_constrained_qp::OK()const
+Ineq_constrained_qp::OK() const
 {
+#ifndef NDEBUG    
     assert(cons.sz() == consrhs.sz());
     Matrix Qdif= quad - quad.transposed();
-    assert(Qdif.norm() < EPS);
+    assert(Qdif.norm()/quad.norm() < EPS);
+#endif    
 }
      
 
@@ -95,29 +101,34 @@ Mixed_qp::Mixed_qp(int n)
 }
 
 void
-Mixed_qp::OK()const
+Mixed_qp::OK() const
 {
+#ifndef NDEBUG
     Ineq_constrained_qp::OK();
     assert(eq_consrhs.sz() == eq_cons.sz());
+#endif    
 }
 void
 Ineq_constrained_qp::print() const
 {
-
+#ifndef NPRINT
     mtor << "Quad " << quad;
     mtor << "lin " << lin <<"\n";
     for (int i=0; i < cons.sz(); i++) {
        mtor << "constraint["<<i<<"]: " << cons[i] << " >= " << consrhs[i];
        mtor << "\n";
     }
+#endif
 }
 void
 Mixed_qp::print() const
 {
+#ifndef NPRINT
     Ineq_constrained_qp::print();
     for (int i=0; i < eq_cons.sz(); i++) {
        mtor << "eq cons "<<i<<": x["<<eq_cons[i]<<"] == " << eq_consrhs[i]<<"\n";
     }
+#endif
 }
 
 
index c3e9176dbd912b3d6c616d66090e4403109c30e6..13bd30e89b0c7021c0555bde61c7258bbc8d5166 100644 (file)
@@ -1,4 +1,5 @@
 #include "qlpsolve.hh"
+#include "const.hh"
 #include "debug.hh"
 #include "choleski.hh"
 
diff --git a/real.hh b/real.hh
deleted file mode 100644 (file)
index 1f2187c..0000000
--- a/real.hh
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef REAL_HH
-#define REAL_HH
-typedef double Real;
-inline Real sqr(Real x){
-    return x*x;
-}
-inline Real MIN(Real x, Real y) {
-    return (x < y)? x : y;
-}
-
-inline Real MAX(Real x, Real y) {
-    return (x > y) ? x : y;
-}
-
-inline Real ABS(Real x)
-{
-    return (x>0)? x:-x;
-}
-inline
-int sgn(Real x) {
-    if (!x)return 0;
-    return (x > 0) ?1: -1;
-}
-
-#endif
index b2b520c4433da53043a42a0853bbc299d2ca1e91..f5e357ecdbab7bfa3b13794d3154a6691d96870d 100644 (file)
--- a/score.cc
+++ b/score.cc
@@ -1,4 +1,4 @@
-#include <time.h>
+
 #include "tstream.hh"
 #include "score.hh"
 #include "pscore.hh"
@@ -6,33 +6,57 @@
 #include "misc.hh"
 #include "debug.hh"
 
+void
+Score::add_command_seq(svec<Command *> com)
+{
+    if (!com.sz())
+       return;
+    Real when = com[0]->when;
+
+    PCursor<Command*> pc(commands_);    
+    while (pc.ok()&&pc->when <= when)
+       pc++;
+    
+    for (int i = 0; i < com.sz(); i++) {
+       assert(com[i]->when == when);
+       if (!pc.ok())
+           pc.add(com[i]);
+       else
+           pc.insert(com[i]);
+    }
+    
+}
+
 void
 Score::add(Command *c)
 {
+    svec<Command*> seq;    
     if (c->code == TYPESET && c->args[0] == "BAR") {
        /* should be encapsulated in BREAKs
 
           THIS SUX.
 
         */
+
        Command k;
        
        k.when = c->when;
        k.code = BREAK_PRE;
-       commands_.bottom().add(new Command(k));
-       commands_.bottom().add(new Command(*c));
+       
+       seq.add(new Command(k));
+       seq.add(new Command(*c));
        k.code = BREAK_MIDDLE;
-       commands_.bottom().add(new Command(k));
-       commands_.bottom().add(new Command(*c));
+       seq.add(new Command(k));
+       seq.add(new Command(*c));
        k.code = BREAK_POST;
-       commands_.bottom().add(new Command(k));
+       seq.add(new Command(k));
        k.code = BREAK_END;
-       commands_.bottom().add(new Command(k));
+       seq.add(new Command(k));
     }
     else
-       commands_.bottom().add(new Command(*c));
-    
+       seq.add(new Command(*c));
     
+    add_command_seq(seq);
 }
 
 void
@@ -53,43 +77,41 @@ Score::do_pcols()
 }
 /*
     this sux. Really makeshift.
+
+    first and last column should be breakable.
+    Remove any command past the last musical column.
     */
 void
 Score::do_miscs()
 {
     Command c;
 
-    c.when = 0.0;
+    {
+       Command c;
+       c.when = 0.0;
+       c.code = TYPESET;
+       c.args.add("BAR");
+       c.args.add("empty");
+       add(&c);
+    }
     
-    c.code = BREAK_END;
-    commands_.top().insert(new Command(c));    
-    c.code = BREAK_POST;
-    commands_.top().insert(new Command(c));
-    c.code = BREAK_MIDDLE;
-    commands_.top().insert(new Command(c));
-    c.code = BREAK_PRE;
-    commands_.top().insert(new Command(c));
-
     PCursor<Command*> bot(commands_.bottom());
-    c.when = last();    
-    while (bot.ok() && bot->when > c.when) {
-//       mtor <<"removing "<< bot->code <<" at " << bot->when<<'\n';
-       bot.remove();
-       bot = commands_.bottom();
+    Real l = last();    
+    while (bot.ok() && bot->when > l) {
+
+       mtor <<"removing "<< bot->code <<" at " << bot->when<<'\n';
+       bot.del();
+       bot = commands_.bottom();
+    }
+
+    if (bot->when != l || bot->code != BREAK_END) {
+       Command c;
+       c.code = TYPESET;
+       c.when = l;
+       c.args.add("BAR");
+       c.args.add("||");
+       add(&c);
     }
-   
-    c.code = BREAK_PRE;
-    bot.add(new Command(c));
-    bot++;
-    c.code = BREAK_MIDDLE;
-    bot.add(new Command(c));
-   bot++;
-    c.code = BREAK_POST;
-    bot.add(new Command(c));
-   bot++;
-   c.code = BREAK_END;
-    bot.add(new Command(c));
-    
    commands_.OK();
 }
 
@@ -106,11 +128,12 @@ void
 Score::clean_commands() 
 {
     Mtime l= last();
-    for (PCursor<Command*> cc(commands_); cc.ok(); cc++) {
+    for (PCursor<Command*> cc(commands_); cc.ok(); ) {
        if (cc->when > l){
-          mtor << "remming \n";
-           cc.remove();
-       }
+           mtor << "remming \n";
+           cc.del();
+       } else
+           cc++;
     }
 }
 void
@@ -143,14 +166,17 @@ Score::process()
     */
 void
 Score::clean_cols()
-{
+{    
     for (PCursor<Staff * > sc(staffs_); sc.ok(); sc++)
        sc->clean_cols();
-    for (PCursor<Score_column*> c(cols_); c.ok(); c++) {
+    
+    for (PCursor<Score_column*> c(cols_); c.ok(); ) {
        if (!c->pcol->used) {
-//         mtor << "removing : "; c->print();
-           c.remove();
-       }
+           mtor << "removing : ";
+           c->print();
+           c.del();
+       } else
+           c++;
     }
     
     pscore_->clean_cols();
@@ -218,19 +244,18 @@ void
 Score::output(String s)
 {
     OK();
-    mtor << "output to " << s << "...\n";
-
-    Tex_stream the_output(s);
-    the_output << "% Automatically generated by LilyPond 0.0 at";
-    time_t t(time(0));
-    the_output << ctime(&t)<<"\n";
-    the_output << "% from input file ..\n";
+    if (outfile=="")
+       outfile = s;
+    
+    *mlog << "output to " << outfile << "...\n";
+    Tex_stream the_output(outfile);    
     pscore_->output(the_output);
 }
 
 void
 Score::OK() const
 {
+#ifndef NDEBUG
     for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
        sc->OK();
        assert(sc->score_ == this);
@@ -243,12 +268,13 @@ Score::OK() const
     for (PCursor<Command*> cc(commands_); cc.ok() && (cc+1).ok(); cc++) {
        assert(cc->when <= (cc+1)->when);
     }
-    
+#endif    
 }
 
 void
 Score::print() const
 {
+#ifndef NPRINT
     mtor << "score {\n"; 
     for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
        sc->print();
@@ -257,8 +283,12 @@ Score::print() const
        sc->print();
     }
     mtor << "}\n";
+#endif
+}
+Score::Score()
+{
+    pscore_=0;
 }
-
 /****************************************************************/
 
 Score_column::Score_column(Mtime w)
@@ -276,10 +306,14 @@ Score_column::used() {
 void
 Score_column::print() const
 {
+    #ifndef NPRINT
     mtor << "Score_column { mus "<< musical <<" at " <<  when<<'\n';
     mtor << " # symbols: " << pcol->its.size() << "\n";
     mtor << "durations: [" ;
     for (int i=0; i < durations.sz(); i++)
        mtor << durations[i] << " ";
     mtor << "]\n}\n";
+    #endif
 }
+
+    
index 3e65d50d998d7e7146cd20543486d4cc82623c21..5ec7f33b5a413ba5c1ac68dbb57e7022d0f86542 100644 (file)
--- a/score.hh
+++ b/score.hh
@@ -41,6 +41,7 @@ instantiate_compare(Score_column&, Score_column::compare);
 
 /// the total music def of one movement
 struct Score {
+    String outfile;
     /// staffs_ and commands_ form the problem definition.
     PointerList<Staff *> staffs_;
     PointerList<Command*> commands_;
@@ -50,6 +51,8 @@ struct Score {
     PScore *pscore_;
 
     /****************************************************************/
+
+    Score();
     
     /// add #Idealspacings# to #pscore_#
     void calc_idealspacing();
@@ -66,6 +69,7 @@ struct Score {
     void do_pcols();
     void add(Command *);
     void add(Staff*);
+    void add_command_seq(svec<Command*> );
     void output(String fn);
     PCursor<Score_column*> create_cols(Mtime);
     void print() const;
diff --git a/scores.cc b/scores.cc
new file mode 100644 (file)
index 0000000..cb06b00
--- /dev/null
+++ b/scores.cc
@@ -0,0 +1,29 @@
+#include "main.hh"
+#include "score.hh"
+
+static svec<Score*> sv;
+
+static String outfn="lelie.uit";
+
+void
+do_scores()
+{
+    for (int i=0; i < sv.sz(); i++) {  
+       sv[i]->process();
+       sv[i]->output(outfn);
+    }
+}
+
+void
+add_score(Score * s)
+{
+    sv.add(s);
+}
+
+
+void
+set_default_output(String s)
+{
+    outfn = s;
+}
+
diff --git a/smat.cc b/smat.cc
deleted file mode 100644 (file)
index 3830fd6..0000000
--- a/smat.cc
+++ /dev/null
@@ -1,187 +0,0 @@
-#include "smat.hh"
-
-void
-Full_storage::operator=(Full_storage const &fs)
-{
-    resize(fs.h, fs.w);
-    OK();
-    fs.OK();
-    for (int i=0; i<h; i++)
-       for (int j=0; j<w; j++)
-           els[i][j]= fs.els[i][j];
-}
-
-void
-Full_storage::OK() const
-{
-    //    static Real dummy;           
-    assert(maxh >= h && maxw >= w);
-    assert(h >= 0 && w >= 0);
-    assert(els||!maxh);
-    if (maxh>0) {              // access outer elts.
-       Real *r = els[maxh -1];
-       if (maxw>0) {
-           assert(r);
-           Real s = r[maxw -1];
-           s = sin(s);
-       }
-    }
-}
-void
-Full_storage::resize_cols(int newh)
-{
-    if (newh <= maxh) {
-       h=newh;
-       return;
-    }
-   
-    Real ** newa=new Real*[newh];
-    int j=0;
-    for (; j < h; j++)
-       newa[j] = els[j];
-    for (; j < newh; j++)
-       newa[j] = new Real[maxw];
-    delete[] els;
-    els=newa;
-
-    h = maxh = newh;
-}
-
-void
-Full_storage::resize_rows(int neww)
-{
-    if (neww <= maxw) {
-       w=neww;
-       return;
-    }
-    for (int i=0; i < maxh ; i++) {
-       Real* newa=new Real[neww];
-       for (int k=0; k < w; k++)
-           newa[k] = els[i][k];
-
-       delete[] els[i];
-       els[i] = newa;
-    }
-    w = maxw = neww;   
-}
-
-Full_storage::~Full_storage() {
-    for (int i=0; i < maxh; i++)
-       delete [] els[i];
-    delete[] els;
-}
-
-void
-Full_storage::resize(int rows, int cols)
-{
-    OK();
-    resize_cols(rows);
-    resize_rows(cols);
-
-}
-
-
-bool
-Full_storage::mult_ok(int i, int j) const
-{
-    return valid(i,j);
-}
-
-bool
-Full_storage::trans_ok(int i, int j) const
-{
-       return valid(i,j);
-} 
-
-
-void
-Full_storage::trans_next(int &i, int &j) const
-{
-    assert(trans_ok(i,j));
-    i++;
-    if (i >= h) {
-       i=0;
-       j ++;
-    }
-}
-
-void
-Full_storage::mult_next(int &i, int &j) const
-{
-    assert(mult_ok(i,j));
-    j++;
-    if (j >= w) {
-       j=0;
-       i++;
-    }
-}
-
-void
-Full_storage::delete_column(int k)
-{
-    assert(0 <= k &&k<w);    
-    for (int i=0; i< h ; i++)
-       for (int j=k+1; j <w; j++)
-           els[i][j-1]=els[i][j];
-    w--;
-}
-void
-Full_storage::delete_row(int k)
-{
-    assert(0 <= k &&k<h);
-    for (int i=k+1; i < h ; i++)
-       for (int j=0; j < w; j++)
-           els[i-1][j]=els[i][j];
-    h--;
-}
-
-
-void
-Full_storage::insert_row(int k)
-{
-    assert(0 <= k&& k <=h);
-    resize_cols(h+1);
-    for (int i=h-1; i > k ; i--)
-       for (int j=0; j <w; j++)
-           els[i][j]=els[i-1][j];
-
-}
-
-
-svec<Real>
-Full_storage::row(int n) const
-{
-    svec<Real> r;
-    for (int j = 0; j < w; j++)
-       r.add(els[n][j]);
-    return r;
-}
-
-svec<Real>
-Full_storage::column(int n) const
-{
-    
-    svec<Real> r;
-    for (int i = 0; i<h; i++)
-       r.add(els[i][n]);
-    return r;
-}
-
-
-Full_storage::Full_storage(Full_storage&s)
-{
-    init();
-    (*this) = s;
-}
-virtual_smat*
-Full_storage::clone()
-{
-    return new Full_storage(*this);
-}
-/****************************************************************/
-
-virtual_smat *
-virtual_smat::get_full(int n, int m)
-{
-    return new Full_storage(n,m);
-}
diff --git a/smat.hh b/smat.hh
deleted file mode 100644 (file)
index c05d032..0000000
--- a/smat.hh
+++ /dev/null
@@ -1,93 +0,0 @@
-#ifndef SMAT_HH
-#define SMAT_HH
-#include "vray.hh"
-#include "vsmat.hh"
-#include "real.hh"
-/// simplest matrix storage. refer to its baseclass for the doco.
-class Full_storage : public virtual_smat
-{
-    /// height, width
-    int h,w;
-    /// maxima.
-    int maxh, maxw;
-    
-    /// the storage
-    Real** els;
-    void
-    init() {
-       els=0;
-       h=w=maxh=maxw=0;
-
-    }
-    
-    bool valid(int i, int j) const {
-       return (i>=0 && i < h)
-           && (j < w && j >=0);
-    }
-    
-
-    void resize_rows(int);
-    void resize_cols(int);
-
-public:
-    virtual int rows() const {
-       return h;
-    }
-    virtual int cols() const {
-       return w;
-    }
-    
-    
-    virtual void set_size(int i, int j)
-    {
-       resize(i,j); //this could be more efficient.
-    }
-    
-    virtual void set_size(int i) {
-       set_size(i,i);
-    }
-    virtual void resize(int i, int j);
-    virtual void resize(int i) {
-       resize(i,i);
-    }
-    
-    virtual Real& elem(int i,int j) {
-       assert(valid(i,j));
-       return els[i][j];
-    }
-    virtual const Real& elem(int i, int j) const {
-       assert(valid(i,j));
-       return els[i][j];
-    }
-    virtual svec<Real> row(int i) const;
-    virtual svec<Real> column(int j) const;
-
-    Full_storage() {
-       init();
-    }
-    Full_storage(int i, int j) {
-       init();
-       set_size(i,j);
-    }
-    Full_storage(Full_storage&);
-    Full_storage(int i) {
-       init();
-       set_size(i);
-    }
-    void OK() const;
-    void operator=(Full_storage const &);
-    
-    virtual void insert_row(int k);
-    virtual void delete_row(int k);
-    virtual void delete_column(int k);
-
-    
-    ~Full_storage();
-    virtual bool mult_ok(int i, int j)const;
-    virtual void mult_next(int &i, int &j) const ;
-    virtual bool trans_ok(int i, int j) const;
-    virtual void trans_next(int &i, int &j) const;
-    virtual virtual_smat * clone();
-};
-
-#endif
index 61699dccb20d6506a6c337d79ddcc37c1cf1ca1c..12bf074d04bb837e762212dcc3b93cdd549ec572 100644 (file)
--- a/staff.cc
+++ b/staff.cc
@@ -6,9 +6,11 @@ void
 Staff::clean_cols()
 {
     PCursor<Staff_column *> stc(cols);
-    for(; stc.ok(); stc++){
+    for(; stc.ok(); ){
        if (!stc->score_column->used())
-           stc.remove();
+           stc.del();
+       else
+           stc++;
     }
 }
 
@@ -122,11 +124,12 @@ Staff::process()
 void
 Staff::OK() const
 {
+#ifndef NDEBUG
     cols.OK();
     commands.OK();
     voices.OK();
-    assert(score_);
-    
+    assert(score_);    
+#endif    
 }
 
 
@@ -164,6 +167,7 @@ Staff_column::when() const
 {
     return score_column->when;
 }
+
 void
 Staff_column::add(Voice_element*ve)
 {
@@ -174,6 +178,7 @@ Staff_column::add(Voice_element*ve)
        
     v_elts.add(ve);
 }
+
 Staff_column::Staff_column(Score_column*s) {
     score_column = s;
 }
index 5375e227f4078adc1f2cf2801f041fef5f366ab4..d00e751dc51a3e0b477566ad912be79a972a1e09 100644 (file)
@@ -1,4 +1,4 @@
-# TeXstring,   xmin xmax ymin ymax
+# index TeXstring,     xmin xmax ymin ymax
 
 table balls
        1       \wholeball      -5      5       -1      1
@@ -7,14 +7,21 @@ table balls
 end
 
 table bars
+       empty   \emptybar       0       0       0       0
        |       \maatstreep     0       1       0       10
+       ||      \finishbar      0       2       0       10
 end
 
 table rests
-       1       \wholerest              -1      1       -1      1
-       2       \halfrest               -1      1       -1      1
-       4       \quartrest              -1      1       -1      1
-       8       \eighthrest             -1      1       -1      1
-       16      \sixteenthrest          -1      1       -1      1
+       1       \wholerest              -5      1       -1      1
+       2       \halfrest               -5      1       -1      1
+       4       \cquartrest             -5      2       -5      5
+       8       \eighthrest             -5      1       -1      1
+       16      \sixteenthrest          -5      1       -1      1
        32      \thirtysecondrest       -1      1       -1      1
-end
\ No newline at end of file
+end
+
+
+
+
+
index 8b87e2fc99a893130426f1075878963f2efbdce5..5d295d0be5aafacf5eb41d5f015b2385198e8d39 100644 (file)
@@ -6,6 +6,20 @@
 #include "symtable.hh"
 #include "const.hh"
 
+static Symbol unknown;
+
+
+// scary! What if Symtable resizes on the fly...?
+const Symbol *
+Symtable::lookup(String s) const
+{
+    if (elt_query(s))
+       return &(*this)[s];
+    else {
+       WARN<<"Unknown symbol " << s <<'\n';
+       return &unknown;
+    }
+}
 
 Symtable* 
 Symtables::operator()(String s) 
@@ -53,25 +67,22 @@ Symtables the_sym_tables("symbol.ini");
 
 
 const Symbol*
-Symbol::find_ball(int i)
+Symbol::find_ball(int j)
 {
-    int j = intlog2(i)+1;
     if (j > 4) j = 4;
     Symtable * st = the_sym_tables("balls");
-    return &(*st)[String(j)];
-
+    return st->lookup(String(j));
 }
 
 const Symbol*
-Symbol::find_rest(int i)
+Symbol::find_rest(int j)
 {
-    int j = intlog2(i)+1;
-    return &(*the_sym_tables("rests"))[String(j)];
+    return the_sym_tables("rests")->lookup(String(j));
 }
 const Symbol*
 Symbol::find_bar(String s)
 {
-    return &(*the_sym_tables("bars"))[s];  
+    return the_sym_tables("bars")->lookup(s);
 }
 /****************************************************************/
 // bare bones.
index 9d5213a7c36ff9f381faa86bf46b5321a838e37e..f390e285e01b26da27d608e1c896f944631ab99a 100644 (file)
@@ -1,5 +1,5 @@
 struct  Symtable : public Assoc<String, Symbol> {
-
+    const Symbol * lookup(String)const;
 };
 
 
index 45e6f4a0e476887a5e11312ef44cdb83c2be2f8a..b06e2ee92f933057cc8787157c00abf701d5ebe8 100644 (file)
--- a/table.cc
+++ b/table.cc
@@ -1,4 +1,5 @@
 #include "glob.hh"
+#include "debug.hh"
 #include "string.hh"
 #include "keyword.hh"
 #include "parser.hh"
@@ -8,6 +9,7 @@ static Keyword_ent  the_key_tab[]={
     "rhythmstaff", RHYTHMSTAFF,
     "score", SCORE,
     "bar", BAR,
+    "output", OUTPUT,
     0,0
 } ;
 
@@ -19,9 +21,13 @@ lookup_keyword(String s)
     return table.lookup(s);
 }
 
+Assoc<String, Identifier*> the_id_tab;
+
 Identifier*
 lookup_identifier(String s)
 {
-    assert(false);
-    return 0;
+    if (!the_id_tab.elt_query(s))
+        the_id_tab[s]= new Identifier;
+    
+    return the_id_tab[s];
 }
diff --git a/template.cc b/template.cc
deleted file mode 100644 (file)
index f0260b5..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "line.hh"
-
-#include "list.hh"
-#include "cols.hh"
-#include "item.hh"
-#include "request.hh"
-#include "score.hh"
-#include "command.hh"
-#include "staff.hh"
-
-#include "list.cc"
-#include "cursor.cc"
-
-
-PL_instantiate(Line_of_score);
-PL_instantiate(Line_of_staff);
-PL_instantiate(Item);
-PL_instantiate(Spanner);
-PL_instantiate(PStaff);
-PL_instantiate(Idealspacing);
-PL_instantiate(PCol);
-PL_instantiate(Command);
-PL_instantiate(Request);
-PL_instantiate(Score_column);
-
-
diff --git a/template1.cc b/template1.cc
new file mode 100644 (file)
index 0000000..908de8d
--- /dev/null
@@ -0,0 +1,20 @@
+#include "line.hh"
+
+#include "list.hh"
+#include "cols.hh"
+#include "item.hh"
+#include "request.hh"
+#include "command.hh"
+
+#include "list.cc"
+#include "cursor.cc"
+
+
+PL_instantiate(Line_of_score);
+PL_instantiate(Line_of_staff);
+PL_instantiate(Item);
+PL_instantiate(Spanner);
+PL_instantiate(PStaff);
+PL_instantiate(Idealspacing);
+PL_instantiate(PCol);
+
index bd9a0dcade2c8fb6333e56dd3f1b57c81495eebc..40cd5b9fbe99c76f6e614c6735792ef9e36c0210 100644 (file)
@@ -1,17 +1,15 @@
 #include "line.hh"
 #include "symbol.hh"
 #include "voice.hh"
-#include "molecule.hh"
-#include "staff.hh"
-
-
 
+#include "staff.hh"
 
 #include "list.cc"
 #include "cursor.cc"
+PL_instantiate(Score_column);
 PL_instantiate(Staff_column);
 PL_instantiate(Staff);
 PL_instantiate(Voice_element);
 PL_instantiate(Voice);
-L_instantiate(Atom);
+
 
diff --git a/template3.cc b/template3.cc
new file mode 100644 (file)
index 0000000..b647f18
--- /dev/null
@@ -0,0 +1,11 @@
+#include "request.hh"
+#include "command.hh"
+#include "molecule.hh"
+#include "list.cc"
+#include "cursor.cc"
+L_instantiate(Atom);
+PL_instantiate(Command);
+PL_instantiate(Request);
+
+
+
index 78c9a72852021c372456eab527ac6ca79c7c7e81..c47fca6da6da3b2f52be6da849d012cf7c01fb8d 100644 (file)
@@ -1,5 +1,7 @@
 #include <fstream.h>
+#include <time.h>
 #include "tex.hh"
+#include "misc.hh"
 #include "tstream.hh"
 #include "debug.hh"
 
@@ -11,8 +13,17 @@ Tex_stream::Tex_stream(String filename)
        error("can't open " + filename);
     nest_level = 0;
     outputting_comment=false;
+    header();
+}
+void
+Tex_stream::header()
+{
+    *os << "% Creator: " << get_version() << "\n";
+    *os << "% Automatically generated, at ";
+    time_t t(time(0));
+    *os << ctime(&t)<<"\n";
+//*os << "% from input file ..\n";    
 }
-
 Tex_stream::~Tex_stream()
 {
     assert(nest_level == 0);
index 07be0c170617ef5189d70b5f181e59fede657250..9474dd69a8d8413b00695efc046295aa39fac83b 100644 (file)
@@ -12,7 +12,7 @@ struct Tex_stream {
     
     /// open a file for writing
     Tex_stream(String filename);
-    
+    void header();
     /// delegate conversion to string class.
     Tex_stream &operator<<(String);
 
diff --git a/vector.cc b/vector.cc
deleted file mode 100644 (file)
index be24232..0000000
--- a/vector.cc
+++ /dev/null
@@ -1,41 +0,0 @@
-#include "debug.hh"
-#include "vector.hh"
-#include "string.hh"
-
-Vector::Vector(const Vector&n)
-          :dat(n.dat)
-     // this makes GCC 272 barf
-{
-    //dat = n.dat;
-}    
-
-Vector::operator String() const
-{
-    int i=0;
-    String s("vector [");
-    for (; i < dim(); i++) {
-       s += String(dat[i], "%6f") + ' ';
-    }
-    s+="]";
-    return s;
-}
-
-
-void
-Vector::print() const
-{
-    mtor << *this<<'\n';
-}
-
-Vector
-Vector::operator-() const
-{
-    Vector v(*this); v*=-1; return v;
-}
-
-void
-Vector::set_unit(int j)
-{
-    fill(0.0);
-    dat[j] = 1.0;
-}
diff --git a/vector.hh b/vector.hh
deleted file mode 100644 (file)
index 5be792c..0000000
--- a/vector.hh
+++ /dev/null
@@ -1,106 +0,0 @@
-#ifndef VECTOR_HH
-#define VECTOR_HH
-
-#include "glob.hh"
-#include "vray.hh"
-
-/// a row of numbers
-class Vector  {
-    svec<Real> dat;
-public:
-    void OK() const { dat.OK();}
-    int dim() const { return dat.sz(); }
-    Vector() { }
-    Vector(const Vector&n);
-    Vector(int n) {
-       dat.set_size(n);
-       fill(0);
-    }
-    void insert(Real v, int i) {
-       dat.insert(v,i);
-    }
-    void del(int i) { dat.del(i); }
-    operator String() const;
-    void fill(Real r) {
-       for (int i=0; i < dim(); i++)
-           dat[i] =r;
-    }
-
-    void operator +=(Vector v) {
-       assert(v.dim() == dim());
-       for (int i=0; i < dim(); i++)
-           dat[i] += v.dat[i];
-    }
-    
-    void operator /=(Real a) {
-       (*this) *= 1/a;
-    }
-
-    void operator *=(Real a) {
-       for (int i=0; i < dim(); i++)
-           dat[i] *= a;
-    }
-
-    void operator -=(Vector v) {
-       assert(v.dim() == dim());
-       for (int i=0; i < dim(); i++)
-           dat[i] -= v(i);     
-    }
-
-    Real &operator()(int i) { return dat[i]; }
-    Real operator()(int i) const { return dat[i]; }
-    Real elem(int i) { return dat[i]; }
-    Real operator *(Vector v) const {
-       Real ip=0;
-       assert(v.dim() == dim());
-       for (int i=0; i < dim(); i++)
-           ip += dat[i] *v(i);
-       return ip;
-    }
-    Vector operator-() const;
-    Real norm() {
-       return sqrt(norm_sq() );
-    }
-    Real norm_sq() {
-       return ((*this) * (*this));
-    }
-    operator svec<Real> () { return dat; }
-    void print() const;
-    /// set to j-th element of unit-base
-    void set_unit(int j) ;
-};
-/**
-    a vector. Storage is handled in svec, Vector only does the mathematics.
- */
-
-inline Vector
-operator+(Vector a, Vector const &b) {
-    a += b;
-    return a;
-}
-
-inline Vector
-operator-(Vector a, Vector const &b) {
-    a -= b;
-    return a;
-}
-
-inline Vector
-operator*(Vector v, Real a) {
-    v *= a;
-    return v;
-}
-
-inline Vector
-operator*( Real a,Vector v) {
-    v *= a;
-    return v;
-}
-
-inline Vector
-operator/(Vector v,Real a) {
-    v *= 1/a;
-    return v;
-}
-
-#endif
index d305e403c6e20b55182be1f5d592b6b7ace200e9..401273b6b11d1cbca02641a59759aa1ada638f6b 100644 (file)
@@ -2,7 +2,7 @@
 
 static char *s = "LilyPond version " VERSIONSTR " compiled on " __DATE__ " at " __TIME__ "\n";
 
-char *
+const char *
 get_version()
 {
    return s;
diff --git a/vsmat.hh b/vsmat.hh
deleted file mode 100644 (file)
index 4e1ea79..0000000
--- a/vsmat.hh
+++ /dev/null
@@ -1,141 +0,0 @@
-#ifndef VSMAT_HH
-#define VSMAT_HH
-#include "vray.hh"
-#include "real.hh"
-/// a  matrix storage baseclass.
-class virtual_smat {
-    
-
-public:
-    /// check invariants
-    virtual void OK() const=0;
-    
-    /// height of matrix
-    virtual int rows() const = 0;
-
-    /// width of matrix
-    virtual int cols() const = 0;
-    
-    /// set the size. contents lost
-    virtual void set_size(int i, int j) = 0;
-    /**      
-      PRE
-      i >=0, j>=0
-    */
-    
-    /// set the size to square dimen. contents lost
-    virtual void set_size(int i) = 0;
-    /**
-      PRE
-      i>=0
-    */
-    /// set the size to i
-    virtual void resize(int i, int j) = 0;
-    /**
-
-      keep contents. If enlarged contents unspecified
-        
-      PRE
-      i>=0, j>=0
-    
-    */
-
-    /// set the size to square dimen. contents kept
-    virtual void resize(int i) = 0;
-    /**    
-    Keep contents. If enlarged contents are unspecified
-    
-    PRE
-    i>=0  
-    */
-    
-    /// access an element
-    virtual Real& elem(int i,int j) = 0;
-    /**
-    access an element.
-
-    Generate an errormessage, if this happens
-    in the 0-part of a sparse matrix.
-    */
-
-    /// access a element, no modify
-    virtual const Real& elem(int i, int j) const = 0;
-
-#if 1
-    virtual svec<Real> row(int i) const = 0;
-    virtual svec<Real> column(int j) const = 0;
-#endif
-
-    /// add a row
-    virtual void insert_row(int k)=0;
-    /**
-    add a row to the matrix before  row k. Contents
-    of added row are unspecified
-
-      0 <= k <= rows()
-    */
-
-    /// delete a row 
-    virtual void delete_row(int k)=0;
-      /**
-      delete a row from this matrix.
-
-      PRE
-      0 <= k < rows();
-    */
-        virtual void delete_column(int k)=0;
-    virtual ~virtual_smat() { }
-    virtual virtual_smat *clone()=0;
-
-
-    /// is there a next?
-    virtual bool mult_ok(int i, int j) const=0;
-    /**
-      at end of matrix? when doing loop
-
-      for(i=0; i<h; i++)
-        for(j=0; j<w; j++)
-          ...
-
-    */
-    /// iterate
-    virtual void mult_next(int &i, int &j) const  = 0;
-    /**
-      walk through matrix (regular multiply)
-      get next j for row i, or get next row i and reset j.
-      this will make sparse matrix implementation easy.
-    
-      PRE
-      mult_ok(i,j)
-     */
-    virtual bool trans_ok(int i, int j) const=0;
-    /**
-      valid matrix entry. return false if at end of row
-    */
-    virtual void trans_next(int &i, int &j) const  = 0;
-    /**
-      walk through matrix (transposed multiply).
-      Get next i (for column j)
-    
-      PRE
-      ver_ok(i,j)
-     */
-
-    /// generate a "Full_storage" matrix    
-    static virtual_smat *get_full(int n, int m);
-
-};
-    
-/** base class for interface with matrix storageclasses.  There are no
-    iterators for matrixclasses, since matrices are (like arrays)
-    explicitly int-indexed.
-
-    Iteration is provided by *_next, *_ok, which update and check both
-    index variables simultaneously.
-
-    TODO
-    determine type of product matrix.
-
-*/
-
-#endif