# class name silence?
Dstream 1
+File_path 1
My_lily_lexer 1
PCol 1
Score_column 1
Melodic_req 0
Midi_walker 1
Stem_req 1
-Group_change_req 1
+Group_change_req 0
Script_req 1
Colinfo 1
Word_wrap 1
TOPLEVEL_MAJOR_VERSION = 0
TOPLEVEL_MINOR_VERSION = 0
-TOPLEVEL_PATCH_LEVEL = 45
+TOPLEVEL_PATCH_LEVEL = 46
# use to send patches, always empty for released version:
# include separator: ".postfix", "-pl" makes rpm barf
-TOPLEVEL_MY_PATCH_LEVEL =
+TOPLEVEL_MY_PATCH_LEVEL = .jcn1
-[Draft version]
+Do you pine for the nice days of Linux 0.95, when men were men and
+wrote their own applications? Are you without a nice project and just
+dying to cut your teeth into a bleeding edge application you can
+modify for your needs. Do you find it frustrating that everything
+works in LaTeX? No more all-nighters to get a nifty program working?
+Then this post might be just for you!
-CALL FOR HACKERS: LilyPond, the Music Typesetter
+I have been working very hard on a music typesetting system (called
+LilyPond) the past half year, and I finally think it is ready to be
+used and hacked at by a larger public than me and my co-developer.
-[Sorry if this is a bit off-topic; I want to announce this software to
-small crowd, because it is still test-stage]
+Sources for this project are on
-Hi net!
+ ftp://pcnov095.win.tue.nl/pub/lilypond/
-this is to announce the availability of the first public release
-(v0.1) of my music typesetter.
+detailed info and examples can be found on the webpage at:
+
+ http://www.stack.nl/~hanwen/lilypond/index.html
+
+(it is somewhat lousy, but I have more important things to do).
+
+
+[DETAILED DESCRIPTION]
WHAT IS LILYPOND
As a bonus, you can also output a MIDI file of what you typed.
-HOW DOES IT WORK
-
-The input is a script file (example appended) which is read. The
-script file is a "music definition", ie, you type the melody as if it
-is read out loud
-
-LilyPond interprets this melody and generates appropriate output items
-(balls, stems, beams), and calculates where they should be put. Then
-it outputs a TeX file. Warning: this said calculations is *slow* (a full
-page of music typically takes 1 minute on my 486/66)
+The input is a script file which is read. The script file is a "music
+definition", ie, you type the melody as if it is read out loud
-WHY IS THIS A TEST VERSION
+WHAT IS NEEDED?
-There a lot of advanced features (grace notes, piano staffs) which are
-VapourFeatures (tm). We're not sure about the language. It may change;
-having a large user base is a burden then.
+for compilation you need
-WHY A CALL FOR HACKERS
+ Unix. (Win32 is known to work, too)
+ GNU C++ v2.7 or better, with libg++ installed.
+ GNU make.
+ Flex (2.5.1 or better).
+ Bison.
-Currently, the development team has three people. I'd this project to
-have more people working on it (there is a lot of work to be done) I
-think this program is pretty original, so join in if you know anything
-about music and computers!
+for running you need
-As an aside, I really like the anarchist approach of linux development.
+ TeX
+ The MusixTeX fonts. (I use those in MusixTeX T.59)
-WHAT HAS TO BE DONE
+FEATURES
-LilyPond is written in Gnu C++, and it is (if I say so myself) written
-very cleanly (Lots of classes, lots of comments, small files/small
-functions) and with extensions in mind.
+ASCII script input, with identifiers (for music reuse), customizable
+notenames
- - Coding. For this time, there won't any biggish (global)
-source hackings. There are a lot of small projects which could use
-some work.
+MIDI output lets you check if you have entered the correct notes.
+MIDI to Mudela conversion through the mi2mu program.
- - Some TeX hacking. I know little about TeX
+Multiple staffs in one score. Each staff can have a different meters.
+Multiple voices within one staff; beams optionally shared between
+voices. (well, more than 2 voices won't look pretty --yet.) Multiple
+scores within one input file. Each score is output to a different
+file.
- - Documentation. I don't have time for this
-
-I WANT MORE INFO!
-
-You can download it at:
-
- ftp://pcnov095.win.tue.nl/pub/lilypond
-
-or visit the incredibly lousy webpage at:
-
- http://www.stack.nl/~hanwen/lilypond/index.html
+Beams, slurs, chords, super/subscripts (accents and text), triplets,
+general n-plet (triplet, quadruplets, etc.), lyrics, transposition
+dynamics (both absolute and hairpin style) clef changes, meter
+changes, cadenza-mode, key changes, repeat bars
-EXAMPLE INPUT
-
- % twinkle twinkle little star
- melody = music {
- $\clef\violin
- c c | g g | a a | g g |
- f f | e e | d d8.( e16 | )c2 |
-
- g g | f f | e e | d d |
- g g | f f | e( e8. f16 | e )d |
-
- c c | g g | a a | g g |
- f f | e e | d d8.( e16 | )c2
- $
- }
-
- text2 = music {
- @
- \textstyle "roman"
- When the bla- zing sun is gone,2
- When he no- thing shines up- on,2
- Then you show your lit- tle light,2
- Twin- kle, twin- kle, all the night.2
- Twin- kle, twin- kle, lit- tle star,2
- How I won- der what you are!2
- @
- }
-
- english_staf = staff {
- lyric
- music { text2 }
- }
-
- score {
- staff { melodic music { melody } }
- staff { english_staf }
- paper {
- unitspace 2.5cm
- }
- commands {
- meter {2 * 4}
- skip {24*2}
- bar "||"
- }
- }
+[Kudos to FSF, all linux hackers, and --of course-- especially
+GrandMaster Linus T, for the OS and The Announce :-]
+ Han-Wen Nienhuys <hanwen@stack.nl>
+ Jan Nieuwenhuizen <jan@digicash.com>
-- Geoffrey James, "The Tao of Programming"
+=head2 FILES
+
+Definitions of classes that are only accessed via pointers
+(*) or references (&) shall not be included as include files.
+
+Include files in C++ always have the file name extension ".hh".
+
+Implementation files in C++ always have the file name
+extension ".cc".
+
+Inline definition files always have the file name extension ".icc".
+
+Template include files always have the file name extension ".tcc".
+
+
=head2 INDENTATION
in emacs:
Class::member()
Type Class::member_type_
-the C<type> is a Hungarian notation postfix for $C<Type>$. See below
+the C<type> is a Hungarian notation postfix for C<Type>. See below
=head2 COMMENTS
=head2 Disadvantages
-=over 5
+=over 4
=item *
=head2 Proposal
-=over 5
+=over 4
=item *
=head2 Types
-=over 5
+=over 4
=item C<byte>
The following types modify the meaning of the prefix.
These are precede the prefixes:
-=over 5
+=over 4
=item C<a>
=back
-=over 5
+=over 4
=item C<loop_i>
Variable bar: an C<Int*> that you must not delete
=back
-
-
-
(most) of the checking is done B<after> parsing (some checks even are
done after the break calc!); I'm sorry.
+Most errors come with a context of the Mudela element that originated
+it. This context may be slightly wrong: the parser sometimes reads a
+few tokens ahead to determine the syntax.
+
[yep.. has to be written..]
--- /dev/null
+=head1 NAME
+
+LilyExamples - LilyPond example input
+
+=head1 DESCRIPTION
+
+This file documents the example inputfiles of LilyPond. Information of
+each file:
+
+ title
+ description (composer, piece)
+ tested LilyPond features.
+ copyright info
+
+=head2 F<cadenza.ly>
+
+A cadenza to Mozart Horn concerto no. 3.
+
+Features: cadenza mode.
+
+Copyright: public domain
+
+=head2 F<coriolan-alto.ly>
+
+Ludwig van Beethoven (1770-1792), Opus 62 Ouverture zu Collins
+Trauerspiel "Coriolan"
+
+a 5 bar fragment of the alto part
+
+Features: pushgroup, popgroup.
+
+=head2 F<error.ly>
+
+Error messages, context errors.
+
+=head2 F<fugue1.midi.ly>
+
+
+=head2 F<kortjakje.ly>
+
+Ah, vous dirais-je, maman" (Mozart, KV 265), bare
+bones version.
+
+Features: example with lots of newbie comment.
+
+=head2 F<maartje.ly>
+
+Features: partial measure.
+
+=head2 F<martien.ly>, F<ml*.ly>
+
+Martien Lohman, Viola Quartet.
+
+Features: n-plets, multi-staff scores.
+
+Copyright: copyright Martien Lohman 1997.
+
+=head2 F<midi.ly>
+
+Features: midi output.
+
+=head2 F<plet.ly>
+
+Features: plets.
+
+=head2 F<rhythm.ly>
+
+Features: auto beams, multiple parralel meters.
+
+=head2 F<scales.ly>
+
+Features: plets, accents, beam steepnesses.
+
+=head2 F<scsii-menuetto.ly>
+
+J. S. Bach, Solo Cello Suites. Suite II part v Menuetto I
+
+Features: breaking algorithm, chords, multivoice, accents
+
+=head2 F<standchen.ly>
+
+St\"andchen (Serenade) "Leise flehen meine
+Lieder" D.957 No.4 Franz Schubert (1797-1828)
+
+Features: multivoice, accents, lyrics, chords, piano music
+
+=head2 F<twinkle.ly>
+
+Features: lyrics
+
+=head2 F<wohltemperirt.ly>
+
+JS Bach, Das Wohltemperirtes Clavier I, Fuga II (c-minor)
+
+a 7 bar fragment.
+
+Features: stem direction, multivoice.
+
+Copyright: public domain
< { a() e } { c () g } >
-in stead of
+instead of
<a( c(> <)e )g>
-to generate slurs between the chords?
+to generate slurs between the chords?
-A: When you type
+A L1: When you type
<a c> <e g>
>
-Q: Why are [] around the notes, and () inbetween?
+Q L2: Why are [] around the notes, and () inbetween?
-A: [] designate beams, a note can only be in one beam at the same
+A L2: [] designate beams, a note can only be in one beam at the same
time. () is a slur, which connects notes. You need to be able to
specify
a()a()a
+Q L3: Why shouldn't I put all commands (\clef, \meter) inside the music?
-Q: I want a DOS/NT/W95 port.
-
-A0: Reconsider. Try Linux. It's fun!
-
-A1: Currently (patchlevel 27), LilyPond (and flowerLib) compiles, links
-and runs on windhoos-nt, using the cygnus gnu port (release b17.1).
-I (JCN) only had to make a minor workaround for missing library calls.
-Have a look at http://www.cygnus.com/gnu-win32. To make LilyPond type
-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.)
-
-A2: I haven't had time to find a GCC crosscompiler (I<with> g++ and
-libg++, mind you) to DOS/win (in rpm, please :).
-
-
-Q: Why GPL?
-
-A: Yes.
-
-Q: Why shouldn't I put all commands (\clef, \meter) inside the music?
-
-A: You should do what you like, but at some time we will enable
+A L3: You should do what you like, but at some time we will enable
quoting of music ("Stichnoten"). Besides if you are going to type an
orchestral score, then you'd probably want to enter most of the meter,
repeat commands only once.
+=head2 MISCELLANEOUS
+
+Q M1: Why GPL?
-Q: Could you implement feature XXXX? It is really easy, just extend
+A M1: Yes.
+
+Q M2: Could you implement feature XXXX? It is really easy, just extend
the syntax to allow YYYY!
-A: If it is reasonable, I'll add XXXX to the TODO list. In general
+A M2: If it is reasonable, I'll add XXXX to the TODO list. In general
finding a cute syntax (such as YYYY) isn't very hard. The complicated
issue how to adapt the internals to do XXXX. The parser is really a
simple front end to the complicated internals.
-Q: Why do I need g++ >= 2.7?
+Q M3: Why do I need g++ >= 2.7?
-A: By using g++ LilyPond is portable to all platforms which support
+A M3: By using g++ LilyPond is portable to all platforms which support
g++ (there are quite a few). Not having to support other compilers
-saves us a I<lot> of trouble. LilyPond & FlowerLib uses:
+saves us a I<lot> of trouble. LilyPond and FlowerLib use:
-=over 6
+=over 4
=item *
builtin bool
=back
+=head2 DOZE
+
+Q D1: I want a DOS/NT/W95 port.
+
+A D1.0: Reconsider. Try Linux. It's fun!
+
+A D1.1: Currently (patchlevel 27), LilyPond (and flowerLib) compiles, links
+and runs on windhoos-nt, using the cygnus gnu port (release b17.1).
+I (JCN) only had to make a minor workaround for missing library calls.
+Have a look at http://www.cygnus.com/gnu-win32. To make LilyPond type
+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.)
+
+A D1.2: I haven't had time to find a GCC crosscompiler (I<with> g++ and
+libg++, mind you) to DOS/win (in rpm, please :).
+
+
+Q D2: I-m dozed enough to run the (sometimes bit stale) .exe-s you distribute.
+Why do i need cygwin.dll?
+
+A D2: It-s all in this cut-n-paste:
+
+Minimalist GNU-Win32 Readme
+version 0.1.3
+March 20, 1997
+Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
+
+[...]
+
+0.3 Fixes and Improvements
+
+[...]
+In the "coming soon" category I have a version of the GNU Standard C++
+library ported to Mingw32. This means you can use iostreams, complex
+numbers and all those neat STL (Standard Template Library) things
+without needing the Cygwin DLL. I hope to put this port up for
+downloading soon (along with the source of course).
+
+[...]
+
+3.2 C++ Support
+
+To add C++ Support to the above the following extra files are required:
+
+In C:\cygnus\H-i386-cygwin32\lib\gcc-lib\i386-cygwin32\cygnus-2.7.2-
+961023:
+ cc1plus.exe
+
+Note that this does not include support for the standard C++ libraries
+(only the C run time libraries) or for iostreams. That support is still
+only available with the Cygwin32 API.
+
LilyPond -- the Webpage
+Excuse me for this poor page. I don't really have time for doing this..
+
=head1 DESCRIPTION
-Excuse me for this poor page. I don't really have time for doing this..
+Technically LilyPond is a preprocessor which generates TeX
+(or LaTeX) output which contains information to typeset a musical
+score. Practically it is a typesetter, which only uses TeX as an
+output medium. (this is handy because there exist music fonts for TeX)
-[and yes, i write webpages in POD :-]
+As a bonus, you can also output a MIDI file of what you typed.
+
+It translates script files (mudela files or F<*.ly>'s) into TeX input.
+Typesetting music is a complex task, whereas the message that printed
+music conveys is usually a simple one. LilyPond is a try at providing
+a simple interface for setting music.
=head1 DOCUMENTATION
+=item *
+<a href=INSTALL.html
+>
+The installation instructions.
+</a
+>
+
+
+
+
=item *
<a href=lilypond.html
>
>
=item *
-<a href=lelieblond.png
+<a href=lelieblond.gif
>
The lilypond logo (Big)
</a
=item *
<a href=lelie_logo.gif
>
-The lilypond logo (in gif format)
+The lilypond logo (in gif format, medium size)
</a
>
+=item *
+<a href=example_output.html
+>
+examples: MIDI, PS, GIF and input.
+</a
+>
=item *
-<a href=wohltemperirt.ly.txt
+<a href=examples.html
>
-An example inputfile: from Bach's WTK: c-minor fugue
+info on examples
</a
>
=item *
-<a href=wohltemperirt.gif
+<a href=TODO.txt
>
-A Gif file of the example
+The TODO list.
</a
>
=item *
-<a href=wohltemperirt.ps
+<a href=NEWS.txt
>
-PS output
+The Change log
</a
>
=item *
-<a href=wohltemperirt.midi
+<a href=CodingStyle.html
>
-MIDI output
+The coding standards of the lilypond project.
</a
>
Get it at ftp://pcnov095.win.tue.nl/pub/lilypond !
=cut
niet veranderen in expliciete URL. pod2* doet dit automaties.
+
+Should generate auto from POD sources.
+
=pod
=head1 AUTHOR
Han-Wen Nienhuys <hanwen@stack.nl>, for this page
+
+<a href=sconstat/stats.html
+>
+Stats on this page.
+</a
+>
LilyPond is a "5-pass" system:
-=over 5
+=over 4
=item 1. Parsing:
Very simple, just walk all Line_of_* and follow the links over there
-=back
-
-
=back
=head1 Request_register
+++ /dev/null
-=head1 NAME
-
-LilyInput - LilyPond input format
-
-=head1 DESCRIPTION
-
-This page globally documents the the LilyPond input format, mudela.
-To get a better impression, please study some examples.
-
-=head2 Overview
-
-General format of a construct:
-
- BLOCKNAME { <info to go with this block> }
-
-Some types allow declarations:
-
- IDENTIFIER = BLOCKNAME {
- <info to go with this block>
- }
-
- ..
-
- BLOCKNAME {
- IDENTIFIER
- ...
- }
-
-
-In musicmode, eg,
-
- ''!c8.-"text"_v
-
-and in lyricmode, eg,
-
- Twin- kle, twin- kle lit- tle star,2
-
-a lot of characters parse differently
-than in "command" mode, eg,
-
- identifier = score { .. }
-
-So you have to signal this to the tokenizer. This is done with
-'$'. '$' is a delimiter, which used by the tokenizer only. The same
-goes for lyrics, it has a '@' delimiter.
-
-=item *
-musicmode: The brace still is used to group grammatical groups.
-
-=item *
-musicmode: "word" are preceded by a '\' (backslash)
-
-This means you can write some stuff in a zillion ways:
-
-=item 1.
- $\var = \blockname { ... } $
-
-=item 2.
- var = blockname { $ ... $ }
-
-=item 3.
- var = $ $ $\blockname { ... $ }
-
-=head2 Comments
-
-Not really crystallized; you can use '#' or '%' as line comment
-
-=head2 other
-
-LilyPond first reads 'symbol.ini', which contains declarations crucial
-to proper operation of LilyPond (symbol tables, note names).
-
-This language looks a lot like Rayce's (Rayce is a raytracer that I've
-written as a hobby project. I used as a practice program for writing
-(among others) C++ and Yacc. It also gave me RSI :-( ) which in turn
-owes a lot to the POVRay raytracer. Now, I know, musictypesetting and
-Raytracing do not necessarily require the same input format, but I was
-just to lazy to make up a new and/or better input format. Suggestions
-appreciated.
-=head1 NAME
-
-LilyInput - LilyPond input format
-
-=head1 DESCRIPTION
-
-This page globally documents the the LilyPond input format, mudela.
-To get a better impression, please study some examples.
-
-=head2 Overview
-
-General format of a construct:
-
- BLOCKNAME { <info to go with this block> }
-
-Some types allow declarations:
-
- IDENTIFIER = BLOCKNAME {
- <info to go with this block>
- }
-
- ..
-
- BLOCKNAME {
- IDENTIFIER
- ...
- }
-
-
-In musicmode, eg,
-
- ''!c8.-"text"_v
-
-and in lyricmode, eg,
-
- Twin- kle, twin- kle lit- tle star,2
-
-a lot of characters parse differently
-than in "command" mode, eg,
-
- identifier = score { .. }
-
-So you have to signal this to the tokenizer. This is done with
-'$'. '$' is a delimiter, which used by the tokenizer only. The same
-goes for lyrics, it has a '@' delimiter.
-
-=item *
-musicmode: The brace still is used to group grammatical groups.
-
-=item *
-musicmode: "word" are preceded by a '\' (backslash)
-
-This means you can write some stuff in a zillion ways:
-
-=item 1.
- $\var = \blockname { ... } $
-
-=item 2.
- var = blockname { $ ... $ }
-
-=item 3.
- var = $ $ $\blockname { ... $ }
-
-=head2 Comments
-
-Not really crystallized; you can use '#' or '%' as line comment
-
-=head2 other
-
-LilyPond first reads 'symbol.ini', which contains declarations crucial
-to proper operation of LilyPond (symbol tables, note names).
beams, slurs, chords, super/subscripts (accents and text), triplets,
general n-plet (triplet, quadruplets, etc.), lyrics, transposition
+dynamics (both absolute and hairpin style)
=item *
This is what the output looks like over here:
LilyPond 0.0.40 #0/FlowerLib 1.1.7 #2. Compile: Mar 11 1997, 22:58:47 (g++ 2.7.2)
- Parsing ... [./init//symbol.ini[./init//dynamic.ini][./init//dutch.ini][./init//script.ini][./init//table_sixteen.ini]][./input/wohltemperirt.ly]
+ Parsing ... [./init//symbol.ini[./init//dynamic.ini][./init//dutch.ini]
+ [./init//script.ini][./init//table_sixteen.ini]][./input/wohltemperirt.ly]
Setting up music ...Processing music ............
Preprocessing ...
Calculating column positions ... [3][6][9]
=back
+=head1 ENVIRONMENT
+
+B<LILYINCLUDE> an (one) additional directory for finding lilypond data.
+
=head1 SEE ALSO
+mudela(5)
+
There are some documentation files in the subdirectory F<Documentation/>,
-among others: lilygut, lilyinput, error, faq,
+among others: lilygut, error, faq,
+
+http://www.stack.nl/~hanwen/lilypond/index.html
=head1 REMARKS
-25/Mar/97 LilyPond 0.0.45 1
+25/Mar/97 LilyPond 0.0.46 1
-25/Mar/97 LilyPond 0.0.45 2
+25/Mar/97 LilyPond 0.0.46 2
-25/Mar/97 LilyPond 0.0.45 3
+25/Mar/97 LilyPond 0.0.46 3
+pl 46.jcn1
+Bugfix
+ - reincluded {interval,pcursor,plist}.tcc
+ - renamed Interval::elt_q to elt_b, invoking of empty to empty_b
+ - readded second (0) arg to warning function (only lily exports
+ a warning(String) function)
+ - fixed dist make/Files.make
+
+pl 46
+ - examples.pod
+ - LILYINCLUDE env var.
+ - push/popgroup
+ - website updated
+ - Swallow_register
+ - Lyric_register.
+ - Staff_sym_register
+ - user settable register config
+ - struct Input now used iso defined_ch_C_
+ - Walker_registers and Staff_registers separated
+ - dynamic-reg -> hairpins
+
+pl 44.jcn2
+ - doze configure/compile fixes
+ - doze make refixed
+ - faq
+ - install mudela manpage too
+ - RedHat spec lilypond.spec fixed
+ - target: rpm (make RedHat packages)
+
+******
+Mar 26
pl 45
- Removing unused Voice_regs & Voice_groups
- -O2 bugfix
pl 41.jn1
Bugfix
- doze compile
+*******
pl 41
- release
pl 40.3
pl 40.hwn1
- hairpin dynamics
- notename now as identifier. Parser/lexer cleanup
- - ''!a now a!'' (NOT!?)
pl 40.2
- mi2mu --blonde-durations, --no-silly options.
******
+Mar 11
pl 40
- release
- fixed midi.ly
*******
+Feb 25
pl 35
- Register_group
Bugfix
Bugfix
- calcideal assertion bugfix
*******
+Feb 12 13:55
pl 30
Features
- Voice_group_registers, Voice_registers, *_register
- Complex_staff
*******
+ Jan 27 '97
pl 25
- other clefs added, keys typeset properly (MB)
- dependencies for Staff_elem's
*******
-pl 20:
+Dec 23
+pl 20:
- updated doco to .pod
- include files from .ly
Internal changes:
- Input_{score/staff}
*******
+Dec 2
pl 13
- Horizontal/Vertical music
- Input_commands
before 0.1
-
+ * update 20 pt table
+
* remove spurious/outdated comments in .ly, debug .ly
* pushgroup, popgroup.
- * basic dynamics
-
* decent TeX page layout
* per-pstaff item-widths
* flower config: separate optiflags.
- * sort out headers, see m2m
-
* do platform stuff: configure, header(s), targets, build (out?)
BUGS
SEVERELY LACKING:
- * hairpins
-
* grace notes
FURTHER FOR ORCHESTRAL SCORE:
INPUTLANGUAGE
- * read ENV for include /init path
+ * unix style paths for LILYINCLUDE ENV
* configure pitch_byte
* rest name configurable
+ * Raw request syntax
+
* uniformate: \clef\violin, \clef"violin", \geometric 1.4,
\meter{ 2/4 }, etc.
+ * subtime with Subtle_reqs
+
SMALLISH PROJECTS
+ * bugreport to doc++ devel: struct not in class hier; public
+ virtual baseclasses
+
+ * indentable stream for TeX stream, lily stream, Dstream.
+
* key transposition
* caching breakpoints / saving them.
* caching of Register_group_register hierarchies.
-
* use (char *) iso. String for communication between lexer and
parser.
* guitar chord
+ * Junk Staff_column, and find the requests while walking the Voices.?
+
* better beamslope calculation: QLP for beams?
* implement better breaking algorithm
#!/usr/bin/perl -w
+# stuff should be generated in out directory.
+
sub
set_hrefs
{
}
local $base="lilypond/";
-local @examples=("wohltemperirt");
+local @examples=("wohltemperirt" ,"standchen", "scsii-menuetto");
+
+#mkdir "lilypond";
+sub
+ gen_html
+{
+ print "generating HTML";
+ foreach $a (<*.pod>) {
+ $f = $a;
+ $f =~ s/.pod/.html/;
+
+ system "pod2html $a" if ( ! -f $f ) ;
+ }
+}
+
+sub
+ gen_examples
+{
+ print "generating examples: ";
+ foreach $a (@examples) {
+ print "$a\n";
+ $texfile="test";
+ $tex = "tex $texfile";
+ if ($a eq "standchen" || $a eq "scsii-menuetto") {
+ $tex = "latex input/$a";
+ $texfile = "$a";
+ }
+ if ( ! -f "$a.ly.txt" ) {
+ system "ln ../input/$a.ly ./$a.ly.txt";
+ }
+ if ( ! -f "$a.ps.gz" ) {
+ system "cd ..; lilypond input/$a;$tex;".
+ "dvips -o $a.ps $texfile;";
+ }
+ # generate the pixmap at twice the size, then rescale (for antialiasing)
+ if ( ! -f "$a.gif" ) {
+ system "mv ../$a.ps $a.ps; ".
+ "mv ../lelie.midi ../$a.midi $a.midi; ".
+ "gs -q -sDEVICE=ppmraw -sOutputFile=- -r200 -dNOPAUSE $a.ps -c quit |pnmscale 0.5| ppmtogif > $a.gif";
+ system "gzip $a.ps";
+ }
+ }
+}
-system 'pod2html';
-print "generating examples";
+sub
+ gen_list
+{
+ open HTMLLIST, ">example_output.html";
+ print HTMLLIST "<title>LilyPond examples</title>\n";
+ foreach $a (@examples) {
+ $name=$a;
+ print HTMLLIST "<h1>example file: $name</h1>\n<XMP>\n";
+ $cmd= "head ../input/$a.ly | grep \^% \| sed \"s/^%/ /\"";
+ $desc = `$cmd`;
+ print HTMLLIST "$desc\n</XMP>";
-foreach $a (@examples) {
- $texfile="test";
- system "ln ../input/$a.ly ./$a.ly.txt";
- system "cd ..; lilypond input/$a; tex $texfile;".
- "dvips -o $texfile.ps $texfile;";
+ $inputf="$a.ly.txt";
+ $giff="$a.gif";
+ $psf="$a.ps.gz";
+ $midif="$a.midi";
+
+ print HTMLLIST "<ul>
+<li><a href=$inputf> The input file</a>
+<li><a href=$giff>The output (gif)</a>
+<li><a href=$psf>The output (PS)</a>
+<li><a href=$midif>The output (MIDI)</a>
+</ul>";
+ }
+}
+sub
+ copy_files
+{
+ print `ln -s ../out ./docxx` if ( ! -x "docxx" ) ;
+ system "cp ../TODO ./TODO.txt";
+ system "cp ../NEWS ./NEWS.txt";
+}
- # generate the pixmap at twice the size, then rescale (for antialiasing)
- if ( ! -f "$a.gif" ) {
- system "mv ../$texfile.ps $a.ps; ".
- "mv ../lelie.midi $a.midi; ".
- "gs -q -sDEVICE=ppmraw -sOutputFile=- -r200 -dNOPAUSE $a.ps -c quit |pnmscale 0.5| ppmtogif > $a.gif";
- }
+sub
+ do_tar
+{
+ system " tar hcf website.tar *.html *.gif lelie_logo.png *.ps.gz *.ly.txt *.midi docxx/*;" .
+ "gzip -f9 website.tar;" if ( ! -f "website.tar" ) ;
}
-system "cd out; tar hcf ../website.tar *.html *.gif lelie_logo.png *.ps *.ly.txt *.midi docxx/;" .
- "gzip -f9 website.tar;"
+gen_html;
+gen_examples;
+gen_list;
+copy_files;
+do_tar;
+
for ac_prog in bison
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:904: checking for $ac_word" >&5
+echo "configure:905: 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
# 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:938: checking for $ac_word" >&5
+echo "configure:939: 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
# 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:972: checking for $ac_word" >&5
+echo "configure:973: 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
# 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:1006: checking for $ac_word" >&5
+echo "configure:1007: 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
# do something sensible if root hasn't specced dir yet attempts install
echo $ac_n "checking TeX installation directory""... $ac_c" 1>&6
-echo "configure:1042: checking TeX installation directory" >&5
+echo "configure:1043: checking TeX installation directory" >&5
ac_tmp_prefix=$prefix
test "x$ac_tmp_prefix" = xNONE && ac_tmp_prefix=$ac_default_prefix
fi
echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
-echo "configure:1105: checking how to run the C++ preprocessor" >&5
+echo "configure:1106: 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
cross_compiling=$ac_cv_prog_cxx_cross
CXXCPP="${CXX-g++} -E"
cat > conftest.$ac_ext <<EOF
-#line 1118 "configure"
+#line 1119 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1123: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1124: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
ac_safe=`echo "FlexLexer.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for FlexLexer.h""... $ac_c" 1>&6
-echo "configure:1143: checking for FlexLexer.h" >&5
+echo "configure:1144: 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 1148 "configure"
+#line 1149 "configure"
#include "confdefs.h"
#include <FlexLexer.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1153: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1154: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
eval "DIR_DATADIR=$datadir"
DIR_DATADIR="$DIR_DATADIR/lilypond"
echo $ac_n "checking ""... $ac_c" 1>&6
-echo "configure:1555: checking " >&5
+echo "configure:1556: checking " >&5
cat << EOF > lib/out/config.hh
AC_MSG_WARN(Couldn't find \`find'. Please use --enable-texprefix)
else
+AC_SUBST(CXX)
AC_SUBST(DEFINES)
AC_SUBST(COMPILEINFO)
AC_SUBST(AUTOHEADER)
MAJOR_VERSION = 1
MINOR_VERSION = 1
-PATCH_LEVEL = 9
+PATCH_LEVEL = 10
# use to send patches, always empty for released version:
MY_PATCH_LEVEL = # include separator: "-1" or ".a"
#
-include /dev/null $(DEPFILES)
#
+
+localdistclean:
+ rm -f config.cache config.status
+pl 1.1.10
+ - Matrix_storage naming
+ - Matrix_storage::try_right_multiply to help speed up
+ matrix multiply routines.
+
pl 1.1.9
- _C iso _c_l
- - flower debug.
+ - flower-debug.
pl 1.1.8
--- /dev/null
+/*
+ full-storage.cc -- implement Full_storage
+
+ source file of the Flower Library
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "full-storage.hh"
+
+void
+Full_storage::operator=(Full_storage const &fs)
+{
+ resize(fs.height_i_, fs.width_i_);
+ OK();
+ fs.OK();
+ for (int i=0; i<height_i_; i++)
+ for (int j=0; j<width_i_; j++)
+ els_p_p_[i][j]= fs.els_p_p_[i][j];
+}
+
+void
+Full_storage::OK() const
+{
+#ifndef NDEBUG
+ // static Real dummy;
+ assert(max_height_i_ >= height_i_ && max_width_i_ >= width_i_);
+ assert(height_i_ >= 0 && width_i_ >= 0);
+ assert(els_p_p_||!max_height_i_);
+#endif
+}
+void
+Full_storage::resize_cols(int newh)
+{
+ if (newh <= max_height_i_) {
+ height_i_=newh;
+ return;
+ }
+
+ Real ** newa=new Real*[newh];
+ int j=0;
+ for (; j < height_i_; j++)
+ newa[j] = els_p_p_[j];
+ for (; j < newh; j++)
+ newa[j] = new Real[max_width_i_];
+ delete[] els_p_p_;
+ els_p_p_=newa;
+
+ height_i_ = max_height_i_ = newh;
+}
+
+void
+Full_storage::resize_rows(int neww)
+{
+ if (neww <= max_width_i_) {
+ width_i_=neww;
+ return;
+ }
+ for (int i=0; i < max_height_i_ ; i++) {
+ Real* newa = new Real[neww];
+ for (int k=0; k < width_i_; k++)
+ newa[k] = els_p_p_[i][k];
+
+ delete[] els_p_p_[i];
+ els_p_p_[i] = newa;
+ }
+ width_i_ = max_width_i_ = neww;
+}
+
+Full_storage::~Full_storage() {
+ for (int i=0; i < max_height_i_; i++)
+ delete [] els_p_p_[i];
+ delete[] els_p_p_;
+}
+
+void
+Full_storage::resize(int rows, int cols)
+{
+ OK();
+ resize_cols(rows);
+ resize_rows(cols);
+
+}
+
+
+bool
+Full_storage::mult_ok(int i, int j) const
+{
+ return valid(i,j);
+}
+
+bool
+Full_storage::trans_ok(int i, int j) const
+{
+ return valid(i,j);
+}
+
+
+void
+Full_storage::trans_next(int &i, int &j) const
+{
+ assert(trans_ok(i,j));
+ i++;
+ if (i >= height_i_) {
+ i=0;
+ j ++;
+ }
+}
+
+void
+Full_storage::mult_next(int &i, int &j) const
+{
+ assert(mult_ok(i,j));
+ j++;
+ if (j >= width_i_) {
+ j=0;
+ i++;
+ }
+}
+
+void
+Full_storage::delete_column(int k)
+{
+ assert(0 <= k &&k<width_i_);
+ for (int i=0; i< height_i_ ; i++)
+ for (int j=k+1; j <width_i_; j++)
+ els_p_p_[i][j-1]=els_p_p_[i][j];
+ width_i_--;
+}
+void
+Full_storage::delete_row(int k)
+{
+ assert(0 <= k &&k<height_i_);
+ for (int i=k+1; i < height_i_ ; i++)
+ for (int j=0; j < width_i_; j++)
+ els_p_p_[i-1][j]=els_p_p_[i][j];
+ height_i_--;
+}
+
+
+void
+Full_storage::insert_row(int k)
+{
+ assert(0 <= k&& k <=height_i_);
+ resize_cols(height_i_+1);
+ for (int i=height_i_-1; i > k ; i--)
+ for (int j=0; j <width_i_; j++)
+ els_p_p_[i][j]=els_p_p_[i-1][j];
+
+}
+
+
+Array<Real>
+Full_storage::row(int n) const
+{
+ Array<Real> r;
+ for (int j = 0; j < width_i_; j++)
+ r.push(els_p_p_[n][j]);
+ return r;
+}
+
+Array<Real>
+Full_storage::column(int n) const
+{
+
+ Array<Real> r;
+ for (int i = 0; i<height_i_; i++)
+ r.push(els_p_p_[i][n]);
+ return r;
+}
+
+
+Full_storage::Full_storage(Full_storage&s)
+{
+ init();
+ (*this) = s;
+}
+Matrix_storage*
+Full_storage::clone()
+{
+ return new Full_storage(*this);
+}
+
+
+Matrix_storage *
+Matrix_storage::get_full(int n, int m)
+{
+ return new Full_storage(n,m);
+}
+
+bool
+Full_storage::try_right_multiply(Matrix_storage * dest, Matrix_storage const * right)
+{
+ if (dest->name() != Full_storage::static_name() ||
+ right->name() != Full_storage::static_name())
+ return false;
+
+ Full_storage *d_l = (Full_storage*)dest;
+ Full_storage *r_l = (Full_storage*)right;
+
+ d_l->set_size(height_i_, r_l->width_i_);
+ for (int i=0; i < d_l->height_i_; i++)
+ for (int j = 0; j < d_l->width_i_; j++) {
+ Real &r(d_l->els_p_p_[i][j]);
+ r=0.0;
+ for (int k = 0; k < width_i_; k++)
+ r += els_p_p_[i][k] * r_l->els_p_p_[k][j];
+
+ }
+ return true;
+
+
+}
+IMPLEMENT_STATIC_NAME(Full_storage);
+IMPLEMENT_STATIC_NAME(Matrix_storage);
--- /dev/null
+/*
+ class-name.hh -- declare
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef CLASS_NAME_HH
+#define CLASS_NAME_HH
+
+/** a macro to declare the classes name as a static and virtual function.
+ The static_name() can *not* be inlined (this might have the effect that
+ s->name() != S::static_name(). Overlapping strings need not be merged in C++
+ */
+#define NAME_MEMBERS(c) \
+static char const *static_name();\
+virtual char const *name() const{ return c::static_name(); } \
+int a_stupid_nonexistent_function_to_allow_the_semicolon_come_out()
+
+#define IMPLEMENT_STATIC_NAME(c)\
+ char const *c::static_name() { return #c; }
+
+#endif // CLASS-NAME_HH
#include "pcursor.hh"
#include "list.hh"
-#include "cursor.inl"
+#include "cursor.icc"
#include "iterate.hh"
#endif // CURSOR_HH
--- /dev/null
+ // cursor.icc -*-c++-*-
+#ifndef CURSOR_INL
+#define CURSOR_INL
+#include <assert.h>
+
+
+template<class T>
+inline
+Cursor<T>::Cursor( const List<T>& list, Link<T>* pointer ) :
+ list_((List<T>&) list )
+{
+ if ( list.size() )
+ pointer_ = pointer ? pointer : list.top_;
+ else
+ pointer_ = pointer;
+}
+
+template<class T>
+inline
+Cursor<T>::Cursor( const Cursor<T>& cursor ) :
+ list_( cursor.list_ )
+{
+ pointer_ = cursor.pointer_;
+}
+
+template<class T>
+inline T&
+Cursor<T>::thing()
+{
+ assert( pointer_ );
+ return pointer_->thing();
+}
+
+template<class T>
+Cursor<T>
+Cursor<T>::operator =( const Cursor<T>& c )
+{
+ assert( &list_ == &c.list_ );
+ pointer_ = c.pointer_;
+ return *this;
+}
+
+template<class T>
+inline void
+Cursor<T>::add( const T& th )
+{
+ list_.add( th, *this );
+}
+
+template<class T>
+inline void
+Cursor<T>::insert( const T& th )
+{
+ list_.insert( th, *this );
+}
+
+template<class T>
+inline List<T>&
+Cursor<T>::list() const
+{
+ return list_;
+}
+
+template<class T>
+inline Link<T>*
+Cursor<T>::pointer()
+{
+ return pointer_;
+}
+
+template<class T>
+inline bool
+Cursor<T>::backward()
+{
+ return ( pointer_ != 0 );
+}
+
+template<class T>
+inline bool
+Cursor<T>::forward()
+{
+ return ( pointer_ != 0 );
+}
+
+template<class T>
+inline bool
+Cursor<T>::ok()
+{
+ return ( pointer_ != 0 );
+}
+
+
+template<class T>
+inline Cursor<T>
+Cursor<T>::operator ++( int )
+{
+ Cursor<T> r (*this);
+ assert( pointer_ );
+ pointer_ = pointer_->next();
+ return r;
+}
+
+template<class T>
+inline Cursor<T>
+Cursor<T>::operator --( int )
+{
+ Cursor<T> r (*this);
+ assert( pointer_ );
+ pointer_ = pointer_->previous();
+ return r;
+}
+
+#endif
+++ /dev/null
- // cursor.inl -*-c++-*-
-#ifndef CURSOR_INL
-#define CURSOR_INL
-#include <assert.h>
-
-
-template<class T>
-inline
-Cursor<T>::Cursor( const List<T>& list, Link<T>* pointer ) :
- list_((List<T>&) list )
-{
- if ( list.size() )
- pointer_ = pointer ? pointer : list.top_;
- else
- pointer_ = pointer;
-}
-
-template<class T>
-inline
-Cursor<T>::Cursor( const Cursor<T>& cursor ) :
- list_( cursor.list_ )
-{
- pointer_ = cursor.pointer_;
-}
-
-template<class T>
-inline T&
-Cursor<T>::thing()
-{
- assert( pointer_ );
- return pointer_->thing();
-}
-
-template<class T>
-Cursor<T>
-Cursor<T>::operator =( const Cursor<T>& c )
-{
- assert( &list_ == &c.list_ );
- pointer_ = c.pointer_;
- return *this;
-}
-
-template<class T>
-inline void
-Cursor<T>::add( const T& th )
-{
- list_.add( th, *this );
-}
-
-template<class T>
-inline void
-Cursor<T>::insert( const T& th )
-{
- list_.insert( th, *this );
-}
-
-template<class T>
-inline List<T>&
-Cursor<T>::list() const
-{
- return list_;
-}
-
-template<class T>
-inline Link<T>*
-Cursor<T>::pointer()
-{
- return pointer_;
-}
-
-template<class T>
-inline bool
-Cursor<T>::backward()
-{
- return ( pointer_ != 0 );
-}
-
-template<class T>
-inline bool
-Cursor<T>::forward()
-{
- return ( pointer_ != 0 );
-}
-
-template<class T>
-inline bool
-Cursor<T>::ok()
-{
- return ( pointer_ != 0 );
-}
-
-
-template<class T>
-inline Cursor<T>
-Cursor<T>::operator ++( int )
-{
- Cursor<T> r (*this);
- assert( pointer_ );
- pointer_ = pointer_->next();
- return r;
-}
-
-template<class T>
-inline Cursor<T>
-Cursor<T>::operator --( int )
-{
- Cursor<T> r (*this);
- assert( pointer_ );
- pointer_ = pointer_->previous();
- return r;
-}
-
-#endif
struct String_handle;
struct String_convert;
struct String;
-struct virtual_smat;
+struct Matrix_storage;
struct Vector ;
struct Text_stream;
struct Data_file;
--- /dev/null
+/*
+ full-storage.hh -- declare Full_storage
+
+ source file of the Flower Library
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef FULL_STORAGE_HH
+#define FULL_STORAGE_HH
+
+#include "varray.hh"
+#include "matrix-storage.hh"
+#include "real.hh"
+/// simplest matrix storage. refer to its baseclass for the doco.
+class Full_storage : public Matrix_storage
+{
+ /// height, width
+ int height_i_,width_i_;
+ /// maxima.
+ int max_height_i_, max_width_i_;
+
+ /// the storage
+ Real** els_p_p_;
+
+ void
+ init() {
+ els_p_p_=0;
+ height_i_=width_i_=max_height_i_=max_width_i_=0;
+
+ }
+
+ bool valid(int i, int j) const {
+ return (i>=0 && i < height_i_)
+ && (j < width_i_ && j >=0);
+ }
+
+
+ void resize_rows(int);
+ void resize_cols(int);
+
+public:
+ virtual int rows() const {
+ return height_i_;
+ }
+ virtual int cols() const {
+ return width_i_;
+ }
+
+
+ virtual void set_size(int i, int j)
+ {
+ resize(i,j); //this could be more efficient.
+ }
+
+ virtual void set_size(int i) {
+ set_size(i,i);
+ }
+ virtual void resize(int i, int j);
+ virtual void resize(int i) {
+ resize(i,i);
+ }
+
+ virtual Real& elem(int i,int j) {
+ assert(valid(i,j));
+ return els_p_p_[i][j];
+ }
+ virtual Real const & elem(int i, int j) const {
+ assert(valid(i,j));
+ return els_p_p_[i][j];
+ }
+ virtual Array<Real> row(int i) const;
+ virtual Array<Real> column(int j) const;
+
+ Full_storage() {
+ init();
+ }
+ Full_storage(int i, int j) {
+ init();
+ set_size(i,j);
+ }
+ Full_storage(Full_storage&);
+ Full_storage(int i) {
+ init();
+ set_size(i);
+ }
+ void OK() const;
+ void operator=(Full_storage const &);
+
+ virtual void insert_row(int k);
+ virtual void delete_row(int k);
+ virtual void delete_column(int k);
+
+
+ ~Full_storage();
+ virtual bool mult_ok(int i, int j)const;
+ virtual void mult_next(int &i, int &j) const ;
+ virtual bool trans_ok(int i, int j) const;
+ virtual void trans_next(int &i, int &j) const;
+ virtual Matrix_storage * clone();
+ NAME_MEMBERS(Full_storage);
+ virtual bool try_right_multiply(Matrix_storage * dest, Matrix_storage const * );
+};
+
+#endif // FULL_STORAGE_HH
T length() const;
void set_empty() ;
- bool empty() const { return left > right; }
+ bool empty_b() const { return left > right; }
Interval_t() {
set_empty();
}
return *this;
}
String str() const;
- bool elt_q(T r);
+ bool elt_b(T r);
};
String
Interval_t<T>::str() const
{
- if (empty())
+ if (empty_b())
return "[empty]";
String s("[");
template<class T>
bool
-Interval_t<T>::elt_q(T r)
+Interval_t<T>::elt_b(T r)
{
return r >= left && r <= right;
}
Link<T>* next_;
};
-#include "link.inl"
+#include "link.icc"
#endif // __LINK_HH //
--- /dev/null
+// link.inl -*-c++-*-
+#ifndef LINK_INL
+#define LINK_INL
+#include <assert.h>
+template<class T>
+inline
+void
+Link<T>::OK() const
+{
+#ifndef NDEBUG
+ if (previous_) {
+ assert(previous_->next_ == this);
+ }
+ if (next_) {
+ assert(next_->previous_ == this);
+ }
+#endif
+}
+
+template<class T>
+inline
+Link<T>::Link( const T& thing ) :
+ thing_( thing )
+{
+ previous_ = next_ = 0;
+}
+
+template<class T>
+inline
+Link<T>::Link( Link<T>* previous, Link<T>* next, const T& thing ) :
+ thing_( thing )
+{
+ previous_ = previous;
+ next_ = next;
+}
+
+template<class T>
+inline
+Link<T>*
+Link<T>::next()
+{
+ return next_;
+}
+
+template<class T>
+inline
+Link<T>*
+Link<T>::previous()
+{
+ return previous_;
+}
+
+template<class T>
+inline
+void
+Link<T>::add( const T& thing )
+{
+
+ Link<T>* l = new Link<T>( this, next_, thing );
+ if ( next_ )
+ next_->previous_ = l;
+ next_ = l;
+}
+
+template<class T>
+inline void
+Link<T>::insert( const T& thing )
+{
+ // Link<T>* l = new Link<T>( next_, this, thing );
+ // bugfix hwn 16/9/96
+ Link<T>* l = new Link<T>( previous_, this, thing );
+ if ( previous_ )
+ previous_->next_ = l;
+ previous_ = l;
+}
+
+/*
+ don't forget to adjust #l#'s top_ and bottom_.
+ */
+template<class T>
+inline void
+Link<T>::remove(List<T> &l)
+{
+ if ( previous_ )
+ previous_->next_ = next_;
+ else
+ l.top_ = next_;
+
+ if ( next_ )
+ next_->previous_ = previous_;
+ else
+ l.bottom_ = previous_;
+}
+
+template<class T>
+inline
+T&
+Link<T>::thing()
+{
+ return thing_;
+}
+#endif
+++ /dev/null
-// link.inl -*-c++-*-
-#ifndef LINK_INL
-#define LINK_INL
-#include <assert.h>
-template<class T>
-inline
-void
-Link<T>::OK() const
-{
-#ifndef NDEBUG
- if (previous_) {
- assert(previous_->next_ == this);
- }
- if (next_) {
- assert(next_->previous_ == this);
- }
-#endif
-}
-
-template<class T>
-inline
-Link<T>::Link( const T& thing ) :
- thing_( thing )
-{
- previous_ = next_ = 0;
-}
-
-template<class T>
-inline
-Link<T>::Link( Link<T>* previous, Link<T>* next, const T& thing ) :
- thing_( thing )
-{
- previous_ = previous;
- next_ = next;
-}
-
-template<class T>
-inline
-Link<T>*
-Link<T>::next()
-{
- return next_;
-}
-
-template<class T>
-inline
-Link<T>*
-Link<T>::previous()
-{
- return previous_;
-}
-
-template<class T>
-inline
-void
-Link<T>::add( const T& thing )
-{
-
- Link<T>* l = new Link<T>( this, next_, thing );
- if ( next_ )
- next_->previous_ = l;
- next_ = l;
-}
-
-template<class T>
-inline void
-Link<T>::insert( const T& thing )
-{
- // Link<T>* l = new Link<T>( next_, this, thing );
- // bugfix hwn 16/9/96
- Link<T>* l = new Link<T>( previous_, this, thing );
- if ( previous_ )
- previous_->next_ = l;
- previous_ = l;
-}
-
-/*
- don't forget to adjust #l#'s top_ and bottom_.
- */
-template<class T>
-inline void
-Link<T>::remove(List<T> &l)
-{
- if ( previous_ )
- previous_->next_ = next_;
- else
- l.top_ = next_;
-
- if ( next_ )
- next_->previous_ = previous_;
- else
- l.bottom_ = previous_;
-}
-
-template<class T>
-inline
-T&
-Link<T>::thing()
-{
- return thing_;
-}
-#endif
Link<T>* bottom_;
};
-#include "list.inl"
+#include "list.icc"
#include "cursor.hh"
// instantiate a template: explicit instantiation.
--- /dev/null
+// -*-c++-*-
+
+#ifndef LIST_INL
+#define LIST_INL
+
+template<class T>
+inline
+List<T>::List()
+{
+ set_empty();
+}
+
+template<class T>
+inline void
+List<T>::set_empty()
+{
+ top_ = bottom_ = 0;
+ size_ = 0;
+}
+
+template<class T>
+inline void
+List<T>::remove( Cursor<T> me )
+{
+ if ( me.ok() ){
+ Link<T> *lp = me.pointer();
+ lp->remove(*this);
+ delete lp;
+ size_--;
+ }
+}
+
+template<class T>
+inline int
+List<T>::size() const
+{
+ return size_;
+}
+
+template<class T>
+inline Cursor<T>
+List<T>::top()const
+{
+ return Cursor<T>( *this, top_ );
+}
+
+
+template<class T>
+inline Cursor<T>
+List<T>::bottom()const
+{
+ return Cursor<T>( *this, bottom_ );
+}
+
+
+#endif
+++ /dev/null
-// -*-c++-*-
-
-#ifndef LIST_INL
-#define LIST_INL
-
-template<class T>
-inline
-List<T>::List()
-{
- set_empty();
-}
-
-template<class T>
-inline void
-List<T>::set_empty()
-{
- top_ = bottom_ = 0;
- size_ = 0;
-}
-
-template<class T>
-inline void
-List<T>::remove( Cursor<T> me )
-{
- if ( me.ok() ){
- Link<T> *lp = me.pointer();
- lp->remove(*this);
- delete lp;
- size_--;
- }
-}
-
-template<class T>
-inline int
-List<T>::size() const
-{
- return size_;
-}
-
-template<class T>
-inline Cursor<T>
-List<T>::top()const
-{
- return Cursor<T>( *this, top_ );
-}
-
-
-template<class T>
-inline Cursor<T>
-List<T>::bottom()const
-{
- return Cursor<T>( *this, bottom_ );
-}
-
-
-#endif
--- /dev/null
+/*
+ matrix-storage.hh -- declare Matrix_storage
+
+ source file of the Flower Library
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef MATRIX_STORAGE_HH
+#define MATRIX_STORAGE_HH
+
+#include "varray.hh"
+#include "real.hh"
+#include "class-name.hh"
+
+/**
+
+ base class for interface with matrix storageclasses. There are no
+ iterators for matrixclasses, since matrices are (like arrays)
+ explicitly int-indexed.
+
+ Iteration is provided by *_next, *_ok, which update and check both
+ index variables simultaneously.
+
+ TODO
+ determine type of product matrix.
+
+*/
+class Matrix_storage {
+
+
+public:
+ /// check invariants
+ virtual void OK() const=0;
+
+ /// height of matrix
+ virtual int rows() const = 0;
+
+ /// width of matrix
+ virtual int cols() const = 0;
+
+
+ /** set the size. contents lost.
+ PRE
+ i >=0, j>=0
+ */
+ virtual void set_size(int rows, int cols) = 0;
+
+ /**set the size to square dimen. contents lost
+ PRE
+ i>=0
+ */
+ virtual void set_size(int i) = 0;
+ /**set the size to i.
+
+ keep contents. If enlarged contents unspecified
+
+ PRE
+ i>=0, j>=0
+
+ */
+ virtual void resize(int rows, int cols ) = 0;
+
+ /**
+ set the size to square dimen. contents kept
+ Keep contents. If enlarged contents are unspecified
+
+ PRE
+ i>=0
+ */
+ virtual void resize(int i) = 0;
+
+
+ /**
+ access an element.
+
+ Generate an errormessage, if this happens
+ in the 0-part of a sparse matrix.
+ */
+
+ virtual Real& elem(int i,int j) = 0;
+
+ /// access a element, no modify
+ virtual Real const & elem(int i, int j) const = 0;
+
+ virtual Array<Real> row(int i) const = 0;
+ virtual Array<Real> column(int j) const = 0;
+
+
+ /**
+ add a row to the matrix before row k. Contents
+ of added row are unspecified
+
+ 0 <= k <= rows()
+ */
+ virtual void insert_row(int k)=0;
+
+
+ /**
+ delete a row from this matrix.
+
+ PRE
+ 0 <= k < rows();
+ */
+ virtual void delete_row(int k)=0;
+ virtual void delete_column(int k)=0;
+ virtual ~Matrix_storage() { }
+ virtual Matrix_storage *clone()=0;
+
+
+
+ /**
+ at end of matrix?. when doing loop
+
+ for(i=0; i<h; i++)
+ for(j=0; j<w; j++)
+ ..
+
+ */
+ virtual bool mult_ok(int i, int j) const=0;
+
+ /**
+ walk through matrix (regular multiply).
+ get next j for row i, or get next row i and reset j.
+ this will make sparse matrix implementation easy.
+
+ PRE
+ mult_ok(i,j)
+ */
+ virtual void mult_next(int &i, int &j) const = 0;
+
+/**
+ valid matrix entry. return false if at end of row
+ */
+ virtual bool trans_ok(int i, int j) const=0;
+
+ /**
+ walk through matrix (transposed multiply).
+ Get next i (for column j)
+
+ PRE
+ ver_ok(i,j)
+ */
+
+ virtual void trans_next(int &i, int &j) const = 0;
+ /// generate a "Full_storage" matrix
+ static Matrix_storage *get_full(int n, int m);
+
+
+ virtual bool try_right_multiply(Matrix_storage *dest,
+ const Matrix_storage *fact) ;
+ /**
+ RTTI.
+ */
+ NAME_MEMBERS(Matrix_storage);
+};
+
+
+
+inline bool
+Matrix_storage::try_right_multiply(Matrix_storage *,
+ const Matrix_storage *)
+{
+ return false;
+}
+#endif // MATRIX_STORAGE_HH
+
#define MATRIX_HH
-#include "vsmat.hh"
+#include "matrix-storage.hh"
#include "vector.hh"
/** a Real matrix. This is a class for a nonsquare block of #Real#s. The
class Matrix {
- virtual_smat *dat;
+ Matrix_storage *dat;
public:
void OK() const { dat->OK(); }
#define IPL_instantiate(a) PL_instantiate(a); \
template class IPointerList<a*>
-#include "plist.inl"
+#include "plist.icc"
#endif
+++ /dev/null
-#ifndef SMAT_HH
-#define SMAT_HH
-#include "varray.hh"
-#include "vsmat.hh"
-#include "real.hh"
-/// simplest matrix storage. refer to its baseclass for the doco.
-class Full_storage : public virtual_smat
-{
- /// height, width
- int h,w;
- /// maxima.
- int maxh, maxw;
-
- /// the storage
- Real** els;
- void
- init() {
- els=0;
- h=w=maxh=maxw=0;
-
- }
-
- bool valid(int i, int j) const {
- return (i>=0 && i < h)
- && (j < w && j >=0);
- }
-
-
- void resize_rows(int);
- void resize_cols(int);
-
-public:
- virtual int rows() const {
- return h;
- }
- virtual int cols() const {
- return w;
- }
-
-
- virtual void set_size(int i, int j)
- {
- resize(i,j); //this could be more efficient.
- }
-
- virtual void set_size(int i) {
- set_size(i,i);
- }
- virtual void resize(int i, int j);
- virtual void resize(int i) {
- resize(i,i);
- }
-
- virtual Real& elem(int i,int j) {
- assert(valid(i,j));
- return els[i][j];
- }
- virtual Real const & elem(int i, int j) const {
- assert(valid(i,j));
- return els[i][j];
- }
- virtual Array<Real> row(int i) const;
- virtual Array<Real> column(int j) const;
-
- Full_storage() {
- init();
- }
- Full_storage(int i, int j) {
- init();
- set_size(i,j);
- }
- Full_storage(Full_storage&);
- Full_storage(int i) {
- init();
- set_size(i);
- }
- void OK() const;
- void operator=(Full_storage const &);
-
- virtual void insert_row(int k);
- virtual void delete_row(int k);
- virtual void delete_column(int k);
-
-
- ~Full_storage();
- virtual bool mult_ok(int i, int j)const;
- virtual void mult_next(int &i, int &j) const ;
- virtual bool trans_ok(int i, int j) const;
- virtual void trans_next(int &i, int &j) const;
- virtual virtual_smat * clone();
-};
-
-#endif
--- /dev/null
+/* -*-C++-*-
+ String_data.inl -- implement String_data
+
+ source file of Flower lib
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#ifndef STRINGDATA_INL
+#define STRINGDATA_INL
+
+#include <assert.h>
+#include <memory.h>
+
+#include "string-data.hh"
+const int INITIALMAX=8;
+
+#include <sys/types.h>
+
+INLINE void
+String_data::OKW()
+{
+ assert (references == 1);
+}
+
+INLINE void
+String_data::OK()
+{
+ assert(maxlen >= length_i_);
+ assert(bool(data_byte_p_));
+ assert(references >= 1);
+}
+
+
+INLINE
+String_data::String_data()
+{
+ references=0;
+ maxlen = INITIALMAX;
+ data_byte_p_ = new Byte[maxlen + 1];
+ data_byte_p_[0] = 0;
+ length_i_ = 0;
+}
+
+INLINE
+String_data::String_data(String_data const &src)
+{
+ references=0;
+ maxlen = length_i_ = src.length_i_;
+ data_byte_p_ = new Byte[maxlen+1]; // should calc GNU 8byte overhead.
+ memcpy( data_byte_p_, src.data_byte_p_, length_i_ + 1 );
+}
+
+INLINE
+String_data::~String_data()
+{
+ assert(references == 0);
+ delete[] data_byte_p_;
+}
+
+INLINE void
+String_data::setmax(int j)
+{
+ OKW();
+ if (j > maxlen) {
+ delete data_byte_p_;
+ maxlen = j;
+ data_byte_p_ = new Byte[maxlen + 1];
+
+ data_byte_p_[0] = 0;
+ length_i_ = 0;
+ }
+}
+
+/* this is all quite hairy:
+ update of length_i_
+ update of maxlen
+ alloc of buffer
+ copying of buffer
+ needs blondification:
+ split tasks
+ define change authority
+*/
+INLINE void
+String_data::remax(int j)
+{
+ OKW();
+ if (j > maxlen) {
+ Byte *p = new Byte[j + 1];
+ memcpy( p, data_byte_p_, ( maxlen <? length_i_ ) + 1 );
+ maxlen = j;
+ delete[] data_byte_p_;
+ data_byte_p_ = p;
+ }
+}
+
+INLINE void
+String_data::tighten()
+{ // should be dec'd const
+ maxlen = length_i_;
+ Byte *p = new Byte[maxlen + 1];
+ memcpy( p, data_byte_p_, length_i_ + 1 );
+ delete[] data_byte_p_;
+ data_byte_p_ = p;
+}
+// assignment.
+INLINE void
+String_data::set( Byte const* byte_C, int length_i )
+{
+ OKW();
+
+ assert( byte_C && byte_C != data_byte_p_);
+
+ length_i_ = length_i;
+ remax( length_i_ ); // copies too
+ memcpy( data_byte_p_, byte_C, length_i_ );
+ data_byte_p_[ length_i_ ] = 0;
+}
+
+INLINE
+void
+String_data::set( char const* ch_C )
+{
+ set( (Byte const*)ch_C, strlen( ch_C ) );
+}
+
+
+/// concatenation.
+INLINE void
+String_data::append( Byte const* byte_C, int length_i )
+{
+ OK();
+ OKW();
+ int old_i = length_i_;
+
+ length_i_ += length_i;
+ remax( length_i_ );
+ memcpy( data_byte_p_ + old_i, byte_C, length_i );
+ data_byte_p_[ length_i_ ] = 0;
+}
+
+INLINE
+void
+String_data::operator += ( char const* ch_C )
+{
+ append( (Byte const*)ch_C, strlen( ch_C ) );
+}
+
+
+
+INLINE
+char const*
+String_data::ch_C() const
+{
+ return (char const*)data_byte_p_;
+}
+INLINE char*
+String_data::ch_l()
+{
+ return (char*)data_byte_p_;
+}
+
+INLINE Byte const*
+String_data::byte_C() const
+{
+ return data_byte_p_;
+}
+
+INLINE Byte*
+String_data::byte_l()
+{
+ OKW();
+ return data_byte_p_;
+}
+
+INLINE
+void
+String_data::trunc(int j)
+{
+ OKW();
+ assert(j >= 0 && j <= length_i_);
+ data_byte_p_[j] = 0;
+ length_i_ = j;
+}
+
+INLINE bool
+String_data::is_binary_bo()const
+{
+// return !memchr(data_byte_p_, length_i_, 0);
+ return ( (int)strlen( (char const*)data_byte_p_ ) != length_i_ );
+}
+
+INLINE Byte&
+String_data::operator [](int j)
+{
+ assert(j >= 0 && j <= length_i_);
+ return data_byte_p_[j] ;
+}
+
+INLINE Byte
+String_data::operator [](int j) const
+{
+ assert(j >= 0 && j <= length_i_);
+ return data_byte_p_[j];
+}
+
+
+
+
+#endif // __STRING_UTIL_CC //
+++ /dev/null
-/* -*-C++-*-
- String_data.inl -- implement String_data
-
- source file of Flower lib
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#ifndef STRINGDATA_INL
-#define STRINGDATA_INL
-
-#include <assert.h>
-#include <memory.h>
-
-#include "string-data.hh"
-const int INITIALMAX=8;
-
-#include <sys/types.h>
-
-INLINE void
-String_data::OKW()
-{
- assert (references == 1);
-}
-
-INLINE void
-String_data::OK()
-{
- assert(maxlen >= length_i_);
- assert(bool(data_byte_p_));
- assert(references >= 1);
-}
-
-
-INLINE
-String_data::String_data()
-{
- references=0;
- maxlen = INITIALMAX;
- data_byte_p_ = new Byte[maxlen + 1];
- data_byte_p_[0] = 0;
- length_i_ = 0;
-}
-
-INLINE
-String_data::String_data(String_data const &src)
-{
- references=0;
- maxlen = length_i_ = src.length_i_;
- data_byte_p_ = new Byte[maxlen+1]; // should calc GNU 8byte overhead.
- memcpy( data_byte_p_, src.data_byte_p_, length_i_ + 1 );
-}
-
-INLINE
-String_data::~String_data()
-{
- assert(references == 0);
- delete[] data_byte_p_;
-}
-
-INLINE void
-String_data::setmax(int j)
-{
- OKW();
- if (j > maxlen) {
- delete data_byte_p_;
- maxlen = j;
- data_byte_p_ = new Byte[maxlen + 1];
-
- data_byte_p_[0] = 0;
- length_i_ = 0;
- }
-}
-
-/* this is all quite hairy:
- update of length_i_
- update of maxlen
- alloc of buffer
- copying of buffer
- needs blondification:
- split tasks
- define change authority
-*/
-INLINE void
-String_data::remax(int j)
-{
- OKW();
- if (j > maxlen) {
- Byte *p = new Byte[j + 1];
- memcpy( p, data_byte_p_, ( maxlen <? length_i_ ) + 1 );
- maxlen = j;
- delete[] data_byte_p_;
- data_byte_p_ = p;
- }
-}
-
-INLINE void
-String_data::tighten()
-{ // should be dec'd const
- maxlen = length_i_;
- Byte *p = new Byte[maxlen + 1];
- memcpy( p, data_byte_p_, length_i_ + 1 );
- delete[] data_byte_p_;
- data_byte_p_ = p;
-}
-// assignment.
-INLINE void
-String_data::set( Byte const* byte_C, int length_i )
-{
- OKW();
-
- assert( byte_C && byte_C != data_byte_p_);
-
- length_i_ = length_i;
- remax( length_i_ ); // copies too
- memcpy( data_byte_p_, byte_C, length_i_ );
- data_byte_p_[ length_i_ ] = 0;
-}
-
-INLINE
-void
-String_data::set( char const* ch_C )
-{
- set( (Byte const*)ch_C, strlen( ch_C ) );
-}
-
-
-/// concatenation.
-INLINE void
-String_data::append( Byte const* byte_C, int length_i )
-{
- OK();
- OKW();
- int old_i = length_i_;
-
- length_i_ += length_i;
- remax( length_i_ );
- memcpy( data_byte_p_ + old_i, byte_C, length_i );
- data_byte_p_[ length_i_ ] = 0;
-}
-
-INLINE
-void
-String_data::operator += ( char const* ch_C )
-{
- append( (Byte const*)ch_C, strlen( ch_C ) );
-}
-
-
-
-INLINE
-char const*
-String_data::ch_C() const
-{
- return (char const*)data_byte_p_;
-}
-INLINE char*
-String_data::ch_l()
-{
- return (char*)data_byte_p_;
-}
-
-INLINE Byte const*
-String_data::byte_C() const
-{
- return data_byte_p_;
-}
-
-INLINE Byte*
-String_data::byte_l()
-{
- OKW();
- return data_byte_p_;
-}
-
-INLINE
-void
-String_data::trunc(int j)
-{
- OKW();
- assert(j >= 0 && j <= length_i_);
- data_byte_p_[j] = 0;
- length_i_ = j;
-}
-
-INLINE bool
-String_data::is_binary_bo()const
-{
-// return !memchr(data_byte_p_, length_i_, 0);
- return ( (int)strlen( (char const*)data_byte_p_ ) != length_i_ );
-}
-
-INLINE Byte&
-String_data::operator [](int j)
-{
- assert(j >= 0 && j <= length_i_);
- return data_byte_p_[j] ;
-}
-
-INLINE Byte
-String_data::operator [](int j) const
-{
- assert(j >= 0 && j <= length_i_);
- return data_byte_p_[j];
-}
-
-
-
-
-#endif // __STRING_UTIL_CC //
#ifdef STRING_UTILS_INLINED
#ifndef INLINE
-#define INLINE inline
+#define INLINE.iccine
#endif
-#include "string-handle.inl"
+#include "string-handle.icc"
/* we should be resetting INLINE. oh well. */
#endif
--- /dev/null
+/* -*-c++-*-
+
+ stringhandle.inl -- implement String_handle
+
+ source file of Flower lib
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#ifndef STRINGHANDLE_INL
+#define STRINGHANDLE_INL
+
+#include <assert.h>
+#include <memory.h>
+
+#include "string-data.hh"
+#include "string-handle.hh"
+
+INLINE void
+String_handle::down()
+{
+ if (!(--data->references)) delete data; data = 0;
+}
+
+/// increase ref count
+INLINE void
+String_handle::up(String_data *d)
+{
+ data=d; data->references ++;
+}
+
+INLINE void
+String_handle::copy()
+{
+ if (data->references !=1){
+ String_data *newdata = new String_data(*data);
+ down();
+ up(newdata);
+ }
+}
+
+INLINE
+String_handle::String_handle()
+{
+ up(new String_data);
+}
+
+INLINE
+String_handle::~String_handle()
+{
+ down();
+}
+
+INLINE
+String_handle::String_handle(String_handle const & src)
+{
+ up(src.data);
+}
+
+INLINE Byte*
+String_handle::byte_l()
+{
+ copy();
+ return data->byte_l();
+}
+
+INLINE char*
+String_handle::ch_l()
+{
+ copy();
+ return (char*)data->byte_l();
+}
+
+INLINE Byte
+const* String_handle::byte_C() const
+{
+ return data->byte_C();
+}
+
+INLINE char const*
+String_handle::ch_C() const
+{
+ return (char const*)data->byte_C();
+}
+
+INLINE void
+String_handle::operator =(String_handle const &src)
+{
+ if (this == &src)
+ return;
+ down();
+ up(src.data);
+}
+
+INLINE void
+String_handle::operator += (char const *s)
+{
+ copy();
+ *data += s;
+}
+
+
+INLINE Byte
+String_handle::operator[](int j) const
+{
+ return (*data)[j];
+}
+
+// !NOT SAFE!
+// don't use this for loops. Use byte_C()
+INLINE Byte &
+String_handle::operator[](int j)
+{
+ copy(); // hmm. Not efficient
+ return data->byte_l()[j];
+}
+
+INLINE void
+String_handle::append( Byte const* byte_C, int length_i )
+{
+ copy();
+ data->append( byte_C, length_i );
+}
+
+INLINE void
+String_handle::set( Byte const* byte_C, int length_i )
+{
+ copy();
+ data->set( byte_C, length_i );
+}
+
+INLINE void
+String_handle::operator = (char const *p)
+{
+ copy();
+ data->set( p );
+}
+
+INLINE void
+String_handle::trunc(int j)
+{
+ copy(); data->trunc(j);
+}
+
+INLINE int
+String_handle::length_i() const
+{
+ return data->length_i_;
+}
+
+INLINE bool
+String_handle::is_binary_bo() const {
+ return data->is_binary_bo();
+}
+
+#endif
+++ /dev/null
-/* -*-c++-*-
-
- stringhandle.inl -- implement String_handle
-
- source file of Flower lib
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#ifndef STRINGHANDLE_INL
-#define STRINGHANDLE_INL
-
-#include <assert.h>
-#include <memory.h>
-
-#include "string-data.hh"
-#include "string-handle.hh"
-
-INLINE void
-String_handle::down()
-{
- if (!(--data->references)) delete data; data = 0;
-}
-
-/// increase ref count
-INLINE void
-String_handle::up(String_data *d)
-{
- data=d; data->references ++;
-}
-
-INLINE void
-String_handle::copy()
-{
- if (data->references !=1){
- String_data *newdata = new String_data(*data);
- down();
- up(newdata);
- }
-}
-
-INLINE
-String_handle::String_handle()
-{
- up(new String_data);
-}
-
-INLINE
-String_handle::~String_handle()
-{
- down();
-}
-
-INLINE
-String_handle::String_handle(String_handle const & src)
-{
- up(src.data);
-}
-
-INLINE Byte*
-String_handle::byte_l()
-{
- copy();
- return data->byte_l();
-}
-
-INLINE char*
-String_handle::ch_l()
-{
- copy();
- return (char*)data->byte_l();
-}
-
-INLINE Byte
-const* String_handle::byte_C() const
-{
- return data->byte_C();
-}
-
-INLINE char const*
-String_handle::ch_C() const
-{
- return (char const*)data->byte_C();
-}
-
-INLINE void
-String_handle::operator =(String_handle const &src)
-{
- if (this == &src)
- return;
- down();
- up(src.data);
-}
-
-INLINE void
-String_handle::operator += (char const *s)
-{
- copy();
- *data += s;
-}
-
-
-INLINE Byte
-String_handle::operator[](int j) const
-{
- return (*data)[j];
-}
-
-// !NOT SAFE!
-// don't use this for loops. Use byte_C()
-INLINE Byte &
-String_handle::operator[](int j)
-{
- copy(); // hmm. Not efficient
- return data->byte_l()[j];
-}
-
-INLINE void
-String_handle::append( Byte const* byte_C, int length_i )
-{
- copy();
- data->append( byte_C, length_i );
-}
-
-INLINE void
-String_handle::set( Byte const* byte_C, int length_i )
-{
- copy();
- data->set( byte_C, length_i );
-}
-
-INLINE void
-String_handle::operator = (char const *p)
-{
- copy();
- data->set( p );
-}
-
-INLINE void
-String_handle::trunc(int j)
-{
- copy(); data->trunc(j);
-}
-
-INLINE int
-String_handle::length_i() const
-{
- return data->length_i_;
-}
-
-INLINE bool
-String_handle::is_binary_bo() const {
- return data->is_binary_bo();
-}
-
-#endif
+++ /dev/null
-#ifndef VSMAT_HH
-#define VSMAT_HH
-#include "varray.hh"
-#include "real.hh"
-/** base class for interface with matrix storageclasses. There are no
- iterators for matrixclasses, since matrices are (like arrays)
- explicitly int-indexed.
-
- Iteration is provided by *_next, *_ok, which update and check both
- index variables simultaneously.
-
- TODO
- determine type of product matrix.
-
-*/
-class virtual_smat {
-
-
-public:
- /// check invariants
- virtual void OK() const=0;
-
- /// height of matrix
- virtual int rows() const = 0;
-
- /// width of matrix
- virtual int cols() const = 0;
-
-
- /** set the size. contents lost.
- PRE
- i >=0, j>=0
- */
- virtual void set_size(int i, int j) = 0;
-
- /**set the size to square dimen. contents lost
- PRE
- i>=0
- */
- virtual void set_size(int i) = 0;
- /**set the size to i.
-
- keep contents. If enlarged contents unspecified
-
- PRE
- i>=0, j>=0
-
- */
- virtual void resize(int i, int j) = 0;
-
- /**
- set the size to square dimen. contents kept
- Keep contents. If enlarged contents are unspecified
-
- PRE
- i>=0
- */
- virtual void resize(int i) = 0;
-
-
- /**
- access an element.
-
- Generate an errormessage, if this happens
- in the 0-part of a sparse matrix.
- */
-
- virtual Real& elem(int i,int j) = 0;
-
- /// access a element, no modify
- virtual Real const & elem(int i, int j) const = 0;
-
-#if 1
- virtual Array<Real> row(int i) const = 0;
- virtual Array<Real> column(int j) const = 0;
-#endif
-
-
- /**
- add a row to the matrix before row k. Contents
- of added row are unspecified
-
- 0 <= k <= rows()
- */
- virtual void insert_row(int k)=0;
-
-
- /**
- delete a row from this matrix.
-
- PRE
- 0 <= k < rows();
- */
- virtual void delete_row(int k)=0;
- virtual void delete_column(int k)=0;
- virtual ~virtual_smat() { }
- virtual virtual_smat *clone()=0;
-
-
-
- /**
- at end of matrix?. when doing loop
-
- for(i=0; i<h; i++)
- for(j=0; j<w; j++)
- ..
-
- */
- virtual bool mult_ok(int i, int j) const=0;
-
- /**
- walk through matrix (regular multiply).
- get next j for row i, or get next row i and reset j.
- this will make sparse matrix implementation easy.
-
- PRE
- mult_ok(i,j)
- */
- virtual void mult_next(int &i, int &j) const = 0;
-
-/**
- valid matrix entry. return false if at end of row
- */
- virtual bool trans_ok(int i, int j) const=0;
-
- /**
- walk through matrix (transposed multiply).
- Get next i (for column j)
-
- PRE
- ver_ok(i,j)
- */
-
- virtual void trans_next(int &i, int &j) const = 0;
- /// generate a "Full_storage" matrix
- static virtual_smat *get_full(int n, int m);
-
-};
-
-
-#endif
Matrix::Matrix(int n, int m)
{
- dat = virtual_smat::get_full(n,m);
+ dat = Matrix_storage::get_full(n,m);
fill(0);
}
Matrix::Matrix(int n)
{
- dat = virtual_smat::get_full(n,n);
+ dat = Matrix_storage::get_full(n,n);
fill(0);
}
Matrix::Matrix(Vector v, Vector w)
{
- dat = virtual_smat::get_full(v.dim(), w.dim());
+ dat = Matrix_storage::get_full(v.dim(), w.dim());
for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
dat->elem(i,j)=v(i)*w(j);
}
{
assert(m1.cols()==m2.rows());
assert(cols()==m2.cols() && rows()==m1.rows());
-
+
+ if (m1.dat->try_right_multiply(dat, m2.dat))
+ return;
for (int i=0, j=0; dat->mult_ok(i,j);
dat->mult_next(i,j)) {
Real r=0.0;
+++ /dev/null
-#include "smat.hh"
-
-void
-Full_storage::operator=(Full_storage const &fs)
-{
- resize(fs.h, fs.w);
- OK();
- fs.OK();
- for (int i=0; i<h; i++)
- for (int j=0; j<w; j++)
- els[i][j]= fs.els[i][j];
-}
-
-void
-Full_storage::OK() const
-{
-#ifndef NDEBUG
- // static Real dummy;
- assert(maxh >= h && maxw >= w);
- assert(h >= 0 && w >= 0);
- assert(els||!maxh);
-#endif
-}
-void
-Full_storage::resize_cols(int newh)
-{
- if (newh <= maxh) {
- h=newh;
- return;
- }
-
- Real ** newa=new Real*[newh];
- int j=0;
- for (; j < h; j++)
- newa[j] = els[j];
- for (; j < newh; j++)
- newa[j] = new Real[maxw];
- delete[] els;
- els=newa;
-
- h = maxh = newh;
-}
-
-void
-Full_storage::resize_rows(int neww)
-{
- if (neww <= maxw) {
- w=neww;
- return;
- }
- for (int i=0; i < maxh ; i++) {
- Real* newa = new Real[neww];
- for (int k=0; k < w; k++)
- newa[k] = els[i][k];
-
- delete[] els[i];
- els[i] = newa;
- }
- w = maxw = neww;
-}
-
-Full_storage::~Full_storage() {
- for (int i=0; i < maxh; i++)
- delete [] els[i];
- delete[] els;
-}
-
-void
-Full_storage::resize(int rows, int cols)
-{
- OK();
- resize_cols(rows);
- resize_rows(cols);
-
-}
-
-
-bool
-Full_storage::mult_ok(int i, int j) const
-{
- return valid(i,j);
-}
-
-bool
-Full_storage::trans_ok(int i, int j) const
-{
- return valid(i,j);
-}
-
-
-void
-Full_storage::trans_next(int &i, int &j) const
-{
- assert(trans_ok(i,j));
- i++;
- if (i >= h) {
- i=0;
- j ++;
- }
-}
-
-void
-Full_storage::mult_next(int &i, int &j) const
-{
- assert(mult_ok(i,j));
- j++;
- if (j >= w) {
- j=0;
- i++;
- }
-}
-
-void
-Full_storage::delete_column(int k)
-{
- assert(0 <= k &&k<w);
- for (int i=0; i< h ; i++)
- for (int j=k+1; j <w; j++)
- els[i][j-1]=els[i][j];
- w--;
-}
-void
-Full_storage::delete_row(int k)
-{
- assert(0 <= k &&k<h);
- for (int i=k+1; i < h ; i++)
- for (int j=0; j < w; j++)
- els[i-1][j]=els[i][j];
- h--;
-}
-
-
-void
-Full_storage::insert_row(int k)
-{
- assert(0 <= k&& k <=h);
- resize_cols(h+1);
- for (int i=h-1; i > k ; i--)
- for (int j=0; j <w; j++)
- els[i][j]=els[i-1][j];
-
-}
-
-
-Array<Real>
-Full_storage::row(int n) const
-{
- Array<Real> r;
- for (int j = 0; j < w; j++)
- r.push(els[n][j]);
- return r;
-}
-
-Array<Real>
-Full_storage::column(int n) const
-{
-
- Array<Real> r;
- for (int i = 0; i<h; i++)
- r.push(els[i][n]);
- return r;
-}
-
-
-Full_storage::Full_storage(Full_storage&s)
-{
- init();
- (*this) = s;
-}
-virtual_smat*
-Full_storage::clone()
-{
- return new Full_storage(*this);
-}
-
-
-virtual_smat *
-virtual_smat::get_full(int n, int m)
-{
- return new Full_storage(n,m);
-}
2e318, this number would have approx 318 zero's in its string.
Should enlarge buff dynamically.
+
@see
man 3 snprintf
*/
u /= 16;
}
#else
- str += int_str( u, "%x" );
+ str += int_str( u, "%x" ); // hmm. %lx vs. %x -> portability?
#endif
str = String( fill_ch, length_i - str.length_i() ) + str;
#include "string-handle.hh"
#include "string-data.hh"
-#include "string-data.inl"
-#include "string-handle.inl"
+#include "string-data.icc"
+#include "string-handle.icc"
+%
+% declare the standard dynamic identifiers.
+%
-ppp = \dynamic {7 }
-pp = \dynamic { 6 }
-p = \dynamic { 5 }
-mp = \dynamic { 4 }
-mf = \dynamic { 3 }
-df = \dynamic { 2 } % f is a notename too.
-ff = \dynamic { 1 }
-fff = \dynamic { 0 }
+ppp = \absdynamic {7 }
+pp = \absdynamic { 6 }
+p = \absdynamic { 5 }
+mp = \absdynamic { 4 }
+mf = \absdynamic { 3 }
+df = \absdynamic { 2 } % f is a notename too.
+ff = \absdynamic { 1 }
+fff = \absdynamic { 0 }
+
+cr = \spandynamic { 1 1 }
+decr = \spandynamic { -1 1 }
+rc = \spandynamic { 1 2 } % stop a crescendo (worrks for decrescendo too)
--- /dev/null
+%
+
+melodicregs = \inputregister {
+ Staff_registers
+ \inputregister {Bar_register}
+ \inputregister {Clef_register}
+ \inputregister {Key_register}
+ \inputregister {Meter_register}
+ \inputregister {Local_key_register}
+ \inputregister { Staff_sym_register }
+ \inputregister {
+ Voice_group_registers
+ \inputregister { Dynamic_register }
+ \inputregister { Stem_beam_register }
+ \inputregister { Text_register }
+ \inputregister { Script_register }
+ \inputregister { Voice_registers
+ \inputregister { Notehead_register }
+ \inputregister { Slur_register }
+ }
+ }
+}
+
+lyricregs = \inputregister {
+ Lyric_register % ugh.
+ \inputregister { Lyric_register }
+ \inputregister { Swallow_register }
+
+}
-
+include "register.ini"
include "dynamic.ini"
include "dutch.ini" % do not include init/ path
include "script.ini"
"linestaf" "\linestafsym{%}{%}"
"stem" "\stem{%}{%}"
"fill" "\hbox{}"
- "crescendo" "\crescendosym{%}" 0\pt 0\pt -3\pt 3\pt
- "decrescendo" "\decrescendosym{%}" 0\pt 0\pt -3\pt 3\pt
+ "crescendosym" "\crescendosym{%}" 0\pt 0\pt -3\pt 3\pt
+ "decrescendosym" "\decrescendosym{%}" 0\pt 0\pt -3\pt 3\pt
}
"dots" = \table {
cad = \melodic{
\cadenza {1}
- \grouping{1*4}\duration { 8}
+ \grouping{1*4}\duration { 8}\octave{c}
\textstyle "italic"
\clef \violin
c'4.mf g8
[b()c'] g-\fermata
\bar \empty
c [c_"rubato" e g c']
- \octave{'}
+ \octave{c'}
e4. e [g ()f_"rit" e d]
\duration{16}
\duration{16} [d cis d e]
f4()[f e d c]
'b4
- \octave{} [d'8 c'8 a8]2/3
+ \octave{c} [d'8 c'8 a8]2/3
g2
\bar \empty
- [g c e g] [c' e g c']\octave{'}
+ [g c e g] [c' e g c']\octave{c}
[e 'g c e] g4^\fermata %()% BUG!
\bar \empty
- [g8.(_"a \tempo" e g8. )e]
+ [g8.(_"a tempo" e g8. )e]
a4. g8 [f8 e8 d8 c8]
'g2 d2^"tr"
c4
}
\score {
- \staff { cad }
- \paper {}
+ \staff { melodicregs cad }
+ \paper {
+
+ \unitspace 14\mm
+ \geometric 1.4}
\midi { \tempo 4:90 }
}
% Opus 62
% Ouverture zu Collins Trauerspiel "Coriolan"
%
-% a 5 \bar fragment of the alto part
+% a 5 bar fragment of the alto part
%
% Copyright (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
%
-% when lily can handle this, i-ll type the other 304 \bars
+% when lily can handle this, i-ll type the other 304 bars
% (maybe even sooner :-)
%
alto = \melodic{
- \meter {4/4} \grouping {4*4}
+ \meter {4/4}
\duration{ 8 }
\key {bes es as}
\clef "alto"
% these are chords (i.e. non-divisi)
- % that-s why i-d rather type chords,
- % but how to type slurs?
+
%30
<
- {
+ { \octave{ c }
+
[ c c-. ] c2.( |
%31
[ ) c c-. ] c2.( |
[ ) c c-. ] c4. c-. c4( |
%33
[ ) c c-. ] c4. c-. c4
- }
+ \group "+bla"
+ \stem{ 1 }[ c16^"div." c16 c16 c16 ] c4 c2
+ \group "-"
+ }
%30:2
{
- \octave{ -1 }
+ \octave{ 'c }
\textstyle "italic"
% this should be a \dynamic, rather than text
[ c c_"cresc. \ \ - \ \ \ \ - \ \ \ \ - \ \ \ \
[ ) c c-. ] c4. c-. c4( |
%33:2
[ ) c c-. ] c4. c-. c4 |
- \octave{ }
- }
-%34
- >
+ \octave{c }
+
+%34
+ \group "+b"
% these are two \voices (i.e. divisi)
% the c4 and c2, however are really 16th...
- % e.g.: c16*4 and c16*8 or
- % [ c4 c2 ]*16 ?
% we-ll say "simile" for now...
%
- < \multivoice
- { \stem{ 1 }[ c16^"div." c16 c16 c16 ] c4 c2 }
- {
- \octave{ -1 }
+ \octave{ 'c }
\textstyle "italic"
- \stem{ -1 } [ as16_"\ff" as16 as16 as16 ] as4_"simile" as2
+ \stem{ -1 } [ as16 ff as16 as16 as16 ] as4_"simile" as2
\textstyle "roman"
+ \group "-"
}
>
}
\score{
- \staff{ alto }
+ \staff{ melodicregs alto }
\paper{
\unitspace 14\mm
\geometric 1.4
% "Ah, vous dirais-je, maman" (Mozart, KV 265)
%
-% \bare bones version. (written down from memory :-)
+% bare bones version. (written down from memory :-)
% for lyrics, see twinkle.ly
-% the % is a co\mment.
+% the % is a comment.
%
% copyright: None
%
begeleiding = \melodic{
\clef "bass"
\meter{ 2/4 }
- \octave{ c' } % default octave: 1 below the first octave.
+ \octave{ c } % default octave: 1 below the first octave.
%%% theme
- 'c % ' means one octave lower.
- % Similarly: ' means one higher.
+ 'c % ' before note means one octave lower.
+ % Similarly: ' after means one higher.
c e c f c e c d 'b c 'a 'f 'g 'c2
- \octave { ' }
+ \octave { 'c }
e 'g d 'g c 'g 'b 'g e 'g d 'g c 'g 'b 'g
%%%% var 1
r8 e8() c r8 e8() c r8 f8()c r8 e8()c
}
\score{
- \staff{ melodie }
- \staff{ begeleiding }
+ \staff{ melodicregs melodie }
+ \staff{ melodicregs begeleiding }
\paper{
\unitspace 2.5\cm % a whole note takes 2.5 \cm ideally.
}
-%%%%%%%%% HAS TO BE ADJUSTED to pl32
-
-
-% martien.ly
%
% Viola Quartet
% Martien Lohman (194x-????)
% quite alive at the time of writing;
% copyright by ml
%
-% lilypond: src/\stem.cc:42: void Stem::set_\stemend(double): Assertion `(dir > 0 && se >= maxnote) || (se <= minnote && dir <0)' failed.
%
% The purpose of this file is to demonstrate features of LilyPond;
% respect the copyright.
-% \midi.ly
-% test source for lilypond-s \midi \output
+% midi.ly
+% test source for lilypond-s midi output
melodie = \melodic{
\clef\violin
-blah = \staff{\melodic{ \meter {6/8}
- \skip {36*8}
- \meter {4/4}}
- \melodic{
-\duration { 8 }
- \octave{ }
- |[ a a a a a a a a a ]6/9
- \octave{ 1 }
- |[ a a a a a a a a a ]6/9
- \octave { ' }
+blah = \staff{ "melodic"
+ \melodic {
+ \duration { 8 } \meter {6/8}
+
+ \octave{ c }
+ |[ a cr a a a a a a a rc a ]6/9
+ \octave{ c }
+ |[ a decr a a a a a a a rc a ]6/9
+ \octave { c' }
[ 'c 'g d a e' b' f'' c''' g''' ]6/9
[ g''' c''' f'' b' e' a d 'g 'c ]6/9
- \octave{ 1 }
+ \octave{ c'' }
[ 'c 'g d a e' b' f'' c''' g''' ]6/9
[ g''' c''' f'' b' e' a d 'g 'c ]6/9
- \octave { }
+ \octave { ''c}
[ c g d' ]2/3
[ d' g c ]2/3
[ f c' g' ]2/3
[ g' c' f ]2/3
- \octave{ 1 }
+ \octave{ c }
[ c g d' ]2/3
[ d' g c ]2/3
[ f c' g' ]2/3
[ g' c' f ]2/3
-
+ [ g' c' f ]2/3
+ \meter {4/4}
+
c1
\duration { 8}
[c-> d-> e-> f->][g-> a-> b-> c'->] % 1
-\octave{'} [c'-^ b-^ a-^ g-^][f-^ e-^ d-^ c-^]
-\octave{} [c'-^ b-^ a-^ g-^][f-^ e-^ d-^ c-^]
+\octave{c'} [c'-^ b-^ a-^ g-^][f-^ e-^ d-^ c-^]
+\octave{c} [c'-^ b-^ a-^ g-^][f-^ e-^ d-^ c-^]
[c-. d-. e-. f-.][g-. a-. b-. c'-.]
[c'-- b-- a-- g][f-- e-- d c--] % 5
- [c-\portato d-\portato e-\portato f-\portato]
- [g-\portato a-\portato b-\portato c'-\portato]
- [c'-\upbow b-\upbow a-\downbow g-\downbow]
- [f-\downbow e-\downbow d-\upbow c-\upbow]
+ [c-portato d-portato e-portato f-portato]
+ [g-portato a-portato b-portato c'-portato]
+ [c'-upbow b-upbow a-downbow g-downbow]
+ [f-downbow e-downbow d-upbow c-upbow]
[c-| d-| e-| f-|][g-| a-| b-| c'-|]
[c' b a g][f e d c]
[c d e f][g a b c'] % 10
}
\score{
- \staff{ $ii_menuetto }
+ \staff{ melodicregs $ii_menuetto }
\paper{
\width 195\mm
\unitspace 9\mm % to get lily to use only three lines
}
\score{
- \staff{ lyric % this sux el grandioso. What about \lyricstaff, \melodicstaff etc.
+ \staff{ lyricregs
+
tekstI tekstII }
- \staff{ melodie }
- \staff{ begeleiding }
+ \staff{ melodicregs melodie }
+ \staff{ melodicregs begeleiding }
\paper{
\width 195\mm
accompany = \melodic{
\clef \bass
- \octave{'c}
- c c' | e' c' | f' c' | e' c' |
+ \octave{'c}\duration{4}
+ c4 c' | e' c' | f' c' | e' c' |
d' b | c' a | f g | c2 |
e' g | d g | c' g | b g |
global = \melodic{
\meter {2 / 4}
- \skip {24*2}
+ \skip {2*24}
% \bar "||"
}
}
\score{
- \staff{ global melody }
- \staff{ global tekst hegedraagjetekst }
- \staff{ global texte }
- \staff{ global texti textii textiii }
- \staff{ accompany }
+ \staff{ melodicregs global melody }
+ \staff{ lyricregs global tekst hegedraagjetekst }
+ \staff{ lyricregs global texte }
+ \staff{ lyricregs global texti textii textiii }
+ \staff{ melodicregs global accompany }
\paper{
\unitspace 2.5\cm
}
}
% every "melody" declared in a staff has its own "voicegroup"
-trebstaf = \staff{ global dux comes }
-
+trebstaf = \staff{
+ \inputregister{ melodicregs}
+ global dux comes
+}
+
\score{
trebstaf
- \staff{ bassdux global }
+ \staff{ \inputregister{ melodicregs}
+ bassdux global
+ }
\paper{}
\midi{
\tempo 4:90
if ( mom == upper_mom ) // don-t miss last (sic)
return upper_dur;
if ( ( mom >= lower_mom ) && ( mom <= upper_mom ) ) {
- warning( String( "duration not exact: " ) + String( (Real)mom ) , 0 );
+ warning( String( "duration not exact: " ) + String( (Real)mom ), 0 );
if ( abs( mom - lower_mom ) < abs( mom - upper_mom ) )
return lower_dur;
else
+/*
+ Argh! this sux! implementation not liblily
+ */
+
#ifndef DEBUG_HH
#define DEBUG_HH
void message( String message_str, char const* context_ch_c_l );
void warning( String message_str, char const* context_ch_c_l );
+void warning( String message_str );
void error( String message_str, char const* context_ch_c_l );
+
+void error( String message_str);
void error(String s); // errors
void error_t(const String& s, Time_description const & t_tdes);
void error_t(String const &s, const Moment &when);
--- /dev/null
+/*
+ input.hh -- declare Input
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef INPUT_HH
+#define INPUT_HH
+
+/**
+ Base class for anything that records its poisition in the parse file.
+ */
+class Input {
+ char const *defined_ch_C_ ;
+
+public:
+ set_spot(char const *);
+ Input(char const *);
+ Input(Input const &);
+};
+
+#endif // INPUT_HH
struct Complex_music;
struct Complex_staff;
struct Complex_walker;
+struct Crescendo ;
struct Cresc_req;
struct Directional_spanner;
struct Decresc_req;
struct Group_feature_req;
struct Idealspacing;
struct Identifier;
+struct Input;
+struct Input_register;
struct Input_file;
struct Input_music;
struct Input_score;
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 ), 0);
+ warning( String( "can't map: " ) + name_str_ + String( ": " ) + strerror( errno ), 0 );
}
String
fildes_i_ = ::open( name_str_, O_RDONLY );
if ( fildes_i_ == -1 ) {
- warning( String( "can't open: " ) + name_str_ + String( ": " ) + strerror( errno ), 0 );
+ warning( String( "can't open: " ) + name_str_ + String( ": " ) + strerror( errno ), 0);
return;
}
MAJOR_VERSION = 0
MINOR_VERSION = 0
-PATCH_LEVEL = 45
+PATCH_LEVEL = 46
# use to send patches, always empty for released version:
# include separator: ".postfix", "-pl" makes rpm barf
-MY_PATCH_LEVEL =
+MY_PATCH_LEVEL = .jcn1
include ./$(depth)/make/Variables.make
include ./$(depth)/make/Files.make
include .version
-
+include Stable.make
#
# identify module:
SUBDIRS = include
#
-# to be remade each build:
-#
-VERSION_DEPENDENCY = $(lily-version)
-#
-
# list of distribution files:
#
-DISTFILES = .version Makefile $(ALL_SOURCES)
+EXTRA_DISTFILES = .version
#
# list of custom libraries:
# main target of this module:
#
-# MAINTARGET = $(EXECUTABLE)
-# MAINTARGET = $(LIBRARY)
MAINTARGET = $(lily_bindir)/$(EXECUTABLE)# huh?
-# MAINTARGET = $(libdir)/$(LIBRARY)# huh?
default: $(MAINTARGET)
#
--- /dev/null
+# kept in dist bo stripping stable stuff, still to copy...
+
+# a bit of a hack to keep exec size under control.
+stablecc=command-request.cc musical-request.cc bar.cc boxes.cc break.cc \
+ item.cc keyword.cc leastsquares.cc \
+ lookup.cc molecule.cc meter.cc\
+ paper-def.cc parser.cc lexer.cc p-staff.cc qlp.cc qlpsolve.cc\
+ template1.cc template2.cc template3.cc template4.cc\
+ template5.cc template6.cc version.cc tex-stream.cc tex.cc\
+ voice.cc wordwrap.cc spanner.cc \
+ voice-element.cc identifier.cc note.cc\
#include "bar-reg.hh"
#include "bar.hh"
#include "command-request.hh"
-#include "score-column.hh"
+//#include "score-column.hh"
#include "time-description.hh"
Bar_register::Bar_register()
}
IMPLEMENT_STATIC_NAME(Bar_register);
+ADD_THIS_REGISTER(Bar_register);
void
Beam::do_pre_processing()
{
- left = (*stems.top()) ->pcol_l_;
- right = (*stems.bottom())->pcol_l_;
+ left_col_l_ = (*stems.top()) ->pcol_l_;
+ right_col_l_ = (*stems.bottom())->pcol_l_;
assert(stems.size()>1);
if (!dir_i_)
set_default_dir();
sb.translate(Offset(x, (x * slope + left_pos)* inter));
out->add(sb);
}
- out->translate(Offset(x0 - left->hpos,0));
+ out->translate(Offset(x0 - left_col_l_->hpos,0));
}
IMPLEMENT_STATIC_NAME(Beam);
c0_position_i_= 10;
}else
return false;
- *get_staff_info().c0_position_i_ = c0_position_i_;
+ *get_staff_info().c0_position_i_l_ = c0_position_i_;
return true;
}
Clef_register::read_req(Clef_change_req*c_l)
{
if (!set_type(c_l->clef_str_))
- error("unknown clef type ", c_l->defined_ch_C_);
+ c_l->error("unknown clef type ");
}
bool
}
}
IMPLEMENT_STATIC_NAME(Clef_register);
+ADD_THIS_REGISTER(Clef_register);
void
Clef_change_req::do_print() const
{
+#ifndef NPRINT
mtor << clef_str_ ;
+#endif
}
Clef_change_req::Clef_change_req(String s)
void
Group_feature_req::do_print() const
{
+#ifndef NPRINT
mtor << "stemdir " << stemdir_i_;
+#endif
}
Group_feature_req::Group_feature_req()
void
Group_change_req::do_print()const
{
+#ifndef NPRINT
mtor << "id : " << newgroup_str_;
+#endif
}
/* *************** */
IMPLEMENT_STATIC_NAME(Terminate_voice_req);
#include "complex-staff.hh"
#include "complex-walker.hh"
-#include "score.hh"
#include "p-score.hh"
-#include "staffsym.hh"
-#include "score-column.hh"
-const NO_LINES = 5;
-
-/** Aside from putting fields right, this generates the staff symbol.
+/** Aside from putting fields right
*/
void
Complex_staff::set_output(PScore* pscore_l )
pstaff_l_ = new PStaff(pscore_l);
pscore_l_ = pscore_l;
pscore_l_->add(pstaff_l_);
-
- Staff_symbol *span_p = new Staff_symbol(NO_LINES);
-
- Score_column* col_last
- =score_l_->find_col(score_l_->last(), false);
- Score_column* col_first=
- score_l_->find_col(0, false);
-
- span_p->set_extent(col_first->pcol_l_->postbreak_p_,
- col_last->pcol_l_->prebreak_p_);
-
- pscore_l_->typeset_spanner(span_p, pstaff_l_);
}
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
-
-#include "musical-request.hh"
#include "staff-column.hh"
#include "voice.hh"
#include "p-score.hh"
#include "complex-staff.hh"
#include "debug.hh"
-#include "voice-group-regs.hh"
-#include "voice-regs.hh"
#include "complex-walker.hh"
-//#include "misc.hh"
-#include "command-request.hh"
#include "walk-regs.hh"
void
walk_regs_p_->do_announces();
}
-bool
-Complex_walker::try_command_request(Command_req *req_l)
-{
- return walk_regs_p_->try_request(req_l);
-}
void
Complex_walker::try_request(Request*req)
{
- walk_regs_p_->try_request(req);
+ bool b =walk_regs_p_->try_request(req);
+ if (!b)
+
+ req->warning("junking request: " + String(req->name()));
+
}
void
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
-
+#include "dimen.hh"
#include "crescendo.hh"
#include "lookup.hh"
#include "paper-def.hh"
-
+#include "debug.hh"
Crescendo::Crescendo(int s)
{
staff_size_i_ = s;
grow_dir_i_ =0;
dir_i_ = -1 ;
+ left_dyn_b_ = right_dyn_b_ =false;
}
Spanner*
Molecule*
Crescendo::brew_molecule_p() const return m_p ;
{
+ Real x_off_dim=0.0;
+ Real absdyn_dim = 10 PT; // UGR
+
m_p = new Molecule;
- Real w_f = width().length();
- Symbol s( paper()->lookup_l()->hairpin(w_f, grow_dir_i_ < 0) );
+ Real w_dim = width().length();
+ if ( left_dyn_b_ ) {
+ w_dim -= absdyn_dim;
+ x_off_dim += absdyn_dim;
+ }
+ if ( right_dyn_b_ ) {
+ w_dim -= absdyn_dim;
+ }
+
+ if (w_dim < 0) {
+ error("Crescendo too small");
+ w_dim = 0;
+ }
+ Symbol s( paper()->lookup_l()->hairpin(w_dim, grow_dir_i_ < 0) );
m_p->add(Atom(s));
int pos = (dir_i_ >0) ? staff_size_i_ + 4 : - 4 ;
m_p->translate(Offset(0,pos * paper()->internote()));
set_debug(bool b)
{
check_debug =b;
-}
+ set_flower_debug(*monitor, check_debug);
+ }
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
-
+#include "debug.hh"
+#include "crescendo.hh"
#include "dynamic-reg.hh"
#include "musical-request.hh"
#include "text-item.hh"
#include "lookup.hh"
#include "paper-def.hh"
+#include "score-column.hh"
Dynamic_register::Dynamic_register()
{
dir_i_ =0;
post_move_processing();
dynamic_p_ =0;
+ to_end_cresc_p_ = cresc_p_ = 0;
+ cresc_req_l_ = 0;
}
void
Dynamic_register::post_move_processing()
{
- dynamic_req_l_ = 0;
+ dynamic_req_l_arr_.set_size(0);
}
bool
Musical_req * m = r->musical();
if (!m || !m->dynamic())
return false;
- assert(!dynamic_req_l_);
- dynamic_req_l_ = m->dynamic();
+ dynamic_req_l_arr_.push(m->dynamic());
return true;
}
void
Dynamic_register::process_requests()
{
- if(dynamic_req_l_){
- if (dynamic_req_l_->absdynamic()) {
+ Crescendo* new_cresc_p=0;
+ for (int i=0; i < dynamic_req_l_arr_.size(); i++) {
+ Dynamic_req *dreq_l = dynamic_req_l_arr_[i];
+ if (dreq_l->absdynamic()) {
Text_def * td_p = new Text_def;
td_p->align_i_ = 0;
String loud =Dynamic_req::loudness_str(
- dynamic_req_l_->absdynamic()->loudness_);
+ dreq_l->absdynamic()->loudness_);
td_p->text_str_ = paper()->lookup_l()->dynamic(loud).tex;
-
-
td_p->style_str_ = "dynamic";
-
+
+ assert (!dynamic_p_) ; // TODO
+
dynamic_p_ = new Text_item(td_p, 10 ); // TODO!
- announce_element(Staff_elem_info(dynamic_p_, dynamic_req_l_));
+ announce_element(Staff_elem_info(dynamic_p_, dreq_l));
+ } else if (dreq_l->span_dynamic()) {
+
+ Span_dynamic_req* span_l = dreq_l->span_dynamic();
+ if (span_l->spantype == Span_req::STOP) {
+ if (!cresc_p_) {
+ span_l->warning("Can't find cresc to end " );
+ } else {
+ assert(!to_end_cresc_p_);
+ to_end_cresc_p_ =cresc_p_;
+ cresc_p_ = 0;
+ }
+ } else if (span_l->spantype == Span_req::START) {
+ cresc_req_l_ = span_l;
+ assert(!new_cresc_p);
+ new_cresc_p = new Crescendo(10);
+ new_cresc_p->grow_dir_i_ = span_l->dynamic_dir_i_;
+ announce_element(Staff_elem_info(new_cresc_p, span_l));
+ }
+ }
+ }
+
+ if ( new_cresc_p ) {
+ cresc_p_ = new_cresc_p;
+ cresc_p_->left_col_l_ = get_staff_info().musical_l()->pcol_l_;
+ if (dynamic_p_) {
+ cresc_p_->left_dyn_b_ = true;
}
}
}
typeset_element(dynamic_p_);
dynamic_p_ = 0;
}
+ if ( to_end_cresc_p_) {
+ if (dynamic_p_)
+ to_end_cresc_p_->right_dyn_b_=true;
+
+ to_end_cresc_p_->right_col_l_ = get_staff_info().musical_l()->pcol_l_;
+
+ typeset_element(to_end_cresc_p_);
+ to_end_cresc_p_ = 0;
+ }
}
bool
}
IMPLEMENT_STATIC_NAME(Dynamic_register);
+ADD_THIS_REGISTER(Dynamic_register);
+
+Dynamic_register::~Dynamic_register()
+{
+ delete dynamic_p_;
+ delete to_end_cresc_p_;
+ if (cresc_p_) {
+ cresc_req_l_->warning("unended crescendo");
+ }
+ delete cresc_p_;
+}
--- /dev/null
+/*
+ global-regs.cc -- implement
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "input-register.hh"
+#include "debug.hh"
+#include "register.hh"
+
+struct Request_register_table_entry {
+ String name_str_;
+ Reg_ctor ctor_l_;
+ Request_register_table_entry(String s, Reg_ctor f) {
+ name_str_ =s;
+ ctor_l_ = f;
+ }
+ Request_register_table_entry()
+ {
+ ctor_l_ =0;
+ }
+};
+
+static Array<Request_register_table_entry> *reg_table=0;
+
+void
+add_request_register(String s, Reg_ctor f)
+{
+ if (!reg_table)
+ reg_table = new Array<Request_register_table_entry>;
+
+ reg_table->push(Request_register_table_entry(s, f));
+}
+
+
+Request_register*
+get_nongroup_register_p(String s)
+{
+ for (int i=0; i < reg_table->size(); i++) {
+ if ((*reg_table)[i].name_str_ == s)
+ return (*(*reg_table)[i].ctor_l_)();
+ }
+ error("Unknown register `" + s +"\'");
+ return 0;
+}
for (int i=0; i < children.size(); i++) {
MInterval inter = intersection(t, children[i]->interval());
- if (inter.empty() || inter.length() <= Rational( 0 )) {
+ if (inter.empty_b() || inter.length() <= Rational( 0 )) {
delete children[i];
children[i] =0;
} else {
note_p_ = n_p;
n_p->set_rhythmic(note_req_l_->rhythmic());
n_p->position = note_req_l_->note()->height() +
- *get_staff_info().c0_position_i_;
+ *get_staff_info().c0_position_i_l_;
} else {
note_p_ = new Rest ( note_req_l_->rhythmic()->duration_);
if (note_req_l_->rhythmic()->duration_.type_i_ <= 2)
}
IMPLEMENT_STATIC_NAME(Notehead_register);
+ADD_THIS_REGISTER(Notehead_register);
#include "identifier.hh"
#include "my-lily-lexer.hh"
#include "debug.hh"
-
+#include "input-register.hh"
#include "input-score.hh"
#include "symtable.hh"
#include "input-staff.hh"
#include "lookup.hh"
#include "script-def.hh"
#include "request.hh"
+#include "input-register.hh"
void
Identifier::error(String expect)
}
Identifier::Identifier(String n, int code)
- : name(n)
+ : name(n)
{
token_code_i_ = code;
data = 0;
accessed_b_ = 0;
init_b_ = 0;
- defined_ch_C_ = 0;
}
void
DEFAULT_PRINT(M_voice_id, Music_voice, mvoice);
DEFAULT_PRINT(Request_id, Request, request);
DEFAULT_PRINT(Score_id, Input_score, score);
+DEFAULT_PRINT(Input_regs_id, Input_register, iregs);
+
void
Real_id::do_print() const
{
Idclass::Idclass(String s, Class*st, int code):Identifier(s,code) { data = st; }\
-implement_id_class(Real_id, Real, real)
-implement_id_class(Script_id, Script_def, script)
-implement_id_class(Lookup_id, Lookup, lookup)
-implement_id_class(Symtables_id, Symtables, symtables)
-implement_id_class(Staff_id, Input_staff, staff)
-implement_id_class(M_chord_id, Music_general_chord, mchord)
-implement_id_class(M_voice_id, Music_voice, mvoice)
-implement_id_class(Score_id, Input_score, score)
-implement_id_class(Request_id, Request, request)
+implement_id_class(Real_id, Real, real);
+implement_id_class(Script_id, Script_def, script);
+implement_id_class(Lookup_id, Lookup, lookup);
+implement_id_class(Symtables_id, Symtables, symtables);
+implement_id_class(Staff_id, Input_staff, staff);
+implement_id_class(M_chord_id, Music_general_chord, mchord);
+implement_id_class(M_voice_id, Music_voice, mvoice);
+implement_id_class(Score_id, Input_score, score);
+implement_id_class(Request_id, Request, request);
+implement_id_class(Input_regs_id, Input_register, iregs);
+
+Identifier::Identifier(Identifier const&)
+{
+ assert(false);
+}
+++ /dev/null
-/*
- class-name.hh -- declare
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef CLASS_NAME_HH
-#define CLASS_NAME_HH
-
-/** a macro to declare the classes name as a static and virtual function.
- The static_name() can *not* be inlined (this might have the effect that
- s->name() != S::static_name(). Overlapping strings need not be merged in C++
- */
-#define NAME_MEMBERS(c) \
-static char const *static_name();\
-virtual char const *name() const{ return c::static_name(); } \
-int a_stupid_nonexistent_function_to_allow_the_semicolon_come_out()
-
-#define IMPLEMENT_STATIC_NAME(c)\
- char const *c::static_name() { return #c; }
-
-#endif // CLASS-NAME_HH
/** Request which are assumed to be "happening" before the
musical requests. */
-struct Command_req : virtual Request {
+class Command_req : public virtual Request {
+public:
REQUESTMETHODS(Command_req, command);
-
+ virtual Terminate_voice_req *terminate() {return 0;}
+ virtual Group_change_req * groupchange() { return 0;}
+ virtual Group_feature_req * groupfeature() { return 0; }
+
virtual Measure_grouping_req * measuregrouping() { return 0; }
virtual Clef_change_req * clefchange() { return 0; }
virtual Key_change_req * keychange() { return 0; }
/** Baseclass for meter/partial req. It has to be handled by
Staff_{walker,column} baseclass. */
-struct Timing_req : Command_req {
+class Timing_req : public Command_req {
+public:
REQUESTMETHODS(Timing_req, timing);
};
-struct Partial_measure_req : Timing_req {
+class Partial_measure_req : public Timing_req {
+public:
Moment duration_;
Partial_measure_req(Moment);
/**
todo: allow C meter
*/
-struct Meter_change_req : Timing_req {
+class Meter_change_req : public Timing_req {
+public:
int beats_i_, one_beat_i_;
int compare(Meter_change_req const&);
};
/// toggle Cadenza mode
-struct Cadenza_req : Timing_req {
+class Cadenza_req : public Timing_req {
+public:
/// turn on?
bool on_b_;
Cadenza_req(bool);
};
/// check if we're at start of a measure.
-struct Barcheck_req : Timing_req {
+class Barcheck_req : public Timing_req {
+public:
REQUESTMETHODS(Barcheck_req,barcheck);
};
-struct Measure_grouping_req: Timing_req {
+class Measure_grouping_req : public Timing_req {
+public:
Array<int> beat_i_arr_;
Array<Moment> elt_length_arr_;
REQUESTMETHODS(Measure_grouping_req, measuregrouping);
};
-struct Group_change_req : Command_req {
+class Group_change_req : public Command_req {
+public:
String newgroup_str_;
REQUESTMETHODS(Group_change_req, groupchange);
};
/** draw a (repeat)-bar. This something different than #Barcheck_req#,
the latter should only happen at the start of a measure. */
-struct Bar_req : Command_req {
+class Bar_req : public Command_req {
+public:
String type_str_;
Bar_req(String);
int compare(const Bar_req&)const;
REQUESTMETHODS(Bar_req,bar);
};
-struct Terminate_voice_req : Command_req {
+class Terminate_voice_req : public Command_req {
+public:
REQUESTMETHODS(Terminate_voice_req,terminate);
};
-struct Group_feature_req : Command_req {
+class Group_feature_req : public Command_req {
+public:
int stemdir_i_;
Group_feature_req();
REQUESTMETHODS(Group_feature_req, groupfeature);
Routines for sharps and flats are separated,
so that caller may identify non-conventional keys.
*/
-struct Key_change_req : Command_req {
+class Key_change_req : public Command_req {
+public:
Array<Melodic_req*> melodic_p_arr_;
bool minor_b_;
int minor_b();
};
-struct Clef_change_req : Command_req {
+class Clef_change_req : public Command_req {
+public:
String clef_str_;
Clef_change_req(String);
REQUESTMETHODS(Clef_change_req, clefchange);
public:
- int c0_position_i_;
Walker_registers *walk_regs_p_;
/* *************** */
#define CRESCENDO_HH
#include "spanner.hh"
-
+/**
+ The hairpin symbol. (cresc)
+ */
class Crescendo : public Spanner {
int staff_size_i_;
public:
int grow_dir_i_;
int dir_i_;
+ /// if there is a dynamic at the end, make the sign smaller.
+ bool right_dyn_b_;
+
+ /// if there is a dynamic at the end, make the sign smaller.
+ bool left_dyn_b_;
Crescendo(int staff_size_i);
private:
Spanner* do_break_at( PCol*, PCol*) const;
struct Dynamic_register : Request_register {
int dir_i_;
Text_item * dynamic_p_;
- Dynamic_req* dynamic_req_l_;
+ Crescendo * to_end_cresc_p_;
+ Crescendo * cresc_p_;
+ Span_dynamic_req * cresc_req_l_;
+ Array<Dynamic_req*> dynamic_req_l_arr_;
/* ************** */
Dynamic_register();
+ ~Dynamic_register();
virtual bool try_request(Request *req_l);
virtual void process_requests();
virtual void pre_move_processing();
#include "proto.hh"
#include "string.hh"
+#include "input.hh"
/* boolean argument to accesor is copy_b..*/
#define IDACCESSOR( Input_staff, staff)\
virtual Input_staff * staff(bool) { error(#Input_staff); return 0; }
-struct Identifier {
+struct Identifier : public Input {
void *data;
String name;
bool init_b_;
bool accessed_b_;
int token_code_i_;
- char const *defined_ch_C_;
Identifier(String n, int code) ;
virtual ~Identifier() {}
IDACCESSOR(Input_staff, staff)
IDACCESSOR(Input_music, music)
IDACCESSOR(Music_voice, mvoice)
+ IDACCESSOR(Input_register, iregs)
+
IDACCESSOR(Script_def, script)
IDACCESSOR(Symtables, symtables)
IDACCESSOR(Music_general_chord, mchord)
protected:
virtual void do_print()const=0;
private:
- Identifier(Identifier const&){}
+ Identifier(Identifier const&);
};
#define declare_id_class(Idclass, Class, accessor) \
declare_id_class(M_voice_id, Music_voice, mvoice);
declare_id_class(Score_id, Input_score, score);
declare_id_class(Request_id, Request, request);
+declare_id_class(Input_regs_id, Input_register, iregs);
#endif // IDENTIFIER_
--- /dev/null
+/*
+ input-register.hh -- declare Input_register
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef INPUT_REGISTER_HH
+#define INPUT_REGISTER_HH
+
+#include "plist.hh"
+#include "string.hh"
+#include "proto.hh"
+#include "input.hh"
+
+struct Input_register : Input {
+ IPointerList<Input_register*> ireg_list_;
+ String name_str_;
+
+ void add(Input_register*);
+ Input_register();
+ bool group_b() const;
+ ~Input_register();
+ /** Get an Input_register with a certain name
+
+ @return 0 if not found.
+ */
+ Input_register *get_ireg_l(String name) const;
+ Input_register(Input_register const&);
+ /**
+ The names of all non -groups.
+ */
+ Array<String> get_nongroups_str_arr() const;
+ void print() const;
+ /**
+ Construct the registers.
+ */
+ Array<Request_register*> get_nongroup_p_arr()const;
+};
+
+Request_register * get_nongroup_register_p(String);
+
+#endif // INPUT_REGISTER_HH
#include "proto.hh"
#include "plist.hh"
#include "string.hh"
-
+#include "input.hh"
/// the total music def of one movement
-struct Input_score {
- /// defined where?
- char const * defined_ch_C_;
+class Input_score : public Input {
+public:
int errorlevel_i_;
/// paper_, staffs_ and commands_ form the problem definition.
void add(Input_staff*);
~Input_score();
/// construction
- void set(Paper_def*);
+ void set(Paper_def* paper_p);
void set(Midi_def* midi_p);
void print() const;
Score*parse();
#include "plist.hh"
#include "varray.hh"
#include "proto.hh"
+#include "input.hh"
-struct Input_staff {
-
- char const * defined_ch_C_;
- String type;
+class Input_staff:public Input {
+public:
IPointerList<Input_music*> music_;
+ Input_register * ireg_p_;
/* *************** */
~Input_staff();
void add(Input_music*m);
Input_staff(Input_staff const&);
- Input_staff(String);
+ Input_staff();
Staff* parse(Score*);
void print() const;
};
--- /dev/null
+/*
+ input.hh -- declare Input
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef INPUT_HH
+#define INPUT_HH
+
+/**
+ Base class for anything that records its poisition in the parse file.
+ */
+class Input {
+ char const *defined_ch_C_ ;
+ Sources * sources_l_;
+public:
+
+ void warning(String)const; // should use member func?
+ void error(String)const;
+ void message(String)const;
+ void set_spot(Input const &);
+ void set_sources(Sources *);
+
+ String location_str()const;
+ Input(Sources *,char const*);
+ Input();
+};
+
+#endif // INPUT_HH
--- /dev/null
+/*
+ lyric-register.hh -- declare
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef LYRIC_REGISTER_HH
+#define LYRIC_REGISTER_HH
+#include "register.hh"
+#include "varray.hh"
+
+#include "proto.hh"
+class Lyric_register : public Request_register {
+ Array<Lyric_req*> lreq_arr_;
+ virtual bool acceptable_request_b(Request*);
+ virtual bool try_request(Request*);
+ virtual void process_requests();
+ virtual void post_move_processing();
+public:
+ NAME_MEMBERS(Lyric_register);
+ Lyric_register();
+};
+#endif // LYRIC_REGISTER_HH
+++ /dev/null
-/*
- lyricstaff.hh -- part of LilyPond
-
- copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
- */
-
-#ifndef LYRICSTAFF_HH
-#define LYRICSTAFF_HH
-
-#include "staff.hh"
-
-/**
- Hungarian prefix lstaff
- */
-struct Lyric_staff : Staff {
- virtual void set_output(PScore *);
- virtual Staff_walker *get_walker_p();
-};
-
-#endif // LYRICSTAFF_HH
-
-
-
-
+++ /dev/null
-//
-// lyricwalker.hh -- declare Lyric_walker
-//
-// (c) 1996,97 Han-Wen Nienhuys, Jan Nieuwenhuizen <jan@digicash.com>
-//
-
-#ifndef LYRICWALKER_HH
-#define LYRICWALKER_HH
-
-#include "proto.hh"
-#include "grouping.hh"
-#include "staff-walker.hh"
-
-/// a simple walker which collects words, and then print them, first on top
-struct Lyric_walker: Staff_walker {
- Array<Lyric_item*> litem_l_array_;
-
- /* *************** */
- virtual void process_requests();
-
- Lyric_walker(Lyric_staff* lstaff_l);
- Lyric_staff* lstaff_l();
-};
-
-
-#endif // LYRICWALKER_HH
-
-
A request which is coupled to a #Voice_element# with nonzero duration.
Base class only
*/
-struct Musical_req : virtual Request {
+class Musical_req : public virtual Request {
+public:
virtual Skip_req* skip() { return 0; }
virtual Dynamic_req* dynamic() { return 0; }
};
-struct Skip_req : Musical_req {
+class Skip_req : public Musical_req {
+public:
Moment duration_;
virtual Moment duration() const;
/** a request with a duration.
This request is used only a base class.
*/
-struct Rhythmic_req : virtual Musical_req {
+class Rhythmic_req : public virtual Musical_req {
+public:
Duration duration_;
/* *************** */
REQUESTMETHODS(Spacing_req, spacing);
};
-struct Blank_req : Spacing_req, Rhythmic_req {
+class Blank_req : public Spacing_req, Rhythmic_req {
+public:
REQUESTMETHODS(Spacing_req, spacing);
};
/// Put a text above or below (?) this staff.
-struct Text_req : virtual Musical_req {
+class Text_req : public virtual Musical_req {
+public:
/// preferred position (above/below)
int dir_i_;
/// the characteristics of the text
/** Put a text in lyric_staff
@see Lyric_staff
*/
-struct Lyric_req : public Rhythmic_req, Text_req {
+class Lyric_req : public Rhythmic_req, public Text_req {
+public:
Lyric_req(Text_def* t_p);
REQUESTMETHODS(Lyric_req, lreq_l);
};
};
/// Put a note of specified type, height, and with accidental on the staff.
-struct Note_req : Rhythmic_req, virtual Melodic_req {
+class Note_req : public Rhythmic_req, virtual public Melodic_req {
+public:
/// force/supress printing of accidental.
bool forceacc_b_;
attach a stem to the noteball.
Rhythmic_req parent needed to determine if it will fit inside a beam.
*/
-struct Stem_req : Rhythmic_req {
+class Stem_req : public Rhythmic_req {
+public:
/// preferred direction for the stem
int dir_i_;
Stem_req();
Requests to start or stop something.
This type of request typically results in the creation of a #Spanner#
*/
-struct Span_req : virtual Musical_req {
+class Span_req : public virtual Musical_req {
+public:
/// should the spanner start or stop, or is it unwanted?
enum {
NOSPAN, START, STOP
ugr. Place in hierarchy?
*/
-struct Plet_req : virtual Request {
+class Plet_req : public virtual Request {
+public:
char type_c_;
int dur_i_;
int type_i_;
/** Start / stop a beam at this note. if #nplet# is set, the staff will try to put an
appropriate number over the beam
*/
-struct Beam_req : Span_req {
+class Beam_req : public Span_req {
+public:
int nplet;
/* *************** */
};
/// a slur
-struct Slur_req : Span_req {
+class Slur_req : public Span_req {
+public:
REQUESTMETHODS(Slur_req,slur);
};
/** Put a script above or below this ``note''. eg upbow, downbow. Why
a request? These symbols may conflict with slurs and brackets, so
this also a request */
-struct Script_req : Musical_req {
+class Script_req : public Musical_req {
+public:
int dir_i_;
Script_def *scriptdef_p_;
Dynamic request carries a time, measured from the start of its
note.
*/
-struct Subtle_req : virtual Musical_req {
+class Subtle_req : public virtual Musical_req {
+public:
Moment subtime_;
REQUESTMETHODS(Subtle_req, subtle);
};
-struct Dynamic_req : Subtle_req {
+class Dynamic_req : public Subtle_req {
+public:
/// for absolute dynamics
enum Loudness {
FFF, FF, F, MF, MP, P, PP, PPP
REQUESTMETHODS(Dynamic_req, dynamic);
};
-struct Absolute_dynamic_req : Dynamic_req {
+class Absolute_dynamic_req : public Dynamic_req {
+public:
Loudness loudness_;
Absolute_dynamic_req();
REQUESTMETHODS(Absolute_dynamic_req, absdynamic);
};
-struct Span_dynamic_req : Dynamic_req, Span_req {
+class Span_dynamic_req : public Dynamic_req, public Span_req {
+public:
/// Grow or shrink the volume: 1=cresc, -1 = decresc
int dynamic_dir_i_;
Span_dynamic_req();
#include "duration.hh"
#include "string.hh"
#include "varray.hh"
+#include "input.hh"
class My_lily_parser {
+ char const* here_ch_C()const;
+ Array<Input> define_spot_array_;
+
+
+ void add_requests( Voice_element*v);
+
+ Voice_element * get_note_element(Note_req * ,Duration *);
+ Voice_element* get_rest_element(String,Duration *);
+ Voice_element* get_word_element(Text_def*, Duration*);
+ void set_last_duration(Duration const *);
+ void set_duration_mode(String s);
public:
friend int yyparse( void*);
bool last_duration_mode ;
Array<Request*> pre_reqs, post_reqs;
- Array<const char *> define_spot_array_;
- char const* defined_ch_C_;
int fatal_error_i_;
Sources * source_l_;
int error_level_i_;
My_lily_lexer * lexer_p_;
Moment plet_mom();
- void add_requests( Voice_element*v);
-
- Voice_element * get_note_element(Note_req * ,Duration *);
- Voice_element* get_rest_element(String,Duration *);
- Voice_element* get_word_element(Text_def*, Duration*);
- void set_last_duration(Duration const *);
- void set_duration_mode(String s);
- char const* here_ch_C()const;
+ Input here_input()const;
void remember_spot();
+ Input pop_spot();
+
Paper_def*default_paper();
void do_yyparse();
void parser_error(String);
public:
void parse_file ( String init_str, String file_str);
My_lily_parser(Sources * sources_l);
+ ~My_lily_parser();
};
#endif // MY_LILY_PARSER_HH
*/
Request_register * get_register_p(Request_register*reg_l);
virtual void set_feature(Features i);
- virtual bool acceptable_request_b(Request*);
+ virtual bool acceptable_request_b(Request*)const;
virtual void pre_move_processing();
virtual void post_move_processing();
virtual void acknowledge_element(Staff_elem_info info);
virtual void process_requests();
virtual ~Register_group_register();
virtual void add(Request_register* reg_p);
- virtual bool contains_b(Request_register*);
+ void add(Array<Request_register*> reg_p_arr);
+ virtual bool contains_b(Request_register*)const;
};
#endif // REGISTERGROUP_HH
#include "varray.hh"
#include "request.hh"
#include "staff-elem-info.hh"
+#include "staff-info.hh"
/**
a struct which processes requests, and creates the #Staff_elem#s.
/**
Does this equal or contain a certain register?
*/
- virtual bool contains_b(Request_register*reg_l);
+ virtual bool contains_b(Request_register*reg_l)const;
/**
Get information on the staff. Default: ask daddy.
*/
void print() const;
};
+/**
+ A macro to automate administration of registers.
+ */
+#define ADD_THIS_REGISTER(c) \
+struct c ## init { \
+ static Request_register * globalctor (){ \
+ return new c; \
+ } \
+ c ## init () { \
+ add_request_register(c::static_name(), globalctor); \
+ \
+ } \
+} _ ## c ## init;
+
+typedef Request_register*(*Reg_ctor)(void);
+void add_request_register(String s, Reg_ctor f);
#endif // REGISTER_HH
#include "string.hh"
#include "moment.hh"
#include "class-name.hh"
+#include "input.hh"
/**
a voice element wants something printed.
Hungarian postfix: req
@see lilygut manpage
*/
-class Request {
+class Request : public Input {
public:
Voice_element*elt_l_;
- char const* defined_ch_C_;
/* *************** */
Voice * voice_l();
virtual Rhythmic_req*rhythmic() { return 0; }
virtual Lyric_req* lreq_l() { return 0; }
virtual Melodic_req *melodic() { return 0; }
- virtual Terminate_voice_req *terminate() {return 0;}
- virtual Group_change_req * groupchange() { return 0;}
- virtual Group_feature_req * groupfeature() { return 0; }
- virtual Spacing_req * spacing() { return 0; }
+ virtual Spacing_req * spacing() { return 0; }
virtual Blank_req * blank() { return 0; }
virtual Musical_req *musical() { return 0; }
virtual Command_req * command() { return 0; }
};
+#include "compare.hh"
+
instantiate_compare(Score_column&, Score_column::compare);
#endif // SCCOL_HH
#include "moment.hh"
#include "assoc.hh"
#include "string.hh"
+#include "input.hh"
/// the total music def of one movement
struct Score {
IPointerList<Score_column*> cols_;
PScore *pscore_p_;
- char const *defined_ch_C_;
+ Input input_;
int errorlevel_i_;
/* *************************************************************** */
#ifndef SCRIPTDEF_HH
#define SCRIPTDEF_HH
#include "string.hh"
+
struct Script_def{
int stemdir;
int staffdir;
*/
struct Spanner:Staff_elem {
- PCol *left, *right;
+ PCol *left_col_l_, *right_col_l_;
/* *************** */
Staff_elem_info();
};
-/// struct to pass staff info along a Request_register hierarchy.
-struct Staff_info {
- int *c0_position_i_;
- Staff_walker *walk_l_;
-
- /// when is now?
- Time_description const *time_C_;
- Rhythmic_grouping const *rhythmic_C_;
- bool break_allowed_b_;
-};
-
struct Features {
bool initialiser_b_;
Stem. So the Beam has to be calculated *before* Stem. This is
accomplished with the dependencies field of struct Staff_elem.
+ (elem)
*/
-struct Staff_elem {
+class Staff_elem {
+
+ /// member: the symbols
+ Molecule *output; // should scrap, and use temp var?
+
+
+ /**
+ This is needed, because #output# may still be
+ NULL.
+ */
+ Offset offset_;
+ Array<Staff_elem*> dependancy_l_arr_;
+public:
enum Status {
ORPHAN, // not yet added to pstaff
VIRGIN, // added to pstaff
PRECALCING,
PRECALCED, // calcs before spacing done
- POSTCALCING,
+ POSTCALCING, // busy calculating. This is used to trap cyclic deps.
POSTCALCED, // after spacing calcs done
OUTPUT, // molecule has been output
} status;
/// do calculations after determining horizontal spacing
virtual void do_post_processing();
- Array<Staff_elem*> dependants;
+ Array<Staff_elem*> dependant_l_arr_;
-private:
- /// member: the symbols
- Molecule *output; // should scrap, and use temp var?
-
-
- /**
- This is needed, because #output# may still be
- NULL.
- */
- Offset offset_;
- Array<Staff_elem*> dependencies;
};
--- /dev/null
+/*
+ staff-info.hh -- declare
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef STAFF_INFO_HH
+#define STAFF_INFO_HH
+
+/// struct to pass staff info along a Request_register hierarchy.
+struct Staff_info {
+ int *c0_position_i_l_;
+ Staff_walker *walk_l_;
+
+
+ /// when is now?
+ Time_description const *time_C_;
+ Rhythmic_grouping const *rhythmic_C_;
+ bool break_allowed_b_;
+
+ Moment when();
+ Staff * staff_l();
+ Score *score_l();
+ PCol * command_pcol_l();
+ PCol * musical_pcol_l();
+ Staff_column *column_l();
+ Score_column *musical_l();
+ Score_column *command_l();
+ Staff_info();
+};
+
+#endif // STAFF_INFO_HH
--- /dev/null
+/*
+ staff-regs.hh -- declare Staff_registers
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef STAFF_REGS_HH
+#define STAFF_REGS_HH
+
+#include "register-group.hh"
+
+/**
+ Registers which manage a Staff (one 5-line linestaff)
+ */
+class Staff_registers : public Register_group_register {
+ int c0_position_i_;
+ Input_register const *ireg_C_;
+ int base_position_i_;
+ Array<Voice_group_registers*> group_l_arr_;
+
+public:
+
+ /* *************** */
+ NAME_MEMBERS(Staff_registers);
+ void change_group(Group_change_req * greq_l,
+ Voice_registers *voice_regs_l,
+ Voice_group_registers * old_group);
+ Voice_group_registers * get_group(String id);
+ void terminate_register(Request_register * reg);
+ virtual bool try_request(Request * r);
+ virtual Staff_info get_staff_info();
+ Staff_registers(Input_register const*);
+ virtual bool acceptable_request_b(Request*) const ;
+};
+
+#endif // STAFF_REGS_HH
--- /dev/null
+/*
+ staff-sym-reg.hh -- declare
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef STAFF_SYM_REG_HH
+#define STAFF_SYM_REG_HH
+#include "register.hh"
+#include "moment.hh"
+
+/**
+ Manage the staff symbol.
+ */
+class Staff_sym_register : public Request_register {
+ Staff_symbol *span_p_;
+ Moment last_mom_;
+public:
+ ~Staff_sym_register();
+ Staff_sym_register();
+ NAME_MEMBERS(Staff_sym_register);
+ virtual void pre_move_processing();
+ virtual void post_move_processing();
+};
+#endif // STAFF_SYM_REG_HH
--- /dev/null
+/*
+ staffsym.hh -- declare Staff_symbol
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef STAFFSYM_HH
+#define STAFFSYM_HH
+#include "spanner.hh"
+/**
+ This spanner draws the lines of a pstaff.
+ The bottom line is position 0.
+ */
+class Staff_symbol : public Spanner
+{
+public:
+ /// this many lines.
+ int no_lines_i_;
+
+ NAME_MEMBERS(Staff_symbol);
+ Staff_symbol(int lines);
+ virtual Molecule* brew_molecule_p() const;
+ void set_extent(PCol* p1, PCol* p2);
+ virtual void do_print()const;
+ virtual Spanner *do_break_at( PCol *c1, PCol *c2) const;
+};
+#endif // STAFFSYM_HH
/// synchronous horizontal stuff
IPointerList<Voice*> voice_list_;
Staff_column *get_col(Moment, PCursor<Staff_column*> * last= 0);
-
+
public:
-
+ Input_register * ireg_p_;
+
/// runtime field
IPointerList<Staff_column*> cols_;
+++ /dev/null
-/*
- staffsym.hh -- declare Staff_symbol
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef STAFFSYM_HH
-#define STAFFSYM_HH
-#include "spanner.hh"
-/**
- This spanner draws the lines of a pstaff.
- The bottom line is position 0.
- */
-class Staff_symbol : public Spanner
-{
-public:
- /// this many lines.
- int no_lines_i_;
-
- NAME_MEMBERS(Staff_symbol);
- Staff_symbol(int lines);
- virtual Molecule* brew_molecule_p() const;
- void set_extent(PCol* p1, PCol* p2);
- virtual void do_print()const;
- virtual Spanner *do_break_at( PCol *c1, PCol *c2) const;
-};
-#endif // STAFFSYM_HH
--- /dev/null
+/*
+ swallow-reg.hh -- declare Swallow_register
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef SWALLOW_REG_HH
+#define SWALLOW_REG_HH
+
+#include "register.hh"
+
+/**
+ This register swallows everything given to it silently. The purpose of
+ this is to prevent spurious "request junked" warnings.
+ */
+class Swallow_register : public Request_register {
+protected:
+ bool acceptable_request_b(Request*) const;
+ bool try_request(Request*) ;
+public:
+ NAME_MEMBERS(Swallow_register);
+};
+#endif // SWALLOW_REG_HH
#include "string.hh"
#include "proto.hh"
+#include "input.hh"
-struct Text_def {
+struct Text_def : Input {
int align_i_;
String text_str_;
String style_str_;
- char const* defined_ch_C_;
-
-
+
/* *************** */
virtual ~Text_def() {};
bool compare(const Text_def&);
void OK() const;
Time_description();
void add(Moment dt);
+ bool allow_meter_change_b();
String str()const;
void print() const;
void setpartial(Moment p);
#include "proto.hh"
#include "plist.hh"
#include "moment.hh"
+#include "input.hh"
/** one horizontal bit. Voice_element is nothing but a container for
*the requests, */
-struct Voice_element {
+class Voice_element : public Input{
+public:
/** the duration of the element. This can be 0; The duration is
determined from rhythmical requests contained in this
Voice_element */
Moment duration_;
- char const* defined_ch_C_;
- Voice const *voice_l_;
+ Voice const *voice_C_;
IPointerList<Request*> reqs;
/* *************** */
#include "register-group.hh"
-struct Voice_group_registers : Register_group_register {
+/**
+ A group of voices which share certain characteristics (such as beams. ).
+ */
+class Voice_group_registers : public Register_group_register {
+ Moment termination_mom_;
+ Input_register const *ireg_C_;
+protected:
+ virtual void do_print() const;
+ virtual void post_move_processing();
+ virtual bool try_request(Request*);
+public:
+
+ virtual Request_register * get_register_p(Request_register * reg_l);
+ /// each group in a staff has an unique ID.
String group_id_str_;
+
+ /// The pointers are in the base class. This is just administration
Array<Voice_registers*> voice_regs_l_;
- Moment termination_mom_;
-
/* *************** */
NAME_MEMBERS(Voice_group_registers);
static bool static_acceptable_request_b(Request*);
- virtual void terminate_register(Request_register*);
- virtual void do_print() const;
- virtual void post_move_processing();
virtual void add(Request_register*);
- Voice_group_registers(String id);
- virtual bool try_request(Request*);
+ Voice_group_registers(String id, Input_register const *);
};
#endif // VOICEGROUPREGS_HH
#include "register-group.hh"
class Voice_registers : public Register_group_register {
-
+ Input_register const *ireg_C_;
public:
Voice *voice_l_;
/* *************** */
virtual bool acceptable_request_b(Request*);
virtual void acknowledge_element(Staff_elem_info info);
virtual bool try_request(Request*);
- Voice_registers(Voice*);
+ Voice_registers(Voice*, Input_register const*);
virtual void do_print() const;
};
Array<Item*> nobreak_item_p_arr_;
Array<Item*> postbreak_item_p_arr_;
Array<Staff_elem_info> announce_info_arr_;
- Array<Voice_group_registers*> group_l_arr_;
+
Complex_walker * walk_l_;
/* *************** */
- void change_group(Group_change_req * greq_l,
- Voice_registers *voice_regs_l,
- Voice_group_registers * old_group);
- Voice_group_registers * get_group(String id);
+
void typeset_musical_item(Staff_elem * elem_p);
Walker_registers(Complex_walker*);
void do_announces();
- void terminate_register(Request_register * reg);
- virtual bool try_request(Request * r);
+
virtual Staff_info get_staff_info();
virtual void announce_element(Staff_elem_info);
if ( i->plet() ) {
Moment start_moment = 0;
if ( !find_plet_start_b( i->plet()->type_c_, start_moment ) ) {
- error( "begin of plet not found", i->defined_ch_C_ );
+ i ->error( "begin of plet not found");
break;
}
Moment moment = 0;
--- /dev/null
+/*
+ input-register.cc -- implement Input_register
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+#include "debug.hh"
+#include "register.hh"
+#include "input-register.hh"
+Input_register::~Input_register()
+{}
+
+Input_register::Input_register()
+{
+}
+
+bool
+Input_register::group_b()const
+{
+ return ireg_list_.size();
+}
+
+Array<String>
+Input_register::get_nongroups_str_arr()const
+{
+ Array<String> s_arr;
+ for (iter_top(ireg_list_, i); i.ok(); i++) {
+ if (!i->group_b())
+ s_arr.push(i->name_str_);
+ }
+ return s_arr;
+}
+
+Input_register*
+Input_register::get_ireg_l(String nm)const
+{
+ for (iter_top(ireg_list_, i); i.ok(); i++) {
+ if (i->name_str_ == nm)
+ return i;
+ }
+ return 0;
+}
+Array<Request_register*>
+Input_register::get_nongroup_p_arr() const return a;
+{
+ Array<String> sa(get_nongroups_str_arr());
+ for (int i=0; i < sa.size(); i++)
+ a.push(get_nongroup_register_p(sa[i]));
+}
+
+void
+Input_register::add(Input_register *p)
+{
+ ireg_list_.bottom().add(p);
+}
+
+void
+Input_register::print() const
+{
+#ifndef NPRINT
+ mtor << name_str_ << " { ";
+ for (iter_top(ireg_list_, i); i.ok(); i++)
+ i->print();
+ mtor <<" }\n";
+#endif
+}
+
+
+Input_register::Input_register(Input_register const&s)
+ : Input(s)
+{
+ name_str_ = s.name_str_;
+ for (iter_top(s.ireg_list_, i); i.ok(); i++)
+ add(new Input_register(*i.ptr()));
+}
}
Input_score::Input_score(Input_score const&s)
+ : Input(s)
{
paper_p_ = (s.paper_p_)? new Paper_def(*s.paper_p_) :0;
midi_p_ = (s.midi_p_)? new Midi_def(*s.midi_p_) : 0;
- defined_ch_C_ = s.defined_ch_C_;
errorlevel_i_ = s.errorlevel_i_;
}
Input_score::parse()
{
Score *s_p = new Score;
- s_p->defined_ch_C_= defined_ch_C_;
+
s_p->errorlevel_i_ = errorlevel_i_;
if (midi_p_)
s_p->set(new Midi_def(*midi_p_));
Input_score::Input_score()
{
- defined_ch_C_=0;
paper_p_= 0;
midi_p_ = 0;
errorlevel_i_ = 0;
#include "input-staff.hh"
#include "staff.hh"
#include "complex-staff.hh"
-#include "lyric-staff.hh"
-
#include "my-lily-lexer.hh"
+#include "input-register.hh"
-
-Input_staff::Input_staff(String s)
+Input_staff::Input_staff()
{
- type= s;
- defined_ch_C_ = 0;
+ ireg_p_ =0;
}
void
Staff*
Input_staff::parse(Score*score_l)
{
- Staff *p=0;
- if (type == "melodic")
- p = new Complex_staff;
- else if (type == "lyric")
- p = new Lyric_staff;
- else {
- error( "Unknown staff-type `" + type +"\'", defined_ch_C_ );
- exit( 1 );
- }
-
+ Staff *p=new Complex_staff;
+
p->score_l_ = score_l;
-
+ p->ireg_p_ = (ireg_p_)? new Input_register(*ireg_p_):0;
for (iter_top(music_,i); i.ok(); i++) {
Voice_list vl = i->convert();
p->add(vl);
}
Input_staff::Input_staff(Input_staff const&s)
+ : Input(s)
{
for (iter_top(s.music_,i); i.ok(); i++)
add(i->clone());
- defined_ch_C_ = s.defined_ch_C_;
- type = s.type;
+
+ ireg_p_ = (s.ireg_p_)? new Input_register(*s.ireg_p_):0;
}
void
mtor << "Input_staff {\n";
for (iter_top(music_,i); i.ok(); i++)
i->print();
+ ireg_p_->print();
mtor << "}\n";
#endif
}
Input_staff::~Input_staff()
{
+ delete ireg_p_;
}
--- /dev/null
+/*
+ input.cc -- implement Input
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+#include "proto.hh"
+#include "input.hh"
+#include "string.hh"
+#include "source.hh"
+#include "source-file.hh"
+
+Input::Input(Sources*s, char const *cl)
+{
+ sources_l_=s;
+ defined_ch_C_=cl;
+}
+
+Input::Input()
+{
+ sources_l_ = 0;
+ defined_ch_C_ = 0;
+}
+
+Input::Input(Input const &s)
+{
+ sources_l_ = s.sources_l_;
+ defined_ch_C_ = s.defined_ch_C_;
+}
+
+void
+Input::set_spot(Input const &i)
+{
+ *this = i;
+}
+
+void
+Input::message(String message_str)const
+{
+ String str = "";
+ Source_file* sourcefile_l=0;
+
+ if (sources_l_)
+ sourcefile_l = sources_l_->sourcefile_l( defined_ch_C_ );
+
+ if ( sourcefile_l ) {
+ str += sourcefile_l->file_line_no_str(defined_ch_C_) + String(": ");
+ }
+
+ str += message_str;
+ if ( sourcefile_l ) {
+ str += ":\n";
+ str += sourcefile_l->error_str( defined_ch_C_);
+ }
+ /*
+ if ( busy_parsing() )
+ cerr << endl;
+ */
+ cerr << str << endl;
+}
+
+void
+Input::warning( String message_str)const
+{
+ message( "warning: " + message_str);
+}
+void
+Input::error(String s)const
+{
+ message("error: "+ s);
+ exit (1);
+}
+
+String
+Input::location_str()const
+{
+ Source_file * sourcefile_l=0;
+ if (sources_l_)
+ sourcefile_l = sources_l_->sourcefile_l (defined_ch_C_);
+ if (sourcefile_l)
+ return sourcefile_l->file_line_no_str(defined_ch_C_);
+ else
+ return "(location unknown)";
+}
{
Command_req * r_l = info.req_l_->command() ;
if (r_l && r_l->clefchange() && !kit_p_) {
- int c0_i= *get_staff_info().c0_position_i_;
+ int c0_i= *get_staff_info().c0_position_i_l_;
kit_p_ = new Key_item(c0_i);
kit_p_->read(*this);
announce_element(Staff_elem_info(kit_p_, keyreq_l_));
}
if ( default_key_b_ || keyreq_l_) {
- int c0_i= *get_staff_info().c0_position_i_;
+ int c0_i= *get_staff_info().c0_position_i_l_;
kit_p_ = new Key_item(c0_i);
kit_p_->read(*this);
announce_element(Staff_elem_info(kit_p_, keyreq_l_));
kit_p_ = 0;
}
IMPLEMENT_STATIC_NAME(Key_register);
+ADD_THIS_REGISTER(Key_register);
if (!key_item_p_) {
- key_item_p_ = new Local_key_item(*get_staff_info().c0_position_i_);
+ key_item_p_ = new Local_key_item(*get_staff_info().c0_position_i_l_);
}
key_item_p_->add(note_l_);
if (key_C_)
local_key_.reset(*key_C_);
else if( time_C_->when_ >Moment(0))
- warning ("Help me! can't figure current key", 0);
+ warning ("Help me! can't figure current key", (const char*)0);
}
}
IMPLEMENT_STATIC_NAME(Local_key_register);
+ADD_THIS_REGISTER(Local_key_register);
// test context-error
if ( tdef_l()->text_str_.index_i( "Gates" ) >=0)// :-)
- warning( "foul word", tdef_l()->defined_ch_C_ );
+ tdef_l()->warning( "foul word");
}
--- /dev/null
+/*
+ lyric-register.cc -- implement Lyric_register
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "staff-walker.hh"
+#include "lyric-register.hh"
+#include "lyric-item.hh"
+#include "musical-request.hh"
+
+Lyric_register::Lyric_register()
+{
+
+}
+
+bool
+Lyric_register::try_request(Request*r)
+{
+ Musical_req * m =r->musical();
+ if (!m || ! m->lreq_l())
+ return false;
+ lreq_arr_.push(m->lreq_l());
+
+ return true;
+}
+
+void
+Lyric_register::process_requests()
+{
+ for (int i=0; i < lreq_arr_.size(); i++) {
+ Item *lp = new Lyric_item(lreq_arr_[i],i);
+ typeset_element(lp);
+ }
+ get_staff_info().walk_l_->allow_break();
+}
+
+void
+Lyric_register::post_move_processing()
+{
+ lreq_arr_.set_size(0);
+}
+
+
+bool
+Lyric_register::acceptable_request_b(Request*r)
+{
+ Musical_req * m =r->musical();
+ return (!m || ! m->lreq_l()) ;
+}
+
+IMPLEMENT_STATIC_NAME(Lyric_register);
+ADD_THIS_REGISTER(Lyric_register);
+++ /dev/null
-#include "musical-request.hh"
-#include "voice.hh"
-#include "staff-walker.hh"
-#include "debug.hh"
-#include "staff.hh"
-#include "lyric-staff.hh"
-#include "lyric-walker.hh"
-#include "p-score.hh"
-
-void
-Lyric_staff::set_output(PScore*pscore_l)
-{
- pstaff_l_ = new PStaff(pscore_l);
- pscore_l_ = pscore_l;
- pscore_l_->add(pstaff_l_);
-}
-
-Staff_walker*
-Lyric_staff::get_walker_p()
-{
- return new Lyric_walker(this);
-}
+++ /dev/null
-/*
- lyricwalker.cc -- implement Lyric_walker
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
-*/
-
-#include "musical-request.hh"
-#include "voice.hh"
-#include "p-score.hh"
-#include "lyric-staff.hh"
-#include "lyric-walker.hh"
-#include "debug.hh"
-#include "lyric-item.hh"
-#include "staff-column.hh"
-
-void
-Lyric_walker::process_requests()
-{
- allow_break();
-
- int req_count=0;
- for (int i = 0; i < ptr()->musicalreq_l_arr_.size(); i++) {
- Lyric_req * lreq_l = ptr()->musicalreq_l_arr_[i]->lreq_l();
- if (!lreq_l)
- continue;
- Item *lp = new Lyric_item(lreq_l,req_count++);
- ptr()->typeset_musical_item( lp);
- }
-}
-
-Lyric_walker::Lyric_walker(Lyric_staff* lstaff_l)
- : Staff_walker(lstaff_l, lstaff_l->pstaff_l_->pscore_l_)
-{
-
-}
-
-
Sources* source_l_g = 0;
bool only_midi = false;
-extern void parse_file(String,String);
void
"USA.\n";
}
-static File_path * path =0;
-struct Main_init {
- Main_init() {
- path = new File_path(String(DIR_DATADIR)+"/init/");
- path->push(DIR_DATADIR );
- debug_init();
- }
- ~Main_init() {
- delete path;
- }
-} main_init;
+static File_path * path_l =0;
void
do_one_file(String init_str, String file_str)
{
- source_l_g = new Sources;
- source_l_g->set_path(path);
- My_lily_parser parser(source_l_g);
- parser.parse_file(init_str, file_str);
+ Sources sources;
+ source_l_g = &sources;
+ source_l_g->set_path(path_l);
+ {
+ My_lily_parser parser(source_l_g);
+ parser.parse_file(init_str, file_str);
+ }
do_scores();
- delete source_l_g;
source_l_g = 0;
}
int
main (int argc, char **argv)
{
+ debug_init(); // should be first
+ File_path path(String(DIR_DATADIR)+"/init/") ;
+ path_l = & path;
+ path_l->push(DIR_DATADIR );
+
+ char const * env_l=getenv("LILYINCLUDE");
+ if (env_l) {
+ path.add(env_l);
+ }
+
Getopt_long oparser(argc, argv,theopts);
cout << get_version_str() << endl;
String init_str("symbol.ini");
exit(0);
break;
case 'I':
- path->push(oparser.optarg);
+ path.push(oparser.optarg);
break;
case 'i':
init_str = oparser.optarg;
return 0;
}
-String
-find_file(String f)
-{
- return path->find(f);
-}
/// make input file name: add default extension. "" is stdin.
void
meter_p_ =0;
}
IMPLEMENT_STATIC_NAME(Meter_register);
+ADD_THIS_REGISTER(Meter_register);
str += ",\n";
Midi_text generate( Midi_text::TEXT, str );
midi_track.add( Moment( 0 ), &generate );
+
+#if 0 // TODO!
Source_file* sourcefile_l = source_l_g->sourcefile_l( score_l_->defined_ch_C_ );
if ( sourcefile_l ) {
- str = "from musical definition: "
+ str += "from musical definition: "
+ sourcefile_l->file_line_no_str(score_l_->defined_ch_C_);
}
+#endif
Midi_text from( Midi_text::TEXT, str );
midi_track.add( Moment( 0 ), &from );
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 ), 0 );
+ output_event( Midi_time( meter_l->beats_i_, meter_l->one_beat_i_, 18 ), 0 );
Key_change_req* key_l = c_l->keychange();
if ( key_l ) {
int sharps_i = key_l->sharps_i();
Request::Request()
{
elt_l_ = 0;
- defined_ch_C_ = 0;
}
Request::Request(Request const&src)
+ :Input(src)
{
elt_l_ = 0;
- defined_ch_C_ = src.defined_ch_C_;
}
/* *************** */
Spacing_req::Spacing_req()
}
accidental_i_ += delta.accidental_i_;
if (abs(accidental_i_) > 2) {
- warning("transposition makes accidental larger than 2",
- delta.defined_ch_C_);
+ delta.warning("transposition makes accidental larger than 2");
}
}
if (!elt_l_)
return 0;
else
- return (Voice*)elt_l_->voice_l_;
+ return (Voice*)elt_l_->voice_C_;
}
/* *************** */
"clef", CLEF,
"cm", CM_T,
"duration", DURATIONCOMMAND,
- "dynamic", DYNAMIC,
+ "absdynamic", ABSDYNAMIC,
+ "group", GROUP,
"geometric", GEOMETRIC,
"in", IN_T,
+ "inputregister", INPUT_REGS,
"lyric", LYRIC,
"key", KEY,
"melodic" , MELODIC,
"start", START_T,
"stem", STEM,
"table", TABLE,
+ "spandynamic", SPANDYNAMIC,
"symboltables", SYMBOLTABLES,
"tempo", TEMPO,
"texid", TEXID,
mtor << "deleting: " << ai.key()<<'\n';
Identifier *i_p = ai.val();
if (!i_p->accessed_b_ && !i_p->init_b_)
- warning("Variable not used", i_p->defined_ch_C_);
+ i_p->warning("Variable not used");
delete ai.val();
}
/*
- my-lily-parser.cc -- implement
+ my-lily-parser.cc -- implement My_lily_parser
source file of the LilyPond music typesetter
lexer_p_ = new My_lily_lexer;
set_debug();
+ init_parse_b_ = true;
lexer_p_->new_input(init, source_l_);
do_yyparse();
print_declarations();
init_parse_b_ = false;
+ set_debug();
lexer_p_->new_input(s, source_l_);
do_yyparse();
if(!define_spot_array_.empty())
- warning("Braces don't match.",0);
+ warning("Braces don't match.");
}
My_lily_parser::~My_lily_parser()
void
My_lily_parser::remember_spot()
{
- define_spot_array_.push(here_ch_C());
+ define_spot_array_.push(here_input());
}
char const *
Lyric_req* lreq_p = new Lyric_req(tdef_p);
lreq_p->duration_ = *duration_p;
- lreq_p->defined_ch_C_ = here_ch_C();
+ lreq_p->set_spot( here_input());
velt_p->add(lreq_p);
My_lily_parser::get_rest_element(String, Duration * duration_p )
{
Voice_element* velt_p = new Voice_element;
- velt_p->defined_ch_C_ = lexer_p_->here_ch_C();
+ velt_p->set_spot( here_input());
Rest_req * rest_req_p = new Rest_req;
rest_req_p->duration_ = *duration_p;
- rest_req_p->defined_ch_C_ = here_ch_C();
+ rest_req_p->set_spot( here_input());
velt_p->add(rest_req_p);
delete duration_p;
My_lily_parser::get_note_element(Note_req *rq, Duration * duration_p )
{
Voice_element*v = new Voice_element;
- v->defined_ch_C_ = here_ch_C();
+ v->set_spot( here_input());
if (duration_p->type_i_ >= 2) {
Stem_req * stem_req_p = new Stem_req();
stem_req_p->duration_ = *duration_p;
- stem_req_p->defined_ch_C_ = here_ch_C();
+ stem_req_p->set_spot( here_input());
v->add(stem_req_p);
}
rq->set_duration(*duration_p);
- rq->defined_ch_C_ = here_ch_C();
+ rq->set_spot( here_input());
v->add(rq);
break;
}
- req_p->defined_ch_C_ = here_ch_C();
+ req_p->set_spot( here_input());
return req_p;
}
textstyle_str_="roman"; // in lexer?
error_level_i_ = 0;
last_duration_mode = false;
- defined_ch_C_ = 0;
fatal_error_i_ = 0;
}
}
post_reqs.set_size(0);
}
+
+Input
+My_lily_parser::pop_spot()
+{
+ return define_spot_array_.pop();
+}
+
+Input
+My_lily_parser::here_input()const
+{
+ return Input(source_l_, here_ch_C());
+}
+/*
+ p-col.cc -- implement PCol
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
#include "p-col.hh"
#include "p-score.hh"
#include "p-staff.hh"
for (iter_top(its,i); i.ok(); i++)
w.unite(i->width());
- if (w.empty())
+ if (w.empty_b())
w.unite(Interval(0,0));
return w;
}
int
PCol::rank() const
{
-#if 0
- if(!pscore_l_)
- return -1;
- PCursor<PCol*> me=pscore_l_->find_col( (PCol*)this);
- if (!me.ok())
- return -1;
- PCursor<PCol*> bot(pscore_l_->cols.top());
- return me - bot;
-#endif
assert(rank_i_ != -1);
return rank_i_;
}
#ifndef NPRINT
mtor << "PCol {";
- if (rank() >= 0)
- mtor << "rank: " << rank_i_ << '\n';
+ mtor << "rank: " << rank_i_ << '\n';
mtor << "# symbols: " << its.size() ;
if (breakable_b()){
void
PScore::add_broken(Spanner*s)
{
- assert(s->left->line_l_ == s->right->line_l_);
+ assert(s->left_col_l_->line_l_ == s->right_col_l_->line_l_);
broken_spans.bottom().add(s);
- s->left->starters.bottom().add (s);
- s->right->stoppers.bottom().add (s);
+ s->left_col_l_->starters.bottom().add (s);
+ s->right_col_l_->stoppers.bottom().add (s);
}
void
#include "voice-element.hh"
#include "my-lily-parser.hh"
#include "text-def.hh"
+#include "input-register.hh"
#ifndef NDEBUG
#define YYDEBUG 1
Box *box;
Duration *duration;
Identifier *id;
+ Input_register * iregs;
Input_music *music;
Input_score *score;
Input_staff *staff;
%token CLEF
%token CM_T
%token DURATIONCOMMAND
-%token DYNAMIC
+%token ABSDYNAMIC
%token END
%token GEOMETRIC
%token GROUPING
+%token GROUP
+%token INPUT_REGS
%token IN_T
%token LYRIC
%token KEY
%token SCORE
%token SCRIPT
%token SKIP
+%token SPANDYNAMIC
%token STAFF
%token START_T
%token STEM
%token <i> DOTS
%token <i> INT
+%token <id> REGS_IDENTIFIER
%token <id> IDENTIFIER
%token <id> MELODIC_REQUEST_IDENTIFIER
%token <id> CHORD_IDENTIFIER
%type <paper> paper_block paper_body
%type <real> dim real
%type <real> unit
-%type <request> post_request pre_request command_req pure_post_request
+%type <request> post_request pre_request command_req
+%type <request> pure_post_request pure_post_request_choice
%type <request> script_req textscript_req dynamic_req
%type <score> score_block score_body
%type <script> script_definition script_body mudela_script
%type <symbol> symboldef
%type <symtable> symtable symtable_body
%type <textdef> mudela_text
-
+%type <iregs> input_regs input_regs_body
%left PRIORITY
add_declaration: declaration {
THIS->lexer_p_->add_identifier($1);
$1->init_b_ = THIS->init_parse_b_;
- $1->defined_ch_C_ = THIS->define_spot_array_.pop();
+ $1->set_spot(THIS->pop_spot());
}
;
| old_identifier {
THIS->remember_spot();
$$ = new String($1->name);
- warning("redeclaration of `" + *$$ + "'", THIS->here_ch_C());
+ THIS->here_input().warning("redeclaration of `" + *$$ + "'");
}
;
| REAL_IDENTIFIER
| SCORE_IDENTIFIER
| REQUEST_IDENTIFIER
+ | REGS_IDENTIFIER
;
declaration:
$$ = new Request_id(*$1, $3, MELODIC_REQUEST_IDENTIFIER);
delete $1;
}
+ | declarable_identifier '=' input_regs {
+ $$ = new Input_regs_id(*$1, $3, REGS_IDENTIFIER);
+ delete $1;
+ }
;
+input_regs:
+ INPUT_REGS
+ { THIS->remember_spot(); }
+ '{' input_regs_body '}'
+ {
+ $$ = $4;
+ $$->set_spot(THIS->pop_spot());
+ }
+ ;
+
+input_regs_body:
+ REGS_IDENTIFIER {
+ $$ = $1->iregs(true);
+ }
+ |STRING {
+ $$ = new Input_register;
+ $$->name_str_ = *$1;
+ }
+ | input_regs_body input_regs {
+ $$->add($2);
+ }
+ ;
+
/*
SCORE
*/
SCORE { THIS->remember_spot(); }
/*cont*/ '{' score_body '}' {
$$ = $4;
- $$->defined_ch_C_ = THIS->define_spot_array_.pop();
+ $$->set_spot(THIS->pop_spot());
if (!$$->paper_p_ && ! $$->midi_p_)
$$->paper_p_ = THIS->default_paper();
STAFF { THIS->remember_spot(); }
/*cont*/ '{' staff_body '}' {
$$ = $4;
- $$-> defined_ch_C_ = THIS->define_spot_array_.pop();
+ $$-> set_spot(THIS->pop_spot());
}
| { THIS->remember_spot(); }
/*cont*/ STAFF_IDENTIFIER {
$$ = $2->staff(true);
- $$-> defined_ch_C_ = THIS->define_spot_array_.pop();
+ $$-> set_spot(THIS->pop_spot());
}
;
staff_init:
- /* empty */ {
- $$ = new Input_staff( "melodic" );
+ REGS_IDENTIFIER {
+ $$ = new Input_staff;
+ $$->ireg_p_ = $1->iregs(true);
}
- | STRING {
- $$ = new Input_staff(*$1);
- delete $1;
+ | input_regs {
+ $$ = new Input_staff;
+ $$->ireg_p_ = $1;
}
;
command_elt:
/* empty */ {
$$ = new Voice_element;
- $$-> defined_ch_C_ = THIS->here_ch_C();
+ $$-> set_spot( THIS->here_input());
}
/* cont: */
command_req {
- $2-> defined_ch_C_ = $$->defined_ch_C_;
+ $2-> set_spot( THIS->here_input());
$$->add($2);
}
| GROUPING '{' intastint_list '}' {
$$ = get_grouping_req(*$3); delete $3;
}
+ | GROUP STRING {
+ $$ = new Group_change_req;
+ $$ -> command()->groupchange()->newgroup_str_ = *$2;
+ delete $2;
+ }
;
post_requests:
assert(THIS->post_reqs.empty());
}
| post_requests post_request {
- $2->defined_ch_C_ = THIS->here_ch_C();
+ $2->set_spot( THIS->here_input());
THIS->post_reqs.push($2);
}
| post_requests close_plet_parens INT '/' INT {
}
;
-pure_post_request:
+pure_post_request:
+ pure_post_request_choice {
+ $$ = $1;
+ $$->set_spot( THIS->here_input());
+ }
+ ;
+pure_post_request_choice:
close_request_parens {
$$ = THIS->get_parens_request($1);
}
;
dynamic_req:
- DYNAMIC '{' int '}' {
+ ABSDYNAMIC '{' int '}' {
Absolute_dynamic_req *ad_p = new Absolute_dynamic_req;
ad_p ->loudness_ = (Dynamic_req::Loudness)$3;
$$ =ad_p;
}
+ |SPANDYNAMIC '{' int int '}' {
+ Span_dynamic_req * sp_p = new Span_dynamic_req;
+ sp_p->spantype = $4;
+ sp_p-> dynamic_dir_i_ = $3;
+ $$ = sp_p;
+ }
;
close_plet_parens:
']' {
- //req_defined_ch_C = THIS->here_ch_C();
$$ = ']';
}
;
mudela_text:
STRING {
- //defined_ch_C = THIS->here_ch_C();
$$ = new Text_def;
$$->text_str_ = *$1;
delete $1;
| '>' { $$ = get_scriptdef('>'); }
| DOTS {
if ( $1 > 1 )
- warning( "too many staccato dots", THIS->here_ch_C() );
+ THIS->here_input().warning( "too many staccato dots" );
$$ = get_scriptdef('.');
}
;
pre_requests:
| pre_requests pre_request {
THIS->pre_reqs.push($2);
- $2->defined_ch_C_ = THIS->here_ch_C();
+ $2->set_spot( THIS->here_input());
}
;
pre_request:
open_request_parens {
- //defined_ch_C = THIS->here_ch_C();
$$ = THIS->get_parens_request($1);
}
;
#include "register.hh"
bool
-Register_group_register::acceptable_request_b(Request* r)
+Register_group_register::acceptable_request_b(Request* r)const
{
for (iter_top(reg_list_, i); i.ok(); i++) {
if (i->acceptable_request_b(r))
}
bool
-Register_group_register::contains_b(Request_register* reg_l)
+Register_group_register::contains_b(Request_register* reg_l)const
{
bool parent_b = Request_register::contains_b(reg_l);
}
return false;
}
+void
+Register_group_register::add(Array<Request_register*> p_arr)
+{
+ for (int i =0; i<p_arr.size(); i++)
+ add(p_arr[i]);
+}
void
Register_group_register::add(Request_register *reg_p)
}
IMPLEMENT_STATIC_NAME(Register_group_register);
+ADD_THIS_REGISTER(Register_group_register);
void
Register_group_register::do_print()const
}
bool
-Request_register::contains_b(Request_register *reg_l)
+Request_register::contains_b(Request_register *reg_l)const
{
return this == reg_l;
}
Request_register::print() const
{
#ifndef NPRINT
- mtor << name() << " {";
+ mtor << "\n" << name() << " {";
do_print();
- mtor << "}\n";
+ mtor << "}";
#endif
}
*mlog << "\nSetting up music ..." << flush;
if (last() == Moment(0)) {
errorlevel_i_ |= 1;
- error("Need to have music in a score.", defined_ch_C_);
+ input_.error("Need to have music in a score.");
}
for (iter_top(staffs_,i); i.ok(); i++) {
paper_p_ = 0;
midi_p_ = 0;
errorlevel_i_ = 0;
- defined_ch_C_ = 0;
}
Score::~Score()
Tex_stream the_output(paper_p_->outfile);
the_output << "% outputting Score, defined at: " <<
- source_l_g->
- sourcefile_l (defined_ch_C_)->file_line_no_str(defined_ch_C_) << "\n";
+ input_.location_str() << "\n";
pscore_p_->output(the_output);
+
}
void
for (int i=0; i < score_array_global.size(); i++) {
Input_score* &is_p = score_array_global[i];
if (is_p->errorlevel_i_) {
- warning("Score contains errors. Will not process it. ",
- is_p->defined_ch_C_);
+ is_p->warning("Score contains errors. Will not process it. ");
delete is_p;
continue;
}
dir_i_ = i.direction_i_;
}
IMPLEMENT_STATIC_NAME(Script_register);
+ADD_THIS_REGISTER(Script_register);
// end slur: move the slur to other array
if (slur_req_l->spantype == Span_req::STOP) {
if (slur_l_stack_.empty())
- warning("can't find slur to end",
- slur_req_l->defined_ch_C_);
+
+ slur_req_l->warning("can't find slur to end");
else {
end_slur_l_arr_.push(slur_l_stack_.pop());
requests_arr_.pop();
Slur_register::~Slur_register()
{
for (int i=0; i < requests_arr_.size(); i++) {
- warning("unterminated slur", requests_arr_[i]->defined_ch_C_);
+ requests_arr_[i]->warning("unterminated slur");
}
}
IMPLEMENT_STATIC_NAME(Slur_register);
+ADD_THIS_REGISTER(Slur_register);
void
Slur::do_pre_processing()
{
- right = encompass.top()->pcol_l_;
- left = encompass[0]->pcol_l_;
+ right_col_l_ = encompass.top()->pcol_l_;
+ left_col_l_ = encompass[0]->pcol_l_;
}
Spanner*
if (encompass[i]->pcol_l_->line_l_==l->line_l_)
ret->encompass.push(encompass[i]);
}
- if (right != r)
+ if (right_col_l_ != r)
ret->open_right = true;
- if (left != l)
+ if (left_col_l_ != l)
ret->open_left = true;
{
Spanner *span_p = do_break_at(c1,c2);
- for (int i=0; i < dependants.size(); i++) {
- dependants[i]->substitute_dependency((Staff_elem*)this, span_p);
+ for (int i=0; i < dependant_l_arr_.size(); i++) {
+ dependant_l_arr_[i]->
+ substitute_dependency((Staff_elem*)this, span_p);
}
- span_p->left = c1;
- span_p->right = c2;
+ span_p->left_col_l_ = c1;
+ span_p->right_col_l_ = c2;
return span_p;
}
Spanner::Spanner()
{
- left = right = 0;
+ left_col_l_ = right_col_l_ = 0;
}
Interval
Spanner::width()const
{
- Real r = right->hpos;
- Real l = left->hpos;
- assert(*left < *right);
+ Real r = right_col_l_->hpos;
+ Real l = left_col_l_->hpos;
+ assert(*left_col_l_ < *right_col_l_);
assert(r>=l);
return Interval(0, r-l);
Interval wid(0,0);
for (int i =0; i < item_l_arr.size(); i++) {
Interval item_width= item_l_arr[i]->width();
+ if (item_width.empty_b()) {
+ item_width = Interval(0,0);
+ }
Real dx =wid.right - item_width.left;
item_width += dx;
item_l_arr[i]->translate(Offset(dx ,0));
f.initialiser_b_ = true;
f.direction_i_ = d;
}
+
+
}
Staff_elem::Staff_elem(Staff_elem const&s)
- : dependants(s.dependants),
- dependencies(s.dependencies)
+ :dependancy_l_arr_(s.dependancy_l_arr_),
+ dependant_l_arr_(s.dependant_l_arr_)
{
status = s.status;
assert(!s.output);
}
/**
TODO:
- If deleted, then remove dependants depency!
+ If deleted, then remove dependant_l_arr_ depency!
*/
Staff_elem::~Staff_elem()
{
} else
r = output->extent().x;
- if (!r.empty()) // float exception on DEC Alpha
+ if (!r.empty_b()) // float exception on DEC Alpha
r+=offset_.x;
return r;
} else
r = output->extent().y;
- if (!r.empty())
+ if (!r.empty_b())
r+=offset_.y;
assert(status != PRECALCING); // cyclic dependency
status = PRECALCING;
- for (int i=0; i < dependencies.size(); i++)
- if (dependencies[i])
- dependencies[i]->pre_processing();
+ for (int i=0; i < dependancy_l_arr_.size(); i++)
+ if (dependancy_l_arr_[i])
+ dependancy_l_arr_[i]->pre_processing();
do_pre_processing();
assert(status != POSTCALCING);// cyclic dependency
status=POSTCALCING;
- for (int i=0; i < dependencies.size(); i++)
- if (dependencies[i])
- dependencies[i]->post_processing();
+ for (int i=0; i < dependancy_l_arr_.size(); i++)
+ if (dependancy_l_arr_[i])
+ dependancy_l_arr_[i]->post_processing();
do_post_processing();
status=POSTCALCED;
}
if (status >= OUTPUT)
return;
status = OUTPUT; // do it only once.
- for (int i=0; i < dependencies.size(); i++)
- if (dependencies[i])
- dependencies[i]->molecule_processing();
+ for (int i=0; i < dependancy_l_arr_.size(); i++)
+ if (dependancy_l_arr_[i])
+ dependancy_l_arr_[i]->molecule_processing();
output= brew_molecule_p();
}
Staff_elem::substitute_dependency(Staff_elem * old, Staff_elem * newdep)
{
bool hebbes_b=false;
- for (int i=0; i < dependencies.size(); i++) {
- if (dependencies[i] == old){
- dependencies[i] = newdep;
+ for (int i=0; i < dependancy_l_arr_.size(); i++) {
+ if (dependancy_l_arr_[i] == old){
+ dependancy_l_arr_[i] = newdep;
hebbes_b = true;
- } else if (dependencies[i] == newdep) {
+ } else if (dependancy_l_arr_[i] == newdep) {
hebbes_b = true;
}
}
if (!hebbes_b)
- dependencies.push(newdep);
+ dependancy_l_arr_.push(newdep);
}
void
Staff_elem::add_dependency(Staff_elem * p)
{
- for (int i=0; i < dependencies.size(); i ++)
- if (dependencies[i] == p)
+ for (int i=0; i < dependancy_l_arr_.size(); i ++)
+ if (dependancy_l_arr_[i] == p)
return;
- dependencies.push(p);
- p->dependants.push(p);
+ dependancy_l_arr_.push(p);
+ p->dependant_l_arr_.push(p);
}
IMPLEMENT_STATIC_NAME(Staff_elem);
--- /dev/null
+/*
+ staff-info.cc -- implement Staff_info
+
+ source file of the LilyPond music typesetter
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+#include "staff.hh"
+#include "proto.hh"
+#include "staff-info.hh"
+#include "score-column.hh"
+#include "complex-walker.hh"
+#include "staff-column.hh"
+
+Staff*
+Staff_info::staff_l()
+{
+ return walk_l_->staff_l_;
+}
+
+Score*
+Staff_info::score_l()
+{
+ return staff_l()->score_l_;
+}
+Staff_info::Staff_info()
+{
+ c0_position_i_l_ = 0;
+ walk_l_ = 0;
+ time_C_ = 0;
+ rhythmic_C_ =0;
+ break_allowed_b_ = 0;
+}
+
+Staff_column*
+Staff_info::column_l()
+{
+ return walk_l_->ptr();
+}
+
+Score_column*
+Staff_info::musical_l()
+{
+ return column_l() -> musical_column_l_;
+}
+
+Score_column*
+Staff_info::command_l()
+{
+ return column_l() -> command_column_l_;
+}
+PCol*
+Staff_info::command_pcol_l()
+{
+ return command_l()->pcol_l_;
+}
+
+Moment
+Staff_info::when()
+{
+ return walk_l_->when();
+}
+
--- /dev/null
+/*
+ staff-regs.cc -- implement Staff_registers
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+#include "staff-sym.hh"
+#include "voice-group-regs.hh"
+#include "voice-regs.hh"
+#include "staff-regs.hh"
+#include "command-request.hh"
+#include "bar.hh"
+#include "debug.hh"
+#include "input-register.hh"
+
+Staff_info
+Staff_registers::get_staff_info() return inf;
+{
+ inf = Request_register::get_staff_info();
+ inf.c0_position_i_l_ = &c0_position_i_;
+}
+
+Staff_registers::Staff_registers(Input_register const*ireg_C)
+{
+ c0_position_i_ = 0;
+ base_position_i_ =0;
+ add( ireg_C->get_nongroup_p_arr());
+ ireg_C_ =ireg_C;
+}
+
+/** Magic function which takes a Voice_registers out of one of its own
+ children, and puts it in another. This also handles the push and
+ popgroup feature. */
+void
+Staff_registers::change_group(Group_change_req * greq_l,
+ Voice_registers *voice_regs_l,
+ Voice_group_registers * old_group)
+{
+
+ Voice_registers *regs_p = (old_group)
+ ? (Voice_registers*) old_group->get_register_p(
+ voice_regs_l)
+ : new Voice_registers(
+ greq_l->voice_l(), ireg_C_->get_ireg_l("Voice_group_registers")
+ ->get_ireg_l("Voice_registers"));
+
+ String new_str = greq_l->newgroup_str_;
+ String old_str;
+ if (old_group)
+ old_str = old_group->group_id_str_;
+ if ( new_str[0] == '+') {
+ new_str = old_str + new_str;
+ } else if (new_str[0] == '-') {
+ int idx = old_str.index_last_i('+');
+ if (idx >=0)
+ new_str = old_str.left_str ( idx );
+ }
+ Voice_group_registers * new_group_l = get_group(new_str);
+ new_group_l->add(regs_p);
+
+ mtor << "processed change_group " << get_staff_info().when()<<"\n";
+ print();
+}
+
+Voice_group_registers *
+Staff_registers::get_group(String id)
+{
+ for (int i=0; i < group_l_arr_.size(); i++) {
+ if (group_l_arr_[i]->group_id_str_ == id)
+ return group_l_arr_[i];
+ }
+ Voice_group_registers *group_p =
+ new Voice_group_registers(id, ireg_C_->get_ireg_l("Voice_group_registers"));
+ group_l_arr_.push(group_p);
+ add(group_p);
+ return group_p;
+}
+
+
+void
+Staff_registers::terminate_register(Request_register * reg)
+{
+ for (int i=0; i < group_l_arr_.size(); i++) {
+ if (group_l_arr_[i] == reg) {
+ group_l_arr_.del(i);
+ Register_group_register::terminate_register(reg);
+ return;
+ }
+ }
+ assert(false);
+}
+
+bool
+Staff_registers::try_request(Request * r)
+{
+ bool b = Register_group_register::try_request(r);
+ if (!b) {
+ Command_req * cr_l = r->command() ;
+
+ if (cr_l && cr_l->groupchange()) {
+ change_group(cr_l->groupchange(), 0, 0);
+ b = true;
+ } else
+ b= false;
+ }
+ return b;
+}
+
+IMPLEMENT_STATIC_NAME(Staff_registers);
+
+bool
+Staff_registers::acceptable_request_b(Request*r)const
+{
+ return Register_group_register::acceptable_request_b(r) ||
+ (r->command() && r->command()->groupchange());
+}
+
--- /dev/null
+/*
+ staff-sym-reg.cc -- implement Staff_sym_register
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "staff-sym-reg.hh"
+#include "staff-sym.hh"
+#include "score.hh"
+#include "p-col.hh"
+
+const NO_LINES = 5;
+
+Staff_sym_register::Staff_sym_register()
+{
+ span_p_ = 0;
+ last_mom_ =0;
+}
+
+void
+Staff_sym_register::post_move_processing()
+{
+ if (!span_p_ && !last_mom_) {
+ span_p_= new Staff_symbol(NO_LINES);
+ span_p_->left_col_l_ =
+ get_staff_info().command_pcol_l()->postbreak_p_; // GUH
+ }
+ if (!last_mom_) {
+ last_mom_ = get_staff_info().score_l()->last();
+ }
+}
+
+
+void
+Staff_sym_register::pre_move_processing()
+{
+ Staff_info i=get_staff_info();
+ if ( span_p_ && i.when() == last_mom_) {
+ span_p_->right_col_l_ = i.command_pcol_l()->prebreak_p_;
+ typeset_element(span_p_);
+ span_p_ =0;
+ }
+}
+
+IMPLEMENT_STATIC_NAME(Staff_sym_register);
+ADD_THIS_REGISTER(Staff_sym_register);
+Staff_sym_register::~Staff_sym_register()
+{
+ assert(!span_p_);
+ delete span_p_;
+}
--- /dev/null
+/*
+ staffsym.cc -- implement Staff_symbol
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+#include "staff-sym.hh"
+#include "lookup.hh"
+#include "paper-def.hh"
+#include "debug.hh"
+
+
+
+Staff_symbol::Staff_symbol(int l)
+{
+ no_lines_i_ = l;
+}
+
+IMPLEMENT_STATIC_NAME(Staff_symbol);
+
+void
+Staff_symbol::do_print()const
+{
+ mtor << "lines: " << no_lines_i_;
+}
+
+Molecule*
+Staff_symbol::brew_molecule_p() const
+{
+ Atom a = paper()->lookup_l()->linestaff(no_lines_i_, width().length());
+ return new Molecule(a);
+}
+
+Spanner*
+Staff_symbol::do_break_at(PCol*p1, PCol*p2)const
+{
+ Staff_symbol *span_p=new Staff_symbol(*this);
+ return span_p;
+}
+
+void
+Staff_symbol::set_extent(PCol*p1, PCol*p2)
+{
+ assert(p1&&p2);
+ left_col_l_ = p1;
+ right_col_l_ = p2;
+}
if (tr_l->meterchange()) {
int b_i=tr_l->meterchange()->beats_i_;
int o_i = tr_l->meterchange()->one_beat_i_;
- time_.set_meter(b_i, o_i);
+ if (! time_.allow_meter_change_b() )
+
+ tr_l->warning("Meterchange should be at start of measure");
+ else
+ time_.set_meter(b_i, o_i);
*default_grouping = Rhythmic_grouping(
MInterval(0,Moment(b_i, o_i)), b_i);
if (tr_l->partial()) {
time_.setpartial(tr_l->partial()->duration_);
} else if (tr_l->barcheck() && time_.whole_in_measure_) {
- warning( "Barcheck failed", tr_l->defined_ch_C_ );
+ tr_l ->warning( "Barcheck failed");
} else if (tr_l->cadenza()) {
time_.set_cadenza(tr_l->cadenza()->on_b_);
} else if (tr_l->measuregrouping()) {
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
-
+#include "input-register.hh"
#include "proto.hh"
-#include "plist.hh"
#include "staff.hh"
#include "score.hh"
#include "voice.hh"
-#include "staff-walker.hh"
#include "staff-column.hh"
#include "score-column.hh"
#include "voice-element.hh"
#include "debug.hh"
#include "musical-request.hh"
#include "command-request.hh" // todo
-#include "midi-stream.hh"
#include "pqueue.hh"
for (iter_top(voice_list_,i); i.ok(); i++) {
i->print();
}
+ ireg_p_->print();
mtor <<"}\n";
#endif
}
Staff::Staff()
{
+ ireg_p_ =0;
score_l_ =0;
pscore_l_ =0;
pstaff_l_ =0;
static String
make_vbox(Interval i)
{
- Real r = (i.empty()) ? 0.0 : i.length();
+ if (i.empty_b())
+ i = Interval(0,0);
+ Real r = i.length();
String s("\\vbox to ");
s += print_dimen(r);
s += "{\\vskip "+print_dimen(i.right)+" ";
PCol *linestop = sc->cols.bottom();
for (iter_top(pstaff_l_->spans,i); i.ok(); i++) {
- PCol *brokenstart = &max(*linestart, *i->left);
- PCol *brokenstop = &min(*linestop, *i->right);
+ PCol *brokenstart = &max(*linestart, *i->left_col_l_);
+ PCol *brokenstop = &min(*linestop, *i->right_col_l_);
if ( *brokenstart < *brokenstop) {
Spanner*span_p =i->broken_at(brokenstart,brokenstop);
line_of_score_l_->pscore_l_-> // higghl
+++ /dev/null
-/*
- staffsym.cc -- implement Staff_symbol
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-#include "staffsym.hh"
-#include "lookup.hh"
-#include "paper-def.hh"
-#include "debug.hh"
-
-
-
-Staff_symbol::Staff_symbol(int l)
-{
- no_lines_i_ = l;
-}
-
-IMPLEMENT_STATIC_NAME(Staff_symbol);
-
-void
-Staff_symbol::do_print()const
-{
- mtor << "lines: " << no_lines_i_;
-}
-
-Molecule*
-Staff_symbol::brew_molecule_p() const
-{
- Atom a = paper()->lookup_l()->linestaff(no_lines_i_, width().length());
- return new Molecule(a);
-}
-
-Spanner*
-Staff_symbol::do_break_at(PCol*p1, PCol*p2)const
-{
- Staff_symbol *span_p=new Staff_symbol(*this);
- return span_p;
-}
-
-void
-Staff_symbol::set_extent(PCol*p1, PCol*p2)
-{
- assert(p1&&p2);
- left = p1;
- right = p2;
-}
if (beam_p_) {
if (stem_req_l_->duration_.type_i_<= 4)
- warning( "stem doesn't fit in Beam",
- stem_req_l_->defined_ch_C_);
+
+ stem_req_l_->warning( "stem doesn't fit in Beam");
else
beam_p_->add(stem_p_);
stem_p_->print_flag = false;
Stem_beam_register::~Stem_beam_register()
{
if (beam_p_)
- warning("unterminated beam", start_req_l_->defined_ch_C_);
+ start_req_l_->warning("unterminated beam");
}
void
}
IMPLEMENT_STATIC_NAME(Stem_beam_register);
+ADD_THIS_REGISTER(Stem_beam_register);
// todo: margins
if (! ((dir > 0 && se >= maxnote) || (se <= minnote && dir <0)) )
- warning("Weird stem size; check for narrow beams",0);
+ warning("Weird stem size; check for narrow beams");
top = (dir < 0) ? maxnote : se;
bot = (dir < 0) ? se : minnote;
Stem::set_default_extents()
{
if (minnote > maxnote) {
- warning("Empty stem. Ugh!", 0);
+ warning("Empty stem. Ugh!");
minnote = -10;
maxnote = 20;
}
--- /dev/null
+/*
+ swallow-reg.cc -- implement Swallow_register
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+#include "swallow-reg.hh"
+
+IMPLEMENT_STATIC_NAME(Swallow_register);
+ADD_THIS_REGISTER(Swallow_register);
+
+bool
+Swallow_register::acceptable_request_b(Request*) const
+{
+ return true;
+}
+
+bool
+Swallow_register::try_request(Request*)
+{
+ return true;
+}
#include "input-score.hh"
#include "input-staff.hh"
#include "input-music.hh"
+#include "input-register.hh"
#include "molecule.hh"
#include "voice-element.hh"
#include "plist.tcc"
IPL_instantiate(Atom);
IPL_instantiate(Input_staff);
IPL_instantiate(Input_music);
+IPL_instantiate(Input_register);
{
align_i_ = 1; // right
style_str_ = "roman";
- defined_ch_C_ = 0;
}
bool
Text_def::compare(Text_def const &def)
text_req_l_ = 0;
}
IMPLEMENT_STATIC_NAME(Text_register);
+ADD_THIS_REGISTER(Text_register);
void
Text_spanner::do_pre_processing()
{
- right = support->right;
- left = support->left;
- assert(left && right);
+ right_col_l_ = support->right_col_l_;
+ left_col_l_ = support->left_col_l_;
+ assert(left_col_l_ && right_col_l_);
}
Interval
if(whole_in_measure_)
error_t("Meterchange should be at start of measure", *this);
}
-
+bool
+Time_description::allow_meter_change_b()
+{
+ return!(whole_in_measure_);
+}
void
Time_description::setpartial(Moment p)
{
--- /dev/null
+/*
+ voice-elt.cc -- implement Voice_element
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#include "proto.hh"
+#include "plist.hh"
+#include "debug.hh"
+#include "voice.hh"
+#include "voice-element.hh"
+#include "musical-request.hh"
+#include "command-request.hh"
+
+
+void
+Voice_element::transpose(Melodic_req const&d)const
+{
+ for (iter_top(reqs,i); i.ok(); i++) {
+ i->transpose(d);
+ }
+}
+
+void
+Voice_element::print() const
+{
+#ifndef NPRINT
+ mtor << "voice_element { dur :"<< duration_ <<"\n";
+ for (iter_top(reqs,rc); rc.ok(); rc++) {
+ rc->print();
+ }
+ mtor << "}\n";
+#endif
+}
+
+void
+Voice_element::add(Request*r)
+{
+ if (r->duration()) {
+ assert (!duration_ || duration_ == r->duration());
+ duration_ = r->duration();
+ }
+
+ r->elt_l_ = this;
+ reqs.bottom().add(r);
+}
+
+
+Voice_element::Voice_element()
+{
+ voice_C_ = 0;
+ duration_ = 0;
+}
+
+Voice_element::Voice_element(Voice_element const&src)
+ : Input(src)
+{
+
+ voice_C_=0;
+ for (iter_top(src.reqs, i); i.ok(); i++)
+ add(i->clone());
+
+}
+bool
+Voice_element::find_plet_start_b(char c, Moment& moment_r)// b unused?
+{
+ assert( c == ']' );
+ moment_r += duration_;
+ for ( PCursor<Request*> i( reqs.top() ); i.ok(); i++ ) {
+ if (i->beam() && i->beam()->spantype == Span_req::START )
+ return true;
+ }
+ return false;
+}
+
+void
+Voice_element::set_default_group(String s)
+{
+ for (iter_top(reqs, i); i.ok(); i++)
+ if (i->command() &&i->command()->groupchange())
+ return ;
+ Group_change_req *greq = new Group_change_req;
+ greq->newgroup_str_ = s;
+ add(greq);
+}
+
+void
+Voice_element::set_plet_backwards(Moment& now_moment_r,
+ Moment until_moment, int num_i, int den_i)
+{
+ now_moment_r += duration_;
+ if ( now_moment_r > until_moment )
+ return;
+ for ( PCursor<Request*> i( reqs.top() ); i.ok(); i++ ) {
+ if (i->beam() && i->beam()->spantype == Span_req::START )
+ i->beam()->nplet = den_i;
+ if (i->rhythmic()) {
+ i->rhythmic()->duration_.plet_.type_i_ = den_i;
+ i->rhythmic()->duration_.plet_.iso_i_ = num_i;
+
+ }
+ }
+}
+++ /dev/null
-/*
- voice-elt.cc -- implement Voice_element
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#include "proto.hh"
-#include "plist.hh"
-#include "debug.hh"
-#include "voice.hh"
-#include "voice-element.hh"
-#include "musical-request.hh"
-#include "command-request.hh"
-
-
-void
-Voice_element::transpose(Melodic_req const&d)const
-{
- for (iter_top(reqs,i); i.ok(); i++) {
- i->transpose(d);
- }
-}
-
-void
-Voice_element::print() const
-{
-#ifndef NPRINT
- mtor << "voice_element { dur :"<< duration_ <<"\n";
- for (iter_top(reqs,rc); rc.ok(); rc++) {
- rc->print();
- }
- mtor << "}\n";
-#endif
-}
-
-void
-Voice_element::add(Request*r)
-{
- if (r->duration()) {
- assert (!duration_ || duration_ == r->duration());
- duration_ = r->duration();
- }
-
- r->elt_l_ = this;
- reqs.bottom().add(r);
-}
-
-
-Voice_element::Voice_element()
-{
- voice_l_ = 0;
- duration_ = 0;
- defined_ch_C_ = 0;
-}
-
-Voice_element::Voice_element(Voice_element const&src)
-{
- defined_ch_C_ = src.defined_ch_C_;
-
- voice_l_=0;
- for (iter_top(src.reqs, i); i.ok(); i++)
- add(i->clone());
-
-}
-bool
-Voice_element::find_plet_start_b(char c, Moment& moment_r)
-{
- assert( c == ']' );
- moment_r += duration_;
- for ( PCursor<Request*> i( reqs.top() ); i.ok(); i++ ) {
- if (i->beam() && i->beam()->spantype == Span_req::START )
- return true;
- }
- return false;
-}
-
-void
-Voice_element::set_default_group(String s)
-{
- for (iter_top(reqs, i); i.ok(); i++)
- if (i->groupchange())
- return ;
- Group_change_req *greq = new Group_change_req;
- greq->newgroup_str_ = s;
- add(greq);
-}
-
-void
-Voice_element::set_plet_backwards(Moment& now_moment_r,
- Moment until_moment, int num_i, int den_i)
-{
- now_moment_r += duration_;
- if ( now_moment_r > until_moment )
- return;
- for ( PCursor<Request*> i( reqs.top() ); i.ok(); i++ ) {
- if (i->beam() && i->beam()->spantype == Span_req::START )
- i->beam()->nplet = den_i;
- if (i->rhythmic()) {
- i->rhythmic()->duration_.plet_.type_i_ = den_i;
- i->rhythmic()->duration_.plet_.iso_i_ = num_i;
-
- }
- }
-}
#include "voice-regs.hh"
#include "voice-group-regs.hh"
#include "register.hh"
-#include "text-reg.hh"
-#include "stem-beam-reg.hh"
-#include "script-reg.hh"
#include "complex-walker.hh"
#include "command-request.hh"
#include "debug.hh"
-#include "dynamic-reg.hh"
+#include "input-register.hh"
static int temp_id_count;
-Voice_group_registers::Voice_group_registers(String id)
+Voice_group_registers::Voice_group_registers(String id,
+ Input_register const *ireg_C)
{
- add(new Dynamic_register);
- add(new Text_register);
- add(new Stem_beam_register);
- add(new Script_register);
-
+ ireg_C_ =ireg_C;
+ Register_group_register::add(ireg_C->get_nongroup_p_arr());
if (id=="") // UGH
id = __FUNCTION__ + String(temp_id_count++);
group_id_str_ = id;
}
return false;
gotcha:
- if (r_l->groupfeature()) {
- set_feature(Features::dir(r_l->groupfeature()->stemdir_i_));
+ Command_req* c_l = r_l->command();
+ if (c_l&& c_l->groupfeature()) {
+ set_feature(Features::dir(c_l->groupfeature()->stemdir_i_));
return true;
}
return Register_group_register::try_request(r_l);
}
-bool
-Voice_group_registers::static_acceptable_request_b(Request*r)
-{
- return (r->stem() || r->beam() || r->text() || r->script() ||
- r->groupfeature());
-}
-
-void
-Voice_group_registers::terminate_register(Request_register*r_l)
-{
- if (r_l->name() == Voice_registers::static_name()) {
- for (int i=0; i <voice_regs_l_.size(); i++) {
- if (r_l == voice_regs_l_[i])
- voice_regs_l_.del(i);
- mtor << "Terminating voice_reg " ;
- Register_group_register::terminate_register(r_l);
- return;
- }
- }
- assert(false);
-}
IMPLEMENT_STATIC_NAME(Voice_group_registers);
void
}
Register_group_register::post_move_processing();
}
+
+Request_register *
+Voice_group_registers::get_register_p(Request_register *reg_l)
+{
+ if (reg_l->name() == Voice_registers::static_name()) {
+ for (int i=0; i <voice_regs_l_.size(); i++) {
+ if (reg_l == voice_regs_l_[i])
+ voice_regs_l_.del(i);
+ }
+ }
+ return Register_group_register::get_register_p(reg_l);
+}
#include "musical-request.hh"
#include "voice-regs.hh"
#include "register.hh"
-#include "slur-reg.hh"
-#include "headreg.hh"
-#include "walk-regs.hh"
+#include "staff-regs.hh" // needed because somebody has to delete us.
#include "debug.hh"
+#include "input-register.hh"
+#include "voice-group-regs.hh"
-Voice_registers::Voice_registers(Voice *v_p)
+Voice_registers::Voice_registers(Voice *v_p, Input_register const*ireg_C)
{
+ ireg_C_ = ireg_C;
voice_l_ = v_p;
- add(new Notehead_register);
- add(new Slur_register);
+ add(ireg_C->get_nongroup_p_arr());
}
void
daddy_reg_l_->terminate_register(this);
return true; // scary. We're deleted now..
} else if (c&&c->groupchange()) {
-
- ((Walker_registers*)daddy_reg_l_->daddy_reg_l_)-> // scary.
+ /* this is scary as well. The groupchange has to be handled by
+ the Staff_registers, which are two levels up in the hierarchy
+ */
+
+ assert(daddy_reg_l_->name() == Voice_group_registers::static_name());
+ ((Staff_registers*)daddy_reg_l_->daddy_reg_l_)-> // scary.
change_group(c->groupchange(), this,
(Voice_group_registers*)daddy_reg_l_); // UGR!
return true;
Voice_registers::acceptable_request_b(Request*r)
{
Command_req * c_l = r->command();
- return r->groupchange() || (c_l&&c_l->terminate())
+ return (c_l&&(c_l->terminate()||c_l->groupchange()))
|| Register_group_register::acceptable_request_b(r);
}
IMPLEMENT_STATIC_NAME(Voice_registers);
void
Voice::add(Voice_element*v)
{
- v->voice_l_ = this;
+ v->voice_C_ = this;
elts.bottom().add(v);
}
(c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
*/
-
#include "debug.hh"
-#include "clef-reg.hh"
-#include "local-key-reg.hh"
-#include "key-reg.hh"
-#include "meter-reg.hh"
-#include "bar-reg.hh"
-#include "bar.hh"
#include "walk-regs.hh"
+#include "staff-regs.hh"
#include "staff-elem.hh"
#include "staff.hh"
#include "complex-walker.hh"
#include "staff-column.hh"
-#include "voice-group-regs.hh"
-#include "voice-regs.hh"
-#include "command-request.hh"
#include "score-walker.hh"
+#include "bar.hh" // needed for Bar::static_name
+#include "input-register.hh"
Walker_registers::Walker_registers(Complex_walker *w)
{
walk_l_ = w;
- add( new Bar_register);
- add( new Clef_register);
- add( new Key_register);
- add( new Meter_register);
- add( new Local_key_register);
+ Input_register * ireg_l = w->staff_l_->ireg_p_;
+ if (ireg_l->name_str_ == "Staff_registers")
+ add(new Staff_registers(ireg_l));
+ else {
+ add(ireg_l->get_nongroup_p_arr());
+ }
}
void
Register_group_register::post_move_processing();
}
-void
-Walker_registers::change_group(Group_change_req * greq_l,
- Voice_registers *voice_regs_l,
- Voice_group_registers * old_group)
-{
- Voice_registers *regs_p = (old_group)
- ? (Voice_registers*) old_group->get_register_p(voice_regs_l)
- : new Voice_registers(greq_l->voice_l());
- Voice_group_registers * new_group_l = get_group(greq_l->newgroup_str_);
- new_group_l->add(regs_p);
-
- mtor << "processed change request";
- print();
-}
-
-Voice_group_registers *
-Walker_registers::get_group(String id)
-{
- for (int i=0; i < group_l_arr_.size(); i++) {
- if (group_l_arr_[i]->group_id_str_ == id)
- return group_l_arr_[i];
- }
- Voice_group_registers *group_p = new Voice_group_registers(id);
- group_l_arr_.push(group_p);
- add(group_p);
- return group_p;
-}
-
-void
-Walker_registers::terminate_register(Request_register * reg)
-{
- for (int i=0; i < group_l_arr_.size(); i++) {
- if (group_l_arr_[i] == reg) {
- group_l_arr_.del(i);
- Register_group_register::terminate_register(reg);
- return;
- }
- }
- assert(false);
-}
-
-bool
-Walker_registers::try_request(Request * r)
-{
- bool b = Register_group_register::try_request(r);
- if (!b) {
- Command_req * cr_l = r->command() ;
-
- if (cr_l && cr_l->groupchange()) {
- change_group(cr_l->groupchange(), 0, 0);
- } else
- warning("junking request: " + String(r->name()),
- r->defined_ch_C_);
- }
- return b;
-}
-
Staff_info
Walker_registers::get_staff_info() return inf;
{
if (walk_l_->score_walk_l_) // we get called ctors
inf.break_allowed_b_ = walk_l_->score_walk_l_->break_allowed_b();
- inf.c0_position_i_ = &walk_l_->c0_position_i_;
inf.walk_l_ = walk_l_;
inf.time_C_ = &walk_l_->time_;
inf.rhythmic_C_ = walk_l_->default_grouping;
+/*
+ warn.cc -- implement warning and error messages. Needs cleanup.
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
#include "proto.hh"
#include "plist.hh"
#include "debug.hh"
#include "source-file.hh"
#include "source.hh"
#include "main.hh"
+#include "input.hh"
ostream &warnout (cerr);
ostream *mlog(&cerr);
-/*
-void
-warning(String s)
-{
- WARN << s;
-}
-*/
+
void
error(String s)
void
message( String message_str, char const* context_ch_C )
{
- String str = ""; //"lilypond: ";// GNU format messages!
+ String str = "";
Source_file* sourcefile_l = source_l_g->sourcefile_l( context_ch_C );
if ( sourcefile_l ) {
str += sourcefile_l->file_line_no_str(context_ch_C) + String(": ");
lexer->errorlevel_i_ |= 1;*/
// exit( 1 );
}
+
+
+void
+warning(String m)
+{
+ warning(m, (char*)0);
+}
+
+void
+message(String m)
+{
+ error(m, (char*)0);
+}
+# project LilyPond -- the musical typesetter
+# title automatic file variables
+# file make/Files.make
+# abstract mmm, brr.
+#
+#
+# Copyright (c) 1997 by
+# Jan Nieuwenhuizen <jan@digicash.com>
+# Han-Wen Nienhuys <hanwen@stack.nl>
+
# list of c++ header files:
#
HHFILES = $(wildcard *.hh)
# list of c++ inline files:
#
-INLFILES = $(wildcard *.inl)
+INLFILES = $(wildcard *.icc)
#
# list of c++ template files:
#
-
TCCFILES = $(wildcard *.tcc)
+#
+# list plain c++ source files:
+#
+CCFILES = $(wildcard *.cc)
#
+
# list of other source files:
#
-
EXTRA_SOURCE_FILES = $(wildcard *.y *.l)
-
#
+
PODFILES = $(wildcard *.pod)
-CCFILES = $(wildcard *.cc)
MAKEFILES = $(wildcard *.make)
ALL_SOURCES=$(HHFILES) $(CCFILES) $(EXTRA_SOURCE_FILES) $(INLFILES) \
include ./$(depth)/make/Rules.make
#
-lilypond.spec: lilypond.spec.in $(depth)/.version
- sed 's/@TOPLEVEL_VERSION@/${TOPLEVEL_VERSION}/g'< $< > $@
+spec: $(outdir)/lilypond.spec
+
+rpm-docs=$(addprefix Documentation/out/, $(notdir $(shell ls $(depth)/Documentation/$(outdir)/*.text)))
+$(outdir)/lilypond.spec: lilypond.spec.in $(depth)/.version
+ cat $< | sed 's/@TOPLEVEL_VERSION@/${TOPLEVEL_VERSION}/g'|sed 's#@TEXT_DOCS@#$(rpm-docs)#g' > $@
+++ /dev/null
-# kept in dist bo stripping stable stuff, still to copy...
-
-# Sources.make
-# sourcefiles to be shipped. Also used for dependencies
-
-hdr=bar.hh barreg.hh beam.hh\
- binary-source-file.hh\
- boxes.hh break.hh clefreg.hh clefitem.hh\
- colhpos.hh commandrequest.hh \
- complexwalker.hh complexstaff.hh\
- const.hh debug.hh dimen.hh directionalspanner.hh\
- glob.hh grouping.hh headreg.hh idealspacing.hh\
- identifier.hh identparent.hh \
- inputmusic.hh inputscore.hh inputstaff.hh\
- inputfile.hh\
- item.hh key.hh keyitem.hh\
- keyreg.hh\
- keyword.hh leastsquares.hh lexer.hh linespace.hh \
- localkeyitem.hh localkeyreg.hh lookup.hh \
- lyricitem.hh lyricstaff.hh lyricwalker.hh\
- main.hh meter.hh meterreg.hh\
- mididef.hh midiitem.hh midioutput.hh midistream.hh\
- midiwalker.hh\
- misc.hh\
- molecule.hh moment.hh musicalrequest.hh\
- notehead.hh notename.hh offset.hh paperdef.hh\
- parseconstruct.hh pcol.hh proto.hh\
- pscore.hh pstaff.hh qlp.hh\
- qlpsolve.hh register.hh registergroup.hh reqtodo.hh \
- request.hh rest.hh scorecolumn.hh score.hh\
- scoreline.hh scorewalker.hh script.hh scriptdef.hh scriptreg.hh \
- slur.hh slurreg.hh source.hh sourcefile.hh\
- spanner.hh staff.hh\
- staffelem.hh staffeleminfo.hh staffline.hh staffsym.hh stembeamreg.hh\
- staffcolumn.hh stem.hh staffwalker.hh symbol.hh symtable.hh\
- tex.hh textdef.hh \
- textitem.hh textreg.hh textspanner.hh timedescription.hh \
- tstream.hh voice.hh\
- voiceregs.hh voicegroupregs.hh walkregs.hh
-
-mycc=bar.cc barreg.cc beam.cc \
- binary-source-file.cc\
- boxes.cc break.cc calcideal.cc clefreg.cc\
- clefitem.cc colhpos.cc commandrequest.cc\
- complexstaff.cc complexwalker.cc \
- debug.cc dimen.cc\
- directionalspanner.cc\
- grouping.cc groupregs.cc headreg.cc\
- idealspacing.cc identifier.cc\
- inputmusic.cc inputscore.cc\
- inputstaff.cc\
- inputfile.cc\
- item.cc key.cc keyitem.cc \
- keyreg.cc keyword.cc\
- leastsquares.cc lexerinit.cc linespace.cc \
- localkeyitem.cc localkeyreg.cc lookup.cc\
- lyricitem.cc lyricstaff.cc lyricwalker.cc\
- main.cc meter.cc meterreg.cc\
- mididef.cc midiitem.cc midioutput.cc midistream.cc\
- midiwalker.cc misc.cc molecule.cc mylexer.cc note.cc\
- notehead.cc notename.cc\
- paperdef.cc pcol.cc pscore.cc pstaff.cc qlp.cc qlpsolve.cc\
- register.cc registergroup.cc request.cc rest.cc\
- scorecolumn.cc score.cc\
- scoreline.cc scores.cc scorewalker.cc script.cc\
- scriptdef.cc scriptreg.cc slur.cc\
- slurreg.cc source.cc sourcefile.cc\
- spanner.cc staff.cc\
- staffelem.cc staffline.cc staffsym.cc\
- stembeamreg.cc staffcolumn.cc stem.cc\
- staffeleminfo.cc staffwalker.cc symbol.cc\
- symtable.cc tex.cc texbeam.cc\
- texslur.cc textdef.cc textitem.cc textreg.cc textspanner.cc\
- timedescription.cc tstream.cc voice.cc voiceelt.cc \
- voiceregs.cc voicegroupregs.cc\
- walkregs.cc warn.cc windhoos-suck-suck-suck-thank-you-cygnus.cc wordwrap.cc\
- template1.cc template2.cc template3.cc template4.cc\
- template5.cc template6.cc version.cc
-
-# a bit of a hack to keep exec size under control.
-stablecc=request.cc bar.cc boxes.cc break.cc \
- item.cc keyword.cc leastsquares.cc \
- lookup.cc molecule.cc meter.cc\
- paperdef.cc parser.cc lexer.cc pstaff.cc qlp.cc qlpsolve.cc\
- template1.cc template2.cc template3.cc template4.cc\
- template5.cc template6.cc version.cc tstream.cc tex.cc\
- voice.cc wordwrap.cc spanner.cc
-
-
-# mi2mu headers
-#
-mymi2muhh=\
- duration.hh\
- lily-stream.hh\
- midi-event.hh\
- midi-main.hh\
- midi-score.hh\
- midi-track.hh\
- my-midi-lexer.hh\
- my-midi-parser.hh\
- track-column.hh\
-
-#
-
-# mi2mu shared headers
-#
-mymi2musharedhh=\
- binary-source-file.hh\
-
-#
-
-# mi2mu source
-#
-mymi2mucc=\
- duration.cc\
- lily-stream.cc\
- midi-event.cc\
- midi-main.cc\
- midi-score.cc\
- midi-template.cc\
- midi-track.cc\
- my-midi-lexer.cc\
- my-midi-parser.cc\
- track-column.cc\
-
-#
-
-# mi2mu shared source
-#
-mymi2musharedcc=\
- binary-source-file.cc\
- inputfile.cc\
- sourcefile.cc\
- source.cc\
-
-#
-
$(EXECUTABLE): $(build) $(OFILES) $(CUSTOMLIBES)
$(INCREASE_BUILD)
$(MAKE) -S $(OFILES) $(SILENT_LOG)
-# $(STRIPDEBUG) $(STABLEOBS)
+ifdef STABLEOBS
+ $(DO_STRIP) $(STABLEOBS)
+endif
$(LD_COMMAND) $(OFILES) $(LOADLIBES)
exe: $(EXECUTABLE)
set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i clean; done
endif
-distclean: clean
- rm -rf Makefile $(lily-version) $(flower-version) $(mi2mu-version) .b $(build) *~ $(allout) $(allgen)
+distclean: localdistclean
+ifdef SUBDIRS
+ set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i localdistclean; done
+endif
+
+localdistclean:
# configure:
# doc++ documentation of classes
doc++: $(progdocs)
- doc++ -kp -d $(DOCDIR) $^
+ doc++ -k -p -d $(DOCDIR) $^
dist:
-mkdir $(distdir)
$(MAKE) ./$(outdir)/$(@F) -C $(depth)/lib
#
+# RedHat rpm package:
+#
+#rpm: dist
+# mv ./$(depth)/lilypond-$(TOPLEVEL_VERSION).tar.gz $(rpm-sources)
+rpm:
+ cp ./$(depth)/../releases/lilypond-$(TOPLEVEL_VERSION).tar.gz $(rpm-sources)
+ cp $(doc-dir)/*.gif $(rpm-sources)
+ $(MAKE) -C $(make-dir) spec
+ rpm -ba $(makeout)/lilypond.spec
+#
+
rm -f INSTALL.text
ln `find -name INSTALL.text|head -1` .
+localdistclean:
+ rm -rf Makefile $(lily-version) $(flower-version) $(mi2mu-version) .b $(build) *~ $(allout) $(allgen) config.cache config.status
+
+
+
localclean:
rm -f $(allexe) core config.cache config.log config.status
rm -f $(outdir)/*.{class,html,gif}
# turn off -pipe if linker doesn't support it
#
-USER_CXXFLAGS=-pipe -Wall -W -Wmissing-prototypes
+# USER_CXXFLAGS=-pipe -Wall -W -Wmissing-prototypes
+# added two warnings that are treated by cygwin32's gcc 2.7.2 as errors.
+# huh, but still, no warnings even provoced with linux's gcc 2.7.2.1?
+USER_CXXFLAGS=-pipe -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wconversion
#
# -lefence = ElectricFence.
# title generic variables
# file make/Variables.make
# abstract do not change this file for site-wide extensions;
-# please edit settings in User.make
+# please edit settings in User.make
#
# Copyright (c) 1997 by
# Jan Nieuwenhuizen <jan@digicash.com>
#
include ./$(depth)/make/out/Configure_variables.make
+# ugh, for win32 make
+# leave me up here, or i won-t work
+export CXX
+
ifeq (0,${MAKELEVEL})
MAKE:=$(MAKE) --no-builtin-rules
endif
lilyout = ./$(depth)/lily/$(outdir)
mi2muout = ./$(depth)/mi2mu/$(outdir)
makeout = ./$(depth)/make/$(outdir)
+doc-dir = ./$(depth)/Documentation
flower-dir = ./$(depth)/flower
lib-dir = ./$(depth)/lib
lily-dir = ./$(depth)/lily
include-lib = ./$(depth)/lib/include
include-flower = ./$(depth)/flower/include
#
+rpm-sources = /usr/src/redhat/SOURCES
+#
# user settings:
#
INCREASE_BUILD = echo `expr \`cat $(build)\` + 1` > .b; mv .b $(build)
#
-# ugh, for win32 make
-export CXX
-
# the version:
#
VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_LEVEL)$(MY_PATCH_LEVEL)
INCLUDES = -Iinclude -I$(outdir) -I$(include-lib) -I$(libout) -I$(include-flower) -I$(flowerout)
CXX_OUTPUT_OPTION = $< -o $@
LDFLAGS = $(EXTRA_LDFLAGS)
-LOADLIBES = $(EXTRA_LIBES) $(CUSTOMLIBES)
+LOADLIBES = $(EXTRA_LIBES) $(CUSTOMLIBES) -lg++ # need lg++ for win32, really!
#
# librarian:
DISTFILES=$(EXTRA_DISTFILES) Makefile $(ALL_SOURCES)
DOCDIR=$(depth)/$(outdir)
-
-progdocs=$(allhh) $(allcc)
+# .hh should be first. Don't know why
+progdocs=$(shell find -name '*.hh' |egrep -v 'obsolete/|out/') $(shell find -name '*.cc'|egrep -v 'out/|obsolete/')
pod2groff=pod2man --center="LilyPond documentation" --section="0"\
--release="LilyPond $(TOPLEVEL_MAJOR_VERSION).$(TOPLEVEL_MINOR_VERSION).$(TOPLEVEL_PATCH_LEVEL)" $< > $@
+STRIP=strip --strip-debug
+ifdef stablecc
+ STABLEOBS=$(addprefix $(outdir)/,$(stablecc:.cc=.o))
+endif
+stablecc=
+DO_STRIP=true
+
%description
LilyPond is a program which converts a music-script (mudela) into
-TeX output, or MIDI to produce multi-staff scores. Feature include multiple
+TeX output, or MIDI to produce multi-staff scores. Features include multiple
meters, clefs, keys, lyrics, versatile input-language, cadenzas
-beams, slurs, triplets
+beams, slurs, triplets.
%prep
%setup
make install
strip /usr/bin/lilypond /usr/bin/mi2mu
%files
-%doc Documentation/out/index.text Documentation/out/CodingStyle.text
-%doc Documentation/out/lilygut.text Documentation/out/lilyinput.text
-%doc Documentation/out/error.text Documentation/out/faq.text
-%doc Documentation/out/INSTALL.text
-%doc Documentation/out/language.text Documentation/lelie_logo.gif
+%doc @TEXT_DOCS@ Documentation/lelie_logo.gif
/usr/bin/lilypond
/usr/bin/mi2mu
/usr/man/man1/lilypond.1
+/usr/man/man5/mudela.5
/usr/lib/texmf/texmf/tex/lilypond/
/usr/share/lilypond/
tor( NORMAL_ver ) << '[' << flush;
if ( bars_i > bar_i ) {
- Moment into_bar_mom = now_mom - ( bars_i - 1 ) * bar_mom;
+ Moment into_bar_mom = now_mom - Moment( bars_i - 1 ) * bar_mom;
if ( bars_i > 1 ) {
if ( !into_bar_mom )
lily_stream_r << "|";
\font\hslurdfont=xslhd20
\font\hslurhfont=xslhz20
\font\musicfnt=musix20
+ \font\musicdraw=musixsps
\font\italicfont=cmti10
\font\dynfont=cmbxti10 scaled \magstep1
\balkhoog=20pt
\font\hslurhfont=xslhz20
\font\musicfnt=musix16
\font\dynfont=cmbxti10
+ \font\musicdraw=musixsps
\balkhoog=16pt
\staffrulethickness=0.4pt
\notewidth=5pt
\def\beamslope#1#2{{\count0=#2\advance\count0 by#1\musicfnt\char\count0}}
\def\rulesym#1#2{\vrule height #1 width #2}
-\def\crescendosym#1{\count0=84\advance\count0 by #1}
-\def\decrescendosym#1{\count0=116\advance\count0 by #1}
+\def\crescendosym#1{\count0=84\advance\count0 by #1\musicdraw\char\count0}
+\def\decrescendosym#1{\count0=116\advance\count0 by #1\musicdraw\char\count0}
\def\settext#1{\textfont #1}
\def\setitalic#1{\italicfont #1}
\def\setdynamic#1{\dynfont #1}