-MAJVER=0
-MINVER=0
-PATCHLEVEL=8
-
-TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
-
-#
-#
-
-include Sources.make
-progdocs=$(hdr) $(mycc)
-gencc=parser.cc lexer.cc
-cc=$(mycc) $(gencc)
-obs=$(cc:.cc=.o)
-
-
-#dist
-.EXPORT_ALL_VARIABLES:
-
-DOCDIR=docdir
-VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL)
-PACKAGENAME=lilypond
-DNAME=$(PACKAGENAME)-$(VERSION)
-othersrc=lexer.l parser.y
-SCRIPTS=make_version make_patch genheader
-IFILES=dimen.tex symbol.ini suzan.ly maartje.ly\
- lilyponddefs.tex test.tex .dstreamrc
-OFILES=Makefile Sources.make COPYING README
-DFILES=$(hdr) $(mycc) $(othersrc) $(OFILES) $(IFILES) $(SCRIPTS)
-
-#compiling
-LOADLIBES=-L$(FLOWERDIR) -lflower
-FLOWERDIR=../flower
-# speedy
-#DEFINES=-DNDEBUG -DNPRINT -O2
-# lots of debugging info
-DEFINES=-g
-
-CXXFLAGS=$(DEFINES) -I$(FLOWERDIR) -pipe -Wall -W -pedantic
-FLEX=flex
-BISON=bison
-exe=$(PACKAGENAME)
-
-##################################################################
+include Make.variables
$(exe): $(obs)
- $(CXX) -o $@ $(obs) $(LOADLIBES)
+ $(CXX) -o $@ $^ $(LOADLIBES)
+
clean:
rm -f $(exe) *.o $(DOCDIR)/* core
distclean: clean
- rm -f TAGS depend version.hh $(gencc) .GENERATE *~
+ rm -f depend version.hh $(gencc) .GENERATE *~
all: kompijl doc
-mkdir $(DOCDIR)
doc++ -p -I -d $(DOCDIR) $(progdocs)
-depend: Sources.make .GENERATE
- $(CXX) $(CXXFLAGS) -MM $(cc) > $@
+depend: Sources.make .GENERATE
+ touch depend
+ $(MAKE) realdepend
+
+
+$(OBJECTDIR)/%.o: $(CCDIR)/%.cc
+ $(CXX) -c $(CXXFLAGS) $(OUTPUT_OPTION)
# hack to create these sources once, before the dependencies
.GENERATE:
$(MAKE) $(gencc)
rm -f depend
+realdepend: $(cc)
+ $(CXX) $(CXXFLAGS) -MM $^ | perl -ne 's/^(.+)\.o/'$(OBJECTDIR)'\/\1.o/; print;' > depend
+
include depend
-parser.cc: parser.y
+$(CCDIR)/parser.cc: parser.y
$(BISON) -d $<
- mv parser.tab.h parser.hh
- mv parser.tab.c parser.cc
+ mv $(CCDIR)/parser.tab.h $(HEADERDIR)/parser.hh
+ mv $(CCDIR)/parser.tab.c $(CCDIR)/parser.cc
parser.hh: parser.cc
version.o: $(obs) version.hh
version.hh: Makefile make_version
- make_version $(MAJVER) $(MINVER) $(PATCHLEVEL) > $@
+ make_version $(MAJVER) $(MINVER) $(PATCHLEVEL) > $(HEADERDIR)/$@
-lexer.cc: lexer.l
+src/lexer.cc: lexer.l
$(FLEX) -+ -t $< > $@
-DDIR=$(TOPDIR)/$(DNAME)
-SUBDIRS=Documentation
dist:
-mkdir $(DDIR)
ln $(DFILES) $(DDIR)/
rm -rf $(DDIR)/
-TAGS: $(mycc) $(hdr) Sources.make
- etags -CT $(mycc) $(hdr)
-
+TAGS:
+ $(MAKE) -C $(HEADERDIR) TAGS
+ $(MAKE) -C $(CCDIR) TAGS
\ No newline at end of file
--- /dev/null
+default:
+ $(MAKE) -C ..
+
+dist:
+ ln Makefile $(hdr) $(DDIR)/$(HEADERDIR)
+
+TAGS: $(hdr)
+ etags -CT $(hdr)
--- /dev/null
+#ifndef ITEM_HH
+#define ITEM_HH
+
+#include "glob.hh"
+#include "boxes.hh"
+#include "string.hh"
+
+/// a horizontally fixed size element of the score
+struct Item {
+ /// indirection to the column it is in
+ PCol * pcol_;
+
+ /// indirection to the pstaff it is in
+ PStaff *pstaff_;
+
+ /// member: the symbols
+ Molecule *output;
+
+ ///
+ Offset offset_;
+ /**
+ This is needed, because #output# may still be
+ NULL.
+ */
+ /****************/
+
+ void translate(Offset);
+
+ /// do calculations after determining horizontal spacing
+ virtual void postprocess();
+
+ /// do calculations before determining horizontal spacing
+ virtual void preprocess();
+ /**
+ This is executed directly after the item is added to the
+ PScore
+ */
+
+ virtual Interval width() const;
+ virtual Interval height() const;
+ String TeXstring () const ;
+ Item();
+ void print()const;
+ virtual ~Item();
+ Paperdef *paper() const;
+};
+/** Item is the datastructure for printables whose width is known
+ before the spacing is calculated
+
+ NB. This doesn't mean an Item has to initialize the output field before
+ spacing calculation.
+
+*/
+
+
+#endif
--- /dev/null
+#include "string.hh"
+#include "molecule.hh"
+#include "meter.hh"
+#include "paper.hh"
+#include "lookup.hh"
+
+
+Meter::Meter(svec<String> a)
+ :args(a)
+{
+}
+void
+Meter::preprocess()
+{
+ Parametric_symbol *p = paper()->lookup_->meter("general");
+ Symbol s = p->eval(args);
+ delete p;
+ output = new Molecule(Atom(s));
+}
+
--- /dev/null
+// utility functions for PScore
+#include "debug.hh"
+#include "spanner.hh"
+#include "paper.hh"
+#include "molecule.hh"
+#include "dimen.hh"
+#include "scoreline.hh"
+#include "pscore.hh"
+#include "tstream.hh"
+
+
+void
+PScore::clean_cols()
+{
+ for (PCursor<PCol *> c(cols); c.ok(); )
+ if (!c->used) {
+ c.del();
+ } else
+ c++;
+}
+
+
+void
+PScore::add(PStaff *s)
+{
+ assert(s->pscore_ == this);
+ staffs.bottom().add(s);
+}
+
+void
+PScore::typeset_item(Item *i, PCol *c, PStaff *s, int breakstat)
+{
+ assert(c && i && s);
+// assert(!breakstat != 4 || c->breakable() );
+ if (breakstat == 0) {
+ typeset_item(i, c->prebreak, s);
+ return;
+ }
+
+ if (breakstat == 2) {
+ typeset_item(i, c->postbreak, s);
+ return;
+ }
+
+
+ its.bottom().add(i);
+ s->add(i);
+ c->add(i);
+
+ /* first do this, because i->width() may follow the 0-pointer */
+ i->preprocess();
+
+
+ if (c->daddy && c == c->daddy->prebreak) { // makeshift.
+
+ Interval iv (i->width());
+ if (!iv.empty()) {
+ svec<Item*> col_its (select_items(s, c));
+ for (int j =0; j < col_its.sz(); j++)
+ col_its[j]->translate(Offset(-iv.length(),0));
+ i->translate (Offset(-iv.max, 0));
+ }
+ }
+
+}
+
+void
+PScore::typeset_spanner(Spanner*sp, PStaff*ps)
+{
+ sp->preprocess();
+ sp->pstaff_ = ps;
+ spanners.bottom().add(sp);
+ ps->spans.bottom().add(sp);
+ sp->left->starters.bottom().add(sp);
+ sp->right->stoppers.bottom().add(sp);
+}
+
+
+void
+PScore::add_line(svec<const PCol *> curline, svec<Real> config)
+{
+ Line_of_score *p = new Line_of_score(curline,this);
+ lines.bottom().add(p);
+ for (int i=0; i < curline.sz(); i++){
+ PCol *c=(PCol *)curline[i]; // so, this isn't really const.
+ c->hpos= config[i];
+ }
+}
+
+Idealspacing*
+PScore::get_spacing(PCol*l, PCol*r)
+{
+ assert(l!=r);
+ for (PCursor<Idealspacing*> ic (suz); ic.ok(); ic++) {
+ if (ic->left == l && ic->right == r){
+ return ic;
+ }
+ }
+
+ Idealspacing*ip =new Idealspacing(l,r);
+ suz.bottom().add(ip);
+
+ return ip;
+}
+
+
+/*
+ return all breakable columns
+ */
+svec<const PCol *>
+PScore::find_breaks() const
+{
+ svec<const PCol *> retval;
+ for (PCursor<PCol *> c(cols); c.ok(); c++)
+ if (c->breakable())
+ retval.add(c);
+
+ return retval;
+}
+
+void
+PScore::add(PCol *p)
+{
+ cols.bottom().add(p);
+}
+
+PScore::PScore( Paperdef*p)
+{
+ paper_ = p;
+}
+
+void
+PScore::output(Tex_stream &ts)
+{
+ int l=1;
+
+ 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";
+ }
+}
+
+
+svec<Item*>
+PScore::select_items(PStaff*ps , PCol*pc)
+{
+ svec<Item*> ret;
+ assert(ps && pc);
+ for (PCursor<const Item*> ic(pc->its); ic.ok(); ic++){
+ if (ic->pstaff_ == ps)
+ ret.add((Item*)(const Item*)ic);
+ }
+ return ret;
+}
+
+void
+PScore::OK()const
+{
+#ifdef NDEBUG
+ for (PCursor<PCol*> cc(cols); cc.ok(); cc++)
+ cc->OK();
+ for (PCursor<Idealspacing*> ic(suz); ic.ok(); ic++)
+ ic->OK();
+#endif
+}
+
+void
+PScore::print() const
+{
+#ifndef NPRINT
+ mtor << "PScore { ";
+ paper_->print();
+ mtor << "\ncolumns: ";
+ for (PCursor<PCol*> cc(cols); cc.ok(); cc++)
+ cc->print();
+
+ mtor << "\nideals: ";
+ for (PCursor<Idealspacing*> ic(suz); ic.ok(); ic++)
+ ic->print();
+ mtor << "}\n";
+#endif
+}
+
+void
+PScore::preprocess()
+{
+#if 0
+ for (PCursor<Item*> ic(its); ic.ok(); ic++){
+ ic->preprocess();
+ }
+#endif
+}
+
+void
+PScore::postprocess()
+{
+ for (PCursor<Spanner*> ic(spanners); ic.ok(); ic++) {
+ ic->process();
+ }
+ for (PCursor<Item*> ic(its); ic.ok(); ic++){
+ ic->postprocess();
+ }
+}
--- /dev/null
+#include "molecule.hh"
+#include "notehead.hh"
+#include "stem.hh"
+#include "linestaff.hh"
+#include "rhythmstaff.hh"
+#include "paper.hh"
+#include "sccol.hh"
+#include "rest.hh"
+
+void
+Rhythmic_staff::set_output(PScore*ps)
+{
+ theline = new Linestaff(1,ps);
+ Simple_staff::set_output(ps);
+}
+
+Item *
+Rhythmic_staff::get_TYPESET_item(Command *com)
+{
+ Item *i = Simple_staff::get_TYPESET_item(com);
+ i->translate(Offset(0,
+ -score_->paper_->standard_height()/2));
+ return i;
+}
+
+Notehead*
+Rhythmic_staff::get_notehead(Note_req *rq)
+{
+ int b = rq->rhythmic()->balltype;
+ int d = rq->rhythmic()->dots;
+
+ Notehead *n =new Notehead(1);
+ n->balltype = b;
+ n->dots =d;
+ n->position = 0;
+ return n;
+}
+
+Stem *
+Rhythmic_staff::get_stem(Stem_req*rq)
+{
+ Stem * s = new Stem(0);
+ s->flag = rq->stem_number;
+ return s;
+}
+
+/*
+ creation
+ */
+Staff *
+get_new_rhythmstaff()
+{
+ return new Rhythmic_staff;
+}
+
+
+
+Rhythmic_staff*
+Rhythmic_staff::clone() const
+{
+ return new Rhythmic_staff(*this);
+}