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
--- /dev/null
+
+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 "||"
+ }
+ }
+
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
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.
/// 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
+
+
+
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:
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]
=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
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
=back
-
-
=head1 OPTIONS
=over 5
=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>,
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.
=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.
flex (2.5.1 or better)
=item *
-Bison or YACC.
+Bison.
=item *
The "Flower" library, which should be available from the same
=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
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
=head1 REMARKS
LilyPond has no connection with the music package RoseGarden, other
-than the names being similar.
+than the names being similar :-)
=head1 HISTORY
(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..]
--- /dev/null
+=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
+>
+
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:
=item *
Staff wide, contains
Local_key_register
+ Bar_register
+ Key_register
+ Meter_register
+ Clef_register
=item *
Voice group, 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>]
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
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.
=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
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;"
$(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 )
$(exe): $(obs)
$(STRIPDEBUG) $(STABLEOBS)
- $(CXX) -o $@ $^ $(LOADLIBES)
+ $(LINKER) -o $@ $^ $(LOADLIBES)
.PHONY: clean docxx
# doc++ documentation of classes
docxx: $(progdocs)
- doc++ -p -d $(DOCDIR) $^
+ doc++ -kp -d $(DOCDIR) $^
$(OBJECTDIR)/%.o: $(CCDIR)/%.cc
$(DODEP)\
+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
+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:
hanwen@stack.urc.tue.nl
-Have fun!
\ No newline at end of file
+Have fun!
+
+======================
+
# -*- 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\
+
+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:
* 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.
* 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
* 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
* Implement all requests
- * merge key{item} & localkey{item}
+ * merge key{item} & localkey{item}?
* QLP for beams?
* eentje/tweetje
+ * piano staff
+
+ * abbreviations a4*8
+
IDEAS
* enter Requests directly
* merge Atom and Symbol?
- * merge Command/Input_command.
-
* merge common code of Item, Atom/Molecule
* Spacing_request for manually adjusting spacing
* PostScript output (esp. Beams, Slurs, etc)
- * caching breakpoints\r
+ * caching breakpoints
+
+ * use exceptions?
\ No newline at end of file
-# -*-make-*-
+# -*-Makefile-*-
# version info
MAJVER=0
MINVER=0
-PATCHLEVEL=31
+PATCHLEVEL=32
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:
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)
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
PREFIX=${PREFIX:-.}
echo using PREFIX=$PREFIX
-NEEDFLOWERVER=1.0.26
+NEEDFLOWERVER=1.0.27
flowertar=flower-$NEEDFLOWERVER
here=`pwd`
cd ..
echo '#define LIBDIR "'$PREFIX'/"'> hdr/config.hh
touch Site.make
make -f Initial.make
+
.PHONY: docxx
docxx: $(hh) $(cc) $(templatecc) $(inl)
- -mkdir docxx
doc++ -p -d docxx $(hh) $(cc) $(templatecc) $(inl)
dist:
+pl 27
+ - (temporarily?) removed findcursor* t*mat*
+
pl 26
- docxx 3.0
-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
MAJVER=1
MINVER=0
-PATCHLEVEL=26
+PATCHLEVEL=27
PACKAGENAME=flower
V val;
};
-/// hungarian: map
-/** mindblowingly stupid Associative array implementation
+
+/** mindblowingly stupid Associative array implementation.Hungarian: map
*/
template<class K, class V>
struct Assoc {
#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
/// 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
#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.
*/
#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
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 );
/// -- 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.
*/
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.
return s;
}
-/// get a char.
-/**
+/** get a char
Only class member who uses text_file::get
*/
char
-// debug_stream
#ifndef DSTREAM_HH
#define DSTREAM_HH
template<class K,class V>
struct Assoc;
-/// debug stream
- /**
+/** debug stream.
a class for providing debug output of nested structures,
with indents according to \{\}()[].
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);
+++ /dev/null
-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"
+++ /dev/null
-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()
-}
#ifndef HANDLE_HH
#define HANDLE_HH
+
/// reference counting handle
template<class T>
class Handle {
#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
*/
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"
+/*
+ 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())
#define iter_top(set,var) iterator(set) var(set)
#define iter_bot(set,var) iterator(set) var(set.bottom())
+#endif // ITERATE_HH
};
-/// 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,
/// 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#
*/
/// 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.
*/
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
int size() const;
- Cursor<T> bottom() const; // const sucks..
+ Cursor<T> bottom() const; // const sucks.
Cursor<T> top() const;
void OK() const; // check list
void concatenate(List<T> const &s);
- /// make *this empty
- /**
+ /** make *this empty.
POST:
size == 0
*/
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
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 )
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
#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.)
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;
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
0 <= k <= rows()
*/
void insert_row(Vector v,int k);
- ///
- /**
+ /** .
delete a row from this matrix.
PRE
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()
*/
#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,
}
-///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.
*/
#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.
-
/*
pcursor.hh -- part of flowerlib
#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
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(); }
#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 *>
{
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:
*/
template<class T>
-struct IPointerList : public PointerList<T> {
+class IPointerList : public PointerList<T> {
+public:
IPointerList(const IPointerList&) { set_empty(); }
IPointerList() { }
~IPointerList();
bool isnum();
operator Real();
operator int();
- ///
- /** perl -like string to bool conversion
+
+ /** perl -like string to bool conversion.
*/
operator bool() const;
-/****************************************************************************
+/*
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>
#include "stringutil.hh"
-/// the smart string class.
-/**
+/** the smart string class.
Intuitive string class. provides
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";
/// 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
*/
const INITIALMAX=8;
class String_handle;
-/// Internal String struct
-/**
+/** Internal String struct.
the data itself. Handles simple tasks (resizing, resetting)
*/
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] ;
-/// ref. counting for strings
-/**
+/** ref. counting for strings.
handles ref. counting, and provides a very thin
interface using char *
*/
#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;
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();
#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)
+++ /dev/null
-#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
+++ /dev/null
-#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>;
+++ /dev/null
-#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
#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);
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
*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
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
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; }
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 {
#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 {
/// 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
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;
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)
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
#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
--- /dev/null
+/*
+ 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
#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;
#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);
+++ /dev/null
-/*
- 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
-
/*
- 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;
};
--- /dev/null
+/*
+ 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
+
+++ /dev/null
-#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
--- /dev/null
+/*
+ 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
#ifndef COMPLEXCOLUMN_HH
#define COMPLEXCOLUMN_HH
+#include "stcol.hh"
+
/// column of Complex_staff: store one request
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
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();
};
/*
- complexwalker.hh -- part of LilyPond
+ complexwalker.hh -- declare Complex_walker
(c) 1996,97 Han-Wen Nienhuys
*/
#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);
};
+++ /dev/null
-/*
- 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
void junk();
void copy(Rhythmic_grouping const&);
};
+
+
+Rhythmic_grouping parse_grouping(Array<int> beat_i_arr, Array<Moment> elt_length_arr);
+
+
#endif
+++ /dev/null
-/*
- 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
-
+++ /dev/null
-/*
- 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
-
/**
+ 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:
- a pitch (it can be transposed)
*/
-
-
struct Input_music {
virtual Voice_list convert()const=0;
virtual Moment length()const=0;
/**
- voice like.
+ A voice like list of music.
different music forms which start after each other ( concatenated,
stacked "horizontally )
-#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"
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
/*
- 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;
};
/// 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
#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;
};
--- /dev/null
+/*
+ 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
#include "varray.hh"
#include "offset.hh"
+
+/**
+ Least squares minimisation in 2 variables.
+ */
struct Least_squares {
Array<Offset> input;
void minimise(Real &coef, Real &offset);
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;
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);
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
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);
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;
/* *************** */
#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*);
//
-// 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
-//
-// 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();
};
/*
- 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();
/*
- meter.hh -- part of LilyPond
+ meter.hh -- declare Meter
(c) 1996,97 Han-Wen Nienhuys
*/
#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;
--- /dev/null
+/*
+ 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
#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
else return 0;
}
+Interval itemlist_width(const Array<Item*> &its);
#endif
--- /dev/null
+/*
+ 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
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);
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
#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);
-
/*
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;
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;
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;
struct Text_gob;
struct Text_register;
struct Text_req;
-
+struct Timing_req;
struct Time_description;
struct Voice;
struct Voice_element;
#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
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.
*/
/* 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 */
/// 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();
}
};
-/// 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
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#
*/
#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);
};
--- /dev/null
+#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
-// 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();
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; }
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 ;
};
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
*/
-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);
+/*
+ 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"
const char *defined_ch_c_l_;
int errorlevel_i_;
- Assoc<String, Moment> markers_assoc_;
-
/* *************************************************************** */
/// construction
~Score();
void add(Staff*);
- void add_marks(Array<String>, Array<Moment>);
/// do everything except outputting to file
void process();
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&){}
/**
--- /dev/null
+/*
+ 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
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 //
{
public:
/**
- RETURN path to opened file.
+ @return path to opened file.
*/
Source_file( String &filename_str );
~Source_file();
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 //
#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.
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
*/
+/*
+ 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;
/// 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
-
-
+++ /dev/null
-/*
- 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
-
--- /dev/null
+/*
+ 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
-
/*
- 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&);
};
#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;
+
};
/*
- stem.hh --
+ stem.hh -- declare Stem
(c) 1996,97 Han-Wen Nienhuys
*/
#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
/// 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.
*/
/// 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
*/
#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
int align_i_;
String text_str_;
String style_str_;
- char const* defined_ch_c_l_m;
+ char const* defined_ch_c_l_;
/* ****************/
#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_;
#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);
#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.
#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
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;
}
"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
}
% 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{}"
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
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}
}
}
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?
}
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
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
melodic music { mwa }
}
commands {
- meter 3*4
+ meter {3*4}
}
}
melodie = music {
$ % switch Lilypond in note-mode
+ \clef\violin
\octave {} % set the default octave
% the default note duratino is 4
%%% theme
% 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.
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
}
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.
}
}
staff {
melodic
music{$
- c8
+ c8\key{fis cis gis}
|r4 r4 r4 r4
|'cis2.. r8
| r4 r8 r16 r32 r32
|''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 {
% 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}
+
}
}
+%%%%%%%%% HAS TO BE ADJUSTED to pl32
+
+
% martien.ly
%
% Viola Quartet
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
alto = music {
$
\duration{16}
+ \clef\alto
\octave{}
%1
[ `b8. `a ] [ `g8 `b c ] |
%
cello = music {
$
- \octave{`}
+\clef"bass" \octave{`}
\duration{4}
%%1
g `g |
%
violin1 = music {
$
+\clef "violin"
\octave{}
\duration{4}
%1
%
violin2 = music {
$
- \octave{}
+\clef "violin" \octave{}
\duration{4}
%1
d2 |
melodic
music{ $
\octave { ' }
+ \key{ fis cis }
\duration { 8 }
% 1
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] |
| [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] |
)b [fis a b ] 'cis4 b4 |
fis2 r2 |
r1-\fermata
- $}
- commands {
- key $fis cis $
- }
+ $}
}
score {
staff {
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
--- /dev/null
+%
+% 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
|['c b a g][f e d c]
$}
- commands {
- }
}
+
score {
staff {
blah
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}
}
}
% % 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-. |
% { 'cis2.-\upbow e2. `a2.\stemdown } :||:
{ 'cis2.-\upbow e2. `a2. } | % :||:
%%9
-% \clef "violin"
+ \clef "violin"
% { 'e2 a2_f\stemdown }
{ 'e2 a2_"\f" }
[ 'd( 'e16 )'f16 ] |
% %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
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 {
geometric 1.4
output "scsii-menuetto.out"
}
-}
+o}
%#%%
%#%\duration8
%%1
-melodie = music { $
+melodie = music { $ \clef\violin
\duration{ 8 }
r_"\pp" { [ d `a-| } f-| { d `a-| } f-| { d `a-| ] } |
%%2
$ }
begeleiding = music { $
- \duration{2}
+\clef\bass
+\duration{2}
`d r4
%%2
``bes r4
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 {
% Copyright: none
melodie = music {
- $
+ $\clef\violin
c c | g g | a a | g g |
f f | e e | d d8.( e16 | )c2 | % :|
}
begeleiding = music {
- $
+ $\clef \bass
\octave{`}
c 'c | 'e 'c | 'f 'c | 'e 'c |
'd b | 'c a | f g | c2 |
mstaf = staff {
melodic
music { melodie }
- commands { clef "violin" }
}
bass_staf = staff {
melodic
music { begeleiding }
- commands { clef "bass" }
}
unitspace 2.5cm
}
commands {
- meter 2 * 4
- skip 24:0
+ meter {2 * 4}
+ skip 24*2
bar "||"
}
}
%
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] |
$}
\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$}
}
}
#include "molecule.hh"
#include "paperdef.hh"
#include "lookup.hh"
+#include "debug.hh"
NAME_METHOD(Bar);
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;
}
--- /dev/null
+/*
+ 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;
+}
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);
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);
{
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;
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
}
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];
+++ /dev/null
-/*
- 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_+"\'");
-}
+/*
+ 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);
y_off = 6;
}
void
-Clef_item::read(Clef k)
+Clef_item::read(Clef_register const &k)
{
read(k.clef_type_str_);
}
--- /dev/null
+/*
+ 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;
+}
+
+++ /dev/null
-#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
-}
--- /dev/null
+/*
+ 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];
+}
--- /dev/null
+/*
+ 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);
+}
+++ /dev/null
-#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_);
-}
-
-
-#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);
+}
+/*
+ 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)
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);
}
}
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);
}
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
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
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()
{
}
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);
+}
+++ /dev/null
-#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;
- }
-}
+/*
+ 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"
}
return r;
}
+
void
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.
*/
Array<int>
Rhythmic_grouping::generate_beams(Array<int> flags, int &flagidx)
{
-
assert (!interval_) ;
Array< Array<int> > children_beams;
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);
+}
+
#include "headreg.hh"
#include "paperdef.hh"
#include "complexwalker.hh"
-
+#include "musicalrequest.hh"
Notehead_register::Notehead_register(Complex_walker*w_l)
:Request_register(w_l)
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);
+++ /dev/null
-#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;
-}
+++ /dev/null
-#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)
-{
-}
#include "debug.hh"
#include "inputmusic.hh"
#include "voice.hh"
-#include "request.hh"
+#include "musicalrequest.hh"
void
Simple_music::add(Voice_element*v)
+/*
+ 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)
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();
-#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;
}
}
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 +"\'", 0 );
+ 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
{
#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_;
+}
#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()
Key::set(int i, int a)
{
assert(a > -3 && a < 3);
- accidentals[i]=a;
+ accidental_i_arr_[i]=a;
}
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;
-}
#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);
Molecule*
-Keyitem::brew_molecule_p()const
+Key_item::brew_molecule_p()const
{
Molecule*output = new Molecule;
Real inter = paper()->internote();
--- /dev/null
+/*
+ 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
+}
String pf(s);
if (pf=="") {
is = &cin;
- defined_ch_c_l_m = 0;
+ defined_ch_c_l_ = 0;
sourcefile_l_ = 0;
}
else {
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;
}
#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)
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;
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
-
+#include "musicalrequest.hh"
#include "localkeyreg.hh"
#include "localkeyitem.hh"
#include "complexwalker.hh"
{
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()
{
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_);
}
}
}
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";
-#include "request.hh"
+#include "musicalrequest.hh"
#include "voice.hh"
#include "staffwalker.hh"
#include "debug.hh"
#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;
}
-#include "request.hh"
+#include "musicalrequest.hh"
#include "paperdef.hh"
#include "lyricitem.hh"
#include "stem.hh"
// 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_ );
}
-#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"
}
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
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);
}
-#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();
+
}
{
return (Lyric_column*) *(*this);
}
-
-void
-Lyric_walker::reset()
-{
-}
-
Meter::brew_molecule_p()const
{
Symbol s = paper()->lookup_p_->meter(args);
-return new Molecule(Atom(s));
+ return new Molecule(Atom(s));
}
--- /dev/null
+/*
+ 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;
+}
+#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;
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;
+}
+
"goto", GOTO,
"in", IN_T,
"key", KEY,
- "mark", MARK,
+
"meter", METER,
"mm", MM_T,
"multivoice", MULTIVOICE,
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;
}
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
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;
}
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;
#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"
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;
}
}
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);
}
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);
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);
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);
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;
}
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;
}
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;
}
#include "paperdef.hh"
#include "lookup.hh"
#include "molecule.hh"
-#include "request.hh"
+#include "musicalrequest.hh"
NAME_METHOD(Notehead);
#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
%union {
Request * request;
Real real;
- Input_command *command;
Identifier *id;
- Voice *voice;
+ Voice *voice;
Voice_element *el;
String *string;
const char *consstr;
Moment *moment;
Array<String> * strvec;
- Array<Input_command*> *commandvec;
Array<int> *intvec;
-
+ Array<Melodic_req*> *melreqvec;
Input_staff *staff;
Input_score *score;
Symtables * symtables;
%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
%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
%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
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);
delete $1;
}
| declarable_identifier error '}' {
-// warning( "parse error", lexer->here_ch_c_l() );
+
}
;
/*
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_;
$$ = 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 {
}
;
-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
| paper_body UNITSPACE dim { $$->whole_width = $3; }
| paper_body GEOMETRIC REAL { $$->geometric_ = $3; }
| paper_body error {
-// warning( "parse error", lexer->here_ch_c_l() );
+
}
;
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() );
}
;
$$->add($2);
}
| music_voice_body error {
-// warning( "parse error", lexer->here_ch_c_l() );
}
;
$$->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() );
}
;
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
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();
$$='[';
}
;
pre_requests:
| pre_requests pre_request {
pre_reqs.push($2);
+ $2->defined_ch_c_l_ = lexer->here_ch_c_l();
}
;
/*
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);
}
;
;
-int_list: {
- $$ = new Array<int>;
- }
- | int_list int {
- $$->push($2);
- }
- ;
-
dim:
real unit { $$ = $1*$2; }
void
yyerror(const char *s)
{
-// if ( YYRECOVERING() )
-// return;
lexer->LexerError(s);
if ( fatal_error_i )
delete lexer;
lexer = 0;
- assert(define_spots.empty());
+ if(!define_spots.empty())
+ warning("Braces don't match.",0);
}
Paperdef*
mtor << "rank: " << rank() << '\n';
mtor << "# symbols: " << its.size() ;
- if (breakable()){
+ if (breakable_b()){
mtor << "\npre,post: ";
prebreak_p_->print();
postbreak_p_->print();
void
PCol::set_breakable()
{
- if (breakable())
+ if (breakable_b())
return;
prebreak_p_ = new PCol(this);
}
bool
-PCol::breakable() const
+PCol::breakable_b() const
{
return prebreak_p_||postbreak_p_;
}
bool
PCol::used()const
{
- return breakable() || its.size();
+ return breakable_b() || its.size();
}
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;
}
{
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
{
/*
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)
/* *************** */
-/*
- 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)
{
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
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
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;
*/
#include "voice.hh"
-#include "request.hh"
+#include "musicalrequest.hh"
#include "register.hh"
#include "notehead.hh"
#include "complexwalker.hh"
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;
}
/* *************** */
+bool
+Request_register::try_request(Request*)
+{
+ return false;
+}
Request_register::Request_register()
{
{
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);
+}
+
-#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
{
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();
}
-void
-Request::do_print() const
-{
-#ifndef NPRINT
-#endif
-}
void
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()
/* *************** */
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;
}
/* *************** */
{
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)
{
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();
}
-
+/*
+ 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"
{
when_ = w;
pcol_l_ = new PCol(0);
- musical_ = false;
+ musical_b_ = false;
}
bool
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] << " ";
}
int
-Tdescription_compare(Moment &a , Moment& b)
+Moment_compare(Moment &a , Moment& b)
{
return sign(a-b);
}
void
Score_column::preprocess()
{
- durations.sort(Tdescription_compare);
+ durations.sort(Moment_compare);
}
void
Score_column::add_duration(Moment d)
}
durations.push(d);
}
+
+bool
+Score_column::breakable_b()
+{
+ return pcol_l_->breakable_b();
+}
+/*
+ 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();
// debugging
OK();
*mlog << endl;
- pscore_p_->process();
+ pscore_p_->process();
}
/**
}
/**
+ 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)
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);
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;
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];
- }
-}
--- /dev/null
+/*
+ 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];
+}
+
+
-#include "request.hh"
+#include "musicalrequest.hh"
#include "paperdef.hh"
#include "script.hh"
#include "stem.hh"
#include "scriptreg.hh"
#include "script.hh"
-#include "request.hh"
+#include "musicalrequest.hh"
#include "complexwalker.hh"
Script_register::Script_register(Complex_walker*w)
(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)
{
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();
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_);
}
}
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;
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();
}
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;
}
}
}
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;
}
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
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
#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_;
{
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++;
}
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
{
#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
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;
{
#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";
+++ /dev/null
-#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));
- }
-}
-
pstaff_l_ = s.pstaff_l_;
offset_ = Offset(0,0);
}
-
+/**
+ TODO:
+ If deleted, then remove dependants depency!
+ */
Staff_elem::~Staff_elem()
{
delete output;
-#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)
{
{
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);
+}
+
+/*
+ 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;
}
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
Real
Stem::hpos()const
{
- return pcol_l_->hpos + stem_xoffset;
+ return pcol_l_->hpos + stem_xoffset; // hmm. + offset_.x;
}
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
+#include "musicalrequest.hh"
#include "stembeamreg.hh"
#include "beam.hh"
#include "stem.hh"
#include "complexwalker.hh"
#include "complexstaff.hh"
#include "debug.hh"
-
+#include "grouping.hh"
Stem_beam_register::Stem_beam_register(Complex_walker*w)
:Request_register(w)
{
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()))
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);
}
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;
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;
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;
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
#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"
-
#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"
#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);
{
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)
-#include "request.hh"
+#include "musicalrequest.hh"
#include "paperdef.hh"
#include "textitem.hh"
#include "stem.hh"
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
+#include "musicalrequest.hh"
#include "textreg.hh"
#include "textitem.hh"
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;
}
{
#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
}
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_ ++;
}
}
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;
+/*
+ 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)
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);
-}
--- /dev/null
+/*
+ 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);
+}
-#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;
delete stem_beam_reg_;
delete script_reg_;
}
+
void
Voice_group_registers::pre_move_processing()
{
-#include "request.hh"
+#include "musicalrequest.hh"
#include "voicegroup.hh"
#include "register.hh"
#include "slurreg.hh"
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);
}
// 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);