From: Han-Wen Nienhuys Date: Wed, 2 Apr 1997 14:59:40 +0000 (+0200) Subject: release: 0.0.46.jcn1 X-Git-Tag: release/0.0.46.jcn1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=3f374e66968308461daa390a7aeed0b013bfe33d;p=lilypond.git release: 0.0.46.jcn1 --- diff --git a/.dstreamrc b/.dstreamrc index 5a6d7a577f..c992908ec4 100644 --- a/.dstreamrc +++ b/.dstreamrc @@ -1,6 +1,7 @@ # class name silence? Dstream 1 +File_path 1 My_lily_lexer 1 PCol 1 Score_column 1 @@ -42,7 +43,7 @@ Time_description 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 diff --git a/.version b/.version index da73d6405e..0aa685e95d 100644 --- a/.version +++ b/.version @@ -1,7 +1,7 @@ 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 diff --git a/ANNOUNCE b/ANNOUNCE index afcf2ffd5d..f011b485f3 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,15 +1,27 @@ -[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 @@ -20,100 +32,46 @@ output medium. (this is handy because there exist music fonts for TeX) 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 + Jan Nieuwenhuizen diff --git a/Documentation/CodingStyle.pod b/Documentation/CodingStyle.pod index 2f65fb775e..4661560af1 100644 --- a/Documentation/CodingStyle.pod +++ b/Documentation/CodingStyle.pod @@ -33,6 +33,21 @@ this is to rewrite the program. -- 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: @@ -58,7 +73,7 @@ in emacs: Class::member() Type Class::member_type_ -the C is a Hungarian notation postfix for $C$. See below +the C is a Hungarian notation postfix for C. See below =head2 COMMENTS @@ -176,7 +191,7 @@ existed. I feel so stupid and ashamed! =head2 Disadvantages -=over 5 +=over 4 =item * @@ -216,7 +231,7 @@ remains an issue. =head2 Proposal -=over 5 +=over 4 =item * @@ -241,7 +256,7 @@ with the parts of the names separated by underscores. =head2 Types -=over 5 +=over 4 =item C @@ -297,7 +312,7 @@ unsigned integer The following types modify the meaning of the prefix. These are precede the prefixes: -=over 5 +=over 4 =item C @@ -331,7 +346,7 @@ reference =back -=over 5 +=over 4 =item C @@ -362,6 +377,3 @@ Variable foo: an C that you must delete Variable bar: an C that you must not delete =back - - - diff --git a/Documentation/error.pod b/Documentation/error.pod index e6ae1a689c..371b73bd99 100644 --- a/Documentation/error.pod +++ b/Documentation/error.pod @@ -10,4 +10,8 @@ A correctly parsed F does not guarantuee output. A lot (most) of the checking is done B 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..] diff --git a/Documentation/examples.pod b/Documentation/examples.pod new file mode 100644 index 0000000000..cd76ca11b4 --- /dev/null +++ b/Documentation/examples.pod @@ -0,0 +1,99 @@ +=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 + +A cadenza to Mozart Horn concerto no. 3. + +Features: cadenza mode. + +Copyright: public domain + +=head2 F + +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 messages, context errors. + +=head2 F + + +=head2 F + +Ah, vous dirais-je, maman" (Mozart, KV 265), bare +bones version. + +Features: example with lots of newbie comment. + +=head2 F + +Features: partial measure. + +=head2 F, F + +Martien Lohman, Viola Quartet. + +Features: n-plets, multi-staff scores. + +Copyright: copyright Martien Lohman 1997. + +=head2 F + +Features: midi output. + +=head2 F + +Features: plets. + +=head2 F + +Features: auto beams, multiple parralel meters. + +=head2 F + +Features: plets, accents, beam steepnesses. + +=head2 F + +J. S. Bach, Solo Cello Suites. Suite II part v Menuetto I + +Features: breaking algorithm, chords, multivoice, accents + +=head2 F + +St\"andchen (Serenade) "Leise flehen meine +Lieder" D.957 No.4 Franz Schubert (1797-1828) + +Features: multivoice, accents, lyrics, chords, piano music + +=head2 F + +Features: lyrics + +=head2 F + +JS Bach, Das Wohltemperirtes Clavier I, Fuga II (c-minor) + +a 7 bar fragment. + +Features: stem direction, multivoice. + +Copyright: public domain diff --git a/Documentation/faq.pod b/Documentation/faq.pod index d63883106d..6fc58b2f26 100644 --- a/Documentation/faq.pod +++ b/Documentation/faq.pod @@ -15,13 +15,13 @@ to make a few chords, but why do I have to type < { a() e } { c () g } > -in stead of +instead of <)e )g> -to generate slurs between the chords? +to generate slurs between the chords? -A: When you type +A L1: When you type @@ -40,57 +40,42 @@ formatting: > -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. (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 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 of trouble. LilyPond & FlowerLib uses: +saves us a I of trouble. LilyPond and FlowerLib use: -=over 6 +=over 4 =item * builtin bool @@ -115,3 +100,55 @@ named return values =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. (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 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 + +[...] + +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. + diff --git a/Documentation/index.pod b/Documentation/index.pod index d1e05d00e7..d6588acde2 100644 --- a/Documentation/index.pod +++ b/Documentation/index.pod @@ -2,14 +2,34 @@ 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 * + +The installation instructions. + + + + + =item * @@ -46,7 +66,7 @@ errors > =item * - The lilypond logo (Big) -The lilypond logo (in gif format) +The lilypond logo (in gif format, medium size) +=item * + +examples: MIDI, PS, GIF and input. + =item * - -An example inputfile: from Bach's WTK: c-minor fugue +info on examples =item * - -A Gif file of the example +The TODO list. =item * - -PS output +The Change log =item * - -MIDI output +The coding standards of the lilypond project. @@ -100,9 +126,18 @@ The DOC++ documentation of the C++ sources. 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 , for this page + + +Stats on this page. + diff --git a/Documentation/lilygut.pod b/Documentation/lilygut.pod index 93a89b9eb7..da7ebcea59 100644 --- a/Documentation/lilygut.pod +++ b/Documentation/lilygut.pod @@ -16,7 +16,7 @@ You should use doc++ to take a peek at the sources. LilyPond is a "5-pass" system: -=over 5 +=over 4 =item 1. Parsing: @@ -45,9 +45,6 @@ are determined. Very simple, just walk all Line_of_* and follow the links over there -=back - - =back =head1 Request_register diff --git a/Documentation/lilyinput-pre-0.1.pod b/Documentation/lilyinput-pre-0.1.pod deleted file mode 100644 index 1e04b19df0..0000000000 --- a/Documentation/lilyinput-pre-0.1.pod +++ /dev/null @@ -1,150 +0,0 @@ -=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 { } - -Some types allow declarations: - - IDENTIFIER = BLOCKNAME { - - } - - .. - - 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 { } - -Some types allow declarations: - - IDENTIFIER = BLOCKNAME { - - } - - .. - - 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). diff --git a/Documentation/lilypond.pod b/Documentation/lilypond.pod index f4dd08b08c..da1d68bf3f 100644 --- a/Documentation/lilypond.pod +++ b/Documentation/lilypond.pod @@ -90,6 +90,7 @@ multiple stafftypes (melodic, rhythmic) [broken from pl28 on] beams, slurs, chords, super/subscripts (accents and text), triplets, general n-plet (triplet, quadruplets, etc.), lyrics, transposition +dynamics (both absolute and hairpin style) =item * @@ -208,7 +209,8 @@ quality. If you're not discouraged; this is what I type in my xterm: 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] @@ -265,10 +267,18 @@ includes files from the directory F. =back +=head1 ENVIRONMENT + +B an (one) additional directory for finding lilypond data. + =head1 SEE ALSO +mudela(5) + There are some documentation files in the subdirectory F, -among others: lilygut, lilyinput, error, faq, +among others: lilygut, error, faq, + +http://www.stack.nl/~hanwen/lilypond/index.html =head1 REMARKS diff --git a/INSTALL.text b/INSTALL.text index 66e6a45bce..72bd01f9a1 100644 --- a/INSTALL.text +++ b/INSTALL.text @@ -61,7 +61,7 @@ CCCCOOOONNNNFFFFIIIIGGGGUUUURRRRIIIINNNNGGGG a -25/Mar/97 LilyPond 0.0.45 1 +25/Mar/97 LilyPond 0.0.46 1 @@ -127,7 +127,7 @@ RRRRUUUUNNNNNNNNIIIINNNNGGGG -25/Mar/97 LilyPond 0.0.45 2 +25/Mar/97 LilyPond 0.0.46 2 @@ -193,6 +193,6 @@ AAAAUUUUTTTTHHHHOOOORRRRSSSS -25/Mar/97 LilyPond 0.0.45 3 +25/Mar/97 LilyPond 0.0.46 3 diff --git a/NEWS b/NEWS index ea2ae1e6df..239dd52b9a 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,34 @@ +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 @@ -113,6 +144,7 @@ pl 41.hwn1 pl 41.jn1 Bugfix - doze compile +******* pl 41 - release pl 40.3 @@ -123,7 +155,6 @@ 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. @@ -147,6 +178,7 @@ Bugfix ****** +Mar 11 pl 40 - release @@ -285,6 +317,7 @@ Examples - fixed midi.ly ******* +Feb 25 pl 35 - Register_group Bugfix @@ -394,6 +427,7 @@ Examples Bugfix - calcideal assertion bugfix ******* +Feb 12 13:55 pl 30 Features @@ -471,6 +505,7 @@ Internal: - Voice_group_registers, Voice_registers, *_register - Complex_staff ******* + Jan 27 '97 pl 25 - other clefs added, keys typeset properly (MB) @@ -519,7 +554,8 @@ Internal changes: - dependencies for Staff_elem's ******* -pl 20: +Dec 23 +pl 20: - updated doco to .pod - include files from .ly Internal changes: @@ -560,6 +596,7 @@ pl 14 - Input_{score/staff} ******* +Dec 2 pl 13 - Horizontal/Vertical music - Input_commands diff --git a/TODO b/TODO index 95fbfc6845..522f9cafbe 100644 --- a/TODO +++ b/TODO @@ -1,11 +1,10 @@ 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 @@ -22,8 +21,6 @@ MAKE-STUFF * flower config: separate optiflags. - * sort out headers, see m2m - * do platform stuff: configure, header(s), targets, build (out?) BUGS @@ -42,8 +39,6 @@ BUGS SEVERELY LACKING: - * hairpins - * grace notes FURTHER FOR ORCHESTRAL SCORE: @@ -56,7 +51,7 @@ FURTHER FOR ORCHESTRAL SCORE: INPUTLANGUAGE - * read ENV for include /init path + * unix style paths for LILYINCLUDE ENV * configure pitch_byte @@ -68,11 +63,20 @@ INPUTLANGUAGE * 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. @@ -118,7 +122,6 @@ SMALLISH PROJECTS * caching of Register_group_register hierarchies. - * use (char *) iso. String for communication between lexer and parser. @@ -156,6 +159,8 @@ FUTURE * guitar chord + * Junk Staff_column, and find the requests while walking the Voices.? + * better beamslope calculation: QLP for beams? * implement better breaking algorithm diff --git a/bin/make_website b/bin/make_website index 5b360b94fb..e728bf9d27 100755 --- a/bin/make_website +++ b/bin/make_website @@ -1,4 +1,6 @@ #!/usr/bin/perl -w +# stuff should be generated in out directory. + sub set_hrefs { @@ -22,25 +24,93 @@ sub all_refs } 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 "LilyPond examples\n"; + foreach $a (@examples) { + $name=$a; + print HTMLLIST "

example file: $name

\n\n"; + $cmd= "head ../input/$a.ly | grep \^% \| sed \"s/^%/ /\""; + $desc = `$cmd`; + print HTMLLIST "$desc\n"; -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 ""; + } +} +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; diff --git a/configure b/configure index ad504fd23d..51d256534b 100755 --- a/configure +++ b/configure @@ -895,12 +895,13 @@ else + 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 @@ -934,7 +935,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure: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 @@ -968,7 +969,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure: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 @@ -1002,7 +1003,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure: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 @@ -1038,7 +1039,7 @@ if test $TEXPREFIX = auto ; then # 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 @@ -1101,7 +1102,7 @@ else 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 @@ -1114,12 +1115,12 @@ ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $L cross_compiling=$ac_cv_prog_cxx_cross CXXCPP="${CXX-g++} -E" cat > conftest.$ac_ext < EOF 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 : @@ -1139,17 +1140,17 @@ echo "$ac_t""$CXXCPP" 1>&6 ac_safe=`echo "FlexLexer.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for FlexLexer.h""... $ac_c" 1>&6 -echo "configure: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 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* @@ -1551,7 +1552,7 @@ fi 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 diff --git a/configure.in b/configure.in index f3837945ae..5d74dab46e 100644 --- a/configure.in +++ b/configure.in @@ -105,6 +105,7 @@ if test FIND = error; then AC_MSG_WARN(Couldn't find \`find'. Please use --enable-texprefix) else +AC_SUBST(CXX) AC_SUBST(DEFINES) AC_SUBST(COMPILEINFO) AC_SUBST(AUTOHEADER) diff --git a/flower/.version b/flower/.version index ea70f79da1..ddcbb111b9 100644 --- a/flower/.version +++ b/flower/.version @@ -1,6 +1,6 @@ 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" # diff --git a/flower/Makefile b/flower/Makefile index 3e04a98362..7de4c58459 100644 --- a/flower/Makefile +++ b/flower/Makefile @@ -55,3 +55,6 @@ localdist: configure -include /dev/null $(DEPFILES) # + +localdistclean: + rm -f config.cache config.status diff --git a/flower/NEWS b/flower/NEWS index 5a62d17bd0..629d06e5dd 100644 --- a/flower/NEWS +++ b/flower/NEWS @@ -1,6 +1,11 @@ +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 diff --git a/flower/full-storage.cc b/flower/full-storage.cc new file mode 100644 index 0000000000..e9fb1f3ca5 --- /dev/null +++ b/flower/full-storage.cc @@ -0,0 +1,215 @@ +/* + full-storage.cc -- implement Full_storage + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys +*/ + +#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_ && 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 k ; i--) + for (int j=0; j +Full_storage::row(int n) const +{ + Array r; + for (int j = 0; j < width_i_; j++) + r.push(els_p_p_[n][j]); + return r; +} + +Array +Full_storage::column(int n) const +{ + + Array r; + for (int i = 0; iname() != 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); diff --git a/flower/include/class-name.hh b/flower/include/class-name.hh new file mode 100644 index 0000000000..14ebf4c927 --- /dev/null +++ b/flower/include/class-name.hh @@ -0,0 +1,25 @@ +/* + class-name.hh -- declare + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#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 diff --git a/flower/include/cursor.hh b/flower/include/cursor.hh index af2e251a08..168ee50393 100644 --- a/flower/include/cursor.hh +++ b/flower/include/cursor.hh @@ -107,7 +107,7 @@ template_instantiate_compare(Cursor, Cursor::compare, template); #include "pcursor.hh" #include "list.hh" -#include "cursor.inl" +#include "cursor.icc" #include "iterate.hh" #endif // CURSOR_HH diff --git a/flower/include/cursor.icc b/flower/include/cursor.icc new file mode 100644 index 0000000000..e103c88e43 --- /dev/null +++ b/flower/include/cursor.icc @@ -0,0 +1,113 @@ + // cursor.icc -*-c++-*- +#ifndef CURSOR_INL +#define CURSOR_INL +#include + + +template +inline +Cursor::Cursor( const List& list, Link* pointer ) : + list_((List&) list ) +{ + if ( list.size() ) + pointer_ = pointer ? pointer : list.top_; + else + pointer_ = pointer; +} + +template +inline +Cursor::Cursor( const Cursor& cursor ) : + list_( cursor.list_ ) +{ + pointer_ = cursor.pointer_; +} + +template +inline T& +Cursor::thing() +{ + assert( pointer_ ); + return pointer_->thing(); +} + +template +Cursor +Cursor::operator =( const Cursor& c ) +{ + assert( &list_ == &c.list_ ); + pointer_ = c.pointer_; + return *this; +} + +template +inline void +Cursor::add( const T& th ) +{ + list_.add( th, *this ); +} + +template +inline void +Cursor::insert( const T& th ) +{ + list_.insert( th, *this ); +} + +template +inline List& +Cursor::list() const +{ + return list_; +} + +template +inline Link* +Cursor::pointer() +{ + return pointer_; +} + +template +inline bool +Cursor::backward() +{ + return ( pointer_ != 0 ); +} + +template +inline bool +Cursor::forward() +{ + return ( pointer_ != 0 ); +} + +template +inline bool +Cursor::ok() +{ + return ( pointer_ != 0 ); +} + + +template +inline Cursor +Cursor::operator ++( int ) +{ + Cursor r (*this); + assert( pointer_ ); + pointer_ = pointer_->next(); + return r; +} + +template +inline Cursor +Cursor::operator --( int ) +{ + Cursor r (*this); + assert( pointer_ ); + pointer_ = pointer_->previous(); + return r; +} + +#endif diff --git a/flower/include/cursor.inl b/flower/include/cursor.inl deleted file mode 100644 index 54d3703e60..0000000000 --- a/flower/include/cursor.inl +++ /dev/null @@ -1,113 +0,0 @@ - // cursor.inl -*-c++-*- -#ifndef CURSOR_INL -#define CURSOR_INL -#include - - -template -inline -Cursor::Cursor( const List& list, Link* pointer ) : - list_((List&) list ) -{ - if ( list.size() ) - pointer_ = pointer ? pointer : list.top_; - else - pointer_ = pointer; -} - -template -inline -Cursor::Cursor( const Cursor& cursor ) : - list_( cursor.list_ ) -{ - pointer_ = cursor.pointer_; -} - -template -inline T& -Cursor::thing() -{ - assert( pointer_ ); - return pointer_->thing(); -} - -template -Cursor -Cursor::operator =( const Cursor& c ) -{ - assert( &list_ == &c.list_ ); - pointer_ = c.pointer_; - return *this; -} - -template -inline void -Cursor::add( const T& th ) -{ - list_.add( th, *this ); -} - -template -inline void -Cursor::insert( const T& th ) -{ - list_.insert( th, *this ); -} - -template -inline List& -Cursor::list() const -{ - return list_; -} - -template -inline Link* -Cursor::pointer() -{ - return pointer_; -} - -template -inline bool -Cursor::backward() -{ - return ( pointer_ != 0 ); -} - -template -inline bool -Cursor::forward() -{ - return ( pointer_ != 0 ); -} - -template -inline bool -Cursor::ok() -{ - return ( pointer_ != 0 ); -} - - -template -inline Cursor -Cursor::operator ++( int ) -{ - Cursor r (*this); - assert( pointer_ ); - pointer_ = pointer_->next(); - return r; -} - -template -inline Cursor -Cursor::operator --( int ) -{ - Cursor r (*this); - assert( pointer_ ); - pointer_ = pointer_->previous(); - return r; -} - -#endif diff --git a/flower/include/fproto.hh b/flower/include/fproto.hh index c2fc98399c..030157cbe4 100644 --- a/flower/include/fproto.hh +++ b/flower/include/fproto.hh @@ -43,7 +43,7 @@ struct String_data; struct String_handle; struct String_convert; struct String; -struct virtual_smat; +struct Matrix_storage; struct Vector ; struct Text_stream; struct Data_file; diff --git a/flower/include/full-storage.hh b/flower/include/full-storage.hh new file mode 100644 index 0000000000..e409415645 --- /dev/null +++ b/flower/include/full-storage.hh @@ -0,0 +1,106 @@ +/* + full-storage.hh -- declare Full_storage + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys +*/ + + +#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 row(int i) const; + virtual Array 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 diff --git a/flower/include/interval.hh b/flower/include/interval.hh index aae16381db..57f6a5607a 100644 --- a/flower/include/interval.hh +++ b/flower/include/interval.hh @@ -55,7 +55,7 @@ struct Interval_t { T length() const; void set_empty() ; - bool empty() const { return left > right; } + bool empty_b() const { return left > right; } Interval_t() { set_empty(); } @@ -69,7 +69,7 @@ struct Interval_t { return *this; } String str() const; - bool elt_q(T r); + bool elt_b(T r); }; diff --git a/flower/include/interval.tcc b/flower/include/interval.tcc index 6e7b0b1279..32eec44580 100644 --- a/flower/include/interval.tcc +++ b/flower/include/interval.tcc @@ -91,7 +91,7 @@ template String Interval_t::str() const { - if (empty()) + if (empty_b()) return "[empty]"; String s("["); @@ -100,7 +100,7 @@ Interval_t::str() const template bool -Interval_t::elt_q(T r) +Interval_t::elt_b(T r) { return r >= left && r <= right; } diff --git a/flower/include/link.hh b/flower/include/link.hh index 22fcec4e71..218a0f8e55 100644 --- a/flower/include/link.hh +++ b/flower/include/link.hh @@ -33,6 +33,6 @@ private: Link* next_; }; -#include "link.inl" +#include "link.icc" #endif // __LINK_HH // diff --git a/flower/include/link.icc b/flower/include/link.icc new file mode 100644 index 0000000000..3926d6bc2a --- /dev/null +++ b/flower/include/link.icc @@ -0,0 +1,102 @@ +// link.inl -*-c++-*- +#ifndef LINK_INL +#define LINK_INL +#include +template +inline +void +Link::OK() const +{ +#ifndef NDEBUG + if (previous_) { + assert(previous_->next_ == this); + } + if (next_) { + assert(next_->previous_ == this); + } +#endif +} + +template +inline +Link::Link( const T& thing ) : + thing_( thing ) +{ + previous_ = next_ = 0; +} + +template +inline +Link::Link( Link* previous, Link* next, const T& thing ) : + thing_( thing ) +{ + previous_ = previous; + next_ = next; +} + +template +inline +Link* +Link::next() +{ + return next_; +} + +template +inline +Link* +Link::previous() +{ + return previous_; +} + +template +inline +void +Link::add( const T& thing ) +{ + + Link* l = new Link( this, next_, thing ); + if ( next_ ) + next_->previous_ = l; + next_ = l; +} + +template +inline void +Link::insert( const T& thing ) +{ + // Link* l = new Link( next_, this, thing ); + // bugfix hwn 16/9/96 + Link* l = new Link( previous_, this, thing ); + if ( previous_ ) + previous_->next_ = l; + previous_ = l; +} + +/* + don't forget to adjust #l#'s top_ and bottom_. + */ +template +inline void +Link::remove(List &l) +{ + if ( previous_ ) + previous_->next_ = next_; + else + l.top_ = next_; + + if ( next_ ) + next_->previous_ = previous_; + else + l.bottom_ = previous_; +} + +template +inline +T& +Link::thing() +{ + return thing_; +} +#endif diff --git a/flower/include/link.inl b/flower/include/link.inl deleted file mode 100644 index 3926d6bc2a..0000000000 --- a/flower/include/link.inl +++ /dev/null @@ -1,102 +0,0 @@ -// link.inl -*-c++-*- -#ifndef LINK_INL -#define LINK_INL -#include -template -inline -void -Link::OK() const -{ -#ifndef NDEBUG - if (previous_) { - assert(previous_->next_ == this); - } - if (next_) { - assert(next_->previous_ == this); - } -#endif -} - -template -inline -Link::Link( const T& thing ) : - thing_( thing ) -{ - previous_ = next_ = 0; -} - -template -inline -Link::Link( Link* previous, Link* next, const T& thing ) : - thing_( thing ) -{ - previous_ = previous; - next_ = next; -} - -template -inline -Link* -Link::next() -{ - return next_; -} - -template -inline -Link* -Link::previous() -{ - return previous_; -} - -template -inline -void -Link::add( const T& thing ) -{ - - Link* l = new Link( this, next_, thing ); - if ( next_ ) - next_->previous_ = l; - next_ = l; -} - -template -inline void -Link::insert( const T& thing ) -{ - // Link* l = new Link( next_, this, thing ); - // bugfix hwn 16/9/96 - Link* l = new Link( previous_, this, thing ); - if ( previous_ ) - previous_->next_ = l; - previous_ = l; -} - -/* - don't forget to adjust #l#'s top_ and bottom_. - */ -template -inline void -Link::remove(List &l) -{ - if ( previous_ ) - previous_->next_ = next_; - else - l.top_ = next_; - - if ( next_ ) - next_->previous_ = previous_; - else - l.bottom_ = previous_; -} - -template -inline -T& -Link::thing() -{ - return thing_; -} -#endif diff --git a/flower/include/list.hh b/flower/include/list.hh index fbb79e6edf..1cfa9f54ed 100644 --- a/flower/include/list.hh +++ b/flower/include/list.hh @@ -83,7 +83,7 @@ class List Link* bottom_; }; -#include "list.inl" +#include "list.icc" #include "cursor.hh" // instantiate a template: explicit instantiation. diff --git a/flower/include/list.icc b/flower/include/list.icc new file mode 100644 index 0000000000..df0687b7c8 --- /dev/null +++ b/flower/include/list.icc @@ -0,0 +1,56 @@ +// -*-c++-*- + +#ifndef LIST_INL +#define LIST_INL + +template +inline +List::List() +{ + set_empty(); +} + +template +inline void +List::set_empty() +{ + top_ = bottom_ = 0; + size_ = 0; +} + +template +inline void +List::remove( Cursor me ) +{ + if ( me.ok() ){ + Link *lp = me.pointer(); + lp->remove(*this); + delete lp; + size_--; + } +} + +template +inline int +List::size() const +{ + return size_; +} + +template +inline Cursor +List::top()const +{ + return Cursor( *this, top_ ); +} + + +template +inline Cursor +List::bottom()const +{ + return Cursor( *this, bottom_ ); +} + + +#endif diff --git a/flower/include/list.inl b/flower/include/list.inl deleted file mode 100644 index df0687b7c8..0000000000 --- a/flower/include/list.inl +++ /dev/null @@ -1,56 +0,0 @@ -// -*-c++-*- - -#ifndef LIST_INL -#define LIST_INL - -template -inline -List::List() -{ - set_empty(); -} - -template -inline void -List::set_empty() -{ - top_ = bottom_ = 0; - size_ = 0; -} - -template -inline void -List::remove( Cursor me ) -{ - if ( me.ok() ){ - Link *lp = me.pointer(); - lp->remove(*this); - delete lp; - size_--; - } -} - -template -inline int -List::size() const -{ - return size_; -} - -template -inline Cursor -List::top()const -{ - return Cursor( *this, top_ ); -} - - -template -inline Cursor -List::bottom()const -{ - return Cursor( *this, bottom_ ); -} - - -#endif diff --git a/flower/include/matrix-storage.hh b/flower/include/matrix-storage.hh new file mode 100644 index 0000000000..8e34d604f4 --- /dev/null +++ b/flower/include/matrix-storage.hh @@ -0,0 +1,168 @@ +/* + matrix-storage.hh -- declare Matrix_storage + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys +*/ + + +#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 row(int i) const = 0; + virtual Array 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; iOK(); } diff --git a/flower/include/plist.hh b/flower/include/plist.hh index f9af4c693b..1fc4d941ab 100644 --- a/flower/include/plist.hh +++ b/flower/include/plist.hh @@ -67,6 +67,6 @@ void PL_copy(IPointerList &dst,IPointerList const&src); #define IPL_instantiate(a) PL_instantiate(a); \ template class IPointerList -#include "plist.inl" +#include "plist.icc" #endif diff --git a/flower/include/smat.hh b/flower/include/smat.hh deleted file mode 100644 index 05bdac464b..0000000000 --- a/flower/include/smat.hh +++ /dev/null @@ -1,93 +0,0 @@ -#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 row(int i) const; - virtual Array 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 diff --git a/flower/include/string-data.icc b/flower/include/string-data.icc new file mode 100644 index 0000000000..5a3bb390ef --- /dev/null +++ b/flower/include/string-data.icc @@ -0,0 +1,210 @@ +/* -*-C++-*- + String_data.inl -- implement String_data + + source file of Flower lib + + (c) 1997 Han-Wen Nienhuys +*/ + +#ifndef STRINGDATA_INL +#define STRINGDATA_INL + +#include +#include + +#include "string-data.hh" +const int INITIALMAX=8; + +#include + +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 = 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 // diff --git a/flower/include/string-data.inl b/flower/include/string-data.inl deleted file mode 100644 index 5a3bb390ef..0000000000 --- a/flower/include/string-data.inl +++ /dev/null @@ -1,210 +0,0 @@ -/* -*-C++-*- - String_data.inl -- implement String_data - - source file of Flower lib - - (c) 1997 Han-Wen Nienhuys -*/ - -#ifndef STRINGDATA_INL -#define STRINGDATA_INL - -#include -#include - -#include "string-data.hh" -const int INITIALMAX=8; - -#include - -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 = 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 // diff --git a/flower/include/string-handle.hh b/flower/include/string-handle.hh index 3f42e860e6..88954cb168 100644 --- a/flower/include/string-handle.hh +++ b/flower/include/string-handle.hh @@ -60,9 +60,9 @@ public: #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 diff --git a/flower/include/string-handle.icc b/flower/include/string-handle.icc new file mode 100644 index 0000000000..63b2ab379d --- /dev/null +++ b/flower/include/string-handle.icc @@ -0,0 +1,156 @@ +/* -*-c++-*- + + stringhandle.inl -- implement String_handle + + source file of Flower lib + + (c) 1997 Han-Wen Nienhuys +*/ + +#ifndef STRINGHANDLE_INL +#define STRINGHANDLE_INL + +#include +#include + +#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 diff --git a/flower/include/string-handle.inl b/flower/include/string-handle.inl deleted file mode 100644 index 63b2ab379d..0000000000 --- a/flower/include/string-handle.inl +++ /dev/null @@ -1,156 +0,0 @@ -/* -*-c++-*- - - stringhandle.inl -- implement String_handle - - source file of Flower lib - - (c) 1997 Han-Wen Nienhuys -*/ - -#ifndef STRINGHANDLE_INL -#define STRINGHANDLE_INL - -#include -#include - -#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 diff --git a/flower/include/vsmat.hh b/flower/include/vsmat.hh deleted file mode 100644 index b9dcdadecb..0000000000 --- a/flower/include/vsmat.hh +++ /dev/null @@ -1,141 +0,0 @@ -#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 row(int i) const = 0; - virtual Array 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; imult_ok(i,j); dat->mult_next(i,j)) dat->elem(i,j)=v(i)*w(j); } @@ -188,7 +188,9 @@ Matrix::set_product(Matrix const &m1, Matrix const &m2) { 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; diff --git a/flower/smat.cc b/flower/smat.cc deleted file mode 100644 index dcc61ce44e..0000000000 --- a/flower/smat.cc +++ /dev/null @@ -1,181 +0,0 @@ -#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 && 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 k ; i--) - for (int j=0; j -Full_storage::row(int n) const -{ - Array r; - for (int j = 0; j < w; j++) - r.push(els[n][j]); - return r; -} - -Array -Full_storage::column(int n) const -{ - - Array r; - for (int i = 0; i portability? #endif str = String( fill_ch, length_i - str.length_i() ) + str; diff --git a/flower/stringutil.cc b/flower/stringutil.cc index 43c8e15d82..d73e4f14d3 100644 --- a/flower/stringutil.cc +++ b/flower/stringutil.cc @@ -29,5 +29,5 @@ mymemmove( void* dest, void const* src, size_t n ) #include "string-handle.hh" #include "string-data.hh" -#include "string-data.inl" -#include "string-handle.inl" +#include "string-data.icc" +#include "string-handle.icc" diff --git a/init/dynamic.ini b/init/dynamic.ini index c8d5985f7e..e1cf6e6c23 100644 --- a/init/dynamic.ini +++ b/init/dynamic.ini @@ -1,10 +1,17 @@ +% +% 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) diff --git a/init/register.ini b/init/register.ini new file mode 100644 index 0000000000..b8447d2dc4 --- /dev/null +++ b/init/register.ini @@ -0,0 +1,29 @@ +% + +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 } + +} diff --git a/init/symbol.ini b/init/symbol.ini index 7ed0e0c99a..2ae2fcc064 100644 --- a/init/symbol.ini +++ b/init/symbol.ini @@ -1,4 +1,4 @@ - +include "register.ini" include "dynamic.ini" include "dutch.ini" % do not include init/ path include "script.ini" diff --git a/init/table_sixteen.ini b/init/table_sixteen.ini index 5d9e6842ad..1767806825 100644 --- a/init/table_sixteen.ini +++ b/init/table_sixteen.ini @@ -114,8 +114,8 @@ table_sixteen= "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 { diff --git a/input/cadenza.ly b/input/cadenza.ly index 0acc9d037a..c631aaa5d9 100644 --- a/input/cadenza.ly +++ b/input/cadenza.ly @@ -6,7 +6,7 @@ cad = \melodic{ \cadenza {1} - \grouping{1*4}\duration { 8} + \grouping{1*4}\duration { 8}\octave{c} \textstyle "italic" \clef \violin c'4.mf g8 @@ -16,7 +16,7 @@ cad = \melodic{ [b()c'] g-\fermata \bar \empty c [c_"rubato" e g c'] - \octave{'} + \octave{c'} e4. e [g ()f_"rit" e d] \duration{16} @@ -34,20 +34,23 @@ cad = \melodic{ \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 } } diff --git a/input/coriolan-alto.ly b/input/coriolan-alto.ly index 55f2bbb575..2a59761f00 100644 --- a/input/coriolan-alto.ly +++ b/input/coriolan-alto.ly @@ -3,27 +3,27 @@ % 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 % -% 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.( | @@ -31,10 +31,13 @@ alto = \melodic{ [ ) 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. \ \ - \ \ \ \ - \ \ \ \ - \ \ \ \ @@ -48,30 +51,26 @@ alto = \melodic{ [ ) 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 diff --git a/input/kortjakje.ly b/input/kortjakje.ly index 9bc116a99c..a7637f4d4a 100644 --- a/input/kortjakje.ly +++ b/input/kortjakje.ly @@ -1,9 +1,9 @@ % "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 % @@ -36,13 +36,13 @@ melodie = \melodic{ 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 @@ -50,8 +50,8 @@ begeleiding = \melodic{ } \score{ - \staff{ melodie } - \staff{ begeleiding } + \staff{ melodicregs melodie } + \staff{ melodicregs begeleiding } \paper{ \unitspace 2.5\cm % a whole note takes 2.5 \cm ideally. } diff --git a/input/martien.ly b/input/martien.ly index b3917c6209..7ae8fe4041 100644 --- a/input/martien.ly +++ b/input/martien.ly @@ -1,7 +1,3 @@ -%%%%%%%%% HAS TO BE ADJUSTED to pl32 - - -% martien.ly % % Viola Quartet % Martien Lohman (194x-????) @@ -9,7 +5,6 @@ % 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. diff --git a/input/midi.ly b/input/midi.ly index 330b732414..8207361f55 100644 --- a/input/midi.ly +++ b/input/midi.ly @@ -1,5 +1,5 @@ -% \midi.ly -% test source for lilypond-s \midi \output +% midi.ly +% test source for lilypond-s midi output melodie = \melodic{ \clef\violin diff --git a/input/scales.ly b/input/scales.ly index 0c210cbf77..1fe1f39875 100644 --- a/input/scales.ly +++ b/input/scales.ly @@ -1,41 +1,42 @@ -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 diff --git a/input/scsii-menuetto.ly b/input/scsii-menuetto.ly index 85c6a8e1e1..d6d189c95c 100644 --- a/input/scsii-menuetto.ly +++ b/input/scsii-menuetto.ly @@ -94,7 +94,7 @@ ii_menuetto = \melodic{ } \score{ - \staff{ $ii_menuetto } + \staff{ melodicregs $ii_menuetto } \paper{ \width 195\mm \unitspace 9\mm % to get lily to use only three lines diff --git a/input/standchen.ly b/input/standchen.ly index bd98824b16..2c6a2c06a9 100644 --- a/input/standchen.ly +++ b/input/standchen.ly @@ -447,10 +447,11 @@ tekstII = \lyric{ } \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 diff --git a/input/twinkle.ly b/input/twinkle.ly index 8bcad352ec..158095c36f 100644 --- a/input/twinkle.ly +++ b/input/twinkle.ly @@ -19,8 +19,8 @@ melody = \melodic{ 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 | @@ -33,7 +33,7 @@ accompany = \melodic{ global = \melodic{ \meter {2 / 4} - \skip {24*2} + \skip {2*24} % \bar "||" } @@ -102,11 +102,11 @@ textiii = \lyric{ } \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 } diff --git a/input/wohltemperirt.ly b/input/wohltemperirt.ly index 24888841b7..15723bc442 100644 --- a/input/wohltemperirt.ly +++ b/input/wohltemperirt.ly @@ -55,11 +55,16 @@ bassdux = \melodic{ } % 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 diff --git a/lib/duration-convert.cc b/lib/duration-convert.cc index 80141d17d5..8ec7e2527d 100644 --- a/lib/duration-convert.cc +++ b/lib/duration-convert.cc @@ -198,7 +198,7 @@ Duration_convert::ticks2standardised_dur( int ticks_i ) 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 diff --git a/lib/include/debug.hh b/lib/include/debug.hh index 92715dbfdc..7870a0da03 100644 --- a/lib/include/debug.hh +++ b/lib/include/debug.hh @@ -1,3 +1,7 @@ +/* + Argh! this sux! implementation not liblily + */ + #ifndef DEBUG_HH #define DEBUG_HH @@ -9,7 +13,10 @@ 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); diff --git a/lib/include/input.hh b/lib/include/input.hh new file mode 100644 index 0000000000..80ab11a1bb --- /dev/null +++ b/lib/include/input.hh @@ -0,0 +1,25 @@ +/* + input.hh -- declare Input + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#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 diff --git a/lib/include/proto.hh b/lib/include/proto.hh index 32714730c7..19273d0ab1 100644 --- a/lib/include/proto.hh +++ b/lib/include/proto.hh @@ -33,6 +33,7 @@ struct Colinfo; struct Complex_music; struct Complex_staff; struct Complex_walker; +struct Crescendo ; struct Cresc_req; struct Directional_spanner; struct Decresc_req; @@ -45,6 +46,8 @@ struct Group_change_req; struct Group_feature_req; struct Idealspacing; struct Identifier; +struct Input; +struct Input_register; struct Input_file; struct Input_music; struct Input_score; diff --git a/lib/source-file.cc b/lib/source-file.cc index 28ede975d6..43fe9c53a3 100644 --- a/lib/source-file.cc +++ b/lib/source-file.cc @@ -153,7 +153,7 @@ Source_file::map() 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 @@ -168,7 +168,7 @@ Source_file::open() 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; } diff --git a/lily/.version b/lily/.version index 5cb028566e..44ee82c2f9 100644 --- a/lily/.version +++ b/lily/.version @@ -1,7 +1,7 @@ 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 diff --git a/lily/Makefile b/lily/Makefile index f052914063..583becb8e8 100644 --- a/lily/Makefile +++ b/lily/Makefile @@ -17,7 +17,7 @@ depth = .. include ./$(depth)/make/Variables.make include ./$(depth)/make/Files.make include .version - +include Stable.make # # identify module: @@ -31,15 +31,10 @@ NAME = lilypond 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: @@ -53,10 +48,7 @@ LOADLIBES += # main target of this module: # -# MAINTARGET = $(EXECUTABLE) -# MAINTARGET = $(LIBRARY) MAINTARGET = $(lily_bindir)/$(EXECUTABLE)# huh? -# MAINTARGET = $(libdir)/$(LIBRARY)# huh? default: $(MAINTARGET) # diff --git a/lily/Stable.make b/lily/Stable.make new file mode 100644 index 0000000000..376452d8e1 --- /dev/null +++ b/lily/Stable.make @@ -0,0 +1,11 @@ +# 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\ diff --git a/lily/bar-reg.cc b/lily/bar-reg.cc index 93334497cf..8450b6bf7e 100644 --- a/lily/bar-reg.cc +++ b/lily/bar-reg.cc @@ -9,7 +9,7 @@ #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() @@ -83,5 +83,6 @@ Bar_register::post_move_processing() } IMPLEMENT_STATIC_NAME(Bar_register); +ADD_THIS_REGISTER(Bar_register); diff --git a/lily/beam.cc b/lily/beam.cc index c4d62b54d2..a20e859e23 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -180,8 +180,8 @@ Beam::do_break_at( PCol *, PCol *) const 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(); @@ -278,7 +278,7 @@ Beam::brew_molecule_p() const return out; 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); diff --git a/lily/clef-reg.cc b/lily/clef-reg.cc index 403dabb250..f0bff0374c 100644 --- a/lily/clef-reg.cc +++ b/lily/clef-reg.cc @@ -36,7 +36,7 @@ Clef_register::set_type(String s) 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; } @@ -45,7 +45,7 @@ void Clef_register::read_req(Clef_change_req*c_l) { if (!set_type(c_l->clef_str_)) - error("unknown clef type ", c_l->defined_ch_C_); + c_l->error("unknown clef type "); } bool @@ -106,3 +106,4 @@ Clef_register::post_move_processing() } } IMPLEMENT_STATIC_NAME(Clef_register); +ADD_THIS_REGISTER(Clef_register); diff --git a/lily/command-request.cc b/lily/command-request.cc index 7d95dd980d..dfa448f41f 100644 --- a/lily/command-request.cc +++ b/lily/command-request.cc @@ -72,7 +72,9 @@ IMPLEMENT_STATIC_NAME(Clef_change_req); void Clef_change_req::do_print() const { +#ifndef NPRINT mtor << clef_str_ ; +#endif } Clef_change_req::Clef_change_req(String s) @@ -85,7 +87,9 @@ IMPLEMENT_STATIC_NAME(Group_feature_req); void Group_feature_req::do_print() const { +#ifndef NPRINT mtor << "stemdir " << stemdir_i_; +#endif } Group_feature_req::Group_feature_req() @@ -98,7 +102,9 @@ IMPLEMENT_STATIC_NAME(Group_change_req); void Group_change_req::do_print()const { +#ifndef NPRINT mtor << "id : " << newgroup_str_; +#endif } /* *************** */ IMPLEMENT_STATIC_NAME(Terminate_voice_req); diff --git a/lily/complex-staff.cc b/lily/complex-staff.cc index 661d8332ed..57d2fc0861 100644 --- a/lily/complex-staff.cc +++ b/lily/complex-staff.cc @@ -1,13 +1,8 @@ #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 ) @@ -15,18 +10,6 @@ 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_); } diff --git a/lily/complex-walker.cc b/lily/complex-walker.cc index 09773b1503..ba7be37cd1 100644 --- a/lily/complex-walker.cc +++ b/lily/complex-walker.cc @@ -5,18 +5,12 @@ (c) 1997 Han-Wen Nienhuys */ - -#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 @@ -37,16 +31,15 @@ Complex_walker::do_announces() walk_regs_p_->do_announces(); } -bool -Complex_walker::try_command_request(Command_req *req_l) -{ - return walk_regs_p_->try_request(req_l); -} void Complex_walker::try_request(Request*req) { - walk_regs_p_->try_request(req); + bool b =walk_regs_p_->try_request(req); + if (!b) + + req->warning("junking request: " + String(req->name())); + } void diff --git a/lily/crescendo.cc b/lily/crescendo.cc index 29aa3ab841..163e3be737 100644 --- a/lily/crescendo.cc +++ b/lily/crescendo.cc @@ -5,16 +5,17 @@ (c) 1997 Han-Wen Nienhuys */ - +#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* @@ -27,9 +28,24 @@ Crescendo::do_break_at(PCol*, PCol*)const 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())); diff --git a/lily/debug.cc b/lily/debug.cc index 67bcd70681..a2bce7c8ce 100644 --- a/lily/debug.cc +++ b/lily/debug.cc @@ -55,6 +55,7 @@ void set_debug(bool b) { check_debug =b; -} + set_flower_debug(*monitor, check_debug); + } diff --git a/lily/dynamic-reg.cc b/lily/dynamic-reg.cc index 5f137035fa..e0e38a7a59 100644 --- a/lily/dynamic-reg.cc +++ b/lily/dynamic-reg.cc @@ -5,24 +5,28 @@ (c) 1997 Han-Wen Nienhuys */ - +#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 @@ -31,27 +35,54 @@ Dynamic_register::try_request(Request * r) 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; } } } @@ -63,6 +94,15 @@ Dynamic_register::pre_move_processing() 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 @@ -79,3 +119,14 @@ Dynamic_register::set_feature(Features i) } 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_; +} diff --git a/lily/global-regs.cc b/lily/global-regs.cc new file mode 100644 index 0000000000..207cc16c55 --- /dev/null +++ b/lily/global-regs.cc @@ -0,0 +1,47 @@ +/* + global-regs.cc -- implement + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#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 *reg_table=0; + +void +add_request_register(String s, Reg_ctor f) +{ + if (!reg_table) + reg_table = new Array; + + 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; +} diff --git a/lily/grouping.cc b/lily/grouping.cc index bc665a19c0..2e59f05bd2 100644 --- a/lily/grouping.cc +++ b/lily/grouping.cc @@ -93,7 +93,7 @@ Rhythmic_grouping::intersect(MInterval t) 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 { diff --git a/lily/headreg.cc b/lily/headreg.cc index 61232d25b8..318ed3a607 100644 --- a/lily/headreg.cc +++ b/lily/headreg.cc @@ -46,7 +46,7 @@ Notehead_register::process_requests() 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) @@ -75,3 +75,4 @@ Notehead_register::post_move_processing() } IMPLEMENT_STATIC_NAME(Notehead_register); +ADD_THIS_REGISTER(Notehead_register); diff --git a/lily/identifier.cc b/lily/identifier.cc index 0eab514cb5..8b989f9868 100644 --- a/lily/identifier.cc +++ b/lily/identifier.cc @@ -11,7 +11,7 @@ #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" @@ -19,6 +19,7 @@ #include "lookup.hh" #include "script-def.hh" #include "request.hh" +#include "input-register.hh" void Identifier::error(String expect) @@ -29,13 +30,12 @@ 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 @@ -61,6 +61,8 @@ DEFAULT_PRINT(M_chord_id, Music_general_chord, mchord); 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 { @@ -85,12 +87,18 @@ Idclass::~Idclass() { delete accessor(false); }\ 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); +} diff --git a/lily/include/class-name.hh b/lily/include/class-name.hh deleted file mode 100644 index 14ebf4c927..0000000000 --- a/lily/include/class-name.hh +++ /dev/null @@ -1,25 +0,0 @@ -/* - class-name.hh -- declare - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#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 diff --git a/lily/include/command-request.hh b/lily/include/command-request.hh index 488728d2d9..87139bd427 100644 --- a/lily/include/command-request.hh +++ b/lily/include/command-request.hh @@ -15,9 +15,13 @@ /** 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; } @@ -31,12 +35,14 @@ struct Command_req : virtual Request { /** 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); @@ -46,7 +52,8 @@ struct Partial_measure_req : Timing_req { /** 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&); @@ -56,7 +63,8 @@ struct Meter_change_req : Timing_req { }; /// toggle Cadenza mode -struct Cadenza_req : Timing_req { +class Cadenza_req : public Timing_req { +public: /// turn on? bool on_b_; Cadenza_req(bool); @@ -64,36 +72,42 @@ struct Cadenza_req : Timing_req { }; /// 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 beat_i_arr_; Array 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); @@ -105,7 +119,8 @@ struct Group_feature_req : Command_req { 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_p_arr_; bool minor_b_; @@ -125,7 +140,8 @@ struct Key_change_req : Command_req { 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); diff --git a/lily/include/complex-walker.hh b/lily/include/complex-walker.hh index 861cee77f8..a23371abea 100644 --- a/lily/include/complex-walker.hh +++ b/lily/include/complex-walker.hh @@ -22,7 +22,6 @@ class Complex_walker: public Staff_walker { public: - int c0_position_i_; Walker_registers *walk_regs_p_; /* *************** */ diff --git a/lily/include/crescendo.hh b/lily/include/crescendo.hh index 858cd44075..cb6b159ad7 100644 --- a/lily/include/crescendo.hh +++ b/lily/include/crescendo.hh @@ -11,12 +11,19 @@ #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; diff --git a/lily/include/dynamic-reg.hh b/lily/include/dynamic-reg.hh index cd500c1901..164ac6af3d 100644 --- a/lily/include/dynamic-reg.hh +++ b/lily/include/dynamic-reg.hh @@ -15,9 +15,13 @@ 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_l_arr_; /* ************** */ Dynamic_register(); + ~Dynamic_register(); virtual bool try_request(Request *req_l); virtual void process_requests(); virtual void pre_move_processing(); diff --git a/lily/include/identifier.hh b/lily/include/identifier.hh index 2baf529b49..9078f7323c 100644 --- a/lily/include/identifier.hh +++ b/lily/include/identifier.hh @@ -9,19 +9,19 @@ #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() {} @@ -32,6 +32,8 @@ struct 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) @@ -43,7 +45,7 @@ struct Identifier { protected: virtual void do_print()const=0; private: - Identifier(Identifier const&){} + Identifier(Identifier const&); }; #define declare_id_class(Idclass, Class, accessor) \ @@ -66,5 +68,6 @@ declare_id_class(M_chord_id, Music_general_chord, mchord); 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_ diff --git a/lily/include/input-register.hh b/lily/include/input-register.hh new file mode 100644 index 0000000000..6149121e29 --- /dev/null +++ b/lily/include/input-register.hh @@ -0,0 +1,45 @@ +/* + input-register.hh -- declare Input_register + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#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 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 get_nongroups_str_arr() const; + void print() const; + /** + Construct the registers. + */ + Array get_nongroup_p_arr()const; +}; + +Request_register * get_nongroup_register_p(String); + +#endif // INPUT_REGISTER_HH diff --git a/lily/include/input-score.hh b/lily/include/input-score.hh index 36baf691c9..a55b7a4378 100644 --- a/lily/include/input-score.hh +++ b/lily/include/input-score.hh @@ -14,12 +14,11 @@ #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. @@ -35,7 +34,7 @@ struct Input_score { 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(); diff --git a/lily/include/input-staff.hh b/lily/include/input-staff.hh index 25e1431162..0a35b460b6 100644 --- a/lily/include/input-staff.hh +++ b/lily/include/input-staff.hh @@ -11,19 +11,19 @@ #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 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; }; diff --git a/lily/include/input.hh b/lily/include/input.hh new file mode 100644 index 0000000000..8677daa116 --- /dev/null +++ b/lily/include/input.hh @@ -0,0 +1,32 @@ +/* + input.hh -- declare Input + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#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 diff --git a/lily/include/lyric-register.hh b/lily/include/lyric-register.hh new file mode 100644 index 0000000000..f9f43bea26 --- /dev/null +++ b/lily/include/lyric-register.hh @@ -0,0 +1,26 @@ +/* + lyric-register.hh -- declare + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef LYRIC_REGISTER_HH +#define LYRIC_REGISTER_HH +#include "register.hh" +#include "varray.hh" + +#include "proto.hh" +class Lyric_register : public Request_register { + Array 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 diff --git a/lily/include/lyric-staff.hh b/lily/include/lyric-staff.hh deleted file mode 100644 index fb88c5e5aa..0000000000 --- a/lily/include/lyric-staff.hh +++ /dev/null @@ -1,24 +0,0 @@ -/* - lyricstaff.hh -- part of LilyPond - - copyright 1997 Jan Nieuwenhuizen - */ - -#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 - - - - diff --git a/lily/include/lyric-walker.hh b/lily/include/lyric-walker.hh deleted file mode 100644 index 1a80523883..0000000000 --- a/lily/include/lyric-walker.hh +++ /dev/null @@ -1,28 +0,0 @@ -// -// lyricwalker.hh -- declare Lyric_walker -// -// (c) 1996,97 Han-Wen Nienhuys, Jan Nieuwenhuizen -// - -#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 litem_l_array_; - - /* *************** */ - virtual void process_requests(); - - Lyric_walker(Lyric_staff* lstaff_l); - Lyric_staff* lstaff_l(); -}; - - -#endif // LYRICWALKER_HH - - diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index d9a13deda9..a3079b10f4 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -18,7 +18,8 @@ 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; } @@ -29,7 +30,8 @@ struct Musical_req : virtual Request { }; -struct Skip_req : Musical_req { +class Skip_req : public Musical_req { +public: Moment duration_; virtual Moment duration() const; @@ -38,7 +40,8 @@ struct Skip_req : Musical_req { /** 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_; /* *************** */ @@ -58,13 +61,15 @@ struct Spacing_req :virtual Request { 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 @@ -80,7 +85,8 @@ struct Text_req : virtual Musical_req { /** 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); }; @@ -109,7 +115,8 @@ struct Melodic_req :virtual Musical_req }; /// 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_; @@ -130,7 +137,8 @@ public: 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(); @@ -141,7 +149,8 @@ struct Stem_req : Rhythmic_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 @@ -158,7 +167,8 @@ struct Span_req : virtual Musical_req { 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_; @@ -170,7 +180,8 @@ struct Plet_req : virtual Request { /** 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; /* *************** */ @@ -180,7 +191,8 @@ struct Beam_req : Span_req { }; /// a slur -struct Slur_req : Span_req { +class Slur_req : public Span_req { +public: REQUESTMETHODS(Slur_req,slur); }; @@ -189,7 +201,8 @@ struct Slur_req : Span_req { /** 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_; @@ -208,12 +221,14 @@ struct Script_req : Musical_req { 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 @@ -222,13 +237,15 @@ struct Dynamic_req : Subtle_req { 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(); diff --git a/lily/include/my-lily-parser.hh b/lily/include/my-lily-parser.hh index 679c381181..2eef0929a4 100644 --- a/lily/include/my-lily-parser.hh +++ b/lily/include/my-lily-parser.hh @@ -18,8 +18,20 @@ #include "duration.hh" #include "string.hh" #include "varray.hh" +#include "input.hh" class My_lily_parser { + char const* here_ch_C()const; + Array 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*); @@ -30,8 +42,6 @@ public: bool last_duration_mode ; Array pre_reqs, post_reqs; - Array define_spot_array_; - char const* defined_ch_C_; int fatal_error_i_; Sources * source_l_; int error_level_i_; @@ -39,15 +49,10 @@ public: 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); @@ -60,6 +65,7 @@ public: public: void parse_file ( String init_str, String file_str); My_lily_parser(Sources * sources_l); + ~My_lily_parser(); }; #endif // MY_LILY_PARSER_HH diff --git a/lily/include/register-group.hh b/lily/include/register-group.hh index 278d150753..7af00f6505 100644 --- a/lily/include/register-group.hh +++ b/lily/include/register-group.hh @@ -40,7 +40,7 @@ public: */ 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); @@ -48,7 +48,8 @@ public: virtual void process_requests(); virtual ~Register_group_register(); virtual void add(Request_register* reg_p); - virtual bool contains_b(Request_register*); + void add(Array reg_p_arr); + virtual bool contains_b(Request_register*)const; }; #endif // REGISTERGROUP_HH diff --git a/lily/include/register.hh b/lily/include/register.hh index 808b28d05c..4ac81c61e4 100644 --- a/lily/include/register.hh +++ b/lily/include/register.hh @@ -11,6 +11,7 @@ #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. @@ -84,7 +85,7 @@ protected: /** 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. */ @@ -103,6 +104,22 @@ public: 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 diff --git a/lily/include/request.hh b/lily/include/request.hh index 66e62d4843..c3e0deb846 100644 --- a/lily/include/request.hh +++ b/lily/include/request.hh @@ -14,16 +14,16 @@ #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(); @@ -54,10 +54,7 @@ public: 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; } diff --git a/lily/include/score-column.hh b/lily/include/score-column.hh index e961d04920..9f2e33c6b5 100644 --- a/lily/include/score-column.hh +++ b/lily/include/score-column.hh @@ -50,6 +50,8 @@ public: }; +#include "compare.hh" + instantiate_compare(Score_column&, Score_column::compare); #endif // SCCOL_HH diff --git a/lily/include/score.hh b/lily/include/score.hh index cf86ad342a..32b57bf01f 100644 --- a/lily/include/score.hh +++ b/lily/include/score.hh @@ -16,6 +16,7 @@ #include "moment.hh" #include "assoc.hh" #include "string.hh" +#include "input.hh" /// the total music def of one movement struct Score { @@ -28,7 +29,7 @@ struct Score { IPointerList cols_; PScore *pscore_p_; - char const *defined_ch_C_; + Input input_; int errorlevel_i_; /* *************************************************************** */ diff --git a/lily/include/script-def.hh b/lily/include/script-def.hh index 8b5be32561..8d9528b45a 100644 --- a/lily/include/script-def.hh +++ b/lily/include/script-def.hh @@ -7,6 +7,7 @@ #ifndef SCRIPTDEF_HH #define SCRIPTDEF_HH #include "string.hh" + struct Script_def{ int stemdir; int staffdir; diff --git a/lily/include/spanner.hh b/lily/include/spanner.hh index 43a3567fa5..3bb547b528 100644 --- a/lily/include/spanner.hh +++ b/lily/include/spanner.hh @@ -30,7 +30,7 @@ */ struct Spanner:Staff_elem { - PCol *left, *right; + PCol *left_col_l_, *right_col_l_; /* *************** */ diff --git a/lily/include/staff-elem-info.hh b/lily/include/staff-elem-info.hh index 2d58add6fb..24e09501e3 100644 --- a/lily/include/staff-elem-info.hh +++ b/lily/include/staff-elem-info.hh @@ -25,17 +25,6 @@ struct Staff_elem_info { 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_; diff --git a/lily/include/staff-elem.hh b/lily/include/staff-elem.hh index e2fce84582..a604385cff 100644 --- a/lily/include/staff-elem.hh +++ b/lily/include/staff-elem.hh @@ -18,14 +18,27 @@ 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 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; @@ -68,19 +81,8 @@ protected: /// do calculations after determining horizontal spacing virtual void do_post_processing(); - Array dependants; + Array 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 dependencies; }; diff --git a/lily/include/staff-info.hh b/lily/include/staff-info.hh new file mode 100644 index 0000000000..4873da6b49 --- /dev/null +++ b/lily/include/staff-info.hh @@ -0,0 +1,35 @@ +/* + staff-info.hh -- declare + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#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 diff --git a/lily/include/staff-regs.hh b/lily/include/staff-regs.hh new file mode 100644 index 0000000000..344659dff3 --- /dev/null +++ b/lily/include/staff-regs.hh @@ -0,0 +1,39 @@ +/* + staff-regs.hh -- declare Staff_registers + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#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 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 diff --git a/lily/include/staff-sym-reg.hh b/lily/include/staff-sym-reg.hh new file mode 100644 index 0000000000..24bd2c7abb --- /dev/null +++ b/lily/include/staff-sym-reg.hh @@ -0,0 +1,28 @@ +/* + staff-sym-reg.hh -- declare + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#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 diff --git a/lily/include/staff-sym.hh b/lily/include/staff-sym.hh new file mode 100644 index 0000000000..bcec2bfaff --- /dev/null +++ b/lily/include/staff-sym.hh @@ -0,0 +1,30 @@ +/* + staffsym.hh -- declare Staff_symbol + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#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 diff --git a/lily/include/staff.hh b/lily/include/staff.hh index 959859b6e4..2ceeb237fd 100644 --- a/lily/include/staff.hh +++ b/lily/include/staff.hh @@ -20,9 +20,10 @@ class Staff { /// synchronous horizontal stuff IPointerList voice_list_; Staff_column *get_col(Moment, PCursor * last= 0); - + public: - + Input_register * ireg_p_; + /// runtime field IPointerList cols_; diff --git a/lily/include/staffsym.hh b/lily/include/staffsym.hh deleted file mode 100644 index bcec2bfaff..0000000000 --- a/lily/include/staffsym.hh +++ /dev/null @@ -1,30 +0,0 @@ -/* - staffsym.hh -- declare Staff_symbol - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys -*/ - - -#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 diff --git a/lily/include/swallow-reg.hh b/lily/include/swallow-reg.hh new file mode 100644 index 0000000000..9785fa29ac --- /dev/null +++ b/lily/include/swallow-reg.hh @@ -0,0 +1,26 @@ +/* + swallow-reg.hh -- declare Swallow_register + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#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 diff --git a/lily/include/text-def.hh b/lily/include/text-def.hh index 50bb98105c..bd59e41789 100644 --- a/lily/include/text-def.hh +++ b/lily/include/text-def.hh @@ -9,14 +9,13 @@ #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&); diff --git a/lily/include/time-description.hh b/lily/include/time-description.hh index 7e366ec4c2..16ea5c5f14 100644 --- a/lily/include/time-description.hh +++ b/lily/include/time-description.hh @@ -33,6 +33,7 @@ struct Time_description { void OK() const; Time_description(); void add(Moment dt); + bool allow_meter_change_b(); String str()const; void print() const; void setpartial(Moment p); diff --git a/lily/include/voice-element.hh b/lily/include/voice-element.hh index aa72fb8122..29a41d4658 100644 --- a/lily/include/voice-element.hh +++ b/lily/include/voice-element.hh @@ -13,16 +13,17 @@ #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 reqs; /* *************** */ diff --git a/lily/include/voice-group-regs.hh b/lily/include/voice-group-regs.hh index 5f17d8fa8b..cdc5b3b157 100644 --- a/lily/include/voice-group-regs.hh +++ b/lily/include/voice-group-regs.hh @@ -12,20 +12,29 @@ #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_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 diff --git a/lily/include/voice-regs.hh b/lily/include/voice-regs.hh index 70735ff10f..8b565f7735 100644 --- a/lily/include/voice-regs.hh +++ b/lily/include/voice-regs.hh @@ -13,7 +13,7 @@ #include "register-group.hh" class Voice_registers : public Register_group_register { - + Input_register const *ireg_C_; public: Voice *voice_l_; /* *************** */ @@ -22,7 +22,7 @@ public: 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; }; diff --git a/lily/include/walk-regs.hh b/lily/include/walk-regs.hh index daa4690932..7739ed269b 100644 --- a/lily/include/walk-regs.hh +++ b/lily/include/walk-regs.hh @@ -23,19 +23,15 @@ struct Walker_registers : Register_group_register { Array nobreak_item_p_arr_; Array postbreak_item_p_arr_; Array announce_info_arr_; - Array 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); diff --git a/lily/input-music.cc b/lily/input-music.cc index e407c87dd5..9ba6838179 100644 --- a/lily/input-music.cc +++ b/lily/input-music.cc @@ -12,7 +12,7 @@ Input_music::check_plet(Voice_element* velt_l) 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; diff --git a/lily/input-register.cc b/lily/input-register.cc new file mode 100644 index 0000000000..e038b18dd2 --- /dev/null +++ b/lily/input-register.cc @@ -0,0 +1,76 @@ +/* + input-register.cc -- implement Input_register + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ +#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 +Input_register::get_nongroups_str_arr()const +{ + Array 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 +Input_register::get_nongroup_p_arr() const return a; +{ + Array 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())); +} diff --git a/lily/input-score.cc b/lily/input-score.cc index ed7d831eea..a2dacc048e 100644 --- a/lily/input-score.cc +++ b/lily/input-score.cc @@ -37,10 +37,10 @@ Input_score::set(Midi_def* midi_p) } 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_; } @@ -48,7 +48,7 @@ Score* 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_)); @@ -72,7 +72,6 @@ Input_score::~Input_score() Input_score::Input_score() { - defined_ch_C_=0; paper_p_= 0; midi_p_ = 0; errorlevel_i_ = 0; diff --git a/lily/input-staff.cc b/lily/input-staff.cc index 9262851f3c..618d98f012 100644 --- a/lily/input-staff.cc +++ b/lily/input-staff.cc @@ -12,15 +12,12 @@ #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 @@ -32,18 +29,10 @@ Input_staff::add(Input_music*m) 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); @@ -52,11 +41,12 @@ Input_staff::parse(Score*score_l) } 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 @@ -66,9 +56,11 @@ Input_staff::print() const 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_; } diff --git a/lily/input.cc b/lily/input.cc new file mode 100644 index 0000000000..1ff4e86244 --- /dev/null +++ b/lily/input.cc @@ -0,0 +1,85 @@ +/* + input.cc -- implement Input + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ +#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)"; +} diff --git a/lily/key-reg.cc b/lily/key-reg.cc index 83fb84c0cd..ca98995b1c 100644 --- a/lily/key-reg.cc +++ b/lily/key-reg.cc @@ -39,7 +39,7 @@ Key_register::acknowledge_element(Staff_elem_info info) { Command_req * r_l = info.req_l_->command() ; if (r_l && r_l->clefchange() && !kit_p_) { - int c0_i= *get_staff_info().c0_position_i_; + 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_)); @@ -57,7 +57,7 @@ Key_register::process_requests() } 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_)); @@ -98,3 +98,4 @@ Key_register::post_move_processing() kit_p_ = 0; } IMPLEMENT_STATIC_NAME(Key_register); +ADD_THIS_REGISTER(Key_register); diff --git a/lily/local-key-reg.cc b/lily/local-key-reg.cc index ea7e66b7d7..876a0ecf01 100644 --- a/lily/local-key-reg.cc +++ b/lily/local-key-reg.cc @@ -40,7 +40,7 @@ Local_key_register::acknowledge_element(Staff_elem_info info) 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_); @@ -64,7 +64,8 @@ Local_key_register::process_requests() 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); diff --git a/lily/lyric-item.cc b/lily/lyric-item.cc index 1a54f12bca..8bca62e9c9 100644 --- a/lily/lyric-item.cc +++ b/lily/lyric-item.cc @@ -22,5 +22,5 @@ Lyric_item::do_pre_processing() // test context-error if ( tdef_l()->text_str_.index_i( "Gates" ) >=0)// :-) - warning( "foul word", tdef_l()->defined_ch_C_ ); + tdef_l()->warning( "foul word"); } diff --git a/lily/lyric-register.cc b/lily/lyric-register.cc new file mode 100644 index 0000000000..73f0def7b0 --- /dev/null +++ b/lily/lyric-register.cc @@ -0,0 +1,55 @@ +/* + lyric-register.cc -- implement Lyric_register + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#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); diff --git a/lily/lyric-staff.cc b/lily/lyric-staff.cc deleted file mode 100644 index 77d276187c..0000000000 --- a/lily/lyric-staff.cc +++ /dev/null @@ -1,22 +0,0 @@ -#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); -} diff --git a/lily/lyric-walker.cc b/lily/lyric-walker.cc deleted file mode 100644 index 6643215ea3..0000000000 --- a/lily/lyric-walker.cc +++ /dev/null @@ -1,39 +0,0 @@ -/* - lyricwalker.cc -- implement Lyric_walker - - source file of the LilyPond music typesetter - - (c) 1997 Jan Nieuwenhuizen -*/ - -#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_) -{ - -} - - diff --git a/lily/main.cc b/lily/main.cc index dd38e5cad5..1576773e86 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -21,7 +21,6 @@ Sources* source_l_g = 0; bool only_midi = false; -extern void parse_file(String,String); void @@ -96,33 +95,35 @@ notice() "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"); @@ -137,7 +138,7 @@ main (int argc, char **argv) exit(0); break; case 'I': - path->push(oparser.optarg); + path.push(oparser.optarg); break; case 'i': init_str = oparser.optarg; @@ -172,11 +173,6 @@ main (int argc, char **argv) return 0; } -String -find_file(String f) -{ - return path->find(f); -} /// make input file name: add default extension. "" is stdin. void diff --git a/lily/meter-reg.cc b/lily/meter-reg.cc index 3c500e6042..c4ef7b9bb1 100644 --- a/lily/meter-reg.cc +++ b/lily/meter-reg.cc @@ -63,3 +63,4 @@ Meter_register::post_move_processing() meter_p_ =0; } IMPLEMENT_STATIC_NAME(Meter_register); +ADD_THIS_REGISTER(Meter_register); diff --git a/lily/midi-output.cc b/lily/midi-output.cc index 5992cf9505..c239e82af5 100644 --- a/lily/midi-output.cc +++ b/lily/midi-output.cc @@ -83,12 +83,15 @@ Midi_output::header() 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 ); diff --git a/lily/midi-walker.cc b/lily/midi-walker.cc index ef1ea8382a..a024458349 100644 --- a/lily/midi-walker.cc +++ b/lily/midi-walker.cc @@ -82,7 +82,7 @@ Midi_walker::process_requests() 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(); diff --git a/lily/musical-request.cc b/lily/musical-request.cc index c7a848a18f..1ba4fd7801 100644 --- a/lily/musical-request.cc +++ b/lily/musical-request.cc @@ -65,12 +65,11 @@ Span_req::do_print() const 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() @@ -115,8 +114,7 @@ Melodic_req::transpose(Melodic_req const & delta) } 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"); } } @@ -363,7 +361,7 @@ Request::voice_l() if (!elt_l_) return 0; else - return (Voice*)elt_l_->voice_l_; + return (Voice*)elt_l_->voice_C_; } /* *************** */ diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index 57909e8708..2bb88b7448 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -26,9 +26,11 @@ static Keyword_ent the_key_tab[]={ "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, @@ -51,6 +53,7 @@ static Keyword_ent the_key_tab[]={ "start", START_T, "stem", STEM, "table", TABLE, + "spandynamic", SPANDYNAMIC, "symboltables", SYMBOLTABLES, "tempo", TEMPO, "texid", TEXID, @@ -103,7 +106,7 @@ My_lily_lexer::~My_lily_lexer() 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(); } diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc index 9924a78a7e..0696d91912 100644 --- a/lily/my-lily-parser.cc +++ b/lily/my-lily-parser.cc @@ -1,5 +1,5 @@ /* - my-lily-parser.cc -- implement + my-lily-parser.cc -- implement My_lily_parser source file of the LilyPond music typesetter @@ -45,18 +45,20 @@ My_lily_parser::parse_file(String init, String s) 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() @@ -67,7 +69,7 @@ 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 * @@ -109,7 +111,7 @@ My_lily_parser::get_word_element(Text_def* tdef_p, Duration * duration_p) 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); @@ -121,11 +123,11 @@ Voice_element * 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; @@ -136,18 +138,18 @@ Voice_element * 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); @@ -199,7 +201,7 @@ My_lily_parser::get_parens_request(char c) break; } - req_p->defined_ch_C_ = here_ch_C(); + req_p->set_spot( here_input()); return req_p; } @@ -212,7 +214,6 @@ My_lily_parser::My_lily_parser(Sources * source_l) textstyle_str_="roman"; // in lexer? error_level_i_ = 0; last_duration_mode = false; - defined_ch_C_ = 0; fatal_error_i_ = 0; } @@ -228,3 +229,15 @@ My_lily_parser::add_requests(Voice_element*v) } 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()); +} diff --git a/lily/p-col.cc b/lily/p-col.cc index 3ace8fba82..c47a4b2d27 100644 --- a/lily/p-col.cc +++ b/lily/p-col.cc @@ -1,3 +1,11 @@ +/* + p-col.cc -- implement PCol + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + #include "p-col.hh" #include "p-score.hh" #include "p-staff.hh" @@ -10,7 +18,7 @@ PCol::width() const 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; } @@ -18,15 +26,6 @@ PCol::width() const int PCol::rank() const { -#if 0 - if(!pscore_l_) - return -1; - PCursor me=pscore_l_->find_col( (PCol*)this); - if (!me.ok()) - return -1; - PCursor bot(pscore_l_->cols.top()); - return me - bot; -#endif assert(rank_i_ != -1); return rank_i_; } @@ -47,8 +46,7 @@ PCol::print() const #ifndef NPRINT mtor << "PCol {"; - if (rank() >= 0) - mtor << "rank: " << rank_i_ << '\n'; + mtor << "rank: " << rank_i_ << '\n'; mtor << "# symbols: " << its.size() ; if (breakable_b()){ diff --git a/lily/p-score.cc b/lily/p-score.cc index 800d3287cf..d31762e54a 100644 --- a/lily/p-score.cc +++ b/lily/p-score.cc @@ -220,10 +220,10 @@ PScore::find_col(PCol const *c)const 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 diff --git a/lily/parser.y b/lily/parser.y index a4f0103fb4..69ef223a4e 100644 --- a/lily/parser.y +++ b/lily/parser.y @@ -23,6 +23,7 @@ #include "voice-element.hh" #include "my-lily-parser.hh" #include "text-def.hh" +#include "input-register.hh" #ifndef NDEBUG #define YYDEBUG 1 @@ -46,6 +47,7 @@ Box *box; Duration *duration; Identifier *id; + Input_register * iregs; Input_music *music; Input_score *score; Input_staff *staff; @@ -96,10 +98,12 @@ yylex(YYSTYPE *s, void * v_l) %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 @@ -119,6 +123,7 @@ yylex(YYSTYPE *s, void * v_l) %token SCORE %token SCRIPT %token SKIP +%token SPANDYNAMIC %token STAFF %token START_T %token STEM @@ -134,6 +139,7 @@ yylex(YYSTYPE *s, void * v_l) %token DOTS %token INT +%token REGS_IDENTIFIER %token IDENTIFIER %token MELODIC_REQUEST_IDENTIFIER %token CHORD_IDENTIFIER @@ -173,7 +179,8 @@ yylex(YYSTYPE *s, void * v_l) %type paper_block paper_body %type dim real %type unit -%type post_request pre_request command_req pure_post_request +%type post_request pre_request command_req +%type pure_post_request pure_post_request_choice %type script_req textscript_req dynamic_req %type score_block score_body %type