# yydebug
InitParser 1
Parser 1
+InitDeclarations 1
# FlexLexer debug
InitLexer 1
Stem 1
Staff 0
Score 1
-Voice 1
-Voice_element 1
+Voice 0
+Voice_element 0
Input_cursor 1
Commands_at 1
Input_command 1
Melodic_req 0
Midi_walker 0
Stem_req 1
-Group_change_req 1
+Group_change_req 0
Script_req 1
Colinfo 1
Word_wrap 1
Script_def 1
Text_def 1
Paperdef 1
+Symtable 1
+Symtables 1
\ No newline at end of file
(add-hook 'c-mode-hook
'(lambda ()(setq c-basic-offset 4)))
-
-
(add-hook 'c++-mode-hook
'(lambda() (c-set-style "Stroustrup")
)
)
+=head2 FILES
+The class C<This_is_a_class> is declared in F<this-is-a-class.hh> and
+implemented in F<this-is-a-class.cc>.
=head2 CLASSES and TYPES:
Class::member()
Type Class::member_type_
-the C<type> is a Hungarian notation postfix for $C<Type>$. See below
+the C<type> is a Hungarian notation postfix for C<Type>. See below
=head2 COMMENTS
NB: in PCursor (which is part of the library) P stands for PointerCursor
-=head2 MEMBERS(2)
+=head2 MEMBERS (2)
Standard methods:
=item B<-M,--midi>
-do midi output only
+Do midi output only.
=item B<-d,--debug>,
=over 5
=item *
-a fast computer (a full page of music typically takes 1 minute
+A fast computer (a full page of music typically takes 1 minute
on my 486/66, using the DEBUG compile. It's lot slower than most
MusiXTeX preprocessors)
You probably want to edit Variables.make to tailor the compilation
flags. If you're not into debugging C++, then you should go for no
-debugging and C<-O2>
+debugging and C<-O2>.
=head1 AUTHORS
Han-Wen Nienhuys <hanwen@stack.nl>, Main author
=item *
-Jan Nieuwenhuizen <jan@digicash.com>, Context errors, Lyrics,
-bits of FlowerLib, general comments.
+Jan C. Nieuwenhuizen <jan@digicash.com>, Context errors, Lyrics, Midi
+output, m2m, bits of FlowerLib, general comments.
=item *
-Mats Bengtsson <matsb@s3.kth.se>, bugfixes, testing, general comments.
+Mats Bengtsson <matsb@s3.kth.se>, bugfixes, testing, criticism, general comments.
=back
=head1 SEE ALSO
-There are some documentation files in the subdirectory F<Documentation/>,
-among others: lilygut, lilyinput, error, faq,
+There are some documentation files in the subdirectory
+F<Documentation/>, among others: lilygut, lilyinput, error, faq. There
+is a rudimentary webpage at the following URL:
+http://www.stack.nl/~hanwen/lilypond/index.html
=head1 REMARKS
Some questions that have been answered before.
+Q: Gee, I really like MPP, why would I want to switch to LilyPond?
+
+A: The design of MPP is broken beyond repair: it is very difficult to
+enhance MPP, and any working version is (probably) bug-ridden.
+
+Every once in a while, I have a major attack of hybris, and I go in to
+enhance MPP. I usually end up thoroughly frustated within an hour or
+so. I concur, it does work but extending MPP is a major pain.
+
+We will not sacrifice development time on something else than the most
+trivial bugfixes. If you insist on using MusiXTeX, then LilyPond is
+not for you, and you might try PMX which does also nice output.
+
+
Q: Why are [] around the notes, and () inbetween?
A: [] designate beams, a note can only be in one beam at the same
A0: Reconsider. Try Linux. It's fun!
A1: Currently (patchlevel 27), LilyPond (and flowerLib) compiles, links
-and runs on windhoos-nt, using the cygnus gnu port (release b17.1).
+and runs on Windhoos-NT, using the CYGNUS GNU port (release b17.1).
I (JCN) only had to make a minor workaround for missing library calls.
Have a look at http://www.cygnus.com/gnu-win32. To make LilyPond type
-make $OS. (I am not promising to maintain this platform, it is just that
+C<make $OS>. (I am not promising to maintain this platform, it is just that
when having to use doze, i-m sometimes too lazy to reboot.)
-A2: I haven't had time to find a GCC crosscompiler (*with* g++, mind you) to
+A2: I haven't had time to find a GCC crosscompiler (I<with> g++, mind you) to
DOS/win (in rpm, please :).
A: Yes.
+
Q: Why shouldn't I put all commands (\clef, \meter) inside the music?
A: You should do what you like, but at some time we will enable
Q: Why do I need g++ >= 2.7?
A: By using g++ LilyPond is portable to all platforms which support
-g++ (there are quite a few). Not having to support other compilers
-saves us a *lot* of trouble. LilyPond & FlowerLib uses:
+g++ (there are quite a few, more than platforms which have AT&T CC or
+Micro$oft C++). Not having to support other compilers saves us a I<lot>
+of trouble. You need a version better than 2.7 because LilyPond &
+FlowerLib uses:
=over 6
=back
+Q: Why do I have to tell LilyPond explictly that the lowest-line-note
+is "es" if I am using the key of "bes"?
+
+A: The goal of lilypond (and MPP) was to design a language which
+conveys the I<musical> message of a piece. That is the reason that it
+does not ask you to enter the line on which the note is is. (Or the
+"natural" note-name without any "es" or "is" postfix)
+
+We do realise it is a bit shortsighted of us to assume that any user could
+readily read the music he/she is entering. We might extend LilyPond to
+allow "programmable" intervals, keys and clefs (and thus give him a
+means to build his own scales, custom etc.).
+
+For now, you can program LilyPond to use custom notenames and do
+
+ notenames { ces_key_notenames }
+ music { $ % music in the key of ces
+ ...
+ $}
+ notenames { dutch_notenames } % restore default
+
+as an ad-hoc solution.
+
programmers and non programmers. The final aim is to be able to
express what can be expressed in sheet music.
+This document is intended to summarise the plans for mudela 2 (mudela
+0 being mpp-input, and mudela-1 LilyPond input upto version 0.0.38).
+Ideas for any further extensions (mudela 3, read total vapourware)
+should be marked as such.
+
+
=over 5
=item *
We might be able to do without the staff{} construct, but I doubt if
it will make things easier.
+=head1 DECISIONS
+
+[none, yet]
+
+
=head1 THOUGHTS
=head2 Typing
\key{\keybes}
+[LOOSE]
+We could be even more rabid, and use '\rab' as \bar terminator.
+
+Just kidding of course...
[LOOSE THOUGHT]
not. I see the Mudela music as something which can be plugged into
different staffs, transposed, translated in time, copied, quoted,
etc. Encouraging "inline" commands would be bad since they hinder this
-reuse of typed music.
+reuse of mudela-isated music.
The way I figure it, the bad part is essentially counting
bars/wholes. Maybe we can get rid of it, by reinstalling the "mark"
linked across staffs. I should first think of a way to do this in
LilyPond, before even considering a syntax.
+[see also: filtering]
=head2 Volta
The syntax of /, * and : has to be settled, we have
- - notes (1, 2, 4, 8 etc)
+ - notes (1, 2, 4, 8 etc), which also can take 1*2/3 to do plets.
- meter 2*4
- plet 2/3
- multiple notes: 3*4
- abbreviations (not implemented) c4/4 or c4*4
+ - measure grouping, {2*4 3*4}
+ - skip
+
=head2 Filtering
sc1.staff{<\b1 \b2>}
sc1.paper=mypaperdef;
-
We're not doing a programming language. In this syntax the parser has
to lookup what sc1 means, decide if it should copied shallow/deep,
decide if has a staff block, switch the mode after it finds that staff
Mudela version 3. And I think using m4 (or something alike) would be
just as convenient.
+It might clear things up, if JCN told us what is so special about this
+syntax (without the C++ looks).
+
=head2 Transposition
Has to be done. How about:
+pl 38
+
+Internal
+ - great filename renaming operation with - convention.
+ - printing methods for paper_def/lookup/symtab(s)
+ - untied all registers from complexwalker. Now registers are
+intrinsically hierarchical. All walker communication is done via a
+"top level" register.
+
+******
pl 37
- language.pod as starting point for mudela devel.
- Jan's patches:
-(jan's pl 36-3)
-
+Features
+ - m2m patchy --no-triplet option;
+ lilypond accepts m2m's real midi output (hand-add red tape)
+ - m2m output only valid durations, resync option wip
- m2m produces .ly output
Internal
- simpler and better naming for Duration*
- the great String renaming / index to base=0 change
- Track_column, Lily_stream
-Features
- - m2m patchy --no-triplet option;
- lilypond accepts m2m's real midi output (hand-add red tape)
- - m2m output only valid durations, resync option wip
+ - Duration, Plet, Duration_convert taking load off duration calc.
Bugfix
- m2m duration calc
-Internal
- - Duration, Plet, Duration_convert taking load off duration calc.
+
+******
pl 36
- Jan's patches:
- do MIDI rests cleanly.
# Sources.make
# sourcefiles to be shipped. Also used for dependencies
-hdr=bar.hh barreg.hh beam.hh\
+hdr=bar.hh bar-reg.hh beam.hh\
binary-source-file.hh\
- boxes.hh break.hh clefreg.hh clefitem.hh\
+ boxes.hh break.hh class-name.hh clef-reg.hh clef-item.hh\
colhpos.hh commandrequest.hh \
- complexwalker.hh complexstaff.hh\
- const.hh debug.hh dimen.hh directionalspanner.hh\
+ complex-walker.hh complex-staff.hh\
+ const.hh debug.hh dimen.hh directional-spanner.hh\
glob.hh grouping.hh headreg.hh idealspacing.hh\
identifier.hh identparent.hh \
- inputmusic.hh inputscore.hh inputstaff.hh\
- inputfile.hh\
- item.hh key.hh keyitem.hh\
- keyreg.hh\
+ input-music.hh input-score.hh input-staff.hh\
+ input-file.hh\
+ item.hh key.hh key-item.hh\
+ key-reg.hh\
keyword.hh leastsquares.hh lexer.hh linespace.hh \
- localkeyitem.hh localkeyreg.hh lookup.hh \
- lyricitem.hh lyricstaff.hh lyricwalker.hh\
- main.hh meter.hh meterreg.hh\
- mididef.hh midiitem.hh midioutput.hh midistream.hh\
- midiwalker.hh\
+ local-key-item.hh local-key-reg.hh lookup.hh \
+ lyric-item.hh lyricstaff.hh lyricwalker.hh\
+ main.hh meter.hh meter-reg.hh\
+ midi-def.hh midi-item.hh midi-output.hh midi-stream.hh\
+ midi-walker.hh\
misc.hh\
molecule.hh moment.hh musicalrequest.hh\
- notehead.hh notename.hh offset.hh paperdef.hh\
+ notehead.hh notename.hh offset.hh paper-def.hh\
parseconstruct.hh pcol.hh proto.hh\
pscore.hh pstaff.hh qlp.hh\
qlpsolve.hh register.hh registergroup.hh reqtodo.hh \
- request.hh rest.hh scorecolumn.hh score.hh\
- scoreline.hh scorewalker.hh script.hh scriptdef.hh scriptreg.hh \
- slur.hh slurreg.hh source.hh sourcefile.hh\
+ request.hh rest.hh score-column.hh score.hh\
+ scoreline.hh score-walker.hh script.hh script-def.hh script-reg.hh \
+ slur.hh slur-reg.hh source.hh source-file.hh\
spanner.hh staff.hh\
- staffelem.hh staffeleminfo.hh staffline.hh staffsym.hh stembeamreg.hh\
- staffcolumn.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\
- voiceregs.hh voicegroupregs.hh walkregs.hh
+ staff-elem.hh staff-elem-info.hh staffline.hh staffsym.hh stem-beam-reg.hh\
+ staff-column.hh stem.hh staff-walker.hh symbol.hh symtable.hh\
+ tex.hh text-def.hh \
+ textitem.hh text-reg.hh textspanner.hh time-description.hh \
+ tex-stream.hh voice.hh\
+ voice-element.hh voice-regs.hh voice-group-regs.hh walkregs.hh
-mycc=bar.cc barreg.cc beam.cc \
+mycc=bar.cc bar-reg.cc beam.cc \
binary-source-file.cc\
- boxes.cc break.cc calcideal.cc clefreg.cc\
- clefitem.cc colhpos.cc commandrequest.cc\
- complexstaff.cc complexwalker.cc \
+ boxes.cc break.cc calcideal.cc clef-reg.cc\
+ clef-item.cc colhpos.cc commandrequest.cc\
+ complex-staff.cc complex-walker.cc \
debug.cc dimen.cc\
- directionalspanner.cc\
+ directional-spanner.cc\
grouping.cc groupregs.cc headreg.cc\
idealspacing.cc identifier.cc\
- inputmusic.cc inputscore.cc\
- inputstaff.cc\
- inputfile.cc\
- item.cc key.cc keyitem.cc \
- keyreg.cc keyword.cc\
+ input-music.cc input-score.cc\
+ input-staff.cc\
+ input-file.cc\
+ item.cc key.cc key-item.cc \
+ key-reg.cc keyword.cc\
leastsquares.cc lexerinit.cc linespace.cc \
- localkeyitem.cc localkeyreg.cc lookup.cc\
- lyricitem.cc lyricstaff.cc lyricwalker.cc\
- main.cc meter.cc meterreg.cc\
- mididef.cc midiitem.cc midioutput.cc midistream.cc\
- midiwalker.cc misc.cc molecule.cc mylexer.cc note.cc\
+ local-key-item.cc local-key-reg.cc lookup.cc\
+ lyric-item.cc lyricstaff.cc lyricwalker.cc\
+ main.cc meter.cc meter-reg.cc\
+ midi-def.cc midi-item.cc midi-output.cc midi-stream.cc\
+ midi-walker.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\
+ paper-def.cc pcol.cc pscore.cc pstaff.cc qlp.cc qlpsolve.cc\
register.cc registergroup.cc request.cc rest.cc\
- scorecolumn.cc score.cc\
- scoreline.cc scores.cc scorewalker.cc script.cc\
- scriptdef.cc scriptreg.cc slur.cc\
- slurreg.cc source.cc sourcefile.cc\
+ score-column.cc score.cc\
+ scoreline.cc scores.cc score-walker.cc script.cc\
+ script-def.cc script-reg.cc slur.cc\
+ slur-reg.cc source.cc source-file.cc\
spanner.cc staff.cc\
- staffelem.cc staffline.cc staffsym.cc\
- stembeamreg.cc staffcolumn.cc stem.cc\
- staffeleminfo.cc staffwalker.cc symbol.cc\
+ staff-elem.cc staffline.cc staffsym.cc\
+ stem-beam-reg.cc staff-column.cc stem.cc\
+ staff-elem-info.cc staff-walker.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 voiceelt.cc \
- voiceregs.cc voicegroupregs.cc\
+ texslur.cc text-def.cc textitem.cc text-reg.cc textspanner.cc\
+ time-description.cc tex-stream.cc voice.cc voiceelt.cc \
+ voice-regs.cc voice-group-regs.cc\
walkregs.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 \
item.cc keyword.cc leastsquares.cc \
- lookup.cc molecule.cc meter.cc\
- paperdef.cc parser.cc lexer.cc pstaff.cc qlp.cc qlpsolve.cc\
+ molecule.cc meter.cc\
+ paper-def.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\
+ template5.cc template6.cc version.cc tex-stream.cc tex.cc\
voice.cc wordwrap.cc spanner.cc
#
mym2msharedcc=\
binary-source-file.cc\
- inputfile.cc\
- sourcefile.cc\
+ input-file.cc\
+ source-file.cc\
source.cc\
#
* remove spurious/outdated comments in .ly
- * more control in Register_groups
-
* pushgroup, popgroup.
* basic dynamics
- * basic syntax
+ * basic syntax & parser/lexer cleanup.
* decent TeX page layout
* clean split for m2m of sources.
+ * caching of Register_group_register hierarchies.
+
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
+ * plet bugs: scales.ly
+
* key at clef change.
* key undo
* parshape
+ * a pure parser.
+
* bar numbers/repetition marks
* read from mmap directly: study yy_scan_buffer
* create libmudela, or liblily_frontend
+ * Horizontal_align_item, Vertical_align_item.
+
* move MIDI io to a ANSI C libmidi library.
* fold indentifiers and notenames?
# version info
MAJVER=0
MINVER=0
-PATCHLEVEL=37
+PATCHLEVEL=38
# CXX=g++
# turn off -pipe if linker doesn't support it
-EXTRACXXFLAGS=-pipe -Wall -W -Wmissing-prototypes -DSTRING_UTILS_INLINED -O
+EXTRACXXFLAGS=-pipe -Wall -W -Wmissing-prototypes -DSTRING_UTILS_INLINED
#
# -lefence = ElectricFence.
MY_CCSOURCE=$(addprefix $(CCDIR)/, $(mycc))
CCSOURCE=$(addprefix $(CCDIR)/, $(cc))
+
obs=$(addprefix $(OBJECTDIR)/,$(cc:.cc=.o))
m2mobs=$(addprefix $(OBJECTDIR)/,$(m2mcc:.cc=.o))
+
allcc=$(mycc) $(mym2mcc)
allobs=$(obs) $(m2mobs)
allexe=$(exe) $(m2m)
LINKER=$(CXX)
include Site.make
+TAGSACTION=etags -l c++ --no-defines
--- /dev/null
+/*
+ associter.hh -- part of flowerlib
+
+ (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef ASSOCITER_HH
+#define ASSOCITER_HH
+
+#include "assoc.hh"
+
+/// an iterator for the #Assoc# class
+template<class K, class V>
+struct Assoc_iter {
+ int i;
+ Assoc<K,V> &assoc_;
+ /// we don't want to be bothered by const correctness
+ Assoc_iter(const Assoc<K,V> &a) :
+ assoc_((Assoc<K,V> &)a)
+ {
+ i= next(0);
+ }
+ int next(int j) {
+ while (j < assoc_.arr.size() && assoc_.arr[j].free)
+ j++;
+ return j;
+ }
+ bool ok() const {
+ return i < assoc_.arr.size();
+ }
+ void OK()const {
+ assert(!ok() || !assoc_.arr[i].free);
+ }
+ void operator++(int) { i++; i = next(i); }
+ K key() { return assoc_.arr[i].key; }
+ V &val() { return assoc_.arr[i].val; }
+};
+
+#endif
--- /dev/null
+#include <fstream.h>
+#include <ctype.h>
+
+#include "data-file.hh"
+
+void
+Data_file::gobble_white()
+{
+ char c;
+
+ while ((c=data_get()) == ' ' ||c == '\t')
+ if (eof())
+ break;
+
+ data_unget(c);
+}
+
+String
+Data_file::get_word()
+{// should handle escape seq's
+ String s;
+
+ while (1)
+ {
+ char c = data_get();
+
+ if (isspace(c) || eof())
+ {
+ data_unget(c);
+ break;
+ }
+
+
+ if (c == '\"')
+ {
+ rawmode= true;
+
+ while ((c = data_get()) != '\"')
+ if (eof())
+ error("EOF in a string");
+ else
+ s += c;
+
+
+ rawmode= false;
+ }
+ else
+ s += c;
+ }
+
+ return s;
+}
+
+/** get a char
+ Only class member who uses text_file::get
+ */
+char
+Data_file::data_get() {
+ char c = get();
+ if (!rawmode && c == '#') // gobble comment
+ {
+ while ((c = get()) != '\n' && !eof())
+ ;
+ return '\n';
+ }
+
+ return c;
+}
+
+/// read line, gobble '\n'
+String Data_file::get_line()
+{
+ char c;
+ String s;
+
+ while ((c = data_get()) != '\n' && !eof())
+ s += c;
+ return s;
+}
+
+/// gobble stuff before first entry on a line.
+void
+Data_file::gobble_leading_white()
+{
+ // eat blank lines.
+ while (!eof()) {
+ char c = data_get();
+ if (!isspace(c)) {
+ data_unget(c);
+ break;
+ }
+ }
+}
+
+
--- /dev/null
+/*
+ data-file.hh -- declare Data_file
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef DATAFILE_HH
+#define DATAFILE_HH
+
+#include "text-stream.hh"
+
+/// read a data file
+class Data_file : private Text_stream
+{
+
+ public:
+ bool rawmode;
+
+ Text_stream::line;
+ Text_stream::eof;
+ Text_stream::get_name;
+
+ char data_get();
+ void data_unget(char c) {
+ unget(c);
+ }
+
+ /// read line, eat #\n#
+ String get_line();
+
+ /// read a word till next space, leave space. Also does quotes
+ String get_word();
+
+ /// gobble horizontal white stuff.
+ void gobble_white();
+
+ /// gobble empty stuff before first field.
+ void gobble_leading_white();
+ Data_file(String s) : Text_stream(s) {
+ //*mlog << "(" << s << flush;
+ rawmode= false;
+ }
+
+ ~Data_file() {
+ // *mlog << ")"<<flush;
+ }
+
+ warning(String s) {
+ message("warning: " + s);
+ }
+ error(String s){
+ message(s);
+ exit(1);
+ }
+};
+#endif // DATAFILE_HH
--- /dev/null
+/*
+ libc-extension.cc -- implement some string.h extensions
+
+ source file of the flowerlib
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include <string.h>
+#include <ctype.h>
+#include "libc-extension.hh"
+
+/*
+ compensate for lacking libc functions.
+ */
+ char*
+strnlwr( char* start_l ,int n)
+{
+ char * p = start_l + n;
+ while ( --p >= start_l) {
+ *p = tolower( *p ); /* a macro on some compilers */
+ }
+ return start_l;
+}
+
+ char*
+strnupr( char* start_l, int n)
+{
+ char * p = start_l + n;
+ while ( --p >= start_l) {
+ *p = toupper( *p ); /* a macro on some compilers */
+ }
+ return start_l;
+}
+
+/** locate a substring. #memmem# finds the first occurrence of
+ #needle# in #haystack#
+ */
+
+ char *
+memmem(const Byte * haystack, const Byte *needle,
+ int haystack_len, int needle_len)
+{
+ const Byte * end_haystack = haystack + haystack_len - needle_len;
+ const Byte * end_needle = needle + needle_len ;
+
+ /* Ahhh ... Some minimal lowlevel stuff. This *is* nice; Varation
+ is the spice of life */
+ while (haystack < end_haystack) {
+ const Byte *subneedle_l = needle;
+ const Byte *subhaystack_l = haystack;
+ while (subneedle_l < end_needle) {
+ if (*subneedle_l++ != *subhaystack_l++)
+ goto next; // yeah. I should be prosecuted.
+ }
+
+ // completed the needle. Gotcha.
+ return (char*) haystack;
+ next:
+ haystack++;
+ }
+ return 0;
+}
+
+Byte *
+memrchr(const Byte * p, int n, char c)
+{
+ const Byte * q = p+n;
+ while (q > p) {
+ if (*--q == c)
+ return (Byte*)q;
+ }
+ return 0;
+}
+
+
+template<class T>
+inline void
+my_swap(T &t1, T &t2, T &tmp)
+{
+ tmp = t1;
+ t1 = t2;
+ t2 = tmp;
+}
+
+Byte*
+strrev( Byte* byte_l, int length_i )
+{
+ Byte tmp_byte;
+
+ Byte* left_l = byte_l;
+ Byte* right_l = byte_l + length_i;
+
+ while ( right_l > left_l ) {
+ my_swap(*right_l-- , *left_l++ , tmp_byte);
+ }
+ return byte_l;
+}
--- /dev/null
+/*
+ libc-extension.hh -- declare some string.h extensions
+
+ source file of the flowerlib
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef LIBC_EXTENSION_HH
+#define LIBC_EXTENSION_HH
+#include "fproto.hh"
+
+char* strnlwr( char* start_l ,int n);
+char* strnupr( char* start_l, int n);
+/*
+ should use void* like in libc
+ */
+char *memmem(const Byte * haystack, const Byte *needle,
+ int haystack_len, int needle_len);
+Byte *memrchr(const Byte * p, int n, char c);
+Byte*strrev( Byte* byte_l, int length_i );
+
+
+#endif // LIBC_EXTENSION_HH
--- /dev/null
+/*
+ string-data.hh -- declare String_data
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef STRINGDATA_HH
+#define STRINGDATA_HH
+
+
+/**Internal String struct.
+ the data itself. Handles simple tasks (resizing, resetting)
+ */
+class String_data {
+ // GNU malloc: storage overhead is 8 bytes anyway.
+
+friend class String_handle;
+ int maxlen; // maxlen is arraysize-1
+
+ int length_i_;
+ Byte* data_byte_p_;
+ int references;
+
+ /// init to ""
+ String_data();
+
+ /// init from src. Conservative allocation.
+ String_data(String_data const &src);
+
+ ~String_data();
+
+ /** POST: maxlen >= j.
+ @param j, maximum stringlength_i_.
+ contents thrown away.
+ */
+ void setmax(int j);
+
+ /** POST: maxlen >= j.
+ @param j, maximum stringlength_i_.
+ contents are kept if it grows.
+ */
+ void remax(int j);
+
+ /// check if writeable.
+ void OKW();
+
+ /// check state.
+ void OK();
+
+ /// reduce memory usage.
+ void tighten();
+
+ // assignment.
+ void set( Byte const* byte_c_l, int length_i );
+
+ void set( char const* ch_c_l );
+
+ /// concatenation.
+ void append( Byte const* byte_c_l, int length_i );
+
+ void operator += ( char const* ch_c_l );
+
+ char const* ch_c_l() const;
+
+ char* ch_l();
+
+ Byte const* byte_c_l() const;
+
+ // idem, non const
+ Byte* byte_l();
+
+ void trunc(int j);
+
+ /** access element. not really safe. Can alter length_i_ without
+ #String_data# knowing it. */
+ Byte &operator [](int j);
+ Byte operator [](int j) const;
+ bool null_terminated_b()const;
+};
+
+
+
+#ifdef STRING_UTILS_INLINED
+#ifndef INLINE
+#define INLINE inline
+#endif
+#include "string-data.inl"
+
+#endif
+
+
+#endif // STRING_DATA_HH
--- /dev/null
+/* -*-C++-*-
+ String_data.inl -- implement String_data
+
+ source file of Flower lib
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#ifndef STRINGDATA_INL
+#define STRINGDATA_INL
+
+#include <assert.h>
+#include <memory.h>
+
+#include "string-data.hh"
+const int INITIALMAX=8;
+
+#include <sys/types.h>
+
+INLINE void
+String_data::OKW()
+{
+ assert (references == 1);
+}
+
+INLINE void
+String_data::OK()
+{
+ assert(maxlen >= length_i_);
+ assert(bool(data_byte_p_));
+ assert(references >= 1);
+}
+
+
+INLINE
+String_data::String_data()
+{
+ references=0;
+ maxlen = INITIALMAX;
+ data_byte_p_ = new Byte[maxlen + 1];
+ data_byte_p_[0] = 0;
+ length_i_ = 0;
+}
+
+INLINE
+String_data::String_data(String_data const &src)
+{
+ references=0;
+ maxlen = length_i_ = src.length_i_;
+ data_byte_p_ = new Byte[maxlen+1]; // should calc GNU 8byte overhead.
+ memcpy( data_byte_p_, src.data_byte_p_, length_i_ + 1 );
+}
+
+INLINE
+String_data::~String_data()
+{
+ assert(references == 0);
+ delete[] data_byte_p_;
+}
+
+INLINE void
+String_data::setmax(int j)
+{
+ OKW();
+ if (j > maxlen) {
+ delete data_byte_p_;
+ maxlen = j;
+ data_byte_p_ = new Byte[maxlen + 1];
+
+ data_byte_p_[0] = 0;
+ length_i_ = 0;
+ }
+}
+
+/* this is all quite hairy:
+ update of length_i_
+ update of maxlen
+ alloc of buffer
+ copying of buffer
+ needs blondification:
+ split tasks
+ define change authority
+*/
+INLINE void
+String_data::remax(int j)
+{
+ OKW();
+ if (j > maxlen) {
+ Byte *p = new Byte[j + 1];
+ memcpy( p, data_byte_p_, ( maxlen <? length_i_ ) + 1 );
+ maxlen = j;
+ delete[] data_byte_p_;
+ data_byte_p_ = p;
+ }
+}
+
+INLINE void
+String_data::tighten()
+{ // should be dec'd const
+ maxlen = length_i_;
+ Byte *p = new Byte[maxlen + 1];
+ memcpy( p, data_byte_p_, length_i_ + 1 );
+ delete[] data_byte_p_;
+ data_byte_p_ = p;
+}
+// assignment.
+INLINE void
+String_data::set( Byte const* byte_c_l, int length_i )
+{
+ OKW();
+
+ assert( byte_c_l && byte_c_l != data_byte_p_);
+
+ length_i_ = length_i;
+ remax( length_i_ ); // copies too
+ memcpy( data_byte_p_, byte_c_l, length_i_ );
+ data_byte_p_[ length_i_ ] = 0;
+}
+
+INLINE
+void
+String_data::set( char const* ch_c_l )
+{
+ set( (Byte const*)ch_c_l, strlen( ch_c_l ) );
+}
+
+
+/// concatenation.
+INLINE void
+String_data::append( Byte const* byte_c_l, int length_i )
+{
+ OK();
+ OKW();
+ int old_i = length_i_;
+
+ length_i_ += length_i;
+ remax( length_i_ );
+ memcpy( data_byte_p_ + old_i, byte_c_l, length_i );
+ data_byte_p_[ length_i_ ] = 0;
+}
+
+INLINE
+void
+String_data::operator += ( char const* ch_c_l )
+{
+ append( (Byte const*)ch_c_l, strlen( ch_c_l ) );
+}
+
+
+
+INLINE
+char const*
+String_data::ch_c_l() const
+{
+ return (char const*)data_byte_p_;
+}
+INLINE char*
+String_data::ch_l()
+{
+ return (char*)data_byte_p_;
+}
+
+INLINE Byte const*
+String_data::byte_c_l() const
+{
+ return data_byte_p_;
+}
+
+INLINE Byte*
+String_data::byte_l()
+{
+ OKW();
+ return data_byte_p_;
+}
+
+INLINE
+void
+String_data::trunc(int j)
+{
+ OKW();
+ assert(j >= 0 && j <= length_i_);
+ data_byte_p_[j] = 0;
+ length_i_ = j;
+}
+
+INLINE bool
+String_data::null_terminated_b()const
+{
+ return !memchr(data_byte_p_, length_i_, 0);
+}
+
+INLINE Byte&
+String_data::operator [](int j)
+{
+ assert(j >= 0 && j <= length_i_);
+ return data_byte_p_[j] ;
+}
+
+INLINE Byte
+String_data::operator [](int j) const
+{
+ assert(j >= 0 && j <= length_i_);
+ return data_byte_p_[j];
+}
+
+
+
+
+#endif // __STRING_UTIL_CC //
--- /dev/null
+/*
+ string-handle.hh -- declare String_handle
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef STRINGHANDLE_HH
+#define STRINGHANDLE_HH
+#include "fproto.hh"
+
+
+/**
+ Reference counting for strings.
+
+ handles ref. counting, and provides a very thin interface using
+ Byte *
+
+ */
+class String_handle {
+ String_data* data;
+
+ /// decrease ref count. Named kind of like a Tanenbaum semafore
+ void down();
+
+ /// increase ref count
+ void up(String_data *d);
+
+ /** make sure data has only one reference.
+ POST: data->references == 1
+ */
+ void copy();
+
+public:
+ String_handle();
+ ~String_handle();
+ String_handle(String_handle const & src);
+
+ Byte const* byte_c_l() const;
+ char const* ch_c_l() const;
+ Byte* byte_l();
+ char* ch_l();
+ bool null_terminated_b()const;
+ void operator =(String_handle const &src);
+ void operator += (char const *s);
+ Byte operator[](int j) const;
+
+ /** Access elements. WARNING: NOT SAFE
+ don't use this for loops. Use byte_c_l()
+ */
+ Byte &operator[](int j);
+ void append( Byte const* byte_c_l, int length_i );
+ void set( Byte const* byte_c_l, int length_i );
+ void operator = (char const *p);
+ void trunc(int j);
+ int length_i() const;
+};
+
+#ifdef STRING_UTILS_INLINED
+#ifndef INLINE
+#define INLINE inline
+#endif
+#include "string-handle.inl"
+/* we should be resetting INLINE. oh well. */
+#endif
+
+
+#endif // STRINGHANDLE_HH
--- /dev/null
+/* -*-c++-*-
+
+ stringhandle.inl -- implement String_handle
+
+ source file of Flower lib
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#ifndef STRINGHANDLE_INL
+#define STRINGHANDLE_INL
+
+#include <assert.h>
+#include <memory.h>
+
+#include "string-data.hh"
+#include "string-handle.hh"
+
+INLINE void
+String_handle::down()
+{
+ if (!(--data->references)) delete data; data = 0;
+}
+
+/// increase ref count
+INLINE void
+String_handle::up(String_data *d)
+{
+ data=d; data->references ++;
+}
+
+INLINE void
+String_handle::copy()
+{
+ if (data->references !=1){
+ String_data *newdata = new String_data(*data);
+ down();
+ up(newdata);
+ }
+}
+
+INLINE
+String_handle::String_handle()
+{
+ up(new String_data);
+}
+
+INLINE
+String_handle::~String_handle()
+{
+ down();
+}
+
+INLINE
+String_handle::String_handle(String_handle const & src)
+{
+ up(src.data);
+}
+
+INLINE Byte*
+String_handle::byte_l()
+{
+ copy();
+ return data->byte_l();
+}
+
+INLINE char*
+String_handle::ch_l()
+{
+ copy();
+ return (char*)data->byte_l();
+}
+
+INLINE Byte
+const* String_handle::byte_c_l() const
+{
+ return data->byte_c_l();
+}
+
+INLINE char const*
+String_handle::ch_c_l() const
+{
+ return (char const*)data->byte_c_l();
+}
+
+INLINE void
+String_handle::operator =(String_handle const &src)
+{
+ if (this == &src)
+ return;
+ down();
+ up(src.data);
+}
+
+INLINE void
+String_handle::operator += (char const *s)
+{
+ copy();
+ *data += s;
+}
+
+
+INLINE Byte
+String_handle::operator[](int j) const
+{
+ return (*data)[j];
+}
+
+// !NOT SAFE!
+// don't use this for loops. Use byte_c_l()
+INLINE Byte &
+String_handle::operator[](int j)
+{
+ copy(); // hmm. Not efficient
+ return data->byte_l()[j];
+}
+
+INLINE void
+String_handle::append( Byte const* byte_c_l, int length_i )
+{
+ copy();
+ data->append( byte_c_l, length_i );
+}
+
+INLINE void
+String_handle::set( Byte const* byte_c_l, int length_i )
+{
+ copy();
+ data->set( byte_c_l, length_i );
+}
+
+INLINE void
+String_handle::operator = (char const *p)
+{
+ copy();
+ data->set( p );
+}
+
+INLINE void
+String_handle::trunc(int j)
+{
+ copy(); data->trunc(j);
+}
+
+INLINE int
+String_handle::length_i() const
+{
+ return data->length_i_;
+}
+
+INLINE bool
+String_handle::null_terminated_b() const {
+ return data->null_terminated_b();
+}
+
+#endif
--- /dev/null
+#include "text-db.hh"
+bool
+Text_db::eof()
+{
+ Data_file::gobble_leading_white();
+ return Data_file::eof();
+}
+
+void
+Text_db::gobble_leading_white()
+{
+ while (1) {
+ Data_file::gobble_leading_white();
+ if (eof())
+ return ;
+ char c;
+ if ((c = data_get()) !='\n'){
+ data_unget (c);
+ return ;
+ }
+ }
+}
+
+
+Text_record
+Text_db::get_record()
+{
+ while (1) {
+ String s;
+ Array<String> fields;
+ assert(!eof());
+
+ while ((s = get_word()) != "")
+ {
+ fields.push(s);
+ gobble_white();
+ }
+
+
+ if (get_line() != "")
+ assert(false);
+
+ assert (fields.size());
+ return Text_record(fields, get_name(), line());
+ }
+}
+
+
--- /dev/null
+#ifndef TEXTDB_HH
+#define TEXTDB_HH
+
+#include "data-file.hh"
+
+/**a "const" Array. Contents can't be changed. do "#" comments, read quote enclosed fields */
+
+class Text_record : Array<String>
+{
+ int line_no;
+ String filename;
+
+public:
+ Text_record() { } // needed because of other ctor
+
+ /// report an error in this line.
+ message(String s) {
+ cerr << '\n'<< filename << ": "<< line_no << s << "\n";
+ }
+ String operator[](int j) {
+ return Array<String>::operator[](j);
+ }
+
+ Text_record(Array<String> s, String fn, int j) : Array<String>(s) {
+ filename = fn; line_no = j;
+ }
+ Array<String>::size;
+};
+
+/** abstraction for a datafile.
+ add a subrec/fieldsep/record separator
+ */
+
+class Text_db : private Data_file
+{
+ void gobble_leading_white();
+public:
+ /// get a line with records
+ Text_record get_record();
+
+ Text_db(String fn):Data_file(fn) { }
+ Data_file::error;
+ bool eof();
+
+ /// get next line.
+ Text_record operator++(int) {
+ return get_record();
+ }
+ /// are we done yet?
+ operator bool() {
+ return !eof();
+ }
+};
+
+#endif
--- /dev/null
+#include "text-stream.hh"
+
+Text_stream::Text_stream(String fn)
+{
+ ios::sync_with_stdio();
+ if (fn == "")
+ {
+ name = "<STDIN>";
+ f = stdin;
+ }
+
+ else
+ {
+ name = fn;
+ f = fopen(fn, "r");
+ }
+
+ if (!f) {
+ cerr <<__FUNCTION__<< ": can't open `" << fn << "'\n";
+ exit(1);
+ }
+
+ line_no = 1;
+ }
+
+void
+Text_stream::message(String s)
+{
+ cerr << "\n"<<get_name() << ": " << line()<<": "<<s<<endl;
+}
+
--- /dev/null
+
+#ifndef TEXTSTR_HH
+#define TEXTSTR_HH
+
+#include <stdio.h>
+#include <ctype.h>
+#include "string.hh"
+#include "varray.hh"
+
+/**
+ line counting input stream.
+ a stream for textfiles. linecounting. Thin interface getchar and
+ ungetchar. (ungetc is unlimited)
+
+ should protect get and unget against improper use
+*/
+
+
+class Text_stream
+{
+ int line_no;
+
+ // could just have used streams.
+ FILE *f;
+ Array<char> pushback;
+ String name;
+
+ public:
+ Text_stream(String fn);
+ String get_name() { return name; }
+ bool eof() {
+ return feof(f);
+ }
+ bool eol() {
+ return (peek() == '\n');
+ }
+ char peek() {
+ char c = get();
+ unget(c);
+ return c;
+ }
+ int line(){
+ return line_no;
+ }
+
+ char get() {
+ char c;
+
+ if (pushback.empty())
+ c = getc(f);
+ else
+ c = pushback.pop();
+
+ if (c =='\n')
+ line_no++;
+ return c;
+ }
+ void unget(char c) {
+ if (c =='\n')
+ line_no--;
+ pushback.push(c);
+ }
+ ~Text_stream (){
+ if (!eof())
+ cerr <<__FUNCTION__<< ": closing unended file";
+
+ fclose(f);
+ }
+
+ /// GNU format message.
+ void message(String s);
+};
+
+#endif
*/\n";
my $startdef= $fn;
-$startdef =~ s/\./_/;
+$startdef =~ s/[\.-]/_/g;
$startdef =~ tr/a-z/A-Z/;
my $terminatestr="\n";
if ($hh_q) {
TAGS: $(hdr)
- etags -CT $(hdr)
+ $(TAGSACTION) $^
clean:
rm -f parser.hh
--- /dev/null
+/*
+ bar-reg.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_requests();
+ virtual void pre_move_processing();
+ virtual void post_move_processing();
+ Bar_register();
+ NAME_MEMBERS(Bar_register);
+};
+
+#endif // BARREG_HH
String type;
Bar(String type);
- const char * name() const;
+NAME_MEMBERS(Bar);
void do_print() const;
Molecule*brew_molecule_p()const;
};
+++ /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
#ifndef BEAM_HH
#define BEAM_HH
#include "proto.hh"
-#include "directionalspanner.hh"
+#include "directional-spanner.hh"
#include "plist.hh"
/** a beam connects multiple stems Beam adjusts the stems its owns to
/* *************** */
- const char * name() const;
+NAME_MEMBERS(Beam);
virtual Interval width()const;
Offset center() const;
--- /dev/null
+/*
+ class-name.hh -- declare
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef CLASS_NAME_HH
+#define CLASS_NAME_HH
+
+/// a macro to declare the classes name as a static and virtual function.
+#define NAME_MEMBERS(c) \
+static const char *static_name(){ return #c; }\
+virtual const char *name() const{ return c::static_name(); } \
+int a_stupid_nonexistent_function_to_allow_the_semicolon_come_out()
+
+#endif // CLASS-NAME_HH
--- /dev/null
+
+/*
+ clef-item.hh -- declare Clef_item
+
+ (c) 1996,97 Han-Wen Nienhuys
+*/
+
+#ifndef CLEFITEM_HH
+#define CLEFITEM_HH
+#include "item.hh"
+
+
+struct Clef_item : Item {
+ String type;
+ int y_off;
+
+ /// is this a change clef (smaller size)?
+ bool change;
+
+
+ /* *************** */
+NAME_MEMBERS(Clef_item);
+ Clef_item();
+ void read(Clef_register const&);
+ void read(String);
+ Molecule* brew_molecule_p()const;
+};
+
+#endif // CLEFITEM_HH
+
+
--- /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_;
+ Clef_change_req * clef_req_l_;
+
+public:
+ int c0_position_i_;
+ String clef_type_str_;
+
+ /* ************** */
+ virtual void process_requests();
+ virtual void pre_move_processing();
+ virtual void post_move_processing();
+ virtual bool try_request(Request*);
+ Clef_register();
+ NAME_MEMBERS(Clef_register);
+ void read_req(Clef_change_req*);
+ bool set_type(String);
+};
+#endif // CLEF_HH
+
+++ /dev/null
-
-/*
- clefitem.hh -- declare Clef_item
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef CLEFITEM_HH
-#define CLEFITEM_HH
-#include "item.hh"
-
-
-struct Clef_item : Item {
- String type;
- int y_off;
-
- /// is this a change clef (smaller size)?
- bool change;
-
-
- /* *************** */
- const char * name() const;
- Clef_item();
- void read(Clef_register const&);
- void read(String);
- Molecule* brew_molecule_p()const;
-};
-
-#endif // CLEFITEM_HH
-
-
+++ /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(Request*);
- Clef_register(Complex_walker*);
- void read_req(Clef_change_req*);
- bool set_type(String);
-};
-#endif // CLEF_HH
-
--- /dev/null
+/*
+ complex-staff.hh -- declare Complex_staff
+
+ (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#ifndef COMPLEXSTAF_HH
+#define COMPLEXSTAF_HH
+
+
+#include "key.hh"
+#include "staff.hh"
+#include "staff-walker.hh"
+
+///
+struct Complex_staff : Staff {
+
+ /* *************** */
+
+ virtual void set_output(PScore *);
+ virtual Staff_walker *get_walker_p();
+};
+
+#endif // COMPLEXSTAF_HH
+
--- /dev/null
+/*
+ complex-walker.hh -- declare Complex_walker
+
+ (c) 1996,97 Han-Wen Nienhuys
+*/
+
+#ifndef COMPLEXWALKER_HH
+#define COMPLEXWALKER_HH
+
+#include "proto.hh"
+#include "staff-walker.hh"
+#include "staff-elem-info.hh"
+
+/**
+ A staff walker which uses registers to decide what to print
+ */
+class Complex_walker: public Staff_walker {
+ bool try_command_request(Command_req *req_l);
+ void do_announces();
+ void try_request(Request*req);
+
+
+
+public:
+ int c0_position_i_;
+ Walker_registers *walk_regs_p_;
+
+ /* *************** */
+
+ void regs_process_requests();
+ void typeset_element(Staff_elem *elem_p);
+ void announce_element(Staff_elem_info);
+ virtual void process_requests();
+ virtual void do_post_move();
+ virtual void do_pre_move();
+
+ Complex_walker(Complex_staff*);
+ ~Complex_walker();
+
+ Complex_staff *staff();
+private:
+};
+
+
+#endif // COMPLEXWALKER_HH
+
+
+++ /dev/null
-/*
- complexstaff.hh -- declare Complex_staff
-
- (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#ifndef COMPLEXSTAF_HH
-#define COMPLEXSTAF_HH
-
-
-#include "key.hh"
-#include "staff.hh"
-#include "staffwalker.hh"
-
-///
-struct Complex_staff : Staff {
-
- /* *************** */
-
- virtual void set_output(PScore *);
- virtual Staff_walker *get_walker_p();
-};
-
-#endif // COMPLEXSTAF_HH
-
+++ /dev/null
-/*
- complexwalker.hh -- declare Complex_walker
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef COMPLEXWALKER_HH
-#define COMPLEXWALKER_HH
-
-#include "proto.hh"
-#include "assoc.hh"
-#include "staffwalker.hh"
-#include "staffeleminfo.hh"
-#include "plist.hh"
-
-/**
- A staff walker which uses registers to decide what to print
- */
-class Complex_walker: public Staff_walker {
- bool try_command_request(Command_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_;
-
- Array<Staff_elem_info> announce_info_arr_;
- Walker_registers *walk_regs_p_;
-
- /* *************** */
-
- Voice_registers *find_voice_reg(Voice*v_l)const;
- Voice_registers *get_voice_reg(Voice*v_l);
-
- /** 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 for voice_group named #id#
-
- @return
- pointer if found, 0 if not found.
- */
- Voice_group_registers *find_voice_group(const char* id)const;
-
- /**
- 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 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_staff *staff();
-private:
-};
-
-
-#endif // COMPLEXWALKER_HH
-
-
--- /dev/null
+/*
+ directional-spanner.hh -- part of LilyPond
+
+ (c) 1996,97 Han-Wen Nienhuys
+*/
+
+#ifndef DIRECTIONALSPANNER_HH
+#define DIRECTIONALSPANNER_HH
+
+#include "spanner.hh"
+
+/// a spanner which can be pointing "up" or "down"
+struct Directional_spanner : Spanner{
+
+ /// -1 below heads, +1 above heads.
+ int dir_i_;
+
+ /// offset of "center" relative to left-column/0-pos of staff
+ virtual Offset center() const=0;
+ virtual void set_default_dir()=0;
+ Directional_spanner();
+
+};
+
+#endif // DIRECTIONALSPANNER_HH
+
+++ /dev/null
-/*
- directionalspanner.hh -- part of LilyPond
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef DIRECTIONALSPANNER_HH
-#define DIRECTIONALSPANNER_HH
-
-#include "spanner.hh"
-
-/// a spanner which can be pointing "up" or "down"
-struct Directional_spanner : Spanner{
-
- /// -1 below heads, +1 above heads.
- int dir_i_;
-
- /// offset of "center" relative to left-column/0-pos of staff
- virtual Offset center() const=0;
- virtual void set_default_dir()=0;
- Directional_spanner();
-
-};
-
-#endif // DIRECTIONALSPANNER_HH
-
Array<int> generate_beams(Array<int>, int&);
- /// multiply self to span #i#
- void extend(MInterval i);
+ /** multiply self to span #i#.
+ In implementation, this isn't really const, but conceptually it is.
+ */
+ void extend(MInterval i) const;
void translate(Moment);
private:
void init();
struct Notehead_register : Request_register {
Item* note_p_;
+ Rhythmic_req * note_req_l_;
int dir_i_;
+
/* *************** */
- Notehead_register(Complex_walker*);
+ Notehead_register();
virtual bool try_request(Request *req_l) ;
- virtual void process_request();
- virtual void do_pre_move_process();
- void set_dir(int);
+ virtual void process_requests();
+ virtual void pre_move_processing();
+ virtual void post_move_processing();
+ void set_feature(Features);
+ NAME_MEMBERS(Notehead_register);
};
#define IDENTIFIER_HH
#include "identparent.hh"
#include "symtable.hh"
-#include "inputstaff.hh"
-#include "inputmusic.hh"
+#include "input-staff.hh"
+#include "input-music.hh"
#include "notename.hh"
#include "lookup.hh"
-#include "scriptdef.hh"
+#include "script-def.hh"
#define make_id_class(Idclass, Class, accessor) \
struct Idclass : Identifier {\
return (Class*) data;\
}\
~Idclass() { delete accessor(false); }\
+ virtual void do_print()const; \
}\
make_id_class(Real_id, Real, real);
Identifier(String n) : name(n) { }
virtual ~Identifier() {}
+
+ void print()const;
virtual const char*classname() { return "new Identifier"; }
void error(String);
IDACCESSOR(Input_staff, staff)
IDACCESSOR(Lookup,lookup)
IDACCESSOR(Real,real)
IDACCESSOR(Notename_tab, notename_tab)
+protected:
+ virtual void do_print()const=0;
private:
Identifier(Identifier const&){}
+
};
#endif // IDENTPARENT_HH
--- /dev/null
+/*
+ input-file.hh -- declare Input_file
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#ifndef INPUT_FILE_HH
+#define INPUT_FILE_HH
+#include <FlexLexer.h>
+#include "proto.hh"
+#include "fproto.hh"
+#include "varray.hh"
+#include "string.hh"
+
+struct Input_file {
+ istream* is;
+ char const* defined_ch_c_l_;
+ Source_file* sourcefile_l_;
+ int line;
+ String name;
+
+ Input_file(String);
+ ~Input_file();
+};
+
+#endif // INPUT_FILE_HH
--- /dev/null
+/*
+ input-music.hh -- part of LilyPond
+
+ (c) 1996,97 Han-Wen Nienhuys
+*/
+
+#ifndef INPUTMUSIC_HH
+#define INPUTMUSIC_HH
+
+#include "plist.hh"
+#include "proto.hh"
+#include "voice.hh"
+#include "moment.hh"
+
+struct Voice_list : public PointerList<Voice*> {
+ void translate_time(Moment dt);
+};
+
+/**
+
+ 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:
+
+ - it is rhythmic (it has a length, and can be translated horizontally)
+ - a pitch (it can be transposed)
+
+ */
+struct Input_music {
+ virtual Voice_list convert()const=0;
+ void check_plet(Voice_element* velt_l);
+ virtual Moment length()const=0;
+ virtual void translate_time(Moment dt)=0;
+ virtual ~Input_music(){}
+ virtual void print() const =0;
+ virtual void set_default_group(String)=0;
+ virtual bool find_plet_start_bo(char c, Moment& moment_r) = 0;
+ virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i) = 0;
+ // virtual void transpose(...) const =0;
+
+
+ virtual Input_music *clone() const = 0;
+ virtual Simple_music *simple() { return 0; }
+};
+
+/// Simple music consists of one voice
+struct Simple_music : Input_music {
+ Voice voice_;
+
+ /* *** */
+ virtual Simple_music*simple() { return this; }
+ void add(Voice_element*);
+ virtual void set_default_group(String g) { voice_.set_default_group(g); }
+ virtual Moment length()const;
+ virtual Voice_list convert()const;
+ virtual void translate_time(Moment dt);
+ virtual void print() const;
+ virtual bool find_plet_start_bo(char c, Moment& moment_r);
+ virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i);
+ virtual Input_music *clone() const {
+ return new Simple_music(*this);
+ }
+
+};
+
+/// Complex_music consists of multiple voices
+struct Complex_music : Input_music {
+ IPointerList<Input_music*> elts;
+ /* *************** */
+ virtual void set_default_group(String g);
+ void add(Input_music*);
+ Complex_music();
+ Complex_music(Complex_music const &);
+ virtual void print() const ;
+ void concatenate(Complex_music*);
+ virtual bool find_plet_start_bo(char c, Moment& moment_r);
+ virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i);
+
+};
+
+
+/**
+ A voice like list of music.
+
+ different music forms which start after each other ( concatenated,
+ stacked "horizontally )
+
+ */
+
+struct Music_voice : Complex_music {
+
+
+ /* *************** */
+ Moment length()const;
+ virtual void translate_time(Moment dt);
+ virtual Voice_list convert()const;
+ void add_elt(Voice_element*);
+ virtual Input_music *clone() const {
+ return new Music_voice(*this);
+ }
+ virtual void print() const ;
+};
+
+/**
+ Multiple musicstuff stacked on top of each other
+ chord like :
+
+ - different music forms which start at the same time ( stacked "vertically" )
+
+ */
+struct Music_general_chord : Complex_music {
+
+
+ /* *************** */
+
+ virtual Moment length()const;
+ virtual Voice_list convert()const;
+ virtual void translate_time(Moment dt);
+ void add_elt(Voice_element*);
+ virtual Input_music *clone() const {
+ return new Music_general_chord(*this);
+ }
+
+ virtual void print() const ;
+};
+
+struct Multi_voice_chord : Music_general_chord {
+ void set_default_group(String);
+ virtual Input_music *clone() const {
+ return new Multi_voice_chord(*this);
+ }
+};
+struct Voice_group_chord : Music_general_chord {
+
+ virtual Input_music *clone() const {
+ return new Voice_group_chord(*this);
+ }
+};
+#endif // INPUTMUSIC_HH
--- /dev/null
+/*
+ input-score.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"
+#include "string.hh"
+
+
+/// the total music def of one movement
+struct Input_score {
+ /// defined where?
+ const char* defined_ch_c_l_;
+ int errorlevel_i_;
+
+ /// paper_, staffs_ and commands_ form the problem definition.
+ Paper_def *paper_p_;
+ Midi_def* midi_p_;
+ IPointerList<Input_staff*> staffs_;
+
+ Input_music * score_wide_music_p_;
+
+ /* *************************************************************** */
+ Input_score();
+ Input_score(Input_score const&);
+
+ void add(Input_staff*);
+ ~Input_score();
+ /// construction
+ void set(Paper_def*);
+ void set(Midi_def* midi_p);
+ void print() const;
+ Score*parse();
+ void set(Input_music*);
+};
+
+#endif
--- /dev/null
+/*
+ input-staff.hh -- declare Input_staff
+
+ (c) 1996,97 Han-Wen Nienhuys
+*/
+
+#ifndef INPUTSTAFF_HH
+#define INPUTSTAFF_HH
+
+#include "string.hh"
+#include "plist.hh"
+#include "varray.hh"
+#include "proto.hh"
+
+struct Input_staff {
+
+ const char * defined_ch_c_l_;
+ String type;
+
+ 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 set_score_wide(Input_music*m);
+ Staff* parse(Score*, Input_music *score_wide);
+ void print() const;
+};
+
+
+#endif // INPUTSTAFF_HH
+
+++ /dev/null
-/*
- inputfile.hh -- declare Input_file
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#ifndef INPUT_FILE_HH
-#define INPUT_FILE_HH
-#include <FlexLexer.h>
-#include "proto.hh"
-#include "fproto.hh"
-#include "varray.hh"
-#include "string.hh"
-
-struct Input_file {
- istream* is;
- char const* defined_ch_c_l_;
- Source_file* sourcefile_l_;
- int line;
- String name;
-
- Input_file(String);
- ~Input_file();
-};
-
-#endif // INPUT_FILE_HH
+++ /dev/null
-/*
- inputmusic.hh -- part of LilyPond
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef INPUTMUSIC_HH
-#define INPUTMUSIC_HH
-
-#include "plist.hh"
-#include "proto.hh"
-#include "voice.hh"
-#include "moment.hh"
-
-struct Voice_list : public PointerList<Voice*> {
- void translate_time(Moment dt);
-};
-
-/**
-
- 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:
-
- - it is rhythmic (it has a length, and can be translated horizontally)
- - a pitch (it can be transposed)
-
- */
-struct Input_music {
- virtual Voice_list convert()const=0;
- void check_plet(Voice_element* velt_l);
- virtual Moment length()const=0;
- virtual void translate_time(Moment dt)=0;
- virtual ~Input_music(){}
- virtual void print() const =0;
- virtual void set_default_group(String)=0;
- virtual bool find_plet_start_bo(char c, Moment& moment_r) = 0;
- virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i) = 0;
- // virtual void transpose(...) const =0;
-
-
- virtual Input_music *clone() const = 0;
- virtual Simple_music *simple() { return 0; }
-};
-
-/// Simple music consists of one voice
-struct Simple_music : Input_music {
- Voice voice_;
-
- /* *** */
- virtual Simple_music*simple() { return this; }
- void add(Voice_element*);
- virtual void set_default_group(String g) { voice_.set_default_group(g); }
- virtual Moment length()const;
- virtual Voice_list convert()const;
- virtual void translate_time(Moment dt);
- virtual void print() const;
- virtual bool find_plet_start_bo(char c, Moment& moment_r);
- virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i);
- virtual Input_music *clone() const {
- return new Simple_music(*this);
- }
-
-};
-
-/// Complex_music consists of multiple voices
-struct Complex_music : Input_music {
- IPointerList<Input_music*> elts;
- /* *************** */
- virtual void set_default_group(String g);
- void add(Input_music*);
- Complex_music();
- Complex_music(Complex_music const &);
- virtual void print() const ;
- void concatenate(Complex_music*);
- virtual bool find_plet_start_bo(char c, Moment& moment_r);
- virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i);
-
-};
-
-
-/**
- A voice like list of music.
-
- different music forms which start after each other ( concatenated,
- stacked "horizontally )
-
- */
-
-struct Music_voice : Complex_music {
-
-
- /* *************** */
- Moment length()const;
- virtual void translate_time(Moment dt);
- virtual Voice_list convert()const;
- void add_elt(Voice_element*);
- virtual Input_music *clone() const {
- return new Music_voice(*this);
- }
- virtual void print() const ;
-};
-
-/**
- Multiple musicstuff stacked on top of each other
- chord like :
-
- - different music forms which start at the same time ( stacked "vertically" )
-
- */
-struct Music_general_chord : Complex_music {
-
-
- /* *************** */
-
- virtual Moment length()const;
- virtual Voice_list convert()const;
- virtual void translate_time(Moment dt);
- void add_elt(Voice_element*);
- virtual Input_music *clone() const {
- return new Music_general_chord(*this);
- }
-
- virtual void print() const ;
-};
-
-struct Multi_voice_chord : Music_general_chord {
- void set_default_group(String);
- virtual Input_music *clone() const {
- return new Multi_voice_chord(*this);
- }
-};
-struct Voice_group_chord : Music_general_chord {
-
- virtual Input_music *clone() const {
- return new Voice_group_chord(*this);
- }
-};
-#endif // INPUTMUSIC_HH
+++ /dev/null
-/*
- 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"
-#include "string.hh"
-
-
-/// the total music def of one movement
-struct Input_score {
- /// defined where?
- const char* defined_ch_c_l_;
- int errorlevel_i_;
-
- /// paper_, staffs_ and commands_ form the problem definition.
- Paperdef *paper_p_;
- Midi_def* midi_p_;
- IPointerList<Input_staff*> staffs_;
-
- Input_music * score_wide_music_p_;
-
- /* *************************************************************** */
- Input_score();
- Input_score(Input_score const&);
-
- void add(Input_staff*);
- ~Input_score();
- /// construction
- void set(Paperdef*);
- void set(Midi_def* midi_p);
- void print() const;
- Score*parse();
- void set(Input_music*);
-};
-
-#endif
+++ /dev/null
-/*
- inputstaff.hh -- declare Input_staff
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef INPUTSTAFF_HH
-#define INPUTSTAFF_HH
-
-#include "string.hh"
-#include "plist.hh"
-#include "varray.hh"
-#include "proto.hh"
-
-struct Input_staff {
-
- const char * defined_ch_c_l_;
- String type;
-
- 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 set_score_wide(Input_music*m);
- Staff* parse(Score*, Input_music *score_wide);
- void print() const;
-};
-
-
-#endif // INPUTSTAFF_HH
-
#include "glob.hh"
#include "boxes.hh"
#include "string.hh"
-#include "staffelem.hh"
+#include "staff-elem.hh"
/**
a horizontally fixed size element of the score
virtual Item *item() { return this; }
Item();
void do_print()const;
- const char*name()const;
+
+ NAME_MEMBERS(Item);
};
--- /dev/null
+/*
+ key-item.hh -- part of LilyPond
+
+ (c) 1996,97 Han-Wen Nienhuys
+*/
+
+#ifndef KEYITEM_HH
+#define KEYITEM_HH
+
+#include "item.hh"
+#include "varray.hh"
+
+
+/// An item which places accidentals at the start of the line
+struct Key_item : Item {
+ Array<int> pitch;
+ Array<int> acc;
+ int c_position;
+
+
+ /* *************** */
+NAME_MEMBERS(Key_item);
+ Key_item(int cposition);
+ void add(int pitch, int acc);
+ void read(const Key_register&);
+ void set_c_position(int);
+ void preprocess();
+ Molecule* brew_molecule_p()const;
+};
+
+#endif // KEYITEM_HH
--- /dev/null
+/*
+ key-reg.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_requests();
+ virtual void pre_move_processing();
+ virtual void post_move_processing();
+ virtual void acknowledge_element(Staff_elem_info);
+ Key_register();
+ NAME_MEMBERS(Key_register);
+private:
+
+ void read_req(Key_change_req * r);
+};
+
+#endif // KEYREG_HH
+++ /dev/null
-/*
- keyitem.hh -- part of LilyPond
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef KEYITEM_HH
-#define KEYITEM_HH
-
-#include "item.hh"
-#include "varray.hh"
-
-
-/// An item which places accidentals at the start of the line
-struct Key_item : Item {
- Array<int> pitch;
- Array<int> acc;
- int c_position;
-
-
- /* *************** */
- const char * name() const;
- Key_item(int cposition);
- void add(int pitch, int acc);
- void read(const Key_register&);
- void set_c_position(int);
- void preprocess();
- Molecule* brew_molecule_p()const;
-};
-
-#endif // KEYITEM_HH
+++ /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();
- virtual void acknowledge_element(Staff_elem_info);
- Key_register(Complex_walker*);
-private:
-
- void read_req(Key_change_req * r);
-};
-
-#endif // KEYREG_HH
void new_input(String s);
bool close_input();
int yylex();
+ void print_declarations() const;
};
extern My_flex_lexer *lexer;
--- /dev/null
+/*
+ local-key-item.hh -- part of LilyPond
+
+ (c) 1996,97 Han-Wen Nienhuys
+*/
+
+#ifndef LOCALKEYITEM_HH
+#define LOCALKEYITEM_HH
+#include "item.hh"
+#include "varray.hh"
+
+struct Local_acc {
+ int name , acc, octave;
+ static int compare(Local_acc&, Local_acc&);
+};
+
+struct Local_key_item : Item {
+NAME_MEMBERS(Local_key_item);
+ Array<Local_acc> accs;
+ Array<Item*> support_items_;
+ int c0_position;
+
+ /* *************** */
+
+ Local_key_item(int c0position);
+ void add(Item*);
+ void add(int oct, int pitch, int acc);
+ void add(Melodic_req*);
+ void do_pre_processing();
+ Molecule* brew_molecule_p()const;
+};
+#endif // LOCALKEYITEM_HH
+
--- /dev/null
+/*
+ local-key-reg.hh -- declare Local_key_register
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#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_;
+ const Key *key_c_l_;
+ /* *************** */
+ virtual void process_requests();
+ virtual void acknowledge_element(Staff_elem_info);
+ virtual void pre_move_processing();
+ Local_key_register();
+ NAME_MEMBERS(Local_key_register);
+};
+
+#endif // LOCALKEYREG_HH
+++ /dev/null
-/*
- localkeyitem.hh -- part of LilyPond
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef LOCALKEYITEM_HH
-#define LOCALKEYITEM_HH
-#include "item.hh"
-#include "varray.hh"
-
-struct Local_acc {
- int name , acc, octave;
- static int compare(Local_acc&, Local_acc&);
-};
-
-struct Local_key_item : Item {
- const char * name() const;
- Array<Local_acc> accs;
- Array<Item*> support_items_;
- int c0_position;
-
- /* *************** */
-
- Local_key_item(int c0position);
- void add(Item*);
- void add(int oct, int pitch, int acc);
- void add(Melodic_req*);
- void do_pre_processing();
- Molecule* brew_molecule_p()const;
-};
-#endif // LOCALKEYITEM_HH
-
+++ /dev/null
-/*
- localkeyreg.hh -- declare Local_key_register
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#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_;
- const Key *key_c_l_;
- /* *************** */
- virtual void process_request();
- virtual void acknowledge_element(Staff_elem_info);
- virtual void do_pre_move_process();
- Local_key_register(Complex_walker*);
-};
-
-#endif // LOCALKEYREG_HH
String texsetting;
/* *************** */
void add(String, Symtable*);
-
+ void print()const;
Real internote();
Symbol linestaff(int n, Real w);
#include "proto.hh"
#include "grouping.hh"
-#include "staffwalker.hh"
+#include "staff-walker.hh"
/// a simple walker which collects words, and then print them, first on top
struct Lyric_walker: Staff_walker {
--- /dev/null
+/*
+ meter-reg.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_requests();
+ virtual void pre_move_processing();
+ virtual void post_move_processing();
+ Meter_register();
+ NAME_MEMBERS(Meter_register);
+};
+#endif // METERREG_HH
struct Meter: Item {
Array<Scalar> args;
/* *************** */
- const char * name() const;
+NAME_MEMBERS(Meter);
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
--- /dev/null
+/*
+ midi-output.hh -- declare Midi_output
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef MIDIOUTPUT_HH
+#define MIDIOUTPUT_HH
+#include "pscore.hh"
+
+struct Midi_output {
+ Midi_stream* midi_stream_l_;
+ Midi_output(Score* score_l, Midi_def* );
+ void do_staff(Staff*st_l, int count);
+
+ Midi_def* midi_l_;
+};
+#endif // MIDIOUTPUT_HH
+++ /dev/null
-/*
- midioutput.hh -- declare Midi_output
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef MIDIOUTPUT_HH
-#define MIDIOUTPUT_HH
-#include "pscore.hh"
-
-struct Midi_output {
- Midi_stream* midi_stream_l_;
- Midi_output(Score* score_l, Midi_def* );
- void do_staff(Staff*st_l, int count);
-
- Midi_def* midi_l_;
-};
-#endif // MIDIOUTPUT_HH
*/
struct Notehead : Item {
- const char * name() const;
+ NAME_MEMBERS(Notehead);
int position;
/// -1 = lowest, 0 = inside, 1 = top
*/
Notehead(int staff_size);
void do_print()const;
- static int compare(Notehead*&a, Notehead*&b) ;
+ static int compare(Notehead * const &a, Notehead *const &b) ;
Molecule* brew_molecule_p()const;
};
#endif // NOTEHEAD_HH
--- /dev/null
+/*
+ paper-def.hh -- declare
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef Paper_def_HH
+#define Paper_def_HH
+#include "proto.hh"
+#include "real.hh"
+#include "string.hh"
+#include "moment.hh"
+
+
+/** symbols, dimensions and constants
+
+ This struct takes care of all kinds of symbols, dimensions and
+ constants. Most of them are related to the point-size of the fonts,
+ so therefore, the lookup table for symbols is also in here.
+
+ see TODO
+ */
+struct Paper_def {
+ Lookup *lookup_p_;
+ String outfile;
+
+ Real linewidth;
+
+ /// how much space does a whole note take (ideally?)
+ Real whole_width;
+
+ /// ideal = geometric_ ^ log2(duration)
+ Real geometric_;
+
+ /* *************** */
+ void reinit();
+ Paper_def(Lookup*);
+ void set(Lookup*);
+ ~Paper_def();
+ Paper_def(Paper_def const&);
+ Real interline()const;
+ Real internote()const;
+ Real rule_thickness()const;
+ Real standard_height()const;
+ Real note_width() const;
+ void print() const;
+ Real duration_to_dist(Moment);
+};
+
+#endif // Paper_def_HH
+
+++ /dev/null
-/*
- paperdef.hh -- declare
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef PAPERDEF_HH
-#define PAPERDEF_HH
-#include "proto.hh"
-#include "real.hh"
-#include "string.hh"
-#include "moment.hh"
-
-
-/** symbols, dimensions and constants
-
- This struct takes care of all kinds of symbols, dimensions and
- constants. Most of them are related to the point-size of the fonts,
- so therefore, the lookup table for symbols is also in here.
-
- see TODO
- */
-struct Paperdef {
- Lookup *lookup_p_;
- String outfile;
-
- Real linewidth;
-
- /// how much space does a whole note take (ideally?)
- Real whole_width;
-
- /// ideal = geometric_ ^ log2(duration)
- Real geometric_;
-
- /* *************** */
- void reinit();
- Paperdef(Lookup*);
- void set(Lookup*);
- ~Paperdef();
- Paperdef(Paperdef const&);
- Real interline()const;
- Real internote()const;
- Real rule_thickness()const;
- Real standard_height()const;
- Real note_width() const;
- void print() const;
- Real duration_to_dist(Moment);
-};
-
-#endif // PAPERDEF_HH
-
struct Complex_staff;
struct Complex_walker;
struct Cresc_req;
+struct Directional_spanner;
struct Decresc_req;
struct Duration;
struct Duration_iterator;
struct Plet;
struct PScore;
struct PStaff;
-struct Paperdef;
+struct Paper_def;
struct Partial_measure_req;
struct Rational;
-struct Register_group;
+struct Register_group_register;
struct Request;
struct Request_register;
struct Rest;
*/
struct PScore {
- Paperdef *paper_l_;
+ Paper_def *paper_l_;
/// the columns, ordered left to right
IPointerList<PCol *> cols;
/* *************** */
/* CONSTRUCTION */
- PScore(Paperdef*);
+ PScore(Paper_def*);
/// add a line to the broken stuff. Positions given in #config#
void set_breaking(Array<Col_hpositions>);
#include "proto.hh"
#include "varray.hh"
#include "request.hh"
-#include "staffeleminfo.hh"
-
+#include "staff-elem-info.hh"
/**
a struct which processes requests, and creates the #Staff_elem#s.
- Hungarian postfix: reg
+ It may use derived classes. Hungarian postfix: register
*/
class Request_register {
+ friend class Register_group_register;
/**
- Warning: you can't copy a #Request_register#
- */
- Request_register(Request_register const &);
-public:
- Complex_walker * walk_l_;
- Array<Request*> accepted_req_arr_;
-
- Request_register(Complex_walker*);
- Request_register();
- virtual ~Request_register(){}
-
- /**
- take note of item/spanner
- put item in spanner. Adjust local key; etc.
+ You cannot copy a Request_register
+ */
+ Request_register(const Request_register&){}
+protected:
- Default: ignore the info
- */
- virtual void acknowledge_element(Staff_elem_info){}
+ /// utility
+ virtual Paper_def * paper() const;
/**
try to fit the request in this register
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
+ Default: always return false
*/
virtual bool try_request(Request *req_l);
/// make items/spanners with the requests you got
- virtual void process_request(){}
-
- /// typeset any spanners. Empty #accepted_req_arr_#
- void pre_move_processing();
- /// reset any appropriate data.
- void post_move_processing();
- virtual bool acceptable_request_b(Request*) const;
- virtual void set_dir(int){}
-protected:
- /// utility
- Paperdef * paper() const;
-
-
- /**
- invoke walker method to typeset element
- */
- void typeset_element(Staff_elem*elem_p);
-
+ virtual void process_requests(){}
+
+ /** typeset any items/spanners. Default: do nothing
+ */
+ virtual void pre_move_processing(){}
+ /** reset any appropriate data. Default: do nothing
+ */
+ virtual void post_move_processing(){}
+
+ /**
+ Is this request eligible to be processed? Default: return false.
+ */
+ virtual bool acceptable_request_b(Request*) const;
/**
- typeset a "command" item.
+ typeset a "command" item. Default: pass on to daddy.
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 typeset_breakable_item(Item * pre_p ,
+ Item * nobreak_p, Item * post_p);
+ /**
+ Invoke walker method to typeset element. Default: pass on to daddy.
+ */
+ virtual void typeset_element(Staff_elem*elem_p);
+
+ /**
+ take note of item/spanner
+ put item in spanner. Adjust local key; etc.
+
+ Default: ignore the info
*/
- 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(){}
+ virtual void acknowledge_element(Staff_elem_info) {}
/**
- Announce element to walker. Utility
+ Announce element. Default: pass on to daddy. Utility
*/
- void announce_element(Staff_elem_info);
+ virtual void announce_element(Staff_elem_info);
+ /**
+ Set features of the register(s). Default: ignore features.
+ */
+ virtual void set_feature(Features){}
+ /**
+ Does this equal or contain a certain register?
+ */
+ virtual bool contains_b(Request_register*reg_l);
+ /**
+ Get information on the staff. Default: ask daddy.
+ */
+ virtual Staff_info get_staff_info();
+
+ virtual void do_print()const;
+public:
+ /** Every Request_register (except for the 'top' which is directly
+ inside the Staff_walker, is a element of a group. */
+ Register_group_register * daddy_reg_l_;
+
+ Request_register();
+ virtual ~Request_register(){}
+ NAME_MEMBERS(Request_register);
+ void print() const;
};
#include "plist.hh"
-#include "staffeleminfo.hh"
+#include "staff-elem-info.hh"
+#include "register.hh"
+
/**
Group a number of registers. Usually delegates everything to its contents.
+ Postfix: group
*/
-class Register_group {
-public:
+class Register_group_register : public Request_register {
+protected:
IPointerList<Request_register*> reg_list_;
+ virtual void do_print()const;
+public:
+
+ /**
+ Junk #reg_l#.
+
+ Pre:
+ #reg_l# is in #reg_list_#
+ */
+ virtual void terminate_register(Request_register * reg_l);
- void set_dir(int i);
- bool acceptable_request_b(Request*);
- void pre_move_processing();
- void post_move_processing();
- void acknowledge_element(Staff_elem_info info);
- bool try_request(Request*);
- void process_requests();
- virtual ~Register_group();
- void add(Request_register* reg_p);
- bool contains_b(Request_register*);
-// bool contains_b(Register_group*);
+ /**
+ Remove #reg_l# from the list, and return it.
+ */
+ Request_register * get_register_p(Request_register*reg_l);
+ virtual void set_feature(Features i);
+ virtual bool acceptable_request_b(Request*);
+ virtual void pre_move_processing();
+ virtual void post_move_processing();
+ virtual void acknowledge_element(Staff_elem_info info);
+ virtual bool try_request(Request*);
+ virtual void process_requests();
+ virtual ~Register_group_register();
+ virtual void add(Request_register* reg_p);
+ virtual bool contains_b(Request_register*);
};
#endif // REGISTERGROUP_HH
#include "glob.hh"
#include "string.hh"
#include "moment.hh"
+#include "class-name.hh"
/**
a voice element wants something printed.
Hungarian postfix: req
@see lilygut manpage
*/
-struct Request {
+class Request {
+public:
Voice_element*elt_l_;
char const* defined_ch_c_l_;
/* *************** */
+ Voice * voice_l();
Request();
Request(Request const&);
virtual ~Request(){}
- virtual const char * name() const { return "Request";}
+ NAME_MEMBERS(Request);
virtual Request* clone() const { return new Request(*this); }
void print()const ;
#define REQUESTMETHODS(T,accessor) \
virtual T * accessor() { return this;}\
-virtual const char* name() const { return #T; }\
+NAME_MEMBERS(T);\
virtual Request *clone() const { return new T(*this); } \
virtual void do_print() const
Rest(int dur,int dots);
void do_print()const;
- const char * name() const;
+NAME_MEMBERS(Rest);
Molecule* brew_molecule_p()const;
};
#endif
--- /dev/null
+/*
+ sccol.hh -- part of LilyPond
+
+ (c) 1996,97 Han-Wen Nienhuys
+*/
+
+#ifndef SCCOL_HH
+#define SCCOL_HH
+#include "proto.hh"
+#include "varray.hh"
+#include "moment.hh"
+
+
+/**
+
+ When typesetting hasn't started on PScore yet, the columns which
+ contain data have a rhythmical position. Score_column is the type
+ with a rhythmical time attached to it. The calculation of
+ idealspacing is done with data in these columns. (notably: the
+ #durations# field)
+
+ */
+
+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;
+
+ /* *************** */
+
+ Moment when() { return when_; }
+ Score_column(Moment when);
+ static int compare(Score_column & c1, Score_column &c2);
+ void add_duration(Moment );
+ void preprocess();
+ bool breakable_b();
+ bool musical_b() { return musical_b_; }
+ bool used_b();
+ void print() const;
+
+
+};
+
+instantiate_compare(Score_column&, Score_column::compare);
+
+#endif // SCCOL_HH
+
+
+
+
--- /dev/null
+/*
+ score-walker.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 *>
+{
+ Score* score_l_;
+ /// 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
/// the total music def of one movement
struct Score {
/// paper_, staffs_ and commands_ form the problem definition.
- Paperdef *paper_p_;
+ Paper_def *paper_p_;
Midi_def *midi_p_;
IPointerList<Staff*> staffs_;
///
void set(Midi_def* midi_p);
///
- void set(Paperdef* midi_p);
+ void set(Paper_def* midi_p);
// standard
void OK() const;
+++ /dev/null
-/*
- sccol.hh -- part of LilyPond
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef SCCOL_HH
-#define SCCOL_HH
-#include "proto.hh"
-#include "varray.hh"
-#include "moment.hh"
-
-
-/**
-
- When typesetting hasn't started on PScore yet, the columns which
- contain data have a rhythmical position. Score_column is the type
- with a rhythmical time attached to it. The calculation of
- idealspacing is done with data in these columns. (notably: the
- #durations# field)
-
- */
-
-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;
-
- /* *************** */
-
- Moment when() { return when_; }
- Score_column(Moment when);
- static int compare(Score_column & c1, Score_column &c2);
- void add_duration(Moment );
- void preprocess();
- bool breakable_b();
- bool musical_b() { return musical_b_; }
- bool used_b();
- void print() const;
-
-
-};
-
-instantiate_compare(Score_column&, Score_column::compare);
-
-#endif // SCCOL_HH
-
-
-
-
+++ /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 *>
-{
- Score* score_l_;
- /// 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
--- /dev/null
+/*
+ script-def.hh -- part of LilyPond
+
+ (c) 1996,97 Han-Wen Nienhuys
+*/
+
+#ifndef SCRIPTDEF_HH
+#define SCRIPTDEF_HH
+#include "string.hh"
+struct Script_def{
+ int stemdir;
+ int staffdir;
+
+ bool invertsym;
+ String symidx;
+
+ /* *************** */
+ int compare(Script_def const &);
+ void print() const;
+ Script_def(String, int, int ,bool);
+};
+
+
+#endif // SCRIPTDEF_HH
+
--- /dev/null
+/*
+ script-reg.hh -- part of LilyPond
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef SCRIPTREG_HH
+#define SCRIPTREG_HH
+
+#include "register.hh"
+
+
+struct Script_register : Request_register {
+ Script * script_p_;
+ Script_req * script_req_l_;
+ int dir_i_;
+ /* *************** */
+ void set_feature(Features dir_i_);
+ Script_register();
+ virtual bool try_request(Request*);
+ virtual void process_requests();
+ virtual void acknowledge_element(Staff_elem_info);
+ virtual void pre_move_processing();
+ virtual void post_move_processing();
+ NAME_MEMBERS(Script_register);
+};
+
+#endif // SCRIPTREG_HH
#ifndef SCRIPT_HH
#define SCRIPT_HH
-#include "scriptdef.hh"
+#include "script-def.hh"
#include "item.hh"
struct Script : Item {
Array<Item *> support;
/* *************** */
- const char * name() const;
- Molecule* brew_molecule_p()const;
+ NAME_MEMBERS(Script);
+ Molecule *brew_molecule_p()const;
virtual void do_post_processing();
virtual void do_pre_processing();
Script(Script_req*, int staffsize);
Interval support_height()const;
virtual Interval width() const;
private:
- void set_symdir();
- void set_default_dir();
- void set_default_index();
+ void set_symdir();
+ void set_default_dir();
+ void set_default_index();
Symbol symbol()const;
};
+++ /dev/null
-/*
- scriptdef.hh -- part of LilyPond
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef SCRIPTDEF_HH
-#define SCRIPTDEF_HH
-#include "string.hh"
-struct Script_def{
- int stemdir;
- int staffdir;
-
- bool invertsym;
- String symidx;
-
- /* *************** */
- int compare(Script_def const &);
- void print() const;
- Script_def(String, int, int ,bool);
-};
-
-
-#endif // SCRIPTDEF_HH
-
+++ /dev/null
-/*
- scriptreg.hh -- part of LilyPond
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef SCRIPTREG_HH
-#define SCRIPTREG_HH
-
-#include "register.hh"
-
-
-struct Script_register : Request_register {
- Script * script_p_;
- int dir_i_;
- /* *************** */
- void set_dir(int dir_i_);
- Script_register(Complex_walker*);
- virtual bool try_request(Request*);
- virtual void process_request();
- virtual void acknowledge_element(Staff_elem_info);
- virtual void do_pre_move_process();
-};
-
-#endif // SCRIPTREG_HH
--- /dev/null
+/*
+ slur-reg.hh -- declare Slur_register
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef SLURREG_HH
+#define SLURREG_HH
+
+#include "register.hh"
+
+struct Slur_register : Request_register {
+ Array<Slur_req*> requests_arr_;
+ Array<Slur_req*> new_slur_req_l_arr_;
+ Array<Slur *> slur_l_stack_;
+ Array<Slur*> end_slur_l_arr_;
+
+ int dir_i_;
+
+ /* *************** */
+ ~Slur_register();
+ Slur_register();
+ virtual bool try_request(Request*);
+ virtual void process_requests();
+ virtual void acknowledge_element(Staff_elem_info);
+ virtual void pre_move_processing();
+ virtual void post_move_processing();
+ virtual void set_feature(Features);
+ NAME_MEMBERS(Slur_register);
+};
+
+#endif // SLURREG_HH
#ifndef SLUR_HH
#define SLUR_HH
-#include "directionalspanner.hh"
+#include "directional-spanner.hh"
#include "fproto.hh"
#include "varray.hh"
void process();
private:
Molecule*brew_molecule_p()const;
- const char * name() const;
+ NAME_MEMBERS(Slur);
};
#endif // SLUR_HH
+++ /dev/null
-/*
- slurreg.hh -- declare Slur_register
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef SLURREG_HH
-#define SLURREG_HH
-
-#include "register.hh"
-
-struct Slur_register : Request_register {
- Array<Slur_req*> requests_arr_;
- Array<Slur *> slur_l_stack_;
- Array<Slur*> end_slur_l_arr_;
- int dir_i_;
- /* *************** */
- ~Slur_register();
- Slur_register(Complex_walker*);
- virtual bool try_request(Request*);
- virtual void process_request();
- virtual void acknowledge_element(Staff_elem_info);
- virtual void do_pre_move_process();
- virtual void set_dir(int);
-};
-
-#endif // SLURREG_HH
#define SPANNER_HH
#include "proto.hh"
-#include "staffelem.hh"
+#include "staff-elem.hh"
/** a symbol which is attached between two columns. A spanner is a symbol which spans across several columns, so its
Spanner();
virtual Interval width()const;
void do_print()const;
- const char* name()const;
+
Spanner *broken_at(PCol *c1, PCol *c2) const;
virtual Spanner* spanner() { return this; }
protected:
PRE
c1 >= start, c2 <= stop
*/
- virtual Spanner *do_break_at( PCol *c1, PCol *c2) const=0;
+ virtual Spanner *do_break_at( PCol *c1, PCol *c2) const=0;
+ NAME_MEMBERS(Spanner);
};
#endif
--- /dev/null
+/*
+ staff-column.hh -- declare Staff_column
+
+ (c) 1996,97 Han-Wen Nienhuys
+*/
+
+#ifndef STAFFCOLUMN_HH
+#define STAFFCOLUMN_HH
+#include "proto.hh"
+#include "varray.hh"
+#include "moment.hh"
+
+/// store simultaneous requests
+class Staff_column {
+
+ Staff_column(Staff_column const&);
+
+public:
+ Array<Request*> creationreq_l_arr_;
+ Array<Request*> musicalreq_l_arr_;
+ Array<Request*> commandreq_l_arr_;
+ Staff * staff_l_;
+
+ /// fields to collect timing data vertically.
+ Array<Timing_req*> timing_req_l_arr_;
+ Score_column *musical_column_l_, *command_column_l_;
+
+ /* *************** */
+
+ Staff_column();
+
+ Moment when() const;
+ void set_cols(Score_column *c1, Score_column *c2);
+ void add(Voice_element*ve);
+ void OK() const;
+ ~Staff_column();
+ void typeset_breakable_items(Array<Item *> &pre_p_arr,
+ Array<Item *> &nobreak_p_arr,
+ Array<Item *> &post_p_arr);
+ void typeset_musical_item(Item *i);
+protected:
+ void setup_one_request(Request*);
+};
+
+
+
+#endif // STAFFCOLUMN_HH
+
--- /dev/null
+/*
+ staff-elem-info.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"
+#include "varray.hh"
+/// data container.
+struct Staff_elem_info {
+ Staff_elem * elem_p_;
+ Request*req_l_;
+ const Voice * voice_l_;
+ Array<Request_register*> origin_reg_l_arr_;
+
+
+ /* *** */
+ Staff_elem_info(Staff_elem*, Request*);
+ Staff_elem_info();
+};
+
+struct Staff_info {
+ int *c0_position_i_;
+ Staff_walker *walk_l_;
+ const Time_description *time_c_l_;
+ const Rhythmic_grouping *rhythmic_c_l_;
+};
+
+
+struct Features {
+ bool initialiser_b_;
+ int direction_i_;
+
+ Features();
+ static Features dir(int);
+};
+#endif // STAFFELEMINFO_HH
--- /dev/null
+/*
+ staff-elem.hh -- part of LilyPond
+
+ (c) 1996,97 Han-Wen Nienhuys
+*/
+
+#ifndef STAFFELEM_HH
+#define STAFFELEM_HH
+#include "varray.hh"
+#include "proto.hh"
+#include "offset.hh"
+#include "molecule.hh"
+#include "class-name.hh"
+
+
+/** Both Spanner and Item are Staff_elem's. Most Staff_elem's depend
+ on other Staff_elem's, eg, Beam needs to know and set direction of
+ Stem. So the Beam has to be calculated *before* Stem. This is
+ accomplished with the dependencies field of struct Staff_elem.
+
+ */
+struct Staff_elem {
+ enum Status {
+ ORPHAN, // not yet added to pstaff
+ VIRGIN, // added to pstaff
+ PRECALCING,
+ PRECALCED, // calcs before spacing done
+ POSTCALCING,
+ POSTCALCED, // after spacing calcs done
+ OUTPUT, // molecule has been output
+ } status;
+
+ /// the pstaff it is in
+ PStaff *pstaff_l_;
+
+ /* *************** */
+ Staff_elem(Staff_elem const&);
+ String TeXstring () const ;
+ virtual void print() const;
+ virtual Interval width() const;
+ virtual Interval height() const;
+ Paper_def *paper() const;
+ virtual ~Staff_elem();
+ Staff_elem();
+ NAME_MEMBERS(Staff_elem);
+ void translate(Offset);
+ void add_processing();
+ void pre_processing();
+ void post_processing();
+ void molecule_processing();
+
+ virtual Spanner* spanner() { return 0; }
+ virtual Item * item() { return 0; }
+ void add_dependency(Staff_elem* );
+ void substitute_dependency(Staff_elem* old, Staff_elem * newdep);
+
+protected:
+
+ /// do printing of derived info.
+ virtual void do_print() const=0;
+ /// generate the molecule
+ virtual Molecule* brew_molecule_p()const=0;
+ ///executed directly after the item is added to the PScore
+ virtual void do_add_processing();
+ /// do calculations before determining horizontal spacing
+ virtual void do_pre_processing();
+
+ /// do calculations after determining horizontal spacing
+ virtual void do_post_processing();
+
+ Array<Staff_elem*> dependants;
+
+private:
+ /// member: the symbols
+ Molecule *output; // should scrap, and use temp var?
+
+
+ /**
+ This is needed, because #output# may still be
+ NULL.
+ */
+ Offset offset_;
+ Array<Staff_elem*> dependencies;
+};
+
+
+#endif // STAFFELEM_HH
+
--- /dev/null
+/*
+ staff-walker.hh -- declare Staff_walker
+
+ (c) 1996,97 Han-Wen Nienhuys
+*/
+
+#ifndef STAFFWALKER_HH
+#define STAFFWALKER_HH
+
+#include "proto.hh"
+#include "time-description.hh"
+#include "pcursor.hh"
+
+/**
+ manage run-time info when walking staffcolumns such as: key,
+ meter, pending beams & slurs
+ */
+struct Staff_walker : public PCursor<Staff_column*> {
+ Staff * staff_l_;
+ PScore * pscore_l_;
+ Score_walker *score_walk_l_;
+ Time_description time_;
+ Rhythmic_grouping *default_grouping;
+
+ /* *************** */
+
+ Moment when() const;
+ virtual ~Staff_walker();
+ Staff_walker(Staff*, PScore*);
+ void process() ;
+
+ void operator++(int);
+ void allow_break();
+
+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;
+private:
+ void process_timing_reqs();
+ Staff_walker(Staff_walker const&);
+};
+
+#endif // STAFFWALKER_HH
+
void add(const PointerList<Voice*> &s);
void add_voice(Voice *v);
- Paperdef*paper()const;
+ Paper_def*paper()const;
void setup_staffcols();
+++ /dev/null
-/*
- staffcolumn.hh -- declare Staff_column
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef STAFFCOLUMN_HH
-#define STAFFCOLUMN_HH
-#include "proto.hh"
-#include "varray.hh"
-#include "moment.hh"
-
-/// store simultaneous requests
-class Staff_column {
-
- Staff_column(Staff_column const&);
-
-public:
- Array<Request*> musicalreq_l_arr_;
- Array<Request*> commandreq_l_arr_;
- Staff * staff_l_;
-
- /// fields to collect timing data vertically.
- Array<Timing_req*> timing_req_l_arr_;
- Score_column *musical_column_l_, *command_column_l_;
-
- /* *************** */
-
- Staff_column();
-
- Moment when() const;
- void set_cols(Score_column *c1, Score_column *c2);
- void add(Voice_element*ve);
- void OK() const;
- ~Staff_column();
- void typeset_breakable_items(Array<Item *> &pre_p_arr,
- Array<Item *> &nobreak_p_arr,
- Array<Item *> &post_p_arr);
- void typeset_musical_item(Item *i);
-protected:
- void setup_one_request(Request*);
-};
-
-
-
-#endif // STAFFCOLUMN_HH
-
+++ /dev/null
-/*
- staffelem.hh -- part of LilyPond
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef STAFFELEM_HH
-#define STAFFELEM_HH
-#include "varray.hh"
-#include "proto.hh"
-#include "offset.hh"
-#include "molecule.hh"
-
-/** Both Spanner and Item are Staff_elem's. Most Staff_elem's depend
- on other Staff_elem's, eg, Beam needs to know and set direction of
- Stem. So the Beam has to be calculated *before* Stem. This is
- accomplished with the dependencies field of struct Staff_elem.
-
- */
-struct Staff_elem {
- enum Status {
- ORPHAN, // not yet added to pstaff
- VIRGIN, // added to pstaff
- PRECALCING,
- PRECALCED, // calcs before spacing done
- POSTCALCING,
- POSTCALCED, // after spacing calcs done
- OUTPUT, // molecule has been output
- } status;
-
- /// the pstaff it is in
- PStaff *pstaff_l_;
-
- /* *************** */
- Staff_elem(Staff_elem const&);
- String TeXstring () const ;
- virtual void print() const;
- virtual Interval width() const;
- virtual Interval height() const;
- Paperdef *paper() const;
- virtual ~Staff_elem();
- Staff_elem();
-
- void translate(Offset);
- void add_processing();
- void pre_processing();
- void post_processing();
- void molecule_processing();
- virtual const char *name() const; // to find out derived classes.
- virtual Spanner* spanner() { return 0; }
- virtual Item * item() { return 0; }
- void add_depedency(Staff_elem* );
- void substitute_dependency(Staff_elem* old, Staff_elem * newdep);
-protected:
-
- /// do printing of derived info.
- virtual void do_print() const=0;
- /// generate the molecule
- virtual Molecule* brew_molecule_p()const=0;
- ///executed directly after the item is added to the PScore
- virtual void do_add_processing();
- /// do calculations before determining horizontal spacing
- virtual void do_pre_processing();
-
- /// do calculations after determining horizontal spacing
- virtual void do_post_processing();
-
- Array<Staff_elem*> dependants;
-
-private:
- /// member: the symbols
- Molecule *output; // should scrap, and use temp var?
-
-
- /**
- This is needed, because #output# may still be
- NULL.
- */
- Offset offset_;
- Array<Staff_elem*> dependencies;
-};
-#define NAME_METHOD(c) const char *c::name()const{ return #c; } struct c
-#endif // STAFFELEM_HH
-
+++ /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
/// this many lines.
int no_lines_i_;
- const char *name()const;
+ NAME_MEMBERS(Staff_symbol);
Staff_symbol(int lines);
virtual Molecule* brew_molecule_p() const;
void set_extent(PCol* p1, PCol* p2);
+++ /dev/null
-/*
- staffwalker.hh -- declare Staff_walker
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef STAFFWALKER_HH
-#define STAFFWALKER_HH
-
-#include "proto.hh"
-#include "timedescription.hh"
-#include "pcursor.hh"
-
-/**
- manage run-time info when walking staffcolumns such as: key,
- meter, pending beams & slurs
- */
-struct Staff_walker : public PCursor<Staff_column*> {
- Staff * staff_l_;
- PScore * pscore_l_;
- Score_walker *score_walk_l_;
- Time_description time_;
- Rhythmic_grouping *default_grouping;
-
- /* *************** */
-
- Moment when() const;
- virtual ~Staff_walker();
- Staff_walker(Staff*, PScore*);
- void process() ;
-
- void operator++(int);
- void allow_break();
-
-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;
-private:
- void process_timing_reqs();
- Staff_walker(Staff_walker const&);
-};
-
-#endif // STAFFWALKER_HH
-
--- /dev/null
+/*
+ stem-beam-reg.hh -- part of LilyPond
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef STEMBEAMREG_HH
+#define STEMBEAMREG_HH
+#include "register.hh"
+
+struct Stem_beam_register : Request_register {
+ Stem * stem_p_;
+ Beam * beam_p_;
+ Beam_req * beam_req_l_;
+ Stem_req * stem_req_l_;
+ Beam_req * start_req_l_;
+ bool end_beam_b_;
+ Rhythmic_grouping *current_grouping;
+ int default_dir_i_;
+
+ /* *************** */
+ Stem_beam_register();
+ ~Stem_beam_register();
+ virtual void set_feature(Features dir_i_);
+ virtual bool try_request(Request*);
+ virtual void process_requests();
+ virtual void acknowledge_element(Staff_elem_info);
+ virtual void pre_move_processing();
+ virtual void post_move_processing();
+ NAME_MEMBERS(Stem_beam_register);
+};
+#endif // STEMBEAMREG_HH
/// ensure that this Stem also encompasses the Notehead #n#
void add(Notehead*n);
- const char * name() const;
+
+ NAME_MEMBERS(Stem);
Real hindex()const;
void do_print() const;
+++ /dev/null
-/*
- stembeamreg.hh -- part of LilyPond
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef STEMBEAMREG_HH
-#define STEMBEAMREG_HH
-#include "register.hh"
-
-struct Stem_beam_register : Request_register {
- Stem * stem_p_;
- Beam * beam_p_;
- Beam_req * beam_req_l_;
- Stem_req * stem_req_l_;
- Beam_req * start_req_l_;
- bool end_beam_b_;
- Rhythmic_grouping *current_grouping;
- int default_dir_i_;
-
- /* *************** */
- Stem_beam_register(Complex_walker*);
- ~Stem_beam_register();
- void set_dir(int dir_i_);
- virtual bool try_request(Request*);
- virtual void process_request();
- virtual void acknowledge_element(Staff_elem_info);
- virtual void do_pre_move_process();
- virtual void do_post_move_process();
-};
-#endif // STEMBEAMREG_HH
Symbol (String, Box);
Symbol();
+ String str()const; // for printing.
};
#endif
struct Symtable : public Assoc<String, Symbol> {
Symbol lookup(String)const;
-
+ void print()const;
};
Symtables();
Symtables(Symtables const&);
Assoc<String, Symtable*>::add;
+ void print()const;
};
--- /dev/null
+#ifndef TSTREAM__HH
+#define TSTREAM__HH
+
+#include <iostream.h>
+#include "string.hh"
+
+
+/** 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.
+ */
+struct Tex_stream {
+ bool outputting_comment;
+ ostream *os;
+ int nest_level;
+
+ /// open a file for writing
+ Tex_stream(String filename);
+ void header();
+ /// delegate conversion to string class.
+ Tex_stream &operator<<(String);
+
+ /// close the file
+ ~Tex_stream();
+private:
+ Tex_stream(Tex_stream const&);
+};
+#endif
--- /dev/null
+/*
+ text-def.hh -- part of LilyPond
+
+ (c) 1996,97 Han-Wen Nienhuys
+*/
+
+#ifndef TEXTDEF_HH
+#define TEXTDEF_HH
+
+#include "string.hh"
+#include "proto.hh"
+
+struct Text_def {
+ int align_i_;
+ String text_str_;
+ String style_str_;
+ char const* defined_ch_c_l_;
+
+
+ /* ****************/
+ virtual ~Text_def() {};
+ bool compare(const Text_def&);
+ Text_def();
+ virtual void print() const;
+ virtual Atom create_atom(Paper_def*) const;
+};
+
+#endif // TEXTDEF_HH
+
--- /dev/null
+/*
+ text-reg.hh -- part of LilyPond
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef TEXTREG_HH
+#define TEXTREG_HH
+#include "register.hh"
+
+struct Text_register : Request_register{
+ Text_item * text_p_;
+ Text_req * text_req_l_;
+ int dir_i_;
+ /* *************** */
+ virtual void set_feature(Features );
+ Text_register();
+ virtual bool try_request(Request*);
+ virtual void process_requests();
+ virtual void pre_move_processing();
+ virtual void post_move_processing();
+ NAME_MEMBERS(Text_register);
+};
+
+#endif // TEXTREG_HH
+++ /dev/null
-/*
- textdef.hh -- part of LilyPond
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef TEXTDEF_HH
-#define TEXTDEF_HH
-
-#include "string.hh"
-#include "proto.hh"
-
-struct Text_def {
- int align_i_;
- String text_str_;
- String style_str_;
- char const* defined_ch_c_l_;
-
-
- /* ****************/
- virtual ~Text_def() {};
- bool compare(const Text_def&);
- Text_def();
- virtual void print() const;
- virtual Atom create_atom(Paperdef*) const;
-};
-
-#endif // TEXTDEF_HH
-
#ifndef TEXT_ITEM_HH
#define TEXT_ITEM_HH
-#include "textdef.hh"
+#include "text-def.hh"
#include "item.hh"
struct Text_item : Item {
Text_def* tdef_l_;
/* ***************/
- const char * name() const;
+ NAME_MEMBERS(Text_item);
virtual void set_default_index();
Molecule* brew_molecule_p() const;
void do_pre_processing();
+++ /dev/null
-/*
- textreg.hh -- part of LilyPond
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef TEXTREG_HH
-#define TEXTREG_HH
-#include "register.hh"
-
-struct Text_register : Request_register{
- Text_item * text_p_;
- int dir_i_;
- /* *************** */
- void set_dir(int dir_i);
- Text_register(Complex_walker*);
- virtual bool try_request(Request*);
- virtual void process_request();
- virtual void do_pre_move_process();
-};
-
-#endif // TEXTREG_HH
#define TEXTSPANNER_HH
#include "string.hh"
-#include "directionalspanner.hh"
-#include "textdef.hh"
+#include "directional-spanner.hh"
+#include "text-def.hh"
/** a spanner which puts texts on top of other spanners. Use for
triplets, eentweetjes, ottava, etc. */
/* *************** */
- const char * name() const;
- virtual void do_pre_processing();
- virtual void do_post_processing();
- virtual Interval height() const ;
+ NAME_MEMBERS(Text_spanner);
+ virtual void do_pre_processing();
+ virtual void do_post_processing();
+ virtual Interval height() const ;
virtual Molecule* brew_molecule_p()const;
virtual void do_print() const;
virtual Spanner* do_break_at(PCol*,PCol*)const;
--- /dev/null
+/*
+ moment.hh -- part of LilyPond
+
+ (c) 1996,97 Han-Wen Nienhuys
+*/
+
+#ifndef tdes_HH
+#define tdes_HH
+
+#include "moment.hh"
+
+/// full info on where we are
+struct Time_description {
+ Moment when_;
+
+ /// if true, no bars needed, no reduction of whole_in_measure
+ bool cadenza_b_;
+
+ /// current measure info
+ Moment whole_per_measure_;
+
+ /// where am i
+ Moment whole_in_measure_;
+
+ /// how long is one beat?
+ Moment one_beat_;
+
+ /// idem
+ int bars_i_;
+
+ /* *************** */
+ void set_cadenza(bool);
+ void OK() const;
+ Time_description();
+ void add(Moment dt);
+ String str()const;
+ void print() const;
+ void setpartial(Moment p);
+ Moment barleft();
+ void set_meter(int,int);
+ static int compare (Time_description&, Time_description&);
+};
+
+#include "compare.hh"
+
+
+instantiate_compare(Time_description&,Time_description::compare);
+
+#endif // Time_description_HH
+
+++ /dev/null
-/*
- moment.hh -- part of LilyPond
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef tdes_HH
-#define tdes_HH
-
-#include "moment.hh"
-
-/// full info on where we are
-struct Time_description {
- Moment when_;
-
- /// if true, no bars needed, no reduction of whole_in_measure
- bool cadenza_b_;
-
- /// current measure info
- Moment whole_per_measure_;
-
- /// where am i
- Moment whole_in_measure_;
-
- /// how long is one beat?
- Moment one_beat_;
-
- /// idem
- int bars_i_;
-
- /* *************** */
- void set_cadenza(bool);
- void OK() const;
- Time_description();
- void add(Moment dt);
- String str()const;
- void print() const;
- void setpartial(Moment p);
- Moment barleft();
- void set_meter(int,int);
- static int compare (Time_description&, Time_description&);
-};
-
-#include "compare.hh"
-
-
-instantiate_compare(Time_description&,Time_description::compare);
-
-#endif // Time_description_HH
-
+++ /dev/null
-#ifndef TSTREAM__HH
-#define TSTREAM__HH
-
-#include <iostream.h>
-#include "string.hh"
-
-
-/** 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.
- */
-struct Tex_stream {
- bool outputting_comment;
- ostream *os;
- int nest_level;
-
- /// open a file for writing
- Tex_stream(String filename);
- void header();
- /// delegate conversion to string class.
- Tex_stream &operator<<(String);
-
- /// close the file
- ~Tex_stream();
-private:
- Tex_stream(Tex_stream const&);
-};
-#endif
--- /dev/null
+/*
+ voice-element.hh -- declare Voice_element
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef VOICE_ELEMENT_HH
+#define VOICE_ELEMENT_HH
+
+#include "proto.hh"
+#include "plist.hh"
+#include "moment.hh"
+
+/** one horizontal bit. Voice_element is nothing but a container for
+ *the requests, */
+struct Voice_element {
+ Moment duration;
+ char const* defined_ch_c_l_;
+ const Voice *voice_l_;
+ IPointerList<Request*> reqs;
+
+ /* *************** */
+
+ Voice_element();
+ Voice_element(Voice_element const & src );
+
+ void add(Request*);
+ bool find_plet_start_bo(char c, Moment& moment_r);
+ void print ()const;
+ void set_default_group(String id);
+ void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i);
+};
+
+#endif // VOICE-ELEMENT_HH
--- /dev/null
+/*
+ voice-group-regs.hh -- declare Voice_group_registers
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef VOICEGROUPREGS_HH
+#define VOICEGROUPREGS_HH
+
+#include "registergroup.hh"
+
+struct Voice_group_registers : Register_group_register {
+ String group_id_str_;
+ Array<Voice_registers*> voice_regs_l_;
+
+ /* *************** */
+
+ NAME_MEMBERS(Voice_group_registers);
+ static bool static_acceptable_request_b(Request*);
+ virtual void terminate_register(Request_register*);
+ virtual void do_print() const;
+ virtual void add(Request_register*);
+ Voice_group_registers(String id);
+ virtual bool try_request(Request*);
+};
+#endif // VOICEGROUPREGS_HH
--- /dev/null
+/*
+ voice-regs.hh -- declare Voice_registers
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef VOICEREGS_HH
+#define VOICEREGS_HH
+
+#include "registergroup.hh"
+
+class Voice_registers : public Register_group_register {
+
+
+public:
+ Voice *voice_l_;
+ /* *************** */
+
+ NAME_MEMBERS(Voice_registers);
+ virtual bool acceptable_request_b(Request*);
+ virtual void acknowledge_element(Staff_elem_info info);
+ virtual bool try_request(Request*);
+ Voice_registers(Voice*);
+ virtual void do_print() const;
+};
+
+
+#endif // VOICEREGS_HH
/** 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
+ Voice is a ordered row of Voice_elements. It is strictly
+ horizontal: you cannot have two rhythmic elements running parallel
+ in a Voice. For proper processing, each Voice should have
+ Group_change_req as a first element.
*/
void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i);
};
-/** 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_;
- const Voice *voice_l_;
- IPointerList<Request*> reqs;
-
- /* *************** */
-
- Voice_element();
- Voice_element(Voice_element const & src );
-
- void add(Request*);
- bool find_plet_start_bo(char c, Moment& moment_r);
- void print ()const;
- void set_default_group(String id);
- void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i);
- /// return true when done
-};
#endif
+++ /dev/null
-/*
- voicegroupregs.hh -- declare
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef VOICEGROUPREGS_HH
-#define VOICEGROUPREGS_HH
-
-#include "registergroup.hh"
-
-struct Voice_group_registers : Register_group {
- String group_id_str_;
- Complex_walker * walk_l_;
-
- /* *************** */
- void set_dir(int i);
- static bool acceptable_request_b(Request*);
-
- void acknowledge_element(Staff_elem_info info);
- Voice_group_registers(Complex_walker*, String id = "");
- bool try_request(Request*);
-};
-#endif // VOICEGROUPREGS_HH
+++ /dev/null
-/*
- voiceregs.hh -- declare Voice_registers
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef VOICEREGS_HH
-#define VOICEREGS_HH
-
-#include "registergroup.hh"
-
-struct Voice_registers : Register_group {
- Voice *voice_l_;
-
- /* *************** */
-
- static bool acceptable_request_b(Request*);
- virtual void acknowledge_element(Staff_elem_info info);
-
- Voice_registers(Complex_walker*,Voice*);
-};
-
-
-#endif // VOICEREGS_HH
#include "registergroup.hh"
-struct Walker_registers : Register_group {
- Walker_registers(Complex_walker *w);
+/**
+ Top level registers: the interface to Complex_walker.
+
+ [sigh. Sometimes I wish C++ could do better late binding.]
+ */
+struct Walker_registers : Register_group_register {
+ Array<Item*> prebreak_item_p_arr_;
+ Array<Item*> nobreak_item_p_arr_;
+ Array<Item*> postbreak_item_p_arr_;
+ Array<Staff_elem_info> announce_info_arr_;
+ Array<Voice_group_registers*> group_l_arr_;
+ Complex_walker * walk_l_;
+
+ /* *************** */
+ void change_group(Group_change_req * greq_l,
+ Voice_registers *voice_regs_l,
+ Voice_group_registers * old_group);
+ Voice_group_registers * get_group(String id);
+ void typeset_musical_item(Staff_elem * elem_p);
+ Walker_registers(Complex_walker*);
+ void do_announces();
+ void terminate_register(Request_register * reg);
+ virtual bool try_request(Request * r);
+ virtual Staff_info get_staff_info();
+
+ virtual void announce_element(Staff_elem_info);
+ virtual void acknowledge_element(Staff_elem_info);
+ virtual void typeset_breakable_item(Item * pre_p , Item * nobreak_p, Item * post_p);
+ virtual void typeset_element(Staff_elem*elem_p);
+ virtual void pre_move_processing();
+ virtual void post_move_processing();
+ virtual Paper_def * paper() const;
};
#endif // WALKREGS_HH
include "dutch.ini" # do not include init/ path
-include "script.ini"
-include "table_sixteen.ini"
+include "script.ini"
+include "table_sixteen.ini" # not needed if doing MIDI
melodie = music {
$\clef\violin
c c | g g | a a | g2
- f f | e e | d d8.( e16 | )c2 | % :|
+ f f | e e | d d8. e16 | c2 | % :|
$
}
commands {
meter { 2 * 4}
}
+ paper{}
midi {
tempo 4:120
}
music{ $
\duration { 8 }
\octave{ }
- |[ a a a a a a a a a ]
+ |[ a a a a a a a a a ]8/9
\octave{ ' }
- |[ a a a a a a a a a ]
+ |[ a a a a a a a a a ]8/9
\octave { ` }
- [ `c `g d a 'e 'b ''f '''c '''g ]
- [ '''g '''c ''f 'b 'e a d `g `c ]
+ [ `c `g d a 'e 'b ''f '''c '''g ] 8/9
+ [ '''g '''c ''f 'b 'e a d `g `c ] 8/9
\octave{ ' }
- [ `c `g d a 'e 'b ''f '''c '''g ]
- [ '''g '''c ''f 'b 'e a d `g `c ]
+ [ `c `g d a 'e 'b ''f '''c '''g ] 8/9
+ [ '''g '''c ''f 'b 'e a d `g `c ] 8/9
\octave { }
[ c g 'd ]2/3
[ 'd g c ]2/3
}
commands {
meter {6*8}
- skip 36*8
+ skip {36*8}
meter {4*4}
}
}
ln $(DISTFILES) $(DDIR)/$(SUBDIR)
TAGS: $(allcc)
- etags -CT $(allcc)
+ $(TAGSACTION) $^
clean:
rm -f $(gencc)
--- /dev/null
+/*
+ bar-reg.cc -- implement Bar_register
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "bar-reg.hh"
+#include "bar.hh"
+#include "commandrequest.hh"
+#include "score-column.hh"
+#include "time-description.hh"
+
+Bar_register::Bar_register()
+{
+ post_move_processing();
+}
+
+bool
+Bar_register::try_request(Request*r_l)
+{
+ Command_req* c_l = r_l->command();
+ if (!c_l|| !c_l->bar())
+ return false;
+
+ assert(!bar_req_l_);
+ bar_req_l_ = c_l->bar();
+
+ return true;
+}
+
+void
+Bar_register::process_requests()
+{
+ if (bar_req_l_ ) {
+ bar_p_ = new Bar(bar_req_l_->type_str_);
+ } else if (!get_staff_info().time_c_l_->whole_in_measure_) {
+ bar_p_ = new Bar("|");
+ }
+
+ if (bar_p_){
+ announce_element(Staff_elem_info(bar_p_, bar_req_l_) );
+ }
+}
+
+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::pre_move_processing()
+{
+ 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::post_move_processing()
+{
+ bar_req_l_ = 0;
+ bar_p_ =0;
+}
#include "bar.hh"
#include "string.hh"
#include "molecule.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
#include "lookup.hh"
#include "debug.hh"
-NAME_METHOD(Bar);
+
Bar::Bar( String t)
{
+++ /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 "scorecolumn.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->command()->bar())
- return false;
-
- assert(!bar_req_l_);
- bar_req_l_ = r_l->command()->bar();
-
- return true;
-}
-
-void
-Bar_register::process_request()
-{
-
- if (bar_req_l_ ) {
- bar_p_ = new Bar(bar_req_l_->type_str_);
- } 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;
-}
#include "leastsquares.hh"
#include "pcol.hh"
#include "stem.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
#include "lookup.hh"
#include "grouping.hh"
-NAME_METHOD(Beam);
+
struct Stem_info {
Real x;
Beam::add(Stem*s)
{
stems.bottom().add(s);
- s->add_depedency(this);
+ s->add_dependency(this);
s->print_flag = false;
}
-//
-// binary-source-file.cc
-//
+/*
+ binary-source-file.cc -- implement Binary_source_file
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Jan Nieuwenhuizen
+*/
+
#include <limits.h> // INT_MAX
#include <assert.h>
#include "plist.hh"
#include "string.hh"
#include "debug.hh"
-#include "sourcefile.hh"
+#include "source-file.hh"
#include "binary-source-file.hh"
+#include "string-convert.hh"
Binary_source_file::Binary_source_file( String& filename_str )
: Source_file( filename_str )
do calculations for breaking problem
*/
#include "break.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
#include "linespace.hh"
#include "debug.hh"
#include "scoreline.hh"
#include "idealspacing.hh"
#include "score.hh"
#include "pscore.hh"
-#include "paperdef.hh"
-#include "scorecolumn.hh"
+#include "paper-def.hh"
+#include "score-column.hh"
#include "dimen.hh"
--- /dev/null
+/*
+ clef-item.cc -- implement Clef_item
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "clef-item.hh"
+#include "string.hh"
+#include "molecule.hh"
+#include "paper-def.hh"
+#include "lookup.hh"
+#include "clef-reg.hh"
+
+
+
+Clef_item::Clef_item()
+{
+ change = true;
+ read("violin");
+}
+
+void
+Clef_item::read(String t)
+{
+ type = t;
+ if (type == "violin")
+ y_off = 2;
+ if (type == "alto")
+ y_off = 4;
+ if (type == "tenor")
+ y_off = 6;
+ if (type == "bass")
+ y_off = 6;
+}
+void
+Clef_item::read(Clef_register const &k)
+{
+ read(k.clef_type_str_);
+}
+
+Molecule*
+Clef_item::brew_molecule_p()const
+{
+ String t = type;
+ if (change)
+ t += "_change";
+ Symbol s = paper()->lookup_p_->clef(t);
+ Molecule*output = new Molecule(Atom(s));
+ output->translate(Offset(0, paper()->internote() * y_off));
+ return output;
+}
+
--- /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 "clef-reg.hh"
+#include "clef-item.hh"
+#include "debug.hh"
+#include "commandrequest.hh"
+#include "time-description.hh"
+#include "staff-column.hh"
+
+Clef_register::Clef_register()
+{
+ clef_p_ = 0;
+
+ /* ugly hack to prevent segfault (daddy_reg_l_ == 0 at construction) */
+ clef_type_str_ = "";
+}
+
+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;
+ *get_staff_info().c0_position_i_ = 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(Request * r_l)
+{
+ Command_req* creq_l= r_l->command();
+ if (!creq_l || !creq_l->clefchange())
+ return false;
+
+ clef_req_l_ = creq_l->clefchange();
+
+ // do it now! Others have to read c0_pos.
+ read_req(creq_l->clefchange());
+ return true;
+}
+
+void
+Clef_register::process_requests()
+{
+ const Time_description *time_l = get_staff_info().time_c_l_;
+ if (!clef_req_l_ && (!time_l->whole_in_measure_|| !time_l->when_)) {
+ clef_p_ = new Clef_item;
+ clef_p_->change = false;
+ } else if (clef_req_l_) {
+ clef_p_ = new Clef_item;
+ clef_p_->change = true;
+ }
+ if (clef_p_) {
+ clef_p_->read(*this);
+ announce_element(Staff_elem_info(clef_p_,
+ clef_req_l_));
+ }
+}
+
+void
+Clef_register::pre_move_processing()
+{
+ if (!clef_p_)
+ return;
+ if (clef_p_->change) {
+ Clef_item* post_p = new Clef_item(*clef_p_);
+ post_p->change = false;
+ typeset_breakable_item(new Clef_item(*clef_p_),
+ clef_p_, post_p);
+ } else {
+ typeset_breakable_item(0, 0, clef_p_);
+ }
+ clef_p_ = 0;
+}
+
+void
+Clef_register::post_move_processing()
+{
+ clef_req_l_ = 0;
+ /* not in ctor, since the reg might not be linked in.*/
+ if (clef_type_str_ == "") {
+ set_type("violin");
+ }
+}
+++ /dev/null
-/*
- 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 "clefreg.hh"
-
-NAME_METHOD(Clef_item);
-
-Clef_item::Clef_item()
-{
- change = true;
- read("violin");
-}
-
-void
-Clef_item::read(String t)
-{
- type = t;
- if (type == "violin")
- y_off = 2;
- if (type == "alto")
- y_off = 4;
- if (type == "tenor")
- y_off = 6;
- if (type == "bass")
- y_off = 6;
-}
-void
-Clef_item::read(Clef_register const &k)
-{
- read(k.clef_type_str_);
-}
-
-Molecule*
-Clef_item::brew_molecule_p()const
-{
- String t = type;
- if (change)
- t += "_change";
- Symbol s = paper()->lookup_p_->clef(t);
- Molecule*output = new Molecule(Atom(s));
- output->translate(Offset(0, paper()->internote() * y_off));
- return output;
-}
-
+++ /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 "staffcolumn.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(Request * r_l)
-{
-
- Command_req* creq_l= r_l->command();
- if (!creq_l || !creq_l->clefchange())
- return false;
-
- accepted_req_arr_.push(creq_l);
- // do it now! Others have to read c0_pos.
- read_req(creq_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 "complex-staff.hh"
+#include "complex-walker.hh"
+#include "score.hh"
+#include "pscore.hh"
+#include "staffsym.hh"
+#include "score-column.hh"
+
+const NO_LINES = 5;
+
+/** Aside from putting fields right, this generates the staff symbol.
+ */
+void
+Complex_staff::set_output(PScore* pscore_l )
+{
+ pstaff_l_ = new PStaff(pscore_l);
+ pscore_l_ = pscore_l;
+ pscore_l_->add(pstaff_l_);
+
+ Staff_symbol *span_p = new Staff_symbol(NO_LINES);
+
+ Score_column* col_last
+ =score_l_->find_col(score_l_->last(), false);
+ Score_column* col_first=
+ score_l_->find_col(0, false);
+
+ span_p->set_extent(col_first->pcol_l_->postbreak_p_,
+ col_last->pcol_l_->prebreak_p_);
+
+ pscore_l_->typeset_spanner(span_p, pstaff_l_);
+}
+
+
+Staff_walker *
+Complex_staff::get_walker_p()
+{
+ return new Complex_walker(this);
+}
--- /dev/null
+/*
+ complex-walker.cc -- implement Complex_walker
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "musicalrequest.hh"
+#include "staff-column.hh"
+#include "voice.hh"
+#include "pscore.hh"
+#include "complex-staff.hh"
+#include "debug.hh"
+#include "voice-group-regs.hh"
+#include "voice-regs.hh"
+#include "complex-walker.hh"
+//#include "misc.hh"
+#include "commandrequest.hh"
+#include "walkregs.hh"
+
+void
+Complex_walker::do_post_move()
+{
+ walk_regs_p_->post_move_processing();
+}
+
+void
+Complex_walker::do_pre_move()
+{
+ walk_regs_p_->pre_move_processing();
+}
+
+void
+Complex_walker::do_announces()
+{
+ walk_regs_p_->do_announces();
+}
+
+bool
+Complex_walker::try_command_request(Command_req *req_l)
+{
+ return walk_regs_p_->try_request(req_l);
+}
+
+void
+Complex_walker::try_request(Request*req)
+{
+ walk_regs_p_->try_request(req);
+}
+
+void
+Complex_walker::process_requests()
+{
+ Staff_column*c =ptr();
+
+ for (int i=0; i < c->creationreq_l_arr_.size(); i++) {
+ try_request(c->creationreq_l_arr_[i]);
+ }
+ for (int i=0; i < c->commandreq_l_arr_.size(); i++) {
+ try_request(c->commandreq_l_arr_[i]);
+ }
+
+ for (int i=0; i < c->musicalreq_l_arr_.size(); i++) {
+ try_request(c->musicalreq_l_arr_[i]);
+ }
+
+ regs_process_requests();
+ do_announces();
+}
+
+void
+Complex_walker::regs_process_requests()
+{
+ walk_regs_p_->process_requests();
+}
+
+void
+Complex_walker::typeset_element(Staff_elem *elem_p)
+{
+ if (!elem_p)
+ return;
+ if (elem_p->spanner())
+ pscore_l_->typeset_spanner(elem_p->spanner(), staff()->pstaff_l_);
+ else
+ ptr()->typeset_musical_item(elem_p->item());
+}
+
+Complex_walker::Complex_walker(Complex_staff*s)
+ : Staff_walker(s, s->pstaff_l_->pscore_l_)
+{
+ walk_regs_p_ = new Walker_registers(this);
+ do_post_move();
+}
+
+
+Complex_walker::~Complex_walker()
+{
+}
+
+Complex_staff*
+Complex_walker::staff()
+{
+ return (Complex_staff*) staff_l_;
+}
+
+
+
+++ /dev/null
-#include "debug.hh"
-#include "complexstaff.hh"
-#include "complexwalker.hh"
-#include "score.hh"
-#include "pscore.hh"
-#include "staffsym.hh"
-#include "pscore.hh"
-#include "bar.hh"
-#include "meter.hh"
-#include "scorecolumn.hh"
-#include "commandrequest.hh"
-
-const NO_LINES = 5;
-
-/** Aside from putting fields right, this generates the staff symbol.
- */
-void
-Complex_staff::set_output(PScore* pscore_l )
-{
- pstaff_l_ = new PStaff(pscore_l);
- pscore_l_ = pscore_l;
- pscore_l_->add(pstaff_l_);
-
- Staff_symbol *span_p = new Staff_symbol(NO_LINES);
-
- Score_column* col_last
- =score_l_->find_col(score_l_->last(), false);
- Score_column* col_first=
- score_l_->find_col(0, false);
-
- span_p->set_extent(col_first->pcol_l_->postbreak_p_,
- col_last->pcol_l_->prebreak_p_);
-
- pscore_l_->typeset_spanner(span_p, pstaff_l_);
-}
-
-
-Staff_walker *
-Complex_staff::get_walker_p()
-{
- return new Complex_walker(this);
-}
+++ /dev/null
-/*
- 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 "musicalrequest.hh"
-#include "staffcolumn.hh"
-#include "voice.hh"
-#include "pscore.hh"
-#include "complexstaff.hh"
-#include "debug.hh"
-#include "voicegroupregs.hh"
-#include "voiceregs.hh"
-#include "complexwalker.hh"
-#include "misc.hh"
-#include "commandrequest.hh"
-#include "walkregs.hh"
-
-
-void
-Complex_walker::announce_element(Staff_elem_info info)
-{
- info.group_regs_l_ = find_voice_group((Voice*)info.voice_l_);
- announce_info_arr_.push(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;
-
- walk_regs_p_->acknowledge_element(info);
- 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);
- }
- }
-}
-
-Voice_registers *
-Complex_walker::find_voice_reg(Voice*v_l)const
-{
- for (iter_top(voice_reg_list_, i); i.ok(); i++) {
- if (i->voice_l_ == v_l)
- return i;
- }
- return 0;
-}
-
-Voice_registers*
-Complex_walker::get_voice_reg(Voice*v_l)
-{
- Voice_registers *regs_p=find_voice_reg(v_l);
- if (regs_p)
- return regs_p;
-
- regs_p = new Voice_registers(this,v_l);
- voice_reg_list_.bottom().add (regs_p);
- return regs_p;
-}
-
-Voice_group_registers *
-Complex_walker::find_voice_group(Voice* v_l)const
-{
- if (!voice_group_map_.elt_query(v_l))
- return 0;
- else return voice_group_map_[v_l];
-}
-
-Voice_group_registers *
-Complex_walker::find_voice_group(const char *id)const
-{
- for (iter_top(group_reg_list_, i); i.ok(); i++)
- if (i->group_id_str_ == id)
- return i;
- return 0;
-}
-
-
-Voice_group_registers *
-Complex_walker::get_voice_group(Voice *v_l)
-{
- Voice_group_registers *group_p = find_voice_group(v_l);
- if (group_p)
- return group_p;
-
- group_p = new Voice_group_registers(this);
- group_reg_list_.bottom().add(group_p);
- voice_group_map_[v_l] = group_p;
- return group_p;
-}
-
-
-Voice_group_registers *
-Complex_walker::get_voice_group(const char* id)
-{
- Voice_group_registers *group_p = find_voice_group(id);
- if (group_p)
- return group_p;
- group_p = new Voice_group_registers(this,id);
- group_reg_list_.bottom().add(group_p);
- return group_p;
-}
-
-void
-Complex_walker::do_change_group(Voice * v, String group_id_str)
-{
- voice_group_map_[v] = get_voice_group(group_id_str);
-}
-
-bool
-Complex_walker::try_command_request(Command_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 {
- b |= walk_regs_p_->try_request(req_l);
- }
- return b;
-}
-
-void
-Complex_walker::try_request(Request*req)
-{
- bool b=false;
- Voice *voice_l = (Voice*)req->elt_l_->voice_l_; // ahh. This sux
-
- if (req->command()) {
- b = try_command_request(req->command());
- } else if (Voice_registers::acceptable_request_b(req)) {
- Voice_registers *vregs_l = get_voice_reg(voice_l);
- b = vregs_l->try_request(req);
- } else if (Voice_group_registers::acceptable_request_b(req)){
- Voice_group_registers* reg_l = get_voice_group(voice_l);
- b = reg_l->try_request(req);
- }
-
- if (!b)
- warning("junking request: " + String(req->name()),
- req->defined_ch_c_l_);
-}
-
-void
-Complex_walker::process_requests()
-{
- Staff_column*c =ptr();
-
- for (int i=0; i < c->commandreq_l_arr_.size(); i++) {
- try_request(c->commandreq_l_arr_[i]);
- }
-
- for (int i=0; i < c->musicalreq_l_arr_.size(); i++) {
- try_request(c->musicalreq_l_arr_[i]);
- }
-
- regs_process_requests();
- do_announces();
-}
-
-void
-Complex_walker::regs_process_requests()
-{
- walk_regs_p_->process_requests();
- for (iter_top(voice_reg_list_, j); j.ok(); j++) {
- j->process_requests();
- }
- for (iter_top(group_reg_list_, j); j.ok(); j++)
- j->process_requests();
-}
-
-void
-Complex_walker::typeset_element(Staff_elem *elem_p)
-{
- if (!elem_p)
- return;
- if (elem_p->spanner())
- pscore_l_->typeset_spanner(elem_p->spanner(), staff()->pstaff_l_);
- else
- ptr()->typeset_musical_item(elem_p->item());
-}
-
-Complex_walker::Complex_walker(Complex_staff*s)
- : Staff_walker(s, s->pstaff_l_->pscore_l_)
-{
- walk_regs_p_ = new Walker_registers(this);
- do_post_move();
-}
-
-
-Complex_walker::~Complex_walker()
-{
-}
-
-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()
-{
- return (Complex_staff*) staff_l_;
-}
-
-
-void
-Complex_walker::do_pre_move()
-{
- walk_regs_p_->pre_move_processing();
- for (iter_top(voice_reg_list_,i); i.ok(); i++) {
- i->pre_move_processing();
- }
- for (iter_top (group_reg_list_, j); j.ok(); j++)
- j->pre_move_processing();
-
- ptr()->typeset_breakable_items(prebreak_item_p_arr_,
- nobreak_item_p_arr_,
- postbreak_item_p_arr_);
-}
-
-void
-Complex_walker::do_post_move()
-{
- walk_regs_p_->post_move_processing();
- 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();
-}
-
-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++) {
- 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 "directional-spanner.hh"
+
+Directional_spanner::Directional_spanner()
+{
+ dir_i_ = 0;
+}
+++ /dev/null
-#include "directionalspanner.hh"
-
-Directional_spanner::Directional_spanner()
-{
- dir_i_ = 0;
-}
#include "proto.hh" // ugh, these all for midi-main.hh
#include "plist.hh"
#include "string.hh"
-#include "sourcefile.hh"
+#include "source-file.hh"
#include "source.hh"
#include "midi-main.hh" // *tors
}
void
-Rhythmic_grouping::extend(MInterval m)
+Rhythmic_grouping::extend(MInterval m)const
{
assert(m.left >= interval().left);
while (m.right >interval().right ) {
a[i] =new Rhythmic_grouping(*children[i]);
a[i]->translate(children.top()->interval().right);
}
- children.concat(a);
+ ((Rhythmic_grouping*)this)->children.concat(a);
}
assert(m.right <= interval().right);
OK();
#include "rest.hh"
#include "notehead.hh"
#include "headreg.hh"
-#include "paperdef.hh"
-#include "complexwalker.hh"
+#include "paper-def.hh"
+#include "complex-walker.hh"
#include "musicalrequest.hh"
-Notehead_register::Notehead_register(Complex_walker*w_l)
- :Request_register(w_l)
+Notehead_register::Notehead_register()
{
note_p_ = 0;
- set_dir(0);
+ set_feature(Features::dir(0));
+ post_move_processing();
}
bool
Notehead_register::try_request(Request *req_l)
{
if (req_l->note() || req_l->rest())
- accepted_req_arr_.push(req_l);
+ note_req_l_=req_l->rhythmic();
else
return false;
return true;
}
void
-Notehead_register::set_dir(int d)
+Notehead_register::set_feature(Features d)
{
- dir_i_ = d;
+ if(d.direction_i_ || d.initialiser_b_)
+ dir_i_ = d.direction_i_;
}
void
-Notehead_register::process_request()
+Notehead_register::process_requests()
{
- if (!accepted_req_arr_.size())
+ if (!note_req_l_)
return;
- Request* req_l = accepted_req_arr_.top();
- if (req_l->note()) {
+
+ if (note_req_l_->note()) {
Notehead*n_p = new Notehead(8); // ugh
note_p_ = n_p;
- n_p->set_rhythmic(req_l->rhythmic());
- n_p->position = req_l->note()->height() +
- walk_l_->c0_position_i();
+ n_p->set_rhythmic(note_req_l_->rhythmic());
+ n_p->position = note_req_l_->note()->height() +
+ *get_staff_info().c0_position_i_;
} else {
- note_p_ = new Rest ( req_l->rhythmic()->balltype,
- req_l->rhythmic()->dots);
- if (req_l->rhythmic()->balltype <= 2)
+ note_p_ = new Rest ( note_req_l_->rhythmic()->balltype,
+ note_req_l_->rhythmic()->dots);
+ if (note_req_l_->rhythmic()->balltype <= 2)
note_p_->translate(
Offset(0,
6 * paper()->internote()));
}
- Staff_elem_info itinf(note_p_,req_l,this);
+ Staff_elem_info itinf(note_p_,note_req_l_);
announce_element(itinf);
}
void
-Notehead_register::do_pre_move_process()
+Notehead_register::pre_move_processing()
{
if (note_p_) {
- if (dir_i_ && note_p_->name() == String("Rest"))
+ if (dir_i_ && note_p_->name() == Rest::static_name())
note_p_->translate(Offset(0, 4*dir_i_ * paper()->internote()));
typeset_element(note_p_);
note_p_ = 0;
}
}
+void
+Notehead_register::post_move_processing()
+{
+ note_req_l_ = 0;
+}
+/*
+ identifier.cc -- implement identifier and derived classes
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
#include <assert.h>
-#include "identparent.hh"
+#include "identifier.hh"
#include "lexer.hh"
#include "debug.hh"
e += String(classname()) + "(expected " + expect + ")";
::error(e);
}
+
+void
+Identifier::print()const
+{
+ mtor << "identifier \'" << name << "\'=";
+ do_print();
+}
+
+/* ugh. */
+#define DEFAULT_PRINT(Class, Content_type, accessor) \
+void \
+Class::do_print() const { \
+ ((Class*)this)->accessor(false)->print(); \
+} \
+class Class
+
+DEFAULT_PRINT(Script_id, Script_def, script);
+DEFAULT_PRINT(Lookup_id, Lookup, lookup);
+DEFAULT_PRINT(Symtables_id, Symtables, symtables);
+DEFAULT_PRINT(Staff_id, Input_staff, staff);
+DEFAULT_PRINT(M_chord_id, Music_general_chord, mchord);
+DEFAULT_PRINT(M_voice_id, Music_voice, mvoice);
+
+void
+Real_id::do_print() const
+{
+ Identifier::print();
+ mtor << *((Real_id*)this)->real(false)<< "\n";
+}
+
+void
+Notetab_id::do_print() const
+{
+ mtor << "unknown" << "\n";
+}
--- /dev/null
+#include "debug.hh"
+#include "input-music.hh"
+#include "voice.hh"
+#include "musicalrequest.hh"
+#include "voice-element.hh"
+
+void
+Input_music::check_plet(Voice_element* velt_l)
+{
+ for (iter_top(velt_l->reqs,i); i.ok(); i++)
+ if ( i->plet() ) {
+ Moment start_moment = 0;
+ if ( !find_plet_start_bo( i->plet()->type_c_, start_moment ) ) {
+ error( "begin of plet not found", i->defined_ch_c_l_ );
+ break;
+ }
+ Moment moment = 0;
+ set_plet_backwards( moment, start_moment, i->plet()->dur_i_, i->plet()->type_i_ );
+ i.del();
+ break;
+ }
+}
+
+void
+Simple_music::add(Voice_element*v)
+{
+ voice_.add(v);
+}
+
+Moment
+Simple_music::length()const
+{
+ return voice_.last();
+}
+void
+Simple_music::translate_time(Moment t)
+{
+ voice_.start += t;
+}
+
+Voice_list
+Simple_music::convert()const
+{
+ Voice_list l;
+ l.bottom().add(new Voice(voice_));
+ return l;
+}
+
+
+void
+Simple_music::print() const
+{
+ mtor << "Simple_music {";
+ voice_.print();
+ mtor << "}\n";
+}
+bool
+Simple_music::find_plet_start_bo(char c, Moment& moment_r)
+{
+ return voice_.find_plet_start_bo(c, moment_r);
+}
+void
+Simple_music::set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i)
+{
+ voice_.set_plet_backwards(now_moment_r, until_moment, num_i, den_i);
+}
+
+/* *************** */
+
+void
+Complex_music::add(Input_music*v)
+{
+ elts.bottom().add(v);
+}
+
+void
+Complex_music::print() const
+{
+ for (iter_top(elts,i); i.ok(); i++)
+ i->print();
+}
+
+void
+Complex_music::concatenate(Complex_music*h)
+{
+ for (iter_top(h->elts,i); i.ok(); i++)
+ add(i->clone());
+}
+
+Complex_music::Complex_music()
+{
+}
+
+Complex_music::Complex_music(Complex_music const&s)
+{
+ for (iter_top(s.elts,i); i.ok(); i++)
+ add(i->clone());
+}
+void
+Complex_music::set_default_group(String g)
+{
+ for (iter_top(elts,i); i.ok(); i++)
+ i->set_default_group(g);
+}
+bool
+Complex_music::find_plet_start_bo(char c, Moment& moment_r)
+{
+ for (iter_bot(elts,i); i.ok(); i--) {
+ if ( i->find_plet_start_bo(c, moment_r) )
+ return true;
+ }
+ return false;
+}
+void
+Complex_music::set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i)
+{
+ for (iter_bot(elts,i); i.ok(); i--) {
+ i->set_plet_backwards(now_moment_r, until_moment, num_i, den_i);
+ }
+}
+/* *************************************************************** */
+
+void
+Music_voice::print() const
+{
+ mtor << "Music_voice {";
+ Complex_music::print();
+ mtor << "}\n";
+}
+
+void
+Music_voice::add_elt(Voice_element*v)
+{
+ PCursor<Input_music*> c(elts.bottom());
+ if (!c.ok() || !c->simple()) {
+ Simple_music*vs = new Simple_music;
+
+ c.add(vs);
+ }
+
+ c = elts.bottom();
+ Simple_music *s = c->simple();
+ s->add(v);
+
+ check_plet(v);
+}
+
+Moment
+Music_voice::length()const
+{
+ Moment l = 0;
+
+ for (iter_top(elts,i); i.ok(); i++)
+ l += i->length();
+ return l;
+}
+
+
+Voice_list
+Music_voice::convert()const
+{
+ Voice_list l;
+ Moment here = 0;
+
+ for (iter_top(elts,i); i.ok(); i++) {
+ Moment len = i->length();
+ Voice_list k(i->convert());
+ k.translate_time(here);
+ l.concatenate(k);
+ here +=len;
+ }
+ return l;
+}
+
+void
+Music_voice::translate_time(Moment t)
+{
+ elts.bottom()->translate_time(t);
+}
+
+
+
+/* *************** */
+
+void
+Music_general_chord::add_elt(Voice_element*v)
+{
+ Simple_music*vs = new Simple_music;
+ vs->add(v);
+ elts.bottom().add(vs);
+
+ check_plet(v);
+}
+
+void
+Music_general_chord::print() const
+{
+ mtor << "Music_general_chord {";
+ Complex_music::print();
+ mtor << "}\n";
+}
+
+void
+Music_general_chord::translate_time(Moment t)
+{
+ for (iter_top(elts,i); i.ok(); i++)
+ i->translate_time(t);
+}
+
+Moment
+Music_general_chord::length()const
+{
+ Moment l =0;
+
+ for (iter_top(elts,i); i.ok(); i++)
+ l = l >? i->length();
+ return l;
+}
+
+Voice_list
+Music_general_chord::convert()const
+{
+ Voice_list l;
+ for (iter_top(elts,i); i.ok(); i++) {
+ Voice_list k(i->convert());
+ l.concatenate(k);
+ }
+ return l;
+}
+
+/* *************** */
+
+void
+Multi_voice_chord::set_default_group(String g)
+{
+ int j=0;
+ for (iter_top(elts, i); i.ok(); i++) {
+ i->set_default_group(g + String(j));
+ j++;
+ }
+}
+
+
+/* *************** */
+
+void
+Voice_list::translate_time(Moment x)
+{
+ for (iter_top(*this,i); i.ok(); i++)
+ i->start += x;
+}
+
--- /dev/null
+/*
+ input-score.cc -- implement Input_score
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "debug.hh"
+#include "input-score.hh"
+#include "input-staff.hh"
+#include "input-music.hh"
+#include "score.hh"
+#include "paper-def.hh"
+#include "midi-def.hh"
+#include "staff.hh"
+
+
+void
+Input_score::add(Input_staff*s)
+{
+ staffs_.bottom().add(s);
+}
+
+void
+Input_score::set(Paper_def*p)
+{
+ delete paper_p_;
+ paper_p_ = p;
+}
+
+void
+Input_score::set(Midi_def* midi_p)
+{
+ delete midi_p_;
+ midi_p_ = midi_p;
+}
+
+Input_score::Input_score(Input_score const&s)
+{
+ paper_p_ = (s.paper_p_)? new Paper_def(*s.paper_p_) :0;
+ midi_p_ = (s.midi_p_)? new Midi_def(*s.midi_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()
+{
+ Score *s_p = new Score;
+ s_p->defined_ch_c_l_= defined_ch_c_l_;
+ s_p->errorlevel_i_ = errorlevel_i_;
+ if (midi_p_)
+ s_p->set(new Midi_def(*midi_p_));
+ if (paper_p_)
+ s_p->set( new Paper_def(*paper_p_));
+
+ for (iter_top(staffs_,i); i.ok(); i++) {
+ Staff* staf_p=i->parse(s_p, score_wide_music_p_);
+ s_p->add(staf_p);
+ }
+
+ 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_p_;
+ delete score_wide_music_p_;
+ delete midi_p_;
+}
+
+Input_score::Input_score()
+{
+ score_wide_music_p_ =0;
+ defined_ch_c_l_=0;
+ paper_p_= 0;
+ midi_p_ = 0;
+ errorlevel_i_ = 0;
+}
+
+void
+Input_score::print()const
+{
+#ifndef NPRINT
+ mtor << "Input_score {\n";
+ for (iter_top(staffs_,i); i.ok(); i++) {
+ i->print();
+ }
+ mtor << "}\n";
+#endif
+}
--- /dev/null
+/*
+ input-staff.cc -- implement Input_staff
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "debug.hh"
+#include "score.hh"
+#include "input-music.hh"
+#include "input-staff.hh"
+#include "staff.hh"
+#include "complex-staff.hh"
+#include "lyricstaff.hh"
+
+#include "lexer.hh"
+
+
+Input_staff::Input_staff(String s)
+{
+ score_wide_music_p_ =0;
+ type= s;
+ defined_ch_c_l_ = 0;
+}
+
+void
+Input_staff::add(Input_music*m)
+{
+ music_.bottom().add(m);
+}
+
+Staff*
+Input_staff::parse(Score*score_l, Input_music *default_score_wide)
+{
+ Staff *p=0;
+ if (type == "melodic")
+ p = new Complex_staff;
+ else if (type == "lyric")
+ p = new Lyric_staff;
+ else {
+ error( "Unknown staff-type `" + type +"\'", defined_ch_c_l_ );
+ exit( 1 );
+ }
+
+ p->score_l_ = score_l;
+
+ for (iter_top(music_,i); i.ok(); i++) {
+ Voice_list vl = i->convert();
+ p->add(vl);
+ }
+ 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.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
+Input_staff::print() const
+{
+#ifndef NPRINT
+ mtor << "Input_staff {\n";
+ 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_;
+}
+++ /dev/null
-#include "debug.hh"
-#include "inputmusic.hh"
-#include "voice.hh"
-#include "musicalrequest.hh"
-
-void
-Input_music::check_plet(Voice_element* velt_l)
-{
- for (iter_top(velt_l->reqs,i); i.ok(); i++)
- if ( i->plet() ) {
- Moment start_moment = 0;
- if ( !find_plet_start_bo( i->plet()->type_c_, start_moment ) ) {
- error( "begin of plet not found", i->defined_ch_c_l_ );
- break;
- }
- Moment moment = 0;
- set_plet_backwards( moment, start_moment, i->plet()->dur_i_, i->plet()->type_i_ );
- i.del();
- break;
- }
-}
-
-void
-Simple_music::add(Voice_element*v)
-{
- voice_.add(v);
-}
-
-Moment
-Simple_music::length()const
-{
- return voice_.last();
-}
-void
-Simple_music::translate_time(Moment t)
-{
- voice_.start += t;
-}
-
-Voice_list
-Simple_music::convert()const
-{
- Voice_list l;
- l.bottom().add(new Voice(voice_));
- return l;
-}
-
-
-void
-Simple_music::print() const
-{
- mtor << "Simple_music {";
- voice_.print();
- mtor << "}\n";
-}
-bool
-Simple_music::find_plet_start_bo(char c, Moment& moment_r)
-{
- return voice_.find_plet_start_bo(c, moment_r);
-}
-void
-Simple_music::set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i)
-{
- voice_.set_plet_backwards(now_moment_r, until_moment, num_i, den_i);
-}
-
-/* *************** */
-
-void
-Complex_music::add(Input_music*v)
-{
- elts.bottom().add(v);
-}
-
-void
-Complex_music::print() const
-{
- for (iter_top(elts,i); i.ok(); i++)
- i->print();
-}
-
-void
-Complex_music::concatenate(Complex_music*h)
-{
- for (iter_top(h->elts,i); i.ok(); i++)
- add(i->clone());
-}
-
-Complex_music::Complex_music()
-{
-}
-
-Complex_music::Complex_music(Complex_music const&s)
-{
- for (iter_top(s.elts,i); i.ok(); i++)
- add(i->clone());
-}
-void
-Complex_music::set_default_group(String g)
-{
- for (iter_top(elts,i); i.ok(); i++)
- i->set_default_group(g);
-}
-bool
-Complex_music::find_plet_start_bo(char c, Moment& moment_r)
-{
- for (iter_bot(elts,i); i.ok(); i--) {
- if ( i->find_plet_start_bo(c, moment_r) )
- return true;
- }
- return false;
-}
-void
-Complex_music::set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i)
-{
- for (iter_bot(elts,i); i.ok(); i--) {
- i->set_plet_backwards(now_moment_r, until_moment, num_i, den_i);
- }
-}
-/* *************************************************************** */
-
-void
-Music_voice::print() const
-{
- mtor << "Music_voice {";
- Complex_music::print();
- mtor << "}\n";
-}
-
-void
-Music_voice::add_elt(Voice_element*v)
-{
- PCursor<Input_music*> c(elts.bottom());
- if (!c.ok() || !c->simple()) {
- Simple_music*vs = new Simple_music;
-
- c.add(vs);
- }
-
- c = elts.bottom();
- Simple_music *s = c->simple();
- s->add(v);
-
- check_plet(v);
-}
-
-Moment
-Music_voice::length()const
-{
- Moment l = 0;
-
- for (iter_top(elts,i); i.ok(); i++)
- l += i->length();
- return l;
-}
-
-
-Voice_list
-Music_voice::convert()const
-{
- Voice_list l;
- Moment here = 0;
-
- for (iter_top(elts,i); i.ok(); i++) {
- Moment len = i->length();
- Voice_list k(i->convert());
- k.translate_time(here);
- l.concatenate(k);
- here +=len;
- }
- return l;
-}
-
-void
-Music_voice::translate_time(Moment t)
-{
- elts.bottom()->translate_time(t);
-}
-
-
-
-/* *************** */
-
-void
-Music_general_chord::add_elt(Voice_element*v)
-{
- Simple_music*vs = new Simple_music;
- vs->add(v);
- elts.bottom().add(vs);
-
- check_plet(v);
-}
-
-void
-Music_general_chord::print() const
-{
- mtor << "Music_general_chord {";
- Complex_music::print();
- mtor << "}\n";
-}
-
-void
-Music_general_chord::translate_time(Moment t)
-{
- for (iter_top(elts,i); i.ok(); i++)
- i->translate_time(t);
-}
-
-Moment
-Music_general_chord::length()const
-{
- Moment l =0;
-
- for (iter_top(elts,i); i.ok(); i++)
- l = l >? i->length();
- return l;
-}
-
-Voice_list
-Music_general_chord::convert()const
-{
- Voice_list l;
- for (iter_top(elts,i); i.ok(); i++) {
- Voice_list k(i->convert());
- l.concatenate(k);
- }
- return l;
-}
-
-/* *************** */
-
-void
-Multi_voice_chord::set_default_group(String g)
-{
- int j=0;
- for (iter_top(elts, i); i.ok(); i++) {
- i->set_default_group(g + String(j));
- j++;
- }
-}
-
-
-/* *************** */
-
-void
-Voice_list::translate_time(Moment x)
-{
- for (iter_top(*this,i); i.ok(); i++)
- i->start += x;
-}
-
+++ /dev/null
-/*
- inputscore.cc -- implement Input_score
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#include "debug.hh"
-#include "inputscore.hh"
-#include "inputstaff.hh"
-#include "inputmusic.hh"
-#include "score.hh"
-#include "paperdef.hh"
-#include "mididef.hh"
-#include "staff.hh"
-
-
-void
-Input_score::add(Input_staff*s)
-{
- staffs_.bottom().add(s);
-}
-
-void
-Input_score::set(Paperdef*p)
-{
- delete paper_p_;
- paper_p_ = p;
-}
-
-void
-Input_score::set(Midi_def* midi_p)
-{
- delete midi_p_;
- midi_p_ = midi_p;
-}
-
-Input_score::Input_score(Input_score const&s)
-{
- paper_p_ = (s.paper_p_)? new Paperdef(*s.paper_p_) :0;
- midi_p_ = (s.midi_p_)? new Midi_def(*s.midi_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()
-{
- Score *s_p = new Score;
- s_p->defined_ch_c_l_= defined_ch_c_l_;
- s_p->errorlevel_i_ = errorlevel_i_;
- if (midi_p_)
- s_p->set(new Midi_def(*midi_p_));
- if (paper_p_)
- s_p->set( new Paperdef(*paper_p_));
-
- for (iter_top(staffs_,i); i.ok(); i++) {
- Staff* staf_p=i->parse(s_p, score_wide_music_p_);
- s_p->add(staf_p);
- }
-
- 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_p_;
- delete score_wide_music_p_;
- delete midi_p_;
-}
-
-Input_score::Input_score()
-{
- score_wide_music_p_ =0;
- defined_ch_c_l_=0;
- paper_p_= 0;
- midi_p_ = 0;
- errorlevel_i_ = 0;
-}
-
-void
-Input_score::print()const
-{
-#ifndef NPRINT
- mtor << "Input_score {\n";
- for (iter_top(staffs_,i); i.ok(); i++) {
- i->print();
- }
- mtor << "}\n";
-#endif
-}
+++ /dev/null
-/*
- inputstaff.cc -- implement Input_staff
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#include "debug.hh"
-#include "score.hh"
-#include "inputmusic.hh"
-#include "inputstaff.hh"
-#include "staff.hh"
-#include "complexstaff.hh"
-#include "lyricstaff.hh"
-
-#include "lexer.hh"
-
-
-Input_staff::Input_staff(String s)
-{
- score_wide_music_p_ =0;
- type= s;
- defined_ch_c_l_ = 0;
-}
-
-void
-Input_staff::add(Input_music*m)
-{
- music_.bottom().add(m);
-}
-
-Staff*
-Input_staff::parse(Score*score_l, Input_music *default_score_wide)
-{
- Staff *p=0;
- if (type == "melodic")
- p = new Complex_staff;
- else if (type == "lyric")
- p = new Lyric_staff;
- else {
- error( "Unknown staff-type `" + type +"\'", defined_ch_c_l_ );
- exit( 1 );
- }
-
- p->score_l_ = score_l;
-
- for (iter_top(music_,i); i.ok(); i++) {
- Voice_list vl = i->convert();
- p->add(vl);
- }
- 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.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
-Input_staff::print() const
-{
-#ifndef NPRINT
- mtor << "Input_staff {\n";
- 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 "debug.hh"
#include "item.hh"
-NAME_METHOD(Item);
+
Item::Item()
{
--- /dev/null
+#include "key-item.hh"
+#include "key.hh"
+#include "debug.hh"
+#include "molecule.hh"
+#include "paper-def.hh"
+#include "lookup.hh"
+//#include "clef-reg.hh"
+#include "key-reg.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 */
+
+
+
+Key_item::Key_item(int c)
+{
+ set_c_position(c);
+}
+
+void
+Key_item::read(const Key_register& key_reg_r)
+{
+ 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
+Key_item::set_c_position(int c0)
+{
+ int octaves =(abs(c0) / 7) +1 ;
+ c_position=(c0 + 7*octaves)%7;
+}
+
+
+void
+Key_item::add(int p, int a)
+{
+ if ((a<0 && p>FLAT_TOP_PITCH) ||
+ (a>0 && p>SHARP_TOP_PITCH)) {
+ p -= 7; /* Typeset below c_position */
+ }
+ pitch.push(p);
+ acc.push(a);
+}
+
+
+Molecule*
+Key_item::brew_molecule_p()const
+{
+ Molecule*output = new Molecule;
+ Real inter = paper()->internote();
+
+ for (int i =0; i < pitch.size(); i++) {
+ Symbol s= paper()->lookup_p_->accidental(acc[i]);
+ Atom a(s);
+ a.translate(Offset(0,(c_position + pitch[i]) * inter));
+ Molecule m(a);
+ output->add_right(m);
+ }
+ Molecule m(paper()->lookup_p_->fill(Box(
+ Interval(0, paper()->note_width()),
+ Interval(0,0))));
+ output->add_right(m);
+ return output;
+}
--- /dev/null
+/*
+ key-reg.cc -- implement Key_register
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+
+ todo: key undo
+
+ */
+#include "time-description.hh"
+#include "key-reg.hh"
+#include "key-item.hh"
+#include "commandrequest.hh"
+#include "staff-column.hh"
+#include "local-key-reg.hh"
+#include "musicalrequest.hh"
+
+Key_register::Key_register()
+{
+ post_move_processing();
+}
+
+bool
+Key_register::try_request(Request * req_l)
+{
+ Command_req* creq_l= req_l->command();
+ if (!creq_l|| !creq_l->keychange())
+ return false;
+
+ assert(!keyreq_l_); // todo
+ keyreq_l_ = creq_l->keychange();
+ read_req(keyreq_l_);
+ return true;
+}
+
+void
+Key_register::acknowledge_element(Staff_elem_info info)
+{
+ Command_req * r_l = info.req_l_->command() ;
+ if (r_l && r_l->clefchange() && !kit_p_) {
+ int c0_i= *get_staff_info().c0_position_i_;
+ kit_p_ = new Key_item(c0_i);
+ kit_p_->read(*this);
+ announce_element(Staff_elem_info(kit_p_, keyreq_l_));
+ }
+}
+
+void
+Key_register::process_requests()
+{
+ const Time_description *time_l = get_staff_info().time_c_l_;
+
+ if (!keyreq_l_ &&
+ (!time_l->whole_in_measure_|| !time_l->when_)) {
+ default_key_b_ = true;
+ }
+
+ if ( default_key_b_ || keyreq_l_) {
+ int c0_i= *get_staff_info().c0_position_i_;
+ kit_p_ = new Key_item(c0_i);
+ kit_p_->read(*this);
+ announce_element(Staff_elem_info(kit_p_, keyreq_l_));
+ }
+}
+
+void
+Key_register::pre_move_processing()
+{
+ 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::post_move_processing()
+{
+ keyreq_l_ = 0;
+ default_key_b_ = false;
+ kit_p_ = 0;
+}
+++ /dev/null
-#include "keyitem.hh"
-#include "key.hh"
-#include "debug.hh"
-#include "molecule.hh"
-#include "paperdef.hh"
-#include "lookup.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(Key_item);
-
-Key_item::Key_item(int c)
-{
- set_c_position(c);
-}
-
-void
-Key_item::read(const Key_register& key_reg_r)
-{
- 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
-Key_item::set_c_position(int c0)
-{
- int octaves =(abs(c0) / 7) +1 ;
- c_position=(c0 + 7*octaves)%7;
-}
-
-
-void
-Key_item::add(int p, int a)
-{
- if ((a<0 && p>FLAT_TOP_PITCH) ||
- (a>0 && p>SHARP_TOP_PITCH)) {
- p -= 7; /* Typeset below c_position */
- }
- pitch.push(p);
- acc.push(a);
-}
-
-
-Molecule*
-Key_item::brew_molecule_p()const
-{
- Molecule*output = new Molecule;
- Real inter = paper()->internote();
-
- for (int i =0; i < pitch.size(); i++) {
- Symbol s= paper()->lookup_p_->accidental(acc[i]);
- Atom a(s);
- a.translate(Offset(0,(c_position + pitch[i]) * inter));
- Molecule m(a);
- output->add_right(m);
- }
- Molecule m(paper()->lookup_p_->fill(Box(
- Interval(0, paper()->note_width()),
- Interval(0,0))));
- output->add_right(m);
- return output;
-}
+++ /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 "staffcolumn.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->command()->keychange())
- return false;
- assert(!keyreq_l_); // todo
- keyreq_l_ = req_l->command()->keychange();
- read_req(keyreq_l_);
- return true;
-}
-
-void
-Key_register::acknowledge_element(Staff_elem_info info)
-{
- Command_req * r_l = info.req_l_->command() ;
- if (r_l && r_l->clefchange() && !kit_p_) {
- 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::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;
-}
#include "varray.hh"
#include "parser.hh"
#include "debug.hh"
-#include "inputscore.hh"
+#include "input-score.hh"
#include "parseconstruct.hh"
#include "main.hh"
+#include "string-convert.hh"
%}
#include "lexer.hh"
#include "debug.hh"
#include "main.hh"
-#include "sourcefile.hh"
+#include "source-file.hh"
#include "source.hh"
My_flex_lexer *lexer=0;
#include "string.hh"
#include "moment.hh"
-#include "sourcefile.hh"
+#include "source-file.hh"
#include "source.hh"
#include "midi-main.hh" // *tors
--- /dev/null
+#include "local-key-item.hh"
+#include "molecule.hh"
+#include "scalar.hh"
+#include "lookup.hh"
+#include "paper-def.hh"
+#include "musicalrequest.hh"
+#include "notehead.hh"
+#include "misc.hh"
+
+
+
+Local_key_item::Local_key_item(int i)
+{
+ c0_position = i;
+}
+
+void
+Local_key_item::add(Item*head_l)
+{
+ support_items_.push(head_l);
+ add_dependency(head_l);
+}
+
+void
+Local_key_item::add(Melodic_req*m_l)
+{
+ add(m_l->octave_i_, m_l->notename_i_, m_l->accidental_i_);
+}
+void
+Local_key_item::add (int o, int p , int a)
+{
+ Local_acc l;
+ l.octave = o;
+ l.name = p;
+ l.acc = a;
+ accs.push(l);
+}
+
+void
+Local_key_item::do_pre_processing()
+{
+ accs.sort(Local_acc::compare);
+}
+
+Molecule*
+Local_key_item::brew_molecule_p()const
+{
+ Molecule* output = new Molecule;
+ Molecule*octmol = 0;
+ int lastoct = -100;
+ for (int i = 0; i < accs.size(); i++) {
+ // do one octave
+ if (accs[i].octave != lastoct) {
+ if (octmol){
+ Real dy =lastoct*7*paper()->internote();
+ octmol->translate(Offset(0, dy));
+ output->add(*octmol);
+ delete octmol;
+ }
+ octmol= new Molecule;
+ }
+ lastoct = accs[i].octave;
+ Symbol s =paper()->lookup_p_->accidental(accs[i].acc);
+ Atom a(s);
+ Real dy = (accs[i].name + c0_position) * paper()->internote();
+ a.translate(Offset(0,dy));
+
+ octmol->add_right(a);
+ }
+
+ if (octmol){
+ Real dy =lastoct*7*paper()->internote();
+ octmol->translate(Offset(0, dy));
+ output->add(*octmol);
+ delete octmol;
+ }
+
+ Interval head_width=itemlist_width(support_items_);
+ output->translate(Offset(-output->extent().x.right + head_width.left ,0));
+
+ return output;
+}
+
+int
+Local_acc::compare(Local_acc&a, Local_acc&b)
+{
+ if (a.octave - b.octave)
+ return a.octave - b.octave;
+ if (a.name - b.name)
+ return a.name - b.name;
+
+ assert(false);
+};
--- /dev/null
+/*
+ local-key-reg.cc -- implement Local_key_register
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "musicalrequest.hh"
+#include "commandrequest.hh"
+#include "local-key-reg.hh"
+#include "local-key-item.hh"
+#include "complex-walker.hh"
+#include "key-reg.hh"
+#include "debug.hh"
+#include "key-item.hh"
+
+Local_key_register::Local_key_register()
+{
+ key_item_p_ = 0;
+ key_c_l_ = 0;
+}
+
+void
+Local_key_register::pre_move_processing()
+{
+ if (key_item_p_) {
+ typeset_element(key_item_p_);
+ key_item_p_ = 0;
+ }
+}
+void
+Local_key_register::acknowledge_element(Staff_elem_info info)
+{
+ if (info.req_l_->melodic()) {
+ Melodic_req * melodic_l_ = info.req_l_->melodic();
+
+ if( melodic_l_->forceacc_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(*get_staff_info().c0_position_i_);
+ }
+
+ key_item_p_->add(melodic_l_);
+ key_item_p_->add(support_l_);
+ local_key_.oct(melodic_l_->octave_i_)
+ .set(melodic_l_->notename_i_, melodic_l_->accidental_i_);
+ }
+ } else if (info.elem_p_->name()==Key_item::static_name()) {
+ Key_register * key_reg_l =
+ (Key_register*)info.origin_reg_l_arr_[0];
+ key_c_l_ = &key_reg_l->key_;
+ local_key_.reset(*key_c_l_);
+ }
+}
+
+void
+Local_key_register::process_requests()
+{
+ const Time_description * time_c_l_ = get_staff_info().time_c_l_;
+ if (! time_c_l_->whole_in_measure_){
+ if (key_c_l_)
+ local_key_.reset(*key_c_l_);
+ else if( time_c_l_->when_ >0)
+ warning ("Help me! can't figure current key", 0);
+ }
+}
+++ /dev/null
-#include "localkeyitem.hh"
-#include "molecule.hh"
-#include "scalar.hh"
-#include "lookup.hh"
-#include "paperdef.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)
-{
- support_items_.push(head_l);
- add_depedency(head_l);
-}
-
-void
-Local_key_item::add(Melodic_req*m_l)
-{
- add(m_l->octave_i_, m_l->notename_i_, m_l->accidental_i_);
-}
-void
-Local_key_item::add (int o, int p , int a)
-{
- Local_acc l;
- l.octave = o;
- l.name = p;
- l.acc = a;
- accs.push(l);
-}
-
-void
-Local_key_item::do_pre_processing()
-{
- accs.sort(Local_acc::compare);
-}
-
-Molecule*
-Local_key_item::brew_molecule_p()const
-{
- Molecule* output = new Molecule;
- Molecule*octmol = 0;
- int lastoct = -100;
- for (int i = 0; i < accs.size(); i++) {
- // do one octave
- if (accs[i].octave != lastoct) {
- if (octmol){
- Real dy =lastoct*7*paper()->internote();
- octmol->translate(Offset(0, dy));
- output->add(*octmol);
- delete octmol;
- }
- octmol= new Molecule;
- }
- lastoct = accs[i].octave;
- Symbol s =paper()->lookup_p_->accidental(accs[i].acc);
- Atom a(s);
- Real dy = (accs[i].name + c0_position) * paper()->internote();
- a.translate(Offset(0,dy));
-
- octmol->add_right(a);
- }
-
- if (octmol){
- Real dy =lastoct*7*paper()->internote();
- octmol->translate(Offset(0, dy));
- output->add(*octmol);
- delete octmol;
- }
-
- Interval head_width=itemlist_width(support_items_);
- output->translate(Offset(-output->extent().x.right + head_width.left ,0));
-
- return output;
-}
-
-int
-Local_acc::compare(Local_acc&a, Local_acc&b)
-{
- if (a.octave - b.octave)
- return a.octave - b.octave;
- if (a.name - b.name)
- return a.name - b.name;
-
- assert(false);
-};
+++ /dev/null
-/*
- localkeyreg.cc -- implement Local_key_register
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-#include "musicalrequest.hh"
-#include "commandrequest.hh"
-#include "localkeyreg.hh"
-#include "localkeyitem.hh"
-#include "complexwalker.hh"
-#include "keyreg.hh"
-#include "debug.hh"
-
-Local_key_register::Local_key_register(Complex_walker*w)
- : Request_register(w)
-{
- key_item_p_ = 0;
- key_c_l_ = 0;
-}
-
-void
-Local_key_register::do_pre_move_process()
-{
- if (key_item_p_) {
- walk_l_->typeset_element(key_item_p_);
- key_item_p_ = 0;
- }
-}
-void
-Local_key_register::acknowledge_element(Staff_elem_info info)
-{
- if (info.req_l_->melodic()) {
- Melodic_req * melodic_l_ = info.req_l_->melodic();
-
- if( melodic_l_->forceacc_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_->c0_position_i());
- }
-
- key_item_p_->add(melodic_l_);
- key_item_p_->add(support_l_);
- local_key_.oct(melodic_l_->octave_i_)
- .set(melodic_l_->notename_i_, melodic_l_->accidental_i_);
- }
- } else if (info.req_l_->command() &&
- info.req_l_->command()->keychange()) {
- Key_register * key_reg_l = (Key_register*)info.origin_reg_l_;
- key_c_l_ = &key_reg_l->key_;
- local_key_.reset(*key_c_l_);
- }
-}
-
-void
-Local_key_register::process_request()
-{
- if (!walk_l_->time_.whole_in_measure_) {
- if (key_c_l_)
- local_key_.reset(*key_c_l_);
- else if( walk_l_->when() >0)
- warning ("Help me! can't figure current key", 0);
- }
-}
+/*
+ lookup.cc -- implement simple Lookup methods.
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
#include "lookup.hh"
#include "debug.hh"
#include "symtable.hh"
symtables_->add(s, p);
}
+void
+Lookup::print()const
+{
+ mtor << "Lookup: " << texsetting << " {\n";
+ symtables_->print();
+ mtor << "}\n";
+}
+
Symbol
Lookup::text(String style, String text, int dir)
{
return s;
}
-/* *************** */
Real
Lookup::internote()
--- /dev/null
+#include "musicalrequest.hh"
+#include "paper-def.hh"
+#include "lyric-item.hh"
+#include "stem.hh"
+#include "molecule.hh"
+#include "lookup.hh"
+#include "text-def.hh"
+#include "source-file.hh"
+#include "source.hh"
+#include "debug.hh"
+#include "main.hh"
+
+Lyric_item::Lyric_item(Lyric_req* lreq_l, int voice_count_i)
+ : Text_item(lreq_l,0)
+{
+ pos_i_ = -voice_count_i * 4 ; // 4 fontsize dependant. TODO
+ dir_i_ = -1;
+}
+
+void
+Lyric_item::do_pre_processing()
+{
+
+ // test context-error
+ if ( tdef_l_->text_str_.index_i( "Gates" ) >=0)// :-)
+ warning( "foul word", tdef_l_->defined_ch_c_l_ );
+}
+++ /dev/null
-#include "musicalrequest.hh"
-#include "paperdef.hh"
-#include "lyricitem.hh"
-#include "stem.hh"
-#include "molecule.hh"
-#include "lookup.hh"
-#include "textdef.hh"
-#include "sourcefile.hh"
-#include "source.hh"
-#include "debug.hh"
-#include "main.hh"
-
-Lyric_item::Lyric_item(Lyric_req* lreq_l, int voice_count_i)
- : Text_item(lreq_l,0)
-{
- pos_i_ = -voice_count_i * 4 ; // 4 fontsize dependant. TODO
- dir_i_ = -1;
-}
-
-void
-Lyric_item::do_pre_processing()
-{
- // override Text_item
-
- // test context-error
- if ( tdef_l_->text_str_.index_i( "Gates" ) )// :-)
- warning( "foul word", tdef_l_->defined_ch_c_l_ );
-}
#include "musicalrequest.hh"
#include "voice.hh"
-#include "staffwalker.hh"
+#include "staff-walker.hh"
#include "debug.hh"
#include "staff.hh"
#include "lyricstaff.hh"
#include "lyricstaff.hh"
#include "lyricwalker.hh"
#include "debug.hh"
-#include "lyricitem.hh"
-#include "staffcolumn.hh"
+#include "lyric-item.hh"
+#include "staff-column.hh"
void
Lyric_walker::process_requests()
#include "main.hh"
#include "path.hh"
#include "config.hh"
-#include "sourcefile.hh"
+#include "source-file.hh"
#include "source.hh"
Source source;
void
destill_inname( String &name_str_r);
-long_option_init theopts[] = {
+Long_option_init theopts[] = {
1, "output", 'o',
0, "warranty", 'w',
0, "help", 'h',
cout << get_version();
String init_str("symbol.ini");
- while (long_option_init * opt = oparser()) {
+ while (Long_option_init * opt = oparser()) {
switch ( opt->shortname){
case 'o':
set_default_output(oparser.optarg);
--- /dev/null
+/*
+ meter-reg.cc -- implement Meter_register
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "meter-reg.hh"
+#include "meter.hh"
+#include "commandrequest.hh"
+
+Meter_register::Meter_register()
+
+{
+ post_move_processing();
+}
+
+bool
+Meter_register::try_request(Request*r_l)
+{
+ Command_req* creq_l= r_l->command();
+ if (!creq_l || !creq_l->meterchange())
+ return false;
+
+ assert(!meter_req_l_);
+ meter_req_l_ = r_l->command()->meterchange();
+
+ return true;
+}
+
+void
+Meter_register::process_requests()
+{
+ 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_) );
+}
+
+void
+Meter_register::pre_move_processing()
+{
+ 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::post_move_processing()
+{
+ meter_req_l_ = 0;
+ meter_p_ =0;
+}
#include "scalar.hh"
#include "molecule.hh"
#include "meter.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
#include "lookup.hh"
-NAME_METHOD(Meter);
+
Meter::Meter(Array<Scalar>a)
:args(a)
{
+++ /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->command()->meterchange())
- return false;
-
- assert(!meter_req_l_);
- meter_req_l_ = r_l->command()->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 "plist.hh" // all for midi-main.hh
#include "string.hh"
#include "source.hh"
-#include "sourcefile.hh"
+#include "source-file.hh"
#include "midi-main.hh" // *tors
#include "moment.hh"
#include "duration.hh"
#include "string.hh"
#include "lgetopt.hh"
#include "source.hh"
-#include "sourcefile.hh"
+#include "source-file.hh"
#include "midi-main.hh"
#include "moment.hh"
#include "duration.hh"
#include "string.hh"
#include "moment.hh"
#include "duration.hh"
-#include "sourcefile.hh"
+#include "source-file.hh"
#include "source.hh"
#include "midi-main.hh" // *tors
#include "midi-event.hh"
#include "plist.tcc"
#include "pcursor.tcc"
#include "string.hh"
-#include "sourcefile.hh"
+#include "source-file.hh"
#include "moment.hh"
#include "duration.hh"
#include "proto.hh"
#include "plist.hh"
#include "string.hh"
-#include "sourcefile.hh"
+#include "source-file.hh"
#include "source.hh"
#include "midi-main.hh" // *tors
// copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
#include "debug.hh"
-#include "inputfile.hh"
-#include "sourcefile.hh"
+#include "input-file.hh"
+#include "source-file.hh"
#include "my-midi-lexer.hh"
int
#include "plist.hh" // ugh
#include "string.hh"
-#include "sourcefile.hh"
+#include "source-file.hh"
#include "source.hh"
#include "midi-main.hh" // *tors
#include <strstream.h>
+
#include "interval.hh"
#include "identparent.hh"
-#include "associter.hh"
+#include "assoc-iter.hh"
#include "lexer.hh"
-#include "inputfile.hh"
+#include "input-file.hh"
#include "parser.hh"
#include "keyword.hh"
#include "assoc.hh"
#include "lexer.hh"
#include "debug.hh"
#include "notename.hh"
-#include "sourcefile.hh"
+#include "source-file.hh"
#include "parseconstruct.hh"
static Keyword_ent the_key_tab[]={
"goto", GOTO,
"in", IN_T,
"key", KEY,
-
"meter", METER,
"midi", MIDI,
"mm", MM_T,
char const* ch_c_l = here_ch_c_l();
if ( ch_c_l ) {
ch_c_l--;
- while ( ( *ch_c_l == ' ' ) || ( *ch_c_l == '\t' ) || ( *ch_c_l == '\n' ) )
+ while ( ( *ch_c_l == ' ' )
+ || ( *ch_c_l == '\t' ) || ( *ch_c_l == '\n' ) )
ch_c_l--;
ch_c_l++;
}
}
delete the_id_tab;
}
+void
+My_flex_lexer::print_declarations()const
+{
+ for (Assoc_iter<String,Identifier*> ai(*the_id_tab); ai.ok(); ai++) {
+ ai.val()->print();
+ }
+}
String
My_flex_lexer::spot()const
#include "notename.hh"
#include "identparent.hh"
#include "varray.hh"
-#include "textdef.hh"
+#include "text-def.hh"
#include "parseconstruct.hh"
-#include "inputmusic.hh"
+#include "input-music.hh"
+#include "voice-element.hh"
int default_duration = 4, default_dots=0, default_octave=0;
int default_plet_type = 1, default_plet_dur = 1;
#include "notehead.hh"
#include "dimen.hh"
#include "debug.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
#include "lookup.hh"
#include "molecule.hh"
#include "musicalrequest.hh"
-NAME_METHOD(Notehead);
+
Notehead::Notehead(int ss)
{
int
-Notehead::compare(Notehead*&a, Notehead*&b)
+Notehead::compare(Notehead *const &a, Notehead * const &b)
{
return a->position - b->position;
}
Molecule*
Notehead::brew_molecule_p() const return out;
{
- Paperdef *p = paper();
+ Paper_def *p = paper();
Real dy = p->internote();
Symbol s = p->lookup_p_->ball(balltype);
--- /dev/null
+#include <math.h>
+#include "misc.hh"
+#include "paper-def.hh"
+#include "debug.hh"
+#include "lookup.hh"
+#include "dimen.hh"
+
+
+
+// golden ratio
+const Real PHI = (1+sqrt(5))/2;
+
+// see Roelofs, p. 57
+Real
+Paper_def::duration_to_dist(Moment d)
+{
+ if (!d)
+ return 0;
+
+ return whole_width * pow(geometric_, log_2(d));
+}
+
+Real
+Paper_def::rule_thickness()const
+{
+ return 0.4 PT;
+}
+
+Paper_def::Paper_def(Lookup *l)
+{
+ lookup_p_ = l;
+ linewidth = 15 *CM_TO_PT; // in cm for now
+ whole_width = 8 * note_width();
+ geometric_ = sqrt(2);
+ outfile = "lelie.out";
+}
+
+Paper_def::~Paper_def()
+{
+ delete lookup_p_;
+}
+Paper_def::Paper_def(Paper_def const&s)
+{
+ lookup_p_ = new Lookup(*s.lookup_p_);
+ geometric_ = s.geometric_;
+ whole_width = s.whole_width;
+ outfile = s.outfile;
+ linewidth = s.linewidth;
+}
+
+void
+Paper_def::set(Lookup*l)
+{
+ assert(l != lookup_p_);
+ delete lookup_p_;
+ lookup_p_ = l;
+}
+
+Real
+Paper_def::interline() const
+{
+ return lookup_p_->ball(4).dim.y.length();
+}
+
+Real
+Paper_def::internote() const
+{
+ return lookup_p_->internote();
+}
+Real
+Paper_def::note_width()const
+{
+ return lookup_p_->ball(4).dim.x.length( );
+}
+Real
+Paper_def::standard_height() const
+{
+ return 20 PT;
+}
+
+void
+Paper_def::print() const
+{
+#ifndef NPRINT
+ mtor << "Paper {width: " << print_dimen(linewidth);
+ mtor << "whole: " << print_dimen(whole_width);
+ mtor << "out: " <<outfile;
+ lookup_p_->print();
+ mtor << "}\n";
+#endif
+}
+++ /dev/null
-#include <math.h>
-#include "misc.hh"
-#include "paperdef.hh"
-#include "debug.hh"
-#include "lookup.hh"
-#include "dimen.hh"
-
-
-
-// golden ratio
-const Real PHI = (1+sqrt(5))/2;
-
-// see Roelofs, p. 57
-Real
-Paperdef::duration_to_dist(Moment d)
-{
- if (!d)
- return 0;
-
- return whole_width * pow(geometric_, log_2(d));
-}
-
-Real
-Paperdef::rule_thickness()const
-{
- return 0.4 PT;
-}
-
-Paperdef::Paperdef(Lookup *l)
-{
- lookup_p_ = l;
- linewidth = 15 *CM_TO_PT; // in cm for now
- whole_width = 8 * note_width();
- geometric_ = sqrt(2);
- outfile = "lelie.out";
-}
-
-Paperdef::~Paperdef()
-{
- delete lookup_p_;
-}
-Paperdef::Paperdef(Paperdef const&s)
-{
- lookup_p_ = new Lookup(*s.lookup_p_);
- geometric_ = s.geometric_;
- whole_width = s.whole_width;
- outfile = s.outfile;
- linewidth = s.linewidth;
-}
-
-void
-Paperdef::set(Lookup*l)
-{
- assert(l != lookup_p_);
- delete lookup_p_;
- lookup_p_ = l;
-}
-
-Real
-Paperdef::interline() const
-{
- return lookup_p_->ball(4).dim.y.length();
-}
-
-Real
-Paperdef::internote() const
-{
- return lookup_p_->internote();
-}
-Real
-Paperdef::note_width()const
-{
- return lookup_p_->ball(4).dim.x.length( );
-}
-Real
-Paperdef::standard_height() const
-{
- return 20 PT;
-}
-
-void
-Paperdef::print() const
-{
-#ifndef NPRINT
- mtor << "Paper {width: " << print_dimen(linewidth);
- mtor << "whole: " << print_dimen(whole_width);
- mtor << "out: " <<outfile;
- mtor << "}\n";
-#endif
-}
#include "lookup.hh"
#include "misc.hh"
#include "lexer.hh"
-#include "paperdef.hh"
-#include "mididef.hh"
-#include "inputscore.hh"
+#include "paper-def.hh"
+#include "midi-def.hh"
+#include "input-score.hh"
#include "main.hh"
#include "keyword.hh"
#include "debug.hh"
#include "identifier.hh"
#include "commandrequest.hh"
#include "musicalrequest.hh"
+#include "voice-element.hh"
#ifndef NDEBUG
#define YYDEBUG 1
Array<Request*> pre_reqs, post_reqs;
Array<const char *> define_spots;
-Paperdef*default_paper();
+Paper_def*default_paper();
char const* defined_ch_c_l;
char const* req_defined_ch_c_l;
int fatal_error_i = 0;
Voice_element *el;
String *string;
const char *consstr;
- Paperdef *paper;
+ Paper_def *paper;
Midi_def* midi;
Input_music *music;
Music_general_chord *chord;
*mlog << "Parsing ... ";
lexer = new My_flex_lexer;
-#ifdef YYDEBUG
+#ifndef NDEBUG
yydebug = !monitor->silence("InitParser") && check_debug;
lexer->set_debug( !monitor->silence("InitLexer") && check_debug);
#endif
lexer->new_input(init);
+
yyparse();
-#ifdef YYDEBUG
+#ifndef NDEBUG
+ if (check_debug && !monitor->silence("InitDeclarations"))
+ lexer->print_declarations();
+
yydebug = !monitor->silence("Parser") && check_debug;
lexer->set_debug( !monitor->silence("Lexer") && check_debug);
#endif
warning("Braces don't match.",0);
}
-Paperdef*
+Paper_def*
default_paper()
{
- return new Paperdef(
+ return new Paper_def(
lexer->lookup_identifier("default_table")->lookup(true));
}
#include "debug.hh"
#include "lookup.hh"
#include "spanner.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
#include "molecule.hh"
#include "dimen.hh"
#include "scoreline.hh"
#include "pscore.hh"
-#include "tstream.hh"
+#include "tex-stream.hh"
#include "item.hh"
#include "break.hh"
{
for (iter_top(cols,c); c.ok(); )
if (!c->used_b()) {
- delete c.get();
+ delete c.get_p();
} else
c++;
}
cols.bottom().add(p);
}
-PScore::PScore( Paperdef*p)
+PScore::PScore( Paper_def*p)
{
paper_l_ = p;
}
#include "musicalrequest.hh"
#include "register.hh"
#include "notehead.hh"
-#include "complexwalker.hh"
-#include "localkeyitem.hh"
-#include "complexstaff.hh"
+#include "complex-walker.hh"
+#include "local-key-item.hh"
+#include "complex-staff.hh"
+#include "registergroup.hh"
+#include "debug.hh"
bool
Request_register::Request_register()
{
- walk_l_=0;
-}
-
-Request_register::Request_register(Complex_walker*w_l)
-{
- walk_l_=w_l;
-}
-
-void
-Request_register::pre_move_processing()
-{
- do_pre_move_process();
- accepted_req_arr_.set_size(0);
-}
-void
-Request_register::post_move_processing()
-{
- do_post_move_process();
-}
-
-Request_register::Request_register(Request_register const&)
-{
- assert(false);
+ daddy_reg_l_ = 0;
}
void
Request_register::announce_element(Staff_elem_info i)
{
- walk_l_->announce_element(i);
+ i.origin_reg_l_arr_.push(this);
+ daddy_reg_l_->announce_element(i);
}
void
Request_register::typeset_element(Staff_elem*p)
{
- walk_l_->typeset_element(p);
+ daddy_reg_l_->typeset_element(p);
}
-Paperdef*
+Paper_def*
Request_register::paper()const
{
- return walk_l_->staff()->paper();
+ return daddy_reg_l_->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);
+ daddy_reg_l_->typeset_breakable_item(pre_p, nobreak_p, post_p);
}
bool
{
return false;
}
+
+bool
+Request_register::contains_b(Request_register *reg_l)
+{
+ return this == reg_l;
+}
+
+Staff_info
+Request_register::get_staff_info() return inf;
+{
+ inf = daddy_reg_l_->get_staff_info();
+}
+
+void
+Request_register::print() const
+{
+#ifndef NPRINT
+ mtor << name() << " {";
+ do_print();
+ mtor << "}\n";
+#endif
+}
+
+void
+Request_register::do_print()const
+{
+}
/*
- registergroup.cc -- implement Register_group
+ registergroup.cc -- implement Register_group_register
source file of the LilyPond music typesetter
#include "register.hh"
bool
-Register_group::acceptable_request_b(Request* r)
+Register_group_register::acceptable_request_b(Request* r)
{
for (iter_top(reg_list_, i); i.ok(); i++) {
if (i->acceptable_request_b(r))
}
void
-Register_group::set_dir(int d)
+Register_group_register::set_feature(Features d)
{
for (iter_top(reg_list_, i); i.ok(); i++) {
- i->set_dir(d);
+ i->set_feature(d);
}
}
void
-Register_group::pre_move_processing()
+Register_group_register::pre_move_processing()
{
for (iter_top(reg_list_, i); i.ok(); i++)
i->pre_move_processing();
}
void
-Register_group::process_requests()
+Register_group_register::process_requests()
{
for (iter_top(reg_list_, i); i.ok(); i++)
- i->process_request();
+ i->process_requests();
}
void
-Register_group::post_move_processing()
+Register_group_register::post_move_processing()
{
for (iter_top(reg_list_, i); i.ok(); i++)
i->post_move_processing();
}
void
-Register_group::acknowledge_element(Staff_elem_info info)
+Register_group_register::acknowledge_element(Staff_elem_info info)
{
+ if (!contains_b(info.origin_reg_l_arr_[0]))
+ return;
+
for (iter_top(reg_list_, i); i.ok(); i++)
i->acknowledge_element(info);
}
-
bool
-Register_group::contains_b(Request_register* reg_l)
+Register_group_register::contains_b(Request_register* reg_l)
{
- for (iter_top(reg_list_, i); i.ok(); i++)
- if (i.ptr() == reg_l)
+ bool parent_b = Request_register::contains_b(reg_l);
+
+ if (parent_b)
+ return true;
+ for (iter_top(reg_list_, j); j.ok(); j++)
+ if (j->contains_b(reg_l))
return true;
- return false;
+ return false;
}
+
bool
-Register_group::try_request(Request*req_l)
+Register_group_register::try_request(Request*req_l)
{
for (iter_top(reg_list_, i); i.ok(); i++)
if (i->try_request(req_l))
return false;
}
-
-
void
-Register_group::add(Request_register *reg_p)
+Register_group_register::add(Request_register *reg_p)
{
reg_list_.bottom().add(reg_p);
+ reg_p->daddy_reg_l_ = this;
+}
+
+
+Register_group_register::~Register_group_register()
+{
+
+}
+
+Request_register *
+Register_group_register::get_register_p(Request_register*reg_l)
+{
+ iterator(reg_list_) reg_cur= reg_list_.find(reg_l);
+ assert(reg_cur.ok());
+ return reg_cur.get_p();
+}
+
+void
+Register_group_register::terminate_register(Request_register*r_l)
+{
+ delete get_register_p(r_l);
}
-Register_group::~Register_group()
+void
+Register_group_register::do_print()const
{
+#ifndef NPRINT
+ for (iter_top(reg_list_, i); i.ok(); i++)
+ i->print();
+#endif
}
#include "musicalrequest.hh"
#include "misc.hh"
#include "debug.hh"
-#include "scriptdef.hh"
-#include "textdef.hh"
+#include "script-def.hh"
+#include "text-def.hh"
+#include "voice.hh"
+#include "voice-element.hh"
void
Stem_req::do_print() const
mtor << "duration: " << duration();
}
+Voice *
+Request::voice_l()
+{
+ if (!elt_l_)
+ return 0;
+ else
+ return (Voice*)elt_l_->voice_l_;
+}
#include "rest.hh"
#include "dimen.hh"
#include "debug.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
#include "lookup.hh"
#include "molecule.hh"
balltype = t;
dots = d;
}
-NAME_METHOD(Rest);
+
void
Rest::do_print()const
Molecule*
Rest::brew_molecule_p()const
{
- Paperdef *p =paper();
+ Paper_def *p =paper();
Symbol s;
s = p->lookup_p_->rest(balltype);
--- /dev/null
+/*
+ score-column.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 "score-column.hh"
+
+int
+Score_column::compare(Score_column & c1, Score_column &c2)
+{
+ return sign(c1.when_ - c2.when_);
+}
+
+void
+Score_column::set_breakable()
+{
+ pcol_l_->set_breakable();
+}
+
+Score_column::Score_column(Moment w)
+{
+ when_ = w;
+ pcol_l_ = new PCol(0);
+ musical_b_ = false;
+}
+
+bool
+Score_column::used_b() {
+ return pcol_l_->used_b();
+}
+
+void
+Score_column::print() const
+{
+#ifndef NPRINT
+ mtor << "Score_column { mus "<< musical_b_ <<" at " << when_<<'\n';
+ mtor << "durations: [";
+ for (int i=0; i < durations.size(); i++)
+ mtor << durations[i] << " ";
+ mtor << "]\n";
+ pcol_l_->print();
+ mtor << "}\n";
+#endif
+}
+
+int
+Moment_compare(Moment &a , Moment& b)
+{
+ return sign(a-b);
+}
+
+void
+Score_column::preprocess()
+{
+ durations.sort(Moment_compare);
+}
+void
+Score_column::add_duration(Moment d)
+{
+ assert(d);
+ for (int i = 0; i< durations.size(); i++) {
+ if (d == durations[i])
+ return ;
+ }
+ durations.push(d);
+}
+
+bool
+Score_column::breakable_b()
+{
+ return pcol_l_->breakable_b();
+}
--- /dev/null
+/*
+ score-walker.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 "score-walker.hh"
+#include "score.hh"
+#include "staff-walker.hh"
+#include "staff.hh"
+#include "score-column.hh"
+
+Score_walker::Score_walker(Score *s)
+ :PCursor<Score_column *> (s->cols_)
+{
+ score_l_ = s;
+ 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];
+ assert( !score_l_->find_col(score_l_->last(), true)->used_b());
+}
+
+
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
-#include "tstream.hh"
+#include "tex-stream.hh"
#include "score.hh"
-#include "scorecolumn.hh"
+#include "score-column.hh"
#include "pscore.hh"
#include "staff.hh"
#include "debug.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
#include "main.hh"
#include "source.hh"
-#include "sourcefile.hh"
-#include "scorewalker.hh"
-#include "midioutput.hh"
-#include "mididef.hh"
+#include "source-file.hh"
+#include "score-walker.hh"
+#include "midi-output.hh"
+#include "midi-def.hh"
extern String default_out_fn;
for (iter_top(cols_,c); c.ok(); ) {
if (!c->pcol_l_->used_b()) {
- delete c.get();
+ delete c.get_p();
} else {
c->preprocess();
c++;
}
void
-Score::set(Paperdef *pap_p)
+Score::set(Paper_def *pap_p)
{
delete paper_p_;
paper_p_ = pap_p;
+++ /dev/null
-/*
- scorecolumn.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 "scorecolumn.hh"
-
-int
-Score_column::compare(Score_column & c1, Score_column &c2)
-{
- return sign(c1.when_ - c2.when_);
-}
-
-void
-Score_column::set_breakable()
-{
- pcol_l_->set_breakable();
-}
-
-Score_column::Score_column(Moment w)
-{
- when_ = w;
- pcol_l_ = new PCol(0);
- musical_b_ = false;
-}
-
-bool
-Score_column::used_b() {
- return pcol_l_->used_b();
-}
-
-void
-Score_column::print() const
-{
-#ifndef NPRINT
- mtor << "Score_column { mus "<< musical_b_ <<" at " << when_<<'\n';
- mtor << "durations: [";
- for (int i=0; i < durations.size(); i++)
- mtor << durations[i] << " ";
- mtor << "]\n";
- pcol_l_->print();
- mtor << "}\n";
-#endif
-}
-
-int
-Moment_compare(Moment &a , Moment& b)
-{
- return sign(a-b);
-}
-
-void
-Score_column::preprocess()
-{
- durations.sort(Moment_compare);
-}
-void
-Score_column::add_duration(Moment d)
-{
- assert(d);
- for (int i = 0; i< durations.size(); i++) {
- if (d == durations[i])
- return ;
- }
- durations.push(d);
-}
-
-bool
-Score_column::breakable_b()
-{
- return pcol_l_->breakable_b();
-}
#include "dimen.hh"
#include "spanner.hh"
#include "symbol.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
#include "pcol.hh"
#include "pscore.hh"
#include "main.hh"
-#include "inputscore.hh"
+#include "input-score.hh"
#include "score.hh"
#include "string.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
#include "debug.hh"
static Array<Input_score*> score_array_global;
+++ /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 "scorecolumn.hh"
-
-Score_walker::Score_walker(Score *s)
- :PCursor<Score_column *> (s->cols_)
-{
- score_l_ = s;
- 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];
- assert( !score_l_->find_col(score_l_->last(), true)->used_b());
-}
-
-
--- /dev/null
+#include "debug.hh"
+#include "script-def.hh"
+
+Script_def::Script_def(String idx, int stem, int staff ,bool invert)
+{
+ symidx = idx ;
+ stemdir =stem;
+ staffdir = staff;
+ invertsym = invert;
+}
+void
+Script_def::print() const
+{
+ mtor << "Script_def{ idx: " << symidx
+ << " direction, stem: " << stemdir << " staff : " << staffdir << "}\n";
+}
+int
+Script_def::compare(Script_def const & c)
+{
+ return !(symidx == c.symidx &&
+ stemdir == c.stemdir&&
+ staffdir == c.staffdir&&
+ invertsym == c.invertsym);
+}
--- /dev/null
+/*
+ script-reg.cc -- implement Script_register
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "script-reg.hh"
+#include "script.hh"
+#include "musicalrequest.hh"
+#include "complex-walker.hh"
+#include "stem.hh"
+
+Script_register::Script_register()
+{
+ script_p_ = 0;
+ post_move_processing();
+}
+
+bool
+Script_register::try_request(Request *r_l)
+{
+ if (!r_l->script())
+ return false ;
+
+ if (script_req_l_
+ && Script_req::compare(*script_req_l_, *r_l->script()))
+
+ return false;
+
+ script_req_l_ = r_l->script();
+
+ return true;
+}
+
+void
+Script_register::process_requests()
+{
+ if (script_req_l_) {
+ script_p_ = new Script(script_req_l_, 10);
+ announce_element(
+ Staff_elem_info(script_p_, script_req_l_));
+ }
+}
+
+void
+Script_register::acknowledge_element(Staff_elem_info info)
+{
+ if (!script_p_)
+ return;
+ if (info.elem_p_->name() == Stem::static_name())
+ script_p_->set_stem((Stem*)info.elem_p_);
+ else if (info.req_l_->rhythmic())
+ script_p_->set_support(info.elem_p_->item());
+}
+
+void
+Script_register::pre_move_processing()
+{
+ if (script_p_){
+ script_p_->dir = dir_i_;
+ typeset_element(script_p_);
+ script_p_ = 0;
+ }
+}
+void
+Script_register::post_move_processing()
+{
+ script_req_l_ = 0;
+}
+
+void
+Script_register::set_feature(Features i)
+{
+ if (i.direction_i_|| i.initialiser_b_)
+ dir_i_ = i.direction_i_;
+}
#include "musicalrequest.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
#include "script.hh"
#include "stem.hh"
#include "molecule.hh"
#include "lookup.hh"
-NAME_METHOD(Script);
+
void
Script::set_stem(Stem*st_l)
{
stem_l_ = st_l;
- add_depedency(st_l);
+ add_dependency(st_l);
}
void
Script::set_support(Item*i)
{
support.push(i);
- add_depedency(i);
+ add_dependency(i);
}
Script::Script(Script_req* rq, int staflen)
+++ /dev/null
-#include "debug.hh"
-#include "scriptdef.hh"
-
-Script_def::Script_def(String idx, int stem, int staff ,bool invert)
-{
- symidx = idx ;
- stemdir =stem;
- staffdir = staff;
- invertsym = invert;
-}
-void
-Script_def::print() const
-{
- mtor << "idx: " << symidx;
- mtor << "direction, stem: " << stemdir << " staff : " << staffdir;
-}
-int
-Script_def::compare(Script_def const & c)
-{
- return !(symidx == c.symidx &&
- stemdir == c.stemdir&&
- staffdir == c.staffdir&&
- invertsym == c.invertsym);
-}
+++ /dev/null
-/*
- scriptreg.cc -- implement Script_register
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#include "scriptreg.hh"
-#include "script.hh"
-#include "musicalrequest.hh"
-#include "complexwalker.hh"
-
-Script_register::Script_register(Complex_walker*w)
- : Request_register(w)
-{
- script_p_ = 0;
-}
-
-bool
-Script_register::try_request(Request *r_l)
-{
- if (!r_l->script())
- return false ;
-
- if (accepted_req_arr_.size()
- && Script_req::compare(*accepted_req_arr_[0]->script(), *r_l->script()))
-
- return false;
-
- accepted_req_arr_.push(r_l);
-
- return true;
-}
-
-void
-Script_register::process_request()
-{
- if (accepted_req_arr_.size() ) {
- script_p_ = new Script(accepted_req_arr_[0]->script(), 10);
- announce_element(
- Staff_elem_info(script_p_, accepted_req_arr_[0], this));
- }
-}
-
-void
-Script_register::acknowledge_element(Staff_elem_info info)
-{
- if (!script_p_)
- return;
- if (info.elem_p_->name() == String("Stem"))
- script_p_->set_stem((Stem*)info.elem_p_);
- else if (info.req_l_->rhythmic())
- script_p_->set_support(info.elem_p_->item());
-}
-
-void
-Script_register::do_pre_move_process()
-{
- if (script_p_){
- script_p_->dir = dir_i_;
- typeset_element(script_p_);
- script_p_ = 0;
- }
-}
-
-void
-Script_register::set_dir(int i)
-{
- dir_i_ = i;
-}
--- /dev/null
+/*
+ slur-reg.cc -- implement Slur_register
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "plist.hh"
+#include "musicalrequest.hh"
+#include "complex-walker.hh"
+#include "slur-reg.hh"
+#include "slur.hh"
+#include "debug.hh"
+#include "notehead.hh"
+
+void
+Slur_register::set_feature(Features i)
+{
+ dir_i_ = i.direction_i_;
+}
+
+Slur_register::Slur_register()
+{
+ set_feature(Features::dir(0));
+}
+
+bool
+Slur_register::try_request(Request *req_l)
+{
+ if(!req_l->slur())
+ return false;
+
+ new_slur_req_l_arr_.push(req_l->slur());
+ return true;
+}
+
+void
+Slur_register::acknowledge_element(Staff_elem_info info)
+{
+ if (info.elem_p_->name() == Notehead::static_name()) {
+ Notehead *head_p =(Notehead*) info.elem_p_ ;// ugh
+ for (int i = 0; i < slur_l_stack_.size(); i++)
+ slur_l_stack_[i]->add(head_p );
+ for (int i = 0; i < end_slur_l_arr_.size(); i++)
+ end_slur_l_arr_[i]->add(head_p);
+ }
+}
+/*
+ abracadabra
+ */
+void
+Slur_register::process_requests()
+{
+ Array<Slur*> start_slur_l_arr_;
+ for (int i=0; i< new_slur_req_l_arr_.size(); i++) {
+ Slur_req* slur_req_l = new_slur_req_l_arr_[i];
+ // end slur: move the slur to other array
+ 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_);
+ else {
+ end_slur_l_arr_.push(slur_l_stack_.pop());
+ requests_arr_.pop();
+ }
+ } else if (slur_req_l->spantype == Span_req::START) {
+ // push a new slur onto stack.
+ //(use temp. array to wait for all slur STOPs)
+ Slur * s_p =new Slur;
+ requests_arr_.push(slur_req_l);
+ start_slur_l_arr_.push(s_p);
+ announce_element(Staff_elem_info(s_p, slur_req_l));
+ }
+ }
+ for (int i=0; i < start_slur_l_arr_.size(); i++)
+ slur_l_stack_.push(start_slur_l_arr_[i]);
+}
+
+void
+Slur_register::pre_move_processing()
+{
+ for (int i = 0; i < end_slur_l_arr_.size(); i++) {
+ if (dir_i_)
+ end_slur_l_arr_[i]->dir_i_ = dir_i_;
+ typeset_element(end_slur_l_arr_[i]);
+ }
+ end_slur_l_arr_.set_size(0);
+}
+
+void
+Slur_register::post_move_processing()
+{
+ new_slur_req_l_arr_.set_size(0);
+}
+Slur_register::~Slur_register()
+{
+ for (int i=0; i < requests_arr_.size(); i++) {
+ warning("unterminated slur", requests_arr_[i]->defined_ch_c_l_);
+ }
+}
#include "slur.hh"
#include "scalar.hh"
#include "lookup.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
#include "notehead.hh"
#include "pcol.hh"
#include "molecule.hh"
#include "debug.hh"
#include "boxes.hh"
-NAME_METHOD(Slur);
+
Slur::Slur()
{
Slur::add(Notehead*n)
{
encompass.push(n);
- add_depedency(n);
+ add_dependency(n);
}
void
+++ /dev/null
-/*
- slurreg.cc -- implement Slur_register
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#include "plist.hh"
-#include "musicalrequest.hh"
-#include "complexwalker.hh"
-#include "slurreg.hh"
-#include "slur.hh"
-#include "debug.hh"
-
-
-void
-Slur_register::set_dir(int i)
-{
- dir_i_ = i;
-}
-
-Slur_register::Slur_register(Complex_walker* w)
- : Request_register(w)
-{
- set_dir(0);
-}
-
-bool
-Slur_register::try_request(Request *req_l)
-{
- if(!req_l->slur())
- return false;
-
- accepted_req_arr_.push(req_l);
- return true;
-}
-
-void
-Slur_register::acknowledge_element(Staff_elem_info info)
-{
- if (info.elem_p_->name() == String("Notehead")) {
- Notehead *head_p =(Notehead*) info.elem_p_ ;// ugh
- for (int i = 0; i < slur_l_stack_.size(); i++)
- slur_l_stack_[i]->add(head_p );
- for (int i = 0; i < end_slur_l_arr_.size(); i++)
- end_slur_l_arr_[i]->add(head_p);
- }
-}
-/*
- abracadabra
- */
-void
-Slur_register::process_request()
-{
- Array<Slur*> start_slur_l_arr_;
- for (int i=0; i< accepted_req_arr_.size(); i++) {
- Slur_req* slur_req_l = accepted_req_arr_[i]->slur();
- // end slur: move the slur to other array
- 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_);
- else {
- end_slur_l_arr_.push(slur_l_stack_.pop());
- requests_arr_.pop();
- }
- } else if (slur_req_l->spantype == Span_req::START) {
- // push a new slur onto stack.
- //(use temp. array to wait for all slur STOPs)
- Slur * s_p =new Slur;
- requests_arr_.push(slur_req_l);
- start_slur_l_arr_.push(s_p);
- announce_element(Staff_elem_info(s_p, slur_req_l, this));
- }
- }
- for (int i=0; i < start_slur_l_arr_.size(); i++)
- slur_l_stack_.push(start_slur_l_arr_[i]);
-}
-
-void
-Slur_register::do_pre_move_process()
-{
- for (int i = 0; i < end_slur_l_arr_.size(); i++) {
- if (dir_i_)
- end_slur_l_arr_[i]->dir_i_ = dir_i_;
- typeset_element(end_slur_l_arr_[i]);
- }
- end_slur_l_arr_.set_size(0);
-}
-
-Slur_register::~Slur_register()
-{
- for (int i=0; i < requests_arr_.size(); i++) {
- warning("unterminated slur", requests_arr_[i]->defined_ch_c_l_);
- }
-}
--- /dev/null
+//
+// source-file.cc
+//
+
+#include <sys/types.h> // open, mmap
+#include <sys/stat.h> // open
+#include <sys/mman.h> // mmap
+#include <limits.h> // INT_MAX
+#include <fcntl.h> // open
+#include <unistd.h> // close, stat
+#include <stdio.h> // fdopen
+#include <string.h> // strerror
+#include <errno.h> // errno
+#include <assert.h>
+#include <strstream.h>
+
+#include "string.hh"
+#include "proto.hh"
+#include "plist.hh"
+#include "lexer.hh"
+#include "debug.hh"
+#include "parseconstruct.hh"
+#include "main.hh" // find_file
+
+#include "source-file.hh"
+
+Source_file::Source_file( String &filename_str )
+{
+ data_caddr_ = 0;
+ fildes_i_ = 0;
+ size_off_ = 0;
+ name_str_ = filename_str;
+ istream_p_ = 0;
+
+ open();
+ map();
+ // ugh!?, should call name_str() !
+ filename_str = name_str_;
+}
+
+Source_file::~Source_file()
+{
+ delete istream_p_;
+ istream_p_ = 0;
+ unmap();
+ close();
+}
+
+char const*
+Source_file::ch_c_l()
+{
+ assert( this );
+ return (char const*)data_caddr_;
+}
+
+void
+Source_file::close()
+{
+ if ( fildes_i_ ) {
+ ::close( fildes_i_ );
+ fildes_i_ = 0;
+ }
+}
+
+String
+Source_file::error_str( char const* pos_ch_c_l )
+{
+ assert( this );
+ if ( !in_b( pos_ch_c_l ) )
+ return "";
+
+ char const* begin_ch_c_l = pos_ch_c_l;
+ char const* data_ch_c_l = ch_c_l();
+ while ( begin_ch_c_l > data_ch_c_l )
+ if ( *--begin_ch_c_l == '\n' ) {
+ begin_ch_c_l++;
+ break;
+ }
+
+ char const* end_ch_c_l = pos_ch_c_l;
+ while ( end_ch_c_l < data_ch_c_l + size_off_ )
+ if ( *end_ch_c_l++ == '\n' ) {
+ break;
+ }
+ end_ch_c_l--;
+
+#if 1
+// String( char const* p, int length ) is missing!?
+ String line_str( (Byte const*)begin_ch_c_l, end_ch_c_l - begin_ch_c_l );
+#else
+ int length_i = end_ch_c_l - begin_ch_c_l;
+ char* ch_p = new char[ length_i + 1 ];
+ strncpy( ch_p, begin_ch_c_l, length_i );
+ ch_p[ length_i ] = 0;
+ String line_str( ch_p );
+ delete ch_p;
+#endif
+
+ int error_col_i = 0;
+ char const* scan_ch_c_l = begin_ch_c_l;
+ while ( scan_ch_c_l < pos_ch_c_l )
+ if ( *scan_ch_c_l++ == '\t' )
+ error_col_i = ( error_col_i / 8 + 1 ) * 8;
+ else
+ error_col_i++;
+
+ String str = line_str.left_str( pos_ch_c_l - begin_ch_c_l )
+ + String( '\n' )
+ + String( ' ', error_col_i )
+ + line_str.mid_str( pos_ch_c_l - begin_ch_c_l + 1, INT_MAX ); // String::mid should take 0 arg..
+ return str;
+}
+
+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_ ) );
+}
+
+istream*
+Source_file::istream_l()
+{
+ 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_ = new istrstream( "", 0 );
+ istream_p_->set(ios::eofbit);
+ }
+ }
+ return istream_p_;
+}
+
+off_t
+Source_file::length_off()
+{
+ return size_off_;
+}
+
+int
+Source_file::line_i( char const* pos_ch_c_l )
+{
+ if ( !in_b( pos_ch_c_l ) )
+ return 0;
+
+ int i = 1;
+ char const* scan_ch_c_l = ch_c_l();
+ while ( scan_ch_c_l < pos_ch_c_l )
+ if ( *scan_ch_c_l++ == '\n' )
+ i++;
+ return i;
+}
+
+void
+Source_file::map()
+{
+ if ( fildes_i_ == -1 )
+ return;
+
+ data_caddr_ = (caddr_t)mmap( (void*)0, size_off_, PROT_READ, MAP_SHARED, fildes_i_, 0 );
+
+ if ( (int)data_caddr_ == -1 )
+ // ugh: defined_ch_c_l...
+ 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_;
+}
+
+void
+Source_file::open()
+{
+ String name_str = find_file( name_str_ );
+ if ( name_str != "" )
+ name_str_ = name_str;
+
+ fildes_i_ = ::open( name_str_, O_RDONLY );
+
+ 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_, &file_stat );
+ size_off_ = file_stat.st_size;
+}
+
+void
+Source_file::unmap()
+{
+ if ( data_caddr_ ) {
+ munmap( data_caddr_, size_off_ );
+ data_caddr_ = 0;
+ size_off_ = 0;
+ }
+}
+String
+Source_file::file_line_no_str(char const *ch_c_l )
+{
+ return name_str() + ": "
+ + String( line_i( ch_c_l ) );
+}
#include "proto.hh"
#include "plist.hh"
-#include "sourcefile.hh"
+#include "source-file.hh"
#include "source.hh"
Source::Source()
+++ /dev/null
-//
-// sourcefile.cc
-//
-
-#include <sys/types.h> // open, mmap
-#include <sys/stat.h> // open
-#include <sys/mman.h> // mmap
-#include <limits.h> // INT_MAX
-#include <fcntl.h> // open
-#include <unistd.h> // close, stat
-#include <stdio.h> // fdopen
-#include <string.h> // strerror
-#include <errno.h> // errno
-#include <assert.h>
-#include <strstream.h>
-
-#include "string.hh"
-#include "proto.hh"
-#include "plist.hh"
-#include "lexer.hh"
-#include "debug.hh"
-#include "parseconstruct.hh"
-#include "main.hh" // find_file
-
-#include "sourcefile.hh"
-
-Source_file::Source_file( String &filename_str )
-{
- data_caddr_ = 0;
- fildes_i_ = 0;
- size_off_ = 0;
- name_str_ = filename_str;
- istream_p_ = 0;
-
- open();
- map();
- // ugh!?, should call name_str() !
- filename_str = name_str_;
-}
-
-Source_file::~Source_file()
-{
- delete istream_p_;
- istream_p_ = 0;
- unmap();
- close();
-}
-
-char const*
-Source_file::ch_c_l()
-{
- assert( this );
- return (char const*)data_caddr_;
-}
-
-void
-Source_file::close()
-{
- if ( fildes_i_ ) {
- ::close( fildes_i_ );
- fildes_i_ = 0;
- }
-}
-
-String
-Source_file::error_str( char const* pos_ch_c_l )
-{
- assert( this );
- if ( !in_b( pos_ch_c_l ) )
- return "";
-
- char const* begin_ch_c_l = pos_ch_c_l;
- char const* data_ch_c_l = ch_c_l();
- while ( begin_ch_c_l > data_ch_c_l )
- if ( *--begin_ch_c_l == '\n' ) {
- begin_ch_c_l++;
- break;
- }
-
- char const* end_ch_c_l = pos_ch_c_l;
- while ( end_ch_c_l < data_ch_c_l + size_off_ )
- if ( *end_ch_c_l++ == '\n' ) {
- break;
- }
- end_ch_c_l--;
-
-#if 1
-// String( char const* p, int length ) is missing!?
- String line_str( (Byte const*)begin_ch_c_l, end_ch_c_l - begin_ch_c_l );
-#else
- int length_i = end_ch_c_l - begin_ch_c_l;
- char* ch_p = new char[ length_i + 1 ];
- strncpy( ch_p, begin_ch_c_l, length_i );
- ch_p[ length_i ] = 0;
- String line_str( ch_p );
- delete ch_p;
-#endif
-
- int error_col_i = 0;
- char const* scan_ch_c_l = begin_ch_c_l;
- while ( scan_ch_c_l < pos_ch_c_l )
- if ( *scan_ch_c_l++ == '\t' )
- error_col_i = ( error_col_i / 8 + 1 ) * 8;
- else
- error_col_i++;
-
- String str = line_str.left_str( pos_ch_c_l - begin_ch_c_l )
- + String( '\n' )
- + String( ' ', error_col_i )
- + line_str.mid_str( pos_ch_c_l - begin_ch_c_l + 1, INT_MAX ); // String::mid should take 0 arg..
- return str;
-}
-
-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_ ) );
-}
-
-istream*
-Source_file::istream_l()
-{
- 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_ = new istrstream( "", 0 );
- istream_p_->set(ios::eofbit);
- }
- }
- return istream_p_;
-}
-
-off_t
-Source_file::length_off()
-{
- return size_off_;
-}
-
-int
-Source_file::line_i( char const* pos_ch_c_l )
-{
- if ( !in_b( pos_ch_c_l ) )
- return 0;
-
- int i = 1;
- char const* scan_ch_c_l = ch_c_l();
- while ( scan_ch_c_l < pos_ch_c_l )
- if ( *scan_ch_c_l++ == '\n' )
- i++;
- return i;
-}
-
-void
-Source_file::map()
-{
- if ( fildes_i_ == -1 )
- return;
-
- data_caddr_ = (caddr_t)mmap( (void*)0, size_off_, PROT_READ, MAP_SHARED, fildes_i_, 0 );
-
- if ( (int)data_caddr_ == -1 )
- // ugh: defined_ch_c_l...
- 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_;
-}
-
-void
-Source_file::open()
-{
- String name_str = find_file( name_str_ );
- if ( name_str != "" )
- name_str_ = name_str;
-
- fildes_i_ = ::open( name_str_, O_RDONLY );
-
- 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_, &file_stat );
- size_off_ = file_stat.st_size;
-}
-
-void
-Source_file::unmap()
-{
- if ( data_caddr_ ) {
- munmap( data_caddr_, size_off_ );
- data_caddr_ = 0;
- size_off_ = 0;
- }
-}
-String
-Source_file::file_line_no_str(char const *ch_c_l )
-{
- return name_str() + ": "
- + String( line_i( ch_c_l ) );
-}
#include "spanner.hh"
#include "pcol.hh"
-NAME_METHOD(Spanner);
+
void
Spanner::do_print()const
--- /dev/null
+/*
+ staff-column.cc -- implement Staff_column
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+#include "staff.hh"
+#include "voice.hh"
+#include "time-description.hh"
+#include "score-column.hh"
+#include "staff-column.hh"
+#include "commandrequest.hh"
+#include "musicalrequest.hh"
+#include "interval.hh"
+#include "pscore.hh"
+#include "item.hh"
+#include "pcol.hh"
+#include "voice-element.hh"
+
+void
+Staff_column::OK() const
+{
+#ifndef NDEBUG
+ assert (command_column_l_->when() == musical_column_l_->when());
+#endif
+}
+
+Moment
+Staff_column::when() const
+{
+ return (command_column_l_)?
+ command_column_l_->when():
+ musical_column_l_->when();
+}
+
+void
+Staff_column::add(Voice_element*ve)
+{
+ for (iter_top(ve->reqs,j); j.ok(); j++) {
+ if (j->command()) {
+ Command_req * c_l = j->command();
+ if (c_l->timing()) {
+ timing_req_l_arr_.push(j->command()->timing());
+ }
+ if (c_l->groupchange())
+ creationreq_l_arr_.push(c_l);
+ else if (!c_l->barcheck() && !c_l->partial() &&
+ !c_l->measuregrouping())
+ setup_one_request(j); // no need to bother children
+ } else {
+ if (j->rhythmic()) {
+ musical_column_l_->add_duration(j->rhythmic()->duration());
+ }
+ if (!j->musical()->skip())
+ setup_one_request(j);
+ }
+ }
+}
+
+Staff_column::Staff_column()
+{
+ musical_column_l_ = 0;
+ command_column_l_ = 0;
+ staff_l_ = 0;
+}
+
+
+
+
+Staff_column::~Staff_column()
+{
+}
+
+void
+Staff_column::set_cols(Score_column*c1, Score_column*c2)
+{
+ command_column_l_ = c1;
+ musical_column_l_ = c2;
+}
+
+void
+Staff_column::setup_one_request(Request * j)
+{
+ if (j->command()) // ugh
+ commandreq_l_arr_.push(j);
+ else if (j->musical())
+ musicalreq_l_arr_.push(j);
+}
+
+void
+Staff_column::typeset_musical_item(Item*i)
+{
+ assert(i);
+ Score_column * scorecolumn_l = musical_column_l_;
+ musical_column_l_->pcol_l_->pscore_l_->typeset_item(i, scorecolumn_l->pcol_l_,
+ staff_l_->pstaff_l_);
+}
+
+/**
+ align items in #item_l_arr#,
+
+ @return the width of the items after aligning.
+ */
+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();
+ Real dx =wid.right - item_width.left;
+ item_width += dx;
+ item_l_arr[i]->translate(Offset(dx ,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
+Staff_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=command_column_l_->pcol_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
+/*
+ staff-elem-info.cc -- implement Staff_elem_info
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "staff-elem-info.hh"
+#include "request.hh"
+
+Staff_elem_info::Staff_elem_info(Staff_elem*s_l, Request*r_l)
+{
+ elem_p_ = s_l;
+ voice_l_ = (r_l)?r_l->voice_l():0;
+ req_l_ = r_l;
+}
+
+Staff_elem_info::Staff_elem_info()
+{
+ elem_p_ = 0;
+ voice_l_ = 0;
+
+ req_l_ = 0;
+}
+
+Features::Features()
+{
+ direction_i_ = 0;
+ initialiser_b_ = false;
+}
+
+Features
+Features::dir(int d) return f;
+{
+ f.initialiser_b_ = true;
+ f.direction_i_ = d;
+}
--- /dev/null
+#include "pscore.hh"
+#include "symbol.hh"
+#include "pstaff.hh"
+#include "molecule.hh"
+#include "staff-elem.hh"
+#include "debug.hh"
+
+String
+Staff_elem::TeXstring() const
+{
+ Molecule m(*output);
+ m.translate(offset_); // ugh?
+ return m.TeXstring();
+}
+
+Staff_elem::Staff_elem(Staff_elem const&s)
+ : dependants(s.dependants),
+ dependencies(s.dependencies)
+{
+ status = s.status;
+ assert(!s.output);
+ output = 0;
+ pstaff_l_ = s.pstaff_l_;
+ offset_ = Offset(0,0);
+}
+/**
+ TODO:
+ If deleted, then remove dependants depency!
+ */
+Staff_elem::~Staff_elem()
+{
+ delete output;
+}
+
+void
+Staff_elem::translate(Offset O)
+{
+ offset_ += O;
+}
+Interval
+Staff_elem::width() const
+{
+ Interval r;
+
+ if (!output){
+ Molecule*m = brew_molecule_p();
+ r = m->extent().x;
+ delete m;
+ } else
+ r = output->extent().x;
+
+ if (!r.empty()) // float exception on DEC Alpha
+ r+=offset_.x;
+
+ return r;
+}
+Interval
+Staff_elem::height() const
+{
+ Interval r;
+
+ if (!output){
+ Molecule*m = brew_molecule_p();
+ r = m->extent().y;
+ delete m;
+ } else
+ r = output->extent().y;
+
+ if (!r.empty())
+ r+=offset_.y;
+
+
+ return r;
+}
+
+void
+Staff_elem::print()const
+{
+#ifndef NPRINT
+ mtor << name() << "{\n";
+ do_print();
+ if (output)
+ output->print();
+
+ mtor << "}\n";
+#endif
+}
+
+
+
+Staff_elem::Staff_elem()
+{
+ pstaff_l_=0;
+ offset_ = Offset(0,0);
+ output = 0;
+ status = ORPHAN;
+}
+
+
+Paper_def*
+Staff_elem::paper() const
+{
+ assert(pstaff_l_);
+ return pstaff_l_->pscore_l_->paper_l_;
+}
+
+void
+Staff_elem::add_processing()
+{
+ if (status >= VIRGIN)
+ return;
+ status = VIRGIN;
+ do_add_processing();
+}
+
+void
+Staff_elem::pre_processing()
+{
+ if (status >= PRECALCED )
+ return;
+ assert(status != PRECALCING); // cyclic dependency
+ status = PRECALCING;
+
+ for (int i=0; i < dependencies.size(); i++)
+ if (dependencies[i])
+ dependencies[i]->pre_processing();
+
+
+ do_pre_processing();
+ status = PRECALCED;
+}
+void
+Staff_elem::post_processing()
+{
+ if (status >= POSTCALCED)
+ return;
+ assert(status != POSTCALCING);// cyclic dependency
+ status=POSTCALCING;
+
+ for (int i=0; i < dependencies.size(); i++)
+ if (dependencies[i])
+ dependencies[i]->post_processing();
+ do_post_processing();
+ status=POSTCALCED;
+}
+
+void
+Staff_elem::molecule_processing()
+{
+ if (status >= OUTPUT)
+ return;
+ status = OUTPUT; // do it only once.
+ for (int i=0; i < dependencies.size(); i++)
+ if (dependencies[i])
+ dependencies[i]->molecule_processing();
+
+ output= brew_molecule_p();
+}
+
+void
+Staff_elem::do_post_processing()
+{
+}
+
+void
+Staff_elem::do_pre_processing()
+{
+}
+
+void
+Staff_elem::do_add_processing()
+{
+}
+
+void
+Staff_elem::substitute_dependency(Staff_elem * old, Staff_elem * newdep)
+{
+ bool hebbes_b=false;
+ for (int i=0; i < dependencies.size(); i++) {
+ if (dependencies[i] == old){
+ dependencies[i] = newdep;
+ hebbes_b = true;
+ } else if (dependencies[i] == newdep) {
+ hebbes_b = true;
+ }
+ }
+ if (!hebbes_b)
+ dependencies.push(newdep);
+}
+
+void
+Staff_elem::add_dependency(Staff_elem * p)
+{
+ for (int i=0; i < dependencies.size(); i ++)
+ if (dependencies[i] == p)
+ return;
+
+ dependencies.push(p);
+ p->dependants.push(p);
+}
--- /dev/null
+/*
+ staff-walker.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 "staff-walker.hh"
+#include "staff-column.hh"
+#include "score-column.hh"
+#include "debug.hh"
+#include "time-description.hh"
+#include "commandrequest.hh"
+#include "grouping.hh"
+#include "score-walker.hh"
+
+Staff_walker::~Staff_walker()
+{
+ do_pre_move();
+}
+
+Staff_walker::Staff_walker(Staff_walker const &s)
+ :PCursor<Staff_column*> (s)
+{
+ assert(false);
+}
+
+Staff_walker::Staff_walker(Staff * s, PScore*ps )
+ : PCursor<Staff_column*> (s->cols_)
+{
+ staff_l_ = s;
+ pscore_l_ = ps;
+
+ // should be in tdes. TODO
+ default_grouping = new Rhythmic_grouping(MInterval(0, 1), 4);
+ score_walk_l_ = 0;
+}
+
+Moment
+Staff_walker::when() const
+{
+ return ptr()->when();
+}
+
+
+void
+Staff_walker::process_timing_reqs()
+{
+ 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();
+ 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);
+}
+
#include "staff.hh"
#include "score.hh"
#include "voice.hh"
-#include "staffwalker.hh"
-#include "staffcolumn.hh"
-#include "scorecolumn.hh"
-
+#include "staff-walker.hh"
+#include "staff-column.hh"
+#include "score-column.hh"
+#include "voice-element.hh"
#include "debug.hh"
#include "musicalrequest.hh"
#include "commandrequest.hh" // todo
-#include "midistream.hh"
+#include "midi-stream.hh"
void
Staff::add(PointerList<Voice*> const &l)
voice_list_.bottom().add(i);
}
-Paperdef *
+Paper_def *
Staff::paper() const
{
return score_l_->paper_p_;
i->command_column_l_ =0;
if (!i->command_column_l_&& !i->musical_column_l_)
- delete i.get();
+ delete i.get_p();
else
i++;
}
+++ /dev/null
-/*
- staffcolumn.cc -- implement Staff_column
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-#include "staff.hh"
-#include "voice.hh"
-#include "timedescription.hh"
-#include "scorecolumn.hh"
-#include "staffcolumn.hh"
-#include "commandrequest.hh"
-#include "musicalrequest.hh"
-#include "interval.hh"
-#include "pscore.hh"
-#include "item.hh"
-#include "pcol.hh"
-
-void
-Staff_column::OK() const
-{
-#ifndef NDEBUG
- assert (command_column_l_->when() == musical_column_l_->when());
-#endif
-}
-
-Moment
-Staff_column::when() const
-{
- return (command_column_l_)?
- command_column_l_->when():
- musical_column_l_->when();
-}
-
-void
-Staff_column::add(Voice_element*ve)
-{
- for (iter_top(ve->reqs,j); j.ok(); j++) {
- if (j->command()) {
- Command_req * c_l = j->command();
- if (c_l->timing()) {
- timing_req_l_arr_.push(j->command()->timing());
- }
- if (!c_l->barcheck() && !c_l->partial() &&
- !c_l->measuregrouping())
- setup_one_request(j); // no need to bother children
- } else {
- if (j->rhythmic()) {
- musical_column_l_->add_duration(j->rhythmic()->duration());
- }
- if (!j->musical()->skip())
- setup_one_request(j);
- }
- }
-}
-
-Staff_column::Staff_column()
-{
- musical_column_l_ = 0;
- command_column_l_ = 0;
- staff_l_ = 0;
-}
-
-
-
-
-Staff_column::~Staff_column()
-{
-}
-
-void
-Staff_column::set_cols(Score_column*c1, Score_column*c2)
-{
- command_column_l_ = c1;
- musical_column_l_ = c2;
-}
-
-void
-Staff_column::setup_one_request(Request * j)
-{
- if (j->command()) // ugh
- commandreq_l_arr_.push(j);
- else if (j->musical())
- musicalreq_l_arr_.push(j);
-}
-
-void
-Staff_column::typeset_musical_item(Item*i)
-{
- assert(i);
- Score_column * scorecolumn_l = musical_column_l_;
- musical_column_l_->pcol_l_->pscore_l_->typeset_item(i, scorecolumn_l->pcol_l_,
- staff_l_->pstaff_l_);
-}
-
-/**
- align items in #item_l_arr#,
-
- @return the width of the items after aligning.
- */
-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();
- Real dx =wid.right - item_width.left;
- item_width += dx;
- item_l_arr[i]->translate(Offset(dx ,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
-Staff_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=command_column_l_->pcol_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 "pscore.hh"
-#include "symbol.hh"
-#include "pstaff.hh"
-#include "molecule.hh"
-#include "staffelem.hh"
-#include "debug.hh"
-
-String
-Staff_elem::TeXstring() const
-{
- Molecule m(*output);
- m.translate(offset_); // ugh?
- return m.TeXstring();
-}
-
-Staff_elem::Staff_elem(Staff_elem const&s)
- : dependants(s.dependants),
- dependencies(s.dependencies)
-{
- status = s.status;
- assert(!s.output);
- output = 0;
- pstaff_l_ = s.pstaff_l_;
- offset_ = Offset(0,0);
-}
-/**
- TODO:
- If deleted, then remove dependants depency!
- */
-Staff_elem::~Staff_elem()
-{
- delete output;
-}
-
-void
-Staff_elem::translate(Offset O)
-{
- offset_ += O;
-}
-Interval
-Staff_elem::width() const
-{
- Interval r;
-
- if (!output){
- Molecule*m = brew_molecule_p();
- r = m->extent().x;
- delete m;
- } else
- r = output->extent().x;
-
- if (!r.empty()) // float exception on DEC Alpha
- r+=offset_.x;
-
- return r;
-}
-Interval
-Staff_elem::height() const
-{
- Interval r;
-
- if (!output){
- Molecule*m = brew_molecule_p();
- r = m->extent().y;
- delete m;
- } else
- r = output->extent().y;
-
- if (!r.empty())
- r+=offset_.y;
-
-
- return r;
-}
-
-void
-Staff_elem::print()const
-{
-#ifndef NPRINT
- mtor << name() << "{\n";
- do_print();
- if (output)
- output->print();
-
- mtor << "}\n";
-#endif
-}
-
-NAME_METHOD(Staff_elem);
-
-Staff_elem::Staff_elem()
-{
- pstaff_l_=0;
- offset_ = Offset(0,0);
- output = 0;
- status = ORPHAN;
-}
-
-
-Paperdef*
-Staff_elem::paper() const
-{
- assert(pstaff_l_);
- return pstaff_l_->pscore_l_->paper_l_;
-}
-
-void
-Staff_elem::add_processing()
-{
- if (status >= VIRGIN)
- return;
- status = VIRGIN;
- do_add_processing();
-}
-
-void
-Staff_elem::pre_processing()
-{
- if (status >= PRECALCED )
- return;
- assert(status != PRECALCING); // cyclic dependency
- status = PRECALCING;
-
- for (int i=0; i < dependencies.size(); i++)
- if (dependencies[i])
- dependencies[i]->pre_processing();
-
-
- do_pre_processing();
- status = PRECALCED;
-}
-void
-Staff_elem::post_processing()
-{
- if (status >= POSTCALCED)
- return;
- assert(status != POSTCALCING);// cyclic dependency
- status=POSTCALCING;
-
- for (int i=0; i < dependencies.size(); i++)
- if (dependencies[i])
- dependencies[i]->post_processing();
- do_post_processing();
- status=POSTCALCED;
-}
-
-void
-Staff_elem::molecule_processing()
-{
- if (status >= OUTPUT)
- return;
- status = OUTPUT; // do it only once.
- for (int i=0; i < dependencies.size(); i++)
- if (dependencies[i])
- dependencies[i]->molecule_processing();
-
- output= brew_molecule_p();
-}
-
-void
-Staff_elem::do_post_processing()
-{
-}
-
-void
-Staff_elem::do_pre_processing()
-{
-}
-
-void
-Staff_elem::do_add_processing()
-{
-}
-
-void
-Staff_elem::substitute_dependency(Staff_elem * old, Staff_elem * newdep)
-{
- bool hebbes_b=false;
- for (int i=0; i < dependencies.size(); i++) {
- if (dependencies[i] == old){
- dependencies[i] = newdep;
- hebbes_b = true;
- } else if (dependencies[i] == newdep) {
- hebbes_b = true;
- }
- }
- if (!hebbes_b)
- dependencies.push(newdep);
-}
-
-void
-Staff_elem::add_depedency(Staff_elem * p)
-{
- for (int i=0; i < dependencies.size(); i ++)
- if (dependencies[i] == p)
- return;
-
- dependencies.push(p);
- p->dependants.push(p);
-}
+++ /dev/null
-/*
- staffeleminfo.cc -- implement Staff_elem_info
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#include "staffeleminfo.hh"
-#include "request.hh"
-#include "voice.hh"
-
-Staff_elem_info::Staff_elem_info(Staff_elem*s_l, Request*r_l,
- Request_register *reg_l)
-{
- elem_p_ = s_l;
- voice_l_ = (r_l)?r_l->elt_l_->voice_l_:0;
- req_l_ = r_l;
- group_regs_l_ = 0;
- origin_reg_l_ = reg_l;
-}
-
-Staff_elem_info::Staff_elem_info()
-{
- elem_p_ = 0;
- voice_l_ = 0;
-
- group_regs_l_ = 0;
- origin_reg_l_ = 0;
- req_l_ = 0;
-}
-
#include "dimen.hh"
#include "spanner.hh"
#include "symbol.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
#include "molecule.hh"
#include "pcol.hh"
#include "pscore.hh"
*/
#include "staffsym.hh"
#include "lookup.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
#include "debug.hh"
-NAME_METHOD(Staff_symbol);
+
Staff_symbol::Staff_symbol(int l)
{
+++ /dev/null
-/*
- 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 "staffcolumn.hh"
-#include "scorecolumn.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 const &s)
- :PCursor<Staff_column*> (s)
-{
- assert(false);
-}
-
-Staff_walker::Staff_walker(Staff * s, PScore*ps )
- : PCursor<Staff_column*> (s->cols_)
-{
- staff_l_ = s;
- pscore_l_ = ps;
-
- // should be in tdes. TODO
- default_grouping = new Rhythmic_grouping(MInterval(0, 1), 4);
- score_walk_l_ = 0;
-}
-
-Moment
-Staff_walker::when() const
-{
- return ptr()->when();
-}
-
-
-void
-Staff_walker::process_timing_reqs()
-{
- 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();
- 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);
-}
-
--- /dev/null
+/*
+ stem-beam-reg.cc -- part of LilyPond
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "musicalrequest.hh"
+#include "stem-beam-reg.hh"
+#include "beam.hh"
+#include "stem.hh"
+#include "grouping.hh"
+#include "textspanner.hh"
+#include "complex-walker.hh"
+#include "complex-staff.hh"
+#include "debug.hh"
+#include "grouping.hh"
+#include "notehead.hh"
+
+Stem_beam_register::Stem_beam_register()
+{
+ post_move_processing();
+ current_grouping = 0;
+ beam_p_ = 0;
+ set_feature(Features::dir(0));
+ start_req_l_ = 0;
+}
+
+bool
+Stem_beam_register::try_request(Request*req_l)
+{
+ if ( req_l->beam() ) {
+ if (bool(beam_p_ ) == bool(req_l->beam()->spantype == Span_req::START))
+ return false;
+
+ if (beam_req_l_ && Beam_req::compare(*beam_req_l_ , *req_l->beam()))
+ return false;
+
+ beam_req_l_ = req_l->beam();
+ return true;
+ }
+
+ if ( req_l->stem() ) {
+ if (current_grouping && !current_grouping->child_fit_query(
+ get_staff_info().time_c_l_->whole_in_measure_))
+ return false;
+
+ if (stem_req_l_ && Stem_req::compare(*stem_req_l_, *req_l->stem()))
+ return false;
+
+ stem_req_l_ = req_l->stem();
+ return true;
+ }
+ return false;
+}
+
+void
+Stem_beam_register::process_requests()
+{
+ if (beam_req_l_) {
+ if (beam_req_l_->spantype == Span_req::STOP) {
+ end_beam_b_ = true;
+ start_req_l_ = 0;
+ } else {
+ beam_p_ = new Beam;
+ start_req_l_ = beam_req_l_;
+
+ current_grouping = new Rhythmic_grouping;
+ if (beam_req_l_->nplet) {
+ Text_spanner* t = new Text_spanner();
+ 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);
+ }
+
+ }
+ }
+
+ if (stem_req_l_) {
+ stem_p_ = new Stem(4);
+ if (current_grouping)
+ current_grouping->add_child(
+ get_staff_info().time_c_l_->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_);
+ else
+ beam_p_->add(stem_p_);
+ stem_p_->print_flag = false;
+ } else {
+ stem_p_->print_flag = true;
+ }
+
+ announce_element(Staff_elem_info(stem_p_, stem_req_l_));
+ }
+}
+
+void
+Stem_beam_register::acknowledge_element(Staff_elem_info info)
+{
+ if (!stem_p_)
+ return;
+
+ if (info.elem_p_->name() == Notehead::static_name() &&
+ stem_req_l_->duration() == info.req_l_->rhythmic()->duration())
+
+ stem_p_->add((Notehead*)info.elem_p_);
+}
+
+void
+Stem_beam_register::pre_move_processing()
+{
+ if (stem_p_) {
+ if (default_dir_i_)
+ stem_p_->dir = default_dir_i_;
+
+ typeset_element(stem_p_);
+ stem_p_ = 0;
+ }
+ if (beam_p_ && end_beam_b_) {
+ const Rhythmic_grouping * rg_c_l = get_staff_info().rhythmic_c_l_;
+ rg_c_l->extend(current_grouping->interval());
+ beam_p_->set_grouping(*rg_c_l, *current_grouping);
+ typeset_element(beam_p_);
+ delete current_grouping;
+ current_grouping = 0;
+ beam_p_ = 0;
+ }
+ end_beam_b_ = false;
+}
+void
+Stem_beam_register::post_move_processing()
+{
+ stem_p_ = 0;
+ beam_req_l_ = 0;
+ stem_req_l_ = 0;
+ end_beam_b_ = false;
+}
+
+Stem_beam_register::~Stem_beam_register()
+{
+ if (beam_p_)
+ warning("unterminated beam", start_req_l_->defined_ch_c_l_);
+}
+
+void
+Stem_beam_register::set_feature(Features i)
+{
+ default_dir_i_ = i.direction_i_;
+}
#include "stem.hh"
#include "dimen.hh"
#include "debug.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
#include "notehead.hh"
#include "lookup.hh"
#include "molecule.hh"
#include "misc.hh"
const int STEMLEN=7;
-NAME_METHOD(Stem);
+
Stem::Stem(int c) //, Moment len)
{
// todo: margins
if (! ((dir > 0 && se >= maxnote) || (se <= minnote && dir <0)) )
- WARN << "Weird stem size; check for narrow beams.\n";
+ warning("Weird stem size; check for narrow beams",0);
top = (dir < 0) ? maxnote : se;
bot = (dir < 0) ? se : minnote;
if (n->balltype == 1)
return;
int p = n->position;
- if ( p < minnote)
+ if (p < minnote)
minnote = p;
- if ( p> maxnote)
+ if (p > maxnote)
maxnote = p;
heads.push(n);
- n->add_depedency(this);
+ n->add_dependency(this);
}
void
Stem::set_default_extents()
{
- assert(minnote<=maxnote);
+ if (minnote > maxnote) {
+ warning("Empty stem. Ugh!", 0);
+ minnote = -10;
+ maxnote = 20;
+ }
if (!stemlen)
set_default_stemlen();
void
Stem::set_noteheads()
{
+ if(!heads.size())
+ return;
heads.sort(Notehead::compare);
heads[0]->extremal = -1;
heads.top()->extremal = 1;
{
if (!print_flag || abs(flag) <= 4)
return Interval(0,0); // TODO!
- Paperdef*p= paper();
+ Paper_def*p= paper();
Interval r(p->lookup_p_->flag(flag).dim.x);
r+= stem_xoffset;
return r;
assert(bot!=top);
- Paperdef *p =paper();
+ Paper_def *p =paper();
Real dy = p->internote();
Symbol ss =p->lookup_p_->stem(bot*dy,top*dy);
+++ /dev/null
-/*
- stembeamreg.cc -- part of LilyPond
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#include "musicalrequest.hh"
-#include "stembeamreg.hh"
-#include "beam.hh"
-#include "stem.hh"
-#include "grouping.hh"
-#include "textspanner.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)
-{
- do_post_move_process();
- current_grouping = 0;
- beam_p_ = 0;
- set_dir(0);
- start_req_l_ = 0;
-}
-
-bool
-Stem_beam_register::try_request(Request*req_l)
-{
- if ( req_l->beam() ) {
- if (bool(beam_p_ ) == bool(req_l->beam()->spantype == Span_req::START))
- return false;
-
- if (beam_req_l_ && Beam_req::compare(*beam_req_l_ , *req_l->beam()))
- return false;
-
- beam_req_l_ = req_l->beam();
- return true;
- }
-
- if ( req_l->stem() ) {
- if (current_grouping && !current_grouping->child_fit_query(
- walk_l_->time_.whole_in_measure_))
- return false;
-
- if (stem_req_l_ && Stem_req::compare(*stem_req_l_, *req_l->stem()))
- return false;
-
- stem_req_l_ = req_l->stem();
- return true;
- }
- return false;
-}
-
-void
-Stem_beam_register::process_request()
-{
- if (beam_req_l_) {
- if (beam_req_l_->spantype == Span_req::STOP) {
- end_beam_b_ = true;
- start_req_l_ = 0;
- } else {
- beam_p_ = new Beam;
- start_req_l_ = beam_req_l_;
-
- current_grouping = new Rhythmic_grouping;
- if (beam_req_l_->nplet) {
- Text_spanner* t = new Text_spanner();
- 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);
- }
-
- }
- }
-
- if (stem_req_l_) {
- stem_p_ = new Stem(4);
- if (current_grouping)
- current_grouping->add_child(
- 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_);
- else
- beam_p_->add(stem_p_);
- stem_p_->print_flag = false;
- } else {
- stem_p_->print_flag = true;
- }
-
- announce_element(Staff_elem_info(stem_p_,
- stem_req_l_, this));
- }
-}
-
-void
-Stem_beam_register::acknowledge_element(Staff_elem_info info)
-{
- if (!stem_p_)
- return;
-
- if (info.elem_p_->name() == String("Notehead") &&
- stem_req_l_->duration() == info.req_l_->rhythmic()->duration())
-
- stem_p_->add((Notehead*)info.elem_p_);
-}
-
-void
-Stem_beam_register::do_pre_move_process()
-{
- if (stem_p_) {
- if (default_dir_i_)
- stem_p_->dir = default_dir_i_;
-
- typeset_element(stem_p_);
- 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);
- typeset_element(beam_p_);
- delete current_grouping;
- current_grouping = 0;
- beam_p_ = 0;
- }
- end_beam_b_ = false;
-}
-void
-Stem_beam_register::do_post_move_process()
-{
- stem_p_ = 0;
- beam_req_l_ = 0;
- stem_req_l_ = 0;
- end_beam_b_ = false;
-}
-
-Stem_beam_register::~Stem_beam_register()
-{
- if (beam_p_)
- warning("unterminated beam", start_req_l_->defined_ch_c_l_);
-}
-
-void
-Stem_beam_register::set_dir(int i)
-{
- default_dir_i_ = i;
-}
}
+String
+Symbol::str()const return s;
+{
+ s = "symbol(\'"+tex+"\', (" + dim.x.str() + ", " + dim.y.str() + "))";
+}
#include "real.hh"
#include "symbol.hh"
#include "assoc.hh"
-#include "associter.hh"
+#include "assoc-iter.hh"
#include "symtable.hh"
Symtables::Symtables()
{
return Assoc<String, Symtable*>::operator[](s);
}
+void
+Symtables::print() const
+{
+ for (Assoc_iter<String, Symtable*> i(*this); i.ok(); i++) {
+ mtor << "table \'" << i.key() << "\' {\n";
+ i.val()->print();
+ mtor << "}\n";
+ }
+}
+void
+Symtable::print() const
+{
+ for (Assoc_iter<String, Symbol> i(*this); i.ok(); i++) {
+ mtor << "\'" << i.key() << "\'->" << i.val().str() << "\n";
+ }
+}
+
#include "symbol.hh"
#include "voice.hh"
+#include "voice-element.hh"
#include "musicalrequest.hh"
#include "staff.hh"
-#include "scorecolumn.hh"
-#include "staffcolumn.hh"
+#include "score-column.hh"
+#include "staff-column.hh"
#include "spanner.hh"
#include "plist.tcc"
#include "pcursor.tcc"
#include "request.hh"
-#include "inputscore.hh"
-#include "inputstaff.hh"
-#include "inputmusic.hh"
+#include "input-score.hh"
+#include "input-staff.hh"
+#include "input-music.hh"
#include "molecule.hh"
-#include "sourcefile.hh"
-
+#include "source-file.hh"
+#include "voice-element.hh"
#include "plist.tcc"
#include "pcursor.tcc"
#include "proto.hh"
#include "plist.tcc"
#include "register.hh"
-#include "voicegroupregs.hh"
-#include "voiceregs.hh"
+#include "voice-group-regs.hh"
+#include "voice-regs.hh"
IPL_instantiate(Voice_registers);
--- /dev/null
+/*
+ tex-stream.cc -- implement Tex_stream
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include <fstream.h>
+#include <time.h>
+
+#include "tex.hh"
+#include "main.hh"
+#include "tex-stream.hh"
+#include "debug.hh"
+
+Tex_stream::Tex_stream(String filename)
+{
+ os = new ofstream(filename);
+ if (!*os)
+ error("can't open `" + filename+"\'");
+ nest_level = 0;
+ outputting_comment=false;
+ header();
+}
+void
+Tex_stream::header()
+{
+ *os << "% Creator: " << get_version();
+ *os << "% Automatically generated, at ";
+ time_t t(time(0));
+ *os << ctime(&t);
+}
+Tex_stream::~Tex_stream()
+{
+ delete os;
+ assert(nest_level == 0);
+}
+
+// print string. don't forget indent.
+Tex_stream &
+Tex_stream::operator<<(String s)
+{
+
+ for (const char *cp = s; *cp; cp++) {
+ if (outputting_comment) {
+ *os << *cp;
+ if (*cp == '\n') {
+ outputting_comment=false;
+
+ }
+ continue;
+ }
+ switch(*cp)
+ {
+ case '%':
+ outputting_comment = true;
+ *os << *cp;
+ break;
+ case '{':
+ nest_level++;
+ *os << *cp;
+ break;
+ case '}':
+ nest_level--;
+ *os << *cp;
+
+ if (nest_level < 0) {
+ delete os; // we want to see the remains.
+ assert(nest_level>=0);
+ }
+ /* FALLTHROUGH */
+
+ case '\n':
+ *os << "%\n";
+ *os << String(' ', nest_level);
+ break;
+ default:
+ *os << *cp;
+ break;
+ }
+ }
+ return *this;
+}
+
+
+/* *************************************************************** */
substitute_arg(String& r, String arg)
{
int p = r.index_i('%');
- if (!p ) return ;
- else p--;
+ if (p < 0)
+ return ;
+
r = r.left_str(p) + arg + r.right_str(r.length_i() - p -1);
}
String retval (source);
for (int i = 0 ; i < args.size(); i++)
substitute_arg(retval, args[i]);
- while (retval.index_i('%'))
+ while (retval.index_i('%') >= 0)
substitute_arg(retval, "");
return retval;
}
+
String
substitute_args(String source, Array<Scalar> args)
{
--- /dev/null
+#include "debug.hh"
+#include "lookup.hh"
+#include "paper-def.hh"
+#include "molecule.hh"
+#include "text-def.hh"
+
+Text_def::Text_def()
+{
+ align_i_ = 1; // right
+ style_str_ = "roman";
+ defined_ch_c_l_ = 0;
+}
+bool
+Text_def::compare(const Text_def&def)
+{
+ return align_i_ == def.align_i_ && text_str_ == def.text_str_
+ && style_str_ == def.style_str_;
+}
+
+Atom
+Text_def::create_atom(Paper_def*p) const
+{
+ return p->lookup_p_->text(style_str_, text_str_, -align_i_);
+}
+
+void
+Text_def::print() const
+{
+ mtor << "Text `" << text_str_ << "\', style " <<
+ style_str_ << "align " << align_i_ << '\n';
+}
--- /dev/null
+/*
+ text-reg.cc -- implement Text_register
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "musicalrequest.hh"
+#include "text-reg.hh"
+#include "textitem.hh"
+
+Text_register::Text_register()
+{
+ text_p_ = 0;
+ set_feature(Features::dir(0));
+ post_move_processing();
+}
+
+bool
+Text_register::try_request(Request*req_l)
+{
+ if (!req_l->text())
+ return false;
+ if (text_req_l_ &&
+ Text_req::compare(*req_l->text(), *text_req_l_))
+
+ return false;
+
+ text_req_l_ = req_l->text();
+ return true;
+}
+
+void
+Text_register::process_requests()
+{
+
+ if (text_req_l_) {
+ text_p_ = new Text_item(text_req_l_, 10); // UGH
+ announce_element(Staff_elem_info(text_p_, text_req_l_));
+ }
+}
+void
+Text_register::pre_move_processing()
+{
+ if (text_p_) {
+ text_p_->dir_i_ = dir_i_;
+ typeset_element(text_p_);
+ text_p_ = 0;
+ }
+}
+void
+Text_register::set_feature(Features i)
+{
+ dir_i_ = i.direction_i_;
+}
+void
+Text_register::post_move_processing()
+{
+ text_req_l_ = 0;
+}
+++ /dev/null
-#include "debug.hh"
-#include "lookup.hh"
-#include "paperdef.hh"
-#include "molecule.hh"
-#include "textdef.hh"
-
-Text_def::Text_def()
-{
- align_i_ = 1; // right
- style_str_ = "roman";
- defined_ch_c_l_ = 0;
-}
-bool
-Text_def::compare(const Text_def&def)
-{
- return align_i_ == def.align_i_ && text_str_ == def.text_str_
- && style_str_ == def.style_str_;
-}
-
-Atom
-Text_def::create_atom(Paperdef*p) const
-{
- return p->lookup_p_->text(style_str_, text_str_, -align_i_);
-}
-
-void
-Text_def::print() const
-{
- mtor << "Text `" << text_str_ << "\', style " <<
- style_str_ << "align " << align_i_ << '\n';
-}
-#include "musicalrequest.hh"
-#include "paperdef.hh"
+/*
+ textitem.cc -- implement Text_item
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+ #include "musicalrequest.hh"
+#include "paper-def.hh"
#include "textitem.hh"
#include "stem.hh"
#include "molecule.hh"
#include "lookup.hh"
-NAME_METHOD(Text_item);
+
Text_item::Text_item(Text_req* treq_l, int staffsize_i)
{
+++ /dev/null
-/*
- textreg.cc -- implement Text_register
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#include "musicalrequest.hh"
-#include "textreg.hh"
-#include "textitem.hh"
-
-Text_register::Text_register(Complex_walker*w)
- : Request_register(w)
-{
- text_p_ = 0;
- set_dir(0);
-}
-
-bool
-Text_register::try_request(Request*req_l)
-{
- if (!req_l->text())
- return false;
- if (accepted_req_arr_.size() &&
- Text_req::compare(*req_l->text(), *accepted_req_arr_[0]->text()))
-
- return false;
-
- accepted_req_arr_.push(req_l);
- return true;
-}
-
-void
-Text_register::process_request()
-{
-
- if (accepted_req_arr_.size()) {
- text_p_ = new Text_item(accepted_req_arr_[0]->text(), 10);
- announce_element(Staff_elem_info(text_p_, accepted_req_arr_[0], this));
- }
-}
-void
-Text_register::do_pre_move_process()
-{
- if (text_p_) {
- text_p_->dir_i_ = dir_i_;
- typeset_element(text_p_);
- text_p_ = 0;
- }
-}
-void
-Text_register::set_dir(int i)
-{
- dir_i_ = i;
-}
#include "molecule.hh"
#include "boxes.hh"
#include "textspanner.hh"
-#include "textdef.hh"
+#include "text-def.hh"
#include "debug.hh"
-#include "paperdef.hh"
+#include "paper-def.hh"
+
-NAME_METHOD(Text_spanner);
void
Text_spanner::set_support(Directional_spanner*d)
{
support = d;
- add_depedency(d);
+ add_dependency(d);
}
Text_spanner::Text_spanner()
--- /dev/null
+/*
+ time-description.cc -- implement Time_description
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "time-description.hh"
+#include "debug.hh"
+
+String
+Time_description::str()const
+{
+ String s( "Time_description { ");
+ 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_i_) + ":"+ whole_in_measure_ +"\n}\n";
+ return s;
+}
+
+void
+Time_description::print() const
+{
+#ifndef NPRINT
+ mtor << str();
+#endif
+}
+void
+Time_description::OK() const
+{
+#ifndef NDEBUG
+ if (!cadenza_b_)
+ assert(whole_in_measure_ < whole_per_measure_);
+ assert(0 <= whole_in_measure_);
+ assert(one_beat_);
+#endif
+}
+
+void
+Time_description::set_cadenza(bool b)
+{
+ if (cadenza_b_ && !b) {
+ if (whole_in_measure_) {
+ bars_i_ ++;
+ whole_in_measure_ = 0;
+ }
+ }
+ cadenza_b_ = b ;
+}
+
+Time_description::Time_description()
+{
+ 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_i_ ++;
+ }
+}
+
+void
+Time_description::set_meter(int l, int o)
+{
+ assert(o);
+ one_beat_ = Rational(1)/Moment(o);
+ whole_per_measure_ = Moment(l) * one_beat_;
+ if(whole_in_measure_)
+ error_t("Meterchange should be at start of measure", *this);
+}
+
+void
+Time_description::setpartial(Moment p)
+{
+ if (when_)
+ error_t ("Partial measure only allowed at beginning.", *this);
+ if (p<Rational(0)||p > whole_per_measure_)
+ error_t ("Partial measure has incorrect size", *this);
+ whole_in_measure_ = whole_per_measure_ - p;
+}
+
+Moment
+Time_description::barleft()
+{
+ assert(!cadenza_b_);
+ return whole_per_measure_-whole_in_measure_;
+}
+
+int
+Time_description::compare(Time_description &t1, Time_description&t2)
+{
+ int i = sign(t1.when_-t2.when_);
+
+ if (!i) {
+ assert(t1.bars_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;
+}
+++ /dev/null
-/*
- timedescription.cc -- implement Time_description
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#include "timedescription.hh"
-#include "debug.hh"
-
-String
-Time_description::str()const
-{
- String s( "Time_description { ");
- 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_i_) + ":"+ whole_in_measure_ +"\n}\n";
- return s;
-}
-
-void
-Time_description::print() const
-{
-#ifndef NPRINT
- mtor << str();
-#endif
-}
-void
-Time_description::OK() const
-{
-#ifndef NDEBUG
- if (!cadenza_b_)
- assert(whole_in_measure_ < whole_per_measure_);
- assert(0 <= whole_in_measure_);
- assert(one_beat_);
-#endif
-}
-
-void
-Time_description::set_cadenza(bool b)
-{
- if (cadenza_b_ && !b) {
- if (whole_in_measure_) {
- bars_i_ ++;
- whole_in_measure_ = 0;
- }
- }
- cadenza_b_ = b ;
-}
-
-Time_description::Time_description()
-{
- 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_i_ ++;
- }
-}
-
-void
-Time_description::set_meter(int l, int o)
-{
- assert(o);
- one_beat_ = Rational(1)/Moment(o);
- whole_per_measure_ = Moment(l) * one_beat_;
- if(whole_in_measure_)
- error_t("Meterchange should be at start of measure", *this);
-}
-
-void
-Time_description::setpartial(Moment p)
-{
- if (when_)
- error_t ("Partial measure only allowed at beginning.", *this);
- if (p<Rational(0)||p > whole_per_measure_)
- error_t ("Partial measure has incorrect size", *this);
- whole_in_measure_ = whole_per_measure_ - p;
-}
-
-Moment
-Time_description::barleft()
-{
- assert(!cadenza_b_);
- return whole_per_measure_-whole_in_measure_;
-}
-
-int
-Time_description::compare(Time_description &t1, Time_description&t2)
-{
- int i = sign(t1.when_-t2.when_);
-
- if (!i) {
- assert(t1.bars_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;
-}
+++ /dev/null
-#include <fstream.h>
-#include <time.h>
-#include "tex.hh"
-#include "main.hh"
-#include "tstream.hh"
-#include "debug.hh"
-
-Tex_stream::Tex_stream(String filename)
-{
- os = new ofstream(filename);
- if (!*os)
- error("can't open `" + filename+"\'");
- nest_level = 0;
- outputting_comment=false;
- header();
-}
-void
-Tex_stream::header()
-{
- *os << "% Creator: " << get_version();
- *os << "% Automatically generated, at ";
- time_t t(time(0));
- *os << ctime(&t);
-//*os << "% from input file ..\n";
-}
-Tex_stream::~Tex_stream()
-{
- delete os;
- assert(nest_level == 0);
-}
-
-// print string. don't forget indent.
-Tex_stream &
-Tex_stream::operator<<(String s)
-{
-
- for (const char *cp = s; *cp; cp++) {
- if (outputting_comment) {
- *os << *cp;
- if (*cp == '\n') {
- outputting_comment=false;
-
- }
- continue;
- }
- switch(*cp)
- {
- case '%':
- outputting_comment = true;
- *os << *cp;
- break;
- case '{':
- nest_level++;
- *os << *cp;
- break;
- case '}':
- nest_level--;
- *os << *cp;
- assert (nest_level >= 0);
- /* FALTHROUGH */
-
- case '\n':
- *os << "%\n";
- *os << String(' ', nest_level);
- break;
- default:
- *os << *cp;
- break;
- }
- }
- return *this;
-}
-
-
-/* *************************************************************** */
--- /dev/null
+/*
+ voicegroup.cc -- implement Voice_group_registers
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "plist.hh"
+#include "musicalrequest.hh"
+#include "voice-regs.hh"
+#include "voice-group-regs.hh"
+#include "register.hh"
+#include "text-reg.hh"
+#include "stem-beam-reg.hh"
+#include "script-reg.hh"
+#include "complex-walker.hh"
+#include "commandrequest.hh"
+#include "debug.hh"
+
+static int temp_id_count;
+
+Voice_group_registers::Voice_group_registers(String id)
+{
+ add(new Text_register);
+ add(new Stem_beam_register);
+ add(new Script_register);
+
+ if (id=="") // UGH
+ id = __FUNCTION__ + String(temp_id_count++);
+ group_id_str_ = id;
+}
+
+bool
+Voice_group_registers::try_request(Request*r_l)
+{
+ for (int i=0; i < voice_regs_l_.size(); i++) {
+ if (voice_regs_l_[i]->voice_l_ == r_l->voice_l())
+ goto gotcha;
+ }
+ return false;
+gotcha:
+ if (r_l->groupfeature()) {
+ set_feature(Features::dir(r_l->groupfeature()->stemdir_i_));
+ return true;
+ }
+ return Register_group_register::try_request(r_l);
+}
+
+
+bool
+Voice_group_registers::static_acceptable_request_b(Request*r)
+{
+ return (r->stem() || r->beam() || r->text() || r->script() ||
+ r->groupfeature());
+}
+
+void
+Voice_group_registers::terminate_register(Request_register*r_l)
+{
+ if (r_l->name() == Voice_registers::static_name()) {
+ for (int i=0; i <voice_regs_l_.size(); i++) {
+ if (r_l == voice_regs_l_[i])
+ voice_regs_l_.del(i);
+ Register_group_register::terminate_register(r_l);
+ return;
+ }
+ }
+ assert(false);
+}
+void
+Voice_group_registers::do_print() const
+{
+#ifndef NPRINT
+ mtor << "ID: " << group_id_str_<<"\n";
+ Register_group_register::do_print();
+#endif
+}
+void
+Voice_group_registers::add(Request_register*r_l)
+{
+ Register_group_register::add(r_l);
+ if (r_l->name() == Voice_registers::static_name())
+ voice_regs_l_.push( (Voice_registers*)r_l );
+}
--- /dev/null
+/*
+ voice-regs.cc -- implement Voice_registers
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+#include "commandrequest.hh"
+#include "musicalrequest.hh"
+#include "voice-regs.hh"
+#include "register.hh"
+#include "slur-reg.hh"
+#include "headreg.hh"
+#include "walkregs.hh"
+#include "debug.hh"
+
+Voice_registers::Voice_registers(Voice *v_p)
+{
+ voice_l_ = v_p;
+ add(new Notehead_register);
+ add(new Slur_register);
+}
+
+void
+Voice_registers::acknowledge_element(Staff_elem_info i)
+{
+ if (i.voice_l_ != voice_l_)
+ return;
+ Register_group_register::acknowledge_element(i);
+}
+
+bool
+Voice_registers::try_request(Request*r_l)
+{
+ if (r_l->voice_l() !=voice_l_)
+ return false;
+
+ Command_req *c=r_l->command();
+ if (c&&c->terminate()) {
+ daddy_reg_l_->terminate_register(this);
+ return true; // scary. We're deleted now..
+ } else if (c&&c->groupchange()) {
+
+ ((Walker_registers*)daddy_reg_l_->daddy_reg_l_)-> // scary.
+ change_group(c->groupchange(), this,
+ (Voice_group_registers*)daddy_reg_l_); // UGR!
+ return true;
+ }
+
+ return Register_group_register::try_request(r_l);
+}
+
+bool
+Voice_registers::acceptable_request_b(Request*r)
+{
+// return (r->rest() || r->note() || r->slur() || r->groupchange());
+ return r->groupchange()
+ || Register_group_register::acceptable_request_b(r);
+}
+void
+Voice_registers::do_print() const
+{
+ mtor << "Voice= " << voice_l_<<'\n';
+ Register_group_register::do_print();
+}
#include "voice.hh"
#include "musicalrequest.hh"
#include "commandrequest.hh"
-#include "midiitem.hh"
-#include "midistream.hh"
+#include "midi-item.hh"
+#include "midi-stream.hh"
+#include "voice-element.hh"
void
Voice::set_default_group(String s)
}
void
-Voice::set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i)
+Voice::set_plet_backwards(Moment& now_moment_r, Moment until_moment,
+ int num_i, int den_i)
{
for (iter_bot(elts, i); i.ok(); i--)
if ( now_moment_r <= until_moment )
Voice::print() const
{
#ifndef NPRINT
- mtor << "start: "<< start<<eol;
+ mtor << "Voice { start: "<< start<<eol;
for (iter_top(elts,i); i.ok(); i++)
i->print();
+ mtor << "}\n";
#endif
}
#include "debug.hh"
#include "voice.hh"
+#include "voice-element.hh"
#include "musicalrequest.hh"
#include "commandrequest.hh"
assert( c == ']' );
moment_r += duration;
for ( PCursor<Request*> req_l_pcur( reqs.top() ); req_l_pcur.ok(); req_l_pcur++ ) {
- if (req_l_pcur->melodic())
- mtor << (char)('c' + req_l_pcur->melodic()->height()) << "\n";
if (req_l_pcur->beam() && req_l_pcur->beam()->spantype == Span_req::START )
return true;
}
}
void
-Voice_element::set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i)
+Voice_element::set_plet_backwards(Moment& now_moment_r,
+ Moment until_moment, int num_i, int den_i)
{
now_moment_r += duration;
if ( now_moment_r > until_moment )
req_l_pcur->rhythmic()->plet_factor = Moment(num_i, den_i);
if (req_l_pcur->stem())
req_l_pcur->stem()->plet_factor = Moment(num_i, den_i);
- if (req_l_pcur->melodic())
- mtor << (char)('c' + req_l_pcur->melodic()->height()) << "\n";
}
}
+++ /dev/null
-/*
- voicegroup.cc -- implement Voice_group_registers
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#include "plist.hh"
-#include "musicalrequest.hh"
-#include "voiceregs.hh"
-#include "voicegroupregs.hh"
-#include "register.hh"
-#include "textreg.hh"
-#include "stembeamreg.hh"
-#include "scriptreg.hh"
-#include "complexwalker.hh"
-#include "commandrequest.hh"
-
-static int temp_id_count;
-
-Voice_group_registers::Voice_group_registers(Complex_walker*w_l, String id)
-{
- walk_l_ = w_l;
- add(new Text_register(w_l));
- add(new Stem_beam_register(w_l));
- add(new Script_register(w_l));
-
- if (id=="") // UGH
- id = __FUNCTION__ + String(temp_id_count++);
- group_id_str_ = id;
-}
-
-bool
-Voice_group_registers::try_request(Request*r_l)
-{
- if (r_l->groupfeature()) {
- set_dir(r_l->groupfeature()->stemdir_i_);
- return true;
- }
- return Register_group::try_request(r_l);
-}
-
-void
-Voice_group_registers::acknowledge_element(Staff_elem_info i)
-{
- if (i.group_regs_l_!= this)
- return;
- Register_group::acknowledge_element(i);
-}
-#if 1
-void
-Voice_group_registers::set_dir(int i)
-{
- Register_group::set_dir(i);
-
- // ughh
- Array<Voice_registers*> vr_arr (walk_l_->get_voice_regs(this));
- for (int j=0; j<vr_arr.size(); j++) {
- if (vr_arr[j])
- vr_arr[j]->set_dir(i);
- }
-}
-#endif
-bool
-Voice_group_registers::acceptable_request_b(Request*r)
-{
- return (r->stem() || r->beam() || r->text() || r->script() ||
- r->groupfeature());
-}
+++ /dev/null
-/*
- voiceregs.cc -- implement Voice_registers
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#include "musicalrequest.hh"
-#include "voiceregs.hh"
-#include "register.hh"
-#include "slurreg.hh"
-#include "headreg.hh"
-
-Voice_registers::Voice_registers(Complex_walker*c_l, Voice *v_p)
-{
- voice_l_ = v_p;
- add(new Notehead_register(c_l));
- add(new Slur_register(c_l));
-}
-
-void
-Voice_registers::acknowledge_element(Staff_elem_info i)
-{
- if (i.voice_l_ != voice_l_)
- return;
- Register_group::acknowledge_element(i);
-}
-
-bool
-Voice_registers::acceptable_request_b(Request*r)
-{
- return (r->rest() || r->note() || r->slur());
-}
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
-#include "clefreg.hh"
-#include "localkeyreg.hh"
-#include "keyreg.hh"
-#include "meterreg.hh"
-#include "barreg.hh"
+#include "debug.hh"
+#include "clef-reg.hh"
+#include "local-key-reg.hh"
+#include "key-reg.hh"
+#include "meter-reg.hh"
+#include "bar-reg.hh"
+#include "bar.hh"
#include "walkregs.hh"
+#include "staff-elem.hh"
+#include "staff.hh"
+#include "complex-walker.hh"
+#include "staff-column.hh"
+#include "voice-group-regs.hh"
+#include "voice-regs.hh"
+#include "commandrequest.hh"
+
Walker_registers::Walker_registers(Complex_walker *w)
{
- add( new Bar_register(w));
- add( new Clef_register(w));
- add( new Key_register(w));
- add( new Meter_register(w));
- add( new Local_key_register(w));
+ walk_l_ = w;
+ add( new Bar_register);
+ add( new Clef_register);
+ add( new Key_register);
+ add( new Meter_register);
+ add( new Local_key_register);
+}
+
+void
+Walker_registers::announce_element(Staff_elem_info info)
+{
+ if (info.elem_p_->name() == Bar::static_name()) {
+ walk_l_->allow_break();
+ }
+ announce_info_arr_.push(info);
+}
+
+void
+Walker_registers::acknowledge_element(Staff_elem_info )
+{
+ assert(false);
+}
+
+void
+Walker_registers::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;
+ Register_group_register::acknowledge_element(info);
+ }
+ announce_info_arr_.set_size(0);
+}
+
+void
+Walker_registers::typeset_element(Staff_elem *elem_p)
+{
+ typeset_musical_item(elem_p);
+}
+
+void
+Walker_registers::typeset_musical_item(Staff_elem * elem_p)
+{
+ walk_l_->typeset_element(elem_p);
+}
+
+void
+Walker_registers::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);
+}
+
+void
+Walker_registers::pre_move_processing()
+{
+ // this generates all items.
+ Register_group_register::pre_move_processing();
+ walk_l_->ptr()->typeset_breakable_items(prebreak_item_p_arr_,
+ nobreak_item_p_arr_,
+ postbreak_item_p_arr_);
+}
+void
+Walker_registers::post_move_processing()
+{
+ Register_group_register::post_move_processing();
+}
+
+void
+Walker_registers::change_group(Group_change_req * greq_l,
+ Voice_registers *voice_regs_l,
+ Voice_group_registers * old_group)
+{
+ Voice_registers *regs_p = (old_group)
+ ? (Voice_registers*) old_group->get_register_p(voice_regs_l)
+ : new Voice_registers(greq_l->voice_l());
+ Voice_group_registers * new_group_l = get_group(greq_l->newgroup_str_);
+ new_group_l->add(regs_p);
+
+ mtor << "processed change request";
+ print();
+}
+
+Voice_group_registers *
+Walker_registers::get_group(String id)
+{
+ for (int i=0; i < group_l_arr_.size(); i++) {
+ if (group_l_arr_[i]->group_id_str_ == id)
+ return group_l_arr_[i];
+ }
+ Voice_group_registers *group_p = new Voice_group_registers(id);
+ group_l_arr_.push(group_p);
+ add(group_p);
+ return group_p;
+}
+
+void
+Walker_registers::terminate_register(Request_register * reg)
+{
+ for (int i=0; i < group_l_arr_.size(); i++) {
+ if (group_l_arr_[i] == reg) {
+ group_l_arr_.del(i);
+ Register_group_register::terminate_register(reg);
+ return;
+ }
+ }
+ assert(false);
+}
+
+bool
+Walker_registers::try_request(Request * r)
+{
+ bool b = Register_group_register::try_request(r);
+ if (!b) {
+ Command_req * cr_l = r->command() ;
+
+ if (cr_l && cr_l->groupchange()) {
+ change_group(cr_l->groupchange(), 0, 0);
+ } else
+ warning("junking request: " + String(r->name()),
+ r->defined_ch_c_l_);
+ }
+ return b;
+}
+
+
+Staff_info
+Walker_registers::get_staff_info() return inf;
+{
+ inf.c0_position_i_ = &walk_l_->c0_position_i_;
+ inf.walk_l_ = walk_l_;
+ inf.time_c_l_ = &walk_l_->time_;
+ inf.rhythmic_c_l_ = walk_l_->default_grouping;
+}
+Paper_def*
+Walker_registers::paper()const
+{
+ return walk_l_->staff_l_->paper();
}
#include "debug.hh"
#include "lexer.hh"
#include "moment.hh"
-#include "timedescription.hh"
+#include "time-description.hh"
#include "proto.hh"
#include "plist.hh"
-#include "sourcefile.hh"
+#include "source-file.hh"
#include "source.hh"
#include "main.hh"