From: Han-Wen Nienhuys Date: Fri, 10 Jan 1997 00:58:03 +0000 (+0100) Subject: release: 0.0.22 X-Git-Tag: release/0.0.22 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c8374706587ab2ba89c9355efb0d926ae9a9eaef;p=lilypond.git release: 0.0.22 --- diff --git a/.dstreamrc b/.dstreamrc index 8a79bb8f83..0c3afc09bd 100644 --- a/.dstreamrc +++ b/.dstreamrc @@ -3,7 +3,7 @@ My_flex_lexer 1 yyFlexLexer 1 PCol 1 -Score_column 1 +Score_column 0 Ineq_constrained_qp 1 Spacing_problem 0 Colinfo 0 @@ -21,18 +21,18 @@ parse_duration 1 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 diff --git a/Documentation/CodingStyle.pod b/Documentation/CodingStyle.pod index a0ffcaf4ea..995188dec2 100644 --- a/Documentation/CodingStyle.pod +++ b/Documentation/CodingStyle.pod @@ -6,8 +6,6 @@ CodingStyle - standards while programming for LilyPond Please use these standards while doing programming for LilyPond - - Functions and methods do not return errorcodes, but use assert for checking status. @@ -33,16 +31,16 @@ in emacs: =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 is a Hungarian notation postfix =head2 COMMENTS +The source is commented in the DOC++ style. Check out doc++ at +F + /// short description class Class { /// diff --git a/Documentation/README.pod b/Documentation/README.pod index 6ced7dae17..750aa773ea 100644 --- a/Documentation/README.pod +++ b/Documentation/README.pod @@ -9,25 +9,134 @@ Lilypond - a music typesetter =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 =head1 PREREQUISITES @@ -35,37 +144,46 @@ Compilation: =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: @@ -77,27 +195,48 @@ 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 ? +=item * +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 , Main author + +=item * +Jan Nieuwenhuizen , bits of FlowerLib, general comments. -Han-Wen Nienhuys , +=item * +Mats Bengtsson , 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 @@ -133,8 +272,10 @@ Check out kortjakje.ly, it has some comments =head1 PROBLEMS -If LilyPond bombs out, then please recompile using B<-g>, and send a gdb -stacktrace of the crash. It also helps if you can print the values of the objects. So if you trace is +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..) @@ -148,7 +289,7 @@ Than it would help if you send a dump of the Interval and the Item (use: 'print *this' or use LilyPond print() methods). This is a beta version of LilyPond. Please send your helpful comments -and patches to me, +and patches to me (see AUTHORS section) LilyPond is updated very frequently, the latest version is always available at: @@ -160,16 +301,11 @@ F F The initialisation file with symbol tables etc. It includes files from the directory F. -=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 contains some more-in-depth matter on LilyPond - -The source is commented in the DOC++ style. Check out doc++ at -F - -=back +LilyPond has no connection with the music package RoseGarden, other +than the names being similar. diff --git a/Documentation/lilygut.pod b/Documentation/lilygut.pod index 295ed2844c..20d5f0364b 100644 --- a/Documentation/lilygut.pod +++ b/Documentation/lilygut.pod @@ -5,7 +5,8 @@ LilyGuts - doco to the internals of LilyPond =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 @@ -67,48 +68,53 @@ Different staffs can produce different outputs; a melodious voice which is put into a percussion-Staff, will be typeset as the rythm of that voice. -After C made up her mind (Would C be a smart -name? How about C :-), the resultant items and +After C made up her mind, the resultant items and spanners are put on the PScore, and pointers to these items are stored in the C. This construction enables the beams/stems to look up the balls it has to connect to. =over 5 -=item Note_req +=item C + +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 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 to decide. The C can decide on positioning based on ottava commands and the appropriate clef. -=item Rest_req +=item C 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 This type of request typically results in the creation of a C -=item Beam_req +=item C 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 -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 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 @@ -145,7 +151,7 @@ This table decribes the proper order for the different commands: =head1 BREAKING -[Source files: command.hh, scommands.cc] +[Source files: F, F] BREAKING, PREBREAK POSTBREAK, etc. @@ -226,7 +232,7 @@ This is Columbus' egg: LilyPond attaches "springs" to each column-pair. each spring has an equilibrium-position which is equal to the above mentioned distance, so - spring (col1, col2) and spring(col2,col3) try to push column 1 +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 @@ -283,7 +289,6 @@ signifies a "list of". (This is not complete) [partly by Mark Basinski ] - Herbert Chlapik, W.A. Hegazy and J. S. Gourlay. Optimal line breaking in music. In diff --git a/NEWS b/NEWS index def00e3b86..a2033eb366 100644 --- a/NEWS +++ b/NEWS @@ -1,19 +1,34 @@ +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 diff --git a/README b/README index 9b08b5b1e3..414facda00 100644 --- a/README +++ b/README @@ -4,4 +4,16 @@ To generate the pretty-printed docs, do this: 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 diff --git a/Sources.make b/Sources.make index f274a9ebcd..0be964c269 100644 --- a/Sources.make +++ b/Sources.make @@ -22,33 +22,21 @@ hdr= qlp.hh linespace.hh qlpsolve.hh\ 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 diff --git a/Variables.make b/Variables.make index cd4a663b6e..eea032df7f 100644 --- a/Variables.make +++ b/Variables.make @@ -37,7 +37,7 @@ endif # version info MAJVER=0 MINVER=0 -PATCHLEVEL=21 +PATCHLEVEL=22 VERSION=$(MAJVER).$(MINVER).$(PATCHLEVEL) CXXVER=`$(CXX) --version` @@ -77,7 +77,8 @@ DNAME=$(PACKAGENAME)-$(VERSION) othersrc=lexer.l parser.y SCRIPTS=make_version make_patch genheader IFILES=dimen.tex symbol.ini kortjakje.ly pavane.ly maartje.ly\ - lilyponddefs.tex test.tex .dstreamrc 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) diff --git a/flower/NEWS b/flower/NEWS new file mode 100644 index 0000000000..ae66f7dbc3 --- /dev/null +++ b/flower/NEWS @@ -0,0 +1,2 @@ +pl 22: + - Array::add -> Array::push \ No newline at end of file diff --git a/genheader b/genheader index 739df26c47..f153e3e6ca 100755 --- a/genheader +++ b/genheader @@ -1,10 +1,11 @@ #!/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 */ #ifndef $def diff --git a/hdr/beam.hh b/hdr/beam.hh index 2fd78100c3..912f47dc72 100644 --- a/hdr/beam.hh +++ b/hdr/beam.hh @@ -17,9 +17,6 @@ struct Beam: public Directional_spanner { Real left_pos; /// dir: -1 below heads, +1 above heads. - - Rhythmic_grouping *group; - /****************/ virtual Interval width()const; diff --git a/hdr/break.hh b/hdr/break.hh index 4c0f6b33b6..4475e7d173 100644 --- a/hdr/break.hh +++ b/hdr/break.hh @@ -6,18 +6,18 @@ #ifndef BREAK_HH #define BREAK_HH -#include "vray.hh" +#include "varray.hh" #include "proto.hh" -typedef svec Line_of_cols; +typedef Array Line_of_cols; struct Col_configuration { Line_of_cols cols; - svec config; + Array config; Real energy; /****************/ void OK()const; - void setsol(svec); + void setsol(Array); Col_configuration() ; void add( PCol*c); void print() const; @@ -33,21 +33,21 @@ struct Break_algorithm { /// check if the spacing/breaking problem is well-stated void problem_OK()const; /// search all pcols which are breakable. - svec find_breaks() const; + Array find_breaks() const; /// helper: solve for the columns in #curline#. - svec solve_line(Line_of_cols) const; + Array solve_line(Line_of_cols) const; /// does curline fit on the paper? bool feasible(Line_of_cols)const; - virtual svec solve()=0; + virtual Array solve()=0; }; /// wordwrap type algorithm: move to next line if current is optimal. struct Word_wrap : Break_algorithm { - virtual svec solve(); + virtual Array solve(); Word_wrap(PScore&); }; #endif // BREAK_HH diff --git a/hdr/clef.hh b/hdr/clef.hh index 243ea6ebdd..3b61ca3bc7 100644 --- a/hdr/clef.hh +++ b/hdr/clef.hh @@ -7,14 +7,14 @@ #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 args); + void read(Array args); }; #endif // CLEF_HH diff --git a/hdr/command.hh b/hdr/command.hh index 43d016bbee..d4dda9411c 100644 --- a/hdr/command.hh +++ b/hdr/command.hh @@ -2,7 +2,7 @@ #define COMMAND_HH #include "glob.hh" -#include "vray.hh" +#include "varray.hh" #include "scalar.hh" enum Commandcode { @@ -17,7 +17,7 @@ struct Command { Commandcode code; /// analogous to argv[] - svec args; + Array args; /// int priority; diff --git a/hdr/debug.hh b/hdr/debug.hh index 1d1ae745c3..2f5c4ba47e 100644 --- a/hdr/debug.hh +++ b/hdr/debug.hh @@ -6,7 +6,6 @@ #include "real.hh" void error(String s); // errors -void error_t(String s, Real when); // warnings void warning(String s); diff --git a/hdr/getcommand.hh b/hdr/getcommand.hh index 79e6bd407a..e2ce456cf7 100644 --- a/hdr/getcommand.hh +++ b/hdr/getcommand.hh @@ -10,7 +10,9 @@ 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 diff --git a/hdr/grouping.hh b/hdr/grouping.hh index 9541123b9e..6e13f3217e 100644 --- a/hdr/grouping.hh +++ b/hdr/grouping.hh @@ -9,19 +9,19 @@ #include "moment.hh" #include "interval.hh" -#include "vray.hh" +#include "varray.hh" typedef Interval_t MInterval; /// data structure which represents rhythmic units struct Rhythmic_grouping { - svec children; + Array children; MInterval *interval_; /****************/ - svec intervals(); + Array intervals(); MInterval interval()const; Moment length() const; void intersect(MInterval); @@ -30,19 +30,19 @@ struct Rhythmic_grouping { Rhythmic_grouping(Rhythmic_grouping const&); Rhythmic_grouping(MInterval, int n=1); Rhythmic_grouping(); - Rhythmic_grouping(svec); + Rhythmic_grouping(Array); ~Rhythmic_grouping(); void add_child(Moment start, Moment len); void split(Rhythmic_grouping r); - void split(svec); + void split(Array); void split(int n); void print() const; void OK() const; - svec generate_beams(svec, int&); + Array generate_beams(Array, int&); private: void init(); diff --git a/hdr/identparent.hh b/hdr/identparent.hh index 653158da4d..f4e1705d41 100644 --- a/hdr/identparent.hh +++ b/hdr/identparent.hh @@ -28,6 +28,8 @@ struct Identifier { IDACCESSOR(Music_general_chord, mchord) IDACCESSOR(Lookup,lookup) IDACCESSOR(Notename_tab, notename_tab) +private: + Identifier(Identifier const&){} }; #endif // IDENTPARENT_HH diff --git a/hdr/inputcommand.hh b/hdr/inputcommand.hh index 639b6542e1..61f968ee53 100644 --- a/hdr/inputcommand.hh +++ b/hdr/inputcommand.hh @@ -8,27 +8,26 @@ #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 args; + Array args; void print()const; Input_command(); operator Command(); }; - -Input_command* get_meterchange_command( int,int); -Input_command* get_key_interpret_command(svec); -Input_command* get_clef_interpret_command(String w); +Input_command *get_meterchange_command( int,int); +Input_command *get_key_interpret_command(Array); +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); -Input_command *get_bar_command( ); - -svec get_default_grouping(int count); +Input_command *get_grouping_command(Array); +Input_command *get_bar_command(String); +Input_command *get_newmeasure_command(); +Array get_default_grouping(int count); #endif // INPUTCOMMAND_HH diff --git a/hdr/inputcommands.hh b/hdr/inputcommands.hh index e2c487f204..20e6a1cb06 100644 --- a/hdr/inputcommands.hh +++ b/hdr/inputcommands.hh @@ -53,7 +53,7 @@ struct Input_commands : public IPointerList { void reset(); void print()const; - Staff_commands *parse() const; + void parse(Staff *) const; }; #endif // INPUTCOMMANDS_HH diff --git a/hdr/inputscore.hh b/hdr/inputscore.hh index a34e6d9579..39e6a367fd 100644 --- a/hdr/inputscore.hh +++ b/hdr/inputscore.hh @@ -1,6 +1,6 @@ #ifndef ISCORE_HH #define ISCORE_HH -#include "vray.hh" +#include "varray.hh" #include "proto.hh" #include "plist.hh" @@ -14,8 +14,8 @@ struct Input_score { /****************************************************************/ Input_score(); - Input_score(Input_score&); - void add(svec &s); + Input_score(Input_score const&); + void add(Array &s); void add(Input_staff*); ~Input_score(); /// construction diff --git a/hdr/inputstaff.hh b/hdr/inputstaff.hh index e2caea7dc2..6fac204643 100644 --- a/hdr/inputstaff.hh +++ b/hdr/inputstaff.hh @@ -9,7 +9,7 @@ #include "string.hh" #include "plist.hh" -#include "vray.hh" +#include "varray.hh" #include "proto.hh" struct Input_staff { @@ -22,10 +22,9 @@ struct Input_staff { void add(Input_music*m); Input_staff(Input_staff&); Input_staff(String); - void add(svec &s); - Staff* parse(PointerList); + void add(Array &s); + Staff* parse(PointerList, Score*); void print() const; - }; diff --git a/hdr/item.hh b/hdr/item.hh index 516a7b8f9e..9b234819ec 100644 --- a/hdr/item.hh +++ b/hdr/item.hh @@ -10,7 +10,7 @@ /// a horizontally fixed size element of the score struct Item : Staff_elem { /// indirection to the column it is in - PCol * pcol_; + PCol * pcol_l_; /****************/ diff --git a/hdr/key.hh b/hdr/key.hh index f0141d688f..791c0861cf 100644 --- a/hdr/key.hh +++ b/hdr/key.hh @@ -7,17 +7,17 @@ #ifndef KEY_HH #define KEY_HH -#include "vray.hh" +#include "varray.hh" #include "scalar.hh" class Key { - svec accidentals; + Array accidentals; /****************/ public: - svec read(svec ); - svec oldkey_undo(svec); + Array read(Array ); + Array oldkey_undo(Array); Key(); void set(int i, int acc); @@ -31,7 +31,7 @@ struct Local_key Local_key(); private: - svec octaves; + Array octaves; }; #endif // KEY_HH diff --git a/hdr/keyitem.hh b/hdr/keyitem.hh index ffd0abeb9d..43ce9ca0a7 100644 --- a/hdr/keyitem.hh +++ b/hdr/keyitem.hh @@ -8,12 +8,12 @@ #define KEYITEM_HH #include "item.hh" -#include "vray.hh" +#include "varray.hh" /// struct Keyitem : Item { - svec pitch; - svec acc; + Array pitch; + Array acc; int c_position; @@ -21,7 +21,7 @@ struct Keyitem : Item { Keyitem(int cposition); void add(int pitch, int acc); - void read(svec k); + void read(Array k); void preprocess(); diff --git a/hdr/leastsquares.hh b/hdr/leastsquares.hh index 105efd0aa7..e7368e398b 100644 --- a/hdr/leastsquares.hh +++ b/hdr/leastsquares.hh @@ -6,11 +6,11 @@ #ifndef LEASTSQUARE_HH #define LEASTSQUARE_HH -#include "vray.hh" +#include "varray.hh" #include "offset.hh" struct Least_squares { - svec input; + Array input; void minimise(Real &coef, Real &offset); }; diff --git a/hdr/linespace.hh b/hdr/linespace.hh index 75f4b9fb74..50f13bd35c 100644 --- a/hdr/linespace.hh +++ b/hdr/linespace.hh @@ -3,7 +3,7 @@ #include "glob.hh" #include "plist.hh" -#include "vray.hh" +#include "varray.hh" #include "vector.hh" #include "interval.hh" @@ -29,8 +29,8 @@ struct Colinfo { /// spacing for one line. class Spacing_problem { - svec ideals; - svec cols; + Array ideals; + Array cols; /// the index of #c# in #cols# int col_id(const PCol *c) const; @@ -51,7 +51,7 @@ class Spacing_problem { public: /// solve the spacing problem - svec solve() const; + Array solve() const; /** return the column positions, and the energy (last element) */ diff --git a/hdr/localkeyitem.hh b/hdr/localkeyitem.hh index 05a468b973..6276977b77 100644 --- a/hdr/localkeyitem.hh +++ b/hdr/localkeyitem.hh @@ -7,7 +7,7 @@ #ifndef LOCALKEYITEM_HH #define LOCALKEYITEM_HH #include "item.hh" -#include "vray.hh" +#include "varray.hh" struct Local_acc { int name , acc, octave; @@ -15,8 +15,8 @@ struct Local_acc { }; struct Local_key_item : Item { - svec accs; - svec group; + Array accs; + Array group; int c0_position; // move into walker /****************/ diff --git a/hdr/lookup.hh b/hdr/lookup.hh index 5fa14d57a8..f947a7d734 100644 --- a/hdr/lookup.hh +++ b/hdr/lookup.hh @@ -28,7 +28,7 @@ struct Lookup { pos == -3: below staff */ - Symbol meter(svec); + Symbol meter(Array); Symbol stem(Real y1_pos, Real y2_pos); Symbol rule_symbol(Real height, Real width); Symbol accidental(int); diff --git a/hdr/meter.hh b/hdr/meter.hh index 33838c1525..ca364cf59c 100644 --- a/hdr/meter.hh +++ b/hdr/meter.hh @@ -7,13 +7,13 @@ #ifndef METER_HH #define METER_HH #include "item.hh" -#include "vray.hh" +#include "varray.hh" struct Meter: Item { - svec args; + Array args; /****************/ - Meter(svec args) ; + Meter(Array args) ; Molecule*brew_molecule() const; }; #endif // METER_HH diff --git a/hdr/moment.hh b/hdr/moment.hh index 3327741384..1f34eae5ab 100644 --- a/hdr/moment.hh +++ b/hdr/moment.hh @@ -1,13 +1,14 @@ /* - (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 // diff --git a/hdr/notehead.hh b/hdr/notehead.hh index be0a345283..860d16280d 100644 --- a/hdr/notehead.hh +++ b/hdr/notehead.hh @@ -12,7 +12,8 @@ struct Notehead : public Item { int position; - + /// -1 = lowest, 0 = inside, 1 = top + int extremal; /// needed for the help-lines int staff_size; int dots; diff --git a/hdr/paper.hh b/hdr/paper.hh index 34c6ce3e20..6da51df33e 100644 --- a/hdr/paper.hh +++ b/hdr/paper.hh @@ -5,7 +5,7 @@ /// symbols, dimensions and constants struct Paperdef { - Lookup *lookup_; + Lookup *lookup_p_; String outfile; Real linewidth; @@ -21,6 +21,7 @@ struct Paperdef { Paperdef(Lookup*); void set(Lookup*); ~Paperdef(); + Paperdef(Paperdef const&); Real interline()const; Real internote()const; Real rule_thickness()const; diff --git a/hdr/parseconstruct.hh b/hdr/parseconstruct.hh index dea0d0cd95..8afb32d94b 100644 --- a/hdr/parseconstruct.hh +++ b/hdr/parseconstruct.hh @@ -16,7 +16,7 @@ Staff * get_new_rhythmstaff(); 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&req); +void add_requests( Voice_element*v, Array&req); Request* get_request(char); void set_text_style(String); Script_def* get_scriptdef(char); diff --git a/hdr/pcol.hh b/hdr/pcol.hh index 7da7c02cb2..a0f2a87624 100644 --- a/hdr/pcol.hh +++ b/hdr/pcol.hh @@ -13,32 +13,33 @@ struct PCol { /// 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; @@ -62,6 +63,8 @@ struct PCol { 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: diff --git a/hdr/proto.hh b/hdr/proto.hh index b11ca6c59f..ac215970fe 100644 --- a/hdr/proto.hh +++ b/hdr/proto.hh @@ -15,6 +15,7 @@ struct Absdynamic_req; struct Accidental; struct Atom; +struct Barcheck_req; struct Beam; struct Beam_req; struct Box; diff --git a/hdr/pscore.hh b/hdr/pscore.hh index 8ad259412e..f796247353 100644 --- a/hdr/pscore.hh +++ b/hdr/pscore.hh @@ -4,13 +4,13 @@ #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 cols; @@ -34,63 +34,62 @@ struct PScore { IPointerList broken_spans; /****************/ - - void add_broken(Spanner*); - - svec 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); 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 select_items(PStaff*, PCol*); + + /// return argument as a cursor. + PCursor 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 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# diff --git a/hdr/pstaff.hh b/hdr/pstaff.hh index 6d0bdcf341..78a68fb306 100644 --- a/hdr/pstaff.hh +++ b/hdr/pstaff.hh @@ -7,8 +7,8 @@ /// items grouped horizontally struct PStaff { - Molecule * stafsym; - PScore * pscore_; + Molecule * stafsym_p_; + PScore * pscore_l_; PointerList spans; @@ -19,6 +19,8 @@ struct PStaff { void add(Item*i); PStaff(PScore*); virtual ~PStaff(); +private: + PStaff(PStaff const&); }; #endif diff --git a/hdr/qlp.hh b/hdr/qlp.hh index b539fe6b86..db5438499d 100644 --- a/hdr/qlp.hh +++ b/hdr/qlp.hh @@ -7,8 +7,8 @@ class Ineq_constrained_qp { friend class Active_constraints; - svec cons; - svec consrhs; + Array cons; + Array consrhs; public: Matrix quad; Vector lin; @@ -55,8 +55,8 @@ public: /// Quadratic programming with mixed linear constraints class Mixed_qp :public Ineq_constrained_qp { - svec eq_cons; - svec eq_consrhs; + Array eq_cons; + Array eq_consrhs; public: Mixed_qp(int n); void OK() const; diff --git a/hdr/qlpsolve.hh b/hdr/qlpsolve.hh index 4d29bcc4a0..b9789bfc4a 100644 --- a/hdr/qlpsolve.hh +++ b/hdr/qlpsolve.hh @@ -7,8 +7,8 @@ class Active_constraints { Matrix A,H; - svec active; - svec inactive; // actually this is a set, not an array. + Array active; + Array inactive; // actually this is a set, not an array. const Ineq_constrained_qp *opt; public: @@ -71,7 +71,7 @@ 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. diff --git a/hdr/request.hh b/hdr/request.hh index 43b31d75cc..a6ae0fbc88 100644 --- a/hdr/request.hh +++ b/hdr/request.hh @@ -8,14 +8,20 @@ /// 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;} @@ -26,14 +32,17 @@ struct Request { 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 { @@ -107,6 +116,7 @@ struct Span_req : Request { NOSPAN, START, STOP } spantype ; + virtual void print() const; Span_req*span() { return this; } Span_req(); virtual Request*clone()const; @@ -132,6 +142,7 @@ appropriate number over the beam /// a slur struct Slur_req : Span_req { + virtual Request*clone()const; virtual Slur_req*slur() { return this; } }; @@ -148,6 +159,7 @@ struct Script_req : Request { 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 */ @@ -162,7 +174,8 @@ struct Text_req : Request { virtual void print() const; Request *clone()const; Text_req(int d, Text_def*); - ~Text_req(); + ~Text_req(); + Text_req(Text_req const&); }; diff --git a/hdr/sccol.hh b/hdr/sccol.hh index 8c1d82b3ae..615376309c 100644 --- a/hdr/sccol.hh +++ b/hdr/sccol.hh @@ -7,25 +7,23 @@ #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 durations; + Array 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 ); @@ -33,6 +31,9 @@ struct Score_column { void set_breakable(); bool used(); void print() const; + +private: + Moment when_; }; /** diff --git a/hdr/score.hh b/hdr/score.hh index 5363b475cb..f58367c30e 100644 --- a/hdr/score.hh +++ b/hdr/score.hh @@ -1,6 +1,6 @@ #ifndef SCORE_HH #define SCORE_HH -#include "vray.hh" +#include "varray.hh" #include "proto.hh" #include "plist.hh" #include "moment.hh" @@ -8,12 +8,12 @@ /// the total music def of one movement struct Score { /// paper_, staffs_ and commands_ form the problem definition. - Paperdef *paper_; + Paperdef *paper_p_; IPointerList staffs_; /// "runtime" fields for setting up spacing IPointerList cols_; - PScore *pscore_; + PScore *pscore_p_; /****************************************************************/ @@ -22,22 +22,32 @@ struct Score { ~Score(); void add(Staff*); - - - void OK() const; - PCursor find_col(Moment,bool); + /// do everything except outputting to file void process(); + + /// output to file void output(String fn); - PCursor create_cols(Moment); + + // standard + void OK() const; void print() const; + + // utils: + PCursor create_cols(Moment); + PCursor 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(); diff --git a/hdr/scoreline.hh b/hdr/scoreline.hh index 5734a7b4b4..233496932a 100644 --- a/hdr/scoreline.hh +++ b/hdr/scoreline.hh @@ -8,7 +8,7 @@ #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 @@ -17,11 +17,11 @@ Line_of_score { // need to store height of each staff. IPointerList staffs; - PScore * pscore_; // needed to generate staffs + PScore * pscore_l_; // needed to generate staffs /****************/ void process() ; - Line_of_score(svec sv, PScore *); + Line_of_score(Array sv, PScore *); String TeXstring() const; diff --git a/hdr/script.hh b/hdr/script.hh index 08d7a64f18..01dd75c53d 100644 --- a/hdr/script.hh +++ b/hdr/script.hh @@ -15,8 +15,8 @@ struct Script : Item{ int symdir; int pos; int staffsize; - Script_def*specs; - Stem * stem_; + Script_def*specs_l_; + Stem * stem_l_; Item * support; /****************/ @@ -24,7 +24,7 @@ struct Script : Item{ 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(); diff --git a/hdr/simplestaff.hh b/hdr/simplestaff.hh index 34e48b0d23..f074dc169d 100644 --- a/hdr/simplestaff.hh +++ b/hdr/simplestaff.hh @@ -19,7 +19,7 @@ struct Simple_staff; struct Note_info { Rhythmic_req *rq; - svec scripts; + Array scripts; Note_info(); Note_info(Rhythmic_req*); }; @@ -27,8 +27,8 @@ struct Note_info { /// column of Simple_staff: store one request struct Simple_column : Staff_column { - svec notes; - svec slurs; + Array notes; + Array slurs; Stem_req *stem_; Moment stem_requester_len; Beam_req *beam_; diff --git a/hdr/simplewalker.hh b/hdr/simplewalker.hh index 635b9fbbcc..34403e465c 100644 --- a/hdr/simplewalker.hh +++ b/hdr/simplewalker.hh @@ -12,22 +12,23 @@ struct Simple_walker: Staff_walker { Stem *stem_; - svecnoteheads; + Arraynoteheads; Local_key local_key_; Key key_; - svec *oldkey_undo; - svec typesetkey; + Array *oldkey_undo; + Array 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 pending_slur_reqs; - svec pending_slurs; - + Array pending_slur_reqs; + Array pending_slurs; + /****************/ virtual void do_TYPESET_command(Command*); diff --git a/hdr/slur.hh b/hdr/slur.hh index cf8c2261ab..9a3333f063 100644 --- a/hdr/slur.hh +++ b/hdr/slur.hh @@ -9,11 +9,11 @@ #include "directionalspanner.hh" #include "fproto.hh" -#include "vray.hh" +#include "varray.hh" struct Slur : Directional_spanner { - svec encompass; + Array encompass; //int dir; bool open_left,open_right; diff --git a/hdr/staff.hh b/hdr/staff.hh index 5414fc3f8b..7d6be0e12f 100644 --- a/hdr/staff.hh +++ b/hdr/staff.hh @@ -9,36 +9,42 @@ struct Staff { /// synchronous horizontal stuff IPointerList voices; - /// commands in chronological order - Staff_commands *staff_commands_; - /// runtime field IPointerList cols; - /// indirections to the Score and PScore - Score *score_; - PScore *pscore_; + Score *score_l_; + PScore *pscore_l_; /****************************************************************/ void add(PointerList &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(); @@ -51,6 +57,8 @@ struct Staff { virtual void walk()=0; virtual Staff_column * create_col(Score_column * )=0; virtual ~Staff() { } +private: + void set_time_descriptions(); }; #endif diff --git a/hdr/staffcommands.hh b/hdr/staffcommands.hh index 633b73285c..e0e27be4be 100644 --- a/hdr/staffcommands.hh +++ b/hdr/staffcommands.hh @@ -6,7 +6,7 @@ #include "proto.hh" #include "command.hh" -#include "vray.hh" +#include "varray.hh" #include "plist.hh" #include "timedescription.hh" @@ -28,20 +28,5 @@ struct Staff_commands_at : public IPointerList { void add(Command c); }; -/// the list of commands in Score -struct Staff_commands : public IPointerList -{ - 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 diff --git a/hdr/staffelem.hh b/hdr/staffelem.hh index a12addbfac..bd10f216a8 100644 --- a/hdr/staffelem.hh +++ b/hdr/staffelem.hh @@ -6,7 +6,7 @@ #ifndef STAFFELEM_HH #define STAFFELEM_HH -#include "vray.hh" +#include "varray.hh" #include "proto.hh" #include "offset.hh" #include "molecule.hh" @@ -20,13 +20,13 @@ struct Staff_elem { OUTPUT, // molecule has been output } status; bool calc_children; - svec dependencies; + Array 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; diff --git a/hdr/staffline.hh b/hdr/staffline.hh index 12d30c3764..663c9584b2 100644 --- a/hdr/staffline.hh +++ b/hdr/staffline.hh @@ -9,15 +9,15 @@ #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_; /****************/ diff --git a/hdr/stcol.hh b/hdr/stcol.hh index 9e7501edc7..2bdd3b8bb9 100644 --- a/hdr/stcol.hh +++ b/hdr/stcol.hh @@ -7,19 +7,19 @@ #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 v_elts; + Array v_elts; /// idem - Staff_commands_at *s_commands; + Staff_commands_at *staff_commands_p_; Time_description *tdescription_; @@ -29,7 +29,7 @@ struct Staff_column { bool mus() const; Moment when() const; void add(Voice_element*ve); - + void OK() const; /**************************************************************** VIRTUAL ****************************************************************/ @@ -37,6 +37,8 @@ struct Staff_column { virtual void process_requests()=0; virtual ~Staff_column(); +private: + Staff_column(Staff_column const&){} }; diff --git a/hdr/stem.hh b/hdr/stem.hh index ad2856b0f2..b7d7e05e29 100644 --- a/hdr/stem.hh +++ b/hdr/stem.hh @@ -7,7 +7,7 @@ #ifndef STEM_HH #define STEM_HH #include "item.hh" -#include "vray.hh" +#include "varray.hh" #include "moment.hh" /// the rule attached to the ball @@ -46,7 +46,7 @@ struct Stem : public Item { Real stem_xoffset; - svec heads; + Array heads; /****************/ Stem(int center, Moment duration); diff --git a/hdr/swalker.hh b/hdr/swalker.hh index 0d66a55fb4..046ded590e 100644 --- a/hdr/swalker.hh +++ b/hdr/swalker.hh @@ -30,6 +30,8 @@ struct Staff_walker : public PCursor { 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, diff --git a/hdr/tex.hh b/hdr/tex.hh index aba60f06c4..c33f30e202 100644 --- a/hdr/tex.hh +++ b/hdr/tex.hh @@ -7,7 +7,7 @@ /// parameter substitution in TeXstrings String -substitute_args(String source, svec args); +substitute_args(String source, Array args); /** this structure provides a simple macro mechanism: @@ -17,7 +17,7 @@ substitute_args(String source, svec args); /// parameter substitution in TeXstrings String -substitute_args(String source, svec args); +substitute_args(String source, Array args); /// #h# is in points String vstrut(Real h); diff --git a/hdr/timedescription.hh b/hdr/timedescription.hh index 2cdbc8de23..2194ee0a16 100644 --- a/hdr/timedescription.hh +++ b/hdr/timedescription.hh @@ -26,11 +26,18 @@ struct Time_description { /****************/ 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 diff --git a/hdr/tstream.hh b/hdr/tstream.hh index 9474dd69a8..e75d27a4b3 100644 --- a/hdr/tstream.hh +++ b/hdr/tstream.hh @@ -18,6 +18,8 @@ struct Tex_stream { /// close the file ~Tex_stream(); +private: + Tex_stream(Tex_stream const&); }; /** Use this class for writing to a TeX file. diff --git a/init/Makefile b/init/Makefile index b9d962d1ed..19dfcbfcaf 100644 --- a/init/Makefile +++ b/init/Makefile @@ -1,5 +1,8 @@ DFILES=dutch.ini table_sixteen.ini table_twenty.ini\ english.ini script.ini +default: + echo huh? + dist: ln Makefile $(DFILES) $(DDIR)/$(INITDIR) diff --git a/init/script.ini b/init/script.ini index 6ac23c92c5..aeee0b01ac 100644 --- a/init/script.ini +++ b/init/script.ini @@ -3,12 +3,14 @@ % 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 } diff --git a/init/table_sixteen.ini b/init/table_sixteen.ini index 2b719ecd88..5eb42dde18 100644 --- a/init/table_sixteen.ini +++ b/init/table_sixteen.ini @@ -14,12 +14,15 @@ symboltables { "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 } @@ -67,9 +70,13 @@ symboltables { } "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 { diff --git a/kortjakje.ly b/kortjakje.ly index f5e6d08139..ac78340c4f 100644 --- a/kortjakje.ly +++ b/kortjakje.ly @@ -11,17 +11,20 @@ melodie = music { \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. @@ -49,7 +52,6 @@ bstaf = staff { music { begeleiding } % use the declared music commands { % commands with Staff-wide impact. clef bass % bass-clef - } } @@ -57,6 +59,7 @@ bstaf = staff { vstaf = staff { melodic music { melodie } + commands { clef violin } % default clef is violin clef } @@ -69,8 +72,8 @@ score { } 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 } } diff --git a/lilyponddefs.tex b/lilyponddefs.tex index 24df3eedaa..eadca08e81 100644 --- a/lilyponddefs.tex +++ b/lilyponddefs.tex @@ -1,7 +1,22 @@ %% %% 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 @@ -9,6 +24,7 @@ \newcount\n \newdimen\balkhoog \newdimen\notewidth + \newdimen\noteheight \newdimen\notewidthhalf \newdimen\notewidthdouble \newdimen\staffrulethickness @@ -27,10 +43,12 @@ \font\italicfont=cmti10 \balkhoog=20pt \notewidth=6pt + \noteheight=5pt \staffrulethickness=0.4pt - \musixcalc } + + \def\musixsixteendefs{ \font\textfont=cmr8 \font\meterfont=cmbx12 @@ -45,6 +63,7 @@ \balkhoog=16pt \staffrulethickness=0.4pt \notewidth=5pt + \noteheight=4pt \musixcalc } @@ -55,12 +74,12 @@ \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}} @@ -105,11 +124,17 @@ \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 @@ -157,22 +182,26 @@ \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} @@ -187,11 +216,3 @@ \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}} diff --git a/maartje.ly b/maartje.ly index 28d1d78040..f585c27b80 100644 --- a/maartje.ly +++ b/maartje.ly @@ -47,7 +47,7 @@ c8 $} commands { -% skip 0:0.125 + skip 3:0%BUG key $ fis cis gis $ skip 2:0 @@ -67,8 +67,9 @@ score { 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 } diff --git a/pavane.ly b/pavane.ly index 96fb1da3da..a5ad5cc311 100644 --- a/pavane.ly +++ b/pavane.ly @@ -12,79 +12,80 @@ staff {melodic \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 $ @@ -95,20 +96,24 @@ score { 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 diff --git a/pavane.tex b/pavane.tex new file mode 100644 index 0000000000..69a136237e --- /dev/null +++ b/pavane.tex @@ -0,0 +1,12 @@ +\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} diff --git a/scales.ly b/scales.ly new file mode 100644 index 0000000000..99d6f5630a --- /dev/null +++ b/scales.ly @@ -0,0 +1,36 @@ + +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 diff --git a/src/bar.cc b/src/bar.cc index 01807f123e..edfd6a8e3c 100644 --- a/src/bar.cc +++ b/src/bar.cc @@ -12,7 +12,7 @@ Bar::Bar( String t) 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; diff --git a/src/beam.cc b/src/beam.cc index 5edf3ce7eb..1016320dea 100644 --- a/src/beam.cc +++ b/src/beam.cc @@ -50,7 +50,6 @@ Beam::center()const Beam::Beam() { - group = 0; slope = 0; left_pos = 0.0; dir =0; @@ -85,7 +84,7 @@ Beam::set_default_dir() void Beam::solve_slope() { - svec sinfo; + Array sinfo; for (iter_top(stems,i); i.ok(); i++) { i->set_default_extents(); Stem_info info(i); @@ -93,14 +92,14 @@ Beam::solve_slope() } 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; @@ -113,7 +112,7 @@ Beam::solve_slope() // 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(); } @@ -141,28 +140,28 @@ Beam::set_grouping(Rhythmic_grouping def, Rhythmic_grouping cur) { 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 b; + + Array b; { iter_top(stems,s); - svec flags; + Array 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]; } @@ -179,8 +178,8 @@ Beam::do_break_at( PCol *, PCol *) const 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(); @@ -207,7 +206,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const 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; @@ -217,7 +216,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const int lhalfs= lhalfs = here->beams_left - prev->beams_right ; int lwholebeams= here->beams_left 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); @@ -231,7 +230,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const int rwholebeams = here->beams_right 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++) { @@ -240,7 +239,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const 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); @@ -257,7 +256,6 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const Molecule* Beam::brew_molecule() const return out; { - assert(left->line == right->line); Real inter=paper()->internote(); out = new Molecule; Real x0 = stems.top()->hpos(); @@ -288,5 +286,5 @@ Beam::print()const Beam::~Beam() { - delete group; + } diff --git a/src/boxes.cc b/src/boxes.cc index d6564663a1..f83f7659e9 100644 --- a/src/boxes.cc +++ b/src/boxes.cc @@ -1,6 +1,6 @@ #include "boxes.hh" #include "const.hh" -#include "vray.hh" +#include "varray.hh" Box::Box() diff --git a/src/break.cc b/src/break.cc index e27abd9b84..2a0586edff 100644 --- a/src/break.cc +++ b/src/break.cc @@ -13,27 +13,25 @@ /* return all breakable columns */ -svec +Array Break_algorithm::find_breaks() const { - svec retval; + Array 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 +Array 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); @@ -41,21 +39,21 @@ Break_algorithm::solve_line(Line_of_cols curline) const for (iter_top(pscore_.suz,i); i.ok(); i++) { sp.add_ideal(i); } - svec the_sol=sp.solve(); + Array 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; } @@ -88,7 +86,7 @@ Col_configuration::add( PCol*c) } void -Col_configuration::setsol(svec sol) +Col_configuration::setsol(Array sol) { config = sol; energy = config.last(); @@ -100,11 +98,13 @@ Col_configuration::print() const { #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 } diff --git a/src/calcideal.cc b/src/calcideal.cc index 77cef180ef..b6d3411508 100644 --- a/src/calcideal.cc +++ b/src/calcideal.cc @@ -9,32 +9,12 @@ #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() { @@ -43,21 +23,20 @@ Score::calc_idealspacing() for (; i.ok(); i++) { assert(i->used()); PCursor 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()) { @@ -66,14 +45,13 @@ Score::calc_idealspacing() 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. } } diff --git a/src/clef.cc b/src/clef.cc index 49671dd426..0abd26f44a 100644 --- a/src/clef.cc +++ b/src/clef.cc @@ -7,7 +7,7 @@ Clef::Clef() } void -Clef::read(svecargs) +Clef::read(Arrayargs) { clef_type = args[0]; if (clef_type == "violin") { diff --git a/src/clefitem.cc b/src/clefitem.cc index 4289c64374..c6b8f09d0b 100644 --- a/src/clefitem.cc +++ b/src/clefitem.cc @@ -31,7 +31,7 @@ Clef_item::brew_molecule()const 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; diff --git a/src/command.cc b/src/command.cc index 98be691cd3..7ddebc6f82 100644 --- a/src/command.cc +++ b/src/command.cc @@ -21,9 +21,9 @@ Command::print() const mtor << "Command " << "code " << code << " prio " << priority; if ( isbreak()) mtor << "(break separator)"; - if (args.sz()) { + if (args.size()) { mtor<< " args: "; - for (int i = 0; iwhich) +get_key_typeset_command(Arraywhich) { Command*c = new Command; c->code = TYPESET; @@ -20,7 +20,6 @@ get_meter_command(int n, int m) { Command*c = new Command; -// c->when = w; c->code = TYPESET; c->args.add( "METER"); c->args.add( n ); @@ -29,3 +28,38 @@ get_meter_command(int n, int m) 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; + } +} diff --git a/src/grouping.cc b/src/grouping.cc index c7d38dbdae..4b8efaee6c 100644 --- a/src/grouping.cc +++ b/src/grouping.cc @@ -12,14 +12,16 @@ Rhythmic_grouping::init() 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 @@ -48,7 +50,7 @@ Rhythmic_grouping::split(Rhythmic_grouping r) 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); @@ -57,17 +59,17 @@ Rhythmic_grouping::split(Rhythmic_grouping r) } -svec +Array Rhythmic_grouping::intervals() { - svec r; - if (interval_ || children.sz() == 1) { + Array 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; @@ -80,7 +82,7 @@ Rhythmic_grouping::intersect(MInterval t) 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]; @@ -89,7 +91,7 @@ Rhythmic_grouping::intersect(MInterval t) 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 @@ -99,14 +101,14 @@ Rhythmic_grouping::intersect(MInterval t) } void -Rhythmic_grouping::split(svec splitpoints) +Rhythmic_grouping::split(Array splitpoints) { //check on splitpoints.. int j = 0, i=0, starti = 0, startj = 0; - svec ch; + Array ch; while (1) { - if ( i >= children.sz() || j >= splitpoints.sz()) + if ( i >= children.size() || j >= splitpoints.size()) break; assert( @@ -152,7 +154,7 @@ Rhythmic_grouping::Rhythmic_grouping(MInterval t, int n) } -Rhythmic_grouping::Rhythmic_grouping(svec r) +Rhythmic_grouping::Rhythmic_grouping(Array r) :children(r) { interval_ =0; @@ -168,7 +170,7 @@ void 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])); } @@ -189,7 +191,7 @@ void 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(); } @@ -201,7 +203,7 @@ Rhythmic_grouping::print()const 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"; @@ -212,14 +214,14 @@ void 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))); @@ -231,23 +233,23 @@ Rhythmic_grouping::Rhythmic_grouping() } int -min_elt(svec v) +min_elt(Array v) { int i = 1000; // ugh - for (int j = 0 ; j < v.sz(); j++) + for (int j = 0 ; j < v.size(); j++) i = i -Rhythmic_grouping::generate_beams(svec flags, int &flagidx) +Array +Rhythmic_grouping::generate_beams(Array flags, int &flagidx) { assert (!interval_) ; - svec< svec > children_beams; - for (int i=0; i < children.sz(); i++) { - svec child_beams; + Array< Array > children_beams; + for (int i=0; i < children.size(); i++) { + Array child_beams; if (children[i]->interval_) { int f = flags[flagidx++]; child_beams.add(f); @@ -257,18 +259,18 @@ Rhythmic_grouping::generate_beams(svec flags, int &flagidx) } children_beams.add(child_beams); } - svec beams; + Array 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) @@ -283,7 +285,7 @@ Rhythmic_grouping::generate_beams(svec flags, int &flagidx) lastm = m; m = nextm; } - assert(!(beams.sz()%2)); + assert(!(beams.size()%2)); return beams; } diff --git a/src/inputcommand.cc b/src/inputcommand.cc index fda5ceefcf..9cedc52c2a 100644 --- a/src/inputcommand.cc +++ b/src/inputcommand.cc @@ -10,7 +10,7 @@ Input_command::Input_command() Input_command::operator Command() { Command c; - if (!args.sz()) + if (!args.size()) return c; c.code = INTERPRET; @@ -45,22 +45,22 @@ get_partial_command(Moment u) } Input_command* -get_grouping_command(sveca ) +get_grouping_command(Arraya ) { 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(sveca ) +get_key_interpret_command(Arraya ) { 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; @@ -87,12 +87,11 @@ get_meterchange_command(int n, int m) } 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; } @@ -114,9 +113,9 @@ void Input_command::print()const { mtor << "{ "; - if (args.sz()) { + if (args.size()) { mtor<< " args: "; - for (int i = 0; i +Input_command* +get_bar_command(String w) +{ + Input_command*c = new Input_command; + c->args.add("BAR"); + c->args.add(w); + return c; +} + +Array get_default_grouping(int count) { - svec s; + Array s; if (!(count % 3 )) { for (int i=0; i < count/3; i++) s.add(3); diff --git a/src/inputcommands.cc b/src/inputcommands.cc index 64e8fa9598..90d6eeffa6 100644 --- a/src/inputcommands.cc +++ b/src/inputcommands.cc @@ -4,6 +4,8 @@ #include "staffcommands.hh" #include "getcommand.hh" #include "command.hh" +#include "stcol.hh" +#include "staff.hh" void Commands_at::print() const @@ -25,7 +27,7 @@ Commands_at::Commands_at(Moment dt, Commands_at* prev) : tdescription_(dt, (prev)? &prev->tdescription_ : 0) { if (prev&& !tdescription_.whole_in_measure) { - bottom().add(get_bar_command()); + bottom().add(get_newmeasure_command()); } } @@ -70,7 +72,7 @@ Commands_at::parse(Staff_commands_at*s) { 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); @@ -169,30 +171,31 @@ Input_commands::add(Input_command 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; } diff --git a/src/inputscore.cc b/src/inputscore.cc index 8bbe7e266e..cdc348c725 100644 --- a/src/inputscore.cc +++ b/src/inputscore.cc @@ -6,10 +6,10 @@ #include "paper.hh" void -Input_score::add(svec &s) +Input_score::add(Array &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]); } @@ -29,19 +29,20 @@ Input_score::set(Paperdef*p) 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_; } diff --git a/src/inputstaff.cc b/src/inputstaff.cc index 97622a9dab..1786f3e293 100644 --- a/src/inputstaff.cc +++ b/src/inputstaff.cc @@ -10,10 +10,10 @@ #include "staff.hh" void -Input_staff::add(svec &s) +Input_staff::add(Array &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); } @@ -30,7 +30,7 @@ Input_staff::add(Input_music*m) } Staff* -Input_staff::parse(PointerList score_wide) +Input_staff::parse(PointerList score_wide, Score*score_l) { Staff *p=0; @@ -38,7 +38,7 @@ Input_staff::parse(PointerList score_wide) 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); @@ -50,7 +50,7 @@ Input_staff::parse(PointerList score_wide) for (iter_top(commands_,i); i.ok(); i++) commands.add(**i); - p->staff_commands_ = commands.parse(); + commands.parse(p); return p; } @@ -60,7 +60,7 @@ Input_staff::Input_staff(Input_staff&s) 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; } diff --git a/src/item.cc b/src/item.cc index 64dcc1e1f4..11096c95c0 100644 --- a/src/item.cc +++ b/src/item.cc @@ -3,7 +3,7 @@ Item::Item() { - pcol_ = 0; + pcol_l_ = 0; } void diff --git a/src/key.cc b/src/key.cc index dac8c266ec..cd7f400737 100644 --- a/src/key.cc +++ b/src/key.cc @@ -36,14 +36,14 @@ Local_key::reset(Key k) octaves[i] = k; } -svec -Key::read(svec s) +Array +Key::read(Array s) { - svec newkey; + Array 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; @@ -54,21 +54,21 @@ Key::read(svec s) return newkey; } -svec -Key::oldkey_undo(svecs) +Array +Key::oldkey_undo(Arrays) { - svec oldkey; - svec newkey; + Array oldkey; + Array 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); diff --git a/src/keyitem.cc b/src/keyitem.cc index 3499149352..29b1f25e5c 100644 --- a/src/keyitem.cc +++ b/src/keyitem.cc @@ -12,9 +12,9 @@ Keyitem::Keyitem(int c) } void -Keyitem::read(svec s) +Keyitem::read(Array s) { - for (int i = 0 ; i< s.sz(); ) { + for (int i = 0 ; i< s.size(); ) { int note = s[i++]; int acc = s[i++]; @@ -36,14 +36,14 @@ Keyitem::brew_molecule()const 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); diff --git a/src/leastsquares.cc b/src/leastsquares.cc index 1e1c91cee3..adbc098219 100644 --- a/src/leastsquares.cc +++ b/src/leastsquares.cc @@ -8,7 +8,7 @@ Least_squares::minimise(Real &coef, Real &offset) 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; @@ -16,7 +16,7 @@ Least_squares::minimise(Real &coef, Real &offset) sqx += sqr(x); sxy += x*y; } - int N = input.sz(); + int N = input.size(); coef = (N * sxy - sx*sy )/(N*sqx - sqr(sx)); diff --git a/src/lexer.l b/src/lexer.l index 22bda7c92e..9f99dd2713 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -5,7 +5,7 @@ #include "string.hh" #include "notename.hh" #include "lexer.hh" -#include "vray.hh" +#include "varray.hh" #include "parser.hh" #include "debug.hh" @@ -31,7 +31,7 @@ AN {AA}|{N} WORD {A}{AN}* ALPHAWORD {A}+ INT -?{N}+ -REAL {INT}(\.{N}*)? +REAL {INT}?(\.{N}*)? OPTSIGN !? PITCHMOD ['`]*{OPTSIGN} @@ -95,8 +95,6 @@ DOTS \.+ yylval.i = String(YYText()).value(); return INT; } -\| { -} [%#].*\n { } @@ -110,21 +108,13 @@ DOTS \.+ return YYText()[0]; } -[\[)] { /* parens () are NO mistake */ - yylval.c = YYText()[0]; - return OPEN_REQUEST_PARENS; -} -[\](] { /* parens () are NO mistake */ - yylval.c = YYText()[0]; - return CLOSE_REQUEST_PARENS; -} \"[^\"]*\" { String s (YYText()+1); s = s.left(s.len()-1); yylval.string = new String(s); return STRING; } -[/.^>_-] { +[()\[\]|/.^>_-] { return yylval.c = YYText()[0]; } diff --git a/src/linespace.cc b/src/linespace.cc index f35f64e2fa..920d3ba7ab 100644 --- a/src/linespace.cc +++ b/src/linespace.cc @@ -12,7 +12,7 @@ const Real COLFUDGE=1e-3; 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; @@ -21,7 +21,7 @@ Spacing_problem::contains(const PCol *w) 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); @@ -32,20 +32,20 @@ void Spacing_problem::OK() const { #ifndef NDEBUG - Union_find connected(cols.sz()); - svec fixed; - for (int i=0; i < ideals.sz(); i++) { + Union_find connected(cols.size()); + Array 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; jleft); int r = col_id(i->right); @@ -156,7 +156,7 @@ Spacing_problem::make_matrices(Matrix &quad, Vector &lin, Real &c) const 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()) { @@ -173,7 +173,7 @@ Spacing_problem::make_constraints(Mixed_qp& lp) const } } -svec +Array Spacing_problem::solve() const { print(); @@ -181,7 +181,7 @@ Spacing_problem::solve() const 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(); @@ -191,7 +191,7 @@ Spacing_problem::solve() const } - svec posns(sol); + Array posns(sol); posns.add(lp.eval(sol)); return posns; } @@ -234,11 +234,11 @@ void 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 diff --git a/src/linestaff.cc b/src/linestaff.cc index 6d3985cb8b..f9430e9b73 100644 --- a/src/linestaff.cc +++ b/src/linestaff.cc @@ -15,8 +15,8 @@ Linestaff::Linestaff(int l, PScore *s) 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); } diff --git a/src/localkeyitem.cc b/src/localkeyitem.cc index 42bb268df0..d23b26277f 100644 --- a/src/localkeyitem.cc +++ b/src/localkeyitem.cc @@ -33,7 +33,7 @@ Local_key_item::brew_molecule()const 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; @@ -44,7 +44,7 @@ Local_key_item::brew_molecule()const 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)); diff --git a/src/lookup.cc b/src/lookup.cc index 9c8def52cf..200ae0994b 100644 --- a/src/lookup.cc +++ b/src/lookup.cc @@ -31,7 +31,7 @@ Lookup::add(String s, Symtable*p) Symbol Lookup::text( String style, String text , int dir) { - svec a; + Array a; a.add(text); Symbol tsym = (*symtables_)("style")->lookup(style); @@ -129,7 +129,7 @@ Lookup::streepjes(int i) } Symbol ret = (*symtables_)("streepjes")->lookup(idx); - svec a; + Array a; a.add(arg); ret.tex = substitute_args(ret.tex, a); @@ -146,7 +146,7 @@ Lookup::linestaff(int lines, Real wid) Real dy=(lines-1)*internote()*2; s.dim.y = Interval(0,dy); - svec a; + Array a; a.add(lines); a.add(print_dimen(wid)); @@ -158,7 +158,7 @@ Lookup::linestaff(int lines, Real wid) Symbol -Lookup::meter(svec a) +Lookup::meter(Array a) { Symbol s; s.dim.x = Interval( convert_dimen(0,"pt"), @@ -179,7 +179,7 @@ Lookup::stem(Real y1,Real y2) s.dim.x = Interval(0,0); s.dim.y = Interval(y1,y2); - svec a; + Array a; a.add(print_dimen(y1)); a.add(print_dimen(y2)); diff --git a/src/meter.cc b/src/meter.cc index dc3cb40f3e..fb8224ec07 100644 --- a/src/meter.cc +++ b/src/meter.cc @@ -4,7 +4,7 @@ #include "paper.hh" #include "lookup.hh" -Meter::Meter(sveca) +Meter::Meter(Arraya) :args(a) { } @@ -12,7 +12,7 @@ Meter::Meter(sveca) Molecule* Meter::brew_molecule()const { - Symbol s = paper()->lookup_->meter(args); + Symbol s = paper()->lookup_p_->meter(args); return new Molecule(Atom(s)); } diff --git a/src/molecule.cc b/src/molecule.cc index 6b9db4cac3..682204880d 100644 --- a/src/molecule.cc +++ b/src/molecule.cc @@ -1,4 +1,4 @@ -#include "vray.hh" +#include "varray.hh" #include "interval.hh" #include "dimen.hh" #include "string.hh" @@ -32,7 +32,7 @@ Atom::TeXstring() const { // whugh.. Hard coded... String s("\\placebox{%}{%}{%}"); - svec a; + Array a; a.add(print_dimen(off.y)); a.add(print_dimen(off.x)); a.add(sym.tex); diff --git a/src/note.cc b/src/note.cc index 30ded730d4..4454e67727 100644 --- a/src/note.cc +++ b/src/note.cc @@ -7,7 +7,7 @@ #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; @@ -149,6 +149,9 @@ get_request(char c) { Request* ret=0; switch (c) { + case '|': + ret = new Barcheck_req; + break; case '[': case ']': { @@ -177,8 +180,9 @@ get_request(char c) case ']': ret->span()->spantype = Span_req::STOP; break; + default: - assert(false); + break; } @@ -186,9 +190,9 @@ get_request(char c) } void -add_requests(Voice_element *v, svec &req) +add_requests(Voice_element *v, Array &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); @@ -203,7 +207,7 @@ get_scriptdef(char c) break; case '+' : s = "stopped"; break; - case '-' : s = "portato"; + case '-' : s = "tenuto"; break; case '|': s = "staccatissimo"; break; diff --git a/src/notehead.cc b/src/notehead.cc index 5db7386600..f6521a58fe 100644 --- a/src/notehead.cc +++ b/src/notehead.cc @@ -14,6 +14,7 @@ Notehead::Notehead(int ss) position = 0; balltype = 0; dots = 0; + extremal = 0; } void @@ -39,11 +40,11 @@ Notehead::brew_molecule() const return out; 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)) @@ -55,7 +56,7 @@ Notehead::brew_molecule() const return out; 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) diff --git a/src/paper.cc b/src/paper.cc index 82b8583876..09fd19aad4 100644 --- a/src/paper.cc +++ b/src/paper.cc @@ -25,7 +25,7 @@ Paperdef::rule_thickness()const Paperdef::Paperdef(Lookup *l) { - lookup_ = l; + lookup_p_ = l; linewidth = convert_dimen(15,"cm"); // in cm for now whole_width = 8 * note_width(); @@ -34,32 +34,40 @@ Paperdef::Paperdef(Lookup *l) 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 diff --git a/src/parser.y b/src/parser.y index 3ef8d182ff..a2603284b3 100644 --- a/src/parser.y +++ b/src/parser.y @@ -2,7 +2,6 @@ #include #include "lookup.hh" - #include "misc.hh" #include "lexer.hh" #include "paper.hh" @@ -19,7 +18,7 @@ #define YYDEBUG 1 #endif -svec pre_reqs, post_reqs; +Array pre_reqs, post_reqs; Paperdef*default_paper(); %} @@ -42,9 +41,9 @@ Paperdef*default_paper(); char c; int ii[10]; - svec * strvec; - svec *commandvec; - svec *intvec; + Array * strvec; + Array *commandvec; + Array *intvec; Input_staff *staff; Input_score *score; @@ -72,11 +71,11 @@ Paperdef*default_paper(); %token NOTENAME %token REAL %token STRING -%token OPEN_REQUEST_PARENS CLOSE_REQUEST_PARENS + %token DOTS INT %type unit %type pitch_list - +%type open_request_parens close_request_parens %type declaration %type declarable_identifier %type paper_block paper_body @@ -204,7 +203,7 @@ score_commands_block: COMMANDS '{' score_commands_body '}' { $$ =$3;} ; -score_commands_body: { $$ = new svec; } +score_commands_body: { $$ = new Array; } | score_commands_body score_command { $$->add($2); } @@ -215,7 +214,7 @@ staff_commands_block: COMMANDS '{' staff_commands_body '}' { ; staff_commands_body: - /* empty */ { $$ = new svec; } + /* empty */ { $$ = new Array; } | staff_commands_body staff_command { $$->add($2); } @@ -246,6 +245,10 @@ skipcommand: score_command: skipcommand + | BAR STRING { + $$ = get_bar_command(*$2); + delete $2; + } | METER int int { $$ = get_meterchange_command($2, $3); } @@ -377,10 +380,20 @@ post_requests: ; 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; } @@ -434,7 +447,7 @@ pre_requests: ; pre_request: - OPEN_REQUEST_PARENS { $$ = get_request($1); } + open_request_parens { $$ = get_request($1); } ; @@ -489,7 +502,7 @@ voice_elt: UTILITIES */ pitch_list: { - $$ = new svec; + $$ = new Array; } | pitch_list NOTENAME { $$->add($2[0]); @@ -508,7 +521,7 @@ int: int_list: /* */ { - $$ = new svec; + $$ = new Array; } | int_list int { $$->add($2); diff --git a/src/pcol.cc b/src/pcol.cc index 52df4297d4..b64873345d 100644 --- a/src/pcol.cc +++ b/src/pcol.cc @@ -18,12 +18,12 @@ PCol::width() const int PCol::rank() const { - if(!pscore_) + if(!pscore_l_) return -1; - PCursor me=pscore_->find_col( (PCol*)this); + PCursor me=pscore_l_->find_col( (PCol*)this); if (!me.ok()) return -1; - PCursor bot(pscore_->cols.top()); + PCursor bot(pscore_l_->cols.top()); return me - bot; } @@ -39,10 +39,11 @@ PCol::print() const 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"; @@ -52,17 +53,23 @@ PCol::print() const 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 ac(ps_l->find_col(&c1)); + PCursor 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 @@ -71,42 +78,39 @@ PCol::set_breakable() 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 diff --git a/src/pscore.cc b/src/pscore.cc index bd9154647d..696c542838 100644 --- a/src/pscore.cc +++ b/src/pscore.cc @@ -42,22 +42,45 @@ PScore::clean_cols() 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; } @@ -73,7 +96,7 @@ PScore::typeset_item(Item *i, PCol *c, PStaff *s, int breakstat) 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); @@ -82,29 +105,20 @@ PScore::typeset_spanner(Spanner*span_p, PStaff*ps) } -int -PScore::compare_pcols(PCol*a, PCol*b)const -{ - PCursor ac(find_col(a)); - PCursor 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 @@ -112,7 +126,7 @@ PScore::output(Tex_stream &ts) { 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(); @@ -122,13 +136,13 @@ PScore::output(Tex_stream &ts) } -svec -PScore::select_items(PStaff*ps , PCol*pc) +Array +PScore::select_items(PStaff*ps, PCol*pc) { - svec ret; + Array 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; @@ -150,7 +164,7 @@ PScore::print() const { #ifndef NPRINT mtor << "PScore { "; - paper_->print(); + paper_l_->print(); mtor << "\ncolumns: "; for (iter_top(cols,cc); cc.ok(); cc++) cc->print(); @@ -196,34 +210,34 @@ PScore::postprocess() } PCursor -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 breaking) +PScore::set_breaking(Array breaking) { - for (int j=0; j < breaking.sz(); j++) { - svec &curline(breaking[j].cols); - svec &config(breaking[j].config); + for (int j=0; j < breaking.size(); j++) { + Array &curline(breaking[j].cols); + Array &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]; } } @@ -235,3 +249,15 @@ PScore::calc_breaking() Word_wrap w(*this); set_breaking(w.solve()); } + +void +PScore::process() +{ + clean_cols(); + *mlog << "Preprocessing ... "; + preprocess(); + *mlog << "Calculating ... "; + calc_breaking(); + *mlog << "Postprocessing ... "; + postprocess(); +} diff --git a/src/pstaff.cc b/src/pstaff.cc index ba7789c91b..3c7d82deae 100644 --- a/src/pstaff.cc +++ b/src/pstaff.cc @@ -1,19 +1,20 @@ #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; } diff --git a/src/qlp.cc b/src/qlp.cc index 460bd86423..5aa8e9f45e 100644 --- a/src/qlp.cc +++ b/src/qlp.cc @@ -34,7 +34,7 @@ void 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 @@ -52,12 +52,12 @@ Mixed_qp::solve(Vector start) const 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; @@ -80,7 +80,7 @@ Ineq_constrained_qp::eliminate_var(int idx, Real value) 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); } @@ -91,8 +91,8 @@ Ineq_constrained_qp::eliminate_var(int idx, Real value) void Ineq_constrained_qp::assert_solution(Vector sol) const { - svec binding; - for (int i=0; i < cons.sz(); i++) { + Array binding; + for (int i=0; i < cons.size(); i++) { Real R=cons[i] * sol- consrhs[i]; assert(R> -EPS); if (R < EPS) @@ -109,7 +109,7 @@ Ineq_constrained_qp::print() const 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["<= " << consrhs[i]; mtor << "\n"; } @@ -137,7 +137,7 @@ Mixed_qp::OK() const { #ifndef NDEBUG Ineq_constrained_qp::OK(); - assert(eq_consrhs.sz() == eq_cons.sz()); + assert(eq_consrhs.size() == eq_cons.size()); #endif } @@ -146,7 +146,7 @@ Mixed_qp::print() const { #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 "<cons.sz()); + assert(active.size() +inactive.size() == opt->cons.size()); assert(H.dim() == opt->dim()); - assert(active.sz() == A.rows()); - svec allcons; + assert(active.size() == A.rows()); + Array 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 @@ -60,7 +63,7 @@ Active_constraints::add(int k) 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] ); @@ -92,7 +95,7 @@ Active_constraints::add(int k) void Active_constraints::drop(int k) { - int q=active.sz()-1; + int q=active.size()-1; // drop indices inactive.add(active[k]); @@ -124,7 +127,7 @@ Active_constraints::Active_constraints(Ineq_constrained_qp const *op) 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(); diff --git a/src/request.cc b/src/request.cc index 4cb98c2f34..f87f103a6c 100644 --- a/src/request.cc +++ b/src/request.cc @@ -8,6 +8,7 @@ #define RCONS(T) VIRTUALCONS(T, Request) RCONS(Rest_req); +RCONS(Barcheck_req); RCONS(Text_req); RCONS(Rhythmic_req); RCONS(Stem_req); @@ -18,6 +19,14 @@ RCONS(Span_req); RCONS(Slur_req); RCONS(Beam_req); +void +Barcheck_req::print() const +{ +#ifndef NPRINT + mtor << "Barcheck\n"; +#endif +} + void Request::print() const { @@ -26,11 +35,22 @@ 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; @@ -105,6 +125,12 @@ Script_req::Script_req(int d , Script_def*def) scriptdef = def; } +Script_req::Script_req(Script_req const &s) +{ + dir = s.dir; + scriptdef = new Script_def(*s.scriptdef); +} + void Script_req::print() const { @@ -118,7 +144,11 @@ Script_req::~Script_req() 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; diff --git a/src/rest.cc b/src/rest.cc index edb89c3696..d06489507c 100644 --- a/src/rest.cc +++ b/src/rest.cc @@ -22,16 +22,14 @@ Rest::print()const 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); diff --git a/src/rhythmstaff.cc b/src/rhythmstaff.cc index 9142986abc..c78eedb256 100644 --- a/src/rhythmstaff.cc +++ b/src/rhythmstaff.cc @@ -25,7 +25,7 @@ Rhythmic_staff::get_TYPESET_item(Command *com) 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; } diff --git a/src/sccol.cc b/src/sccol.cc index ec8784a9bd..bbd0dba1ae 100644 --- a/src/sccol.cc +++ b/src/sccol.cc @@ -5,35 +5,37 @@ 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 } @@ -52,7 +54,7 @@ Score_column::preprocess() 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 ; } diff --git a/src/score.cc b/src/score.cc index 2819a21965..706fc53d99 100644 --- a/src/score.cc +++ b/src/score.cc @@ -10,37 +10,26 @@ 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"; } @@ -52,15 +41,13 @@ Score::clean_cols() 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. @@ -73,14 +60,14 @@ Score::create_cols(Moment w) 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; } @@ -102,9 +89,9 @@ Score::find_col(Moment w,bool mus) { 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); @@ -114,12 +101,13 @@ Score::find_col(Moment w,bool mus) } 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 @@ -137,12 +125,12 @@ Score::OK() 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 } @@ -159,8 +147,8 @@ Score::print() const for (iter_top(cols_,i); i.ok(); i++) { i->print(); } - if (pscore_) - pscore_->print(); + if (pscore_p_) + pscore_p_->print(); mtor << "}\n"; #endif @@ -168,25 +156,26 @@ Score::print() const 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); } @@ -194,7 +183,7 @@ Score::output(String s) void Score::add(Staff*s) { - s->score_ = this; + s->score_l_ = this; staffs_.bottom().add(s); } diff --git a/src/scoreline.cc b/src/scoreline.cc index 39c13c48b8..ed28c5b543 100644 --- a/src/scoreline.cc +++ b/src/scoreline.cc @@ -22,17 +22,17 @@ Line_of_score::TeXstring() const } -Line_of_score::Line_of_score(svec sv, +Line_of_score::Line_of_score(Array 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 diff --git a/src/scores.cc b/src/scores.cc index 1d0679c534..1b7b6558de 100644 --- a/src/scores.cc +++ b/src/scores.cc @@ -3,7 +3,7 @@ #include "score.hh" #include "string.hh" -static svec sv; +static Array score_array_global; static String outfn="lelie.uit"; @@ -11,21 +11,21 @@ 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); } diff --git a/src/script.cc b/src/script.cc index 493c6823d7..4f5ed1c0e7 100644 --- a/src/script.cc +++ b/src/script.cc @@ -5,15 +5,15 @@ #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; @@ -22,42 +22,51 @@ Script::Script(Script_req* rq, Item*i , int staflen, Stem*st_p) 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 height(); + + if (d > 0) { + y = y >? v.max(); + }else if (d < 0) { + y = y 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 @@ -80,16 +96,13 @@ Script::do_post_processing() { 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; } diff --git a/src/simpleprint.cc b/src/simpleprint.cc index b3f2ac40c0..de3d6ec921 100644 --- a/src/simpleprint.cc +++ b/src/simpleprint.cc @@ -13,7 +13,7 @@ Item * Simple_staff::get_TYPESET_item(Command *com) { Item *s=0; - svec arg( com->args); + Array arg( com->args); String type =arg[0]; arg.del(0); if (type == "BAR" ) { @@ -32,12 +32,12 @@ Simple_staff::get_TYPESET_item(Command *com) Interval -itemlist_width(const svec &its) +itemlist_width(const Array &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()); } @@ -49,18 +49,18 @@ Simple_column::typeset_item(Item *i, int breakst) { 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 to_move( - staff_->pscore_->select_items(staff_->theline, - score_column->pcol_->prebreak)); + Array 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)); } } @@ -70,13 +70,13 @@ void 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 to_move(staff_->pscore_->select_items(staff_->theline, + Array to_move(staff_->pscore_l_->select_items(staff_->theline, c)); typeset_item(i, breakst); @@ -89,8 +89,8 @@ Simple_column::typeset_item_directional(Item *i, int dir, int breakst) void Simple_staff::set_output(PScore* ps ) { - pscore_ = ps; - pscore_->add(theline); + pscore_l_ = ps; + pscore_l_->add(theline); } diff --git a/src/simplestaff.cc b/src/simplestaff.cc index 636b6691de..f0087ebd3f 100644 --- a/src/simplestaff.cc +++ b/src/simplestaff.cc @@ -39,9 +39,15 @@ Scalar 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()); } diff --git a/src/simplewalker.cc b/src/simplewalker.cc index 945f5151de..21ed11573a 100644 --- a/src/simplewalker.cc +++ b/src/simplewalker.cc @@ -1,5 +1,5 @@ /* - UGR + UGR!! CHAOS RULEZ */ #include "textspanner.hh" #include "script.hh" @@ -23,15 +23,15 @@ #include "textitem.hh" Rhythmic_grouping -parse_grouping(svec a, Moment one_beat) +parse_grouping(Array a, Moment one_beat) { - svec r; - for (int i= 0 ; i < a.sz(); i++) + Array r; + for (int i= 0 ; i < a.size(); i++) r.add(a[i]); Moment here =0.0; - svec children; - for (int i=0; i < r.sz(); i++) { + Array children; + for (int i=0; i < r.size(); i++) { Moment last = here; here += one_beat * r[i]; @@ -45,19 +45,19 @@ parse_grouping(svec a, Moment one_beat) void Simple_walker::do_INTERPRET_command(Command*com) { - svec args(com->args); + Array 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( key_.oldkey_undo(args)); + oldkey_undo = new Array( key_.oldkey_undo(args)); } typesetkey = key_.read(args); @@ -84,7 +84,13 @@ Simple_walker::do_TYPESET_command(Command*com) 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) @@ -132,11 +138,13 @@ Simple_walker::do_note(Note_info n) 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()); @@ -168,14 +176,15 @@ Simple_walker::process_requests() 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); @@ -190,7 +199,7 @@ Simple_walker::process_requests() 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]); } @@ -208,6 +217,7 @@ Simple_walker::process_requests() /* 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); @@ -223,7 +233,7 @@ Simple_walker::process_requests() 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); @@ -235,13 +245,13 @@ Simple_walker::process_requests() 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); @@ -253,7 +263,7 @@ Simple_walker::process_requests() } Simple_walker::Simple_walker(Simple_staff*s) - : Staff_walker(s, s->theline->pscore_) + : Staff_walker(s, s->theline->pscore_l_) { stem_ = 0; beam_ =0; @@ -285,13 +295,14 @@ Simple_walker::reset() { 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; diff --git a/src/slur.cc b/src/slur.cc index 15a94cf8c3..e5dbf385ac 100644 --- a/src/slur.cc +++ b/src/slur.cc @@ -38,12 +38,12 @@ void 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 @@ -59,19 +59,19 @@ Slur::print()const 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) @@ -93,32 +93,41 @@ Molecule* Slur::brew_molecule() const { Molecule*output = new Molecule; - assert(left->line == right->line); + int minp=1000, maxp=-1000; // todo - for (int i=0; iposition 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; } diff --git a/src/staff.cc b/src/staff.cc index 825e878d8a..ef54dbe466 100644 --- a/src/staff.cc +++ b/src/staff.cc @@ -15,16 +15,18 @@ Staff::add(PointerList &l) } 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 @@ -32,7 +34,7 @@ Staff::clean_cols() { iter_top(cols,i); for(; i.ok(); ){ - if (!i->score_column->used()) + if (!i->score_column_l_->used()) i.del(); else i++; @@ -42,18 +44,18 @@ Staff::clean_cols() 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()) { @@ -66,8 +68,6 @@ Staff::get_col(Moment w, bool mus) return newst; } -// ; assert((i-1).ok()) - // todo! // making a fix at 2:30 am, with several beers drunk. // but it works :-) @@ -97,28 +97,24 @@ Staff::setup_staffcols() 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() { @@ -133,7 +129,7 @@ Staff::OK() const #ifndef NDEBUG cols.OK(); voices.OK(); - assert(score_); + assert(score_l_); #endif } @@ -157,15 +153,12 @@ Staff::print() const 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; } diff --git a/src/staffcommands.cc b/src/staffcommands.cc index f1588ebe23..f99a3d9726 100644 --- a/src/staffcommands.cc +++ b/src/staffcommands.cc @@ -1,6 +1,7 @@ #include "staffcommands.hh" #include "debug.hh" #include "parseconstruct.hh" +#include "getcommand.hh" Moment Staff_commands_at::when() @@ -22,10 +23,12 @@ Staff_commands_at::print() const 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) @@ -48,7 +51,7 @@ Staff_commands_at::is_breakable() void Staff_commands_at::set_breakable() { - assert(!is_breakable()); + if (is_breakable()) return; Command k; k.code = BREAK_PRE; @@ -123,9 +126,11 @@ Staff_commands_at::add(Command c) 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); @@ -145,8 +150,8 @@ Staff_commands_at::add(Command c) 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; @@ -198,73 +203,3 @@ Staff_commands_at::add(Command c) } } - -/****************************************************************/ - -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 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 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 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(); - } -} diff --git a/src/staffelem.cc b/src/staffelem.cc index bf76a9eb70..d942732e7c 100644 --- a/src/staffelem.cc +++ b/src/staffelem.cc @@ -7,12 +7,23 @@ 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; @@ -60,7 +71,7 @@ Staff_elem::print()const Staff_elem::Staff_elem() { calc_children = false; - pstaff_=0; + pstaff_l_=0; offset_ = Offset(0,0); output = 0; status = ORPHAN; @@ -70,8 +81,8 @@ Staff_elem::Staff_elem() Paperdef* Staff_elem::paper() const { - assert(pstaff_); - return pstaff_->pscore_->paper_; + assert(pstaff_l_); + return pstaff_l_->pscore_l_->paper_l_; } void @@ -89,7 +100,7 @@ Staff_elem::pre_processing() { 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) @@ -101,7 +112,7 @@ Staff_elem::post_processing() { 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) @@ -114,7 +125,7 @@ Staff_elem::molecule_processing() { 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) diff --git a/src/staffline.cc b/src/staffline.cc index 7bd534fb97..1eacf8cb65 100644 --- a/src/staffline.cc +++ b/src/staffline.cc @@ -26,11 +26,11 @@ Line_of_staff::TeXstring() const // 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. @@ -45,12 +45,12 @@ Line_of_staff::TeXstring() const // 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(); } } @@ -60,19 +60,19 @@ Line_of_staff::TeXstring() const 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); } } @@ -82,19 +82,19 @@ Line_of_staff::Line_of_staff(Line_of_score * sc, PStaff*st) 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()); } } @@ -105,7 +105,7 @@ Line_of_staff::height() const 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); } diff --git a/src/stcol.cc b/src/stcol.cc index 9ed22dfe47..46c04cbead 100644 --- a/src/stcol.cc +++ b/src/stcol.cc @@ -1,18 +1,30 @@ #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 @@ -20,17 +32,17 @@ Staff_column::add(Voice_element*ve) { 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() diff --git a/src/stem.cc b/src/stem.cc index df250aa8d3..66b1aadb33 100644 --- a/src/stem.cc +++ b/src/stem.cc @@ -116,9 +116,11 @@ void 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) { @@ -146,7 +148,7 @@ Stem::width()const 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; } @@ -154,20 +156,19 @@ Stem::width()const 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); @@ -183,7 +184,7 @@ Stem::brew_molecule()const return out; Real Stem::hpos()const { - return pcol_->hpos + stem_xoffset; + return pcol_l_->hpos + stem_xoffset; } diff --git a/src/swalker.cc b/src/swalker.cc index 9e4f1d3ff6..34afa0ee40 100644 --- a/src/swalker.cc +++ b/src/swalker.cc @@ -4,6 +4,11 @@ #include "sccol.hh" Staff_walker::~Staff_walker() {} +Staff_walker::Staff_walker(Staff_walker const &s) + :PCursor (s) +{ + assert(false); +} Staff_walker::Staff_walker(Staff * s, PScore*ps ) : PCursor (s->cols) @@ -23,8 +28,8 @@ void 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); } @@ -40,7 +45,7 @@ Staff_walker::process_command(Command*com) 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: diff --git a/src/symbol.cc b/src/symbol.cc index d9ffea7afb..01b235679b 100644 --- a/src/symbol.cc +++ b/src/symbol.cc @@ -1,5 +1,5 @@ #include "symbol.hh" -#include "vray.hh" +#include "varray.hh" Symbol::Symbol() diff --git a/src/template1.cc b/src/template1.cc index 0a9c288bde..128dd06258 100644 --- a/src/template1.cc +++ b/src/template1.cc @@ -8,13 +8,13 @@ #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); diff --git a/src/template2.cc b/src/template2.cc index da169d1657..06b3a167c4 100644 --- a/src/template2.cc +++ b/src/template2.cc @@ -8,7 +8,7 @@ #include "spanner.hh" #include "plist.tcc" - +#include "pcursor.tcc" IPL_instantiate(Request); IPL_instantiate(Score_column); diff --git a/src/template3.cc b/src/template3.cc index 0dba62b3d8..106260039a 100644 --- a/src/template3.cc +++ b/src/template3.cc @@ -10,7 +10,7 @@ #include "plist.tcc" - +#include "pcursor.tcc" IPL_instantiate(Atom); IPL_instantiate(Command); IPL_instantiate(Atom); diff --git a/src/tex.cc b/src/tex.cc index 372536c20a..9a10c993ea 100644 --- a/src/tex.cc +++ b/src/tex.cc @@ -2,7 +2,7 @@ #include "tex.hh" #include "symbol.hh" #include "const.hh" -#include "vray.hh" +#include "varray.hh" String vstrut(Real h) @@ -22,20 +22,20 @@ substitute_arg(String& r, String arg) String -substitute_args(String source, svec args) +substitute_args(String source, Array 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 args) +substitute_args(String source, Array args) { - svec sv; - for (int i = 0 ; i < args.sz(); i++) + Array sv; + for (int i = 0 ; i < args.size(); i++) sv.add(args[i]); return substitute_args(source, sv); diff --git a/src/texbeam.cc b/src/texbeam.cc index 713bc1f473..652360eee8 100644 --- a/src/texbeam.cc +++ b/src/texbeam.cc @@ -18,7 +18,7 @@ Lookup::beam_element(int sidx, int widx, Real slope) { Symbol bs=(*symtables_)("beamslopes")->lookup("slope"); - svec args; + Array args; args.add(sidx); args.add(widx); bs.tex = substitute_args(bs.tex,args); @@ -51,7 +51,7 @@ Symbol Lookup::rule_symbol(Real height, Real width) { Symbol bs=(*symtables_)("beamslopes")->lookup("horizontal"); - svec args; + Array args; args.add(print_dimen(height)); args.add(print_dimen(width)); bs.tex = substitute_args(bs.tex,args); diff --git a/src/textdef.cc b/src/textdef.cc index 58c666150c..26dee59a71 100644 --- a/src/textdef.cc +++ b/src/textdef.cc @@ -13,7 +13,7 @@ Text_def::Text_def() Atom Text_def::create(Paperdef*p) const { - return p->lookup_->text(style, text, -align); + return p->lookup_p_->text(style, text, -align); } void diff --git a/src/timedescription.cc b/src/timedescription.cc index 459c15a06d..ce9b667aaf 100644 --- a/src/timedescription.cc +++ b/src/timedescription.cc @@ -1,23 +1,33 @@ #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 "<0); + assert(dt >= 0); *this = *prev; when += + dt; whole_in_measure += dt; @@ -51,8 +61,24 @@ Time_description::setpartial(Moment p) 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; } diff --git a/src/voice.cc b/src/voice.cc index 9c474f81bb..f4372893af 100644 --- a/src/voice.cc +++ b/src/voice.cc @@ -4,7 +4,9 @@ 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; } @@ -57,7 +59,7 @@ Voice_element::add(Request*r) assert (!duration); duration = r->duration(); } - r->elt = this; + r->elt_l_ = this; reqs.bottom().add(r); } @@ -71,9 +73,8 @@ Voice_element::Voice_element() 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()); } diff --git a/src/warn.cc b/src/warn.cc index 230e4bb976..0c3cac1186 100644 --- a/src/warn.cc +++ b/src/warn.cc @@ -1,11 +1,10 @@ #include "debug.hh" #include "lexer.hh" +#include "moment.hh" ostream &warnout (cerr); ostream *mlog(&cerr); - - void warning(String s) { @@ -25,9 +24,9 @@ error(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); } diff --git a/src/wordwrap.cc b/src/wordwrap.cc index ec6ac16395..d0bfd5b74f 100644 --- a/src/wordwrap.cc +++ b/src/wordwrap.cc @@ -9,25 +9,25 @@ */ -svec +Array Word_wrap::solve() { problem_OK(); iter_top(pscore_.cols,curcol); - svec breaking; - svec breakpoints(find_breaks()); - assert(breakpoints.sz()>=2); - for (int i=0 ; i < breakpoints.sz() -1; ) { + Array breaking; + Array 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()){ @@ -35,9 +35,9 @@ Word_wrap::solve() 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; } diff --git a/titledefs.tex b/titledefs.tex new file mode 100644 index 0000000000..33cf8133cc --- /dev/null +++ b/titledefs.tex @@ -0,0 +1,15 @@ +\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