diff options
author | Han-Wen Nienhuys <hanwen@xs4all.nl> | 1997-08-14 02:41:33 +0200 |
---|---|---|
committer | Han-Wen Nienhuys <hanwen@xs4all.nl> | 1997-08-14 02:41:33 +0200 |
commit | 6a62932652940f4ac2931f75d48796887fbc5fdc (patch) | |
tree | c7450e406b639f403f08551e90ace01fe8330838 | |
parent | a19cd9c5efcc258ac73e34eac5223879393b6b50 (diff) |
release: 0.1.7
301 files changed, 4493 insertions, 2713 deletions
diff --git a/.dstreamrc b/.dstreamrc index 2ec9f75879..ae0b1b1143 100644 --- a/.dstreamrc +++ b/.dstreamrc @@ -14,83 +14,83 @@ Lexer 1 Matrix 1 +# flower lib +File_path 0 -Atom 1 -Bar 1 -Beam 1 -Change_iterator 1 +Atom 0 +Bar 0 +Beam 0 +Change_iterator 0 Chord 0 -Chord_iterator 1 -Clef_item 1 -Col_configuration 1 -Colinfo 1 -Colinfo 1 -Collision 1 -Command 1 +Chord_iterator 0 +Clef_item 0 +Col_configuration 0 +Colinfo 0 +Colinfo 0 +Collision 0 # E l b e ment? search/replace typo. # Yeah. kind of. Looks cute though -Elbement_group 1 -Engraver 1 -Engraver_group_engraver 1 -File_path 1 -Group_change_req 1 -Head_column 1 -Idealspacing 1 -Ineq_constrained_qp 1 -Input_translator 1 -Item 1 -Key_item 1 -Lookup 1 -Line_spacer 1 +Elbement_group 0 +Engraver 0 +Engraver_group_engraver 0 +Group_change_req 0 +Head_column 0 +Idealspacing 0 +Ineq_constrained_qp 0 +Input_translator 0 +Item 0 +Key_item 0 +Lookup 0 +Line_spacer 0 Melodic_req 0 -Midi_def 1 -Mixed_qp 1 -Music 1 -Music_iterator 1 +Midi_def 0 +Mixed_qp 0 +Music 0 +Music_iterator 0 My_lily_lexer 1 -Note_head 1 -Note_performer 1 +Note_head 0 +Note_performer 0 Note_req 0 -PCol 1 -PScore 1 -Paper_def 1 -Paperdef 1 -Performer 1 -Performer_group_performer 1 -Request 1 -Request_iterator 1 -Rest_collision 1 -Rest_collision_engraver 1 -Rest_req 1 +PCol 0 +PScore 0 +Paper_def 0 +Paperdef 0 +Performer 0 +Performer_group_performer 0 +Request 0 +Request_iterator 0 +Rest_collision 0 +Rest_collision_engraver 0 +Rest_req 0 Rhythmic_req 0 -Score 1 -Score_column 1 -Score_elem 1 -Score_engraver 1 -Score_performer 1 -Script_column 1 -Script_def 1 -Script_req 1 -Slur 1 -Spacing_problem 1 -Spanner 1 -Spring_spacer 1 -Staff 1 -Staff_commands 1 -Stem 1 -Stem 1 -Stem_req 1 -Symtable 1 -Symtables 1 -Text_def 1 -Text_req 1 -Time_description 1 -Voice 1 -Voice_element 1 -Voice_element_iterator 1 -Voice_iterator 1 -Word_wrap 1 +Score 0 +Score_column 0 +Score_elem 0 +Score_engraver 0 +Score_performer 0 +Script_column 0 +Script_def 0 +Script_req 0 +Slur 0 +Spacing_problem 0 +Spanner 0 +Spring_spacer 0 +Staff 0 +Staff_commands 0 +Stem 0 +Stem 0 +Stem_req 0 +Symtable 0 +Symtables 0 +Text_def 0 +Text_req 0 +Time_description 0 +Voice 0 +Voice_element 0 +Voice_element_iterator 0 +Voice_iterator 0 +Word_wrap 0 delete_identifiers 1 parse_duration 1 parse_pitchmod 1 @@ -1,3 +1,4 @@ +Keywords: midi notation music typesetting gnu Subject: LilyPond 0.1 released - The GNU Project music typesetter BORN @@ -8,8 +9,7 @@ Subject: LilyPond 0.1 released - The GNU Project music typesetter (GNU LilyPond 0.1) - daughter to Jan 'Janneke' Nieuwenhuizen and Han-Wen 'Wendy' - Nienhuys + daughter to Jan 'Janneke' Nieuwenhuizen and Han-Wen 'Wendy' Nienhuys Lily is a healthy, bouncing baby weighing 345 kilobytes @@ -126,3 +126,40 @@ THANK YOU, Thanks go out to Mats Bengtsson, Werner Lemberg and Richard Stallman for comments and contributions. + + +**** NOTE + +LilyPond might have a minor bug if you use glibc-2; we will look into it +If you use glibc-2, please try 0.1.0 to see if it works and, download 0.1.1 +when it's available. + +LilyPond might exhibit a g++ bug on Solaris 1.5 (The stack frame gets corrupted +by a constructor) if you compile with -O2. We don't know workarounds. + + --- * --- + + We would like to dedicate this program to all the friends that we + met through music. + + + Those deserving special mention (in no particular order): +Esther, Marijke, Heike, Inge, Judith, Hannah, Auke, Ilse, Evelyn, +Maartje, Suzanne, Ilse (gee, again?) and last (but certainly not least) +Janneke! + + HWN + + That's a nice thought, Wendy. I've got a few too, to spread +the credits a bit (Again, no particular order) Michelle, Illushka, +Ruth, Eva, Fro/ydis, Monique, Noor, Sascha, Monique, Ilse, Monique, +Eva, Roos, Judith, Tim and, of course, Wendy! + + JCN + + +Of course, our other friends in the `Eindhovens Jongeren Ensemble' +(http://www.stack.nl/~hanwen/eje.html) cannot go unmentioned either. + + + --- * --- diff --git a/AUTHORS.text b/AUTHORS.text index 4ebcd69823..a035909c09 100644 --- a/AUTHORS.text +++ b/AUTHORS.text @@ -31,12 +31,16 @@ AAAAUUUUTTTTHHHHOOOORRRRSSSS CCCCOOOONNNNTTTTRRRRIIIIBBBBUUUUTTTTOOOORRRRSSSS +o Mats Bengtsson <matsb@s3.kth.se>, parts of clef- - reg.cc, clef-item.cc testing, general comments. + reg.cc, clef-item.cc swedish notenames, testing, + general comments. +o Werner Lemberg <xlwy01@uxp1.hrz.uni-dortmund.de>, misc bugfixes, some Beam and Stem code. - +o Alexandre Oliva <oliva@dcc.unicamp.br> + +o Alexandre Oliva <oliva@dcc.unicamp.br>, testing + + +o Anthony Fok <foka@gpu.srv.ualberta.ca>, debian + package: make/debian/* Your name could be here! If you want to help, then take a look at the SMALLISH PROJECTS section of in the file _T_O_D_O. @@ -57,10 +61,6 @@ CCCCOOOONNNNTTTTRRRRIIIIBBBBUUUUTTTTOOOORRRRSS - - - - -30/Jul/97 LilyPond 0.1.1 1 +12/Aug/97 LilyPond 0.1.7 1 @@ -1,22 +1,11 @@ +Document reintroduced deficiencies. -[document reintroduced deficiencies.] +* placement of bar-numbers -******************* - '.' -> lilypond: lexer.l:258: int My_lily_lexer::yylex(): Assertion `cnv == 1' failed. +* -*********************** +hw:~/musix/spacer/Documentation/out$ LILYINCLUDE=../../input lilypond -o wohltemperirt ../../input/wohltemperirt.ly - -\score { < - \melodic { \id "Staff" ""; c'4 g'4 } - \lyric { \id "Lyric" ""; hello4 bye4 < a chord > } - \lyric { \id "Lyric" ""; bye4 hello4 } - \melodic { \id "Staff" ""; c'4 g'4 } - > -} - -******************* - -Stack frame overwrite in on Solaris 2.5. -Engraver_group_engraver::Engraver_group_engraver() called from -Score_engraver::Score_engraver() +GNU LilyPond 0.1.7 #10/FlowerLib 1.1.26 #1 +Parsing ... [/home/hw/share/lilypond/init//symbol.ly[/home/hw/share/lilypond/init//dynamic.ly][/home/hw/share/lilypond/init//dutch.ly][/home/hw/share/lilypond/init//script.ly][/home/hw/share/lilypond/init//paper16.ly[/home/hw/share/lilypond/init//table16.ly^[[B][/home/hw/share/lilypond/init//engraver.ly]][/home/hw/share/lilypond/init//midi.lySegmentation fault (core dumped) +hw:~/musix/spacer/Documentation/out$ @@ -1,8 +1,11 @@ -This license applies to all files except: - - the included input files which explicitly state a different -copyright policy +*** NOTE + + This license applies to all files except the included input files + (which are in the subdirectory input/ + +*** END NOTE GNU GENERAL PUBLIC LICENSE Version 2, June 1991 diff --git a/Documentation/AUTHORS.pod b/Documentation/AUTHORS.pod index cab146ee80..f6366d5e00 100644 --- a/Documentation/AUTHORS.pod +++ b/Documentation/AUTHORS.pod @@ -36,7 +36,7 @@ and corresponding header files. =item * Mats Bengtsson <matsb@s3.kth.se>, parts of clef-reg.cc, clef-item.cc -testing, general comments. +swedish notenames, testing, general comments. =item * @@ -45,12 +45,14 @@ Beam and Stem code. =item * -Alexandre Oliva <oliva@dcc.unicamp.br> +Alexandre Oliva <oliva@dcc.unicamp.br>, testing + +=item * + +Anthony Fok <foka@gpu.srv.ualberta.ca>, debian package: make/debian/* =back Your name could be here! If you want to help, then take a look at the SMALLISH PROJECTS section of in the file F<TODO>. Some do not involve coding C++ - - diff --git a/Documentation/INSTALL.pod b/Documentation/INSTALL.pod index 82d5e944fd..ae5da8da87 100644 --- a/Documentation/INSTALL.pod +++ b/Documentation/INSTALL.pod @@ -95,8 +95,8 @@ Although not strictly necessary, these are recommended to have. =item * -Perl. Most scripts are written in Perl. Most documentation was created -with the perl's Plain Old Documentation. +Perl-5. Most scripts are written in Perl. Most documentation was created +with the perl's Plain Old Documentation. (I use 5.003) =item * @@ -311,18 +311,17 @@ permissions will not be set correctly, unfortunately) A Debian package is in the works -=head1 WINDOZE +=head1 WINDOWS NT/95 -Windows NT: +So, you're stuck with Windows, eh? Well, don't worry, you just +need (to get) Cygnus' windows32 port of gnu development stuff; +have a look at http://www.cygnus.com/gnu-win32. -you need the cygnus windows32 gnu port development stuff; have a look -at http://www.cygnus.com/gnu-win32. - -to make GNU LilyPond under, brr, aargh, shudder.. windows32, well, +To make GNU LilyPond under, brr, aargh, shudder... windows32, well, simply type: bash configure - make windows32 + make =head1 AUTHORS diff --git a/Documentation/Makefile b/Documentation/Makefile index edd922ce57..1bc695200e 100644 --- a/Documentation/Makefile +++ b/Documentation/Makefile @@ -31,7 +31,8 @@ DVIFILES = $(addprefix $(outdir)/, $(DOCFILES:.doc=.dvi)) # # list of distribution files: # -EXTRA_DISTFILES = lelie_icon.gif lelie_logo.gif $(DOCFILES) +EXTRA_DISTFILES = lelie_icon.gif lelie_logo.gif $(DOCFILES) +# $(wildcard Vocab*) default: do-doc diff --git a/Documentation/Rules.make b/Documentation/Rules.make index 7724807799..bf32a8d067 100644 --- a/Documentation/Rules.make +++ b/Documentation/Rules.make @@ -23,8 +23,13 @@ $(outdir)/%.text: $(outdir)/%.1 $(depth)/%.text: $(outdir)/%.text cp $< $@ -$(outdir)/%.html: %.pod - $(pod2html) $< +do_pod2html=$(pod2html) $< + +# do this for perl 5.004 +# $ make do_pod2html='$(pod2html) --infile $< --outfile=$@' html +# +$(outdir)/%.html: %.pod $(depth)/VERSION + $(do_pod2html) mv $(notdir $@) $(outdir)/ $(outdir)/%.5: %.pod @@ -36,16 +41,20 @@ $(outdir)/%.1: %.pod $(outdir)/%.gz: $(outdir)/% gzip -c9 $< > $@ -$(outdir)/%.dvi: $(depth)/input/%.ly $(lilyout)/lilypond - (cd $(outdir); lilypond ../$< ;\ +name-stem= $(notdir $(basename $<)) +$(outdir)/%.dvi: $(depth)/input/%.ly + (cd $(outdir); \ + rm lelie.midi ; \ + lilypond -o $(name-stem) ../$< ) + (cd $(outdir); \ if [ -f ../$(basename $< ).tex ]; \ then \ latex ../$(basename $< ) ;\ else \ - tex '\nonstopmode \input lelie' ;\ - mv lelie.dvi ../$@ ; \ + tex $(name-stem) ;\ fi) + # generate the pixmap at twice the size, then rescale (for antialiasing) $(outdir)/%.gif: $(outdir)/%.ps gs -q -sDEVICE=ppmraw -sOutputFile=- -r200 -dNOPAUSE $< -c quit |pnmscale 0.5| ppmtogif > $@ diff --git a/Documentation/faq.pod b/Documentation/faq.pod index ac6aa0637f..9d58aaec2f 100644 --- a/Documentation/faq.pod +++ b/Documentation/faq.pod @@ -138,6 +138,22 @@ output PostScript or render to an X window too) =head2 Miscellaneous +Q: Do you support pop songs (chords, single staff, lyrics)? + +A: Yes, see the twinkle-pop example + +Q: Do you support guitar chord diagrams? + +A: No, not yet. We ourselves don't play guitar, and don't know the +fine points of this notation. We would welcome anyone who could give +this a try. + +Q: Do you support TAB notation + +A: No. The same as for the previous question goes, but TAB is a lot +more work than diagrams (TAB needs modification of Parser, Lexer, +Notehead, Stem, and stem-code. ) + Q: How do I change the TeX layout? A: See lilyponddefs.tex, it has some comments. @@ -199,21 +215,21 @@ Q: I want a DOS/NT/W95 port. A.0: Reconsider. Try Linux. It's fun! -A.1: Currently (patchlevel 27), GNU LilyPond (and flowerLib) compiles, links -and runs on windhoos-nt, using the cygnus gnu port (release b17.1). +A.1: Currently (patchlevel 27), GNU LilyPond (and flowerLib) compiles, +links and runs on Windows-nt, using 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 GNU LilyPond type -C<make $OSTYPE>. (I am not promising to maintain this platform, it is just -that when having to use doze, i-m sometimes too lazy to reboot.) +Have a look at http://www.cygnus.com/gnu-win32. To make GNU LilyPond +type C<make>. (I am not promising to maintain this platform, it is just +that when forced into doze, i'm sometimes too lazy to reboot.) A.2: I haven't had time to find a GCC crosscompiler (I<with> g++ and -libg++, mind you) to DOS/win (in rpm, please :-) +libg++, mind you) to DOS/Windows (in rpm, please :-) -Q: I-m dozed enough to run the (sometimes bit stale) .exe-s you distribute. +Q: I just love to blindly run the (sometimes bit stale) .exe's you distribute. Why do i need cygwin.dll? -A: It-s all in this cut-n-paste: +A: It's all in this cut-n-paste: Minimalist GNU-Win32 Readme version 0.1.3 diff --git a/Documentation/gnu-music.pod b/Documentation/gnu-music.pod index fbb2d7402f..c209f2a31a 100644 --- a/Documentation/gnu-music.pod +++ b/Documentation/gnu-music.pod @@ -6,27 +6,61 @@ GNU Music project - manifesto Random ranting about the GNU Music project. -=head2 Note +=head2 History of the GNU Music Project -The GNU Music project was started by a few people (among others Robert Strandh, -Robert.Strandh@labri.u-bordeaux.fr), who wanted to create free software -for music printing and composing. After its initiation, its -development efforts slowed down. +Please note that this all happened when I wasn't around yet. If you +think that I am a biased, unfair, predisposed hypocrite, then don't +bother flaming me; I already know that. -Independently, I started LilyPond. When I showed it to +The GNU Music project is a project which aims to create free software +for music printing and composing. It was started in november '92 by a +core team of four members (Bryan Ford <baford@cs.utah.edu>, David Linn +<drl@vuse.vanderbilt.edu>, Francois Pinard <pinard@iro.umontreal.ca>, +Neil Jerram <nj104@cus.cam.ac.uk> and in January '93 Robert Strandh +<Robert.Strandh@labri.u-bordeaux.fr> joined. + +After serious disputes with Robert Strandh +<Robert.Strandh@labri.u-bordeaux.fr> and the FSF staff in '94, the +project core team got divided. The development efforts of GMP stopped. + +Independently, I (HWN) started LilyPond. When I showed it to RMS, he was very enthousiastic about having LilyPond in the GNU project. I subsequently learned about the GNU Music project, and -contacted them. We (the GNU Music project people and us, LilyPond -people) agreed that cooperation would be desirable. Although merging -of both efforts is technically infeasible at this point, we did decide -that LilyPond should also be part of the GNU Music project (when it is -really released). - -In summary, LilyPond is part of the GNU project, and part of the (yet -to be created) GNU Music project. LilyPond 's existence does not mean -that other efforts for free music tools have come to a halt. In -particular, the following document is entirely mine, and is not meant -to reflect anyone else's opinion. +contacted them. + +What was left of the GMP (Robert Strandh) and us, LilyPond people, +agreed that cooperation would be desirable. Although merging of both +efforts was and is technically infeasible, we did decide that LilyPond +should also be part of the GNU Music project. + +Only later did I discover the previous quarrels about the GMP-"take +1". To show that I am aware of the history, and to make sure nobody +gets me wrong or is angry at me because I stole a project or a +project's name, I wrote this note. + +In summary, LilyPond is now the only substantial embodiment of the GNU Music +Project, and it is part of the GNU project. + +For completeness' sake, I will mention the other efforts here: + +=over 4 + +=item G Sharp, http://dept-info.labri.u-bordeaux.fr/~strandh/Gsharp + +An alpha version notation editor for X in Scheme. Source available on +request. + +=item GNU music, + +An alpha version of a music editing system with Musictex +output. Pretest versions of GNU Music (v0.3) can still be obtained from +Francois Pinard. + +=back + +This history note is probably biased in some way, because I wrote it. +The rest of this document is also entirely mine, and is not meant to +reflect anyone else's opinion. =head1 GOAL @@ -70,25 +104,12 @@ performing =back -Music publishers make lots of money out of selling sheet music which -is in the public domain (the composers died a long time ago). It is -usually prohibited to xerox the sheet music. Publishers have two -arguments to justify this policy: the high prices are there to guarantee -diversity (keeping lots of stock is expensive), and to encourage new -work being composed. - -LilyPond addresses the first issue: storing mudelas takes up almost no -space at all. Other systems should address the other issue: -encouraging laymen to take up composing, in the same way that GNU -tools have created a whole new generation of programmers. - -The public deserves to get public domain music for free (zero cents). +These systems should encourage laymen to take up composing, in the +same way that GNU tools have created a whole new generation of +programmers. The public deserves free tools for composing and printing. -In general, the same arguments as for software hold for music. See -Stallmans articles on free software. - =head1 REQUIREMENTS @@ -146,8 +167,7 @@ but it is not (yet) suited to interactive typesetting which can display clear notewriting in (say) an X-window -G-Sharp is there, but far from finished. Ideally the system should -cooperate with the typesetting engine +Ideally the system should cooperate with the typesetting engine =item An ASCII language @@ -180,11 +200,6 @@ simplifies creating a collection of music (difficult) A system to generate accompaniments, figured bass, automatic accompaniment, etc. -=item An internet archive of free music - -The complete works by Bach, Beethoven, and any other ancient composer -should be electronically retrievable. This might be a separate -project: the Free Music Project. =back diff --git a/Documentation/index.pod b/Documentation/index.pod index 43f6c2b1e0..992009edc9 100644 --- a/Documentation/index.pod +++ b/Documentation/index.pod @@ -8,6 +8,9 @@ GNU LilyPond is a program which converts music definition files into visual or auditive output: it can typeset formatted sheet music to a TeX file and and (mechanical) performances to MIDI files. +This is not a Fanmail/Hype page. These pages were entirely created from +the LilyPond package-sources + =head2 Examples <a href=example_output.html @@ -107,6 +110,14 @@ The GNU Music project > =item * +<a href=mutopia.html +> +Mutopia -- Music To the People +</a +> + + +=item * <a href=ANNOUNCE.txt > The announce of 0.1 @@ -141,7 +152,7 @@ The Change log > =item * -<a href=lilygut.html +<a href=internals.html > internal structures. </a @@ -175,7 +186,7 @@ AUTHORS =over 5 =item * -<a href=lilyliterature.html +<a href=literature.html > Papers, books and online-resources on music typesetting </a diff --git a/Documentation/lilygut.pod b/Documentation/internals.pod index 4d174f1e63..4d174f1e63 100644 --- a/Documentation/lilygut.pod +++ b/Documentation/internals.pod diff --git a/Documentation/lilypond.pod b/Documentation/lilypond.pod index faa26928e4..c2d2656935 100644 --- a/Documentation/lilypond.pod +++ b/Documentation/lilypond.pod @@ -10,7 +10,7 @@ lilypond - the GNU music typesetter GNU LilyPond is a program which converts music definition files into visual or auditive output: it can typeset formatted sheet music to a -TeX file and and (mechanical) performances to MIDI files. +TeX file and play (mechanical) performances to MIDI files. =head1 OPTIONS @@ -22,12 +22,12 @@ add F<FILE> to the search path for input files. =item B<-M,--midi> -do midi output only +do midi output only. =item B<-d,--debug>, -Turn debugging info. GNU LilyPond will read the file F<.dstreamrc>, which -tells for what functions and classes may produce copious debugging +Turn debugging info on. GNU LilyPond reads the file F<.dstreamrc>, +which lists what functions and classes may produce copious debugging output. =item B<-w,--warranty>, @@ -41,11 +41,11 @@ Set the default output file to F<FILE>. =item B<-h,--help>, -Show a summary of usage +Show a summary of usage. =item B<-i,--init=>F<FILE> -set init file to F<FILE> (default: F<symbol.ly>) +set init file to F<FILE> (default: F<symbol.ly>). =item B<--include, -I>=F<DIRECTORY> @@ -53,21 +53,21 @@ add F<DIRECTORY> to the search path for input files. =item B<--ignore-version, -V> -make incompatible mudela version non-fatal +make incompatible mudela version non-fatal. =back =head1 FEATURES -This is an overview of the features that GNU LilyPond supports. For -details on how to use them, you should consult mudela(5) +This is an overview of the features that GNU LilyPond supports. For +details on how to use them, you should consult mudela(5). =over 5 =item * ASCII script input, with identifiers (for music reuse), -customizable notenames, customizable fontset +customizable notenames, customisable fontset. =item * @@ -79,7 +79,7 @@ MIDI to Mudela conversion through the mi2mu program. =item * -Multiple staffs in one score. Each staff can have a different meters. +Multiple staffs in one score. Each staff can have a different meters. =item * @@ -90,11 +90,11 @@ transposition dynamics (both absolute and hairpin style) =item * multiple voices within one staff; beams optionally shared -between voices. Up to four voices is handled cleanly. +between voices. Up to four voices is handled cleanly. =item * -multiple scores within one input file. Each score is output to +multiple scores within one input file. Each score is output to a different file. =item * @@ -105,11 +105,11 @@ clef changes, meter changes, cadenza-mode, key changes, repeat bars =head1 DISCLAIMER & COPYING POLICY -GNU LilyPond is copyright 1996,97 by its authors. GNU LilyPond is -distributed under the terms of the GNU General Public -License. GNU LilyPond is provided without any warranty what so ever. -GNU LilyPond may be freely distributed. For further information consult -the GNU General Public License, which is in the file F<COPYING> +GNU LilyPond is copyright 1996, 1997 by its authors. GNU LilyPond is +distributed under the terms of the GNU General Public License. GNU LilyPond +is provided without any warranty what so ever. +GNU LilyPond may be freely distributed. For further information consult +the GNU General Public License, from the file F<COPYING>. =head1 AUTHORS @@ -132,7 +132,7 @@ Jan Nieuwenhuizen <jan@digicash.com>, http://www.digicash.com/~jan. =head1 PROBLEMS -There is an extensive list of todoes and bugs. See F<TODO>. In +There is an extensive list of todoes and bugs. See F<TODO>. In general, try to find out =over 4 @@ -159,7 +159,7 @@ send a description of the platform you use =item * send a description of the LilyPond version you use (with -compile/config options please) +compile/configure options please) =item * send a description of the bug itself. @@ -171,8 +171,8 @@ send it to bug-gnu-music@vuse.vanderbilt.edu It does help if you can find out where the bug comes from: if GNU LilyPond bombs out, then please recompile using with debugging info -turned on, and send gdb stacktrace of the crash. It also helps if you -can print the values of the objects. So if your trace is +turned on, and send gdb stacktrace of the crash. It also helps if you +can print the values of the objects. So if your trace is received SIGSEGV (gdb) backtrace 12 @@ -193,7 +193,7 @@ Than it would help if you send a dump of the Interval and the Item =item F<symbol.ly> -The initialisation file with symbol tables etc. It +The initialisation file with symbol tables etc. It includes files from the directory F<init/>. =back @@ -214,7 +214,7 @@ On technical details of LilyPond =item mudela-man -On the input format. This is a LilyPond-enhanced LaTeX document. +On the input format. This is a LilyPond-enhanced LaTeX document. =item MANIFESTO @@ -227,7 +227,7 @@ The GNU LilyPond FAQ list =item http://www.stack.nl/~hanwen/lilypond/index.html GNU LilyPond has her own webpage. This webpage contains the MIDI, GIF -and PS files for some standard music files. It also has the complete +and PS files for some standard music files. It also has the complete LilyPond documentation =back @@ -235,7 +235,7 @@ LilyPond documentation GNU LilyPond is updated very frequently, the latest version is always available at: ftp://pcnov095.win.tue.nl/pub/lilypond and -ftp://alpha.gnu.ai.mit.edu/gnu/ +ftp://alpha.gnu.ai.mit.edu/gnu/lilypond/ For programs which are part of the GNU music project, the following @@ -251,13 +251,13 @@ subject "subscribe" to info-gnu-music-request@vuse.vanderbilt.edu =item help-gnu-music@vuse.vanderbilt.edu -For help with programs from the GNU music project. To subscribe: send +For help with programs from the GNU music project. To subscribe: send mail with subject "subscribe" to help-gnu-music-request@vuse.vanderbilt.edu =item bug-gnu-music@vuse.vanderbilt.edu -If you have bugreports, you should send them to this list. If you want +If you have bugreports, you should send them to this list. If you want to read all bugreports, you should subscribe to this list. To subscribe: send mail with subject "subscribe" to bug-gnu-music-request@vuse.vanderbilt.edu @@ -284,19 +284,19 @@ than the names being similar :-) (for a detailed changelog, see F<NEWS>) GNU LilyPond's roots lie in MPP, a preprocessor to the rather arcane -MusiXTeX macro package for TeX. A friend of mine, Jan Nieuwenhuizen +MusiXTeX macro package for TeX. A friend of mine, Jan Nieuwenhuizen wrote the first 44 versions (0.01 to 0.44), then his program caught my attention, and I was slowly sucked in to the interesting problem of -easily producing beautifully printed music. I contributed some -code. We soon realised that MPP's design was too fundamentally broken +easily producing beautifully printed music. I contributed some +code. We soon realised that MPP's design was too fundamentally broken to be repaired, so it was decided to rewrite MPP. We debated a lot about -the requirements to an inputformat (fall 1995). I sat down and started +the requirements to an inputformat (fall 1995). I sat down and started with a parser-first, bottom-up rewrite called mpp95 (which totally failed, obviously). After long and hard thinking, I came up with an algorithm for the horizontal spacing of multiple staffs (april 1996) I coded it (and did -not test it). After starting with this fundamental piece, I slowly +not test it). After starting with this fundamental piece, I slowly added the stages which come before spacing, and after. A half year later, I had a first working version, (october 1996). I announced Patchlevel 0.0.7 (or 8) to the mutex list after asking some technical @@ -304,7 +304,7 @@ details on spacing; it was downloaded approximately 4 times. Then I got the hang of it, and in the subsequent two months, I coded until it had doubled in size (pl 23). -Most the other history is described in the NEWS file. The first large +Most the other history is described in the NEWS file. The first large scale release (0.1) was done after approximately 78 patchlevels on August 1, 1997. diff --git a/Documentation/links.pod b/Documentation/links.pod index c5fadae003..ab1adf7a3e 100644 --- a/Documentation/links.pod +++ b/Documentation/links.pod @@ -16,6 +16,11 @@ of interest to LilyPond users. LilyPond is part of the GNU Project started by the Free Software Foundation to create a system of free software for the world-community +=item http://www.zib.de/Visual/software/doc++/index.html + +The documentation system for C++ sources, which the LilyPond sources use. + + =back =head2 Ftp @@ -34,8 +39,8 @@ An ftp site which is in CTAN. =item ftp://ftp.redhat.com/pub/contrib/ -RedHat Software develops and markets a GNU/Linux distribution (of -which we are avid users) +The FTP site of RedHat Software. + =back @@ -45,7 +50,7 @@ Beta releases will also be at =item ftp://pcnov095.win.tue.nl/pub/lilypond -=item ftp://alpha.gnu.ai.mit.edu/gnu/ +=item ftp://alpha.gnu.ai.mit.edu/gnu/lilypond/ =back @@ -73,8 +78,9 @@ mailing list have been setup: =item info-gnu-music@vuse.vanderbilt.edu -For information on the GNU Music project, to subscribe: send mail with -subject "subscribe" to info-gnu-music-request@vuse.vanderbilt.edu +A moderated list for information on the GNU Music project, to +subscribe: send mail with subject "subscribe" to +info-gnu-music-request@vuse.vanderbilt.edu =item help-gnu-music@vuse.vanderbilt.edu @@ -93,7 +99,7 @@ bug-gnu-music-request@vuse.vanderbilt.edu For discussions concerning the GNU Music project, to subscribe: send mail with subject "subscribe" to -gnu-music-discuss-request@vuse.vanderbilt.edu, +gnu-music-discuss-request@vuse.vanderbilt.edu =back @@ -126,4 +132,10 @@ The Linux webwatcher. Transcriptions of the music of Thomas Ravenscroft, partly using LilyPond +=item http://www.redhat.com/ + +develops and markets a GNU/Linux distribution (of +which we are avid users) + + =back diff --git a/Documentation/lilyliterature.pod b/Documentation/literature.pod index 5bba17b138..f96915a22c 100644 --- a/Documentation/lilyliterature.pod +++ b/Documentation/literature.pod @@ -250,9 +250,6 @@ Kurt Stone. Music Notation in the Twentieth Century. New York: Norton, =head2 Other stuff -More on GNU Music: -http://dept-info.labri.u-bordeaux.fr/~strandh/Gsharp - Peter S. Langston, ``Unix music tools at Bellcore''. Software --- Practice and Experience, Vol. 20(S1), S1/47--S1/61, 1990. @@ -272,8 +269,13 @@ http://www.jtauber.com/music/encoding/niff/ [Specs for NIFF, a comprehensive but binary (yuk) format for notation HWN] -SMDL, Standard Musical Description Language -ftp://ftp.ornl.gov/pub/sgml/wg8/smdl/10743.pdf +SMDL, Standard Musical Description Language, +ftp://ftp.ornl.gov/pub/sgml/wg8/smdl/10743.pdf. ISO/IEC DIS 10743. + +[An ISO defined SGML language. A much more thorough treatment of music +definition than Mudela (but not suited for manual entry). It deals +with notation and perfomance issues by (basically) saying "You can +embed a MIDI or NIFF file" (sic) HWN] MPDL, diff --git a/Documentation/mi2mu.pod b/Documentation/mi2mu.pod index 77a68f1f52..1e35a7547a 100644 --- a/Documentation/mi2mu.pod +++ b/Documentation/mi2mu.pod @@ -80,11 +80,11 @@ This is an overview of the features that Mi2mu supports. =head1 DISCLAIMER & COPYING POLICY -Mi2mu is copyright 1996,97 by its authors. Mi2mu is distributed +Mi2mu is copyright 1996, 1997 by its authors. Mi2mu is distributed as part of GNU LilyPond, under the terms of the GNU General Public License. Mi2mu is provided without any warranty what so ever. Mi2mu may be freely distributed. For further information consult -the GNU General Public License, which is in the file F<COPYING>. +the GNU General Public License, from the file F<COPYING>. =head1 AUTHORS diff --git a/Documentation/mudela-course.doc b/Documentation/mudela-course.doc index a918c5df2e..369cfc745c 100644 --- a/Documentation/mudela-course.doc +++ b/Documentation/mudela-course.doc @@ -41,7 +41,8 @@ chords by \verb+<+ and \verb+>+. \begin[verbatim]{mudela} \score { \melodic { % {...} is a voice - c'4 g'4 % c and g are pitches, 4 is the duration (quaver) + c'4 g'4 % c and g are pitches, 4 is the duration + % (crotchet/quarter note) c''4 ''c4 % c' is 1 octave up, 'c 1 down. <c'4 g'4> % <...> is a chord } diff --git a/Documentation/mudela-man.doc b/Documentation/mudela-man.doc index 8e3d0de2ea..a4cb803430 100644 --- a/Documentation/mudela-man.doc +++ b/Documentation/mudela-man.doc @@ -24,7 +24,8 @@ effective language for defining music. We call this language (rather arrogantly) The Musical Definition Language or Mudela, for short.\footnote{If anybody comes up with a better name, we'd gladly take this. Gourlay already uses Musical Description Language, - G-Sharp Score Definition Language. We're not being original here} + G-Sharp Score Definition Language. ISO standard 10743 defines a + Standard Music Description Language. We're not being original here} The first aim of Mudela is to define a piece of music, being complete from both from a musical typesetting, as from a musical performing @@ -218,10 +219,10 @@ meaning of \verb+_+ and the resolution of words You enter a note by giving the name and the reciprocal of the duration: \begin[fragment,verbatim]{mudela} -a'4 % dutch names +a'4 % Dutch names \end{mudela} -is a A-1 pitched quaver. The ' signifies an octave change. A-1 is 440 +is a A-1 pitched crotchet. The ' signifies an octave change. A-1 is 440 Hz concert-pitch. \verb+c'+ is also known as the central c. More examples: \begin[fragment,verbatim]{mudela} @@ -235,11 +236,11 @@ a'' % 880 The last one is an A flat, (just below 110 Hz concert-pitch). The \verb+*2/3+ signifies that this note is part of a triplet (3 in stead of 2). The -duration is one and a half quaver (\verb+4.+) times 2/3. +duration is one and a half quarter note (\verb+4.+) times 2/3. Notenames are just a special kind of identifiers, and can be declared for any language appropriate (see \file{init/dutch.ly}). The default language -for notenames is defined to be dutch. In dutch, the notenames are +for notenames is defined to be Dutch. In Dutch, the notenames are a,b,c,d,e,f and g. Sharps are formed by adding the extension "is", flats by adding ``es'' @@ -334,7 +335,7 @@ a4 \dynamic { 0 } % 0 = fff, 7 = ppp Mudela defines the following dynamic identifiers: \begin{verbatim} -ppp pp p mp mf df ff fff % df iso f, f is a notename. +ppp pp p mp mf f ff fff \end{verbatim} and the following abbreviations: \begin{verbatim} @@ -492,7 +493,7 @@ You can set the voicegroup of a voice with the command \verb+\group+, e.g., In this example, the two oboe voices share one staff and are initially in the voicegroup called "oboes". They will share beams, dynamics etc. -After two quavers, oboeI "pushes" its group: a new voicegroup is +After two quarter notes, oboeI "pushes" its group: a new voicegroup is created, called "oboes+solo". The \verb+\group "-"+ command makes the voice enter "oboes" again. @@ -547,7 +548,7 @@ same syntax as grouping: \end{verbatim} Make the piece start with a partial measure [english translation?] -lasting 1 3/4 quaver. +lasting 1 3/4 quarter notes. These commands are also "voice elements", and constitute simple mudela (consisting of stuff with duration 0). diff --git a/Documentation/mutopia.pod b/Documentation/mutopia.pod new file mode 100644 index 0000000000..bdefc53132 --- /dev/null +++ b/Documentation/mutopia.pod @@ -0,0 +1,35 @@ +=head1 NAME + +Mutopia project - manifesto + +=head1 DESCRIPTION + +Random ranting about the Mutopia project, aka "Music To the People." +[Not yet finished, so this is unpolished] + +=head1 WHY + +Music publishers make lots of money out of selling sheet music which +is in the public domain (the composers died a long time ago). It is +usually prohibited to xerox the sheet music. Publishers have two +arguments to justify this policy: the high prices are there to guarantee +diversity (keeping lots of stock is expensive), and to encourage new +work being composed. + +This is bad. Storing a Mudela file takes almost no space at all, and +if sheet music could be had for free, then it would be much easier +obtain less famous music. These composers have died long ago, and not +having their music available only discourages people from +experimenting with it. You deserve to get public domain music for +free (zero cents) + +=head1 WHAT + +For literature, the project Gutenberg has an archive of public domain +literary works. For music, this does not exist yet. + +We also need an archive of public domain sheet music; this is what we +call The Mutopia Project. + + + diff --git a/Documentation/other-packages.pod b/Documentation/other-packages.pod index 9da5f26af9..3049783499 100644 --- a/Documentation/other-packages.pod +++ b/Documentation/other-packages.pod @@ -9,11 +9,6 @@ packages. Feel free to add info (and mail it to me). =head2 Free packages (with source) -=item G Sharp, http://dept-info.labri.u-bordeaux.fr/~strandh/Gsharp - -An alpha version notation editor for X in Scheme. Source available on -request. - =item Rosegarden, http://www.bath.ac.uk/~masjpf/rose.html A Notation editor/Sequencer for X (windows95 port underway). Outputs musictex. @@ -51,7 +46,7 @@ MusixTeX is a macro package for TeX to typeset polyphonic or instrumental music by Daniel Taupin, Ross Mitchell and Andreas Egler. It includes a full-featured set of fonts. -=item ABC2MTeX, http://www.gmd.de/Misc/Music/ +=item ABC2MTeX, http://www.gre.ac.uk/~c.walshaw/abc A preprocessor to MusixTeX by Chris Walshaw for transcribing folk and traditional music. diff --git a/INSTALL.text b/INSTALL.text index 3a2b240602..a91ed8b4ef 100644 --- a/INSTALL.text +++ b/INSTALL.text @@ -61,7 +61,7 @@ RRRRUUUUNNNNNNNNIIIINNNNGGGG -3/Aug/97 LilyPond 0.1.1 1 +8/Aug/97 LilyPond 0.1.7 1 @@ -89,9 +89,9 @@ RRRREEEECCCCOOOOMMMMMMMMEEEENNNNDDDDEEEEDDDD Although not strictly necessary, these are recommended to have. - +o Perl. Most scripts are written in Perl. Most + +o Perl-5. Most scripts are written in Perl. Most documentation was created with the perl's Plain - Old Documentation. + Old Documentation. (I use 5.003) +o GNU find @@ -127,7 +127,7 @@ CCCCOOOONNNNFFFFIIIIGGGGUUUURRRRIIIINNNNGGGG a -3/Aug/97 LilyPond 0.1.1 2 +8/Aug/97 LilyPond 0.1.7 2 @@ -193,7 +193,7 @@ INSTALL(1) LilyPond documentation INSTALL(1) -3/Aug/97 LilyPond 0.1.1 3 +8/Aug/97 LilyPond 0.1.7 3 @@ -259,7 +259,7 @@ IIIINNNNSSSSTTTTAAAALLLLLLLLIIIINNNNGGGG -3/Aug/97 LilyPond 0.1.1 4 +8/Aug/97 LilyPond 0.1.7 4 @@ -325,7 +325,7 @@ RRRREEEEDDDDHHHHAAAATTTT LLLLIIIINNNNUUUUXXXX -3/Aug/97 LilyPond 0.1.1 5 +8/Aug/97 LilyPond 0.1.7 5 @@ -337,17 +337,17 @@ INSTALL(1) LilyPond documentation INSTALL(1) DDDDEEEEBBBBIIIIAAAANNNN GGGGNNNNUUUU////LLLLIIIINNNNUUUUXXXX A Debian package is in the works -WWWWIIIINNNNDDDDOOOOZZZZEEEE - Windows NT: +WWWWIIIINNNNDDDDOOOOWWWWSSSS NNNNTTTT////99995555 + So, you're stuck with Windows, eh? Well, don't worry, you + just need (to get) Cygnus' windows32 port of gnu + development stuff; have a look at + http://www.cygnus.com/gnu-win32. - you need the cygnus windows32 gnu port development stuff; - have a look at http://www.cygnus.com/gnu-win32. - - to make GNU LilyPond under, brr, aargh, shudder.. + To make GNU LilyPond under, brr, aargh, shudder... windows32, well, simply type: bash configure - make windows32 + make AAAAUUUUTTTTHHHHOOOORRRRSSSS @@ -391,6 +391,6 @@ AAAAUUUUTTTTHHHHOOOORRRRSSSS -3/Aug/97 LilyPond 0.1.1 6 +8/Aug/97 LilyPond 0.1.7 6 @@ -1,11 +1,105 @@ +pl 7 + - Audio_element as base for Audio_item and Audio_staff. fixes +midi-lyric segfault + - added "Gallina a due violini" + - make MIDI files on website. + - Collision now also is an Element_group. + - bf: announce Collision when created + +******** +aug 13 +pl 6 + - bf: 13 shift/reduce in parser fixed + - bf: plets in parser + - bf: main.o (again) + - german notenames (RM) + - Score_elem::offset_ now relative to its X/Y groups. Slight +speed increase? + +******** +aug 12 +pl 5 + + - Wordwrap revert + - added LilyPond in WWW titles + - oops. A quaver is a 8th note, not a 4th + - bf: main.o remaking in lily/Makefile + - unhair Voice_iterator + - bf: error if no music in score + - bf: don't create translators if Chord element is empty + - bf: ctor of Tempo_req + - use virtual do_equal_b() for request comparison + - bf: turned off default plets: c4*2/3 c4*2/3 -> c4*2/3 c4*4/9 + - bf: time_int() of an empty chord/voice + - more corrections to GMP Manifesto + - debian updates (AF) + - bf: g++ ICE in Performer_group_performer + - use fread() for reading in Simple_file_storage + +pl 0.1.3.jcn1 + - mi2mu: simplification +bf lily_stream: indentation and wordwrap + - mi2mu: bf: blunt: non-alpha(num) chars from identifiers + +********* +aug 11 +pl 4 + - correction of GNU Music Manifesto + - moved lowlevel stuff of Source_file to Mapped_file_storage. +Interface via File_storage. (Now using Simple_file_storage) + - bf: c4-"A"-"B" + - bf: exit status + - declarable keys + - Engraver_group_engraver::find_simple_engraver() + - bf: lily/Makefile + - bf: Midi_note_event ctor + - bf: tempo request + - popular twinkle twinkle (JV) + - mudela: parse tempo requests, \midi{ \tempo 4= 60;} + +****** +aug 8 +pl 3 + - don't crash if no Clef_engraver. + - PScore -> Paper_score + - bf: Score_elem::extent() init of interval + - bfs: {Horizontal,Vertical}_group related + - bf: don't change original Item while doing making + multiple copies + - bf: configure DATADIR + - bf: type of spanbar. + +pl 0.1.2.jcn1 + - minor doco fixes + - revived Midi_walker + - moved midi out of performer-* to audio-* + - Audio_staff + - removed all <ugh> members from performers + +******* +aug 7 +pl 2 + - junked Line_of_staff + - bf: --output + - bf: . in lexer + - bf: mi2mu version number. + - bf: in mudela-book + - bf: don't forget to make mi2mu + - Bar_number_grav: measure numbers (experimental) + - Bar_column_engraver, Bar_column: scripts on bars + - rewrite of {Horizontal,Vertical}_group. Yes, again. +Now neatly integrated into class hierarchy + - Axis, Axis_group + - Debian rules (AF) + pl 0.1.1.jcn1 - Audio{column,score,item,...}, more generic audio - bf: Makefiles - - added empty flower/aclocal.m4? - bf: mi2mu mudela version +********* +aug 5 pl 0.1.1 - - {Horizontal, Vertical}_group. A score_element may be in at most one. + - {Horizontal, Vertical}_group. A score_element may be in at most one. - This means Horizontal_group_item and Vertical_group_spanner need special support. - This also means a big speed increase - configure cleanup @@ -5,6 +5,7 @@ GNU LilyPond which converts music definition files into visual or audio output: it can typeset formatted sheet music in TeX and and (mechanical) perfomances to MIDI files. + 1. VERSIONING if you have downloaded a @@ -46,30 +47,17 @@ You can also simply read the .pod sources. They are ASCII text. LilyPond is a long way from finished and polished. I do appreciate criticism, comments, bugreports, patches, etc. Please send e-mail to -the mailing lists - - - info-gnu-music@vuse.vanderbilt.edu - help-gnu-music@vuse.vanderbilt.edu - bug-gnu-music@vuse.vanderbilt.edu - gnu-music-discuss@vuse.vanderbilt.edu, - -See the man page on what to use for what. Or you can send it directly -to us: hanwen@stack.nl, jan@digicash.com. - - - +the mailing lists. See Documentation/links.pod for more info -Have fun! 6. DOZE If you have received this file as part of a DOS/Window32 distribution (lilypond-*.zip ), then it is advisable to also download the source -package, since it contains the complete documentation +package, since it might contain more documentation ftp://pcnov095.win.tue.nl/pub/lilypond/ (Europe) - ftp://alpha.gnu.ai.mit.edu/gnu/ (US) + ftp://alpha.gnu.ai.mit.edu/gnu/lilypond/ (US) The website also contains the complete documentation @@ -77,5 +65,20 @@ The website also contains the complete documentation +7. CAVEATS + +Solaris + +Stack frame overwrite on Solaris 2.x (this will produce a seg +fault, signal 11). Stacktrace + + Engraver_group_engraver::Engraver_group_engraver(int) + Score_engraver::Score_engraver( ) + get_group_engraver_p() + +We don't know a fix or workaround, but compiling without optimisation +might help (Without -O2 optimisation, my execs run fine on Solaris; +without -O2, but with purify, it dumps core) + @@ -5,13 +5,25 @@ done, or is an idea that I want to think about Most of the items are marked in the code as well, with full explanation. grep for TODO and ugh/ugr + * Generate TeX titles from MudelaHeader - * generate stuff in out/default, out/sun5-irix etc iso out/ -and out-sun5/ + * integrate midi-elts from mi2mu and lily + + * virtualise PCols to make encapsulated spacing problems + + * fix spacing: standchen: distance bar-note, + strange stretching and compressing of 8's + + * Doc Mutopia (Music To The People) + + * context in spring-spacer. - * derive dstream, texstream from ostream? + * don't count bars which are not on first beat. - * A typical pop-music example. + * generate stuff in out/default, out/sun5-irix etc iso out/ + and out-sun5/ + + * derive lily_stream, Dstream, texstream from ostream? * check libtool, automake @@ -31,21 +43,21 @@ and out-sun5/ * get rid of gif files. - * set_midi_channel/staff() out of performer. - * dots into separate item. * use String iso Text_def for lyrics. * use position 0 for center of staff iso bottom. + * Klavarskribo? + * return status on exit * lyrics in chords still fuck up. * rewire acknowledge_element() logic with a process_acknowledged() - * Global type registration. + * Global type registration. My_class * p = create_object( My_class ) Type t = get_type ( *p ); @@ -68,10 +80,12 @@ and out-sun5/ 3RD PARTY BUGS: + * collision.cc: 138, g++ errors + * bugreport to doc++ devel: struct not in class hier; public virtual baseclasses - * DOC++ bugs/ newer version? + * DOC++ bugs/newer version? * Rational infty(HUGE_VAL) on glibc / w32 @@ -81,10 +95,20 @@ and out-sun5/ yy_scan_buffer in C++.. * (where are the) gcc compile warnings on linux - + +LILY BUGS + + \score { < + \melodic { \id "Staff" ""; c'4 g'4 } + \lyric { \id "Lyric" ""; hello4 bye4 < a chord > } + \lyric { \id "Lyric" ""; bye4 hello4 } + \melodic { \id "Staff" ""; c'4 g'4 } + > } PROJECTS + * emacs-mode for mudela + * input converters - NIFF? - ABC? @@ -174,17 +198,23 @@ PROJECTS besides lists of flats/sharps, possibly via declaration - key transposition. - key undo: \key bes; .. . \key; should print natural - - special key: \key 'b bes bis'; + - special key: \key bes 'b bis'; - spacing, national styles? -PARSER - * Duration -> Musical_duration, typedef Rational Duration? + * Support for TAB + - redo Notehead to allow digits as heads + - add a \tablature {} lexer mode for easy entering -BUGS * should adjust stemlength for flag number. - * lilypond - -> crash + * breaking: + - caching breakpoints + - saving them + - allowing users to set them. + - penalties + - specify number of lines + - set linelength per line SEVERELY LACKING: @@ -272,8 +302,6 @@ SMALLISH PROJECTS * centered whole rest - * caching breakpoints / saving them. - * use dstream feature in mi2mu * qtor, btor, mtor-> tor( QUIET_ver ), tor( DEBUG_ver ), etc. @@ -308,10 +336,6 @@ SMALLISH PROJECTS * configure idealspacing: arithmetic spacing - * LilyPond .deb. Other packaging methods? - - * detect -pipe - DOC * Score_elem structure. @@ -346,7 +370,6 @@ FUTURE * volta IDEAS - * check out CORBA for Score_elems? * derive PCol from Score_elem? More in Score_elems? Spacing? @@ -388,7 +411,7 @@ IDEAS % fingering: footing: < a-4 c-2 g-1 > < c-\ltoe e-\lheel > - * parameterised scripts for fingering and footing: + * stackparameterised scripts for fingering and footing: % toe to bheel four to five % ^_u 4_5 @@ -1,6 +1,6 @@ TOPLEVEL_MAJOR_VERSION = 0 TOPLEVEL_MINOR_VERSION = 1 -TOPLEVEL_PATCH_LEVEL = 1 +TOPLEVEL_PATCH_LEVEL = 7 # use to send patches, always empty for released version: -TOPLEVEL_MY_PATCH_LEVEL = .jcn1 +TOPLEVEL_MY_PATCH_LEVEL = diff --git a/bin/convert-mudela.in b/bin/convert-mudela.in index f1b640c0ae..bad1df51ec 100644 --- a/bin/convert-mudela.in +++ b/bin/convert-mudela.in @@ -1,4 +1,5 @@ #!@PERL@ -w +# -*-perl-*- =head1 TODO @@ -105,6 +106,10 @@ sub convert_0_0_60_to_0_0_61 } +sub convert_0_1_0_to_0_1_1 +{ + s/\\tempo (.*):(.*);/\\tempo $1 = $2;/g +} ############################################################### sub last_conversion @@ -144,19 +149,22 @@ my %minor_conversions = ("0.0.50" => \&no_conv, "0.0.58" => \&convert_0_0_57_to_0_0_58, "0.0.59" => \&convert_0_0_58_to_0_0_59, "0.0.60" => \&convert_0_0_59_to_0_0_60, - "0.0.61" => \&convert_0_0_60_to_0_0_61 + "0.0.61" => \&convert_0_0_60_to_0_0_61, + "0.1.1" => \&convert_0_1_0_to_0_1_1 ); sub versions { - return (sort keys %minor_conversions); + return (sort { cmpver; } (keys %minor_conversions)); } -sub show_rules +sub show_rules { - print "Rules: ", join(", ", sort keys %minor_conversions), "\n"; + my (@v) = versions; + + print "Rules: ", join(", ", @v), "\n"; } @@ -167,7 +175,6 @@ sub do_conversion my @applicable_conversion; my @mudela_levels; -# die "This is too old to convert " if $from < 50; my @v = versions; foreach $ver (@v) { if (version_compare($ver, $from) > 0 && version_compare($ver,$to) <= 0 ){ diff --git a/bin/make-version b/bin/make-version index d8e79346cd..3be14353cb 100755 --- a/bin/make-version +++ b/bin/make-version @@ -10,11 +10,4 @@ fi cat $versionfile| sed 's/#.*$//g'|sed 's/\([^ ]*\)[\t ]*=[ \t]*\([^ ]*\)$/#define \1 \"\2\"/g' echo -if [ -z $CXX ] -then - COMPILER=unknown -else - COMPILER="$CXX `$CXX --version`" -fi - -echo "#define COMPILER "\"$COMPILER\" + diff --git a/bin/make-website.in b/bin/make-website.in index 28f85f79ba..e6796215f3 100644 --- a/bin/make-website.in +++ b/bin/make-website.in @@ -1,12 +1,12 @@ #!@PERL@ -w -# stupid script to generate WWW site. +# stupid script to generate WWW site. -*-Perl-*- use FileHandle; use Getopt::Long; my $lily_version; my $footstr; my $mw_id = "<!make_website!>"; -my $id_str = "make-website 0.3"; +my $id_str = "make-website 0.4"; my $TAR="tar"; my $MAKE="make"; @@ -40,12 +40,11 @@ sub set_html_footer my $username=$pw[6]; $footstr = - "\n<hr>Please take me <a href=index.html>back to the index</a>\n<hr> + "\n<hr>Please take me <a href=index.html>back to the LilyPond index</a>\n<hr> <font size=-1> -This page was generated by <code>" . $id_str . "</code> from lilypond-$lily_version by +This page was built using <code>" . $id_str . "</code> from lilypond-$lily_version by <p> <address><br>$username <a href=mailto:$MAILADRESS><<!bla>$MAILADRESS</a>></address> -<p>" . `date` . " <p></font>"; } @@ -76,7 +75,7 @@ sub my_system local $base="lilypond/"; local @examples=("twinkle", "multi", "wohltemperirt" ,"standchen", "toccata-fuga-E", - "scsii-menuetto", "collisions", "cadenza", "scales"); + "scsii-menuetto", "collisions", "cadenza", "scales", "twinkle-pop"); # rhythm, scales, @@ -104,7 +103,7 @@ sub gen_manuals { print "generating TeX doco list\n"; open HTMLLIST, ">tex_manuals.html"; - print HTMLLIST "<HTML><TITLE>LilyPond manuals</title>\n" ; + print HTMLLIST "<HTML><TITLE>PostScript Manuals</TITLE>\n" ; print HTMLLIST "<BODY><h1>LilyPond manuals (in PostScript)</h1>"; print HTMLLIST "<ul>\n"; my @todo=(); @@ -124,7 +123,7 @@ sub gen_list { print "generating HTML list\n"; open HTMLLIST, ">example_output.html"; - print HTMLLIST "<html><body><title>LilyPond examples</title>\n + print HTMLLIST "<html><body><TITLE>Rendered Examples</TITLE>\n These example files are taken from the LilyPond distribution.\n LilyPond currently only outputs TeX and MIDI. The pictures and\n PostScript files were generated using TeX, Ghostscript and some graphics tools. \n @@ -192,8 +191,10 @@ sub edit_html $subst .= $back if (! $a =~ /index.html/ ); $file =~ s/$sep/$subst$sep/g ; $file =~ s/\.gif/\.$image/g; + $file =~ s!<TITLE>(.*)</TITLE>!<TITLE>LilyPond WWW: $1</TITLE>!g; open H, ">$a"; print H $mw_id; + print H $file; close H; } @@ -213,7 +214,7 @@ sub copy_txt_file sub copy_files { print "copying files\n"; - print `ln -s $depth/out ./docxx` if ( ! -x "docxx" ) ; + my_system "ln -s $depth/out ./docxx" if ( ! -x "docxx" ) ; my_system "cp $depth/TODO ./TODO.txt", "cp $depth/ANNOUNCE ./ANNOUNCE.txt", "cp $depth/NEWS ./NEWS.txt", @@ -237,7 +238,13 @@ sub set_images sub docxx_update { - my_system "$MAKE -C $depth doc++"; + open BANNER, ">/tmp/lilybanner.html"; + my $ban = $footstr; + $ban =~ s!index.html!../index.html!g; + print BANNER $ban; + close BANNER; + my_system "$MAKE -C $depth docxx-opts=\"-p -S -k -B /tmp/lilybanner.html\" doc++"; + # should add a cute header. } sub do_tar @@ -283,8 +290,8 @@ sub main if (! $opt_noexamples) { gen_examples; gen_list; + gen_manuals; } - gen_manuals; set_images; edit_html; diff --git a/bin/mudela-book.in b/bin/mudela-book.in index 11f27a40aa..374f223a1f 100644 --- a/bin/mudela-book.in +++ b/bin/mudela-book.in @@ -3,6 +3,7 @@ my $mudcount = 0; my $mudela_b = 0; my $outname = "-"; +my $outdir; use Getopt::Long; sub gen_mufile @@ -99,7 +100,7 @@ sub main if (defined ($opt_outdir)) { $outdir = $opt_outdir . "/"; } else { - $outdir = ""; + $outdir = "."; } if (defined ($ARGV[0])) { @@ -110,12 +111,17 @@ sub main if (defined ($opt_outname)) { $outname = $opt_outname ; } else { - die "Need to have an output name, use --outname" if ( $infile == "-"); + die "Need to have an output name, use --outname" if ( $infile eq "-"); $outname = "$infile.tex"; } - + + my $openout ="$outdir$outname"; + if ( $infile eq $openout ) { + die "The input can't be the output\n"; + } + open INFILE, "<$infile"; - open BOOK, ">$outdir$outname"; + open BOOK, ">$openout"; while (<INFILE>) { if ($mudela_b) { if (end_b "mudela") { @@ -542,7 +542,10 @@ if test x$srcdir != x.; then echo Please look in the INSTALL instructions for echo directions for multi-architecture building - { echo "configure: error: This package does not support --srcdir." 1>&2; exit 1; } + + echo "configure: warning: This package does not support --srcdir!" 1>&2 + warn_b=yes + fi # if given here, these vars are initted at the checking point. @@ -557,7 +560,6 @@ checking_b=yes debug_b=yes optimise_b=no profile_b=no -warn_b=no ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -684,7 +686,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:688: checking for $ac_word" >&5 +echo "configure:690: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -715,7 +717,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:719: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:721: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -725,11 +727,11 @@ ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $L cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext <<EOF -#line 729 "configure" +#line 731 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:733: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -749,12 +751,12 @@ if test $ac_cv_prog_cxx_works = no; then { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:753: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:755: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:758: checking whether we are using GNU C++" >&5 +echo "configure:760: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -763,7 +765,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:767: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:769: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -778,7 +780,7 @@ if test $ac_cv_prog_gxx = yes; then ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:782: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:784: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -808,7 +810,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:812: checking for $ac_word" >&5 +echo "configure:814: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -864,7 +866,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:868: checking for a BSD compatible install" >&5 +echo "configure:870: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -918,7 +920,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:922: checking for $ac_word" >&5 +echo "configure:924: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_TAR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -952,7 +954,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:956: checking for $ac_word" >&5 +echo "configure:958: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_FIND'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -982,14 +984,18 @@ done test -n "$FIND" || FIND="error" -if test FIND = error; then - - echo "configure: warning: Couldn't find \`find'. Please use --enable-tex-dir" 1>&2 + + if test $FIND = "error" + then + + echo "configure: warning: can't find \`find\'. Please use --enable-tex-dir. " 1>&2 warn_b=yes -fi + fi + + @@ -1014,7 +1020,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1018: checking for $ac_word" >&5 +echo "configure:1024: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_BISON'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1048,7 +1054,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1052: checking for $ac_word" >&5 +echo "configure:1058: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_FLEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1082,7 +1088,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1086: checking for $ac_word" >&5 +echo "configure:1092: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_MAKE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1114,7 +1120,7 @@ test -n "$MAKE" || MAKE="error" # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1118: checking for $ac_word" >&5 +echo "configure:1124: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1148,7 +1154,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1152: checking for $ac_word" >&5 +echo "configure:1158: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_PODMAN'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1184,7 +1190,7 @@ if test "x$TEXPREFIX" = xauto ; then echo $ac_n "checking TeX/MF root dir directory""... $ac_c" 1>&6 -echo "configure:1188: checking TeX/MF root dir directory" >&5 +echo "configure:1194: checking TeX/MF root dir directory" >&5 find_root_prefix="$prefix" @@ -1225,7 +1231,7 @@ if test "x$TEXDIR" = xauto ; then echo $ac_n "checking TeX input directory""... $ac_c" 1>&6 -echo "configure:1229: checking TeX input directory" >&5 +echo "configure:1235: checking TeX input directory" >&5 find_dirdir=`(cd $find_texprefix; $FIND ./ -type d -a -name tex -print |sort|head -1|sed 's#^\./##')` @@ -1245,7 +1251,9 @@ echo "configure:1229: checking TeX input directory" >&5 fi - + + + if test $MAKE = "error" @@ -1326,7 +1334,7 @@ else fi echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6 -echo "configure:1330: checking how to run the C++ preprocessor" >&5 +echo "configure:1338: checking how to run the C++ preprocessor" >&5 if test -z "$CXXCPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1339,12 +1347,12 @@ ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $L cross_compiling=$ac_cv_prog_cxx_cross CXXCPP="${CXX-g++} -E" cat > conftest.$ac_ext <<EOF -#line 1343 "configure" +#line 1351 "configure" #include "confdefs.h" #include <stdlib.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1348: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1356: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -1364,17 +1372,17 @@ echo "$ac_t""$CXXCPP" 1>&6 ac_safe=`echo "FlexLexer.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for FlexLexer.h""... $ac_c" 1>&6 -echo "configure:1368: checking for FlexLexer.h" >&5 +echo "configure:1376: checking for FlexLexer.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1373 "configure" +#line 1381 "configure" #include "confdefs.h" #include <FlexLexer.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1378: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1386: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1400,7 +1408,7 @@ else fi -for a in `find -type d -and -not -name 'out*'`; do +for a in `find . -type d -and -not -name 'out*' -print`; do if test ! -d $a/$OUTDIR_NAME; then mkdir $a/$OUTDIR_NAME fi @@ -1409,8 +1417,6 @@ done subdirs="flower" -# ugh -eval "DIR_DATADIR=$datadir/lilypond" trap '' 1 2 15 cat > confcache <<\EOF @@ -1526,7 +1532,6 @@ ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "make/$OUTDIR_NAME/Configure_variables.make:make/Configure_variables.make.in - lib/$OUTDIR_NAME/config.hh:lib/config.hh.in Makefile:make/Toplevel.make.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <<EOF @@ -1625,7 +1630,6 @@ EOF cat >> $CONFIG_STATUS <<EOF CONFIG_FILES=\${CONFIG_FILES-"make/$OUTDIR_NAME/Configure_variables.make:make/Configure_variables.make.in - lib/$OUTDIR_NAME/config.hh:lib/config.hh.in Makefile:make/Toplevel.make.in"} EOF cat >> $CONFIG_STATUS <<\EOF @@ -1812,7 +1816,7 @@ If you want to make site-wide extensions to the makefiles, please use END -if test $warn_b = "yes" ; then +if test x$warn_b = "xyes" ; then cat <<EOF ************************************************** diff --git a/configure.in b/configure.in index ffe79f3e4a..e3e93c03bd 100644 --- a/configure.in +++ b/configure.in @@ -8,7 +8,7 @@ if test x$srcdir != x.; then echo Please look in the INSTALL instructions for echo directions for multi-architecture building - AC_MSG_ERROR(This package does not support --srcdir.) + AC_LILY_WARN(This package does not support --srcdir!) fi # if given here, these vars are initted at the checking point. @@ -23,7 +23,6 @@ checking_b=yes debug_b=yes optimise_b=no profile_b=no -warn_b=no AC_LANG_CPLUSPLUS @@ -119,10 +118,9 @@ AC_CHECK_PROGS(TAR, tar, error) AC_CHECK_PROGS(FIND, find, error) dnl should check out -print -if test FIND = error; then - AC_LILY_WARN(Couldn't find \`find'. Please use --enable-tex-dir) -fi +AC_CHECK_SEARCH_RESULT($FIND, \`find\'. Please use --enable-tex-dir) + AC_SUBST(OUTDIR_NAME) AC_SUBST(CXXFLAGS) AC_SUBST(CPPFLAGS) @@ -160,10 +158,11 @@ if test "x$TEXDIR" = xauto ; then AC_TEX_SUBDIR(TEXDIR) fi -dnl if test "x$MFDIR" = xauto; then -dnl AC_MF_SUBDIR(MFDIR) -dnl fi - + +AC_JUNK_ARGS( [if test "x$MFDIR" = xauto; then + AC_MF_SUBDIR(MFDIR) + fi] +) AC_CHECK_SEARCH_RESULT($MAKE, GNU make, You should install GNU make) AC_CHECK_SEARCH_RESULT( $BISON, bison, Please install Bison, 1.25 or better) @@ -197,7 +196,7 @@ fi AC_CHECK_HEADER(FlexLexer.h, true, AC_LILY_WARN(can't find flex header. Please install Flex headers correctly)) -for a in `find -type d -and -not -name 'out*'`; do +for a in `find . -type d -and -not -name 'out*' -print`; do if test ! -d $a/$OUTDIR_NAME; then mkdir $a/$OUTDIR_NAME fi @@ -205,11 +204,8 @@ done AC_CONFIG_SUBDIRS(flower) -# ugh -eval "DIR_DATADIR=$datadir/lilypond" AC_OUTPUT(make/$OUTDIR_NAME/Configure_variables.make:make/Configure_variables.make.in - lib/$OUTDIR_NAME/config.hh:lib/config.hh.in Makefile:make/Toplevel.make.in) touch make/$OUTDIR_NAME/Site.make @@ -229,7 +225,7 @@ If you want to make site-wide extensions to the makefiles, please use END -if test $warn_b = "yes" ; then +if test x$warn_b = "xyes" ; then cat <<EOF ************************************************** diff --git a/flower/Makefile b/flower/Makefile index 750c101458..13daeba0b8 100644 --- a/flower/Makefile +++ b/flower/Makefile @@ -40,7 +40,7 @@ SUBDIRS = include test # SCRIPTS = README_FILES = ONEWS NEWS README TODO -EXTRA_DISTFILES= configure config.hh.in configure.in aclocal.m4 VERSION $(README_FILES) $(SCRIPTS) Flower-flags.make.in +EXTRA_DISTFILES= aclocal.m4 configure config.hh.in configure.in VERSION $(README_FILES) $(SCRIPTS) Flower-flags.make.in # diff --git a/flower/NEWS b/flower/NEWS index 57ad102788..f2720c2744 100644 --- a/flower/NEWS +++ b/flower/NEWS @@ -1,4 +1,7 @@ +pl 26 + - Getopt_long : command -- and command - + - Getopt_long: cosmetics pl 25 - unordered_substitute and unordered_del diff --git a/flower/README b/flower/README index 6706447fcf..46a01d28e5 100644 --- a/flower/README +++ b/flower/README @@ -1,5 +1,5 @@ This library contains some general purpose routines which aren't -standardised libraries yet. It may be replaced by STL in time +standardised libraries yet. It may be replaced by STL in time. It was written by: @@ -9,4 +9,4 @@ and Jan Nieuwenhuizen <jan@digicash.com> -It is licensed under the GNU GPL.
\ No newline at end of file +It is licensed under the GNU GPL. diff --git a/flower/VERSION b/flower/VERSION index d05f7ff918..7aec79ceb0 100644 --- a/flower/VERSION +++ b/flower/VERSION @@ -1,6 +1,6 @@ MAJOR_VERSION = 1 MINOR_VERSION = 1 -PATCH_LEVEL = 25 +PATCH_LEVEL = 26 # use to send patches, always empty for released version: MY_PATCH_LEVEL = # include separator: "-1" or ".a" # diff --git a/flower/aclocal.m4 b/flower/aclocal.m4 new file mode 100644 index 0000000000..57ac6967aa --- /dev/null +++ b/flower/aclocal.m4 @@ -0,0 +1,2 @@ + +dnl this file intentionally left blank :) diff --git a/flower/dstream.cc b/flower/dstream.cc index 23b77bbbc4..ce0a51d363 100644 --- a/flower/dstream.cc +++ b/flower/dstream.cc @@ -13,6 +13,7 @@ #include "text-db.hh" #include "string-convert.hh" #include "assoc-iter.hh" + /// indent of each level const INDTAB = 2; @@ -75,8 +76,6 @@ Dstream::silence(String s) return (*silent_assoc_p_)[s]; } -/** Output a string via the Dstream. This is the only output - interface. It delegates all conversion to String class. */ Dstream & Dstream::operator<<(String s) { @@ -172,5 +171,4 @@ Dstream::clear_silence() for (Assoc_iter<String, bool> i(*silent_assoc_p_); i.ok(); i++) { i.val() = 0; } - } diff --git a/flower/include/dstream.hh b/flower/include/dstream.hh index 63130d1204..19fd8acab2 100644 --- a/flower/include/dstream.hh +++ b/flower/include/dstream.hh @@ -16,7 +16,7 @@ const char eol= '\n'; template<class K,class V> struct Assoc; -/** debug stream. +/** Debug stream. a class for providing debug output of nested structures, with indents according to \{\}()[]. @@ -47,11 +47,12 @@ public: /** if rcfile == 0, then do not read any rc file. */ - Dstream(ostream *r, char const * rcfile); virtual ~Dstream(); Dstream &identify_as(String s); +/** Output a string via the Dstream. This is the only output + interface. It delegates all conversion to String class. */ Dstream &operator << (String s); /** Output memory locations. diff --git a/flower/include/lgetopt.hh b/flower/include/lgetopt.hh index 6db9cd4dfd..89b0196bf2 100644 --- a/flower/include/lgetopt.hh +++ b/flower/include/lgetopt.hh @@ -14,7 +14,7 @@ struct Long_option_init { char const * longname; char shortname; - ostream &printon(ostream &errorout); + void printon(ostream &errorout)const ; }; @@ -28,54 +28,56 @@ struct Long_option_init { argument reordering */ class Getopt_long { -public: - /** errorcodes: no error, argument expected, no argument expected, - unknown option, illegal argument (eg. int expected). */ - enum Errorcod { E_NOERROR = 0, E_ARGEXPECT, E_NOARGEXPECT, E_UNKNOWNOPTION, - E_ILLEGALARG } ; - - -private: /// the option info. - Long_option_init *the_opts; - int table_len; + const Long_option_init *option_a_; + int table_len_i_; - /// if doing short option, argv[optind][optindind] is processed next. - int optindind; + /// if doing short option, arg_value_ch_a_a_[optind][optindind] is processed next. + int argument_index_i_; /// the option found - Long_option_init *beet; + const Long_option_init *found_option_l_; - /// get ready for processing next error. - bool next(); - Long_option_init *parselong(); - Long_option_init *parseshort(); - - ostream *errorout; - /// report an error and abort - void report(Errorcod c); -public: +public: + /** errorcodes: no error, argument expected, no argument expected, + unknown option, illegal argument (eg. int expected). */ + enum Errorcod { E_NOERROR = 0, E_ARGEXPECT, E_NOARGEXPECT, E_UNKNOWNOPTION, + E_ILLEGALARG } ; /// argument. Set to 0 if not present - char* optarg; + char const * optional_argument_ch_C_; /// current error status - Errorcod error; + Errorcod error_; - /// return an integer (with err. detect) - long intarg(); - /// argv[optind] will be processed next. - int optind; + /// arg_value_ch_a_a_[array_index_i_] will be processed next. + int array_index_i_; /// the arguments - char **argv; + char **arg_value_ch_a_a_; /// the arg. count - int argc; - - /* *************** */ + int argument_count_i_; + + ostream *error_ostream_l_; + +public: + /// get ready for processing next error. + void next(); + const Long_option_init *parselong(); + const Long_option_init *parseshort(); + void OK()const; + bool ok() const; + + /// report an error and abort + void report(Errorcod c); + + + /// return an integer (with err. detect) + long argument_to_i(); + /** What to do with errors. @@ -92,9 +94,9 @@ public: @return pointer to next option found. 0 if error occurred, or next argument is no option. */ - Long_option_init *operator()(); + const Long_option_init *operator()(); - char *current_arg(); - char * get_next_arg(); + char const *current_arg(); + char const * get_next_arg(); }; #endif diff --git a/flower/lgetopt.cc b/flower/lgetopt.cc index c2e5a3b790..afffc2f4b2 100644 --- a/flower/lgetopt.cc +++ b/flower/lgetopt.cc @@ -9,64 +9,65 @@ #include "lgetopt.hh" long -Getopt_long::intarg() +Getopt_long::argument_to_i() { long l; - if (sscanf(optarg, "%ld", &l) != 1) + if (!optional_argument_ch_C_ + || sscanf(optional_argument_ch_C_, "%ld", &l) != 1) report(E_ILLEGALARG); return l; } -Long_option_init * +const Long_option_init * Getopt_long::parselong() { - char const *optnm = argv[optind] + 2 ; + char const *optnm = arg_value_ch_a_a_[array_index_i_] + 2 ; assert(*optnm); - char *endopt = strchr(optnm, '='); + char const *endopt = strchr(optnm, '='); int searchlen = (endopt) ? endopt - optnm : strlen(optnm); - beet=0; - for (int i=0; i< table_len; i++) { - char const *ln = the_opts[i].longname; + found_option_l_=0; + for (int i=0; i< table_len_i_; i++) { + char const *ln = option_a_[i].longname; if (ln && !strncmp(ln, optnm, searchlen)) { - beet = the_opts+i; + found_option_l_ = option_a_+i; break; } } - if (!beet) { + if (!found_option_l_) { report(E_UNKNOWNOPTION); return 0; } - optind++; - optindind = 0; + array_index_i_++; + argument_index_i_ = 0; - if (beet->take_arg) { + if (found_option_l_->take_arg) { if (endopt) - optarg = endopt +1; // a '=' + optional_argument_ch_C_ = endopt +1; // a '=' else { - optarg = argv[optind]; - optind++; + optional_argument_ch_C_ = arg_value_ch_a_a_[array_index_i_]; + array_index_i_++; } - if (!optarg) + if (!optional_argument_ch_C_) report(E_ARGEXPECT); } else { - optarg = 0; + optional_argument_ch_C_ = 0; if (endopt) report(E_NOARGEXPECT); } - return beet; + return found_option_l_; } -ostream & -Long_option_init::printon(ostream &errorout) +void +Long_option_init::printon(ostream &errorout)const { if (shortname) errorout <<"-" << shortname; @@ -74,150 +75,164 @@ Long_option_init::printon(ostream &errorout) errorout << ", "; if (longname) errorout << "`--" << longname << "'"; - return errorout; } // report an error, GNU style. void Getopt_long::report(Errorcod c) { - error = c; - if (!errorout) + error_ = c; + if (!error_ostream_l_) return; - *errorout << argv[0] << ": "; + *error_ostream_l_ << arg_value_ch_a_a_[0] << ": "; switch (c) { case E_ARGEXPECT: - *errorout<< "option "; - beet->printon(*errorout); - *errorout << "requires an argument"<<endl; + *error_ostream_l_<< "option "; + found_option_l_->printon(*error_ostream_l_); + *error_ostream_l_ << "requires an argument"<<endl; break; case E_NOARGEXPECT: - *errorout << "option `--" << - beet->longname << "' does not allow an argument"<<endl; + *error_ostream_l_ << "option `--" << + found_option_l_->longname << "' does not allow an argument"<<endl; break; case E_UNKNOWNOPTION: - *errorout << "unrecognized option "; - if (optindind) - *errorout << "-" << argv[optind][optindind] << endl; + *error_ostream_l_ << "unrecognized option "; + if (argument_index_i_) + *error_ostream_l_ << "-" << arg_value_ch_a_a_[array_index_i_][argument_index_i_] << endl; else - *errorout << argv[optind] << endl; + *error_ostream_l_ << arg_value_ch_a_a_[array_index_i_] << endl; break; case E_ILLEGALARG: - *errorout << "illegal argument `" << optarg << "\'to option "; - beet->printon(*errorout); - *errorout << '\n'; + *error_ostream_l_ << "illegal argument `" << optional_argument_ch_C_ << "\'to option "; + found_option_l_->printon(*error_ostream_l_); + *error_ostream_l_ << '\n'; default: assert(false); } exit(2); } -Long_option_init * +const Long_option_init * Getopt_long::parseshort() { - char c=argv[optind][optindind]; - beet=0; + char c=arg_value_ch_a_a_[array_index_i_][argument_index_i_]; + found_option_l_=0; assert(c); - for (int i=0; i < table_len; i++) - if (the_opts[i].shortname == c) { - beet = the_opts+i; + for (int i=0; i < table_len_i_; i++) + if (option_a_[i].shortname == c) { + found_option_l_ = option_a_+i; break; } - if (!beet){ + if (!found_option_l_){ report(E_UNKNOWNOPTION); return 0; } - optindind++; - if (!beet->take_arg){ - optarg = 0; - return beet; + argument_index_i_++; + if (!found_option_l_->take_arg){ + optional_argument_ch_C_ = 0; + return found_option_l_; } - optarg = argv[optind] + optindind; + optional_argument_ch_C_ = arg_value_ch_a_a_[array_index_i_] + argument_index_i_; - optind ++; - optindind = 0; + array_index_i_ ++; + argument_index_i_ = 0; - if (!optarg[0]) { - optarg = argv[optind]; - optind ++; + if (!optional_argument_ch_C_[0]) { + optional_argument_ch_C_ = arg_value_ch_a_a_[array_index_i_]; + array_index_i_ ++; } - if (!optarg) { + if (!optional_argument_ch_C_) { report(E_ARGEXPECT); } - return beet; + return found_option_l_; } -Long_option_init * +const Long_option_init * Getopt_long::operator()() { - if (!next()) + if (!ok()) return 0; - if (optindind) - return parseshort(); + next(); + + if (argument_index_i_) + return parseshort(); + + const char * argument_C = arg_value_ch_a_a_[array_index_i_]; - if (argv[optind][0] != '-') + if (argument_C[0] != '-') return 0; - if (argv[optind][1] == '-') {// what to do with "command -- bla" - return parselong(); + if (argument_C[1] == '-') {// what to do with "command -- bla" + if ( argument_C[2] ) + return parselong(); + else + return 0; } else { - optindind = 1; - return parseshort(); + if (argument_C[ 1 ]) { + argument_index_i_ = 1; + return parseshort(); + } else { + return 0; + } } } -Getopt_long::Getopt_long(int c, char **v, Long_option_init *lo) +Getopt_long::Getopt_long(int c, char **v, Long_option_init *lo) { - the_opts = lo; - errorout = &cerr; - argv = v; - argc = c; - optind = 1; - optindind = 0; + option_a_ = lo; + error_ostream_l_ = &cerr; + arg_value_ch_a_a_ = v; + argument_count_i_ = c; + array_index_i_ = 1; + argument_index_i_ = 0; // reached end of option table? - int i; - for (i = 0; the_opts[i].longname ||the_opts[i].shortname; i++) - ; - table_len = i; + table_len_i_ =0; + for (int i = 0; option_a_[i].longname ||option_a_[i].shortname; i++) + table_len_i_ ++; } bool -Getopt_long::next() +Getopt_long::ok()const { + return array_index_i_ < argument_count_i_; +} - error = E_NOERROR; - while (optind < argc && !argv[optind][optindind]) { - optind++; - optindind = 0; +void +Getopt_long::next() +{ + error_ = E_NOERROR; + while (array_index_i_ < argument_count_i_ + && !arg_value_ch_a_a_[array_index_i_][argument_index_i_]) { + array_index_i_++; + argument_index_i_ = 0; } - return (optind < argc); } -char * +char const * Getopt_long::current_arg() { - if (optind >= argc) + if (array_index_i_ >= argument_count_i_) return 0; - char * a = argv[optind]; - return a + optindind; + char const * a = arg_value_ch_a_a_[array_index_i_]; + return a + argument_index_i_; } -char * +char const * Getopt_long::get_next_arg() { - char * a = current_arg(); - if ( a) { - optind ++; - optindind = 0; + char const * a = current_arg(); + if (a) { + array_index_i_ ++; + argument_index_i_= 0; } return a; } diff --git a/flower/path.cc b/flower/path.cc index bd6a6660d2..5674ca90a3 100644 --- a/flower/path.cc +++ b/flower/path.cc @@ -66,7 +66,7 @@ File_path::find(String nm)const path+= String(path.length_i()? "/":"")+nm; fdebug << path << "? "; - FILE *f = fopen(path, "r"); // ugh! + FILE *f = fopen(path.ch_C(), "r"); // ugh! if (f) { fdebug << "found\n"; fclose(f); diff --git a/init/dutch.ly b/init/dutch.ly index b3d80dc62d..0a7c423ff5 100644 --- a/init/dutch.ly +++ b/init/dutch.ly @@ -30,7 +30,7 @@ eisis = \melodic_request { -1 2 2 } feses = \melodic_request { -1 3 -2 } fes = \melodic_request { -1 3 -1 } - "f" = \melodic_request { -1 3 0 } + f = \melodic_request { -1 3 0 } fis = \melodic_request { -1 3 1 } fisis = \melodic_request { -1 3 2 } geses = \melodic_request { -1 4 -2 } @@ -97,3 +97,7 @@ } + + + +keyCminor = \key \bes \es \as; diff --git a/init/engraver.ly b/init/engraver.ly index 5fe3255194..c80d39e6fe 100644 --- a/init/engraver.ly +++ b/init/engraver.ly @@ -5,7 +5,6 @@ staff_engraver = \requesttranslator { Engraver "Engraver_group_engraver" \alias "Staff"; - \consists "Line_group_engraver"; \consists "Bar_engraver"; \consists "Clef_engraver"; \consists "Key_engraver"; @@ -14,6 +13,8 @@ staff_engraver = \requesttranslator { \consists "Staff_sym_engraver"; \consists "Collision_engraver"; \consists "Rest_collision_engraver"; + + \consists "Line_group_engraver"; \contains \requesttranslator { Engraver "Voice_group_engravers" \alias "Voice_group"; @@ -37,8 +38,10 @@ piano_staff_engraver = \requesttranslator { \alias "Hoenoemjedat"; \consists "Span_bar_engraver"; \consists "Vertical_align_engraver"; - \consists "Line_group_engraver"; \consists "Piano_bar_engraver"; + + % This should come last + \consists "Line_group_engraver"; \contains\requesttranslator { \staff_engraver } } @@ -50,6 +53,7 @@ staff_group_engraver = \requesttranslator { \consists "Line_group_engraver"; \contains\requesttranslator { \staff_engraver } } + lyric_engraver = \requesttranslator { Engraver "Engraver_group_engraver" \alias "Lyric"; @@ -68,6 +72,9 @@ orchestral_score_translator = \requesttranslator { Engraver Score_engraver \alias "Score"; + \consists "Bar_column_engraver"; + \consists "Bar_number_grav"; + \consists "Bar_align_engraver"; \consists "Clef_align_engraver"; \consists "Key_align_engraver"; @@ -76,11 +83,10 @@ orchestral_score_translator = \requesttranslator { \consists "Vertical_align_engraver"; \consists "Span_score_bar_engraver"; + \contains \requesttranslator { \staff_group_engraver } \contains \requesttranslator { \lyric_engraver } \contains \requesttranslator { \piano_staff_engraver } - - } diff --git a/init/german.ly b/init/german.ly new file mode 100644 index 0000000000..7defccdd64 --- /dev/null +++ b/init/german.ly @@ -0,0 +1,93 @@ +% +% common german names for notes. "es" means flat, "is" means sharp +% +% by Roland Meier <meier@informatik.th-darmstadt.de> +% based on swedish.ly by Mats Bengtsson. + + +% +% Please note that, while these names are used to enter *notes*, they +% actually are *melodic*s, i.e. they represent a pitch solely. Notes +% have a rhythmic part too. This is the reason that we don't write 'note { .. }' +% +\notenames { + ceses = \melodic_request { -1 0 -2 } + ces = \melodic_request { -1 0 -1 } + c = \melodic_request { -1 0 0 } + cis = \melodic_request { -1 0 1 } + cisis = \melodic_request { -1 0 2 } + deses = \melodic_request { -1 1 -2 } + des = \melodic_request { -1 1 -1 } + d = \melodic_request { -1 1 0 } + dis = \melodic_request { -1 1 1 } + disis = \melodic_request { -1 1 2 } + eses = \melodic_request { -1 2 -2 } + es = \melodic_request { -1 2 -1 } + e = \melodic_request { -1 2 0 } + eis = \melodic_request { -1 2 1 } + eisis = \melodic_request { -1 2 2 } + feses = \melodic_request { -1 3 -2 } + fes = \melodic_request { -1 3 -1 } + f = \melodic_request { -1 3 0 } + fis = \melodic_request { -1 3 1 } + fisis = \melodic_request { -1 3 2 } + geses = \melodic_request { -1 4 -2 } + ges = \melodic_request { -1 4 -1 } + g = \melodic_request { -1 4 0 } + gis = \melodic_request { -1 4 1 } + gisis = \melodic_request { -1 4 2 } + ases = \melodic_request { -1 5 -2 } + as = \melodic_request { -1 5 -1 } + a = \melodic_request { -1 5 0 } + ais = \melodic_request { -1 5 1 } + aisis = \melodic_request { -1 5 2 } + heses = \melodic_request { -1 6 -2 } + b = \melodic_request { -1 6 -1 } + h = \melodic_request { -1 6 0 } + his = \melodic_request { -1 6 1 } + hisis = \melodic_request { -1 6 2 } + + + % + % upper case: 1 octave lower. + % + + + Ceses = \melodic_request { -2 0 -2 } + Ces = \melodic_request { -2 0 -1 } + C = \melodic_request { -2 0 0 } + Cis = \melodic_request { -2 0 1 } + Cisis = \melodic_request { -2 0 2 } + Deses = \melodic_request { -2 1 -2 } + Des = \melodic_request { -2 1 -1 } + D = \melodic_request { -2 1 0 } + Dis = \melodic_request { -2 1 1 } + Disis = \melodic_request { -2 1 2 } + Eses = \melodic_request { -2 2 -2 } + Es = \melodic_request { -2 2 -1 } + E = \melodic_request { -2 2 0 } + Eis = \melodic_request { -2 2 1 } + Eisis = \melodic_request { -2 2 2 } + Feses = \melodic_request { -2 3 -2 } + Fes = \melodic_request { -2 3 -1 } + F = \melodic_request { -2 3 0 } + Fis = \melodic_request { -2 3 1 } + Fisis = \melodic_request { -2 3 2 } + Geses = \melodic_request { -2 4 -2 } + Ges = \melodic_request { -2 4 -1 } + G = \melodic_request { -2 4 0 } + Gis = \melodic_request { -2 4 1 } + Gisis = \melodic_request { -2 4 2 } + Ases = \melodic_request { -2 5 -2 } + As = \melodic_request { -2 5 -1 } + A = \melodic_request { -2 5 0 } + Ais = \melodic_request { -2 5 1 } + Aisis = \melodic_request { -2 5 2 } + Heses = \melodic_request { -2 6 -2 } + B = \melodic_request { -2 6 -1 } + H = \melodic_request { -2 6 0 } + His = \melodic_request { -2 6 1 } + Hisis = \melodic_request { -2 6 2 } + + +} diff --git a/init/midi.ly b/init/midi.ly index 0ee376eac4..95602c3235 100644 --- a/init/midi.ly +++ b/init/midi.ly @@ -1,6 +1,6 @@ \include "performer.ly" default_midi = \midi { - \tempo 4:60; + \tempo 4=60; \requesttranslator{ \default_midi_perf } } diff --git a/init/script.ly b/init/script.ly index 6a1c283df0..9f37993065 100644 --- a/init/script.ly +++ b/init/script.ly @@ -25,6 +25,8 @@ lfheel = \script { "fheel" 0 0 -1 0 0 } rfheel = \script { "fheel" 0 0 1 0 0 } lftoe = \script { "ftoe" 0 0 -1 0 0 } rftoe = \script { "ftoe" 0 0 1 0 0 } +turn = \script { "turn" 0 0 1 0 0 } + % % left toe: right heel: % diff --git a/init/swedish.ly b/init/swedish.ly index 22f16645e0..f679da1195 100644 --- a/init/swedish.ly +++ b/init/swedish.ly @@ -27,7 +27,7 @@ eississ = \melodic_request { -1 2 2 } fessess = \melodic_request { -1 3 -2 } fess = \melodic_request { -1 3 -1 } - "f" = \melodic_request { -1 3 0 } + f = \melodic_request { -1 3 0 } fiss = \melodic_request { -1 3 1 } fississ = \melodic_request { -1 3 2 } gessess = \melodic_request { -1 4 -2 } diff --git a/init/symbol.ly b/init/symbol.ly index 62baead466..8d84256d94 100644 --- a/init/symbol.ly +++ b/init/symbol.ly @@ -1,4 +1,4 @@ -\version "0.1.0"; +\version "0.1.1"; \include "dynamic.ly" \include "dutch.ly" @@ -8,6 +8,7 @@ % ugh \include "midi.ly" +% declarations for standard directions left = -1 right = 1 up = 1 diff --git a/init/table16.ly b/init/table16.ly index ebc9c375a4..f3fdd6de45 100644 --- a/init/table16.ly +++ b/init/table16.ly @@ -36,6 +36,7 @@ table_sixteen= "ftoe" "\ftoe" 0.0\pt 6.0\pt -1.0\pt 5.0\pt "-back" "\backorfront" 0.0\pt 6.0\pt 0.0\pt 3.0\pt "front" "\backorfront" 0.0\pt 6.0\pt 0.0\pt 3.0\pt + "turn" "\turn" -2.0\pt 7.0\pt 0.0\pt 4.0\pt } "style" = \table { diff --git a/input/beams.ly b/input/beams.ly index ff17863b40..7b18bfbf52 100644 --- a/input/beams.ly +++ b/input/beams.ly @@ -5,7 +5,7 @@ description: composer(s): heu entered-by: jcn - copyright: GPL + copyright: PD Tested Features: beams and beamflags EndMudelaHeader diff --git a/input/cadenza.ly b/input/cadenza.ly index 2201747c62..9814cad784 100644 --- a/input/cadenza.ly +++ b/input/cadenza.ly @@ -1,8 +1,9 @@ %{MudelaHeader - title: - description:Cadenza to Mozart Horn concerto 3 - composer(s):unknown - entered-by:HWN + filename: cadenza.ly + title: Cadenza ad libitum + description: Cadenza to Mozart Horn concerto 3 + composer(s): unknown + entered-by: HWN copyright: public domain Tested Features: cadenza mode @@ -10,7 +11,7 @@ EndMudelaHeader %} -\version "0.1.0"; +\version "0.1.1"; cad = \melodic {\id "Staff" "french horn"; @@ -42,7 +43,7 @@ cad = \melodic {\id "Staff" "french horn"; r8 'a ['b cis] \duration 16; [d cis d e] f4~ [f e d c] - 'b4 + 'b4-\turn \octave c'; [2/3 d'8 c'8 a8]1/1 g2 \bar "" ; @@ -51,15 +52,15 @@ cad = \melodic {\id "Staff" "french horn"; \bar "" ; [g8.(_"a tempo" e g8. )e] a4. g8 [f8 e8 d8 c8] - 'g2 d2^"tr" + 'g2 d2^"\tr" c4 } \score { \melodic { \cad } \paper { - unitspace= 14.0\mm; + unitspace= 16.0\mm; geometric= 1.4; } - \midi { \tempo 4:90; } + \midi { \tempo 4 = 90; } } diff --git a/input/collisions.ly b/input/collisions.ly index d281dc0e74..2a9505752b 100644 --- a/input/collisions.ly +++ b/input/collisions.ly @@ -10,7 +10,7 @@ Tested Features:test the Collision resolution EndMudelaHeader %} -\version "0.1.0"; +\version "0.1.1"; diff --git a/input/coriolan-alto.ly b/input/coriolan-alto.ly index ac772fdf9f..8dc5c69796 100644 --- a/input/coriolan-alto.ly +++ b/input/coriolan-alto.ly @@ -17,7 +17,7 @@ EndMudelaHeader % (maybe even sooner :-) % -\version "0.0.58"; +\version "0.1.1"; alto = \melodic{ diff --git a/input/gallina.ly b/input/gallina.ly new file mode 100644 index 0000000000..08f9b997b0 --- /dev/null +++ b/input/gallina.ly @@ -0,0 +1,232 @@ +%{ +From mats.bengtsson@s3.kth.seThu Aug 14 02:11:19 1997 +Date: Wed, 13 Aug 1997 18:24:53 +0200 +From: Mats Bengtsson <mats.bengtsson@s3.kth.se> +To: Han-Wen Nienhuys <hanwen@stack.nl> +Subject: Re: brevis? + +[snip] + +Here comes a sample score where I've tried to fiddle around with different +spacing parameters to get a decent layout, but it still looks quite strange. +For example is the second half of the bar more spread out than the first +half in many cases. +Hopefully it could be useful input to future improvements. I've entered the +music directly from the 1637 manuscript and intend to publish it public +domain on for example ftp.gmd.de when finished. You could include it as an +example in the distribution, but in that case I could add a LaTeX title file. +There were no beams in the manuscript so I didn't use them in this edition +either. + + /Mats + +-------------------------------------------------- +%} +%{ + title: La Gallina a 2 violini + date: 1637 + source: the manuscript of Canzoni overo Sonate Concertate + libro terzo, opera duodecima + composer(s): Tarquinio Merula (?-?) + entered-by: Mats Bengtsson + copyright: Public Domain + + + Tested Features: Note placement, multipart score, figured base + +%} + +vi1=\melodic{ + \meter 4/4; + \octave c''; + + d8 d d d d4 A16 B c A | + B8 G G G16 A B8 G G G16 A | + B8 G G A16 B c4 B | + A8 D G4. Fis16 E Fis4 | + G2 r2 | + r1 | + d8 d d d d4 A16 B c A | + B8 G G G16 A B8 G G G16 A | + B8 G G A16 B c8 e d c | + B G c2 B4 | + c2 r | + r1 | + g8 g g g g4 d16 e f d | + e8 c c c16 d e8 c c c16 d | + e8 c c d16 e f4 e | + d8 G c2 B4 | + c8 G G G16 A B4 G | + r8 G G G16 A B4 G | + r8 E16 Fis G8 G Fis G G Fis| + G2 r | + r1 | + r16 d c B A G Fis E D8 d d d16 c | + B8 d d d16 c B8 d d d16 e | + fis4 g2 fis4 | + r16 g f e d c B A G8 g g g16 f | + e8 g g g16 f e8 g g g16 a | + b4 c'2 b4 | + c'8 g g g16 f e4 d | + r8 g g g16 f e4 d | + r8 d16 A B8 B16 c A2 | + B1 | + \meter 3/2; + r4 d d d d d | + e1. | + r4 c c c c c | + d1. | + r4 d8 c B4 c8 d G4 A8 B | + E1. | + r4 e8 d cis4 d8 e A4 B8 cis | + Fis1. | + r4 d d d d d | + e e8 d c4 d8 e A4 B8 c | + Fis4 fis8 e d4 e8 fis B4 c8 d | + G4 g g g g g | + a4 c'8 b a4 b8 c' f4 g8 a | + d4 g g g g g | + a d8 c B4 c8 d A2 | + \meter 4/4; + B1 | + d8 d d d d4 A16 B c A | + B8 G G G16 A B8 G G G16 A | + B8 G c2 B4 | + c2 r | + g8 g g g g4 d16 e f d | + e8 G G G16 A B8 d d d16 e | + fis4 g2 fis4 | + r16 g f e d c B A G8 g g g16 f | + e2 r8 d d d16 e | + fis a g fis e d c B A8 d d d16 e | + fis4 g2 fis4 | + g1 + \bar "|."; +} + +vi2=\melodic{ + \meter 4/4; + \octave c''; + + r1 | r | r | + d8 d d d d4 A16 B c A | + B8 G G G16 A B8 G G G16 A | + B8 G G A16 B c4 B | + A8 D G4. Fis16 E Fis4 | + G2 r2 | + r1 | + g8 g g g g4 d16 e f d | + e8 c c c16 d e8 c c c16 d | + e8 c c d16 e f4 e | + d8 G c2 B4 | + c2 r | + r1 | + g8 g g g g4 d16 e f d | + e2 r8 G G G16 A | + B4 G r8 G G A16 B + c4 B A2 | + G r16 d c B A G Fis E | + D8 d d d16 c B8 d d d16 e | + fis4 g g4. fis8 | + g2 r | + r16 d c B A G Fis E D8 d d d16 c | + B4 c2 B4 | + c d G2 | + r16 g f e d c B A G8 g g g16 f | + e4 d r8 g g g16 f | + e4 d r8 c16 G B8 B16 c | + A4 G2 Fis4 | + G1 | + \meter 3/2; + r1. | + r4 g8 f e4 f8 g c4 d8 e | + A1. | + r4 a8 g fis4 g8 a d4 e8 fis | + B1. | + r4 g g g g g | + a1. | + r4 a a a a a | + b d8 c B4 c8 d G4 A8 B | + E4 g8 f e4 f8 g c4 d8 e | + A4 a8 g fis4 g8 a d4 e8 fis | + B4 b8 a g4 a8 b e4 fis8 g | + c4 A A A A A | + B d8 c B4 c8 d D4 E | + Fis2 G Fis | + \meter 4/4; + G1 | + r1 | r1 | + g8 g g g g4 d16 e f d | + e8 c c c16 d e8 G G G16 A | + B8 G c2 B4 | + c2 r | + r16 d c B A G Fis E D8 d d d16 c | + B4 c2 B4 | + c8 G G G16 A B d c B A G Fis E | + D8 d d d16 e fis16 a g fis e d c B | + A d c B A G Fis E D4 d | + B1 + \bar "|."; +} + +bc=\melodic{ + \clef "bass"; + \meter 4/4; + \octave c; + + G2 d^"4 3" | G1 | + g2 c4 G | d1^"3 4 3" | + G1 | g2 c4 G | + d1^"3 4 3" | G | + g2 c4 d | G1^"3 4 3" | + c1 | c2 F4 c | + G1^"3 4 3" | c | + c2 F4 c | G1^"3 4 3" | + c2 G | g G | + c4 G d2^"3 4 3" | G g | + fis g | d1^"3 4 3" | + G2 B | d1^"3 4 3" | + G^"3 4 3" | c4 B c2 | + G1^"3 4 3" | c4 B c g | + c B c G | d1^"3 4 3" | + G1 | + \meter 3/2; + g1. | c | + f | d^"\sharp" | + g | c | + A | d^"\sharp" | + G | c | + d^"\sharp" | e | + f | g1 B2 | + d1.^"3 4 3" | + \meter 4/4; + G1 | + g2 fis | g G | + g1^"3 4 3" | c | + G^"3 4 3" | c2 G | + d1^"3 4 3" | G^"3 4 3" | + c2 G | d1^"\sharp" ( | + ) d^"3 4 3" | G | + \bar "|."; +} + +\score{ + < \multi 3; + \vi1 + \vi2 + \bc + > + \paper{ + geometric=1.2; + unitspace=8.\mm; + linewidth=18.\cm; + gourlay_maxmeasures=4.; + gourlay_energybound = 70000.; + basicspace = 2.8\pt; + } +} + + + + + diff --git a/input/header.ly b/input/header.ly index 3baaadf9e1..71b146c913 100644 --- a/input/header.ly +++ b/input/header.ly @@ -2,12 +2,16 @@ filename: title: + date: description: + opus: + source: composers: entered-by: copyright: - + remarks: Tested Features: + EndMudelaHeader %} -\version "0.1.0"; +\version "0.1.1"; diff --git a/input/keys.ly b/input/keys.ly index 45237a2d7e..5d79a70223 100644 --- a/input/keys.ly +++ b/input/keys.ly @@ -10,7 +10,7 @@ Tested Features: local key, key, forced accidentals EndMudelaHeader %} -\version "0.1.0"; +\version "0.1.1"; blah = \melodic{ diff --git a/input/kortjakje.ly b/input/kortjakje.ly index 0ba3de2f78..6f0451ef6f 100644 --- a/input/kortjakje.ly +++ b/input/kortjakje.ly @@ -5,12 +5,12 @@ description: bare bones version. (written down from memory :-) composers: Mozart, KV 265 entered-by: HWN - copyright: none + copyright: PD Tested Features: example file with comments EndMudelaHeader %} -\version "0.1.0"; +\version "0.1.1"; % the % is a comment. diff --git a/input/multi.ly b/input/multi.ly index 141d191a9e..90ce751c7a 100644 --- a/input/multi.ly +++ b/input/multi.ly @@ -12,7 +12,7 @@ EndMudelaHeader %} -\version "0.1.0"; +\version "0.1.1"; \score{ \melodic diff --git a/input/pedal.ly b/input/pedal.ly index da3290ec44..76ef376884 100644 --- a/input/pedal.ly +++ b/input/pedal.ly @@ -24,7 +24,7 @@ % \lbheel \lbheel \lfheel \lftoe % \rbheel \rbtoe \rfheel \rftoe -\version "0.1.0"; +\version "0.1.1"; \score{ \melodic { diff --git a/input/rhythm.ly b/input/rhythm.ly index a321ca34a7..a2ab538381 100644 --- a/input/rhythm.ly +++ b/input/rhythm.ly @@ -14,7 +14,7 @@ EndMudelaHeader -\version "0.1.0"; +\version "0.1.1"; ritme = \melodic{ %\octave ; \partial 8; diff --git a/input/rock.ly b/input/rock.ly deleted file mode 100644 index b6434ab2b8..0000000000 --- a/input/rock.ly +++ /dev/null @@ -1,4 +0,0 @@ - -mel = \melodic { - [c8 c32 c16] -} diff --git a/input/scales.ly b/input/scales.ly index 0e30979237..f69bc1b650 100644 --- a/input/scales.ly +++ b/input/scales.ly @@ -15,7 +15,7 @@ EndMudelaHeader % scales with accents. % -\version "0.1.0"; +\version "0.1.1"; blah = \melodic { \meter 6/8; \octave 'c ; diff --git a/input/scripts.ly b/input/scripts.ly index 51d8a9093f..8e005edee9 100644 --- a/input/scripts.ly +++ b/input/scripts.ly @@ -10,7 +10,7 @@ Tested Features: scripts, text. EndMudelaHeader %} -\version "0.1.0"; +\version "0.1.1"; blah = \melodic { diff --git a/input/scsii-menuetto.ly b/input/scsii-menuetto.ly index 1c69f21f99..35ba9023f2 100644 --- a/input/scsii-menuetto.ly +++ b/input/scsii-menuetto.ly @@ -3,6 +3,8 @@ filename: scsii-menuetto.ly title: Solo Cello Suites, Suite II part V, Menuetto I description: Cello suite transcribed for Viola + source: ? + opus: BWV 1008 no. 5 composers: Johann Sebastian Bach (1685-1750) entered-by: JCN copyright: public domain @@ -13,7 +15,7 @@ EndMudelaHeader %} -\version "0.1.0"; +\version "0.1.1"; %% Stuff from MPP version % \lefttitle{Menuetto} @@ -111,7 +113,7 @@ IImenuetto = \melodic{ \output "scsii-menuetto.out"; } \midi{ - \tempo 4:120; + \tempo 4 = 120; \output "scsii-menuetto.midi"; } } diff --git a/input/slurs.ly b/input/slurs.ly index 87223a1b04..b49616ff9e 100644 --- a/input/slurs.ly +++ b/input/slurs.ly @@ -5,13 +5,13 @@ description: composer(s): HWN entered-by: HWN - copyright: GPL + copyright: PD Tested Features: test slurs and ties EndMudelaHeader %} -\version "0.1.0"; +\version "0.1.1"; \score{ \melodic{\octave c'; diff --git a/input/standchen.ly b/input/standchen.ly index 1769e18564..58d1dd27c1 100644 --- a/input/standchen.ly +++ b/input/standchen.ly @@ -2,18 +2,18 @@ filename: standchen.ly title: St\"andchen (Serenade) "Leise flehen meine Lieder" - description: D.957 No.4 + opus: D. 957 No. 4 composers: Franz Schubert (1797-1828) Text by Ludwig Rellstab (1799-1860) entered-by:JCN - copyright: + copyright: public domain Tested Features: multivoice, accents, lyrics, chords, piano music EndMudelaHeader %} -\version "0.1.0"; +\version "0.1.1"; commands = \melodic{ \skip 2.*4; @@ -152,8 +152,11 @@ melodie = \melodic{ %%48 \textstyle "italic"; < - { fis2.~ \group "+1"; \stem \down; f2. } - { d'2. ~ \stem \up; d'4 r4_"decresc." d'4 } + { fis2.~ + %\group "+1"; + \stem \down; f2. } + { d'2. ~ \stem \up; + d'4 r4_"decresc." d'4 } > \textstyle "roman"; | %%50 @@ -485,6 +488,6 @@ tekstII = \lyric{ \output "standchen.out"; } \midi{ - \tempo 4:54; + \tempo 4 = 54; } } diff --git a/input/toccata-fuga-E.ly b/input/toccata-fuga-E.ly index a1d59b84c9..828796f9d0 100644 --- a/input/toccata-fuga-E.ly +++ b/input/toccata-fuga-E.ly @@ -1,14 +1,14 @@ %{MudelaHeader filename: toccata-fuga-E.ly - title: toccata and fuga in E-major bwv 566 - description: + title: toccata and fuga in E-major + opus: BWV 566 toccata: 3 bar excerpt 2nd fuga: transposed subject --- 4 bar excerpt composers: Johann Sebastian Bach (1685-1750) entered-by: JCN - copyright: + copyright: public domain Tested Features: purpose of this file is testing: @@ -20,7 +20,7 @@ EndMudelaHeader %} -\version "0.1.0"; +\version "0.1.1"; toccata_commands = \melodic{ \meter 4/4; @@ -72,6 +72,7 @@ fuga2_commands = \melodic{ fuga2_right = \melodic{ \$fuga2_commands + \clef violin; % 15 \octave c'; <\multi 2; @@ -151,7 +152,7 @@ break = \melodic{ > \paper{} \midi{ - \tempo 4:96; + \tempo 4 = 96; } } diff --git a/input/twinkle-pop.ly b/input/twinkle-pop.ly new file mode 100644 index 0000000000..41561e6a44 --- /dev/null +++ b/input/twinkle-pop.ly @@ -0,0 +1,47 @@ +%{MudelaHeader + + filename: twinkle.ly + title: Ah, vous dirais-je, maman + description: twinkle twinkle in pop-song-settings + composers: traditional + + entered-by: HWN, chords by Johan Vromans + copyright: public domain + + Tested Features: lyrics and chords +EndMudelaHeader +%} + +\version "0.1.1"; + +melodie = \melodic { + \clef"violin"; + \meter 2/4 ; + \octave c'; + + c4^"C" c | g g | a^"F" a | g2^"C" | + f4^"F" f | e^"C" e | d^"G7" d | c2^"C" | + g4^"G" g | f^"F" f | e^"C" e | d^"G7" d | + g^"G" g | f^"F" f | e^"C" e | d^"G7" d | + c4^"C" c | g g | a^"F" a | g2^"C" | + f4^"F" f | e^"C" e | d^"G7" d | c2^"C" | +} + +texte = \lyric{ + + \textstyle "italic"; + Ah!4 vous dir- ai_- je ma man2 + Ce4 qui cau- se mon tour- ment2 + Pa-4 pa veut que je rai- so- nne + Comme4 un- e grand- e per- so- nne + Moi4 je dis que les bon- bons2 + Val-4 ent mieux que la rai- son2 + +} + +\score { + < \melodic < \id "Piano" ""; \melodie > + \lyric < \id "Lyric" ""; \texte > + > + \paper { unitspace= 2.5\cm; } +} diff --git a/input/twinkle.ly b/input/twinkle.ly index 4835e7783a..ba47c25d35 100644 --- a/input/twinkle.ly +++ b/input/twinkle.ly @@ -3,18 +3,19 @@ filename: twinkle.ly title: twinkle twinkle little star description: + traditional song in various languages. "Ah, vous dirais-je, maman" "Altijd is Kortjakje ziek" "Twinkle twinkle little star" - composers: ? + composers: Traditional entered-by: HWN & JCN copyright: public domain Tested Features: lyrics EndMudelaHeader %} -\version "0.1.0"; +\version "0.1.1"; melody = \melodic{ \clef violin; @@ -32,7 +33,7 @@ melody = \melodic{ accompany = \melodic { \clef "bass"; - \octave'c; + \octave 'c; \duration 4; c4 c' | e' c' | f' c' | e' c' | d' b | c' a | f g | c2 | @@ -60,6 +61,12 @@ tekst = \lyric{ midden4 in_de week maar s'_zon- dags niet.2 } +%{ + +Ja inderdaad. Dit is geen educatieve danwel muzikaal verantwoorde +tekst. Mogen wij ook af en toe ergens op afgeven? + +%} hegedraagjetekst = \lyric{ Al-4 tijd zuigt Bill Gates mijn piek,2 "\TeX"4 is slecht- ser dan mu- ziek.2 @@ -125,7 +132,7 @@ textiii = \lyric{ % ugh \lyric < \id "Lyric" "1"; - \global \tekst \hegedraagjetekst > + \global \tekst > \lyric < \id "Lyric" "2"; \global \texte > \lyric < \id "Lyric" "3"; \global @@ -136,7 +143,7 @@ textiii = \lyric{ unitspace= 2.5\cm; } \midi{ - \tempo 4:120 ; + \tempo 4 = 120 ; } } diff --git a/input/wohltemperirt.ly b/input/wohltemperirt.ly index 6807b651d5..b3c6234a82 100644 --- a/input/wohltemperirt.ly +++ b/input/wohltemperirt.ly @@ -1,7 +1,10 @@ %{ - title: Das Wohltemperirte Clavier I, Fuga II (c-minor) - description: following Henle's Urtext - composer(s): J.S. Bach + filename: wohltemperirt.ly + title: Fuga a 3 + description: Das Wohltemperirte Clavier I, Fuga II (c-minor) + Opus: BWV ? + source: Henle's Urtext + composer(s): Johann Sebastian Bach (1685-1750) entered-by: HWN and Werner Lemberg copyright: Public Domain @@ -9,7 +12,7 @@ %} -\version "0.1.0"; +\version "0.1.1"; % should add \need{dutch.ini} for % correct parsing of note names @@ -17,7 +20,7 @@ global = \melodic { \meter 4/4; % should be \meter C - \key bes es as; + \keyCminor } dux = @@ -173,11 +176,9 @@ bassdux = > > - \paper{ -% castingalgorithm=0.; - } + \paper{} \midi { - \tempo 4:84; + \tempo 4 = 84; } } diff --git a/lib/Makefile b/lib/Makefile index 1fbb2d83c2..9538b989ae 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -52,7 +52,7 @@ LOADLIBES += # MAINTARGET = $(bindir)/$(EXECUTABLE)# huh? MAINTARGET = $(outdir)/$(LIBRARY)# huh? -default: $(MAINTARGET) +default: configheader $(MAINTARGET) # localclean: @@ -68,3 +68,10 @@ include ./$(depth)/make/Rules.make -include $(DEPFILES) # +.PHONY: configheader + +configheader: $(outdir)/config.hh + +# Ugh ugh +$(outdir)/config.hh: config.hh.in + sed 's!@datadir@!$(datadir)!'< $< > $@ diff --git a/lib/binary-source-file.cc b/lib/binary-source-file.cc index c2e3c152be..666012f0c6 100644 --- a/lib/binary-source-file.cc +++ b/lib/binary-source-file.cc @@ -34,7 +34,7 @@ Binary_source_file::error_str( char const* pos_ch_c_l ) return ""; char const* begin_ch_c_l = pos_ch_c_l - 8 >? ch_C(); - char const* end_ch_c_l = pos_ch_c_l + 7 <? ch_C() + length_off(); + char const* end_ch_c_l = pos_ch_c_l + 7 <? ch_C() + length_i(); String pre_str( (Byte const*)begin_ch_c_l, pos_ch_c_l - begin_ch_c_l ); pre_str = String_convert::bin2hex_str( pre_str ); diff --git a/lib/config.hh.in b/lib/config.hh.in index 2aa23dfdaa..1e7112e2c9 100644 --- a/lib/config.hh.in +++ b/lib/config.hh.in @@ -1,6 +1,6 @@ /* @configure_input@ */ #ifndef CONFIG_HH #define CONFIG_HH -#define DIR_DATADIR "@DIR_DATADIR@" +#define DIR_DATADIR "@datadir@/lilypond" #endif diff --git a/lib/duration-convert.cc b/lib/duration-convert.cc index 4a46bf9e64..b2a7195103 100644 --- a/lib/duration-convert.cc +++ b/lib/duration-convert.cc @@ -4,6 +4,7 @@ source file of the LilyPond music typesetter (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> + Jan Nieuwenhuizen <jan@digicash.com> */ #include <assert.h> #include "duration-convert.hh" @@ -115,9 +116,7 @@ Duration_convert::mom2standardised_dur( Moment mom ) // if ( !dur_array_s.length_i() ) if ( !dur_array_s.size() ) set_array(); -// assert( dur_array_s.length_i() ); assert( dur_array_s.size() ); -// for ( int i = 0; i < dur_array_s.length_i() - 1; i++ ) { for ( int i = 0; i < dur_array_s.size() - 1; i++ ) { Moment lower_mom = dur2_mom( dur_array_s[ i ] ); if ( mom <= lower_mom ) { @@ -125,22 +124,18 @@ Duration_convert::mom2standardised_dur( Moment mom ) // kinda ok if ( i || ( mom / lower_mom > Moment( 3, 4 ) ) ) return dur_array_s[ i ]; - else - return Duration( 0 ); + else { + Duration d; + d.type_i_ = 0; + return d; + } } Moment upper_mom = dur2_mom( dur_array_s[ i + 1 ] ); -#if 0 // % deviation of upper/lower from mom, perhaps it's better to use - if ( ( mom < upper_mom ) - && ( ( mom - lower_mom ) / mom - < ( upper_mom - mom ) / mom ) ) -#else // % deviation of mom from lower/upper? if ( ( mom < upper_mom ) && ( ( mom - lower_mom ) / lower_mom < ( upper_mom - mom ) / upper_mom ) ) -#endif return dur_array_s[ i ]; } -// return dur_array_s[ dur_array_s.length_i() ]; return dur_array_s[ dur_array_s.size() - 1 ]; } diff --git a/lib/duration.cc b/lib/duration.cc index 8c08c12802..fab55e756c 100644 --- a/lib/duration.cc +++ b/lib/duration.cc @@ -3,9 +3,8 @@ source file of the LilyPond music typesetter - copyright 1997 Jan Nieuwenhuizen <jan@digicash.com> - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> + (c) 1997 Jan Nieuwenhuizen <jan@digicash.com> + Han-Wen Nienhuys <hanwen@stack.nl> */ #include "proto.hh" @@ -21,12 +20,10 @@ int Duration::division_1_i_s = 384 * 4; -Duration::Duration( int type_i, int dots_i = 0) +Duration::Duration() { -// this breaks mi2mu quite effectively -// assert(duration_type_b(type_i)); - type_i_ = type_i; - dots_i_ = dots_i; + type_i_ = 1; + dots_i_ = 0; ticks_i_ = 0; } @@ -85,12 +82,6 @@ Plet::Plet() iso_i_ = 1; } -Plet::Plet( int iso_i, int type_i ) -{ - iso_i_ = iso_i; - type_i_ = type_i; -} - Moment Plet::mom()const { diff --git a/lib/file-storage.cc b/lib/file-storage.cc new file mode 100644 index 0000000000..16bee29c68 --- /dev/null +++ b/lib/file-storage.cc @@ -0,0 +1,98 @@ +/* + file-storage.cc -- implement Mapped_file_storage + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> + Jan Nieuwenhuizen <jan@digicash.com> +*/ +#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 "string.hh" +#include "proto.hh" +#include "warn.hh" +#include "file-storage.hh" + +Mapped_file_storage::Mapped_file_storage(String s) +{ + data_caddr_ = 0; + fildes_i_ = 0; + size_off_ = 0; + open(s); +} + +char const* +Mapped_file_storage::ch_C()const +{ + return (char const*)data_caddr_; +} + +void +Mapped_file_storage::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 ) + warning( String( "can't map: error no: " ) + strerror( errno )); +} + + +void +Mapped_file_storage::open(String name_str) +{ + fildes_i_ = ::open( name_str, O_RDONLY ); + + if ( fildes_i_ == -1 ) { + warning( String( "can't open: " ) + name_str + String( ": " ) + strerror( errno )); + return; + } + + struct stat file_stat; + fstat( fildes_i_, &file_stat ); + size_off_ = file_stat.st_size; + map(); +} + +void +Mapped_file_storage::unmap() +{ + if ( data_caddr_ ) { + munmap( data_caddr_, size_off_ ); + data_caddr_ = 0; + size_off_ = 0; + } +} + +void +Mapped_file_storage::close() +{ + unmap(); + if ( fildes_i_ ) { + ::close( fildes_i_ ); + fildes_i_ = 0; + } +} + +int +Mapped_file_storage::length_i()const +{ + return size_off_; +} + +Mapped_file_storage::~Mapped_file_storage() +{ + close(); +} diff --git a/lib/include/duration.hh b/lib/include/duration.hh index c8554f343a..c46fc5a7c0 100644 --- a/lib/include/duration.hh +++ b/lib/include/duration.hh @@ -18,11 +18,12 @@ // ugh, to get me in lily lib extern bool no_triplets_bo_g; -/** (plet) - The type and replacement value of a plet (triplet, quintuplet.) Conceptually the same as a rational, but 4/6 != 2/3 +/** + The type and replacement value of a plet (triplet, quintuplet.) Conceptually the same as a rational, but 4/6 != 2/3. + + (plet) */ struct Plet { - Plet( int replace_i, int type_i ); Plet(); Moment mom()const; bool unit_b()const; @@ -39,7 +40,7 @@ struct Duration { /** Ctor of Duration. type_i should be a power of 2. */ - Duration( int type_i = 1, int dots_i = 0); + Duration(); /// is the "plet factor" of this note != 1 ? bool plet_b(); String str()const; diff --git a/lib/include/file-storage.hh b/lib/include/file-storage.hh new file mode 100644 index 0000000000..850046236c --- /dev/null +++ b/lib/include/file-storage.hh @@ -0,0 +1,62 @@ +/* + file-storage.hh -- declare File_storage, Mapped_file_storage, Simple_file_storage + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef FILE_STORAGE_HH +#define FILE_STORAGE_HH + +#include "proto.hh" + +/** + store a file in-memory. + */ +class File_storage +{ +public: + virtual char const* ch_C()const=0; + virtual int length_i()const=0; + virtual ~File_storage(){} +}; + +/** + Use mmap to "copy" a file into memory + */ +class Mapped_file_storage:public File_storage +{ +public: + Mapped_file_storage(String); +protected: + virtual char const* ch_C()const; + virtual int length_i()const; + virtual ~Mapped_file_storage(); +private: + void open(String name); + void close(); + + void map(); + void unmap(); + int fildes_i_; + off_t size_off_; + caddr_t data_caddr_; +}; + +/** + read file char by char and copy into a malloc array. + */ +class Simple_file_storage : public File_storage +{ + char * data_p_; + int len_i_; +protected: + virtual char const*ch_C()const; + virtual int length_i()const; + virtual ~Simple_file_storage(); +public: + Simple_file_storage(String); +}; +#endif // FILE_STORAGE_HH diff --git a/lib/include/proto.hh b/lib/include/proto.hh index 17a7b341a8..21cadf9b79 100644 --- a/lib/include/proto.hh +++ b/lib/include/proto.hh @@ -14,4 +14,7 @@ struct Duration; struct Duration_iterator; struct Source_file; struct Sources; +struct File_storage; +struct Mapped_file_storage; +struct Simple_file_storage; #endif // PROTO_HH diff --git a/lib/include/source-file.hh b/lib/include/source-file.hh index 6fdcc5d88a..39cd533e41 100644 --- a/lib/include/source-file.hh +++ b/lib/include/source-file.hh @@ -5,9 +5,13 @@ #ifndef SOURCE_FILE_HH #define SOURCE_FILE_HH -#include "fproto.hh" + +#include "proto.hh" #include "string.hh" + class istream; + + /// class for reading and mapping a file. class Source_file { @@ -17,26 +21,19 @@ public: Source_file( String filename_str_r ); virtual ~Source_file(); - char const* ch_C(); - virtual String error_str( char const* pos_ch_c_l ); + char const* ch_C()const; + virtual String error_str( char const* pos_ch_c_l )const; istream * istream_l(); - bool in_b( char const* pos_ch_c_l ); - off_t length_off(); - virtual int line_i( char const* pos_ch_c_l ); - String name_str(); - String file_line_no_str( char const* ch_c_l ); + bool in_b( char const* pos_ch_c_l )const; + int length_i()const; + virtual int line_i( char const* pos_ch_c_l )const; + String name_str()const; + String file_line_no_str( char const* ch_c_l )const; private: - void close(); - void map(); - void open(); - void unmap(); - - istream* istream_p_; - int fildes_i_; String name_str_; - off_t size_off_; - caddr_t data_caddr_; + istream* istream_p_; + File_storage * storage_p_; }; #endif // SOURCE_FILE_HH // diff --git a/lib/include/source.hh b/lib/include/source.hh index bc4a859c0a..9d443ed0db 100644 --- a/lib/include/source.hh +++ b/lib/include/source.hh @@ -14,6 +14,7 @@ public: void set_path(File_path*p_C); Sources(); void set_binary(bool); + ~Sources(); private: const File_path * path_C_; void add( Source_file* sourcefile_p ); diff --git a/lib/simple-file-storage.cc b/lib/simple-file-storage.cc new file mode 100644 index 0000000000..be022cee02 --- /dev/null +++ b/lib/simple-file-storage.cc @@ -0,0 +1,63 @@ +/* + simple-file-storage.cc -- implement Simple_file_storage + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include <stdio.h> + +#include "file-storage.hh" +#include "varray.hh" +#include "string.hh" +#include "warn.hh" + +/** + Stupid but foolproof way of opening files. + + TODO + Should use obstack. Should check IO status + + This is of course a build it yourself version of mmap, so we should + have been using that... (see Mapped_file_storage) But we noticed + some problems with this (unexplained lexer crashes) + + */ + +Simple_file_storage::Simple_file_storage(String s) +{ + data_p_ =0; + FILE * f = fopen ( s.ch_C(), "r"); + if ( !f ) { + warning("can't open file\n"); + return ; + } + + int ret = fseek( f, 0, SEEK_END); + len_i_ = ftell(f); + rewind(f); + data_p_ = new char[len_i_+1]; + data_p_[len_i_] = 0; + ret = fread(data_p_, sizeof(char), len_i_, f); + assert (ret==len_i_); + fclose(f); +} + +char const* +Simple_file_storage::ch_C() const +{ + return data_p_; +} + +int +Simple_file_storage::length_i()const +{ + return len_i_; +} + + +Simple_file_storage::~Simple_file_storage() +{ + delete []data_p_; +} diff --git a/lib/source-file.cc b/lib/source-file.cc index 8f28f9b5f5..ffc7a341ed 100644 --- a/lib/source-file.cc +++ b/lib/source-file.cc @@ -1,50 +1,40 @@ -// -// 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 +/* + source-file.cc -- implement + + source file of the GNU LilyPond music typesetter + + (c) 1997 Jan Nieuwenhuizen <jan@digicash.com> + & Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + #include <assert.h> #include <strstream.h> #include "string.hh" #include "proto.hh" #include "plist.hh" - - #include "warn.hh" #include "windhoos-suck-suck-suck-thank-you-cygnus.hh" - #include "source-file.hh" +#include "file-storage.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(); - if ( fildes_i_ > 0 ) - map(); + storage_p_ = new Simple_file_storage(filename_str); } istream* Source_file::istream_l() { - if ( !fildes_i_ ) + if ( !name_str_.length_i()) return &cin; + if ( !istream_p_ ) { - if ( size_off_ ) // can-t this be done without such a hack? - istream_p_ = new istrstream( ch_C(), size_off_ ); + if ( length_i() ) // can-t this be done without such a hack? + istream_p_ = new istrstream( ch_C(), length_i() ); else { istream_p_ = new istrstream( "", 0 ); istream_p_->set(ios::eofbit); @@ -53,35 +43,29 @@ Source_file::istream_l() return istream_p_; } -Source_file::~Source_file() +String +Source_file::file_line_no_str(char const *ch_C )const { - delete istream_p_; - istream_p_ = 0; - unmap(); - close(); + return name_str() + ": " + + String( line_i( ch_C ) ); } -char const* -Source_file::ch_C() +String +Source_file::name_str()const { - assert( this ); - return (char const*)data_caddr_; + return name_str_; } - -void -Source_file::close() +Source_file::~Source_file() { - if ( fildes_i_ ) { - ::close( fildes_i_ ); - fildes_i_ = 0; - } + delete istream_p_; + istream_p_ = 0; + delete storage_p_; } - String -Source_file::error_str( char const* pos_ch_C ) +Source_file::error_str( char const* pos_ch_C )const { char const* data_ch_C = ch_C(); - char const * eof_C_ = data_ch_C + size_off_; + char const * eof_C_ = data_ch_C + length_i(); if ( !in_b( pos_ch_C ) ) return "(position unknown)"; @@ -121,19 +105,14 @@ Source_file::error_str( char const* pos_ch_C ) } bool -Source_file::in_b( char const* pos_ch_C ) +Source_file::in_b( char const* pos_ch_C )const { - return ( pos_ch_C && ( pos_ch_C >= ch_C() ) && ( pos_ch_C <= ch_C() + size_off_ ) ); + return ( pos_ch_C && ( pos_ch_C >= ch_C() ) && ( pos_ch_C <= ch_C() + length_i() ) ); } -off_t -Source_file::length_off() -{ - return size_off_; -} int -Source_file::line_i( char const* pos_ch_C ) +Source_file::line_i( char const* pos_ch_C )const { if ( !in_b( pos_ch_C ) ) return 0; @@ -146,56 +125,14 @@ Source_file::line_i( char const* pos_ch_C ) 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 ) - warning( String( "can't map: " ) + name_str_ + String( ": " ) + strerror( errno )); -} - -String -Source_file::name_str() -{ - return name_str_; -} - -void -Source_file::open() +int +Source_file::length_i()const { - if ( !name_str_.length_i() || ( name_str_ == "-" ) ) { - fildes_i_ = 0; - return; - } - - fildes_i_ = ::open( name_str_, O_RDONLY ); - - if ( fildes_i_ == -1 ) { - warning( String( "can't open: " ) + name_str_ + String( ": " ) + strerror( errno )); - return; - } - - struct stat file_stat; - fstat( fildes_i_, &file_stat ); - size_off_ = file_stat.st_size; + return storage_p_->length_i(); } -void -Source_file::unmap() +char const * +Source_file::ch_C()const { - 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 ) -{ - return name_str() + ": " - + String( line_i( ch_C ) ); + return storage_p_->ch_C(); } diff --git a/lib/source.cc b/lib/source.cc index 6be3ca42fc..ec490f17e7 100644 --- a/lib/source.cc +++ b/lib/source.cc @@ -72,3 +72,6 @@ Sources::sourcefile_l( char const* ch_C ) return *sourcefile_l_pcur; return 0; } + +Sources::~Sources() +{} diff --git a/lily/Makefile b/lily/Makefile index 1cee326a74..16f59f5d5c 100644 --- a/lily/Makefile +++ b/lily/Makefile @@ -37,7 +37,7 @@ EXTRA_DISTFILES = VERSION # list of custom libraries: # -MODULE_LIBDEPS= check-flower-deps check-lily-deps +MODULE_LIBDEPS= check-flower-deps check-lib-deps MODULE_LIBES= -llily -lflower # @@ -70,3 +70,8 @@ localinstall: installexe localuninstall: uninstallexe $(outdir)/lily-version.o: $(outdir)/version.hh + +# make config.hh. Ugh +$(outdir)/main.o: $(libout)/config.hh + +$(libout)/config.hh: check-lib-deps diff --git a/lily/Stable.make b/lily/Stable.make index 885745a247..c6d2ee88d9 100644 --- a/lily/Stable.make +++ b/lily/Stable.make @@ -1,10 +1,10 @@ # kept in dist bo stripping stable stuff, still to copy... # a bit of a hack to keep exec size under control. -stablecc=atom.cc command-request.cc musical-request.cc bar.cc boxes.cc \ +stablecc=atom.cc bar.cc boxes.cc \ keyword.cc leastsquares.cc \ lookup.cc meter.cc\ - parser.cc \ + parser.cc notename-table.cc lexer.cc\ qlp.cc qlpsolve.cc\ - template*.cc template6.cc version.cc tex-stream.cc tex.cc\ + template*.cc version.cc tex-stream.cc tex.cc\ identifier.cc note.cc diff --git a/lily/VERSION b/lily/VERSION index 013490db64..c04453cdaa 100644 --- a/lily/VERSION +++ b/lily/VERSION @@ -1,6 +1,6 @@ MAJOR_VERSION = 0 MINOR_VERSION = 1 -PATCH_LEVEL = 1 +PATCH_LEVEL = 7 # use to send patches, always empty for released version: # include separator: ".postfix", "-pl" makes rpm barf diff --git a/lily/atom.cc b/lily/atom.cc index f90625a25f..0d8eb44f44 100644 --- a/lily/atom.cc +++ b/lily/atom.cc @@ -13,12 +13,12 @@ #include "varray.hh" #include "debug.hh" - - void Atom::print() const { +#ifndef NPRINT mtor << "texstring: " <<sym_.tex<<"\n"; +#endif } Box @@ -39,14 +39,14 @@ String Atom::TeX_string() const { /* infinity checks. */ - assert( abs(off_.x) < 100 CM); - assert( abs(off_.y) < 100 CM); + assert( abs(off_.x()) < 100 CM); + assert( abs(off_.y()) < 100 CM); // whugh.. Hard coded... String s("\\placebox{%}{%}{%}"); Array<String> a; - a.push(print_dimen(off_.y)); - a.push(print_dimen(off_.x)); + a.push(print_dimen(off_.y())); + a.push(print_dimen(off_.x())); a.push(sym_.tex); return substitute_args(s, a); } diff --git a/lily/audio-element.cc b/lily/audio-element.cc new file mode 100644 index 0000000000..6ab6c02d58 --- /dev/null +++ b/lily/audio-element.cc @@ -0,0 +1,13 @@ +/* + audio-element.cc -- implement Audio_element + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "audio-element.hh" + +IMPLEMENT_IS_TYPE_B(Audio_element); +Audio_element::~Audio_element() +{} diff --git a/lily/audio-item.cc b/lily/audio-item.cc index 689c34af38..a041a7d2f3 100644 --- a/lily/audio-item.cc +++ b/lily/audio-item.cc @@ -9,12 +9,17 @@ #include "audio-item.hh" #include "midi-item.hh" -#if 0 Audio_instrument::Audio_instrument( String instrument_str ) : Audio_item( 0 ) { + str_ = instrument_str; +} + +Midi_item* +Audio_instrument::midi_item_p() +{ + return new Midi_instrument( 0, str_ ); } -#endif Audio_item::Audio_item( Request* req_l ) { @@ -34,10 +39,9 @@ Audio_key::midi_item_p() } -Audio_note::Audio_note( Request* req_l, bool on_b ) +Audio_note::Audio_note( Request* req_l ) : Audio_item( req_l ) { - on_b_ = on_b; } Midi_item* @@ -82,3 +86,5 @@ Audio_text::midi_item_p() return new Midi_text( this ); } + +IMPLEMENT_IS_TYPE_B1(Audio_item, Audio_element); diff --git a/lily/audio-score.cc b/lily/audio-score.cc index 8094b3e369..27f82a0746 100644 --- a/lily/audio-score.cc +++ b/lily/audio-score.cc @@ -6,49 +6,98 @@ (c) 1997 Jan Nieuwenhuizen <jan@digicash.com> */ +#include <time.h> #include "debug.hh" +#include "string.hh" +#include "string-convert.hh" +#include "main.hh" #include "midi-def.hh" +#include "midi-item.hh" +#include "midi-stream.hh" #include "audio-column.hh" +#include "audio-staff.hh" #include "audio-score.hh" +#include "score.hh" -Audio_score::Audio_score( Midi_def* l ) +Audio_score::Audio_score( Score* l ) { - midi_l_ = l; + score_l_ = l; } void -Audio_score::play( Audio_item* i, Audio_column* c ) +Audio_score::add( Audio_column* p ) { - assert( c ); - assert( i ); + p->audio_score_l_ = this; + audio_column_p_list_.bottom().add(p); +} - c->add( i ); -// typeset_element( i ); +void +Audio_score::output( Midi_stream& midi_stream_r ) +{ + int tracks_i = audio_staff_l_list_.size() + 1; + // ugh + int clocks_per_4_i = 384; + midi_stream_r << Midi_header( 1, tracks_i, clocks_per_4_i ); + output_header_track( midi_stream_r ); + int n = 1; + for ( PCursor<Audio_staff*> i( audio_staff_l_list_ ); i.ok(); i++ ) + i->output( midi_stream_r, n++ ); } void -Audio_score::add( Audio_column* p ) +Audio_score::output_header_track( Midi_stream& midi_stream_r ) { - p->audio_score_l_ = this; - audio_column_p_list_.bottom().add(p); + Midi_track midi_track; + + time_t t = time( 0 ); + + // perhaps multiple text events? + String str = String( "Creator: " ) + get_version_str() + "\n"; + + Midi_text creator( Midi_text::TEXT, str ); + midi_track.add( Moment( 0 ), &creator ); + + str = "Automatically generated at "; + str += ctime( &t ); + str = str.left_str( str.length_i() - 1 ); + str += "\n"; + Midi_text generate( Midi_text::TEXT, str ); + midi_track.add( Moment( 0 ), &generate ); + + str = "from musical definition: "; + + str += score_l_->location_str(); + Midi_text from( Midi_text::TEXT, str ); + midi_track.add( Moment( 0 ), &from ); + + Midi_text track_name( Midi_text::TRACK_NAME, "Track " + + String_convert::i2dec_str( 0, 0, '0' ) ); + midi_track.add( Moment( 0 ), &track_name ); + + Midi_tempo tempo( score_l_->midi_p_->get_tempo_i( Moment( 1, 4 ) ) ); + midi_track.add( Moment(0), &tempo); + + midi_stream_r << midi_track; +} + +void +Audio_score::add_staff( Audio_staff* l ) +{ + audio_staff_l_list_.bottom().add( l ); } -#if 0 void -Audio_score::output(Tex_stream &ts) +Audio_score::add(Audio_element *p) { - ts << "\n "<< midi_l_->lookup_l()->texsetting << "%(Tex id)\n"; - ts<< super_elem_l_->TeX_string(); - ts << "\n\\EndLilyPondOutput"; + audio_elem_p_list_.bottom().add( p); } -#endif void Audio_score::print() const { #ifndef NPRINT mtor << "Audio_score { "; - midi_l_->print(); + score_l_->midi_p_->print(); mtor << "\ncolumns: "; for ( PCursor<Audio_column*> i( audio_column_p_list_ ); i.ok(); i++ ) i->print(); @@ -59,15 +108,5 @@ Audio_score::print() const void Audio_score::process() { -#if 0 - clean_cols(); - print(); - *mlog << "Preprocessing elements... " <<flush; - preprocess(); - *mlog << "\nCalculating column positions ... " <<flush; - calc_breaking(); - *mlog << "\nPostprocessing elements..." << endl; - postprocess(); -#endif } diff --git a/lily/axis-group-item.cc b/lily/axis-group-item.cc new file mode 100644 index 0000000000..bc1bffd00a --- /dev/null +++ b/lily/axis-group-item.cc @@ -0,0 +1,50 @@ +/* + axis-item.cc -- implement Axis_group_item + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ +#include "axis-group-item.hh" +#include "p-col.hh" + +IMPLEMENT_IS_TYPE_B2(Axis_group_item, Axis_group_element, Item); + +void +Axis_group_item::OK() const +{ + Link_array<Score_elem> elems = axis_admin_.elem_l_arr_; + for (int i=0; i < elems.size(); i++) { + Item * it_l = elems[i]->item(); + assert(it_l); + + // somebody probably broke it in pieces + assert (it_l->pcol_l_ == pcol_l_ ); + } +} + +void +Axis_group_item::do_breakable_col_processing() +{ + if (!pcol_l_->breakable_b()) + return; + OK(); + copy_breakable_items(); + + + Link_array<Score_elem> elems = axis_admin_.elem_l_arr_; + for (int i=0; i < elems.size(); i++) { + Item* it_l = elems[i]->item(); + for ( int j=0; j < 2; j++) { + Item *new_l = it_l->find_prebroken_piece(broken_to_a_[j]->pcol_l_); + ((Axis_group_item*)broken_to_a_[j])->add_element( new_l ); + } + } + Item::do_breakable_col_processing(); +} + +void +Axis_group_item::do_print() const +{ + Axis_group_element::do_print(); +} diff --git a/lily/axis-group-spanner.cc b/lily/axis-group-spanner.cc new file mode 100644 index 0000000000..94aab236b6 --- /dev/null +++ b/lily/axis-group-spanner.cc @@ -0,0 +1,115 @@ +/* + axis-group-spanner.cc -- implement Axis_group_spanner + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "axis-group-spanner.hh" +#include "item.hh" +#include "p-col.hh" + +/** Do stuff if we're not broken. In this case the last and first + columns usually are pre- and postbreak respectively, + so the items from these columns need adjusting. + */ +void +Axis_group_spanner::do_break_processing_if_unbroken() +{ + Link_array<Score_elem> elems = axis_admin_.elem_l_arr_; + Line_of_score *my_line = line_l(); + for (int i=0; i < elems.size(); i++) { + if (!elems[i]->line_l()) { + Item * item_l = elems[i]->item(); + if (item_l + && item_l->breakable_b_ + && item_l->break_status_i() == 0) { + // last two checks are paranoia + Item * broken_item_l = + item_l->find_prebroken_piece( my_line ); + add_element( broken_item_l ); + } + remove_element( elems[i] ); + } + } + +} +void +Axis_group_spanner::do_break_processing() +{ + set_my_columns(); + bool breaking_self_b = ! Spanner::line_l(); + if (!breaking_self_b) { + do_break_processing_if_unbroken(); + Spanner::do_break_processing(); + return; + } + + break_into_pieces( true ); + Link_array<Score_elem> loose_elems = axis_admin_.elem_l_arr_; + remove_all(); + + for (int i=0; i < loose_elems.size(); i++) { + Score_elem * elt = loose_elems[i]; + Line_of_score *elt_line = elt->line_l(); + + if ( ! elt_line ){ + /* this piece doesn't know where it belongs. + Find out if it was broken, and use the broken remains + */ + if (elt->spanner()) { + Spanner * sp = elt->spanner(); + + for (int j =0; j < broken_into_l_arr_.size(); j++) { + Axis_group_spanner * my_broken_l + = (Axis_group_spanner*)broken_into_l_arr_[j]; + + Spanner * broken_span_l + = sp->find_broken_piece( + ((Score_elem*)my_broken_l)->line_l()); + + if (broken_span_l) + my_broken_l->add_element(broken_span_l ); + + } + } else if (elt->item() + && elt->item()->breakable_b_ + && elt->item()->break_status_i() == 0) { + + // broken items + for (int j =0; j < 2; j++) { + Item * my_item = elt->item()->broken_to_a_[j]; + Line_of_score * item_line_l = my_item->line_l() ; + if ( ! item_line_l ) + continue; + + Axis_group_spanner * v + = (Axis_group_spanner*)find_broken_piece( item_line_l ); + if (v) + v->add_element( my_item ); + } + + } + } else { + /* this piece *does* know where it belongs. + Put it in appropriate piece of this spanner + */ + Axis_group_spanner * my_broken_l + = (Axis_group_spanner*)find_broken_piece( elt->line_l() ); + my_broken_l->add_element( elt ); + } + } + + Spanner::do_break_processing(); +} + +void +Axis_group_spanner::do_print() const +{ + Axis_group_element::do_print(); +} + + + +IMPLEMENT_IS_TYPE_B2(Axis_group_spanner, Spanner, Axis_group_element); diff --git a/lily/axis-group.cc b/lily/axis-group.cc new file mode 100644 index 0000000000..b6b5eec4fc --- /dev/null +++ b/lily/axis-group.cc @@ -0,0 +1,76 @@ +/* + axis-group.cc -- implement Axis_group_administration + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ +#include "interval.hh" +#include "axis-group.hh" +#include "score-elem.hh" +#include "debug.hh" + +/** don't copy anything: an element can only be in one + Axis_group_element at one time. */ +Axis_group_administration::Axis_group_administration( + Axis_group_administration const&) +{ +} + +bool +Axis_group_administration::contains_b(Score_elem const *e)const +{ + return elem_l_arr_.find_l(e); +} + +Interval +Axis_group_administration::extent(Axis axis)const +{ + Interval r; + for (int i=0; i < elem_l_arr_.size(); i++) + r.unite(elem_l_arr_[i]->extent(axis)); + return r; +} + +void +Axis_group_administration::add_element(Score_elem*e, + Axis_group_element*g, Axis a1, Axis a2) +{ + assert( ! e->axis_group_l_a_[a1] && !e->axis_group_l_a_[a2] ); + e->axis_group_l_a_[a1] = g; + e->axis_group_l_a_[a2] = g; + elem_l_arr_.push ( e); +} + + + +void +Axis_group_administration::remove_element(Score_elem*e, Axis a1, Axis a2) +{ + assert( contains_b( e)); + elem_l_arr_.unordered_substitute(e,0); + + e->axis_group_l_a_[a1] = 0; + e->axis_group_l_a_[a2] = 0; +} + +void +Axis_group_administration::remove_all(Axis a1, Axis a2) +{ + for (int i=0; i < elem_l_arr_.size(); i++) { + Score_elem*e=elem_l_arr_[i]; + e->axis_group_l_a_[a1] = 0; + e->axis_group_l_a_[a2] = 0; + } + elem_l_arr_.clear(); +} + + +void +Axis_group_administration::print() const +{ +#ifndef NPRINT + for (int i=0; i < elem_l_arr_.size(); i++) + mtor << elem_l_arr_[i]->name() << ' '; +#endif +} diff --git a/lily/axis.cc b/lily/axis.cc new file mode 100644 index 0000000000..eddfd0c9b5 --- /dev/null +++ b/lily/axis.cc @@ -0,0 +1,16 @@ +/* + axis.cc -- implement Axis + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "axes.hh" +#include "string.hh" + +String +axis_name_str(Axis a) +{ + return String (a + 'x'); +} diff --git a/lily/bar-column-grav.cc b/lily/bar-column-grav.cc new file mode 100644 index 0000000000..1dda5113ca --- /dev/null +++ b/lily/bar-column-grav.cc @@ -0,0 +1,69 @@ +/* + bar-column-grav.cc -- implement Bar_column_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#include "bar-column-grav.hh" +#include "bar-column.hh" +#include "request.hh" +#include "script.hh" +#include "bar.hh" + +Bar_column_engraver::Bar_column_engraver() +{ + bar_l_ =0; + barcol_p_ =0; +} + + +void +Bar_column_engraver::acknowledge_element(Score_elem_info info) +{ + if (info.elem_l_->is_type_b(Script::static_name()) + && info.req_l_->command() + && info.origin_grav_l_arr_.size() == 1) { + script_l_arr_.push( (Script*)info.elem_l_->item()); + } else { + if (info.origin_grav_l_arr_.size() == 1 + && info.elem_l_->is_type_b(Bar::static_name())) + bar_l_ = (Bar*)info.elem_l_->item(); + } + + if ( bar_l_ && !barcol_p_ ) { + barcol_p_ = new Bar_column; + barcol_p_->breakable_b_ =true; + barcol_p_->set_bar( bar_l_ ); + announce_element(Score_elem_info(barcol_p_, 0)); + } + + if (barcol_p_ ) { + for (int i=0; i < script_l_arr_.size(); i++) { + script_l_arr_[i]->breakable_b_ = true; + barcol_p_->add(script_l_arr_[i]); + } + script_l_arr_.clear(); + } +} + +void +Bar_column_engraver::do_pre_move_processing() +{ + if (barcol_p_) { + typeset_element( barcol_p_ ); + barcol_p_ =0; + } +} + +void +Bar_column_engraver::do_post_move_processing() +{ + script_l_arr_.clear(); + bar_l_ =0; +} + +IMPLEMENT_IS_TYPE_B1(Bar_column_engraver, Engraver); +ADD_THIS_ENGRAVER(Bar_column_engraver); diff --git a/lily/bar-column.cc b/lily/bar-column.cc new file mode 100644 index 0000000000..123b512ed4 --- /dev/null +++ b/lily/bar-column.cc @@ -0,0 +1,35 @@ +/* + bar-column.cc -- implement Bar_column + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "bar.hh" +#include "bar-column.hh" + +Bar_column::Bar_column() +{ + bar_l_ =0; + breakable_b_ = true; +} + +void +Bar_column::set_bar(Bar*b) +{ + Script_column::add_support( b ); + bar_l_ = b; +} + +void +Bar_column::do_substitute_dependency(Score_elem*o,Score_elem*n) +{ + Script_column::do_substitute_dependency(o,n); + if ( o == bar_l_ ) { + bar_l_ = n ? (Bar*)n->item() : 0; + } +} + +IMPLEMENT_IS_TYPE_B1(Bar_column, Script_column); + diff --git a/lily/bar-grav.cc b/lily/bar-grav.cc index 3362ce0024..3847e9a5ba 100644 --- a/lily/bar-grav.cc +++ b/lily/bar-grav.cc @@ -24,7 +24,7 @@ Bar_engraver::do_try_request(Request*r_l) if (!c_l|| !c_l->bar()) return false; Bar_req * b= c_l->bar(); - if (bar_req_l_ && bar_req_l_->compare(*b)) + if (bar_req_l_ && bar_req_l_->equal_b(b)) return false; bar_req_l_ = b; @@ -55,7 +55,7 @@ void Bar_engraver::do_pre_move_processing() { if (bar_p_) { - typeset_breakable_item(bar_p_); + typeset_element(bar_p_); bar_p_ =0; } } diff --git a/lily/bar-number-grav.cc b/lily/bar-number-grav.cc new file mode 100644 index 0000000000..4b0535f5a4 --- /dev/null +++ b/lily/bar-number-grav.cc @@ -0,0 +1,51 @@ +/* + bar-number-grav.cc -- implement Bar_number_grav + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#include "bar-number-grav.hh" +#include "script.hh" +#include "text-def.hh" +#include "command-request.hh" +#include "bar.hh" + +Bar_number_grav::Bar_number_grav() +{ + number_i_ =1; + script_p_ =0; +} + +static Command_script_req dummy; + +void +Bar_number_grav::acknowledge_element(Score_elem_info i) +{ + if (i.origin_grav_l_arr_.size() == 1 && + i.elem_l_->is_type_b( Bar::static_name()) && !script_p_) { + + script_p_ = new Script; + Text_def *td_p =new Text_def; + td_p->text_str_ = number_i_++; + script_p_->specs_l_ = td_p; + script_p_->breakable_b_ = true; + script_p_->dir_i_ = 1; + + announce_element(Score_elem_info( script_p_, &dummy)); + } +} + +void +Bar_number_grav::do_pre_move_processing() +{ + if ( script_p_ ) { + typeset_element(script_p_); + script_p_ =0; + } +} + +IMPLEMENT_IS_TYPE_B1(Bar_number_grav,Engraver); +ADD_THIS_ENGRAVER(Bar_number_grav); diff --git a/lily/bar.cc b/lily/bar.cc index b45d977b26..2342d227b2 100644 --- a/lily/bar.cc +++ b/lily/bar.cc @@ -15,6 +15,7 @@ Bar::Bar() { + breakable_b_ = true; type_str_ = "|"; spanned_i_ = 0; } @@ -40,13 +41,15 @@ Bar::brew_molecule_p()const } /** + Prescriptions for splitting bars. TODO: parametrise this (input-settable) */ -char const *bar_breaks[][3] ={ +static char const *bar_breaks[][3] ={ {":|", ":|:", "|:"}, {"|", "|", ""}, {"", "|:", "|:"}, {"||.", "||.", ""}, + {":|", ":|", ""}, {0,0,0} }; @@ -58,7 +61,11 @@ Bar::do_pre_processing() type_str_ = bar_breaks[i][break_status_i()+1]; } - // span_score_bar needs dims. -// transparent_b_ = empty_b_ = (type_str_ == ""); + /* + span_score_bar needs dims, so don't do + + transparent_b_ = empty_b_ = (type_str_ == ""); + + */ } diff --git a/lily/beam.cc b/lily/beam.cc index 9079d277ba..4dd852f188 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -312,7 +312,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const a.translate(Offset (-w, -w * sl)); for (int j = 0; j < lhalfs; j++) { Atom b(a); - b.translate_y( -dir_i_ * dy * (lwholebeams+j)); + b.translate( -dir_i_ * dy * (lwholebeams+j), Y_AXIS); leftbeams.add( b ); } } @@ -327,7 +327,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const int j = 0; for (; j < rwholebeams; j++) { Atom b(a); - b.translate_y( -dir_i_ * dy * j); + b.translate( -dir_i_ * dy * j, Y_AXIS); rightbeams.add( b ); } @@ -337,7 +337,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const for (; j < rwholebeams + rhalfs; j++) { Atom b(a); - b.translate_y( -dir_i_ * dy * j); + b.translate( -dir_i_ * dy * j, Y_AXIS); rightbeams.add(b ); } @@ -366,7 +366,7 @@ Beam::brew_molecule_p() const sb.translate(Offset(x, (x * slope + left_pos)* inter_f)); mol_p->add(sb); } - mol_p->translate_x(x0 - left_col_l_->hpos_f_); + mol_p->translate(x0 - left_col_l_->hpos_f_, X_AXIS); return mol_p; } diff --git a/lily/boxes.cc b/lily/boxes.cc index 1798cb93c3..d06bfd2165 100644 --- a/lily/boxes.cc +++ b/lily/boxes.cc @@ -8,7 +8,7 @@ Box::Box() Box::Box(Interval ix, Interval iy) { - x = ix; - y = iy; + x() = ix; + y() = iy; } diff --git a/lily/break.cc b/lily/break.cc index 1ef5c4bc6f..8edb91a8b6 100644 --- a/lily/break.cc +++ b/lily/break.cc @@ -120,7 +120,7 @@ Break_algorithm::Break_algorithm() } void -Break_algorithm::set_pscore(PScore*s) +Break_algorithm::set_pscore(Paper_score*s) { pscore_l_ = s; linelength = s->paper_l_->linewidth_f(); diff --git a/lily/clef-grav.cc b/lily/clef-grav.cc index e7126456e2..a4426bcea2 100644 --- a/lily/clef-grav.cc +++ b/lily/clef-grav.cc @@ -106,7 +106,7 @@ Clef_engraver::do_pre_move_processing() { if (!clef_p_) return; - typeset_breakable_item(clef_p_); + typeset_element(clef_p_); clef_p_ = 0; } diff --git a/lily/clef-item.cc b/lily/clef-item.cc index 15cc5687b2..67742488ca 100644 --- a/lily/clef-item.cc +++ b/lily/clef-item.cc @@ -27,6 +27,7 @@ Clef_item::do_pre_processing() Clef_item::Clef_item() { + breakable_b_ =true; default_b_ = false; change_b_ = true; read("violin"); @@ -59,7 +60,7 @@ Clef_item::brew_molecule_p()const t += "_change"; Symbol s = paper()->lookup_l()->clef(t); Molecule*output = new Molecule(Atom(s)); - output->translate_y( paper()->internote_f() * y_off); + output->translate( paper()->internote_f() * y_off, Y_AXIS); return output; } diff --git a/lily/collision-grav.cc b/lily/collision-grav.cc index 2a4903d105..8eaa7cd30f 100644 --- a/lily/collision-grav.cc +++ b/lily/collision-grav.cc @@ -16,9 +16,10 @@ Collision_engraver::acknowledge_element(Score_elem_info i) if (!(i.elem_l_->name() == Note_column::static_name())) return; - if (!col_p_) + if (!col_p_) { col_p_ = new Collision; - + announce_element(Score_elem_info(col_p_,0)); + } col_p_->add((Note_column*)i.elem_l_->item()); } diff --git a/lily/collision.cc b/lily/collision.cc index f9a15bc4fa..0af68c462e 100644 --- a/lily/collision.cc +++ b/lily/collision.cc @@ -20,6 +20,7 @@ void Collision::add(Note_column* ncol_l) { clash_l_arr_.push(ncol_l); + add_element( ncol_l ); add_dependency(ncol_l); } /** @@ -76,7 +77,7 @@ Collision::do_pre_processing() do { if (!clash_group_arr_a[idx(d, false)].size()){ clash_group_arr_a[idx(d, false)] = clash_group_arr_a[idx(d, true)]; - clash_group_arr_a[idx(d, true)].set_size(0); + clash_group_arr_a[idx(d, true)].clear(); } } while ((d *= -1) != 1); @@ -133,10 +134,14 @@ Collision::do_pre_processing() Real inter_f = paper()->internote_f(); Real wid_f = paper()->note_width(); for (int j=0; j < 4; j++) { - if (col_l_a[j]) - col_l_a[j]->translate(Offset(x_off[j] * wid_f, - y_off[j] * inter_f)); - + if (col_l_a[j]) { + /* collision.cc:138: request for method `translate' is ambiguous + + (shaddup) + */ + Offset o(x_off[j] * wid_f, y_off[j] * inter_f); + ((Score_elem*)col_l_a[j])->translate(o); + } } } diff --git a/lily/command-request.cc b/lily/command-request.cc index cf5ef632f8..9fe1c9118b 100644 --- a/lily/command-request.cc +++ b/lily/command-request.cc @@ -13,6 +13,7 @@ void Command_script_req::do_print() const {} +Command_script_req::Command_script_req(){} IMPLEMENT_IS_TYPE_B1(Command_script_req,Command_req); @@ -22,7 +23,17 @@ IMPLEMENT_IS_TYPE_B1(Cadenza_req, Timing_req); void Cadenza_req::do_print()const { +#ifndef NPRINT mtor << on_b_; +#endif +} + +bool +Cadenza_req::do_equal_b(Request*r)const +{ + Cadenza_req*cad = r->command()->timing()->cadenza(); + + return cad->on_b_ == on_b_; } Cadenza_req::Cadenza_req(bool b) @@ -32,10 +43,11 @@ Cadenza_req::Cadenza_req(bool b) /* *************** */ -int -Bar_req::compare(Bar_req const &c1)const +bool +Bar_req::do_equal_b(Request*r)const { - return type_str_ == c1.type_str_; + Bar_req * b = r->command()->bar(); + return type_str_ == b->type_str_; } @@ -56,7 +68,14 @@ Partial_measure_req::Partial_measure_req(Moment m) { duration_ =m; } -/* *************** */ + +bool +Partial_measure_req::do_equal_b(Request* r)const +{ + Partial_measure_req *p = r->command()->timing()->partial(); + + return p->duration_ == duration_; +} IMPLEMENT_IS_TYPE_B1(Timing_req,Command_req); @@ -83,6 +102,11 @@ IMPLEMENT_IS_TYPE_B1(Barcheck_req,Timing_req); void Barcheck_req::do_print() const{} +bool +Barcheck_req::do_equal_b(Request*)const +{ + return true; +} /* *************** */ IMPLEMENT_IS_TYPE_B1(Clef_change_req,Command_req); @@ -128,13 +152,18 @@ IMPLEMENT_IS_TYPE_B1(Meter_change_req,Timing_req); void Meter_change_req::do_print() const { +#ifndef NPRINT mtor << beats_i_ << "/" << one_beat_i_; +#endif } -int -Meter_change_req::compare(Meter_change_req const &m) +bool +Meter_change_req::do_equal_b(Request * r)const { - return m.beats_i_ == beats_i_ && one_beat_i_ == m.one_beat_i_; + Meter_change_req * m = r->command()->timing()->meterchange(); + + return m->beats_i_ == beats_i_ + && one_beat_i_ == m->one_beat_i_; } Meter_change_req::Meter_change_req() @@ -150,6 +179,28 @@ Meter_change_req::set(int b,int o) one_beat_i_=o; } + +Tempo_req::Tempo_req() +{ + metronome_i_ = 60; + dur_. type_i_ = 4; +} + +void +Tempo_req::do_print()const +{ + mtor << dur_.str() << " = " <<metronome_i_ ; +} +IMPLEMENT_IS_TYPE_B1(Tempo_req, Timing_req); + +bool +Tempo_req::do_equal_b(Request *r)const +{ + Tempo_req *t = r->command()->timing()->tempo(); + + return t->dur_.length()== dur_.length() && metronome_i_ == t->metronome_i_; +} + /* *************** */ @@ -162,6 +213,14 @@ Measure_grouping_req::do_print() const mtor << beat_i_arr_[i] <<"*" << elt_length_arr_[i]<<" "; } } + + +bool +Measure_grouping_req::do_equal_b(Request*)const +{ + return false; // todo +} + /* *************** */ void diff --git a/lily/crescendo.cc b/lily/crescendo.cc index df349421bb..8f604dbcba 100644 --- a/lily/crescendo.cc +++ b/lily/crescendo.cc @@ -24,7 +24,7 @@ Crescendo::Crescendo() Interval Crescendo::symbol_height()const { - return get_symbol().dim.y; + return get_symbol().dim[Y_AXIS]; } static Real absdyn_dim = 10 PT; // ugh diff --git a/lily/dynamic-grav.cc b/lily/dynamic-grav.cc index 8f99590581..72d76607df 100644 --- a/lily/dynamic-grav.cc +++ b/lily/dynamic-grav.cc @@ -28,7 +28,7 @@ Dynamic_engraver::Dynamic_engraver() void Dynamic_engraver::do_post_move_processing() { - dynamic_req_l_arr_.set_size(0); + dynamic_req_l_arr_.clear(); } bool diff --git a/lily/elem-group-item.cc b/lily/elem-group-item.cc index 138bd146a3..c22739a849 100644 --- a/lily/elem-group-item.cc +++ b/lily/elem-group-item.cc @@ -13,7 +13,7 @@ void Horizontal_vertical_group_item::do_print()const { - Horizontal_vertical_group::do_print(); + Horizontal_vertical_group_element::do_print(); } -IMPLEMENT_IS_TYPE_B2(Horizontal_vertical_group_item,Horizontal_vertical_group,Item); +IMPLEMENT_IS_TYPE_B2(Horizontal_vertical_group_item,Horizontal_vertical_group_element,Item); diff --git a/lily/elem-group.cc b/lily/elem-group.cc index badb6db851..5115c5c70b 100644 --- a/lily/elem-group.cc +++ b/lily/elem-group.cc @@ -1,5 +1,5 @@ /* - elem-group.cc -- implement Horizontal_vertical_group + elem-group.cc -- implement Horizontal_vertical_group_element source file of the GNU LilyPond music typesetter @@ -11,195 +11,107 @@ #include "item.hh" #include "debug.hh" -bool -Elbement_group::contains_b(Score_elem const*e)const +void +Axis_group_element::do_unlink() { - return elem_l_arr_.find_l(e); + remove_all(); } -Elbement_group::Elbement_group(Elbement_group const &s) - : Score_elem(s) -{ -} -Interval -Vertical_group::do_height()const -{ - Interval r; - for (int i=0; i < elem_l_arr_.size(); i++) - r.unite(elem_l_arr_[i]->height()); - return r; -} - -Interval -Horizontal_group::do_width()const +bool +Axis_group_element::contains_b(Score_elem const*e)const { - Interval r; - for (int i=0; i < elem_l_arr_.size(); i++) - if (elem_l_arr_[i]->item()) // makes no at preprocessing for spanners. - r.unite(elem_l_arr_[i]->width()); - return r; + return axis_admin_.contains_b(e); } - -IMPLEMENT_IS_TYPE_B1(Horizontal_group, Elbement_group); -IMPLEMENT_IS_TYPE_B1(Vertical_group, Elbement_group); - - -void -Elbement_group::add_element(Score_elem*i_l) +Link_array<Score_elem> +Axis_group_element::get_extra_dependencies()const { - assert(i_l!= this); - assert(! contains_b(i_l)); - - elem_l_arr_.push(i_l); - add_dependency(i_l); + return axis_admin_.elem_l_arr_; } void -Horizontal_group::add_element(Score_elem*elt) +Axis_group_element::do_print()const { - assert ( !elt->x_group_l_ ); - elt->x_group_l_ = this; - Elbement_group::add_element(elt); + axis_admin_.print(); } -void -Vertical_group::add_element(Score_elem*e) -{ - assert( ! e->y_group_l_ ); - e->y_group_l_ = this; - - Elbement_group::add_element(e); -} +// **************** void -Horizontal_group::translate_x(Real x) +Vertical_group_element::add_element(Score_elem*e) { - for (int i=0; i < elem_l_arr_.size(); i++) - elem_l_arr_[i]->translate_x(x); + axis_admin_.add_element(e, this, Y_AXIS, Y_AXIS); } void -Vertical_group::translate_y(Real y) +Vertical_group_element::remove_element(Score_elem*e) { - for (int i=0; i < elem_l_arr_.size(); i++) - elem_l_arr_[i]->translate_y(y); + axis_admin_.remove_element(e, Y_AXIS, Y_AXIS); } -IMPLEMENT_IS_TYPE_B1(Elbement_group, Score_elem); - -void -Elbement_group::do_print() const +Interval +Vertical_group_element::do_height() const { -#ifndef NPRINT - for (int i=0; i < elem_l_arr_.size(); i++) - mtor << elem_l_arr_[i]->name() << ' '; -#endif + return axis_admin_.extent(Y_AXIS); } - void -Horizontal_group::do_substitute_dependency(Score_elem* old, Score_elem *new_l) +Vertical_group_element::remove_all() { - int i; - - while ((i=elem_l_arr_.find_i(old))>=0) { - old->x_group_l_ =0; - - if (new_l){ - new_l->x_group_l_ = this; - elem_l_arr_[i] = new_l; - }else { - elem_l_arr_.unordered_del(i); - } - } + axis_admin_.remove_all(Y_AXIS,Y_AXIS); } +// **************** void -Vertical_group::do_substitute_dependency(Score_elem* old, Score_elem *new_l) -{ - int i; - - while ((i=elem_l_arr_.find_i(old))>=0) { - old->y_group_l_ =0; - - if (new_l){ - new_l->y_group_l_ =this; - elem_l_arr_[i] = new_l; - }else { - elem_l_arr_.unordered_del(i); - } - } -} - -Vertical_group::Vertical_group(Vertical_group - const &s) - : Elbement_group(s) +Horizontal_group_element::remove_all() { + axis_admin_.remove_all(X_AXIS,X_AXIS); } -Horizontal_group::Horizontal_group(Horizontal_group - const &s) - : Elbement_group(s) +void +Horizontal_group_element::add_element(Score_elem*e) { + axis_admin_.add_element(e,this, X_AXIS,X_AXIS); } -Elbement_group::Elbement_group() +void +Horizontal_group_element::remove_element(Score_elem*e) { - transparent_b_ = true; + axis_admin_.remove_element(e,X_AXIS,X_AXIS); } -IMPLEMENT_IS_TYPE_B2(Horizontal_vertical_group, Horizontal_group, Vertical_group); - -Horizontal_vertical_group::Horizontal_vertical_group() +Interval +Horizontal_group_element::do_width()const { + return axis_admin_.extent(X_AXIS); } -void -Horizontal_vertical_group::do_substitute_dependency(Score_elem*o,Score_elem*n) -{ - Vertical_group::do_substitute_dependency(o,n); - Horizontal_group::do_substitute_dependency(o,n); -} -void -Horizontal_vertical_group::add_element(Score_elem*e) -{ - Vertical_group::add_element(e); - Horizontal_group::add_element(e); -} +// **************** void -Horizontal_vertical_group::do_print()const +Horizontal_vertical_group_element::remove_all() { - Vertical_group::do_print(); + axis_admin_.remove_all(X_AXIS,Y_AXIS); } - void -Vertical_group::do_print()const +Horizontal_vertical_group_element::add_element(Score_elem *e) { - Elbement_group::do_print(); + axis_admin_.add_element(e, this, X_AXIS, Y_AXIS); } void -Horizontal_group::do_print() const +Horizontal_vertical_group_element::remove_element(Score_elem*e) { - Elbement_group::do_print(); + axis_admin_.remove_element(e, X_AXIS, Y_AXIS); } -void -Vertical_group::remove_element(Score_elem*s) -{ - remove_dependency( s ); -} - -void -Horizontal_group::remove_element(Score_elem*s) -{ - remove_dependency( s ); -} +IMPLEMENT_IS_TYPE_B1(Axis_group_element, Score_elem); +IMPLEMENT_IS_TYPE_B1(Horizontal_group_element, Axis_group_element); +IMPLEMENT_IS_TYPE_B1(Vertical_group_element, Axis_group_element); +IMPLEMENT_IS_TYPE_B2(Horizontal_vertical_group_element, Horizontal_group_element, Vertical_group_element); diff --git a/lily/engraver-group.cc b/lily/engraver-group.cc index 672c8f2e5f..69038b5024 100644 --- a/lily/engraver-group.cc +++ b/lily/engraver-group.cc @@ -17,6 +17,12 @@ Engraver* get_engraver_p(String); +void +Engraver_group_engraver::print()const +{ + Engraver::print(); +} + Engraver_group_engraver::~Engraver_group_engraver() { assert(removable_b()); @@ -160,7 +166,7 @@ void Engraver_group_engraver::terminate_engraver(Engraver*r_l) { mtor << "Removing " << r_l->name() << " at " << get_staff_info().when() << "\n"; - r_l->do_removal_processing(); + r_l->removal_processing(); Engraver * grav_p =remove_engraver_p(r_l); delete grav_p; @@ -176,7 +182,8 @@ Engraver_group_engraver::do_print()const #ifndef NPRINT if ( !check_debug) return ; - mtor << "ID: " << id_str_ << "\n"; + mtor << "ID: " << id_str_ ; + mtor << " iterators: " << iterator_count_<< "\n"; for (PCursor<Engraver*> i(grav_list_.top()); i.ok(); i++) i->print(); #endif @@ -266,7 +273,7 @@ Engraver_group_engraver::do_announces() nongroup_l_arr_[i]->acknowledge_element(info); } } - announce_info_arr_.set_size(0); + announce_info_arr_.clear(); } @@ -274,7 +281,7 @@ void Engraver_group_engraver::do_removal_processing() { for (PCursor<Engraver*> i(grav_list_.top()); i.ok(); i++) - i->do_removal_processing(); + i->removal_processing(); } Staff_info @@ -309,3 +316,16 @@ Engraver_group_engraver::is_bottom_engraver_b()const { return !itrans_l_->get_default_itrans_l(); } + +Engraver* +Engraver_group_engraver::get_simple_engraver(char const *type)const +{ + for (int i=0; i < nongroup_l_arr_.size(); i++) { + if (nongroup_l_arr_[i]->name() == type ) + return nongroup_l_arr_[i]; + } + if ( daddy_grav_l_ ) + return daddy_grav_l_->get_simple_engraver(type); + return 0; +} + diff --git a/lily/engraver.cc b/lily/engraver.cc index 4dea919eca..697a4844a2 100644 --- a/lily/engraver.cc +++ b/lily/engraver.cc @@ -26,6 +26,15 @@ Engraver::post_move_processing() status = MOVE_INITED; } +void +Engraver::removal_processing() +{ + if ( status < CREATION_INITED ) + do_creation_processing(); + + do_removal_processing(); +} + bool Engraver::try_request(Request * r) { @@ -97,12 +106,6 @@ Engraver::paper()const return daddy_grav_l_->paper(); } -void -Engraver::typeset_breakable_item(Item * nobreak_p) -{ - daddy_grav_l_->typeset_breakable_item(nobreak_p); -} - bool Engraver::contains_b(Engraver *grav_l)const { diff --git a/lily/general-script-def.cc b/lily/general-script-def.cc index 9bf570e5b8..e755af94c5 100644 --- a/lily/general-script-def.cc +++ b/lily/general-script-def.cc @@ -38,11 +38,11 @@ General_script_def::equal_b(General_script_def const&g)const if (name() != g.name()) return false; - return do_equal_b(g); + return do_equal_b(&g); } bool -General_script_def::do_equal_b(General_script_def const&)const +General_script_def::do_equal_b(General_script_def const*)const { return true; } diff --git a/lily/gourlay-breaking.cc b/lily/gourlay-breaking.cc index 03f6d3cd7c..6a0d2376a4 100644 --- a/lily/gourlay-breaking.cc +++ b/lily/gourlay-breaking.cc @@ -145,14 +145,18 @@ Gourlay_breaking::do_solve()const Array<int> final_breaks; + Array<Col_hpositions> lines; /* skip 0-th element, since it is a "dummy" elt*/ for (int i = optimal_paths.size()-1; i> 0; ) { final_breaks.push ( i ); assert ( i > optimal_paths[i].prev_break_i_); + + // there was no "feasible path" + if (!optimal_paths[i].line_config_.config.size() ) + return lines; i = optimal_paths[i].prev_break_i_; } - Array<Col_hpositions> lines; for (int i= final_breaks.size(); i--; ) lines.push ( optimal_paths[final_breaks[i]].line_config_ ); diff --git a/lily/grouping.cc b/lily/grouping.cc index 0781bf9cb3..f35ae8e354 100644 --- a/lily/grouping.cc +++ b/lily/grouping.cc @@ -14,7 +14,7 @@ void Rhythmic_grouping::init() { interval_ = 0; - children.set_size(0); + children.clear(); } void diff --git a/lily/head-column.cc b/lily/head-column.cc index d08519a891..2d978bb60e 100644 --- a/lily/head-column.cc +++ b/lily/head-column.cc @@ -10,6 +10,7 @@ #include "head-column.hh" #include "note-head.hh" #include "stem.hh" +#include "script.hh" Head_column::Head_column() { @@ -36,10 +37,19 @@ void Head_column::set(Stem*stem_l) { stem_l_ = stem_l; - add_dependency(stem_l); + Score_elem::add_dependency(stem_l); + for (int i=0; script_l_arr_.size(); i++) + script_l_arr_[i]->set_stem( stem_l ); } void +Head_column::add(Script *script_l) +{ + Script_column::add(script_l) ; + if (stem_l_ ) + script_l->set_stem( stem_l_ ); +} +void Head_column::add(Note_head *n_l) { add_support(n_l); diff --git a/lily/head-grav.cc b/lily/head-grav.cc index 952f6d8670..2db5d4ac0b 100644 --- a/lily/head-grav.cc +++ b/lily/head-grav.cc @@ -40,8 +40,10 @@ Note_head_engraver::do_process_requests() n_p->set_rhythmic(note_req_l_->rhythmic()); if (note_req_l_->note()) { - n_p->position_i_ = note_req_l_->note()->height() + - *get_staff_info().c0_position_i_l_; + n_p->position_i_ = note_req_l_->note()->height(); + Staff_info inf = get_staff_info(); + if (inf.c0_position_i_l_) + n_p->position_i_ += *inf.c0_position_i_l_; } else if (note_req_l_->rest()) { n_p->rest_b_ = true; } diff --git a/lily/horizontal-align-item.cc b/lily/horizontal-align-item.cc index 46c9b70b85..8b4427fc0d 100644 --- a/lily/horizontal-align-item.cc +++ b/lily/horizontal-align-item.cc @@ -69,8 +69,8 @@ Horizontal_align_item::do_pre_processing() Horizontal_align_item_content( item_l_arr_[i], priority_i_arr_[i])); content.sort(Horizontal_align_item_content::compare); - item_l_arr_.set_size(0); - priority_i_arr_.set_size(0); + item_l_arr_.clear(); + priority_i_arr_.clear(); for (int i =0; i < content.size(); i++) { item_l_arr_.push( content[i].item_l_ ); priority_i_arr_.push( content[i].priority_i_); @@ -93,14 +93,14 @@ Horizontal_align_item::do_pre_processing() Real center_dx_f = 0; for ( int i=0 ; i < item_l_arr_.size(); i++) { Real dx = where_f -dims[i][-1]; - item_l_arr_[i]->translate_x( dx ); + item_l_arr_[i]->translate( dx , X_AXIS); if (item_l_arr_[i] == center_l_) center_dx_f = where_f; where_f += dims[i].length(); } if (center_dx_f && !align_i_ ) for ( int i=0 ; i < item_l_arr_.size(); i++) - item_l_arr_[i]->translate_x( - center_dx_f ); + item_l_arr_[i]->translate( - center_dx_f , X_AXIS); } diff --git a/lily/horizontal-group-item.cc b/lily/horizontal-group-item.cc index 15af0bd803..409f2feadf 100644 --- a/lily/horizontal-group-item.cc +++ b/lily/horizontal-group-item.cc @@ -9,33 +9,10 @@ #include "p-col.hh" #include "horizontal-group-item.hh" -IMPLEMENT_IS_TYPE_B2(Horizontal_group_item, Horizontal_group, Item); +IMPLEMENT_IS_TYPE_B2(Horizontal_group_item, Horizontal_group_element, Axis_group_item); void -Horizontal_group_item::OK() const -{ - for (int i=0; i < elem_l_arr_.size(); i++) { - Item * it_l = elem_l_arr_[i]->item(); - - assert(it_l&& it_l->pcol_l_ == pcol_l_ ); - } -} - -void -Horizontal_group_item::do_breakable_col_processing() -{ - if (!pcol_l_->breakable_b()) - return; - OK(); - copy_breakable_items(); - - Link_array<Score_elem> elems = elem_l_arr_; - - for (int i=0; i < elems.size(); i++) { - Item* it_l = elems[i]->item(); - for ( int j=0; j < 2; j++) { - Item *new_l = it_l->find_prebroken_piece(broken_to_a_[j]->pcol_l_); - ((Horizontal_group_item*)broken_to_a_[j])->add_element( new_l ); - } - } +Horizontal_group_item::do_print() const +{ + Axis_group_item::do_print(); } diff --git a/lily/include/audio-element.hh b/lily/include/audio-element.hh new file mode 100644 index 0000000000..6deaf15713 --- /dev/null +++ b/lily/include/audio-element.hh @@ -0,0 +1,19 @@ +/* + audio-element.hh -- declare Audio_element + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef AUDIO_ELEMENT_HH +#define AUDIO_ELEMENT_HH + +#include "virtual-methods.hh" + +struct Audio_element { + virtual ~Audio_element(); + DECLARE_MY_RUNTIME_TYPEINFO; +}; +#endif // AUDIO_ELEMENT_HH diff --git a/lily/include/audio-item.hh b/lily/include/audio-item.hh index e6104dcb7f..1b0a4fccf9 100644 --- a/lily/include/audio-item.hh +++ b/lily/include/audio-item.hh @@ -9,29 +9,30 @@ #include "lily-proto.hh" #include "string.hh" +#include "audio-element.hh" /** Any piece of audio information. We need virtual constructors, let's try decentralised factory for specific audio implemenations. + + TODO: + + virtual Niff_item* niff_item_p() = 0; + + virtual CSound_item* score_item_p() = 0; */ -struct Audio_item { +struct Audio_item : public Audio_element { Audio_item( Request* req_l ); /// Create a midi-item from myself. virtual Midi_item* midi_item_p() = 0; -#if 0 - /// Not implemented. Anyone? - virtual Niff_item* niff_item_p() = 0; - - /// Not implemented. Anyone? - virtual Cscore_item* score_item_p() = 0; -#endif - Audio_column* audio_column_l_; Request* req_l_; + DECLARE_MY_RUNTIME_TYPEINFO; + private: Audio_item( Audio_item const& ); Audio_item& operator=( Audio_item const& ); @@ -43,16 +44,15 @@ struct Audio_key : public Audio_item { virtual Midi_item* midi_item_p(); }; -#if 0 struct Audio_instrument : public Audio_item { - Audio_instrument( Request* req_l ); + Audio_instrument( String instrument_str ); + virtual Midi_item* midi_item_p(); + String str_; }; -#endif struct Audio_note : public Audio_item { - Audio_note( Request* req_l, bool on_b ); + Audio_note( Request* req_l ); virtual Midi_item* midi_item_p(); - bool on_b_; }; struct Audio_text : Audio_item { diff --git a/lily/include/audio-score.hh b/lily/include/audio-score.hh index 845b598e47..407a7b412d 100644 --- a/lily/include/audio-score.hh +++ b/lily/include/audio-score.hh @@ -7,8 +7,7 @@ #ifndef AUDIO_SCORE_HH #define AUDIO_SCORE_HH -#include "proto.hh" -#include "parray.hh" +#include "lily-proto.hh" #include "plist.hh" /** all stuff which goes onto midi. notes, signs, symbols in a score @@ -18,18 +17,23 @@ class Audio_score { public: - Audio_score( Midi_def* ); + Audio_score( Score* l ); void add( Audio_column* ); + void add_staff( Audio_staff* l ); + void add(Audio_element*p); -// void output(Tex_stream &ts); + + void output( Midi_stream& midi_stream_r ); + void output_header_track( Midi_stream& midi_stream_r ); - void play( Audio_item* i, Audio_column* c ); void print() const; void process(); Pointer_list<Audio_column*> audio_column_p_list_; - Midi_def *midi_l_; + Link_list<Audio_staff*> audio_staff_l_list_; + Pointer_list<Audio_element*> audio_elem_p_list_; + Score* score_l_; }; #endif // AUDIO_SCORE_HH diff --git a/lily/include/axes.hh b/lily/include/axes.hh new file mode 100644 index 0000000000..7dfe8fbf7a --- /dev/null +++ b/lily/include/axes.hh @@ -0,0 +1,24 @@ + +/* + axes.hh -- declare + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef AXES_HH +#define AXES_HH + +enum Axis { + X_AXIS =0, + Y_AXIS =1, + NO_AXES=2, +}; + +class String; + +String axis_name_str(Axis); + +#endif // AXES_HH diff --git a/lily/include/axis-group-item.hh b/lily/include/axis-group-item.hh new file mode 100644 index 0000000000..a461f52c25 --- /dev/null +++ b/lily/include/axis-group-item.hh @@ -0,0 +1,30 @@ +/* + axis-item.hh -- declare Axis_group_item + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef AXIS_ITEM_HH +#define AXIS_ITEM_HH + +#include "axis-group.hh" +#include "item.hh" + +/** + A grouping item. Its special support is in do_breakable_col_processing(). + */ + +class Axis_group_item : public virtual Axis_group_element, public Item { +protected: + virtual void do_breakable_col_processing(); + void OK()const; + virtual void do_print() const; +public: + DECLARE_MY_RUNTIME_TYPEINFO; + +}; + +#endif // AXIS_ITEM_HH diff --git a/lily/include/axis-group-spanner.hh b/lily/include/axis-group-spanner.hh new file mode 100644 index 0000000000..2b7d6e22bf --- /dev/null +++ b/lily/include/axis-group-spanner.hh @@ -0,0 +1,29 @@ +/* + axis-group-spanner.hh -- declare Axis_group_spanner + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef SPAN_AXIS_GROUP_HH +#define SPAN_AXIS_GROUP_HH + +#include "spanner.hh" +#include "axis-group.hh" + +/** An element which groups a line in a certain direction. The most + useful example of this is the Vertical_group_spanner */ +class Axis_group_spanner : public Spanner, public virtual Axis_group_element +{ + void do_break_processing_if_unbroken(); +protected: + virtual void do_break_processing(); + virtual void do_print()const; + +public: + DECLARE_MY_RUNTIME_TYPEINFO; +}; + +#endif // SPAN_AXIS_GROUP_HH diff --git a/lily/include/axis-group.hh b/lily/include/axis-group.hh new file mode 100644 index 0000000000..bdf758cb42 --- /dev/null +++ b/lily/include/axis-group.hh @@ -0,0 +1,53 @@ +/* +axis-group.hh -- declare Axis_group_administration, Axis_group_element + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef Axis_group_administration_HH +#define Axis_group_administration_HH + +#include "parray.hh" +#include "axes.hh" +#include "real.hh" +#include "lily-proto.hh" +#include "score-elem.hh" +/** + Do the dirty work for Axis_group_element. + */ +struct Axis_group_administration { + Link_array<Score_elem> elem_l_arr_; + + Interval extent(Axis)const; + void print() const ; + Axis_group_administration(Axis_group_administration const&); + Axis_group_administration(){} + void remove_all(Axis a1,Axis a2); + + bool contains_b(Score_elem const *)const; + void add_element(Score_elem*, Axis_group_element*, Axis a1, Axis a2); + void remove_element(Score_elem*, Axis a1, Axis a2); +}; + +/** + Treat a group of elements a unity in either or both axis sense . + This is a wrapper around Axis_group_administration + */ +class Axis_group_element : public virtual Score_elem { +protected: + Axis_group_administration axis_admin_; + virtual void do_print()const; + virtual Link_array<Score_elem> get_extra_dependencies()const; + virtual void do_unlink(); + +public: + virtual void remove_all()=0; + virtual void add_element(Score_elem*)=0; + virtual void remove_element(Score_elem*)=0; + virtual bool contains_b(Score_elem const *)const; + DECLARE_MY_RUNTIME_TYPEINFO; +}; +#endif // Axis_group_administration_HH diff --git a/lily/include/bar-column-grav.hh b/lily/include/bar-column-grav.hh new file mode 100644 index 0000000000..70b7bcf63a --- /dev/null +++ b/lily/include/bar-column-grav.hh @@ -0,0 +1,31 @@ +/* + bar-column-grav.hh -- declare Bar_column_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef BAR_COLUMN_GRAV_HH +#define BAR_COLUMN_GRAV_HH + +#include "engraver.hh" + +/// couple bars and appropriate scripts +class Bar_column_engraver :public Engraver { + Bar_column *barcol_p_; + Array< Script * > script_l_arr_; + + Bar *bar_l_; + +protected: + virtual void acknowledge_element(Score_elem_info); + virtual void do_pre_move_processing(); + virtual void do_post_move_processing(); +public: + Bar_column_engraver(); + DECLARE_MY_RUNTIME_TYPEINFO; +}; + +#endif // BAR_COLUMN_GRAV_HH diff --git a/lily/include/bar-column.hh b/lily/include/bar-column.hh new file mode 100644 index 0000000000..7c7fb426ad --- /dev/null +++ b/lily/include/bar-column.hh @@ -0,0 +1,30 @@ +/* + bar-column.hh -- declare Bar_column + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef BAR_COLUMN_HH +#define BAR_COLUMN_HH + +#include "script-column.hh" + +/** + The scripts over a and the bar itself. + */ +class Bar_column : public Script_column { + Bar * bar_l_; + +public: + Bar_column(); + void set_bar( Bar*); +protected: + SCORE_ELEM_CLONE(Bar_column); + void do_substitute_dependency(Score_elem*,Score_elem*); + DECLARE_MY_RUNTIME_TYPEINFO; +}; + +#endif // BAR_COLUMN_HH diff --git a/lily/include/bar-number-grav.hh b/lily/include/bar-number-grav.hh new file mode 100644 index 0000000000..287706b6ee --- /dev/null +++ b/lily/include/bar-number-grav.hh @@ -0,0 +1,29 @@ +/* + bar-number-grav.hh -- declare Bar_number_grav + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef BAR_NUMBER_GRAV_HH +#define BAR_NUMBER_GRAV_HH + +#include "engraver.hh" + +/** + catch bars, and put a number over them. + */ +class Bar_number_grav : public Engraver { + Script * script_p_; + int number_i_; +protected: + + void acknowledge_element(Score_elem_info); + void do_pre_move_processing(); +public: + Bar_number_grav(); + DECLARE_MY_RUNTIME_TYPEINFO; +}; +#endif // BAR_NUMBER_GRAV_HH diff --git a/lily/include/bar.hh b/lily/include/bar.hh index 9a7a8b92b6..c03527e6cc 100644 --- a/lily/include/bar.hh +++ b/lily/include/bar.hh @@ -8,6 +8,8 @@ #define BAR_HH #include "item.hh" /** + A vertical bar. + TODO: connections with pre and postbreak */ class Bar:public Item { diff --git a/lily/include/boxes.hh b/lily/include/boxes.hh index 22a2eec3a5..8161a84518 100644 --- a/lily/include/boxes.hh +++ b/lily/include/boxes.hh @@ -9,19 +9,28 @@ #include "real.hh" #include "interval.hh" #include "offset.hh" +#include "axes.hh" -/// a square subset of Real^2 struct Box { - Interval x, y; - + Interval interval_a_[NO_AXES]; + + Interval &x() {return interval_a_[X_AXIS]; } + Interval &y(){ return interval_a_[Y_AXIS]; } + Interval x()const{ return interval_a_[X_AXIS]; } + Interval y()const{return interval_a_[Y_AXIS]; } + Interval operator[](Axis a ) { + return interval_a_[a]; + } + void translate(Offset o) { - x.translate(o.x); - y.translate(o.y); + x().translate(o.x()); + y().translate(o.y()); } + /// smallest box enclosing #b# void unite(Box b) { - x.unite(b.x); - y.unite(b.y); + x().unite(b.x()); + y().unite(b.y()); } Box(); Box(Interval ix, Interval iy); diff --git a/lily/include/break.hh b/lily/include/break.hh index e016a8806a..0a9fafe68c 100644 --- a/lily/include/break.hh +++ b/lily/include/break.hh @@ -36,7 +36,7 @@ struct Col_stats class Break_algorithm { protected: - PScore *pscore_l_; + Paper_score *pscore_l_; Real linelength; /// search all pcols which are breakable. @@ -69,7 +69,7 @@ public: Line_spacer* (*get_line_spacer)(); Break_algorithm(); - void set_pscore(PScore*); + void set_pscore(Paper_score*); /// check if the spacing/breaking problem is well-stated void problem_OK()const; diff --git a/lily/include/collision.hh b/lily/include/collision.hh index 3891a5a0c1..162c5fe385 100644 --- a/lily/include/collision.hh +++ b/lily/include/collision.hh @@ -10,14 +10,17 @@ #ifndef COLLISION_HH #define COLLISION_HH #include "lily-proto.hh" -#include "item.hh" +#include "elem-group-item.hh" -/** TODO +/** + Resolve conflicts between various Note_columns (chords). + + TODO multistaff support (see Chlapik: equal noteheads should be on the same hpos.) */ -class Collision : public Item { +class Collision : public Horizontal_vertical_group_item { protected: virtual void do_substitute_dependency(Score_elem*,Score_elem*); virtual void do_pre_processing(); @@ -26,6 +29,5 @@ public: DECLARE_MY_RUNTIME_TYPEINFO; void add (Note_column*ncol_l); Collision(); - }; #endif // COLLISION_HH diff --git a/lily/include/command-request.hh b/lily/include/command-request.hh index 11a1e44bdf..5d173ca9f9 100644 --- a/lily/include/command-request.hh +++ b/lily/include/command-request.hh @@ -1,5 +1,5 @@ /* - command-request.hh -- declare Non musical requests + command-request.hh -- declare non-musical requests source file of the GNU LilyPond music typesetter @@ -12,6 +12,7 @@ #include "request.hh" #include "varray.hh" +#include "duration.hh" /** Request which are assumed to be "happening" before the musical requests. */ @@ -34,6 +35,8 @@ public: class Command_script_req : public Command_req, public Script_req { public: + // huh? + Command_script_req(); REQUESTMETHODS(Command_script_req, commandscript); }; @@ -49,15 +52,29 @@ public: class Timing_req : public Command_req { public: REQUESTMETHODS(Timing_req, timing); + virtual Tempo_req * tempo(){return 0; } + Tempo_req(); }; +class Tempo_req : public Timing_req +{ +public: + Duration dur_; + int metronome_i_; + + Tempo_req(); + REQUESTMETHODS(Tempo_req, tempo); + bool do_equal_b(Request *)const; +}; + class Partial_measure_req : public Timing_req { public: Moment duration_; Partial_measure_req(Moment); REQUESTMETHODS(Partial_measure_req, partial); + bool do_equal_b(Request*)const; }; /** @@ -67,9 +84,9 @@ class Meter_change_req : public Timing_req { public: int beats_i_, one_beat_i_; - int compare(Meter_change_req const&); Meter_change_req(); void set(int,int); + bool do_equal_b(Request*)const; REQUESTMETHODS(Meter_change_req, meterchange); }; @@ -78,6 +95,7 @@ class Cadenza_req : public Timing_req { public: /// turn on? bool on_b_; + bool do_equal_b(Request*)const; Cadenza_req(bool); REQUESTMETHODS(Cadenza_req,cadenza); }; @@ -85,7 +103,7 @@ public: /// check if we're at start of a measure. class Barcheck_req : public Timing_req { public: - + bool do_equal_b(Request *)const; REQUESTMETHODS(Barcheck_req,barcheck); }; @@ -93,7 +111,7 @@ class Measure_grouping_req : public Timing_req { public: Array<int> beat_i_arr_; Array<Moment> elt_length_arr_; - + bool do_equal_b(Request *)const; REQUESTMETHODS(Measure_grouping_req, measuregrouping); }; @@ -103,7 +121,8 @@ class Bar_req : public Command_req { public: String type_str_; Bar_req(String); - int compare(const Bar_req&)const; + bool do_equal_b(Request*)const; + REQUESTMETHODS(Bar_req,bar); }; diff --git a/lily/include/elem-group-item.hh b/lily/include/elem-group-item.hh index bf532c035d..b1248cc990 100644 --- a/lily/include/elem-group-item.hh +++ b/lily/include/elem-group-item.hh @@ -10,15 +10,25 @@ #ifndef ELEM_GROUP_ITEM_HH #define ELEM_GROUP_ITEM_HH +#include "axis-group-item.hh" #include "elem-group.hh" -#include "item.hh" -class Horizontal_vertical_group_item : public Item, public Horizontal_vertical_group { + +/** + Treat a collection of items as a unity + */ +class Horizontal_vertical_group_item : public Axis_group_item, public Horizontal_vertical_group_element { +protected: + virtual void do_print() const; + virtual void remove_all() { Horizontal_vertical_group_element::remove_all(); } public: + virtual void add_element(Score_elem*e) { Horizontal_vertical_group_element::add_element(e); } + virtual void remove_element(Score_elem*e) { Horizontal_vertical_group_element::remove_element(e); } + DECLARE_MY_RUNTIME_TYPEINFO; SCORE_ELEM_CLONE(Horizontal_vertical_group_item); -protected: - virtual void do_print() const; + + }; #endif // ELEM_GROUP_ITEM_HH diff --git a/lily/include/elem-group.hh b/lily/include/elem-group.hh index 9569dcd90c..baf3010c09 100644 --- a/lily/include/elem-group.hh +++ b/lily/include/elem-group.hh @@ -1,5 +1,5 @@ /* - elem-group.hh -- declare Horizontal_vertical_group + elem-group.hh -- declare Horizontal_vertical_group_element source file of the GNU LilyPond music typesetter @@ -11,49 +11,36 @@ #define ELEM_GROUP_HH #include "score-elem.hh" +#include "axis-group.hh" -class Elbement_group: public virtual Score_elem { + + +/** + Treat a group of elements a unity in horizontal sense . + A column is a typical Vertical_group. + */ +class Horizontal_group_element : public virtual Axis_group_element { protected: - Link_array<Score_elem> elem_l_arr_; - - virtual void do_print() const ; -public: - Elbement_group(Elbement_group const&); - Elbement_group(); - bool contains_b(Score_elem const *)const; - void add_element(Score_elem*); - DECLARE_MY_RUNTIME_TYPEINFO; -}; + virtual void remove_all(); + virtual Interval do_width()const; -class Horizontal_group : public Elbement_group { public: DECLARE_MY_RUNTIME_TYPEINFO; - Horizontal_group(){} - void add_element(Score_elem*); - Horizontal_group(Horizontal_group const&); - void remove_element(Score_elem*); + virtual void add_element(Score_elem*); + virtual void remove_element(Score_elem*); -protected: - virtual Horizontal_group * horizontal_group() { return this; } - virtual void do_substitute_dependency(Score_elem*,Score_elem*); - virtual void do_print() const ; - virtual void translate_x(Real); - virtual Interval do_width()const; }; - -class Vertical_group : public Elbement_group { +/** + Like Horizontal_group_element, but in X direction + */ +class Vertical_group_element : public virtual Axis_group_element { protected: - virtual void translate_y(Real); - virtual void do_print() const ; virtual Interval do_height()const; - virtual void do_substitute_dependency(Score_elem*,Score_elem*); - virtual Vertical_group * vertical_group() { return this; } + virtual void remove_all(); + public: - void add_element(Score_elem*); - void remove_element(Score_elem*); - - Vertical_group(Vertical_group const &); - Vertical_group(){} + virtual void add_element(Score_elem*); + virtual void remove_element(Score_elem*); DECLARE_MY_RUNTIME_TYPEINFO; }; @@ -61,18 +48,16 @@ public: dimensions are the unions of the dimensions of what it contains. Translation means translating the contents. */ -class Horizontal_vertical_group : public Vertical_group, - public Horizontal_group +class Horizontal_vertical_group_element : public Vertical_group_element, + public Horizontal_group_element { protected: - virtual Horizontal_vertical_group* elem_group() { return this; } + virtual void remove_all(); public: - Horizontal_vertical_group(); - bool contains_b(Score_elem const *)const; - DECLARE_MY_RUNTIME_TYPEINFO; - virtual void do_substitute_dependency(Score_elem*,Score_elem*); - virtual void do_print() const; - void add_element(Score_elem*); + virtual void add_element(Score_elem*); + virtual void remove_element(Score_elem*); + + DECLARE_MY_RUNTIME_TYPEINFO; }; #endif // ELEM_GROUP_HH diff --git a/lily/include/engraver-group.hh b/lily/include/engraver-group.hh index 96e67feaa8..2e3e4941bd 100644 --- a/lily/include/engraver-group.hh +++ b/lily/include/engraver-group.hh @@ -24,7 +24,6 @@ */ class Engraver_group_engraver : public Engraver, public virtual Translator { protected: - Pointer_list<Engraver*> grav_list_; Link_array<Engraver_group_engraver> group_l_arr_; Link_array<Engraver> nongroup_l_arr_; @@ -32,11 +31,10 @@ protected: Array<Score_elem_info> announce_info_arr_; virtual void do_print()const; - virtual bool removable_b()const; - public: - virtual void print() const { Engraver::print(); } + Engraver*get_simple_engraver(char const*typeinfo)const; + virtual void print() const ; Input_translator * itrans_l_; void check_removal(); @@ -53,7 +51,8 @@ public: */ virtual void terminate_engraver(Engraver * grav_l); - DECLARE_MY_RUNTIME_TYPEINFO; + + DECLARE_MY_RUNTIME_TYPEINFO; /** Remove #grav_l# from the list, and return it. @@ -84,7 +83,6 @@ public: */ Translator * ancestor_l(int l=1); int depth_i() const; - }; #endif // ENGRAVERGROUP_HH diff --git a/lily/include/engraver.hh b/lily/include/engraver.hh index 52cd3bd7ea..60b8b95ca1 100644 --- a/lily/include/engraver.hh +++ b/lily/include/engraver.hh @@ -65,11 +65,6 @@ protected: virtual void do_removal_processing() {} /** - typeset a "command" item. Default: pass on to daddy. - If the column is not breakable, #pre_p# and #post_p# are junked - */ - virtual void typeset_breakable_item(Item * nobreak_p); - /** Invoke walker method to typeset element. Default: pass on to daddy. */ virtual void typeset_element(Score_elem*elem_p); @@ -129,6 +124,7 @@ public: bool is_bottom_engraver() const; void post_move_processing(); + void removal_processing(); Engraver_group_engraver * daddy_grav_l_; diff --git a/lily/include/general-script-def.hh b/lily/include/general-script-def.hh index acaa554019..c384d4fa10 100644 --- a/lily/include/general-script-def.hh +++ b/lily/include/general-script-def.hh @@ -30,7 +30,7 @@ public: virtual ~General_script_def() {} protected: - virtual bool do_equal_b(General_script_def const &)const; + virtual bool do_equal_b(General_script_def const *)const; virtual void do_print()const; }; diff --git a/lily/include/head-column.hh b/lily/include/head-column.hh index 77065d84cb..f95733201b 100644 --- a/lily/include/head-column.hh +++ b/lily/include/head-column.hh @@ -12,6 +12,9 @@ #include "script-column.hh" +/** + Scripts and rests/noteheads + */ class Head_column : public Script_column { public: @@ -27,7 +30,7 @@ public: Stem* stem_l_; void add(Note_head*); - void add(Script*s) { Script_column::add(s) ; } + virtual void add(Script*s); virtual void set(Stem*); Head_column(); DECLARE_MY_RUNTIME_TYPEINFO; diff --git a/lily/include/head-grav.hh b/lily/include/head-grav.hh index 2a5b2be280..57711a27be 100644 --- a/lily/include/head-grav.hh +++ b/lily/include/head-grav.hh @@ -9,17 +9,22 @@ #define HEADGRAV_HH #include "engraver.hh" -struct Note_head_engraver : Engraver { +/** + make balls and rests + */ +class Note_head_engraver : public Engraver { Note_head* note_p_; Rhythmic_req * note_req_l_; - /* *************** */ +public: Note_head_engraver(); + DECLARE_MY_RUNTIME_TYPEINFO; +protected: virtual bool do_try_request(Request *req_l) ; virtual void do_process_requests(); virtual void do_pre_move_processing(); virtual void do_post_move_processing(); - DECLARE_MY_RUNTIME_TYPEINFO; + }; diff --git a/lily/include/horizontal-group-item.hh b/lily/include/horizontal-group-item.hh index 3495af9f97..f1fc8b3c9c 100644 --- a/lily/include/horizontal-group-item.hh +++ b/lily/include/horizontal-group-item.hh @@ -11,15 +11,19 @@ #define HORIZONTAL_GROUP_ITEM_HH #include "elem-group.hh" -#include "item.hh" +#include "axis-group-item.hh" -class Horizontal_group_item : public Item, public Horizontal_group { +class Horizontal_group_item : public Axis_group_item, public Horizontal_group_element { +protected: + virtual void remove_all() { Horizontal_group_element::remove_all(); } + virtual void do_print() const; +public: + virtual void add_element(Score_elem*e) { Horizontal_group_element::add_element(e); } + virtual void remove_element(Score_elem*e) { Horizontal_group_element::remove_element(e); } DECLARE_MY_RUNTIME_TYPEINFO; SCORE_ELEM_CLONE(Horizontal_group_item); -protected: - virtual void do_breakable_col_processing(); - void OK()const; - virtual void do_print() const { Elbement_group::do_print(); } + + }; #endif // HORIZONTAL_GROUP_ITEM_HH diff --git a/lily/include/input-translator.hh b/lily/include/input-translator.hh index b2883a30cf..49f44bec01 100644 --- a/lily/include/input-translator.hh +++ b/lily/include/input-translator.hh @@ -24,7 +24,10 @@ struct Input_translator_list : public Pointer_list<Input_translator*> ~Input_translator_list(){} }; -struct Input_translator : Input { +/** Define a intereter for music. This is an runtime interface to the + typesystem */ +class Input_translator : public Input { +public: Input_translator_list contains_itrans_p_list_; Array<String> consists_str_arr_; Array<String> alias_str_arr_; diff --git a/lily/include/item.hh b/lily/include/item.hh index dcbae6374f..0768c5885e 100644 --- a/lily/include/item.hh +++ b/lily/include/item.hh @@ -14,7 +14,7 @@ #include "score-elem.hh" /** - a horizontally fixed size element of the score + A horizontally fixed size element of the score. Item is the datastructure for printables whose width is known before the spacing is calculated @@ -30,7 +30,10 @@ public: Item * broken_to_a_[2]; - // nobreak = 0, pre =1, post = 2 + /// should be put in a breakable col. + bool breakable_b_; + int break_status_i_; + /// nobreak = 0, pre = -1, post = 1 int break_status_i()const; Item * find_prebroken_piece(PCol*)const; Item * find_prebroken_piece(Line_of_score*)const; @@ -47,7 +50,6 @@ protected: virtual void do_print()const; void copy_breakable_items(); - }; diff --git a/lily/include/key-grav.hh b/lily/include/key-grav.hh index 7b54214892..51a978e592 100644 --- a/lily/include/key-grav.hh +++ b/lily/include/key-grav.hh @@ -13,7 +13,14 @@ #include "engraver.hh" #include "key.hh" -struct Key_engraver : Engraver { +/** + Make the key signature. + */ +class Key_engraver : public Engraver { + void create_key(); + void read_req(Key_change_req * r); + +public: Key key_; Key_change_req * keyreq_l_; Key_item * kit_p_; @@ -21,17 +28,15 @@ struct Key_engraver : Engraver { bool default_key_b_; bool change_key_b_; +protected: virtual bool do_try_request(Request *req_l); virtual void do_process_requests(); virtual void do_pre_move_processing(); virtual void do_post_move_processing(); virtual void acknowledge_element(Score_elem_info); +public: Key_engraver(); DECLARE_MY_RUNTIME_TYPEINFO; -private: - void create_key(); - - void read_req(Key_change_req * r); }; #endif // KEYGRAV_HH diff --git a/lily/include/key-item.hh b/lily/include/key-item.hh index a1ab3dc6d4..b980e3ff0f 100644 --- a/lily/include/key-item.hh +++ b/lily/include/key-item.hh @@ -19,7 +19,6 @@ struct Key_item : Item { bool default_b_; - /* *************** */ DECLARE_MY_RUNTIME_TYPEINFO; SCORE_ELEM_CLONE(Key_item); @@ -27,6 +26,7 @@ struct Key_item : Item { void add(int pitch, int acc); void read(const Key_engraver&); void set_c_position(int); +protected: virtual void do_pre_processing(); Molecule* brew_molecule_p()const; }; diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh index 5619bf021a..5e42f95f1e 100644 --- a/lily/include/lily-proto.hh +++ b/lily/include/lily-proto.hh @@ -10,18 +10,25 @@ #define LILY_PROTO_HH #include "proto.hh" -struct My_lily_lexer; + struct Absolute_dynamic_req; +struct Axis_group_element; +struct Axis_group; struct Translator; +struct Audio_element; struct Audio_column; struct Audio_item; struct Audio_key; struct Audio_meter; struct Audio_note; +struct Audio_note_off; struct Audio_score; +struct Audio_staff; struct Audio_tempo; struct Atom; struct Bar; +struct Bar_column_engraver; +struct Bar_column; struct Bar_engraver; struct Bar_req; struct Barcheck_req; @@ -50,6 +57,7 @@ struct Complex_music; struct Cresc_req; struct Crescendo ; struct Decresc_req; + struct Directional_spanner; struct Disallow_break_req; struct Durational_req; @@ -64,7 +72,7 @@ struct Group_change_req; struct Group_feature_req; struct Head_column; struct Horizontal_align_item; -struct Horizontal_group; +struct Horizontal_group_element; struct Horizontal_group_item; struct Horizontal_vertical_group; struct Idealspacing; @@ -92,6 +100,7 @@ struct Local_key_engraver; struct Lookup; struct Lyric_item; struct Lyric_req; +struct My_lily_lexer; struct Measure_grouping_req; struct Melodic_req; struct Meter; @@ -105,11 +114,14 @@ struct Midi_item; struct Midi_key; struct Midi_meter; struct Midi_note; +struct Midi_note_event; +struct Midi_note_off; struct Midi_output; struct Midi_score; struct Midi_stream; struct Midi_tempo; struct Midi_track; +struct Midi_walker; struct Mixed_qp; struct Molecule; struct Music_general_chord; @@ -130,7 +142,7 @@ struct Offset; struct Output; struct Performer; struct PCol; -struct PScore; +struct Paper_score; struct Paper_def; struct Partial_measure_req; struct Plet; @@ -184,6 +196,7 @@ struct Symtable; struct Symtables; struct Super_elem; struct Terminate_voice_req; +struct Tempo_req; struct Tex_stream; struct Text_def; struct Text_gob; @@ -197,7 +210,7 @@ struct Time_description; struct Timing_req; struct Vertical_brace; struct Vertical_spanner; -struct Vertical_group; +struct Vertical_group_element; struct Vertical_align_spanner; struct Vertical_align_engraver; struct Vertical_align_element; diff --git a/lily/include/local-key-item.hh b/lily/include/local-key-item.hh index 2d4ed66e8f..7316df60e7 100644 --- a/lily/include/local-key-item.hh +++ b/lily/include/local-key-item.hh @@ -21,20 +21,26 @@ struct Local_acc { TODO: update item if Items are removed + + TODO + + figure out private/public + */ -struct Local_key_item : Item { +class Local_key_item : public Item { +public: DECLARE_MY_RUNTIME_TYPEINFO; Array<Local_acc> accs; Link_array<Item> support_items_; int c0_position; - /* *************** */ + Local_key_item(int c0position); void add_support(Item*); void add(int oct, int pitch, int acc); void add(Melodic_req*); -public: +protected: virtual void do_pre_processing(); virtual void do_substitute_dependency(Score_elem*,Score_elem*); virtual Molecule* brew_molecule_p()const; diff --git a/lily/include/main.hh b/lily/include/main.hh index 7ec479ebd2..0c461a36d6 100644 --- a/lily/include/main.hh +++ b/lily/include/main.hh @@ -12,6 +12,7 @@ String find_file(String); String get_version_str(); extern Sources* source_l_g; extern bool only_midi; +extern int exit_status_i_; extern String default_out_fn; diff --git a/lily/include/midi-def.hh b/lily/include/midi-def.hh index 13073251ab..89a7543567 100644 --- a/lily/include/midi-def.hh +++ b/lily/include/midi-def.hh @@ -16,6 +16,7 @@ /** + definitions for midi output. Rather empty */ struct Midi_def { // ugh! @@ -25,7 +26,6 @@ struct Midi_def { /// output file name String outfile_str_; - Assoc<String, Real> *real_vars_p_; Input_translator* itrans_p_; /// duration of whole note @@ -37,11 +37,9 @@ struct Midi_def { Real duration_to_seconds_f(Moment); Global_translator* get_global_translator_p() const; - Real get_var( String s ) const; int get_tempo_i( Moment moment ); void print() const; void set( Input_translator* itrans_p ); - void set_var( String s, Real r ); void set_tempo( Moment moment, int count_per_minute_i ); }; diff --git a/lily/include/midi-item.hh b/lily/include/midi-item.hh index 369d4a4886..4906f27ba8 100644 --- a/lily/include/midi-item.hh +++ b/lily/include/midi-item.hh @@ -9,6 +9,8 @@ #include "string.hh" #include "lily-proto.hh" +#include "virtual-methods.hh" +#include "moment.hh" /** Any piece of midi information. @@ -16,6 +18,7 @@ Maybe use base classes for RIFF files? */ struct Midi_item { + DECLARE_MY_RUNTIME_TYPEINFO; Midi_item( Audio_item* audio_item_l ); static String i2varint_str( int i ); void output( Midi_stream* midi_stream_l ) const; @@ -29,72 +32,104 @@ private: Midi_item& operator =( Midi_item const& ); }; -struct Midi_key : public Midi_item { - Midi_key( Audio_item* audio_item_l ); - +/** + variable sized MIDI data + */ +struct Midi_chunk : Midi_item { + DECLARE_MY_RUNTIME_TYPEINFO; + Midi_chunk(); + + void add( String str ); + void set( String header_str, String data_str, String footer_str ); + virtual String str() const; + +private: + String data_str_; + String footer_str_; + String header_str_; +}; + +struct Midi_duration : public Midi_item { + DECLARE_MY_RUNTIME_TYPEINFO; + Midi_duration( Real seconds_f ); + virtual String str() const; + Real seconds_f_; +}; + +struct Midi_header : Midi_chunk { + DECLARE_MY_RUNTIME_TYPEINFO; + + Midi_header( int format_i, int tracks_i, int clocks_per_4_i ); + }; /** Change instrument event */ struct Midi_instrument : public Midi_item { + DECLARE_MY_RUNTIME_TYPEINFO; Midi_instrument( int channel_i, String instrument_str ); virtual String str() const; String instrument_str_; }; -struct Midi_note : public Midi_item { - /** - Generate a note-event on a channel. - - @param #melreq_l# is the pitch. - */ - Midi_note( Audio_item* audio_item_l ); +struct Midi_key : public Midi_item { + DECLARE_MY_RUNTIME_TYPEINFO; + Midi_key( Audio_item* audio_item_l ); + virtual String str() const; - - /* *************** */ - int const c0_pitch_i_c_ = 60; - bool on_b_; - Byte dynamic_byte_; }; -struct Midi_duration : public Midi_item { - Midi_duration( Real seconds_f ); +struct Midi_meter : Midi_item { + DECLARE_MY_RUNTIME_TYPEINFO; + Midi_meter( Audio_item* audio_item_l ); + virtual String str() const; - /* *************** */ - Real seconds_f_; + int clocks_per_1_i_; }; -struct Midi_chunk : Midi_item { - Midi_chunk(); +/** + Turn a note on (blond). + */ +struct Midi_note : public Midi_item { + DECLARE_MY_RUNTIME_TYPEINFO; + Midi_note( Audio_item* audio_item_l ); - void add( String str ); - void set( String header_str, String data_str, String footer_str ); + Moment duration() const; + int pitch_i() const; virtual String str() const; -private: - String data_str_; - String footer_str_; - String header_str_; + + int const c0_pitch_i_c_ = 60; + Byte dynamic_byte_; }; -struct Midi_header : Midi_chunk { - /* *************** */ - Midi_header( int format_i, int tracks_i, int clocks_per_4_i ); +/** + Turn a note off (dark). + */ +struct Midi_note_off : public Midi_item { + DECLARE_MY_RUNTIME_TYPEINFO; + Midi_note_off( Midi_note* midi_note_l ); + + int pitch_i() const; + virtual String str() const; + + Byte aftertouch_byte_; }; struct Midi_text : Midi_item { + DECLARE_MY_RUNTIME_TYPEINFO; + enum Type { TEXT = 1, COPYRIGHT, TRACK_NAME, INSTRUMENT_NAME, LYRIC, MARKER, CUE_POINT }; - - Midi_text( Audio_item* audio_item_l ); Midi_text( Midi_text::Type type, String text_str ); - + Midi_text( Audio_item* audio_item_l ); + virtual String str() const; Type type_; @@ -102,24 +137,19 @@ struct Midi_text : Midi_item { }; struct Midi_tempo : Midi_item { - Midi_tempo( Audio_item* audio_item_l ); + DECLARE_MY_RUNTIME_TYPEINFO; Midi_tempo( int per_minute_4_i ); - + Midi_tempo( Audio_item* audio_item_l ); + virtual String str() const; int per_minute_4_i_; }; -struct Midi_meter : Midi_item { - Midi_meter( Audio_item* audio_item_l ); - - virtual String str() const; - int clocks_per_1_i_; -}; - struct Midi_track : Midi_chunk { + DECLARE_MY_RUNTIME_TYPEINFO; int number_i_; - /* *************** */ + Midi_track(); void add( int delta_time_i, String event ); diff --git a/lily/include/midi-output.hh b/lily/include/midi-output.hh deleted file mode 100644 index 0338916a53..0000000000 --- a/lily/include/midi-output.hh +++ /dev/null @@ -1,30 +0,0 @@ -/* - midioutput.hh -- declare Midi_output - - source file of the GNU LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - - -#ifndef MIDIOUTPUT_HH -#define MIDIOUTPUT_HH -#include "lily-proto.hh" - - -struct Midi_output { - #if 0 - Midi_output(Score* score_l, Midi_def* ); - - void do_staff(Staff*st_l, int count); - void header(); - void staffs(); - - Score* score_l_; - Midi_def* midi_l_; - Midi_stream* midi_stream_l_; -#endif -}; - -#endif // MIDIOUTPUT_HH - diff --git a/lily/include/midi-stream.hh b/lily/include/midi-stream.hh index c18cb9c4e9..9fded298d5 100644 --- a/lily/include/midi-stream.hh +++ b/lily/include/midi-stream.hh @@ -1,7 +1,8 @@ -// -// midistream.hh -- part of GNU LilyPond -// -// copyright 1997 Jan Nieuwenhuizen <jan@digicash.com> +/* + midi-stream.hh -- declare Midi_stream + + (c) 1997 Jan Nieuwenhuizen <jan@digicash.com> + */ #ifndef MIDI_STREAM_HH #define MIDI_STREAM_HH @@ -9,24 +10,19 @@ #include <iostream.h> #include "string.hh" -/// Midi output +/// Midi outputfile struct Midi_stream { - ostream* os_p_; - String filename_str_; - int clocks_per_4_i_; - int tracks_i_; - - Midi_stream( String filename_str, int tracks_i, int clocks_per_4_i_ ); + Midi_stream( String filename_str ); ~Midi_stream(); Midi_stream& operator <<( String str ); Midi_stream& operator <<( Midi_item const& mitem_c_r ); Midi_stream& operator <<( int i ); - void header(); void open(); -//private: -// Midi_stream(Midi_stream const&); + ostream* os_p_; + String filename_str_; }; -#endif // MIDI_STREAM_HH // + +#endif // MIDI_STREAM_HH diff --git a/lily/include/midi-walker.hh b/lily/include/midi-walker.hh new file mode 100644 index 0000000000..a9ce619a09 --- /dev/null +++ b/lily/include/midi-walker.hh @@ -0,0 +1,48 @@ +/* + midi-walker.hh -- declare Midi_walker + + (c) 1996, 1997 Han-Wen Nienhuys <hanwen@stack.nl> + Jan Nieuwenhuizen <jan@digicash.com> + */ + +#ifndef MIDI_WALKER_HH +#define MIDI_WALKER_HH + +#include "proto.hh" +#include "plist.hh" +#include "pcursor.hh" +#include "pqueue.hh" +#include "lily-proto.hh" +#include "moment.hh" + +struct Midi_note_event : PQueue_ent<Moment, Midi_note_off*> +{ + bool ignore_b_; + Midi_note_event(); +}; + +int compare(Midi_note_event const& left, Midi_note_event const& right ); + +/** + walk audio and output midi + */ +class Midi_walker : public PCursor<Audio_item*> +{ +public: + Midi_walker( Audio_staff* audio_staff_l, Midi_track* midi_track_l ); + ~Midi_walker(); + + void process(); + +private: + void do_start_note( Midi_note* note_l ); + void do_stop_notes( Moment now_mom ); + void output_event( Moment now_mom, Midi_item* l ); + + Midi_track* track_l_; + PQueue<Midi_note_event> stop_note_queue; + Moment last_mom_; +}; + + +#endif // MIDI_WALKER_HH diff --git a/lily/include/molecule.hh b/lily/include/molecule.hh index 2eccfd3ee8..d1057bebf0 100644 --- a/lily/include/molecule.hh +++ b/lily/include/molecule.hh @@ -22,8 +22,7 @@ struct Molecule { void add_bottom(const Molecule &m); void add(Molecule const &m); void translate(Offset); - void translate_y(Real); - void translate_x(Real); + void translate(Real,Axis); void add(Atom const & a) ; /// how big is #this#? Box extent() const; diff --git a/lily/include/music-iterator.hh b/lily/include/music-iterator.hh index 42ad968c42..c38340706e 100644 --- a/lily/include/music-iterator.hh +++ b/lily/include/music-iterator.hh @@ -16,24 +16,23 @@ #include "moment.hh" class Music_iterator { + Array<Translator *>report_to_l_arr_; + void push_translator(Translator*); + void pop_translator(); protected: bool first_b_; virtual void do_print()const; -public: - Music_iterator *daddy_iter_l_; - DECLARE_MY_RUNTIME_TYPEINFO; - Array<Translator *>report_to_l_arr_; - - Translator *report_to_l()const; - - static Music_iterator* static_get_iterator_p(Music*,Translator*); + virtual Translator * get_req_translator_l(); Music_iterator* get_iterator_p(Music*)const; void set_translator(Translator*); - void push_translator(Translator*); - void pop_translator(); - + Music_iterator *daddy_iter_l_; +public: + Translator *report_to_l()const; + DECLARE_MY_RUNTIME_TYPEINFO; + + static Music_iterator* static_get_iterator_p(Music*,Translator*); Music_iterator(); virtual void process_and_next(Moment until); @@ -42,16 +41,8 @@ public: virtual ~Music_iterator(); virtual void construct_children(); void print()const; - virtual Translator * get_req_translator_l(); }; -class Change_iterator : public Music_iterator { - Change_reg * change_l_; -public: - DECLARE_MY_RUNTIME_TYPEINFO; - virtual void process_and_next(Moment); - Change_iterator(Change_reg*); -}; class Chord_iterator : public Music_iterator { @@ -91,7 +82,10 @@ class Voice_iterator : private PCursor<Music*>, public Music_iterator Moment here_mom_; const Voice * voice_C_; Music_iterator * iter_p_; - void next_element(); + void start_next_element(); + void leave_element(); + void set_voice_translator(); + public: Voice_iterator(Voice const*); DECLARE_MY_RUNTIME_TYPEINFO; diff --git a/lily/include/music.hh b/lily/include/music.hh index 41531a7902..63ce4b8799 100644 --- a/lily/include/music.hh +++ b/lily/include/music.hh @@ -17,18 +17,22 @@ #include "lily-proto.hh" #include "string.hh" -/** In Lily, everything that has a length and a pitch (which can be - transposed) is considered "music", +/** + Anything which has length or pitch. + + In Lily, everything that can be thought to have a length and a pitch + (which has a duration which can be transposed) is considered "music", Music is hierarchical: - @seealso Music_list + @see Music_list + */ class Music:public Input { public: Music_list * parent_music_l_; - /** what kind of iterator needed to walk this music? This doesn't + /** The kind of iterator needed to walk this music. This doesn't make sense for simple (ie non-list) music, but it does no harm here. Yes, it did harm Music_list: you can forget to copy it. diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index 782541d689..6152be7782 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -51,9 +51,10 @@ public: /* *************** */ void set_duration(Duration); - static int compare(const Rhythmic_req &, const Rhythmic_req &); + bool do_equal_b(Request*)const; virtual Moment duration() const; Rhythmic_req(); + static int compare(Rhythmic_req const&,Rhythmic_req const&); REQUESTMETHODS(Rhythmic_req, rhythmic); }; @@ -88,7 +89,7 @@ public: Text_req(int d, Text_def*); ~Text_req(); Text_req(Text_req const&); - static int compare(const Text_req&,const Text_req&); + REQUESTMETHODS(Text_req,text); }; @@ -120,8 +121,8 @@ struct Melodic_req :virtual Musical_req /// return pitch from central c (in halfnotes) int pitch()const; Melodic_req(); - static int compare(Melodic_req const&, Melodic_req const&); - + bool do_equal_b(Request*)const; + static int compare( Melodic_req const&,Melodic_req const&); REQUESTMETHODS(Melodic_req,melodic); }; @@ -132,6 +133,7 @@ public: /// force/supress printing of accidental. bool forceacc_b_; Note_req(); + bool do_equal_b(Request*)const; Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); } REQUESTMETHODS(Note_req, note); }; @@ -166,7 +168,7 @@ public: enum { NOSPAN, START, STOP } spantype ; - static int compare(const Span_req &r1, const Span_req &r2); + bool do_equal_b(Request*)const; REQUESTMETHODS(Span_req,span); Span_req(); diff --git a/lily/include/my-lily-parser.hh b/lily/include/my-lily-parser.hh index 6c96382498..e606a0f4b3 100644 --- a/lily/include/my-lily-parser.hh +++ b/lily/include/my-lily-parser.hh @@ -38,6 +38,8 @@ class My_lily_parser { public: int default_octave_i_; Duration default_duration_; + Plet plet_; + String textstyle_str_; bool first_b_; bool last_duration_mode_b_ ; diff --git a/lily/include/note-column-grav.hh b/lily/include/note-column-grav.hh index 561944f00f..43ebda4432 100644 --- a/lily/include/note-column-grav.hh +++ b/lily/include/note-column-grav.hh @@ -23,7 +23,7 @@ class Note_column_engraver :public Engraver { bool h_shift_b_; int dir_i_; - /* *************** */ + bool acceptable_elem_b(Score_elem const*)const; protected: virtual void set_feature(Feature); diff --git a/lily/include/note-performer.hh b/lily/include/note-performer.hh index b925617e42..0fb8aecbd4 100644 --- a/lily/include/note-performer.hh +++ b/lily/include/note-performer.hh @@ -18,7 +18,6 @@ public: DECLARE_MY_RUNTIME_TYPEINFO; Note_performer(); - ~Note_performer(); protected: virtual void process_requests(); @@ -28,7 +27,6 @@ protected: private: Melodic_req * note_req_l_; - Moment off_mom_; }; #endif // NOTE_PERFORMER_HH diff --git a/lily/include/offset.hh b/lily/include/offset.hh index bd5b269532..00bc73e0e2 100644 --- a/lily/include/offset.hh +++ b/lily/include/offset.hh @@ -6,33 +6,49 @@ #ifndef OFFSET_HH #define OFFSET_HH + #include "real.hh" +#include "axes.hh" + /// 2d vector struct Offset { - Real x,y; - - Offset operator+(Offset o)const { - Offset r(*this); - r+=o; - return r; + Real coordinate_a_[NO_AXES]; + + Real &y() { return coordinate_a_[Y_AXIS]; } + Real &x() { return coordinate_a_[X_AXIS]; } + Real y()const { return coordinate_a_[Y_AXIS]; } + Real x()const { return coordinate_a_[X_AXIS]; } + + Real &operator[](Axis i) { + return coordinate_a_[i]; + } + Real operator[](Axis i) const{ + return coordinate_a_[i]; } Offset operator+=(Offset o) { - x+=o.x; - y+=o.y; + x()+=o.x(); + y()+=o.y(); return *this; } Offset(Real ix , Real iy) { - x=ix; - y=iy; + x()=ix; + y()=iy; } Offset() { - x=0.0; - y=0.0; + x()=0.0; + y()=0.0; } }; +inline Offset +operator+(Offset o1, Offset const& o2) +{ + o1 += o2; + return o1; +} + #endif // OFFSET_HH diff --git a/lily/include/p-col.hh b/lily/include/p-col.hh index 136d25293c..d66921dc87 100644 --- a/lily/include/p-col.hh +++ b/lily/include/p-col.hh @@ -23,7 +23,7 @@ class PCol { public: Link_list<Item *> its; - Link_list<Spanner *> stoppers, starters; + Link_list<Spanner *> starters; /** prebreak is put before end of line. if broken here, then (*this) column is discarded, and prebreak @@ -49,7 +49,7 @@ public: bool error_mark_b_; bool used_b_ ; // manual override.. - PScore * pscore_l_; + Paper_score * pscore_l_; /* *************** */ /// which one (left =0) @@ -79,7 +79,7 @@ public: void set_rank(int); void OK() const; - void set_breakable(); + void set_breakable(); virtual void do_set_breakable(); void print()const; private: diff --git a/lily/include/p-score.hh b/lily/include/p-score.hh index 596e718c41..12ba8c77ad 100644 --- a/lily/include/p-score.hh +++ b/lily/include/p-score.hh @@ -1,5 +1,5 @@ /* - p-score.hh -- declare PScore + p-score.hh -- declare Paper_score source file of the GNU LilyPond music typesetter @@ -16,11 +16,11 @@ #include "plist.hh" /** all stuff which goes onto paper. notes, signs, symbols in a score - #PScore# contains the items, the columns. + #Paper_score# contains the items, the columns. */ -class PScore { +class Paper_score { public: Paper_def *paper_l_; @@ -41,7 +41,7 @@ public: /* *************** */ /* CONSTRUCTION */ - PScore(Paper_def*); + Paper_score(Paper_def*); /// add a line to the broken stuff. Positions given in #config# void set_breaking(Array<Col_hpositions> const &); @@ -49,9 +49,9 @@ public: add the item in specified containers. If breakstatus is set properly, add it to the {pre,post}break of the pcol. */ - void typeset_item(Item *item_p, PCol *pcol_l,int breakstatus=0); + void typeset_item(Item *item_p, PCol *pcol_l); - /// add to bottom of pcols + /// add to bottom of pcols void add(PCol*); /** @@ -75,7 +75,7 @@ public: /* STANDARD ROUTINES */ void OK()const; void print() const; - ~PScore(); + ~Paper_score(); void typeset_element(Score_elem*); void typeset_broken_spanner(Spanner*); /// add a Spanner diff --git a/lily/include/paper-def.hh b/lily/include/paper-def.hh index d172c0bc38..44fc05e12a 100644 --- a/lily/include/paper-def.hh +++ b/lily/include/paper-def.hh @@ -18,7 +18,7 @@ /** - symbols, dimensions and constants + Symbols, dimensions and constants pertaining to visual output. This struct takes care of all kinds of symbols, dimensions and constants. Most of them are related to the point-size of the fonts, @@ -68,7 +68,7 @@ public: /// height of the staff Real standard_height()const; - /// width of a quaver ball + /// width of a crotchet ball Real note_width() const; void print() const; diff --git a/lily/include/performer-group-performer.hh b/lily/include/performer-group-performer.hh index fdca52a576..4c57fc7af8 100644 --- a/lily/include/performer-group-performer.hh +++ b/lily/include/performer-group-performer.hh @@ -23,22 +23,14 @@ public: DECLARE_MY_RUNTIME_TYPEINFO; Input_translator* itrans_l_; - Performer_group_performer(); - ~Performer_group_performer(); - virtual void add( Performer* perf_p ); - virtual void print()const { Performer::print() ; } - virtual Moment get_mom() const; virtual bool do_try_request( Request* req_l ); - virtual bool try_request(Request*r) { return Performer::try_request(r) ; } - - // <ugh> - virtual void set_track( int& track_i_r ); - virtual int get_track_i() const; - // </ugh> + virtual void print() const; + virtual bool try_request(Request* r); + protected: - + virtual ~Performer_group_performer(); virtual Translator* find_get_translator_l( String name, String id ); virtual Translator* get_default_interpreter(); diff --git a/lily/include/performer.hh b/lily/include/performer.hh index eda9b784f3..0126c7b231 100644 --- a/lily/include/performer.hh +++ b/lily/include/performer.hh @@ -27,16 +27,9 @@ public: Performer(); virtual ~Performer(); - void print() const; virtual void process_requests(); - virtual void set( Moment mom ); - // <ugh> - virtual void set_track( int& track_i_r ); - virtual int get_track_i() const; - // </ugh> - virtual bool try_request( Request* req_l ); virtual void do_removal_processing(); @@ -44,13 +37,10 @@ public: protected: virtual void do_creation_processing(); - virtual bool do_try_request(Request*); virtual int get_tempo_i() const; virtual void do_print() const; - virtual Moment get_mom() const; - virtual void play( Audio_item* p ); - virtual void play( Midi_item* l ); + virtual void play( Audio_element * elem_p ); }; #include "global-performers.hh" diff --git a/lily/include/request.hh b/lily/include/request.hh index 37bf51caa8..07e480137e 100644 --- a/lily/include/request.hh +++ b/lily/include/request.hh @@ -46,8 +46,10 @@ public: virtual Blank_req * blank() { return 0; } virtual Musical_req *musical() { return 0; } virtual Command_req * command() { return 0; } + bool equal_b(Request*) const; protected: - virtual void do_print()const ; + virtual bool do_equal_b(Request*) const; + virtual void do_print()const; }; #define REQUESTMETHODS(T,accessor) \ @@ -67,7 +69,8 @@ public: General_script_def *scriptdef_p_; /* *************** */ - static int compare(const Script_req &, const Script_req &); + bool do_equal_b(Request*)const; + Script_req(); REQUESTMETHODS(Script_req,script); ~Script_req(); diff --git a/lily/include/rest-column.hh b/lily/include/rest-column.hh index 7e2db4272c..6dfdaf16c9 100644 --- a/lily/include/rest-column.hh +++ b/lily/include/rest-column.hh @@ -13,10 +13,8 @@ #include "script-column.hh" #include "head-column.hh" -/** - struct to treat a set of rests as union (one voicegroup should - only produce one rest. - */ +/** struct to treat a set of rests as union (one voice should only + produce one rest. */ class Rest_column : public Head_column { public: DECLARE_MY_RUNTIME_TYPEINFO; diff --git a/lily/include/score-align-grav.hh b/lily/include/score-align-grav.hh index 4dcee6837e..718137ecfa 100644 --- a/lily/include/score-align-grav.hh +++ b/lily/include/score-align-grav.hh @@ -12,6 +12,9 @@ #include "engraver.hh" +/** + Group a number of items across staffs + */ class Score_align_engraver: public Engraver { Horizontal_group_item * align_p_; diff --git a/lily/include/score-column.hh b/lily/include/score-column.hh index 396fc0312b..e108bc8213 100644 --- a/lily/include/score-column.hh +++ b/lily/include/score-column.hh @@ -16,14 +16,14 @@ #include "p-col.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) - - */ + Column with durational info. + + 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 : public PCol { friend class Score; diff --git a/lily/include/score-elem.hh b/lily/include/score-elem.hh index 39c0615262..82a6fbfe3d 100644 --- a/lily/include/score-elem.hh +++ b/lily/include/score-elem.hh @@ -15,6 +15,8 @@ #define SCORE_ELEM_CLONE(T) VIRTUAL_COPY_CONS(T, Score_elem) + + /** Both Spanner and Item are Score_elem's. Most Score_elem's depend on other Score_elem's, eg, Beam needs to know and set direction of Stem. So the Beam has to be calculated *before* Stem. This is @@ -29,11 +31,6 @@ class Score_elem : private Directed_graph_node { Molecule *output; // should scrap, and use temp var? - /** - This is needed, because #output# may still be - NULL. - */ - Offset offset_; /** for administration of what was done already @@ -56,12 +53,26 @@ class Score_elem : private Directed_graph_node { Status status_; + Score_elem* dependency(int) const; + Score_elem* dependent(int) const; + int dependent_size() const; + int dependency_size() const; public: - PScore *pscore_l_; - Vertical_group *y_group_l_; - Horizontal_group *x_group_l_; + /** + This is needed, because #output# may still be + NULL. + */ + Offset offset_; + + + + + Paper_score *pscore_l_; + Axis_group_element * axis_group_l_a_[2]; + Score_elem(Score_elem const&); virtual String TeX_string () const ; + String TeX_string_without_offset(Offset)const; virtual void print() const; Paper_def *paper() const; @@ -70,17 +81,24 @@ public: Score_elem(); DECLARE_MY_RUNTIME_TYPEINFO; + Interval extent(Axis)const; Interval width() const; Interval height() const; - virtual void translate_x(Real); - virtual void translate_y(Real); Status status() const; /** translate the symbol. The symbol does not have to be created yet. */ void translate(Offset); - Offset offset()const; + /** + translate in one direction + */ + + void translate(Real, Axis); + Real relative_coordinate(Axis_group_element*, Axis)const; + Offset absolute_offset()const; + Real absolute_coordinate(Axis)const; + Axis_group_element*common_group(Score_elem const* s, Axis a)const; void add_processing(); void OK() const; @@ -91,6 +109,9 @@ public: void post_processing(); void molecule_processing(); + /** + Remove all links (dependencies, dependents, Axis_group_elements. + */ void unlink(); void unlink_all(); void substitute_dependency(Score_elem*,Score_elem*); @@ -109,19 +130,12 @@ public: /* virtual accessors */ - virtual Vertical_group * vertical_group() { return 0; } - virtual Horizontal_group * horizontal_group() { return 0; } virtual Spanner* spanner() { return 0; } - virtual Horizontal_vertical_group* elem_group() { return 0; } virtual Item * item() { return 0; } virtual Line_of_score * line_l() const; SCORE_ELEM_CLONE(Score_elem); - Score_elem* dependency(int) const; - Score_elem* dependent(int) const; - int dependent_size() const; - int dependency_size() const; - + /// no dimension, translation is noop bool empty_b_; /// do not print anything black @@ -135,7 +149,7 @@ protected: virtual void do_print() const {} /// generate the molecule virtual Molecule* brew_molecule_p()const; - ///executed directly after the item is added to the PScore + ///executed directly after the item is added to the Paper_score virtual void do_add_processing(); /// do calculations before determining horizontal spacing virtual void do_pre_processing(); @@ -149,9 +163,8 @@ protected: virtual void do_break_processing(); virtual void handle_broken_dependencies(); virtual void handle_prebroken_dependencies(); - - - + virtual Link_array<Score_elem> get_extra_dependencies()const; + virtual void do_unlink(); }; diff --git a/lily/include/score-grav.hh b/lily/include/score-grav.hh index 7a722edc2e..39941cda65 100644 --- a/lily/include/score-grav.hh +++ b/lily/include/score-grav.hh @@ -13,6 +13,9 @@ #include "engraver-group.hh" #include "global-translator.hh" +/** + Top level engraver. Puts elements into appropriate columns. + */ class Score_engraver : public Engraver_group_engraver, public Global_translator { @@ -28,7 +31,7 @@ class Score_engraver : Score_column* musical_column_l_; friend class Score; - void set_cols(Score_column*,Score_column*); + void set_columns(Score_column*,Score_column*); void typeset_all(); public: @@ -52,7 +55,6 @@ protected: virtual void do_creation_processing(); virtual void do_removal_processing(); virtual void announce_element(Score_elem_info); - virtual void typeset_breakable_item(Item * nobreak_p); virtual void do_announces(); virtual void typeset_element(Score_elem*elem_p); virtual Paper_def * paper() const; diff --git a/lily/include/score-performer.hh b/lily/include/score-performer.hh index b4030800b4..b0b584e72a 100644 --- a/lily/include/score-performer.hh +++ b/lily/include/score-performer.hh @@ -11,6 +11,9 @@ #include "performer-group-performer.hh" #include "global-translator.hh" +/** + Top level performer. Completely takes care of MIDI output + */ class Score_performer: public Performer_group_performer, public Global_translator { @@ -20,29 +23,22 @@ public: ~Score_performer(); protected: - virtual Translator* ancestor_l( int l ); + virtual Translator* ancestor_l(int l); virtual int depth_i() const; virtual void finish(); - virtual Moment get_mom() const; - virtual void prepare( Moment mom ); + virtual void prepare(Moment mom); virtual void process(); - virtual void set_score( Score* score_l ); + virtual void set_score(Score* score_l); virtual void start(); virtual int get_tempo_i() const; - virtual void play(Audio_item*); - virtual void play(Midi_item*); + virtual void play(Audio_element* p); private: void header(Midi_stream&); - Midi_def* midi_l_; - - Moment prev_mom_; Moment now_mom_; Audio_column* audio_column_l_; - - Link_array<Midi_item> midi_item_l_arr_; }; #endif // SCORE_PERFORMER_HH diff --git a/lily/include/score.hh b/lily/include/score.hh index ecd4f8cc10..058fb173b0 100644 --- a/lily/include/score.hh +++ b/lily/include/score.hh @@ -26,7 +26,7 @@ public: Paper_def *paper_p_; Midi_def *midi_p_; Music * music_p_; - PScore *pscore_p_; + Paper_score *pscore_p_; Audio_score* audio_score_p_; int errorlevel_i_; @@ -44,7 +44,6 @@ public: /// output to file void output(String fn); - /// void set(Midi_def* midi_p); /// @@ -66,7 +65,6 @@ private: // utils: PCursor<Score_column*> create_cols(Moment, PCursor<Score_column*> &last); - /** make the pcol_l_ fields of each Score_column point to the correct PCol, remove any unnecessary Score_column's diff --git a/lily/include/script-column.hh b/lily/include/script-column.hh index aeb9d11277..b3d73aac95 100644 --- a/lily/include/script-column.hh +++ b/lily/include/script-column.hh @@ -25,7 +25,7 @@ public: Link_array<Item> support_l_arr_; DECLARE_MY_RUNTIME_TYPEINFO; - void add(Script *); + virtual void add(Script *); void add_support(Item*); }; diff --git a/lily/include/script-def.hh b/lily/include/script-def.hh index 890ce377bc..65898a0549 100644 --- a/lily/include/script-def.hh +++ b/lily/include/script-def.hh @@ -37,7 +37,7 @@ public: virtual Atom get_atom(Paper_def* p, int dir_i_)const; DECLARE_MY_RUNTIME_TYPEINFO; - virtual bool do_equal_b(General_script_def const &)const; + virtual bool do_equal_b(General_script_def const *)const; virtual void do_print() const; Script_def(); void set_from_input(String, bool, int, int ,bool,int ); diff --git a/lily/include/script-grav.hh b/lily/include/script-grav.hh index 2e622aa7ff..ce72d40def 100644 --- a/lily/include/script-grav.hh +++ b/lily/include/script-grav.hh @@ -15,15 +15,12 @@ class Script_engraver : public Engraver { Array<Script *> script_p_arr_; Array<Script_req *> script_req_l_arr_; - /* *************** */ - bool acceptable_elem_b(Score_elem*); public: DECLARE_MY_RUNTIME_TYPEINFO; Script_engraver(); protected: virtual bool do_try_request(Request*); virtual void do_process_requests(); - virtual void acknowledge_element(Score_elem_info); virtual void do_pre_move_processing(); virtual void do_post_move_processing(); diff --git a/lily/include/script.hh b/lily/include/script.hh index 2031a28ad6..bd7a5cc086 100644 --- a/lily/include/script.hh +++ b/lily/include/script.hh @@ -17,7 +17,6 @@ class Script : public Item, public Staff_side { Stem *stem_l_; - /* *************** */ protected: Molecule *brew_molecule_p()const; virtual void do_substitute_dependency(Score_elem*,Score_elem*); @@ -25,6 +24,7 @@ protected: virtual Interval symbol_height()const; virtual void do_pre_processing(); virtual Interval do_width() const; + SCORE_ELEM_CLONE(Script); private: void set_default_dir(); diff --git a/lily/include/span-bar-grav.hh b/lily/include/span-bar-grav.hh index f81428dc03..03a63aaece 100644 --- a/lily/include/span-bar-grav.hh +++ b/lily/include/span-bar-grav.hh @@ -12,6 +12,12 @@ #include "engraver.hh" +/** + + Make bars that span multiple "staffs". Catch bars, and span a + Span_bar over them if we find more than 2 bars + + */ class Span_bar_engraver : public Engraver { Span_bar * spanbar_p_; diff --git a/lily/include/span-bar.hh b/lily/include/span-bar.hh index d181ebbc95..724caa3b9f 100644 --- a/lily/include/span-bar.hh +++ b/lily/include/span-bar.hh @@ -17,6 +17,7 @@ class Span_bar : public Bar Link_array<Bar> spanning_l_arr_; public: + Span_bar(); DECLARE_MY_RUNTIME_TYPEINFO; SCORE_ELEM_CLONE(Span_bar); void add(Bar* ); @@ -25,7 +26,6 @@ public: protected: virtual Interval do_width()const; virtual void do_pre_processing(); - virtual void translate_y(Real y); virtual void do_substitute_dependency(Score_elem*,Score_elem*); virtual Molecule * brew_molecule_p()const; diff --git a/lily/include/span-score-bar-grav.hh b/lily/include/span-score-bar-grav.hh index 5b53ffbb71..836424c0c2 100644 --- a/lily/include/span-score-bar-grav.hh +++ b/lily/include/span-score-bar-grav.hh @@ -12,6 +12,13 @@ #include "span-bar-grav.hh" +/** + + Make the bars that Span the entire score line (system). A + Span_bar_engraver which generates a special bar. + + */ + class Span_score_bar_engraver : public Span_bar_engraver { public: diff --git a/lily/include/spanner-elem-group.hh b/lily/include/spanner-elem-group.hh index 821c762cf0..2f65af207b 100644 --- a/lily/include/spanner-elem-group.hh +++ b/lily/include/spanner-elem-group.hh @@ -13,7 +13,7 @@ #include "spanner.hh" #include "elem-group.hh" -class Spanner_elem_group : public Spanner, public Horizontal_vertical_group { +class Spanner_elem_group : public Spanner, public Horizontal_vertical_group_element { protected: virtual Interval do_width()const; diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index 30a72290c0..79e1bd4cfd 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -10,7 +10,7 @@ #include "lily-proto.hh" #include "score-elem.hh" -/** a symbol which is attached between two columns. A spanner is a +/** A symbol which is attached between two columns. A spanner is a symbol which spans across several columns, so its final appearance can only be calculated after the breaking problem is solved. diff --git a/lily/include/spring-spacer.hh b/lily/include/spring-spacer.hh index 85b828d2fa..0a38a2e255 100644 --- a/lily/include/spring-spacer.hh +++ b/lily/include/spring-spacer.hh @@ -16,7 +16,7 @@ #include "colhpos.hh" /** - Determine positions of columns connected by springs and held apart by rods + Determine positions of columns connected by springs and held apart by rods. Generate a spacing which diff --git a/lily/include/staff-performer.hh b/lily/include/staff-performer.hh index 8d6a45d92f..b73e9b9fe5 100644 --- a/lily/include/staff-performer.hh +++ b/lily/include/staff-performer.hh @@ -21,22 +21,12 @@ public: String instrument_str(); protected: - virtual void play( Midi_item* l ); - virtual void play( Audio_item* l ); + virtual void play( Audio_element* p ); virtual void do_removal_processing(); virtual void do_creation_processing(); - // <ugh> - virtual void set_track( int& track_i_r ); - virtual int get_track_i() const; - // </ugh> private: - void header(); - - Moment midi_mom_; - Midi_track* midi_track_p_; - Pointer_list<Audio_item*> audio_item_p_list_; - int track_i_; + Audio_staff* audio_staff_p_; }; #endif // STAFF_PERFORMER_HH diff --git a/lily/include/staff-side.hh b/lily/include/staff-side.hh index 4186c01be1..73f174f105 100644 --- a/lily/include/staff-side.hh +++ b/lily/include/staff-side.hh @@ -13,9 +13,8 @@ #include "score-elem.hh" #include "interval.hh" -/** A symbol which sits along a staff +/** A symbol which sits along a staff. - Should override translate_y() ? */ class Staff_side : virtual Score_elem { Link_array<Score_elem> support_l_arr_; diff --git a/lily/include/staffline.hh b/lily/include/staffline.hh deleted file mode 100644 index db08cb6446..0000000000 --- a/lily/include/staffline.hh +++ /dev/null @@ -1,26 +0,0 @@ -/* - staffline.hh -- horizontal structures for broken scores. - - (c) 1996,97 Han-Wen Nienhuys -*/ - -#ifndef STAFFLINE_HH -#define STAFFLINE_HH - -#include "spanner-elem-group.hh" - -/// one broken line of staff. -struct Line_of_staff : public Spanner_elem_group{ - - SCORE_ELEM_CLONE(Line_of_staff); -public: - DECLARE_MY_RUNTIME_TYPEINFO; - - /* *************** */ - /** - Add an element. If it is a Element_group, only the dependency - (otherwise, might translate doubly) */ - void add_element(Score_elem*); -}; - -#endif diff --git a/lily/include/super-elem.hh b/lily/include/super-elem.hh index d090ea707a..c6b7360e05 100644 --- a/lily/include/super-elem.hh +++ b/lily/include/super-elem.hh @@ -11,10 +11,10 @@ #define SUPER_ELEM_HH #include "score-elem.hh" -/** The toplevel element. The PScore contains this element, and any +/** The toplevel element. The Paper_score contains this element, and any element shoud be a dependency for the super element. */ -class Super_elem : public virtual Score_elem { +class Super_elem : public Score_elem { public: Link_array<Line_of_score> lines_arr_; Line_of_score * line_of_score_l_; diff --git a/lily/include/symbol.hh b/lily/include/symbol.hh index e1e24b25e0..3e2eafc7d3 100644 --- a/lily/include/symbol.hh +++ b/lily/include/symbol.hh @@ -33,13 +33,9 @@ struct Atom { void translate(Offset o) { off_ += o; } - void translate_x(Real r){ - off_.x += r; + void translate(Real r,Axis a){ + off_[a] += r; } - void translate_y(Real r) { - off_.y += r; - } - /// how big is #this#? Box extent() const; Atom(Symbol s); diff --git a/lily/include/text-def.hh b/lily/include/text-def.hh index 371aeb44b8..3f7d433246 100644 --- a/lily/include/text-def.hh +++ b/lily/include/text-def.hh @@ -28,10 +28,9 @@ public: String text_str_; String style_str_; - /* *************** */ virtual void do_print() const; virtual ~Text_def() {}; - bool do_equal_b(const Text_def&)const; + virtual bool do_equal_b(const General_script_def*)const; Text_def(); virtual void print() const; Interval width(Paper_def*) const; diff --git a/lily/include/timing-grav.hh b/lily/include/timing-grav.hh new file mode 100644 index 0000000000..96abc5c865 --- /dev/null +++ b/lily/include/timing-grav.hh @@ -0,0 +1,38 @@ +/* + timing-grav.hh -- declare Timing_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef TIMING_GRAV_HH +#define TIMING_GRAV_HH + +#include "engraver.hh" +#include "time-description.hh" +#include "grouping.hh" +#include "parray.hh" + +/** + Do time bookkeeping + */ +class Timing_engraver : public Engraver +{ + Time_description time_; + Rhythmic_grouping default_grouping_; + + Link_array<Timing_req> timing_req_l_arr_; + + virtual void fill_staff_info(Staff_info&); + virtual bool do_try_request(Request *req_l); + virtual void do_process_requests(); + virtual void do_pre_move_processing(); + virtual void do_creation_processing(); + virtual void do_post_move_processing(); + Timing_engraver(); + DECLARE_MY_RUNTIME_TYPEINFO; +} + +#endif // TIMING_GRAV_HH diff --git a/lily/include/vertical-align-elem.hh b/lily/include/vertical-align-elem.hh index b96dfba335..0fc0029b5b 100644 --- a/lily/include/vertical-align-elem.hh +++ b/lily/include/vertical-align-elem.hh @@ -11,6 +11,7 @@ #define VERTICAL_ALIGN_ITEM_HH #include "elem-group.hh" + /** Order elements top to bottom. */ diff --git a/lily/include/vertical-group-spanner.hh b/lily/include/vertical-group-spanner.hh index d092d96488..ab90bdb6b6 100644 --- a/lily/include/vertical-group-spanner.hh +++ b/lily/include/vertical-group-spanner.hh @@ -10,26 +10,21 @@ #ifndef SPAN_VERTICAL_GROUP_HH #define SPAN_VERTICAL_GROUP_HH -#include "spanner.hh" +#include "axis-group-spanner.hh" #include "elem-group.hh" -/** An element which groups a line. Due to technical problems, this - cannot be used as a baseclass */ -class Vertical_group_spanner : public Spanner, public Vertical_group +/** An element which groups a line. + */ +class Vertical_group_spanner : public Axis_group_spanner, public Vertical_group_element { protected: - virtual void do_break_processing(); - virtual void do_print()const; - VIRTUAL_COPY_CONS(Vertical_group_spanner, Score_elem); - -private: - void remove_all(); - /// shouldn't be copied. - Vertical_group_spanner(Vertical_group_spanner const&); - + SCORE_ELEM_CLONE(Vertical_group_spanner); + virtual void remove_all() { Vertical_group_element::remove_all(); } public: - Vertical_group_spanner(); DECLARE_MY_RUNTIME_TYPEINFO; + virtual void add_element(Score_elem*e) { Vertical_group_element::add_element(e); } + virtual void remove_element(Score_elem*e) { Vertical_group_element::remove_element(e); } + }; #endif // SPAN_VERTICAL_GROUP_HH diff --git a/lily/item.cc b/lily/item.cc index 083798be00..7553b8cf6b 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -14,9 +14,10 @@ Item::Item() { + breakable_b_ = false; + break_status_i_ = 0; pcol_l_ = 0; - broken_to_a_[0] - = broken_to_a_[1]=0; + broken_to_a_[0] = broken_to_a_[1]=0; } IMPLEMENT_IS_TYPE_B1(Item, Score_elem); @@ -33,11 +34,9 @@ Item::do_print() const Real Item::hpos_f()const { - return pcol_l_->hpos_f_ + offset().x; + return pcol_l_->hpos_f_ + absolute_coordinate(X_AXIS); } - - Line_of_score * Item::line_l()const { @@ -47,43 +46,42 @@ Item::line_l()const int Item::break_status_i() const { - PCol * c = pcol_l_; - if (c->breakable_b()) - return 0; - else if (!c->daddy_l_) - return 0; - else if (c == c->daddy_l_->prebreak_p_) - return -1; - else - return 1; + return break_status_i_; } void Item::copy_breakable_items() { + if ( broken_to_a_[0] || broken_to_a_[1] ) + return; + Item *new_copies[2]; for (int i=0; i < 2; i++) { Item * item_p = clone()->item(); item_p->copy_dependencies(*this); - /* add our pre and postbreaks blondly to our own y_group - Let Vertical_group_spanner figure out the mess. - */ - if ( y_group_l_ ) - y_group_l_->add_element( item_p ); - pscore_l_->typeset_item(item_p, pcol_l_, -1+ 2*i); + + item_p->break_status_i_ = -1+ 2*i; + pscore_l_->typeset_item(item_p, pcol_l_); item_p->handle_prebroken_dependencies(); - broken_to_a_[i] = item_p; + new_copies[i] =item_p; } + broken_to_a_= new_copies; } void Item::do_breakable_col_processing() { - PCol * c = pcol_l_; - if (!c->breakable_b()) + if (!breakable_b_ || !pcol_l_->breakable_b()) return; - + copy_breakable_items(); handle_prebroken_dependencies(); + + /* + Otherwise the broken items won't be pre_process()'ed. + */ + add_dependency( broken_to_a_[0] ); + add_dependency( broken_to_a_[1] ); + } Item* @@ -116,6 +114,6 @@ Item::find_prebroken_piece(PCol*c)const void Item::handle_prebroken_dependencies() { - if ( pcol_l_->breakable_b() || pcol_l_->daddy_l_ ) + if ( breakable_b_ ) Score_elem::handle_prebroken_dependencies(); } diff --git a/lily/key-grav.cc b/lily/key-grav.cc index 84288bd101..5de204bd25 100644 --- a/lily/key-grav.cc +++ b/lily/key-grav.cc @@ -28,7 +28,11 @@ void Key_engraver::create_key() { if (!kit_p_) { - int c0_i= *get_staff_info().c0_position_i_l_; + int c0_i=0; + + Staff_info inf = get_staff_info(); + if (inf.c0_position_i_l_) + c0_i = *get_staff_info().c0_position_i_l_; kit_p_ = new Key_item(c0_i); announce_element(Score_elem_info(kit_p_,keyreq_l_)); @@ -67,9 +71,9 @@ Key_engraver::acknowledge_element(Score_elem_info info) void Key_engraver::do_process_requests() { - if (key_.multi_octave_b_) + if (key_.multi_octave_b_) { assert(false); // TODO . - else if (keyreq_l_) { + } else if (keyreq_l_) { create_key(); } } @@ -79,7 +83,7 @@ Key_engraver::do_pre_move_processing() { if (kit_p_) { kit_p_->default_b_ = default_key_b_; - typeset_breakable_item( kit_p_); + typeset_element( kit_p_); kit_p_ = 0; } } @@ -90,7 +94,7 @@ void Key_engraver::read_req(Key_change_req * r) { key_.multi_octave_b_ = r->multi_octave_b_; - accidental_idx_arr_.set_size(0); + accidental_idx_arr_.clear(); for (int i = 0; i < r->melodic_p_arr_.size(); i ++) { Melodic_req * m_l =r->melodic_p_arr_[i]; int n_i =m_l->notename_i_; diff --git a/lily/key-item.cc b/lily/key-item.cc index aa8401e005..299695561f 100644 --- a/lily/key-item.cc +++ b/lily/key-item.cc @@ -1,10 +1,20 @@ +/* + key-item.cc -- implement Key_item + + source file of the GNU LilyPond music typesetter + + (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl> + + keyplacement by Mats Bengtsson +*/ + #include "key-item.hh" #include "key.hh" #include "debug.hh" #include "molecule.hh" #include "paper-def.hh" #include "lookup.hh" -//#include "clef-grav.hh" + #include "key-grav.hh" const int FLAT_TOP_PITCH=2; /* fes,ges,as and bes typeset in lower octave */ @@ -12,6 +22,7 @@ const int SHARP_TOP_PITCH=4; /* ais and bis typeset in lower octave */ Key_item::Key_item(int c) { + breakable_b_ =true; default_b_ = false; set_c_position(c); } @@ -58,7 +69,7 @@ Key_item::brew_molecule_p()const for (int i =0; i < pitch.size(); i++) { Symbol s= paper()->lookup_l()->accidental(acc[i]); Atom a(s); - a.translate_y((c_position + pitch[i]) * inter); + a.translate((c_position + pitch[i]) * inter, Y_AXIS); Molecule m(a); output->add_right(m); } diff --git a/lily/leastsquares.cc b/lily/leastsquares.cc index cf9ec478e4..04dd26bdcc 100644 --- a/lily/leastsquares.cc +++ b/lily/leastsquares.cc @@ -5,7 +5,7 @@ Least_squares::OK() const assert( input.size() > 1 ); Real dx = 0.0; for (int i=1; i < input.size(); i++) - dx += abs (input[i-1].x - input[i].x); + dx += abs (input[i-1].x() - input[i].x()); assert(dx); } @@ -19,8 +19,8 @@ Least_squares::minimise(Real &coef, Real &offset) Real sxy = 0.0; for (int i=0; i < input.size();i++) { - Real x=input[i].x; - Real y = input[i].y; + Real x=input[i].x(); + Real y = input[i].y(); sx += x; sy += y; sqx += sqr(x); diff --git a/lily/lexer.l b/lily/lexer.l index 51ea87a08d..0634e76c4a 100644 --- a/lily/lexer.l +++ b/lily/lexer.l @@ -70,7 +70,7 @@ TEX {AA}|-|{PUNCT}|{ACCENT}|{NATIONAL} WORD {A}{AN}* ALPHAWORD {A}+ INT -?{N}+ -REAL {INT}?\.{N}* +REAL ({INT}\.{N}*)|(-?\.{N}+) KEYWORD \\{WORD} WHITE [ \n\t\f] BLACK [^ \n\t\f] @@ -179,9 +179,6 @@ LYRICS ({AA}|{NATIONAL})[^0-9 \t\n\f]* return INT; } - \+\+ { - return CONCAT; - } \" { start_quote(); } @@ -223,7 +220,7 @@ LYRICS ({AA}|{NATIONAL})[^0-9 \t\n\f]* /* ugr. This sux. */ String s (YYText()); int i = 0; - while ((i=s.index_i("_")) != -1) // change word binding "_" to " " + while ((i=s.index_i("_")) != -1) // change word binding "_" to " " *(s.ch_l() + i) = ' '; if ((i=s.index_i("\\,")) != -1) // change "\," to TeX's "\c " { @@ -335,6 +332,14 @@ My_lily_lexer::scan_escaped_word(String str) yylval.id = id; return id->token_code_i_; } + if ( YYSTATE != notes ) { + Melodic_req * mel_l = lookup_melodic_req_l(str); + if (mel_l) { + mtor << "(notename)\n"; + yylval.melreq = mel_l; + return NOTENAME_ID; + } + } LexerError( "Unknown escaped string: `" + str + "'"); mtor << "(string)"; String *sp = new String( str); @@ -354,17 +359,6 @@ My_lily_lexer::scan_bare_word(String str) return NOTENAME_ID; } } -#if 0 - if (YYSTATE != notes) { - // ugr. Should do this in note mode? - // Identifier * id = lookup_identifier(str); - if (id) { - mtor << "(identifier)\n"; - yylval.id = id; - return id->token_code_i_; - } - } -#endif yylval.string=new String( str ); return STRING; diff --git a/lily/line-group-grav.cc b/lily/line-group-grav.cc index 2e4b506335..3fc21f2472 100644 --- a/lily/line-group-grav.cc +++ b/lily/line-group-grav.cc @@ -11,7 +11,6 @@ #include "command-request.hh" #include "bar.hh" #include "debug.hh" -#include "staffline.hh" #include "line-group-grav.hh" Line_group_engraver::Line_group_engraver() @@ -22,7 +21,7 @@ Line_group_engraver::Line_group_engraver() void Line_group_engraver::acknowledge_element(Score_elem_info elem) { - if ( !elem.elem_l_->y_group_l_ ) + if ( !elem.elem_l_->axis_group_l_a_[Y_AXIS] ) staffline_p_->add_element(elem.elem_l_); } diff --git a/lily/local-key-grav.cc b/lily/local-key-grav.cc index 78fbae2992..bd474f4d2b 100644 --- a/lily/local-key-grav.cc +++ b/lily/local-key-grav.cc @@ -40,8 +40,15 @@ Local_key_engraver::do_pre_move_processing() - if (!key_item_p) - key_item_p = new Local_key_item(*get_staff_info().c0_position_i_l_); + if (!key_item_p) { + int c0_i=0; + + Staff_info inf = get_staff_info(); + if (inf.c0_position_i_l_) + c0_i = *get_staff_info().c0_position_i_l_; + + key_item_p = new Local_key_item(c0_i); + } key_item_p->add(note_l); key_item_p->add_support(support_l); local_key_.oct(note_l->octave_i_) @@ -57,12 +64,14 @@ Local_key_engraver::do_pre_move_processing() typeset_element(key_item_p); } - mel_l_arr_.set_size(0); - tied_l_arr_.set_size(0); - support_l_arr_.set_size(0); - forced_l_arr_.set_size(0); + mel_l_arr_.clear(); + tied_l_arr_.clear(); + support_l_arr_.clear(); + forced_l_arr_.clear(); } - +/* + whoah .. this looks hairy! + */ void Local_key_engraver::acknowledge_element(Score_elem_info info) { @@ -95,11 +104,9 @@ void Local_key_engraver::do_process_requests() { Time_description const * time_C_ = get_staff_info().time_C_; - if (! time_C_->whole_in_measure_){ + if (time_C_ && !time_C_->whole_in_measure_){ if (key_C_) local_key_= *key_C_; - else if(0&& time_C_->when_ >Moment(0)) - warning ("Help me! can't figure out current key"); } } diff --git a/lily/local-key-item.cc b/lily/local-key-item.cc index 50f870c1cf..6f84c2d40d 100644 --- a/lily/local-key-item.cc +++ b/lily/local-key-item.cc @@ -66,7 +66,7 @@ Local_key_item::brew_molecule_p()const if (accs[i].octave_i_ != lastoct) { if (octmol){ Real dy =lastoct*7*paper()->internote_f(); - octmol->translate_y( dy); + octmol->translate( dy, Y_AXIS); output->add(*octmol); delete octmol; } @@ -76,20 +76,20 @@ Local_key_item::brew_molecule_p()const Symbol s =paper()->lookup_l()->accidental(accs[i].accidental_i_); Atom a(s); Real dy = (accs[i].name_i_ + c0_position) * paper()->internote_f(); - a.translate_y(dy); + a.translate(dy, Y_AXIS); octmol->add_right(a); } if (octmol){ Real dy =lastoct*7*paper()->internote_f(); - octmol->translate_y( dy); + octmol->translate( dy, Y_AXIS); output->add(*octmol); delete octmol; } Interval head_width=itemlist_width(support_items_); - output->translate_x(-output->extent().x.right + head_width.left ); + output->translate(-output->extent().x().right + head_width.left , X_AXIS); return output; } diff --git a/lily/lookup.cc b/lily/lookup.cc index 6bc298e147..e51a3e8b89 100644 --- a/lily/lookup.cc +++ b/lily/lookup.cc @@ -109,7 +109,7 @@ Lookup::bar(String s, Real h) const a.push(print_dimen( h)); Symbol ret=(*symtables_)("bars")->lookup(s);; ret.tex = substitute_args(ret.tex, a); - ret.dim.y = Interval( 0, h); + ret.dim.y() = Interval( 0, h); return ret; } @@ -183,7 +183,7 @@ Lookup::hairpin(Real &wid, bool decresc) const Array<String> a; a.push(idx); ret.tex = substitute_args(ret.tex, a); - ret.dim.x = Interval(0,wid); + ret.dim.x() = Interval(0,wid); return ret; } @@ -192,9 +192,8 @@ Lookup::linestaff(int lines, Real wid) const { Real internote_f = paper_l_ ->internote_f(); Symbol s; - s.dim.x = Interval(0,wid); Real dy = (lines >0) ? (lines-1)*internote_f : 0; - s.dim.y = Interval(0,dy); + s.dim = Box(Interval(0,wid), Interval(0,dy)); Array<String> a; a.push(lines); @@ -211,8 +210,8 @@ Symbol Lookup::meter(Array<Scalar> a) const { Symbol s; - s.dim.x = Interval( 0 PT, 10 PT); - s.dim.y = Interval(0, 20 PT); // todo + s.dim.x() = Interval( 0 PT, 10 PT); + s.dim.y() = Interval(0, 20 PT); // todo String src = (*symtables_)("param")->lookup("meter").tex; s.tex = substitute_args(src,a); return s; @@ -229,8 +228,8 @@ Lookup::stem(Real y1,Real y2) const } Symbol s; - s.dim.x = Interval(0,0); - s.dim.y = Interval(y1,y2); + s.dim.x() = Interval(0,0); + s.dim.y() = Interval(y1,y2); Array<String> a; a.push(print_dimen(y1)); @@ -263,7 +262,7 @@ Lookup::vbrace(Real &y) const Array<String> a; a.push(idx); s.tex = substitute_args(s.tex,a); - s.dim.y = Interval(0,y); + s.dim.y() = Interval(0,y); } { Array<String> a; diff --git a/lily/lyric-grav.cc b/lily/lyric-grav.cc index 85e8e630fd..0ab6b79204 100644 --- a/lily/lyric-grav.cc +++ b/lily/lyric-grav.cc @@ -36,7 +36,7 @@ Lyric_engraver::do_process_requests() if ( lreq_l_ ) { lyric_item_p_ = new Text_item(lreq_l_->tdef_p_ ); - lyric_item_p_->translate_x( paper()->note_width()/2 ); + lyric_item_p_->translate( paper()->note_width()/2 , X_AXIS); lyric_item_p_->dir_i_ = -1; lyric_item_p_->fat_b_ = true; announce_element( Score_elem_info( lyric_item_p_, lreq_l_)); diff --git a/lily/main.cc b/lily/main.cc index a87d9b2885..eff3d6cc81 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -23,6 +23,7 @@ Sources* source_l_g = 0; bool only_midi = false; bool version_ignore_b_ = false; +int exit_status_i_; void destill_inname( String &name_str_r); @@ -65,7 +66,10 @@ usage() #ifdef STRING_UTILS_INLINED "STRING_UTILS_INLINED " #endif - "datadir= " DIR_DATADIR "\n" + "datadir= " DIR_DATADIR + + "\n"; + ; @@ -76,13 +80,10 @@ notice() { cout << "\n" - "GNU LilyPond, a music typesetter.\n" - "Copyright (C) 1996,97 by\n" + "GNU LilyPond -- The GNU Project music typesetter.\n" + "Copyright 1996,97 by\n" " Han-Wen Nienhuys <hanwen@stack.nl>\n" " Jan Nieuwenhuizen <jan@digicash.com>\n" - "Contributors\n" - " Mats Bengtsson <matsb@s3.kth.se>\n" - " Werner Lemberg <xlwy01@uxp1.hrz.uni-dortmund.de>\n" "\n" " This program is free software; you can redistribute it and/or\n" "modify it under the terms of the GNU General Public License version 2\n" @@ -106,7 +107,7 @@ void do_one_file(String init_str, String file_str) { if ( init_str != "" && "" == path.find( init_str ) ) { - error ( "Can not find `" + init_str +"'"); + error ( "Can not find `" + init_str +"\'"); return ; } if ( file_str!= "" && path.find( file_str ) == "" ) { @@ -146,20 +147,20 @@ main (int argc, char **argv) cout << get_version_str() << endl; String init_str("symbol.ly"); - while (Long_option_init * opt = oparser()) { + while (Long_option_init const * opt = oparser()) { switch ( opt->shortname){ case 'o': - set_default_output(oparser.optarg); + set_default_output(oparser.optional_argument_ch_C_); break; case 'w': notice(); exit(0); break; case 'I': - path.push(oparser.optarg); + path.push(oparser.optional_argument_ch_C_); break; case 'i': - init_str = oparser.optarg; + init_str = oparser.optional_argument_ch_C_; break; case 'h': usage(); @@ -181,7 +182,7 @@ main (int argc, char **argv) } int p=0; - char *arg ; + const char *arg ; while ( (arg= oparser.get_next_arg()) ) { String f(arg); destill_inname(f); @@ -192,7 +193,7 @@ main (int argc, char **argv) do_one_file(init_str, ""); } - return 0; + return exit_status_i_; } /// make input file name: add default extension. "" is stdin. diff --git a/lily/meter-grav.cc b/lily/meter-grav.cc index 3112f18556..d65e5cfae2 100644 --- a/lily/meter-grav.cc +++ b/lily/meter-grav.cc @@ -100,7 +100,7 @@ void Meter_engraver::do_pre_move_processing() { if (meter_p_) { - typeset_breakable_item(meter_p_); + typeset_element(meter_p_); meter_p_ =0; meter_req_l_ = 0; } diff --git a/lily/meter.cc b/lily/meter.cc index e578cef5fe..6c74a1edbf 100644 --- a/lily/meter.cc +++ b/lily/meter.cc @@ -7,6 +7,7 @@ Meter::Meter(Array<Scalar>a) :args(a) { + breakable_b_ = true; } Molecule* diff --git a/lily/midi-def.cc b/lily/midi-def.cc index 280b6304d1..800c1e9cd1 100644 --- a/lily/midi-def.cc +++ b/lily/midi-def.cc @@ -23,14 +23,14 @@ // statics Midi_def // ugh + int Midi_def::den_i_s = 4; int Midi_def::num_i_s = 4; Midi_def::Midi_def() { - outfile_str_ = "lelie.midi"; + outfile_str_ = ""; itrans_p_ = 0; - real_vars_p_ = new Assoc<String,Real>; // ugh set_tempo( Moment( 1, 4 ), 60 ); } @@ -39,14 +39,12 @@ Midi_def::Midi_def( Midi_def const& s ) { whole_seconds_f_ = s.whole_seconds_f_; itrans_p_ = s.itrans_p_ ? new Input_translator( *s.itrans_p_ ) : 0; - real_vars_p_ = new Assoc<String,Real> ( *s.real_vars_p_ ); outfile_str_ = s.outfile_str_; } Midi_def::~Midi_def() { delete itrans_p_; - delete real_vars_p_; } Real @@ -64,14 +62,6 @@ Midi_def::get_global_translator_p() const return itrans_p_->get_group_performer_p()->global_l(); } -Real -Midi_def::get_var( String s ) const -{ - if ( !real_vars_p_->elt_b( s ) ) - error ( "unknown midi variable `" + s + "'" ); - return real_vars_p_->elem( s ); -} - int Midi_def::get_tempo_i( Moment moment ) { @@ -85,9 +75,6 @@ Midi_def::print() const mtor << "Midi {"; mtor << "4/min: " << Real( 60 ) / ( whole_seconds_f_ * 4 ); mtor << "out: " << outfile_str_; - for (Assoc_iter<String,Real> i( *real_vars_p_ ); i.ok(); i++) { - mtor << i.key() << "= " << i.val() << "\n"; - } mtor << "}\n"; #endif } @@ -105,9 +92,3 @@ Midi_def::set_tempo( Moment moment, int count_per_minute_i ) whole_seconds_f_ = Moment( count_per_minute_i ) / Moment( 60 ) / moment; } -void -Midi_def::set_var( String s, Real r ) -{ - real_vars_p_->elem( s ) = r; -} - diff --git a/lily/midi-item.cc b/lily/midi-item.cc index d520eac8fb..88ac41f6b4 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -18,6 +18,19 @@ #include "midi-stream.hh" #include "audio-item.hh" +IMPLEMENT_IS_TYPE_B(Midi_item); +IMPLEMENT_IS_TYPE_B1(Midi_chunk, Midi_item); +IMPLEMENT_IS_TYPE_B1(Midi_duration, Midi_item); +IMPLEMENT_IS_TYPE_B1(Midi_header, Midi_chunk); +IMPLEMENT_IS_TYPE_B1(Midi_instrument, Midi_item); +IMPLEMENT_IS_TYPE_B1(Midi_key,Midi_item); +IMPLEMENT_IS_TYPE_B1(Midi_meter, Midi_item); +IMPLEMENT_IS_TYPE_B1(Midi_note, Midi_item); +IMPLEMENT_IS_TYPE_B1(Midi_note_off, Midi_item); +IMPLEMENT_IS_TYPE_B1(Midi_tempo, Midi_item); +IMPLEMENT_IS_TYPE_B1(Midi_text, Midi_item); +IMPLEMENT_IS_TYPE_B1(Midi_track, Midi_chunk); + Midi_chunk::Midi_chunk() : Midi_item( 0 ) { @@ -256,20 +269,19 @@ Midi_instrument::Midi_instrument( int channel_i, String instrument_str ) String Midi_instrument::str() const { - // ugh, does not work... - return String( "" ); Byte program_byte = 0; for ( int i = 0; instrument_name_sz_a_[i]; i++ ) if ( instrument_str_ == String(instrument_name_sz_a_[ i ] )) { program_byte = (Byte)i; break; } - if ( program_byte ) { - String str = String( (char)( 0xc0 + channel_i_ ) ); - str += String( (char)program_byte ); - return str; - } - return String( "" ); + + if ( !program_byte ) + return String( "" ); + + String str = String( (char)( 0xc0 + channel_i_ ) ); + str += String( (char)program_byte ); + return str; } Midi_item::Midi_item( Audio_item* audio_item_l ) @@ -329,32 +341,88 @@ Midi_key::str() const return String_convert::hex2bin_str( str ); } +Midi_meter::Midi_meter( Audio_item* audio_item_l ) + : Midi_item( audio_item_l ) +{ + clocks_per_1_i_ = 18; +} + +String +Midi_meter::str() const +{ + Meter_change_req* m = audio_item_l_->req_l_->command()->meterchange(); + int num_i = m->beats_i_; + int den_i = m->one_beat_i_; + + String str = "ff5804"; + str += String_convert::i2hex_str( num_i, 2, '0' ); + str += String_convert::i2hex_str( intlog2( den_i ) , 2, '0' ); + str += String_convert::i2hex_str( clocks_per_1_i_, 2, '0' ); + str += String_convert::i2hex_str( 8, 2, '0' ); + return String_convert::hex2bin_str( str ); +} + Midi_note::Midi_note( Audio_item* audio_item_l ) : Midi_item( audio_item_l ) { - // ugh - dynamic_byte_ = 0x64; - on_b_ = ( (Audio_note*)audio_item_l_ )->on_b_; - if ( on_b_ ) // poor man-s staff dynamics: - dynamic_byte_ -= 0x10 * channel_i_; - else - dynamic_byte_ += 0x32; // 0x64 is supposed to be neutral, but let-s try + dynamic_byte_ = 0x7f; +} + +Moment +Midi_note::duration() const +{ + return audio_item_l_->req_l_->musical()->rhythmic()->duration(); +} + +int +Midi_note::pitch_i() const +{ + return audio_item_l_->req_l_->musical()->melodic()->pitch(); } String Midi_note::str() const { - Note_req* n = audio_item_l_->req_l_->musical()->melodic()->note(); - int pitch_i = n->pitch() + c0_pitch_i_c_; - if ( pitch_i != INT_MAX ) { - Byte status_byte = ( on_b_ ? 0x90 : 0x80 ) + channel_i_; - String str = String( (char)status_byte ); - str += (char)pitch_i; - // poor man-s staff dynamics: - str += (char)dynamic_byte_; - return str; - } - return String( "" ); + if ( pitch_i() == INT_MAX ) + return String( "" ); + + Byte status_byte = (char)( 0x90 + channel_i_ ); + + String str = String( (char)status_byte ); + str += (char)( pitch_i() + c0_pitch_i_c_ ); + + // poor man's staff dynamics: + str += (char)( dynamic_byte_ - 0x10 * channel_i_ ); + + return str; +} + +Midi_note_off::Midi_note_off( Midi_note* midi_note_l ) + : Midi_item( midi_note_l->audio_item_l_ ) +{ + // 0x64 is supposed to be neutral, but let's try + aftertouch_byte_ = 0x64; + channel_i_ = midi_note_l->channel_i_; +} + +int +Midi_note_off::pitch_i() const +{ + return audio_item_l_->req_l_->musical()->melodic()->pitch(); +} + +String +Midi_note_off::str() const +{ + if ( pitch_i() == INT_MAX ) + return String( "" ); + + Byte status_byte = (char)( 0x80 + channel_i_ ); + + String str = String( (char)status_byte ); + str += (char)( pitch_i() + Midi_note::c0_pitch_i_c_ ); + str += (char)aftertouch_byte_; + return str; } Midi_tempo::Midi_tempo( Audio_item* audio_item_l ) @@ -378,27 +446,6 @@ Midi_tempo::str() const return String_convert::hex2bin_str( str ); } -Midi_meter::Midi_meter( Audio_item* audio_item_l ) - : Midi_item( audio_item_l ) -{ - clocks_per_1_i_ = 18; -} - -String -Midi_meter::str() const -{ - Meter_change_req* m = audio_item_l_->req_l_->command()->meterchange(); - int num_i = m->beats_i_; - int den_i = m->one_beat_i_; - - String str = "ff5804"; - str += String_convert::i2hex_str( num_i, 2, '0' ); - str += String_convert::i2hex_str( intlog2( den_i ) , 2, '0' ); - str += String_convert::i2hex_str( clocks_per_1_i_, 2, '0' ); - str += String_convert::i2hex_str( 8, 2, '0' ); - return String_convert::hex2bin_str( str ); -} - Midi_text::Midi_text( Audio_item* audio_item_l ) : Midi_item( audio_item_l ) { diff --git a/lily/midi-stream.cc b/lily/midi-stream.cc index 38f462d760..04777b50c8 100644 --- a/lily/midi-stream.cc +++ b/lily/midi-stream.cc @@ -15,14 +15,11 @@ #include "midi-stream.hh" #include "debug.hh" -Midi_stream::Midi_stream( String filename_str, int tracks_i, int clocks_per_4_i ) +Midi_stream::Midi_stream( String filename_str ) { filename_str_ = filename_str; - tracks_i_ = tracks_i; - clocks_per_4_i_ = clocks_per_4_i; os_p_ = 0; open(); - header(); } Midi_stream::~Midi_stream() @@ -63,20 +60,6 @@ Midi_stream::operator <<( int i ) } void -Midi_stream::header() -{ -/* - 4D 54 68 64 MThd - String str = "MThd"; - 00 00 00 06 chunk length - 00 01 format 1 - 00 01 one track - 00 60 96 per quarter-note -*/ - *this << Midi_header( 1, tracks_i_, clocks_per_4_i_ ); -} - -void Midi_stream::open() { os_p_ = new ofstream( filename_str_ ); diff --git a/lily/midi-walker.cc b/lily/midi-walker.cc index 8cf348d9f7..4b4eed261d 100644 --- a/lily/midi-walker.cc +++ b/lily/midi-walker.cc @@ -3,135 +3,108 @@ source file of the GNU LilyPond music typesetter - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>, Jan Nieuwenhuizen <jan@digicash.com> - - TODO - - Ideally this should also use a register system, to process slurs, - dynamics, etc. - -*/ - -/* reincluded for code jatting */ -#if 0 + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> + Jan Nieuwenhuizen <jan@digicash.com> + */ -#include "command-request.hh" -#include "musical-request.hh" -#include "p-score.hh" -#include "staff.hh" #include "midi-walker.hh" +#include "audio-column.hh" +#include "audio-item.hh" +#include "audio-staff.hh" #include "midi-item.hh" #include "midi-stream.hh" #include "debug.hh" -#include "staff-column.hh" -Midi_walker::Midi_walker(Staff *st_l, Midi_track* track_l) - : PCursor<Staff_column*>(st_l->cols_) +Midi_note_event::Midi_note_event() +{ + ignore_b_ = false; +} + +int +compare( Midi_note_event const& left, Midi_note_event const& right ) { - track_l_ = track_l; - last_moment_= 0; + return sign( left.key - right.key ); } -/** - output notestop events for all notes which end before #max_moment# - */ -void -Midi_walker::do_stop_notes(Moment max_moment) +Midi_walker::Midi_walker( Audio_staff* audio_staff_l, Midi_track* track_l ) + : PCursor<Audio_item*>( audio_staff_l->audio_item_l_list_ ) { - while (stop_notes.size() && stop_notes.front().key <= max_moment) { - Note_event ent=stop_notes.get(); - if (ent.ignore_b_) - continue; - - Moment stop_moment = ent.key; - Melodic_req * req_l = ent.val; - - Midi_note note(req_l, track_l_->number_i_, false); - output_event(note, stop_moment); - } + track_l_ = track_l; + last_mom_ = 0; } + +Midi_walker::~Midi_walker() +{ + // ugh + do_stop_notes( last_mom_ + Moment( 10, 1 ) ); +} + /** - Find out if start_note event is needed, and do it if needed. + Find out if start_note event is needed, and do it if needed. */ void -Midi_walker::do_start_note(Note_req*note_l) +Midi_walker::do_start_note( Midi_note* note_l ) { - Moment stop = note_l->duration() + ptr()->when(); - for(int i=0; i < stop_notes.size(); i++) { - if (stop_notes[i].val->melodic()->pitch() == - note_l->pitch()) { - if ( stop_notes[i].key < stop){ - stop_notes[i].ignore_b_=true; - } - else - return; // skip the stop note + Moment stop_mom = note_l->duration() + ptr()->audio_column_l_->at_mom(); + for ( int i=0; i < stop_note_queue.size(); i++ ) { + if ( stop_note_queue[ i ].val->pitch_i() == note_l->pitch_i() ) { + if ( stop_note_queue[ i ].key < stop_mom ) + stop_note_queue[ i ].ignore_b_ = true; + else // skip the stopnote + return; } } - Note_event e; - e.val = note_l; - e.key = stop; - - stop_notes.insert(e); - - Midi_note note(note_l, track_l_->number_i_, true); - output_event(note, ptr()->when()); -} - -/** advance the track to #now#, output the item, and adjust current - "moment". */ -void -Midi_walker::output_event(Midi_item &i, Moment now) -{ - Moment delta_t = now - last_moment_ ; - last_moment_ += delta_t; - track_l_->add(delta_t, &i ); + Midi_note_event e; + e.val = new Midi_note_off( note_l ); + e.key = stop_mom; + stop_note_queue.insert( e ); + + output_event( ptr()->audio_column_l_->at_mom(), note_l ); } +/** + Output note events for all notes which end before #max_mom# + */ void -Midi_walker::process_requests() +Midi_walker::do_stop_notes( Moment max_mom ) { - do_stop_notes(ptr()->when()); - - for ( int i = 0; i < ptr()->commandreq_l_arr_.size(); i++ ) { - Command_req *c_l = ptr()->commandreq_l_arr_[i]->command(); - Meter_change_req* meter_l = c_l->meterchange(); - if ( meter_l ) - output_event( Midi_time( meter_l->beats_i_, meter_l->one_beat_i_, 18 ), ptr()->when() ); - Key_change_req* key_l = c_l->keychange(); - if ( key_l ) { - int sharps_i = key_l->sharps_i(); - int flats_i = key_l->flats_i(); - // midi cannot handle non-conventional keys - if ( !( flats_i && sharps_i ) ) - output_event( Midi_key( sharps_i - flats_i, key_l->minor_b() ), ptr()->when() ); - } - } - - for ( int i = 0; i < ptr()->musicalreq_l_arr_.size(); i++ ) { - Musical_req *m = ptr()->musicalreq_l_arr_[i]->musical(); - if (!m) - return; - Rhythmic_req *n = m->rhythmic(); - if ( !n) - continue; - Note_req * note_l = n->note(); - if (!note_l) + while ( stop_note_queue.size() && stop_note_queue.front().key <= max_mom ) { + Midi_note_event e = stop_note_queue.get(); + if ( e.ignore_b_ ) continue; - do_start_note(note_l); + + Moment stop_mom = e.key; + Midi_note_off* note_l = e.val; + + output_event( stop_mom, note_l ); } } -Midi_walker::~Midi_walker() +/** + Advance the track to #now#, output the item, and adjust current "moment". + */ +void +Midi_walker::output_event( Moment now_mom, Midi_item* l ) { - do_stop_notes( last_moment_ + Moment(10,1)); // ugh + Moment delta_t = now_mom - last_mom_ ; + last_mom_ += delta_t; + track_l_->add( delta_t, l ); } - -int -compare(Note_event const&e1, Note_event const&e2) +void +Midi_walker::process() { - return sign(e1.key - e2.key); + do_stop_notes( ptr()->audio_column_l_->at_mom() ); + + Midi_item* p = ptr()->midi_item_p(); + p->channel_i_ = track_l_->number_i_; + + if ( p->name() != Midi_note::static_name() ) + output_event( ptr()->audio_column_l_->at_mom(), p ); + else + do_start_note( (Midi_note*)p ); + + delete p; } -#endif diff --git a/lily/molecule.cc b/lily/molecule.cc index ee4fe5e485..f9cc7bb12a 100644 --- a/lily/molecule.cc +++ b/lily/molecule.cc @@ -14,9 +14,6 @@ #include "debug.hh" #include "tex.hh" - -/* *************** */ - String Molecule::TeX_string() const { @@ -43,15 +40,10 @@ Molecule::translate(Offset o) } void -Molecule::translate_x(Real x) -{ - translate(Offset(x,0)); -} - -void -Molecule::translate_y(Real y) +Molecule::translate(Real x,Axis a) { - translate(Offset(0,y)); + for (iter_top(ats,c); c.ok(); c++) + c->translate(x,a); } void @@ -69,7 +61,9 @@ Molecule::add_right(Molecule const &m) add(m); return; } - Real xof=extent().x.right - m.extent().x.left; + Real xof=extent().x().right - m.extent().x().left; + + Molecule toadd(m); toadd.translate(Offset(xof, 0.0)); add(toadd); @@ -82,7 +76,8 @@ Molecule::add_left(Molecule const &m) add(m); return; } - Real xof=extent().x.left - m.extent().x.right; + Real xof=extent().x().left - m.extent().x().right; + Molecule toadd(m); toadd.translate(Offset(xof, 0.0)); add(toadd); @@ -96,9 +91,10 @@ Molecule::add_top(Molecule const &m) add(m); return; } - Real yof=extent().y.right - m.extent().y.left; + Real yof=extent().y().right - m.extent().y().left; + Molecule toadd(m); - toadd.translate_y(yof); + toadd.translate(yof, Y_AXIS); add(toadd); } @@ -109,9 +105,9 @@ Molecule::add_bottom(Molecule const &m) add(m); return; } - Real yof=extent().y.left- m.extent().y.right; + Real yof=extent().y().left- m.extent().y().right; Molecule toadd(m); - toadd.translate_y(yof); + toadd.translate(yof, Y_AXIS); add(toadd); } diff --git a/lily/music-iterator.cc b/lily/music-iterator.cc index 25e5f2b63f..cf3f4f13ea 100644 --- a/lily/music-iterator.cc +++ b/lily/music-iterator.cc @@ -54,19 +54,16 @@ Music_iterator::get_req_translator_l() void Music_iterator::push_translator(Translator*t) { - if (t) { - report_to_l_arr_.push(t); - t->iterator_count_ ++; - } + report_to_l_arr_.push(t); + t->iterator_count_ ++; } void Music_iterator::pop_translator() { - if (report_to_l()) { - report_to_l()->iterator_count_ --; - report_to_l_arr_.pop(); - } + report_to_l()->iterator_count_ --; + assert (report_to_l()->iterator_count_ >=0); + report_to_l_arr_.pop(); } Translator* @@ -79,12 +76,14 @@ Music_iterator::report_to_l()const void -Music_iterator::set_translator(Translator*reg) +Music_iterator::set_translator(Translator*trans) { - if (report_to_l()==reg) + if (report_to_l()==trans) return; - pop_translator(); - push_translator(reg); + if ( report_to_l() ) + pop_translator(); + if (trans) + push_translator(trans); } void @@ -121,9 +120,7 @@ Music_iterator::static_get_iterator_p(Music *m, Translator *report_l) { Music_iterator * p =0; - if (m->is_type_b( Change_reg::static_name())) - p = new Change_iterator((Change_reg*)m); - else if (m->is_type_b( Request_chord::static_name())) + if (m->is_type_b( Request_chord::static_name())) p = new Request_chord_iterator( (Request_chord*) m); else if (m->is_type_b( Chord::static_name())) p = new Chord_iterator( (Chord*) m); @@ -172,10 +169,11 @@ Chord_iterator::construct_children() for(PCursor<Music*> i(chord_C_->music_p_list_.top()); //, int j = 0; i.ok(); j++, i++) { Music_iterator * mi = get_iterator_p( i.ptr()); - set_translator(mi->report_to_l()->ancestor_l( chord_C_->multi_level_i_ )); - if ( mi->ok() ) + if ( mi->ok() ) { + set_translator(mi->report_to_l()->ancestor_l( + chord_C_->multi_level_i_ ) ); children_p_list_.bottom().add( mi ); - else + } else delete mi; } } @@ -244,26 +242,45 @@ Voice_iterator::Voice_iterator(Voice const*v) void Voice_iterator::construct_children() { - if (ok()) { - iter_p_ = Music_iterator::get_iterator_p( ptr() ); - if (iter_p_->report_to_l()->depth_i() > report_to_l()->depth_i()) - set_translator(iter_p_->report_to_l()); + while (PCursor<Music*>::ok()) { + start_next_element(); + if ( !iter_p_->ok()) { + leave_element(); + } else { + set_voice_translator(); + break; + } } } -void -Voice_iterator::next_element() +void +Voice_iterator::leave_element() { - delete iter_p_ ; + delete iter_p_; iter_p_ =0; - here_mom_ += ptr()->time_int().length(); + MInterval elt_time = ptr()->time_int(); + if (!elt_time.empty_b()) + here_mom_ += elt_time.length(); PCursor<Music*>::next(); - construct_children(); +} + +void +Voice_iterator::start_next_element() +{ + assert( !iter_p_); + iter_p_ = get_iterator_p( ptr()); +} + +void +Voice_iterator::set_voice_translator() +{ + if (iter_p_->report_to_l()->depth_i() > report_to_l()->depth_i()) + set_translator(iter_p_->report_to_l()); } Voice_iterator::~Voice_iterator() { - delete iter_p_; + assert(! iter_p_); } @@ -272,21 +289,30 @@ IMPLEMENT_IS_TYPE_B1(Voice_iterator,Music_iterator); void Voice_iterator::process_and_next(Moment until) { - while (ok()) { + while (1) { Moment local_until = until - here_mom_; - while ( iter_p_ && iter_p_->ok() ) { + while ( iter_p_->ok() ) { Moment here = iter_p_->next_moment(); if (here != local_until) - return; + goto loopexit; + iter_p_->process_and_next(local_until); } - if (!iter_p_) - iter_p_ = Music_iterator::get_iterator_p( ptr() ); - else if (!iter_p_->ok() ) - next_element(); + + if (!iter_p_->ok() ) { + leave_element(); + if ( PCursor<Music*>::ok() ) { + start_next_element(); + set_voice_translator(); + } else { + goto loopexit; + } + } } + +loopexit: + Music_iterator::process_and_next(until); - assert(!ok() || next_moment() > until); } Moment @@ -298,44 +324,9 @@ Voice_iterator::next_moment()const bool Voice_iterator::ok()const { - return PCursor<Music*>::ok(); + return iter_p_; } -/* ***************** */ - - -Change_iterator::Change_iterator(Change_reg * ch) -{ - change_l_ = ch; -} - - -IMPLEMENT_IS_TYPE_B1(Change_iterator,Music_iterator); - -/* - TODO: pop/pushgroup - */ -void -Change_iterator::process_and_next(Moment mom) -{ -#if 0 - if ( id[0] == '-') { - - - Engraver_group_engraver *group_l = - report_to_l()->find_get_translator_l(change_l_->type_str_, - change_l_->id_str_); - - report_to_l()->daddy_grav_l_->remove_engraver_p(report_to_l()); - group_l->add(report_to_l()); -#endif - Music_iterator::process_and_next(mom); -} - - - -/* ******************** */ - IMPLEMENT_IS_TYPE_B1(Request_chord_iterator,Music_iterator); diff --git a/lily/music-list.cc b/lily/music-list.cc index bd1cef64d8..97f5a8a9e7 100644 --- a/lily/music-list.cc +++ b/lily/music-list.cc @@ -30,6 +30,7 @@ Chord::time_int()const MInterval m; for (iter(music_p_list_.top(), i); i.ok(); i++) m.unite(i->time_int()); + return m; } @@ -54,8 +55,15 @@ MInterval Voice::time_int() const { Moment last=0; - for (iter(music_p_list_.top(), i); i.ok(); i++) - last += i->time_int().length(); + for (iter(music_p_list_.top(), i); i.ok(); i++) { + MInterval interval = i->time_int(); + + /* + c4 <> c4 + */ + if ( !interval.empty_b() ) + last += interval.length(); + } return offset_mom_ + MInterval(0,last); } diff --git a/lily/musical-request.cc b/lily/musical-request.cc index 0d14c09c38..4bd6598489 100644 --- a/lily/musical-request.cc +++ b/lily/musical-request.cc @@ -80,6 +80,7 @@ Blank_req::do_print()const Spacing_req::do_print(); } /* *************** */ + Melodic_req::Melodic_req() { notename_i_ = 0; @@ -98,6 +99,7 @@ Melodic_req::transpose(Melodic_req const & delta) notename_i_ -= 7; octave_i_ ++; } + int new_pitch = pitch(); int delta_acc = new_pitch - old_pitch - delta_pitch; @@ -107,18 +109,28 @@ Melodic_req::transpose(Melodic_req const & delta) } } - IMPLEMENT_IS_TYPE_B1(Melodic_req,Musical_req); +bool +Melodic_req::do_equal_b(Request*r)const +{ + Melodic_req* m= r->musical()->melodic(); + return !compare( *m, *this); +} + int -Melodic_req::compare(Melodic_req const&m1, Melodic_req const&m2) -{ - if (m1.octave_i_ != m2.octave_i_) - return m1.octave_i_ -m2.octave_i_; - else if (m1.notename_i_ != m2.notename_i_) - return m1.notename_i_ - m2.notename_i_; - else if (m1.accidental_i_ != m2.accidental_i_) - return m1.accidental_i_ - m2.accidental_i_; +Melodic_req::compare(Melodic_req const &m1 , Melodic_req const&m2) +{ + int o= m1.octave_i_ - m2.octave_i_; + int n = m1.notename_i_ - m2.notename_i_; + int a = m1.accidental_i_ - m2.accidental_i_; + + if (o) + return o; + if ( n) + return n; + if (a) + return a; return 0; } @@ -126,7 +138,8 @@ void Melodic_req::do_print() const { #ifndef NPRINT - mtor << "notename: " << notename_i_ << " acc: " <<accidental_i_<<" oct: "<< octave_i_; + mtor << "notename: " << notename_i_ + << " acc: " <<accidental_i_<<" oct: "<< octave_i_; #endif } @@ -137,9 +150,9 @@ Melodic_req::height() const } /* - should be settable from input to allow "viola"-mode + should be settable from input to allow "viola"-mode */ -static Byte pitch_byte_a[ 7 ] = { 0, 2, 4, 5, 7, 9, 11 }; +static Byte pitch_byte_a[ ] = { 0, 2, 4, 5, 7, 9, 11 }; int Melodic_req::pitch() const @@ -151,7 +164,15 @@ Melodic_req::pitch() const int Rhythmic_req::compare(Rhythmic_req const &r1, Rhythmic_req const &r2) { - return sign(r1.duration() - r2.duration()); + return (r1.duration() - r2.duration()); +} + +bool +Rhythmic_req::do_equal_b(Request*r)const +{ + Rhythmic_req* rh = r->musical()->rhythmic(); + + return !compare(*this, *rh); } void @@ -200,6 +221,13 @@ Lyric_req::do_print() const } /* *************** */ +bool +Note_req::do_equal_b(Request*r)const +{ + return Rhythmic_req::do_equal_b(r) && Melodic_req::do_equal_b(r); +} + + Note_req::Note_req() { forceacc_b_ = false; @@ -243,10 +271,13 @@ IMPLEMENT_IS_TYPE_B1(Slur_req,Span_req); void Slur_req::do_print()const{} /* *************** */ -int -Span_req:: compare(Span_req const &r1, Span_req const &r2) + + +bool +Span_req:: do_equal_b(Request*r)const { - return r1.spantype - r2.spantype; + Span_req * s = r->span(); + return spantype - s->spantype; } Span_req::Span_req() @@ -261,11 +292,17 @@ Script_req::Script_req(Script_req const&s) scriptdef_p_ = s.scriptdef_p_ ? s.scriptdef_p_->clone() : 0; } -int -Script_req::compare(Script_req const &d1, Script_req const &d2) +/* + don't check dirs? + + (d1.dir_i_ == d2.dir_i_ ) + */ +bool +Script_req::do_equal_b(Request*r)const { - return !(d1.dir_i_ == d2.dir_i_ && - d1.scriptdef_p_->equal_b(*d2.scriptdef_p_)); + Script_req * s = r->script(); + + return scriptdef_p_->equal_b(*s->scriptdef_p_); } Script_req::Script_req() @@ -301,13 +338,8 @@ Script_req::~Script_req() delete scriptdef_p_; } /* *************** */ -int -Text_req:: compare(Text_req const &r1, Text_req const &r2) -{ - bool b1 = (r1.dir_i_ == r2.dir_i_); - bool b2 = (r1.tdef_p_ ->equal_b(*r2.tdef_p_)); - return b1 && b2; -} + + Text_req::~Text_req() { delete tdef_p_; @@ -333,7 +365,6 @@ void Text_req::do_print() const { #ifndef NPRINT - mtor << " dir " << dir_i_ ; tdef_p_->print(); #endif diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index a67aac8a76..18155a56e7 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -33,11 +33,9 @@ static Keyword_ent the_key_tab[]={ {"duration", DURATIONCOMMAND}, {"absdynamic", ABSDYNAMIC}, {"group", GROUP}, - {"geometric", GEOMETRIC}, {"hshift", HSHIFT}, {"id", ID}, {"in", IN_T}, - {"init_end", INIT_END}, {"requesttranslator", REQUESTTRANSLATOR}, {"lyric", LYRIC}, {"key", KEY}, @@ -47,7 +45,6 @@ static Keyword_ent the_key_tab[]={ {"midi", MIDI}, {"mm", MM_T}, {"multi", MULTI}, - {"note", NOTE}, {"notenames", NOTENAMES}, {"octave", OCTAVECOMMAND}, {"output", OUTPUT}, @@ -59,7 +56,6 @@ static Keyword_ent the_key_tab[]={ {"script", SCRIPT}, {"skip", SKIP}, {"staff", STAFF}, - {"start", START_T}, {"stem", STEM}, {"table", TABLE}, {"spandynamic", SPANDYNAMIC}, @@ -68,8 +64,6 @@ static Keyword_ent the_key_tab[]={ {"texid", TEXID}, {"textstyle", TEXTSTYLE}, {"transpose", TRANSPOSE}, - {"unitspace", UNITSPACE}, - {"width", WIDTH}, {"version", VERSION}, {"grouping", GROUPING}, {0,0} diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc index 5c14442745..3f12eba6fe 100644 --- a/lily/my-lily-parser.cc +++ b/lily/my-lily-parser.cc @@ -203,7 +203,7 @@ My_lily_parser::get_parens_request(char c) case ']': { Beam_req*b = new Beam_req; - int p_i=default_duration_.plet_.type_i_ ; // ugh . Should junk? + int p_i=plet_.type_i_ ; // ugh . Should junk? if (p_i!= 1) b->nplet = p_i; req_p = b; @@ -270,11 +270,11 @@ My_lily_parser::add_requests(Chord*v) for (int i = 0; i < pre_reqs.size(); i++) { v->add(pre_reqs[i]); } - pre_reqs.set_size(0); + pre_reqs.clear(); for (int i = 0; i <post_reqs.size(); i++) { v->add(post_reqs[i]); } - post_reqs.set_size(0); + post_reqs.clear(); } Input diff --git a/lily/note-column-grav.cc b/lily/note-column-grav.cc index 6761456558..7ce98ae77c 100644 --- a/lily/note-column-grav.cc +++ b/lily/note-column-grav.cc @@ -49,7 +49,7 @@ Note_column_engraver::acknowledge_element(Score_elem_info i) char const*nC = i.elem_l_->name(); - if (nC == Script::static_name()) { + if (nC == Script::static_name() && i.req_l_ && i.req_l_->musical()) { script_l_arr_.push((Script*)i.elem_l_->item()); } else if (nC == Note_head::static_name()) { Note_head * h_l = (Note_head*)i.elem_l_->item(); @@ -78,7 +78,7 @@ Note_column_engraver::acknowledge_element(Score_elem_info i) ncol_p_->add(script_l_arr_[i]); } - script_l_arr_.set_size(0); + script_l_arr_.clear(); } } @@ -107,7 +107,7 @@ Note_column_engraver::do_pre_move_processing() void Note_column_engraver::do_post_move_processing() { - script_l_arr_.set_size(0); + script_l_arr_.clear(); stem_l_ =0; } diff --git a/lily/note-performer.cc b/lily/note-performer.cc index be234fcdd1..5471110e90 100644 --- a/lily/note-performer.cc +++ b/lily/note-performer.cc @@ -20,11 +20,6 @@ ADD_THIS_PERFORMER(Note_performer); Note_performer::Note_performer() { note_req_l_ = 0; - off_mom_ = 0; -} - -Note_performer::~Note_performer() -{ } void @@ -33,7 +28,6 @@ Note_performer::do_print() const #ifndef NPRINT if ( note_req_l_ ) { note_req_l_->print(); - mtor << ( off_mom_ ? "on" : "off" ) << "\n"; } #endif } @@ -45,17 +39,8 @@ Note_performer::process_requests() if ( !note_req_l_ || !note_req_l_->melodic() || !note_req_l_->rhythmic() ) return; - // ugh! Midi specific - Moment mom = get_mom(); - if ( !off_mom_ ) { // start note - off_mom_ = mom + note_req_l_->duration(); - play( new Audio_note( note_req_l_, true ) ); - } - else if ( mom == off_mom_ ) { // stop note - play( new Audio_note( note_req_l_, false ) ); - note_req_l_ = 0; - off_mom_ = 0; - } + play( new Audio_note( note_req_l_ ) ); + note_req_l_ = 0; } bool @@ -64,14 +49,9 @@ Note_performer::do_try_request( Request* req_l ) if ( note_req_l_ ) return false; - // huh? -// if (req_l->musical() && (req_l->musical()->note() || req_l->musical()->rest())) -// note_req_l_ = req_l->musical()->rhythmic(); - if ( req_l->musical() && req_l->musical()->note() ) -// huh? - note_req_l_ = req_l->musical()->melodic(); - else + if ( !req_l->musical() || !req_l->musical()->note() ) return false; + note_req_l_ = req_l->musical()->melodic(); return true; } diff --git a/lily/notehead.cc b/lily/notehead.cc index 48b6b7ba6d..1e37bb328b 100644 --- a/lily/notehead.cc +++ b/lily/notehead.cc @@ -114,12 +114,12 @@ Note_head::brew_molecule_p() const s = p->lookup_l()->rest(balltype_i_, streepjes_b); } out = new Molecule(Atom(s)); - out->translate_x( x_dir_i_ * s.dim.x.length() ); + out->translate( x_dir_i_ * s.dim.x().length() , X_AXIS); if (dots_i_) { Symbol d = p->lookup_l()->dots(dots_i_ ); Molecule dm; dm.add(Atom(d)); - dm.translate_y( inter_f * dot_delta_y_i_ ); + dm.translate( inter_f * dot_delta_y_i_ , Y_AXIS); out->add_right(dm); } @@ -136,11 +136,11 @@ Note_head::brew_molecule_p() const Molecule sm; sm.add(Atom(str)); if (position_i_ % 2) - sm.translate_y(-inter_f* dir); + sm.translate(-inter_f* dir, Y_AXIS); out->add(sm); } - out->translate_y(inter_f*position_i_); + out->translate(inter_f*position_i_, Y_AXIS); return out; } diff --git a/lily/p-score.cc b/lily/p-score.cc index 661ccfeaec..3e1af5259a 100644 --- a/lily/p-score.cc +++ b/lily/p-score.cc @@ -1,5 +1,5 @@ /* - p-score.cc -- implement PScore + p-score.cc -- implement Paper_score source file of the GNU LilyPond music typesetter @@ -19,20 +19,20 @@ #include "word-wrap.hh" #include "gourlay-breaking.hh" -PScore::PScore(Paper_def*p) +Paper_score::Paper_score(Paper_def*p) { paper_l_ = p; super_elem_l_ = new Super_elem; typeset_element(super_elem_l_); } -PScore::~PScore() +Paper_score::~Paper_score() { super_elem_l_->unlink_all(); } void -PScore::typeset_element(Score_elem * elem_p) +Paper_score::typeset_element(Score_elem * elem_p) { elem_p_list_.bottom().add(elem_p); elem_p->pscore_l_ = this; @@ -41,18 +41,15 @@ PScore::typeset_element(Score_elem * elem_p) } void -PScore::typeset_item(Item *i, PCol *c, int breakstat) +Paper_score::typeset_item(Item *i, PCol *c) { assert(c && i); + int breakstat = i->break_status_i_; if (breakstat == -1) { - typeset_item(i, c->prebreak_p_); - return; - } - - if (breakstat == 1) { - typeset_item(i, c->postbreak_p_); - return; + c = c->prebreak_p_; + }else if (breakstat == 1) { + c = c->postbreak_p_; } c->add(i); @@ -60,10 +57,9 @@ PScore::typeset_item(Item *i, PCol *c, int breakstat) } void -PScore::typeset_broken_spanner(Spanner*span_p) +Paper_score::typeset_broken_spanner(Spanner*span_p) { span_p->left_col_l_->starters.bottom().add (span_p); - span_p->right_col_l_->stoppers.bottom().add(span_p); assert(span_p->left_col_l_->line_l_ == span_p->right_col_l_->line_l_); typeset_element(span_p); @@ -71,7 +67,7 @@ PScore::typeset_broken_spanner(Spanner*span_p) void -PScore::typeset_unbroken_spanner(Spanner*span_p) +Paper_score::typeset_unbroken_spanner(Spanner*span_p) { span_p_list_.bottom().add(span_p); span_p->pscore_l_=this; @@ -87,7 +83,7 @@ PScore::typeset_unbroken_spanner(Spanner*span_p) void -PScore::clean_cols() +Paper_score::clean_cols() { int rank_i = 0; for (iter_top(col_p_list_,c); c.ok(); ) @@ -100,7 +96,7 @@ PScore::clean_cols() } void -PScore::add(PCol *p) +Paper_score::add(PCol *p) { p->pscore_l_ = this; if (p->breakable_b()){ @@ -111,7 +107,7 @@ PScore::add(PCol *p) } void -PScore::output(Tex_stream &ts) +Paper_score::output(Tex_stream &ts) { ts << "\n "<< paper_l_->lookup_l()->texsetting << "%(Tex id)\n"; ts<< super_elem_l_->TeX_string(); @@ -120,21 +116,23 @@ PScore::output(Tex_stream &ts) void -PScore::OK()const +Paper_score::OK()const { #ifndef NDEBUG for (iter_top(col_p_list_,cc); cc.ok(); cc++) cc->OK(); + for (PCursor<Score_elem*> i( elem_p_list_.top()); i.ok(); i++) + i->OK(); #endif } void -PScore::print() const +Paper_score::print() const { #ifndef NPRINT if ( !check_debug) return ; - mtor << "PScore { "; + mtor << "Paper_score { "; paper_l_->print(); mtor << "\n elements: "; for (iter_top(elem_p_list_,cc); cc.ok(); cc++) @@ -151,21 +149,21 @@ PScore::print() const } void -PScore::preprocess() +Paper_score::preprocess() { super_elem_l_->breakable_col_processing(); super_elem_l_->pre_processing(); } void -PScore::postprocess() +Paper_score::postprocess() { super_elem_l_->post_processing(); super_elem_l_->molecule_processing(); } PCursor<PCol *> -PScore::find_col(PCol const *c)const +Paper_score::find_col(PCol const *c)const { PCol const *what = c; if (what->daddy_l_ ) @@ -176,7 +174,7 @@ PScore::find_col(PCol const *c)const void -PScore::set_breaking(Array<Col_hpositions> const &breaking) +Paper_score::set_breaking(Array<Col_hpositions> const &breaking) { super_elem_l_->line_of_score_l_->set_breaking( breaking); super_elem_l_->break_processing(); @@ -205,7 +203,7 @@ PScore::set_breaking(Array<Col_hpositions> const &breaking) } void -PScore::calc_breaking() +Paper_score::calc_breaking() { Break_algorithm *algorithm_p; Array<Col_hpositions> sol; @@ -217,7 +215,7 @@ PScore::calc_breaking() sol = algorithm_p->solve(); delete algorithm_p; if ( ! sol.size()) { - error ( "Can not solve this casting problem exactly; revert to Word_wrap"); + warning( "Can not solve this casting problem exactly; revert to Word_wrap"); try_wrap = true; } } @@ -231,7 +229,7 @@ PScore::calc_breaking() } void -PScore::process() +Paper_score::process() { clean_cols(); print(); @@ -241,11 +239,16 @@ PScore::process() calc_breaking(); *mlog << "\nPostprocessing elements..." << endl; postprocess(); + +#ifndef NDEBUGA + for(PCursor<Score_elem*> i(elem_p_list_.top()); i.ok(); i++) + assert (i->status() >= 9); +#endif } /** Get all breakable columns between l and r, (not counting l and r). */ Link_array<PCol> -PScore::breakable_col_range(PCol*l,PCol*r)const +Paper_score::breakable_col_range(PCol*l,PCol*r)const { Link_array<PCol> ret; @@ -264,7 +267,7 @@ PScore::breakable_col_range(PCol*l,PCol*r)const return ret; } Link_array<PCol> -PScore::col_range(PCol*l,PCol*r)const +Paper_score::col_range(PCol*l,PCol*r)const { Link_array<PCol> ret; @@ -282,7 +285,7 @@ PScore::col_range(PCol*l,PCol*r)const } Link_array<PCol> -PScore::broken_col_range(PCol*l,PCol*r)const +Paper_score::broken_col_range(PCol*l,PCol*r)const { Link_array<PCol> ret; diff --git a/lily/paper-def.cc b/lily/paper-def.cc index 4cf44b1f8d..baace2c030 100644 --- a/lily/paper-def.cc +++ b/lily/paper-def.cc @@ -51,7 +51,6 @@ Paper_def::Paper_def() itrans_p_ = 0; lookup_p_ = 0; real_vars_p_ = new Assoc<String,Real>; - outfile_str_ = "lelie.tex"; } Paper_def::~Paper_def() diff --git a/lily/parser.y b/lily/parser.y index d494a11a48..b06ca442cd 100644 --- a/lily/parser.y +++ b/lily/parser.y @@ -12,7 +12,7 @@ #include <iostream.h> // mmm -#define MUDELA_VERSION "0.1.0" +#define MUDELA_VERSION "0.1.1" #include "script-def.hh" #include "symtable.hh" @@ -77,6 +77,7 @@ Symtable * symtable; Symtables * symtables; Text_def * textdef; + Tempo_req *tempo; char c; const char *consstr; int i; @@ -100,7 +101,6 @@ yylex(YYSTYPE *s, void * v_l) %pure_parser /* tokens which are not keywords */ -%token CONCAT %token ALIAS %token BAR @@ -114,14 +114,12 @@ yylex(YYSTYPE *s, void * v_l) %token DURATIONCOMMAND %token ABSDYNAMIC %token END -%token GEOMETRIC %token GROUPING %token GROUP %token REQUESTTRANSLATOR %token HSHIFT %token IN_T %token ID -%token INIT_END %token LYRIC %token KEY %token MELODIC @@ -130,7 +128,6 @@ yylex(YYSTYPE *s, void * v_l) %token METER %token MM_T %token MULTI -%token NOTE %token NOTENAMES %token OCTAVECOMMAND %token OUTPUT @@ -152,8 +149,6 @@ yylex(YYSTYPE *s, void * v_l) %token TEXID %token TEXTSTYLE %token TITLE -%token UNITSPACE -%token WIDTH %token VERSION /* escaped */ @@ -168,7 +163,7 @@ yylex(YYSTYPE *s, void * v_l) %token <id> VOICE_IDENTIFIER %token <id> POST_REQUEST_IDENTIFIER %token <id> SCRIPT_IDENTIFIER -%token <id> STAFF_IDENTIFIER +%token <id> COMMAND_IDENTIFIER %token <id> REAL_IDENTIFIER %token <id> INPUT_TRANS_IDENTIFIER %token <id> INT_IDENTIFIER @@ -190,7 +185,7 @@ yylex(YYSTYPE *s, void * v_l) %type <i> int %type <i> script_dir %type <id> declaration -%type <duration> explicit_duration notemode_duration +%type <duration> explicit_duration notemode_duration entered_notemode_duration %type <interval> dinterval %type <intvec> intastint_list %type <lookup> symtables symtables_body @@ -217,6 +212,7 @@ yylex(YYSTYPE *s, void * v_l) %type <symbol> symboldef %type <symtable> symtable symtable_body %type <itrans> input_translator_spec input_translator_spec_body +%type <tempo> tempo_request %left PRIORITY @@ -461,15 +457,16 @@ midi_block: '{' midi_body '}' { $$ = $3; } ; -midi_body: /* empty */ { - $$ = THIS->default_midi(); // midi / audio / perform +midi_body: /* empty */ { + $$ = THIS->default_midi(); } | midi_body OUTPUT STRING ';' { $$->outfile_str_ = *$3; delete $3; } - | midi_body TEMPO notemode_duration ':' int ';' { - $$->set_tempo( $3->length(), $5 ); + | midi_body tempo_request ';' { + $$->set_tempo( $2->dur_.length(), $2->metronome_i_ ); + delete $2; } | midi_body input_translator_spec { $$->set( $2 ); @@ -479,6 +476,15 @@ midi_body: /* empty */ { } ; +tempo_request: + TEMPO entered_notemode_duration '=' int { + $$ = new Tempo_req; + $$->dur_ = *$2; + delete $2; + $$-> metronome_i_ = $4; + } + ; + /* MUSIC */ @@ -562,33 +568,23 @@ full_element: THIS->add_requests((Chord*)$2);//ugh $$ = $2; } + | command_elt | voice_command ';' { $$ = 0; } ; simple_element: music_elt | lyrics_elt - | command_elt ; command_elt: -/* empty */ { + command_req { $$ = new Request_chord; $$-> set_spot( THIS->here_input()); - } -/* cont: */ - command_req { - $2-> set_spot( THIS->here_input()); - ((Chord*)$$) ->add($2);//ugh + $1-> set_spot( THIS->here_input()); + ((Chord*)$$) ->add($1);//ugh } - | GROUP STRING ';' { // ugh ugh ugh - Change_reg *chr_p = new Change_reg; - $$ = chr_p; - chr_p-> type_str_ = "Voice_group_engravers"; //ugh - chr_p-> id_str_ = *$2; - delete $2; - } ; command_req: @@ -600,6 +596,9 @@ abbrev_command_req: '|' { $$ = new Barcheck_req; } + | COMMAND_IDENTIFIER { + $$ = $1->request(true); + } ; verbose_command_req: @@ -620,13 +619,15 @@ verbose_command_req: } | SKIP duration_length { Skip_req * skip_p = new Skip_req; - skip_p->duration_ = Duration(1,0); skip_p->duration_.set_plet($2->numerator().as_long(), $2->denominator().as_long()); delete $2; $$ = skip_p; } + | tempo_request { + $$ = $1; + } | CADENZA int { $$ = new Cadenza_req($2); } @@ -653,7 +654,6 @@ verbose_command_req: | GROUPING intastint_list { $$ = get_grouping_req(*$2); delete $2; } - ; post_requests: @@ -735,7 +735,8 @@ dynamic_req: close_plet_parens: ']' INT '/' INT { $$ = ']'; - THIS->default_duration_.set_plet($2,$4); + THIS->plet_.type_i_ = $4; + THIS->plet_.iso_i_ = $2; } ; @@ -763,7 +764,8 @@ close_request_parens: open_plet_parens: '[' INT '/' INT { $$ = '['; - THIS->default_duration_.set_plet($2,$4); + THIS->plet_.type_i_ = $4; + THIS->plet_.iso_i_ = $2; } ; @@ -872,7 +874,7 @@ voice_command: THIS->set_duration_mode(*$2); delete $2; } - | DURATIONCOMMAND notemode_duration { + | DURATIONCOMMAND entered_notemode_duration { THIS->set_default_duration($2); delete $2; } @@ -910,12 +912,12 @@ dots: | dots '.' { $$ ++; } ; -notemode_duration: +entered_notemode_duration: /* */ { $$ = new Duration(THIS->default_duration_); } | dots { - $$ = new Duration(THIS->default_duration_); + $$ = new Duration(THIS->default_duration_); $$->dots_i_ = $1; } | explicit_duration { @@ -924,6 +926,14 @@ notemode_duration: } ; +notemode_duration: + entered_notemode_duration { + $$ = $1; + $$->plet_.type_i_ *= THIS->plet_.type_i_; + $$->plet_.iso_i_ *= THIS->plet_.iso_i_; + } + ; + explicit_duration: int { $$ = new Duration; @@ -931,7 +941,6 @@ explicit_duration: THIS->parser_error("Not a duration"); else { $$->type_i_ = $1; - $$->set_plet(THIS->default_duration_); } } | explicit_duration '.' { diff --git a/lily/performer-group-performer.cc b/lily/performer-group-performer.cc index f465139920..b697dca1a6 100644 --- a/lily/performer-group-performer.cc +++ b/lily/performer-group-performer.cc @@ -12,15 +12,11 @@ #include "debug.hh" IMPLEMENT_IS_TYPE_B2(Performer_group_performer,Performer, Translator); - ADD_THIS_PERFORMER(Performer_group_performer); -Performer_group_performer::Performer_group_performer() -{ -} - Performer_group_performer::~Performer_group_performer() { + } void @@ -51,6 +47,42 @@ Performer_group_performer::depth_i() const return daddy_perf_l_->depth_i() + 1; } +void +Performer_group_performer::do_creation_processing() +{ + for ( PCursor<Performer*> i( perf_p_list_.top() ); i.ok(); i++ ) + i->creation_processing(); +} + +void +Performer_group_performer::do_print()const +{ +#ifndef NPRINT + if ( !check_debug) + return ; + for ( PCursor<Performer*> i( perf_p_list_.top() ); i.ok(); i++ ) + i->print(); +#endif +} + +void +Performer_group_performer::do_removal_processing() +{ + for ( PCursor<Performer*> i( perf_p_list_.top() ); i.ok(); i++ ) + i->do_removal_processing(); +} + +bool +Performer_group_performer::do_try_request( Request* req_l ) +{ + bool hebbes_b =false; + for (int i =0; !hebbes_b && i < nongroup_l_arr_.size() ; i++) + hebbes_b =nongroup_l_arr_[i]->try_request(req_l); + if ( !hebbes_b && daddy_perf_l_ ) + hebbes_b = daddy_perf_l_->try_request(req_l); + return hebbes_b ; +} + Translator* Performer_group_performer::find_get_translator_l( String n,String id ) { @@ -109,83 +141,27 @@ Performer_group_performer::get_default_interpreter() return perf_p->get_default_interpreter(); } -Moment -Performer_group_performer::get_mom() const -{ - Moment mom = Performer::get_mom(); - - for ( int i = 0; i < nongroup_l_arr_.size(); i++ ) - nongroup_l_arr_[ i ]->set( mom ); - - return mom; -} - bool Performer_group_performer::is_bottom_performer_b() const { return !itrans_l_->get_default_itrans_l(); } - -void -Performer_group_performer::process_requests() -{ - for ( PCursor<Performer*> i( perf_p_list_.top() ); i.ok(); i++ ) - i->process_requests(); -} - -//<ugh> -int -Performer_group_performer::get_track_i() const -{ - int track_i = Performer::get_track_i(); - - for ( int i = 0; i < nongroup_l_arr_.size(); i++ ) - nongroup_l_arr_[ i ]->set_track( track_i ); - - return track_i; -} - -void -Performer_group_performer::set_track( int& track_i_r ) -{ - for ( PCursor<Performer*> i( perf_p_list_.top() ); i.ok(); i++ ) - i->set_track( track_i_r ); -} -//</ugh> - -bool -Performer_group_performer::do_try_request( Request* req_l ) -{ - bool hebbes_b =false; - for (int i =0; !hebbes_b && i < nongroup_l_arr_.size() ; i++) - hebbes_b =nongroup_l_arr_[i]->try_request(req_l); - if ( !hebbes_b && daddy_perf_l_ ) - hebbes_b = daddy_perf_l_->try_request(req_l); - return hebbes_b ; -} - void -Performer_group_performer::do_print()const -{ -#ifndef NPRINT - if ( !check_debug) - return ; - for ( PCursor<Performer*> i( perf_p_list_.top() ); i.ok(); i++ ) - i->print(); -#endif +Performer_group_performer::print() const +{ + Performer::print(); } void -Performer_group_performer::do_creation_processing() +Performer_group_performer::process_requests() { for ( PCursor<Performer*> i( perf_p_list_.top() ); i.ok(); i++ ) - i->creation_processing(); + i->process_requests(); } -void -Performer_group_performer::do_removal_processing() +bool +Performer_group_performer::try_request( Request* r ) { - for ( PCursor<Performer*> i( perf_p_list_.top() ); i.ok(); i++ ) - i->do_removal_processing(); + return Performer::try_request( r ); } diff --git a/lily/performer.cc b/lily/performer.cc index 246fc603e2..c1d84ca83b 100644 --- a/lily/performer.cc +++ b/lily/performer.cc @@ -29,24 +29,12 @@ Performer::do_print() const { } -Moment -Performer::get_mom() const -{ - return daddy_perf_l_->get_mom(); -} - void -Performer::play( Audio_item* p ) +Performer::play( Audio_element* p ) { daddy_perf_l_->play( p ); } -void -Performer::play( Midi_item* l ) -{ - daddy_perf_l_->play( l ); -} - int Performer::get_tempo_i()const { @@ -68,24 +56,6 @@ Performer::process_requests() { } -void -Performer::set( Moment ) -{ -} - -//<ugh> -int -Performer::get_track_i() const -{ - return daddy_perf_l_->get_track_i(); -} - -void -Performer::set_track( int& ) -{ -} -//</ugh> - bool Performer::do_try_request( Request* req_l ) { @@ -105,17 +75,11 @@ void Performer::creation_processing() { if (!init_b_) { -/* if ( daddy_perf_l_ ) { - init_b_ = true; // ugh. avoid recursion - daddy_perf_l_->creation_processing(); - init_b_ = false; - } - - */ do_creation_processing(); init_b_ = true; } } + void Performer::do_creation_processing() { diff --git a/lily/request.cc b/lily/request.cc index 15a90ca6e3..36589b6455 100644 --- a/lily/request.cc +++ b/lily/request.cc @@ -23,3 +23,21 @@ Request::time_int() const return MInterval(0, duration()); } + +bool +Request::equal_b(Request *r)const +{ + if ( is_type_b ( r->name() ) ) + return r->do_equal_b( (Request*)this ); + if ( r->is_type_b( name ())) + return do_equal_b( r ); + + return false; +} + +bool +Request::do_equal_b(Request*)const +{ + return false; +} + diff --git a/lily/rest-collision-grav.cc b/lily/rest-collision-grav.cc index 29fdac1a3d..bf18c12e1a 100644 --- a/lily/rest-collision-grav.cc +++ b/lily/rest-collision-grav.cc @@ -31,8 +31,10 @@ Rest_collision_engraver::acknowledge_element(Score_elem_info i) } else if (nC == Note_column::static_name()) { // what should i do, what should _engraver do? - if (!rest_collision_p_) + if (!rest_collision_p_) { rest_collision_p_ = new Rest_collision; + announce_element(Score_elem_info(rest_collision_p_, 0)); + } rest_collision_p_->add((Note_column*)i.elem_l_->item()); } else if (nC == Rest_column::static_name()) { diff --git a/lily/score-align-grav.cc b/lily/score-align-grav.cc index babf47bd32..9660c144ed 100644 --- a/lily/score-align-grav.cc +++ b/lily/score-align-grav.cc @@ -22,7 +22,7 @@ void Score_align_engraver::do_pre_move_processing() { if (align_p_) { - typeset_breakable_item( align_p_); + typeset_element( align_p_); align_p_ =0; } } @@ -34,10 +34,13 @@ Score_align_engraver::acknowledge_element(Score_elem_info inf) if (!align_p_ ) { align_p_ = new Horizontal_group_item; + align_p_->breakable_b_ = true; announce_element(Score_elem_info(align_p_,0)); } - - align_p_->add_element(inf.elem_l_); + Score_elem * unbound_elem = inf.elem_l_; + while ( unbound_elem->axis_group_l_a_[X_AXIS] ) + unbound_elem = unbound_elem->axis_group_l_a_[X_AXIS]; + align_p_->add_element(unbound_elem ); } } diff --git a/lily/score-elem.cc b/lily/score-elem.cc index 3e945a5e2b..c80314ef4a 100644 --- a/lily/score-elem.cc +++ b/lily/score-elem.cc @@ -5,7 +5,9 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ - +/* + too big. Should split. + */ #include "p-score.hh" #include "paper-def.hh" #include "lookup.hh" @@ -44,16 +46,16 @@ Score_elem::dependent_size() const } + String -Score_elem::TeX_string() const +Score_elem::TeX_string_without_offset(Offset o)const { - assert( status_ > POSTCALCED); if (transparent_b_ ) return ""; String s( "\\placebox{%}{%}{%}"); Array<String> a; - a.push(print_dimen(offset_.y)); - a.push(print_dimen(offset_.x)); + a.push( print_dimen(o.y() )); + a.push( print_dimen(o.x() )); String t = output->TeX_string(); if (t == "") return t; @@ -64,7 +66,13 @@ Score_elem::TeX_string() const r = String("\n%start: ") + name() + "\n"; r += substitute_args(s, a);; return r; - +} + +String +Score_elem::TeX_string() const +{ + assert( status_ > POSTCALCED); + return TeX_string_without_offset(offset_); } void @@ -81,8 +89,7 @@ Score_elem::Score_elem(Score_elem const&s) { transparent_b_ = s.transparent_b_; empty_b_ = s.empty_b_; - x_group_l_ = 0; - y_group_l_ = 0; + axis_group_l_a_[0] = axis_group_l_a_[1] =0; status_ = s.status_; assert(!s.output); output = 0; @@ -100,26 +107,69 @@ Score_elem::~Score_elem() } -void -Score_elem::translate_x(Real x) +/* + GEOMETRY + */ +Real +Score_elem::absolute_coordinate(Axis a)const { - offset_.x += x; + Real r = offset_[a]; + for ( Axis_group_element * axis_group_l = axis_group_l_a_[a]; + axis_group_l; axis_group_l = axis_group_l->axis_group_l_a_[a]) + + r += axis_group_l->offset_[a]; + return r; } + +Offset +Score_elem::absolute_offset() const +{ + return Offset(absolute_coordinate(X_AXIS), absolute_coordinate(Y_AXIS)); +} + void +Score_elem::translate(Real y, Axis a) +{ + offset_[a] += y; +} -void -Score_elem::translate_y(Real y) +Real +Score_elem::relative_coordinate(Axis_group_element*e, Axis a)const { - offset_.y += y; + Real r =0.0; + for ( Axis_group_element * axis_group_l = axis_group_l_a_[a]; + axis_group_l != e; + axis_group_l = axis_group_l->axis_group_l_a_[a]) + r += axis_group_l->offset_[a]; + + return r; } +Axis_group_element* +Score_elem::common_group(Score_elem const* s, Axis a)const +{ + Link_array<Axis_group_element> my_groups; + for ( Axis_group_element * axis_group_l = axis_group_l_a_[a]; + axis_group_l; + axis_group_l = axis_group_l->axis_group_l_a_[a]) + my_groups.push( axis_group_l ); + + Axis_group_element* common_l=0; + for ( Axis_group_element * axis_group_l = s->axis_group_l_a_[a]; + !common_l && axis_group_l; + axis_group_l = axis_group_l->axis_group_l_a_[a]) + common_l = my_groups.find_l( axis_group_l ); + + return common_l; +} + + void Score_elem::translate(Offset O) { - translate_y(O.y); - translate_x(O.x); + offset_ += O; } Interval @@ -129,20 +179,30 @@ Score_elem::do_width() const if (!output){ Molecule*m = brew_molecule_p(); - r = m->extent().x; + r = m->extent().x(); delete m; } else - r = output->extent().x; + r = output->extent().x(); return r; } Interval Score_elem::width() const { - Interval r=(empty_b_)?Interval(0,0):do_width(); + return extent( X_AXIS); +} +Interval +Score_elem::extent(Axis a)const +{ + Interval r; + if ( !empty_b_ ) { + + r = (a == X_AXIS)? do_width(): do_height(); + } + if (!r.empty_b()) // float exception on DEC Alpha - r+=offset_.x; + r+=offset_[a]; return r; } @@ -153,25 +213,22 @@ Score_elem::do_height() const Interval r; if (!output){ Molecule*m = brew_molecule_p(); - r = m->extent().y; + r = m->extent().y(); delete m; } else - r = output->extent().y; + r = output->extent().y(); return r; } Interval Score_elem::height() const { - Interval r=(empty_b_)?Interval(0,0): do_height(); - - if (!r.empty_b()) - r+=offset_.y; - - - return r; + return extent(Y_AXIS); } +/* + STANDARD METHS + */ void Score_elem::print()const { @@ -179,8 +236,8 @@ Score_elem::print()const mtor << name() << "{\n"; mtor << "dets: " << dependent_size() << "dependencies: " << dependency_size(); - if (offset_.x || offset_.y) - mtor << "offset (" << offset_.x << ", " << offset_.y <<")"; + if (offset_.x() || offset_.y()) + mtor << "offset (" << offset_.x() << ", " << offset_.y() <<")"; mtor << "\n"; do_print(); @@ -191,13 +248,10 @@ Score_elem::print()const #endif } - - Score_elem::Score_elem() { transparent_b_ = empty_b_ = false; - x_group_l_ = 0; - y_group_l_ =0; + axis_group_l_a_[0] = axis_group_l_a_[1] =0; pscore_l_=0; offset_ = Offset(0,0); output = 0; @@ -233,6 +287,9 @@ Score_elem::pre_processing() for (int i=0; i < dependency_size(); i++) dependency(i)->pre_processing(); + Link_array<Score_elem> extra(get_extra_dependencies()); + for (int i=0; i < extra.size(); i++) + extra[i]->pre_processing(); do_pre_processing(); status_ = PRECALCED; @@ -253,7 +310,11 @@ Score_elem::breakable_col_processing() for (int i=0; i < dependency_size(); i++) dependency(i)->breakable_col_processing(); + Link_array<Score_elem> extra(get_extra_dependencies()); + for (int i=0; i < extra.size(); i++) + extra[i]->breakable_col_processing(); + do_breakable_col_processing(); status_ = PREBROKEN; } @@ -273,6 +334,11 @@ Score_elem::break_processing() for (int i=0; i < dependency_size(); i++) dependency(i)->break_processing(); + Link_array<Score_elem> extra(get_extra_dependencies()); + for (int i=0; i < extra.size(); i++) + extra[i]->break_processing(); + + do_break_processing(); status_ = BROKEN; @@ -297,6 +363,12 @@ Score_elem::post_processing() for (int i=0; i < dependency_size(); i++) dependency(i)->post_processing(); + + Link_array<Score_elem> extra(get_extra_dependencies()); + for (int i=0; i < extra.size(); i++) + extra[i]->post_processing(); + + do_post_processing(); status_=POSTCALCED; } @@ -317,11 +389,21 @@ Score_elem::molecule_processing() for (int i=0; i < dependency_size(); i++) dependency(i)->molecule_processing(); + Link_array<Score_elem> extra(get_extra_dependencies()); + for (int i=0; i < extra.size(); i++) + extra[i]->molecule_processing(); + + if (transparent_b_) return ; output= brew_molecule_p(); } +/* + + VIRTUAL STUBS + + */ void Score_elem::do_post_processing() { @@ -341,7 +423,6 @@ Score_elem::do_pre_processing() void Score_elem::do_add_processing() { - } void @@ -349,16 +430,13 @@ Score_elem::do_substitute_dependency(Score_elem*,Score_elem*) { } void -Score_elem::do_substitute_dependent(Score_elem*o,Score_elem*n) +Score_elem::do_substitute_dependent(Score_elem*,Score_elem*) { - if ( o== y_group_l_ ) { - y_group_l_ = n ? n->vertical_group() : 0; - } else if (o == x_group_l_ ) { - x_group_l_ = n ? n->horizontal_group() : 0; - } } - +void +Score_elem::do_unlink() +{} IMPLEMENT_IS_TYPE_B(Score_elem); @@ -368,11 +446,7 @@ Score_elem::brew_molecule_p()const Atom a(paper()->lookup_l()->fill(Box(Interval(0,0), Interval(0,0)))); return new Molecule (a); } -Offset -Score_elem::offset() const -{ - return offset_; -} + Line_of_score * Score_elem::line_l()const @@ -381,8 +455,10 @@ Score_elem::line_l()const } /* + DEPENDENCIES - */ + + */ void Score_elem::remove_dependency(Score_elem*e) @@ -437,7 +513,6 @@ Score_elem::handle_broken_dependencies() } remove_us_arr.push(elt); } - } remove_us_arr.default_sort(); @@ -445,6 +520,7 @@ Score_elem::handle_broken_dependencies() for (int i=0; i <remove_us_arr.size(); i++) remove_dependency(remove_us_arr[i]); + status_ = BROKEN; } /* @@ -463,31 +539,32 @@ Score_elem::handle_broken_dependencies() void Score_elem::handle_prebroken_dependencies() { - Link_array<Score_elem> remove_us_arr; + Link_array<Score_elem> old_arr, new_arr; + for (int i=0; i < dependency_size(); i++) { Score_elem * elt = dependency(i); Item *it_l = elt->item(); - if (it_l && it_l->pcol_l_->breakable_b()) + if (it_l && it_l->breakable_b_) if (item()) { Score_elem *new_l = it_l->find_prebroken_piece(item()->pcol_l_); if (new_l != elt ) { - do_substitute_dependency( elt, new_l); - remove_us_arr.push(elt); - - add_dependency(new_l); + new_arr.push (new_l); + old_arr.push(elt); } }else { - add_dependency(it_l->broken_to_a_[0]); - add_dependency(it_l->broken_to_a_[1]); + new_arr.push(it_l->broken_to_a_[0]); + old_arr.push(0); + old_arr.push(0); + new_arr.push(it_l->broken_to_a_[1]); } - } - remove_us_arr.default_sort(); - remove_us_arr.uniq(); - for (int i=0; i <remove_us_arr.size(); i++) - remove_dependency(remove_us_arr[i]); - + for (int i=0; i < old_arr.size(); i++) + if (old_arr[i]) + substitute_dependency( old_arr[i], new_arr[i] ); + + + status_ = PREBROKEN; } @@ -497,14 +574,18 @@ Score_elem::unlink_all() { for (int i=0; i < dependency_size(); i++) dependency(i)->unlink_all(); + Link_array<Score_elem> extra(get_extra_dependencies()); + for (int i=0; i < extra.size(); i++) + extra[i]->unlink_all(); + junk_links(); - y_group_l_ = 0; - x_group_l_ = 0; + axis_group_l_a_[0] = axis_group_l_a_[1] =0; } void Score_elem::unlink() { + do_unlink(); while ( dependency_size()) { do_substitute_dependency(dependency(0),0); remove_edge_out_idx(0); @@ -512,9 +593,11 @@ Score_elem::unlink() while ( dependent_size() ) { dependent(0)->remove_dependency(this); } -} - + for (int j=0; j < 2; j++) + if ( axis_group_l_a_[j]) + axis_group_l_a_[j]->remove_element(this); +} void Score_elem::OK()const @@ -525,3 +608,10 @@ Score_elem::OK()const } #endif } + +Link_array<Score_elem> +Score_elem::get_extra_dependencies()const +{ + Link_array<Score_elem> empty; + return empty; +} diff --git a/lily/score-grav.cc b/lily/score-grav.cc index 8c31c827c7..0b40a875df 100644 --- a/lily/score-grav.cc +++ b/lily/score-grav.cc @@ -5,12 +5,12 @@ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> */ + #include "super-elem.hh" #include "scoreline.hh" #include "debug.hh" #include "score-elem.hh" #include "bar.hh" // needed for Bar::static_name -#include "staffline.hh" #include "score-grav.hh" #include "p-col.hh" #include "p-score.hh" @@ -40,14 +40,9 @@ Score_engraver::Score_engraver() void Score_engraver::prepare(Moment w) { - command_column_l_ = new Score_column(w); - musical_column_l_ = new Score_column(w); + set_columns(new Score_column(w), new Score_column(w)); - command_column_l_->musical_b_ = false; - musical_column_l_->musical_b_ = true; - score_l_->pscore_p_->add(command_column_l_); - score_l_->pscore_p_->add(musical_column_l_); disallow_break_b_ = false; post_move_processing(); } @@ -59,7 +54,7 @@ Score_engraver::finish() *mlog << "[" << breaks_i_ << "]" << flush; check_removal(); - do_removal_processing(); + removal_processing(); } void @@ -77,6 +72,7 @@ Score_engraver::do_removal_processing() scoreline_l_->right_col_l_ = get_staff_info().command_pcol_l(); scoreline_l_->right_col_l_ ->set_breakable(); typeset_all(); + set_columns(0,0); } void @@ -125,28 +121,25 @@ Score_engraver::do_announces() void Score_engraver::typeset_element(Score_elem *elem_p) { - musical_item_p_arr_.push(elem_p); -} - -void -Score_engraver::typeset_breakable_item(Item * nobreak_p) -{ - if (nobreak_p) { - nobreak_item_p_arr_.push(nobreak_p); - } + if ( elem_p->item() && elem_p->item()->breakable_b_ ) { + nobreak_item_p_arr_.push(elem_p->item()); + } else + musical_item_p_arr_.push(elem_p); } void Score_engraver::typeset_all() { PCol * c= get_staff_info().command_pcol_l(); - PScore *ps_l = score_l_->pscore_p_; + Paper_score *ps_l = score_l_->pscore_p_; for (int i =0; i < nobreak_item_p_arr_.size(); i++) { - ps_l->typeset_item(nobreak_item_p_arr_[i], c, 0); + ps_l->typeset_item(nobreak_item_p_arr_[i], c); + + // should get rid of this.. . scoreline_l_->add_dependency(nobreak_item_p_arr_[i]); } - nobreak_item_p_arr_.set_size(0); + nobreak_item_p_arr_.clear(); for (int i=0; i < musical_item_p_arr_.size(); i++) { PCol* m = get_staff_info().musical_pcol_l(); @@ -156,11 +149,11 @@ Score_engraver::typeset_all() if (elem_p->spanner()) { ps_l->typeset_unbroken_spanner(elem_p->spanner()); } else if (elem_p->item()) { - ps_l->typeset_item(elem_p->item(), m, 0); + ps_l->typeset_item(elem_p->item(), m); } else assert(false); } - musical_item_p_arr_.set_size(0); + musical_item_p_arr_.clear(); } @@ -179,6 +172,33 @@ Score_engraver::do_pre_move_processing() typeset_all(); } +void +Score_engraver::set_columns(Score_column *new_command_l, + Score_column *new_musical_l) +{ + if ( command_column_l_ && command_column_l_->used_b() ) + score_l_->pscore_p_->add(command_column_l_); + else { + delete command_column_l_ ; + command_column_l_ =0; + } + if (new_command_l) { + command_column_l_ = new_command_l; + command_column_l_->musical_b_ = false; + } + if ( musical_column_l_ && musical_column_l_->used_b()) + score_l_->pscore_p_->add (musical_column_l_); + else { + delete musical_column_l_; + musical_column_l_ = 0; + } + + if (new_musical_l) { + musical_column_l_ = new_musical_l; + musical_column_l_->musical_b_ = true; + } +} + Staff_info Score_engraver::get_staff_info()const @@ -208,6 +228,5 @@ Score_engraver::do_try_request(Request*r) } IMPLEMENT_IS_TYPE_B1(Score_engraver,Engraver_group_engraver); - ADD_THIS_ENGRAVER(Score_engraver); diff --git a/lily/score-halign-grav.cc b/lily/score-halign-grav.cc index 243b8622f9..3d5293ee26 100644 --- a/lily/score-halign-grav.cc +++ b/lily/score-halign-grav.cc @@ -20,7 +20,7 @@ void Score_horizontal_align_engraver::do_pre_move_processing() { if (halign_p_) { - typeset_breakable_item(halign_p_); + typeset_element(halign_p_); halign_p_ =0; } @@ -36,6 +36,7 @@ Score_horizontal_align_engraver::acknowledge_element(Score_elem_info i) Score_align_engraver * align_grav_l = (Score_align_engraver*) reg; if (!halign_p_) { halign_p_ = new Break_align_item; + halign_p_->breakable_b_ = true; announce_element(Score_elem_info(halign_p_,0)); } Item * it = i.elem_l_->item(); diff --git a/lily/score-performer.cc b/lily/score-performer.cc index bb05c0f16a..ea27d507b8 100644 --- a/lily/score-performer.cc +++ b/lily/score-performer.cc @@ -2,165 +2,103 @@ score-performer.cc -- implement Score_performer source file of the GNU LilyPond music typesetter - + (c) 1996, 1997 Jan Nieuwenhuizen <jan@digicash.com> */ -#include <time.h> #include "score-performer.hh" #include "input-translator.hh" #include "midi-def.hh" -#include "audio-item.hh" #include "audio-column.hh" +#include "audio-item.hh" #include "audio-score.hh" -#include "midi-item.hh" #include "midi-stream.hh" #include "string-convert.hh" #include "debug.hh" -#include "main.hh" #include "score.hh" #include "source-file.hh" #include "source.hh" +#include "audio-staff.hh" IMPLEMENT_IS_TYPE_B1(Score_performer,Performer_group_performer); + ADD_THIS_PERFORMER(Score_performer); + Score_performer::Score_performer() { - midi_l_ = 0; } + Score_performer::~Score_performer() { } + Translator* -Score_performer::ancestor_l( int l ) +Score_performer::ancestor_l(int l) { - return Global_translator::ancestor_l( l ); + return Global_translator::ancestor_l(l); } + int Score_performer::depth_i() const { return Global_translator::depth_i(); } + void Score_performer::finish() { Performer_group_performer::do_removal_processing(); - - - Midi_stream output_stream( midi_l_->outfile_str_, midi_item_l_arr_.size() + 1, 384 ); - *mlog << "MIDI output to " << midi_l_->outfile_str_ << " ..." << endl; - - header( output_stream); -// int track_i = 1; - for (int i=0; i< midi_item_l_arr_.size(); i++) { - Midi_item * it_p = midi_item_l_arr_[i]; - -// if ( it_p->is_type_b( Midi_track::static_name())) -// ((Midi_track*)it_p )->number_i_ = track_i ++; - output_stream<< *it_p; - } - *output_stream.os_p_ << flush; - *mlog << endl; } -void -Score_performer::play( Audio_item* l ) -{ - l->audio_column_l_ = audio_column_l_; - audio_column_l_->add( l ); -} void -Score_performer::play( Midi_item* l ) +Score_performer::play(Audio_element * p) { - midi_item_l_arr_.push( l ); -} - -Moment -Score_performer::get_mom() const -{ - return now_mom_; + if (p->is_type_b(Audio_item::static_name())) { + audio_column_l_->add( (Audio_item*)p); + } else if (p->is_type_b(Audio_staff::static_name())) { + score_l_->audio_score_p_->add_staff( (Audio_staff*)p ); + } + score_l_->audio_score_p_->add(p); } -void -Score_performer::header(Midi_stream &output_stream) -{ - Midi_track midi_track; - - time_t t = time( 0 ); - - // perhaps multiple text events? - String str = String( "Creator: " ) + get_version_str() + "\n"; - - Midi_text creator( Midi_text::TEXT, str ); - midi_track.add( Moment( 0 ), &creator ); - - str = "Automatically generated at "; - str += ctime( &t ); - str = str.left_str( str.length_i() - 1 ); - str += "\n"; - Midi_text generate( Midi_text::TEXT, str ); - midi_track.add( Moment( 0 ), &generate ); - - str = "from musical definition: "; - - str += score_l_->location_str(); - Midi_text from( Midi_text::TEXT, str ); - midi_track.add( Moment( 0 ), &from ); - - Midi_text track_name( Midi_text::TRACK_NAME, "Track " - + String_convert::i2dec_str( 0, 0, '0' ) ); - midi_track.add( Moment( 0 ), &track_name ); - - Midi_tempo tempo ( get_tempo_i() ); - midi_track.add( Moment(0), &tempo); - - output_stream << midi_track; -} void -Score_performer::prepare( Moment m ) +Score_performer::prepare(Moment m) { now_mom_ = m; - audio_column_l_ = new Audio_column( m ); - - score_l_->audio_score_p_->add( audio_column_l_ ); + audio_column_l_ = new Audio_column(m); + score_l_->audio_score_p_->add(audio_column_l_); } + void Score_performer::process() { process_requests(); - prev_mom_ = now_mom_; } + void -Score_performer::set_score(Score* score_l ) +Score_performer::set_score(Score* score_l) { - Global_translator::set_score( score_l ); - midi_l_ = score_l->midi_p_; + Global_translator::set_score(score_l); } + void Score_performer::start() { - //<ugh> - int track_i = 1; - Performer_group_performer::set_track( track_i ); - //</ugh> - - if ( midi_l_->outfile_str_ == "" ) - midi_l_->outfile_str_ = default_out_fn + ".midi"; } int Score_performer::get_tempo_i()const { - return midi_l_->get_tempo_i(Moment( 1, 4 )); + return score_l_->midi_p_->get_tempo_i(Moment(1, 4)); } diff --git a/lily/score.cc b/lily/score.cc index 729df8e020..53208cebc7 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -15,8 +15,8 @@ #include "main.hh" #include "source.hh" #include "source-file.hh" -#include "midi-output.hh" #include "midi-def.hh" +#include "midi-stream.hh" #include "audio-score.hh" #include "p-col.hh" #include "music-iterator.hh" @@ -59,11 +59,20 @@ Score::run_translator(Global_translator * trans_l) trans_l); iter->construct_children(); + if ( ! iter->ok() ) { + delete iter; + warning ("Need music in a score"); + errorlevel_i_ =1; + return ; + } + trans_l->start(); + while ( iter->ok() || trans_l->moments_left_i() ) { Moment w = infinity_mom; if (iter->ok() ) { w = iter->next_moment(); + mtor << w; iter->print(); } trans_l->modify_next( w ); @@ -92,7 +101,7 @@ Score::midi() return; *mlog << "\nCreating MIDI elements ..." << flush; - audio_score_p_ = new Audio_score( midi_p_ ); + audio_score_p_ = new Audio_score( this ); Global_translator* score_trans= midi_p_->get_global_translator_p(); run_translator( score_trans ); @@ -104,6 +113,8 @@ Score::midi() // return; } *mlog << endl; + + midi_output(); } void @@ -113,7 +124,7 @@ Score::paper() return; *mlog << "\nCreating elements ..." << flush; - pscore_p_ = new PScore(paper_p_); + pscore_p_ = new Paper_score(paper_p_); Global_translator * score_trans= paper_p_->get_global_translator_p(); run_translator( score_trans ); @@ -125,7 +136,6 @@ Score::paper() // return; } - // debugging *mlog << endl; pscore_p_->process(); @@ -133,41 +143,24 @@ Score::paper() paper_output(); } - void -Score::set(Paper_def *pap_p) +Score::midi_output() { - delete paper_p_; - paper_p_ = pap_p; -} - -void -Score::set(Midi_def* midi_p) -{ - delete midi_p_; - midi_p_ = midi_p; -} - + if ( midi_p_->outfile_str_ == "" ) + midi_p_->outfile_str_ = default_out_fn + ".midi"; + Midi_stream midi_stream( midi_p_->outfile_str_ ); + *mlog << "MIDI output to " << midi_p_->outfile_str_ << " ..." << endl; -void -Score::print() const -{ -#ifndef NPRINT - mtor << "score {\n"; - music_p_->print(); - if (midi_p_) - midi_p_->print(); - - mtor << "}\n"; -#endif + audio_score_p_->output( midi_stream ); + *mlog << endl; } void Score::paper_output() { if (paper_p_->outfile_str_=="") - paper_p_->outfile_str_ = default_out_fn + ".out"; + paper_p_->outfile_str_ = default_out_fn + ".tex"; if ( errorlevel_i_ ) { *mlog << "lilypond: warning: no output to: " << paper_p_->outfile_str_ @@ -182,21 +175,32 @@ Score::paper_output() the_output << "% outputting Score, defined at: " << location_str() << "\n"; pscore_p_->output(the_output); - } void -Score::midi_output() +Score::print() const { -#if 0 - if (!midi_p_) - return; - - if (midi_p_->outfile_str_ == "") - midi_p_->outfile_str_ = default_out_fn + ".midi"; +#ifndef NPRINT + mtor << "score {\n"; + music_p_->print(); + if (midi_p_) + midi_p_->print(); - *mlog << "midi output to " << midi_p_->outfile_str_ << " ...\n"; - Midi_output(this, midi_p_); + mtor << "}\n"; #endif } +void +Score::set(Paper_def *pap_p) +{ + delete paper_p_; + paper_p_ = pap_p; +} + +void +Score::set(Midi_def* midi_p) +{ + delete midi_p_; + midi_p_ = midi_p; +} + diff --git a/lily/scoreline.cc b/lily/scoreline.cc index d4951dbb83..2cf31bcbed 100644 --- a/lily/scoreline.cc +++ b/lily/scoreline.cc @@ -7,7 +7,6 @@ */ #include "scoreline.hh" -#include "staffline.hh" #include "dimen.hh" #include "spanner.hh" #include "symbol.hh" @@ -17,8 +16,8 @@ /* To do: + take out hard coded TeX stuff. - */ String Line_of_score::TeX_string() const @@ -33,27 +32,29 @@ Line_of_score::TeX_string() const PCol* col_l= cols[i]; // all items in the current line & staff. String chunk_str; - Real delta = col_l->hpos_f_ - lastpos; + + Link_array<Score_elem> elems; if (col_l->error_mark_b_) { chunk_str += String("\\columnerrormark"); } + // now output the items. for (iter_top(col_l->its,j); j.ok(); j++) { - chunk_str += j->TeX_string(); + elems.push(j); } + // spanners. for (iter_top(col_l->starters,j); j.ok(); j++) { if (j->name() != name()) - chunk_str += j->TeX_string(); + elems.push(j); } - if (chunk_str!="") { - // moveover - if (delta) - s +=String( "\\kern ") + print_dimen(delta); - s += chunk_str; - lastpos = col_l->hpos_f_; + + for (int j =0; j< elems.size(); j++) { + Offset o = elems[j]->absolute_offset(); + o[X_AXIS] += cols[i]->hpos_f_; + s += elems[j]->TeX_string_without_offset(o); } } s += "}"; @@ -75,7 +76,8 @@ IMPLEMENT_IS_TYPE_B1(Line_of_score,Spanner); void Line_of_score::add(Score_elem*e) { - if( !e->dependent_size()) // avoid excess dependencies. + // avoid excess dependencies. + if(!( e->axis_group_l_a_[0] || e->axis_group_l_a_[1])) add_dependency(e); } diff --git a/lily/scores.cc b/lily/scores.cc index be558b29c1..3cfc56969c 100644 --- a/lily/scores.cc +++ b/lily/scores.cc @@ -28,9 +28,8 @@ do_scores() if (is_p->errorlevel_i_) { is_p->warning("Score contains errors. Will not process it. "); - + exit_status_i_ |= 1; } else { - is_p->print (); is_p->process(); } @@ -38,7 +37,7 @@ do_scores() is_p =0; } - score_array_global.set_size(0); + score_array_global.clear(); } void diff --git a/lily/script-column.cc b/lily/script-column.cc index 166eb348bb..1c1df618ba 100644 --- a/lily/script-column.cc +++ b/lily/script-column.cc @@ -20,6 +20,7 @@ void Script_column::add(Script*s_l) { script_l_arr_.push(s_l); + add_dependency(s_l); add_element(s_l); } @@ -89,13 +90,13 @@ void Script_column::add_support(Item*i_l) { support_l_arr_.push(i_l); + add_dependency( i_l); add_element(i_l); } void Script_column::do_substitute_dependency(Score_elem*o,Score_elem*n) { - Horizontal_vertical_group::do_substitute_dependency(o,n); if (o->item()) { script_l_arr_.substitute((Script*)o->item(),(Script*) (n?n->item():0)); support_l_arr_.substitute(o->item(), (n?n->item():0)); diff --git a/lily/script-def.cc b/lily/script-def.cc index 5475ec8cf2..856879eed7 100644 --- a/lily/script-def.cc +++ b/lily/script-def.cc @@ -44,13 +44,13 @@ Script_def::do_print() const } bool -Script_def::do_equal_b(General_script_def const &g)const +Script_def::do_equal_b(General_script_def const *g)const { - Script_def const & c = (Script_def const&) g; - return (symidx_str_ == c.symidx_str_ && - rel_stem_dir_i_ == c.rel_stem_dir_i_&& - staff_dir_i_ == c.staff_dir_i_&& - invertsym_b_ == c.invertsym_b_); + Script_def const * c = (Script_def const*) g; + return (symidx_str_ == c->symidx_str_ && + rel_stem_dir_i_ == c->rel_stem_dir_i_&& + staff_dir_i_ == c->staff_dir_i_&& + invertsym_b_ == c->invertsym_b_); } int diff --git a/lily/script-grav.cc b/lily/script-grav.cc index e33f121bb1..cd58609143 100644 --- a/lily/script-grav.cc +++ b/lily/script-grav.cc @@ -21,11 +21,11 @@ Script_engraver::do_try_request(Request *r_l) if (!r_l->musical() || ! r_l->musical()->musicalscript()) return false ; - for (int i=0; i < script_req_l_arr_.size(); i++) - if ( !Script_req::compare(*script_req_l_arr_[i], *r_l->script())) { + for (int i=0; i < script_req_l_arr_.size(); i++) { + if ( r_l->equal_b(script_req_l_arr_[i])) return true; - } + } script_req_l_arr_.push( r_l->script()); return true; @@ -44,44 +44,22 @@ Script_engraver::do_process_requests() } } -bool -Script_engraver::acceptable_elem_b(Score_elem*s_l) -{ - char const *nC = s_l->name(); - return (nC == Stem::static_name()); -} - -void -Script_engraver::acknowledge_element(Score_elem_info info) -{ - Score_elem *elem_l = info.elem_l_; - if (!acceptable_elem_b(elem_l)) - return; - - for (int i=0; i < script_p_arr_.size(); i++) { - Script*script_l = script_p_arr_[i]; - if (elem_l->name() == Stem::static_name()) - script_l->set_stem((Stem*)elem_l->item()); - } -} - void Script_engraver::do_pre_move_processing() { Staff_symbol* s_l = get_staff_info().staff_sym_l_; for (int i=0; i < script_p_arr_.size(); i++) { - Script*script_p = script_p_arr_[i]; script_p->set_staffsym( s_l); typeset_element(script_p); } - script_p_arr_.set_size(0); + script_p_arr_.clear(); } void Script_engraver::do_post_move_processing() { - script_req_l_arr_.set_size(0); + script_req_l_arr_.clear(); } diff --git a/lily/script.cc b/lily/script.cc index 4fed330013..eb88b8756f 100644 --- a/lily/script.cc +++ b/lily/script.cc @@ -67,12 +67,16 @@ Script::set_default_dir() Interval Script::do_width() const { - return specs_l_->get_atom(paper(), dir_i_).extent().x; + return specs_l_->get_atom(paper(), dir_i_).extent().x(); } void Script::do_pre_processing() { + if (breakable_b_ && break_status_i() != 1) { + transparent_b_ = empty_b_ = true; + } + if (!dir_i_) set_default_dir(); inside_staff_b_ = specs_l_->inside_b(); @@ -81,7 +85,7 @@ Script::do_pre_processing() Interval Script::symbol_height()const { - return specs_l_->get_atom(paper(), dir_i_).extent().y; + return specs_l_->get_atom(paper(), dir_i_).extent().y(); } Molecule* @@ -90,7 +94,7 @@ Script::brew_molecule_p() const Real dy = paper()->internote_f(); Molecule*out = new Molecule(specs_l_->get_atom(paper(), dir_i_)); - out->translate_y(dy * pos_i_); + out->translate(dy * pos_i_, Y_AXIS); return out; } diff --git a/lily/slur-grav.cc b/lily/slur-grav.cc index feabdd45b4..1c5c51df4e 100644 --- a/lily/slur-grav.cc +++ b/lily/slur-grav.cc @@ -85,13 +85,13 @@ Slur_engraver::do_pre_move_processing() end_slur_l_arr_[i]->dir_i_ = dir_i_; typeset_element(end_slur_l_arr_[i]); } - end_slur_l_arr_.set_size(0); + end_slur_l_arr_.clear(); } void Slur_engraver::do_post_move_processing() { - new_slur_req_l_arr_.set_size(0); + new_slur_req_l_arr_.clear(); } Slur_engraver::~Slur_engraver() { diff --git a/lily/span-bar-grav.cc b/lily/span-bar-grav.cc index a6d40fdd9c..8e2663a265 100644 --- a/lily/span-bar-grav.cc +++ b/lily/span-bar-grav.cc @@ -25,8 +25,10 @@ Span_bar_engraver::get_span_bar_p()const void Span_bar_engraver::acknowledge_element(Score_elem_info i) { - if ( i.origin_grav_l_arr_.size() > 1 && - i.elem_l_->is_type_b( Bar::static_name() ) ) { + int depth = i.origin_grav_l_arr_.size(); + if ( depth > 1 + && i.elem_l_->is_type_b( Bar::static_name() ) ) + { bar_l_arr_.push( (Bar*)i.elem_l_->item() ); if (bar_l_arr_.size() >= 2 && !spanbar_p_) { @@ -46,7 +48,7 @@ Span_bar_engraver::do_pre_move_processing() for (int i=0; i < bar_l_arr_.size() ; i++) spanbar_p_->add(bar_l_arr_[i]); spanbar_p_->set( valign_l_ ); - typeset_breakable_item(spanbar_p_); + typeset_element(spanbar_p_); spanbar_p_ =0; } bar_l_arr_.set_size( 0); diff --git a/lily/span-bar.cc b/lily/span-bar.cc index 24430729bd..1c9a8ba159 100644 --- a/lily/span-bar.cc +++ b/lily/span-bar.cc @@ -43,15 +43,6 @@ Span_bar::do_substitute_dependency(Score_elem*o, Score_elem*n) spanning_l_arr_.substitute( bold , b); } -/* - A no-op if not yet output: the span_bar slavish follows what it spans - */ -void -Span_bar::translate_y(Real y) -{ - if (status() == OUTPUT) - Score_elem::translate_y(y); -} void Span_bar::set(Vertical_align_element *a) @@ -63,7 +54,7 @@ Span_bar::set(Vertical_align_element *a) Interval Span_bar::do_width() const { - return paper()->lookup_l()->bar(type_str_, 40 PT).dim.x; // ugh + return paper()->lookup_l()->bar(type_str_, 40 PT).dim.x(); // ugh } void Span_bar::do_pre_processing() @@ -91,18 +82,31 @@ Span_bar::get_bar_sym(Real dy) const return paper()->lookup_l()->bar(type_str_, dy); } + Molecule* Span_bar::brew_molecule_p()const { - Interval y; - for (int i=0; i < spanning_l_arr_.size(); i++) - y.unite( spanning_l_arr_[i]->height() ); - Symbol s = get_bar_sym(y.length()); - Molecule*output = new Molecule(Atom(s)); - output->translate_y ( y[-1] ); + Interval y_int; + for (int i=0; i < spanning_l_arr_.size(); i++) { + Axis_group_element *common = + common_group(spanning_l_arr_[i], Y_AXIS); + + Real y = spanning_l_arr_[i]->relative_coordinate(common, Y_AXIS) + -relative_coordinate(common,Y_AXIS); + + y_int.unite( y + spanning_l_arr_[i]->height() ); + } + Symbol s = get_bar_sym(y_int.length()); + Molecule*output = new Molecule(Atom(s)); + output->translate ( y_int[-1], Y_AXIS ); return output; } IMPLEMENT_IS_TYPE_B1(Span_bar,Bar); + +Span_bar::Span_bar() +{ + type_str_ = ""; +} diff --git a/lily/span-score-bar-grav.cc b/lily/span-score-bar-grav.cc index cccbd03b78..4afd1358d7 100644 --- a/lily/span-score-bar-grav.cc +++ b/lily/span-score-bar-grav.cc @@ -17,7 +17,6 @@ Span_score_bar_engraver::get_span_bar_p() const IMPLEMENT_IS_TYPE_B1(Span_score_bar_engraver, Span_bar_engraver); - IMPLEMENT_IS_TYPE_B1(Piano_bar_engraver, Span_score_bar_engraver); Span_bar* diff --git a/lily/spanner-elem-group.cc b/lily/spanner-elem-group.cc index 8e2c98bf19..d463c2889d 100644 --- a/lily/spanner-elem-group.cc +++ b/lily/spanner-elem-group.cc @@ -11,7 +11,7 @@ -IMPLEMENT_IS_TYPE_B2(Spanner_elem_group,Spanner,Horizontal_vertical_group); +IMPLEMENT_IS_TYPE_B2(Spanner_elem_group,Spanner,Horizontal_vertical_group_element); Interval Spanner_elem_group::do_width() const @@ -24,7 +24,7 @@ Spanner_elem_group::do_print() const { #ifndef NPRINT Spanner::do_print(); - Horizontal_vertical_group::do_print(); + Horizontal_vertical_group_element::do_print(); #endif } diff --git a/lily/spanner.cc b/lily/spanner.cc index 0039caefb5..01a02cf8d4 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -36,6 +36,9 @@ Spanner::do_print()const void Spanner::break_into_pieces(bool copy_deps_b) { + if ( broken_into_l_arr_.size() ) + return; + PCol * left = left_col_l_; PCol * right = right_col_l_; if(left->daddy_l_) left = left->daddy_l_; diff --git a/lily/staff-info.cc b/lily/staff-info.cc index 6159758077..5f7fed022d 100644 --- a/lily/staff-info.cc +++ b/lily/staff-info.cc @@ -16,6 +16,7 @@ Staff_info::score_l() { return score_l_; } + Staff_info::Staff_info() { score_l_ =0; diff --git a/lily/staff-performer.cc b/lily/staff-performer.cc index a1efbfcebc..3605653c38 100644 --- a/lily/staff-performer.cc +++ b/lily/staff-performer.cc @@ -6,79 +6,50 @@ (c) 1997 Jan Nieuwenhuizen <jan@digicash.com> */ - #include "staff-performer.hh" #include "translator.hh" #include "input-translator.hh" #include "debug.hh" -#include "midi-def.hh" #include "audio-column.hh" #include "audio-item.hh" -#include "midi-item.hh" -#include "midi-stream.hh" -#include "string.hh" -#include "string-convert.hh" - +#include "audio-staff.hh" IMPLEMENT_IS_TYPE_B1(Staff_performer,Performer_group_performer); ADD_THIS_PERFORMER(Staff_performer); Staff_performer::Staff_performer() { - midi_track_p_ = new Midi_track; + audio_staff_p_ = 0; } Staff_performer::~Staff_performer() { - delete midi_track_p_; + delete audio_staff_p_; } void Staff_performer::do_creation_processing() { -} + audio_staff_p_ = new Audio_staff; -void -Staff_performer::do_removal_processing() -{ - header(); + // staff name + play(new Audio_text( Audio_text::TRACK_NAME, instrument_str())); - Moment midi_mom = 0; - for ( PCursor<Audio_item*> i( audio_item_p_list_ ); i.ok(); i++ ) { - Audio_item* l = *i; - Moment mom = l->audio_column_l_->at_mom(); - Moment delta_t = mom - midi_mom_ ; - midi_mom_ += delta_t; - Midi_item* p = l->midi_item_p(); - p->channel_i_ = track_i_; - midi_track_p_->add( delta_t, p ); - delete p; - } + // instrument description + play(new Audio_text( Audio_text::INSTRUMENT_NAME, instrument_str())); - Performer::play( midi_track_p_ ); + // tempo + play(new Audio_tempo(get_tempo_i())); + + // instrument + play(new Audio_instrument(instrument_str())); } void -Staff_performer::header() +Staff_performer::do_removal_processing() { - // set track name - Midi_text track_name( Midi_text::TRACK_NAME, instrument_str() ); - midi_track_p_->add( Moment( 0 ), &track_name ); - - // set instrument description - Midi_text instrument_name( Midi_text::INSTRUMENT_NAME, instrument_str() ); - midi_track_p_->add( Moment( 0 ), &instrument_name ); - - // set instrument :-) - // lieve wendy, nu heb je mijn track_i_ / get_staff_i weggehaald... - // zie ook note-performer: ugh - // ugh, need to know channel (===track===staff) too - int channel_i = track_i_; - Midi_instrument instrument( channel_i, instrument_str() ); - midi_track_p_->add( Moment( 0 ), &instrument ); - - Midi_tempo midi_tempo( get_tempo_i() ); - midi_track_p_->add( Moment( 0 ), &midi_tempo ); + Performer::play( audio_staff_p_ ); + audio_staff_p_ = 0; } String @@ -88,31 +59,11 @@ Staff_performer::instrument_str() } void -Staff_performer::play( Audio_item* p ) +Staff_performer::play( Audio_element* p ) { - audio_item_p_list_.bottom().add( p ); - Performer::play( p ); -} - -// huh? -void -Staff_performer::play( Midi_item* p ) -{ - Performer::play( p ); -} - - -//<ugh> -int -Staff_performer::get_track_i() const -{ - return track_i_; -} - -void -Staff_performer::set_track( int& track_i_r ) -{ - track_i_ = track_i_r++; + if (p->is_type_b(Audio_item::static_name())) { + audio_staff_p_->add((Audio_item*)p); + } + Performer::play(p); } -//</ugh> diff --git a/lily/staff-side.cc b/lily/staff-side.cc index a661a0cb97..6cade842a5 100644 --- a/lily/staff-side.cc +++ b/lily/staff-side.cc @@ -106,13 +106,7 @@ Staff_side::do_post_processing() void Staff_side::do_substitute_dependency(Score_elem*o, Score_elem*n) { - int i; - while ((i=support_l_arr_.find_i(o) ) >=0) - if (n) - support_l_arr_[i] = n; - else - support_l_arr_.del(i); - + support_l_arr_.unordered_substitute(o,n); if (staff_sym_l_ == o) staff_sym_l_ = n ? (Staff_symbol*) n->spanner():0; } diff --git a/lily/staffline.cc b/lily/staffline.cc deleted file mode 100644 index f8bbcd306b..0000000000 --- a/lily/staffline.cc +++ /dev/null @@ -1,21 +0,0 @@ -/* - staffline.cc -- implement Line_of_staff - - source file of the GNU LilyPond music typesetter - - (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - -#include "staffline.hh" -#include "scoreline.hh" -#include "dimen.hh" -#include "spanner.hh" -#include "symbol.hh" -#include "paper-def.hh" -#include "molecule.hh" -#include "p-col.hh" -#include "p-score.hh" - - - -IMPLEMENT_IS_TYPE_B2(Line_of_staff,Spanner,Horizontal_vertical_group); diff --git a/lily/stem-beam-grav.cc b/lily/stem-beam-grav.cc index 38f84a48dc..70fca43bf7 100644 --- a/lily/stem-beam-grav.cc +++ b/lily/stem-beam-grav.cc @@ -43,7 +43,7 @@ Stem_beam_engraver::do_try_request(Request*req_l) if (bool(beam_p_ ) == bool(mus_l->beam()->spantype == Span_req::START)) return false; - if (beam_req_l_ && Beam_req::compare(*beam_req_l_ , *mus_l->beam())) + if (beam_req_l_ && beam_req_l_ ->equal_b(mus_l)) return false; beam_req_l_ = mus_l->beam(); @@ -55,7 +55,7 @@ Stem_beam_engraver::do_try_request(Request*req_l) get_staff_info().time_C_->whole_in_measure_)) return false; - if (stem_req_l_ && Stem_req::compare(*stem_req_l_, *mus_l->stem())) + if (stem_req_l_ && !stem_req_l_->equal_b( mus_l ) ) return false; stem_req_l_ = mus_l->stem(); diff --git a/lily/stem.cc b/lily/stem.cc index cf811ddf56..d0f9f8105c 100644 --- a/lily/stem.cc +++ b/lily/stem.cc @@ -237,7 +237,7 @@ Stem::do_width()const if (!print_flag_b_ || abs(flag_i_) <= 4) return Interval(0,0); // TODO! Paper_def*p= paper(); - Interval r(p->lookup_l()->flag(flag_i_).dim.x); + Interval r(p->lookup_l()->flag(flag_i_).dim.x()); r+= stem_xoffset_f_; return r; } @@ -270,7 +270,7 @@ Stem::brew_molecule_p()const assert(false); } - out->translate_x(stem_xoffset_f_); + out->translate(stem_xoffset_f_, X_AXIS); return out; } diff --git a/lily/symbol.cc b/lily/symbol.cc index 29674b58d4..8a83027610 100644 --- a/lily/symbol.cc +++ b/lily/symbol.cc @@ -17,5 +17,5 @@ Symbol::Symbol(String s, Box b) String Symbol::str()const { - return "symbol(\'"+tex+"\', (" + dim.x.str() + ", " + dim.y.str() + "))"; + return "symbol(\'"+tex+"\', (" + dim.x().str() + ", " + dim.y().str() + "))"; } diff --git a/lily/template8.cc b/lily/template8.cc index effc9ec539..de06b70477 100644 --- a/lily/template8.cc +++ b/lily/template8.cc @@ -10,12 +10,12 @@ #include "plist.hh" #include "audio-column.hh" #include "audio-item.hh" -#include "cursor.tcc" -#include "list.tcc" +#include "audio-staff.hh" #include "pcursor.tcc" #include "plist.tcc" -IPL_instantiate(Audio_item); +IPL_instantiate(Audio_element); IPL_instantiate(Audio_column); + diff --git a/lily/tex-beam.cc b/lily/tex-beam.cc index 356565c4f7..c337baf38a 100644 --- a/lily/tex-beam.cc +++ b/lily/tex-beam.cc @@ -24,8 +24,8 @@ Lookup::beam_element(int sidx, int widx, Real slope) const bs.tex = substitute_args(bs.tex,args); int w = 2 << widx; Real width = w PT; - bs.dim.x = Interval(0,width); - bs.dim.y = Interval(0,width*slope); + bs.dim.x() = Interval(0,width); + bs.dim.y() = Interval(0,width*slope); return bs; } @@ -55,8 +55,8 @@ Lookup::rule_symbol(Real height, Real width) const args.push(print_dimen(height)); args.push(print_dimen(width)); bs.tex = substitute_args(bs.tex,args); - bs.dim.x = Interval(0,width); - bs.dim.y = Interval(0,height); + bs.dim.x() = Interval(0,width); + bs.dim.y() = Interval(0,height); return bs; } @@ -97,8 +97,8 @@ Lookup::beam(Real &slope, Real width) const Symbol ret; ret.tex = m.TeX_string(); - ret.dim.y = Interval(0,width*slope); - ret.dim.x = Interval(0,width); + ret.dim.y() = Interval(0,width*slope); + ret.dim.x() = Interval(0,width); return ret; } diff --git a/lily/tex-slur.cc b/lily/tex-slur.cc index c1ba56bd89..b7c0660a43 100644 --- a/lily/tex-slur.cc +++ b/lily/tex-slur.cc @@ -52,8 +52,8 @@ Lookup::half_slur_middlepart(Real &dx, int dir) const Symbol s; - s.dim.y = Interval(min(0,0), max(0,0)); // todo - s.dim.x = Interval(0,dx); + s.dim.y() = Interval(min(0,0), max(0,0)); // todo + s.dim.x() = Interval(0,dx); String f = String("\\hslurchar"); f += direction_char(0); @@ -67,7 +67,7 @@ Lookup::half_slur_middlepart(Real &dx, int dir) const f+=String( "{" ) + String( idx ) + "}"; s.tex = f; Atom a(s); - a.translate_x(dx/2); + a.translate(dx/2, X_AXIS); s.tex = a.TeX_string(); return s; @@ -95,8 +95,8 @@ Lookup::half_slur(int dy, Real &dx, int dir, int xpart) const } Symbol s; - s.dim.x = Interval(0,dx); - s.dim.y = Interval(min(0,dy), max(0,dy)); + s.dim.x() = Interval(0,dx); + s.dim.y() = Interval(min(0,dy), max(0,dy)); String f = String("\\hslurchar"); @@ -156,8 +156,8 @@ Lookup::slur (int dy , Real &dx, int dir) const } Symbol s; - s.dim.x = Interval(0,dx); - s.dim.y = Interval(min(0,dy), max(0,dy)); + s.dim.x() = Interval(0,dx); + s.dim.y() = Interval(min(0,dy), max(0,dy)); String f = String("\\slurchar") + String( direction_char(y_sign) ); @@ -182,7 +182,7 @@ Lookup::slur (int dy , Real &dx, int dir) const s.tex = f; Atom a(s); - a.translate_x(dx/2); + a.translate(dx/2, X_AXIS); s.dim = a.extent(); s.tex = a.TeX_string(); return s; @@ -209,10 +209,10 @@ Lookup::big_slur(int dy , Real &dx, int dir) const Molecule mol; mol.add(l); Atom a(m); - a.translate_y(slur_extra * internote_f); + a.translate(slur_extra * internote_f, Y_AXIS); mol.add_right(m); mol.add_right(r); - mol.translate_y( l_dy * internote_f); + mol.translate( l_dy * internote_f, Y_AXIS); Symbol s; s.tex = mol.TeX_string(); s.dim = mol.extent(); diff --git a/lily/text-def.cc b/lily/text-def.cc index 9ab7d0a25b..39318c9094 100644 --- a/lily/text-def.cc +++ b/lily/text-def.cc @@ -18,7 +18,7 @@ Text_def::width(Paper_def * p) const { Atom a = get_atom(p,0); - Real guess_width_f = text_str_.length_i() * a.sym_.dim.x.length(); // ugh + Real guess_width_f = text_str_.length_i() * a.sym_.dim.x().length(); // ugh Interval i(0, guess_width_f); i += - (align_i_ + 1)* i.center(); return i; @@ -39,10 +39,11 @@ Text_def::Text_def() } bool -Text_def::do_equal_b(Text_def const &def)const +Text_def::do_equal_b(General_script_def const *gdef) const { - return align_i_ == def.align_i_ && text_str_ == def.text_str_ - && style_str_ == def.style_str_; + Text_def const *def= (Text_def*)gdef; + return align_i_ == def->align_i_ && text_str_ == def->text_str_ + && style_str_ == def->style_str_; } Atom diff --git a/lily/text-grav.cc b/lily/text-grav.cc index 5095b23b3c..be857aaf80 100644 --- a/lily/text-grav.cc +++ b/lily/text-grav.cc @@ -23,9 +23,7 @@ Text_engraver::do_try_request(Request*req_l) Musical_req *m = req_l->musical(); if (!m || ! m->text()) return false; - if (text_req_l_ && - Text_req::compare(*m->text(), *text_req_l_)) - + if (text_req_l_ && text_req_l_->equal_b(m)) return false; text_req_l_ = m->text(); diff --git a/lily/text-item.cc b/lily/text-item.cc index 3ae99c40ad..ad5745f6a5 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -36,7 +36,7 @@ Text_item::do_pre_processing() Interval Text_item::symbol_height()const { - return tdef_p_->get_atom(paper(), dir_i_).sym_.dim.y; + return tdef_p_->get_atom(paper(), dir_i_).sym_.dim.y(); } Molecule* @@ -51,8 +51,8 @@ Text_item::brew_molecule_p() const Molecule* mol_p = new Molecule(a); if(dir_i_<0 ) // should do something better anyway. - mol_p->translate_y( -mol_p->extent().y.left ); - mol_p->translate_y( pos_i_ * paper()->internote_f()); + mol_p->translate( -mol_p->extent().y().left , Y_AXIS); + mol_p->translate( pos_i_ * paper()->internote_f(), Y_AXIS); return mol_p; } diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc index 437739019a..a9e6f4f257 100644 --- a/lily/text-spanner.cc +++ b/lily/text-spanner.cc @@ -69,7 +69,7 @@ Text_spanner::do_pre_processing() Interval Text_spanner::height()const { - return brew_molecule_p()->extent().y; + return brew_molecule_p()->extent().y(); } void diff --git a/lily/timing-grav.cc b/lily/timing-grav.cc new file mode 100644 index 0000000000..97d7c92ee0 --- /dev/null +++ b/lily/timing-grav.cc @@ -0,0 +1,27 @@ +/* + timing-grav.cc -- implement Timing_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ +#if 0 + +#include "timing-grav.hh" +#include "command-request.hh" + + +Timing_engraver::Timing_engraver() +{ + default_grouping_ = Rhythmic_grouping(MInterval(0,4),4); // ugh +} + +void +Timing_engraver::fill_staff_info(Staff_info &inf) +{ + inf.time_C_ = &time_; + inf.rhythmic_C_ = &default_grouping_; +} + + +#endif diff --git a/lily/vertical-align-elem.cc b/lily/vertical-align-elem.cc index 4ba8b7c5a4..7ebf647c34 100644 --- a/lily/vertical-align-elem.cc +++ b/lily/vertical-align-elem.cc @@ -27,6 +27,13 @@ Vertical_align_element::do_substitute_dependency(Score_elem*o,Score_elem*n) else elem_l_arr_.del(i); } + +/** + Align elements top to bottom. + The first element has its top at y =0.0 afterwards + + TODO configurable, like Horizontal_align_item + */ void Vertical_align_element::do_post_processing() { @@ -41,7 +48,7 @@ Vertical_align_element::do_post_processing() Real where_f=0; for ( int i=0 ; i < elem_l_arr_.size(); i++) { - elem_l_arr_[i]->translate_y( - dims[i][1] - where_f); + elem_l_arr_[i]->translate( - dims[i][1] - where_f, Y_AXIS); where_f += dims[i].length(); } } diff --git a/lily/vertical-align-grav.cc b/lily/vertical-align-grav.cc index c6690f6ef1..1ab374c1d8 100644 --- a/lily/vertical-align-grav.cc +++ b/lily/vertical-align-grav.cc @@ -35,8 +35,8 @@ void Vertical_align_engraver::acknowledge_element(Score_elem_info i) { if ( i.origin_grav_l_arr_.size() == 2 && - i.elem_l_->is_type_b(Vertical_group::static_name()) && - !i.elem_l_->y_group_l_ ) { + i.elem_l_->is_type_b(Vertical_group_element::static_name()) && + !i.elem_l_->axis_group_l_a_[Y_AXIS] ) { assert( !valign_p_->contains_b( i.elem_l_) ); valign_p_->add ( i.elem_l_ ); diff --git a/lily/vertical-group-spanner.cc b/lily/vertical-group-spanner.cc index d858349ca5..2e11db7420 100644 --- a/lily/vertical-group-spanner.cc +++ b/lily/vertical-group-spanner.cc @@ -10,95 +10,4 @@ #include "item.hh" #include "p-col.hh" -/** - Uncouple all elements of this Vertical_group. Ugh! - */ -void -Vertical_group_spanner::remove_all() -{ - for (int i=0; i < elem_l_arr_.size(); i++){ - elem_l_arr_[i]->y_group_l_ = 0; - } - elem_l_arr_.set_size(0); - junk_dependencies(); -} - -void -Vertical_group_spanner::do_break_processing() -{ - set_my_columns(); - if ( line_l() ) { - return; - } - break_into_pieces( false ); - - Link_array<Score_elem> elem_l_arr = elem_l_arr_; - remove_all(); - - - - for (int i=0; i < elem_l_arr.size(); i++) { - Score_elem * elt = elem_l_arr[i]; - Line_of_score *elt_line = elt->line_l(); - - if ( elt-> y_group_l_ ) - continue; - - if ( ! elt_line ){ - if (elt->spanner()) { - Spanner * sp = elt->spanner(); - - for (int j =0; j < broken_into_l_arr_.size(); j++) { - Vertical_group_spanner * my_broken_l - = (Vertical_group_spanner*)broken_into_l_arr_[j]; - - Spanner * broken_span_l - = sp->find_broken_piece(my_broken_l->line_l()); - - if (broken_span_l) { - my_broken_l->add_element(broken_span_l ); - } - } - } else if (elt->item() && elt->item()->pcol_l_->breakpoint_b() - && elt->item()->break_status_i() == 0) { - for (int j =0; j < 2; j++) { - Item * my_item = elt->item()->broken_to_a_[j]; - Line_of_score * item_line_l_ = my_item->line_l() ; - if ( ! item_line_l_ ) - continue; - - Vertical_group_spanner * v - = (Vertical_group_spanner*)find_broken_piece( item_line_l_); - if (v) { - v->add_element( my_item ); - } - } - } - } else { - Vertical_group_spanner * my_broken_l - = (Vertical_group_spanner*)find_broken_piece( elt->line_l() ); - my_broken_l->add_element( elt ); - } - } - for (int j =0; j < broken_into_l_arr_.size(); j++) - broken_into_l_arr_[j]->break_processing(); -} - -Vertical_group_spanner::Vertical_group_spanner() -{ -} - -void -Vertical_group_spanner::do_print() const -{ - Vertical_group::do_print(); -} - - - -IMPLEMENT_IS_TYPE_B2(Vertical_group_spanner, Spanner, Vertical_group); - -Vertical_group_spanner::Vertical_group_spanner(Vertical_group_spanner const &s) - : Spanner(s), Vertical_group(s) -{ -} +IMPLEMENT_IS_TYPE_B2(Vertical_group_spanner, Axis_group_spanner, Vertical_group_element); diff --git a/make/Makefile b/make/Makefile index 99e0bbf008..2f4197f208 100644 --- a/make/Makefile +++ b/make/Makefile @@ -16,7 +16,7 @@ depth = .. # identify module: # NAME = make - +SUBDIRS = debian # list of distribution files: @@ -24,6 +24,7 @@ NAME = make # configure and make. EXTRA_DISTFILES = Configure_variables.make.in lilypond.spec.in Toplevel.make.in \ lilypond.lsm.in $(outdir)/lilypond.spec $(outdir)/lilypond.lsm + # # generic variables: diff --git a/make/Rules.make b/make/Rules.make index 07e44b7041..a09bf62d74 100644 --- a/make/Rules.make +++ b/make/Rules.make @@ -12,7 +12,7 @@ # so why does make still consider xx.y : RCS/xx.y,v ? # there is no suffix ,v anymore! -.SUFFIXES: .cc .o .hh .y .l .pod .text .1 .dep .html +.SUFFIXES: .cc .o .hh .y .l .dep # compile rules: diff --git a/make/Targets.make b/make/Targets.make index 206e2c0267..d84b62e304 100644 --- a/make/Targets.make +++ b/make/Targets.make @@ -8,7 +8,7 @@ # Han-Wen Nienhuys <hanwen@stack.nl> .PHONY : all clean config default dist doc doc++ dummy exe help lib TAGS html\ - check-flower-deps check-lily-deps check-doc-deps + check-flower-deps check-lib-deps check-doc-deps # target all: # @@ -123,7 +123,7 @@ doc: # doc++ documentation of classes doc++: $(progdocs) - doc++ -k -p -d $(DOCDIR) $^ + $(docxx) $(docxx-opts) -d $(DOCDIR) $^ # ugh. should generate in out/ dist: @@ -224,7 +224,7 @@ $(LIBFLOWER): check-flower-deps check-flower-deps: $(MAKE) -C $(depth)/flower/ default -check-lily-deps: check-flower-deps +check-lib-deps: check-flower-deps $(MAKE) -C $(depth)/lib check-doc-deps: diff --git a/make/Variables.make b/make/Variables.make index b601cbd8a4..c1a022fa19 100644 --- a/make/Variables.make +++ b/make/Variables.make @@ -157,9 +157,6 @@ RANLIB_COMMAND=$(RANLIB) $@ DO_CXX_COMPILE=$(DODEP)\ $(CXX) -c $(CXXFLAGS) $(CXX_OUTPUT_OPTION) -# "CC = $(CC)" -# "CXX = $(CXX)" -# # linker: # @@ -205,7 +202,8 @@ DOCDIR=$(depth)/$(outdir) # .hh should be first. Don't know why # take some trouble to auto ignore sources and obsolete stuff. -progdocs=$(shell $(FIND) ./ -name '*.hh' |egrep -v '$(OUTDIR_NAME)') $(shell $(FIND) ./ -name '*.cc'|egrep -v '$(OUTDIR_NAME)') +progdocs=$(shell $(FIND) ./ -name '*.hh' |egrep -v '$(OUTDIR_NAME)') \ + $(shell $(FIND) ./ -name '*.cc' |egrep -v '$(OUTDIR_NAME)') \ pod2html=pod2html @@ -221,3 +219,7 @@ endif # substitute $(STRIP) in Site.make if you want stripping DO_STRIP=true + +docxx-opts=-S -k -p +docxx=doc++ + diff --git a/make/debian/Makefile b/make/debian/Makefile new file mode 100644 index 0000000000..a09a412ec9 --- /dev/null +++ b/make/debian/Makefile @@ -0,0 +1,20 @@ +depth = ../.. + +NAME= debian + +# generic variables: +# +include ./$(depth)/make/Variables.make +include ./$(depth)/make/Files.make +# + +# generic targets and rules: +# +include ./$(depth)/make/Targets.make +include ./$(depth)/make/Rules.make +# + + +EXTRA_DISTFILES = README.debian.ex changelog control\ + copyright dirs diversions.ex docs examples info.ex menu.ex postinst\ + postrm rules watch diff --git a/make/debian/README.debian.ex b/make/debian/README.debian.ex new file mode 100644 index 0000000000..99296fb0a2 --- /dev/null +++ b/make/debian/README.debian.ex @@ -0,0 +1,6 @@ +lilypond for DEBIAN +------------------- + +Comments regarding the Package + +Anthony Fok <foka@gpu.srv.ualberta.ca>, Wed, 6 Aug 1997 02:14:59 -0600 diff --git a/make/debian/changelog b/make/debian/changelog new file mode 100644 index 0000000000..c8fea56d93 --- /dev/null +++ b/make/debian/changelog @@ -0,0 +1,10 @@ +lilypond (0.1.0-1) unstable; urgency=low + + * Initial Release. + + -- Anthony Fok <foka@gpu.srv.ualberta.ca> Wed, 6 Aug 1997 04:40:57 -0600 + +Local variables: +mode: debian-changelog +add-log-mailing-address: "foka@gpu.srv.ualberta.ca" +End: diff --git a/make/debian/control b/make/debian/control new file mode 100644 index 0000000000..cd13df85ed --- /dev/null +++ b/make/debian/control @@ -0,0 +1,22 @@ +Source: lilypond +Section: tex +Priority: contrib/optional +Maintainer: Anthony Fok <foka@gpu.srv.ualberta.ca> +Standards-Version: 2.2.0.0 + +Package: lilypond +Architecture: any +Depends: ${shlibs:Depends} +Recommends: tetex-base, musixtex | musixtex-fonts +Description: GNU LilyPond -- A preprocessor to make TeX typeset music. + GNU LilyPond is a program which converts a music-script (mudela) into TeX + output, or MIDI to produce multi-staff scores. Features include multiple + meters, clefs, keys, lyrics, versatile input-language, cadenzas beams, + slurs, triplets, multiple voices. + . + Note: LilyPond uses the fonts from MusiXTeX. Please install the package + musixtex or musixtex-fonts when you install lilypond. :) + . + URL: http://www.stack.nl/~hanwen/lilypond/ + Authors: Han-Wen Nienhuys <hanwen@stack.nl> + Jan Nieuwenhuizen <jan@digicash.com> diff --git a/make/debian/copyright b/make/debian/copyright new file mode 100644 index 0000000000..244cda9c46 --- /dev/null +++ b/make/debian/copyright @@ -0,0 +1,36 @@ +This package was debianized by Anthony Fok foka@gpu.srv.ualberta.ca on +Wed, 6 Aug 1997 04:30:28 -0600 + +It was downloaded from + ftp://pcnov095.win.tue.nl/pub/lilypond/lilypond-0.1.0.tar.gz + +It is also available from: + ftp://alpha.gnu.ai.mit.edu/gnu/lilypond-0.1.0.tar.gz + +For more informatino about GNU LilyPond, please visit: + http://www.stack.nl/~hanwen/lilypond/ for more information. + + +Authors: + Han-Wen Nienhuys <hanwen@stack.nl> + Jan Nieuwenhuizen <jan@digicash.com> + +Copyright: + + GNU LilyPond is Copyright (C) Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 dated June, 1991. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave., Cambridge, MA 02139, USA. + + On Debian GNU/Linux systems, the complete text of the GNU General + Public License can be found in `/usr/doc/copyright/GPL.gz'. diff --git a/make/debian/dirs b/make/debian/dirs new file mode 100644 index 0000000000..2a3cf99753 --- /dev/null +++ b/make/debian/dirs @@ -0,0 +1,2 @@ +usr/bin +usr/lib/texmf/doc diff --git a/make/debian/diversions.ex b/make/debian/diversions.ex new file mode 100644 index 0000000000..aebbbe5dc9 --- /dev/null +++ b/make/debian/diversions.ex @@ -0,0 +1 @@ +<FILE> <Diverted to> <Packagename> diff --git a/make/debian/docs b/make/debian/docs new file mode 100644 index 0000000000..191b9f88dc --- /dev/null +++ b/make/debian/docs @@ -0,0 +1,3 @@ +Documentation/out/*.text +Documentation/*.doc +Documentation/lelie_logo.gif diff --git a/make/debian/examples b/make/debian/examples new file mode 100644 index 0000000000..3be67ec77c --- /dev/null +++ b/make/debian/examples @@ -0,0 +1,2 @@ +input/*.ly +input/*.tex diff --git a/make/debian/info.ex b/make/debian/info.ex new file mode 100644 index 0000000000..5a311f02bc --- /dev/null +++ b/make/debian/info.ex @@ -0,0 +1,15 @@ +# This is a configuration files for installing a .info menu +# The Description to be placed into the directory +DESCR="Description" + +# The section this info file should be placed in (Regexp) followed by +# the new section name to be created if the Regexp does not match +# (Optional. If not given the .info will be appended to the directory) +#SECTION_MATCH="Regexp" +#SECTION_NAME="New Section Name" + +# The file referred to from the Info directory +FILE=lilypond.info + +# Optional. The files to be copied to /usr/info +#FILES=*.info diff --git a/make/debian/menu.ex b/make/debian/menu.ex new file mode 100644 index 0000000000..179992fae0 --- /dev/null +++ b/make/debian/menu.ex @@ -0,0 +1 @@ +text Apps/Misc lilypond none "lilypond Description" /usr/bin/lilypond diff --git a/make/debian/postinst b/make/debian/postinst new file mode 100644 index 0000000000..8647e7ab64 --- /dev/null +++ b/make/debian/postinst @@ -0,0 +1,7 @@ +#!/bin/bash +set -e + +if [ -x /usr/bin/texhash -a -e /usr/lib/texmf/ls-R ]; then + texhash +fi + diff --git a/make/debian/postrm b/make/debian/postrm new file mode 100644 index 0000000000..cca5631edc --- /dev/null +++ b/make/debian/postrm @@ -0,0 +1,28 @@ +#!/bin/bash + +set -e + +case "$1" in + remove) + if [ -x /usr/bin/texhash -a -e /usr/lib/texmf/ls-R ]; then + texhash + fi + ;; + + upgrade) + ;; + + purge) + if [ -x /usr/bin/texhash -a -e /usr/lib/texmf/ls-R ]; then + texhash + fi + ;; + + failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 0 + ;; +esac diff --git a/make/debian/rules b/make/debian/rules new file mode 100644 index 0000000000..c27fa6409d --- /dev/null +++ b/make/debian/rules @@ -0,0 +1,57 @@ +#!/usr/bin/make -f +# Made with the aid of debmake, by Christoph Lameter, +# based on the sample debian/rules file for GNU hello by Ian Jackson. + +package=lilypond + +build: + $(checkdir) + ./configure --enable-checking --disable-debugging \ + --enable-printing --prefix=/usr --enable-optimize \ + --enable-shared + make all + + touch build + +clean: + $(checkdir) + -rm -f build + -make distclean + -rm -f {,*/}out/{*,.build} flower/config.{log,status} + -rm -f `find . -name "*~"` + -rm -rf debian/tmp debian/files* core debian/substvars + +binary-indep: checkroot build + $(checkdir) +# There are no architecture-independent files to be uploaded +# generated by this package. If there were any they would be +# made here. + +binary-arch: checkroot build + $(checkdir) + -rm -rf debian/tmp + install -d debian/tmp + cd debian/tmp && install -d `cat ../dirs` + make prefix=`pwd`/debian/tmp/usr install + ln -fs ../../../doc/lilypond debian/tmp/usr/lib/texmf/doc/lilypond +# Must have debmake installed for this to work. Otherwise please copy +# /usr/bin/debstd into the debian directory and change debstd to debian/debstd + debstd -m BUGS TODO NEWS DEDICATION ANNOUNCE README + dpkg-gencontrol + chown -R root.root debian/tmp + chmod -R go=rX debian/tmp + dpkg --build debian/tmp .. + +define checkdir + test -f debian/rules +endef + +# Below here is fairly generic really + +binary: binary-indep binary-arch + +checkroot: + $(checkdir) + test root = "`whoami`" + +.PHONY: binary binary-arch binary-indep clean checkroot diff --git a/make/debian/watch b/make/debian/watch new file mode 100644 index 0000000000..2b1a91d0d7 --- /dev/null +++ b/make/debian/watch @@ -0,0 +1,5 @@ +# Example watch control file for uscan +# Rename this file to "watch" and then you can run the "uscan" command +# to check for upstream updates and more. +# Site Directory Pattern Version Script +pcnov095.win.tue.nl /pub/lilypond lilypond-*.tar.gz debian uupdate diff --git a/make/lilypond.lsm b/make/lilypond.lsm index 40fca3deca..72d3c71938 100644 --- a/make/lilypond.lsm +++ b/make/lilypond.lsm @@ -1,7 +1,7 @@ Begin3 Title: LilyPond -Version: 0.1.1 -Entered-date: 05AUG97 +Version: 0.1.7 +Entered-date: 14AUG97 Description: GNU LilyPond is a program which converts music definition files into visual or auditive output: it can typeset formatted sheet music to a TeX file and and @@ -14,8 +14,8 @@ Author: hanwen@stack.nl (Han-Wen Nienhuys) jan@digicash.com (Jan Nieuwenhuizen) Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys) Primary-site: sunsite.unc.edu /pub/Linux/apps - 340k lilypond-0.1.1.tar.gz + 340k lilypond-0.1.7.tar.gz Original-site: pcnov095.win.tue.nl /pub/lilypond/ - 340k lilypond-0.1.1.tar.gz + 340k lilypond-0.1.7.tar.gz Copying-policy: GPL End diff --git a/make/lilypond.spec b/make/lilypond.spec index 604160109c..93d06809d7 100644 --- a/make/lilypond.spec +++ b/make/lilypond.spec @@ -1,9 +1,9 @@ Name: lilypond -Version: 0.1.1 +Version: 0.1.7 Release: 1 Copyright: GPL Group: Applications/Publishing -Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.1.1.tar.gz +Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-0.1.7.tar.gz Summary: A preprocessor to make TeX typeset music. URL: http://www.stack.nl/~hanwen/lilypond Packager: Han-Wen Nienhuys <hanwen@stack.nl> @@ -27,8 +27,8 @@ rm -rf $RPM_BUILD_ROOT strip lily/out/lilypond mi2mu/out/mi2mu make prefix="$RPM_BUILD_ROOT/usr" install %files -%doc Documentation/out/AUTHORS.text Documentation/out/CodingStyle.text Documentation/out/INSTALL.text Documentation/out/MANIFESTO.text Documentation/out/convert-mudela.text Documentation/out/faq.text Documentation/out/gnu-music.text Documentation/out/index.text Documentation/out/language.text Documentation/out/lilygut.text Documentation/out/lilyliterature.text Documentation/out/lilypond.text Documentation/out/links.text Documentation/out/mi2mu.text Documentation/out/mudela-book.text Documentation/out/other-packages.text BUGS TODO NEWS DEDICATION ANNOUNCE README -%doc input/beams.ly input/cadenza.ly input/collisions.ly input/coriolan-alto.ly input/header.ly input/keys.ly input/kortjakje.ly input/multi.ly input/pedal.ly input/rhythm.ly input/rock.ly input/scales.ly input/scripts.ly input/scsii-menuetto.ly input/scsii-menuetto.tex input/slurs.ly input/standchen.ly input/standchen.tex input/toccata-fuga-E.ly input/twinkle.ly input/wohltemperirt.ly Documentation/mudela-course.doc Documentation/mudela-man.doc +%doc Documentation/out/AUTHORS.text Documentation/out/CodingStyle.text Documentation/out/INSTALL.text Documentation/out/MANIFESTO.text Documentation/out/convert-mudela.text Documentation/out/faq.text Documentation/out/gnu-music.text Documentation/out/index.text Documentation/out/internals.text Documentation/out/language.text Documentation/out/lilypond.text Documentation/out/links.text Documentation/out/literature.text Documentation/out/mi2mu.text Documentation/out/mudela-book.text Documentation/out/mutopia.text Documentation/out/other-packages.text BUGS TODO NEWS DEDICATION ANNOUNCE README +%doc input/beams.ly input/cadenza.ly input/collisions.ly input/coriolan-alto.ly input/gallina.ly input/header.ly input/keys.ly input/kortjakje.ly input/multi.ly input/pedal.ly input/rhythm.ly input/scales.ly input/scripts.ly input/scsii-menuetto.ly input/scsii-menuetto.tex input/slurs.ly input/standchen.ly input/standchen.tex input/toccata-fuga-E.ly input/twinkle-pop.ly input/twinkle.ly input/wohltemperirt.ly Documentation/mudela-course.doc Documentation/mudela-man.doc %doc Documentation/lelie_logo.gif /usr/bin/convert-mudela /usr/bin/mudela-book diff --git a/mi2mu/Makefile b/mi2mu/Makefile index bd430b8aa7..704221df8a 100644 --- a/mi2mu/Makefile +++ b/mi2mu/Makefile @@ -13,11 +13,8 @@ depth = .. # -# identify module: -# NAME = mi2mu MODULE_NAME = mi2mu -# # generic variables: # @@ -25,7 +22,7 @@ include ./$(depth)/make/Variables.make include ./$(depth)/make/Files.make # -# versioning +# identify module: # include $(mi2mu-dir)/VERSION build = $(mi2mu-dir)/$(outdir)/.build @@ -49,7 +46,7 @@ EXTRA_DISTFILES = VERSION TODO # list of custom libraries: # -MODULE_LIBDEPS=check-flower-deps check-lily-deps +MODULE_LIBDEPS=check-flower-deps check-lib-deps MODULE_LIBES=-llily -lflower # diff --git a/mi2mu/TODO b/mi2mu/TODO index 01de76df27..df3a7ce45a 100644 --- a/mi2mu/TODO +++ b/mi2mu/TODO @@ -16,6 +16,8 @@ IMPORTANT PROJECTS + * junk one in list vs. array + * write something interesting in mi2mu manual page * check/use type 0 / 1 / 2 of midi file diff --git a/mi2mu/VERSION b/mi2mu/VERSION index 5596987483..22b9eff149 100644 --- a/mi2mu/VERSION +++ b/mi2mu/VERSION @@ -1,6 +1,6 @@ MAJOR_VERSION = 0 MINOR_VERSION = 0 -PATCH_LEVEL = 18 +PATCH_LEVEL = 19 # use to send patches, always empty for released version: MY_PATCH_LEVEL = # diff --git a/mi2mu/include/lily-stream.hh b/mi2mu/include/lily-stream.hh index 8c6622d324..755d19fb55 100644 --- a/mi2mu/include/lily-stream.hh +++ b/mi2mu/include/lily-stream.hh @@ -9,26 +9,26 @@ #define LILY_STREAM_HH /// Lily output -struct Lily_stream { - ostream* os_p_; - String filename_str_; - int indent_i_; - int column_i_; - int wrap_column_i_; - bool comment_mode_bo_; - +class Lily_stream { +public: Lily_stream( String filename_str ); ~Lily_stream(); Lily_stream& operator <<( String str ); Lily_stream& operator <<( Midi_event& midi_event_r ); - void check_comment( String str ); +private: void header(); - void indent(); - void newline(); void open(); - void tnedni(); + void output( String str ); + void output_wrapped( String str ); + + ostream* os_p_; + String filename_str_; + int indent_i_; + int column_i_; + int wrap_column_i_; + bool comment_mode_b_; }; #endif // LILY_STREAM_HH diff --git a/mi2mu/include/midi-track.hh b/mi2mu/include/midi-track.hh index c25d65831b..3d654ae3df 100644 --- a/mi2mu/include/midi-track.hh +++ b/mi2mu/include/midi-track.hh @@ -14,6 +14,7 @@ public: void add_event( Moment mom, Midi_event* midi_event_p ); Moment end_mom(); + String id_str(); String name_str(); void output_mudela( Lily_stream& lily_stream_r ); Moment next_begin_mom( Moment now_mom ); diff --git a/mi2mu/lily-stream.cc b/mi2mu/lily-stream.cc index 97fdcaab56..91824e2098 100644 --- a/mi2mu/lily-stream.cc +++ b/mi2mu/lily-stream.cc @@ -14,7 +14,7 @@ Lily_stream::Lily_stream( String filename_str ) filename_str_ = filename_str; os_p_ = 0; indent_i_ = 0; - comment_mode_bo_ = false; + comment_mode_b_ = false; column_i_ = 0; wrap_column_i_ = 60; open(); @@ -31,49 +31,15 @@ Lily_stream::~Lily_stream() Lily_stream& Lily_stream::operator <<( String str ) { - static String nobreak_str = "\\`'_-.^<>*@"; + static String word_sep_str = "{} \t\n"; while ( str.length_i() ) { - int max_i = wrap_column_i_ - column_i_ - 1; - int i = str.length_i() - 1 <? max_i; - int nl_i = str.left_str( i + 1 ).index_i( '\n' ); - if ( nl_i != -1 ) { - i = nl_i - 1; - str = str.nomid_str( nl_i, 1 ); - } - - if ( ( i != str.length_i() - 1 ) && ( nl_i == -1 ) ) { - while ( i && ( isalnum( str[ i ] ) - || ( nobreak_str.index_i( str[ i ] ) != -1 ) ) ) - i--; - - if ( !i ) { // no room left - if ( column_i_ > 8 * indent_i_ ) { - newline(); - if ( comment_mode_bo_ && ( str[ 0 ] != '%' ) ) - str = "%" + str; - continue; - } - else { // cannot break neatly... - i = max_i; - } - } - } - - String line = str.left_str( i + 1 ); - str = str.mid_str( i + 1, INT_MAX ); - *os_p_ << line; - column_i_ += line.length_i(); - if ( nl_i != -1 ) - newline(); - else - check_comment( line ); - if ( ( str.length_i() && ( nl_i == -1 ) ) || ( column_i_ >= wrap_column_i_ ) ) { - //brr. - if ( comment_mode_bo_ ) - str = "%" + str; - newline(); - } - } + int i = str.index_any_i( word_sep_str ) + 1; + if ( !i ) + i = str.length_i(); + String word = str.left_str( i ); + str = str.mid_str( i, str.length_i() ); + output_wrapped( word ); + } return *this; } @@ -86,18 +52,6 @@ Lily_stream::operator <<( Midi_event& midi_event_r ) } void -Lily_stream::check_comment( String str ) -{ - int newline_i = str.index_last_i( '\n' ); - if ( newline_i != -1 ) { - str = str.mid_str( newline_i +1, INT_MAX ); - comment_mode_bo_ = false; - } - if ( str.index_i( '%' ) != -1 ) - comment_mode_bo_ = true; -} - -void Lily_stream::header() { *os_p_ << "% Creator: " << mi2mu_version_str() << "\n"; @@ -110,23 +64,6 @@ Lily_stream::header() // ugh *os_p_ << "\\version \"0.1.0\";\n"; } -/* - snapnie: dit kan toch automaties? Zie ook dstream. - */ -void -Lily_stream::indent() -{ - indent_i_++; - newline(); -} - -void -Lily_stream::newline() -{ - *os_p_ << endl << String( '\t', indent_i_ ); - column_i_ = indent_i_ * 8; - comment_mode_bo_ = false; -} void Lily_stream::open() @@ -137,10 +74,70 @@ Lily_stream::open() } void -Lily_stream::tnedni() +Lily_stream::output( String str ) +{ + for ( int i = 0; i < str.length_i(); i++ ) { + char c = str[ i ]; + switch ( c ) { + case '{' : + case '<' : + indent_i_++; + column_i_++; + *os_p_ << c; + break; + case '}' : + case '>' : + assert( indent_i_ ); + indent_i_--; + column_i_++; + *os_p_ << c; + break; + case '%' : + comment_mode_b_ = true; + *os_p_ << c; + column_i_++; + break; + case '\t' : + column_i_ += 8; + *os_p_ << c; + break; + case '\n' : + *os_p_ << endl; + *os_p_ << String( '\t', indent_i_ ); + column_i_ = indent_i_ * 8; + comment_mode_b_ = false; + break; + default : + column_i_++; + *os_p_ << c; + break; + } + } +} + +void +Lily_stream::output_wrapped( String str ) { - assert( indent_i_ > 0 ); - indent_i_--; - newline(); + // enough room left -> doit + if ( column_i_ + str.length_i() <= wrap_column_i_ ) { + output( str ); + return; + } + + // we're at BOL already; this will never fit -> doit + if ( column_i_ == indent_i_ * 8 ) { + output( str ); + return; + } + + // ok, let's wrap + // preserve comment mode + if ( comment_mode_b_ ) + output( String( "\n%" ) ); + else + output( String( "\n" ) ); + + output( str ); } + diff --git a/mi2mu/main.cc b/mi2mu/main.cc index f447a181db..a50cf55ff6 100644 --- a/mi2mu/main.cc +++ b/mi2mu/main.cc @@ -93,7 +93,7 @@ main( int argc_i, char* argv_sz_a[] ) Getopt_long getopt_long( argc_i, argv_sz_a, long_option_init_a ); String output_str; - while ( Long_option_init* long_option_init_p = getopt_long() ) + while ( Long_option_init const* long_option_init_p = getopt_long() ) switch ( long_option_init_p->shortname ) { case 'b': Duration_convert::no_quantify_b_s = true; @@ -115,7 +115,7 @@ main( int argc_i, char* argv_sz_a[] ) Duration_convert::no_smaller_than_i_s = 32; break; case 'o': - output_str = getopt_long.optarg; + output_str = getopt_long.optional_argument_ch_C_; break; case 'p': Duration_convert::no_triplets_b_s = true; @@ -124,7 +124,7 @@ main( int argc_i, char* argv_sz_a[] ) level_ver = QUIET_ver; break; case 's': { - int i = String_convert::dec2_i( getopt_long.optarg ); + int i = String_convert::dec2_i( getopt_long.optional_argument_ch_C_ ); if ( !i ) { identify(); usage(); @@ -152,7 +152,7 @@ main( int argc_i, char* argv_sz_a[] ) // flag -q must be checked first identify(); - char* arg_sz = 0; + char const* arg_sz = 0; while ( ( arg_sz = getopt_long.get_next_arg() ) ) { My_midi_parser midi_parser( arg_sz, & source ); midi_parser_l_g = &midi_parser; diff --git a/mi2mu/midi-event.cc b/mi2mu/midi-event.cc index f698cde71c..712a5ae941 100644 --- a/mi2mu/midi-event.cc +++ b/mi2mu/midi-event.cc @@ -175,12 +175,13 @@ Midi_text::mudela_str( bool command_mode_bo ) || ( text_str_.length_i() != (int)strlen( text_str_.ch_C() ) ) ) return ""; - return "% " + text_str_ + "\n\t"; + return "% " + text_str_ + "\n"; } Midi_time::Midi_time( int num_i, int den_i, int clocks_4_i, int count_32_i ) - : sync_dur_( 8 ) { + sync_dur_.type_i_ = 8; + sync_f_ = 1.0; if ( count_32_i != 8 ) warning( String( "#32 in quarter: " ) + String( count_32_i )); @@ -192,7 +193,9 @@ Midi_time::Midi_time( int num_i, int den_i, int clocks_4_i, int count_32_i ) Moment Midi_time::bar_mom() { - return Moment( num_i_ ) * Duration_convert::dur2_mom( Duration( 1 << den_i_ ) ); + Duration d; + d.type_i_ = 1 << den_i_ ; + return Moment( num_i_ ) * Duration_convert::dur2_mom( d ); } int diff --git a/mi2mu/midi-parser.y b/mi2mu/midi-parser.y index ce33c6bc83..d28e907340 100644 --- a/mi2mu/midi-parser.y +++ b/mi2mu/midi-parser.y @@ -148,8 +148,6 @@ the_meta_event: break; case Midi_text::TRACK_NAME: midi_parser_l_g->track_name_str_ = *$2; - while ( midi_parser_l_g->track_name_str_.index_i( ' ' ) != -1 ) - *(midi_parser_l_g->track_name_str_.ch_l() + midi_parser_l_g->track_name_str_.index_i( ' ' ) ) = '_'; break; case Midi_text::INSTRUMENT_NAME: midi_parser_l_g->instrument_str_ = *$2; diff --git a/mi2mu/midi-score.cc b/mi2mu/midi-score.cc index 62cc98910f..7b3262045c 100644 --- a/mi2mu/midi-score.cc +++ b/mi2mu/midi-score.cc @@ -36,42 +36,32 @@ Midi_score::output_mudela( String filename_str ) for ( PCursor<Midi_track*> i( midi_track_p_list_.top() ); i.ok(); i++ ) { tor( NORMAL_ver ) << "track " << track_i++ << ": " << flush; i->output_mudela( lily_stream ); - lily_stream.newline(); + lily_stream << "\n"; tor( NORMAL_ver ) << endl; } - lily_stream << "\\score{"; - lily_stream.indent(); - lily_stream << " < \\multi 3;"; - lily_stream.indent(); - for ( PCursor<Midi_track*> i( midi_track_p_list_.top() ); i.ok(); i++ ) { - if ( ( midi_track_p_list_.size() != 1 ) - && ( i == midi_track_p_list_.top() ) ) - continue; - lily_stream << "\\melodic{ "; - lily_stream << "\\$" << i->name_str(); - lily_stream << " }"; - lily_stream.newline(); - } - lily_stream.tnedni(); - lily_stream << ">"; - lily_stream.newline(); - lily_stream << "\\paper{"; - lily_stream.indent(); - lily_stream << "unitspace = 20.0\\mm;"; - lily_stream.tnedni(); - lily_stream << "}"; - lily_stream.newline(); - lily_stream << "\\midi{"; - lily_stream.indent(); - // not use silly 0 track - midi_track_p_list_.bottom()->midi_tempo_p_->output_mudela( lily_stream, true ); - lily_stream.tnedni(); - lily_stream << "}"; - lily_stream.tnedni(); + lily_stream << "\\score{\n"; + lily_stream << " < \\multi 3;\n"; + for ( PCursor<Midi_track*> i( midi_track_p_list_.top() ); i.ok(); i++ ) { + if ( ( midi_track_p_list_.size() != 1 ) + && ( i == midi_track_p_list_.top() ) ) + continue; + lily_stream << "\\melodic{ "; + lily_stream << "\\$" << i->id_str(); + lily_stream << " }\n"; + } + lily_stream << ">\n"; + + lily_stream << "\\paper{"; + lily_stream << "unitspace = 20.0\\mm;"; + lily_stream << "}\n"; + + lily_stream << "\\midi{"; + // not use silly 0 track + midi_track_p_list_.bottom()->midi_tempo_p_->output_mudela( lily_stream, true ); + lily_stream << "}\n"; - lily_stream << "}"; - lily_stream.newline(); + lily_stream << "}\n"; return 0; } diff --git a/mi2mu/midi-track.cc b/mi2mu/midi-track.cc index f575ccfe68..0efb703501 100644 --- a/mi2mu/midi-track.cc +++ b/mi2mu/midi-track.cc @@ -126,6 +126,17 @@ Midi_track::get_free_midi_voice_l( Moment mom ) } String +Midi_track::id_str() +{ + String str = name_str(); + for ( int i = 0; i < str.length_i(); i++ ) + if ( ( !i && !isalpha( str[ i ] ) ) + || !isalnum( str[ i ] ) ) + *( str.ch_l() + i ) = '_'; + return str; +} + +String Midi_track::name_str() { if ( name_str_.length_i() ) @@ -223,17 +234,12 @@ Midi_track::process() tor( DEBUG_ver ) << ":sdne" << endl; } - void Midi_track::output_mudela( Lily_stream& lily_stream_r ) { - lily_stream_r << name_str() << " = \\melodic{"; - lily_stream_r.indent(); - lily_stream_r << "% midi copyright:" << copyright_str_; - lily_stream_r.newline(); - lily_stream_r << "% instrument:" << instrument_str_; - lily_stream_r.newline(); - + lily_stream_r << "$" << id_str() << " = \\melodic{\n"; + lily_stream_r << "% midi copyright:" << copyright_str_ << "\n"; + lily_stream_r << "% instrument:" << instrument_str_ << "\n"; // int bar_i = 1; int bar_i = 0; @@ -333,9 +339,7 @@ Midi_track::output_mudela( Lily_stream& lily_stream_r ) // bar_i++; // tor( NORMAL_ver ) << '[' << bar_i << ']' << flush; - lily_stream_r.tnedni(); - lily_stream_r << "} % " << name_str(); - lily_stream_r.newline(); + lily_stream_r << "} % " << name_str() << "\n"; } @@ -346,13 +350,12 @@ Midi_track::output_mudela_begin_bar( Lily_stream& lily_stream_r, Moment now_mom, Moment into_bar_mom = now_mom - Moment( bar_i - 1 ) * bar_mom; if ( bar_i > 1 ) { if ( !into_bar_mom ) - lily_stream_r << "|"; - lily_stream_r.newline(); + lily_stream_r << "|\n"; } lily_stream_r << "% " << String_convert::i2dec_str( bar_i, 0, ' ' ); if ( into_bar_mom ) lily_stream_r << ":" << Duration_convert::dur2_str( Duration_convert::mom2_dur( into_bar_mom ) ); - lily_stream_r.newline(); + lily_stream_r << "\n"; } diff --git a/mi2mu/my-midi-parser.cc b/mi2mu/my-midi-parser.cc index e3a4c988cc..7c86998486 100644 --- a/mi2mu/my-midi-parser.cc +++ b/mi2mu/my-midi-parser.cc @@ -121,7 +121,8 @@ My_midi_parser::note_end_midi_event_p( int channel_i, int pitch_i, int dyn_i ) // running_i64_i64_a_[ channel_i ][ pitch_i ] = -1; // assert( start_i64 != -1 ); // did we start? - Duration dur( 0 ); + Duration dur; + dur.type_i_ = 0; if ( Duration_convert::no_quantify_b_s ) dur = Duration_convert::ticks2_dur( (I64)now_i64_ - start_i64 ); else { diff --git a/tex/dimen.tex b/tex/dimen.tex index 59c50fb1e4..1b38526a5c 100644 --- a/tex/dimen.tex +++ b/tex/dimen.tex @@ -2,12 +2,11 @@ % A tex file to help determine dims. % -\font\musicfont=musixsps -\font\slurfont=xhslu16 +\font\musicfont=musix16 +\font\slurfont=xslu16 \font\specfont=musixspx -% \def\thefont{\musicfont} +\def\thefont{\musicfont} %\def\thefont{\specfont} -\def\thefont{\slurfont} \def\mb#1{{\thefont\char#1}} @@ -21,7 +20,7 @@ \divide\wid by 2 \here=-\wid \loop\ifdim\here<\wid\advance\here by\inc - \hbox to0pt{\kern\here\vrule width0.05pt height 4pt\hss}% + \hbox to0pt{\kern\here\vrule width0.05pt height 1pt depth 1pt\hss}% \repeat% } @@ -32,18 +31,20 @@ \divide\wid by 2 \here=-\wid \loop\ifdim\here<\wid\advance\here by\inc - \vbox to0pt{\vskip\here\vrule width2pt height 0.05pt\vss}% + \hbox to0pt{\vbox to0pt{\vss\hrule width2pt height 0.05pt\kern\here}\hss}% \repeat% } -\def\twhrul{\hbox to 0pt{\hbox{\hruler{20}\vrule - width0.1pt height 3ptdepth 1pt}}} -\def\twvrul{\hbox{\vbox to 20pt{\vruler{20}\vrule - width3pt height 0.1pt}}} +\def\twhrul{\hbox to 0pt{\hbox{\hruler{20}% + \vrule width0.1pt height 2pt depth 2pt}}} +\def\twvrul{\vbox to0pt{\vss\hbox to0pt{\hss\vruler{12}}\vss}% + \kern-1pt\vrule width4pt height 0.1pt}% + \def\doitem#1{ - #1 % - %\twvrul%doesn't work - \hbox to 50pt{\qquad\twhrul\mb{#1}\hss}\setbox0=\hbox{\mb{#1}} width \the\wd0\ depth \the\dp0 \ height \the\ht0} + #1% + \vbox to12pt{\vfill\hbox to0pt{\qquad\kern-1pt\twvrul\hss}}% + \hbox to50pt{\qquad\twhrul\mb{#1}\hss}% + \setbox0=\hbox{\mb{#1}} width \the\wd0\ depth \the\dp0 \ height \the\ht0} \newcount\n \def\charn{\n=-1 diff --git a/tex/taupindefs.tex b/tex/taupindefs.tex index 0c71bea3a1..e51404f93e 100644 --- a/tex/taupindefs.tex +++ b/tex/taupindefs.tex @@ -97,6 +97,7 @@ \def\ldoubledot{\kern-\notewidth\doubledot} \def\ltripledot{\kern-\notewidth\tripledot} +\mdef\turn{67} \maccentdef\sforzato{30}{-3/2} \maccentdef\marcato{20}{-1/1} \maccentdef\imarcato{21}{1/1} @@ -115,3 +116,5 @@ \mdef\ispicato{29} \mdef\upbow{23} \mdef\downbow{22} + +\def\tr{{\it tr}} |