My_flex_lexer 1
yyFlexLexer 1
PCol 1
-Score_column 1
+Score_column 0
Ineq_constrained_qp 1
Spacing_problem 0
Colinfo 0
parse_pitchmod 1
Col_configuration 1
Request 1
-Note_req 1
+Note_req 0
Rhythmic_req 1
Rest_req 1
delete_identifiers 1
Command 1
Staff_commands 1
Stem 1
-Staff 1
+Staff 0
Score 1
-Voice 1
-Voice_element 1
+Voice 0
+Voice_element 0
Input_cursor 1
Commands_at 1
-Input_command 1
-Time_description 1
\ No newline at end of file
+Input_command 0
+Time_description 1
\ No newline at end of file
Please use these standards while doing programming for LilyPond
-
-
Functions and methods do not return errorcodes, but use assert for
checking status.
=head2 DATA MEMBERS
- Class::member
-
-if the member's name resembles its type, then I use
+ Class::member()
+ Class::member_type_()
- class Fubular { ..}
-
- Class::fubular_
+the C<type> is a Hungarian notation postfix
=head2 COMMENTS
+The source is commented in the DOC++ style. Check out doc++ at
+F<http://www.ZIB-Berlin.DE/VisPar/doc++/doc++.html>
+
/// short description
class Class {
///
=head1 DESCRIPTION
LilyPond typesets music. It translates script files (mudela files or
-F<.ly>'s) into TeX input.
+F<.ly>'s) into TeX input. Typesetting music is a complex task,
+whereas the message that printed music conveys is usually a simple
+one. LilyPond is a try at providing a simple interface for setting
+music LilyPond has these features:
+
+
+=over 5
+
+=item * ASCII script input, with identifiers (for music reuse),
+customizable notenames, customizable fontset
+
+=item *
+multiple staffs in one score
+
+=item *
+multiple stafftypes (melodic, rhythmic)
+
+=item *
+beams, slurs, chords, super/subscripts (accents and text),
+triplets, clef changes, meter changes, general n-plet (triplet,
+quadruplets, etc.)
+
+=item *
+multiple scores within one input file. Each score is output to
+a different file.
+
+=back
+
+=head1 DESIGN CONSIDERATIONS
+
+LilyPond was written with some
+considerations in mind:
+
+=over 5
+
+=item *
+Describing a well-defined language for defining music. We call this
+language (rather arrogantly) The Musical Definition Language (mudela
+for short). LilyPond reads a mudela sourcefile
+and outputs a TeX file. This musical definition language should:
+
+=over 5
+
+=item 1
+define the musical message of the writer as unambigiously as
+possible.
+
+=item 2
+be easily readable. (as compared to, say, MusixTeX input)
+
+=item 3
+be writable in ASCII (with a simple texteditor).
+
+=back
+
+At this time, the language isn't yet defined precisely. It is evolving as
+LilyPond is getting more complex.
+
+=item *
+We want to provide an easy-to-use interface for typesetting music in
+its broadest sense. This interface should be intuitive from a musical
+point of view. By broadest sense we mean: it is designed for music
+printed left to right in staffs, using notes to designate rythm and
+pitch.
+
+=item *
+LilyPond uses MusiXTeX fonts and TeX for its output. This is not a key
+issue: in a future version, LilyPond might bypass TeX, but at the moment
+TeX is very convenient for producing output.
+
+=item *
+ Generate high-quality output. Ideally it should be of a professional
+quality. We'd like to render Herbert Chlapiks words, "Fine music
+setting is not possible without a knowledgeable printer," untrue.
+
+=item *
+LilyPond does not display notes directly, nor will it be rehacked to be
+used interactively. LilyPond writes output to a file. It will not be
+extended to play music, or to recognize music.
+
+We're thinking about adding MIDI output, though
+
+=item *
+LilyPond is intended to run on Unix platforms, but it should
+be portable to any platform which can run TeX and the GNU tools
+
+=item *
+LilyPond is free. Commercial windows packages for setting music are
+abundant. Free musicprinting software is scarce.
+
+=item *
+LilyPond is written in GNU C++. It will not be downgraded/ported to fit
+broken systems.
+
+=back
+
+
=head1 OPTIONS
+=over 5
+
=item B<-d,--debug>,
-debugging
+
+debugging. LilyPond will read the file F<.dstreamrc>, which tells for what functions to produce copious debugging output.
=item B<-w,--warranty>,
+
warranty
=item B<-o,--output>,
+
default output file
=item B<-h,--help>,
+
help
-=head1 LICENSE
+=back
+
+=head1
+DISCLAIMER & COPYING POLICY
-GNU GPL. See file COPYING
+LilyPond is copyright 1996,97 by its authors. LilyPond is
+distributed under the terms of the GNU General Public
+License. LilyPond is provided without any warranty what so ever.
+LilyPond may be freely distributed. For further information consult
+the GNU General Public License, which is in the file F<COPYING>
=head1 PREREQUISITES
=over 5
-=item - Unix (any decent Linux distribution is fine)
+=item *
+ Unix. Any decent Linux distribution is fine. LilyPond is known to run
+on Linux and Solaris
-=item - GNU C++ v2.7 or better (with libg++ )
+=item *
+ GNU C++ v2.7 or better (with libg++ )
-=item - GNU make.
+=item *
+ GNU make.
-=item - flex (2.5.1 or better)
+=item *
+ flex (2.5.1 or better)
-=item - bison/yacc
+=item *
+bison/yacc
-=item - The "flower" library,
+=item *
+The "flower" library,
which should be available from the
same source you got this from.
-=item - perl
+=item *
+perl
=back
+
+The Makefile uses perl for trivial operations, and you could tinker
+with it to use sed or awk.
+
Operation:
=over 5
-=item TeX
+=item * TeX
-=item the MusixTeX fonts
+=item * the MusixTeX fonts
=back
-The Makefile uses perl for trivial operations, and you could tinker
-with it to use sed or awk.
-
=head1 COMPILING
Do:
cd lilypond-1.2.13
make
+You might want to edit Variables.make to tailor the compilation flags.
why G++ >= 2.7? LilyPond & flower lib uses:
=over 5
-=item builtin bool
+=item *
+builtin bool
-=item typeof
+=item *
+typeof
-=item operator <?, operator >?
+=item *
+operator <?, operator >?
-=item the new for-scope
+=item *
+the new for-scope
-=item class Rational (libg++)
+=item *
+class Rational (libg++)
-=item named return values
+=item *
+named return values
=back
-=head1 AUTHOR
+=head1 AUTHORS
+
+=over 5
+
+=item *
+Han-Wen Nienhuys <hanwen@stack.nl>, Main author
+
+=item *
+Jan Nieuwenhuizen <jan@digicash.com>, bits of FlowerLib, general comments.
-Han-Wen Nienhuys <hanwen@stack.nl>, <jan@digicash.com>
+=item *
+Mats Bengtsson <matsb@s3.kth.se>, bugfixes, testing.
+
+=back
+
+Your name could be here! If you want to help, then take a look at the
+SMALLISH PROJECTS section of LilyPond. Some do not involve coding C++
=head1 EXAMPLES
=head1 PROBLEMS
-If LilyPond bombs out, then please recompile using B<-g>, and send a gdb
-stacktrace of the crash. It also helps if you can print the values of the objects. So if you trace is
+If LilyPond bombs out, then please recompile using B<-g>, and send a
+copy of the input which causes the error and a gdb stacktrace of the
+crash. It also helps if you can print the values of the objects. So if
+you trace is
(gdb) backtrace 12
#0 Interval::operator+= (this=0x11fffec60..)
(use: 'print *this' or use LilyPond print() methods).
This is a beta version of LilyPond. Please send your helpful comments
-and patches to me,
+and patches to me (see AUTHORS section)
LilyPond is updated very frequently, the latest version is always available at:
F<symbol.ini> The initialisation file with symbol tables etc. It
includes files from the directory F<init/>.
-=head1 HOW DOES IT WORK
+=head1 SEE ALSO
-=over 5
+lilygut(1), lilyinput(1)
-Use The Source, Luke. If you don't know C++, you can try editing
-the file F<.dstreamrc> for copious debugging output. (use B<-d>)
+=head1 REMARKS
-the subdir F<Documentation/> contains some more-in-depth matter on LilyPond
-
-The source is commented in the DOC++ style. Check out doc++ at
-F<http://www.ZIB-Berlin.DE/VisPar/doc++/doc++.html>
-
-=back
+LilyPond has no connection with the music package RoseGarden, other
+than the names being similar.
=head1 DESCRIPTION
This page documents some aspects of the internals of LilyPond. Some of
-this stuff comes from e-mail I wrote, some from e-mail others wrote, some are large comments taken away from the headers
+this stuff comes from e-mail I wrote, some from e-mail others wrote,
+some are large comments taken away from the headers
=head1 OVERVIEW
which is put into a percussion-Staff, will be typeset as the rythm of
that voice.
-After C<Staff> made up her mind (Would C<Staff> be a smart
-name? How about C<struct Susan {}> :-), the resultant items and
+After C<Staff> made up her mind, the resultant items and
spanners are put on the PScore, and pointers to these items are
stored in the C<Voice_element>. This construction enables the
beams/stems to look up the balls it has to connect to.
=over 5
-=item Note_req
+=item C<Barcheck_req>
+
+Checks during music processing if start of this voice element
+coincides with the start of a measure. Handy to check if you left out
+some voice elts.
+
+=item C<Note_req>
Staff has to decide if the ball should be hanging left or right. This
influences the horizontal dimensions of a column, and this is why
request processing should be done before horizontal spacing.
Other voices' frivolities may cause the need for accidentals, so this
-is also for the Staff to decide. The Staff can decide on positioning
+is also for the C<Staff> to decide. The C<Staff> can decide on positioning
based on ottava commands and the appropriate clef.
-=item Rest_req
+=item C<Rest_req>
Why a request? It might be a good idea to not typeset the rest, if the
paper is too crowded.
-=item Span_req
+=item C<Span_req>
This type of request typically results in the creation of a C<Spanner>
-=item Beam_req
+=item C<Beam_req>
Staff has to combine this request with the stem_request, since the
number of flags that a stem wants to carry will determine the
number of beams.
-=item Dynamic
+=item C<Dynamic>
-Each dynamic is bound to one note ( a crescendo spanning multiple
+Each dynamic is bound to one note (a crescendo spanning multiple
notes is thought to be made of two "dynamics": a start and a stop).
Dynamic changes can occur in a smaller time than the length of its
-note, therefore fore each Dynamic request carries a time, measured
+note, therefore fore each C<Dynamic> request carries a time, measured
from the start of its note.
-This subfield would come in handy, if mpp96 was adapted for midi
+This subfield would come in handy, if LilyPond was adapted for midi
support.
=back
=head1 BREAKING
-[Source files: command.hh, scommands.cc]
+[Source files: F<command.hh>, F<scommands.cc>]
BREAKING, PREBREAK POSTBREAK, etc.
column-pair. each spring has an equilibrium-position which is equal to
the above mentioned distance, so
- spring (col1, col2) and spring(col2,col3) try to push column 1
+spring (col1, col2) and spring (col2,col3) try to push column 1
and 3 away (to a distance of 20pt) from each other, whereas the spring
between col 1 and col 3 tries to pull those two together (to a
distance of 14.1 pt). The net result of this pushing and pulling is an
[partly by Mark Basinski <basinski@arizona.edu>]
-
Herbert Chlapik,
W.A. Hegazy and J. S. Gourlay. Optimal line breaking in music. In
+pl 22:
+ - doco from mpp
+ - repeat signs
+ - | checks for bar in a voice (Barcheck_req)
+Internal changes:
+ - naming (Hungarian notation, svec vs. Array)
+ - huge memleak fixed; unearthed lots of bugs
+ - bug noteheadswap
+ - cleanup PScore, Score
+ - removed Staff_commands, plugging commands into Staff_column directly
+
pl 21:
- - Move breaking stuff into a separate class Break_algorithm
- - dependencies for Staff_elem's
- scripts
- texts
- nplets (triplets!)
+Internal changes:
+ - Move breaking stuff into a separate class Break_algorithm
+ - dependencies for Staff_elem's
pl 20:
- - Rational for time measurement
- updated doco to .pod
+ - include files from .ly
+Internal changes:
+ - Rational for time measurement
- directionalspanner/textspanner
- - include files
pl 19:
- - struct Moment
- grouping code: LilyPond can set advanced multibeams.
+Internal changes:
+ - struct Moment
+
pl 18:
- robust Staff_commands
make doc
-in the top-level dir
\ No newline at end of file
+in the top-level dir
+
+
+======================
+
+NOTE:
+
+LilyPond is a long way from finished and polished. I do appreciate
+criticism, comments, bugreports, patches, etc. Please send e-mail to
+
+ hanwen@stack.urc.tue.nl
+
+Have fun!
\ No newline at end of file
staffelem.hh idealspacing.hh break.hh\
scriptdef.hh script.hh textdef.hh textitem.hh
-mycc= qlp.cc qlpsolve.cc leastsquares.cc\
- inputcommands.cc inputmusic.cc \
- inputscore.cc inputstaff.cc inputcommand.cc\
- timedescription.cc\
- break.cc linespace.cc molecule.cc staffline.cc\
- pscore.cc tex.cc item.cc pcol.cc staff.cc \
- rhythmstaff.cc score.cc note.cc main.cc misc.cc\
- symbol.cc request.cc notename.cc voice.cc\
- keyword.cc linestaff.cc table.cc command.cc\
- warn.cc debug.cc symtable.cc boxes.cc\
- pstaff.cc tstream.cc\
- calcideal.cc scores.cc \
- dimen.cc paper.cc lookup.cc staffcommands.cc\
- sccol.cc stcol.cc getcommands.cc simplestaff.cc\
- melodicstaff.cc simpleprint.cc\
- spanner.cc textspanner.cc directionalspanner.cc \
- notehead.cc stem.cc \
- rest.cc bar.cc meter.cc keyitem.cc localkeyitem.cc clefitem.cc\
- swalker.cc scoreline.cc\
- simplewalker.cc scriptdef.cc script.cc\
- texbeam.cc texslur.cc clef.cc key.cc slur.cc beam.cc\
- idealspacing.cc grouping.cc identifier.cc\
- lexerinit.cc mylexer.cc textdef.cc textitem.cc\
- staffelem.cc wordwrap.cc\
+mycc=bar.cc beam.cc boxes.cc break.cc calcideal.cc clef.cc\
+ clefitem.cc command.cc debug.cc dimen.cc directionalspanner.cc\
+ getcommands.cc grouping.cc idealspacing.cc identifier.cc\
+ inputcommand.cc inputcommands.cc inputmusic.cc inputscore.cc\
+ inputstaff.cc item.cc key.cc keyitem.cc keyword.cc\
+ leastsquares.cc lexerinit.cc linespace.cc linestaff.cc\
+ localkeyitem.cc lookup.cc main.cc melodicstaff.cc meter.cc\
+ misc.cc molecule.cc mylexer.cc note.cc notehead.cc notename.cc\
+ paper.cc pcol.cc pscore.cc pstaff.cc qlp.cc qlpsolve.cc\
+ request.cc rest.cc rhythmstaff.cc sccol.cc score.cc\
+ scoreline.cc scores.cc script.cc scriptdef.cc simpleprint.cc\
+ simplestaff.cc simplewalker.cc slur.cc spanner.cc staff.cc\
+ staffcommands.cc staffelem.cc staffline.cc stcol.cc stem.cc\
+ swalker.cc symbol.cc symtable.cc table.cc tex.cc texbeam.cc\
+ texslur.cc textdef.cc textitem.cc textspanner.cc\
+ timedescription.cc tstream.cc voice.cc warn.cc wordwrap.cc\
template1.cc template2.cc template3.cc template4.cc\
- template5.cc\
- version.cc
-
-
-
+ template5.cc version.cc
\ No newline at end of file
# version info
MAJVER=0
MINVER=0
-PATCHLEVEL=21
+PATCHLEVEL=22
VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL)
CXXVER=`$(CXX) --version`
othersrc=lexer.l parser.y
SCRIPTS=make_version make_patch genheader
IFILES=dimen.tex symbol.ini kortjakje.ly pavane.ly maartje.ly\
- lilyponddefs.tex test.tex .dstreamrc cadenza.ly
+ lilyponddefs.tex test.tex .dstreamrc cadenza.ly scales.ly\
+ titledefs.tex pavane.tex
OFILES=Makefile Variables.make Sources.make COPYING README NEWS
DFILES=$(OFILES) $(IFILES) $(SCRIPTS)
--- /dev/null
+pl 22:
+ - Array::add -> Array::push
\ No newline at end of file
#!/bin/sh
def=`echo $1 | sed s/\\\./_/ | tr a-z A-Z`
+
cat << HERE
/*
$1 -- part of LilyPond
- (c) 1996 Han-Wen Nienhuys
+ (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
#ifndef $def
Real left_pos;
/// dir: -1 below heads, +1 above heads.
-
- Rhythmic_grouping *group;
-
/****************/
virtual Interval width()const;
#ifndef BREAK_HH
#define BREAK_HH
-#include "vray.hh"
+#include "varray.hh"
#include "proto.hh"
-typedef svec<PCol*> Line_of_cols;
+typedef Array<PCol*> Line_of_cols;
struct Col_configuration {
Line_of_cols cols;
- svec<Real> config;
+ Array<Real> config;
Real energy;
/****************/
void OK()const;
- void setsol(svec<Real>);
+ void setsol(Array<Real>);
Col_configuration() ;
void add( PCol*c);
void print() const;
/// check if the spacing/breaking problem is well-stated
void problem_OK()const;
/// search all pcols which are breakable.
- svec<PCol *> find_breaks() const;
+ Array<PCol *> find_breaks() const;
/// helper: solve for the columns in #curline#.
- svec<Real> solve_line(Line_of_cols) const;
+ Array<Real> solve_line(Line_of_cols) const;
/// does curline fit on the paper?
bool feasible(Line_of_cols)const;
- virtual svec<Col_configuration> solve()=0;
+ virtual Array<Col_configuration> solve()=0;
};
/// wordwrap type algorithm: move to next line if current is optimal.
struct Word_wrap : Break_algorithm {
- virtual svec<Col_configuration> solve();
+ virtual Array<Col_configuration> solve();
Word_wrap(PScore&);
};
#endif // BREAK_HH
#ifndef CLEF_HH
#define CLEF_HH
#include "scalar.hh"
-#include "vray.hh"
+#include "varray.hh"
struct Clef {
int c0_pos;
String clef_type;
Clef();
- void read(svec<Scalar> args);
+ void read(Array<Scalar> args);
};
#endif // CLEF_HH
#define COMMAND_HH
#include "glob.hh"
-#include "vray.hh"
+#include "varray.hh"
#include "scalar.hh"
enum Commandcode {
Commandcode code;
/// analogous to argv[]
- svec<Scalar> args;
+ Array<Scalar> args;
///
int priority;
#include "real.hh"
void error(String s); // errors
-void error_t(String s, Real when);
// warnings
void warning(String s);
Command* get_meter_command(int,int);
+Command get_defaultbar_command();
+void split_bar_command(Command &pre_com, Command &no_break_com, Command &post_com,String s);
#endif // GETCOMMAND_HH
#include "moment.hh"
#include "interval.hh"
-#include "vray.hh"
+#include "varray.hh"
typedef Interval_t<Moment> MInterval;
/// data structure which represents rhythmic units
struct Rhythmic_grouping {
- svec<Rhythmic_grouping*> children;
+ Array<Rhythmic_grouping*> children;
MInterval *interval_;
/****************/
- svec<MInterval> intervals();
+ Array<MInterval> intervals();
MInterval interval()const;
Moment length() const;
void intersect(MInterval);
Rhythmic_grouping(Rhythmic_grouping const&);
Rhythmic_grouping(MInterval, int n=1);
Rhythmic_grouping();
- Rhythmic_grouping(svec<Rhythmic_grouping*>);
+ Rhythmic_grouping(Array<Rhythmic_grouping*>);
~Rhythmic_grouping();
void add_child(Moment start, Moment len);
void split(Rhythmic_grouping r);
- void split(svec<MInterval>);
+ void split(Array<MInterval>);
void split(int n);
void print() const;
void OK() const;
- svec<int> generate_beams(svec<int>, int&);
+ Array<int> generate_beams(Array<int>, int&);
private:
void init();
IDACCESSOR(Music_general_chord, mchord)
IDACCESSOR(Lookup,lookup)
IDACCESSOR(Notename_tab, notename_tab)
+private:
+ Identifier(Identifier const&){}
};
#endif // IDENTPARENT_HH
#define INPUTCOMMAND_HH
#include "proto.hh"
#include "scalar.hh"
-#include "vray.hh"
+#include "varray.hh"
#include "moment.hh"
struct Input_command {
/// analogous to argv[]
- svec<Scalar> args;
+ Array<Scalar> args;
void print()const;
Input_command();
operator Command();
};
-
-Input_command* get_meterchange_command( int,int);
-Input_command* get_key_interpret_command(svec<int >);
-Input_command* get_clef_interpret_command(String w);
+Input_command *get_meterchange_command( int,int);
+Input_command *get_key_interpret_command(Array<int >);
+Input_command *get_clef_interpret_command(String w);
Input_command *get_reset_command();
Input_command *get_partial_command(Moment u);
Input_command *get_skip_command(int,Moment);
-Input_command *get_grouping_command(svec<int>);
-Input_command *get_bar_command( );
-
-svec<int> get_default_grouping(int count);
+Input_command *get_grouping_command(Array<int>);
+Input_command *get_bar_command(String);
+Input_command *get_newmeasure_command();
+Array<int> get_default_grouping(int count);
#endif // INPUTCOMMAND_HH
void reset();
void print()const;
- Staff_commands *parse() const;
+ void parse(Staff *) const;
};
#endif // INPUTCOMMANDS_HH
#ifndef ISCORE_HH
#define ISCORE_HH
-#include "vray.hh"
+#include "varray.hh"
#include "proto.hh"
#include "plist.hh"
/****************************************************************/
Input_score();
- Input_score(Input_score&);
- void add(svec<Input_command*> &s);
+ Input_score(Input_score const&);
+ void add(Array<Input_command*> &s);
void add(Input_staff*);
~Input_score();
/// construction
#include "string.hh"
#include "plist.hh"
-#include "vray.hh"
+#include "varray.hh"
#include "proto.hh"
struct Input_staff {
void add(Input_music*m);
Input_staff(Input_staff&);
Input_staff(String);
- void add(svec<Input_command*> &s);
- Staff* parse(PointerList<Input_command*>);
+ void add(Array<Input_command*> &s);
+ Staff* parse(PointerList<Input_command*>, Score*);
void print() const;
-
};
/// a horizontally fixed size element of the score
struct Item : Staff_elem {
/// indirection to the column it is in
- PCol * pcol_;
+ PCol * pcol_l_;
/****************/
#ifndef KEY_HH
#define KEY_HH
-#include "vray.hh"
+#include "varray.hh"
#include "scalar.hh"
class Key {
- svec<int> accidentals;
+ Array<int> accidentals;
/****************/
public:
- svec<int> read(svec<Scalar> );
- svec<int> oldkey_undo(svec<Scalar>);
+ Array<int> read(Array<Scalar> );
+ Array<int> oldkey_undo(Array<Scalar>);
Key();
void set(int i, int acc);
Local_key();
private:
- svec<Key> octaves;
+ Array<Key> octaves;
};
#endif // KEY_HH
#define KEYITEM_HH
#include "item.hh"
-#include "vray.hh"
+#include "varray.hh"
///
struct Keyitem : Item {
- svec<int> pitch;
- svec<int> acc;
+ Array<int> pitch;
+ Array<int> acc;
int c_position;
Keyitem(int cposition);
void add(int pitch, int acc);
- void read(svec<int> k);
+ void read(Array<int> k);
void preprocess();
#ifndef LEASTSQUARE_HH
#define LEASTSQUARE_HH
-#include "vray.hh"
+#include "varray.hh"
#include "offset.hh"
struct Least_squares {
- svec<Offset> input;
+ Array<Offset> input;
void minimise(Real &coef, Real &offset);
};
#include "glob.hh"
#include "plist.hh"
-#include "vray.hh"
+#include "varray.hh"
#include "vector.hh"
#include "interval.hh"
/// spacing for one line.
class Spacing_problem {
- svec<const Idealspacing*> ideals;
- svec<Colinfo> cols;
+ Array<const Idealspacing*> ideals;
+ Array<Colinfo> cols;
/// the index of #c# in #cols#
int col_id(const PCol *c) const;
public:
/// solve the spacing problem
- svec<Real> solve() const;
+ Array<Real> solve() const;
/**
return the column positions, and the energy (last element)
*/
#ifndef LOCALKEYITEM_HH
#define LOCALKEYITEM_HH
#include "item.hh"
-#include "vray.hh"
+#include "varray.hh"
struct Local_acc {
int name , acc, octave;
};
struct Local_key_item : Item {
- svec<Local_acc> accs;
- svec<Notehead*> group;
+ Array<Local_acc> accs;
+ Array<Notehead*> group;
int c0_position; // move into walker
/****************/
pos == -3: below staff
*/
- Symbol meter(svec<Scalar>);
+ Symbol meter(Array<Scalar>);
Symbol stem(Real y1_pos, Real y2_pos);
Symbol rule_symbol(Real height, Real width);
Symbol accidental(int);
#ifndef METER_HH
#define METER_HH
#include "item.hh"
-#include "vray.hh"
+#include "varray.hh"
struct Meter: Item {
- svec<Scalar> args;
+ Array<Scalar> args;
/****************/
- Meter(svec<Scalar> args) ;
+ Meter(Array<Scalar> args) ;
Molecule*brew_molecule() const;
};
#endif // METER_HH
/*
- (c) 1996 Han-Wen Nienhuys
+ (c) 1996,97 Han-Wen Nienhuys
*/
#ifndef MOMENT_HH
#define MOMENT_HH
#include "rational.hh"
-
+class String;
typedef Rational Moment;
+void error_t(String const &s, Moment when);
#endif //
struct Notehead : public Item
{
int position;
-
+ /// -1 = lowest, 0 = inside, 1 = top
+ int extremal;
/// needed for the help-lines
int staff_size;
int dots;
/// symbols, dimensions and constants
struct Paperdef {
- Lookup *lookup_;
+ Lookup *lookup_p_;
String outfile;
Real linewidth;
Paperdef(Lookup*);
void set(Lookup*);
~Paperdef();
+ Paperdef(Paperdef const&);
Real interline()const;
Real internote()const;
Real rule_thickness()const;
Voice_element * get_note_element(String,int * ,int *);
Voice_element* get_rest_element(String,int *);
Staff * get_new_melodicstaff();
-void add_requests( Voice_element*v, svec<Request*>&req);
+void add_requests( Voice_element*v, Array<Request*>&req);
Request* get_request(char);
void set_text_style(String);
Script_def* get_scriptdef(char);
/// prebreak is put before end of line.
- PCol *prebreak;
+ PCol *prebreak_p_;
/**
if broken here, then (*this) column is discarded, and prebreak
is put at end of line, owned by Col
*/
/// postbreak at beginning of the new line
- PCol *postbreak;
+ PCol *postbreak_p_;
/** \See{prebreak}
*/
- PCol *daddy;
+ PCol *daddy_l_;
/** if this column is pre or postbreak, then this field points to
the parent. */
/// if lines are broken then this column is in #line#
- const Line_of_score *line;
+ const Line_of_score *line_l_;
/// if lines are broken then this column x-coord #hpos#
Real hpos;
- PScore * pscore_;
+ PScore * pscore_l_;
/****************/
/// which one (left =0)
int rank() const;
+
/// does this column have items, does it have spacings attached?
bool used() const;
void OK() const;
void set_breakable();
void print()const;
+private:
+ PCol(PCol const&){}
};
/**
This is a class to address items vertically. It contains the data for:
struct Absdynamic_req;
struct Accidental;
struct Atom;
+struct Barcheck_req;
struct Beam;
struct Beam_req;
struct Box;
#define PSCORE_HH
#include "break.hh"
-#include "vray.hh"
+#include "varray.hh"
#include "pcol.hh"
#include "pstaff.hh"
/// all stuff which goes onto paper
struct PScore {
- Paperdef *paper_; // indirection.
+ Paperdef *paper_l_;
/// the columns, ordered left to right
IPointerList<PCol *> cols;
IPointerList<Spanner*> broken_spans;
/****************/
-
- void add_broken(Spanner*);
-
- svec<Item*> select_items(PStaff*, PCol*);
-
- /// before calc_breaking
- void preprocess();
-
- void calc_breaking();
- /**
- calculate where the lines are to be broken.
-
- POST
-
- lines contain the broken lines.
- */
-
- /// after calc_breaking
- void postprocess();
+ /* CONSTRUCTION */
+ PScore(Paperdef*);
/// add a line to the broken stuff. Positions given in #config#
- void set_breaking(svec< Col_configuration> );
+ void set_breaking(Array<Col_configuration>);
void add(PStaff *);
/// add item
void typeset_item(Item *, PCol *,PStaff*,int=1);
- /// add an Spanner
+ /// add a Spanner
void typeset_spanner(Spanner*, PStaff*);
/// add to bottom of pcols
void add(PCol*);
- /**
+ void add_broken(Spanner*);
+
+ /* INSPECTION */
+ Array<Item*> select_items(PStaff*, PCol*);
+
+ /// return argument as a cursor.
+ PCursor<PCol *> find_col(const PCol *)const;
+
+ /* MAIN ROUTINES */
+ void process();
- */
+ /// last deed of this struct
void output(Tex_stream &ts);
- Idealspacing* get_spacing(PCol *, PCol *);
- /*
- get the spacing between c1 and c2, create one if necessary.
- */
+ /* UTILITY ROUTINES */
- /// return argument as a cursor.
- PCursor<PCol *> find_col(PCol *)const;
+ /// get the spacing between c1 and c2, create one if necessary.
+ Idealspacing* get_spacing(PCol *c1, PCol *c2);
- /// delete unused columns
- void clean_cols();
+ /// connect c1 and c2
+ void do_connect(PCol *c1, PCol *c2, Real distance_f, Real strength_f);
- /// invarinants
+ /// connect c1 and c2 and any children of c1 and c2
+ void connect(PCol* c1, PCol *c2, Real distance_f,Real strength_f= 1.0);
+
+ /* STANDARD ROUTINES */
void OK()const;
-
- PScore(Paperdef*);
void print() const;
+private:
+ /// before calc_breaking
+ void preprocess();
+
+ /// calculate where the lines are to be broken, and use results
+ void calc_breaking();
- /// which is first (left, higher)
- int compare_pcols( PCol*, PCol*)const;
+ /// after calc_breaking
+ void postprocess();
+
+ /// delete unused columns
+ void clean_cols();
};
/** notes, signs, symbols in a score can be grouped in two ways:
horizontally (staffwise), and vertically (columns). #PScore#
/// items grouped horizontally
struct PStaff {
- Molecule * stafsym;
- PScore * pscore_;
+ Molecule * stafsym_p_;
+ PScore * pscore_l_;
PointerList<const Spanner*> spans;
void add(Item*i);
PStaff(PScore*);
virtual ~PStaff();
+private:
+ PStaff(PStaff const&);
};
#endif
class Ineq_constrained_qp {
friend class Active_constraints;
- svec<Vector> cons;
- svec<Real> consrhs;
+ Array<Vector> cons;
+ Array<Real> consrhs;
public:
Matrix quad;
Vector lin;
/// Quadratic programming with mixed linear constraints
class Mixed_qp :public Ineq_constrained_qp {
- svec<int> eq_cons;
- svec<Real> eq_consrhs;
+ Array<int> eq_cons;
+ Array<Real> eq_consrhs;
public:
Mixed_qp(int n);
void OK() const;
Matrix A,H;
- svec<int> active;
- svec<int> inactive; // actually this is a set, not an array.
+ Array<int> active;
+ Array<int> inactive; // actually this is a set, not an array.
const Ineq_constrained_qp *opt;
public:
int constraint_id() const { return ac->inactive[j]; }
Vector vec() const { return ac->vec(constraint_id()); }
Real rhs() const { return ac->rhs(constraint_id()); }
- bool ok() const { return j < ac->inactive.sz(); }
+ bool ok() const { return j < ac->inactive.size(); }
};
/**
loop through the inactive constraints.
/// a voice element wants something printed
struct Request {
- Voice_element*elt; // indirection.
+ Voice_element*elt_l_;
/****************/
Request();
+ Request(Request const&);
virtual ~Request(){}
virtual void print()const ;
+ virtual Moment duration() const { return 0.0; }
+ virtual Request* clone() const =0;
+
+ /* accessors for children */
+ virtual Barcheck_req *barcheck() { return 0; }
virtual Note_req *note() {return 0;}
virtual Script_req *script() {return 0;}
virtual Stem_req *stem() {return 0;}
virtual Slur_req *slur() { return 0 ; }
virtual Rhythmic_req*rhythmic() { return 0; }
virtual Melodic_req *melodic() { return 0; }
- virtual Moment duration() const { return 0.0; }
- virtual Request* clone() const =0;
};
/**
see lilygut page
*/
+struct Barcheck_req : Request {
+ virtual Barcheck_req *barcheck() { return this; }
+ void print ()const;
+ Request*clone() const;
+};
/// a request with a duration
struct Rhythmic_req : virtual Request {
NOSPAN, START, STOP
} spantype ;
+ virtual void print() const;
Span_req*span() { return this; }
Span_req();
virtual Request*clone()const;
/// a slur
struct Slur_req : Span_req {
+
virtual Request*clone()const;
virtual Slur_req*slur() { return this; }
};
Request *clone()const;
Script_req(int d, Script_def*);
~Script_req();
+ Script_req(Script_req const&);
};
/** eg upbow, downbow. Why a request? These symbols may conflict with
slurs and brackets, so this also a request */
virtual void print() const;
Request *clone()const;
Text_req(int d, Text_def*);
- ~Text_req();
+ ~Text_req();
+ Text_req(Text_req const&);
};
#ifndef SCCOL_HH
#define SCCOL_HH
#include "proto.hh"
-#include "vray.hh"
+#include "varray.hh"
#include "moment.hh"
struct Score_column {
/// indirection to column
- PCol * pcol_;
+ PCol * pcol_l_;
/// length of notes/rests in this column
- svec<Moment> durations;
+ Array<Moment> durations;
- Moment when;
-
///
- bool musical;
+ bool musical_;
/****************/
-
+ Moment when() { return when_; }
Score_column(Moment when);
static int compare(Score_column & c1, Score_column &c2);
void add_duration(Moment );
void set_breakable();
bool used();
void print() const;
+
+private:
+ Moment when_;
};
/**
#ifndef SCORE_HH
#define SCORE_HH
-#include "vray.hh"
+#include "varray.hh"
#include "proto.hh"
#include "plist.hh"
#include "moment.hh"
/// the total music def of one movement
struct Score {
/// paper_, staffs_ and commands_ form the problem definition.
- Paperdef *paper_;
+ Paperdef *paper_p_;
IPointerList<Staff*> staffs_;
/// "runtime" fields for setting up spacing
IPointerList<Score_column*> cols_;
- PScore *pscore_;
+ PScore *pscore_p_;
/****************************************************************/
~Score();
void add(Staff*);
-
-
- void OK() const;
- PCursor<Score_column *> find_col(Moment,bool);
+ /// do everything except outputting to file
void process();
+
+ /// output to file
void output(String fn);
- PCursor<Score_column*> create_cols(Moment);
+
+ // standard
+ void OK() const;
void print() const;
+
+ // utils:
+ PCursor<Score_column*> create_cols(Moment);
+ PCursor<Score_column *> find_col(Moment,bool);
+ /// when does the last *musical* element finish?
Moment last() const;
private:
- void do_pcols();
+ Score(Score const&){}
+ void do_cols();
+ /**
+ make the pcol_l_ fields of each Score_column point to the correct PCol,
+ remove any unnecessary Score_column's
+ */
+
+ /// remove unused cols
void clean_cols();
- void distribute_commands();
- void do_connect(PCol *c1, PCol *c2, Real d,Real);
- void connect(PCol* c1, PCol *c2, Real d,Real = 1.0);
/// add #Idealspacings# to #pscore_#
void calc_idealspacing();
#define SCORELINE_HH
#include "plist.hh"
#include "proto.hh"
-#include "vray.hh"
+#include "varray.hh"
/// the columns of a score that form one line.
struct
// need to store height of each staff.
IPointerList<Line_of_staff*> staffs;
- PScore * pscore_; // needed to generate staffs
+ PScore * pscore_l_; // needed to generate staffs
/****************/
void process() ;
- Line_of_score(svec<PCol *> sv, PScore *);
+ Line_of_score(Array<PCol *> sv, PScore *);
String TeXstring() const;
int symdir;
int pos;
int staffsize;
- Script_def*specs;
- Stem * stem_;
+ Script_def*specs_l_;
+ Stem * stem_l_;
Item * support;
/****************/
void set_symdir();
void set_default_dir();
void set_default_pos();
-
+ Symbol symbol()const;
Molecule* brew_molecule()const;
virtual void do_post_processing();
virtual void do_pre_processing();
struct Simple_staff;
struct Note_info {
Rhythmic_req *rq;
- svec<Script_req*> scripts;
+ Array<Script_req*> scripts;
Note_info();
Note_info(Rhythmic_req*);
};
/// column of Simple_staff: store one request
struct Simple_column : Staff_column {
- svec<Note_info> notes;
- svec<Slur_req *> slurs;
+ Array<Note_info> notes;
+ Array<Slur_req *> slurs;
Stem_req *stem_;
Moment stem_requester_len;
Beam_req *beam_;
struct Simple_walker: Staff_walker {
Stem *stem_;
- svec<Notehead *>noteheads;
+ Array<Notehead *>noteheads;
Local_key local_key_;
Key key_;
- svec<int> *oldkey_undo;
- svec<int> typesetkey;
+ Array<int> *oldkey_undo;
+ Array<int> typesetkey;
Beam *beam_;
Local_key_item *local_key_item_;
bool wantkey; // urgh
+ int processed_bar_priority;
bool processed_key;
bool processed_clef;
Clef clef_;
Rhythmic_grouping default_grouping;
Rhythmic_grouping *current_grouping;
- svec<Slur_req*> pending_slur_reqs;
- svec<Slur*> pending_slurs;
-
+ Array<Slur_req*> pending_slur_reqs;
+ Array<Slur*> pending_slurs;
+
/****************/
virtual void do_TYPESET_command(Command*);
#include "directionalspanner.hh"
#include "fproto.hh"
-#include "vray.hh"
+#include "varray.hh"
struct Slur : Directional_spanner {
- svec<Notehead*> encompass;
+ Array<Notehead*> encompass;
//int dir;
bool open_left,open_right;
/// synchronous horizontal stuff
IPointerList<Voice*> voices;
- /// commands in chronological order
- Staff_commands *staff_commands_;
-
/// runtime field
IPointerList<Staff_column*> cols;
- /// indirections to the Score and PScore
- Score *score_;
- PScore *pscore_;
+ Score *score_l_;
+ PScore *pscore_l_;
/****************************************************************/
void add(PointerList<Voice*> &s);
- void process_commands(Moment l);
+
+ /// throw away cols later the #l#
+ void truncate_cols(Moment l);
Staff(const Staff&src);
void add_voice(Voice *v);
void add_staff_column(Staff_column *sp);
Paperdef*paper()const;
+
/// interpret all requests and add items to #destination#.
void process();
/**
This routines calls virtual functions from Staff, to delegate the
interpretation of requests to a derived class of Staff */
+
+
void setup_staffcols();
void OK() const;
void print() const;
+
+ /// when does the last *musical* element finish?
Moment last() const;
+
+ /// remove unused cols
void clean_cols() ;
+
Staff_column * get_col(Moment,bool);
Staff();
virtual void walk()=0;
virtual Staff_column * create_col(Score_column * )=0;
virtual ~Staff() { }
+private:
+ void set_time_descriptions();
};
#endif
#include "proto.hh"
#include "command.hh"
-#include "vray.hh"
+#include "varray.hh"
#include "plist.hh"
#include "timedescription.hh"
void add(Command c);
};
-/// the list of commands in Score
-struct Staff_commands : public IPointerList<Staff_commands_at*>
-{
- Staff_commands_at*find(Moment);
- void add(Staff_commands_at*);
- void clean(Moment last);
- void OK() const;
- void print() const;
- Moment last() const;
-};
-/** the list of commands in Score. Put in a separate class, since it
- otherwise clutters the methods of Score.
-
- */
-
#endif
#ifndef STAFFELEM_HH
#define STAFFELEM_HH
-#include "vray.hh"
+#include "varray.hh"
#include "proto.hh"
#include "offset.hh"
#include "molecule.hh"
OUTPUT, // molecule has been output
} status;
bool calc_children;
- svec<Staff_elem*> dependencies;
+ Array<Staff_elem*> dependencies;
- /// indirection to the pstaff it is in
- PStaff *pstaff_;
+ /// the pstaff it is in
+ PStaff *pstaff_l_;
/****************/
-
+ Staff_elem(Staff_elem const&);
String TeXstring () const ;
virtual void print() const;
virtual Interval width() const;
#include "real.hh"
#include "plist.hh"
-#include "vray.hh"
+#include "varray.hh"
#include "glob.hh"
#include "pstaff.hh"
/// one broken line of staff.
struct Line_of_staff {
- Line_of_score * line_of_score_;
- PStaff *pstaff_;
+ Line_of_score * line_of_score_l_;
+ PStaff *pstaff_l_;
/****************/
#ifndef STCOL_HH
#define STCOL_HH
#include "proto.hh"
-#include "vray.hh"
+#include "varray.hh"
#include "moment.hh"
/// store simultaneous requests
struct Staff_column {
- /// indirection
- Score_column *score_column;
+
+ Score_column *score_column_l_;
/// fields to collect data vertically.
- svec<Voice_element *> v_elts;
+ Array<Voice_element *> v_elts;
/// idem
- Staff_commands_at *s_commands;
+ Staff_commands_at *staff_commands_p_;
Time_description *tdescription_;
bool mus() const;
Moment when() const;
void add(Voice_element*ve);
-
+ void OK() const;
/****************************************************************
VIRTUAL
****************************************************************/
virtual void process_requests()=0;
virtual ~Staff_column();
+private:
+ Staff_column(Staff_column const&){}
};
#ifndef STEM_HH
#define STEM_HH
#include "item.hh"
-#include "vray.hh"
+#include "varray.hh"
#include "moment.hh"
/// the rule attached to the ball
Real stem_xoffset;
- svec<Notehead*> heads;
+ Array<Notehead*> heads;
/****************/
Stem(int center, Moment duration);
virtual void process_requests()=0;
virtual void do_TYPESET_command(Command*)=0;
virtual void do_INTERPRET_command(Command*)=0 ;
+private:
+ Staff_walker(Staff_walker const&);
};
/**
manage run-time info when walking staffcolumns such as: key,
/// parameter substitution in TeXstrings
String
-substitute_args(String source, svec<String> args);
+substitute_args(String source, Array<String> args);
/**
this structure provides a simple macro mechanism:
/// parameter substitution in TeXstrings
String
-substitute_args(String source, svec<Scalar> args);
+substitute_args(String source, Array<Scalar> args);
/// #h# is in points
String vstrut(Real h);
/****************/
void OK() const;
Time_description(Rational, const Time_description*);
+ String str()const;
void print() const;
void setpartial(Rational p);
Rational barleft();
void set_meter(int,int);
+ static int compare (Time_description&, Time_description&);
};
+#include "compare.hh"
+
+
+instantiate_compare(Time_description&,Time_description::compare);
+
#endif // Time_description_HH
/// close the file
~Tex_stream();
+private:
+ Tex_stream(Tex_stream const&);
};
/**
Use this class for writing to a TeX file.
DFILES=dutch.ini table_sixteen.ini table_twenty.ini\
english.ini script.ini
+default:
+ echo huh?
+
dist:
ln Makefile $(DFILES) $(DDIR)/$(INITDIR)
% indexstring same_dir_as_stem above_below_staff symbol_can_beinverted }
%
+accent = script { "sforzato" -1 0 0 }
+marcato = script { "marcato" -1 0 1 }
+staccatissimo = script { "staccatissimo" -1 0 1 }
+portato= script { "portato" -1 0 1 }
fermata = script { "fermata" 1 0 1 }
stopped = script { "stopped" 0 1 0 }
-accent = script { "accent" -1 0 0 }
staccato = script { "staccato" -1 0 0 }
-staccatissimo = script { "staccatissimo" 1 0 1 }
+tenuto = script {"tenuto" -1 0 0 }
portato = script { "portato" -1 0 0 }
-marcato = script { "marcato" -1 0 1 }
upbow = script { "upbow" 0 1 0 }
downbow = script { "downbow" 0 1 0 }
"fermata" "\fermata" 0pt 0pt 0pt 11.25pt
"-fermata" "\ifermata" 0pt 0pt -11.25pt 0pt
"portato" "\portato" 0pt 0pt 0pt 0pt
- "accent" "\maccent" -1pt 8pt 0pt 0pt
- "marcato" "\marcato" 0pt 0pt 0pt 11.25pt
- "-marcato" "\imarcato" 0pt 0pt -11.25pt 0pt
+ "-portato" "\iportato" 0pt 0pt 0pt 0pt
+ "tenuto" "\tenuto" 0pt 0pt 0pt 0pt
+ "-tenuto" "\itenuto" 0pt 0pt 0pt 0pt
+ "sforzato" "\sforzato" -0.8pt 4.8pt -1.92pt 1.92pt
+ "marcato" "\marcato" 0pt 4.8pt 0pt 4pt
+ "-marcato" "\imarcato" 0pt 4.8pt -4pt 0pt
"staccato" "\staccato" 0pt 0pt 0pt 5pt
"staccatissimo" "\staccatissimo" 0pt 0pt 0pt 7.5pt
- "istaccatissimo" "\staccatissimo" 0pt 0pt -7.5pt 0pt
+ "-staccatissimo" "\istaccatissimo" 0pt 0pt -7.5pt 0pt
"upbow" "\upbow" -1pt 6pt 0pt 5pt
"downbow" "\downbow" 0pt 5pt 0pt 7.5pt
}
}
"bars" = table {
- "empty" "\emptybar" 0pt 0pt 0pt 0pt
- "|" "\maatstreep" 0pt 5pt -12pt 12pt
- "||" "\finishbar" 0pt 2pt -12pt 12pt
+ "empty" "\emptybar" 0pt 0pt 0pt 0pt
+ "|" "\maatstreep" 0pt 5pt -8pt 8pt
+ "||" "\finishbar" 0pt 2pt -8pt 8pt
+ ":|" "\repeatbar" -4pt 0pt -8pt 8pt
+ "|:" "\startrepeat" 0pt 4pt -8pt 8pt
+ ":|:" "\repeatbarstartrepeat" 0pt 8pt -8pt 8pt
+
}
"rests" = table {
\octave {} % set the default octave
% the default note duratino is 4
%%% theme
- c c g g a a
- g2 % g2 means a "g-1" pitched half-note
- f f e e d d c2
- g g f f e e d d g g f f e e d d
+ c c | % the '|' checks if there is a new measure here.
+ g g|
+ a a|
+
+ g2| % g2 means a "g-1" pitched half-note
+ f f| e e| d d| c2
+ g g| f f| e e| d d| g g| f f| e e| d d|
%%% var 1
c r8 c8 % r8 means an 8th rest.
- ( % start a slur
+ (| % start a slur
% NOTE: the slurstart should be directly after the note
) % end a slur.
- g r8 g8 ( ) a r8 a8 ( ) g r4
- f r8 f8 ( ) e4 r8 e8 ( ) d4 r8 d8 ( ) c4 r4
+ g r8 g8 (| ) a r8 a8 (| ) g r4
+ f r8 f8 (| ) e4 r8 e8 ( |) d4 r8 d8 (| ) c4 r4
$}
% more of this.
music { begeleiding } % use the declared music
commands { % commands with Staff-wide impact.
clef bass % bass-clef
-
}
}
vstaf = staff {
melodic
music { melodie }
+ commands { clef violin }
% default clef is violin clef
}
}
commands {
meter 2 4 % a 2/4 meter.
- skip 32:0 % skip 32 measures, and generate the bars
- meter 6 8 % another meter
+ skip 33:0 % skip 32 measures, and generate the bars
+% meter 6 8 % another meter
}
}
%%
%% include file for LilyPond
-\def\mdef#1#2{\def#1{{\musicfnt\char#2}}}
+\def\mdef#1#2{\def#1{\mchar{#2}}}
+\def\mchar#1{\musicfnt\char#1}
+\def\rationalmultiply#1*#2/#3{\multiply #1 by #2 \divide #1 by #3}
+\def\maccentraise#1#2{\dimen0=\noteheight
+ \rationalmultiply\dimen0*#2%
+ \raise\dimen0\hbox{#1}}
+\def\maccentdef#1#2#3{\def#1{\maccentraise{\mchar{#2}}{#3}}}
+\def\vcenter#1{\vbox to 0pt{\vss #1\vss}}
+
+\def\topalign#1{\vbox to 0pt{#1\vss}}
+\def\botalign#1{\vbox to 0pt{\vss #1}}
+
+\def\centeralign#1{\hbox to 0pt{\hss#1\hss}}
+\def\leftalign#1{\hbox to 0pt{#1\hss}}
+\def\rightalign#1{\hbox to 0pt{\hss#1}}
+
%% musix defs
\parindent=0pt
\newcount\n
\newdimen\balkhoog
\newdimen\notewidth
+ \newdimen\noteheight
\newdimen\notewidthhalf
\newdimen\notewidthdouble
\newdimen\staffrulethickness
\font\italicfont=cmti10
\balkhoog=20pt
\notewidth=6pt
+ \noteheight=5pt
\staffrulethickness=0.4pt
-
\musixcalc
}
+
+
\def\musixsixteendefs{
\font\textfont=cmr8
\font\meterfont=cmbx12
\balkhoog=16pt
\staffrulethickness=0.4pt
\notewidth=5pt
+ \noteheight=4pt
\musixcalc
}
\advance\interstaffrule by -\staffrulethickness
\notewidthhalf=\notewidth
\notewidthdouble=\notewidth
- \divide \notewidthhalf by 2
+ \rationalmultiply \notewidthhalf*1/2
\multiply \notewidthdouble by 2
- \balkhalf=\balkhoog
- \divide \balkhalf by 2
+ \balkhalf=\balkhoog
+ \rationalmultiply\balkhalf*1/2
}
-
+\def\dyn{\italicfont}
\def\slurcharh#1{{\slurhfont\char#1}}
\def\slurcharu#1{{\slurufont\char#1}}
\def\maatstreep{\vrule height\balkhoog}
\def\finishbar{\vrule height\balkhoog width 1pt}
+\maccentdef\repeatcolon{55}{2/1}
+
+\def\repeatbar{\rightalign{\repeatcolon\kern 2pt\finishbar}}
+\def\startrepeat{\hbox{\finishbar\kern 2pt\repeatcolon}}
+\def\repeatbarstartrepeat{\hbox{\repeatbar\kern 1pt\startrepeat}}
+
\def\generalmeter#1#2{\botalign{\vbox to\balkhalf{\vss \meterfont#1}%
\nointerlineskip
\vbox to \balkhalf{\vss\meterfont #2}}}
-\def\lineseparator{\vbox{\mussepline\vskip -5pt\mussepline}}
-
+\def\defaultlineseparator{\vbox{\mussepline\vskip -5pt\mussepline}}
+\def\lineseparator{\defaultlineseparator}
\def\beauty{%
\par\vskip 10pt plus 30pt minus 10pt\par
\hskip -5pt\lineseparator
\def\ldoubledot{\kern-\notewidth\doubledot}
\def\ltripledot{\kern-\notewidth\tripledot}
-\mdef\maccent{30}
+\maccentdef\sforzato{30}{-3/2}
+\maccentdef\marcato{20}{-1/1}
+\maccentdef\imarcato{21}{1/1}
+\maccentdef\staccato{24}{-1/1}
+\maccentdef\istaccato{25}{1/1}
+\maccentdef\staccatissimo{28}{-1/1}
+\maccentdef\istaccatissimo{29}{1/1}
+\maccentdef\portato{18}{-9/10}
+\maccentdef\iportato{19}{9/10}
+\maccentdef\tenuto{26}{0/1}
+\maccentdef\itenuto{27}{0/1}
\mdef\fermata{80}
\mdef\ifermata{81}
-\mdef\iaccent{31}
-\mdef\msxmarcato{20}
-\def\marcato{\botalign{\msxmarcato}}
-\mdef\msximarcato{21}
-\def\imarcato{\topalign{\msximarcato}}
-\mdef\staccato{24}
-\mdef\istaccato{25}
-\mdef\staccatissimo{16}
-\mdef\istaccatissimo{17}
+
+
+
\mdef\spicato{28}
\mdef\ispicato{29}
-\mdef\upbow{22}
-\mdef\downbow{23}
+\mdef\upbow{23}
+\mdef\downbow{22}
\mdef\portato{26}
\def\stem#1#2{\vrule height#2 depth-#1}
\def\settext#1{\textfont #1}
\def\setitalic#1{\italicfont #1}
-
-\def\vcenter#1{\vbox to 0pt{\vss #1\vss}}
-
-\def\topalign#1{\vbox to 0pt{#1\vss}}
-\def\botalign#1{\vbox to 0pt{\vss #1}}
-
-\def\centeralign#1{\hbox to 0pt{\hss#1\hss}}
-\def\leftalign#1{\hbox to 0pt{#1\hss}}
$}
commands {
-% skip 0:0.125
+
skip 3:0%BUG
key $ fis cis gis $
skip 2:0
commands {
meter 4 4
partial 8
- skip 1:0
- skip 2:0
+ skip 1:2
+ bar ":|:"
+ skip 2:0
meter 2 4
skip 19:0
}
\duration { 8}
% 1
- d2( [)d e cis `b]
- `a4 [`b cis] [cis `b] `b4
- fis2( [)fis g e d]
- cis4 [d e(] [)e fis d cis]
- `b4 [cis d(] [)d e cis `b]
- cis2 r2^"c\'edez"
- r4 fis2 fis4
- fis2^"en mesure" ()[fis e a fis]
- fis4-- e4-- d4-- e4--
- `b2()[`b^"un peu retenu" `a( d cis]
+ d2( [)d e cis `b] |
+ `a4 [`b cis] [cis `b] `b4 |
+ fis2( [)fis g e d] |
+ cis4 [d e(] [)e fis d cis] |
+ `b4 [cis d(] [)d e cis `b] |
+ cis2 r2^"c\'edez" |
+ r4 fis2 fis4 |
+ fis2^"en mesure" ()[fis e a fis]|
+ fis4-- e4-- d4-- e4-- |
+ `b2()[`b^"un peu retenu" `a( d cis]|
% 11
- )`b [`fis^"en \'elargissant"-- `a-- `b--] cis4-- `b4--
- `fis2 r2
+ )`b [`fis^"en \'elargissant"-- `a-- `b--] cis4-- `b4--|
+ `fis2 r2 |
cis4^"1er mouvement" d4^"tr\`es lontain" ()[d cis d e]
\octave { }
- a4 gis2.
- a4 b4()[b a b 'cis]
- fis4 e4 cis2
- e4 fis4 () [fis e fis gis]
- cis4 `b4()`b8 r8 r4^"tr\`es soutenu"
+ | a4 gis2. |
+ a4 b4()[b a b 'cis] |
+ fis4 e4 cis2 |
+ e4 fis4 () [fis e fis gis] |
+ cis4 `b4()`b8 r8 r4^"tr\`es soutenu" |
- r4 r4 %2/4 meter
+ r4 r4 | %2/4 meter
- 'cis4_"ppp" 'd4 () ['d 'cis 'd 'e]
- a4 gis2.
- a4 b4()[b a b 'cis]
- fis4 e4 cis2
- e4_"pp" fis4()[fis e fis gis]
- cis4_"mf" `b4()`b8 r8 r4^"un peu plus lent"
- r1
- r2 r4 r4%^\fermata
+ 'cis4_"\dyn ppp" 'd4 () ['d 'cis 'd 'e] |
+ a4 gis2. |
+ a4 b4()[b a b 'cis] |
+ fis4 e4 cis2 |
+ e4_"\dyn pp" fis4()[fis e fis gis] |
+ cis4_"\dyn mf" `b4()`b8 r8 r4^"un peu plus lent" |
+ r1 |
+ r2 r4 r4 %^\fermata
%% cut 'n paste.
\octave { ' }
- d2^"Reprenez le mouvement"( [)d e cis `b]
- `a4 [`b cis] [cis `b] `b4
- fis2( [)fis g e d]
- cis4 [d e(] [)e fis d cis]
- `b4 [cis d(] [)d e cis `b]
- cis2 r2^"c\'edez"
- r4 fis2 fis4
- fis2^"en mesure"()[fis e a fis]
- fis4-- e4-- d4-- e4--
- `b2() [`b `a-. d-. cis-.]
- `b-. [`fis^"large" `a `b] cis4 `b4 `fis2 r2
- r1
+ | d2^"Reprenez le mouvement"( [)d e cis `b] |
+ `a4 [`b cis] [cis `b] `b4 |
+ fis2( [)fis g e d] |
+ cis4 [d e(] [)e fis d cis] |
+ `b4 [cis d(] [)d e cis `b] |
+ cis2 r2^"c\'edez" |
+ r4 fis2 fis4 |
+ fis2^"en mesure"()[fis e a fis] |
+ fis4-- e4-- d4-- e4-- |
+ `b2() [`b `a-. d-. cis-.] |
+ `b-. [`fis^"large" `a `b] cis4 `b4 `fis2 r2 |
+
+ %% mark B
+ r1^"1er mouvement"
\duration {8}
- r2 [c-.( e-. c-. )`a-. ]
- \plet {2/3}\octave{}
- [c e a ] \plet{1/1} b4-> () [b c-- e-- a--]
- b4. b8()g2
- r1
- r2
- [f a f d]
+ | r2 [c-.( e-. c-. )`a-. ]
+ \plet {2/3}\octave{} |
+ | [c e a ] \plet{1/1} b4-> () [b c-- e-- a--] |
+ b4. b8()g2 |
+ r1 |
+ r2 [f a f d]
\plet {2/3}
- [f a 'c] \plet{1/1} 'e4-^ () ['e f-> a-> 'c->]
- e4._"sf" e8()c4 r4
- r1
- r4 r4-\fermata
+ | [f a 'c] \plet{1/1} 'e4-^ () ['e f-> a-> 'c->] |
+ 'e4._"sf" 'e8()'c4 r4 |
+ r1 |
+ r4 r4-\fermata
\octave { ' }
- d2( [)d e cis `b]
- `a4 [`b cis] [cis `b] `b4
- fis2( [)fis g e d]
- cis4 [d e(] [)e fis d cis]
- `b4 [cis d(] [)d e cis `b]
- cis2 r2^"c\'edez"
- r4 fis2 fis4
- fis2()[fis e a fis]
- fis4-- e4-- d4-- e4--
- \octave{ }
- b2()[b a 'd 'cis]
- b [fis a b ] 'cis4 b4
- fis2 r2
- r1-\fermata
+ |d2( [)d e cis `b] |
+ `a4 [`b cis] [cis `b] `b4 |
+ fis2( [)fis g e d] |
+ cis4 [d e(] [)e fis d cis] |
+ `b4 [cis d(] [)d e cis `b] |
+ cis2 r2^"c\'edez" |
+ r4 fis2 fis4 |
+ fis2()[fis e a fis] |
+ fis4-- e4-- d4-- e4--
+ \octave{ }
+ | b2()[b a 'd 'cis] |
+ b [fis a b ] 'cis4 b4 |
+ fis2 r2 |
+ r1-\fermata
$}
commands {
key $fis cis $
horn
}
paper {
- symboltables { table_sixteen}
+ output "pavane.out"
unitspace 1.5 cm
geometric 1.4
}
- commands {meter 4 4
-
+ commands {
+ meter 4 4
skip 18:0
meter 2 4
skip 1:0
meter 4 4
- skip 29:0
+ skip 20:0
+ bar "|:"
+ skip 9:0
meter 2 4
skip 1:0
+ bar ":|"
meter 4 4
skip 13:0
+ bar "||"
}
}
\ No newline at end of file
--- /dev/null
+\documentclass{article} %UGH
+\usepackage{a4}
+\begin{document}
+\input lilyponddefs
+\input titledefs
+\def\interscoreline{\vskip12pt}
+\title{Pavane pour une Infante d\'efunte}
+\composer{Maurice Ravel}
+\instrument{Cor en Fa}
+\maketit
+\input pavane.out
+\end{document}
--- /dev/null
+
+blah =
+staff {melodic
+ music{ $ c1
+ \duration { 8}
+ [c-> d-> e-> f->][g-> a-> b-> 'c->]
+\octave{'} ['c-^ b-^ a-^ g-^][f-^ e-^ d-^ c-^]
+
+\octave{} ['c-^ b-^ a-^ g-^][f-^ e-^ d-^ c-^]
+
+ [c-. d-. e-. f-.][g-. a-. b-. 'c-.]
+ ['c-- b-- a-- g][f-- e-- d c--]
+ [c-\portato d-\portato e-\portato f-\portato][g-\portato a-\portato b-\portato 'c-\portato]
+ ['c-\upbow b-\upbow a-\downbow g-\downbow][f-\downbow e-\downbow d-\upbow c-\upbow]
+ [c-| d-| e-| f-|][g-| a-| b-| 'c-|]
+ ['c b a g][f e d c]
+ [c d e f][g a b 'c]
+ ['c b a g][f e d c]
+ $}
+ commands {
+ }
+}
+score {
+ staff {
+ blah
+ }
+ paper {
+ symboltables { table_sixteen}
+ unitspace 1.5 cm
+ geometric 1.4
+ }
+ commands {meter 4 4
+
+ skip 18:0
+ }
+}
\ No newline at end of file
Molecule*
Bar::brew_molecule()const
{
- Symbol s = paper()->lookup_->bar(type);
+ Symbol s = paper()->lookup_p_->bar(type);
Molecule* output = new Molecule(Atom(s));
return output;
Beam::Beam()
{
- group = 0;
slope = 0;
left_pos = 0.0;
dir =0;
void
Beam::solve_slope()
{
- svec<Stem_info> sinfo;
+ Array<Stem_info> sinfo;
for (iter_top(stems,i); i.ok(); i++) {
i->set_default_extents();
Stem_info info(i);
}
Real leftx = sinfo[0].x;
Least_squares l;
- for (int i=0; i < sinfo.sz(); i++) {
+ for (int i=0; i < sinfo.size(); i++) {
sinfo[i].x -= leftx;
l.input.add(Offset(sinfo[i].x, sinfo[i].idealy));
}
l.minimise(slope, left_pos);
Real dy = 0.0;
- for (int i=0; i < sinfo.sz(); i++) {
+ for (int i=0; i < sinfo.size(); i++) {
Real y = sinfo[i].x * slope + left_pos;
Real my = sinfo[i].miny;
// URG
Real sl = slope*paper()->internote();
- paper()->lookup_->beam(sl, convert_dimen(20,"pt"));
+ paper()->lookup_p_->beam(sl, convert_dimen(20,"pt"));
slope = sl /paper()->internote();
}
{
def.OK();
cur.OK();
- assert(cur.children.sz() == stems.size());
+ assert(cur.children.size() == stems.size());
cur.split(def);
- group = new Rhythmic_grouping(cur);
- svec<int> b;
+
+ Array<int> b;
{
iter_top(stems,s);
- svec<int> flags;
+ Array<int> flags;
for (; s.ok(); s++) {
int f = intlog2(abs(s->flag))-2;
assert(f>0);
flags.add(f);
}
int fi =0;
- b= group->generate_beams(flags, fi);
+ b= cur.generate_beams(flags, fi);
b.insert(0,0);
b.add(0);
- assert(stems.size() == b.sz()/2);
+ assert(stems.size() == b.size()/2);
}
iter_top(stems,s);
- for (int i=0; i < b.sz() && s.ok(); i+=2, s++) {
+ for (int i=0; i < b.size() && s.ok(); i+=2, s++) {
s->beams_left = b[i];
s->beams_right = b[i+1];
}
void
Beam::do_pre_processing()
{
- left = (*stems.top()) ->pcol_;
- right = (*stems.bottom())->pcol_;
+ left = (*stems.top()) ->pcol_l_;
+ right = (*stems.bottom())->pcol_l_;
assert(stems.size()>1);
if (!dir)
set_default_dir();
Real dy=paper()->internote()*2;
Real stemdx = paper()->rule_thickness();
Real sl = slope*paper()->internote();
- paper()->lookup_->beam(sl, convert_dimen(20,"pt"));
+ paper()->lookup_p_->beam(sl, convert_dimen(20,"pt"));
Molecule leftbeams;
Molecule rightbeams;
int lhalfs= lhalfs = here->beams_left - prev->beams_right ;
int lwholebeams= here->beams_left <? prev->beams_right ;
Real w = (here->hpos() - prev->hpos())/4;
- Atom a = paper()->lookup_->beam(sl, w);
+ Atom a = paper()->lookup_p_->beam(sl, w);
a.translate(Offset (-w, -w * sl));
for (int j = 0; j < lhalfs; j++) {
Atom b(a);
int rwholebeams = here->beams_right <? next->beams_left;
Real w = next->hpos() - here->hpos();
- Atom a = paper()->lookup_->beam(sl, w + stemdx);
+ Atom a = paper()->lookup_p_->beam(sl, w + stemdx);
int j = 0;
for (; j < rwholebeams; j++) {
rightbeams.add( b );
}
w /= 4;
- a = paper()->lookup_->beam(sl, w);
+ a = paper()->lookup_p_->beam(sl, w);
for (; j < rwholebeams + rhalfs; j++) {
Atom b(a);
Molecule*
Beam::brew_molecule() const return out;
{
- assert(left->line == right->line);
Real inter=paper()->internote();
out = new Molecule;
Real x0 = stems.top()->hpos();
Beam::~Beam()
{
- delete group;
+
}
#include "boxes.hh"
#include "const.hh"
-#include "vray.hh"
+#include "varray.hh"
Box::Box()
/*
return all breakable columns
*/
-svec<PCol *>
+Array<PCol *>
Break_algorithm::find_breaks() const
{
- svec<PCol *> retval;
+ Array<PCol *> retval;
for (iter_top(pscore_.cols,c); c.ok(); c++)
if (c->breakable())
-
-
retval.add(c);
return retval;
}
// construct an appropriate Spacing_problem and solve it.
-svec<Real>
+Array<Real>
Break_algorithm::solve_line(Line_of_cols curline) const
{
Spacing_problem sp;
sp.add_column(curline[0], true, 0.0);
- for (int i=1; i< curline.sz()-1; i++)
+ for (int i=1; i< curline.size()-1; i++)
sp.add_column(curline[i]);
sp.add_column(curline.last(), true, linelength);
for (iter_top(pscore_.suz,i); i.ok(); i++) {
sp.add_ideal(i);
}
- svec<Real> the_sol=sp.solve();
+ Array<Real> the_sol=sp.solve();
return the_sol;
}
Break_algorithm::Break_algorithm(PScore&s)
:pscore_(s)
{
- linelength = s.paper_->linewidth;
+ linelength = s.paper_l_->linewidth;
}
bool
Break_algorithm::feasible(Line_of_cols curline) const
{
Real l =0;
- for (int i=0; i < curline.sz(); i++)
+ for (int i=0; i < curline.size(); i++)
l +=curline[i]->width().length();
return l < linelength;
}
}
void
-Col_configuration::setsol(svec<Real> sol)
+Col_configuration::setsol(Array<Real> sol)
{
config = sol;
energy = config.last();
{
#ifndef NPRINT
mtor << "energy : " << energy << '\n';
- mtor << "line of " << config.sz() << " cols\n";
+ mtor << "line of " << config.size() << " cols\n";
#endif
}
void
Col_configuration::OK()const
{
- assert(config.sz() == cols.sz());
+#ifndef NDEBUG
+ assert(config.size() == cols.size());
+#endif
}
#include "dimen.hh"
-void
-Score::do_connect(PCol *c1, PCol *c2, Real d, Real h)
-{
- if (!c1 || !c2 )
- return;
- Idealspacing*sp=pscore_->get_spacing(c1,c2);
-
- if (!sp->hooke){
- sp->hooke = h;
- sp->space =d;
- }
-}
-
-void
-Score::connect(PCol* c1, PCol *c2, Real d, Real h)
-{
- do_connect(c1,c2,d,h);
- do_connect(c1->postbreak, c2,d,h);
- do_connect(c1, c2->prebreak,d,h);
- do_connect(c1->postbreak, c2->prebreak,d,h);
-}
+/*
+ this needs A LOT of rethinking.
-/* this needs A LOT of rethinking.
+ generate springs between columns.
- generate springs between columns.
- */
+ */
void
Score::calc_idealspacing()
{
for (; i.ok(); i++) {
assert(i->used());
PCursor<Score_column*> j(i+1);
- if (i->musical) {
+ if (i->musical_) {
assert(j.ok());
- for (int n=0; n < i->durations.sz(); n++) {
+ for (int n=0; n < i->durations.size(); n++) {
Moment d = i->durations[n];
- Real dist = paper_->duration_to_dist(d);
- while (j->when < d + i->when)
+ Real dist = paper_p_->duration_to_dist(d);
+ while (j->when() < d + i->when())
j++;
-
- assert( j->when== d+i->when);
+ assert( j->when()== d+i->when());
- connect(i->pcol_, j->pcol_, dist);
- if (!j->musical && (j+1).ok()
- && (j+1)->when == j->when) {
+ pscore_p_->connect(i->pcol_l_, j->pcol_l_, dist);
+ if (!j->musical_ && (j+1).ok()
+ && (j+1)->when() == j->when()) {
j++;
- connect(i->pcol_, j->pcol_, dist);
+ pscore_p_->connect(i->pcol_l_, j->pcol_l_, dist);
}
}
} else if (j.ok()) {
the last col is breakable, and therefore in use
*/
- Moment d = j->when - i->when;
- Real dist = (d) ? paper_->duration_to_dist(d) :
+ Moment d = j->when() - i->when();
+ Real dist = (d) ? paper_p_->duration_to_dist(d) :
convert_dimen(2,"pt"); // todo
- connect(i->pcol_, j->pcol_, dist, (d) ? 1.0:1.0);
+ pscore_p_->connect(i->pcol_l_, j->pcol_l_, dist, (d) ? 1.0:1.0);
}
- // !j.ok() might hold if we're at the last col.
-
+ // !j.ok() might hold if we're at the last col.
}
}
}
void
-Clef::read(svec<Scalar>args)
+Clef::read(Array<Scalar>args)
{
clef_type = args[0];
if (clef_type == "violin") {
String t = type;
if (change)
t += "_change";
- Symbol s = paper()->lookup_->clef(t);
+ Symbol s = paper()->lookup_p_->clef(t);
Molecule*output = new Molecule(Atom(s));
output->translate(Offset(0, paper()->interline()/2 * y_off));
return output;
mtor << "Command " << "code " << code << " prio " << priority;
if ( isbreak())
mtor << "(break separator)";
- if (args.sz()) {
+ if (args.size()) {
mtor<< " args: ";
- for (int i = 0; i<args.sz(); i++)
+ for (int i = 0; i<args.size(); i++)
mtor << "`"<<args[i] <<"',";
}
mtor << "\n";
void
mynewhandler()
{
- cerr << "Out of free store memory. Aborting.. "<< flush;
assert(false);
}
void
debug_init()
{
+#ifndef NDEBUG
set_new_handler(&mynewhandler);
+#endif
set_matrix_debug(monitor);
signal(SIGFPE, float_handler);
}
}
-#if 0 // want to debug mem functions
-
-
-///
-static
-void foobulize(void *p , size_t s)
-{
-// assert(s < 2000000);
- memset(p, 0xf0, s);
-}
-/**
- trash a portion of memory. Make sure access to deleted stuff is bogus.
- */
-void *
-operator new (size_t s)
-{
- void *p = malloc(s);
- assert(p);
-// foobulize(p,s);
- return p;
-}
-
-void
-operator delete(void *p, size_t s)
-{
- foobulize(p,s);
- free(p);
-}
-#endif
#include "command.hh"
Command*
-get_key_typeset_command(svec<Scalar>which)
+get_key_typeset_command(Array<Scalar>which)
{
Command*c = new Command;
c->code = TYPESET;
{
Command*c = new Command;
-// c->when = w;
c->code = TYPESET;
c->args.add( "METER");
c->args.add( n );
return c;
}
+Command
+get_defaultbar_command()
+{
+ Command c;
+ c.code = TYPESET;
+ c.args.add("BAR");
+ c.args.add("default");
+ return c;
+}
+
+void
+split_bar_command(Command &pre_com, Command &no_break_com, Command &post_com,
+ String s)
+{
+ Command c;
+ c.code = TYPESET;
+ c.priority = (s=="default") ? 100: 110;
+ c.args.add("BAR");
+ if(s=="default")
+ s = "|";
+
+ if (s == "|" || s == ":|" || s == "||") {
+ c.args.add(s);
+ pre_com= no_break_com= c;
+ } else if (s == ":|:") {
+ no_break_com=post_com=pre_com = c;
+
+ pre_com.args.add( ":|");
+ no_break_com.args.add( s);
+ post_com.args.add( "|:");
+ }else if (s=="|:") {
+ c.args.add(s);
+ no_break_com=post_com=c;
+ }
+}
void
Rhythmic_grouping::OK()const
{
- assert(bool(children.sz()) != bool(interval_));
+#ifndef NDEBUG
+ assert(bool(children.size()) != bool(interval_));
- for (int i= 0; i < children.sz(); i++) {
+ for (int i= 0; i < children.size(); i++) {
children[i]->OK();
if (i>0)
assert(children[i-1]->interval().right ==
children[i]->interval().left);
}
+#endif
}
Moment
r.intersect(interval());
split(r.intervals());
- for (int i= 0; i < children.sz(); i++) {
+ for (int i= 0; i < children.size(); i++) {
if (!children[i]->interval_) {
Rhythmic_grouping here(r);
children[i]->split(here);
}
-svec<MInterval>
+Array<MInterval>
Rhythmic_grouping::intervals()
{
- svec<MInterval> r;
- if (interval_ || children.sz() == 1) {
+ Array<MInterval> r;
+ if (interval_ || children.size() == 1) {
MInterval i(interval());
MInterval r1(i), r2(i);
r1.right = r2.left = i.center();
r.add(r1); r.add(r2);
} else {
- for (int i=0; i < children.sz(); i++)
+ for (int i=0; i < children.size(); i++)
r.add(children[i]->interval());
}
return r;
return;
}
- for (int i=0; i < children.sz(); i++) {
+ for (int i=0; i < children.size(); i++) {
MInterval inter = intersection(t, children[i]->interval());
if (inter.empty() || inter.length() <= 0) {
delete children[i];
children[i]->intersect(t);
}
}
- for (int i=0; i < children.sz(); ) {
+ for (int i=0; i < children.size(); ) {
if (!children[i])
children.del(i);
else
}
void
-Rhythmic_grouping::split(svec<MInterval> splitpoints)
+Rhythmic_grouping::split(Array<MInterval> splitpoints)
{
//check on splitpoints..
int j = 0, i=0, starti = 0, startj = 0;
- svec<Rhythmic_grouping*> ch;
+ Array<Rhythmic_grouping*> ch;
while (1) {
- if ( i >= children.sz() || j >= splitpoints.sz())
+ if ( i >= children.size() || j >= splitpoints.size())
break;
assert(
}
-Rhythmic_grouping::Rhythmic_grouping(svec<Rhythmic_grouping*> r)
+Rhythmic_grouping::Rhythmic_grouping(Array<Rhythmic_grouping*> r)
:children(r)
{
interval_ =0;
Rhythmic_grouping::copy(Rhythmic_grouping const&s)
{
interval_ = (s.interval_)? new MInterval(*s.interval_) : 0;
- for (int i=0; i < s.children.sz(); i++)
+ for (int i=0; i < s.children.size(); i++)
children.add(new Rhythmic_grouping(*s.children[i]));
}
Rhythmic_grouping::junk()
{
delete interval_;
- for (int i=0; i < children.sz(); i++)
+ for (int i=0; i < children.size(); i++)
delete children[i];
init();
}
mtor << "{ \n";
if (interval_)
mtor<<" Interval "<< interval_->str();
- for (int i=0; i < children.sz(); i++) {
+ for (int i=0; i < children.size(); i++) {
children[i]->print();
}
mtor << "}\n";
Rhythmic_grouping::add_child(Moment start, Moment len)
{
Moment stop = start+len;
- for (int i=0; i < children.sz(); i ++) {
+ for (int i=0; i < children.size(); i ++) {
MInterval j=children[i]->interval();
if (j.left == start && j.right==stop) {
return;
}
}
- if (children.sz())
+ if (children.size())
assert ( children.last()->interval().right== start);
children.add(new Rhythmic_grouping(MInterval(start, stop)));
}
int
-min_elt(svec<int> v)
+min_elt(Array<int> v)
{
int i = 1000; // ugh
- for (int j = 0 ; j < v.sz(); j++)
+ for (int j = 0 ; j < v.size(); j++)
i = i <? v[j];
return i;
}
-svec<int>
-Rhythmic_grouping::generate_beams(svec<int> flags, int &flagidx)
+Array<int>
+Rhythmic_grouping::generate_beams(Array<int> flags, int &flagidx)
{
assert (!interval_) ;
- svec< svec<int> > children_beams;
- for (int i=0; i < children.sz(); i++) {
- svec<int> child_beams;
+ Array< Array<int> > children_beams;
+ for (int i=0; i < children.size(); i++) {
+ Array<int> child_beams;
if (children[i]->interval_) {
int f = flags[flagidx++];
child_beams.add(f);
}
children_beams.add(child_beams);
}
- svec<int> beams;
+ Array<int> beams;
int lastm, m, nextm;
- for (int i=0; i < children_beams.sz(); i++) {
+ for (int i=0; i < children_beams.size(); i++) {
bool add_left = (i >0);
- bool add_right = (i < children_beams.sz() -1);
+ bool add_right = (i < children_beams.size() -1);
if (!i)
m = min_elt(children_beams[i]);
if (add_right)
nextm = min_elt(children_beams[i+1]);
- if (children_beams[i].sz() == 1) {
+ if (children_beams[i].size() == 1) {
if (add_right)
beams.add(m);
if (add_left)
lastm = m;
m = nextm;
}
- assert(!(beams.sz()%2));
+ assert(!(beams.size()%2));
return beams;
}
Input_command::operator Command()
{
Command c;
- if (!args.sz())
+ if (!args.size())
return c;
c.code = INTERPRET;
}
Input_command*
-get_grouping_command(svec<int>a )
+get_grouping_command(Array<int>a )
{
Input_command*c = new Input_command;
c->args.add("GROUPING");
- for (int i=0; i < a.sz(); i ++)
+ for (int i=0; i < a.size(); i ++)
c->args.add(a[i]);
return c;
}
Input_command*
-get_key_interpret_command(svec<int >a )
+get_key_interpret_command(Array<int >a )
{
Input_command*c = new Input_command;
c->args.add("KEY");
- for (int i=0; i < a.sz(); i ++) {
+ for (int i=0; i < a.size(); i ++) {
c->args.add(a[i]);
}
return c;
}
Input_command *
-get_bar_command()
+get_newmeasure_command()
{
Input_command*c = new Input_command;
- c->args.add( "BAR");
- c->args.add( "|");
+ c->args.add( "NEWMEASURE");
return c;
}
Input_command::print()const
{
mtor << "{ ";
- if (args.sz()) {
+ if (args.size()) {
mtor<< " args: ";
- for (int i = 0; i<args.sz(); i++)
+ for (int i = 0; i<args.size(); i++)
mtor << "`"<<args[i] <<"',";
}
mtor << "}\n";
return c;
}
-svec<int>
+Input_command*
+get_bar_command(String w)
+{
+ Input_command*c = new Input_command;
+ c->args.add("BAR");
+ c->args.add(w);
+ return c;
+}
+
+Array<int>
get_default_grouping(int count)
{
- svec<int> s;
+ Array<int> s;
if (!(count % 3 )) {
for (int i=0; i < count/3; i++)
s.add(3);
#include "staffcommands.hh"
#include "getcommand.hh"
#include "command.hh"
+#include "stcol.hh"
+#include "staff.hh"
void
Commands_at::print() const
: tdescription_(dt, (prev)? &prev->tdescription_ : 0)
{
if (prev&& !tdescription_.whole_in_measure) {
- bottom().add(get_bar_command());
+ bottom().add(get_newmeasure_command());
}
}
{
s->tdescription_ = tdescription_;
for (iter_top(*this,cc); cc.ok(); cc++) {
- if (cc->args.sz() && cc->args[0] !="") {
+ if (cc->args.size() && cc->args[0] !="") {
Command c = **cc;
s->add(c);
}
-Staff_commands*
-Input_commands::parse() const
+void
+Input_commands::parse(Staff * staff_l) const
{
print();
- Staff_commands*nc = new Staff_commands;
-
for (iter_top(*this,i); i.ok(); i++) {
- Staff_commands_at* s= nc->find(i->when());
- if (!s){
- s = new Staff_commands_at(i->tdescription_);
- nc->add(s);
- }
+ Staff_column* col_l = staff_l->get_col(i->when(), false);
+ if (!col_l->staff_commands_p_)
+ col_l->staff_commands_p_ = new Staff_commands_at(i->tdescription_);
+
+ Staff_commands_at * com_l = col_l->staff_commands_p_;
+
if (!i->when()) { /* all pieces should start with a breakable. */
+ com_l->set_breakable();
+ #if 0
Command c;//(0.0);
c.code = INTERPRET;
c.args.add("BAR");
c.args.add("empty");
- s->add(c);
+ com_l->add(c);
+ #endif
}
- i->parse(s);
+ i->parse(com_l);
}
- return nc;
}
#include "paper.hh"
void
-Input_score::add(svec<Input_command*> &s)
+Input_score::add(Array<Input_command*> &s)
{
commands_.bottom().add(get_reset_command());
- for (int i=0; i < s.sz(); i++)
+ for (int i=0; i < s.size(); i++)
commands_.bottom().add(s[i]);
}
Score*
Input_score::parse()
{
- Paperdef* p=new Paperdef(*paper_);
- Score *s = new Score(p);
+ Paperdef* paper_p=new Paperdef(*paper_);
+ Score *s_p = new Score(paper_p);
for (iter_top(staffs_,i); i.ok(); i++) {
- Staff* staf=i->parse(commands_);
- s->add(staf);
+ Staff* staf_p=i->parse(commands_, s_p);
+ s_p->add(staf_p);
}
- return s;
+ return s_p;
}
Input_score::~Input_score()
{
- // should fix paper/symtabs to allow this deletion.
+ // TODO!
+//should fix paper/symtabs to allow this deletion.
// delete paper_;
}
#include "staff.hh"
void
-Input_staff::add(svec<Input_command*> &s)
+Input_staff::add(Array<Input_command*> &s)
{
commands_.bottom().add(get_reset_command());
- for (int i=0; i < s.sz(); i++)
+ for (int i=0; i < s.size(); i++)
commands_.bottom().add(s[i]);
s.set_size(0);
}
}
Staff*
-Input_staff::parse(PointerList<Input_command*> score_wide)
+Input_staff::parse(PointerList<Input_command*> score_wide, Score*score_l)
{
Staff *p=0;
p = new Melodic_staff;
else if (type == "rhythmic")
p = new Rhythmic_staff;
-
+ p->score_l_ = score_l;
for (iter_top(music_,i); i.ok(); i++) {
Voice_list vl = i->convert();
p->add(vl);
for (iter_top(commands_,i); i.ok(); i++)
commands.add(**i);
- p->staff_commands_ = commands.parse();
+ commands.parse(p);
return p;
}
for (iter_top(s.commands_,i); i.ok(); i++)
commands_.bottom().add(new Input_command(**i));
for (iter_top(s.music_,i); i.ok(); i++)
- add(i);
+ add(i->clone());
type = s.type;
}
Item::Item()
{
- pcol_ = 0;
+ pcol_l_ = 0;
}
void
octaves[i] = k;
}
-svec<int>
-Key::read(svec<Scalar> s)
+Array<int>
+Key::read(Array<Scalar> s)
{
- svec<int> newkey;
+ Array<int> newkey;
for (int j = 0; j < 7; j++)
accidentals[j] = 0;
- for (int i=0; i < s.sz(); ) {
+ for (int i=0; i < s.size(); ) {
int large = s[i++];
int small = s[i++];
accidentals[large]=small;
return newkey;
}
-svec<int>
-Key::oldkey_undo(svec<Scalar>s)
+Array<int>
+Key::oldkey_undo(Array<Scalar>s)
{
- svec<int> oldkey;
- svec<int> newkey;
+ Array<int> oldkey;
+ Array<int> newkey;
newkey.set_size(7);
- for (int i=0; i < newkey.sz(); i++)
+ for (int i=0; i < newkey.size(); i++)
newkey[i] = 0;
- for (int i=0; i < s.sz(); ) {
+ for (int i=0; i < s.size(); ) {
int large = s[i++];
int small = s[i++];
newkey[large] = small;
}
- for (int i=0; i < newkey.sz(); i++)
+ for (int i=0; i < newkey.size(); i++)
if (accidentals[i] && accidentals[i] != newkey[i]) {
oldkey.add(i);
oldkey.add(0);
}
void
-Keyitem::read(svec<int> s)
+Keyitem::read(Array<int> s)
{
- for (int i = 0 ; i< s.sz(); ) {
+ for (int i = 0 ; i< s.size(); ) {
int note = s[i++];
int acc = s[i++];
Molecule*output = new Molecule;
Real inter = paper()->interline()/2;
- for (int i =0; i < pitch.sz(); i++) {
- Symbol s= paper()->lookup_->accidental(acc[i]);
+ for (int i =0; i < pitch.size(); i++) {
+ Symbol s= paper()->lookup_p_->accidental(acc[i]);
Atom a(s);
a.translate(Offset(0,(c_position + pitch[i]) * inter));
Molecule m(a);
output->add_right(m);
}
- Molecule m(paper()->lookup_->fill(Box(
+ Molecule m(paper()->lookup_p_->fill(Box(
Interval(0, paper()->note_width()),
Interval(0,0))));
output->add_right(m);
Real sqx =0.0;
Real sxy = 0.0;
- for (int i=0; i < input.sz();i++) {
+ for (int i=0; i < input.size();i++) {
Real x=input[i].x;
Real y = input[i].y;
sx += x;
sqx += sqr(x);
sxy += x*y;
}
- int N = input.sz();
+ int N = input.size();
coef = (N * sxy - sx*sy )/(N*sqx - sqr(sx));
#include "string.hh"
#include "notename.hh"
#include "lexer.hh"
-#include "vray.hh"
+#include "varray.hh"
#include "parser.hh"
#include "debug.hh"
WORD {A}{AN}*
ALPHAWORD {A}+
INT -?{N}+
-REAL {INT}(\.{N}*)?
+REAL {INT}?(\.{N}*)?
OPTSIGN !?
PITCHMOD ['`]*{OPTSIGN}
yylval.i = String(YYText()).value();
return INT;
}
-<notes>\| {
-}
<notes>[%#].*\n {
}
return YYText()[0];
}
-<notes>[\[)] { /* parens () are NO mistake */
- yylval.c = YYText()[0];
- return OPEN_REQUEST_PARENS;
-}
-<notes>[\](] { /* parens () are NO mistake */
- yylval.c = YYText()[0];
- return CLOSE_REQUEST_PARENS;
-}
<notes>\"[^\"]*\" {
String s (YYText()+1);
s = s.left(s.len()-1);
yylval.string = new String(s);
return STRING;
}
-<notes>[/.^>_-] {
+<notes>[()\[\]|/.^>_-] {
return yylval.c = YYText()[0];
}
bool
Spacing_problem::contains(const PCol *w)
{
- for (int i=0; i< cols.sz(); i++)
+ for (int i=0; i< cols.size(); i++)
if (cols[i].pcol_ == w)
return true;
return false;
int
Spacing_problem::col_id(const PCol *w)const
{
- for (int i=0; i< cols.sz(); i++)
+ for (int i=0; i< cols.size(); i++)
if (cols[i].pcol_ == w)
return i;
assert(false);
Spacing_problem::OK() const
{
#ifndef NDEBUG
- Union_find connected(cols.sz());
- svec<int> fixed;
- for (int i=0; i < ideals.sz(); i++) {
+ Union_find connected(cols.size());
+ Array<int> fixed;
+ for (int i=0; i < ideals.size(); i++) {
assert(ideals[i]->hooke > 0);
int l = col_id(ideals[i]->left);
int r = col_id(ideals[i]->right);
connected.connect(l,r);
}
- for (int i = 0; i < cols.sz(); i++)
+ for (int i = 0; i < cols.size(); i++)
if (cols[i].fixed())
fixed.add(i);
- for (int i = 0; i < cols.sz(); i++) {
+ for (int i = 0; i < cols.size(); i++) {
bool c=false;
- for (int j =0; j<fixed.sz(); j++)
+ for (int j =0; j<fixed.size(); j++)
c |= connected.equiv(j,i);
assert(c);
}
Vector
Spacing_problem::try_initial_solution() const
{
- int dim=cols.sz();
+ int dim=cols.size();
Vector initsol(dim);
for (int i=0; i < dim; i++) {
if (cols[i].fixed()) {
quad.fill(0);
lin.fill(0);
c = 0;
- for (int j=0; j < ideals.sz(); j++){
+ for (int j=0; j < ideals.size(); j++){
Idealspacing const*i=ideals[j];
int l = col_id(i->left);
int r = col_id(i->right);
void
Spacing_problem::make_constraints(Mixed_qp& lp) const
{
- int dim=cols.sz();
+ int dim=cols.size();
for (int j=0; j < dim; j++) {
Colinfo *c=&(cols[j]);
if (c->fixed()) {
}
}
-svec<Real>
+Array<Real>
Spacing_problem::solve() const
{
print();
assert(check_feasible());
/* optimalisatiefunctie */
- Mixed_qp lp(cols.sz());
+ Mixed_qp lp(cols.size());
make_matrices(lp.quad,lp.lin, lp.const_term);
make_constraints(lp);
Vector start=find_initial_solution();
}
- svec<Real> posns(sol);
+ Array<Real> posns(sol);
posns.add(lp.eval(sol));
return posns;
}
Spacing_problem::print() const
{
#ifndef NPRINT
- for (int i=0; i < cols.sz(); i++) {
+ for (int i=0; i < cols.size(); i++) {
mtor << "col " << i<<' ';
cols[i].print();
}
- for (int i=0; i < ideals.sz(); i++) {
+ for (int i=0; i < ideals.size(); i++) {
print_ideal(ideals[i]);
}
#endif
void
Linestaff::brew_molecule(Real width)
{
- Atom a = pscore_->paper_->lookup_->linestaff(nolines,width);
- stafsym = new Molecule(a);
+ Atom a = pscore_l_->paper_l_->lookup_p_->linestaff(nolines,width);
+ stafsym_p_ = new Molecule(a);
}
Molecule* output = new Molecule;
Molecule*octmol = 0;
int lastoct = -100;
- for (int i = 0; i < accs.sz(); i++) {
+ for (int i = 0; i < accs.size(); i++) {
if (accs[i].octave != lastoct) {
if (octmol){
Real dy =lastoct*7*paper()->interline()/2;
octmol= new Molecule;
}
lastoct = accs[i].octave;
- Symbol s =paper()->lookup_->accidental(accs[i].acc);
+ Symbol s =paper()->lookup_p_->accidental(accs[i].acc);
Atom a(s);
Real dy = (accs[i].name + c0_position) * paper()->interline()/2;
a.translate(Offset(0,dy));
Symbol
Lookup::text( String style, String text , int dir)
{
- svec<String> a;
+ Array<String> a;
a.add(text);
Symbol tsym = (*symtables_)("style")->lookup(style);
}
Symbol ret = (*symtables_)("streepjes")->lookup(idx);
- svec<String> a;
+ Array<String> a;
a.add(arg);
ret.tex = substitute_args(ret.tex, a);
Real dy=(lines-1)*internote()*2;
s.dim.y = Interval(0,dy);
- svec<String> a;
+ Array<String> a;
a.add(lines);
a.add(print_dimen(wid));
Symbol
-Lookup::meter(svec<Scalar> a)
+Lookup::meter(Array<Scalar> a)
{
Symbol s;
s.dim.x = Interval( convert_dimen(0,"pt"),
s.dim.x = Interval(0,0);
s.dim.y = Interval(y1,y2);
- svec<String> a;
+ Array<String> a;
a.add(print_dimen(y1));
a.add(print_dimen(y2));
#include "paper.hh"
#include "lookup.hh"
-Meter::Meter(svec<Scalar>a)
+Meter::Meter(Array<Scalar>a)
:args(a)
{
}
Molecule*
Meter::brew_molecule()const
{
- Symbol s = paper()->lookup_->meter(args);
+ Symbol s = paper()->lookup_p_->meter(args);
return new Molecule(Atom(s));
}
-#include "vray.hh"
+#include "varray.hh"
#include "interval.hh"
#include "dimen.hh"
#include "string.hh"
{
// whugh.. Hard coded...
String s("\\placebox{%}{%}{%}");
- svec<String> a;
+ Array<String> a;
a.add(print_dimen(off.y));
a.add(print_dimen(off.x));
a.add(sym.tex);
#include "voice.hh"
#include "notename.hh"
#include "identparent.hh"
-#include "vray.hh"
+#include "varray.hh"
#include "textdef.hh"
int default_duration = 4, default_dots=0, default_octave=0;
{
Request* ret=0;
switch (c) {
+ case '|':
+ ret = new Barcheck_req;
+ break;
case '[':
case ']':
{
case ']':
ret->span()->spantype = Span_req::STOP;
break;
+
default:
- assert(false);
+
break;
}
}
void
-add_requests(Voice_element *v, svec<Request*> &req)
+add_requests(Voice_element *v, Array<Request*> &req)
{
- for (int i = 0; i < req.sz(); i++) {
+ for (int i = 0; i < req.size(); i++) {
v->add(req[i]);
}
req.set_size(0);
break;
case '+' : s = "stopped";
break;
- case '-' : s = "portato";
+ case '-' : s = "tenuto";
break;
case '|': s = "staccatissimo";
break;
position = 0;
balltype = 0;
dots = 0;
+ extremal = 0;
}
void
Paperdef *p = paper();
Real dy = p->internote();
- Symbol s = p->lookup_->ball(balltype);
+ Symbol s = p->lookup_p_->ball(balltype);
out = new Molecule(Atom(s));
if (dots) {
- Symbol d = p->lookup_->dots(dots);
+ Symbol d = p->lookup_p_->dots(dots);
Molecule dm;
dm.add(Atom(d));
if (!(position %2))
if (streepjes) {
int dir = sign(position);
int s =(position<-1) ? -((-position)/2): (position-staff_size)/2;
- Symbol str = p->lookup_->streepjes(s);
+ Symbol str = p->lookup_p_->streepjes(s);
Molecule sm;
sm.add(Atom(str));
if (position % 2)
Paperdef::Paperdef(Lookup *l)
{
- lookup_ = l;
+ lookup_p_ = l;
linewidth = convert_dimen(15,"cm"); // in cm for now
whole_width = 8 * note_width();
Paperdef::~Paperdef()
{
- delete lookup_;
+ delete lookup_p_;
+}
+Paperdef::Paperdef(Paperdef const&s)
+{
+ lookup_p_ = new Lookup(*s.lookup_p_);
+ geometric_ = s.geometric_;
+ whole_width = s.whole_width;
+ outfile = s.outfile;
+ linewidth = s.linewidth;
}
void
Paperdef::set(Lookup*l)
{
- assert(l != lookup_);
- delete lookup_;
- lookup_ = l;
+ assert(l != lookup_p_);
+ delete lookup_p_;
+ lookup_p_ = l;
}
Real
Paperdef::interline() const
{
- return lookup_->ball(4).dim.y.length();
+ return lookup_p_->ball(4).dim.y.length();
}
Real
Paperdef::internote() const
{
- return lookup_->internote();
+ return lookup_p_->internote();
}
Real
Paperdef::note_width()const
{
- return lookup_->ball(4).dim.x.length( );
+ return lookup_p_->ball(4).dim.x.length( );
}
Real
Paperdef::standard_height() const
#include <iostream.h>
#include "lookup.hh"
-
#include "misc.hh"
#include "lexer.hh"
#include "paper.hh"
#define YYDEBUG 1
#endif
-svec<Request*> pre_reqs, post_reqs;
+Array<Request*> pre_reqs, post_reqs;
Paperdef*default_paper();
%}
char c;
int ii[10];
- svec<String> * strvec;
- svec<Input_command*> *commandvec;
- svec<int> *intvec;
+ Array<String> * strvec;
+ Array<Input_command*> *commandvec;
+ Array<int> *intvec;
Input_staff *staff;
Input_score *score;
%token <ii> NOTENAME
%token <real> REAL
%token <string> STRING
-%token <c> OPEN_REQUEST_PARENS CLOSE_REQUEST_PARENS
+
%token <i> DOTS INT
%type <consstr> unit
%type <intvec> pitch_list
-
+%type <c> open_request_parens close_request_parens
%type <id> declaration
%type <string> declarable_identifier
%type <paper> paper_block paper_body
COMMANDS '{' score_commands_body '}' { $$ =$3;}
;
-score_commands_body: { $$ = new svec<Input_command*>; }
+score_commands_body: { $$ = new Array<Input_command*>; }
| score_commands_body score_command {
$$->add($2);
}
;
staff_commands_body:
- /* empty */ { $$ = new svec<Input_command*>; }
+ /* empty */ { $$ = new Array<Input_command*>; }
| staff_commands_body staff_command {
$$->add($2);
}
score_command:
skipcommand
+ | BAR STRING {
+ $$ = get_bar_command(*$2);
+ delete $2;
+ }
| METER int int {
$$ = get_meterchange_command($2, $3);
}
;
post_request:
- CLOSE_REQUEST_PARENS { $$ = get_request($1); }
+ close_request_parens { $$ = get_request($1); }
| script_req
| textscript_req
;
+close_request_parens:
+ '(' { $$='('; }
+ |']' { $$ = ']' }
+ ;
+
+open_request_parens:
+ '|' {$$='|'}
+ |')' {$$=')'}
+ |'[' {$$='['}
+ ;
script_definition:
SCRIPT '{' script_body '}' { $$ = $3; }
;
pre_request:
- OPEN_REQUEST_PARENS { $$ = get_request($1); }
+ open_request_parens { $$ = get_request($1); }
;
UTILITIES
*/
pitch_list: {
- $$ = new svec<int>;
+ $$ = new Array<int>;
}
| pitch_list NOTENAME {
$$->add($2[0]);
int_list:
/* */ {
- $$ = new svec<int>;
+ $$ = new Array<int>;
}
| int_list int {
$$->add($2);
int
PCol::rank() const
{
- if(!pscore_)
+ if(!pscore_l_)
return -1;
- PCursor<PCol*> me=pscore_->find_col( (PCol*)this);
+ PCursor<PCol*> me=pscore_l_->find_col( (PCol*)this);
if (!me.ok())
return -1;
- PCursor<PCol*> bot(pscore_->cols.top());
+ PCursor<PCol*> bot(pscore_l_->cols.top());
return me - bot;
}
mtor << "# symbols: " << its.size() ;
if (breakable()){
mtor << "\npre,post: ";
- prebreak->print();
- postbreak->print();
- } else if (daddy) {
- mtor<<'\n' << ((this == daddy->prebreak) ? "prebreak" : "postbreak");
+ prebreak_p_->print();
+ postbreak_p_->print();
+ } else if (daddy_l_) {
+ mtor<<'\n' << ((this == daddy_l_->prebreak_p_) ?
+ "prebreak_p_" : "postbreak");
}
mtor << "extent: " << width().str() << "\n";
mtor << "}\n";
int
PCol::compare(const PCol &c1, const PCol &c2)
{
- return c1.pscore_->compare_pcols((PCol*)&c1,(PCol*)&c2);
+ PScore*ps_l = c1.pscore_l_;
+ PCursor<PCol*> ac(ps_l->find_col(&c1));
+ PCursor<PCol*> bc(ps_l->find_col(&c2));
+ assert(ac.ok() && bc.ok());
+ return ac - bc;
}
void
-PCol::OK () const
+PCol::OK() const
{
- if (prebreak || postbreak ) {
- assert(prebreak&&postbreak);
- assert(prebreak->daddy == this);
- assert(postbreak->daddy == this);
- }
+#ifndef NDEBUG
+ if (prebreak_p_ || postbreak_p_ ) {
+ assert(prebreak_p_&&postbreak_p_);
+ assert(prebreak_p_->daddy_l_ == this);
+ assert(postbreak_p_->daddy_l_ == this);
+ }
+#endif
}
void
if (breakable())
return;
- prebreak = new PCol(this);
- postbreak = new PCol(this);
- prebreak->pscore_ = pscore_;
- postbreak->pscore_ = pscore_;
-
-
+ prebreak_p_ = new PCol(this);
+ postbreak_p_ = new PCol(this);
+ prebreak_p_->pscore_l_ = pscore_l_;
+ postbreak_p_->pscore_l_ = pscore_l_;
}
bool
PCol::breakable() const
{
- return prebreak||postbreak;
+ return prebreak_p_||postbreak_p_;
}
PCol::PCol(PCol *parent)
{
- daddy = parent;
- prebreak=0;
- postbreak=0;
- line=0;
+ daddy_l_ = parent;
+ prebreak_p_=0;
+ postbreak_p_=0;
+ line_l_=0;
- pscore_ = 0;
+ pscore_l_ = 0;
}
PCol::~PCol()
{
- delete prebreak;
- delete postbreak;
+ delete prebreak_p_;
+ delete postbreak_p_;
}
void
PCol::add( Item *i)
{
its.bottom().add(i);
- i->pcol_ = this;
-
+ i->pcol_l_ = this;
}
bool
void
PScore::add(PStaff *s)
{
- assert(s->pscore_ == this);
+ assert(s->pscore_l_ == this);
staffs.bottom().add(s);
}
+
+void
+PScore::do_connect(PCol *c1, PCol *c2, Real d, Real h)
+{
+ if (!c1 || !c2 )
+ return;
+ Idealspacing*s_l=get_spacing(c1,c2);
+
+ if (!s_l->hooke){
+ s_l->hooke = h;
+ s_l->space =d;
+ }
+}
+
+void
+PScore::connect(PCol* c1, PCol *c2, Real d, Real h)
+{
+ do_connect(c1,c2,d,h);
+ do_connect(c1->postbreak_p_, c2,d,h);
+ do_connect(c1, c2->prebreak_p_,d,h);
+ do_connect(c1->postbreak_p_, c2->prebreak_p_,d,h);
+}
+
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);
+ typeset_item(i, c->prebreak_p_, s);
return;
}
if (breakstat == 2) {
- typeset_item(i, c->postbreak, s);
+ typeset_item(i, c->postbreak_p_, s);
return;
}
void
PScore::typeset_spanner(Spanner*span_p, PStaff*ps)
{
- span_p->pstaff_ = ps;
+ span_p->pstaff_l_ = ps;
spanners.bottom().add(span_p);
ps->spans.bottom().add(span_p);
}
-int
-PScore::compare_pcols(PCol*a, PCol*b)const
-{
- PCursor<PCol*> ac(find_col(a));
- PCursor<PCol*> bc(find_col(b));
- assert(ac.ok() && bc.ok());
- return ac - bc;
-}
-
void
PScore::add(PCol *p)
{
- p->pscore_ = this;
+ p->pscore_l_ = this;
if (p->breakable()){
- p->prebreak->pscore_ = this;
- p->postbreak->pscore_ = this;
+ p->prebreak_p_->pscore_l_ = this;
+ p->postbreak_p_->pscore_l_ = this;
}
cols.bottom().add(p);
}
PScore::PScore( Paperdef*p)
{
- paper_ = p;
+ paper_l_ = p;
}
void
{
int l=1;
- ts << "\n "<< paper_->lookup_->texsetting << "%(Tex id)\n";
+ ts << "\n "<< paper_l_->lookup_p_->texsetting << "%(Tex id)\n";
for (iter_top(lines,lic); lic.ok(); lic++) {
ts << "% line of score no. " << l++ <<"\n";
ts << lic->TeXstring();
}
-svec<Item*>
-PScore::select_items(PStaff*ps , PCol*pc)
+Array<Item*>
+PScore::select_items(PStaff*ps, PCol*pc)
{
- svec<Item*> ret;
+ Array<Item*> ret;
assert(ps && pc);
for (iter_top(pc->its,i); i.ok(); i++){
- if (i->pstaff_ == ps)
+ if (i->pstaff_l_ == ps)
ret.add((Item*)(const Item*)i);
}
return ret;
{
#ifndef NPRINT
mtor << "PScore { ";
- paper_->print();
+ paper_l_->print();
mtor << "\ncolumns: ";
for (iter_top(cols,cc); cc.ok(); cc++)
cc->print();
}
PCursor<PCol *>
-PScore::find_col(PCol *c)const
+PScore::find_col(const PCol *c)const
{
- PCol*what = (PCol*)c;
- if (what->daddy )
- what = what -> daddy;
+ const PCol*what = c;
+ if (what->daddy_l_ )
+ what = what->daddy_l_;
- return cols.find(what);
+ return cols.find((PCol*)what);
}
void
PScore::add_broken(Spanner*s)
{
- assert(s->left->line == s->right->line);
+ assert(s->left->line_l_ == s->right->line_l_);
broken_spans.bottom().add(s);
s->left->starters.bottom().add (s);
s->right->stoppers.bottom().add (s);
}
void
-PScore::set_breaking(svec<Col_configuration> breaking)
+PScore::set_breaking(Array<Col_configuration> breaking)
{
- for (int j=0; j < breaking.sz(); j++) {
- svec<PCol*> &curline(breaking[j].cols);
- svec<Real> &config(breaking[j].config);
+ for (int j=0; j < breaking.size(); j++) {
+ Array<PCol*> &curline(breaking[j].cols);
+ Array<Real> &config(breaking[j].config);
- Line_of_score *p = new Line_of_score(curline,this);
- lines.bottom().add(p);
- for (int i=0; i < curline.sz(); i++){
+ Line_of_score *s_p = new Line_of_score(curline,this);
+ lines.bottom().add(s_p);
+ for (int i=0; i < curline.size(); i++){
curline[i]->hpos = config[i];
}
}
Word_wrap w(*this);
set_breaking(w.solve());
}
+
+void
+PScore::process()
+{
+ clean_cols();
+ *mlog << "Preprocessing ... ";
+ preprocess();
+ *mlog << "Calculating ... ";
+ calc_breaking();
+ *mlog << "Postprocessing ... ";
+ postprocess();
+}
#include "pstaff.hh"
#include "molecule.hh"
+
PStaff::~PStaff()
{
- delete stafsym;
+ delete stafsym_p_;
}
PStaff::PStaff(PScore*ps)
{
- pscore_=ps;
- stafsym = 0;
+ pscore_l_=ps;
+ stafsym_p_ = 0;
}
void
PStaff::add(Item *i )
{
its.bottom().add(i);
- i->pstaff_ = this;
+ i->pstaff_l_ = this;
}
Ineq_constrained_qp::OK() const
{
#ifndef NDEBUG
- assert(cons.sz() == consrhs.sz());
+ assert(cons.size() == consrhs.size());
Matrix Qdif= quad - quad.transposed();
assert(Qdif.norm()/quad.norm() < EPS);
#endif
print();
Ineq_constrained_qp pure(*this);
- for (int i= eq_cons.sz()-1; i>=0; i--) {
+ for (int i= eq_cons.size()-1; i>=0; i--) {
pure.eliminate_var(eq_cons[i], eq_consrhs[i]);
start.del(eq_cons[i]);
}
Vector sol = pure.solve(start);
- for (int i= 0; i < eq_cons.sz(); i++) {
+ for (int i= 0; i < eq_cons.size(); i++) {
sol.insert( eq_consrhs[i],eq_cons[i]);
}
return sol;
row.del(idx);
lin +=row ;
- for (int i=0; i < cons.sz(); i++) {
+ for (int i=0; i < cons.size(); i++) {
consrhs[i] -= cons[i](idx) *value;
cons[i].del(idx);
}
void
Ineq_constrained_qp::assert_solution(Vector sol) const
{
- svec<int> binding;
- for (int i=0; i < cons.sz(); i++) {
+ Array<int> binding;
+ for (int i=0; i < cons.size(); i++) {
Real R=cons[i] * sol- consrhs[i];
assert(R> -EPS);
if (R < EPS)
mtor << "Quad " << quad;
mtor << "lin " << lin <<"\n"
<< "const " << const_term<<"\n";
- for (int i=0; i < cons.sz(); i++) {
+ for (int i=0; i < cons.size(); i++) {
mtor << "constraint["<<i<<"]: " << cons[i] << " >= " << consrhs[i];
mtor << "\n";
}
{
#ifndef NDEBUG
Ineq_constrained_qp::OK();
- assert(eq_consrhs.sz() == eq_cons.sz());
+ assert(eq_consrhs.size() == eq_cons.size());
#endif
}
{
#ifndef NPRINT
Ineq_constrained_qp::print();
- for (int i=0; i < eq_cons.sz(); i++) {
+ for (int i=0; i < eq_cons.size(); i++) {
mtor << "eq cons "<<i<<": x["<<eq_cons[i]<<"] == " << eq_consrhs[i]<<"\n";
}
#endif
Active_constraints::status() const
{
String s("Active|Inactive [");
- for (int i=0; i< active.sz(); i++) {
+ for (int i=0; i< active.size(); i++) {
s += String(active[i]) + " ";
}
s+="| ";
- for (int i=0; i< inactive.sz(); i++) {
+ for (int i=0; i< inactive.size(); i++) {
s += String(inactive[i]) + " ";
}
s+="]";
}
void
-Active_constraints::OK() {
+Active_constraints::OK()
+{
+ #ifndef NDEBUG
H.OK();
A.OK();
- assert(active.sz() +inactive.sz() == opt->cons.sz());
+ assert(active.size() +inactive.size() == opt->cons.size());
assert(H.dim() == opt->dim());
- assert(active.sz() == A.rows());
- svec<int> allcons;
+ assert(active.size() == A.rows());
+ Array<int> allcons;
- for (int i=0; i < opt->cons.sz(); i++)
+ for (int i=0; i < opt->cons.size(); i++)
allcons.add(0);
- for (int i=0; i < active.sz(); i++) {
+ for (int i=0; i < active.size(); i++) {
int j = active[i];
allcons[j]++;
}
- for (int i=0; i < inactive.sz(); i++) {
+ for (int i=0; i < inactive.size(); i++) {
int j = inactive[i];
allcons[j]++;
}
- for (int i=0; i < allcons.sz(); i++)
+ for (int i=0; i < allcons.size(); i++)
assert(allcons[i] == 1);
+#endif
}
Vector
int cidx=inactive[k];
active.add(cidx);
- inactive.swap(k,inactive.sz()-1);
+ inactive.swap(k,inactive.size()-1);
inactive.pop();
Vector a( opt->cons[cidx] );
void
Active_constraints::drop(int k)
{
- int q=active.sz()-1;
+ int q=active.size()-1;
// drop indices
inactive.add(active[k]);
H(op->dim()),
opt(op)
{
- for (int i=0; i < op->cons.sz(); i++)
+ for (int i=0; i < op->cons.size(); i++)
inactive.add(i);
Choleski_decomposition chol(op->quad);
H=chol.inverse();
#define RCONS(T) VIRTUALCONS(T, Request)
RCONS(Rest_req);
+RCONS(Barcheck_req);
RCONS(Text_req);
RCONS(Rhythmic_req);
RCONS(Stem_req);
RCONS(Slur_req);
RCONS(Beam_req);
+void
+Barcheck_req::print() const
+{
+#ifndef NPRINT
+ mtor << "Barcheck\n";
+#endif
+}
+
void
Request::print() const
{
#endif
}
-Request::Request()
+void
+Span_req::print() const
{
- elt = 0;
+#ifndef NPRINT
+ mtor << "Span_req {" << spantype << "}\n";
+#endif
}
+Request::Request()
+{
+ elt_l_ = 0;
+}
+Request::Request(Request const&)
+{
+ elt_l_ = 0;
+}
Melodic_req::Melodic_req()
{
name = 0;
scriptdef = def;
}
+Script_req::Script_req(Script_req const &s)
+{
+ dir = s.dir;
+ scriptdef = new Script_def(*s.scriptdef);
+}
+
void
Script_req::print() const
{
delete scriptdef;
}
-
+Text_req::Text_req(Text_req const& s)
+{
+ spec = new Text_def(*s.spec);
+ dir = s.dir;
+}
Text_req::Text_req(int d , Text_def*def)
{
dir = d;
Molecule*
Rest::brew_molecule()const
{
- assert(pstaff_);
-
Paperdef *p =paper();
Symbol s;
- s = p->lookup_->rest(balltype);
+ s = p->lookup_p_->rest(balltype);
Molecule *m = new Molecule(Atom(s));
if (dots) {
- Symbol d =p->lookup_->dots(dots);
+ Symbol d =p->lookup_p_->dots(dots);
Molecule dm;
dm.add(Atom(d));
m->add_right(dm);
Item *i = Simple_staff::get_TYPESET_item(com);
if (!i) return 0;
i->translate(Offset(0,
- -score_->paper_->standard_height()/2));
+ -score_l_->paper_p_->standard_height()/2));
return i;
}
int
Score_column::compare(Score_column & c1, Score_column &c2)
{
- return sign(c1.when - c2.when);
+ return sign(c1.when_ - c2.when_);
}
void
-Score_column::set_breakable() {
- pcol_->set_breakable();
+Score_column::set_breakable()
+{
+ pcol_l_->set_breakable();
}
+
Score_column::Score_column(Moment w)
{
- when = w;
- pcol_ = new PCol(0);
- musical = false;
+ when_ = w;
+ pcol_l_ = new PCol(0);
+ musical_ = false;
}
bool
Score_column::used() {
- return pcol_->used();
+ return pcol_l_->used();
}
void
Score_column::print() const
{
#ifndef NPRINT
- mtor << "Score_column { mus "<< musical <<" at " << when<<'\n';
+ mtor << "Score_column { mus "<< musical_ <<" at " << when_<<'\n';
mtor << "durations: [";
- for (int i=0; i < durations.sz(); i++)
+ for (int i=0; i < durations.size(); i++)
mtor << durations[i] << " ";
mtor << "]\n";
- pcol_->print();
+ pcol_l_->print();
mtor << "}\n";
#endif
}
void
Score_column::add_duration(Moment d)
{
- for (int i = 0; i< durations.sz(); i++) {
+ for (int i = 0; i< durations.size(); i++) {
if (d == durations[i])
return ;
}
void
Score::process()
{
- *mlog << "\nProcessing ... ";
+ *mlog << "\nProcessing music ... ";
- assert (paper_);
+ assert (paper_p_);
/// distribute commands to disciples
- pscore_ = new PScore(paper_);
+ pscore_p_ = new PScore(paper_p_);
for (iter_top(staffs_,i); i.ok(); i++) {
- i->process_commands(last());
- i->set_output(pscore_);
+ i->truncate_cols(last());
+ i->set_output(pscore_p_);
i->process();
}
// do this after processing, staffs first have to generate PCols.
- do_pcols();
-
- clean_cols(); // can't move this farther up.
-
+ find_col(last(), false)->set_breakable();
+ do_cols();
calc_idealspacing();
// debugging
- print ();
OK();
-
- pscore_->preprocess();
- *mlog << "Calculating ... ";
- pscore_->calc_breaking();
- *mlog << "Postprocessing ... ";
- pscore_->postprocess();
-
- // TODO: calculate vertical structs?
- // TODO: calculate mixed structs.?
+ pscore_p_->process();
*mlog << "\n";
}
i->clean_cols();
for (iter_top(cols_,c); c.ok(); ) {
- if (!c->pcol_->used()) {
+ if (!c->pcol_l_->used()) {
c.del();
} else {
c->preprocess();
c++;
}
}
-
- pscore_->clean_cols();
}
/*
this sux. We should have Score_column create the appropriate PCol.
Score_column* c1 = new Score_column(w);
Score_column* c2 = new Score_column(w);
- c1->musical = false;
- c2->musical = true;
+ c1->musical_ = false;
+ c2->musical_ = true;
iter_top(cols_,i);
for (; i.ok(); i++) {
- assert(i->when != w);
- if (i->when > w)
+ assert(i->when() != w);
+ if (i->when() > w)
break;
}
{
iter_top(cols_,i);
for (; i.ok(); i++) {
- if (i->when == w && i->musical == mus)
+ if (i->when() == w && i->musical_ == mus)
return i;
- if (i->when > w)
+ if (i->when() > w)
break;
}
i = create_cols(w);
}
void
-Score::do_pcols()
+Score::do_cols()
{
iter_top(cols_,i);
for (; i.ok(); i++) {
- pscore_->add(i->pcol_);
+ pscore_p_->add(i->pcol_l_);
}
+ clean_cols(); // can't move clean_cols() farther up.
}
Moment
Score::last() const
#ifndef NDEBUG
for (iter_top(staffs_,i); i.ok(); i++) {
i->OK();
- assert(i->score_ == this);
+ assert(i->score_l_ == this);
}
staffs_.OK();
cols_.OK();
for (iter_top(cols_,cc); cc.ok() && (cc+1).ok(); cc++) {
- assert(cc->when <= (cc+1)->when);
+ assert(cc->when() <= (cc+1)->when());
}
#endif
}
for (iter_top(cols_,i); i.ok(); i++) {
i->print();
}
- if (pscore_)
- pscore_->print();
+ if (pscore_p_)
+ pscore_p_->print();
mtor << "}\n";
#endif
Score::Score(Paperdef*p)
{
- pscore_=0;
- paper_ = p;
+ pscore_p_=0;
+ paper_p_ = p; // ?? safe?
}
Score::~Score()
{
- delete pscore_;
+ delete pscore_p_;
+ delete paper_p_;
}
void
Score::output(String s)
{
OK();
- if (paper_->outfile=="")
- paper_->outfile = s;
+ if (paper_p_->outfile=="")
+ paper_p_->outfile = s;
- *mlog << "output to " << paper_->outfile << "...\n";
- Tex_stream the_output(paper_->outfile);
- pscore_->output(the_output);
+ *mlog << "output to " << paper_p_->outfile << "...\n";
+ Tex_stream the_output(paper_p_->outfile);
+ pscore_p_->output(the_output);
}
void
Score::add(Staff*s)
{
- s->score_ = this;
+ s->score_l_ = this;
staffs_.bottom().add(s);
}
}
-Line_of_score::Line_of_score(svec<PCol *> sv,
+Line_of_score::Line_of_score(Array<PCol *> sv,
PScore *ps)
{
- pscore_ = ps;
- for (int i=0; i< sv.sz(); i++) {
+ pscore_l_ = ps;
+ for (int i=0; i< sv.size(); i++) {
PCol *p=(PCol *) sv[i];
cols.bottom().add(p);
- p->line=this;
+ p->line_l_=this;
}
- for (iter_top(pscore_->staffs,sc); sc.ok(); sc++)
+ for (iter_top(pscore_l_->staffs,sc); sc.ok(); sc++)
staffs.bottom().add(new Line_of_staff(this, sc));
}
/* construct a line with the named columns. Make the line field
#include "score.hh"
#include "string.hh"
-static svec<Input_score*> sv;
+static Array<Input_score*> score_array_global;
static String outfn="lelie.uit";
void
do_scores()
{
- for (int i=0; i < sv.sz(); i++) {
- Score * s = sv[i]->parse();
- delete sv[i];
-
- s->process();
- s->output(outfn);
- delete s;
+ for (int i=0; i < score_array_global.size(); i++) {
+ Score * s_p = score_array_global[i]->parse();
+ delete score_array_global[i];
+ s_p->print ();
+ s_p->process();
+ s_p->output(outfn);
+ delete s_p;
}
- sv.set_size(0);
+ score_array_global.set_size(0);
}
void
add_score(Input_score * s)
{
- sv.add(s);
+ score_array_global.add(s);
}
#include "molecule.hh"
#include "lookup.hh"
-Script::Script(Script_req* rq, Item*i , int staflen, Stem*st_p)
+Script::Script(Script_req* rq, Item*i , int staflen, Stem*st_l)
{
- dependencies.add(st_p);
+ dependencies.add(st_l);
dependencies.add(i);
staffsize =staflen;
- specs = rq->scriptdef;
+ specs_l_ = rq->scriptdef;
support= i;
- stem_ = st_p;
+ stem_l_ = st_l;
pos = 0;
symdir=1;
dir =rq->dir;
void
Script::set_symdir()
{
- if (specs->invertsym)
+ if (specs_l_->invertsym)
symdir = (dir < 0) ? -1:1;
}
void
Script::set_default_dir()
{
- if (specs->stemdir) {
- if (!stem_)
+ if (specs_l_->stemdir) {
+ if (!stem_l_)
dir = 1;
else
- dir = stem_->dir * specs->stemdir;
+ dir = stem_l_->dir * specs_l_->stemdir;
}
}
void
Script::set_default_pos()
{
- assert(dir);
- Real y;
Real inter= paper()->internote();
-
- int d = specs->staffdir;
+ Interval dy = symbol().dim.y;
+
+ int d = specs_l_->staffdir;
if (!d) {
Interval v= support->height();
- pos = rint(v[dir]/inter) + dir* 2;
+ pos = rint((v[dir] -dy[-dir])/inter) + dir* 2;
} else {
- y = (d > 0) ? staffsize + 2: -2; // ug
+ Real y = (d > 0) ? staffsize + 2: -2; // ug
y *=inter;
Interval v= support->height();
- if (dir > 0) {
+ if (d > 0) {
y = y >? v.max();
- }else if (dir < 0) {
+ } else if (d < 0) {
y = y <? v.min();
}
+
+ if (stem_l_) {
+ Interval v= stem_l_->height();
+
+ if (d > 0) {
+ y = y >? v.max();
+ }else if (d < 0) {
+ y = y <? v.min();
+ }
+ }
pos = int(rint(Real(y)/inter));
}
}
Interval
Script::width() const
{
- return paper()->lookup_->script(specs->symidx).dim.x;
+ return symbol().dim.x;
+}
+
+Symbol
+Script::symbol()const
+{
+ String preidx = (symdir < 0) ?"-" :"";
+ return paper()->lookup_p_->script(preidx+specs_l_->symidx);
}
void
{
set_default_pos();
}
+
Molecule*
Script::brew_molecule() const
{
- Paperdef *p =paper();
-
- Real dy = p->internote();
- String preidx = (symdir < 0) ?"-" :"";
- Symbol ss =p->lookup_->script(preidx+specs->symidx);
- Molecule*out = new Molecule(Atom(ss));
+ Real dy = paper()->internote();
+
+ Molecule*out = new Molecule(Atom(symbol()));
out->translate(Offset(0,dy * pos));
- return
- out;
+ return out;
}
Simple_staff::get_TYPESET_item(Command *com)
{
Item *s=0;
- svec<Scalar> arg( com->args);
+ Array<Scalar> arg( com->args);
String type =arg[0];
arg.del(0);
if (type == "BAR" ) {
Interval
-itemlist_width(const svec<Item*> &its)
+itemlist_width(const Array<Item*> &its)
{
Interval iv ;
iv.set_empty();
- for (int j =0; j < its.sz(); j++){
+ for (int j =0; j < its.size(); j++){
iv.unite (its[j]->width());
}
{
assert(i);
- staff_->pscore_->typeset_item(i, score_column->pcol_,
+ staff_->pscore_l_->typeset_item(i, score_column_l_->pcol_l_,
staff_->theline,breakst);
if (breakst == BREAK_PRE - BREAK_PRE) {
- svec<Item*> to_move(
- staff_->pscore_->select_items(staff_->theline,
- score_column->pcol_->prebreak));
+ Array<Item*> to_move(
+ staff_->pscore_l_->select_items(staff_->theline,
+ score_column_l_->pcol_l_->prebreak_p_));
Interval column_wid = itemlist_width(to_move);
assert(!column_wid.empty());
- for (int j=0; j < to_move.sz(); j++) {
+ for (int j=0; j < to_move.size(); j++) {
to_move[j]->translate(Offset(-column_wid.right, 0));
}
}
Simple_column::typeset_item_directional(Item *i, int dir, int breakst)
{
assert(i);
- PCol * c=score_column->pcol_;
+ PCol * c=score_column_l_->pcol_l_;
if (breakst == 0)
- c = c->prebreak;
+ c = c->prebreak_p_;
else if (breakst == 2)
- c = c->postbreak;
+ c = c->postbreak_p_;
- svec<Item*> to_move(staff_->pscore_->select_items(staff_->theline,
+ Array<Item*> to_move(staff_->pscore_l_->select_items(staff_->theline,
c));
typeset_item(i, breakst);
void
Simple_staff::set_output(PScore* ps )
{
- pscore_ = ps;
- pscore_->add(theline);
+ pscore_l_ = ps;
+ pscore_l_->add(theline);
}
void
Simple_column::process_requests()
{
- for (int i = 0 ; i < v_elts.sz(); i ++)
+ for (int i = 0 ; i < v_elts.size(); i ++)
for (iter_top(v_elts[i]->reqs,j); j.ok(); j++) {
Request *rq= j;
+ if (rq->barcheck()) {
+ if (tdescription_->whole_in_measure) {
+ error("Barcheck failed, " + tdescription_->str());
+ }
+ }
+
if (rq->rhythmic()){
notes.add(rq->rhythmic());
}
/*
- UGR
+ UGR!! CHAOS RULEZ
*/
#include "textspanner.hh"
#include "script.hh"
#include "textitem.hh"
Rhythmic_grouping
-parse_grouping(svec<Scalar> a, Moment one_beat)
+parse_grouping(Array<Scalar> a, Moment one_beat)
{
- svec<int> r;
- for (int i= 0 ; i < a.sz(); i++)
+ Array<int> r;
+ for (int i= 0 ; i < a.size(); i++)
r.add(a[i]);
Moment here =0.0;
- svec<Rhythmic_grouping*> children;
- for (int i=0; i < r.sz(); i++) {
+ Array<Rhythmic_grouping*> children;
+ for (int i=0; i < r.size(); i++) {
Moment last = here;
here += one_beat * r[i];
void
Simple_walker::do_INTERPRET_command(Command*com)
{
- svec<Scalar> args(com->args);
+ Array<Scalar> args(com->args);
args.del(0);
if (com->args[0] == "GROUPING") {
default_grouping = parse_grouping(args,
col()->tdescription_->one_beat);
- }else if (com->args[0] == "BAR") {
+ }else if (com->args[0] == "NEWMEASURE") {
local_key_.reset(key_);
} else if (com->args[0] == "KEY") {
if (col()->when() > Moment(0)) {
assert(!oldkey_undo);
- oldkey_undo = new svec<int>( key_.oldkey_undo(args));
+ oldkey_undo = new Array<int>( key_.oldkey_undo(args));
}
typesetkey = key_.read(args);
if (processed_clef)
return;
}
-
+ if (com->args[0] == "BAR") {
+
+ if (processed_bar_priority > com->priority)
+ return;
+ else
+ processed_bar_priority = com->priority;
+ }
Item* i = staff()->get_TYPESET_item(com);
if (!i)
Item*rhythmic=0;
if (n.rq->note()) {
Note_req * req = n.rq->note() ;
- const Voice *v = req->elt->voice_;
+ const Voice *v = req->elt_l_->voice_;
Notehead*n = s->get_notehead(req, clef_.c0_pos);
rhythmic=n;
- stem_->add(n);
+ if (stem_)
+ stem_->add(n);
+
if (current_grouping) {
current_grouping->add_child(
c->tdescription_->whole_in_measure, req->duration());
error("Too many beams (t = "
+String(c->when())+")");
beam_ = new Beam;
+ assert(!current_grouping);
current_grouping = new Rhythmic_grouping;
}
- for (int i=0; i < c->slurs.sz(); i++) {
+ for (int i=0; i < c->slurs.size(); i++) {
Slur_req*sl = c->slurs[i];
if (sl->spantype == Span_req::START) {
- if (find_slur(sl->elt->voice_ )>=0)
+ if (find_slur(sl->elt_l_->voice_ )>=0)
error_t("Too many slurs in voice", col()->when());
pending_slur_reqs.add(sl);
pending_slurs.add(new Slur);
stem_ = s->get_stem(c->stem_->stem(), c->stem_requester_len);
}
- for (int i = 0; i < c->notes.sz(); i ++) {
+ for (int i = 0; i < c->notes.size(); i ++) {
do_note(c->notes[i]);
}
/* needed, otherwise placement of
local_key fucks up */
}
+
if (c->beam_&& c->beam_->spantype == Span_req::STOP) {
beam_->set_grouping(default_grouping, *current_grouping);
pscore_->typeset_spanner(beam_, s->theline);
delete current_grouping;
current_grouping =0;
}
- for (int i = 0; i < noteheads.sz(); i++) {
+ for (int i = 0; i < noteheads.size(); i++) {
c->typeset_item(noteheads[i]);
}
noteheads.set_size(0);
if (stem_) {
stem_ = 0;
}
- for (int i=0; i < c->slurs.sz(); i++) {
+ for (int i=0; i < c->slurs.size(); i++) {
Slur_req *sl = c->slurs[i];
if (sl->spantype == Span_req::STOP) {
- int idx = find_slur(sl->elt->voice_);
+ int idx = find_slur(sl->elt_l_->voice_);
if (idx < 0)
- error("can't find slur to end");
+ error_t("can't find slur to end; ", c->when());
pscore_->typeset_spanner(pending_slurs[idx],
s->theline);
}
Simple_walker::Simple_walker(Simple_staff*s)
- : Staff_walker(s, s->theline->pscore_)
+ : Staff_walker(s, s->theline->pscore_l_)
{
stem_ = 0;
beam_ =0;
{
processed_clef =false;
processed_key = false;
+ processed_bar_priority = 0;
}
int
Simple_walker::find_slur(const Voice *v)
{
- for (int i=0; i < pending_slur_reqs.sz(); i++) {
- if (pending_slur_reqs[i]->elt->voice_ == v)
+ for (int i=0; i < pending_slur_reqs.size(); i++) {
+ if (pending_slur_reqs[i]->elt_l_->voice_ == v)
return i;
}
return -1;
Slur::set_default_dir()
{
int sumpos=0;
- for (int i=0; i < encompass.sz(); i ++) {
+ for (int i=0; i < encompass.size(); i ++) {
sumpos += encompass[i]->position;
}
/* should consult stems */
- Real meanpos = sumpos/Real(encompass.sz());
+ Real meanpos = sumpos/Real(encompass.size());
if (meanpos < 5) // todo
dir = -1;
else
void
Slur::do_pre_processing()
{
- right = encompass.last()->pcol_;
- left = encompass[0]->pcol_;
+ right = encompass.last()->pcol_l_;
+ left = encompass[0]->pcol_l_;
}
Spanner*
Slur::do_break_at(PCol*l, PCol*r) const
{
- assert(l->line == r->line);
+ assert(l->line_l_ == r->line_l_);
Slur*ret = new Slur(*this);
ret->encompass.set_size(0);
- for (int i =0; i < encompass.sz(); i++) {
- if (encompass[i]->pcol_->line==l->line)
+ for (int i =0; i < encompass.size(); i++) {
+ if (encompass[i]->pcol_l_->line_l_==l->line_l_)
ret->encompass.add(encompass[i]);
}
if (right != r)
Slur::brew_molecule() const
{
Molecule*output = new Molecule;
- assert(left->line == right->line);
+
int minp=1000, maxp=-1000; // todo
- for (int i=0; i<encompass.sz(); i++) {
+ for (int i=0; i<encompass.size(); i++) {
minp = encompass[i]->position <? minp;
maxp = encompass[i]->position >? maxp;
}
- assert(encompass.sz()>0); // todo
+ assert(encompass.size()>0); // todo
Notehead *lnote_p =encompass[0];
Notehead *rnote_p =encompass.last();
- int pos1 = lnote_p->position;
- int pos2 = rnote_p->position;
-
- int dy = pos2-pos1;
+ int lpos_i = lnote_p->position;
+ int rpos_i = rnote_p->position;
+ Offset left_off(lnote_p->x_dir, lpos_i + 2*dir);
+ Offset right_off(lnote_p->x_dir, rpos_i + 2*dir);
+ if (!lnote_p->extremal)
+ left_off += Offset(0.5, -dir);
+ if (!rnote_p->extremal)
+ right_off+= Offset(-0.5, -dir);
+
+ int dy = right_off.y - left_off.y;
+
Real nw_f = paper()->note_width();
+ Real nh_f = paper()->internote();
Real w = width().length();
- w+= (-lnote_p->x_dir + rnote_p->x_dir)* nw_f ;
+
+ w+= (right_off.x - left_off.x) * nw_f ;
Real round_w = w; // slur lookup rounds the slurwidth .
- Symbol sl = paper()->lookup_->slur(dy , round_w, dir);
+ Symbol sl = paper()->lookup_p_->slur(dy , round_w, dir);
Real error = w-round_w;
Atom a(sl);
- a.translate(Offset((lnote_p->x_dir + 0.5 )*nw_f + error/2,
- (pos2+2*dir) * paper()->internote()));
+ a.translate(Offset((left_off.x + 0.5 )*nw_f + error/2,
+ left_off.y * nh_f));
output->add(a);
return output;
}
}
void
-Staff::process_commands(Moment l)
+Staff::truncate_cols(Moment l)
{
- if (staff_commands_)
- staff_commands_->clean(l);
+ iter_bot(cols, i);
+ for (; i->when() > l; i=cols.bottom()) {
+ i.del();
+ }
}
Paperdef*
Staff::paper() const
{
- return score_->paper_;
+ return score_l_->paper_p_;
}
void
{
iter_top(cols,i);
for(; i.ok(); ){
- if (!i->score_column->used())
+ if (!i->score_column_l_->used())
i.del();
else
i++;
Staff_column *
Staff::get_col(Moment w, bool mus)
{
- Score_column* sc = score_->find_col(w,mus);
- assert(sc->when == w);
+ Score_column* sc = score_l_->find_col(w,mus);
iter_top(cols,i);
for (; i.ok(); i++) {
- if (*i->score_column > *sc) // too far
+
+ if (*i->score_column_l_ > *sc) // too far
break;
- if (sc == i->score_column)
+ if (sc == i->score_column_l_)
return i;
}
- /* post: *sc > *->score_column || !i.ok() */
+ /* post: *sc > *->score_column_l_ || !i.ok() */
Staff_column* newst = create_col(sc);
if (!i.ok()) {
return newst;
}
-// ; assert((i-1).ok())
- // todo!
// making a fix at 2:30 am, with several beers drunk.
// but it works :-)
now += ve->duration;
}
}
+ set_time_descriptions();
+}
- for (iter_top(*staff_commands_,cc); cc.ok(); cc++) {
- Staff_column *sc=get_col(cc->tdescription_.when,false);
- sc->s_commands = cc;
- sc->tdescription_ = new Time_description(cc->tdescription_);
- }
-
- iter_top(*staff_commands_,cc);
+void
+Staff::set_time_descriptions()
+{
+ Time_description t(0,0);
for (iter_top(cols,i); i.ok(); i++) {
- while ((cc+1).ok() && (cc+1)->when() < i->when())
- cc++;
-
+ if (i->staff_commands_p_)
+ t = i->staff_commands_p_->tdescription_;
+ else if (i->tdescription_)
+ t = *i->tdescription_;
if(!i->tdescription_) {
- if (cc->tdescription_.when == i->when())
- i->tdescription_ = new Time_description(cc->tdescription_);
- else
- i->tdescription_ = new Time_description(
- i->when() - cc->when() ,&cc->tdescription_);
+ i->tdescription_ = new Time_description(i->when() - t.when ,&t);
}
}
-}
+}
void
Staff::process()
{
#ifndef NDEBUG
cols.OK();
voices.OK();
- assert(score_);
+ assert(score_l_);
#endif
}
for (iter_top(voices,i); i.ok(); i++) {
i->print();
}
- if (staff_commands_)
- staff_commands_->print();
mtor <<"}\n";
#endif
}
Staff::Staff()
{
- staff_commands_ = 0;
- score_ =0;
- pscore_=0;
+ score_l_ =0;
+ pscore_l_ =0;
}
#include "staffcommands.hh"
#include "debug.hh"
#include "parseconstruct.hh"
+#include "getcommand.hh"
Moment
Staff_commands_at::when()
void
Staff_commands_at::OK()const
{
+#ifndef NDEBUG
iter_top(*this,i);
for (; i.ok() && (i+1).ok(); i++)
if (!i->isbreak() && !(i+1)->isbreak())
assert(i->priority >= (i+1)->priority);
+#endif
}
Staff_commands_at::Staff_commands_at(Time_description m)
void
Staff_commands_at::set_breakable()
{
- assert(!is_breakable());
+ if (is_breakable()) return;
Command k;
k.code = BREAK_PRE;
Command typeset; // kut met peren
typeset.code = TYPESET;
typeset.args = c.args;
- if (c.args[0] == "BAR") {
- typeset.priority = 100;
+ if (c.args[0] == "NEWMEASURE") {
+ add(get_defaultbar_command());
+ } else if (c.args[0] == "BAR") {
add(typeset);
+ c.code= NOP; // no INTERPRET (BAR) commands
} else if (c.args[0] == "KEY") {
typeset.priority = 70;
add(typeset);
if (c.args[0] == "BAR") {
set_breakable();
encapsulate = true;
- mid = c;
- pre = c;
+ split_bar_command(pre,mid,post, c.args[1]);
+
{ /* every line a currentkey. */
Command kc;
kc.code =TYPESET;
}
}
-
-/****************************************************************/
-
-void
-Staff_commands::OK() const
-{
-#ifndef NDEBUG
- for (iter_top(*this,i); i.ok() && (i+1).ok(); i++) {
- assert(i->tdescription_.when <= (i+1)->tdescription_.when);
- i->OK();
- }
-#endif
-}
-
-void
-Staff_commands::print() const
-{
-#ifndef NPRINT
- for (iter_top(*this,i); i.ok() ; i++) {
- i->print();
- }
-#endif
-}
-
-Staff_commands_at*
-Staff_commands::find(Moment w)
-{
- PCursor<Staff_commands_at*> i(bottom());
- for (; i.ok() ; i--) {
- if (i->tdescription_.when == w)
- return i;
- if (i->tdescription_.when < w)
- break;
- }
- return 0;
-}
-
-void
-Staff_commands::add(Staff_commands_at*p)
-{
- PCursor<Staff_commands_at*> i(bottom());
- for (; i.ok() ; i--) {
- if (i->tdescription_.when < p->tdescription_.when)
- break;
- }
- if (!i.ok())
- i.insert(p);
- else {
- i.add(p);
- i++;
- }
-}
-
-void
-Staff_commands::clean(Moment l)
-{
- PCursor<Staff_commands_at*> i(bottom());
- for (; i->tdescription_.when > l; i=bottom()) {
- remove(i);
- }
-
- Staff_commands_at*p = find(l);
- if (!p) {
- p = new Staff_commands_at(Time_description(l - i->when(), &i->tdescription_));
- add(p);
- }
- if (!p->is_breakable()) {
- p->set_breakable();
- }
-}
String
Staff_elem::TeXstring() const
{
- assert(output && !calc_children);
+ assert(!calc_children);
Molecule m(*output);
m.translate(offset_); // ugh?
return m.TeXstring();
}
+Staff_elem::Staff_elem(Staff_elem const&s)
+ : dependencies(s.dependencies)
+{
+ status = s.status;
+ assert(!s.output);
+ output = 0;
+ pstaff_l_ = s.pstaff_l_;
+ calc_children = false;
+ offset_ = Offset(0,0);
+}
+
Staff_elem::~Staff_elem()
{
delete output;
Staff_elem::Staff_elem()
{
calc_children = false;
- pstaff_=0;
+ pstaff_l_=0;
offset_ = Offset(0,0);
output = 0;
status = ORPHAN;
Paperdef*
Staff_elem::paper() const
{
- assert(pstaff_);
- return pstaff_->pscore_->paper_;
+ assert(pstaff_l_);
+ return pstaff_l_->pscore_l_->paper_l_;
}
void
{
if (status >= PRECALCED )
return;
- for (int i=0; i < dependencies.sz(); i++)
+ for (int i=0; i < dependencies.size(); i++)
if (dependencies[i])
dependencies[i]->pre_processing();
if (!calc_children)
{
if (status > POSTCALCED)
return;
- for (int i=0; i < dependencies.sz(); i++)
+ for (int i=0; i < dependencies.size(); i++)
if (dependencies[i])
dependencies[i]->post_processing();
if (!calc_children)
{
if (status >= OUTPUT)
return;
- for (int i=0; i < dependencies.sz(); i++)
+ for (int i=0; i < dependencies.size(); i++)
if (dependencies[i])
dependencies[i]->molecule_processing();
if (!calc_children)
// the staff itself: eg lines, accolades
s += "\\hbox{";
{
- ((PStaff*)pstaff_)->
- brew_molecule(line_of_score_->pscore_->paper_->linewidth);
+ ((PStaff*)pstaff_l_)->
+ brew_molecule(line_of_score_l_->pscore_l_->paper_l_->linewidth);
- s+=pstaff_->stafsym->TeXstring();
- iter_top(line_of_score_->cols,cc);
+ s+=pstaff_l_->stafsym_p_->TeXstring();
+ iter_top(line_of_score_l_->cols,cc);
Real lastpos=cc->hpos;
// all items in the current line & staff.
// now output the items.
for (iter_top(cc->its,i); i.ok(); i++) {
- if (i->pstaff_ == pstaff_)
+ if (i->pstaff_l_ == pstaff_l_)
s += i->TeXstring();
}
// spanners.
for (iter_top(cc->starters,i); i.ok(); i++)
- if (i->pstaff_ == pstaff_)
+ if (i->pstaff_l_ == pstaff_l_)
s += i->TeXstring();
}
}
Line_of_staff::Line_of_staff(Line_of_score * sc, PStaff*st)
{
- line_of_score_=sc;
- pstaff_=st;
+ line_of_score_l_=sc;
+ pstaff_l_=st;
PCol *linestart = sc->cols.top();
PCol *linestop = sc->cols.bottom();
- for (iter_top(pstaff_->spans,i); i.ok(); i++) {
+ for (iter_top(pstaff_l_->spans,i); i.ok(); i++) {
PCol *brokenstart = &max(*linestart, *i->left);
PCol *brokenstop = &min(*linestop, *i->right);
if ( *brokenstart < *brokenstop) {
Spanner*span_p =i->broken_at(brokenstart,brokenstop);
- line_of_score_->pscore_-> // higghl
+ line_of_score_l_->pscore_l_-> // higghl
add_broken(span_p);
}
}
Interval
Line_of_staff::height() const
{
- Interval y = pstaff_->stafsym->extent().y;
- iter_top(line_of_score_->cols,cc);
+ Interval y = pstaff_l_->stafsym_p_->extent().y;
+ iter_top(line_of_score_l_->cols,cc);
// all items in the current line & staff.
for (; cc.ok(); cc++) {
for (iter_top(cc->its,i); i.ok(); i++) {
- if (i->pstaff_ == pstaff_)
+ if (i->pstaff_l_ == pstaff_l_)
y.unite(i->height());
}
// spanners.
for (iter_top(cc->starters,i); i.ok(); i++)
- if (i->pstaff_ == pstaff_) {
+ if (i->pstaff_l_ == pstaff_l_) {
y.unite(i->height());
}
}
void
Line_of_staff::process()
{
- if (!pstaff_->stafsym)
- pstaff_->brew_molecule(line_of_score_->pscore_->
- paper_->linewidth);
+ if (!pstaff_l_->stafsym_p_)
+ pstaff_l_->brew_molecule(line_of_score_l_->pscore_l_->
+ paper_l_->linewidth);
}
#include "voice.hh"
#include "timedescription.hh"
#include "sccol.hh"
+#include "staffcommands.hh"
#include "stcol.hh"
+void
+Staff_column::OK() const
+{
+#ifndef NDEBUG
+ if (tdescription_) {
+ assert(tdescription_->when == when());
+ assert(*tdescription_ == staff_commands_p_->tdescription_);
+ }
+ #endif
+}
+
bool
Staff_column::mus() const
{
- return score_column->musical;
+ return score_column_l_->musical_;
}
Moment
Staff_column::when() const
{
- return score_column->when;
+ return score_column_l_->when();
}
void
{
Moment d= ve->duration;
if (d){
- score_column->add_duration(d);
+ score_column_l_->add_duration(d);
}
v_elts.add(ve);
}
-Staff_column::Staff_column(Score_column*s)
+Staff_column::Staff_column(Score_column *s_l)
{
- score_column = s;
- s_commands = 0;
- tdescription_ = 0;
+ tdescription_ =0;
+ score_column_l_ = s_l;
+ staff_commands_p_ = 0;
}
Staff_column::~Staff_column()
Stem::set_noteheads()
{
heads.sort(Notehead::compare);
+ heads[0]->extremal = -1;
+ heads.last()->extremal = 1;
int parity=1;
int lastpos = heads[0]->position;
- for (int i=1; i < heads.sz(); i ++) {
+ for (int i=1; i < heads.size(); i ++) {
int dy =abs(lastpos- heads[i]->position);
if (dy <= 1) {
if (!print_flag || abs(flag) <= 4)
return Interval(0,0); // TODO!
Paperdef*p= paper();
- Interval r(p->lookup_->flag(flag).dim.x);
+ Interval r(p->lookup_p_->flag(flag).dim.x);
r+= stem_xoffset;
return r;
}
Molecule*
Stem::brew_molecule()const return out;
{
- assert(pstaff_);
assert(bot!=top);
Paperdef *p =paper();
Real dy = p->internote();
- Symbol ss =p->lookup_->stem(bot*dy,top*dy);
+ Symbol ss =p->lookup_p_->stem(bot*dy,top*dy);
out = new Molecule(Atom(ss));
if (print_flag&&abs(flag) > 4){
- Symbol fl = p->lookup_->flag(flag);
+ Symbol fl = p->lookup_p_->flag(flag);
Molecule m(fl);
if (flag < -4){
out->add_bottom(m);
Real
Stem::hpos()const
{
- return pcol_->hpos + stem_xoffset;
+ return pcol_l_->hpos + stem_xoffset;
}
#include "sccol.hh"
Staff_walker::~Staff_walker() {}
+Staff_walker::Staff_walker(Staff_walker const &s)
+ :PCursor<Staff_column*> (s)
+{
+ assert(false);
+}
Staff_walker::Staff_walker(Staff * s, PScore*ps )
: PCursor<Staff_column*> (s->cols)
Staff_walker::process()
{
break_status = BREAK_END - BREAK_PRE;
- if (ptr()->s_commands)
- for (iter_top(*ptr()->s_commands,i); i.ok(); i++) {
+ if (ptr()->staff_commands_p_)
+ for (iter_top(*ptr()->staff_commands_p_,i); i.ok(); i++) {
process_command(i);
}
case BREAK_MIDDLE:
case BREAK_POST:
case BREAK_END:
- (*this)->score_column->set_breakable();
+ (*this)->score_column_l_->set_breakable();
break_status = com->code- BREAK_PRE;
break;
case INTERPRET:
#include "symbol.hh"
-#include "vray.hh"
+#include "varray.hh"
Symbol::Symbol()
#include "scoreline.hh"
#include "staffline.hh"
-
+#include "pcursor.tcc"
#include "plist.tcc"
#define IPLC_instantiate(a) IPL_instantiate(a); PL_instantiate(const a)
-IPLC_instantiate(Stem*);
+
IPLC_instantiate(Line_of_score);
IPLC_instantiate(Line_of_staff);
IPLC_instantiate(Item);
#include "spanner.hh"
#include "plist.tcc"
-
+#include "pcursor.tcc"
IPL_instantiate(Request);
IPL_instantiate(Score_column);
#include "plist.tcc"
-
+#include "pcursor.tcc"
IPL_instantiate(Atom);
IPL_instantiate(Command);
IPL_instantiate(Atom);
#include "tex.hh"
#include "symbol.hh"
#include "const.hh"
-#include "vray.hh"
+#include "varray.hh"
String
vstrut(Real h)
String
-substitute_args(String source, svec<String> args)
+substitute_args(String source, Array<String> args)
{
String retval (source);
- for (int i = 0 ; i < args.sz(); i++)
+ for (int i = 0 ; i < args.size(); i++)
substitute_arg(retval, args[i]);
while (retval.pos('%'))
substitute_arg(retval, "");
return retval;
}
String
-substitute_args(String source, svec<Scalar> args)
+substitute_args(String source, Array<Scalar> args)
{
- svec<String> sv;
- for (int i = 0 ; i < args.sz(); i++)
+ Array<String> sv;
+ for (int i = 0 ; i < args.size(); i++)
sv.add(args[i]);
return substitute_args(source, sv);
{
Symbol bs=(*symtables_)("beamslopes")->lookup("slope");
- svec<String> args;
+ Array<String> args;
args.add(sidx);
args.add(widx);
bs.tex = substitute_args(bs.tex,args);
Lookup::rule_symbol(Real height, Real width)
{
Symbol bs=(*symtables_)("beamslopes")->lookup("horizontal");
- svec<String> args;
+ Array<String> args;
args.add(print_dimen(height));
args.add(print_dimen(width));
bs.tex = substitute_args(bs.tex,args);
Atom
Text_def::create(Paperdef*p) const
{
- return p->lookup_->text(style, text, -align);
+ return p->lookup_p_->text(style, text, -align);
}
void
#include "timedescription.hh"
#include "debug.hh"
+String
+Time_description::str()const
+{
+ String s( "Time_description { at ");
+ s+=when;
+ s+="\nmeter " + String(whole_per_measure/one_beat) +":" +(1/one_beat);
+ s+= "\nposition "+String( bars) + ":"+ whole_in_measure +"\n}\n";
+ return s;
+}
void
Time_description::print() const
{
- mtor << "Time_description { at "<<when<<'\n';
- mtor << "meter " << whole_per_measure << ":" << 1/one_beat
- << "\nposition "<< bars << ":" << whole_in_measure <<"\n}\n";
+ mtor << str();
}
void
Time_description::OK() const
{
+#ifdef NDEBUG
assert(whole_in_measure < whole_per_measure && 0 <= whole_in_measure);
assert(one_beat);
+#endif
}
+
Time_description::Time_description(Moment dt, Time_description const *prev)
{
if (prev) {
- assert(dt >0);
+ assert(dt >= 0);
*this = *prev;
when += + dt;
whole_in_measure += dt;
error_t ("Partial measure has incorrect size", when);
whole_in_measure = whole_per_measure - p;
}
+
Moment
Time_description::barleft()
{
-return whole_per_measure-whole_in_measure;
+ return whole_per_measure-whole_in_measure;
+}
+
+int
+Time_description::compare(Time_description &t1, Time_description&t2)
+{
+ int i = sign(t1.when-t2.when);
+
+ if (!i) {
+ assert(t1.bars==t2.bars);
+ assert(t1.one_beat == t2.one_beat);
+ assert(t1.whole_in_measure == t2.whole_in_measure);
+ assert(t1.whole_per_measure == t2.whole_per_measure);
+ }
+
+ return i;
}
Voice::Voice(Voice const&src)
{
- PL_copy(elts, src.elts);
+ for (iter_top(src.elts, i); i.ok(); i++)
+ add(new Voice_element(**i));
+
start = src.start;
}
assert (!duration);
duration = r->duration();
}
- r->elt = this;
+ r->elt_l_ = this;
reqs.bottom().add(r);
}
Voice_element::Voice_element(Voice_element const&src)
{
- duration=src.duration;
voice_=src.voice_;
- IPointerList__copy(Request*, reqs, src.reqs, clone());
+ for (iter_top(src.reqs, i); i.ok(); i++)
+ add(i->clone());
group=src.group;
-// assert(!granted_items.size() && !granted_spanners.size());
}
#include "debug.hh"
#include "lexer.hh"
+#include "moment.hh"
ostream &warnout (cerr);
ostream *mlog(&cerr);
-
-
void
warning(String s)
{
}
void
-error_t(String s, Real r)
+error_t(const String& s, Moment r)
{
- String e=s+ "(t = " + r + ")";
+ String e=s+ "(t = " + String(r) + ")";
error(e);
exit(1);
}
*/
-svec<Col_configuration>
+Array<Col_configuration>
Word_wrap::solve()
{
problem_OK();
iter_top(pscore_.cols,curcol);
- svec<Col_configuration> breaking;
- svec<PCol *> breakpoints(find_breaks());
- assert(breakpoints.sz()>=2);
- for (int i=0 ; i < breakpoints.sz() -1; ) {
+ Array<Col_configuration> breaking;
+ Array<PCol *> breakpoints(find_breaks());
+ assert(breakpoints.size()>=2);
+ for (int i=0 ; i < breakpoints.size() -1; ) {
Col_configuration minimum;
Col_configuration current;
// do another line
- PCol *post = breakpoints[i]->postbreak;
+ PCol *post = breakpoints[i]->postbreak_p_;
current.add( post);
curcol++; // skip the breakable.
i++;
- while (i < breakpoints.sz()) {
+ while (i < breakpoints.size()) {
// add another measure.
while (breakpoints[i] != curcol.ptr()){
current.add(curcol);
curcol++;
}
- current.add(breakpoints[i]->prebreak );
+ current.add(breakpoints[i]->prebreak_p_ );
if (!feasible(current.cols)) {
- if (!minimum.cols.sz())
+ if (!minimum.cols.size())
error("sorry, this measure is too long");
break;
}
--- /dev/null
+\def\thetitle{}
+\def\thecomposer{}
+\def\theinstrument{}
+\def\title#1{\def\thetitle{#1}}
+\def\composer#1{\def\thecomposer{#1}}
+\def\instrument#1{\def\theinstrument{#1}}
+
+\def\maketit{
+ \begin{center}
+ {\Large\bfseries\thetitle}\\
+ \vskip12pt
+ {\bfseries\theinstrument}\hfill{\scshape\thecomposer}
+ \end{center}
+ \bigskip
+ }
\ No newline at end of file