]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 0.0.32 release/0.0.32
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 18 Feb 1997 10:49:50 +0000 (11:49 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 18 Feb 1997 10:49:50 +0000 (11:49 +0100)
208 files changed:
.dstreamrc
ANNOUNCE [new file with mode: 0644]
Documentation/CodingStyle.pod
Documentation/Makefile
Documentation/README.pod
Documentation/error.pod
Documentation/index.pod [new file with mode: 0644]
Documentation/lilygut.pod
Documentation/lilyinput.pod
Documentation/make_website
Generate.make
Makefile
NEWS
README
Sources.make
TODO
Variables.make
configure
flower/Makefile
flower/NEWS
flower/Sources.make
flower/Variables.make
flower/assoc.hh
flower/choleski.hh
flower/compare.hh
flower/cursor.hh
flower/dataf.cc
flower/dstream.hh
flower/findcurs.hh [deleted file]
flower/findcurs.inl [deleted file]
flower/handle.hh
flower/interval.hh
flower/iterate.hh
flower/lgetopt.hh
flower/list.hh
flower/list.tcc
flower/matrix.hh
flower/path.cc
flower/path.hh
flower/pcursor.hh
flower/plist.hh
flower/scalar.hh
flower/string.cc
flower/string.hh
flower/stringutil.hh
flower/textdb.hh
flower/textstr.hh
flower/tsmat.hh [deleted file]
flower/tsmat.tcc [deleted file]
flower/tvsmat.hh [deleted file]
flower/unionfind.hh
flower/varray.hh
flower/vector.hh
flower/vsmat.hh
hdr/bar.hh
hdr/barreg.hh [new file with mode: 0644]
hdr/beam.hh
hdr/boxes.hh
hdr/clef.hh [deleted file]
hdr/clefitem.hh
hdr/clefreg.hh [new file with mode: 0644]
hdr/command.hh [deleted file]
hdr/commandrequest.hh [new file with mode: 0644]
hdr/complexcolumn.hh
hdr/complexstaff.hh
hdr/complexwalker.hh
hdr/getcommand.hh [deleted file]
hdr/grouping.hh
hdr/inputcommand.hh [deleted file]
hdr/inputcommands.hh [deleted file]
hdr/inputmusic.hh
hdr/inputscore.hh
hdr/inputstaff.hh
hdr/key.hh
hdr/keyitem.hh
hdr/keyreg.hh [new file with mode: 0644]
hdr/leastsquares.hh
hdr/lexer.hh
hdr/linespace.hh
hdr/localkeyitem.hh
hdr/localkeyreg.hh
hdr/lyriccolumn.hh
hdr/lyricstaff.hh
hdr/lyricwalker.hh
hdr/meter.hh
hdr/meterreg.hh [new file with mode: 0644]
hdr/misc.hh
hdr/musicalrequest.hh [new file with mode: 0644]
hdr/parseconstruct.hh
hdr/pcol.hh
hdr/proto.hh
hdr/pscore.hh
hdr/qlp.hh
hdr/qlpsolve.hh
hdr/register.hh
hdr/reqtodo.hh [new file with mode: 0644]
hdr/request.hh
hdr/sccol.hh
hdr/score.hh
hdr/scorewalker.hh [new file with mode: 0644]
hdr/source.hh
hdr/sourcefile.hh
hdr/spanner.hh
hdr/staff.hh
hdr/staffcommands.hh [deleted file]
hdr/staffeleminfo.hh [new file with mode: 0644]
hdr/staffwalker.hh
hdr/stcol.hh
hdr/stem.hh
hdr/tex.hh
hdr/textdef.hh
hdr/textspanner.hh
hdr/timedescription.hh
hdr/tstream.hh
hdr/voice.hh
init/table_sixteen.ini
input/Makefile
input/cadenza.ly
input/coriolan-alto.ly
input/error.ly
input/kortjakje.ly
input/maartje.ly
input/martien.ly
input/mlalt.ly
input/mlcello.ly
input/mlvio1.ly
input/mlvio2.ly
input/pavane.ly
input/rhythm.ly [new file with mode: 0644]
input/scales.ly
input/scsii-menuetto.ly
input/standchen.ly
input/twinkle.ly
input/wohltemperirt.ly
src/bar.cc
src/barreg.cc [new file with mode: 0644]
src/beam.cc
src/break.cc
src/calcideal.cc
src/clef.cc [deleted file]
src/clefitem.cc
src/clefreg.cc [new file with mode: 0644]
src/command.cc [deleted file]
src/commandrequest.cc [new file with mode: 0644]
src/complexcolumn.cc [new file with mode: 0644]
src/complexprint.cc [deleted file]
src/complexstaff.cc
src/complexwalker.cc
src/getcommands.cc [deleted file]
src/grouping.cc
src/headreg.cc
src/inputcommand.cc [deleted file]
src/inputcommands.cc [deleted file]
src/inputmusic.cc
src/inputscore.cc
src/inputstaff.cc
src/key.cc
src/keyitem.cc
src/keyreg.cc [new file with mode: 0644]
src/lexerinit.cc
src/localkeyitem.cc
src/localkeyreg.cc
src/lookup.cc
src/lyriccolumn.cc
src/lyricitem.cc
src/lyricstaff.cc
src/lyricwalker.cc
src/meter.cc
src/meterreg.cc [new file with mode: 0644]
src/misc.cc
src/mylexer.cc
src/note.cc
src/notehead.cc
src/parser.y
src/pcol.cc
src/pscore.cc
src/qlp.cc
src/qlpsolve.cc
src/register.cc
src/request.cc
src/sccol.cc
src/score.cc
src/scorewalker.cc [new file with mode: 0644]
src/script.cc
src/scriptreg.cc
src/slurreg.cc
src/source.cc
src/sourcefile.cc
src/staff.cc
src/staffcommands.cc [deleted file]
src/staffelem.cc
src/staffwalker.cc
src/stcol.cc
src/stem.cc
src/stembeamreg.cc
src/template1.cc
src/template2.cc
src/template3.cc
src/textdef.cc
src/textitem.cc
src/textreg.cc
src/timedescription.cc
src/voice.cc
src/voiceelt.cc [new file with mode: 0644]
src/voicegroup.cc
src/voiceregs.cc
src/warn.cc
src/wordwrap.cc

index 5c98922777e4cc878b0293ada0171398189a6ca4..b4d6029922c1d2e5901460cd9913ba9ad92acfd2 100644 (file)
@@ -38,7 +38,7 @@ Input_cursor          1
 Commands_at            1
 Input_command          1
 Time_description       1
-Melodic_req            1
+Melodic_req            0
 Stem_req               0
 Group_change_req       1
 Script_req             1
diff --git a/ANNOUNCE b/ANNOUNCE
new file mode 100644 (file)
index 0000000..56579bf
--- /dev/null
+++ b/ANNOUNCE
@@ -0,0 +1,115 @@
+
+CALL FOR HACKERS: LilyPond, the Music Typesetter
+
+[Sorry if this is a bit off-topic; I want to announce this software to
+small crowd, because it is still test-stage]
+
+Hi net!
+
+this is to announce the availability of the first public release
+(v0.1) of my music typesetter.
+
+WHAT IS LILYPOND
+
+Technically it is a preprocessor which generates TeX
+(or LaTeX) output which contains information to typeset a musical
+score. Practically it is a typesetter, which only uses TeX as an
+output medium. (this is handy because there exist music fonts for TeX)
+
+HOW DOES IT WORK
+
+The input is a script file (example appended) which is read. The
+script file is a "music definition", ie, you type the melody as if it
+is read out loud
+
+LilyPond interprets this melody and generates appropriate output items
+(balls, stems, beams), and calculates where they should be put. Then
+it outputs a TeX file. Warning: this said calculations is *slow* (a full
+page of music typically takes 1 minute on my 486/66)
+
+WHY IS THIS A TEST VERSION
+
+There a lot of advanced features (grace notes, piano staffs) which are
+VapourFeatures (tm). We're not sure about the language. It may change;
+having a large user base is a burden then.
+
+WHY A CALL FOR HACKERS
+
+Currently, the development has three people. I'd this project to have
+more people working on it (there is a lot of work to be done) I think
+this program is pretty original, so join in if you anything about
+music and computers!
+
+As an aside, I really like the anarchist approach of linux development.
+
+WHAT HAS TO BE DONE
+
+LilyPond is written in Gnu C++, and it is (imo) written very cleanly
+(Lots of classes, lots of comments, small files/small functions) and
+with extensions in mind.
+
+       - Coding. For this time, there won't any biggish (global)
+source hackings. There are a lot of small projects which could use
+some work.
+
+       - Some TeX hacking. I know little about TeX
+
+       - Documentation. I don't have time for this
+
+I WANT MORE INFO!
+
+You can download it at:
+
+       ftp://pcnov095.win.tue.nl/pub/lilypond
+
+or visit the incredibly lousy webpage at:
+
+       http://www.stack.nl/~hanwen/lilypond/index.html
+
+
+EXAMPLE INPUT
+
+       % twinkle twinkle little star
+       melody = music {
+               $\clef\violin
+               c c | g g | a a | g g |
+               f f | e e | d d8.( e16 | )c2 |
+
+               g g | f f | e e | d d |
+               g g | f f | e( e8. f16 | e )d |
+
+               c c | g g | a a | g g |
+               f f | e e | d d8.( e16 | )c2 
+               $
+       }
+
+       text2 = music {
+               @
+               \textstyle "roman"
+               When the bla- zing sun is gone,2
+               When he no- thing shines up- on,2
+               Then you show your lit- tle light,2
+               Twin- kle, twin- kle, all the night.2
+               Twin- kle, twin- kle, lit- tle star,2
+               How I won- der what you are!2
+               @
+       }
+
+       english_staf = staff {
+               lyric 
+               music { text2 }
+       }
+
+       score {
+               staff { melodic music { melody }  }
+               staff { english_staf }
+               paper {
+                       unitspace 2.5cm
+               }
+               commands {
+                       meter {2 * 4}
+                       skip 24*2
+                       bar "||"
+               }
+       }
+
index 2b86193338b7ad38209442f2f0df23a32f14b79c..fdbab0668bafa409aa1138d6d4e03e7dc88bd2c7 100644 (file)
@@ -34,7 +34,7 @@ in emacs:
        Class::member()
        Type Class::member_type_
 
-the C<type> is a Hungarian notation postfix for $C<Type>$.
+the C<type> is a Hungarian notation postfix for $C<Type>$. See below
 
 
 =head2 COMMENTS
@@ -42,25 +42,26 @@ the C<type> is a Hungarian notation postfix for $C<Type>$.
 The source is commented in the DOC++ style.  Check out doc++ at
 http://www.zib.de/Visual/software/doc++/index.html
 
-       /// short description
+       /**
+               short description.
+               Long class documentation.
+       */
        class Class {
-               /// short description
-               /**
-                       long description
+               /** short description.
+                 long description
                */
 
                Data data_member_;
-               /****************/
 
-               /// short memo
+
                /**
-                       long doco of member()
+                       short memo. long doco of member()
                */
                member();
+
+               /// memo only
+               boring_member();
        };
-       /**
-               Class documentation.
-       */
 
 Unfortunately most of the code isn't really documented that good.
 
@@ -87,13 +88,207 @@ Standard methods:
        /// print *this (and substructures) to debugging log
        void print() const
 
-       /// add some data to *this; 
-       add( .. )
        /**
+       protected member. Usually invoked by non-virtual A_virtual_func()
+       */
+       virtual do_A_virtual_func()
+
+       /**add some data to *this.
        Presence of these methods usually imply that it is not feasible to this
        via  a constructor
        */
+       add( .. )
 
        /// replace some data of *this
        set( .. )
 
+=head1 HUNGARIAN NOTATION NAMING CONVENTION
+
+Proposed is a naming convention derived from the so-called I<Hungarian
+Notation>.
+
+=head2 Hungarian
+
+The Hungarian Notation was conceived by
+or at least got its name from,
+the hungarian programmer x. 
+It is a naming convention with the aim 
+to make code more readable (for fellow programmers)
+and more accessible for programmers 
+that are new to a project.
+
+The essence of the Hungarian Notation 
+is that every identifier has a part
+which identifies its type 
+(for functions this is the result type).
+This is particularly useful in object oriented programming,
+where a particular object implies a specific interface
+(a set of member functions, perhaps some redefined operators),
+and for accounting heap allocated memory pointers and links.
+
+=head2 Advantages
+
+Another fun quote from Microsoft Secrets:
+
+
+       The Hungarian naming convention gives developers the ability
+       to read other people's code relatively easily, with a minmum
+       number of comments in the source code.  Jon De Vann estimated
+       that only about 1 percent of all lines in the Excel product
+       code consist of comments, but the code is still very
+       understandable due to the use of Hungarian: "if you look at
+       our source code, you also notice very few comments.  Hungarian
+       gives us the ability to go in and read code..."
+
+
+Wow! If you use Hungarian you don't have to document your software!
+Just think of the hours I have wasted documenting while this "silver bullet"
+existed. I feel so stupid and ashamed!
+
+=head2 Disadvantages
+
+=over 5
+
+=item *
+more keystrokes (disk space!)
+
+=item *
+it looks silly C<get_slu_p()>
+
+=item *
+it looks like code from micro suckers
+
+=item *
+(which) might scare away some (otherwise good?)
+progammers, or make you a paria in the free
+software community
+
+=item *
+it has ambiguities
+
+=item *
+not very useful if not used consistently
+
+=item *
+usefullness in I<very large> 
+(but how many classes is very large?)
+remains an issue.
+
+=back
+
+
+
+=head2 Proposal
+
+=over 5
+
+=item *
+learn about cut and paste / use emacs or vi
+or lean to type using ten fingers
+
+=item *
+Use emacs dabbrev-expand, with dabbrev-case-fold-search set to nil.
+
+=item *
+use no, or pick less silly, abbrvs.
+
+=item *
+use non-ambiguous postfixes C<identifier_name_type_modifier[_modifier]>
+=back
+
+Macros, C<enum>s and C<const>s are all uppercase,
+with the parts of the names separated by underscores.
+
+=head2 Types
+
+=over 5
+
+=item C<b>
+bool
+
+=item C<bi>
+bit
+
+=item C<ch>
+char
+
+=item C<f>
+float
+
+=item C<i>
+signed integer
+
+=item C<str>
+string class
+
+=item C<sz>
+Zero terminated c string
+
+=item C<u>
+unsigned integer
+
+=back
+
+=head2 User defined types
+
+
+       /** Slur blah. blah.
+       (slur)
+       */
+       class Slur {};
+       Slur* slur_p = new Slur;
+
+=head2 Modifiers
+
+The following types modify the meaning of the prefix. 
+These are precede the prefixes:
+
+=over 5
+
+=item C<a>
+array
+
+=item C<arr>
+user built array.
+
+=item C<c>
+const
+
+=item C<l>
+temporary pointer to object (link)
+
+=item C<p>
+pointer to newed object
+
+=item C<r>
+reference
+
+=back
+
+=over 5
+
+=item C<loop_i>
+Variable loop: an integer
+
+=item C<u>
+Temporary variable: an unsigned integer
+
+=item C<test_ch>
+Variable Test: a character
+
+=item C<firstName_str>
+Variable first_name: a String class object
+
+=item C<first_name_ch_a>
+Variable first_name: a C<char> array
+
+=item C<loop_i_p>
+Variable Loop: an C<Int*> that you must delete
+
+=item C<loop_i_l>
+Variable Loop: an C<Int*> that you must not delete
+
+=back
+
+
+
index c025773895212f810670c8909f639c7502da691c..f8211b708cd8ee35b80370b917a3b22d26fa528b 100644 (file)
@@ -1,9 +1,9 @@
 PODS=README.pod CodingStyle.pod lilygut.pod lilyinput.pod error.pod\
-       faq.pod
+       faq.pod index.pod
 TXTS=$(PODS:.pod=.txt)
 MANS=$(PODS:.pod=.1)
 HTMLS=$(PODS:.pod=.html)
-DISTFILES=$(PODS) Makefile lelie_logo.png make_website #lelieblond.gif 
+DISTFILES=$(PODS) Makefile lelie_logo.png make_website
 
 
 default:
index d8f0d1eae778eca5e0316646f65dc9f1e3f1d55a..87e2b65fbea84770e351ed91f8fc0d56ea24881b 100644 (file)
@@ -22,7 +22,7 @@ ASCII script input, with identifiers (for music reuse),
 customizable notenames, customizable fontset
 
 =item *
-multiple staffs in one score
+Multiple staffs in one score. Each staff can have a different meters.
 
 =item *
 multiple stafftypes (melodic, rhythmic) [broken from  pl28 on]
@@ -33,15 +33,14 @@ triplets, general n-plet (triplet, quadruplets, etc.), lyrics
 
 =item *
 multiple voices within one staff; beams optionally shared
-between voices.
+between voices. (well, more than 2 voices won't look pretty)
 
 =item *
 multiple scores within one input file. Each score is output to
 a different file.
 
 =item *
-clef changes, meter changes, cadenza-mode, declaring markings
-in the music, repeat bars
+clef changes, meter changes, cadenza-mode, key changes, repeat bars
 
 =back
 
@@ -96,7 +95,7 @@ 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
+It will output MIDI, though (at some stage)
 
 =item *
 LilyPond is intended to run on Unix platforms, but it should
@@ -112,8 +111,6 @@ broken systems.
 
 =back
 
-
-
 =head1 OPTIONS
 
 =over 5
@@ -124,7 +121,9 @@ add F<FILE> to the search path for input files.
 
 =item  B<-d,--debug>,
 
-debugging. LilyPond will read the file F<.dstreamrc>, which tells for what functions to produce copious debugging output. 
+Turn debugging info. LilyPond will read the file F<.dstreamrc>, which
+tells for what functions and classes may produce copious debugging
+output.
 
 =item  B<-w,--warranty>,
 
@@ -138,9 +137,9 @@ Set the default output file to F<FILE>.
 
 Show a summary of usage
 
-=item  B<--init, -i>
+=item  B<-i,--init=>F<FILE>
 
-set init file (default: symbol.ini)
+set init file (default: F<symbol.ini>)
 
 =item B<--include, -I>
 add to file search path.
@@ -163,11 +162,13 @@ Compilation:
 =over 5
 
 =item *
- Unix. Any decent Linux distribution is fine. LilyPond is known to run
-on Linux, AIX, Digital Unix and Solaris
+Unix. LilyPond is known to run on Linux, AIX, Digital Unix and
+Solaris (if you have the Cygnus WIN32 port of the GNU utils, it will
+even work in Lose NT/95)
 
 =item *
-GNU C++ v2.7  or better, with libg++. Version 2.7.2 or better recommended.
+GNU C++ v2.7 or better, with libg++ installed.  Version 2.7.2
+or better recommended. I doubt if it will compile with AT&T CC.
 
 =item *
 GNU make.
@@ -176,7 +177,7 @@ GNU make.
 flex (2.5.1 or better)
 
 =item *
-Bison or YACC.
+Bison.
 
 =item *
 The "Flower" library, which should be available from the same
@@ -192,6 +193,10 @@ LilyPond does use a lot of resources. For operation you need the following:
 
 =over 5
 
+=item *
+a fast computer (well; full page of music typically takes 1
+minute on my 486/66, using the DEBUG compile)
+
 =item *
 TeX
 
@@ -266,10 +271,20 @@ quality. If you're not discouraged; this is what I type in my xterm:
 
 This is what the output looks like over here:
 
-       hw:~/musix/spacer$ lilypond input/maartje.ly
-       LilyPond 0.0.27/FlowerLib 1.0.23. Compile: Feb  5 1997, 00:28:13 (g++ 2.7.2)
-       Parsing ... [./init//symbol.ini[./init/dutch.ini][./init/script.ini][./init/table_sixteen.ini]][./input/maartje.ly]
-       Processing music ... Preprocessing ... Calculating ... Postprocessing ... 
+       LilyPond 0.0.pre32-3/FlowerLib 1.0.27. Compile: Feb 18 1997, 11:21:57 (g++ 2.7.2)
+       Parsing ... [./init//symbol.ini[./init//dutch.ini][./init//script.ini][./init//table_sixteen.ini]][./input/wohltemperirt.ly]
+       Setting up music ...Processing music ............
+       Preprocessing ... 
+       Calculating column positions ... [3][6][9]
+       Postprocessing ...
+       warning: slope_index(): beam steeper than 0.5 (-0.555556)
+       warning: slope_index(): beam steeper than 0.5 (-0.588346)
+       warning: slope_index(): beam steeper than 0.5 (-0.523166)
+       warning: slope_index(): beam steeper than 0.5 (0.571915)
+       warning: slope_index(): beam steeper than 0.5 (-0.555556)
+       warning: slope_index(): beam steeper than 0.5 (-0.588346)
+       warning: slope_index(): beam steeper than 0.5 (-0.523166)
+       warning: slope_index(): beam steeper than 0.5 (0.571915)
        output to lelie.out...
 
        hw:~/musix/spacer$ tex test
@@ -329,7 +344,7 @@ among others: lilygut, lilyinput, error, faq,
 =head1  REMARKS
 
 LilyPond has no connection with the music package RoseGarden, other
-than the names being similar.
+than the names being similar :-)
 
 
 =head1 HISTORY
index 0a73c5b627ba9001788aee9489de23dd14eb4c9e..e6ae1a689cc62798ac50445170787f94fb6954c9 100644 (file)
@@ -10,22 +10,4 @@ A correctly parsed F<input.ly> does not guarantuee output. A lot
 (most) of the checking is done B<after> parsing (some checks even are
 done after the break calc!); I'm sorry.
 
-[outdated]
-
-The parser's job is to construct appropriate objects. It will B<only>
-detect parse errors.
-
-        can't find slur to end
-
-Eg. with:
-
-       {d g ( } ) g8
-
-The {} part generates two one-note C<Voice>s, the C<g8> another, which
-is translated to start right after the chord.  Slurs are contained
-within voices.  LilyPond can't find a slur which started in this
-C<g8>'s voice. (what should C<{ d( g ( } )g8 )g8 }> look like?  Use
-
-       { \music { d } \music { g()g8 } }
-
-
+[yep.. has to be written..]
diff --git a/Documentation/index.pod b/Documentation/index.pod
new file mode 100644 (file)
index 0000000..0636473
--- /dev/null
@@ -0,0 +1,76 @@
+=head1 NAME
+
+LilyPond -- the Webpage
+
+=head1 DESCRIPTION
+
+Excuse me for this poor page. I don't really have time for doing this..
+
+[and yes, i write webpages in POD :-]
+
+=head1 DOCUMENTATION
+
+=item *
+<a href=README.html
+>
+README
+</a
+>
+
+=item *
+<a href=lilygut.html
+>
+internal structures.
+</a
+>
+
+=item *
+<a href=lilyinput.html
+>
+notes on the input format
+</a
+>
+
+=item *
+<a href=faq.html
+>
+FAQ
+</a
+>
+
+=item *
+<a href=error.html
+>
+errors
+</a
+>
+
+=item *
+<a href=lelie_logo.png
+>
+The lilypond logo (in PNG format)
+</a
+>
+
+
+=item *
+<a href=wohltemperirt.ly
+>
+An example inputfile: from Bach's WTK: c-minor fugue
+</a
+>
+
+=item *
+<a href=wohltemperirt.gif
+>
+A Gif file of the example
+</a
+>
+
+=item *
+<a href=wohltemperirt.ps
+>
+PS output
+</a
+>
+
index 5633ee211a9e22723ba5e55c0995358ac5d3425e..e348b644d0f914ff114fac7c440dabf8b107b86f 100644 (file)
@@ -8,6 +8,10 @@ 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
 
+You should use doc++ to take a peek at the sources.
+
+[have to do more doco; see TODO]
+
 =head1 OVERVIEW
 
 LilyPond is a "5-pass" system:
@@ -170,6 +174,10 @@ registers. There are a few groups:
 =item *
 Staff wide, contains
        Local_key_register
+       Bar_register
+       Key_register
+       Meter_register
+       Clef_register
 
 =item *
 Voice group, contains
@@ -186,36 +194,6 @@ Voice, contains
 =item 1
 
 
-=head1 COMMANDS
-
-
-This table decribes the proper order for the different commands:
-
-
-=head2 interpret
-
-       which           priority
-       ========================
-       
-       key             200
-       clef            190
-       meter           180             
-       bar             170
-
-=head2 typeset
-
-       which           priority
-       ========================
-
-       bar             100
-       clef            90
-       currentclef     80
-       key             70
-       currentkey      60
-       meter           40
-
-
-
 =head1 BREAKING
 
 [Source files: F<command.hh>, F<scommands.cc>]
@@ -317,39 +295,6 @@ concept of pre- and post-breaks.
 minimum distance to other columns, to prevent symbols from running
 into symbols of other columns.)
 
-=head1 POINTERS
-
-This describes the ownership of certain classes in LilyPond. +
-signifies a "list of". (This is not complete)
-
-       Score:
-               Paperdef
-               Staff+
-               Score_commands
-               Score_columns+
-               PScore
-
-       Staff:
-               Voice
-               Staff_column+
-               Command+
-
-
-       Voice:
-               Voice_element
-
-       Voice_element:
-               Request+
-
-
-       PScore:
-               PStaff+
-               PCol+
-               Idealspacing+
-               Item+
-               Spanner+
-               Spanner+ (broken)
-
 =head1 SEE ALSO
 
 =head2 References
@@ -401,7 +346,8 @@ Muziek'' afstudeerscriptie Bestuurlijke informatica, no 45327, Erasmus
 universiteit Rotterdam, 1991.  (``An automated system for printing
 music'' Master's Thesis Management and Computer Science.)
 
-C. Roemer,  The Art of Music Copying. Roerick music co., Sherman Oaks (CA), 1973.
+C. Roemer, The Art of Music Copying. Roerick music co., Sherman Oaks
+(CA), 1973.
 
 Rosecrans, Glen. Music Notation Primer. New York: Passantino, 1979.
  
index dfdd59794832ec97a7b3c6f41a545bd67e316efe..b7d48880064e465b7e4631a5b2a3071bfa5db595 100644 (file)
@@ -4,7 +4,8 @@ LilyInput -  LilyPond input format
 
 =head1 DESCRIPTION
 
-This page documents the the LilyPond input format, mudela.
+This page globally documents the the LilyPond input format, mudela.
+To get a better impression, please study some examples.
 
 =head2 Overview
 
index d241527ff185a14a07f22a4b0672323a2776287f..4b1a9aaf4af78dc71d7c794217f209853b73948f 100755 (executable)
@@ -25,9 +25,13 @@ foreach $a (<*.html>)
 
 foreach $a (@examples) {
     $texfile="test";
-    system "cd ..; lilypond input/$a; tex $texfile; dvips $texfile;";    
-    system "mv ../$texfile.ps $a.ps";
-    system "gs -q -sDEVICE=ppmraw -sOutputFile=- -r200 -dNOPAUSE  $a.ps -c quit |pnmscale 0.5| ppmtogif > $a.gif"
+    system "cd ..; lilypond input/$a; tex $texfile;";
+    system "dvips -o $texfile.ps $texfile;";    
+    system "mv ../$texfile.ps $a.ps;".
+       "gs -q -sDEVICE=ppmraw -sOutputFile=- -r200 -dNOPAUSE  $a.ps -c quit |pnmscale 0.5| ppmtogif > $a.gif"
 }
 
-system "tar cfz website.tgz *.html *.gif *.png *.ps " 
+system "mkdir docxx; make -C.. docxx; ln ../docxx/* ./docxx/;"
+
+system "tar cf website.tar *.html *.gif *.png *.ps docxx/;" .
+"gzip -9 website.tar;"
index 08d53ba78cce47eb666bbae256822c5a703f267d..701c6d79b04493d1f0168e3914df82d4fac4c7a5 100644 (file)
@@ -7,7 +7,7 @@ parsheadnew=$(HEADERDIR)/parser.hh
 $(CCDIR)/parser.cc: $(CCDIR)/parser.y
        $(BISON) -d $<
        (if diff  $(parsheadorig) $(parsheadnew)>/dev/null; then \
-               echo leaving $(parsheadnew);  \
+               echo Ignoring $(parsheadorig);  \
        else \
                mv $(parsheadorig) $(parsheadnew); \
        fi )
index 7af694d132eecc3397b107daf6cedff27495439b..f34bcbc4ca1bef03a86f49fdd06884169fec1896 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ include Variables.make
 
 $(exe): $(obs)
        $(STRIPDEBUG) $(STABLEOBS)
-       $(CXX) -o $@ $^ $(LOADLIBES)
+       $(LINKER) -o $@ $^ $(LOADLIBES)
 
 
 .PHONY: clean docxx
@@ -31,7 +31,7 @@ doc:
 
 # doc++ documentation of classes
 docxx: $(progdocs)     
-       doc++ -p -d $(DOCDIR) $^
+       doc++ -kp -d $(DOCDIR) $^
 
 $(OBJECTDIR)/%.o: $(CCDIR)/%.cc
        $(DODEP)\
diff --git a/NEWS b/NEWS
index 1899d8f4c7ff9c1ce73aae4bbba6b956b6acec9c..34f241725cf09df96c623eb1597cb396babb44ed 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,31 @@
+pl 32
+       - multiple meters, see rhythm.ly
+       
+
+pl 32-2
+       - skip syntax/Skip_req
+       - command carnage
+       - score_wide_music: commands in staff now override commands in score.
+Internal:
+       - Key_register
+       - Bar_register
+       - Meter_register
+       - meters now kept in baseclass Staff_walker
+       - Score_walker (to ease MIDI output)
+Doc:
+       - Hungarian doco added to CodingStyle
+
+pl 32-1
+       - music processing speedup
+       - website added to doco
+       - clef must *inside* music
+       - fixed spurious "beam too narrow" messages.
+Internal
+       - merge musical / non-musical staff_column
+       - musical/ non-musical requests
+       - Clef_register
+       - split up request.hh, Musical_req vs. Nonmusical_req
+
 pl 31
 
 Examples
diff --git a/README b/README
index 414facda003d3666a7ea8f290725eaf9547b8ac5..8c2b831b5af0ddf294b450727312de2e3a5274fb 100644 (file)
--- a/README
+++ b/README
@@ -1,3 +1,11 @@
+IMPORTANT: if you have downloaded a
+
+       *.pre*
+
+version, then this is version is *not* meant for producing nice output
+(but to keep your patchsets up to date)
+
+====================
 Please refer to the directory Documentation/, Documentation/README.*
 
 To generate the pretty-printed docs, do this:
@@ -16,4 +24,7 @@ criticism, comments, bugreports, patches, etc. Please send e-mail to
 
        hanwen@stack.urc.tue.nl
 
-Have fun!
\ No newline at end of file
+Have fun!
+
+======================
+
index dad8bf273410848c8d25ce7d94d9e902d612b77c..ffb0f96cd59e0313d4f2aa95fcd130d4cfda296f 100644 (file)
@@ -1,65 +1,68 @@
 # -*- Makefile-*-
-# sourcefiles to be shipped. Also for dependencies
+# sourcefiles to be shipped. Also used for dependencies
 
-hdr=   bar.hh beam.hh boxes.hh break.hh clef.hh clefitem.hh\
-       colhpos.hh command.hh  complexcolumn.hh \
+hdr=   bar.hh barreg.hh beam.hh boxes.hh break.hh clefreg.hh clefitem.hh\
+       colhpos.hh  commandrequest.hh  complexcolumn.hh \
        complexwalker.hh complexstaff.hh\
        const.hh debug.hh dimen.hh directionalspanner.hh\
-       getcommand.hh glob.hh  grouping.hh headreg.hh idealspacing.hh\
-       identifier.hh identparent.hh inputcommand.hh inputcommands.hh\
+        glob.hh  grouping.hh headreg.hh idealspacing.hh\
+       identifier.hh identparent.hh \
        inputmusic.hh inputscore.hh inputstaff.hh item.hh key.hh keyitem.hh\
+       keyreg.hh\
        keyword.hh leastsquares.hh lexer.hh linespace.hh \
        localkeyitem.hh localkeyreg.hh lookup.hh \
        lyriccolumn.hh  lyricitem.hh lyricstaff.hh lyricwalker.hh\
-       main.hh  meter.hh misc.hh\
-       molecule.hh moment.hh notehead.hh notename.hh offset.hh paperdef.hh\
+       main.hh  meter.hh meterreg.hh misc.hh\
+       molecule.hh moment.hh musicalrequest.hh\
+       notehead.hh notename.hh offset.hh paperdef.hh\
        parseconstruct.hh pcol.hh proto.hh pscore.hh pstaff.hh qlp.hh\
-       qlpsolve.hh register.hh request.hh rest.hh \
+       qlpsolve.hh register.hh reqtodo.hh request.hh rest.hh \
        sccol.hh score.hh\
-       scoreline.hh script.hh scriptdef.hh scriptreg.hh \
+       scoreline.hh scorewalker.hh script.hh scriptdef.hh scriptreg.hh \
        slur.hh slurreg.hh source.hh sourcefile.hh\
-       spanner.hh staff.hh staffcommands.hh\
-       staffelem.hh staffline.hh staffsym.hh stembeamreg.hh\
+       spanner.hh staff.hh\
+       staffelem.hh staffeleminfo.hh staffline.hh staffsym.hh stembeamreg.hh\
        stcol.hh stem.hh staffwalker.hh symbol.hh symtable.hh\
        tex.hh textdef.hh \
        textitem.hh textreg.hh textspanner.hh timedescription.hh \
        tstream.hh voice.hh\
        voicegroup.hh
 
-mycc=bar.cc beam.cc boxes.cc break.cc calcideal.cc clef.cc\
-       clefitem.cc colhpos.cc command.cc\
-       complexstaff.cc complexwalker.cc \
-       complexprint.cc debug.cc dimen.cc\
+mycc=bar.cc barreg.cc beam.cc boxes.cc break.cc calcideal.cc clefreg.cc\
+       clefitem.cc colhpos.cc  commandrequest.cc\
+       complexcolumn.cc complexstaff.cc complexwalker.cc \
+       debug.cc dimen.cc\
        directionalspanner.cc\
-       getcommands.cc grouping.cc groupregs.cc headreg.cc\
+        grouping.cc groupregs.cc headreg.cc\
        idealspacing.cc identifier.cc\
-       inputcommand.cc inputcommands.cc inputmusic.cc inputscore.cc\
-       inputstaff.cc item.cc key.cc keyitem.cc keyword.cc\
+        inputmusic.cc inputscore.cc\
+       inputstaff.cc item.cc key.cc keyitem.cc \
+       keyreg.cc keyword.cc\
        leastsquares.cc lexerinit.cc linespace.cc \
        localkeyitem.cc localkeyreg.cc lookup.cc\
        lyriccolumn.cc lyricitem.cc lyricstaff.cc lyricwalker.cc\
-       main.cc  meter.cc\
+       main.cc  meter.cc meterreg.cc\
        misc.cc molecule.cc mylexer.cc note.cc notehead.cc  notename.cc\
        paperdef.cc pcol.cc pscore.cc pstaff.cc qlp.cc qlpsolve.cc\
        register.cc request.cc rest.cc  sccol.cc score.cc\
-       scoreline.cc scores.cc script.cc scriptdef.cc scriptreg.cc \
-        slur.cc\
+       scoreline.cc scores.cc scorewalker.cc script.cc\
+       scriptdef.cc scriptreg.cc slur.cc\
        slurreg.cc source.cc sourcefile.cc\
        spanner.cc staff.cc\
-       staffcommands.cc staffelem.cc staffline.cc staffsym.cc\
-       stembeamreg.cc\
-       stcol.cc stem.cc\
+       staffelem.cc staffline.cc staffsym.cc\
+       stembeamreg.cc stcol.cc stem.cc\
        staffwalker.cc symbol.cc symtable.cc  tex.cc texbeam.cc\
        texslur.cc textdef.cc textitem.cc textreg.cc textspanner.cc\
-       timedescription.cc tstream.cc voice.cc voiceregs.cc voicegroup.cc\
+       timedescription.cc tstream.cc voice.cc voiceelt.cc \
+       voiceregs.cc voicegroup.cc\
        warn.cc windhoos-suck-suck-suck-thank-you-cygnus.cc wordwrap.cc\
        template1.cc template2.cc template3.cc template4.cc\
        template5.cc template6.cc version.cc
 
 # a bit of a hack to keep exec size under control.
-stablecc=request.cc bar.cc boxes.cc break.cc  clef.cc getcommands.cc grouping.cc\
+stablecc=request.cc bar.cc boxes.cc break.cc  \
        item.cc keyword.cc leastsquares.cc \
-       linepstaff.cc linespace.cc lookup.cc molecule.cc meter.cc\
+        lookup.cc molecule.cc meter.cc\
        paperdef.cc parser.cc lexer.cc pstaff.cc qlp.cc qlpsolve.cc\
        template1.cc template2.cc template3.cc template4.cc\
        template5.cc template6.cc version.cc tstream.cc  tex.cc\
diff --git a/TODO b/TODO
index ab8df4498746cc5a1ed66dbc9ce0114dfd2caeed..1803ad21c3cfcf7efe328a0bb5e9c556716e05b6 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,12 +1,29 @@
+
+before 0.1
+
+       * martien.ly, standchen.ly
+
+       * pushgroup, popgroup.
+
+       * basic dynamics
+
+       * triplet notation
+
+       * midi output
+
+       * decent TeX page layout
+       
+       * < .. > vs. { .. }
+
 This is an assorted collection of stuff that will be done, might be
 done, or is an idea that I want to think about
 
 BUGS
-       * first clef isn't printed
-
        * key undo
 
-       * key print if 
+       * key print if clef change.
+
+       * $cis ( | ) cis$
 
 SEVERELY LACKING:
 
@@ -24,11 +41,15 @@ INPUTLANGUAGE
 
        * rest name configurable
 
+       * '*' vs. '/'
+
 SMALLISH PROJECTS
 
+       * bar numbers
+
        * read from mmap directly: study yy_scan_buffer
 
-       * binsearch for notenames
+       * binsearch/hash for notenames
 
        * stafftypes: voice names/ instrument names.
 
@@ -56,10 +77,9 @@ SMALLISH PROJECTS
 
        * fix linking: `Warning: size of symbol'
 
-BIGGISH PROJECT
+       * collision Request_register.
 
-       * merge musical & non-musical column. Scrap Commands in favour
-       of Requests, and do multiparallel meters
+       * LilyPond .rpm and .deb
 
 DOC
 
@@ -69,11 +89,13 @@ DOC
 
        * a decent webpage
 
+       * a test suite
+
 FUTURE
 
-       * warning: beam(): Beam too narrow: beam gen not per stem
+       * Register_container baseclass
 
-       * put scripts on barcommands 
+       * put scripts on bars
 
        * glissando
 
@@ -85,7 +107,7 @@ FUTURE
 
        * Implement all requests
 
-       * merge key{item} & localkey{item}
+       * merge key{item} & localkey{item}?
 
        * QLP for beams?
 
@@ -93,6 +115,10 @@ FUTURE
 
        * eentje/tweetje
 
+       * piano staff
+       
+       * abbreviations a4*8
+
 IDEAS
 
        * enter Requests directly
@@ -108,8 +134,6 @@ IDEAS
 
        * merge Atom and Symbol?
 
-       * merge Command/Input_command.
-       
        * merge common code of Item, Atom/Molecule
 
        * Spacing_request for manually adjusting spacing
@@ -125,4 +149,6 @@ IDEAS
 
        * PostScript output (esp. Beams, Slurs, etc)
 
-       * caching breakpoints\r
+       * caching breakpoints
+
+       * use exceptions?
\ No newline at end of file
index 6d2ad10580f5a1454dc34c7c8e4cf5cafb330f13..6c7566575700645ea021269d4032802236a91e21 100644 (file)
@@ -1,9 +1,9 @@
-# -*-make-*-
+# -*-Makefile-*-
 
 # version info
 MAJVER=0
 MINVER=0
-PATCHLEVEL=31
+PATCHLEVEL=32
 
 
 
@@ -66,12 +66,13 @@ include Sources.make
 gencc=parser.cc lexer.cc
 cc=$(mycc) $(gencc)
 
+MY_CCSOURCE=$(addprefix $(CCDIR)/, $(mycc))
 CCSOURCE=$(addprefix $(CCDIR)/, $(cc))
 obs=$(addprefix $(OBJECTDIR)/,$(cc:.cc=.o)) 
 ALLDEPS=$(addprefix $(DEPDIR)/,$(cc:.cc=.dep))
 STABLEOBS=$(addprefix $(OBJECTDIR)/,$(stablecc:.cc=.o)) 
 HEADERS=$(addprefix $(HEADERDIR)/,$(hdr)) 
-progdocs=$(HEADERS) #$(CCSOURCE)
+progdocs=$(HEADERS) $(MY_CCSOURCE)
 
 #dist
 .EXPORT_ALL_VARIABLES:
@@ -86,7 +87,7 @@ othersrc=lexer.l parser.y
 SCRIPTS=make_version make_patch genheader clearlily
 MAKFILES=Makefile Variables.make Sources.make Initial.make Generate.make \
        configure
-OFILES=COPYING README NEWS TODO
+OFILES=COPYING README NEWS TODO ANNOUNCE
 IFILES=  titledefs.tex lilyponddefs.tex \
        ltest.tex test.tex .dstreamrc dimen.tex 
 DFILES=$(MAKFILES) $(OFILES) $(IFILES) $(SCRIPTS)
@@ -107,6 +108,8 @@ SUBDIRS=Documentation $(OBJECTDIR) $(CCDIR) $(HEADERDIR) $(INITDIR) $(DEPDIR) \
 depfile=deps/$(subst .o,.dep,$(notdir $@)) 
 DODEP=rm -f $(depfile); DEPENDENCIES_OUTPUT="$(depfile) $(OBJECTDIR)/$(notdir $@)"
 
-STRIPDEBUG=true # replace to do stripping of certain objects
+STRIPDEBUG=true #replace to do stripping of certain objects
+LINKER=$(CXX)
+
 
 include Site.make
\ No newline at end of file
index 2857ad2aa4ee85a66ac059fb273620d179c6c171..b1b21e0631aad197b8d4c474442e2d618c92c956 100755 (executable)
--- a/configure
+++ b/configure
@@ -3,7 +3,7 @@
 PREFIX=${PREFIX:-.}
 echo using PREFIX=$PREFIX
 
-NEEDFLOWERVER=1.0.26
+NEEDFLOWERVER=1.0.27
 flowertar=flower-$NEEDFLOWERVER
 here=`pwd`
 cd ..
@@ -29,3 +29,4 @@ cd $here
 echo '#define LIBDIR "'$PREFIX'/"'> hdr/config.hh
 touch Site.make
 make -f Initial.make
+
index 9c692641150bde2f5e9c4bec672a6021d00d8db6..611691fae6eb11de9c30aa2085bf0586622781a2 100644 (file)
@@ -19,7 +19,6 @@ fversion.hh: Variables.make make_version
 
 .PHONY: docxx
 docxx: $(hh) $(cc) $(templatecc) $(inl)
-       -mkdir docxx
        doc++ -p -d docxx $(hh) $(cc) $(templatecc) $(inl)
 
 dist:
index 6f4fd129cd2aaaa005a5a48ef64726926e8c1dd4..b89a032048d24d2f41b51292bc67762d1eaa1c9f 100644 (file)
@@ -1,3 +1,6 @@
+pl 27
+       - (temporarily?) removed findcursor* t*mat*
+
 pl 26
        - docxx 3.0
 
index 1e4fb2bc02f7f4fad594abef5bff6cf73464fbf0..23d5164f0a9c99548e71cd1124229740f61390e1 100644 (file)
@@ -1,18 +1,13 @@
 
-cc=lgetopt.cc   string.cc dataf.cc textdb.cc unionfind.cc  \
-       smat.cc matrix.cc choleski.cc vector.cc dstream.cc\
-       matdebug.cc  scalar.cc path.cc
+cc=choleski.cc dataf.cc dstream.cc lgetopt.cc matdebug.cc matrix.cc\
+path.cc scalar.cc smat.cc string.cc textdb.cc unionfind.cc vector.cc
 
-templatecc=cursor.tcc list.tcc tsmat.tcc plist.tcc interval.tcc\
+templatecc=cursor.tcc list.tcc plist.tcc interval.tcc\
        pcursor.tcc
 
-inl=findcurs.inl link.inl list.inl  cursor.inl plist.inl
-hh=cursor.hh pcursor.hh lgetopt.hh link.hh list.hh dstream.hh \
-       string.hh stringutil.hh varray.hh textdb.hh textstr.hh  assoc.hh\
-       findcurs.hh unionfind.hh compare.hh handle.hh matrix.hh\
-       smat.hh vsmat.hh  vector.hh  real.hh choleski.hh\
-       tsmat.hh tvsmat.hh plist.hh associter.hh fproto.hh\
-       interval.hh scalar.hh rational.hh iterate.hh\
-       path.hh
-       
-
+inl=link.inl list.inl  cursor.inl plist.inl
+hh=assoc.hh associter.hh choleski.hh compare.hh cursor.hh dstream.hh\
+fproto.hh handle.hh interval.hh iterate.hh lgetopt.hh link.hh list.hh\
+matrix.hh path.hh pcursor.hh plist.hh rational.hh real.hh scalar.hh\
+smat.hh string.hh stringutil.hh textdb.hh textstr.hh unionfind.hh\
+varray.hh vector.hh vsmat.hh
index 0dc6c79705610f0195050e2c525070d88ce71c06..6d0cec88bde3e83fe959ec39984e9449af1bdc46 100644 (file)
@@ -1,6 +1,6 @@
 MAJVER=1
 MINVER=0
-PATCHLEVEL=26
+PATCHLEVEL=27
 
 PACKAGENAME=flower
 
index 154a0242a22749c3ec7494d432168cfad114b332..07afb8a27ce45499aa8d7c6d191cbdad7573fdf3 100644 (file)
@@ -11,8 +11,8 @@ struct Assoc_ent_ {
     V val;
 };
 
-/// hungarian: map
-/** mindblowingly stupid Associative array implementation
+
+/** mindblowingly stupid Associative array implementation.Hungarian: map
  */
 template<class K, class V>
 struct Assoc {
index 14cf5e2326d8f4bbdf2fae00faaa87d13921a70d..f5e9fb4f5a36be596f3b44f1d9cb0306c0e1f050 100644 (file)
@@ -4,7 +4,8 @@
 #include "matrix.hh"
 
 /**
-    structure for using the LU decomposition of a positive definite .
+  Choleski decomposition of a matrix
+    structure for using the LU decomposition of a positive definite matrix.
 
     #P# is split  into
 
@@ -17,22 +18,23 @@ struct Choleski_decomposition {
 
     /// diagonal 
     Vector D;
-    ///Create decomposition of P
-    /**
+
+    /** Create decomposition of P. 
     PRE
     P needs to be symmetric positive definite
     */
     
     Choleski_decomposition(Matrix P);
-    Vector solve(Vector rhs) const;
-        /**
+
+    /**
     solve Px = rhs
     */
-Vector operator * (Vector rhs) const { return solve (rhs); }
+    Vector solve(Vector rhs) const;
+
+    Vector operator * (Vector rhs) const { return solve (rhs); }
   /**
     return the inverse of the matrix P.
     */
-
     Matrix inverse() const;
     /**
     return P,  calc'ed from L and D
index 30a1998ad34671935bacd51d834abeb8e617c207..203ba014e7cb89fbed70b41355d498354c2624a6 100644 (file)
@@ -28,8 +28,7 @@ operator op(type t1, type t2)\
 #define gpp_minmax(type, prefix)
 #endif
 
-/// handy notations for a signed comparison
-/**
+/**  handy notations for a signed comparison. 
     make the operators{<,<=,==,>=,>} and the MAX and MIN of two.
     Please fill a & in the type argument if necessary.    
     */
index d8274d2493c422cfbb70f82fef6863a77794e6d8..0ea99037f9d4d8b48c2277c2fe81cdc492e570ea 100644 (file)
@@ -6,8 +6,7 @@
 #include "link.hh"
 template<class T> class List;
 
-/// iterator to List
-/** 
+/**  iterator to List.  
   add and insert extend the list
   items are always stored as copies in List, but:
   List<String> :  copies of String stored 
@@ -19,8 +18,8 @@ template<class T>
 class Cursor 
 {
  public:
-    /** this isn't true, actually, #list# surely isn't const, but I get
-      tired of the warning messages.  */
+    /** create cursor, set at top. The const part isn't true, actually, #list#
+      surely isn't const, but I get tired of the warning messages.  */
     Cursor( const List<T>& list, Link<T>* pointer = 0 );
     
     Cursor( const Cursor<T>& cursor );
@@ -56,8 +55,7 @@ class Cursor
     /// -- items left?
     bool backward();
 
-    /// put (copy) after me in List
-    /**
+    /**  put (copy) after me in List. 
       analogously to editor. ok() interpreted as at end
       of line.
 
@@ -70,8 +68,7 @@ class Cursor
       */
     void add( const T& thing );
 
-    /// put (copy) before me in List
-    /**
+    /**  put (copy) before me in List. 
       analogously to editor. ok() interpreted as at begin of
       line.
       
index e3c42ad45f24abd4133b8619c711c7ef2b7df7e5..29b366c8603f030c4115af6394d274231184df36 100644 (file)
@@ -78,8 +78,7 @@ Data_file::get_word()
     return s;        
 }
 
-/// get a char.
-/**
+/**  get a char 
    Only class member who uses text_file::get
    */
 char
index 0143eb05104fa4490c07d1e077b70cc46cafd52b..801b166774a00515cbdc577575070a3c1a90f953 100644 (file)
@@ -1,4 +1,3 @@
-// debug_stream
 
 #ifndef DSTREAM_HH
 #define DSTREAM_HH
@@ -10,8 +9,7 @@ const char eol= '\n';
 template<class K,class V>
 struct Assoc;
 
-/// debug stream
- /**
+/**  debug stream. 
    a class for providing debug output of nested structures,
    with indents according to \{\}()[].
 
@@ -38,7 +36,7 @@ public:
     bool silence(String);
     
     /**
-      if rcfile == 0, then do not read any rc file
+      if rcfile == 0, then do not read any rc file.
       */
       
     Dstream(ostream *r, const char  * rcfile);
diff --git a/flower/findcurs.hh b/flower/findcurs.hh
deleted file mode 100644 (file)
index e46b64d..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-template<class T, class U>
-class FindCursor : public Cursor<T>
-{
-public:
-    FindCursor( List<T>& list, Link<T>* pointer = 0 );
-    FindCursor( const Cursor<T>& cursor );
-    
-    Cursor<T> operator =( const Cursor<T>& c );
-    FindCursor<T, U> find( const T& thing );
-};
-
-#include "findcurs.inl"
diff --git a/flower/findcurs.inl b/flower/findcurs.inl
deleted file mode 100644 (file)
index 593d4aa..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-template<class T, class U>
-inline
-FindCursor<T, U>::FindCursor( List<T>& list, Link<T>* pointer ) : 
-    Cursor<T>( list, pointer )
-{
-}
-
-template<class T, class U>
-inline
-FindCursor<T, U>::FindCursor( const Cursor<T>& cursor ) :
-    Cursor<T>( cursor )
-{
-}
-
-template<class T, class U>
-Cursor<T>
-FindCursor<T, U>::operator =( const Cursor<T>& c )
-{   
-    ( (Cursor<T>&)*this ) = c;
-    return *this;
-}
-
-template<class T, class U>
-inline FindCursor<T, U>
-FindCursor<T, U>::find( const T& thing )
-{
-    Cursor<T> c( *this );
-    while( c.forward() )
-       {
-       T& look = *c;
-       if ( U::equal( look, thing ) )
-           return c;
-       c++;
-       }
-
-    return FindCursor( *this ); // cursor is not .ok()
-}
index 921dc6031c4a1d77e7f55dc15da3f3cdd89c894b..63c17ef1d2eec8e58d7f8814a17afbd86c0a7a9b 100644 (file)
@@ -1,5 +1,6 @@
 #ifndef HANDLE_HH
 #define HANDLE_HH
+
 /// reference counting handle
 template<class T>
 class Handle {
index 9cff84fb3cc65d01d3377cd87840bd77a86dcde9..aae16381dbef62ed5133b332d49714d8260b5070 100644 (file)
@@ -12,8 +12,7 @@
 #include "real.hh"
 
 
-/// a T interval
-/**
+/**  a T interval. 
   this represents the closed interval [left,right].
   No invariants. T must be a totally ordered ring
   */
@@ -73,16 +72,16 @@ struct Interval_t {
     bool elt_q(T r);
 };
 
-/// partial ordering
-template<class T>
-int Interval__compare(const Interval_t<T>&,Interval_t<T> const&);
+
 /**
   inclusion ordering. Crash if not comparable.
   */
+template<class T>
+int Interval__compare(const Interval_t<T>&,Interval_t<T> const&);
 
-/****************************************************************
+/*
   INLINE
- ****************************************************************/
+ */
 
 #include "compare.hh"
 
index 33dbb16a4cc732b1ae0901e4072d305eaab04728..1e924f0790d6ac8bdc55a64ff693f9272fcfeb72 100644 (file)
@@ -1,3 +1,16 @@
+/*
+  iterate.hh -- define some list macros
+
+  source file of the flowerlib
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef ITERATE_HH
+#define ITERATE_HH
+
+
 
 #define iterator(set)          typeof((set).top())
 #define iterator_bot(set)              typeof((set).bottom())
@@ -6,3 +19,4 @@
 #define iter_top(set,var)      iterator(set) var(set)
 #define iter_bot(set,var)      iterator(set) var(set.bottom())
 
+#endif // ITERATE_HH
index 67deb700bc703fd24e17ed14849ee75d2c3c08ba..31fb2c55ebe609b4d9e778f45b417f450577d83f 100644 (file)
@@ -15,9 +15,9 @@ struct long_option_init {
 };
 
 
-///  C++ for version of long_getopt.
-/** For processing GNU style command line arguments.  No pointer
-  (return values, arguments) contents are copied.  */
+/** C++ for version of long_getopt.  For processing GNU style command
+  line arguments.  No pointer (return values, arguments) contents are
+  copied.  */
 class Getopt_long {
 public:
     /** errorcodes: no error, argument expected, no argument expected,
@@ -48,8 +48,7 @@ private:
     /// report an error and abort
     void report(Errorcod c);
 public:
-    /// what to do with  errors
-    /**
+    /**  what to do with  errors. 
        report messages on  #*os#, and abort.
        if #os# is null, then do not report nor abort, just set #error#
       */
@@ -73,8 +72,7 @@ public:
     /// construct: pass arguments and option info.
     Getopt_long(int c,  char **v, long_option_init *lo);
 
-    /// get the next option
-    /**
+    /**  get the next option. 
       @return pointer to next option found.
       0 if error occurred, or next argument is no option.
       */
index 4f3c1aa825e4b8c8976a8540ca9b855b9a633488..ec59fbff07447b4710ccb8e529748a227951a43d 100644 (file)
@@ -5,9 +5,8 @@ class ostream;
 template<class T> class Cursor;
 template<class T> class Link;
 
-/// all-purpose doubly linked list
-/**
-  a doubly linked list; 
+/**  all-purpose doubly linked list. 
+
   List can be seen as all items written down on paper,
   from top to bottom
 
@@ -39,7 +38,7 @@ class List
        
     int size() const;
 
-    Cursor<T> bottom() const;  // const sucks..
+    Cursor<T> bottom() const;  // const sucks.
     Cursor<T> top() const;
 
     void OK() const;           // check list
@@ -50,8 +49,7 @@ class List
 
     void concatenate(List<T> const &s);
     
-    /// make *this empty
-     /**
+    /**  make *this empty. 
 
       POST:
       size == 0
@@ -61,12 +59,12 @@ class List
       */
      void set_empty();
   
-    /// add after after_me
     void add( const T& thing, Cursor<T> &after_me );
 
     /// put thing before #before_me#
     void insert( const T& thing, Cursor<T> &before_me );
-     /** Remove link pointed to by me. Destructor of contents called
+
+    /** Remove link pointed to by me. Destructor of contents called
       (nop for pointers)
 
       POST
index 37ded81bbe83ae82ccc762823613dca7726ed3be..16e12a31f1f8645c0a7f9af7ece4af2f26cc0f72 100644 (file)
@@ -43,6 +43,18 @@ List<T>::~List()
        c.del();
 }
 
+/** 
+
+  add after after_me.
+
+  Procedure:
+  \begin{itemize}
+  \item if #after_me# is #ok()#, add after #after_me#, else
+  \item if list !empty simply add to bottom, else
+  \item list is empty: create first \Ref{Link} and initialize 
+  #bottom_# and #top_#.
+  \end{itemize}
+*/
 template<class T>
 void
 List<T>::add( const T& thing, Cursor<T> &after_me )
@@ -62,16 +74,6 @@ List<T>::add( const T& thing, Cursor<T> &after_me )
 
     size_++;
 }
-/** 
-
-  Procedure:
-  \begin{itemize}
-  \item if #after_me# is #ok()#, add after #after_me#, else
-  \item if list !empty simply add to bottom, else
-  \item list is empty: create first \Ref{Link} and initialize 
-  #bottom_# and #top_#.
-  \end{itemize}
-*/
 
 template<class T>
 void
index 73a9f0487e5a221e7207705a082001409417d71e..a633d6657a853946fed30b2f42e1c1e36b71c2f2 100644 (file)
@@ -5,8 +5,7 @@
 #include "vsmat.hh"
 #include "vector.hh"
 
-/// a Real matrix
-/** This is a class for a nonsquare block of #Real#s.  The
+/**  a Real matrix.  This is a class for a nonsquare block of #Real#s.  The
     implementation of sparse matrices is done in the appropriate #smat#
     class. Matrix only does the mathematical actions (adding,
     multiplying, etc.)
@@ -24,9 +23,8 @@ public:
     int cols() const { return dat->cols(); }
     int rows() const { return dat->rows(); }
 
-    /// return the size of a matrix
-    /**
-      @pre
+    /**  return the size of a matrix. 
+      PRE
       the matrix needs to be square.
     */
     int dim() const;
@@ -49,8 +47,7 @@ public:
     void operator*=(Real a);
     void operator/=(Real a) { (*this) *= 1/a; }
     
-    /// add a row
-    /**
+    /**  add a row. 
       add a row to the matrix before  row k
 
       PRE
@@ -58,8 +55,7 @@ public:
       0 <= k <= rows()
     */
     void insert_row(Vector v,int k);
-    ///
-    /**
+    /** . 
       delete a row from this matrix.
 
       PRE
@@ -107,15 +103,13 @@ public:
     Matrix transposed() const ;
 
     Real norm() const;
-    /// swap
-    /**
+    /**  swap. 
       PRE
       0 <= c1,c2 < cols()
     */
     void swap_columns(int c1, int c2);
 
-    /// swap
-    /**
+    /**  swap. 
       PRE
       0 <= c1,c2 < rows()
     */
index 2737d1cd154173d19d293971d493af9d0bb75f07..3dc38366f26405fa583c5def9d921f6dca61e27d 100644 (file)
@@ -9,8 +9,8 @@
 #endif
 
 /**
-   INPUT: path the original full filename
-   OUTPUT: 4 components of the path. They can be empty
+   @param path the original full filename
+   @return 4 components of the path. They can be empty
 */
 void
 split_path(String path, 
@@ -56,8 +56,7 @@ File_path::File_path(String pref)
 }
 
 
-///find a file
-/**
+/** find a file. 
   It will search in the current dir, in the construction-arg, and
   in any other added path, in this order.
   */
index 4a36730dcd34b840aa1aeffb2879db1af9a280d5..bc4d9f3776c58abde644f69a0ebea7ab9cbe342c 100644 (file)
@@ -4,8 +4,7 @@
 #include "varray.hh"
 
 
-///   searching directory for file.
-/**
+/**    searching directory for file.
 
    Abstraction of PATH variable. An interface for searching input files.
    Search a number of dirs for a file.
index 8498aa9e0d38bd52b132cdad61662339dfa2dd32..1215270e3b6b02338ed0db07dc119dfe0aa52f51 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
   pcursor.hh -- part of flowerlib
 
@@ -8,15 +7,16 @@
 #ifndef PCURSOR_HH
 #define PCURSOR_HH
 
+#include "plist.hh"
+#include "cursor.hh"
 
-/// cursor to go with PointerList
-/**
+/**  cursor to go with PointerList. 
   don't create PointerList<void*>'s.
   This cursor is just an interface class for Cursor. It takes care of the
   appropriate type casts
  */
 template<class T>
-struct PCursor : private Cursor<void *> {
+class PCursor : private Cursor<void *> {
     friend class IPointerList<T>;
 
     /// delete contents
@@ -45,7 +45,7 @@ public:
     PCursor<T> operator +( int no) const {return Cursor<void*>::operator+(no);}    PCursor(const PointerList<T> & l) : Cursor<void*> (l) {}
 
     PCursor( const Cursor<void*>& cursor ) : Cursor<void*>(cursor) { }
-    void* vptr() const { return  * ((Cursor<void*> &) *this); }
+    void* vptr() const { return *((Cursor<void*> &) *this); }
 
     // should return T& ?
     T ptr() const { return (T) vptr(); }
index 61b51d97e3cfc81986bb8bd3ff5b1a062e46747d..426b861c024f079364f3c5d5d68ee7a9f0eb79dc 100644 (file)
@@ -9,12 +9,15 @@
 
 #include "list.hh"
 
-/// Use for list of pointers, e.g. PointerList<AbstractType*>.
 /**
+  A list of pointers.
+  
+  Use for list of pointers, e.g. PointerList<AbstractType*>. 
   This class does no deletion of the pointers, but it knows how to
   copy itself (shallow copy). We could have derived it from List<T>,
   but this design saves a lot of code dup; for all PointerLists in the
-  program only one parent List<void*> is instantiated.  */
+  program only one parent List<void*> is instantiated.
+  */
 template<class T>
 class PointerList : public List<void *>
 {
@@ -30,8 +33,7 @@ class PointerList : public List<void *>
     PointerList() {}
 };
 
-///  pl. which deletes pointers given to it.
-/**
+/**   PointerList which deletes pointers given to it. 
   NOTE:
   
   The copy constructor doesn't do what you'd want:
@@ -43,7 +45,8 @@ class PointerList : public List<void *>
   
   */
 template<class T>
-struct IPointerList : public PointerList<T> {
+class IPointerList : public PointerList<T> {
+public:
     IPointerList(const IPointerList&) { set_empty(); }
     IPointerList() { }
     ~IPointerList();
index 0213a92f0d9013df8116769c2499da8c348ce9f5..5cdfa427da053134f4db86358991558226611a63 100644 (file)
@@ -23,8 +23,8 @@ struct Scalar : public String {
     bool isnum();
     operator Real();
     operator int();
-    ///
-    /** perl -like string to bool conversion
+
+    /**   perl -like string to bool conversion.
      */
     operator bool() const;
 
index eb5822cf32685e8bbce079668c472ff68cde7d47..9c7f2d0801e0ce350ed776eae5385bb5e0ec223e 100644 (file)
@@ -1,11 +1,12 @@
-/****************************************************************************
+/*
   PROJECT: FlowerSoft C++ library
   FILE   : string.cc
 
   Rehacked by HWN 3/nov/95
   removed String &
   introduced Class String_handle
---*/
+
+*/
 
 #include <string.h>
 #include <stdlib.h>
index e58f6146997405e7471a6e24316909e100c089c3..420d5f959d85491096ad798696d3e034cd4bd5e8 100644 (file)
@@ -19,8 +19,7 @@
 
 #include "stringutil.hh"
 
-/// the smart string class.
-/** 
+/**  the smart string class.  
 
   Intuitive string class. provides 
 
@@ -50,8 +49,7 @@ protected:
     String_handle data; // should derive String from String_handle?
 
 public:
-    /// init to ""
-    /** needed because other constructors are provided.*/
+    /**  init to "".  needed because other constructors are provided.*/
     String() {  }                  
     String(Rational);
     /// String s = "abc";
@@ -118,8 +116,7 @@ public:
     /// index of rightmost element of string 
     int lastPos( const char* string ) const;
 
-    /// index of leftmost c
-    /**
+    /**  index of leftmost c. 
     RETURN:
     0 if not found, else index + 1
     */
index 6a7feb126ab44e17e985cae8672944f521759d1b..2f62caee3d73564cd41bdaf0863680071b897243 100644 (file)
@@ -9,8 +9,7 @@
 const INITIALMAX=8;
 class String_handle;
 
-/// Internal String struct
-/**
+/**  Internal String struct. 
    the data itself. Handles simple tasks (resizing, resetting)
    */
 
@@ -145,8 +144,8 @@ friend class String_handle;
        length = j;
     }
 
-    /** not really safe. Can alter length without StringData knowing it.
-      */
+    /** access a char. not really safe. Can alter length without
+      *StringData knowing it. */
     char &operator [](int j) {
        assert(j >= 0 && j <= length);
        return string[j] ; 
@@ -160,8 +159,7 @@ friend class String_handle;
 
 
 
-/// ref. counting for strings
-/**
+/**  ref. counting for strings. 
    handles ref. counting, and provides a very thin
    interface using char *
  */
index cdc889853936e6b3cec33ef29e4cc33f02bd9da1..3586c0d180628fd611e3f99ef4a02e22592afa33 100644 (file)
@@ -3,8 +3,8 @@
 
 #include "textstr.hh"
 
-/** do "#" comments, read quote enclosed  fields */
-/// a "const" Array. Contents can't be changed.
+/**a "const" Array. Contents can't be changed. do "#" comments, read quote enclosed  fields */
+
 class Text_record : Array<String>  
 {
     int line_no;
@@ -27,10 +27,10 @@ public:
     Array<String>::size;           
 };
 
-/**
+/** abstraction for a datafile.
     add a subrec/fieldsep/record separator
     */
-/// abstraction for a datafile
+
 class Text_db : private Data_file
 {
     void gobble_leading_white();
index 489682effdee2969795d929d479ce56f74b32c06..2d648d4c19accf760b921d6e634466cd59621890 100644 (file)
@@ -7,8 +7,7 @@
 #include "string.hh"
 #include "varray.hh"
 
-/// line counting input stream.
-/**
+/**  line counting input stream. 
  a stream for textfiles. linecounting. Thin interface getchar and
  ungetchar.  (ungetc is unlimited) 
 
diff --git a/flower/tsmat.hh b/flower/tsmat.hh
deleted file mode 100644 (file)
index e8dac44..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-#ifndef SMAT_HH
-#define SMAT_HH
-#include "varray.hh"
-#include "vsmat.hh"
-
-/// simplest matrix storage. refer to its baseclass for the doco.
-template<class T>
-class Full_storage : public virtual_smat<T>
-{
-    /// height, width
-    int h,w;
-    /// maxima.
-    int maxh, maxw;
-    
-    /// the storage
-    T** els;
-    void
-    init() {
-       els=0;
-       h=w=maxh=maxw=0;
-
-    }
-    
-    bool valid(int i, int j) const {
-       return (i>=0 && i < h)
-           && (j < w && j >=0);
-    }
-    
-
-    void resize_rows(int);
-    void resize_cols(int);
-
-public:
-    virtual int rows() const {
-       return h;
-    }
-    virtual int cols() const {
-       return w;
-    }
-    
-    
-    virtual void set_size(int i, int j)
-    {
-       resize(i,j); //this could be more efficient.
-    }
-    
-    virtual void set_size(int i) {
-       set_size(i,i);
-    }
-    virtual void resize(int i, int j);
-    virtual void resize(int i) {
-       resize(i,i);
-    }
-    
-    virtual T& elem(int i,int j) {
-       assert(valid(i,j));
-       return els[i][j];
-    }
-    virtual const T& elem(int i, int j) const {
-       assert(valid(i,j));
-       return els[i][j];
-    }
-    virtual Array<T> row(int i) const;
-    virtual Array<T> column(int j) const;
-
-    Full_storage() {
-       init();
-    }
-    Full_storage(int i, int j) {
-       init();
-       set_size(i,j);
-    }
-    Full_storage(int i) {
-       init();
-       set_size(i);
-    }
-    void OK() const;
-    void operator=(Full_storage const &);
-    
-    virtual void insert_row(int k);
-    virtual void delete_row(int k);
-
-    
-    ~Full_storage();
-    virtual bool mult_ok(int i, int j)const;
-    virtual void mult_next(int &i, int &j) const ;
-    virtual bool trans_ok(int i, int j) const;
-    virtual void trans_next(int &i, int &j) const;
-
-};
-
-#endif
diff --git a/flower/tsmat.tcc b/flower/tsmat.tcc
deleted file mode 100644 (file)
index 0e5407a..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-#include "smat.hh"
-
-template<class T>
-void
-Full_storage<T>::operator=(Full_storage const &fs)
-{
-    resize(fs.h, fs.w);
-    for (int i=0; i<h; i++)
-       for (int j=0; i<w; j++)
-           els[i][j]= fs.els[i][j];
-}
-
-template<class T>
-void
-Full_storage<T>::OK() const
-{
-    assert(maxh >= h && maxw >= w);
-    assert(h >= 0 && w >= 0);
-}
-template<class T>
-void
-Full_storage<T>::resize_cols(int newh)
-{
-    if (newh <= maxh) {
-       h=newh;
-       return;
-    }
-   
-    T** newa=new T*[newh];
-    int j=0;
-    for (; j < h; j++)
-       newa[j] = els[j];
-    for (; j < newh; j++)
-       newa[j] = new T[w];
-    delete[] els;
-    els=newa;
-    maxh = newh;
-}
-
-template<class T>
-void
-Full_storage<T>::resize_rows(int neww)
-{
-    if (neww <= maxw) {
-       w=neww;
-       return;
-    }
-    for (int i=0; i < h ; i++) {
-       T* newa=new T[neww];
-       for (int k=0; k < w; k++)
-           newa[k] = els[i][k];
-
-       delete[] els[i];
-       els[i] = newa;
-       maxw = neww;
-    }
-}
-
-template<class T>
-Full_storage<T>::~Full_storage() {
-    for (int i=0; i < maxh; i++)
-       delete [] els[i];
-    delete[] els;
-}
-
-template<class T>
-void
-Full_storage<T>::resize(int i, int j)
-{
-    resize_cols(i);
-    resize_rows(j);
-}
-
-template<class T>
-void
-Full_storage<T>::set_size(int i, int j)
-{    
-    resize(i,j)
-}
-
-template<class T>
-bool
-Full_storage<T>::mult_ok(int i, int j) const
-{
-    return valid(i,j);
-}
-
-template<class T>
-bool
-Full_storage<T>::trans_ok(int i, int j) const
-{
-       return valid(i,j);
-} 
-
-
-template<class T>
-void
-Full_storage<T>::trans_next(int &i, int &j) const
-{
-    assert(trans_ok(i,j));
-    i++;
-    if (i >= h) {
-       i=0;
-       j ++;
-    }
-}
-
-template<class T>
-void
-Full_storage<T>::mult_next(int &i, int &j) const
-{
-    assert(mult_ok(i,j));
-    j++;
-    if (j >= w) {
-       j=0;
-       i++;
-    }
-}
-
-template<class T>
-void
-Full_storage<T>::delete_row(int k)
-{
-    assert(0 <= k <h);
-    for (int i=h-1; i > k ; i++)
-       for (int j=0; j < w; j++)
-           els[i-1][j]=els[i][j];
-}
-
-template<class T>
-void
-Full_storage<T>::insert_row(int k)
-{
-    assert(0 <= k <=h);
-    resize_cols(h+1);
-    for (int i=h-1; i > k ; i++)
-       for (int j=0; j <w; j++)
-           els[i][j]=els[i-1][j];
-}
-
-/****************************************************************/
-
-template<class T>
-virtual_smat<T> *
-virtual_smat<T>::get_full(int n, int m)
-{
-    return new Full_storage<T>(n,m);
-}
-#include "real.hh"
-
-template Full_storage<Real>;
diff --git a/flower/tvsmat.hh b/flower/tvsmat.hh
deleted file mode 100644 (file)
index 847c650..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-#ifndef VSMAT_HH
-#define VSMAT_HH
-#include "varray.hh"
-
-/// a  matrix storage baseclass.
-/** base class for interface with matrix storageclasses.  There are no
-    iterators for matrixclasses, since matrices are (like arrays)
-    explicitly int-indexed.
-
-    Iteration is provided by *_next, *_ok, which update and check both
-    index variables simultaneously.
-
-    TODO
-    determine type of product matrix.
-
-*/
-class virtual_smat {
-    
-
-public:
-    /// check invariants
-    virtual void OK() const=0;
-    
-    /// height of matrix
-    virtual int rows() const = 0;
-
-    /// width of matrix
-    virtual int cols() const = 0;
-    
-    /// set the size. contents lost
-    /**      
-      PRE
-      i >=0, j>=0
-    */
-    virtual void set_size(int i, int j) = 0;
-    
-    /// set the size to square dimen. contents lost
-    virtual void set_size(int i) = 0;
-    /**
-      PRE
-      i>=0
-    */
-    /// set the size to i,j 
-    /**
-
-      keep contents. If enlarged contents unspecified
-        
-      PRE
-      i>=0, j>=0
-    
-    */
-    virtual void resize(int i, int j) = 0;
-
-    /// set the size to square dimen. contents kept
-    /**    
-    Keep contents. If enlarged contents are unspecified
-    
-    PRE
-    i>=0  
-    */
-    virtual void resize(int i) = 0;
-    
-    /// access an element
-    /**
-    access an element.
-
-    Generate an errormessage, if this happens
-    in the 0-part of a sparse matrix.
-    */
-
-    virtual Real& elem(int i,int j) = 0;
-    /// access a element, no modify
-    virtual const Real& elem(int i, int j) const = 0;
-
-#if 1
-    virtual Array<Real> row(int i) const = 0;
-    virtual Array<Real> column(int j) const = 0;
-#endif
-
-    /// add a row
-    /**
-    add a row to the matrix before  row k. Contents
-    of added row are unspecified
-
-      0 <= k <= rows()
-    */
-  virtual void insert_row(int k)=0;
-  
-    /// delete a row 
-          /**
-      delete a row from this matrix.
-
-      PRE
-      0 <= k < rows();
-    */virtual void delete_row(int k)=0;
-
-    virtual ~virtual_smat() { }
-    virtual virtual_smat *clone()=0;
-
-
-    /// is there a next?
-      /**
-      at end of matrix? when doing loop
-
-      for(i=0; i<h; i++)
-        for(j=0; j<w; j++)
-          ...
-
-    */ virtual bool mult_ok(int i, int j) const=0;
-    /// iterate
-       /**
-      walk through matrix (regular multiply)
-      get next j for row i, or get next row i and reset j.
-      this will make sparse matrix implementation easy.
-    
-      PRE
-      mult_ok(i,j)
-     */virtual void mult_next(int &i, int &j) const  = 0;
-  /**
-      valid matrix entry. return false if at end of row
-    */
-    virtual bool trans_ok(int i, int j) const=0;
-   
-    /**
-      walk through matrix (transposed multiply).
-      Get next i (for column j)
-    
-      PRE
-      ver_ok(i,j)
-     */
-    virtual void trans_next(int &i, int &j) const  = 0;
-
-    /// generate a "Full_storage" matrix    
-    virtual_smat<Real> *get_full(int n, int m);
-
-};
-    
-
-#endif
index 523321ff5f9774046a0aa61682225c3527c749de..fbaa51e7318f57e186962f209d48cc918eacf656 100644 (file)
@@ -2,7 +2,16 @@
 #define UNIONFIND_HH
 #include "varray.hh"
 
-/// which points of a graph are connected?
+/*
+    which points of a graph are connected?.
+    Union find, a standard algorithm:
+
+    Union_find represents an undirected graph of N points. You can
+    connect two points using #connect()#. #find(i)# finds a uniquely
+    determined representant of the equivalence class of points
+    connected to #i#.
+    
+    */
 struct Union_find {    
     void connect(int i, int j);
     int find(int i);
@@ -13,13 +22,4 @@ private:
     Array<int> classes;
 
 };
-/*
-    Union find, a standard algorithm:
-
-    Union_find represents an undirected graph of N points. You can
-    connect two points using #connect()#. #find(i)# finds a uniquely
-    determined representant of the equivalence class of points
-    connected to #i#.
-    
-    */
 #endif
index 0daafb84f817721c4d7cd198ba0f31741afaceb0..d2c2f5532191e48dcaf41f340fb6145457a207ef 100644 (file)
@@ -15,9 +15,9 @@ inline void arrcpy(T*dest, T*src, int count) {
        *dest++ = *src++;
 }
 
-///scaleable array/stack template, for T with def ctor.
-/**
 
+/**
+  scaleable array/stack template, for T with def ctor.
   This template implements a scaleable vector. With (or without) range
   checking. It may be flaky for objects with complicated con- and
   destructors. The type T should have a default constructor. It is
@@ -52,8 +52,9 @@ public:
        assert(max >= size_ && size_ >=0);
        if (max) assert(thearray);
     }
-    /// report the size_. See {setsize_}
-
+    /** report the size_.
+      @see {setsize_}
+      */
     int size() const  { return size_; }
     
     /// POST: size() == 0
@@ -61,13 +62,14 @@ public:
 
     Array() { thearray = 0; max =0; size_ =0; }
 
-    /// set the size_ to #s#
+
+    /** set the size_ to #s#.
+      POST: size() == s.
+    Warning: contents are unspecified */
     void set_size(int s) {
        if (s >= max) remax(s);
        size_ = s;    
     }
-    /** POST: size() == s.
-    Warning: contents are unspecified */
     
     ~Array() { delete[] thearray; }
 
index 266254dbb82834be54cf56da1d6ebd73b0a196eb..4d91397cc6c710d0a34118710a86c4d514aba725 100644 (file)
@@ -9,8 +9,7 @@ class Dstream;
 class String;
 void set_matrix_debug(Dstream&ds);
 
-/// a row of numbers
-/**
+/**  a row of numbers. 
     a vector. Storage is handled in Array, Vector only does the mathematics.
  */
 class Vector  {
index 8765cbfe9491aa3e3926ddb8cf2a29ebe7bab29d..283b1e567b524375a4d17926475cd93229aa9bf7 100644 (file)
@@ -2,7 +2,17 @@
 #define VSMAT_HH
 #include "varray.hh"
 #include "real.hh"
-/// a  matrix storage baseclass.
+/** base class for interface with matrix storageclasses.  There are no
+    iterators for matrixclasses, since matrices are (like arrays)
+    explicitly int-indexed.
+
+    Iteration is provided by *_next, *_ok, which update and check both
+    index variables simultaneously.
+
+    TODO
+    determine type of product matrix.
+
+*/
 class virtual_smat {
     
 
@@ -15,23 +25,20 @@ public:
 
     /// width of matrix
     virtual int cols() const = 0;
-    
-    /// set the size. contents lost
-    /**      
+      
+    /**  set the size. contents lost.       
       PRE
       i >=0, j>=0
     */
-    
     virtual void set_size(int i, int j) = 0;
-    /// set the size to square dimen. contents lost
-    virtual void set_size(int i) = 0;
-    /**
+    /**set the size to square dimen. contents lost
       PRE
       i>=0
     */
-    /// set the size to i
-    virtual void resize(int i, int j) = 0;
-    /**
+    virtual void set_size(int i) = 0;
+     /**set the size to i.
 
       keep contents. If enlarged contents unspecified
         
@@ -39,25 +46,27 @@ public:
       i>=0, j>=0
     
     */
-
-    /// set the size to square dimen. contents kept
-    virtual void resize(int i) = 0;
-    /**    
+    virtual void resize(int i, int j) = 0;
+  /**    
+    set the size to square dimen. contents kept
     Keep contents. If enlarged contents are unspecified
     
     PRE
     i>=0  
     */
+    virtual void resize(int i) = 0;
+  
     
-    /// access an element
-    virtual Real& elem(int i,int j) = 0;
-    /**
+        /**
     access an element.
 
     Generate an errormessage, if this happens
     in the 0-part of a sparse matrix.
     */
 
+    virtual Real& elem(int i,int j) = 0;
+
     /// access a element, no modify
     virtual const Real& elem(int i, int j) const = 0;
 
@@ -66,53 +75,54 @@ public:
     virtual Array<Real> column(int j) const = 0;
 #endif
 
-    /// add a row
-    virtual void insert_row(int k)=0;
+    
     /**
     add a row to the matrix before  row k. Contents
     of added row are unspecified
 
       0 <= k <= rows()
     */
+    virtual void insert_row(int k)=0;
 
-    /// delete a row 
-    virtual void delete_row(int k)=0;
+    
       /**
       delete a row from this matrix.
 
       PRE
       0 <= k < rows();
     */
+    virtual void delete_row(int k)=0;
         virtual void delete_column(int k)=0;
     virtual ~virtual_smat() { }
     virtual virtual_smat *clone()=0;
 
 
-    /// is there a next?
-    virtual bool mult_ok(int i, int j) const=0;
+    
     /**
-      at end of matrix? when doing loop
+      at end of matrix?. when doing loop
 
       for(i=0; i<h; i++)
         for(j=0; j<w; j++)
-          ...
+          ..
 
     */
-    /// iterate
-    virtual void mult_next(int &i, int &j) const  = 0;
+    virtual bool mult_ok(int i, int j) const=0;
+
     /**
-      walk through matrix (regular multiply)
+      walk through matrix (regular multiply).
       get next j for row i, or get next row i and reset j.
       this will make sparse matrix implementation easy.
     
       PRE
       mult_ok(i,j)
      */
-    virtual bool trans_ok(int i, int j) const=0;
-    /**
+    virtual void mult_next(int &i, int &j) const  = 0;
+
+/**
       valid matrix entry. return false if at end of row
     */
-    virtual void trans_next(int &i, int &j) const  = 0;
+    virtual bool trans_ok(int i, int j) const=0;
+
     /**
       walk through matrix (transposed multiply).
       Get next i (for column j)
@@ -121,21 +131,11 @@ public:
       ver_ok(i,j)
      */
 
+    virtual void trans_next(int &i, int &j) const  = 0;
     /// generate a "Full_storage" matrix    
     static virtual_smat *get_full(int n, int m);
 
 };
     
-/** base class for interface with matrix storageclasses.  There are no
-    iterators for matrixclasses, since matrices are (like arrays)
-    explicitly int-indexed.
-
-    Iteration is provided by *_next, *_ok, which update and check both
-    index variables simultaneously.
-
-    TODO
-    determine type of product matrix.
-
-*/
 
 #endif
index a6cd8d4d048e7a799ee329cc40e553dd5b376ac2..e83a7681c6654b6dc15ec7322077b1f728b87699 100644 (file)
@@ -9,11 +9,11 @@
 #include "item.hh"
 
 struct Bar: Item {
-    const char * name() const;
     String type;
     
     Bar(String type);
-
+    const char * name() const;
+    void do_print() const;
     Molecule*brew_molecule_p()const;
 };
 #endif // BAR_HH
diff --git a/hdr/barreg.hh b/hdr/barreg.hh
new file mode 100644 (file)
index 0000000..0b99ec0
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+  barreg.hh -- declare Bar_register
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef BARREG_HH
+#define BARREG_HH
+#include "register.hh"
+
+/**
+  generate bars. Either user ("|:"), or default (new measure)
+  */
+class Bar_register : public Request_register {
+    void split_bar(Bar *& pre, Bar * no, Bar * &post);
+public:
+    Bar_req * bar_req_l_;
+    Bar * bar_p_;
+    virtual bool try_request(Request *req_l);
+    virtual void process_request();
+    virtual void do_pre_move_process();
+    virtual void do_post_move_process();
+    Bar_register(Complex_walker*);
+};
+
+#endif // BARREG_HH
index 68f5087f459c884a16443657b78afee8cc469dcd..eb8020c53ade4b5e4453b29c59d8504f48ae73f1 100644 (file)
 #include "plist.hh"
 
 /** a beam connects multiple stems Beam adjusts the stems its owns to
-make sure that they reach the beam and that point in the correct
-direction */
+  make sure that they reach the beam and that point in the correct
+  direction */
 struct Beam:  public Directional_spanner {
     PointerList<Stem*> stems;
+    /// the slope of the beam in posns / point (dimension)   
     Real slope;
+
+    /// position of leftmost end of beam  
     Real left_pos;
    
 
index d817dc42e89d3c634922e79b4d8145553b470eca..22a2eec3a5f29ee524cd192aaee3e5277ac1f177 100644 (file)
@@ -9,14 +9,16 @@
 #include "real.hh"
 #include "interval.hh"
 #include "offset.hh"
+
 /// a square subset of Real^2
 struct Box {
     Interval x, y;
-    
+
     void translate(Offset o) {
        x.translate(o.x);
        y.translate(o.y);
     }
+    /// smallest box enclosing #b#
     void unite(Box b) {
        x.unite(b.x);
        y.unite(b.y);
diff --git a/hdr/clef.hh b/hdr/clef.hh
deleted file mode 100644 (file)
index 7325c54..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-  clef.hh -- part of LilyPond
-
-  (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef CLEF_HH
-#define CLEF_HH
-#include "scalar.hh"
-#include "varray.hh"
-
-/// where is c-0 in the staff?
-class Clef {
-
-public:
-    int c0_position_i_;
-    String clef_type_str_;
-
-    Clef();
-    void set_type(String);
-};
-#endif // CLEF_HH
-
index b7ea93caaa8e5453b416ea8ea210399973748a4c..2e67a7d094785306670a076e805dd968ed2e41ce 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
-  clefitem.hh -- part of LilyPond
+  clefitem.hh -- declare Clef_item
 
   (c) 1996,97 Han-Wen Nienhuys
 */
 
 
 struct Clef_item : Item {
-    const char * name() const;
     String type;
     int y_off;
+
+    /// is this a change clef (smaller size)?
     bool change;
 
 
     /* *************** */
-
+    const char * name() const;
     Clef_item();
-    void read(Clef);
+    void read(Clef_register const&);
     void read(String);
     Molecule* brew_molecule_p()const;
 };
diff --git a/hdr/clefreg.hh b/hdr/clefreg.hh
new file mode 100644 (file)
index 0000000..ff9e590
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+  clef.hh -- part of LilyPond
+
+  (c) 1996,97 Han-Wen Nienhuys
+*/
+
+#ifndef CLEF_HH
+#define CLEF_HH
+#include "scalar.hh"
+#include "varray.hh"
+#include "register.hh"
+
+/// where is c-0 in the staff?
+class Clef_register : public  Request_register {
+    Clef_item *clef_p_;
+public:
+    int c0_position_i_;
+    String clef_type_str_;
+
+    /* ************** */
+    virtual void process_request();
+    virtual void do_pre_move_process();
+    virtual bool try_request(Nonmusical_req*);
+    Clef_register(Complex_walker*);
+    void read_req(Clef_change_req*);
+    bool set_type(String);
+};
+#endif // CLEF_HH
+
diff --git a/hdr/command.hh b/hdr/command.hh
deleted file mode 100644 (file)
index 2408ac0..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-#ifndef COMMAND_HH
-#define COMMAND_HH
-
-#include "glob.hh"
-#include "varray.hh"
-#include "scalar.hh"
-
-/// what kind of command?
-enum Commandcode {
-       NOP,
-       INTERPRET,
-       TYPESET,
-       BREAK_PRE,BREAK_MIDDLE, BREAK_POST, BREAK_END
-};
-
-/// set a nonrythmical symbol
-
-/**
-    A nonrhythmical "thing" in a  staff is called a "command".
-    Commands have these properties:
-
-    \begin{itemize}
-    \item They are \bf{not} rhythmical, i.e. they do not have  a duration
-    \item They have a staff-wide impact, i.e. a command cannot be targeted at
-    only one voice in the staff: two voices sharing a staff can't have
-    different clefs
-    \item Commands are ordered, that is, when from musical point of view the
-    commands happen simultaneously, the order in which Staff receives the
-    commands can still make a difference in the output
-    \item Some commands are actually score wide, so Score has to issue these
-    commands to the Staff, eg. BREAK commands
-    \end{itemize}
-
-    At this moment we have three classes of commands:
-    \begin{description}
-    INTERPRET commands are not grouped.
-    \item[TYPESET] These commands instruct the Staff to
-    typeset symbols on the output, eg meter/clef/key changes
-    \item[INTERPRET] These commands do not produce output, instead,
-    they change the interpretation of other commands or requests. 
-    example: shift output vertically, set the key.
-    \item[BREAK_XXX] These commands group TYPESET commands in
-    prebreak and postbreak commands. See Documentation/breaking    
-    
-    Staff can insert additional commands in a sequence of BREAK_XXX
-    commands, eg. key change commands
-
-    \end{description}
-    
-    These commands are generated by Score, since they have to be the
-    same for the whole score.
-    
-
-    \begin{description}
-    \item[BREAK_PRE]
-    \item[BREAK_MIDDLE]
-    \item[BREAK_POST]
-    \item[BREAK_END]
-    \item[TYPESET] METER,BAR
-    \end{description}
-
-    Commands can be freely copied, they do not have virtual methods.
-    
-    */
-
-struct Command {
-    Commandcode code;
-
-    /// analogous to argv[]
-    Array<Scalar> args;
-
-
-    /** in what order relative to other TYPESET commands (eg, bar
-       should precede meter). Highest priority first. */
-    int priority;
-    
-    /* *************** */
-    
-    Command();
-    bool isbreak()const;
-    void print() const;
-};
-
-#endif
diff --git a/hdr/commandrequest.hh b/hdr/commandrequest.hh
new file mode 100644 (file)
index 0000000..e5419da
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+  commandrequest.hh -- declare Non musical requests
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef COMMANDREQUEST_HH
+#define COMMANDREQUEST_HH
+
+#include "request.hh"
+#include "varray.hh"
+
+/**
+  Request assumed to be "happening" before the musical requests
+ */
+struct Nonmusical_req : virtual Request {
+    REQUESTMETHODS(Nonmusical_req, nonmus);
+
+    virtual Measure_grouping_req * measuregrouping() { return 0; }
+    virtual Clef_change_req * clefchange() { return 0; }
+    virtual Key_change_req * keychange() { return 0; }
+    virtual Partial_measure_req * partial() { return 0; }
+    virtual Meter_change_req * meterchange() { return 0; }
+    virtual Bar_req *bar() { return 0; }
+    virtual Cadenza_req *cadenza() { return 0; }
+    virtual Timing_req*timing() {  return 0; }
+};
+
+
+/** Baseclass for meter/partial req. It has to be handled by
+  Staff_{walker,column} baseclass.  */
+struct Timing_req : Nonmusical_req {
+    REQUESTMETHODS(Timing_req, timing);
+};
+
+
+struct Partial_measure_req : Timing_req {
+    Moment duration_;
+
+    Partial_measure_req(Moment);
+    REQUESTMETHODS(Partial_measure_req, partial);
+};
+
+/**
+  todo: allow C meter
+ */
+struct Meter_change_req : Timing_req {
+    int beats_i_, one_beat_i_;
+
+    Meter_change_req();
+    void set(int,int);
+    REQUESTMETHODS(Meter_change_req, meterchange);
+};
+
+/// toggle Cadenza mode
+struct Cadenza_req : Timing_req {
+    /// turn on?
+    bool on_b;
+    Cadenza_req(bool);
+    REQUESTMETHODS(Cadenza_req,cadenza);
+};
+
+/// check if we're at start of a  measure.
+struct Barcheck_req : Timing_req {
+
+    REQUESTMETHODS(Barcheck_req,barcheck);
+};
+
+struct Measure_grouping_req: Timing_req {
+    Array<int> beat_i_arr_;
+    Array<Moment> elt_length_arr_;
+
+    REQUESTMETHODS(Measure_grouping_req, measuregrouping);
+};
+
+struct Group_change_req : Nonmusical_req {
+    String newgroup_str_;
+    REQUESTMETHODS(Group_change_req, groupchange);
+};
+
+/** draw a (repeat)-bar. This something different than #Barcheck_req#,
+  the latter should only happen at the start of a measure.  */
+struct Bar_req : Nonmusical_req {
+    String type;
+    Bar_req(String);
+    REQUESTMETHODS(Bar_req,bar);
+};
+struct Terminate_voice_req : Nonmusical_req {
+    REQUESTMETHODS(Terminate_voice_req,terminate);
+};
+
+struct Group_feature_req : Nonmusical_req {
+    int stemdir_i_;
+    Group_feature_req();
+    REQUESTMETHODS(Group_feature_req, groupfeature);
+};
+
+
+struct Key_change_req : Nonmusical_req {
+    Array<Melodic_req*> melodic_p_arr_;
+
+    Key_change_req();
+    Key_change_req(Key_change_req const&);
+    ~Key_change_req();
+    REQUESTMETHODS(Key_change_req, keychange);
+};
+
+struct Clef_change_req : Nonmusical_req {
+    String clef_str_;
+    Clef_change_req(String);
+    REQUESTMETHODS(Clef_change_req, clefchange);
+};
+
+#endif // COMMANDREQUEST_HH
index 50ad5fc8a0e30848382b12ace263f32d156a4fa0..4065954b645ee4029c32c17bd520e3a25eb76c05 100644 (file)
@@ -10,6 +10,8 @@
 #ifndef COMPLEXCOLUMN_HH
 #define COMPLEXCOLUMN_HH
 
+#include "stcol.hh"
+
 /// column of Complex_staff: store one request
 struct Complex_column : Staff_column {
 
@@ -22,14 +24,13 @@ struct Complex_column : Staff_column {
 
     Slur_req *find_slur(Voice *);
 
-    void typeset_item(Item *, int=1);
-    void typeset_item_directional(Item *, int dir, int=1);
-    Molecule *create_command_mol(Command *com);
-
-    void take_request(Request *rq);   
-    virtual void setup_requests();
+    void typeset_musical_item(Item *);
+    void typeset_breakable_items(Array<Item *> &pre_p_arr,
+                                Array<Item *> &nobreak_p_arr,
+                                Array<Item *> &post_p_arr);
+    virtual void setup_one_request(Request*);
 
-    Complex_column(Score_column*s,Complex_staff*rs);
+    Complex_column(Complex_staff*rs);
 };
 
 #endif // COMPLEXCOLUMN_HH
index 6c7dbdb18d01d659aba66bc43a90a00f0428e695..5a605d475e8fbb043e9807fb5a58cd19023946fd 100644 (file)
@@ -21,12 +21,9 @@ struct Complex_staff : Staff {
     PStaff *pstaff_l_;
 
     /* *************** */
-    Staff_column*create_col(Score_column*);    
-    virtual Item *get_TYPESET_item(Command*);
+    Staff_column*create_col();    
     virtual void set_output(PScore *);
-    void process_commands( PCursor<Command*> &where);
-    virtual void walk();
-
+    virtual Staff_walker *get_walker_p();
     Complex_staff();
 };
 
index a4ba27b03b925d30e5a6a0394bdd8e4bb60c282c..d8444c7c9edb9f3e5a69040ecb759ad76cee0a02 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  complexwalker.hh -- part of LilyPond
+  complexwalker.hh -- declare Complex_walker
 
   (c) 1996,97 Han-Wen Nienhuys
 */
@@ -8,70 +8,92 @@
 #define COMPLEXWALKER_HH
 
 #include "proto.hh"
-#include "grouping.hh"
 #include "voicegroup.hh"
 #include "assoc.hh"
 #include "staffwalker.hh"
-#include "key.hh"
-#include "clef.hh"
-#include "register.hh"
-#include "localkeyreg.hh"
-
+#include "staffeleminfo.hh"
+#include "plist.hh"
 
 /**
-  A staff walker which uses registers to what to print
+  A staff walker which uses registers to decide what to print
  */
-struct Complex_walker: Staff_walker {
-    Local_key local_key_;
-    Key key_;
-    Array<int> *oldkey_undo;
-    Array<int> typesetkey;
-
-    int processed_bar_priority;
-    bool processed_key;
-    bool processed_clef;
-    Clef clef_;
-    Rhythmic_grouping default_grouping;
-    
+class Complex_walker: public Staff_walker {
+    bool try_command_request(Nonmusical_req *req_l);
+    void do_change_group( Voice * v, String group_id_str);
+    void do_announces();
+    void try_request(Request*req);    
+    int c0_position_i_;
 
+    Array<Item*> prebreak_item_p_arr_;
+    Array<Item*> nobreak_item_p_arr_;
+    Array<Item*> postbreak_item_p_arr_;
+    
+public:
+    
     IPointerList<Voice_registers *> voice_reg_list_;
     IPointerList<Voice_group_registers*> group_reg_list_;
     Assoc<Voice *, Voice_group_registers *> voice_group_map_;
 
-    Local_key_register local_key_reg_;
+    Clef_register *clef_reg_p_;
+    Local_key_register *local_key_reg_p_;
+    Key_register *key_reg_p_;
+    Bar_register *bar_reg_p_;
+    Meter_register *meter_reg_p_;
+    
     Array<Staff_elem_info> announce_info_arr_;
     
     /* *************** */
+
     Voice_registers *find_voice_reg(Voice*v_l)const;
     Voice_registers *get_voice_reg(Voice*v_l);
     
-    /// search and return. return 0 if not found.
+    /** search for voice_group containing #v_l#
+
+      @return
+      pointer if found,  0 if not found.
+      */
     Voice_group_registers *find_voice_group(Voice* v_l)const;
+
     /// search. Create if necessary
     Voice_group_registers *get_voice_group(Voice* v_l);
-    /// search and return. return 0 if not found
+    /** search for voice_group named #id#
+
+      @return
+      pointer if found,  0 if not found.
+      */
     Voice_group_registers *find_voice_group(const char* id)const;
-    /// Create if necessary
+
+    /**
+      search for voice_group named #id#, create if necessary
+      */
     Voice_group_registers *get_voice_group(const char*);
 
     Array<Voice_registers *> get_voice_regs(Voice_group_registers *) const;
     
     void regs_process_requests();
+    void typeset_breakable_item(Item * pre_p ,
+                               Item * nobreak_p, Item * post_p);
     void typeset_element(Staff_elem *elem_p);
     void announce_element(Staff_elem_info);
-    virtual void do_TYPESET_command(Command*);
-    virtual void do_INTERPRET_command(Command*);
     virtual void process_requests();
     virtual void do_post_move();
     virtual void do_pre_move();
-    
+    /**
+      @return the position of central c.
+     */
+    int c0_position_i() const;
+
+    /**
+      set the position of central c.
+      @param the new position
+     */
+    void set_c0_position(int j);
     Complex_walker(Complex_staff*);
+    ~Complex_walker();
+
     Complex_column *col();
     Complex_staff *staff();
 private:
-    void  do_change_group( Voice * v, String group_id_str);
-    void do_announces();
-    void try_request(Request*req);
 };
 
 
diff --git a/hdr/getcommand.hh b/hdr/getcommand.hh
deleted file mode 100644 (file)
index 77123e8..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
-  getcommand.hh -- part of LilyPond
-
-  (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef GETCOMMAND_HH
-#define GETCOMMAND_HH
-#include "proto.hh"
-
-
-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
index 70d95ef55d1f74d2ada3ee4d5cfb002b13d4570e..72d2960f827beb03364c3b5c212efe3f08137a67 100644 (file)
@@ -52,4 +52,9 @@ private:
     void junk();
     void copy(Rhythmic_grouping const&);
 };
+
+
+Rhythmic_grouping parse_grouping(Array<int> beat_i_arr, Array<Moment> elt_length_arr);
+
+
 #endif
diff --git a/hdr/inputcommand.hh b/hdr/inputcommand.hh
deleted file mode 100644 (file)
index 8437454..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-  inputcommand.hh -- part of LilyPond
-
-  (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef INPUTCOMMAND_HH
-#define INPUTCOMMAND_HH
-#include "proto.hh"
-#include "scalar.hh"
-#include "varray.hh"
-#include "moment.hh"
-/// command without time assoced 
-struct Input_command {
-    /// analogous to argv[]
-    Array<Scalar> args;
-    void print()const;
-    Input_command();
-
-    operator Command();
-};
-Input_command*get_cadenza_toggle(int i);
-Input_command *get_meterchange_command( int,int);
-Input_command *get_key_interpret_command(Array<int >);
-Input_command *get_clef_interpret_command(String w);
-Input_command *get_reset_command();
-Input_command *get_partial_command(Moment u);
-Input_command *get_skip_command(int,Moment);
-Input_command *get_grouping_command(Array<int>);
-Input_command *get_bar_command(String);
-Input_command *get_newmeasure_command();
-Input_command *get_goto_command(String);
-Array<int> get_default_grouping(int count, int onenote);
-#endif // INPUTCOMMAND_HH
-
diff --git a/hdr/inputcommands.hh b/hdr/inputcommands.hh
deleted file mode 100644 (file)
index 94d94c4..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-  inputcommands.hh -- part of LilyPond
-
-  (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef INPUTCOMMANDS_HH
-#define INPUTCOMMANDS_HH
-
-#include "proto.hh"
-#include "plist.hh"
-#include "real.hh"
-#include "timedescription.hh"
-
-struct Commands_at : public IPointerList<Input_command*> {
-    Time_description tdescription_;
-    
-    /* *************** */
-
-    Moment when();
-    void parse(Staff_commands_at*);
-    void print() const;
-    Moment barleft();
-    void add(Input_command*);
-    void setpartial(Moment);
-    Commands_at(const Commands_at&);
-    Commands_at(Moment, Commands_at*prev);
-};
-
-struct Input_cursor : public PCursor<Commands_at*>
-{
-    /* *************** */
-    Input_cursor(PCursor<Commands_at*>);
-    Moment when()const;
-    void find_moment(Moment w);
-    void prev() { operator --(0); }
-    void next() { operator ++(0); }    
-};
-
-/// the list of commands in Score
-struct Input_commands : public IPointerList<Commands_at*> {    
-    Input_cursor ptr;
-    
-    /* *************** */
-
-    void find_moment(Moment);
-    void add(Input_command c,Assoc<String,Moment> &marks_assoc_r);
-    void do_skip(int bars, Moment wholes);
-        
-    Input_commands();
-    Input_commands(Input_commands const&);
-
-    void reset();
-    void print()const;
-    void parse(Staff *) const;
-};
-
-#endif // INPUTCOMMANDS_HH
-
index 0a1d95cfc6ee7baf8e4ff101d9efd28194bf7e47..13e8f4a3653ec7ee55f2760e496f8a408f17ac4f 100644 (file)
@@ -18,6 +18,7 @@ struct Voice_list : public PointerList<Voice*> {
 
 /**
 
+  A set voices.
   Input_music is anything that can simply be regarded as/converted to
   a set of voices "cooperating" or independant. It has some basic
   characteristics that real music has too:
@@ -26,8 +27,6 @@ struct Voice_list : public PointerList<Voice*> {
   - a pitch (it can be transposed)
 
   */
-
-
 struct Input_music {
     virtual Voice_list convert()const=0;
     virtual Moment length()const=0;
@@ -75,7 +74,7 @@ struct Complex_music : Input_music {
 
 
 /**
-  voice like.
+  A voice like list of music.
 
   different music forms which start after each other ( concatenated,
   stacked "horizontally )
index ef0d9d6a889f9763577cbe92dc093ae7555a1975..024c6d132c25d129780796c1ff4c6c1ff8c7837e 100644 (file)
@@ -1,5 +1,15 @@
-#ifndef ISCORE_HH
-#define ISCORE_HH
+/*
+  inputscore.hh -- declare 
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef INPUTSCORE_HH
+#define INPUTSCORE_HH
+
 #include "varray.hh"
 #include "proto.hh"
 #include "plist.hh"
@@ -13,20 +23,22 @@ struct Input_score {
     int errorlevel_i_;
     
     /// paper_, staffs_ and commands_ form the problem definition.
-    Paperdef *paper_;
+    Paperdef *paper_p_;
     IPointerList<Input_staff*> staffs_;
-    IPointerList<Input_command*> commands_;
+
+    Input_music * score_wide_music_p_;
     
     /* *************************************************************** */
     Input_score();
     Input_score(Input_score const&);
-    void add(Array<Input_command*> &s);
+
     void add(Input_staff*);
     ~Input_score();
     /// construction
     void set(Paperdef*);
     void print() const;
     Score*parse();
+    void set(Input_music*);
 };
 
 #endif
index cc9f823885b06a8c4fc26ef87737b5faaea47528..f72cac8ba1aa60f9c50b8fbbe0b6229f1fede1a9 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  inputstaff.hh -- part of LilyPond
+  inputstaff.hh -- declare Input_staff
 
   (c) 1996,97 Han-Wen Nienhuys
 */
 
 struct Input_staff {
     
-
     const char * defined_ch_c_l_;
     String type;
-    IPointerList<Input_command*> commands_;
+    
     IPointerList<Input_music*> music_;
-
+    Input_music * score_wide_music_p_;
+    
     /* *************** */
-
+    ~Input_staff();
     void add(Input_music*m);
     Input_staff(Input_staff const&);
     Input_staff(String);
-    void add(Array<Input_command*> &s);
-    Staff* parse(Score*);
+    void set_score_wide(Input_music*m);
+    Staff* parse(Score*, Input_music *score_wide);
     void print() const;
 };
 
index 7a755244a850762f61a17d0b28985f69082748b9..3d58629d5d49dd5b9c48e11ac4f16ea2530d3e2d 100644 (file)
 
 /// administration of current key
 class Key {
-    Array<int> accidentals;
+    Array<int> accidental_i_arr_;
 
     /* *************** */
 
 public:
-    Array<int> read(Array<Scalar> );
-    Array<int> oldkey_undo(Array<Scalar>);
-
     Key();
     void set(int i, int acc);
-    int acc(int i) { return accidentals[i]; }
+    int acc(int i)const { return accidental_i_arr_[i]; }
 };
 
 /// administration of accidentals
index b882c9551a15eaf5e8c9230c4399e41b74f8b076..86dae4d9fceb9f166de947d7bbb7583bd24ed3f9 100644 (file)
 #include "item.hh"
 #include "varray.hh"
 
-struct Clef;
 
 /// An item which places accidentals at the start of the line
-struct Keyitem : Item {
-    const char * name() const;
+struct Key_item : Item {
     Array<int> pitch;
     Array<int> acc;
     int c_position;
 
     
     /* *************** */
-    
-    Keyitem(int cposition);
+    const char * name() const;    
+    Key_item(int cposition);
     void add(int pitch, int acc);
-    void read(Array<int> k);
-    void read(const Clef& c);
-
+    void read(const Key_register&);
+    void set_c_position(int);
     void preprocess();
-
     Molecule* brew_molecule_p()const;
 };
 
diff --git a/hdr/keyreg.hh b/hdr/keyreg.hh
new file mode 100644 (file)
index 0000000..cf19231
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+  keyreg.hh -- declare Key_register
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef KEYREG_HH
+#define KEYREG_HH
+
+#include "register.hh"
+#include "key.hh"
+
+struct Key_register : Request_register {
+    Key key_;
+    Key_change_req * keyreq_l_;
+    Key_item * kit_p_;
+    Array<int> accidental_idx_arr_;
+    bool default_key_b_;
+    
+    virtual bool try_request(Request *req_l);
+    virtual void process_request();
+    virtual void do_pre_move_process();
+    virtual void do_post_move_process();
+    Key_register(Complex_walker*);
+private:
+    
+    void read_req(Key_change_req * r);
+};
+
+#endif // KEYREG_HH
index b9a9241d0d8081aeef9e0a65755733f3986ba547..35b1e1d34b912f0c71bcd52fac37e670ea88bcf4 100644 (file)
@@ -9,6 +9,10 @@
 #include "varray.hh"
 #include "offset.hh"
 
+
+/**
+  Least squares minimisation in 2 variables.
+  */
 struct Least_squares {
     Array<Offset> input;
     void minimise(Real &coef, Real &offset);
index e2909d8879aa4daf1142802e0176e463ae531725..8f1e67123e9c20a69b79e979715f15d80c4c508b 100644 (file)
@@ -14,7 +14,7 @@ void set_lexer();
 
 struct Input_file {
        istream* is;
-       char const* defined_ch_c_l_m;
+       char const* defined_ch_c_l_;
        Source_file* sourcefile_l_;
        int line;
        String name;
@@ -31,7 +31,7 @@ struct My_flex_lexer : yyFlexLexer {
     Assoc<String, Identifier*> *the_id_tab;
     Keyword_table * keytable;
     Notename_tab * defaulttab;
-    char const* data_ch_c_l_m;
+    char const* data_ch_c_l_;
     int errorlevel_i_;
     /* *************** */
     int ret_notename(int *p, String text, int octave_mod);    
index b9027754ce3bac7e58dca9a87511e85231584462..1479d1e9368db4d3d1135d78c2c5490887f91f45 100644 (file)
@@ -70,13 +70,15 @@ class Spacing_problem {
 
 public:
     /** solve the spacing problem
-          return the column positions, and the energy (last element)
-         */
+      
+      @return the column positions, and the energy (last element)
+
+      */
     Array<Real> solve() const;
 
-    /// add a idealspacing to the problem.
+    
     /**
-      
+       add a idealspacing to the problem.
       
     One pair of columns can have no, one or more idealspacings,
     since they can be "summed" if the columns to which #i# refers are
@@ -85,8 +87,7 @@ public:
     void add_ideal(const Idealspacing *i);
     
     
-    /// add a col to the problem
-       /** columns have to be added left to right. The column contains
+    /** add a col to the problem. columns have to be added left to right. The column contains
       info on it's minimum width.
     */
     void add_column(const PCol *, bool fixed=false, Real fixpos=0.0);
index 492a23f345eaad5f2c4b99bc30135bbe1dd91832..e9640023d4560395dd690b7b7e33db8c91fa3343 100644 (file)
@@ -17,8 +17,8 @@ struct Local_acc {
 struct Local_key_item : Item {
     const char * name() const;
     Array<Local_acc> accs;
-    Array<Item*> group;
-    int c0_position;           // move into walker
+    Array<Item*> support_items_;
+    int c0_position;
 
     /* *************** */
     
index 742d9cb41e2d47679c8e7b6af16061ea6282bc85..48a9b5cbd299749c79fe347590375d1ec12e0e06 100644 (file)
@@ -8,14 +8,13 @@
 #ifndef LOCALKEYREG_HH
 #define LOCALKEYREG_HH
 #include "register.hh"
+#include "key.hh"
 
 struct Local_key_register : Request_register {
+    Local_key local_key_;
     Local_key_item* key_item_p_;
 
     /* *************** */
-    
-    virtual bool try_request(Request*);
-    virtual void process_request();
     virtual void acknowledge_element(Staff_elem_info);
     virtual void do_pre_move_process();
     Local_key_register(Complex_walker*);
index 118b9f34bdb5beca83d4d521211307e878b8338f..a7202e593d53ba5b25398fa0313c0f1c7a787cb8 100644 (file)
@@ -1,5 +1,5 @@
 //
-// lyriccolumn.hh -- part of LilyPond
+// lyriccolumn.hh -- declare Lyric_column
 //
 // copyright 1997 Jan Nieuwenhuizen <jan@digicash.nl>
 
 #include "stcol.hh"
 #include "staff.hh"
 
-struct Lyric_staff;
-
-/// (winfo)
-struct Word_info {
-    Lyric_req* lreq_l_;
-    Word_info();
-    Word_info(Lyric_req* lreq_l);
-};
-
 /// (lcol)
 struct Lyric_column : Staff_column {
 
-    Array<Word_info> winfo_array_;
+    Array<Lyric_req*> lreq_l_array_;
     Lyric_staff* lstaff_l_;
     
     void typeset_item(Item *);
-    virtual void setup_requests();
+    virtual void setup_one_request(Request*);
 
-    Lyric_column(Score_column* s,Lyric_staff*rs);
+    Lyric_column(Lyric_staff*rs);
 };
 
 #endif // LYRICSTAFF_HH
index 22fb8958b6cc8cf25b31cbbc9e4af39ef510a175..31cc62caaab75ae64ebcf67b28856dec6f6230a8 100644 (file)
@@ -1,23 +1,23 @@
-//
-//  lyricstaff.hh -- part of LilyPond
-//
-//  copyright 1997 Jan Nieuwenhuizen <jan@digicash.nl>
+/*
+  lyricstaff.hh -- part of LilyPond
+
+  copyright 1997 Jan Nieuwenhuizen <jan@digicash.nl>
+  */
 
 #ifndef LYRICSTAFF_HH
 #define LYRICSTAFF_HH
 
 #include "staff.hh"
 
-/// (lstaff)
+/**
+  Hungarian prefix lstaff
+ */
 struct Lyric_staff : Staff {
     PStaff* pstaff_l_;
 
-    Staff_column* create_col(Score_column*);
-
+    Staff_column* create_col();
     virtual void set_output(PScore *);
-    void process_commands(PCursor<Command*> &where);
-    virtual void walk();
-
+    virtual Staff_walker *get_walker_p();
     Lyric_staff();
 };
 
index fcf0c9186bd6481bc97b78dc27f7e241651ae9a9..5f413f2ab9569acff29dd7dc1c385168226dc651 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  simplewalker.hh -- part of LilyPond
+  lyricwalker.hh -- declare Lyric_walker
 
   (c) 1996,97 Han-Wen Nienhuys, Jan Nieuwenhuizen <jan@digicash.nl>
 */
 #include "staffwalker.hh"
 #include "lyriccolumn.hh"
 
-struct Lyric_item; // put into proto
+/// a simple walker which collects words, and then print them, first on top
 struct Lyric_walker: Staff_walker {
     Array<Lyric_item*> litem_l_array_;
 
     /* *************** */
-    
-    virtual void do_TYPESET_command(Command*);
-    virtual void do_INTERPRET_command(Command*);
     virtual void process_requests();
-    virtual void reset();
     
-    void do_word(Word_info);
     Lyric_walker(Lyric_staff* lstaff_l);
     Lyric_column* lcol_l();
     Lyric_staff* lstaff_l();
index 22a256c93c74e2129e3d0799fc27a35de960cc5f..7de58e7c64748eafd1df71d03371f82c0af9c840 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  meter.hh -- part of LilyPond
+  meter.hh -- declare Meter
 
   (c) 1996,97 Han-Wen Nienhuys
 */
@@ -8,11 +8,12 @@
 #define METER_HH
 #include "item.hh"
 #include "varray.hh"
+#include "scalar.hh"
 
 struct Meter: Item {
-    const char * name() const;
     Array<Scalar> args;
     /* *************** */
+    const char * name() const;
     
     Meter(Array<Scalar> args) ;
     Molecule*brew_molecule_p() const;
diff --git a/hdr/meterreg.hh b/hdr/meterreg.hh
new file mode 100644 (file)
index 0000000..f14e2ec
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+  meterreg.hh -- declare  Meter_register
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef METERREG_HH
+#define METERREG_HH
+#include "register.hh"
+
+/**
+  generate meters. 
+  */
+class Meter_register : public Request_register {
+public:
+    Meter_change_req * meter_req_l_;
+    Meter * meter_p_;
+    virtual bool try_request(Request *req_l);
+    virtual void process_request();
+    virtual void do_pre_move_process();
+    virtual void do_post_move_process();
+    Meter_register(Complex_walker*);
+};
+#endif // METERREG_HH
index ae288151a27fab8165f7d386703f542b2ddfb464..00b742076e3cb1c6fab555d5a47f468a27654c10 100644 (file)
@@ -5,10 +5,9 @@
 #include "real.hh"
 #include "moment.hh"
 #include "scalar.hh"
+#include "grouping.hh"
 
 Moment wholes(int dur, int dots);
-
-Rhythmic_grouping parse_grouping(const Array<Scalar> &a);    
 double log_2(double x) ;
 int intlog2(int d);
 inline int
@@ -22,5 +21,6 @@ sign(int i) {
     else return 0;
 }
 
+Interval itemlist_width(const Array<Item*> &its);
 
 #endif
diff --git a/hdr/musicalrequest.hh b/hdr/musicalrequest.hh
new file mode 100644 (file)
index 0000000..2a864eb
--- /dev/null
@@ -0,0 +1,185 @@
+/*
+  musicalrequests.hh -- declare Musical requests
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef MUSICALREQUESTS_HH
+#define MUSICALREQUESTS_HH
+
+#include "request.hh"
+
+
+/**
+  A request which is coupled to a #Voice_element# with nonzero duration.
+  Base class only
+ */
+struct Musical_req : virtual Request {
+    virtual Skip_req* skip() { return 0; }
+    REQUESTMETHODS(Musical_req, musical);
+};
+
+
+struct Skip_req : Musical_req {
+    Moment duration_;
+    
+    virtual Moment duration() const;
+    REQUESTMETHODS(Skip_req, skip);
+};
+/** a request with a duration.
+  This request is used only a base class.
+ */
+struct Rhythmic_req : virtual Musical_req {
+    int balltype;
+    int dots;
+    Moment plet_factor;
+    /* *************** */
+    static int compare(const Rhythmic_req &, const Rhythmic_req &);
+    virtual Moment duration() const;
+    Rhythmic_req();
+    Rhythmic_req(int,int);
+    REQUESTMETHODS(Rhythmic_req, rhythmic);
+};
+
+struct Spacing_req :virtual Request {
+    Moment next;
+    Real distance;
+    Real strength;
+    /* *************** */
+    Spacing_req();
+    REQUESTMETHODS(Spacing_req, spacing);
+};
+
+struct Blank_req : Spacing_req, Rhythmic_req {
+    REQUESTMETHODS(Spacing_req, spacing);
+    
+};
+
+/// Put a text above or below (?) this staff.
+struct Text_req : virtual Musical_req {
+    /// preferred position (above/below)
+    int dir_i_;
+    /// the characteristics of the text
+    Text_def *tdef_p_;
+    /* *************** */
+    Text_req(int d, Text_def*);
+    ~Text_req();
+    Text_req(Text_req const&);
+    static int compare(const Text_req&,const Text_req&);
+    REQUESTMETHODS(Text_req,text);
+};
+
+/** Put a text in lyric_staff
+  @see Lyric_staff
+  */
+struct Lyric_req : public Rhythmic_req, Text_req {
+    Lyric_req(Text_def* t_p);
+    REQUESTMETHODS(Lyric_req, lreq_l);
+};
+
+/// request which has some kind of pitch
+struct Melodic_req :virtual Musical_req
+{
+    /// 0 is c, 6 is b
+    int notename_i_;
+    /// 0 is central c
+    int octave_i_;
+
+    /// 0 natural, 1 sharp, etc
+    int accidental_i_;
+
+    /// force/supress printing of accidental.
+    bool forceacc_b_;
+
+    /// return height from central c (in halflines)
+    int height()const; 
+    Melodic_req();
+   
+    REQUESTMETHODS(Melodic_req,melodic);
+};
+
+/// Put a note of specified type, height, and with accidental on the staff.
+struct Note_req : Rhythmic_req, virtual Melodic_req {
+    
+
+    Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); }
+    REQUESTMETHODS(Note_req, note);
+ };
+
+/**
+Put a rest on the staff. Why a request? It might be a good idea to not typeset the rest, if the paper is too crowded.
+*/
+class Rest_req : public Rhythmic_req {
+public:
+    REQUESTMETHODS(Rest_req,rest);
+};
+
+/**
+  attach a stem to the noteball.
+  Rhythmic_req parent needed to  determine if it will fit inside a beam.
+  */
+struct Stem_req : Rhythmic_req {
+    /// preferred direction for the stem
+    int dir_i_;
+    Stem_req(int s, int dots);
+    REQUESTMETHODS(Stem_req,stem);
+};
+
+/**
+  Requests to start or stop something.
+ This type of request typically results in the creation of a #Spanner#
+*/
+struct Span_req : Musical_req {
+    /// should the spanner start or stop, or is it unwanted?
+    enum {
+       NOSPAN, START, STOP
+    } spantype ;
+    static int compare(const Span_req &r1, const Span_req &r2);
+    REQUESTMETHODS(Span_req,span);
+
+    Span_req();
+  
+};
+
+
+/** Start / stop a beam at this note.  if #nplet# is set, the staff will try to put an
+appropriate number over the beam
+    */
+struct Beam_req : Span_req {
+    int nplet;
+
+    /* *************** */
+     REQUESTMETHODS(Beam_req,beam);
+
+    Beam_req();
+};
+
+/// a slur
+struct Slur_req : Span_req {
+ REQUESTMETHODS(Slur_req,slur);
+
+};
+
+
+/**Put a script above or below this ``note''. eg upbow, downbow. Why a
+request? These symbols may conflict with slurs and brackets, so this
+also a request */
+struct Script_req : Musical_req {
+    int dir_i_;
+    Script_def *scriptdef_p_;
+
+    /* *************** */
+    static int compare(const Script_req &, const Script_req &);
+    Script_req(int d, Script_def*);
+    REQUESTMETHODS(Script_req,script);
+    ~Script_req();
+    Script_req(Script_req const&);
+};
+
+
+
+
+#endif // MUSICALREQUESTS_HH
index 78d4f84861eb1f9651d201898feaa08ee5ea0ce5..5ee82774c06f5df206c77f8341134286ae2c990b 100644 (file)
@@ -11,7 +11,6 @@
 
 extern char const* defined_ch_c_l;
 extern char const* req_defined_ch_c_l;
-Voice_element*get_mark_element(String);
 void set_default_duration(int *);
 void last_duration(int n);
 void set_duration_mode(String s);
@@ -28,11 +27,12 @@ Script_def* get_scriptdef(char);
 Text_def*get_text(String s);
 Request*get_script_req(int d , Script_def*def);
 Request*get_text_req(int d , Text_def*def);
-Voice_element*get_command_element(Input_command*);
-Voice_element* get_barcheck_element();
-Voice_element* get_stemdir_element(int);
+Request* get_stemdir_req(int);
 
 
 
+
+Request*get_grouping_req(Array<int> i_arr);
+
 #endif // PARSECONSTRUCT_HH
 
index 0e8ed3e6776002ec6b567805b8935eb5a4673960..21fdb698d9c2b9935d0b74e27f79889165faed38 100644 (file)
@@ -6,8 +6,9 @@
 #include "plist.hh"
 #include "item.hh"
 
-/// stuff grouped vertically.
+
 /**
+   stuff grouped vertically.
     This is a class to address items vertically. It contains the data for:
     \begin{itemize}
     \item
     \item
     the linespacing problem
     \end{itemize}
-  */struct PCol {
+  */
+
+struct PCol {
     PointerList<const Item*> its;
     PointerList<const Spanner*> stoppers, starters;
     
 
-    /// prebreak is put before end of line.
-    /**
+
+    /** prebreak is put before end of line.
     if broken here, then (*this) column is discarded, and prebreak
     is put at end of line, owned by Col
     */
     void add(Item *i);
 
     /// Can this be broken? true eg. for bars. 
-    bool breakable()const;
+    bool breakable_b()const;
     
     Interval width() const;
     ~PCol();
     PCol(PCol * parent);
 
-    /// which col comes first?
     /**
+       which col comes first?.
     signed compare on columns.
 
-    return < 0 if c1 < c2.
+    @return < 0 if c1 < c2.
     */static int compare(const PCol &c1, const PCol &c2);
     
 
index eac46fbecabb296323d80689b84ba85620b024d1..5610e4f54b7512b546ed841e039d6fcd89c0b5d6 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
   proto.hh -- part of LilyPond
 
 struct Absdynamic_req;
 struct Accidental;
 struct Atom;
+struct Bar;
+struct Bar_register;
 struct Barcheck_req;
+struct Bar_req;
 struct Beam;
 struct Beam_req;
 struct Box;
 struct Bracket_req;
-struct CNote_info;
+struct Cadenza_req;
 struct Chord;
-struct Clef;
+struct Clef_change_req;
+struct Clef_register;
 struct Clef_item;
 struct Col_hpositions;
 struct Colinfo;
-struct Command;
-struct Commands_at ;
 struct Complex_column;
 struct Complex_music;
 struct Complex_staff;
 struct Complex_walker;
 struct Cresc_req;
 struct Decresc_req;
+struct Durational_req;
 struct Dynamic;
 struct Group_change_req;
 struct Group_feature_req;
 struct Idealspacing;
 struct Identifier;
-struct Input_command;
-struct Input_commands;
 struct Input_file;
 struct Input_music;
 struct Input_score;
 struct Input_staff;
 struct Item;
 struct Key;
-struct Keyitem;
+struct Key_register;
+struct Key_change_req;
+struct Key_item;
 struct Keyword;
 struct Keyword_table;
 struct Line_of_score;
 struct Line_of_staff;
 struct Linestaff;
 struct Local_key;
+struct Local_key_register;
 struct Local_key_item;
 struct Lookup;
+struct Lyric_item;
 struct Lyric_req;
-struct Lyric_req;
-struct Mark_req;
 struct Melodic_req;
+struct Measure_grouping_req;
+struct Meter_change_req;
+struct Meter;
+struct Meter_register;
 struct Mixed_qp;
 struct Molecule;
+struct Musical_req;
 struct Music_general_chord;
 struct Music_voice;
+struct Nonmusical_req;
 struct Note_req;
 struct Notehead;
 struct Notehead_register;
@@ -73,21 +81,24 @@ struct PCol;
 struct PScore;
 struct PStaff;
 struct Paperdef;
-struct Parametric_symbol;
+struct Partial_measure_req;
 struct Rational;
 struct Request;
 struct Request_register;
 struct Rest;
 struct Rest_req;
 struct Rhythmic_grouping;
+struct Rhythmic_grouping_req;
 struct Rhythmic_req;
 struct Score;
 struct Score_column;
+struct Score_walker;
 struct Script_def;
 struct Script;
 struct Script_register;
 struct Script_req;
 struct Simple_music;
+struct Skip_req;
 struct Slur;
 struct Slur_register;
 struct Slur_req;
@@ -99,9 +110,6 @@ struct Spanner;
 struct Blank_req;
 struct Staff;
 struct Staff_column;
-struct Staff_command_req;
-struct Staff_commands;
-struct Staff_commands_at ;
 struct Staff_elem;
 struct Staff_elem_info;
 struct Staff_symbol;
@@ -120,7 +128,7 @@ struct Text_def;
 struct Text_gob;
 struct Text_register;
 struct Text_req;
-
+struct Timing_req;
 struct Time_description;
 struct Voice;
 struct Voice_element;
index f4b3f788d9b458c88f86f578777c71062255f5af..f1f8dbbc9694bc4dfe5eb82811b01d5904d081f4 100644 (file)
@@ -8,11 +8,13 @@
 #include "pcol.hh"
 #include "pstaff.hh"
 
-/// all stuff which goes onto paper
-/** notes, signs, symbols in a score can be grouped in two ways:
+
+/** all stuff which goes onto paper. notes, signs, symbols in a score can be grouped in two ways:
     horizontally (staffwise), and vertically (columns). #PScore#
     contains the items, the columns and the staffs.
- */struct PScore {
+ */
+
+struct PScore {
     Paperdef *paper_l_;
     
     /// the columns, ordered left to right
@@ -45,8 +47,8 @@
 
     void add(PStaff *);
     
-     /// add an item
-    /**
+
+    /** add an item.
        add the item in specified containers. If breakstatus is set
        properly, add it to the {pre,post}break of the pcol.
        */
@@ -62,7 +64,9 @@
     /* INSPECTION */
     Array<Item*> select_items(PStaff*, PCol*);
 
-    /// return argument as a cursor.
+     /**
+       @return argument as a cursor of the list
+       */
     PCursor<PCol *> find_col(const PCol *)const;
 
     /* MAIN ROUTINES */
index 7bc667b95693f13c66f66982713d196e51f0d560..ccfba72bb83c76abf9901a5c20c447b894d89983 100644 (file)
@@ -30,7 +30,9 @@ public:
     /// solve the problem using a projected gradient method
     Vector solve(Vector start) const;
     
-    /** return the number of variables in the problem */
+    /**
+      @return the number of variables in the problem
+      */
     int dim() const{
        return lin.dim();
     }
@@ -61,8 +63,9 @@ public:
 
 };
 
-/// Quadratic programming with mixed linear constraints
+
 /**
+   Quadratic programming with mixed linear constraints.
   problem definition of a quadratic optimisation problem with linear
   inequality and equality constraints
 
index 811556c362b680a69af431f9d5575f5e4328e41e..7c9b8da341b57342033d9bf97c71bdd45efb213f 100644 (file)
@@ -40,15 +40,15 @@ public:
     Vector vec(int k) const { return opt->cons[k]; }
     Real rhs(int k) const { return opt->consrhs[k]; }
     
-    /// drop constraint
-    /** drop constraint k from the active set. k is the index of the
+
+    /** drop constraint. drop constraint k from the active set. k is the index of the
     constraint in #active#
     
     */
     void drop (int k);
     
-    ///     add constraint j
-    /**
+
+    /** add constraint j.
     add constraint j to the active set j is the index of the
     constraint in #inactive#   
     */
index 0c47e35cd1979bd2ed7a8c6a04c7bc0b9e03c2e2..922d874644f63f6f5c74964cd396890824c4e1f0 100644 (file)
@@ -6,77 +6,88 @@
 
 #ifndef REGISTER_HH
 #define REGISTER_HH
+
 #include "proto.hh"
 #include "varray.hh"
 #include "request.hh"
+#include "staffeleminfo.hh"
 
-/// data container.
-struct Staff_elem_info {
-    Staff_elem * elem_p_;
-    Request*req_l_;
-    const Voice * voice_l_;
-    Voice_group_registers * group_regs_l_; 
-    Request_register * origin_reg_l_;
-
-    /* *** */
-    Staff_elem_info(Staff_elem*, Request*, Request_register*);
-    Staff_elem_info();
-};
 
-/// Hungarian postfix: reg
 /**
-  a struct which processes requests, and creates the Staff_elems  
+  a struct which processes requests, and creates the #Staff_elem#s.
+   Hungarian postfix: reg
   */
-struct Request_register {
+class Request_register {
+public:
     Complex_walker * walk_l_;
     Array<Request*> accepted_req_arr_;
     
-    /* *************** */
     /**
-      Warning: you can't copy a Request_register
+      Warning: you can't copy a #Request_register#
       */
     Request_register(Request_register const &);
     Request_register(Complex_walker*);
     Request_register();
     virtual ~Request_register(){}
 
-    /** take note of item/spaanner
-       put item in spanner. Adjust local key; etc.
-      */
-    virtual void acknowledge_element(Staff_elem_info){}
     /**
-      Announce element to  walker
-      */
-    void announce_element(Staff_elem_info);
+      take note of item/spanner
+      put item in spanner. Adjust local key; etc.
 
-    /**
-      invoke walker method to typeset element
+      Default: ignore the info
       */
-    void typeset_element(Staff_elem*elem_p);
-    
+    virtual void acknowledge_element(Staff_elem_info){}
+
     /**
       try to fit the request in this register
 
       @return
       false: not noted,  not taken.
 
-      true: request swallowed. Don't try to put elsewhere
+      true: request swallowed. Don't try to put the request elsewhere.
 
       (may be we could use C++ exceptions.. :-)
+
+      #Request_register::try_request# always returns false
       */
-    virtual bool try_request(Request *req_l) =0;
+    virtual bool try_request(Request *req_l);
     
     /// make items/spanners with the requests you got
-    virtual void process_request()=0;
-    Paperdef * paper() const;
-    /// typeset any spanners. Empty accepted_req_arr_
+    virtual void process_request(){}
+
+    /// typeset any spanners. Empty #accepted_req_arr_#
     void pre_move_processing();
+    /// reset any appropriate data.
     void post_move_processing();
+    
     virtual void set_dir(int){}
 protected:
-    /// virtual, called by pre_move_process()
+    /// utility
+    Paperdef * paper() const;
+
+
+     /**
+      invoke walker method to typeset element
+      */
+    void typeset_element(Staff_elem*elem_p);
+
+
+    /**
+      typeset a "command" item.
+      If the column is not breakable, #pre_p# and #post_p# are junked
+      */
+    void typeset_breakable_item(Item * pre_p , Item * nobreak_p, Item * post_p);
+    /** virtual, called by #pre_move_processing()#
+      #Request_register::do_pre_move_process()# defaults to NOP
+      */
     virtual void do_pre_move_process(){}
+    /** virtual, called by #post_move_processing#,
+      #Request_register::do_post_move_process()# defaults to NOP */
     virtual void do_post_move_process(){}
+    /**
+      Announce element to walker. Utility
+      */
+    void announce_element(Staff_elem_info);
 };
 
 
diff --git a/hdr/reqtodo.hh b/hdr/reqtodo.hh
new file mode 100644 (file)
index 0000000..eaed606
--- /dev/null
@@ -0,0 +1,83 @@
+#if 0
+
+
+
+/**Draw a (Guitar) chord above or below this ``note''.
+Why a request?
+Because everything else is done in requests.
+*/
+struct Chord : Request {
+       // don't know how this looks.
+};
+
+
+/// for absolute dynamics
+enum Loudness {
+    FFF, FF, F, MF, MP, P, PP, PPP
+} ;
+
+
+/**
+Start/stop a bracket at this note. if #nplet# is set, the staff will
+try to put an appropriate number over the bracket
+*/
+struct Bracket_req : Span_req {
+    int nplet;                 // print a number over the beam.
+};
+
+struct Subtle_req {
+    Moment subtime;
+};
+
+
+/** helper in the hierarchy. 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 from the start of its
+    note.
+
+    This subfield would come in handy, if mpp96 was adapted for midi
+    support.
+    
+    Dynamic should have been derived from request, but I don't want to
+    fuss with virtual baseclasses.  */
+
+struct Dynamic:Subtle_req {
+
+};
+/// do a crescendo
+struct Cresc_req : Span_req, Dynamic {
+    
+};
+
+/// do a decrescendo
+struct Decresc_req : Span_req, Dynamic {
+    
+};
+
+/// do a dynamic like "fff" or "mp"
+struct Absdynamic_req : Request, Dynamic {
+    Loudness loudness;
+};
+
+struct Grace_req : Subtle_req {
+    
+};
+
+struct Grace_turn_req : Grace_turn {
+    
+};
+
+struct Grace_note : Melodic_req {
+    
+};
+
+struct Grace_notes {
+    
+};
+
+struct Glissando_req : Span_req {
+    
+};
+#endif
index b533a3fbb53c0db029efc30574bc42a05fef47d4..56fc3e4ea590e3d39a9c9dfa68a4cf82888d0497 100644 (file)
@@ -1,20 +1,27 @@
-// LilyPond's second egg of columbus!
+/*
+  request.hh -- declare Request baseclasses.
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
 #ifndef REQUEST_HH
 #define REQUEST_HH
+// LilyPond's second egg of columbus!
 
 #include "glob.hh"
 #include "string.hh"
 #include "moment.hh"
 
-/// Hungarian postfix: req
 /**
  a voice element wants something printed.
-see lilygut page
+ Hungarian postfix: req
+ @see lilygut manpage
  */
-
 struct Request {
     Voice_element*elt_l_;
-    char const* defined_ch_c_l_m;
+    char const* defined_ch_c_l_;
     
     /* *************** */
     Request();
@@ -22,7 +29,7 @@ struct Request {
     virtual ~Request(){}
 
     virtual const char * name() const { return "Request";}
-    virtual Request* clone() const =0;
+    virtual Request* clone() const { return new Request(*this); }
     void print()const ;
     
     virtual Moment duration() const { return 0; }
@@ -31,24 +38,24 @@ struct Request {
        maybe checkout RTTI
      */
     virtual Barcheck_req *barcheck() { return 0; }
-    virtual Note_req *note() {return 0;}
-    virtual Script_req *script() {return 0;}
-    virtual Stem_req *stem() {return 0;}
+    virtual Note_req *note() { return 0;}
+    virtual Script_req *script() { return 0;}
+    virtual Stem_req *stem() { return 0;}
     virtual Text_req*text() { return 0; }
-    virtual Rest_req *rest() {return 0;}
-    virtual Span_req *span() {return 0;}
+    virtual Rest_req *rest() { return 0; }
+    virtual Span_req *span() { return 0; }
     virtual Beam_req *beam() { return 0 ; }
     virtual Slur_req *slur() { return 0 ; }
     virtual Rhythmic_req*rhythmic() { return 0; }
     virtual Lyric_req* lreq_l() { return 0; }
     virtual Melodic_req *melodic() { return 0; }
-    virtual Mark_req * mark() { return 0; }
-    virtual Staff_command_req* command() { return 0;}
     virtual Terminate_voice_req *terminate() {return 0;}
     virtual Group_change_req * groupchange() { return 0;}
     virtual Group_feature_req * groupfeature() { return 0; }
     virtual Spacing_req * spacing() { return 0; }
     virtual Blank_req * blank() { return 0; }
+    virtual Musical_req *musical() { return 0; }
+    virtual Nonmusical_req * nonmus() { return 0; }
 protected:
     virtual void do_print()const ;
 };
@@ -58,271 +65,5 @@ virtual T * accessor() { return this;}\
 virtual const char* name() const { return #T; }\
 virtual Request *clone() const { return  new T(*this); } \
 virtual void do_print() const
-       
-struct Barcheck_req : Request {
-    REQUESTMETHODS(Barcheck_req,barcheck);
-};
-
-struct Terminate_voice_req : Request {
-    REQUESTMETHODS(Terminate_voice_req,terminate);
-};
-
-struct Group_feature_req : Request {
-    int stemdir_i_;
-    Group_feature_req();
-    REQUESTMETHODS(Group_feature_req, groupfeature);
-};
-
-struct Group_change_req : Request {
-    String newgroup_str_;
-    REQUESTMETHODS(Group_change_req, groupchange);
-};
-
-/// a request with a duration
-struct Rhythmic_req : virtual Request {
-    int balltype;
-    int dots;
-    Moment plet_factor;
-    /* *************** */
-    static int compare(const Rhythmic_req &, const Rhythmic_req &);
-    Moment duration() const;
-    Rhythmic_req();
-    Rhythmic_req(int,int);
-    REQUESTMETHODS(Rhythmic_req, rhythmic);
-};
-
-struct Spacing_req :virtual Request {
-    Moment next;
-    Real distance;
-    Real strength;
-    /* *************** */
-    Spacing_req();
-    REQUESTMETHODS(Spacing_req, spacing);
-};
-
-struct Blank_req : Spacing_req, Rhythmic_req {
-    REQUESTMETHODS(Spacing_req, spacing);
-    
-};
-
-///Put a text above or below (?) this staff.
-struct Text_req : virtual Request {
-    int dir_i_;
-    Text_def *tdef_p_;
-    /* *************** */
-    Text_req(int d, Text_def*);
-    ~Text_req();
-    Text_req(Text_req const&);
-    static int compare(const Text_req&,const Text_req&);
-    REQUESTMETHODS(Text_req,text);
-};
-
-
-struct Lyric_req : public Rhythmic_req, Text_req {
-
-    Lyric_req(Text_def* t_p);
-    REQUESTMETHODS(Lyric_req, lreq_l);
-};
-
-/// request which has some kind of pitch
-struct Melodic_req :virtual  Request
-{
-    /// 0 is c
-    int notename;
-    int octave;
-    int accidental;
-    bool forceacc;
-
-    // return height from central c (in halflines)
-    int height()const; 
-    Melodic_req();
-   
-    REQUESTMETHODS(Melodic_req,melodic);
-};
-
-/// Put a note of specified type, height, and with accidental on the staff.
-struct Note_req : Rhythmic_req, virtual Melodic_req {
-    
-
-    Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); }
-    REQUESTMETHODS(Note_req, note);
- };
-/**
-*/
-
-
-///Put a rest on the staff.
-/**
-Why a request? It might be a good idea to not typeset the rest, if the paper is too crowded.
-*/
-
-struct Rest_req : Rhythmic_req {
-
- REQUESTMETHODS(Rest_req,rest);
-};
-/// attach a stem to the noteball
-/**
-  Rhythmic_req parent needed to  determine if it will fit inside a beam.
-  */
-
-struct Stem_req : Rhythmic_req {
-    int dir_i_;
-    Stem_req(int s, int dots);
-    REQUESTMETHODS(Stem_req,stem);
-};
-
-/// requests to start or stop something.
-/**
- This type of request typically results in the creation of a #Spanner#
-*/
-struct Span_req : Request {
-    /// should the spanner start or stop, or is it unwanted?
-    enum {
-       NOSPAN, START, STOP
-    } spantype ;
-    static int compare(const Span_req &r1, const Span_req &r2);
-    REQUESTMETHODS(Span_req,span);
-
-    Span_req();
-  
-};
-
-
-///Start / stop a beam at this note.
-
-/**   if #nplet# is set, the staff will try to put an
-appropriate number over the beam
-    */
-struct Beam_req : Span_req {
-    int nplet;
-
-    /* *************** */
-     REQUESTMETHODS(Beam_req,beam);
-
-    Beam_req();
-};
-
-/// a slur
-struct Slur_req : Span_req {
- REQUESTMETHODS(Slur_req,slur);
-
-};
-
-
-///Put a script above or below this ``note''    
-/** eg upbow, downbow. Why a request? These symbols may conflict with
-slurs and brackets, so this also a request */
-struct Script_req : Request {
-    int dir_i_;
-    Script_def *scriptdef_p_;
-
-    /* *************** */
-    static int compare(const Script_req &, const Script_req &);
-    Script_req(int d, Script_def*);
-    REQUESTMETHODS(Script_req,script);
-    ~Script_req();
-    Script_req(Script_req const&);
-};
-
-
-/// designate this spot with a name.
-struct Mark_req : Request {
-    String mark_str_;
-    /* *************** */
-    Mark_req(String);
-    REQUESTMETHODS(Mark_req,mark);
-};
-
-struct Staff_command_req : Request {
-    Input_command * com_p_;
-    /* *************** */
-    Staff_command_req(Staff_command_req const&);
-    ~Staff_command_req();
-    Staff_command_req(Input_command*);
-    REQUESTMETHODS(Staff_command_req,command);
-};
-
-#if 0
-
-
-///Draw a (Guitar) chord above or below this ``note''
-/**
-Why a request?
-Because everything else is done in requests.
-*/
-struct Chord : Request {
-       // don't know how this looks.
-};
-
 
-/// for absolute dynamics
-enum Loudness {
-    FFF, FF, F, MF, MP, P, PP, PPP
-} ;
-
-
-///Start / stop a slur or a bracket.
-/**
-Start/stop a bracket at this note. if #nplet# is set, the staff will
-try to put an appropriate number over the bracket
-*/
-struct Bracket_req : Span_req {
-    int nplet;                 // print a number over the beam.
-};
-
-struct Subtle_req {
-    Moment subtime;
-};
-
-/// helper in the hierarchy
-/** 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
-    from the start of its note.
-
-    This subfield would come in handy, if mpp96 was adapted for midi
-    support.
-    
-    Dynamic should have been derived from request, but I don't want to
-    fuss with virtual baseclasses.  */
-
-struct Dynamic:Subtle_req {
-
-};
-/// do a crescendo
-struct Cresc_req : Span_req, Dynamic {
-    
-};
-
-/// do a decrescendo
-struct Decresc_req : Span_req, Dynamic {
-    
-};
-
-/// do a dynamic like "fff" or "mp"
-struct Absdynamic_req : Request, Dynamic {
-    Loudness loudness;
-};
-
-struct Grace_req : Subtle_req {
-    
-};
-
-struct Grace_turn_req : Grace_turn {
-    
-};
-
-struct Grace_note : Melodic_req {
-    
-};
-
-struct Grace_notes {
-    
-};
-
-struct Glissando_req : Span_req {
-    
-};
-#endif
 #endif
index 1d2f4022bbb9bd90de0ab062be548ded4a5042e3..8237822219d4d58197454df845f9b3c551029c7f 100644 (file)
 
     */
 
-struct Score_column {
+class Score_column {
+    friend class Score;
+    friend class Score_walker;
 
+    bool musical_b_;
+    Moment when_;
+    void set_breakable();
+public:
     /// indirection to column
     PCol * pcol_l_;
 
     /// length of notes/rests in this column
     Array<Moment> durations;
     
-
-    bool musical_;
-    
     /* *************** */
+
     Moment when() {  return when_; }
     Score_column(Moment when);       
     static int compare(Score_column & c1, Score_column &c2);
     void add_duration(Moment );
     void preprocess();
-    void set_breakable();
+    bool breakable_b();
+    bool musical_b() { return musical_b_; }
     bool used();
     void print() const;
 
-private:
-    Moment when_;
+
 };
 
 instantiate_compare(Score_column&, Score_column::compare);
index cd5a56c5e73279b4952efc41eaa542b55dec3ea9..f48ad356df76b869d7012ed04062aa04c5f68f36 100644 (file)
@@ -1,5 +1,15 @@
+/*
+  score.hh -- declare Score
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
 #ifndef SCORE_HH
 #define SCORE_HH
+
 #include "varray.hh"
 #include "proto.hh"
 #include "plist.hh"
@@ -20,8 +30,6 @@ struct Score {
     const char *defined_ch_c_l_;
     int errorlevel_i_;
     
-    Assoc<String, Moment> markers_assoc_;
-
     /* *************************************************************** */
 
     /// construction
@@ -29,7 +37,6 @@ struct Score {
     ~Score();    
     void add(Staff*);
 
-    void add_marks(Array<String>, Array<Moment>);
     /// do everything except outputting to file
     void process();
     
@@ -40,16 +47,18 @@ struct Score {
     void OK() const;
     void print() const;
 
-    // utils:
-    PCursor<Score_column*> create_cols(Moment);
-
-    /// find a column. The cursor is given to try a little efficiency.
+    /// find a column.
     PCursor<Score_column *> find_col(Moment,bool);
     
     /// when does the last *musical* element finish?
     Moment last() const;
 
 private:
+    void setup_music();
+    void process_music();
+    // utils:
+    PCursor<Score_column*> create_cols(Moment);
+
     Score(Score const&){}
 
     /**
diff --git a/hdr/scorewalker.hh b/hdr/scorewalker.hh
new file mode 100644 (file)
index 0000000..0bfc991
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+  scorewalker.hh -- declare Score_walker
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef SCOREWALKER_HH
+#define SCOREWALKER_HH
+#include "pcursor.hh"
+#include "proto.hh"
+#include "varray.hh"
+
+
+/**
+  walk through the score_columns, and while doing so, walk all staffs in a score.
+  */
+class Score_walker : public PCursor<Score_column *>
+{
+    /// walkers for the individual staves.
+    Array<Staff_walker *> walker_p_arr_;
+    Array<Staff_walker *> disallow_break_walk_l_arr;
+    int disallow_break_count_;
+    void reinit();
+public:
+    void allow_break(Staff_walker*w);
+    Score_walker(Score*);
+    ~Score_walker();
+    Moment when();
+    void operator++(int);
+    /// process staff walkers. 
+    void process();
+};
+#endif // SCOREWALKER_HH
index b9d00f46509f04374a2d8578da28859cd8eb3c84..063905baaa91821727e026813cc34355220750bb 100644 (file)
@@ -16,7 +16,7 @@ public:
     Source_file* sourcefile_l( char const* ch_c_l );
 
 private:
-    IPointerList<Source_file*> sourcefile_p_iplist_m;
+    IPointerList<Source_file*> sourcefile_p_iplist_;
 };
 
 #endif // SOURCE_HH //
index f92631dbe06db523704c6fbe917f5279d9ddd4cf..a52e76f66a30052453bdf8162a9b4195239bf1d2 100644 (file)
@@ -11,7 +11,7 @@ class Source_file
 {
 public:
     /**
-      RETURN path to opened file.
+      @return path to opened file.
      */
     Source_file( String &filename_str );
     ~Source_file();
@@ -29,11 +29,11 @@ private:
     void open();
     void unmap();
 
-    istream* istream_p_m;
-    int fildes_i_m;
-    String name_str_m;
-    off_t size_off_m;
-    caddr_t data_caddr_m;
+    istream* istream_p_;
+    int fildes_i_;
+    String name_str_;
+    off_t size_off_;
+    caddr_t data_caddr_;
 };
 
 #endif // SOURCE_FILE_HH //
index 097a592cd608bf7edc898301375220060ebd3ceb..878d48d6e02b35ef4e2cf66d86077048796aa137 100644 (file)
@@ -10,8 +10,8 @@
 #include "proto.hh"
 #include "staffelem.hh"
 
-/// a symbol which is attached between two columns.
-/** A spanner is a symbol which spans across several columns, so its
+
+/** a symbol which is attached between two columns. A spanner is a symbol which spans across several columns, so its
   final appearance can only be calculated after the breaking problem
   is solved.
 
@@ -42,9 +42,9 @@ struct Spanner:Staff_elem {
     Spanner *broken_at(PCol *c1,  PCol *c2) const;
     virtual Spanner* spanner() { return this; }
 protected:
-    /// clone a piece of  this spanner.
+
     /**
+  clone a piece of  this spanner.
     PRE
     c1 >= start, c2  <= stop
     */
index 6f43293b264c6baa188181a1b8401b1eee200059..4c507c4b5bb1ccedb2c18879d742a953b2f35a48 100644 (file)
@@ -1,45 +1,41 @@
+/*
+  staff.hh -- declare Staff
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
 #ifndef STAFF_HH
 #define STAFF_HH
 
-#include "staffcommands.hh"
-
+#include "plist.hh"
+#include "proto.hh"
+#include "moment.hh"
 
 /// base class for a collection of voices.
-struct Staff {
+class Staff {
+    Staff_column *get_col(Moment, PCursor<Staff_column*> * last= 0);
+    Staff(const Staff&src);
+    
     /// synchronous horizontal stuff
-    IPointerList<Voice*> voices;
+    IPointerList<Voice*> voice_list_;
+
+public:
 
     /// runtime field
     IPointerList<Staff_column*> cols;
 
     Score *score_l_;
     PScore *pscore_l_;
-    String define_spot_str_;
 
     /* *************************************************************** */
 
-    void add(PointerList<Voice*> &s);
-    void do_commands(PointerList<Input_command*> score_wide,
-                    PointerList<Input_command*> staff_wide);
+    void add(const PointerList<Voice*> &s);
 
-    void get_marks(Array<String>&, Array<Moment>&);
-    
-    /// 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#.
-    /**
-    This routines calls virtual functions from Staff, to delegate the
-    interpretation of requests to a derived class of Staff */
-    void process();
 
-    
     void setup_staffcols();
 
     void OK() const;
@@ -50,22 +46,12 @@ struct Staff {
 
     /// remove unused cols
     void clean_cols() ;
-    
-    Staff_column *get_col(Moment,bool); // ugh
-
     Staff();
-
-    /* 
-      VIRTUALS
-      */
-
+    
     virtual void set_output(PScore * destination)=0;
-    virtual void walk()=0;    
-    virtual Staff_column * create_col(Score_column * )=0;
+    virtual Staff_walker *get_walker_p()=0;    
     virtual ~Staff() { }
-private:
-    void set_time_descriptions();
+protected:
+    virtual Staff_column * create_col()=0;
 };
 #endif
-
-
diff --git a/hdr/staffcommands.hh b/hdr/staffcommands.hh
deleted file mode 100644 (file)
index 1caead8..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-  lilypond, (c) 1996,97 Han-Wen Nienhuys
-*/
-#ifndef SCORECOMMANDS_HH
-#define SCORECOMMANDS_HH
-
-#include "proto.hh"
-#include "command.hh"
-#include "varray.hh"
-#include "plist.hh"
-#include "timedescription.hh"
-
-
-struct Staff_commands_at : public IPointerList<Command*> {
-    Time_description tdescription_;
-    
-    /* *************** */
-    
-    bool is_breakable();
-    Moment when();
-    Staff_commands_at(Time_description);
-    void set_breakable();
-    void add_command_to_break(Command pre, Command mid,Command post);
-    void print() const;
-    void OK() const;
-    void insert_between(Command victim, PCursor<Command*> firstc,
-                       PCursor<Command*> last);
-    void add(Command c);
-};
-
-#endif
-
diff --git a/hdr/staffeleminfo.hh b/hdr/staffeleminfo.hh
new file mode 100644 (file)
index 0000000..b8af8ae
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+  staffeleminfo.hh -- declare Staff_elem_info
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef STAFFELEMINFO_HH
+#define STAFFELEMINFO_HH
+
+#include "proto.hh"
+
+/// data container.
+struct Staff_elem_info {
+    Staff_elem * elem_p_;
+    Request*req_l_;
+    const Voice * voice_l_;
+    Voice_group_registers * group_regs_l_; 
+    Request_register * origin_reg_l_;
+
+    /* *** */
+    Staff_elem_info(Staff_elem*, Request*, Request_register*);
+    Staff_elem_info();
+};
+
+#endif // STAFFELEMINFO_HH
index 3b78c29c6b75493dfdc4c6ca0238ef6a40cbee39..aed371ef32d57d10bc28bac29fe16469fdc84919 100644 (file)
@@ -1,14 +1,15 @@
-
 /*
-  staffwalker.hh -- part of LilyPond
-
+  staffwalker.hh -- declare Staff_walker
+  
   (c) 1996,97 Han-Wen Nienhuys
 */
 
 #ifndef STAFFWALKER_HH
 #define STAFFWALKER_HH
 
-#include "staff.hh"
+#include "proto.hh"
+#include "timedescription.hh"
+#include "pcursor.hh"
 
 /**
   manage run-time info when walking staffcolumns such as: key,
 struct Staff_walker : public PCursor<Staff_column*> {
     Staff * staff_l_;
     PScore * pscore_l_;
-
-    int break_status;
+    Score_walker *score_walk_l_;
+    Time_description time_;
+    Rhythmic_grouping *default_grouping;
     
     /* *************** */
 
-    int priority() const;              // Command
     Moment when() const;    
     virtual ~Staff_walker();
     Staff_walker(Staff*, PScore*);
     void process() ;
-    void process_command(Command *);
-    void operator++(int);
 
-    /* ***************
-      VIRTUAL
-     *************** */
+    void operator++(int);
+    void allow_break();
 
-    /// every time ++ is called
+protected:
+    /// every time before ++ is called
     virtual void do_pre_move(){}
+    /// every time after ++ is called
     virtual void do_post_move(){}
     virtual void process_requests()=0;
-    virtual void do_TYPESET_command(Command*)=0;
-    virtual void do_INTERPRET_command(Command*)=0 ;
 private:
+    void process_timing_reqs();
     Staff_walker(Staff_walker const&);
 };
 
index 0ae5244d8a6751d9c8a366bb81f69f2ad26c9bd3..613dffb7583ba727792cab70c382d9df2b2f05a8 100644 (file)
 #include "moment.hh"
 
 /// store simultaneous requests
-struct Staff_column {
-
-    Score_column *score_column_l_;
-
-    /// fields to collect data vertically.
-    Array<Voice_element *> v_elts;
-
-    /// idem
-    Staff_commands_at *staff_commands_p_;
+class Staff_column {
+    Staff_column(Staff_column const&);
+public:
+    /// fields to collect timing data vertically.
+    Array<Timing_req*> timing_req_l_arr_;
+    Score_column *musical_column_l_, *command_column_l_;
 
-    Time_description *tdescription_;
-    
     /* *************** */
     
-    Staff_column(Score_column*); 
-    bool musical_b() const;
+    Staff_column();
+
     Moment when() const;
+    void set_cols(Score_column *c1, Score_column *c2);
     void add(Voice_element*ve);
     void OK() const;
-    /*
-      VIRTUAL
-    */
+    virtual ~Staff_column();
 
-    virtual void setup_requests()=0;
 
-    virtual ~Staff_column();
-private:
-    Staff_column(Staff_column const&);
+protected:
+    virtual void setup_one_request(Request*)=0;
+
 };
 
 
index 962d1f4ba3ffba7d302383fff19846115a1bde23..ccc02a6b594a561f223860b7f6813d60817b452c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  stem.hh -- 
+  stem.hh -- declare Stem
 
   (c) 1996,97 Han-Wen Nienhuys
 */
@@ -10,8 +10,8 @@
 #include "varray.hh"
 #include "moment.hh"
 
-/// the rule attached to the ball
-/**
+
+/**the rule attached to the ball.
   takes care of:
 
   \begin{itemize}
   */
 
 struct Stem : Item {
-/*
-    /// rhythmical length
-    Moment note_length;
-    */  
-    // heads the stem encompasses (positions)
+    /// heads that the stem encompasses (positions)
     int minnote, maxnote;
 
     /// false if in beam
@@ -38,8 +34,8 @@ struct Stem : Item {
     /// needed for determining direction/length
     int staff_center;
 
-    // extent of the stem (positions)
-    /**
+
+    /**extent of the stem (positions).
       fractional, since Beam has to adapt them.
       */
 
@@ -49,8 +45,9 @@ struct Stem : Item {
     /// flagtype? 4 none, 8 8th flag, 0 = beam.
     int flag;
 
-    ///geen gedonder, jij gaat onder
+
     /**
+      geen gedonder, jij gaat onder.
        -1 stem points down, +1: stem points up
        */
 
index baff1c634d275b08c567cc1e5c022be12c12077c..af45ba7d27c68d073f778d7375ef8bf50a04f9cb 100644 (file)
@@ -5,8 +5,7 @@
 #include "boxes.hh"
 #include "scalar.hh"
 
-/// parameter substitution in TeXstrings
-/**
+/** parameter substitution in TeXstrings.
   this function provides a simple macro mechanism:
 
   if source == "tex%bla%", then
index 8100ed45d88992c1dfa89a349e297f02b4c1ab67..da0055281d7e34e183a28df8d7204632ed1c2cdf 100644 (file)
@@ -14,7 +14,7 @@ struct Text_def  {
     int align_i_;
     String text_str_;
     String style_str_;
-    char const* defined_ch_c_l_m;
+    char const* defined_ch_c_l_;
   
 
     /* ****************/
index 40ae5ffa640706156a141e6fa495347a83f33900..586d25a5d84114ca955d9e8f869e13954c7d6213 100644 (file)
 #include "directionalspanner.hh"
 #include "textdef.hh"
 
-/// a spanner which puts texts on top of other spanners.
-/**
-  Use for triplets, eentweetjes, ottava, etc.
-  */
+/** a spanner which puts texts on top of other spanners.  Use for
+  triplets, eentweetjes, ottava, etc.  */
 struct Text_spanner : Spanner {
     Text_def spec;
     Offset text_off_;
index 4eb5db119464916f1e8b8b362de77f1ab399280c..7e366ec4c2b12ca86fd8e5f69c79328c6d0dfe46 100644 (file)
@@ -7,32 +7,32 @@
 #ifndef tdes_HH
 #define tdes_HH
 
-#include "real.hh"
 #include "moment.hh"
 
 /// full info on where we are
 struct Time_description {
-    Moment when;
+    Moment when_;
 
     /// if true, no bars needed, no reduction of whole_in_measure
     bool cadenza_b_;
     
     /// current measure info
-    Moment whole_per_measure;
+    Moment whole_per_measure_;
 
     /// where am i 
-    Moment whole_in_measure;
+    Moment whole_in_measure_;
 
     /// how long is one beat?
-    Moment one_beat;
+    Moment one_beat_;
 
     /// idem
-    int bars;
+    int bars_i_;
 
     /* *************** */
     void set_cadenza(bool);
     void OK() const;
-    Time_description(Moment, const Time_description*);
+    Time_description();
+    void add(Moment dt);
     String str()const;
     void print() const;
     void setpartial(Moment p);
index 27ec95cd165f9a8a2b748839af4806e8c3d168b3..4d5805c556b27aafe00ea8145da2330c023707bd 100644 (file)
@@ -4,8 +4,8 @@
 #include <iostream.h>
 #include "string.hh"
 
-/// TeX output
-/**
+
+/** TeX output.
   Use this class for writing to a TeX file.
   It counts braces to prevent nesting errors, and
   it will add a comment sign before each newline.
index 20538ae861743767f2ac9fdf7301772f095f9d8a..4d282ddea176c61697abb511d83d7c8f27a2f1c4 100644 (file)
@@ -5,8 +5,7 @@
 #include "plist.hh"
 #include "moment.hh"
 
-/// class for  horizontal stuff.
-/**
+/** class for  horizontal stuff.
 
     Voice is a ordered row of Voice_elements. It is strictly horizontal:
     you cannot have two rhythmic elements running parallel in a Voice
@@ -26,12 +25,12 @@ struct Voice {
     void print() const;
     void set_default_group(String id);
 };
-/// one horizontal bit. 
-/** Apart from being a container for the requests, Voice_element is nothing
+
+/** one horizontal bit.  Apart from being a container for the requests, Voice_element is nothing
     */
 struct Voice_element {
     Moment duration;
-    char const* defined_ch_c_l_m;
+    char const* defined_ch_c_l_;
     const Voice *voice_l_;
     IPointerList<Request*> reqs;
 
index 7c61810970ad32dbbb93c97dbcdb589ce6c4b17d..689f935b0f3e58f8e00d0c16fe74e278cb7e4a62 100644 (file)
@@ -72,11 +72,11 @@ symboltables {
      }
 
      "bars" = table {
-       "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
+       "empty" "\emptybar"             0pt     0pt     0pt     0pt
+       "|"     "\maatstreep"           0pt     0.4pt   -8pt    8pt
+       "||"    "\finishbar"            0pt     2pt     -8pt    8pt
+       ":|"    "\repeatbar"            -4pt    0pt     -8pt    8pt
+       "|:"    "\startrepeat"          0pt     4pt     -8pt    8pt
        ":|:"   "\repeatbarstartrepeat" 0pt     16pt    -8pt    8pt
 
      }
@@ -97,7 +97,7 @@ symboltables {
 
      % dims ignored for this table
      "param" = table {
-            "meter"    "\generalmeter{%}{%}"   -3pt    10pt    -5pt    5pt
+            "meter"    "\generalmeter{%}{%}"   0pt     10pt    -5pt    5pt
             "linestaf" "\linestafsym{%}{%}"
             "stem"     "\stem{%}{%}"           
             "fill"     "\hbox{}"
index c9888dd680c8e1f6ede0a0d2aa962b2a270a2dbd..885dcf19a9ebd373203898ffe80f27d7fb1c261d 100644 (file)
@@ -4,7 +4,7 @@ DISTFILES=Makefile  kortjakje.ly pavane.ly  maartje.ly\
        cadenza.ly scales.ly standchen.ly twinkle.ly\
        wohltemperirt.ly error.ly\
        martien.ly mlalt.ly mlvio1.ly mlvio2.ly mlcello.ly\
-       coriolan-alto.ly\
+       coriolan-alto.ly rhythm.ly \
        standchen.tex pavane.tex scsii-menuetto.tex scsii-menuetto.ly\
        martien.tex
 
index 3f32d19de38c6b0c2308805b082f797c726586cb..6773143fea3eef97ab42958ab2280318dd53c67a 100644 (file)
@@ -7,53 +7,50 @@
 cad = music { $
        \duration { 8}
        \textstyle "italic"
-       \command { \clef \violin }
+       \clef \violin 
        'c4._"f" g8
        \textstyle  "roman" 
 
        ['e^"accel" ()'d 'c b]
        [b()'c] g-\fermata
-               \command { \bar \empty }
+               \bar \empty
                        c [c_"rubato" e g 'c]
        \octave{'}
        e4. e [g ()f_"rit" e d]
 
        \duration{16}
        dis4()e4
-               \command { \bar \empty }
+               \bar \empty 
                r8 [c d] [e f g gis]
        \duration{4}
        a-> `f()`e g
        f-> `d()`cis e
        \duration{8}    
        d4^\fermata
-               \command { \bar \empty }
+               \bar \empty 
 
        r8 `a [`b cis]
        \duration{16}   [d cis d e]
        f4()[f e d c]
        `b4
-       \octave{} \plet{2/3} ['d8 'c8 a8]
-       \plet{1/1}
+       \octave{} \plet{2/3} ['d8 'c8 a8] \plet{1/1}
        g2
-               \command { \bar \empty }
+               \bar \empty 
        [g c e g] ['c e g 'c]\octave{'} 
        [e `g c e] g4^\fermata %()% BUG!
-               \command { \bar \empty }
+               \bar \empty 
        [g8.(_"a tempo" e g8. )e]
        a4. g8 [f8 e8 d8 c8]
        `g2 d2^"tr"
        c4
        $}
 
-       score {
+score {
        staff { melodic
                music { cad }
-               
        }
        commands {
-               meter 4*4
-               cadenza 1
-               grouping 1*4
+               cadenza $1$
+               grouping{1*4}
        }
 }
index 959c4d79a3b4bc2a10849f824cfafc5b0129d0af..683141814d55773b7bbd06f9a11221854ee22d86 100644 (file)
@@ -14,7 +14,9 @@
 alto = music { 
        $
        \duration{ 8 }
-
+       \key {$bes es as$}
+               
+       }                       \clef "alto"
        % these are chords (i.e. non-divisi)
        % that-s why i-d rather type chords, 
        % but how to type slurs?
@@ -68,15 +70,10 @@ alto = music {
 }
 
 score {
-       staff { melodic music { alto }
-               commands {
-                       clef "alto"
-                       key $c es as$ % c ??? 
-               }
-       }
+       staff { melodic music { alto }}
+
        commands { 
-               meter 4*4
-               skip 5:0
+               meter {4*4} grouping {4*4}
        }
        paper { 
                unitspace 14mm
index 9cc63116978f73466b34157b3345086d4706c482..922f9ebefd4641649d81c036c8c4d95d1dd7078a 100644 (file)
@@ -1,8 +1,7 @@
 mwa = music {
        $
-%      [ a8 a8 a8 a8 a8 ]      % assertion fail
-%      [ a8 a8 a8 ]    % assertion fail
-%      [ a8 ]  % assertion fail
+       [ a8 a8 a8 a8 a8 ]      % 
+       [ a8 ]  % 
        a ) b ] c       % warning
        &               % ok; error
        a b ) ]         % ok; error
@@ -37,6 +36,6 @@ score {
                melodic music { mwa }
        }
        commands {
-               meter 3*4
+               meter {3*4}
        }
 }
index ba78402109039db5fb9255e604e916af95ca9024..6da101c266ca06b3774aa611b4207ced558dd4ec 100644 (file)
@@ -11,6 +11,7 @@
 
 melodie = music {
        $                       % switch Lilypond in note-mode
+       \clef\violin
        \octave {}              % set the default octave
        % the default note duratino is 4
        %%% theme
@@ -32,7 +33,7 @@ $}
 
                                % more of this.
 begeleiding =
-$
+$      \clef "bass"            % bass-clef
        \music {                % as you can see, the $ sign obliges 
                                % you to precede keyword by a backslash: \
        \octave { ` }           % default octave: 1 below the first octave.
@@ -53,16 +54,12 @@ $
 bstaf = staff {
        melodic
        music { begeleiding }   % use the declared music
-               commands {      % commands with Staff-wide impact.
-                       clef "bass"     % bass-clef
-               }
        }
 
 % another one
 vstaf = staff {
        melodic
                music { melodie }
-               commands { clef "violin" }
                                % default clef is violin clef
        }
 
@@ -74,9 +71,7 @@ score {
                unitspace 2.5cm % a whole note takes 2.5 cm ideally.
        }
        commands {
-               meter 2* 4      % a 2/4 meter.
-               skip 33:0       % skip 32 measures, and generate the bars
-%              meter 6 8       % another meter
+               meter {2* 4}    % a 2/4 meter.
        }
 }
 
index 0f96005edff5e538639e54c0cf43a31e38253e7d..9a79cf47c3abecd803ea6495a0cc159d28f24444 100644 (file)
@@ -26,7 +26,7 @@ melody=
 staff {
        melodic
        music{$
-       c8
+       c8\key{fis cis gis}
        |r4 r4 r4 r4
        |'cis2..        r8
        | r4 r8 r16 r32 r32 
@@ -45,19 +45,11 @@ staff {
        |''fis2
        | a8 b8 'c8 'd8 |''c8 ```c8 c4 |c4  c4 |c4
        \duration{ 16 } `b `a `g `f \duration{ 4}
-       
+       \clef\bass      
 
        |c `b `a `g `f `e `d `c ``b ``a ``g ``f ``e ``d ``c
        $}
 
-       commands {
-               skip 3:0
-               key $ fis cis gis $
-               skip 2:0
-               key 
-               skip 5:0
-               clef bass
-       }
 }
 
 score {
@@ -68,13 +60,13 @@ score {
 %      staff { ritme }%broken for now
        staff { melody }
        commands {
-               meter 4* 4
+               meter {4* 4}
                partial 8
-               skip 1:2
+               skip 3*2
                bar ":|:"
-               skip 2:0
-               meter 2* 4
-               skip 19:0
+               skip 2*1
+               meter {2*4}
+
        }
 }
 
index b299340b3aa11cc80423719ccb718aadb0d29dd1..cf40cc97886f571e06c3cb778d8248a329853da8 100644 (file)
@@ -1,3 +1,6 @@
+%%%%%%%%% HAS TO BE ADJUSTED to pl32
+
+
 % martien.ly
 %
 % Viola Quartet
@@ -23,83 +26,30 @@ score {
        staff { 
                melodic 
                music { alto }
-               commands {
-%                      meter 2*4
-                       clef "alto"
-                       key $fis$
-                       skip 56:0
-                       key $bes es as$
-                       skip 8:0
-%                      meter 6*8
-                       skip 8:0
-%                      meter 2*4
-                       skip 16:0
-                       key $fis$
-               }
        }
        staff { 
                melodic 
                music { violin1 }
-               commands {
-%                      meter 2*4
-                       clef "violin"
-                       key $fis$
-                       skip 56:0
-                       key $bes es as$
-                       skip 8:0
-%                      meter 6*8
-                       skip 8:0
-%                      meter 2*4
-                       skip 16:0
-                       key $fis$
-               }
        }
        staff { 
                melodic 
                music { violin2 }
-               commands {
-%                      meter 2*4
-                       clef "violin"
-                       key $fis$
-                       skip 56:0
-                       key $bes es as$
-                       skip 8:0
-%                      meter 6*8
-                       skip 8:0
-%                      meter 2*4
-                       skip 16:0
-                       key $fis$
-               }
        } 
        staff { 
                melodic 
                music { cello }
-               commands {
-%                      meter 2*4
-                       clef "bass"
-                       key $fis$
-                       skip 56:0
-                       key $bes es as$
-                       skip 8:0
-%                      meter 6*8
-                       skip 8:0
-%                      meter 2*4
-                       skip 16:0
-                       key $fis$
-               }
        } 
        commands {
-               meter 2*4
-               skip 56:0
-               bar "||"
-               skip 8:0
-               meter 6*8
-               bar "||"
-               skip 8:0
-               meter 2*4
-               bar "||"
-               skip 16:0
-               bar "||"
+               meter {2*4}
+               key $fis$
+               skip 56*2
+               key $bes es as$
+               skip 8*2
+               meter {6*8}
+               skip 48*8
+               meter {2*4}
+               skip 16*2
+               key $fis$
        }
        paper {
 %              unitspace 16mm
index 9058f25dd264e9c5c60e46036956183ccee672ed..51f7de87423634135e65fb353b472f152c930584 100644 (file)
@@ -14,6 +14,7 @@
 alto = music { 
        $
        \duration{16}
+       \clef\alto
        \octave{}
 %1
         [ `b8. `a ] [ `g8 `b c ] |
index 5795bb44c1b819388ed35e89a07fe7b472ff5dda..cdc0b433483a50678ffeb416b6edba1188455fec 100644 (file)
@@ -13,7 +13,7 @@
 %
 cello = music { 
        $
-       \octave{`}
+\clef"bass"    \octave{`}
        \duration{4}
 %%1
        g `g |
index 7ea613f53c2b065fa4f843ca973f7e7441320d16..a6f2b049f44a9a4a0b778b3707f624b3728b8e18 100644 (file)
@@ -13,6 +13,7 @@
 %
 violin1 = music { 
        $
+\clef "violin"
        \octave{}
        \duration{4}
 %1
index 0a9df42f3f7ed3ec0943fa653ba3215eff2d00fe..ad6deb44a41f465ed16703b801edf9119af0b5e9 100644 (file)
@@ -13,7 +13,7 @@
 %
 violin2 = music { 
        $
-       \octave{}
+\clef "violin" \octave{}
        \duration{4}
 %1
        d2 |
index e3b1e50e0663cf9ff171f6bfb9de542bb07297dc..4f0b3b8812b390b1b3bbdc4e74a67997fe3597f0 100644 (file)
@@ -15,6 +15,7 @@ staff {
        melodic
        music{  $
        \octave { ' }
+       \key{  fis cis }
        \duration { 8 }
 
 % 1
@@ -39,8 +40,8 @@ staff {
        e4( fis4 () [fis e fis gis]     |
        cis4 `b4())`b8 r8 r4^"tr\`es soutenu"   |
 
      \command { \meter 2 *4 } r4 r4  |
      \command { \meter 4 *4 }
\meter {2 *4} r4 r4   |
\meter {4 *4}
        'cis4_"\dyn ppp"( 'd4 () ['d 'cis 'd 'e] |
        a4 )gis2.       |
        a4 (b4()[b a b 'cis]    |
@@ -76,8 +77,9 @@ staff {
        | [f a 'c] \plet{1/1} 'e4-^ () ['e f-> a-> 'c->]        |
        'e4._"sf" 'e8()'c4 r4 |
        r1      |
-       \command { \meter 2 *4 } r4 r4-\fermata
-       \command { \meter 4 *4 }
+       \meter {2 *4}
+       r4 r4-\fermata
+       \meter {4 *4}
 
        \octave { ' }
        |d2(( [)d e cis `b]     |
@@ -94,10 +96,7 @@ staff {
        )b [fis a b ] 'cis4 b4  |
        fis2 r2 |
        r1-\fermata     
-               $}
-       commands {      
-               key  $fis cis $
-       }
+       $}
 }
 score {
        staff {
@@ -110,14 +109,12 @@ score {
                width 12cm
        }
        commands  {
-               meter 4 *4
-               skip 18:0
-               skip 1:0
-               skip 20:0
+               meter {4 *4}
+               skip 39*1
                bar "|:"
-               skip 10:0
+               skip 10*1
                bar ":|"
-               skip 13:0
+               skip 13*1
                bar "||"
        }
 }
\ No newline at end of file
diff --git a/input/rhythm.ly b/input/rhythm.ly
new file mode 100644 (file)
index 0000000..c74c9d8
--- /dev/null
@@ -0,0 +1,60 @@
+%
+%      I've got rhythm!
+%
+% add any impressive examples here, please
+
+ritme = staff {
+       melodic
+
+       music { $
+       c8                                      |
+
+       [a8() a8. a8 a16 a16 a16] c4.           |       % watch the beams!
+        r32 r32 r16 r8 r4 r2                   |
+       \meter{  5*16}
+
+       % divide measure in 5 equal parts. Usually it 2+3 or 3+2
+       \grouping { 5*16 }      
+       [c8 c16 c8 ]                            |       % watch THIS!
+       \plet{5/4} [c16 c16 c16 c16]\plet{1/1} |
+       \meter{  2*8}
+       c4                              |
+       c4      c4      c4      c4
+       \meter {4*4}
+       c1 c1 c1
+       
+%      [c16 c16 c16 c16 ]                      |
+%      [c16 c16 c16 c16 c16 ]                  |
+%      [c16 c16 c16 c16 c16 ]                  |       
+       
+       $ }
+
+       commands {      % override "commands" section of Score.
+               partial 1*8
+               meter{ 4*4}
+       }
+}
+another = staff {
+       melodic
+       music { $
+               c1 c1 c1 c4 c4 c4 c4  {\meter 4*4} c1 c1 c1
+       $ }
+}
+
+yanother = staff {
+       melodic
+       music { $
+               c1 c1 c1 c4 c4 c4 c4  c1 c1 c1
+       $ }
+}
+
+score {
+       staff{ritme}
+       staff { another }
+       staff { yanother }
+       commands { meter {4*4 }}
+       paper {
+               unitspace 2cm
+               geometric 1.3
+       }
+}
\ No newline at end of file
index 97d8dd89cb045899cbb9139330df044ae6b7578b..fba2c9ff4d3e63f2d686b1658ea73dc845a81546 100644 (file)
@@ -41,9 +41,8 @@ c1
        |['c b a g][f e d c]
                        
                $}
-       commands {      
-       }
 }
+
 score {
        staff {
        blah
@@ -54,11 +53,8 @@ score {
                geometric 1.4
        }
        commands  {
-                meter 6*8
-                skip 6:0
-               meter 4*4
-               skip 2:0
-               skip 11:0
-
+                meter {6*8}
+                skip 36*8
+               meter {4*4}
        }
 }
index 2e7358db481ce9ef595b1606d3e4dd4462efe69c..00fde25284e75671c79334cebae0054041d51e55 100644 (file)
@@ -28,7 +28,8 @@
 %              % because piece is set very tightly
 %%1            % double comments are included in .tex file
 ii_menuetto = music {
-       $
+       $\clef"alto"
+       \key {bes}
        \octave{}
        \duration{8}
        { a2 f2 d2_"\f" } bes4-.  |
@@ -59,7 +60,7 @@ ii_menuetto = music {
 %      { 'cis2.-\upbow e2. `a2.\stemdown } :||:
        { 'cis2.-\upbow e2. `a2. } | % :||:
 %%9
-%      \clef "violin"
+       \clef "violin"
 %      { 'e2 a2_f\stemdown }
        { 'e2 a2_"\f" }
        [ 'd( 'e16 )'f16 ] |
@@ -76,7 +77,8 @@ ii_menuetto = music {
 % %13
 %      { bes2\stemup g4\stemdown } ( )  f4
 %      { 'c4\stemup e4\stemdown }
-%      { bes2 g4 } f4 { 'c4 e4 } | % \clef "alto" |
+%      { bes2 g4 } f4 { 'c4 e4 } |
+       \clef "alto"% 
        { \multivoice
                \music { \stem{1} bes2 'c4 }
                \music { \stem{-1} g4(\stem{-1}) f4 e4 }% ugh
@@ -125,24 +127,15 @@ ii_menuetto = music {
 score {
        staff { 
                melodic music { ii_menuetto }
-               commands {
-                       key $bes$
-                       clef "alto"     
-                       skip 8:0
-                       clef "violin"
-                       skip 5:0
-                       clef "alto"
-                       skip 12:0
-               }
        }
        commands {
-               meter 3*4
-               skip 8:0
+               meter {3 * 4}
+               skip {24 * 4}% 8 measures
                bar ":|:"
-%              clef "violin"
-               skip 5:0
-%              \clef "alto" 
-               skip 12:0
+
+               skip {15 * 4} % 5 meas.
+
+               skip {36*4}
                bar ":||"
        }
        paper {
@@ -153,4 +146,4 @@ score {
                geometric 1.4
                output "scsii-menuetto.out"
        }
-}
+o}
index 279cd513be7d13dedf171f1cc24436444f5c427a..edc487c9b06999704cf9a201020eb9d462446cc2 100644 (file)
@@ -35,7 +35,7 @@
 %#%%
 %#%\duration8
 %%1
-melodie = music { $ 
+melodie = music { $ \clef\violin
        \duration{ 8 }
        r_"\pp" { [ d `a-| } f-| { d `a-| } f-| { d `a-| ] } |
 %%2
@@ -194,7 +194,8 @@ melodie = music { $
 $ }
 
 begeleiding = music { $
-       \duration{2}
+\clef\bass
+\duration{2}
        `d r4
 %%2
        ``bes r4
@@ -472,26 +473,19 @@ score {
        staff { 
                melodic 
                music { melodie }
-               commands {
-                       key $bes$
-                       clef "violin"
-               }
        }
        staff { 
                melodic 
                music { begeleiding }
-               commands {
-                       key $bes$
-                       clef "bass"
-               }
        }
        commands { 
-               meter 3*4 
-               skip 4:0
+               meter { 3*4 }
+               key $bes$
+               skip 12*4
                bar ":|"
-               skip 32:0
+               skip 96*4
                bar ":|"
-               skip 22:0
+               skip 66*4
                bar "||"
        }
        paper {
index 80b8be6eee4ed9dc6e4b3f1710eaf50de39c65c8..9b081c43fab54d3900d09f9a65e4bf45915eca40 100644 (file)
@@ -5,7 +5,7 @@
 % Copyright: none
 
 melodie = music {
-       $
+       $\clef\violin
        c c | g g | a a | g g |
        f f | e e | d d8.( e16 | )c2 | % :|
 
@@ -19,7 +19,7 @@ melodie = music {
 }
 
 begeleiding = music {
-       $
+       $\clef \bass
        \octave{`}
        c 'c | 'e 'c | 'f 'c | 'e 'c | 
        'd b | 'c a | f g | c2 | 
@@ -106,13 +106,11 @@ text3 = music {
 mstaf = staff {
        melodic
        music { melodie }
-       commands { clef "violin" }
 }
 
 bass_staf = staff {
        melodic 
        music { begeleiding }
-       commands { clef "bass" }
 }
 
 
@@ -151,8 +149,8 @@ score {
                unitspace 2.5cm
        }
        commands {
-               meter 2 * 4
-               skip 24:0
+               meter {2 * 4}
+               skip 24*2
                bar "||"
        }
 }
index 53187772f919370846ad21f6a031d98d1d9f561e..c4c0f2455e849ea19787103f60baa2a997c47779 100644 (file)
@@ -6,14 +6,17 @@
 %
 
 dux = music { $
-       \duration { \last } 
-        r8-"dux" \stem{-1} ['c16 b] ['c8 g] [as 'c16 b] ['c8 'd] |
+       \clef \violin
+       \duration { \last }
+       \stem{-1}
+       
+        r8-"dux" ['c16 b] ['c8 g] [as 'c16 b] ['c8 'd] |
        [g 'c16 b] ['c8 'd] [f16 g] as4 [g16 f] |
        [es 'c b a] [ g f es d] [c8 'es 'd 'c] |
        [bes a bes 'c] [fis g a fis] |
        g4 r16 [c d es] [f g as8(] [)as16 d es f ]|
        [g a bes8(] [)bes16 es f g ] [as g f es] [d8 'c16 b]|
-       'c4 r4 r8 ['f 'es 'd] |
+       'c4 r4 r8 ['f 'es 'd] 
        r8 [as g f] [g f16 es] [f8 d] | 
 $}
 
@@ -23,47 +26,37 @@ comes = music { $
        \octave {'}
        r8-"comes" [g16 fis] [g8 c] [es g16 f] [g8 a]|
        [d8 g16 fis] [g8 a] [c16 d] es4 [d16 c] |
-       [`bes8 es16 d] [es8 `g8] [`as f16 es] [f8 `a] |
+       [`bes8 es16 d] [es8 `g8] [`as f16 es] [f8 `a] 
        [`bes8 g16 f] [g8 `b] [c8 d16 es] f4( |
-       [) f8 es16 d] [c16 `bes `as `g] [`f8 as g f] |
+       [) f8 es16 d] [c16 `bes `as `g] [`f8 as g f] 
        [es d es f] [`b c d `b] |
        
 $}
 
 bassdux = music { $
+       \clef \bass
        r1 r r r r r
        \octave { }
        r8 [c16 B] [c8 G] [As c16 B] [c8 d] |
        [G c16 B] [c8 d] [F16 G] As4 [G16 F] | $
 }
 
-% will make it look even uglier
 basstaf = staff { melodic
        music { bassdux }
-       commands {
-               clef bass
-               key $bes es as$
-       }
 }
 
 score {
        staff { melodic
-
                % every "music {} " in a staff has its own "voicegroup"
                music { dux }
                music { comes }
                
-               commands {
-                       key $bes es as$
-               }
        }
        staff { basstaf }
-       commands { 
-               meter 4*4
-               skip 8:0
-       }
-       paper { %unitspace 2.5cm
-               %geometric 1.4
+       commands {
+               meter {4*4}
+               grouping {2*2}
+               key {$bes es as$}
        }
 }
 
index 4f26d2531024667eb2dd63d4c7ed59eaa6b87152..ad64e016a66db0d3c2ec1c5db20e2b1c33d52632 100644 (file)
@@ -3,6 +3,7 @@
 #include "molecule.hh"
 #include "paperdef.hh"
 #include "lookup.hh"
+#include "debug.hh"
 
 NAME_METHOD(Bar);
 
@@ -11,11 +12,17 @@ Bar::Bar( String t)
     type = t;
 }
 
+void
+Bar::do_print()const
+{
+    mtor << type;
+}
+
 Molecule*
 Bar::brew_molecule_p()const
 {    
     Symbol s = paper()->lookup_p_->bar(type);
-    Molecule*    output = new Molecule(Atom(s));
+    Molecule*output = new Molecule(Atom(s));
     return output;
 }
     
diff --git a/src/barreg.cc b/src/barreg.cc
new file mode 100644 (file)
index 0000000..03b4949
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+  barreg.cc -- implement Bar_register
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "barreg.hh"
+#include "bar.hh"
+#include "commandrequest.hh"
+#include "complexwalker.hh"
+#include "complexcolumn.hh"
+#include "sccol.hh"
+
+
+Bar_register::Bar_register(Complex_walker*w)
+    : Request_register(w)
+{
+    do_post_move_process();
+}
+
+bool
+Bar_register::try_request(Request*r_l)
+{
+    if (!r_l->nonmus()->bar()) 
+       return false;
+
+    assert(!bar_req_l_);
+    bar_req_l_ = r_l->nonmus()->bar();
+
+    return true;
+}
+
+void
+Bar_register::process_request()
+{
+
+    if (bar_req_l_ ) {
+       bar_p_ = new Bar(bar_req_l_->type);
+    } else if (!walk_l_->time_.whole_in_measure_) {
+       bar_p_ = new Bar("|");
+    }
+    
+    if (bar_p_){
+       walk_l_->allow_break();         
+       announce_element(Staff_elem_info(bar_p_, bar_req_l_, this) );
+    }
+}
+
+void
+Bar_register::split_bar(Bar *& pre, Bar * no, Bar * &post)
+{
+    String s= no->type;
+    if (s == ":|:") {
+       pre = new Bar(":|");
+       post = new Bar("|:");
+    }else if (s=="|:") {
+       post = new Bar(s);
+    } else {
+       pre = new Bar(*no);
+    }
+}
+
+void 
+Bar_register::do_pre_move_process()
+{
+      if (bar_p_) {
+         Bar * post_p =0;
+         Bar * pre_p =0;
+         split_bar(pre_p, bar_p_, post_p);
+         
+         typeset_breakable_item(pre_p, bar_p_, post_p);
+         bar_p_ =0;
+      }
+}
+
+void
+Bar_register::do_post_move_process()
+{
+    bar_req_l_ = 0;
+    bar_p_ =0;
+}
index 44d51e0af9215ba967c7e933a96b3f5891af9a7a..1b0fa2baa3c53f610eb5983aae11e20f0ffa8b48 100644 (file)
@@ -217,7 +217,10 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
        int lhalfs= lhalfs = here->beams_left - prev->beams_right ;
        int lwholebeams= here->beams_left <? prev->beams_right ;
        Real w = (here->hpos() - prev->hpos())/4;
-       Atom a =  paper()->lookup_p_->beam(sl, w);
+       Symbol dummy;
+       Atom a(dummy);
+       if (lhalfs)             // generates warnings if not
+           a =  paper()->lookup_p_->beam(sl, w);
        a.translate(Offset (-w, -w * sl));
        for (int j = 0; j  < lhalfs; j++) {
            Atom b(a);
@@ -239,8 +242,10 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
            b.translate(Offset(0, -dir_i_ * dy * j));
            rightbeams.add( b ); 
        }
+
        w /= 4;
-       a = paper()->lookup_p_->beam(sl, w);
+       if (rhalfs)
+           a = paper()->lookup_p_->beam(sl, w);
        
        for (; j  < rwholebeams + rhalfs; j++) {
            Atom b(a);
index 576bf4c67a3d7c30ecc37751e09f79fdd8670e19..6128fdd097e38049b7cf9385ae72150b017845ea 100644 (file)
@@ -17,7 +17,7 @@ Break_algorithm::find_breaks() const
 {
     Line_of_cols retval;
     for (iter_top(pscore_.cols,c); c.ok(); c++)
-       if (c->breakable())
+       if (c->breakable_b())
            retval.push(c);
     assert(retval.top() == pscore_.cols.bottom().ptr());
     return retval;
@@ -71,7 +71,7 @@ Break_algorithm::problem_OK() const
     iter_top(pscore_.cols,start);
     PCursor<PCol *> end (pscore_.cols.bottom());
     
-    assert(start->breakable());    
-    assert(end->breakable());
+    assert(start->breakable_b());    
+    assert(end->breakable_b());
 #endif
 }
index 79db657588e043ef0a1eb93c6f1bfd7813d5a5ea..a656482e7dca39507df33c16aa3a760da04ec3e6 100644 (file)
@@ -20,7 +20,7 @@ Score::calc_idealspacing()
     for (; i.ok(); i++) {
        assert(i->used());
        PCursor<Score_column*> j(i+1);
-       if (i->musical_) {
+       if (i->musical_b()) {
            assert(j.ok());
            for (int n=0; n < i->durations.size(); n++) {
                Moment d = i->durations[n];
diff --git a/src/clef.cc b/src/clef.cc
deleted file mode 100644 (file)
index bf7b924..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-  clef.cc -- implement  Clef
-
-  source file of the LilyPond music typesetter
-
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>,
-  Mats Bengtsson <matsb@s3.kth.se>
-*/
-
-#include "clef.hh"
-#include "debug.hh"
-
-Clef::Clef()
-{
-    set_type("violin");
-}
-
-void 
-Clef::set_type(String type_str)
-{
-    clef_type_str_  = type_str;
-    if (clef_type_str_ == "violin") {
-       c0_position_i_= -2;
-    } else if (clef_type_str_ == "alto") {
-       c0_position_i_= 4;
-    } else if (clef_type_str_ == "tenor") {
-       c0_position_i_= 6;
-    } else if (clef_type_str_ == "bass") {
-       c0_position_i_= 10;
-    } else
-       error("unknown clef type `"+clef_type_str_+"\'");
-}
index 30703026daf4642fa2aff007bdc23b4d43f21677..037aab69b80aab6504bf11301521b470a598d928 100644 (file)
@@ -1,9 +1,17 @@
+/*
+  clefitem.cc -- implement Clef_item
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
 #include "clefitem.hh"
 #include "string.hh"
 #include "molecule.hh"
 #include "paperdef.hh"
 #include "lookup.hh"
-#include "clef.hh"
+#include "clefreg.hh"
 
 NAME_METHOD(Clef_item);
 
@@ -27,7 +35,7 @@ Clef_item::read(String t)
        y_off = 6;
 }
 void
-Clef_item::read(Clef k)
+Clef_item::read(Clef_register const &k)
 {
     read(k.clef_type_str_);
 }
diff --git a/src/clefreg.cc b/src/clefreg.cc
new file mode 100644 (file)
index 0000000..81c87e9
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+  clef.cc -- implement  Clef_register
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>,
+  Mats Bengtsson <matsb@s3.kth.se>
+*/
+
+#include "clefreg.hh"
+#include "clefitem.hh"
+#include "debug.hh"
+#include "commandrequest.hh"
+#include "timedescription.hh"
+#include "complexwalker.hh"
+#include "stcol.hh"
+
+Clef_register::Clef_register(Complex_walker*w)
+    : Request_register(w)
+{
+    clef_p_ = 0;
+    
+    set_type("violin");
+}
+bool
+Clef_register::set_type(String s)
+{
+    clef_type_str_  = s;
+    if (clef_type_str_ == "violin") {
+       c0_position_i_= -2;
+    } else if (clef_type_str_ == "alto") {
+       c0_position_i_= 4;
+    } else if (clef_type_str_ == "tenor") {
+       c0_position_i_= 6;
+    } else if (clef_type_str_ == "bass") {
+       c0_position_i_= 10;
+    }else 
+       return false;
+    walk_l_->set_c0_position(c0_position_i_);
+    return true;
+}
+
+void 
+Clef_register::read_req(Clef_change_req*c_l)
+{
+    if (!set_type(c_l->clef_str_))
+       error("unknown clef type ", c_l->defined_ch_c_l_);
+}
+
+bool
+Clef_register::try_request(Nonmusical_req* r_l)
+{
+    if (!r_l->clefchange())
+       return false;
+
+    accepted_req_arr_.push(r_l);
+    // do it now! Others have to read c0_pos.
+    read_req(r_l->clefchange()); 
+    return true;
+}
+
+void
+Clef_register::process_request()
+{
+    const Time_description *time_l = &walk_l_->time_;
+    if (!accepted_req_arr_.size() &&
+       (!time_l->whole_in_measure_|| !time_l->when_)) {
+
+       clef_p_ = new Clef_item;
+       clef_p_->change = false;
+    } else if (accepted_req_arr_.size()) {
+       clef_p_ = new Clef_item;
+       clef_p_->change = true;
+    }
+    if (clef_p_) {
+       clef_p_->read(*this);
+//     announce_element(Staff_elem_info(clef_p_,
+//                                      accepted_req_arr_[0], this));
+    }
+}
+
+void
+Clef_register::do_pre_move_process()
+{
+    if (!clef_p_)
+       return;
+    if (clef_p_->change) {
+       typeset_breakable_item(new Clef_item(*clef_p_),
+                              clef_p_, new Clef_item(*clef_p_) );
+    } else {
+       typeset_breakable_item(0, 0, clef_p_);
+    }
+    clef_p_ = 0;
+}
+    
diff --git a/src/command.cc b/src/command.cc
deleted file mode 100644 (file)
index 7ddebc6..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#include "string.hh"
-#include "debug.hh"
-#include "command.hh"
-
-bool
-Command::isbreak()const
-{
-    return (code >= BREAK_PRE && code <= BREAK_END);
-}
-
-Command::Command()
-{
-    code = NOP;
-    priority=0;
-}
-
-void
-Command::print() const
-{
-#ifndef NPRINT
-    mtor << "Command " << "code " << code << " prio " << priority;
-    if ( isbreak())
-       mtor << "(break separator)";
-    if (args.size()) {
-       mtor<< " args: ";
-       for (int i = 0; i<args.size(); i++)
-           mtor << "`"<<args[i] <<"',";
-    }
-    mtor << "\n";
-#endif
-}
diff --git a/src/commandrequest.cc b/src/commandrequest.cc
new file mode 100644 (file)
index 0000000..065f69a
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+  commandrequest.cc -- implement Nonmusical reqs
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "commandrequest.hh"
+#include "debug.hh"
+#include "musicalrequest.hh"
+
+
+void
+Cadenza_req::do_print()const
+{
+    mtor << on_b;
+}
+
+void
+Bar_req::do_print() const
+{
+    mtor << type;
+}
+
+Partial_measure_req::Partial_measure_req(Moment m)
+{
+    duration_ =m;
+}
+/* *************** */
+Cadenza_req::Cadenza_req(bool b)
+{
+    on_b =b;
+}
+/* *************** */
+
+Meter_change_req::Meter_change_req()
+{
+    beats_i_ = 0;
+    one_beat_i_ =0;
+}
+void
+Meter_change_req::set(int b,int o)
+{
+    beats_i_=b;
+    one_beat_i_=o;
+}
+
+void
+Timing_req::do_print()const{}
+
+void
+Nonmusical_req::do_print()const{}
+/* *************** */
+void
+Barcheck_req::do_print() const{}
+
+Bar_req::Bar_req(String s)
+{
+    type = s;
+}
+/* *************** */
+void
+Clef_change_req::do_print() const
+{
+    mtor << clef_str_ ;
+}
+
+Clef_change_req::Clef_change_req(String s)
+{
+    clef_str_ = s;
+}
+/* *************** */
+void
+Group_feature_req::do_print() const
+{
+    mtor << "stemdir " << stemdir_i_;
+}
+
+Group_feature_req::Group_feature_req()
+{
+    stemdir_i_ = 0;
+}
+
+void
+Group_change_req::do_print()const
+{
+    mtor << "id : " << newgroup_str_;
+}
+/* *************** */
+void
+Terminate_voice_req::do_print()const
+{
+}
+
+/* *************** */
+void
+Partial_measure_req::do_print() const
+{
+    mtor << duration_;
+}
+
+void
+Meter_change_req::do_print() const
+{
+    mtor << beats_i_ << "*" << one_beat_i_;
+}
+
+/* *************** */
+
+void
+Measure_grouping_req::do_print() const
+{
+    for (int i=0; i < elt_length_arr_.size(); i++) {
+       mtor << beat_i_arr_[i] <<"*" << elt_length_arr_[i]<<" ";
+    }
+}
+/* *************** */
+void
+Key_change_req::do_print() const
+{
+    for (int i=0; i < melodic_p_arr_.size(); i++) {
+       melodic_p_arr_[i]->print();
+    }
+}
+
+Key_change_req::Key_change_req()
+{
+}
+Key_change_req::Key_change_req(Key_change_req const&c)
+{
+    for (int i=0; i < c.melodic_p_arr_.size(); i++) {
+       melodic_p_arr_.push( c.melodic_p_arr_[i]->clone()->melodic() );
+    }
+}
+
+Key_change_req::~Key_change_req()
+{
+    for (int i=0; i < melodic_p_arr_.size(); i++)
+       delete melodic_p_arr_[i];
+}
diff --git a/src/complexcolumn.cc b/src/complexcolumn.cc
new file mode 100644 (file)
index 0000000..22e6950
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+  complexcolumn.cc -- implement Complex_column
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+#include "voice.hh"
+#include "debug.hh"
+#include "complexcolumn.hh"
+#include "pscore.hh"
+#include "request.hh"
+#include "pscore.hh"
+#include "sccol.hh"
+#include "complexstaff.hh"
+#include "misc.hh"
+
+void
+Complex_column::typeset_musical_item(Item *i)
+{
+    assert(i);
+    Score_column * sccol_l = musical_column_l_;
+    staff_l_->pscore_l_->typeset_item(i, sccol_l->pcol_l_,
+                                     staff_l_->pstaff_l_);
+}
+
+Complex_column::Complex_column(Complex_staff *staff_l)
+{
+    staff_l_ = staff_l;
+}
+
+void
+Complex_column::setup_one_request(Request * j)
+{
+    if (j->nonmus()) // ugh
+       first_l_arr_.push(j);
+    else if (j->musical())
+       second_l_arr_.push(j);
+}
+
+/**
+  align items in #item_l_arr#, return the width.
+ */
+Interval
+align_items(Array<Item*> item_l_arr)
+{
+    Interval wid(0,0);
+    for  (int i =0; i < item_l_arr.size(); i++) {
+       Interval item_width= item_l_arr[i]->width();
+       item_l_arr[i]->translate(Offset( wid.right - item_width.left ,0));
+       wid.unite(item_width);
+    }
+    return wid;
+}
+
+void 
+translate_items(Real x,  Array<Item*> item_l_arr)
+{
+    for  (int i =0; i < item_l_arr.size(); i++) 
+       item_l_arr[i]->translate(Offset(x, 0));
+}
+/*
+  UGR
+  This still sux
+  */
+void
+Complex_column::typeset_breakable_items(Array<Item *> &pre_p_arr,
+                                       Array<Item *> &nobreak_p_arr,
+                                       Array<Item *> &post_p_arr)
+{
+    PCol * c= command_column_l_->pcol_l_;
+    PScore *ps_l=staff_l_->pscore_l_;
+    if (!c->breakable_b()) {     
+       for  (int i =0; i < pre_p_arr.size(); i++)
+           delete pre_p_arr[i];
+       pre_p_arr.set_size(0);
+       for  (int i =0; i < post_p_arr.size(); i++)
+           delete post_p_arr[i];
+       post_p_arr.set_size(0);
+    }
+
+      
+    for  (int i =0; i < pre_p_arr.size(); i++) {
+       ps_l->typeset_item(pre_p_arr[i], c, staff_l_->pstaff_l_,0);
+    }
+    for  (int i =0; i < nobreak_p_arr.size(); i++) {
+       ps_l->typeset_item(nobreak_p_arr[i], c, staff_l_->pstaff_l_,1);
+    }
+    for  (int i =0; i < post_p_arr.size(); i++) {
+       ps_l->typeset_item(post_p_arr[i], c, staff_l_->pstaff_l_,2);
+    }
+
+    Interval pre_wid= align_items(pre_p_arr);
+    translate_items( -pre_wid.right, pre_p_arr);
+    align_items(nobreak_p_arr);
+    Interval post_wid =align_items(post_p_arr);
+    translate_items (-post_wid.left , post_p_arr);
+
+    pre_p_arr.set_size(0);
+       post_p_arr.set_size(0);
+   nobreak_p_arr.set_size(0);
+}
diff --git a/src/complexprint.cc b/src/complexprint.cc
deleted file mode 100644 (file)
index 6abe765..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-#include "keyitem.hh"
-
-#include "request.hh"
-#include "pscore.hh"
-#include "paperdef.hh"
-#include "complexstaff.hh"
-#include "sccol.hh"
-#include "debug.hh"
-
-#include "clefitem.hh"
-#include "bar.hh"
-#include "meter.hh"
-const NO_LINES = 5;
-
-Item *
-Complex_staff::get_TYPESET_item(Command *com)
-{
-    Item *s=0;
-    Array<Scalar> arg( com->args);
-    String type =arg[0];
-    arg.del(0);
-    if (com->args[0] == "KEY") {
-       return new Keyitem(NO_LINES);   // urgh. depends on clef.
-    } else if (type ==  "BAR" ) {
-       s = new Bar(com->args[1]);      
-    } else if (type == "METER") {
-       s = new Meter(arg);
-    } else if (type == "CLEF" || type == "CURRENTCLEF") {
-       Clef_item * c = new Clef_item;
-       s = c;
-       c->change = (type == "CLEF");   
-    }else{
-       WARN << "ignoring TYPESET command for " << type << '\n';
-    }
-    return s;
-}
-
-
-
-Interval
-itemlist_width(const Array<Item*> &its)
-{
-    Interval iv ;
-    iv.set_empty();
-     
-    for (int j =0; j < its.size(); j++){
-       iv.unite (its[j]->width());
-
-    }
-    return iv;
-}
-
-void
-Complex_column::typeset_item(Item *i, int breakst)
-{
-    assert(i);
-    
-    staff_l_->pscore_l_->typeset_item(i, score_column_l_->pcol_l_,
-                                 staff_l_->pstaff_l_,breakst);
-    
-    if (breakst == BREAK_PRE - BREAK_PRE) {
-       
-        Array<Item*> to_move(
-           staff_l_->pscore_l_->select_items(staff_l_->pstaff_l_,
-                                         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.size(); j++) {
-           to_move[j]->translate(Offset(-column_wid.right, 0));
-       }
-    }
-}    
-/*
-  UGGGG
-  */
-void
-Complex_column::typeset_item_directional(Item *i, int dir, int breakst) // UGH!
-{
-    assert(i);
-    PCol * c=score_column_l_->pcol_l_;
-    if (breakst == 0)
-       c = c->prebreak_p_;
-    else if (breakst == 2)
-       c = c->postbreak_p_;
-    
-    Array<Item*> to_move(staff_l_->pscore_l_->select_items(staff_l_->pstaff_l_,
-                                                     c));    
-    typeset_item(i, breakst);
-
-    Interval column_wid = itemlist_width(to_move);
-    if (column_wid.empty())
-       column_wid = Interval(0,0);
-    i->translate(Offset(column_wid[dir] - i->width()[-dir], 0));
-}
-
-void
-Complex_staff::set_output(PScore* pscore_l )
-{
-    pstaff_l_ = new PStaff(pscore_l); // pstaff_l_ is added to pscore later.
-    pscore_l_ = pscore_l;
-    pscore_l_->add(pstaff_l_);
-}
-
-
index d5d44362d9d5fce98d027fbcc60dcabef5cd9bc2..3ecf9fdb89d26324bba5d38a3de531932fd17add 100644 (file)
@@ -1,78 +1,56 @@
-#include "request.hh"
-#include "voice.hh"
-#include "staffwalker.hh"
 #include "debug.hh"
-#include "clef.hh"
-#include "staff.hh"
-#include "command.hh"
 #include "complexstaff.hh"
-#include "sccol.hh" 
 #include "complexwalker.hh"
+#include "complexcolumn.hh"
 #include "score.hh"
 #include "pscore.hh"
 #include "staffsym.hh"
+#include "pscore.hh"
+#include "bar.hh"
+#include "meter.hh"
+#include "sccol.hh"
+#include "commandrequest.hh"
 
+const NO_LINES = 5;
 
-Complex_column::Complex_column(Score_column*s, Complex_staff *staff_l)
-    : Staff_column(s)
-{
-    staff_l_ = staff_l;
-}
-
-Complex_staff::Complex_staff()
-{
-    pstaff_l_ = 0;
-}
-
+/** Aside from putting fields right, this generates the staff symbol.
+ */
 void
-Complex_column::setup_requests()
+Complex_staff::set_output(PScore* pscore_l )
 {
-    for (int i = 0 ; i < v_elts.size(); i ++)
-       for (iter_top(v_elts[i]->reqs,j); j.ok(); j++) {            
+    pstaff_l_ = new PStaff(pscore_l);
+    pscore_l_ = pscore_l;
+    pscore_l_->add(pstaff_l_);
 
-           if (j->barcheck()) {
-               if (tdescription_->whole_in_measure) {
-                   warning( "Barcheck failed", j->defined_ch_c_l_m );
-//                 staff_l_->the_line_->pscore_l_->heu errorlevel_i_ |= 1;
-               }
-               continue;
-           }
-           if (j->mark())
-               continue;
-           if (j->command())
-               continue;
-           if (j->groupchange()) // ugh
-               first_l_arr_.push(j);
-           else
-               second_l_arr_.push(j);
-       }
-}
 
-Staff_column*
-Complex_staff::create_col(Score_column*s)
-{
-    return new Complex_column(s,this);
-}
-
-void
-Complex_staff::walk()
-{
-    for (Complex_walker sc(this); sc.ok(); sc++) {
-       sc.col()->setup_requests();
-       sc.process();
-    }
+   
     Staff_symbol *span_p = new Staff_symbol(5);
 
-       
+    
     Score_column* col_last
        =score_l_->find_col(score_l_->last(), false);
     Score_column* col_first=
        score_l_->find_col(0, false);
-    col_first->pcol_l_->set_breakable();
-    col_last->pcol_l_->set_breakable();
        
-    span_p->set_extent( col_first->pcol_l_->postbreak_p_,
+    span_p->set_extent(col_first->pcol_l_->postbreak_p_,
                       col_last->pcol_l_->prebreak_p_);
 
     pscore_l_->typeset_spanner(span_p, pstaff_l_);
 }
+
+Complex_staff::Complex_staff()
+{
+    pstaff_l_ = 0;
+}
+
+Staff_column*
+Complex_staff::create_col()
+{
+    return new Complex_column(this);
+}
+
+Staff_walker * 
+Complex_staff::get_walker_p()
+{
+    return new Complex_walker(this);
+}
index ba8253205b8b9c832c998061345c3bd83960476b..c6478fbb236f78b8231b13d523bfcdc522ad74f1 100644 (file)
+/*
+  complexwalker.cc -- implement Complex_walker
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
 #include "associter.hh"
 #include "script.hh"
-#include "request.hh"
+#include "musicalrequest.hh"
 #include "voice.hh"
-#include "clef.hh"
 #include "pscore.hh"
 #include "complexstaff.hh"
 #include "debug.hh"
-#include "keyitem.hh"
-#include "clefitem.hh"
 #include "voicegroup.hh"
-#include "localkeyreg.hh"
 #include "complexwalker.hh"
 #include "misc.hh"
+#include "commandrequest.hh"
+#include "clefreg.hh"
+#include "localkeyreg.hh"
+#include "keyreg.hh"
+#include "meterreg.hh"
+#include "barreg.hh"
 
-Rhythmic_grouping
-parse_grouping(Array<Scalar> const &a)
-{
-    Array<int> r;
-    Array<Moment> grouplen_arr;
-    for (int i= 0 ; i < a.size()/2; ) {
-       r.push(a[i++]);
-       grouplen_arr.push(Moment(1,(int) a[i++]));
-    }
-    Moment here =0;
-
-    Array<Rhythmic_grouping*> children;
-    for (int i=0; i < r.size(); i++) {
-       
-       Moment last = here;
-       here += grouplen_arr[i] * Rational(r[i]);
-       children.push(
-           new Rhythmic_grouping(MInterval(last, here), r[i] ));
-    }
-    return Rhythmic_grouping(children);
-}
-
-void
-Complex_walker::do_INTERPRET_command(Command*com_l)
-{
-    Array<Scalar> args(com_l->args);
-    args.del(0);
-    String com = com_l->args[0];
-    
-    if (com == "GROUPING") {   
-       default_grouping = parse_grouping(args);
-    }else if (com == "NEWMEASURE") {
-       local_key_.reset(key_);
-
-    } else if (com == "KEY") {
-       
-       if (col()->when() > Moment(0)) {
-           assert(!oldkey_undo);
-           oldkey_undo = new Array<int>( key_.oldkey_undo(args));
-       }
-       
-       typesetkey = key_.read(args);
-       local_key_.reset(key_); 
-    } else if (com == "CLEF") {
-       clef_.set_type(args[0]);
-    } else {
-       WARN << " ignoring INTERPRET command: " << com<< "\n";
-    }
-}
-
-void
-Complex_walker::do_TYPESET_command(Command*com)
-{
-    /* ignore these commands if non-default versions have been
-      processed.  */
-    if (com->args[0] == "CURRENTKEY") 
-       if (processed_key) 
-           return;
-       else
-           com->args[0] = "KEY"; // urgh
-    
-    if (com->args[0] == "CURRENTCLEF") {
-       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)
-       return;
-
-    if (com->args[0] == "KEY") {
-       ((Keyitem*) i)->read(clef_);
-       if (oldkey_undo) {
-           ((Keyitem*) i)->read(*oldkey_undo);
-           delete oldkey_undo;
-           oldkey_undo = 0;
-       }
-       processed_key = true;
-       
-       ((Keyitem*) i)->read(typesetkey); // ugh        
-    }
-
-    if (com->args[0] == "CLEF"||com->args[0] == "CURRENTCLEF") {
-       processed_clef =true;
-       Clef_item*c=(Clef_item*)i;
-       c->read(clef_);
-       c->change = (break_status != BREAK_POST - BREAK_PRE);
-    }
-    col()->typeset_item_directional(i, 1, break_status);
-}
 
 void
 Complex_walker::announce_element(Staff_elem_info info)
@@ -121,15 +34,24 @@ Complex_walker::announce_element(Staff_elem_info info)
 void
 Complex_walker::do_announces()
 {
+    Request dummy_req;
     for (int i = 0; i < announce_info_arr_.size(); i++){
        Staff_elem_info info = announce_info_arr_[i];
+       if (!info.req_l_)
+           info.req_l_ = &dummy_req;
+       
        for (iter_top(voice_reg_list_,j); j.ok(); j++) {
            j->acknowledge_element(info);
        }
        for (iter_top ( group_reg_list_, j); j.ok(); j++) {
            j->acknowledge_element(info);
        }
-       local_key_reg_.acknowledge_element(info);
+       bar_reg_p_->acknowledge_element(info);
+       clef_reg_p_->acknowledge_element(info);
+       key_reg_p_->acknowledge_element(info);
+       meter_reg_p_->acknowledge_element(info);
+       
+       local_key_reg_p_->acknowledge_element(info);
     }
 }
 
@@ -204,15 +126,37 @@ Complex_walker::do_change_group(Voice * v, String group_id_str)
     voice_group_map_[v] = get_voice_group(group_id_str);
 }
 
+bool
+Complex_walker::try_command_request(Nonmusical_req *req_l)
+{
+    bool b=false;
+    Voice *voice_l = (Voice*)req_l->elt_l_->voice_l_; // ugh
+    if (req_l->groupchange()){
+       do_change_group(voice_l, req_l->groupchange()->newgroup_str_);
+       b|= true;
+    } else if(req_l->groupfeature()) {
+       Voice_group_registers* reg_l = get_voice_group(voice_l);
+       b |= reg_l->try_request(req_l);
+    } else {
+       if (!b)
+           b |= bar_reg_p_->try_request(req_l);
+       b |= clef_reg_p_->try_request(req_l);
+       if (!b) 
+           b |= key_reg_p_->try_request(req_l);
+       if (!b)
+           b |= meter_reg_p_->try_request(req_l);
+    }
+    return b;
+}
+
 void
 Complex_walker::try_request(Request*req)
 {
     bool b=false;
-    Voice *voice_l = req->elt_l_->voice_l_;
+    Voice *voice_l = (Voice*)req->elt_l_->voice_l_; // ahh. This sux
 
-    if (req->groupchange()) {
-       do_change_group(voice_l, req->groupchange()->newgroup_str_);
-       b = true;
+    if (req->nonmus()) {
+       b = try_command_request(req->nonmus());
     } else if (Voice_registers::acceptable_request(req)) {
        Voice_registers *vregs_l = get_voice_reg(voice_l);
        b = vregs_l->try_request(req);
@@ -222,7 +166,8 @@ Complex_walker::try_request(Request*req)
     } 
 
     if (!b)
-       warning("junking request: "  + String(req->name()), req->defined_ch_c_l_m);
+       warning("junking request: "  + String(req->name()),
+               req->defined_ch_c_l_);
 }
 
 void
@@ -251,7 +196,12 @@ Complex_walker::regs_process_requests()
     for (iter_top(group_reg_list_, j); j.ok(); j++) 
        j->process_requests();
     
-    local_key_reg_.process_request();
+    
+    bar_reg_p_->process_request();
+    clef_reg_p_->process_request();
+    key_reg_p_->process_request();
+    meter_reg_p_->process_request();
+    local_key_reg_p_->process_request();
 }
 
 void
@@ -262,17 +212,43 @@ Complex_walker::typeset_element(Staff_elem *elem_p)
     if (elem_p->spanner())
        pscore_l_->typeset_spanner(elem_p->spanner(), staff()->pstaff_l_);
     else
-       col()->typeset_item(elem_p->item()); 
+       col()->typeset_musical_item(elem_p->item()); 
 }
 
 Complex_walker::Complex_walker(Complex_staff*s)
-    : Staff_walker(s, s->pstaff_l_->pscore_l_),
-      local_key_reg_(this)      
+    : Staff_walker(s, s->pstaff_l_->pscore_l_)
 {
-    oldkey_undo = 0;
+    local_key_reg_p_= new Local_key_register(this);
+    clef_reg_p_= new Clef_register(this);
+    key_reg_p_ = new Key_register(this);
+    bar_reg_p_ = new Bar_register(this);
+    meter_reg_p_ = new Meter_register(this);
+    
     do_post_move();
 }
 
+
+Complex_walker::~Complex_walker()
+{
+    delete local_key_reg_p_;
+    delete clef_reg_p_;
+    delete meter_reg_p_;
+    delete bar_reg_p_;
+    delete key_reg_p_;
+}
+
+int
+Complex_walker::c0_position_i()const
+{
+    return c0_position_i_;
+}
+
+void
+Complex_walker::set_c0_position(int p)
+{
+    c0_position_i_ =p;
+}
+
 Complex_staff*
 Complex_walker::staff()
 {
@@ -293,31 +269,54 @@ Complex_walker::do_pre_move()
     }
     for (iter_top (group_reg_list_, j); j.ok(); j++) 
        j->pre_move_processing();
-    local_key_reg_.pre_move_processing();
+    local_key_reg_p_->pre_move_processing();
+    bar_reg_p_->pre_move_processing();
+    clef_reg_p_->pre_move_processing();
+    key_reg_p_->pre_move_processing();
+    meter_reg_p_->pre_move_processing();
+
+    col()->typeset_breakable_items(prebreak_item_p_arr_,
+                                  nobreak_item_p_arr_,
+                                  postbreak_item_p_arr_);
 }
 
 void
 Complex_walker::do_post_move()
 {
-    processed_clef = false;    
-    processed_key = false;
-    processed_bar_priority = 0;
-    
     for (iter_top(voice_reg_list_,i); i.ok(); i++) {
        i->post_move_processing();   
     }
     announce_info_arr_.set_size(0);
     for (iter_top (group_reg_list_, j); j.ok(); j++) 
        j->post_move_processing();
-    local_key_reg_.post_move_processing();
+    
+    local_key_reg_p_->post_move_processing();
+    bar_reg_p_->post_move_processing();
+    clef_reg_p_->post_move_processing();
+    key_reg_p_->post_move_processing();
+    meter_reg_p_->post_move_processing();
+
 }
 
 Array<Voice_registers*>
 Complex_walker::get_voice_regs(Voice_group_registers* group_regs_l) const
     return l_arr;
 {
-    for (Assoc_iter<Voice*,Voice_group_registers*> i(voice_group_map_); i.ok(); i++) {
+    for (Assoc_iter<Voice*,Voice_group_registers*> i(voice_group_map_);
+        i.ok(); i++) {
        if (i.val() == group_regs_l)
            l_arr.push(find_voice_reg(i.key()));
     }
 }
+
+void
+Complex_walker::typeset_breakable_item(Item * pre_p , Item * nobreak_p,
+                                      Item * post_p)
+{
+    if (pre_p)
+       prebreak_item_p_arr_.push(pre_p);
+    if (nobreak_p)
+       nobreak_item_p_arr_.push(nobreak_p);
+    if (post_p)
+       postbreak_item_p_arr_.push(post_p);
+}
diff --git a/src/getcommands.cc b/src/getcommands.cc
deleted file mode 100644 (file)
index 61a3f59..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-#include "string.hh"
-#include "inputcommand.hh"
-#include "parseconstruct.hh"
-#include "command.hh"
-
-Command*
-get_key_typeset_command(Array<Scalar>which)
-{
-    Command*c = new Command;
-    c->code = TYPESET;    
-    c->args = which;
-    String k("KEY");
-    c->args.insert(k,0 );
-    c->priority = 70;
-    return c;
-}
-
-Command *
-get_meter_command(int n, int m)
-{
-    Command*c = new Command;
-    
-    c->code = TYPESET;
-    c->args.push( "METER");
-    c->args.push( n );
-    c->args.push( m );
-    c->priority = 40;
-    return c;
-}
-
-Command
-get_defaultbar_command()
-{
-    Command c;
-    c.code = TYPESET;
-    c.args.push("BAR");
-    c.args.push("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.push("BAR");
-    if(s=="default")
-       s = "|";
-    
-    if (s == ":|:") {
-       no_break_com=post_com=pre_com = c;
-       
-       pre_com.args.push( ":|");
-       no_break_com.args.push( s);
-       post_com.args.push( "|:");
-    }else if (s=="|:") {
-       c.args.push(s);
-       no_break_com=post_com=c;
-    } else {
-       c.args.push(s);
-       pre_com= no_break_com= c;       
-    } 
-}
index 8c7e0e5d5b858e5ab1e986bfebfacefa76b04f7e..6c2e6760c800d41e9302da62e9a2775888ef4c57 100644 (file)
@@ -1,3 +1,11 @@
+/*
+  grouping.cc -- implement Rhythmic_grouping
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
 #include "debug.hh"
 #include "grouping.hh"
 #include "interval.hh"
@@ -74,6 +82,7 @@ Rhythmic_grouping::intervals()
     }
     return r;
 }
+
 void
 Rhythmic_grouping::intersect(MInterval t)
 {
@@ -100,7 +109,11 @@ Rhythmic_grouping::intersect(MInterval t)
 
 }
 
-/* I really should be documenting what is happening here, but I find
+/**
+  Put our children in branches of #this#.
+  The min and max time intervals coincide with elements of #splitpoints#
+
+  I really should be documenting what is happening here, but I find
   that difficult, since I don't really understand what's going on here.
 
   */
@@ -248,7 +261,6 @@ min_elt(Array<int> v)
 Array<int>
 Rhythmic_grouping::generate_beams(Array<int> flags, int &flagidx)
 {
-    
     assert (!interval_) ;
     
     Array< Array<int> > children_beams;
@@ -318,3 +330,21 @@ Rhythmic_grouping::extend(MInterval m)
     assert(m.right <= interval().right);
     OK();
 }
+
+Rhythmic_grouping
+parse_grouping(Array<int> beat_i_arr, Array<Moment> elt_length_arr)
+{
+    Moment here =0;
+    assert(beat_i_arr.size() == elt_length_arr.size());
+    
+    Array<Rhythmic_grouping*> children;
+    for (int i=0; i < beat_i_arr.size(); i++) {
+       Moment last = here;
+       here += elt_length_arr[i] * Moment(beat_i_arr[i]);
+       children.push(
+           new Rhythmic_grouping(MInterval(last, here),
+                                 beat_i_arr[i] ));
+    }
+    return Rhythmic_grouping(children);
+}
+
index 94ad2291e19e04785b31c3e29066176f60bf2eaa..c41037c5134b2a5364706d450cc57acce7eec1ee 100644 (file)
@@ -8,7 +8,7 @@
 #include "headreg.hh"
 #include "paperdef.hh"
 #include "complexwalker.hh"
-
+#include "musicalrequest.hh"
 
 Notehead_register::Notehead_register(Complex_walker*w_l)
     :Request_register(w_l)
@@ -45,7 +45,7 @@ Notehead_register::process_request()
        note_p_ = n_p;
        n_p->set_rhythmic(req_l->rhythmic());
        n_p->position = req_l->note()->height() +
-           walk_l_->clef_.c0_position_i_;
+           walk_l_->c0_position_i();
     } else {
        note_p_ = new Rest ( req_l->rhythmic()->balltype,
                             req_l->rhythmic()->dots);
diff --git a/src/inputcommand.cc b/src/inputcommand.cc
deleted file mode 100644 (file)
index aab0ea4..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-#include "inputcommand.hh"
-#include "debug.hh"
-#include "command.hh"
-
-Input_command::Input_command()
-{
-}
-
-
-Input_command::operator Command()
-{
-    Command c;
-    if (!args.size())
-       return c;
-    
-    c.code = INTERPRET;
-    String s = args[0];
-        
-    int p=0;
-    if (s == "KEY")
-       p = 200;
-    else if (s=="CLEF")
-       p = 190;
-    else if (s == "METER")
-       p = 180;
-    else if (s == "BAR")
-       p = 170;
-    else if (s == "GROUPING")
-       p = 160;
-    
-    c.priority = p;
-    c.args = args;
-    
-    return c;    
-}
-
-
-Input_command*
-get_partial_command(Moment u)
-{
-    Input_command*c = new Input_command;
-    c->args.push("PARTIAL");
-    c->args.push(u);
-    return c;
-}
-
-Input_command*
-get_goto_command(String s)
-{
-    Input_command*c = new Input_command;
-    c->args.push("GOTO");
-    c->args.push(s);
-    return c;
-}
-
-Input_command*
-get_cadenza_toggle(int i)
-{
-    
-    Input_command*c = new Input_command;
-    c->args.push("CADENZA");
-    c->args.push(i);
-    return c;
-}
-Input_command*
-get_grouping_command(Array<int>a ) 
-{
-    Input_command*c = new Input_command;
-    c->args.push("GROUPING");    
-    for (int i=0; i < a.size(); i ++)
-       c->args.push(a[i]);
-
-    return c;
-}
-
-Input_command*
-get_key_interpret_command(Array<int >a ) 
-{
-    Input_command*c = new Input_command;
-    c->args.push("KEY");
-    for (int i=0; i < a.size(); i ++) {
-       c->args.push(a[i]);
-    }
-    return c;
-}
-
-Input_command*
-get_reset_command()
-{
-    Input_command*c = new Input_command;
-    c->args.push("RESET");
-    return c;
-}
-
-Input_command *
-get_meterchange_command(int n, int m)
-{
-    Input_command*c = new Input_command;
-
-    c->args.push( "METER");
-    c->args.push( n );
-    c->args.push( m );
-
-    return c;
-}
-
-Input_command *
-get_newmeasure_command()
-{
-    Input_command*c = new Input_command;
-    c->args.push( "NEWMEASURE");
-    return c;
-}
-
-Input_command *
-get_skip_command(int n, Moment m)
-{
-    Input_command*c = new Input_command;
-    
-    c->args.push( "SKIP");
-    c->args.push( n );
-    c->args.push( m );
-
-    return c;
-}
-
-
-void
-Input_command::print()const
-{
-#ifndef NPRINT
-    mtor << "{ ";
-    if (args.size()) {
-       mtor<< " args: ";
-       for (int i = 0; i<args.size(); i++)
-           mtor << "`"<<args[i] <<"',";
-    }
-    mtor << "}\n";
-#endif    
-}
-
-Input_command*
-get_clef_interpret_command(String w)
-{
-    Input_command*c = new Input_command;
-    c->args.push("CLEF");
-    c->args.push(w);
-    return c;
-}
-
-Input_command*
-get_bar_command(String w)
-{
-    Input_command*c = new Input_command;
-    c->args.push("BAR");
-    c->args.push(w);
-    return c;
-}
-
-Array<int>
-get_default_grouping(int count, int one_beat_note)
-{
-    Array<int> s;
-    if (!(count % 3 )) {
-       for (int i=0; i < count/3; i++) {
-           s.push(3);
-           s.push(one_beat_note);
-       }
-    } else if (!(count %2)) {
-       for (int i=0; i < count/2; i++) {
-           s.push(2);
-           s.push(one_beat_note);
-       }
-           
-    }else {
-       s.push(2);
-       s.push(one_beat_note);
-       s.concat(get_default_grouping(count-2, one_beat_note));
-    }
-    return s;
-}
diff --git a/src/inputcommands.cc b/src/inputcommands.cc
deleted file mode 100644 (file)
index 36e421c..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-#include "inputcommands.hh"
-#include "inputcommand.hh"
-#include "debug.hh"
-#include "staffcommands.hh"
-#include "getcommand.hh"
-#include "command.hh"
-#include "stcol.hh"
-#include "staff.hh"
-#include "assoc.hh"
-#include "lexer.hh"
-
-void
-Commands_at::print() const
-{
-#ifndef NPRINT
-    mtor << "Commands_at {";
-    tdescription_.print();
-    for (iter_top(*this,cc); cc.ok(); cc++) 
-       cc->print();
-    mtor << "}\n";
-#endif
-}
-
-Moment
-Commands_at::when()
-{
-    return tdescription_.when;
-}
-
-Commands_at::Commands_at(Moment dt, Commands_at* prev)
-    : tdescription_(dt, (prev)? &prev->tdescription_ : 0)
-{
-    if (prev && !tdescription_.whole_in_measure) {
-       bottom().add(get_newmeasure_command());
-    }
-}
-
-void
-Commands_at::add(Input_command *i)
-{
-    bottom().add(i);
-
-    // should check for other meterchanges here.
-    if (i->args[0] == "METER") { 
-       int l = i->args[1];
-       int o = i->args[2];
-       tdescription_.set_meter(l,o);
-       bottom().add(get_grouping_command( get_default_grouping(l,o)));
-    }
-}
-
-Commands_at::Commands_at(Commands_at const&src) :
-    tdescription_(src.tdescription_)
-{
-    IPointerList<Input_command*> &me(*this);
-    const IPointerList<Input_command*> &that(src);
-    
-    PL_copy(me, that);
-}
-
-void
-Commands_at::setpartial(Moment p)
-{
-    tdescription_.setpartial(p);
-}
-
-Moment
-Commands_at::barleft()
-{
-    return  tdescription_.barleft();
-}
-
-void
-Commands_at::parse(Staff_commands_at*s)
-{
-    s->tdescription_ = tdescription_;
-    for (iter_top(*this,cc); cc.ok(); cc++) {
-       if (cc->args.size() &&  cc->args[0] !="") {
-           Command c = **cc;
-           s->add(c);
-           
-       }
-    }
-}
-/* *************** */
-
-void
-Input_cursor::find_moment(Moment w)
-{
-    Moment last = when();
-    while  (1) {
-       if (! ok() ) {
-           *this = list().bottom();
-           
-           Moment dt = (w - when());
-           if ( !ptr()->tdescription_.cadenza_b_ )
-               dt = dt <? ptr()->barleft();
-
-           Commands_at * c = new Commands_at(dt, *this);
-           assert(c->when() <= w);
-           add(c);
-       } else if (when() == w ) {
-           return ;
-       } else if (when() > w )
-           break;
-       
-       
-       last = when();
-       next();
-    }
-
-    prev();
-    Moment dt = (w - when());
-    Commands_at * c = new Commands_at(dt, *this);
-    add(c);
-    next();
-}
-
-
-
-/* *************** */
-void
-Input_commands::find_moment(Moment m)
-{
-    ptr.find_moment(m);
-}
-
-Input_commands::Input_commands(Input_commands const&src)
-    : ptr(src.ptr)
-{
-    IPointerList<Commands_at*> &me(*this);
-    const IPointerList<Commands_at*> &that(src);
-    
-    PL_copy(me, that);    
-}
-
-Input_commands::Input_commands()
-    :    ptr (bottom())
-{
-    Commands_at * p = new Commands_at(0,0);    
-    bottom().add(p);    
-    ptr = bottom();    
-}
-
-void
-Input_commands::do_skip(int bars, Moment wholes)
-{
-    while (bars > 0) {
-       Moment b = ptr->barleft();
-       ptr.find_moment(ptr->when() + b);
-       bars --;        
-    }
-    if (wholes) {
-       ptr.find_moment(ptr->when() + wholes);
-    }
-}
-
-
-void
-Input_commands::add(Input_command c, Assoc<String,Moment> &marks_assoc_r)
-{
-    String s(c.args[0]);
-    if (s == "CADENZA") {
-       ptr->tdescription_.set_cadenza((int)c.args[1]);
-    } if (s == "PARTIAL") {    
-       ptr->setpartial(c.args[1]);
-    } else if (s == "GROUPING") {
-       Input_command *ic = new Input_command(c);
-       ic->args.insert(ptr->tdescription_.one_beat, 1);
-       ptr->add(ic);
-    } else if (s == "METER") {
-       int beats_per_meas = c.args[1];
-       int one_beat = c.args[2];
-       Input_command *ch = get_meterchange_command(beats_per_meas, one_beat);
-       ptr->add(ch);           
-    } else if (s == "SKIP") {
-       int bars = c.args[1] ;
-       Moment wholes= c.args[2];
-       do_skip(bars, wholes);
-    } else if (s == "RESET") {
-       ptr= top();
-    } else if (s=="GOTO") {
-       ptr = top();
-       String m(c.args[1]);
-       if (!marks_assoc_r.elt_query(m)) { 
-           warning( "Unknown marker: `" +m + "\'", 0 );
-           return;
-       }
-       
-       ptr.find_moment(marks_assoc_r[m]);
-    } else {
-       Input_command *ic = new Input_command(c);
-       ptr->add(ic);
-    } 
-    
-}
-
-void
-Input_commands::parse(Staff * staff_l) const
-{
-    print();
-    for (iter_top(*this,i); i.ok(); i++) {
-
-       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();
-       }
-
-       i->parse(com_l);
-    }
-}
-
-
-void
-Input_commands::print() const
-{
-#ifndef NPRINT
-    for (iter_top(*this,cc); cc.ok() ; cc++) {
-       cc->print();
-    }
-#endif
-}
-/* *************** */
-
-Moment
-Input_cursor::when()const
-{
-    return (*this)->when(); 
-}
-Input_cursor::Input_cursor(PCursor<Commands_at *>c)
-    : PCursor<Commands_at*>(c)
-{
-}
index 447d84e41a460136281c93798595d945c49c89be..05918a1a5f68e2eeae05c6fda0b2a7e7cc89c80a 100644 (file)
@@ -1,7 +1,7 @@
 #include "debug.hh"
 #include "inputmusic.hh"
 #include "voice.hh"
-#include "request.hh"
+#include "musicalrequest.hh"
 
 void
 Simple_music::add(Voice_element*v)
index 764c8e8509ff8116ca8f55a95044077b7462124d..a8a653982cdb9ab2639a393b71fcc3123d405ac3 100644 (file)
@@ -1,18 +1,19 @@
+/*
+  inputscore.cc -- implement Input_score
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
 #include "debug.hh"
-#include "inputcommand.hh"
 #include "inputscore.hh"
 #include "inputstaff.hh"
+#include "inputmusic.hh"
 #include "score.hh"
 #include "paperdef.hh"
 #include "staff.hh"
 
-void
-Input_score::add(Array<Input_command*> &s)
-{
-    commands_.bottom().add(get_reset_command());
-    for (int i=0; i < s.size(); i++)
-       commands_.bottom().add(s[i]);
-}
 
 void
 Input_score::add(Input_staff*s)
@@ -23,51 +24,61 @@ Input_score::add(Input_staff*s)
 void
 Input_score::set(Paperdef*p)
 {
-    delete paper_;
-    paper_ = p;
+    delete paper_p_;
+    paper_p_ = p;
 }
 
-Input_score::Input_score(Input_score const&)
+Input_score::Input_score(Input_score const&s)
 {
-    assert(false);
+    paper_p_ = (s.paper_p_)? new Paperdef(*s.paper_p_) :0;
+    defined_ch_c_l_ = s.defined_ch_c_l_;
+    errorlevel_i_ = s.errorlevel_i_;
+    score_wide_music_p_ = (s.score_wide_music_p_) ?
+       s.score_wide_music_p_->clone():0;
 }
 
 Score*
 Input_score::parse()
 {
-    Paperdef* paper_p=new Paperdef(*paper_);
+    Paperdef* paper_p=new Paperdef(*paper_p_);
     Score *s_p = new Score(paper_p);
     s_p->defined_ch_c_l_= defined_ch_c_l_;
     s_p->errorlevel_i_ = errorlevel_i_;
-    Array<Staff*> parsed_staffs;
+
     for (iter_top(staffs_,i); i.ok(); i++) {
-       Staff* staf_p=i->parse(s_p);
-       parsed_staffs.push(staf_p);
+       Staff* staf_p=i->parse(s_p, score_wide_music_p_);
        s_p->add(staf_p);
     }
-    int j = 0;
-    for (iter_top(staffs_,i); i.ok(); i++,j++) {
-       parsed_staffs[j]->do_commands(commands_, i->commands_);
-    }
+
     return s_p;
 }
 
+void
+Input_score::set(Input_music *m_p)
+{
+    delete score_wide_music_p_;
+    score_wide_music_p_ =m_p;    
+}
+
+
 Input_score::~Input_score()
 {
-    delete paper_;
+    delete paper_p_;
+    delete score_wide_music_p_;
 }
 
 Input_score::Input_score()
 {
+    score_wide_music_p_ =0;
     defined_ch_c_l_=0;
-    paper_= 0;
+    paper_p_= 0;
     errorlevel_i_ = 0;
 }
 
 void
 Input_score::print()const
 {
-    #ifndef NPRINT
+#ifndef NPRINT
     mtor << "Input_score {\n";
     for (iter_top(staffs_,i); i.ok(); i++) {
        i->print();
index d79aac1021f2f47c18173330a77183d8c766c6f4..116624574ca1f53ec90f48ddeb6aa2eb2fb17d11 100644 (file)
@@ -1,26 +1,16 @@
-#include "getcommand.hh"
 #include "debug.hh"
 #include "score.hh"
 #include "inputmusic.hh"
 #include "inputstaff.hh"
-#include "inputcommand.hh"
-#include "staffcommands.hh"
 #include "staff.hh"
 #include "complexstaff.hh"
 #include "lexer.hh"
 #include "lyricstaff.hh"
 
-void
-Input_staff::add(Array<Input_command*> &s)
-{
-    commands_.bottom().add(get_reset_command());
-    for (int i=0; i < s.size(); i++)
-       commands_.bottom().add(s[i]);
-    s.set_size(0);
-}
 
 Input_staff::Input_staff(String s)
 {
+    score_wide_music_p_ =0;
     type= s;
     defined_ch_c_l_ = 0;
 }
@@ -32,51 +22,36 @@ Input_staff::add(Input_music*m)
 }
 
 Staff*
-Input_staff::parse(Score*score_l)
+Input_staff::parse(Score*score_l, Input_music *default_score_wide)
 {
     Staff *p=0;
-#if 0
-    if (type == "simple")
-       p = new Melodic_staff;
-    else if (type == "rhythmic")
-       p = new Rhythmic_staff;
-    else
-#endif
-       
-       if (type == "melodic")
+    if (type == "melodic")
        p = new Complex_staff;
     else if (type == "lyric")
        p = new Lyric_staff;
     else
-       error( "Unknown staff-type `" + type +"\'", );
+       error( "Unknown staff-type `" + type +"\'", defined_ch_c_l_);
 
     p->score_l_ = score_l;
-    p->define_spot_str_ = "";  // todo
     
     for (iter_top(music_,i); i.ok(); i++) {
        Voice_list vl = i->convert();
        p->add(vl);
     }
-    
-    {
-       Array<String> mark_arr;
-       Array<Moment> moment_arr;
-       p->get_marks(mark_arr, moment_arr);
-       score_l->add_marks(mark_arr, moment_arr);
-    }
-    
+    Voice_list vl =  (score_wide_music_p_) ? score_wide_music_p_->convert()
+       : default_score_wide->convert();
+    p->add(vl);
     return p;
 }
 
 Input_staff::Input_staff(Input_staff const&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->clone());
     defined_ch_c_l_ = s.defined_ch_c_l_;
     type = s.type;
+    score_wide_music_p_ = (s.score_wide_music_p_) ?
+       s.score_wide_music_p_->clone() : 0;
 }
 
 void
@@ -84,10 +59,19 @@ Input_staff::print() const
 {
 #ifndef NPRINT
     mtor << "Input_staff {\n";
-    for (iter_top(commands_,i); i.ok(); i++)
-       i->print();
     for (iter_top(music_,i); i.ok(); i++)
        i->print();
     mtor << "}\n";
 #endif
 }
+void
+Input_staff::set_score_wide(Input_music *m_p)
+{
+    delete score_wide_music_p_;
+    score_wide_music_p_ = m_p;
+}
+
+Input_staff::~Input_staff()
+{
+    delete score_wide_music_p_;
+}
index 232ce9a94fb19afead5e75d4fe25609fe82b8610..7e23464ccfec917464e06d63eeaad6f3219dca28 100644 (file)
@@ -1,13 +1,13 @@
 #include "key.hh"
 
-const int OCTAVES=14;
+const int OCTAVES=14;          // ugh..
 const int ZEROOCTAVE=7;
 
 Key::Key()
 {
-    accidentals.set_size(7);
+    accidental_i_arr_.set_size(7);
     for (int i= 0; i < 7 ; i++)
-       accidentals[i] = 0;
+       accidental_i_arr_[i] = 0;
 }
 
 Local_key::Local_key()
@@ -25,7 +25,7 @@ void
 Key::set(int i, int a)
 {
     assert(a > -3 && a < 3);
-    accidentals[i]=a;    
+    accidental_i_arr_[i]=a;    
 }
 
 
@@ -36,44 +36,3 @@ Local_key::reset(Key k)
        octaves[i] = k;
 }
 
-Array<int>
-Key::read(Array<Scalar> s)
-{
-    Array<int> newkey;
-    for (int j = 0; j < 7; j++)
-       accidentals[j] = 0;
-   
-    for (int i=0; i < s.size(); ) {
-       int large = s[i++];
-       int small = s[i++];
-       accidentals[large]=small;
-
-       newkey.push(large);
-       newkey.push(small);
-    }
-    return newkey;
-}
-
-Array<int>
-Key::oldkey_undo(Array<Scalar>s)
-{
-    Array<int> oldkey;
-    Array<int> newkey;
-    newkey.set_size(7);
-    for (int i=0; i < newkey.size(); i++)
-       newkey[i] = 0;
-       
-    for (int i=0; i < s.size(); ) {
-       int large = s[i++];
-       int small = s[i++];
-       newkey[large] = small;
-    }
-    for (int i=0; i < newkey.size(); i++)
-       if (accidentals[i] && accidentals[i] != newkey[i]) {
-           oldkey.push(i);
-           oldkey.push(0);
-       }
-    
-
-    return oldkey;
-}
index 22cf0e6d01a885827ccc0844bfb6d6b014b0ca6d..6b465572dd13375d9bfe6c74a2952a36ca58913f 100644 (file)
@@ -4,43 +4,45 @@
 #include "molecule.hh"
 #include "paperdef.hh"
 #include "lookup.hh"
-#include "clef.hh"
+//#include "clefreg.hh"
+#include "keyreg.hh"
 
 const int FLAT_TOP_PITCH=2; /* fes,ges,as and bes typeset in lower octave */
 const int SHARP_TOP_PITCH=4; /*  ais and bis typeset in lower octave */
 
-NAME_METHOD(Keyitem);
+NAME_METHOD(Key_item);
 
-Keyitem::Keyitem(int c)
+Key_item::Key_item(int c)
 {
-    c_position = c;
+    set_c_position(c);
 }
 
 void
-Keyitem::read(Array<int> s)
+Key_item::read(const Key_register& key_reg_r)
 {
-    for (int i = 0 ; i< s.size(); ) {
-       int note = s[i++];
-       int acc = s[i++];
-           
+    const Array<int> &idx_arr =key_reg_r.accidental_idx_arr_; 
+    for (int i = 0 ; i< idx_arr.size(); i++) {
+       int note = idx_arr[i];
+       int acc = key_reg_r.key_.acc(note);
+
        add(note, acc);
     }
 }
 
 void 
-Keyitem::read(const Clef& c)
+Key_item::set_c_position(int c0)
 {
-    int octaves =(abs(c.c0_position_i_) / 7) +1 ;
-    c_position=(c.c0_position_i_ + 7*octaves)%7;
+    int octaves =(abs(c0) / 7) +1 ;
+    c_position=(c0 + 7*octaves)%7;
 }
 
 
 void
-Keyitem::add(int p, int a)
+Key_item::add(int p, int a)
 {
     if ((a<0 && p>FLAT_TOP_PITCH) ||
         (a>0 && p>SHARP_TOP_PITCH)) {
-      p=p-7; /* Typeset below c_position */
+      p -= 7; /* Typeset below c_position */
     }
     pitch.push(p);
     acc.push(a);
@@ -48,7 +50,7 @@ Keyitem::add(int p, int a)
 
 
 Molecule*
-Keyitem::brew_molecule_p()const
+Key_item::brew_molecule_p()const
 {
     Molecule*output = new Molecule;
     Real inter = paper()->internote();
diff --git a/src/keyreg.cc b/src/keyreg.cc
new file mode 100644 (file)
index 0000000..963ebaf
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+  keyreg.cc -- implement Key_register
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+
+  todo: key undo
+  
+  */
+
+#include "keyreg.hh"
+#include "keyitem.hh"
+#include "complexwalker.hh"
+#include "commandrequest.hh"
+#include "stcol.hh"
+#include "localkeyreg.hh"
+#include "musicalrequest.hh"
+
+Key_register::Key_register(Complex_walker*w)
+    : Request_register(w)
+{
+    do_post_move_process();
+}
+
+
+bool
+Key_register::try_request(Request * req_l)
+{
+    if (!req_l->nonmus()->keychange())
+       return false;
+    assert(!keyreq_l_);                // todo
+    keyreq_l_ = req_l->nonmus()->keychange();
+    read_req(keyreq_l_);
+    walk_l_->local_key_reg_p_->local_key_.reset(key_); // ugh
+    return true;
+}
+
+void
+Key_register::process_request()
+{
+    Time_description *time_l = &walk_l_->time_;
+
+    if (!keyreq_l_ &&
+       (!time_l->whole_in_measure_|| !time_l->when_)) {
+       default_key_b_ = true;
+    }
+
+     if (default_key_b_ || keyreq_l_) {
+        kit_p_ = new Key_item(walk_l_->c0_position_i());
+        kit_p_->read(*this);
+        announce_element(Staff_elem_info(kit_p_, keyreq_l_, this));
+     }
+}
+
+void
+Key_register::do_pre_move_process()
+{
+    if (kit_p_) {
+       if (default_key_b_)
+           typeset_breakable_item(0,0,kit_p_);
+       else 
+           typeset_breakable_item(
+               new Key_item(*kit_p_), kit_p_, new Key_item(*kit_p_));
+       kit_p_ = 0;
+    }
+}
+
+
+    
+void
+Key_register::read_req(Key_change_req * r)
+{
+    accidental_idx_arr_.set_size(0);
+    for (int i = 0; i < r->melodic_p_arr_.size(); i ++) {
+       int n_i=r->melodic_p_arr_[i]->notename_i_;
+       key_.set(n_i, r->melodic_p_arr_[i]->accidental_i_);
+       accidental_idx_arr_.push(n_i);
+    }
+}
+
+void
+Key_register::do_post_move_process()
+{
+    keyreq_l_ = 0;
+    default_key_b_ = false;
+    kit_p_ = 0;
+    if (!walk_l_->time_.whole_in_measure_)
+       walk_l_->local_key_reg_p_->local_key_.reset(key_); // ugh
+}
index 5840b3c62eb98dc599af3ce8c8b7b2c50e0aae9c..43a1c2c5a6f4a73685e3ad7cc4f4798643f569d9 100644 (file)
@@ -28,7 +28,7 @@ Input_file::Input_file(String s)
     String pf(s);
     if (pf=="") {
        is = &cin;
-        defined_ch_c_l_m = 0;
+        defined_ch_c_l_ = 0;
         sourcefile_l_ = 0;
     }
     else {
@@ -36,7 +36,7 @@ Input_file::Input_file(String s)
        source_global_l->add( sourcefile_p );
        sourcefile_l_ = sourcefile_p;
        is = sourcefile_l_->istream_l();
-        defined_ch_c_l_m = sourcefile_l_->ch_c_l();
+        defined_ch_c_l_ = sourcefile_l_->ch_c_l();
     }
     cout << "["<<pf<<flush;
 }
index fb288b76a7d2cb0bba3c054a531de4425980f40e..77bad62b2ebc409cc3c63f18d066c155dceb14fb 100644 (file)
@@ -3,24 +3,28 @@
 #include "scalar.hh"
 #include "lookup.hh"
 #include "paperdef.hh"
-#include "request.hh"
+#include "musicalrequest.hh"
 #include "notehead.hh"
+#include "misc.hh"
 
 NAME_METHOD(Local_key_item);
+
 Local_key_item::Local_key_item(int i)
 {
     c0_position  = i;
 }
+
 void
 Local_key_item::add(Item*head_l)
 {
-    group.push(head_l);
+    support_items_.push(head_l);
     add_depedency(head_l);
 }
+
 void
 Local_key_item::add(Melodic_req*m_l)
 {
-    add(m_l->octave, m_l->notename, m_l->accidental);
+    add(m_l->octave_i_, m_l->notename_i_, m_l->accidental_i_);
 }
 void
 Local_key_item::add (int o, int p , int a)
@@ -71,10 +75,7 @@ Local_key_item::brew_molecule_p()const
        delete octmol;
     }
 
-    Interval head_width;
-    for (int i = 0; i  < group.size(); i++) {
-       head_width.unite(group[i]->width());
-    }
+    Interval head_width=itemlist_width(support_items_);
     output->translate(Offset(-output->extent().x.right + head_width.left ,0));
     
     return output;
index bbd4993022a33d44fa0a66ccae756b499abf4e67..56691097862134684307e99afcf138bead95b24f 100644 (file)
@@ -3,7 +3,7 @@
 
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
-
+#include "musicalrequest.hh"
 #include "localkeyreg.hh"
 #include "localkeyitem.hh"
 #include "complexwalker.hh"
@@ -13,17 +13,7 @@ Local_key_register::Local_key_register(Complex_walker*w)
 {
     key_item_p_ = 0;    
 }
-bool
-Local_key_register::try_request(Request*)
-
-{
-    return false;
-}
 
-void
-Local_key_register::process_request()
-{
-}
 void
 Local_key_register::do_pre_move_process()
 {
@@ -38,21 +28,20 @@ Local_key_register::acknowledge_element(Staff_elem_info info)
     if (info.req_l_->melodic()) {
        Melodic_req * melodic_l_ = info.req_l_->melodic();
 
-       if( melodic_l_->forceacc ||
-           walk_l_->local_key_.oct(melodic_l_->octave).acc(melodic_l_->notename)
-           != melodic_l_->accidental) {
+       if( melodic_l_->forceacc_b_ ||
+           local_key_.oct(melodic_l_->octave_i_).acc(melodic_l_->notename_i_)
+           != melodic_l_->accidental_i_) {
            Item * support_l_ = info.elem_p_->item();
        
 
            if (!key_item_p_) {
-               key_item_p_ = new Local_key_item(walk_l_->clef_.c0_position_i_);
-               key_item_p_->c0_position = walk_l_->clef_.c0_position_i_;
+               key_item_p_ = new Local_key_item(walk_l_->c0_position_i());
            }
            
            key_item_p_->add(melodic_l_);
            key_item_p_->add(support_l_);
-           walk_l_->local_key_.oct(melodic_l_->octave)
-               .set(melodic_l_->notename, melodic_l_->accidental);
+           local_key_.oct(melodic_l_->octave_i_)
+               .set(melodic_l_->notename_i_, melodic_l_->accidental_i_);
        }
     }
 }
index 96932e00234d9546ad894b8f5bfe8a878499f47b..a87454e2d15ad10c60e9fa4c06d6d9598e12bee0 100644 (file)
@@ -140,7 +140,7 @@ Lookup::streepjes(int i)
 Symbol
 Lookup::hairpin(Real &wid, bool decresc)
 {
-    int idx = rint(wid / 6 PT);
+    int idx = int(rint(wid / 6 PT));
     if(!idx) idx ++;
     wid = idx*6 PT;
     String idxstr = (decresc)? "decrescendosym" : "crescendosym";
index c54ebc2b397ad5bc10c3146db8e94c47d94c0da0..9d5cbe329773f33b367cf88fe5baa655a9191a5c 100644 (file)
@@ -1,4 +1,4 @@
-#include "request.hh"
+#include "musicalrequest.hh"
 #include "voice.hh"
 #include "staffwalker.hh"
 #include "debug.hh"
@@ -9,43 +9,21 @@
 #include "pscore.hh"
 #include "main.hh"
 
-Lyric_column::Lyric_column(Score_column* s, Lyric_staff* lstaff_l)
-    : Staff_column(s)
+Lyric_column::Lyric_column(Lyric_staff* lstaff_l)
 {
     lstaff_l_ = lstaff_l;
 }
 
 void
-Lyric_column::setup_requests()
+Lyric_column::setup_one_request(Request*req_l)
 {
-    for (int i = 0 ; i < v_elts.size(); i ++) {
-       for (iter_top(v_elts[i]->reqs,j); j.ok(); j++) {
-           Request* req_l = j;
-           if (req_l->barcheck()) {
-               if (tdescription_->whole_in_measure) {
-                   warning( "Barcheck failed ", req_l->defined_ch_c_l_m );
-               }
-           }
-           if (req_l->lreq_l()) {
-               winfo_array_.push(req_l->lreq_l());
-           }
-       }
-    }
+    if (req_l->lreq_l()) 
+       lreq_l_array_.push(req_l->lreq_l());   
 }
 
 void
 Lyric_column::typeset_item(Item *i)
 {    
-    lstaff_l_->pscore_l_->typeset_item(i, score_column_l_->pcol_l_,
+    lstaff_l_->pscore_l_->typeset_item(i, musical_column_l_->pcol_l_,
                                  lstaff_l_->pstaff_l_);
-}    
-
-Word_info::Word_info()
-{
-    lreq_l_ = 0;
-}
-
-Word_info::Word_info(Lyric_req* lreq_l) 
-{
-    lreq_l_ = lreq_l;
 }
index 5b290d3634aea6503ff1f2602a5e40bbef623a87..f8ec193be08636e8cfd50d1a380873350e86fc75 100644 (file)
@@ -1,4 +1,4 @@
-#include "request.hh"
+#include "musicalrequest.hh"
 #include "paperdef.hh"
 #include "lyricitem.hh"
 #include "stem.hh"
@@ -24,5 +24,5 @@ Lyric_item::do_pre_processing()
 
     // test context-error
     if ( tdef_l_->text_str_.pos( "Gates" ) )// :-)
-       warning( "foul word", tdef_l_->defined_ch_c_l_m );
+       warning( "foul word", tdef_l_->defined_ch_c_l_ );
 }
index 279db7ff87b83a08161ed31354acf0adcff33fa4..6d199970c7a78dee39b8274472281507f9043bc9 100644 (file)
@@ -1,12 +1,10 @@
-#include "request.hh"
+#include "musicalrequest.hh"
 #include "voice.hh"
 #include "staffwalker.hh"
 #include "debug.hh"
 #include "staff.hh"
-#include "command.hh"
 #include "lyricstaff.hh"
 #include "lyriccolumn.hh"
-#include "sccol.hh" 
 #include "lyricwalker.hh"
 #include "pscore.hh"
 
@@ -16,9 +14,9 @@ Lyric_staff::Lyric_staff()
 }
 
 Staff_column*
-Lyric_staff::create_col(Score_column*s)
+Lyric_staff::create_col()
 {
-    return new Lyric_column(s,this);
+    return new Lyric_column(this);
 }
 
 void
@@ -29,11 +27,8 @@ Lyric_staff::set_output(PScore*pscore_l)
     pscore_l_->add(pstaff_l_);
 }
 
-void
-Lyric_staff::walk()
+Staff_walker*
+Lyric_staff::get_walker_p()
 {
-    for (Lyric_walker lcols(this); lcols.ok(); lcols++) {
-       lcols.lcol_l()->setup_requests();
-       lcols.process();
-    }
+    return new Lyric_walker(this);
 }
index 160b83ae9e46d2336d6f4be9174d8f46e30b298b..960c1e76e00e4955ba22af5172c235a258d86b95 100644 (file)
@@ -1,42 +1,34 @@
-#include "request.hh"
+/*
+  lyricwalker.cc -- implement Lyric_walker
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Jan Nieuwenhuizen <jan@digicash.nl>
+*/
+
+#include "musicalrequest.hh"
 #include "voice.hh"
 #include "pscore.hh"
 #include "lyricstaff.hh"
 #include "lyricwalker.hh"
-//#include "sccol.hh"
 #include "debug.hh"
 #include "lyricitem.hh"
 
-void
-Lyric_walker::do_word(Word_info)
-{
-}
-
-void
-Lyric_walker::do_INTERPRET_command(Command* )
-{
-}
-
-void
-Lyric_walker::do_TYPESET_command(Command* )
-{
-}
-
 void
 Lyric_walker::process_requests()
 {
-    Lyric_column* lcol_l = Lyric_walker::lcol_l();
-
-    for (int i = 0; i <  lcol_l->winfo_array_.size(); i++)  {
-       lcol_l->typeset_item(new Lyric_item(lcol_l->winfo_array_[i].lreq_l_, i));
+    allow_break();
+    for (int i = 0; i <  lcol_l()->lreq_l_array_.size(); i++)  {
+       lcol_l()->typeset_item(
+           new Lyric_item(lcol_l()->lreq_l_array_[i],i)
+           );
     }
-    
 }
 
 Lyric_walker::Lyric_walker(Lyric_staff* lstaff_l)
     : Staff_walker(lstaff_l, lstaff_l->pstaff_l_->pscore_l_)
 {
-    reset();
+
 }
 
 
@@ -52,9 +44,3 @@ Lyric_walker::lcol_l()
 {
     return (Lyric_column*) *(*this);
 }
-
-void
-Lyric_walker::reset()
-{
-}
-
index 8c4af238188dfbc5017d4add2a7994593398fe4f..4f06b6469ec50d48f25d9a1fe997056528009664 100644 (file)
@@ -13,6 +13,6 @@ Molecule*
 Meter::brew_molecule_p()const
 {
     Symbol s = paper()->lookup_p_->meter(args);
-return new Molecule(Atom(s));
+    return new Molecule(Atom(s));
 }
 
diff --git a/src/meterreg.cc b/src/meterreg.cc
new file mode 100644 (file)
index 0000000..e7d8b8e
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+  meterreg.cc -- implement Meter_register
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "meterreg.hh"
+#include "meter.hh"
+#include "commandrequest.hh"
+
+Meter_register::Meter_register(Complex_walker*w)
+    : Request_register(w)
+{
+    do_post_move_process();
+}
+
+bool
+Meter_register::try_request(Request*r_l)
+{
+    if (!r_l->nonmus()->meterchange()) 
+       return false;
+
+    assert(!meter_req_l_);
+    meter_req_l_ = r_l->nonmus()->meterchange();
+
+    return true;
+}
+
+void
+Meter_register::process_request()
+{
+    if (meter_req_l_ ) {
+       Array<Scalar> args;
+       args.push(meter_req_l_->beats_i_);
+       args.push(meter_req_l_->one_beat_i_);
+       
+       meter_p_ = new Meter(args);
+    }
+
+    if (meter_p_)
+       announce_element(Staff_elem_info(meter_p_, meter_req_l_, this) );
+}
+
+void
+Meter_register::do_pre_move_process()
+{
+    if (meter_p_) {
+       Meter * post_p =new Meter(*meter_p_);
+       Meter * pre_p =new Meter(*meter_p_);
+       
+       typeset_breakable_item(pre_p, meter_p_, post_p);
+       meter_p_ =0;
+    }
+}
+
+void
+Meter_register::do_post_move_process()
+{
+    meter_req_l_ = 0;
+    meter_p_ =0;
+}
index a8fe2c026dc16f09ba2fc705cb6fd598b1380224..f89cdec9f1c455f187d92ab49ff4400703f314f6 100644 (file)
@@ -1,16 +1,17 @@
+#include <math.h>
+
+#include "item.hh"
 #include "misc.hh"
 #include "glob.hh"
 #include "moment.hh"
 
-#include <math.h>
 
 Moment
 wholes(int dur, int dots)
 {
     if (!dur)
-       return 0.0;
+       return 0;
 
-    // stupid Intel: doesn't crash if !dur
     Moment f = Rational(1)/Moment(dur);
     Moment delta = f;
 
@@ -36,3 +37,16 @@ log_2(double x) {
     return log(x)  /log(2.0);
 }
 
+Interval
+itemlist_width(const Array<Item*> &its)
+{
+    Interval iv ;
+    iv.set_empty();
+     
+    for (int j =0; j < its.size(); j++){
+       iv.unite (its[j]->width());
+
+    }
+    return iv;
+}
+
index de6fcc7238c90ad370eae012f44424c1d76bc4a5..7af820ae449efcfc859a7d71a7c6e225b36ab1b6 100644 (file)
@@ -24,7 +24,7 @@ static Keyword_ent the_key_tab[]={
     "goto", GOTO,
     "in", IN_T,
     "key", KEY,
-    "mark", MARK,
+
     "meter", METER,
     "mm", MM_T,
     "multivoice", MULTIVOICE,
@@ -81,7 +81,7 @@ My_flex_lexer::My_flex_lexer()
     keytable = new Keyword_table(the_key_tab);
     the_id_tab = new Assoc<String, Identifier*>;
     defaulttab = 0;
-    data_ch_c_l_m = 0;
+    data_ch_c_l_ = 0;
     errorlevel_i_ = 0;
 }
 
@@ -103,7 +103,7 @@ My_flex_lexer::lookup_identifier(String s)
 char const*
 My_flex_lexer::here_ch_c_l()
 {
-    return data_ch_c_l_m ? data_ch_c_l_m + yyin->tellg() : 0;
+    return data_ch_c_l_ ? data_ch_c_l_ + yyin->tellg() : 0;
 }
 
 void
@@ -155,16 +155,16 @@ My_flex_lexer::new_input(String s)
    if (!include_stack.empty()) {
        include_stack.top()->line = lineno();
             // should this be saved at all?
-       include_stack.top()->defined_ch_c_l_m = defined_ch_c_l;
+       include_stack.top()->defined_ch_c_l_ = defined_ch_c_l;
    }
 
    Input_file *newin = new Input_file(s);
    include_stack.push(newin);
    switch_streams(newin->is);
    if ( newin->sourcefile_l_ )
-       data_ch_c_l_m = newin->sourcefile_l_->ch_c_l();
+       data_ch_c_l_ = newin->sourcefile_l_->ch_c_l();
    else
-       data_ch_c_l_m = 0;
+       data_ch_c_l_ = 0;
 
    yylineno = 1;
 }
@@ -181,7 +181,7 @@ My_flex_lexer::close_input()
        Input_file *i = include_stack.top();
        switch_streams(i->is);
        yylineno = i->line;     
-       defined_ch_c_l = i->defined_ch_c_l_m;
+       defined_ch_c_l = i->defined_ch_c_l_;
     }
     delete old;
     return ok;
index 796090f04dc874e79e93601dd6e38765d7abd8ab..2a89743e95aaa17fdc1da20d376c7e5a5e521fd0 100644 (file)
@@ -6,7 +6,8 @@
 #include "string.hh"
 #include "real.hh"
 #include "debug.hh"
-#include "request.hh"
+#include "musicalrequest.hh"
+#include "commandrequest.hh"
 #include "voice.hh"
 #include "notename.hh"
 #include "identparent.hh"
@@ -48,7 +49,7 @@ get_text(String s) return t;
     t= new Text_def;
     t->text_str_= s;
     t->style_str_ = textstyle;
-    t->defined_ch_c_l_m = defined_ch_c_l;
+    t->defined_ch_c_l_ = defined_ch_c_l;
     return t;
 }
 
@@ -74,40 +75,37 @@ parse_octave (const char *a, int &j, int &oct)
 }
 
 void 
-parse_pitchmod( const char *a, int &j, int &oct, bool & overide_acc)
+parse_pitch( const char *a, Melodic_req* mel_l)
 {
+    int j=0;
+
     // octave
-    oct =default_octave;
-    parse_octave(a,j,oct);
-       
+    mel_l->octave_i_ = default_octave;
+    parse_octave(a,j,mel_l->octave_i_);
+
     // accidental
-    overide_acc = false;
+    mel_l->forceacc_b_ = false;
     
-    if (a[j] == '!')
-       {       
-       overide_acc = true;
+    if (a[j] == '!'){
+       mel_l->forceacc_b_ = true;
        j++;
-       }
-
-    mtor << "oct " << oct;
-    mtor << "override: " << overide_acc<<'\n';
+    }
 }
 
-
 Voice_element *
 get_note_element(String pitch, int * notename, int * duration )
 {
     Voice_element*v = new Voice_element;
-    v->defined_ch_c_l_m = defined_ch_c_l;
-    int i=0;
+    v->defined_ch_c_l_ = defined_ch_c_l;
+
     
     int dur = duration[0];
-    int dots=duration[1];
+    int dots = duration[1];
 
     if (dur >= 2) {
        Stem_req * stem_req_p = new Stem_req(dur,dots);
        stem_req_p->plet_factor = Moment(default_plet_dur, default_plet_type);
-       stem_req_p->defined_ch_c_l_m = defined_ch_c_l;
+       stem_req_p->defined_ch_c_l_ = defined_ch_c_l;
        v->add(stem_req_p);
     }
     
@@ -115,19 +113,15 @@ get_note_element(String pitch, int * notename, int * duration )
         defined_ch_c_l = lexer->here_ch_c_l();
 
     Note_req * rq = new Note_req;
-    
-    int oct;
-    bool forceacc;
-    parse_pitchmod(pitch, i, oct, forceacc);
-    rq->notename =notename[0];
-    rq->accidental = notename[1];
-    rq->octave = oct + notename[2];
-    rq->forceacc = forceacc;
+    rq->notename_i_ =notename[0];
+    rq->accidental_i_ = notename[1];
+    parse_pitch(pitch, rq);
+    rq->octave_i_ += notename[2];
+
     rq->balltype = dur;
     rq->dots = dots;
     rq->plet_factor = Moment(default_plet_dur, default_plet_type);
-    rq->defined_ch_c_l_m = defined_ch_c_l;
-    rq->print();
+    rq->defined_ch_c_l_ = defined_ch_c_l;
 
     v->add(rq);
 
@@ -138,25 +132,20 @@ Voice_element*
 get_word_element(Text_def* tdef_p, int* duration)
 {
     Voice_element* velt_p = new Voice_element;
-    velt_p->defined_ch_c_l_m = defined_ch_c_l;
+    velt_p->defined_ch_c_l_ = defined_ch_c_l;
     
     int dur = duration[0];
     int dots=duration[1];
     
-    tdef_p->defined_ch_c_l_m = defined_ch_c_l;
-#if 0
-    char buf[ 21 ];
-    strncpy( buf, tdef_p->defined_ch_c_l_m, 20 );
-    buf[ 20 ] = 0;
-    cout << hex << (void*)tdef_p->defined_ch_c_l_m << dec << buf << endl;
-#endif
+    tdef_p->defined_ch_c_l_ = defined_ch_c_l;
+
     Lyric_req* lreq_p = new Lyric_req(tdef_p);
 
     lreq_p->balltype = dur;
     lreq_p->dots = dots;
     lreq_p->plet_factor = Moment(default_plet_dur, default_plet_type);
     lreq_p->print();
-    lreq_p->defined_ch_c_l_m = defined_ch_c_l;
+    lreq_p->defined_ch_c_l_ = defined_ch_c_l;
 
     velt_p->add(lreq_p);
 
@@ -167,14 +156,14 @@ Voice_element *
 get_rest_element(String,  int * duration )
 {    
     Voice_element* velt_p = new Voice_element;
-    velt_p->defined_ch_c_l_m = defined_ch_c_l;
+    velt_p->defined_ch_c_l_ = defined_ch_c_l;
 
     Rest_req * rest_req_p = new Rest_req;
     rest_req_p->plet_factor = Moment(default_plet_dur, default_plet_type);
     rest_req_p->balltype = duration[0];
     rest_req_p->dots = duration[1];    
     rest_req_p->print();
-    rest_req_p->defined_ch_c_l_m = defined_ch_c_l;
+    rest_req_p->defined_ch_c_l_ = defined_ch_c_l;
 
     velt_p->add(rest_req_p);
 
@@ -247,7 +236,7 @@ get_request(char c)
        break;
     }
 
-    req_p->defined_ch_c_l_m = req_defined_ch_c_l;
+    req_p->defined_ch_c_l_ = req_defined_ch_c_l;
     return req_p;
 }
 
@@ -289,8 +278,6 @@ Request*
 get_script_req(int d , Script_def*def)
 {
     Script_req* script_req_p = new Script_req(d, def);
-    // all terminal symbols, rather set directly here:
-    script_req_p->defined_ch_c_l_m = lexer->here_ch_c_l();
     return script_req_p;
 }
 
@@ -298,49 +285,24 @@ Request*
 get_text_req(int d , Text_def*def)
 {
     Text_req* text_req_p = new Text_req(d, def);
-    text_req_p->defined_ch_c_l_m = defined_ch_c_l;
     return text_req_p;
 }
 
-Voice_element*
-get_mark_element(String s)
-{
-    Voice_element*v_p = new Voice_element;
-    v_p->defined_ch_c_l_m = defined_ch_c_l;
-    Mark_req* mark_req_p = new Mark_req(s);
-    mark_req_p->defined_ch_c_l_m = defined_ch_c_l;
-    v_p->add(mark_req_p); 
-    return v_p;
-}
-Voice_element*
-get_command_element(Input_command*com_p)
-{
-    Voice_element *velt_p = new Voice_element;
-    velt_p->defined_ch_c_l_m = defined_ch_c_l;
-    Staff_command_req* scommand_req_p = new Staff_command_req(com_p);
-    scommand_req_p->defined_ch_c_l_m = defined_ch_c_l;
-    velt_p->add(scommand_req_p);
-    return velt_p;
-}
-Voice_element*
-get_barcheck_element()
+Request*
+get_stemdir_req(int d)
 {
-    Voice_element* velt_p = new Voice_element;
-    velt_p->defined_ch_c_l_m = req_defined_ch_c_l;
-    Barcheck_req* barcheck_req_p = new Barcheck_req;
-    barcheck_req_p->defined_ch_c_l_m = req_defined_ch_c_l;
-    velt_p->add(barcheck_req_p);
-    return velt_p;
+    Group_feature_req * gfreq_p = new Group_feature_req;
+    gfreq_p->stemdir_i_ =d; 
+    return gfreq_p;
 }
 
-Voice_element*
-get_stemdir_element(int d)
+Request*
+get_grouping_req(Array<int> i_arr)
 {
-    Voice_element*v_p = new Voice_element;
-    v_p->defined_ch_c_l_m = req_defined_ch_c_l;
-    Group_feature_req * gfreq_p = new Group_feature_req;
-    gfreq_p->stemdir_i_ =d; 
-    gfreq_p->defined_ch_c_l_m = req_defined_ch_c_l;
-    v_p->add(gfreq_p);
-    return v_p;
+    Measure_grouping_req * mr_p = new Measure_grouping_req;
+    for (int i=0; i <i_arr.size(); ) {
+       mr_p->beat_i_arr_.push(i_arr[i++]);
+       mr_p->elt_length_arr_.push(Moment(1, i_arr[i++]));
+    }
+    return mr_p;
 }
index 2eabd2ff73172d5c5cf505df325f42e36cb0f436..a0c031c106699fb22084f7ddfbeaa8c5693bcd39 100644 (file)
@@ -5,7 +5,7 @@
 #include "paperdef.hh"
 #include "lookup.hh"
 #include "molecule.hh"
-#include "request.hh"
+#include "musicalrequest.hh"
 
 NAME_METHOD(Notehead);
 
index 5a307d847d8139c59d01c44daf1c2c1ce46e34a1..6c471fc95f1f1efb98b944b50004021b7abae696 100644 (file)
@@ -8,11 +8,12 @@
 #include "inputscore.hh"
 #include "main.hh"
 #include "keyword.hh"
-#include "inputcommand.hh"
 #include "debug.hh"
 #include "parseconstruct.hh"
 #include "dimen.hh"
 #include "identifier.hh"
+#include "commandrequest.hh"
+#include "musicalrequest.hh"
 
 #ifndef NDEBUG
 #define YYDEBUG 1
@@ -31,9 +32,8 @@ int fatal_error_i = 0;
 %union {
     Request * request;
     Real real;
-    Input_command *command;
     Identifier *id;    
-    Voice *voice;    
+   Voice *voice;    
     Voice_element *el; 
     String *string;
     const char *consstr;
@@ -47,9 +47,8 @@ int fatal_error_i = 0;
        Moment *moment;
 
     Array<String> * strvec;
-    Array<Input_command*> *commandvec;
     Array<int> *intvec;
-
+    Array<Melodic_req*> *melreqvec;
     Input_staff *staff;    
     Input_score *score;
     Symtables * symtables;
@@ -69,7 +68,7 @@ int fatal_error_i = 0;
 %token KEY CLEF  TABLE  VOICES STEM
 %token PARTIAL MUSIC GROUPING CADENZA
 %token END SYMBOLTABLES TEXID TABLE NOTENAMES SCRIPT TEXTSTYLE PLET
-%token MARK GOTO
+%token  GOTO
 
 %token <id>  IDENTIFIER
 %token <string> PITCHMOD DURATION RESTNAME
@@ -79,7 +78,7 @@ int fatal_error_i = 0;
 
 %token <i> DOTS INT
 %type <real> unit
-%type <intvec> pitch_list 
+%type <melreqvec> pitch_list 
 %type <c> open_request_parens close_request_parens
 %type <id> declaration
 %type <string> declarable_identifier
@@ -88,15 +87,13 @@ int fatal_error_i = 0;
 %type <ii>  default_duration explicit_duration notemode_duration mudela_duration
 %type <ii> notename
 %type <moment> duration_length
-%type <el> voice_elt full_element lyrics_elt
-%type <command> score_command staff_command position_command
+%type <el> voice_elt full_element lyrics_elt command_elt
+
 %type <score> score_block score_body
 %type <staff> staff_block staff_init staff_body
 %type <i> int
-%type <intvec> int_list intastint_list
-%type <commandvec> score_commands_block score_commands_body
-%type <commandvec> staff_commands_block staff_commands_body
-%type <request> post_request pre_request 
+%type <intvec> intastint_list
+%type <request> post_request pre_request command_req
 %type <string> pitchmod
 %type <music> music 
 %type <chord> music_chord music_chord_body
@@ -145,7 +142,7 @@ declarable_identifier:
 declaration:
        declarable_identifier '=' staff_block  {
                $$ = new Staff_id(*$1, $3);
-               delete $1; // this sux
+               delete $1; 
        }
        | declarable_identifier '=' music_voice {
                $$ = new M_voice_id(*$1, $3);
@@ -172,7 +169,7 @@ declaration:
                delete $1;
        }
        | declarable_identifier error '}' {
-//             warning( "parse error", lexer->here_ch_c_l() );
+
        }
        ;
 
@@ -195,13 +192,13 @@ notename_tab_body:                                {
 /*
        SCORE
 */
-score_block: SCORE 
-               { define_spots.push(lexer->here_ch_c_l()); }
-       '{' score_body '}'      {
+score_block:
+       SCORE { define_spots.push(lexer->here_ch_c_l()); }
+       /*cont*/ '{' score_body '}'     {
                $$ = $4;
                $$->defined_ch_c_l_ = define_spots.pop();
-               if (!$$->paper_)
-                       $$->paper_ = default_paper();
+               if (!$$->paper_p_)
+                       $$->paper_p_ = default_paper();
 
                /* handle error levels. */
                $$->errorlevel_i_ = lexer->errorlevel_i_;
@@ -213,68 +210,15 @@ score_body:               {
                $$ = new Input_score; 
        }
        | score_body staff_block        { $$->add($2); }
-       | score_body score_commands_block       {
-               $$->add(*$2);
-               delete $2;
+       | score_body COMMANDS '{' music_voice_body '}'          {
+               $$->set($4);
        }
        | score_body paper_block                { $$->set($2);  }
-       ;
-/*
-       COMMANDS
-*/
-score_commands_block:
-       COMMANDS '{' score_commands_body '}' { $$ =$3;}
-       | COMMANDS '{' error '}' {
-//             warning( "parse error", lexer->here_ch_c_l() );
-       }
-       ;
-
-score_commands_body:                   { $$ = new Array<Input_command*>; }
-       | score_commands_body score_command             {
-               $$->push($2);
-       }
-       | score_commands_body position_command          {
-               $$->push($2);
-       }
-       ;
-
-staff_commands_block: COMMANDS '{' staff_commands_body '}'     {       
-               $$ = $3; }
-       ;
-
-staff_commands_body:
-       /* empty */                     { $$ = new Array<Input_command*>; }
-       | staff_commands_body staff_command     {
-               $$->push($2);
-       }
-       | staff_commands_body position_command  {
-               $$->push($2);
-       }
-       ;
+       | score_body error {
 
-staff_command:
-       KEY pitch_list  {/*UGH*/
-               $$ = get_key_interpret_command(*$2);
-               delete $2;
-       }
-       | CLEF STRING                   {
-               $$ = get_clef_interpret_command(*$2);
-               delete $2;
-       }
-       ;
-
-position_command:
-       SKIP int ':' duration_length            {
-               $$ = get_skip_command($2, *$4);
-               delete $4;
-       }
-       | GOTO STRING   {
-               $$ = get_goto_command(*$2);
-               delete $2;
        }
        ;
 
-
 intastint_list:
        /* */   { $$ =new Array<int>; }
        | intastint_list int '*' int    {
@@ -282,28 +226,6 @@ intastint_list:
        }
        ;
 
-score_command:
-       BAR STRING                      {
-               $$ = get_bar_command(*$2);
-               delete $2;
-       }
-       | METER  int '*' int            {
-               $$ = get_meterchange_command($2, $4);
-       }
-       | PARTIAL duration_length               {
-               $$ = get_partial_command(*$2);
-               delete $2;
-       }
-       | GROUPING intastint_list               {
-               $$ = get_grouping_command(*$2);
-               delete $2;
-       }
-       | CADENZA int   {
-               $$ = get_cadenza_toggle($2);
-       }
-       ;
-
-
 
 /*
        PAPER
@@ -326,7 +248,7 @@ paper_body:
        | paper_body UNITSPACE dim      { $$->whole_width = $3; }
        | paper_body GEOMETRIC REAL     { $$->geometric_ = $3; }
        | paper_body error {
-//             warning( "parse error", lexer->here_ch_c_l() );
+
        }
        ;
 
@@ -353,16 +275,14 @@ staff_init:
 
 staff_body:
        staff_init
+       | staff_body COMMANDS '{' music_voice_body '}'  {
+               $$->set_score_wide($4);
+       }
        | staff_body music      {
                $2->set_default_group( "staff_music" + String($$->music_.size()));
                $$->add($2);
        }
-       | staff_body staff_commands_block {
-               $$->add(*$2);
-               delete $2;
-       }
        | staff_body error {
-//             warning( "parse error", lexer->here_ch_c_l() );
        }
        ;
 
@@ -393,7 +313,6 @@ music_voice_body:
                $$->add($2);
        }
        | music_voice_body error {
-//             warning( "parse error", lexer->here_ch_c_l() );
        }
        ;
 
@@ -411,13 +330,12 @@ music_chord_body:
                $$->concatenate($2->mchord(true));
        }
        | music_chord_body music {
-               $$ -> add($2);
+               $$->add($2);
        }
        | music_chord_body full_element {
                $$ ->add_elt($2);
        }
        | music_chord_body error {
-//             warning( "parse error", lexer->here_ch_c_l() );
        }
        ;
 
@@ -431,40 +349,77 @@ full_element:     pre_requests voice_elt post_requests {
                add_requests($2, post_reqs);
                $$ = $2;
        }
-       | MARK STRING   {
-               $$ = get_mark_element(*$2);
+       | lyrics_elt
+       | command_elt
+       ;
+
+command_elt:
+       command_req     {
+               $$ = new Voice_element;
+               $$->add($1);
+               $1-> defined_ch_c_l_ = lexer->here_ch_c_l();
+       }
+/* can't do this, since "| |" has  shift/reduce conflict. :
+       command_elt command_req { .. }
+*/
+       ;
+
+command_req:
+        '|'                            { 
+               $$ = new Barcheck_req;
+       }
+       | BAR STRING                    {
+               $$ = new Bar_req(*$2);
+               delete $2;
+       }
+       | METER '{' int '*' int '}'     {
+               Meter_change_req *m = new Meter_change_req;
+               m->set($3,$5);
+               $$ = m;
+       }
+       | SKIP duration_length {
+               Skip_req * skip_p = new Skip_req;
+               skip_p->duration_ = *$2;
                delete $2;
+               $$ = skip_p;
        }
-       | COMMAND '{' staff_command '}' { $$=get_command_element($3); }
-       | COMMAND '{' score_command '}' { $$=get_command_element($3); }
-       | '|'                           { 
-               req_defined_ch_c_l = lexer->here_ch_c_l();
-               $$ = get_barcheck_element(); 
+       | CADENZA int   {
+               $$ = new Cadenza_req($2);
+       }
+       | PARTIAL duration_length       {
+               $$ = new Partial_measure_req(*$2);
+               delete $2;
        }
        | STEM '{' int '}'              {
-               req_defined_ch_c_l = lexer->here_ch_c_l();
-               $$ = get_stemdir_element($3);
+               $$ = get_stemdir_req($3);
+       }
+       | CLEF STRING {
+               $$ = new Clef_change_req(*$2);
+               delete $2;
+       }
+       | KEY '{' pitch_list '}'        {       
+               Key_change_req *key_p= new Key_change_req;
+               key_p->melodic_p_arr_ = *$3;
+               $$ = key_p;
+               delete $3;
+       }
+       | GROUPING '{' intastint_list '}' {
+               $$ = get_grouping_req(*$3); delete $3;
        }
-       | lyrics_elt
-/*
-+      | pre_requests voice_elt post_requests error '|' { 
-+              warning( "parse error", lexer->here_ch_c_l() );
-+      }
-+ */
        ;
-               
+
 post_requests:
        {
                assert(post_reqs.empty());
        }
        | post_requests post_request {
+               $2->defined_ch_c_l_ = lexer->here_ch_c_l();
                post_reqs.push($2);
        }
        ;
 
 post_request:
        close_request_parens    { 
-               req_defined_ch_c_l = lexer->here_ch_c_l();
                $$ = get_request($1); 
        }
        | script_req
@@ -473,22 +428,18 @@ post_request:
 
 close_request_parens:
        '('     { 
-               req_defined_ch_c_l = lexer->here_ch_c_l();
                $$='(';
        }
        | ']'   { 
-               req_defined_ch_c_l = lexer->here_ch_c_l();
                $$ = ']';
        }
        ;
   
 open_request_parens:
        ')'     { 
-               req_defined_ch_c_l = lexer->here_ch_c_l();
                $$=')';
        }
        | '['   {
-               req_defined_ch_c_l = lexer->here_ch_c_l();
                $$='[';
        }
        ;
@@ -552,6 +503,7 @@ script_dir:
 pre_requests:
        | pre_requests pre_request {
                pre_reqs.push($2);
+               $2->defined_ch_c_l_ = lexer->here_ch_c_l();
        }
        ;
 
@@ -665,13 +617,15 @@ lyrics_elt:
 
 /*
        UTILITIES
-*/
+ */
 pitch_list:                    {
-               $$ = new Array<int>;
+               $$ = new Array<Melodic_req*>;
        }
        | pitch_list NOTENAME   {
-               $$->push($2[0]);
-               $$->push($2[1]);                
+               Melodic_req *m_p = new Melodic_req;
+               m_p->notename_i_ = $2[0];
+               m_p->accidental_i_ = $2[1];
+               $$->push(m_p);
        }
        ;
 
@@ -696,14 +650,6 @@ real:
        ;
        
 
-int_list:              {
-               $$ = new Array<int>;
-       }
-       | int_list int          {
-               $$->push($2);
-       }
-       ;
-
 
 dim:
        real unit       { $$ = $1*$2; }
@@ -784,8 +730,6 @@ dinterval: dim      dim             {
 void
 yyerror(const char *s)
 {
-//     if ( YYRECOVERING() ) 
-//             return;
        lexer->LexerError(s);
 
        if ( fatal_error_i )
@@ -816,7 +760,8 @@ parse_file(String init, String s)
    delete lexer;
    lexer = 0;
 
-   assert(define_spots.empty());
+   if(!define_spots.empty())
+       warning("Braces don't match.",0);
 }
 
 Paperdef*
index 54e177f4860c30ee438f68303814be75e8c2f57d..5256947ce77c33fdb1eeb46d15d9595dbae9f595 100644 (file)
@@ -37,7 +37,7 @@ PCol::print() const
        mtor << "rank: " << rank() << '\n';
 
     mtor << "# symbols: " << its.size() ;
-    if (breakable()){
+    if (breakable_b()){
        mtor << "\npre,post: ";
        prebreak_p_->print();
        postbreak_p_->print();
@@ -76,7 +76,7 @@ PCol::OK() const
 void
 PCol::set_breakable()
 {
-    if (breakable())
+    if (breakable_b())
        return;
 
     prebreak_p_ = new PCol(this);
@@ -86,7 +86,7 @@ PCol::set_breakable()
 }
 
 bool
-PCol::breakable() const
+PCol::breakable_b() const
 {
     return prebreak_p_||postbreak_p_;
 }
@@ -117,5 +117,5 @@ PCol::add( Item *i)
 bool
 PCol::used()const
 {
-    return breakable() || its.size();
+    return breakable_b() || its.size();
 }
index 34f0e09c28bf466e8074a407ff71a8f260c204e6..c18fe83e01434433f6fba4610b236eae74d302dd 100644 (file)
@@ -103,7 +103,7 @@ void
 PScore::add(PCol *p)
 {
     p->pscore_l_ = this;
-    if (p->breakable()){
+    if (p->breakable_b()){
        p->prebreak_p_->pscore_l_ = this;
        p->postbreak_p_->pscore_l_ = this;
     }
index 1e3e2f67d495cf59dade64ff5ee47ae4beda1571..e6696acf39966b4a25c72a77f70d89f67d898370 100644 (file)
@@ -46,6 +46,14 @@ Ineq_constrained_qp::eval (Vector v)
 {
     return v * quad * v + lin * v + const_term;
 }
+
+/**
+    eliminate appropriate variables, until we have a Ineq_constrained_qp
+    then solve that.
+
+    PRE
+    cons should be ascending
+    */
 Vector
 Mixed_qp::solve(Vector start) const 
 {
@@ -65,6 +73,8 @@ Mixed_qp::solve(Vector start) const
 
 /*
     assume x(idx) == value, and adjust constraints, lin and quad accordingly
+
+    TODO: add const_term
     */
 void
 Ineq_constrained_qp::eliminate_var(int idx, Real value)
@@ -118,15 +128,6 @@ Ineq_constrained_qp::print() const
 
 /* *************** */
 
-/*
-    eliminate appropriate variables, until we have a Ineq_constrained_qp
-    then solve that.
-
-    PRE
-    cons should be ascending
-    */
-
-
 Mixed_qp::Mixed_qp(int n)
     : Ineq_constrained_qp(n)
 {
index ed49c2a02f8a5d2c6e3e0962a8a1f69dd78756ce..5738be2f3b0223c9236af8e481e72685f2f0bc17 100644 (file)
@@ -133,7 +133,7 @@ Active_constraints::Active_constraints(Ineq_constrained_qp const *op)
     H=chol.inverse();
 }
 
-/* Find the optimum which is in the planes generated by the active
+/** Find the optimum which is in the planes generated by the active
     constraints.        
     */
 Vector
@@ -158,8 +158,8 @@ min_elt_index(Vector v)
     return idx;
 }
 
-///the numerical solving
-/** Mordecai Avriel, Nonlinear Programming: analysis and methods (1976)
+
+/**the numerical solving. Mordecai Avriel, Nonlinear Programming: analysis and methods (1976)
     Prentice Hall.
 
     Section 13.3
@@ -183,8 +183,9 @@ Ineq_constrained_qp::solve(Vector start) const
     
     Vector x(start);
     Vector gradient=quad*x+lin;
-
-
+//    Real fvalue = x*quad*x/2 + lin*x + const_term;
+// it's no use.
+    
     Vector last_gradient(gradient);
     int iterations=0;
     
index 7eeeb46ada77dfcc07de9dea3a25537d1111d91e..d58f2622959d8f3bfeae718808bb51cb65bd8c6a 100644 (file)
@@ -7,7 +7,7 @@
 */
 
 #include "voice.hh"
-#include "request.hh"
+#include "musicalrequest.hh"
 #include "register.hh"
 #include "notehead.hh"
 #include "complexwalker.hh"
@@ -18,7 +18,7 @@ Staff_elem_info::Staff_elem_info(Staff_elem*s_l, Request*r_l,
                                 Request_register *reg_l)
 {
     elem_p_ = s_l;
-    voice_l_ = r_l->elt_l_->voice_l_;
+    voice_l_ =  (r_l)?r_l->elt_l_->voice_l_:0;
     req_l_ = r_l;
     group_regs_l_ = 0;
     origin_reg_l_ = reg_l;
@@ -35,6 +35,11 @@ Staff_elem_info::Staff_elem_info()
 }
 
 /* *************** */
+bool
+Request_register::try_request(Request*)
+{
+    return false;
+}
 
 Request_register::Request_register()
 {
@@ -80,3 +85,11 @@ Request_register::paper()const
 {
     return walk_l_->staff()->paper();
 }
+
+void
+Request_register::typeset_breakable_item(Item * pre_p , Item * nobreak_p,
+                                        Item * post_p)
+{
+    walk_l_->typeset_breakable_item(pre_p,  nobreak_p,post_p);
+}
+
index 951a509bc41a2e9b97f4d8e9fa0a6c7130d05a97..72b8a3544aa3fed86ba3ae8d4c1c20da00a27272 100644 (file)
@@ -1,11 +1,17 @@
-#include "request.hh"
+/*
+  request.cc -- implement all musical requests.
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "musicalrequest.hh"
 #include "misc.hh"
 #include "debug.hh"
 #include "scriptdef.hh"
 #include "textdef.hh"
 
-#include "inputcommand.hh"
-
 void
 Stem_req::do_print() const
 {
@@ -19,20 +25,14 @@ Stem_req::Stem_req(int s, int d)
     dir_i_ = 0;
 }
 
-/* *************** */
-void
-Barcheck_req::do_print() const    
-{
-#ifndef NPRINT
-
-#endif
-}
+/* ************** */
+void Musical_req::do_print()const{}
+void Request::do_print() const{}
 
 /* *************** */
 
 void
 Request::print() const
-
 {
     mtor << name() << " {";
     do_print();
@@ -40,12 +40,6 @@ Request::print() const
 }
      
 
-void
-Request::do_print() const    
-{
-#ifndef NPRINT
-#endif
-}
 
 void
 Span_req::do_print() const    
@@ -58,12 +52,12 @@ Span_req::do_print() const
 Request::Request()
 {
     elt_l_ = 0;
-    defined_ch_c_l_m = 0;
+    defined_ch_c_l_ = 0;
 }
 Request::Request(Request const&src)
 {
     elt_l_ = 0;
-    defined_ch_c_l_m = src.defined_ch_c_l_m;
+    defined_ch_c_l_ = src.defined_ch_c_l_;
 }
 /* *************** */
 Spacing_req::Spacing_req()
@@ -85,22 +79,22 @@ Blank_req::do_print()const
 /* *************** */
 Melodic_req::Melodic_req()
 {
-    notename = 0;
-    octave = 0;
-    accidental = 0;
-    forceacc = false;
+    notename_i_ = 0;
+    octave_i_ = 0;
+    accidental_i_ = 0;
+    forceacc_b_ = false;
 }
 
 void
 Melodic_req::do_print() const
 {
-    mtor << "notename: " << notename << " oct: "<< octave;
+    mtor << "notename: " << notename_i_ << " oct: "<< octave_i_;
 }
 
 int
 Melodic_req::height() const
 {
-    return  notename + octave*7;
+    return  notename_i_ + octave_i_*7;
 }
 
 /* *************** */
@@ -188,25 +182,7 @@ Span_req::Span_req()
 {
     spantype = NOSPAN;
 }
-/* *************** */
-void
-Group_feature_req::do_print() const
-{
-    mtor << "stemdir " << stemdir_i_;
-}
-Group_feature_req::Group_feature_req()
-{
-    stemdir_i_ = 0;
-}
-void
-Group_change_req::do_print()const
-{
-    mtor << "id : " << newgroup_str_;
-}
-void
-Terminate_voice_req::do_print()const
-{
-}
+
 /* *************** */
 Script_req::Script_req(int d , Script_def*def)
 {
@@ -273,39 +249,17 @@ Text_req::do_print() const
     tdef_p_->print();
 }
 
-
-
 /* *************** */
 
-Mark_req::Mark_req(String s)
+Moment
+Skip_req::duration() const
 {
-    mark_str_ = s;
+    return duration_;
 }
 
 void
-Mark_req::do_print()const
-{
-#ifndef NDEBUG
-    mtor<< " `" << mark_str_ << "\'\n";
-#endif
-}
-/* *************** */
-Staff_command_req::Staff_command_req(Input_command * p)
-{
-    com_p_ = p;
-}
-Staff_command_req::~Staff_command_req()
-{
-    delete com_p_;
-}
-Staff_command_req::Staff_command_req(Staff_command_req const&src)
-{
-    com_p_ = new Input_command(*src.com_p_);
-}
-void
-Staff_command_req::do_print()const
+Skip_req::do_print() const
 {
-    com_p_->print();
+    mtor << "duration: " << duration();
 }
 
-
index 2d826094da5f51b725cb62553594b150e0e47a26..1722599b210ef089f4de69b5433468b6ec0ab0de 100644 (file)
@@ -1,3 +1,11 @@
+/*
+  sccol.cc -- implement Score_column
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
 #include "debug.hh"
 #include "pcol.hh"
 #include "sccol.hh"
@@ -18,7 +26,7 @@ Score_column::Score_column(Moment w)
 {
     when_ = w;
     pcol_l_ = new PCol(0);
-    musical_ = false;
+    musical_b_ = false;
 }
 
 bool
@@ -30,7 +38,7 @@ void
 Score_column::print() const
 {
 #ifndef NPRINT
-    mtor << "Score_column { mus "<< musical_ <<" at " <<  when_<<'\n';
+    mtor << "Score_column { mus "<< musical_b_ <<" at " <<  when_<<'\n';
     mtor << "durations: [";
     for (int i=0; i < durations.size(); i++)
        mtor << durations[i] << " ";
@@ -41,7 +49,7 @@ Score_column::print() const
 }
 
 int
-Tdescription_compare(Moment &a , Moment& b)
+Moment_compare(Moment &a , Moment& b)
 {
     return sign(a-b);
 }
@@ -49,7 +57,7 @@ Tdescription_compare(Moment &a , Moment& b)
 void
 Score_column::preprocess()
 {
-    durations.sort(Tdescription_compare);
+    durations.sort(Moment_compare);
 }
 void
 Score_column::add_duration(Moment d)
@@ -61,3 +69,9 @@ Score_column::add_duration(Moment d)
     }
     durations.push(d);
 }
+
+bool
+Score_column::breakable_b()
+{
+    return pcol_l_->breakable_b();
+}
index 1adcf7dd057837c04ff8cc92b397c3bec00ee25a..3084f90c90e96f64cf1c0cd597a29ce8c798b832 100644 (file)
@@ -1,3 +1,11 @@
+/*
+  score.cc -- implement Score
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
 #include "tstream.hh"
 #include "score.hh"
 #include "sccol.hh"
 #include "main.hh"
 #include "source.hh"
 #include "sourcefile.hh"
+#include "scorewalker.hh"
 
 void
-Score::process()
+Score::setup_music()
 {
-    *mlog << "\nProcessing music ..." << flush;
-    
-    assert (paper_p_);
+    *mlog << "\nSetting up music ..." << flush;
     if (last() == Moment(0)) {
        warning("Need to have music in a score.", defined_ch_c_l_);
     }
 
-    // distribute commands to disciples
     pscore_p_ = new PScore(paper_p_);
+    find_col(0, false)->set_breakable(); // ugh
+    find_col(last(), false)->set_breakable();
+    
+       
+
     for (iter_top(staffs_,i); i.ok(); i++) {
        i->set_output(pscore_p_);
-       i->truncate_cols(last());
-       i->process();
+       i->setup_staffcols();
+       i->OK();
     }
+}
+
+void
+Score::process_music()
+{
+    *mlog << "Processing music ..." << flush;
+    for (Score_walker w(this); w.ok(); w++) {
+       w.process();
+    }
+}
+
+void
+Score::process()
+{
+    setup_music();
+    process_music();
 
     // do this after processing, staffs first have to generate PCols.
-    find_col(last(), false)->set_breakable();
     do_cols();
     print();
     calc_idealspacing();
@@ -36,7 +62,7 @@ Score::process()
     // debugging
     OK();
     *mlog << endl;
-    pscore_p_->process();    
+    pscore_p_->process();
 }
 
 /**
@@ -59,8 +85,11 @@ Score::clean_cols()
 }
 
 /**
+  Create columns at time #w#.
   this sux.  We should have Score_column create the appropriate PCol.
-  Unfortunately, PCols don't know about their position.    
+  Unfortunately, PCols don't know about their position.
+
+  @return cursor pointing to the nonmusical (first) column
   */
 PCursor<Score_column*>
 Score::create_cols(Moment w)
@@ -68,8 +97,8 @@ 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_b_ = false;
+    c2->musical_b_ = true;
     
     iter_top(cols_,i);
 
@@ -94,11 +123,11 @@ Score::create_cols(Moment w)
 
 PCursor<Score_column*>
 Score::find_col(Moment w, bool mus)
-{   iter_top( cols_,i);
-       
+{
+    iter_top( cols_,i);
     
     for (; i.ok(); i++) {
-       if (i->when() == w && i->musical_ == mus)
+       if (i->when() == w && i->musical_b_ == mus)
            return i;
        if (i->when() > w)
            break;
@@ -209,17 +238,3 @@ Score::add(Staff*s)
     s->score_l_ = this;
     staffs_.bottom().add(s);
 }
-
-void
-Score::add_marks(Array<String> s_arr, Array<Moment> m_arr)
-{
-    for (int i=0; i < s_arr.size(); i++) {
-       String mark_str (s_arr[i]);
-       if (markers_assoc_.elt_query(mark_str) &&
-           m_arr[i] != markers_assoc_[mark_str])
-           
-           error("Conflicting marker: `" + s_arr[i]+ "\'");
-       else
-           markers_assoc_[s_arr[i]] = m_arr[i];
-    }
-}
diff --git a/src/scorewalker.cc b/src/scorewalker.cc
new file mode 100644 (file)
index 0000000..760bd29
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+  scorewalker.cc -- implement Score_walker
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+#include "debug.hh"
+#include "plist.hh"
+#include "scorewalker.hh"
+#include "score.hh"
+#include "staffwalker.hh"
+#include "staff.hh"
+#include "sccol.hh"
+
+Score_walker::Score_walker(Score *s)
+    :PCursor<Score_column *> (s->cols_)
+{
+    for (iter_top(s->staffs_,i); i.ok(); i++) {
+       Staff_walker* w_p=i->get_walker_p();
+       w_p->score_walk_l_ =this;
+       walker_p_arr_.push(w_p);
+    }
+
+    if(ok()) {
+       s->find_col(0, false)->set_breakable();
+       s->find_col(s->last(), false)->set_breakable();
+    }
+    reinit();
+}
+
+
+void
+Score_walker::reinit()
+{
+    disallow_break_walk_l_arr = walker_p_arr_;
+    disallow_break_count_ = disallow_break_walk_l_arr.size();
+}
+
+
+/** Advance the cursor, and all Staff_walkers contained in this. Reset
+  runtime fields */
+void 
+Score_walker::operator ++(int )
+{
+    Moment last = ptr()->when();
+    
+    PCursor<Score_column *>::operator++(0);
+    if (ok() && ptr()->when() == last)
+       PCursor<Score_column *>::operator++(0);
+    reinit();
+    if (!ok())
+       return;
+    for (int i=0; i< walker_p_arr_.size(); i++) {
+       if (walker_p_arr_[i]->ok() &&
+           walker_p_arr_[i]->when() < when()) {
+
+           walker_p_arr_[i]->operator++(0);
+       }
+    }
+}
+
+/** Allow the command_column to be breakable for one staff. If all
+  staffs allow, then allow a break here.  */
+void
+Score_walker::allow_break(Staff_walker*w)
+{
+    for (int i=0; i < disallow_break_walk_l_arr.size(); i++) {
+       if (w == disallow_break_walk_l_arr[i]) {
+           disallow_break_count_ --;
+           disallow_break_walk_l_arr[i] =0;
+
+           if (!disallow_break_count_) {
+               PCursor<Score_column*> col_cursor = *this;
+               if (ptr()->musical_b())
+                   col_cursor --;
+               col_cursor->set_breakable();
+           }
+       }
+    }
+}
+
+Moment
+Score_walker::when()
+{
+    return ptr()->when();
+}
+
+void
+Score_walker::process()
+{
+    for (int i=0; i < walker_p_arr_.size(); i++) {
+       Staff_walker *w = walker_p_arr_[i];
+       if ( w->ok() && w->when() == when() ) {
+           walker_p_arr_[i]->process();
+       }
+    }
+    if (when().denominator() == 1) {
+       *mlog << "." <<flush;
+    }
+}
+
+Score_walker::~Score_walker()
+{
+    for (int i=0; i < walker_p_arr_.size(); i++) 
+       delete walker_p_arr_[i];
+}
+
+
index 6316baad54b4d27bfe7080884d845f2f28422f08..db87b6baf1d6583cca20c0e46e2b53a0537a8134 100644 (file)
@@ -1,4 +1,4 @@
-#include "request.hh"
+#include "musicalrequest.hh"
 #include "paperdef.hh"
 #include "script.hh"
 #include "stem.hh"
index 88375db8fe9ad5f110dfcfaade1716e8011b9deb..bff07f54d21c4a717b8a148efc2ed55b0616984b 100644 (file)
@@ -6,7 +6,7 @@
 
 #include "scriptreg.hh"
 #include "script.hh"
-#include "request.hh"
+#include "musicalrequest.hh"
 #include "complexwalker.hh"
 
 Script_register::Script_register(Complex_walker*w)
index 05a7564490bde328c979b3b49895777bb998c903..48f60878be2b1994bb8ea1612497e808e5f02f5b 100644 (file)
@@ -4,10 +4,13 @@
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
 
+#include "musicalrequest.hh"
 #include "complexwalker.hh"
 #include "slurreg.hh"
 #include "slur.hh"
 #include "debug.hh"
+
+
 void
 Slur_register::set_dir(int i)
 {
@@ -54,7 +57,7 @@ Slur_register::process_request()
        if (slur_req_l->spantype == Span_req::STOP) {
            if (slur_l_stack_.empty())
                warning("can't find slur to end",
-                     slur_req_l->defined_ch_c_l_m);
+                     slur_req_l->defined_ch_c_l_);
            else {
                end_slur_l_arr_.push(slur_l_stack_.pop());
                requests_arr_.pop();
@@ -86,6 +89,6 @@ Slur_register::do_pre_move_process()
 Slur_register::~Slur_register()
 {
     for (int i=0; i < requests_arr_.size(); i++) {
-       warning("unterminated slur", requests_arr_[i]->defined_ch_c_l_m);
+       warning("unterminated slur", requests_arr_[i]->defined_ch_c_l_);
     }
 }
index dbdc501a4d9ac1f0df79682c14dbacfcc590a663..34f1a8808f00a8ef6644812deec1c36108beca28 100644 (file)
@@ -22,13 +22,13 @@ Source::~Source()
 void
 Source::add( Source_file* sourcefile_p )
 {
-    sourcefile_p_iplist_m.bottom().add( sourcefile_p );
+    sourcefile_p_iplist_.bottom().add( sourcefile_p );
 }
 
 Source_file*
 Source::sourcefile_l( char const* ch_c_l )
 {
-    PCursor<Source_file*> sourcefile_p_pcur( sourcefile_p_iplist_m.top() );
+    PCursor<Source_file*> sourcefile_p_pcur( sourcefile_p_iplist_.top() );
     for ( ; sourcefile_p_pcur.ok(); sourcefile_p_pcur++ )
        if ( sourcefile_p_pcur->in_b( ch_c_l ) )        
            return *sourcefile_p_pcur;
index ac164fd94ab84b37a2071bb668eecdde3a13f1e8..f10d419b5afefe243cc8d28d74361421e3d65943 100644 (file)
 
 Source_file::Source_file( String &filename_str )
 {
-    data_caddr_m = 0;
-    fildes_i_m = 0;
-    size_off_m = 0;
-    name_str_m = filename_str;
-    istream_p_m = 0;
+    data_caddr_ = 0;
+    fildes_i_ = 0;
+    size_off_ = 0;
+    name_str_ = filename_str;
+    istream_p_ = 0;
 
     open();
     map();
-    filename_str = name_str_m;
+    filename_str = name_str_;
 }
 
 Source_file::~Source_file()
 {
-    delete istream_p_m;
-    istream_p_m = 0;
+    delete istream_p_;
+    istream_p_ = 0;
     unmap();
     close();
 }
@@ -49,15 +49,15 @@ char const*
 Source_file::ch_c_l()
 {
     assert( this );
-    return (char const*)data_caddr_m;
+    return (char const*)data_caddr_;
 }
 
 void
 Source_file::close()
 {
-    if ( fildes_i_m ) {
-       ::close( fildes_i_m );
-       fildes_i_m = 0;
+    if ( fildes_i_ ) {
+       ::close( fildes_i_ );
+       fildes_i_ = 0;
     }
 }
 
@@ -77,7 +77,7 @@ Source_file::error_str( char const* pos_ch_c_l )
        }
 
     char const* end_ch_c_l = pos_ch_c_l;
-    while ( end_ch_c_l < data_ch_c_l + size_off_m )
+    while ( end_ch_c_l < data_ch_c_l + size_off_ )
         if ( *end_ch_c_l++ == '\n' ) {
            break;
        }
@@ -111,22 +111,22 @@ Source_file::error_str( char const* pos_ch_c_l )
 bool
 Source_file::in_b( char const* pos_ch_c_l )
 {
-    return ( pos_ch_c_l && ( pos_ch_c_l >= ch_c_l() ) && ( pos_ch_c_l < ch_c_l() + size_off_m ) );
+    return ( pos_ch_c_l && ( pos_ch_c_l >= ch_c_l() ) && ( pos_ch_c_l < ch_c_l() + size_off_ ) );
 }
 
 istream*
 Source_file::istream_l()
 {
-    assert( fildes_i_m );
-    if ( !istream_p_m ) {
-       if ( size_off_m ) // can-t this be done without such a hack?
-           istream_p_m = new istrstream( ch_c_l(), size_off_m );
+    assert( fildes_i_ );
+    if ( !istream_p_ ) {
+       if ( size_off_ ) // can-t this be done without such a hack?
+           istream_p_ = new istrstream( ch_c_l(), size_off_ );
         else {
-           istream_p_m = new istrstream( "", 0 );
-           istream_p_m->set(ios::eofbit);
+           istream_p_ = new istrstream( "", 0 );
+           istream_p_->set(ios::eofbit);
        }
     }
-    return istream_p_m;
+    return istream_p_;
 }
 
 int
@@ -146,47 +146,47 @@ Source_file::line_i( char const* pos_ch_c_l )
 void
 Source_file::map()
 {
-    if ( fildes_i_m == -1 )
+    if ( fildes_i_ == -1 )
        return;
 
-    data_caddr_m = (caddr_t)mmap( (void*)0, size_off_m, PROT_READ, MAP_SHARED, fildes_i_m, 0 );
+    data_caddr_ = (caddr_t)mmap( (void*)0, size_off_, PROT_READ, MAP_SHARED, fildes_i_, 0 );
 
-    if ( (int)data_caddr_m == -1 )
-       warning( String( "can't map: " ) + name_str_m + String( ": " ) + strerror( errno ), defined_ch_c_l ); //lexer->here_ch_c_l() );
+    if ( (int)data_caddr_ == -1 )
+       warning( String( "can't map: " ) + name_str_ + String( ": " ) + strerror( errno ), defined_ch_c_l ); //lexer->here_ch_c_l() );
 }
 
 String
 Source_file::name_str()
 {
-    return name_str_m;
+    return name_str_;
 }
 
 void
 Source_file::open()
 {
-    String name_str = find_file( name_str_m );
+    String name_str = find_file( name_str_ );
     if ( name_str != "" ) 
-        name_str_m = name_str;
+        name_str_ = name_str;
 
-    fildes_i_m = ::open( name_str_m, O_RDONLY );       
+    fildes_i_ = ::open( name_str_, O_RDONLY ); 
            
-    if ( fildes_i_m == -1 ) {
-       warning( String( "can't open: " ) + name_str_m + String( ": " ) + strerror( errno ), defined_ch_c_l ); // lexer->here_ch_c_l() );
+    if ( fildes_i_ == -1 ) {
+       warning( String( "can't open: " ) + name_str_ + String( ": " ) + strerror( errno ), defined_ch_c_l ); // lexer->here_ch_c_l() );
         return;
     }
 
     struct stat file_stat;
-    fstat( fildes_i_m, &file_stat );
-    size_off_m = file_stat.st_size;
+    fstat( fildes_i_, &file_stat );
+    size_off_ = file_stat.st_size;
 }
 
 void
 Source_file::unmap()
 {
-    if ( data_caddr_m ) {
-       munmap( data_caddr_m, size_off_m );
-       data_caddr_m = 0;
-       size_off_m = 0;
+    if ( data_caddr_ ) {
+       munmap( data_caddr_, size_off_ );
+       data_caddr_ = 0;
+       size_off_ = 0;
     }
 }
 String
index 2e650b008fb7578cf56d366e179cbac7e62bc5ed..a69f625aed51d024cde0fda7f4942de5da8bccd8 100644 (file)
@@ -4,59 +4,19 @@
 #include "staffwalker.hh"
 #include "stcol.hh"
 #include "sccol.hh"
-#include "staffcommands.hh"
-#include "debug.hh"
-#include "inputcommands.hh"
-#include "inputcommand.hh"
-#include "request.hh"
-
-void
-Staff::do_commands(PointerList<Input_command*> score_wide,
-                  PointerList<Input_command*> staff_wide)
-{
-    Input_commands commands;
-
-    // bring in commands from voices.
-    for (iter_top(voices, i); i.ok(); i++) {
-       Moment here = i->start;
-       for (iter_top(i->elts, j); j.ok(); j++) {
-           for (iter_top(j->reqs, k); k.ok(); k++) {
-               if (k->command()){
-                   commands.find_moment(here);
-                   commands.add(*k->command()->com_p_,
-                                score_l_->markers_assoc_);
-               }
-           }
-           here += j->duration;
-       }
-    }
-    for (iter_top(score_wide,i); i.ok(); i++) 
-       commands.add(**i, score_l_->markers_assoc_);
-    for (iter_top(staff_wide,i); i.ok(); i++) 
-       commands.add(**i, score_l_->markers_assoc_);
 
-    commands.parse(this);
-}
+#include "debug.hh"
+#include "musicalrequest.hh"
+#include "commandrequest.hh" // todo
 
 void
-Staff::add(PointerList<Voice*> &l)
+Staff::add(PointerList<Voice*> const &l)
 {
     for (iter_top(l,i); i.ok(); i++)
-       voices.bottom().add(i);
+       voice_list_.bottom().add(i);
 }
 
-void
-Staff::truncate_cols(Moment l)
-{
-    iter_bot(cols, i);
-    for (; i->when() > l; i=cols.bottom()) {
-       Staff_column * col_p = i.get();
-       assert(col_p->when() > l);
-       delete col_p;
-    }
-}
-
-Paperdef*
+Paperdef *
 Staff::paper() const
 {
     return score_l_->paper_p_;
@@ -67,7 +27,12 @@ Staff::clean_cols()
 {
     iter_top(cols,i);
     for(; i.ok(); ){
-       if (!i->score_column_l_->used())
+       if (!i->musical_column_l_->used())
+           i->musical_column_l_ = 0;
+       if (!i->command_column_l_->used())
+           i->command_column_l_ =0;
+       
+       if (!i->command_column_l_&& !i->musical_column_l_)
            delete i.get();
        else
            i++;
@@ -75,109 +40,60 @@ Staff::clean_cols()
 }
 
 Staff_column *
-Staff::get_col(Moment w, bool mus)
-{
-    iter_top(cols,i);    
+Staff::get_col(Moment w, PCursor<Staff_column*> *last)
+{    
+    iter_top(cols,i);
+    if (last && last->ok() && (*last)->when() <= w)
+       i = *last;
+    
     for (; i.ok(); i++) {
        if (i->when() == w) {
-           if (i->musical_b() == mus) {
-               assert( score_l_->find_col(w,mus).ptr() == i->score_column_l_);
-               return i;
-           }
-           else if (!mus)
-               break;
+           if (last)
+               *last = i;
+           return i;
        } else if (i->when() > w)
            break;
     }
-    /* post: *sc > *->score_column_l_ || !i.ok() */
 
-    Score_column* sccol_l = score_l_->find_col(w,mus);
-    Staff_column* newst = create_col(sccol_l);
 
-    if (!i.ok()) {
-       cols.bottom().add(newst);
-       return cols.bottom();
-    }
-    
-    if (mus) {
-       i.insert(newst);
-       
-       return newst;
-    }
+    PCursor<Score_column*> sccols(score_l_->find_col(w, false));
+    Staff_column* stcol_p = create_col();
 
+    Score_column* comcol_l  = sccols++;
+    stcol_p->set_cols(comcol_l, sccols);
     
-    // making a fix at 2:30 am, with several beers drunk.
-    // but it works :-)
-    if ((i-1).ok()&& (i-1)->when() == newst->when()) {
+    if (!i.ok()) {
+       cols.bottom().add(    stcol_p);
+       i = cols.bottom();
+    } else {
+       i.insert(stcol_p);
        i--;
     }
-
-    i.insert(newst);
-    
-    return newst;
+    if (last)
+       *last = i;
+    return i;
 }
 
-void
-Staff::get_marks(Array<String>&s_arr, Array<Moment>&m_arr)
-{
-     for (iter_top(voices,i); i.ok(); i++) {
-       Moment now = i->start;
-       for (iter_top(i->elts,j); j.ok(); j++) {
-           for (iter_top(j->reqs, k); k.ok(); k++) {
-               if (k->mark()) { // ugh. 4 levels
-                   s_arr.push(k->mark()->mark_str_);
-                   m_arr.push(now);
-               }
-           }
-           now += j->duration;     
-       }
-     }
-}
-/*
-    put all stuff grouped vertically in the Staff_cols
+/**
+  put all stuff grouped vertically in the Staff_cols.
+  Do the preprarations for walking the cols. not virtual
     */
 void
 Staff::setup_staffcols()
 {    
-    for (iter_top(voices,i); i.ok(); i++) {
-
+    for (iter_top(voice_list_,i); i.ok(); i++) {
+       PCursor<Staff_column*> last(cols);
        Moment now = i->start;
        for (iter_top(i->elts,j); j.ok(); j++) {
            
-           Staff_column *s_l= get_col(now, true);
+           Staff_column *s_l= get_col(now, &last);
            assert(now == s_l->when());
            s_l->add(j);
            now += j->duration;     
        }
-       get_col(now, false);
-    }
-    OK();
-    set_time_descriptions();
-}
-
-
-
-void
-Staff::set_time_descriptions()
-{
-    Time_description t(0,0);
-    for (iter_top(cols,i); i.ok(); i++) {
-       if (i->staff_commands_p_)
-           t = i->staff_commands_p_->tdescription_;
-       else if (i->tdescription_)
-           t = *i->tdescription_;
-       if(!i->tdescription_) {
-           i->tdescription_ = new Time_description(i->when() - t.when ,&t);
-       }
+//     get_col(now,last);
     }
-
-}
-void
-Staff::process()
-{
-    setup_staffcols();
     OK();
-    walk();
 }
 
 void
@@ -185,15 +101,12 @@ Staff::OK() const
 {
 #ifndef NDEBUG
     cols.OK();
-    voices.OK();
+    voice_list_.OK();
     iter_top(cols, i);
     iter_top(cols, j);
     i++;
     for (; i.ok(); j++,i++) {
-       if ( j->when() == i->when())
-           assert(!j->musical_b() && i->musical_b());
-       else
-           assert(j->when () < i->when() );
+       assert(j->when () < i->when() );
     }
     assert(score_l_);
 #endif    
@@ -204,7 +117,7 @@ Moment
 Staff::last() const
 {
     Moment l = 0.0;
-    for (iter_top(voices,i); i.ok(); i++) {
+    for (iter_top(voice_list_,i); i.ok(); i++) {
        l = l >? i->last();
     }
     return l;
@@ -216,7 +129,7 @@ Staff::print() const
 {
 #ifndef NPRINT
     mtor << "Staff {\n";
-    for (iter_top(voices,i); i.ok(); i++) {
+    for (iter_top(voice_list_,i); i.ok(); i++) {
        i->print();     
     }
     mtor <<"}\n";
diff --git a/src/staffcommands.cc b/src/staffcommands.cc
deleted file mode 100644 (file)
index 517e7d1..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-#include "staffcommands.hh"
-#include "debug.hh"
-#include "parseconstruct.hh"
-#include "getcommand.hh"
-
-Moment
-Staff_commands_at::when()
-{
-    return tdescription_.when;
-}
-
-void
-Staff_commands_at::print() const
-{
-#ifndef NPRINT
-    iter_top(*this,i);
-    mtor << "Commands at: " ;
-    tdescription_.print();
-    
-    for (; i.ok(); i++)
-       i->print();
-#endif
-}
-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)
-    :tdescription_(m)
-{
-    
-}
-
-bool
-Staff_commands_at::is_breakable()
-{
-    iter_top(*this,i);
-    for (; i.ok(); i++) {
-       if (i->isbreak())
-           return true;
-    }
-    return false;
-}
-
-void
-Staff_commands_at::set_breakable()
-{
-    if (is_breakable()) return;
-    
-    Command k;
-    k.code = BREAK_PRE;
-    bottom().add(new Command(k));
-    k.code = BREAK_MIDDLE;
-    bottom().add(new Command(k));
-    k.code = BREAK_POST;
-    bottom().add(new Command(k));
-    k.code = BREAK_END;
-    bottom().add(new Command(k));        
-}
-
-void
-Staff_commands_at::insert_between(Command victim, PCursor<Command*> firstc,
-                                 PCursor<Command*> last)
-{
-    PCursor<Command*> c(firstc+1);
-//    assert(firstc < last&&last.ok());
-    assert(firstc->code < last->code && last.ok());
-    
-//    while (c < last) { 
-    while (c->code < last->code ) { 
-       if (c->priority <= victim.priority) {
-           c.insert(new Command(victim));
-           return;
-       }
-       c++;
-    }
-    last.insert(new Command(victim));    
-}
-
-void
-Staff_commands_at::add_command_to_break(Command pre, Command mid,Command post)
-{
-    assert(is_breakable());
-    iter_top(*this,c), f(c), l(c);
-
-    while (!c->isbreak())
-       c++;
-    f = c++;
-    while (!c->isbreak())
-       c++;
-    l = c++;
-    
-    insert_between(pre, f, l);
-    f = l;
-    while (!c->isbreak())
-       c++;
-    l = c++;    
-    insert_between(mid, f, l);
-    f = l;
-    while (!c->isbreak())
-       c++;
-    l = c++;
-    assert(l.ok() && l->code == BREAK_END);
-    
-    insert_between(post, f, l);
-}
-
-
-/*
-  should move this stuff into inputlanguage.
-  */
-void
-Staff_commands_at::add(Command c)
-{
-    bool encapsulate =false;
-    Command pre;
-    Command mid;
-    Command post;
-
-    if (c.code == INTERPRET)
-    {                          // UGH
-       Command typeset;        // kut met peren
-       typeset.code = TYPESET;
-       typeset.args = c.args;
-       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);
-       } else if (c.args[0] == "CLEF") {
-           typeset.priority = 90;
-           add(typeset);
-       } else if (c.args[0] == "METER") {
-           typeset.priority = 40;
-           add(typeset);
-           return;
-       }
-    }
-
-    // kut en peer
-    if (c.code == TYPESET) {
-       encapsulate  = is_breakable();
-       if (c.args[0] == "BAR") {
-           set_breakable();
-           encapsulate = true;
-           split_bar_command(pre,mid,post, c.args[1]);
-
-           { /* every line a currentkey. */
-               Command kc;
-               kc.code =TYPESET;
-               kc.args.push( "CURRENTKEY");
-               kc.priority = 60;
-               add(kc);
-           }
-           { /* every line a currentclef. */
-               Command kc;
-               kc.code =TYPESET;
-               kc.args.push( "CURRENTCLEF");
-               kc.priority = 80;
-               add(kc);
-           }
-       }
-       if (is_breakable()) {
-           if (c.args[0] == "METER") {
-               mid = c;
-               pre = c;
-               post =c;
-           }else if( c.args[0] == "KEY") {
-
-               mid = c;
-               pre = c;
-               post = c;
-           }else if (c.args[0] == "CURRENTKEY" ){
-               post = c;
-
-           }else
-               if (c.args[0] == "CURRENTCLEF" ){
-                   post = c;
-
-               }else if (c.args[0] == "CLEF") {
-
-                   post = c;
-                   pre = c;
-                   mid = c;                   
-               }
-       }
-    }
-    
-    if (encapsulate)
-       add_command_to_break(pre, mid, post);
-    else {
-       if (c.priority>0)
-           top().insert(new Command(c));
-       else
-           bottom().add(new Command(c));
-    }
-}
-
index 341b54e32b01ac8fce50e4e5ae026ac122df88c9..1b5e592762cc6099a89cd2e50d88b8f231823aab 100644 (file)
@@ -23,7 +23,10 @@ Staff_elem::Staff_elem(Staff_elem const&s)
     pstaff_l_ = s.pstaff_l_;
     offset_ = Offset(0,0);
 }
-
+/**
+  TODO:
+  If deleted, then remove dependants depency!
+  */
 Staff_elem::~Staff_elem()
 {
    delete output;
index eac45b5b13fcd1c94e5a15565be44cea30dfb7fe..d93243255d65c09c91da241ad323738847f32217 100644 (file)
@@ -1,10 +1,28 @@
-#include "request.hh"
+/*
+  staffwalker.cc -- implement Staff_walker
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "grouping.hh"
+#include "staff.hh"
+#include "musicalrequest.hh"
 #include "staffwalker.hh"
 #include "stcol.hh"
 #include "sccol.hh"
 #include "debug.hh"
+#include "timedescription.hh"
+#include "commandrequest.hh"
+#include "grouping.hh"
+#include "scorewalker.hh"
+
+Staff_walker::~Staff_walker()
+{
+    do_pre_move();
+}
 
-Staff_walker::~Staff_walker() {}
 Staff_walker::Staff_walker(Staff_walker const &s)
     :PCursor<Staff_column*> (s)
 {
@@ -16,62 +34,73 @@ Staff_walker::Staff_walker(Staff * s, PScore*ps )
 {
     staff_l_ = s;
     pscore_l_ = ps;
-    break_status = BREAK_END - BREAK_PRE;
+    default_grouping = new Rhythmic_grouping(MInterval(0, 1), 4); // should be in tdes. TODO
+    score_walk_l_ = 0;
 }
 
 Moment
 Staff_walker::when() const
 {
-    return (* (PCursor<Staff_column*> *) this)->when();
-}
-
-void
-Staff_walker::process()
-{
-    break_status = BREAK_END - BREAK_PRE;
-
-    if (ptr()->musical_b()) {
-       process_requests();
-    } else if (ptr()->staff_commands_p_)
-       for (iter_top(*ptr()->staff_commands_p_,i); i.ok(); i++) {
-           process_command(i);
-    }
+    return ptr()->when();
 }
 
 
 void
-Staff_walker::process_command(Command*com)
+Staff_walker::process_timing_reqs()
 {
-    switch (com->code){
-    case BREAK_PRE:
-    case BREAK_MIDDLE:
-    case BREAK_POST:
-    case BREAK_END:
-       (*this)->score_column_l_->set_breakable();
-       break_status = com->code- BREAK_PRE;
-       break;
-    case INTERPRET:
-       do_INTERPRET_command(com);
-       break;
-       
-    case TYPESET:
-       do_TYPESET_command(com);
-       break;
-   
-    default :
-       break;
+    for (int i=0; i < ptr()->timing_req_l_arr_.size(); i++) {
+       Timing_req * tr_l = ptr()->timing_req_l_arr_[i];
+       if (tr_l->meterchange()) {
+           int b_i=tr_l->meterchange()->beats_i_;
+           int o_i = tr_l->meterchange()->one_beat_i_;
+           time_.set_meter(b_i, o_i);
+                       
+           *default_grouping = Rhythmic_grouping(
+               MInterval(0,Moment(b_i, o_i)), b_i);
+       } 
+    }
+    
+    for (int i=0; i < ptr()->timing_req_l_arr_.size(); i++) {
+       Timing_req * tr_l = ptr()->timing_req_l_arr_[i];
+       if (tr_l->partial()) {
+           time_.setpartial(tr_l->partial()->duration_);
+       } else if (tr_l->barcheck() && time_.whole_in_measure_) {
+           warning( "Barcheck failed", tr_l->defined_ch_c_l_ );
+       } else if (tr_l->cadenza()) {
+           time_.set_cadenza(tr_l->cadenza()->on_b);
+       } else if (tr_l->measuregrouping()) {
+           *default_grouping = parse_grouping(
+               tr_l->measuregrouping()->beat_i_arr_,
+               tr_l->measuregrouping()->elt_length_arr_);
+       }
     }
+    time_.OK();
 }
 
 void
 Staff_walker::operator++(int i)
 {
+    Moment last = when();
+
     do_pre_move();
-    if (ptr()->musical_b() && ptr()->tdescription_
-       && !ptr()->tdescription_->whole_in_measure) {
-       *mlog << "[" << ptr()->tdescription_->bars<<"]"<< flush;
-    }
     PCursor<Staff_column*>::operator++(i);
-
+    if (ok() ) {
+       Moment delta_t = when() - last;
+       assert(delta_t >0);
+       time_.add( delta_t );
+    }
     do_post_move();
 }
+
+void
+Staff_walker::process()
+{
+    process_timing_reqs();    
+    process_requests();
+}
+void 
+Staff_walker::allow_break()
+{
+    score_walk_l_->allow_break(this);
+}
index 07124096624fd8bb9830b22ef42b4e7fc16c21cc..f3498db0e181d7a9e303ad003cab35cd7a2d1085 100644 (file)
@@ -1,52 +1,69 @@
+/*
+  stcol.cc -- implement Staff_column
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
 #include "voice.hh"
 #include "timedescription.hh"
 #include "sccol.hh"
-#include "staffcommands.hh"
 #include "stcol.hh"
+#include "commandrequest.hh"
+#include "musicalrequest.hh"
 
 void
 Staff_column::OK() const
 {
 #ifndef NDEBUG
-    if (tdescription_) {
-       assert(tdescription_->when == when());
-       assert(*tdescription_ == staff_commands_p_->tdescription_);
-    }
+    assert (command_column_l_->when() == musical_column_l_->when());
 #endif
 }
 
-bool
-Staff_column::musical_b() const
-{
-    return score_column_l_->musical_;
-}
-
 Moment
 Staff_column::when() const
 {
-    return score_column_l_->when();
+    return (command_column_l_)?
+       command_column_l_->when():
+       musical_column_l_->when();
 }
 
 void
 Staff_column::add(Voice_element*ve)
 {
-    Moment d= ve->duration;
-    if (d){
-       score_column_l_->add_duration(d);
+    for (iter_top(ve->reqs,j); j.ok(); j++) {
+       if (j->nonmus()) {
+           if (j->nonmus()->timing()) {
+               timing_req_l_arr_.push(j->nonmus()->timing());
+           }
+           if (!j->barcheck() && !j->nonmus()->measuregrouping())
+               setup_one_request(j);   // no need to bother children
+       } else {
+           if (j->rhythmic()) {
+               musical_column_l_->add_duration(j->rhythmic()->duration());
+           }
+           setup_one_request(j);
+       }
     }
-       
-    v_elts.push(ve);
 }
 
-Staff_column::Staff_column(Score_column * cur)
-
+Staff_column::Staff_column()
 {
-    tdescription_ =0;
-  score_column_l_=cur;
-    staff_commands_p_ = 0;
+    musical_column_l_ = 0;
+    command_column_l_ = 0;
 }
 
+
+
+
 Staff_column::~Staff_column()
 {
-    delete tdescription_;
+}
+
+void
+Staff_column::set_cols(Score_column*c1, Score_column*c2)
+{
+    command_column_l_ = c1;
+    musical_column_l_ = c2;
 }
index 2a1f99e21a8adfffb1e7b88b0c4fdf216a264a15..b11386afec05672dfee0ebdf0d3b5bf5cf086d9b 100644 (file)
@@ -10,9 +10,9 @@
 
 const int STEMLEN=7;
 NAME_METHOD(Stem);
+
 Stem::Stem(int c) //, Moment len)
 {
-//    note_length = len;
     beams_left = 0;
     beams_right = 0;
     minnote = 1000;            // invalid values
@@ -188,7 +188,7 @@ Stem::brew_molecule_p()const return out;
 Real
 Stem::hpos()const
 {
-    return pcol_l_->hpos + stem_xoffset;
+    return pcol_l_->hpos + stem_xoffset; // hmm.  + offset_.x;
 }
 
 
index 506bde34239cbc0ba0255f440aa934838fbbf55d..504ba6854f00895d4e47d08fb392486201ad0b03 100644 (file)
@@ -4,6 +4,7 @@
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
 
+#include "musicalrequest.hh"
 #include "stembeamreg.hh"
 #include "beam.hh"
 #include "stem.hh"
@@ -12,7 +13,7 @@
 #include "complexwalker.hh"
 #include "complexstaff.hh"
 #include "debug.hh"
-
+#include "grouping.hh"
 Stem_beam_register::Stem_beam_register(Complex_walker*w)
     :Request_register(w)
 {
@@ -39,7 +40,7 @@ Stem_beam_register::try_request(Request*req_l)
     
     if ( req_l->stem() ) {
        if (current_grouping && !current_grouping->child_fit_query(
-           walk_l_->col()->tdescription_->whole_in_measure))
+           walk_l_->time_.whole_in_measure_))
            return false;
 
        if (stem_req_l_ && Stem_req::compare(*stem_req_l_, *req_l->stem()))
@@ -68,6 +69,7 @@ Stem_beam_register::process_request()
                t->set_support(beam_p_);
                t->spec.align_i_ = 0;
                t->spec.text_str_ = beam_req_l_->nplet;
+               t->spec.style_str_="italic";
                typeset_element(t);
            }
             
@@ -78,7 +80,7 @@ Stem_beam_register::process_request()
        stem_p_ = new Stem(4);
        if (current_grouping)
            current_grouping->add_child(
-               walk_l_->col()->tdescription_->whole_in_measure,
+               walk_l_->time_.whole_in_measure_,
                stem_req_l_->duration());
 
        stem_p_->flag = stem_req_l_->balltype;
@@ -86,7 +88,7 @@ Stem_beam_register::process_request()
        if (beam_p_) {
            if (stem_req_l_->balltype<= 4)
                warning( "stem doesn't fit in Beam",
-                        stem_req_l_->defined_ch_c_l_m);
+                        stem_req_l_->defined_ch_c_l_);
            else
                beam_p_->add(stem_p_);
            stem_p_->print_flag = false;
@@ -122,8 +124,8 @@ Stem_beam_register::do_pre_move_process()
        stem_p_ = 0;
     }
     if (beam_p_ && end_beam_b_) {
-       walk_l_->default_grouping.extend(current_grouping->interval());
-       beam_p_->set_grouping(walk_l_->default_grouping, *current_grouping);
+       walk_l_->default_grouping->extend(current_grouping->interval());
+       beam_p_->set_grouping(*walk_l_->default_grouping, *current_grouping);
        typeset_element(beam_p_);
        delete current_grouping;
        current_grouping = 0;
@@ -143,7 +145,7 @@ Stem_beam_register::do_post_move_process()
 Stem_beam_register::~Stem_beam_register()
 {
     if (beam_p_)
-       warning("unterminated beam", start_req_l_->defined_ch_c_l_m);
+       warning("unterminated beam", start_req_l_->defined_ch_c_l_);
 }
 
 void
index 128dd06258fbf958bf74b414d6d95150da0d2e0e..283a488b1a2ed98fbe80bb9f57c3ac03d73d2696 100644 (file)
@@ -2,8 +2,7 @@
 #include "plist.hh"
 #include "pcol.hh"
 #include "item.hh"
-#include "request.hh"
-#include "command.hh"
+#include "musicalrequest.hh"
 #include "spanner.hh"
 #include "scoreline.hh" 
 #include "staffline.hh"
index 06b3a167c4c30c31797846ab4c8ecbf7251182b8..29d4b1eaf387af9a5308cc6a871cc1c15c51dff5 100644 (file)
@@ -1,12 +1,10 @@
-
 #include "symbol.hh"
 #include "voice.hh"
-#include "request.hh"
+#include "musicalrequest.hh"
 #include "staff.hh"
 #include "sccol.hh"
 #include "stcol.hh"
 #include "spanner.hh"
-
 #include "plist.tcc"
 #include "pcursor.tcc"
 
index bc7e4885a39201eff891318ae5e0202d58b73c0f..185c1850763ff37d6c2af81dc43380b40ac24ff0 100644 (file)
@@ -1,23 +1,15 @@
 #include "request.hh"
-#include "command.hh"
 #include "inputscore.hh"
 #include "inputstaff.hh"
 #include "inputmusic.hh"
-#include "inputcommand.hh"
-#include "inputcommands.hh"
 #include "molecule.hh"
-#include "staffcommands.hh"
 #include "sourcefile.hh"
 
-
 #include "plist.tcc"
 #include "pcursor.tcc"
+
 IPL_instantiate(Atom);
-IPL_instantiate(Command);
 IPL_instantiate(Atom);
-IPL_instantiate(Input_command);
-IPL_instantiate(Commands_at);
-IPL_instantiate(Staff_commands_at);
 IPL_instantiate(Input_staff);
 IPL_instantiate(Input_music);
 IPL_instantiate(Source_file);
index 09fb2257a10c164b7c7811921d29e416607b86c6..d4e9824d1ba313cdbc822a0332b744ea9b09648c 100644 (file)
@@ -8,7 +8,7 @@ Text_def::Text_def()
 {   
     align_i_ = 1;                      // right
     style_str_ = "roman";
-    defined_ch_c_l_m = 0;
+    defined_ch_c_l_ = 0;
 }
 bool
 Text_def::compare(const Text_def&def)
index c9ead7ce03d811a056b38fd57ee34a0bbae8fd28..110e95e3bfe166488c9d84f0f91044be5375cac7 100644 (file)
@@ -1,4 +1,4 @@
-#include "request.hh"
+#include "musicalrequest.hh"
 #include "paperdef.hh"
 #include "textitem.hh"
 #include "stem.hh"
index 309bf6fe98233de3b6649eb3993eb594053c7ef6..7e6d59e2cba2c97bcd9fc4a5971e1e2a198f3af9 100644 (file)
@@ -4,6 +4,7 @@
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
 
+#include "musicalrequest.hh"
 #include "textreg.hh"
 #include "textitem.hh"
 
index 5026656c2bb052341538b5e01fbf3ba9fbae2808..c9c3d52860866797be8f30f283774f44da35dbfc 100644 (file)
@@ -8,10 +8,10 @@ Time_description::str()const
     if (cadenza_b_)
        s+=String( " (cadenza) ");
     s+= "at ";
-    s+=when;
-    s+="\nmeter " + String(whole_per_measure/one_beat) +":" +
-       String(Rational(Rational(1)/one_beat));
-    s+= "\nposition "+String( bars) + ":"+ whole_in_measure +"\n}\n";
+    s+=when_;
+    s+="\nmeter " + String(whole_per_measure_/one_beat_) +":" +
+       String(Rational(Rational(1)/one_beat_));
+    s+= "\nposition "+String( bars_i_) + ":"+ whole_in_measure_ +"\n}\n";
     return s;
 }
 
@@ -25,9 +25,9 @@ Time_description::OK() const
 {
 #ifdef NDEBUG
     if (!cadenza_b_)
-       assert(whole_in_measure < whole_per_measure);
-    assert(0 <= whole_in_measure);
-    assert(one_beat);
+       assert(whole_in_measure_ < whole_per_measure_);
+    assert(0 <= whole_in_measure_);
+    assert(one_beat_);
 #endif
 }
 
@@ -35,33 +35,33 @@ void
 Time_description::set_cadenza(bool b)
 {
     if (cadenza_b_ && !b) {
-       if (whole_in_measure) {
-           bars ++;
-           whole_in_measure = 0;
+       if (whole_in_measure_) {
+           bars_i_ ++;
+           whole_in_measure_ = 0;
        }
     }
     cadenza_b_ = b ;
 }
 
-Time_description::Time_description(Moment dt, Time_description const *prev)
+Time_description::Time_description()
 {
-    if (prev) {
-       assert(dt >= Rational(0));
-       *this = *prev;
-       when +=  dt;
-       whole_in_measure += dt;
+    whole_per_measure_ = 1;
+    whole_in_measure_ =0;
+    one_beat_ = Moment(1,4);
+    when_ = 0;
+    bars_i_ = 0;
+    cadenza_b_ = false;
+}
+void
+Time_description::add(Moment dt)
+{
+    assert(dt >= Rational(0));
+    when_ +=  dt;
+    whole_in_measure_ += dt;
        
-       while ( !cadenza_b_ && whole_in_measure >= whole_per_measure ) {
-           whole_in_measure -= whole_per_measure;
-           bars ++;
-       }
-    } else {                           // default 4/4
-       whole_per_measure = 1;
-       whole_in_measure =0;
-       one_beat = Moment(1,4);
-       when = 0.0;
-       bars = 0;
-       cadenza_b_ = false;
+    while ( !cadenza_b_ && whole_in_measure_ >= whole_per_measure_ ) {
+       whole_in_measure_ -= whole_per_measure_;
+       bars_i_ ++;
     }
 }
 
@@ -69,39 +69,39 @@ void
 Time_description::set_meter(int l, int o)
 {
     assert(o);
-    one_beat = Rational(1)/Moment(o);
-    whole_per_measure = Moment(l) * one_beat;
-    if(whole_in_measure)
+    one_beat_ = Rational(1)/Moment(o);
+    whole_per_measure_ = Moment(l) * one_beat_;
+    if(whole_in_measure_)
        error_t("Meterchange should be at start of measure", *this);
 }
 
 void
 Time_description::setpartial(Moment p)
 {
-    if (when)
+    if (when_)
        error_t ("Partial measure only allowed at beginning.", *this);
-    if (p<Rational(0)||p > whole_per_measure)
+    if (p<Rational(0)||p > whole_per_measure_)
        error_t ("Partial measure has incorrect size", *this);
-    whole_in_measure = whole_per_measure - p;
+    whole_in_measure_ = whole_per_measure_ - p;
 }
 
 Moment
 Time_description::barleft()
 {
     assert(!cadenza_b_);
-    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);
+    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);
+       assert(t1.bars_i_==t2.bars_i_);
+       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;
index 8bccb12d8d1b8003408d9e303fef6c6a2a863200..3dd4becf218270afe77904ce964fc22499ee4cb6 100644 (file)
@@ -1,6 +1,15 @@
+/*
+  voice.cc -- implement Voice
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
 #include "debug.hh"
 #include "voice.hh"
-#include "request.hh"
+#include "musicalrequest.hh"
+#include "commandrequest.hh"
 
 void
 Voice::set_default_group(String s)
@@ -49,54 +58,4 @@ Voice::last() const
        l  += i->duration;
     return l;
 }
-/* *************************************************************** */
-void
-Voice_element::print() const
-{
-#ifndef NPRINT
-    mtor << "voice_element { dur :"<< duration <<"\n";
-    for (iter_top(reqs,rc); rc.ok(); rc++) {
-       rc->print();
-    }
-    mtor << "}\n";
-#endif
-}
-void
-Voice_element::add(Request*r)
-{
-    if (r->rhythmic()) {
-       assert (!duration  || duration == r->duration());           
-       duration = r->duration();
-    }
-    
-    r->elt_l_ = this;
-    reqs.bottom().add(r);
-}
-
-
-Voice_element::Voice_element()
-{
-    voice_l_ = 0;
-    duration = 0;
-    defined_ch_c_l_m = 0;
-}
 
-Voice_element::Voice_element(Voice_element const&src)
-{
-    defined_ch_c_l_m = src.defined_ch_c_l_m;
-               // are you sure? They can be modified after copying.
-    voice_l_=0;
-    for (iter_top(src.reqs, i); i.ok(); i++)
-       add(i->clone());
-
-}
-void
-Voice_element::set_default_group(String s)
-{
-    for (iter_top(reqs, i); i.ok(); i++)
-       if (i->groupchange())
-           return ;
-    Group_change_req *greq = new Group_change_req;
-    greq->newgroup_str_ = s;
-    add(greq);
-}
diff --git a/src/voiceelt.cc b/src/voiceelt.cc
new file mode 100644 (file)
index 0000000..72ba0a7
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+  voiceelt.cc -- implement Voice_element
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "debug.hh"
+#include "voice.hh"
+#include "musicalrequest.hh"
+#include "commandrequest.hh"
+
+
+void
+Voice_element::print() const
+{
+#ifndef NPRINT
+    mtor << "voice_element { dur :"<< duration <<"\n";
+    for (iter_top(reqs,rc); rc.ok(); rc++) {
+       rc->print();
+    }
+    mtor << "}\n";
+#endif
+}
+
+void
+Voice_element::add(Request*r)
+{
+    if (r->duration()) {
+       assert (!duration  || duration == r->duration());
+       duration = r->duration();
+    }
+    
+    r->elt_l_ = this;
+    reqs.bottom().add(r);
+}
+
+
+Voice_element::Voice_element()
+{
+    voice_l_ = 0;
+    duration = 0;
+    defined_ch_c_l_ = 0;
+}
+
+Voice_element::Voice_element(Voice_element const&src)
+{
+    defined_ch_c_l_ = src.defined_ch_c_l_;
+
+    voice_l_=0;
+    for (iter_top(src.reqs, i); i.ok(); i++)
+       add(i->clone());
+
+}
+void
+Voice_element::set_default_group(String s)
+{
+    for (iter_top(reqs, i); i.ok(); i++)
+       if (i->groupchange())
+           return ;
+    Group_change_req *greq = new Group_change_req;
+    greq->newgroup_str_ = s;
+    add(greq);
+}
index 35de10df4f4713a514455e6889fdb4bdf774f34f..4f622c93849f4c97038674f17f0390078efe66ac 100644 (file)
@@ -1,11 +1,19 @@
-#include "request.hh"
+/*
+  voicegroup.cc -- implement Voice_group_registers
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "musicalrequest.hh"
 #include "voicegroup.hh"
 #include "register.hh"
 #include "textreg.hh"
 #include "stembeamreg.hh"
 #include "scriptreg.hh"
 #include "complexwalker.hh"
-
+#include "commandrequest.hh"
 
 static int temp_id_count;
 
@@ -27,6 +35,7 @@ Voice_group_registers::~Voice_group_registers()
     delete stem_beam_reg_;
     delete script_reg_;
 }
+
 void
 Voice_group_registers::pre_move_processing()
 {
index f7d63bd76f8ba1194b9706d4487a40ff09a4b35e..4eba8c55f7adae0a925c6e2abc3582a4448c391f 100644 (file)
@@ -1,4 +1,4 @@
-#include "request.hh"
+#include "musicalrequest.hh"
 #include "voicegroup.hh"
 #include "register.hh"
 #include "slurreg.hh"
index a7d9ba18beae9ba3d77fe25fb760fb9669e4334b..46d779e10f511cf8495f8c2506b7e19f6aa3188e 100644 (file)
@@ -40,7 +40,7 @@ error_t(const String& s, const Moment& r)
 void
 error_t(const String& s, Time_description const &t_tdes)
 {
-    String e=s+ " (at t=" + String(t_tdes.bars) + ": " + String(t_tdes.whole_in_measure) + ")\n";
+    String e=s+ " (at t=" + String(t_tdes.bars_i_) + ": " + String(t_tdes.whole_in_measure_) + ")\n";
     error(e);
 }
 
index 90d4d542dc7504ab23a8efa956d61c42cd210353..f217a63b0812da110e012f18fa3615e7d6b23bd3 100644 (file)
@@ -40,7 +40,8 @@ Word_wrap::solve()
            // try to solve
            if (!feasible(current.cols)) {
                if (!minimum.cols.size())
-                   error("sorry, this measure is too long");
+                   error("sorry, this measure is too long, breakpoint: "
+                         + String(break_idx_i) );
                current.energy = INFTY; // make sure we go back
            } else {
                current = solve_line(current.cols);