--- /dev/null
+#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
--- /dev/null
+ 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.
MAJVER=0
MINVER=0
-PATCHLEVEL=2
+PATCHLEVEL=3
#
#
progdocs=$(hdr) $(mycc)
gencc=parser.cc lexer.cc
cc=$(mycc) $(gencc)
-obs=$(cc:.cc=.o)
+obs=$(cc:.cc=.o)
#dist
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
-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
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)
+
+
-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
+
+
}
Box::Box()
-{
-
+{
}
Box::Box(Interval ix, Interval iy)
{
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]);
+++ /dev/null
-#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;
-}
-
-
-
-
+++ /dev/null
-#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
void
Idealspacing::OK() const
{
+#ifndef NDEBUG
assert(hooke >= 0 && left && right);
+#endif
}
Interval
PCol::compare(const PCol &c1, const PCol &c2)
{
assert(false);
+ return 0 ;
}
void
PCol::~PCol()
{
- delete prebreak;
- delete postbreak;
+ if (prebreak)
+ delete prebreak; // no recursion!
+ if (postbreak)
+ delete postbreak;
}
void
/*
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
const Real EPS=1e-7; // qlpsolve.hh
const int MAXITER=100; // qlpsolve.hh
const Real INFTY=HUGE;
+#endif
#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);
+}
-#define WARN warnout << "warning: "<<__FUNCTION__ << ": "
+#define WARN warnout << "warning: "<<__FUNCTION__ << "(): "
extern ostream &warnout ;
extern ostream *mlog;
extern Dstream monitor; // monitor
-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
--- /dev/null
+\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
+++ /dev/null
-#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 <<")";
-}
-
-
+++ /dev/null
-// 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
-
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
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\
* 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
#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, )
-// cursor.cc
#ifndef CURSOR_CC
#define CURSOR_CC
#include "cursor.hh"
-//#define inline
-//#include "cursor.inl"
#include <assert.h>
template<class T>
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
/// 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);
/// 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:
-/// 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"
--- /dev/null
+
+
+/// 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.
+ */
-extern Score *the_score;
+
--- /dev/null
+#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);
+ }
+}
int lookup(const char *s) const;
};
-struct Identifier{
+struct Identifier
+{
+ void *data;
+ int type;
+
+ Identifier();
+ ~Identifier();
};
%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
<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} {
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();
{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]+ {
if (!lexer) {
lexer = new yyFlexLexer;
- lexer->set_debug( bool(debug_flags & DEBUGPARSER));
+ lexer->set_debug( !monitor.silence("Lexer"));
}
lexer->switch_streams(newin);
\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}
s += sc->TeXstring();
}
}
- s+="\\hss}}";
+ s+="\\hss}\\vss}";
return s;
}
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;
}
void
Spacing_problem::OK() const
{
+#ifndef NDEBUG
Union_find connected(cols.sz());
for (int i=0; i < ideals.sz(); i++) {
for (int i = 0; i < cols.sz(); i++) {
assert( connected.equiv(0,i));
}
+#endif
}
bool
svec<Real>
Spacing_problem::solve() const
{
+ print();
OK();
assert(check_feasible());
- print();
+
/* optimalisatiefunctie */
Optimisation_problem lp(cols.sz());
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();
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
}
+
+
--- /dev/null
+% 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
+}
+
#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
{
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);
if (!arg) arg = "";
parse_file(arg);
- the_score->process();
- the_score->output(outfn);
+ do_scores();
+ exit (0);
}
--- /dev/null
+#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
#!/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 ..
+++ /dev/null
-#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;
-}
+++ /dev/null
-#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
int intlog2(int d);
Real duration_to_idealspace(Mtime d);
class String;
-char *get_version();
+const char *get_version();
#endif
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;
}
/// how big is #this#?
Box extent() const;
- Atom(const Symbol*s) {
- sym=s;
- }
+ Atom(const Symbol*s);
String TeXstring() const;
};
intdur = (durstr.len()) ?
durstr.value():default_duration;
- if (debug_flags & DEBUGTOKEN)
- mtor << "dur " << intdur << "dots " << dots<<eol;
+
+ mtor << "dur " << intdur << "dots " << dots<<eol;
}
int & large, int & small)
{
// octave
- oct =0;
+ oct =0;
while (1)
{
j++;
}
- if (debug_flags & DEBUGTOKEN) mtor << "oct " << oct;
+
+ mtor << "oct " << oct;
// accidental
overide_acc = false;
j++;
}
- if (debug_flags & DEBUGTOKEN)
- mtor << "ov " << overide_acc;
+
+ mtor << "ov " << overide_acc;
// notename.
String nm;
}
- lookup_notename(large,small,nm);
- if (debug_flags & DEBUGTOKEN)
- mtor << "int "<< large <<" "<<small<<" ";
+ lookup_notename(large,small,nm);
+ mtor << "int "<< large <<" "<<small<<" ";
}
%{ // -*-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);
}
;
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:
parse_file(String s)
{
*mlog << "Parsing ... ";
- yydebug = debug_flags & DEBUGPARSER;
+ yydebug = !monitor.silence("Parser");
new_input(s);
yyparse();
}
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)
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";
}
}
#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);
}
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
}
}
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
}
#include "qlpsolve.hh"
+#include "const.hh"
#include "debug.hh"
#include "choleski.hh"
+++ /dev/null
-#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
-#include <time.h>
+
#include "tstream.hh"
#include "score.hh"
#include "pscore.hh"
#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
}
/*
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();
}
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
*/
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();
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);
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();
sc->print();
}
mtor << "}\n";
+#endif
+}
+Score::Score()
+{
+ pscore_=0;
}
-
/****************************************************************/
Score_column::Score_column(Mtime w)
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
}
+
+
/// the total music def of one movement
struct Score {
+ String outfile;
/// staffs_ and commands_ form the problem definition.
PointerList<Staff *> staffs_;
PointerList<Command*> commands_;
PScore *pscore_;
/****************************************************************/
+
+ Score();
/// add #Idealspacings# to #pscore_#
void calc_idealspacing();
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;
--- /dev/null
+#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;
+}
+
+++ /dev/null
-#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);
-}
+++ /dev/null
-#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
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++;
}
}
void
Staff::OK() const
{
+#ifndef NDEBUG
cols.OK();
commands.OK();
voices.OK();
- assert(score_);
-
+ assert(score_);
+#endif
}
{
return score_column->when;
}
+
void
Staff_column::add(Voice_element*ve)
{
v_elts.add(ve);
}
+
Staff_column::Staff_column(Score_column*s) {
score_column = s;
}
-# TeXstring, xmin xmax ymin ymax
+# index TeXstring, xmin xmax ymin ymax
table balls
1 \wholeball -5 5 -1 1
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
+
+
+
+
+
#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)
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.
struct Symtable : public Assoc<String, Symbol> {
-
+ const Symbol * lookup(String)const;
};
#include "glob.hh"
+#include "debug.hh"
#include "string.hh"
#include "keyword.hh"
#include "parser.hh"
"rhythmstaff", RHYTHMSTAFF,
"score", SCORE,
"bar", BAR,
+ "output", OUTPUT,
0,0
} ;
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];
}
+++ /dev/null
-#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);
-
-
--- /dev/null
+#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);
+
#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);
+
--- /dev/null
+#include "request.hh"
+#include "command.hh"
+#include "molecule.hh"
+#include "list.cc"
+#include "cursor.cc"
+L_instantiate(Atom);
+PL_instantiate(Command);
+PL_instantiate(Request);
+
+
+
#include <fstream.h>
+#include <time.h>
#include "tex.hh"
+#include "misc.hh"
#include "tstream.hh"
#include "debug.hh"
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);
/// open a file for writing
Tex_stream(String filename);
-
+ void header();
/// delegate conversion to string class.
Tex_stream &operator<<(String);
+++ /dev/null
-#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;
-}
+++ /dev/null
-#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
static char *s = "LilyPond version " VERSIONSTR " compiled on " __DATE__ " at " __TIME__ "\n";
-char *
+const char *
get_version()
{
return s;
+++ /dev/null
-#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