From: Han-Wen Nienhuys <hanwen@xs4all.nl> Date: Sun, 23 Mar 1997 23:44:41 +0000 (+0100) Subject: release: 0.0.44 X-Git-Tag: release/0.0.44 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8309cbcd6660ea1f0b35abacbb424ddc4158e448;p=lilypond.git release: 0.0.44 --- diff --git a/.dstreamrc b/.dstreamrc index dd50d37872..63a0a94456 100644 --- a/.dstreamrc +++ b/.dstreamrc @@ -1,7 +1,7 @@ # class name silence? Dstream 1 -My_lily_lexer 0 +My_lily_lexer 1 PCol 1 Score_column 1 Ineq_constrained_qp 1 @@ -13,9 +13,9 @@ Idealspacing 1 # yydebug InitParser 1 -Parser 0 +Parser 1 InitDeclarations 1 -Declarations 0 +Declarations 1 # FlexLexer debug InitLexer 1 Lexer 1 diff --git a/.version b/.version index f3fe58849a..18dcdc6982 100644 --- a/.version +++ b/.version @@ -1,8 +1,7 @@ TOPLEVEL_MAJOR_VERSION = 0 TOPLEVEL_MINOR_VERSION = 0 -TOPLEVEL_PATCH_LEVEL = 43 +TOPLEVEL_PATCH_LEVEL = 44 # use to send patches, always empty for released version: # include separator: ".postfix", "-pl" makes rpm barf TOPLEVEL_MY_PATCH_LEVEL = -# diff --git a/Documentation/CodingStyle.pod b/Documentation/CodingStyle.pod index 66ee04705f..2f65fb775e 100644 --- a/Documentation/CodingStyle.pod +++ b/Documentation/CodingStyle.pod @@ -311,6 +311,12 @@ user built array. const. Note that the proper order C<Type const> i.s.o. C<const Type> +=item C<C> + +A const pointer. This would be equivalent to C<_c_l>, but since any +"const" pointer has to be a link (you can't delete a const pointer), +it is superfluous. + =item C<l> temporary pointer to object (link) diff --git a/Documentation/INSTALL.pod b/Documentation/INSTALL.pod index 4a389171dd..4615b850f2 100644 --- a/Documentation/INSTALL.pod +++ b/Documentation/INSTALL.pod @@ -85,7 +85,10 @@ have the gnu development tools, and your make is gnu make. If this is not the case, you can adjust your environment variables to your taste: - CXXFLAGS="-I /home/me/my_include -DWEIRD_FOOBAR" configure + export CPPFLAGS="-I /home/me/my_include -DWEIRD_FOOBAR" + configure + +C<CPPFLAGS> are the preprocessor flags. the configure script is Cygnus configure, and it will accept B<--help>. If you are not root, you will probably have to make it with diff --git a/Documentation/lilyinput-pre-0.1.pod b/Documentation/lilyinput-pre-0.1.pod index 58a4378d4b..885b303306 100644 --- a/Documentation/lilyinput-pre-0.1.pod +++ b/Documentation/lilyinput-pre-0.1.pod @@ -69,11 +69,3 @@ Not really crystallized; you can use '#' or '%' as line comment 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. diff --git a/Documentation/lilyinput.pod b/Documentation/lilyinput.pod deleted file mode 100644 index 6fdedd2148..0000000000 --- a/Documentation/lilyinput.pod +++ /dev/null @@ -1,362 +0,0 @@ -=head1 NAME - -LilyInput - LilyPond input format -- Mudela 0.1 - -B<NOTICE:> this doc describes the I<new> input format, S<Mudela 0.1>. - -=head1 DESCRIPTION - -This document describes the the LilyPond input format, which is an -effective language for definining music. We call this language -(rather arrogantly) The Musical Definition Language (S<Mudela 0.1>). - -The first aim of Mudela is to define a piece of music, -being complete from both from a musical typesetting, -as from a musical performing point of view. - -The design of Mudela has been (perfect past tense, hopefully) -an ongoing process, -the most important criteria being: - -=over 4 - -=item * - -define the (musical) message of the composer as unambiguously as possible, - -=item * - -be intuitive, and easily readable -(compared to, say, Musi*TeX input, or MIDI :-), - -=item * - -be writable in ASCII with a simple texteditor, yfte(TM). - -=back - -Other considerations were (and will be): - -=over 4 - -=item * - -be able to edit the layout -without danger of changing the original music (Urtext), - -=item * - -allow for adding different interpretations, again, -without danger of changing the original, - -=item * - -easy to create a conductor's score, -as well as the scores for all individual instruments, - -=item * - -provide simple musical manipulations, such as -S<(i) extracting> a slice of music from a previously defined piece, -S<(ii) extracting> only the rhythm from a piece of music, -S<(iii) transposing>, etc., - -=item * - -easy to comprehend to both programmers and others. - -=back - -Musical pieces could be - -=over 5 - -=item * - -Mahlerian orchestral scores, - -=item * - -piano pieces (Schubertian, Rachmaninovian), - -=item * - -pop songs (lyrics and chords), - -=item * - -gregorian chants, - -=item * - -Bach multivoice organ pieces, - -=item * - -short excerpts to be used in musicological publications. - -=back - - -=head1 Overview - -The Musical Definition Language (Mudela) S<version 0.1>, -has a logical structure, -making use of typing and naming (using identifiers), -that allows for flexible input, and definition reuse. - -The below included for explanatory -purposes only (i.e., for a complete and up-to-date definition, see -F<lily/parser.y> and F<lily/lexer.l>): - -=head2 Files - -The de-facto extension of Mudela is F<.ly>. Files may be included by -entering C<include> at the start of a line: - - include "a_file.ly" - -=head2 Comments - -Line comments are introduced by a C<%> - -=head2 Words - -Keywords are preceded by a backslash "\". They contain alphabetic -characters only. - -Identifiers in their normal form consist start with a alpha character, -followed by alpha-numerics. Identifiers can contain any characters -(except whitespace, C<$> and C<%>), if you use this construct: - - $Id_with###@weird92chars = - -=head2 Nesting characters - -Mudela uses the brace (C<{> and C<}>) for hierarchical structures. To -aid the eye in reading, for chords the C<<> and the C<>> are used as -nesting braces. - -=head2 Identifiers - -=head2 Hierarchical structures - -The general structure consists of declarations: - - IDENTIFIER = \TYPE{ - <type specific data> - } - -and instantiations: - - \TYPE{ <type specific data> } - -(Currently, C<\score> is the only type that can be instantiated -at top level. Currently declarations can only be done at top level) - -Most instantiations that use an IDENTIFIER are specified as follows: - - \TYPE { IDENTIFIER [...] } - -Some exceptions on this rule have been made to prevent inputting -Mudela becoming tedious - - -=head2 Simple mudela - -The actual musical part of Mudela that defines a melody, is known as -I<simple mudela>. - -Simple mudela is the most common type of music. It consists of a list -of notes or lyrics, chords, and commands. - -=head2 Modes: - -To simplify different aspects of music definition (entering the notes -and manipulating them) Mudela has a number of different input "modes": - -=over 4 - -=item Normal mode - -At the start of parsing, Mudela assumes normal mode. -In Normal mode, a word is looked up in the following order: - - word identifier, string - \word keyword, string - -In normalmode, a word is assumed to start with an alphabetic -character, followed by alpha-numeric characters. - -=item Note mode - -Note mode (and thus Simple mudela) is introduced by the keyword C<\music>. -In Note mode, a word is looked up in the following order: - - word identifier, string - \word keyword, string - -In Note mode a word is considered to have alphabetic characters only. - -=item Lyric mode - -Lyrics mode (and thus Simple mudela) is introduced by the keyword C<\lyrics>. - -In Lyrics mode, a word is looked up in the following order: - - word string - \word keyword, string - -In Lyric mode every sequence of non-digit and non-white characters -starting with an alphabetic character is considered a word. - -=back - -These modes are of a lexical nature. Normal and Note mode largely -resemble each other, save the possibility of entering Reals, and -meaning of C<_> - -=head2 Notes - -Simple mudela basically is a sequence of the notes you want to -enter. - - a'4 % dutch names - -is a A-1 pitched quaver. The ' as well as the ` signify an octave change. -A-1 is 440 Hz concert-pitch. C<c'> is also known as the central -c. More examples: - - `a % 110 - a % 220 - a' % 440 - a'' % 880 - -another example: - - `as4.*2/3 - -This is an A flat, (just below 110 Hz concert-pitch). The C<*2/3> -signifies that this note is part of a triplet (3 in stead of 2). The -duration is one and a half quaver (C<4.>) times 2/3. - -The default language for notenames is defined to be dutch, - - % double sharp - cisis disis eisis fisis gisis aisis bisis - % sharps - cis dis eis fis gis ais bis - % naturals - c d e f g a b - % flats - ces des es fes ges as bes - % double flats - ceses deses eses feses geses ases beses - -The standard notenames also have uppercase versions, which octavate -down: - - a % 220 - A % 110 - 'A % 55 - A' % 220 - Cisis - -The rest is named - - r - -These notenames along with duration is enough material to construct -simple melodies: - - c4 c4 g4 g4 a4 a4 g2 - f4 f4 e4 e4 d4 d4 c2 - -Music is able to express more. generally speaking, the other -'features' are either connected between notes (slurs, beams: spanning -requests) or attached to notes (eg. accents). The former are -implemented as START and STOP stop features and then attached to the note. - - [] START/STOP a beam - () START/STOP a slur - - -example: - - [c8 () d8 () e8 ] - -Please note that these two characters do I<not> necessarrily nest, eg: - - [c8 e8(] [)g8 c'8] - - -Symbols which can be put at either side of a staff are entered as follows: - - a-^ % marcato, direction: default - a^- % portato, direction: above note - a_. % staccato, direction: below note - a^\script { "symbolindex" . . . } % see script.ini for details. - -Dynamics can be put after the notename: - - a4 \dynamic { 0 } % 0 = fff, 7 = ppp - -Mudela defines the following dynamic identifiers: - - ppp pp p mp mf df ff fff % df iso f, f is a notename. - -The general form of a note is: - - post-requests de-octavate notename octavate duration pre-requests - -Notenames are just identifiers, and can be declared for any -language appropriate (see F<dutch.ini>). - -=head2 Lyrics - -Lyrics in Mudela resemble Simple mudela a lot, with notes substituted -by text. - -All syllables are entered separately, separated by whitespace - - Twin-4 kle4 twin-4 kle4 ... - -Two syllables or words that compose a single -duration entry are bound together using an underscore - - He_could4 not4 - - - -=head2 Rhythms - -Rhythms in Mudela are entered identical to Simple mudela. -The melodic part of the information is ignored. - -=head1 STRUCTURE - -In concrete, a piece of Mudela has the following structure: - - % declare pieces of music: - melody = \music{ <simple mudela> } - accompany = \music{ <simple mudela> } - - % instantiate (=create tex, midi output) the score: - \score{ - \staff{ melody } - \staff{ accompany } - \commands{ <score global commands> } - \midi{ <midi definitions> } - \paper{ <paper and layout definitions } - } - -=head2 Examples - -Examples are included with the LilyPond distribution. For the sake of -maintenance no long examples are included in this document. - - -=head2 Other - -LilyPond first reads F<symbol.ini>, which contains declarations crucial -to proper operation of LilyPond (symbol tables, note names). diff --git a/Documentation/mudela.pod b/Documentation/mudela.pod new file mode 100644 index 0000000000..02f06aeffb --- /dev/null +++ b/Documentation/mudela.pod @@ -0,0 +1,453 @@ +=head1 NAME + +Mudela - LilyPond input format 0.1 + +=head1 DESCRIPTION + +This document describes the the LilyPond input format, which is an +effective language for definining music. We call this language +(rather arrogantly) The Musical Definition Language (S<Mudela 2>). + +The first aim of Mudela is to define a piece of music, +being complete from both from a musical typesetting, +as from a musical performing point of view. + +The design of Mudela has been (perfect past tense, hopefully) +an ongoing process, +the most important criteria being: + +=over 4 + +=item * + +define the (musical) message of the composer as unambiguously as possible, + +=item * + +be intuitive, and easily readable +(compared to, say, Musi*TeX input, or MIDI :-), + +=item * + +be writable in ASCII with a simple texteditor, yfte(TM). + +=back + +Other considerations were (and will be): + +=over 4 + +=item * + +be able to edit the layout +without danger of changing the original music (Urtext), + +=item * + +allow for adding different interpretations, again, +without danger of changing the original, + +=item * + +easy to create a conductor's score, +as well as the scores for all individual instruments, + +=item * + +provide simple musical manipulations, such as +S<(i) extracting> a slice of music from a previously defined piece, +S<(ii) extracting> only the rhythm from a piece of music, +S<(iii) transposing>, etc., + +=item * + +easy to comprehend to both programmers and others. + +=back + +Musical pieces could be + +=over 5 + +=item * + +Mahlerian orchestral scores, + +=item * + +piano pieces (Schubertian, Rachmaninovian), + +=item * + +pop songs (lyrics and chords), + +=item * + +gregorian chants, + +=item * + +Bach multivoice organ pieces, + +=item * + +short excerpts to be used in musicological publications. + +=back + + +=head1 Overview + +The Musical Definition Language (Mudela) S<version 2>, +has a logical structure, +making use of typing and naming (using identifiers), +that allows for flexible input, and definition reuse. + +The below included for explanatory +purposes only (i.e., for a complete and up-to-date definition, see +F<lily/parser.y> and F<lily/lexer.l>): + +=head2 Files + +The de-facto extension of Mudela is F<.ly>. Files may be included by +entering C<include> at the start of a line: + + include "a_file.ly" + +=head2 Comments + +Line comments are introduced by a C<%> + +=head2 Words + +Keywords are preceded by a backslash "\". They contain alphabetic +characters only. + +Identifiers in their normal form consist start with a alpha character, +followed by alpha-numerics. Identifiers can contain any characters +(except whitespace, C<$> and C<%>), if you use this construct: + + $Id_with###@weird92chars = + +=head2 Nesting characters + +Mudela uses the brace (C<{> and C<}>) for hierarchical structures. To +aid the eye in reading, for chords the C<<> and the C<>> are used as +nesting braces. + +=head2 Identifiers + +=head2 Hierarchical structures + +The general structure consists of declarations: + + IDENTIFIER = \TYPE{ + <type specific data> + } + +and instantiations: + + \TYPE{ <type specific data> } + +(Currently, C<\score> is the only type that can be instantiated +at top level. Currently declarations can only be done at top level) + +Most instantiations that use an IDENTIFIER are specified as follows: + + \TYPE { IDENTIFIER [...] } + +Some exceptions on this rule have been made to prevent inputting +Mudela becoming tedious + + +=head2 Simple mudela + +The actual musical part of Mudela that defines a melody, is known as +I<simple mudela>. + +Simple mudela is the most common type of music. It consists of a list +of notes or lyrics, chords, and commands. + +=head2 Modes: + +To simplify different aspects of music definition (entering the notes +and manipulating them) Mudela has a number of different input "modes": + +=over 4 + +=item Normal mode + +At the start of parsing, Mudela assumes normal mode. +In Normal mode, a word is looked up in the following order: + + word identifier, string + \word keyword, string + +In normalmode, a word is assumed to start with an alphabetic +character, followed by alpha-numeric characters. + +=item Note mode + +Note mode (and thus Simple mudela) is introduced by the keyword C<\music>. +In Note mode, a word is looked up in the following order: + + word identifier, string + \word keyword, string + +In Note mode a word is considered to have alphabetic characters only. + +=item Lyric mode + +Lyrics mode (and thus Simple mudela) is introduced by the keyword C<\lyrics>. + +In Lyrics mode, a word is looked up in the following order: + + word string + \word keyword, string + +In Lyric mode every sequence of non-digit and non-white characters +starting with an alphabetic character is considered a word. + + a&@&@&TSI|{[ % a word + 1THtrhortho % not a "word" + Leise Fl\"u\ss{}teren meine Sapfe % 4 words + + +=back + +These modes are of a lexical nature. Normal and Note mode largely +resemble each other, save the possibility of entering Reals, and +meaning of C<_> + +=head2 Notes + +Simple mudela basically is a sequence of the notes you want to +enter. + + a'4 % dutch names + +is a A-1 pitched quaver. The ' as well as the ' signify an octave change. +A-1 is 440 Hz concert-pitch. C<c'> is also known as the central +c. More examples: + + 'a % 110 + a % 220 + a' % 440 + a'' % 880 + +another example: + + 'as4.*2/3 + +This is an A flat, (just below 110 Hz concert-pitch). The C<*2/3> +signifies that this note is part of a triplet (3 in stead of 2). The +duration is one and a half quaver (C<4.>) times 2/3. + +The default language for notenames is defined to be dutch, + + % double sharp + cisis disis eisis fisis gisis aisis bisis + % sharps + cis dis eis fis gis ais bis + % naturals + c d e f g a b + % flats + ces des es fes ges as bes + % double flats + ceses deses eses feses geses ases beses + +The standard notenames also have uppercase versions, which octavate +down: + + a % 220 concert-pitch + A % 110 + 'A % 55 + A' % 220 + Cisis + +The rest is named + + r + +These notenames along with duration are enough material to construct +simple melodies: + + c4 c4 g4 g4 a4 a4 g2 + f4 f4 e4 e4 d4 d4 c2 + +Music is able to express more. generally speaking, the other +'features' are either connected between notes (slurs, beams: spanning +requests) or attached to notes (eg. accents). The former are +implemented as START and STOP stop features and then attached to the note. + + [] START/STOP a beam + () START/STOP a slur + + +example: + + [c8 () d8 () e8 ] + +Please note that these two characters do I<not> necessarrily nest, eg: + + [c8 e8(] [)g8 c'8] + + +Symbols which can be put at either side of a staff are entered as follows: + + a-^ % marcato, direction: default + a^- % portato, direction: above note + a_. % staccato, direction: below note + a^\script { "symbolindex" . . . } % see script.ini for details. + +Dynamics can be put after the notename: + + a4 \dynamic { 0 } % 0 = fff, 7 = ppp + +Mudela defines the following dynamic identifiers: + + ppp pp p mp mf df ff fff % df iso f, f is a notename. + +The general form of a note is: + + post-requests de-octavate notename octavate duration pre-requests + +Notenames are just identifiers, and can be declared for any +language appropriate (see F<dutch.ini>). + +=head2 Defaults + +If omit the duration of a, a default value is substituted. For this +default value, there are two modes: + +=over 4 + +=item 1 + +Use the last duration explicitly entered + +=item 2 + +Use the explicitly set "default duration" + +=back + +Thus the following inputs are equivalent + + c4 c4 c16 c16 c16 s16 c4 c16 + + \duration { "last" } + c4 c c16 c c c c4 c16 + + \duration { 4 } + c c c16 c16 c16 c16 c c16 + + \duration { 16 } + c4 c4 c c c c c4 + +If you are typing music which does not lie in the "small" and "large" +octave, you can prevent having to type C<'> all the time by using the +C<\octave> command: These two notes have the same pitch. + + c'' \octave{2} c + +By default the setting of C<\octave> is 0. + +=head2 Lyrics + +Lyrics in Mudela resemble Simple mudela a lot, with notes substituted +by text. + +All syllables are entered separately, separated by whitespace + + Twin-4 kle4 twin-4 kle4 ... + +Two syllables or words that compose a single +duration entry are bound together using an underscore + + He_could4 not4 + +=head2 Music direction + +Mudela reads left to right, but LilyPond can stack voices and +Voice_elements which are produced in two directions: horizontal +(voice like) and vertical (chord like) + +You can start horizontal music by enclosing a sequence of notes with { and } + + { c c g g a a g2 } % twinkle twinkle + +You can start vertical music (a "chord") by enclosing a sequence of +notes with < and >. Example: + + <a cis e'> % a-major chord + +You can also put vertical music inside horizontal music: + + { c < c e > <c e g> <c e g c'> } % 4 increasing chords + +And vice versa + + < \multivoice + {c c g g a a g2} + {r2 r2 c c g g a a g2} > % a canon + +The duration of a chord equals the union of the durations of each of +its elements. The C<\multivoice> is a construct which is explained +below. + +=head2 Rhythms + +Rhythms in Mudela are entered identical to Simple mudela. +The melodic part of the information is ignored. + +=head1 STRUCTURE + +In concrete, a piece of Mudela has the following structure: + + % declare pieces of music: + melody = \music{ <simple mudela> } + accompany = \music{ <simple mudela> } + + % instantiate (=create tex, midi output) the score: + \score{ + \staff{ melody } + \staff{ accompany } + \commands{ <score global commands> } + \midi{ <midi definitions> } + \paper{ <paper and layout definitions } + } + +=head2 Examples + +Examples are included with the LilyPond distribution. For the sake of +maintenance no long examples are included in this document. + + +=head2 Requests + +=head2 Voice + +=head2 Voice_element + +=head2 Voice groups + +=head2 Other + +LilyPond first reads F<symbol.ini>, which contains declarations crucial +to proper operation of LilyPond (symbol tables, note names). + +=head1 HISTORY + + +This language has a number of roots. First and foremost, LilyPond's +predecessor mpp was the inspiration of simple Mudela. Secondly, the +hierarchical structure looks a lot like Rayce's (Rayce is a raytracer +that I've written as a hobby project. ), which in turn owes a lot to +POVRay. + +Now, we know, musictypesetting and raytracing do not necessarily +require the same input format, and we know that a lot more ways exist +to convert music to ASCII, but we did give this language some +thoughts. As always suggestions are appreciated. + diff --git a/INSTALL.text b/INSTALL.text index fa4c437bca..a42ca956da 100644 --- a/INSTALL.text +++ b/INSTALL.text @@ -61,7 +61,7 @@ CCCCOOOONNNNFFFFIIIIGGGGUUUURRRRIIIINNNNGGGG a -14/Mar/97 LilyPond 0.0.42 1 +24/Mar/97 LilyPond 0.0.44 1 @@ -82,7 +82,10 @@ INSTALL(1) LilyPond documentation INSTALL(1) your make is gnu make. If this is not the case, you can adjust your environment variables to your taste: - CXXFLAGS="-I /home/me/my_include -DWEIRD_FOOBAR" configure + export CPPFLAGS="-I /home/me/my_include -DWEIRD_FOOBAR" + configure + + CPPFLAGS are the preprocessor flags. the configure script is Cygnus configure, and it will accept --------hhhheeeellllpppp. If you are not root, you will probably have @@ -122,12 +125,9 @@ RRRRUUUUNNNNNNNNIIIINNNNGGGG compile. It's lot slower than most MusiXTeX preprocessors) - +o TeX - - -14/Mar/97 LilyPond 0.0.42 2 +24/Mar/97 LilyPond 0.0.44 2 @@ -136,6 +136,8 @@ RRRRUUUUNNNNNNNNIIIINNNNGGGG INSTALL(1) LilyPond documentation INSTALL(1) + +o TeX + +o The MusixTeX fonts. (I use those found in MusixTeX T.59) Please refer to the man page for more information. @@ -191,8 +193,6 @@ AAAAUUUUTTTTHHHHOOOORRRRSSSS - - -14/Mar/97 LilyPond 0.0.42 3 +24/Mar/97 LilyPond 0.0.44 3 diff --git a/NEWS b/NEWS index cb41bce2b2..7b7354de36 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,14 @@ +****** +pl 44 + - pure parser, My_lily_parser + - ''a iso ``a + - Includable_lexer + - junk Input_file + - Duration in parser, Duration restructuring + - grandiose lexer hax. Flex should be fixed, really. + Lexer much faster now. + - opps. mi2mu broken + ****** pl 43 - transposition. @@ -9,14 +20,14 @@ pl 43 pl 42.hwn3 - const naming change (T const <-> const T) - - Mudela 0.1 + - Mudela 0.1 (roughly the same as below..) pl 42.3 - moving towards Mudela 0.1: * (almost) all keywords must be preceded by backslash '\' * explicit lexer switches '$' and '@' dropped * keyword "music" dropped for horizontal music - * keywords "\lyric" "\melodic" "\rhythmic" introduced, e.g.: + * keywords "\lyric" " introduced, e.g.: melody = \melodic { c c | g g } * staff initialisable with music identifier: \staff{ melody } diff --git a/README b/README index 9042e4f255..229d052b1e 100644 --- a/README +++ b/README @@ -1,3 +1,7 @@ + +warning: the --enable-optimise compile seems to broken!! + +=================== IMPORTANT: if you have downloaded a diff --git a/TODO b/TODO index e074ce5aa6..5e14b414d8 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,6 @@ before 0.1 + + * fix -O2 -NDEBUG compile * remove spurious/outdated comments in .ly, debug .ly @@ -8,13 +10,15 @@ before 0.1 * decent TeX page layout + * per-pstaff item-widths + * remove unnecessary or confusing constructs from .ly This is an assorted collection of stuff that will be done, might be done, or is an idea that I want to think about PARSER - * Duration + * Duration-> Musical_duration, typedef Rational Duration? MAKE-STUFF @@ -89,9 +93,8 @@ SMALLISH PROJECTS * parshape - * a pure parser? - - * read from mmap directly: study yy_scan_buffer + * read from mmap directly: bugreport to flex developers-> + yy_scan_buffer in C++.. * binsearch/hash for identifiers @@ -140,6 +143,10 @@ DOC FUTURE + * slur parts as a script + + * multiple scripst. + * mixed fontsizes * put scripts on bars @@ -174,8 +181,6 @@ IDEAS * move MIDI io to a ANSI C libmidi library. - * fold indentifiers and notenames? - * itemcolumns: Use dummy items. * use an embedded language: scheme, lisp, S-lang, Perl, GUILE, ? diff --git a/flower/.version b/flower/.version index c4828f0767..ea70f79da1 100644 --- a/flower/.version +++ b/flower/.version @@ -1,6 +1,6 @@ MAJOR_VERSION = 1 MINOR_VERSION = 1 -PATCH_LEVEL = 8 +PATCH_LEVEL = 9 # use to send patches, always empty for released version: MY_PATCH_LEVEL = # include separator: "-1" or ".a" # diff --git a/flower/NEWS b/flower/NEWS index 4dd5330743..3ee8480d71 100644 --- a/flower/NEWS +++ b/flower/NEWS @@ -1,3 +1,7 @@ +pl 1.1.9 + - _C iso _c_l + - flower debug. + pl 1.1.8 diff --git a/flower/flower-debug.cc b/flower/flower-debug.cc new file mode 100644 index 0000000000..7617faaa24 --- /dev/null +++ b/flower/flower-debug.cc @@ -0,0 +1,18 @@ +#include <fstream.h> +#include "flower-debug.hh" +#include "dstream.hh" + +bool flower_check_debug=false; +ofstream null_device ( "/dev/null"); +Dstream default_flower_stream(&null_device ,"/dev/null"); +Dstream *flower_dstream = &default_flower_stream; + +/** + Set the debugging output. Will not delete/swallow argument. + */ +void set_flower_debug(Dstream&ds, bool b) +{ + flower_check_debug = b; + flower_dstream = &ds; +} + diff --git a/flower/include/flower-debug.hh b/flower/include/flower-debug.hh new file mode 100644 index 0000000000..1fe12e09e1 --- /dev/null +++ b/flower/include/flower-debug.hh @@ -0,0 +1,25 @@ +/* + flower-debug.hh -- declare + + source file of the Flower Library + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef FLOWER_DEBUG_HH +#define FLOWER_DEBUG_HH + +#include "dstream.hh" + +extern Dstream *flower_dstream; +extern bool flower_check_debug; +#ifdef NPRINT +#define fdebug if ( 0 ) *flower_dstream +#else +#define fdebug if (flower_check_debug) \ + flower_dstream->identify_as(__PRETTY_FUNCTION__) +#endif +void set_flower_debug(Dstream&ds, bool); + +#endif // FLOWER_DEBUG_HH diff --git a/flower/include/path.hh b/flower/include/path.hh index bc4d9f3776..0bed543538 100644 --- a/flower/include/path.hh +++ b/flower/include/path.hh @@ -17,7 +17,7 @@ class File_path : private Array<String> { public: /// locate a file in the search path - String find(String nm); + String find(String nm)const; /// construct using prefix. Normally argv[0]. File_path(String); @@ -26,7 +26,13 @@ public: Array<String>::push; void add(String str) { push(str); } }; -/// split path into its components +/** split a path into its components. + + @params path + + @return + String & drive, String &dirs, String &filebase, String &extension + */ void split_path(String path, String &drive, String &dirs, String &filebase, String &extension); #endif diff --git a/flower/include/string-data.hh b/flower/include/string-data.hh index ecd7159074..318f422f16 100644 --- a/flower/include/string-data.hh +++ b/flower/include/string-data.hh @@ -54,20 +54,20 @@ friend class String_handle; void tighten(); // assignment. - void set( Byte const* byte_c_l, int length_i ); + void set( Byte const* byte_C, int length_i ); - void set( char const* ch_c_l ); + void set( char const* ch_C ); /// concatenation. - void append( Byte const* byte_c_l, int length_i ); + void append( Byte const* byte_C, int length_i ); - void operator += ( char const* ch_c_l ); + void operator += ( char const* ch_C ); - char const* ch_c_l() const; + char const* ch_C() const; char* ch_l(); - Byte const* byte_c_l() const; + Byte const* byte_C() const; // idem, non const Byte* byte_l(); diff --git a/flower/include/string-data.inl b/flower/include/string-data.inl index d2b925d0ce..5a3bb390ef 100644 --- a/flower/include/string-data.inl +++ b/flower/include/string-data.inl @@ -105,29 +105,29 @@ String_data::tighten() } // assignment. INLINE void -String_data::set( Byte const* byte_c_l, int length_i ) +String_data::set( Byte const* byte_C, int length_i ) { OKW(); - assert( byte_c_l && byte_c_l != data_byte_p_); + assert( byte_C && byte_C != data_byte_p_); length_i_ = length_i; remax( length_i_ ); // copies too - memcpy( data_byte_p_, byte_c_l, length_i_ ); + memcpy( data_byte_p_, byte_C, length_i_ ); data_byte_p_[ length_i_ ] = 0; } INLINE void -String_data::set( char const* ch_c_l ) +String_data::set( char const* ch_C ) { - set( (Byte const*)ch_c_l, strlen( ch_c_l ) ); + set( (Byte const*)ch_C, strlen( ch_C ) ); } /// concatenation. INLINE void -String_data::append( Byte const* byte_c_l, int length_i ) +String_data::append( Byte const* byte_C, int length_i ) { OK(); OKW(); @@ -135,22 +135,22 @@ String_data::append( Byte const* byte_c_l, int length_i ) length_i_ += length_i; remax( length_i_ ); - memcpy( data_byte_p_ + old_i, byte_c_l, length_i ); + memcpy( data_byte_p_ + old_i, byte_C, length_i ); data_byte_p_[ length_i_ ] = 0; } INLINE void -String_data::operator += ( char const* ch_c_l ) +String_data::operator += ( char const* ch_C ) { - append( (Byte const*)ch_c_l, strlen( ch_c_l ) ); + append( (Byte const*)ch_C, strlen( ch_C ) ); } INLINE char const* -String_data::ch_c_l() const +String_data::ch_C() const { return (char const*)data_byte_p_; } @@ -161,7 +161,7 @@ String_data::ch_l() } INLINE Byte const* -String_data::byte_c_l() const +String_data::byte_C() const { return data_byte_p_; } diff --git a/flower/include/string-handle.hh b/flower/include/string-handle.hh index 5b7a12f648..3f42e860e6 100644 --- a/flower/include/string-handle.hh +++ b/flower/include/string-handle.hh @@ -38,8 +38,8 @@ public: ~String_handle(); String_handle(String_handle const & src); - Byte const* byte_c_l() const; - char const* ch_c_l() const; + Byte const* byte_C() const; + char const* ch_C() const; Byte* byte_l(); char* ch_l(); bool is_binary_bo()const; @@ -48,11 +48,11 @@ public: Byte operator[](int j) const; /** Access elements. WARNING: NOT SAFE - don't use this for loops. Use byte_c_l() + don't use this for loops. Use byte_C() */ Byte &operator[](int j); - void append( Byte const* byte_c_l, int length_i ); - void set( Byte const* byte_c_l, int length_i ); + void append( Byte const* byte_C, int length_i ); + void set( Byte const* byte_C, int length_i ); void operator = (char const *p); void trunc(int j); int length_i() const; diff --git a/flower/include/string-handle.inl b/flower/include/string-handle.inl index 1f1d44ab13..63b2ab379d 100644 --- a/flower/include/string-handle.inl +++ b/flower/include/string-handle.inl @@ -72,15 +72,15 @@ String_handle::ch_l() } INLINE Byte -const* String_handle::byte_c_l() const +const* String_handle::byte_C() const { - return data->byte_c_l(); + return data->byte_C(); } INLINE char const* -String_handle::ch_c_l() const +String_handle::ch_C() const { - return (char const*)data->byte_c_l(); + return (char const*)data->byte_C(); } INLINE void @@ -107,7 +107,7 @@ String_handle::operator[](int j) const } // !NOT SAFE! -// don't use this for loops. Use byte_c_l() +// don't use this for loops. Use byte_C() INLINE Byte & String_handle::operator[](int j) { @@ -116,17 +116,17 @@ String_handle::operator[](int j) } INLINE void -String_handle::append( Byte const* byte_c_l, int length_i ) +String_handle::append( Byte const* byte_C, int length_i ) { copy(); - data->append( byte_c_l, length_i ); + data->append( byte_C, length_i ); } INLINE void -String_handle::set( Byte const* byte_c_l, int length_i ) +String_handle::set( Byte const* byte_C, int length_i ) { copy(); - data->set( byte_c_l, length_i ); + data->set( byte_C, length_i ); } INLINE void diff --git a/flower/include/string.hh b/flower/include/string.hh index 8270e01e08..0e0b9fb4dd 100644 --- a/flower/include/string.hh +++ b/flower/include/string.hh @@ -66,7 +66,7 @@ public: /// String s = "abc"; String( char const* source ); - String( Byte const* byte_c_l, int length_i ); + String( Byte const* byte_C, int length_i ); /// "ccccc" String( char c, int n = 1 ); @@ -79,13 +79,13 @@ public: /// return a "new"-ed copy of contents Byte* copy_byte_p() const; // return a "new"-ed copy of contents - char const* ch_c_l() const; - Byte const* byte_c_l() const; + char const* ch_C() const; + Byte const* byte_C() const; char* ch_l(); Byte* byte_l(); - /// deprecated; use ch_c_l() - operator char const* () const { return ch_c_l(); } + /// deprecated; use ch_C() + operator char const* () const { return ch_C(); } String &operator =( String const & source ); diff --git a/flower/include/vector.hh b/flower/include/vector.hh index 323d03db88..fdeab97f13 100644 --- a/flower/include/vector.hh +++ b/flower/include/vector.hh @@ -7,7 +7,6 @@ class Dstream; class String; -void set_matrix_debug(Dstream&ds); /** a row of numbers. a vector. Storage is handled in Array, Vector only does the mathematics. diff --git a/flower/matdebug.cc b/flower/matdebug.cc deleted file mode 100644 index bcc2843bca..0000000000 --- a/flower/matdebug.cc +++ /dev/null @@ -1,63 +0,0 @@ -#include "dstream.hh" -#include "matrix.hh" - -static Dstream *dout = 0; - -/** - Set the debugging output. Will not delete/swallow argument. - */ -void set_matrix_debug(Dstream&ds) -{ - dout = &ds; -} - -Matrix::operator String() const -{ - String s; -#ifndef NPRINT - s="matrix {\n"; - for (int i=0; i< rows(); i++){ - for (int j = 0; j < cols(); j++) { - s+= String(dat->elem(i,j), "%6f "); - } - s+="\n"; - } - s+="}\n"; -#endif - return s; -} - - -void -Matrix::print() const -{ -#ifndef NPRINT - if (!dout) - return; - *dout << *this; -#endif -} - -Vector::operator String() const -{ - String s; -#ifndef NPRINT - s="vector ["; - for (int i=0; i < dim(); i++) { - s += String(dat[i], "%6f") + String(' '); - } - s+="]"; -#endif - return s; -} - - -void -Vector::print() const -{ -#ifndef NDEBUG - if (!dout) - return; - *dout << *this<<'\n'; -#endif -} diff --git a/flower/matrix-debug.cc b/flower/matrix-debug.cc new file mode 100644 index 0000000000..47a66896a5 --- /dev/null +++ b/flower/matrix-debug.cc @@ -0,0 +1,50 @@ +#include "flower-debug.hh" +#include "matrix.hh" + + +Matrix::operator String() const +{ + String s; +#ifndef NPRINT + s="matrix {\n"; + for (int i=0; i< rows(); i++){ + for (int j = 0; j < cols(); j++) { + s+= String(dat->elem(i,j), "%6f "); + } + s+="\n"; + } + s+="}\n"; +#endif + return s; +} + + +void +Matrix::print() const +{ +#ifndef NPRINT + fdebug << *this; +#endif +} + +Vector::operator String() const +{ + String s; +#ifndef NPRINT + s="vector ["; + for (int i=0; i < dim(); i++) { + s += String(dat[i], "%6f") + String(' '); + } + s+="]"; +#endif + return s; +} + + +void +Vector::print() const +{ +#ifndef NDEBUG + fdebug << *this<<'\n'; +#endif +} diff --git a/flower/path.cc b/flower/path.cc index c79962f00f..a0bbaca44f 100644 --- a/flower/path.cc +++ b/flower/path.cc @@ -3,6 +3,7 @@ */ #include <stdio.h> #include "path.hh" +#include "flower-debug.hh" #ifndef PATHSEP #define PATHSEP '/' @@ -60,18 +61,23 @@ File_path::File_path(String pref) in any other added path, in this order. */ String -File_path::find(String nm) +File_path::find(String nm)const + { - for (int i=0; i < size(); i++) { + fdebug << "looking for " << nm ; + for (int i=0; i < size(); i++) { + String path = (*this)[i]; path+= "/"+nm; - + fdebug << path << "? "; FILE *f = fopen(path, "r"); // ugh! if (f) { + fdebug << "found\n"; fclose(f); return path; } } - return ""; + fdebug << "\n"; + return ""; } diff --git a/flower/scalar.cc b/flower/scalar.cc index 5edd9e997f..da86835063 100644 --- a/flower/scalar.cc +++ b/flower/scalar.cc @@ -26,7 +26,7 @@ Scalar::isnum() int conv = false; if (len()) { long l =0; - conv = sscanf(strh_.ch_c_l(), "%ld", &l); + conv = sscanf(strh_.ch_C(), "%ld", &l); } return len() && conv; } diff --git a/flower/string-convert.cc b/flower/string-convert.cc index 31e7a332b8..565c332228 100644 --- a/flower/string-convert.cc +++ b/flower/string-convert.cc @@ -27,10 +27,10 @@ String String_convert::bin2hex_str( String bin_str ) { String str; - Byte const* byte_c_l = bin_str.byte_c_l(); + Byte const* byte_C = bin_str.byte_C(); for ( int i = 0; i < bin_str.length_i(); i++ ) { - str += (char)nibble2hex_byte( *byte_c_l >> 4 ); - str += (char)nibble2hex_byte( *byte_c_l++ ); + str += (char)nibble2hex_byte( *byte_C >> 4 ); + str += (char)nibble2hex_byte( *byte_C++ ); } return str; } @@ -56,7 +56,7 @@ String_convert::dec2_i( String dec_str ) return 0; long l = 0; - int conv = sscanf( dec_str.ch_c_l(), "%ld", &l ); + int conv = sscanf( dec_str.ch_C(), "%ld", &l ); assert( conv ); return (int)l; @@ -78,7 +78,7 @@ String_convert::dec2_f( String dec_str ) if ( !dec_str.length_i() ) return 0; double d = 0; - int conv = sscanf( dec_str.ch_c_l(), "%lf", &d ); + int conv = sscanf( dec_str.ch_C(), "%lf", &d ); assert( conv ); return d; } @@ -90,11 +90,11 @@ String_convert::hex2bin_i( String hex_str, String& bin_str_r ) hex_str = "0" + hex_str; bin_str_r = ""; - Byte const* byte_c_l= hex_str.byte_c_l(); + Byte const* byte_C= hex_str.byte_C(); int i = 0; while ( i < hex_str.length_i() ) { - int high_i = hex2nibble_i( *byte_c_l++ ); - int low_i = hex2nibble_i( *byte_c_l++ ); + int high_i = hex2nibble_i( *byte_C++ ); + int low_i = hex2nibble_i( *byte_C++ ); if ( high_i < 0 || low_i < 0 ) return 1; // illegal char bin_str_r += String( (char)( high_i << 4 | low_i ), 1 ); diff --git a/flower/string.cc b/flower/string.cc index 3eaa5c1b09..d66951c931 100644 --- a/flower/string.cc +++ b/flower/string.cc @@ -25,7 +25,7 @@ void* mymemmove( void* dest, void const* src, size_t n ); Byte* String::copy_byte_p() const { - Byte const* src = strh_.byte_c_l(); + Byte const* src = strh_.byte_C(); Byte* dest = new Byte[strh_.length_i() + 1]; memcpy( dest, src, strh_.length_i() + 1 ); return dest; @@ -34,7 +34,7 @@ void String::print_on(ostream& os) const { if (!strh_.is_binary_bo()) - os << ch_c_l(); + os << ch_C(); else for ( int i = 0; i < length_i(); i++ ) os << (Byte)(*this)[ i ]; @@ -94,7 +94,7 @@ String::String( Byte const* byte_l, int length_i ) void String::append(String s) { - strh_.append( s.byte_c_l(), s.length_i() ); + strh_.append( s.byte_C(), s.length_i() ); } void String::operator +=(String s) @@ -116,15 +116,15 @@ String::length_i() const } Byte const* -String::byte_c_l() const +String::byte_C() const { - return strh_.byte_c_l(); + return strh_.byte_C(); } char const* -String::ch_c_l() const +String::ch_C() const { - return strh_.ch_c_l(); + return strh_.ch_C(); } Byte* @@ -145,8 +145,8 @@ String::ch_l() int String::compare_i(String const& s1, String const& s2 ) { - Byte const* p1 = s1.byte_c_l(); - Byte const* p2 = s2.byte_c_l(); + Byte const* p1 = s1.byte_C(); + Byte const* p2 = s2.byte_C(); if ( p1 == p2 ) return 0; @@ -164,7 +164,7 @@ String::index_last_i( char const c ) const if ( !length_i() ) return -1; - char const* me = strh_.ch_c_l(); + char const* me = strh_.ch_C(); char const* p = memrchr(me, length_i(), c ); if ( p ) return p - me; @@ -202,7 +202,7 @@ String::index_last_i( char const* string ) const // UGK! int String::index_i(char c ) const { - char const* me = strh_.ch_c_l(); + char const* me = strh_.ch_C(); char const* p = (char const *) memchr( me,c, length_i()); if ( p ) return p - me; @@ -218,9 +218,9 @@ String::index_i(char c ) const int String::index_i( String searchfor ) const { - char const* me = strh_.ch_c_l(); + char const* me = strh_.ch_C(); char const* p = (char const *) memmem( - me, length_i(), searchfor.ch_c_l(), searchfor.length_i()); + me, length_i(), searchfor.ch_C(), searchfor.length_i()); if ( p ) return p - me; @@ -240,7 +240,7 @@ String::index_any_i( String set ) const if ( !n ) return -1; - void const * me_l = (void const *) strh_.ch_c_l(); + void const * me_l = (void const *) strh_.ch_C(); for (int i=0; i < set.length_i(); i++) { char * found=(char*) memchr(me_l, set[i], n ); if (found) { @@ -274,7 +274,7 @@ String::right_str( int n ) const if ( n < 1) return ""; - return String( strh_.byte_c_l() + length_i() - n, n ); + return String( strh_.byte_C() + length_i() - n, n ); } @@ -310,7 +310,7 @@ String::mid_str( int index_i, int n ) const if ( ( n > length_i() ) || ( index_i + n > length_i() ) ) n = length_i() - index_i; - return String( byte_c_l() + index_i, n ); + return String( byte_C() + index_i, n ); } String diff --git a/init/dutch.ini b/init/dutch.ini index a44eaca96b..8aed19fa95 100644 --- a/init/dutch.ini +++ b/init/dutch.ini @@ -2,41 +2,41 @@ % common dutch names for notes. "es" means flat, "is" means sharp % -ceses = \melodic { 0 0 -2 } -ces = \melodic { 0 0 -1 } -c = \melodic { 0 0 0 } -cis = \melodic { 0 0 1 } -cisis = \melodic { 0 0 2 } -deses = \melodic { 0 1 -2 } -des = \melodic { 0 1 -1 } -d = \melodic { 0 1 0 } -dis = \melodic { 0 1 1 } -disis = \melodic { 0 1 2 } -eses = \melodic { 0 2 -2 } -es = \melodic { 0 2 -1 } -e = \melodic { 0 2 0 } -eis = \melodic { 0 2 1 } -eisis = \melodic { 0 2 2 } -feses = \melodic { 0 3 -2 } -fes = \melodic { 0 3 -1 } -f = \melodic { 0 3 0 } -fis = \melodic { 0 3 1 } -fisis = \melodic { 0 3 2 } -geses = \melodic { 0 4 -2 } -ges = \melodic { 0 4 -1 } -g = \melodic { 0 4 0 } -gis = \melodic { 0 4 1 } -gisis = \melodic { 0 4 2 } -ases = \melodic { 0 5 -2 } -as = \melodic { 0 5 -1 } -a = \melodic { 0 5 0 } -ais = \melodic { 0 5 1 } -aisis = \melodic { 0 5 2 } -beses = \melodic { 0 6 -2 } -bes = \melodic { 0 6 -1 } -b = \melodic { 0 6 0 } -bis = \melodic { 0 6 1 } -bisis = \melodic { 0 6 2 } +ceses = \melodic { -1 0 -2 } +ces = \melodic { -1 0 -1 } +c = \melodic { -1 0 0 } +cis = \melodic { -1 0 1 } +cisis = \melodic { -1 0 2 } +deses = \melodic { -1 1 -2 } +des = \melodic { -1 1 -1 } +d = \melodic { -1 1 0 } +dis = \melodic { -1 1 1 } +disis = \melodic { -1 1 2 } +eses = \melodic { -1 2 -2 } +es = \melodic { -1 2 -1 } +e = \melodic { -1 2 0 } +eis = \melodic { -1 2 1 } +eisis = \melodic { -1 2 2 } +feses = \melodic { -1 3 -2 } +fes = \melodic { -1 3 -1 } +f = \melodic { -1 3 0 } +fis = \melodic { -1 3 1 } +fisis = \melodic { -1 3 2 } +geses = \melodic { -1 4 -2 } +ges = \melodic { -1 4 -1 } +g = \melodic { -1 4 0 } +gis = \melodic { -1 4 1 } +gisis = \melodic { -1 4 2 } +ases = \melodic { -1 5 -2 } +as = \melodic { -1 5 -1 } +a = \melodic { -1 5 0 } +ais = \melodic { -1 5 1 } +aisis = \melodic { -1 5 2 } +beses = \melodic { -1 6 -2 } +bes = \melodic { -1 6 -1 } +b = \melodic { -1 6 0 } +bis = \melodic { -1 6 1 } +bisis = \melodic { -1 6 2 } % @@ -44,40 +44,40 @@ bisis = \melodic { 0 6 2 } % -Ceses = \melodic { -1 0 -2 } -Ces = \melodic { -1 0 -1 } -C = \melodic { -1 0 0 } -Cis = \melodic { -1 0 1 } -Cisis = \melodic { -1 0 2 } -Deses = \melodic { -1 1 -2 } -Des = \melodic { -1 1 -1 } -D = \melodic { -1 1 0 } -Dis = \melodic { -1 1 1 } -Disis = \melodic { -1 1 2 } -Eses = \melodic { -1 2 -2 } -Es = \melodic { -1 2 -1 } -E = \melodic { -1 2 0 } -Eis = \melodic { -1 2 1 } -Eisis = \melodic { -1 2 2 } -Feses = \melodic { -1 3 -2 } -Fes = \melodic { -1 3 -1 } -F = \melodic { -1 3 0 } -Fis = \melodic { -1 3 1 } -Fisis = \melodic { -1 3 2 } -Geses = \melodic { -1 4 -2 } -Ges = \melodic { -1 4 -1 } -G = \melodic { -1 4 0 } -Gis = \melodic { -1 4 1 } -Gisis = \melodic { -1 4 2 } -Ases = \melodic { -1 5 -2 } -As = \melodic { -1 5 -1 } -A = \melodic { -1 5 0 } -Ais = \melodic { -1 5 1 } -Aisis = \melodic { -1 5 2 } -Beses = \melodic { -1 6 -2 } -Bes = \melodic { -1 6 -1 } -B = \melodic { -1 6 0 } -Bis = \melodic { -1 6 1 } -Bisis = \melodic { -1 6 2 } +Ceses = \melodic { -2 0 -2 } +Ces = \melodic { -2 0 -1 } +C = \melodic { -2 0 0 } +Cis = \melodic { -2 0 1 } +Cisis = \melodic { -2 0 2 } +Deses = \melodic { -2 1 -2 } +Des = \melodic { -2 1 -1 } +D = \melodic { -2 1 0 } +Dis = \melodic { -2 1 1 } +Disis = \melodic { -2 1 2 } +Eses = \melodic { -2 2 -2 } +Es = \melodic { -2 2 -1 } +E = \melodic { -2 2 0 } +Eis = \melodic { -2 2 1 } +Eisis = \melodic { -2 2 2 } +Feses = \melodic { -2 3 -2 } +Fes = \melodic { -2 3 -1 } +F = \melodic { -2 3 0 } +Fis = \melodic { -2 3 1 } +Fisis = \melodic { -2 3 2 } +Geses = \melodic { -2 4 -2 } +Ges = \melodic { -2 4 -1 } +G = \melodic { -2 4 0 } +Gis = \melodic { -2 4 1 } +Gisis = \melodic { -2 4 2 } +Ases = \melodic { -2 5 -2 } +As = \melodic { -2 5 -1 } +A = \melodic { -2 5 0 } +Ais = \melodic { -2 5 1 } +Aisis = \melodic { -2 5 2 } +Beses = \melodic { -2 6 -2 } +Bes = \melodic { -2 6 -1 } +B = \melodic { -2 6 0 } +Bis = \melodic { -2 6 1 } +Bisis = \melodic { -2 6 2 } diff --git a/input/cadenza.ly b/input/cadenza.ly index ebef5ed7a1..8e8b5e8c73 100644 --- a/input/cadenza.ly +++ b/input/cadenza.ly @@ -24,25 +24,25 @@ cad = \music { \bar \empty r8 [c d] [e f g gis] \duration{4} - a-> `f()`e g - f-> `d()`cis e + a-> 'f()'e g + f-> 'd()'cis e \duration{8} d4^\fermata \bar \empty - r8 `a [`b cis] + r8 'a ['b cis] \duration{16} [d cis d e] f4()[f e d c] - `b4 + 'b4 \octave{} [d'8 c'8 a8]2/3 g2 \bar \empty [g c e g] [c' e g c']\octave{'} - [e `g c e] g4^\fermata %()% BUG! + [e 'g c e] g4^\fermata %()% BUG! \bar \empty [g8.(_"a \tempo" e g8. )e] a4. g8 [f8 e8 d8 c8] - `g2 d2^"tr" + 'g2 d2^"tr" c4 } diff --git a/input/coriolan-alto.ly b/input/coriolan-alto.ly index ad468d0573..eed877bb8c 100644 --- a/input/coriolan-alto.ly +++ b/input/coriolan-alto.ly @@ -34,7 +34,7 @@ alto = \music { } %30:2 { - \octave{ ` } + \octave{ -1 } \textstyle "italic" % this should be a \dynamic, rather than text [ c c_"cresc. \ \ - \ \ \ \ - \ \ \ \ - \ \ \ \ @@ -61,7 +61,7 @@ alto = \music { < \multivoice { \stem{ 1 }[ c16^"div." c16 c16 c16 ] c4 c2 } { - \octave{ ` } + \octave{ -1 } \textstyle "italic" \stem{ -1 } [ as16_"\ff" as16 as16 as16 ] as4_"simile" as2 \textstyle "roman" diff --git a/input/error.ly b/input/error.ly index 570300af98..9a432233b0 100644 --- a/input/error.ly +++ b/input/error.ly @@ -1,7 +1,7 @@ include "this-is-hopefully-a-nonexisting-file" mwa = \music { - + \meter{3/4} [ a8 a8 a8 a8 a8 ] % [ a8 ] % % segfault @@ -13,33 +13,27 @@ mwa = \music { a b c ||| % abc % ok; print error, no \output - \bla % no warning-> this STRING, reduced to lyric_elt. + \bla % STRING, reduced to lyric_elt. a [ b % warning, still \output - { a( b } % warning, still \output + < a( b > % warning, still \output a b ,c a b c-* a b c& - { a-. b-. } + < a-. b-. > } -bla = \music { - @ +bla = \lyrics { These Gates will open just like windows. % ok; warning - @ } include "this-is-hopefully-a-nonexisting-file" - -score { +\score { \staff { lyric \music { bla } } \staff { \melodic \music { mwa } } - \co\mmands { - \meter {3/4} - } } diff --git a/input/fugue1.midi.ly b/input/fugue1.midi.ly index 630b94a4ba..7ebb6970f4 100644 --- a/input/fugue1.midi.ly +++ b/input/fugue1.midi.ly @@ -54,7 +54,7 @@ track2 = \music { % instrument: c8 d8 e8 f8. { \music{ g16 } } { \music{ f16 } } { \music{ e8 } } a8 d8 { \music{ g8. } } a16 g16 f16 - e16 f16 e16 d16 c16 d16 c16 `b16 `a8 fis8 { \music{ + e16 f16 e16 d16 c16 d16 c16 'b16 'a8 fis8 { \music{ g4. } } f16 e16 f8 d8 g8 f8 e8 d8 g4 f16 e16 f4 f16 e8 d4 c8 f8 g16 f16 e16 f8 d8 g4.. g8 a8 b8 { \music{ c'8. } } { \music{ d'16 } } { \music{ c'16 } @@ -83,52 +83,52 @@ track2 = \music { track3 = \music { % \midi copyright: % instrument: - `g8 `a8 `b8 c8. { \music{ d16 } } { \music{ c16 } } - { \music{ `b8 } } e8 `a8 { \music{ d8. } } e16 d16 - c16 `b8 c4 `ais8 `a8 d8 `g8 c8 `a16 `b16 c16 d4 `g4 - `g8 `a8 `b8 c8. { \music{ d16 } } { \music{ c16 } } - { } `b8 e8 `a8 d8. e16 d16 c16 `b8 e4. d4 `b16 c16 - `a16 e16 d16 c16 `b16 c16 `a16 `b16 c16 d16 c16 - `b16 `a16 `g4 `e8 `fis8 `gis8 `a8. { \music{ `b16 } - } { \music{ `a16 } } { \music{ `g8 } } c8 `fis8 - `b8. c16 `b16 `a16 `gis8 { \music{ `a4 } } `gis8 - `a4 `g8 `a8 `b8 c8. { \music{ d16 } } { \music{ c16 - } } { \music{ `b8 } } e8 `a8 d4 `g8 d4 c8 `a8 e4 d8 - `a8 `b8 cis8 d8. { \music{ e16 } } { \music{ d16 } - } { \music{ c8 } } f8 `b8 e8. f16 e16 d16 cis8 `a8 - `b8 cis8 d8. { \music{ e16 } } { \music{ d16 } } { - \music{ c8 } } fis8 `b8 e8. fis16 e16 d16 c4.. d16 - c16 `b16 `a16 `g16 `a16 `fis16 `g8 `b8 c8 { \music{ + 'g8 'a8 'b8 c8. { \music{ d16 } } { \music{ c16 } } + { \music{ 'b8 } } e8 'a8 { \music{ d8. } } e16 d16 + c16 'b8 c4 'ais8 'a8 d8 'g8 c8 'a16 'b16 c16 d4 'g4 + 'g8 'a8 'b8 c8. { \music{ d16 } } { \music{ c16 } } + { } 'b8 e8 'a8 d8. e16 d16 c16 'b8 e4. d4 'b16 c16 + 'a16 e16 d16 c16 'b16 c16 'a16 'b16 c16 d16 c16 + 'b16 'a16 'g4 'e8 'fis8 'gis8 'a8. { \music{ 'b16 } + } { \music{ 'a16 } } { \music{ 'g8 } } c8 'fis8 + 'b8. c16 'b16 'a16 'gis8 { \music{ 'a4 } } 'gis8 + 'a4 'g8 'a8 'b8 c8. { \music{ d16 } } { \music{ c16 + } } { \music{ 'b8 } } e8 'a8 d4 'g8 d4 c8 'a8 e4 d8 + 'a8 'b8 cis8 d8. { \music{ e16 } } { \music{ d16 } + } { \music{ c8 } } f8 'b8 e8. f16 e16 d16 cis8 'a8 + 'b8 cis8 d8. { \music{ e16 } } { \music{ d16 } } { + \music{ c8 } } fis8 'b8 e8. fis16 e16 d16 c4.. d16 + c16 'b16 'a16 'g16 'a16 'fis16 'g8 'b8 c8 { \music{ d8 } } e8. { \music{ f16 } } { \music{ e16 } } { \music{ d8 } } g8 c8 f8. g16 f16 e16 d4 e8 d4 { - \music{ `g8 } } `g4. `c8 `d8 `e8 `f8. { \music{ - `g16 } } { \music{ `f16 } } { \music{ `e8 } } `a8 - `d8 { \music{ `g8. } } `a16 `g16 `f16 `e16 `d16 - `e16 `f16 `g16 `a16 `ais16 `g16 `a16 `e16 `f16 `g16 - `a16 `b16 c16 { \music{ `a16 } \music{ d2 } } c1 + \music{ 'g8 } } 'g4. 'c8 'd8 'e8 'f8. { \music{ + 'g16 } } { \music{ 'f16 } } { \music{ 'e8 } } 'a8 + 'd8 { \music{ 'g8. } } 'a16 'g16 'f16 'e16 'd16 + 'e16 'f16 'g16 'a16 'ais16 'g16 'a16 'e16 'f16 'g16 + 'a16 'b16 c16 { \music{ 'a16 } \music{ d2 } } c1 } % track3 track4 = \music { % \midi copyright: % instrument: - `c8 `d8 `e8 `f8. { \music{ `g16 } } { \music{ `f16 } - } { \music{ `e8 } } `a8 `d8 { \music{ `g8. } } - `a16 `g16 `f16 `e16 `f16 `e16 `d16 `c16 `d16 `c16 - ``b16 ``a8 `d8 `a8 `fis8 `g16 `a16 `ais16 `g16 - `cis8 `d8 `a4 `e4 `a16 `b16 c16 d16 c16 `b16 `a16 - `g16 c8 ``g8 ``a8 ``b8 `c8. { \music{ `d16 } } { - \music{ `c16 } } { \music{ ``b8 } } `e8 ``a8 `d8. - `e16 `d16 `c16 { \music{ ``b8 } } `e4 `d8 `c8 `f4 - `e4 `d4 `e8 `f8 `e16 `d16 `e4 ``a4 ``g8 ``a8 ``b8 - `c8. { \music{ `d16 } } { \music{ `c16 } } { \music{ - ``b8 } } `e8 ``a8 `d8. `e16 `d16 `c16 ``b8 ai``s8 - ``a8 ``g8 ``a8 `fis8 `g8 `e8 `d4 `e8 `f8 `g8. { - \music{ `a16 } } { \music{ `g16 } } { \music{ `f8 } - } `ais8 `e8 `a8. `b16 { \music{ `a16 } } `g16 `f16 - `e16 `f16 `d16 `g8 `a8 `d4.. `e16 `d16 `c16 ``b16 - ``a16 ``g16 fi``s16 ``e8 `e8 `fis8 `g4 `a16 `g16 - `fis8 `d8 `g1 `a4 `b8 c8 `f16 `a16 `g16 `f16 `e16 - `d16 `c16 ``b16 `c16 `d16 `e16 `f16 `g8 ``g8 `b2 + 'c8 'd8 'e8 'f8. { \music{ 'g16 } } { \music{ 'f16 } + } { \music{ 'e8 } } 'a8 'd8 { \music{ 'g8. } } + 'a16 'g16 'f16 'e16 'f16 'e16 'd16 'c16 'd16 'c16 + ''b16 ''a8 'd8 'a8 'fis8 'g16 'a16 'ais16 'g16 + 'cis8 'd8 'a4 'e4 'a16 'b16 c16 d16 c16 'b16 'a16 + 'g16 c8 ''g8 ''a8 ''b8 'c8. { \music{ 'd16 } } { + \music{ 'c16 } } { \music{ ''b8 } } 'e8 ''a8 'd8. + 'e16 'd16 'c16 { \music{ ''b8 } } 'e4 'd8 'c8 'f4 + 'e4 'd4 'e8 'f8 'e16 'd16 'e4 ''a4 ''g8 ''a8 ''b8 + 'c8. { \music{ 'd16 } } { \music{ 'c16 } } { \music{ + ''b8 } } 'e8 ''a8 'd8. 'e16 'd16 'c16 ''b8 ai''s8 + ''a8 ''g8 ''a8 'fis8 'g8 'e8 'd4 'e8 'f8 'g8. { + \music{ 'a16 } } { \music{ 'g16 } } { \music{ 'f8 } + } 'ais8 'e8 'a8. 'b16 { \music{ 'a16 } } 'g16 'f16 + 'e16 'f16 'd16 'g8 'a8 'd4.. 'e16 'd16 'c16 ''b16 + ''a16 ''g16 fi''s16 ''e8 'e8 'fis8 'g4 'a16 'g16 + 'fis8 'd8 'g1 'a4 'b8 c8 'f16 'a16 'g16 'f16 'e16 + 'd16 'c16 ''b16 'c16 'd16 'e16 'f16 'g8 ''g8 'b2 } % track4 score { diff --git a/input/kortjakje.ly b/input/kortjakje.ly index d26a7431bf..36cfbb1246 100644 --- a/input/kortjakje.ly +++ b/input/kortjakje.ly @@ -38,17 +38,17 @@ begeleiding = % you to precede \keyword by a backslash: \ \music { \clef "bass" - \octave { ` } % default \octave: 1 below the first \octave. + \octave { ' } % default \octave: 1 below the first \octave. %%% theme - `c % ` means one \octave lower. + 'c % ' means one \octave lower. % Similarly: ' means one higher. - c e c f c e c d `b c `a `f `g `c2 - \octave { ` } - e `g d `g c `g `b `g e `g d `g c `g `b `g + c e c f c e c d 'b c 'a 'f 'g 'c2 + \octave { ' } + 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 - r8 d8()`b r8 c8()`a r8 `a8()`f r8 `e8()`c + r8 d8()'b r8 c8()'a r8 'a8()'f r8 'e8()'c } diff --git a/input/maartje.ly b/input/maartje.ly index ce3425fbb3..64fa7166ec 100644 --- a/input/maartje.ly +++ b/input/maartje.ly @@ -44,7 +44,7 @@ melody= \duration {4} < - { c () `bes [c8 c8] } + { c () 'bes [c8 c8] } { fis' ()gisis' fis8 fis8 } { d () d dis8 dis8 } { a () bes eis8 eis8 } @@ -55,11 +55,11 @@ melody= [d8 e8 f'8 g8] d8 e8 f8 g8 |fis''2 - | a8 b8 c'8 d'8 |c''8 ```c8 c4 |c4 c4 |c4 - \duration{ 16 } `b `a `g `f \duration{ 4} + | a8 b8 c'8 d'8 |c''8 '''c8 c4 |c4 c4 |c4 + \duration{ 16 } 'b 'a 'g 'f \duration{ 4} \clef\bass - |c `b `a `g `f `e `d `c ``b ``a ``g ``f ``e ``d ``c + |c 'b 'a 'g 'f 'e 'd 'c ''b ''a ''g ''f ''e ''d ''c } } diff --git a/input/midi.ly b/input/midi.ly index 4382ed3bf2..08c6ce4755 100644 --- a/input/midi.ly +++ b/input/midi.ly @@ -11,7 +11,7 @@ melodie = \music { begeleiding = \music { \clef \bass - \octave{`} + \octave{-1} c c' | e' c' | f' c' | e' c' d' b | c' a | f g | c2 | diff --git a/input/mlalt.ly b/input/mlalt.ly index 50563fef84..3e0e419e4a 100644 --- a/input/mlalt.ly +++ b/input/mlalt.ly @@ -18,63 +18,63 @@ alto = \music { \octave{} \key{fis} %1 - [ `b8. `a ] [ `g8 `b c ] | + [ 'b8. 'a ] [ 'g8 'b c ] | %2 [ d8 g8 ] d4 | %3 [ e fis g a ] d4 | %4 - [ c `b `a `b ] `b4 | + [ c 'b 'a 'b ] 'b4 | %5=1 - [ `b8. `a ] [ `g8 `b c ] | + [ 'b8. 'a ] [ 'g8 'b c ] | %6=2 [ d8 g8 ] d4 | %7 - [ c `b `a `g ] [ `fis `e `d `c ] | + [ c 'b 'a 'g ] [ 'fis 'e 'd 'c ] | %8 - [ `d8. `e ] [ `d `fis `a c ] | + [ 'd8. 'e ] [ 'd 'fis 'a c ] | %9=1 - [ `b8. `a ] [ `g8 `b c ] | + [ 'b8. 'a ] [ 'g8 'b c ] | %10 - [ d8 `d8 ] d4 | + [ d8 'd8 ] d4 | %11=4 - [ c `b `a `b ] `b4 | + [ c 'b 'a 'b ] 'b4 | %12 - [ `a8 d8 ] `b4 | + [ 'a8 d8 ] 'b4 | %13 - [ d8. c ] [ `b8 `a `g ] | + [ d8. c ] [ 'b8 'a 'g ] | %14=10 - [ d8 `d8 ] d4 | + [ d8 'd8 ] d4 | %15 [ e8 fis8 ] [ g8 d8 ] | %16 \textstyle "italic" - [ c `a `fis `d ] `g4_"fine" | + [ c 'a 'fis 'd ] 'g4_"fine" | \textstyle "roman" % \scoreverb{\mulooseness=-1} % \newline %17 %=1 - [ `b8. `a ] [ `g8 `b c ] | + [ 'b8. 'a ] [ 'g8 'b c ] | %18=2 [ d8 g8 ] d4 | %19=3 [ e fis g a ] d4 | %20=4 - [ c `b `a `b ] `b4 | + [ c 'b 'a 'b ] 'b4 | %21=5=1 - [ `b8. `a ] [ `g8 `b c ] | + [ 'b8. 'a ] [ 'g8 'b c ] | %22=6=2 [ d8 g8 ] d4 | %23=20=4 - [ c `b `a `b ] `b4 | + [ c 'b 'a 'b ] 'b4 | %24 - [ `a8. `g ] [ `a cis e g ] | + [ 'a8. 'g ] [ 'a cis e g ] | %first modulation %25 [ fis8. e ] [ d8 fis g ] | %26 - [ a8 `a8 ] a4 | + [ a8 'a8 ] a4 | %27 [ g fis e fis ] fis4 | %28 @@ -82,44 +82,44 @@ alto = \music { %29 [ a8. g ] [ fis8 e d ] | %30 - [ a8 `a8 ] a4 | + [ a8 'a8 ] a4 | %31 [ b8 cis'8 ] [ d'8 a8 ] | %32 - [ g e cis `a ] d4 | + [ g e cis 'a ] d4 | %variant a %33 - [ `b8 `g `g ] [ `g8 `b c ] | + [ 'b8 'g 'g ] [ 'g8 'b c ] | %34 - [ d8 `g `g ] `g4 | + [ d8 'g 'g ] 'g4 | %35 - [ e8 `g `g ] [ `g8 e fis ] | + [ e8 'g 'g ] [ 'g8 e fis ] | %36 [ g8. fis32 e32 ] d4 | %37 - [ e8 c c ] [ c8 `b `a ] | + [ e8 c c ] [ c8 'b 'a ] | %38 - [ d8 `b `b ] [ `b8 `a `g ] | + [ d8 'b 'b ] [ 'b8 'a 'g ] | %39 - [ c8 `a `a ] [ `a8 `b `a ] | + [ c8 'a 'a ] [ 'a8 'b 'a ] | %40 - `a4 `g4 | + 'a4 'g4 | %41 - [ `g8 `a `g ] [ d8 e d ] | + [ 'g8 'a 'g ] [ d8 e d ] | %42 - [ `g8 `a `g ] [ g8 e8 ] | + [ 'g8 'a 'g ] [ g8 e8 ] | %43 - [ d8 e d ] [ d8 c `b ] | + [ d8 e d ] [ d8 c 'b ] | %44 - [ `b8. c32 `b32 ] `a4 | + [ 'b8. c32 'b32 ] 'a4 | %45 - [ `g `a `g `a `g `a ]4/6 [ `g `b c d e fis ]4/6 | + [ 'g 'a 'g 'a 'g 'a ]4/6 [ 'g 'b c d e fis ]4/6 | %46 - [ g fis e d `b `g ]4/6 [ `a8 `g8 ] | + [ g fis e d 'b 'g ]4/6 [ 'a8 'g8 ] | %47 - [ g fis e d c `b ]4/6 [ e d c `b `a `g ]4/6 | + [ g fis e d c 'b ]4/6 [ e d c 'b 'a 'g ]4/6 | %48 - [ d e d d `b `g ]4/6 [ `a8 `g8 ] | + [ d e d d 'b 'g ]4/6 [ 'a8 'g8 ] | %theme 2 \duration{8} %49 @@ -127,7 +127,7 @@ alto = \music { %50 [ e d c ]2/3 e4 | %51 - [ d g `g ]2/3 [ `g `a `b ]2/3 | + [ d g 'g ]2/3 [ 'g 'a 'b ]2/3 | %52 d4 e4 | %53 @@ -135,31 +135,31 @@ alto = \music { %54 [ e d c ]2/3 e4 | %55 - [ d g `g ]2/3 [ `g `a `b ]2/3 | + [ d g 'g ]2/3 [ 'g 'a 'b ]2/3 | %56 - `b4 c4 \key{bes es as} | % || \key\Es + 'b4 c4 \key{bes es as} | % || \key\Es %57 - [ `b d ] [ `g `b ] | + [ 'b d ] [ 'g 'b ] | %58 - [ c es ] [ `g c ] | + [ c es ] [ 'g c ] | %59 - [ d f ] [ `g f ] | + [ d f ] [ 'g f ] | %60 [ es16 d16 es16 f16 ] g4 | %61 [ as f ] [ d as ] | %62 - [ g es ] [ c `as ] | + [ g es ] [ c 'as ] | %63 - [ `g `b ] [ es d ] | + [ 'g 'b ] [ es d ] | %64 - [ c8. `g32 `es32 ] `c4 | % || \meter{6/8} + [ c8. 'g32 'es32 ] 'c4 | % || \meter{6/8} %65 es4.( [ )es d c ] | %66 es2. | %67 - d4.( [ )d c `b ] | + d4.( [ )d c 'b ] | %68 d2. | %69 @@ -174,21 +174,21 @@ alto = \music { c r4 r4. | % || \meter{2/4} %73 \duration{8} - [ `b d ] [ `g `b ] | + [ 'b d ] [ 'g 'b ] | %74 - [ c es ] [ `g c ] | + [ c es ] [ 'g c ] | %75 - [ d f ] [ `g f ] | + [ d f ] [ 'g f ] | %76 [ es16 d16 es16 f16 ] g4 | %77 [ as f ] [ d as ] | %78 - [ g es ] [ c `as ] | + [ g es ] [ c 'as ] | %79 - [ `g `b ] [ es d ] | + [ 'g 'b ] [ es d ] | %80 - [ c8. `g32 `es32 ] `c4 | + [ c8. 'g32 'es32 ] 'c4 | %81 g4 [ as g ] | %82 @@ -199,11 +199,11 @@ alto = \music { %84 [ as g f g ] as4 | %85 - f4 [ f des c `bes ] | + f4 [ f des c 'bes ] | %86 - `a2 | + 'a2 | %87 - `b2 | + 'b2 | %88 \textstyle "italic" c2_"dacapo" \key{fis} | diff --git a/input/mlcello.ly b/input/mlcello.ly index c513a366ea..76d9519123 100644 --- a/input/mlcello.ly +++ b/input/mlcello.ly @@ -13,13 +13,13 @@ % cello = \music { -\clef"bass" \octave{`} +\clef"bass" \octave{'} \duration{4} \key{fis} %%1 - g `g | + g 'g | %%2 - [ `g8. `a16 ] ``b | + [ 'g8. 'a16 ] ''b | %%3 c d | %%4 @@ -27,15 +27,15 @@ cello = \music { %%5=1 e2 | %%6=2 - [ `g8. `a16 ] ``b | + [ 'g8. 'a16 ] ''b | %%7 c d | %%8 - `g d | + 'g d | %%9=1 - `g2 | + 'g2 | %%10 - `g ``b | + 'g ''b | %%11=4 e [ g16 fis16 e16 d16( ] | %%12 @@ -45,16 +45,16 @@ cello = \music { %%14=10 [ d8 d'8 ] g | %%15 - [ c8 e8 ] [ g8 `g8 ] | + [ c8 e8 ] [ g8 'g8 ] | %%16 \textstyle "italic" [ d8 c'8 ] b_"fine" \textstyle "roman" | % \newline %%17=1 - g `g | + g 'g | %%18=2 - [ `g8. `a16 ] ``b | + [ 'g8. 'a16 ] ''b | %%19=3 c d | %%20=4 @@ -62,73 +62,73 @@ cello = \music { %%21=5=1 e2 | %%22=6=2 - [ `g8. `a16 ] ``b | + [ 'g8. 'a16 ] ''b | %%23=4 c g | %%24 - a `a | + a 'a | %%25 d2 | %%first modulation %%26 - d `fis | + d 'fis | %%27 - ``b [ dis16 c16 ``b16 `a16( ] | + ''b [ dis16 c16 ''b16 'a16( ] | %%28 - ) `a d | + ) 'a d | %%29 \duration{8} - [ `a a ] d4 | + [ 'a a ] d4 | %%30 - [ `a a ] d4 | + [ 'a a ] d4 | %%31 - [ `g ``b ] [ d `d ] | + [ 'g ''b ] [ d 'd ] | %%32 - [ `a a ] d4 | + [ 'a a ] d4 | %%variant a %%33 \duration{16} - [ `g8 `g `g ] [ `g8 `g `g ] | + [ 'g8 'g 'g ] [ 'g8 'g 'g ] | %%34 - [ `g8 `g `g ] g4 | + [ 'g8 'g 'g ] g4 | %%35 [ c8 c c ] [ c8 c' c' ] | %%36 g4 b4 | %%37 - [ a8 a a ] [ `a8 `a `a ] | + [ a8 a a ] [ 'a8 'a 'a ] | %%38 - [ ``b8 ``b ``b ] [ ``b8 ``b ``b ] | + [ ''b8 ''b ''b ] [ ''b8 ''b ''b ] | %%39 - [ `a8 `a `a ] [ `a8 `a `a ] | + [ 'a8 'a 'a ] [ 'a8 'a 'a ] | %%40 - `d4 `g4 | + 'd4 'g4 | %%41 \duration{8} \textstyle "italic" r_"pizz" \textstyle "roman" - g r `g | + g r 'g | %%42 r g e4 | %%43 - r b r ``b | + r b r ''b | %%44 r e a4 | %%45 r e r e | %%46 - r ``b [ d g ] | + r ''b [ d g ] | %%47 - r e r `a | + r e r 'a | %%48 - r ``b - [ `d `g ] | + r ''b + [ 'd 'g ] | %%theme 2 %%49 \textstyle "italic" r4_"arco" - [ `g `g `g ]2/3 | + [ 'g 'g 'g ]2/3 | \textstyle "roman" %%50 r4 [ c c c ]2/3 | @@ -137,37 +137,37 @@ cello = \music { %%52 c2 | %%53 - r4 [ `g `g `g ]2/3 | + r4 [ 'g 'g 'g ]2/3 | %%54 r4 [ c c c ]2/3 | %%55 g2 | %%56 - `g4 `c4 \key{bes es as}| -% \key\`es || + 'g4 'c4 \key{bes es as}| +% \key\'es || %%57 g r g r | %%58 c r c r | %%59 - `g r `g r | + 'g r 'g r | %%60 c r c r | %%61 - d4. ``b | + d4. ''b | %%62 c2 | %%63 - g4 `g4 | + g4 'g4 | %%64 - c4 `c4 | + c4 'c4 | % \meter{6/8} || %%65 [ c c c ] c4. | %%66 - [ `c `c `c ] `c4. | + [ 'c 'c 'c ] 'c4. | %%67 - [ `g `g `g ] `g4. | + [ 'g 'g 'g ] 'g4. | % \newline %%68 [ g g g ] g4. | @@ -185,28 +185,28 @@ cello = \music { %%74 c r c r | %%75 - `g r `g r | + 'g r 'g r | %%76 c r c4 | %%77 - d4. ``b | + d4. ''b | %%78 c2 | %%79 - g4 `g4 | + g4 'g4 | %%80 - c4 `c4 | + c4 'c4 | %%81 \duration{2} - `c | + 'c | %%82 - `c | + 'c | %%83 - `e | + 'e | %%84 - `f | + 'f | %%85 - `as | + 'as | %%86 c | %%87 @@ -215,6 +215,6 @@ cello = \music { \textstyle "italic" d_"dacapo" \key{fis} | \textstyle "roman" -% \key\`g || +% \key\'g || } diff --git a/input/mlvio1.ly b/input/mlvio1.ly index 9b3bf05604..0ef0d07821 100644 --- a/input/mlvio1.ly +++ b/input/mlvio1.ly @@ -65,7 +65,7 @@ violinI = \music { %22=6 g2 | %23=4 - e [ d16 c16 `b16 c16 ] | + e [ d16 c16 'b16 c16 ] | %24 cis cis' | %25 @@ -151,9 +151,9 @@ violinI = \music { c' r c'4 | %61 \duration{16} - [ as f d f as d' ]4/6 [ as f d `as d f ]4/6 | + [ as f d f as d' ]4/6 [ as f d 'as d f ]4/6 | %62 - [ g es c `g c es ]4/6 [ g c' es' c' g es ]4/6 | + [ g es c 'g c es ]4/6 [ g c' es' c' g es ]4/6 | %63 [ g d g bes d' g' ]4/6 [ f' d' bes g f d ]4/6 | %64 @@ -187,9 +187,9 @@ violinI = \music { c' r c'4 | %77 \duration{16} - [ as f d f as d' ]4/6 [ as f d `as d f ]4/6 | + [ as f d f as d' ]4/6 [ as f d 'as d f ]4/6 | %78 - [ g es c `g c es ]4/6 [ f c' es' c' g es ]4/6 | + [ g es c 'g c es ]4/6 [ f c' es' c' g es ]4/6 | %79 [ g d f b d' g' ]4/6 [ f' d' b g f d ]4/6 | %80 diff --git a/input/mlvio2.ly b/input/mlvio2.ly index 74940775cb..9f87985537 100644 --- a/input/mlvio2.ly +++ b/input/mlvio2.ly @@ -19,7 +19,7 @@ violinII = \music { %1 d2 | %2 - [ `b8. `a16 ] `g4 | + [ 'b8. 'a16 ] 'g4 | %3 [ g8 e8 ] fis | %4 @@ -27,17 +27,17 @@ violinII = \music { %5=1 e2 | %6=2 - [ `b8. `a16 ] `g4 | + [ 'b8. 'a16 ] 'g4 | %7 - `g `a | + 'g 'a | %8 - `b `a | + 'b 'a | %9=1 d2 | %10 - `b `g | + 'b 'g | %11=4 - `g2 | + 'g2 | %12 [ d8 e16 fis16 ] g | %13 @@ -54,7 +54,7 @@ violinII = \music { %17=1 d2 | %18=2 - [ `b8. `a16 ] `g4 | + [ 'b8. 'a16 ] 'g4 | %19=3 [ g8 e8 ] fis | %20=4 @@ -62,9 +62,9 @@ violinII = \music { %21=5=1 e2 | %22=6=2 - [ `b8. `a16 ] `g4 | + [ 'b8. 'a16 ] 'g4 | %23=4 - `g2 | + 'g2 | %24 cis e | %25 @@ -107,9 +107,9 @@ violinII = \music { \textstyle "italic" r_"pizz" \textstyle "roman" - `b r `b | + 'b r 'b | %42 - r `b `g4 | + r 'b 'g4 | %43 r fis r fis | %44 @@ -144,9 +144,9 @@ violinII = \music { f4 e4 \key{bes es as}| % \key\Es || %57 - d r `b r | + d r 'b r | %58 - `g r es r | + 'g r es r | %59 g r g r | %60 @@ -156,7 +156,7 @@ violinII = \music { %62 es2 | %63 - `b d4. | + 'b d4. | %64 es2 | % \meter{6/8} || @@ -164,9 +164,9 @@ violinII = \music { \duration{8} [ c c c ] c4. | %66 - [ `g `g `g ] `g4. | + [ 'g 'g 'g ] 'g4. | %67 - [ `b8 `b `b ] `b4. | + [ 'b8 'b 'b ] 'b4. | %68 [ g g g ] g4. | %69 @@ -179,9 +179,9 @@ violinII = \music { es r4 r4. | %73 % \meter{2/4} || - d r `b r | + d r 'b r | %74 - `g r es r | + 'g r es r | %75 g r g r | %76 @@ -192,7 +192,7 @@ violinII = \music { %78 es | %79 - `b8 d4. | + 'b8 d4. | %80 es | %81 diff --git a/input/pre1.midi.ly b/input/pre1.midi.ly index 3945d68be8..132410ba9a 100644 --- a/input/pre1.midi.ly +++ b/input/pre1.midi.ly @@ -37,36 +37,36 @@ track1 = \music { b16 d16 f16 b16 } } { \music{ d16 f16 b16 d16 f16 b16 } } { \music{ c16 g16 c'16 c16 g16 c'16 } } { \music{ c16 g16 c'16 c16 g16 c'16 } } { \music{ - `a16 c16 f16 `a16 c16 f16 } } { \music{ `a16 c16 - f16 `a16 c16 f16 } } { \music{ `a16 c16 f16 `a16 - c16 f16 } } { \music{ `a16 c16 f16 `a16 c16 f16 } } - { \music{ `g16 `b16 f16 `g16 `b16 f16 } } { \music{ - `g16 `b16 f16 `g16 `b16 f16 } } { \music{ `g16 c16 - e16 `g16 c16 e16 } } { \music{ `g16 c16 e16 `g16 - c16 e16 } } { \music{ `ais16 c16 e16 `ais16 c16 e16 - } } { \music{ `ais16 c16 e16 `ais16 c16 e16 } } { - \music{ `a16 c16 e16 `a16 c16 e16 } } { \music{ - `a16 c16 e16 `a16 c16 e16 } } { \music{ `a16 c16 - dis16 `a16 c16 dis16 } } { \music{ `a16 c16 dis16 - `a16 c16 dis16 } } { \music{ `b16 c16 d16 `b16 c16 - d16 } } { \music{ `b16 c16 d16 `b16 c16 d16 } } { - \music{ `g16 `b16 d16 `g16 `b16 d16 } } { \music{ - `g16 `b16 d16 `g16 `b16 d16 } } { \music{ `g16 c16 - e16 `g16 c16 e16 } } { \music{ `g16 c16 e16 `g16 - c16 e16 } } { \music{ `g16 c16 f16 `g16 c16 f16 } } - { \music{ `g16 c16 f16 `g16 c16 f16 } } { \music{ - `g16 `b16 f16 `g16 `b16 f16 } } { \music{ `g16 `b16 - f16 `g16 `b16 f16 } } { \music{ `a16 c16 fis16 `a16 - c16 fis16 } } { \music{ `a16 c16 fis16 `a16 c16 - fis16 } } { \music{ `g16 c16 g16 `g16 c16 g16 } } { - \music{ `g16 c16 g16 `g16 c16 g16 } } { \music{ - `g16 c16 f16 `g16 c16 f16 } } { \music{ `g16 c16 - f16 `g16 c16 f16 } } { \music{ `g16 `b16 f16 `g16 - `b16 f16 } } { \music{ `g16 `b16 f16 `g16 `b16 f16 } - } { \music{ `g16 `ais16 e16 `g16 `ais16 e16 } } { - \music{ `g16 `ais16 e16 `g16 `ais16 e16 } } { - \music{ `f16 `a16 c16 f16 c16 `a16 c16 `a16 `f16 - `a16 `f16 `d16 `f16 `d16 } } { \music{ g16 b16 d'16 + 'a16 c16 f16 'a16 c16 f16 } } { \music{ 'a16 c16 + f16 'a16 c16 f16 } } { \music{ 'a16 c16 f16 'a16 + c16 f16 } } { \music{ 'a16 c16 f16 'a16 c16 f16 } } + { \music{ 'g16 'b16 f16 'g16 'b16 f16 } } { \music{ + 'g16 'b16 f16 'g16 'b16 f16 } } { \music{ 'g16 c16 + e16 'g16 c16 e16 } } { \music{ 'g16 c16 e16 'g16 + c16 e16 } } { \music{ 'ais16 c16 e16 'ais16 c16 e16 + } } { \music{ 'ais16 c16 e16 'ais16 c16 e16 } } { + \music{ 'a16 c16 e16 'a16 c16 e16 } } { \music{ + 'a16 c16 e16 'a16 c16 e16 } } { \music{ 'a16 c16 + dis16 'a16 c16 dis16 } } { \music{ 'a16 c16 dis16 + 'a16 c16 dis16 } } { \music{ 'b16 c16 d16 'b16 c16 + d16 } } { \music{ 'b16 c16 d16 'b16 c16 d16 } } { + \music{ 'g16 'b16 d16 'g16 'b16 d16 } } { \music{ + 'g16 'b16 d16 'g16 'b16 d16 } } { \music{ 'g16 c16 + e16 'g16 c16 e16 } } { \music{ 'g16 c16 e16 'g16 + c16 e16 } } { \music{ 'g16 c16 f16 'g16 c16 f16 } } + { \music{ 'g16 c16 f16 'g16 c16 f16 } } { \music{ + 'g16 'b16 f16 'g16 'b16 f16 } } { \music{ 'g16 'b16 + f16 'g16 'b16 f16 } } { \music{ 'a16 c16 fis16 'a16 + c16 fis16 } } { \music{ 'a16 c16 fis16 'a16 c16 + fis16 } } { \music{ 'g16 c16 g16 'g16 c16 g16 } } { + \music{ 'g16 c16 g16 'g16 c16 g16 } } { \music{ + 'g16 c16 f16 'g16 c16 f16 } } { \music{ 'g16 c16 + f16 'g16 c16 f16 } } { \music{ 'g16 'b16 f16 'g16 + 'b16 f16 } } { \music{ 'g16 'b16 f16 'g16 'b16 f16 } + } { \music{ 'g16 'ais16 e16 'g16 'ais16 e16 } } { + \music{ 'g16 'ais16 e16 'g16 'ais16 e16 } } { + \music{ 'f16 'a16 c16 f16 c16 'a16 c16 'a16 'f16 + 'a16 'f16 'd16 'f16 'd16 } } { \music{ g16 b16 d'16 f'16 d'16 b16 d'16 b16 g16 b16 d16 f16 e64 } } { \music{ f64 } } { } { \music{ e32 } } { \music{ d16 } } { \music{ c'1 } \music{ g1 } \music{ e1 } } @@ -82,36 +82,36 @@ track2 = \music { e4. } } { \music{ e4. } } { \music{ d4. } } { \music{ d4. } } { \music{ d4. } } { \music{ d4. } } { \music{ c4. } } { \music{ c4. } } { \music{ c4. } - } { \music{ c4. } } { \music{ `a4. } } { \music{ - `a4. } } { \music{ `b4. } } { \music{ `b4. } } { - \music{ `ais4. } } { \music{ `ais4. } } { \music{ - `a4. } } { \music{ `a4. } } { \music{ `gis4. } } { - \music{ `gis4. } } { \music{ `g4. } } { \music{ - `g4. } } { \music{ `f4. } } { \music{ `f4. } } { - \music{ `f4. } } { \music{ `f4. } } { \music{ `d4. } - } { \music{ `d4. } } { \music{ `e4. } } { \music{ - `e4. } } { \music{ `g4. } } { \music{ `c4. } } { } { - } { \music{ `g4. } } { } { \music{ ``f4. } } { - \music{ `f4. } } { \music{ ``f4. } } { \music{ `f4. } - } { \music{ fi``s4. } } { \music{ fi``s4. } \music{ - `c4. } } { } { \music{ `c4. } } { \music{ gi``s4. } } - { \music{ gi``s4. } \music{ `f4. } } { } { \music{ - `f4. } } { \music{ ``g4. } } { \music{ ``g4. } \music{ - `f4. } } { } { \music{ `f4. } } { \music{ ``g4. } } - { \music{ ``g4. } \music{ `e4. } } { } { \music{ ``g4. - } \music{ `e4. } } { } { \music{ ``g4. } \music{ - `d4. } } { } { \music{ ``g4. } \music{ `d4. } } { } { - \music{ `d4. } } { \music{ ``g4. } } { \music{ ``g4. } - \music{ `d4. } } { } { \music{ `dis4. } } { \music{ - ``g4. } } { \music{ `dis4. } } { \music{ ``g4. } } { - \music{ `e4. } } { \music{ ``g4. } } { \music{ `e4. } - } { \music{ ``g4. } } { \music{ `d4. } } { \music{ - ``g4. } } { \music{ `d4. } } { \music{ ``g4. } } { - \music{ `d4. } } { \music{ ``g4. } } { \music{ `d4. } - } { \music{ ``c4. } } { \music{ `c4. } } { \music{ - ``c4. } } { \music{ `c4. } } { \music{ ``c1 } } { - \music{ `c1 } } { \music{ ``c1 } \music{ ``b1 } } { - } { } { } { \music{ ``c1 } \music{ `c1 } } + } { \music{ c4. } } { \music{ 'a4. } } { \music{ + 'a4. } } { \music{ 'b4. } } { \music{ 'b4. } } { + \music{ 'ais4. } } { \music{ 'ais4. } } { \music{ + 'a4. } } { \music{ 'a4. } } { \music{ 'gis4. } } { + \music{ 'gis4. } } { \music{ 'g4. } } { \music{ + 'g4. } } { \music{ 'f4. } } { \music{ 'f4. } } { + \music{ 'f4. } } { \music{ 'f4. } } { \music{ 'd4. } + } { \music{ 'd4. } } { \music{ 'e4. } } { \music{ + 'e4. } } { \music{ 'g4. } } { \music{ 'c4. } } { } { + } { \music{ 'g4. } } { } { \music{ ''f4. } } { + \music{ 'f4. } } { \music{ ''f4. } } { \music{ 'f4. } + } { \music{ fi''s4. } } { \music{ fi''s4. } \music{ + 'c4. } } { } { \music{ 'c4. } } { \music{ gi''s4. } } + { \music{ gi''s4. } \music{ 'f4. } } { } { \music{ + 'f4. } } { \music{ ''g4. } } { \music{ ''g4. } \music{ + 'f4. } } { } { \music{ 'f4. } } { \music{ ''g4. } } + { \music{ ''g4. } \music{ 'e4. } } { } { \music{ ''g4. + } \music{ 'e4. } } { } { \music{ ''g4. } \music{ + 'd4. } } { } { \music{ ''g4. } \music{ 'd4. } } { } { + \music{ 'd4. } } { \music{ ''g4. } } { \music{ ''g4. } + \music{ 'd4. } } { } { \music{ 'dis4. } } { \music{ + ''g4. } } { \music{ 'dis4. } } { \music{ ''g4. } } { + \music{ 'e4. } } { \music{ ''g4. } } { \music{ 'e4. } + } { \music{ ''g4. } } { \music{ 'd4. } } { \music{ + ''g4. } } { \music{ 'd4. } } { \music{ ''g4. } } { + \music{ 'd4. } } { \music{ ''g4. } } { \music{ 'd4. } + } { \music{ ''c4. } } { \music{ 'c4. } } { \music{ + ''c4. } } { \music{ 'c4. } } { \music{ ''c1 } } { + \music{ 'c1 } } { \music{ ''c1 } \music{ ''b1 } } { + } { } { } { \music{ ''c1 } \music{ 'c1 } } } % track4. score { diff --git a/input/scales.ly b/input/scales.ly index ee267b8ce6..d31118d0bd 100644 --- a/input/scales.ly +++ b/input/scales.ly @@ -7,20 +7,20 @@ blah = \duration { 8 } \octave{ } |[ a a a a a a a a a ]6/9 - \octave{ ' } + \octave{ 1 } |[ a a a a a a a a a ]6/9 - \octave { ` } - [ `c `g d a e' b' f'' c''' g''' ]6/9 - [ g''' c''' f'' b' e' a d `g `c ]6/9 - \octave{ ' } - [ `c `g d a e' b' f'' c''' g''' ]6/9 - [ g''' c''' f'' b' e' a d `g `c ]6/9 + \octave { ' } + [ 'c 'g d a e' b' f'' c''' g''' ]6/9 + [ g''' c''' f'' b' e' a d 'g 'c ]6/9 + \octave{ 1 } + [ 'c 'g d a e' b' f'' c''' g''' ]6/9 + [ g''' c''' f'' b' e' a d 'g 'c ]6/9 \octave { } [ c g d' ]2/3 [ d' g c ]2/3 [ f c' g' ]2/3 [ g' c' f ]2/3 - \octave{ ' } + \octave{ 1 } [ c g d' ]2/3 [ d' g c ]2/3 [ f c' g' ]2/3 @@ -42,7 +42,7 @@ c1 [c d e f][g a b c'] % 10 |[c' b a g][f e d c] - } + } } \score { diff --git a/input/scsii-menuetto.ly b/input/scsii-menuetto.ly index b9f848715b..f53ff15fef 100644 --- a/input/scsii-menuetto.ly +++ b/input/scsii-menuetto.ly @@ -30,16 +30,16 @@ ii_menuetto = \music { \clef"alto"\meter{3/4} \key {bes} - \octave{} + \octave{1} \duration{8} < a2 f2 d2 df > bes4-. | %%2 < [ bes^"1" e c_"2"_"4" > a bes-. g-. ] a4-.^"4" | %%3 - < d4 `bes4-. > g4-. [ f-. e-. ] | + < d4 'bes4-. > g4-. [ f-. e-. ] | %%4 - < [ f `a > e d cis-. `b-. `a-. ] + < [ f 'a > e d cis-. 'b-. 'a-. ] %%5 < a2 f2 d2 > bes4-. | % @bes4-. | %%6 @@ -47,10 +47,10 @@ ii_menuetto = \music { c'4-. | % =c'4-. | %%7 < a4-. f4> - < d'4-.-upbow f4 `bes4 > - < e'4-.-downbow g4 `g4 > | + < d'4-.-upbow f4 'bes4 > + < e'4-.-downbow g4 'g4 > | %%8 - < cis'2.-upbow e2. `a2. > \bar ":|:"%%!! sorry! + < cis'2.-upbow e2. 'a2. > \bar ":|:"%%!! sorry! %%9 \clef "violin" < e'2 a2 df > @@ -70,9 +70,9 @@ ii_menuetto = \music { { \stem{-1} g4(\stem{-1}) f4 e4 }% ugh > | %%14 - < [ a f > g a f ] < d'4-upbow e4 `bes4 > | + < [ a f > g a f ] < d'4-upbow e4 'bes4 > | %%15 - < c'4-\downbow f4 `a4 > [ bes( )a g a ] | + < c'4-\downbow f4 'a4 > [ bes( )a g a ] | %%16 [ f( e )f a-. g-. bes-. ] | %%17 @@ -80,7 +80,7 @@ ii_menuetto = \music { %%18 < { [ c'( )bes c' a ] } { [ es ] } > fis4 | %%19 - < d'4-downbow g4 `bes4 > < c'4-upbow g4 c4 > < [ bes d > a ] | + < d'4-downbow g4 'bes4 > < c'4-upbow g4 c4 > < [ bes d > a ] | %%20 < { [ c'( bes a )bes g( )bes ] } { [ d ] } { [ g ] } > | %%21 @@ -88,9 +88,9 @@ ii_menuetto = \music { %%22 < { [ g( )f g e ] } { [ cis ] } > < f4 d4 > | %%23 - [ `g g ] < e4. `a4. > d-upbow | + [ 'g g ] < e4. 'a4. > d-upbow | %%24 - < d2.^"fine" `a2. `d2._"3 mins."> \bar ":|" % \bar ":||" + < d2.^"fine" 'a2. 'd2._"3 mins."> \bar ":|" % \bar ":||" %% \tighten % use one line less } diff --git a/input/standchen.ly b/input/standchen.ly index 7673bb95c1..0fae878df9 100644 --- a/input/standchen.ly +++ b/input/standchen.ly @@ -13,18 +13,18 @@ % (except for grace notes) are printed % %%1 -melodie = \music { \clef\violin +melodie = \music { \clef\violin\octave{1} \key{bes} \meter{3/4}\duration{ 8 } - r pp < [ d `a-| > f-| < d `a-| > f-| < d `a-| ] > | + r pp < [ d 'a-| > f-| < d 'a-| > f-| < d 'a-| ] > | %%2 - r < [ d `bes-| > f-| < d `bes-| > f-| < d `bes-| ] > | + r < [ d 'bes-| > f-| < d 'bes-| > f-| < d 'bes-| ] > | %%3 \textstyle "italic" - r_"simile" < [ d `bes > e < d `bes > e < d `bes ] > + r_"simile" < [ d 'bes > e < d 'bes > e < d 'bes ] > \textstyle "roman" | %%4 - r < [ `a cis > e < `a cis > e < `a cis ] > | + r < [ 'a cis > e < 'a cis > e < 'a cis ] > | %#%:| %%5 [ a()bes a ]2/3 d'4. a | @@ -167,146 +167,146 @@ begeleiding = \music { \key{bes}\meter{3/4} \clef\bass \duration{2} - `d r4 | + 'd r4 | %%2 - ``bes r4 | + ''bes r4 | %%3 - ``g r4 | + ''g r4 | %%4 - ``a r4 | + ''a r4 | %#%:| %%5 \duration{ 8 } - < \multivoice { \stem{ 1 } [ `f `a d `a d `a ] } - { \stem{ -1 } `d2 r4 } > | + < \multivoice { \stem{ 1 } [ 'f 'a d 'a d 'a ] } + { \stem{ -1 } 'd2 r4 } > | %%6 - < \multivoice { \stem{ 1 } [ `d `e `g `e `g `e ] } - { \stem{ -1 } ``bes2 r4 } > | + < \multivoice { \stem{ 1 } [ 'd 'e 'g 'e 'g 'e ] } + { \stem{ -1 } ''bes2 r4 } > | %%7 - < \multivoice { \stem{ 1 } [ `cis `e `g `e `g e ] } - { \stem{ -1 } ``a2 r4 } > | + < \multivoice { \stem{ 1 } [ 'cis 'e 'g 'e 'g e ] } + { \stem{ -1 } ''a2 r4 } > | %%8 - < \multivoice { \stem{ 1 } [ `d `a d `a d `a ] } - { \stem{ -1 } `d2 r4 } > | + < \multivoice { \stem{ 1 } [ 'd 'a d 'a d 'a ] } + { \stem{ -1 } 'd2 r4 } > | %%9 - [ `a e g e g e ] | + [ 'a e g e g e ] | %%10 - [ `d `a d `a d `a ] | + [ 'd 'a d 'a d 'a ] | %%11 - < \multivoice { \stem{ 1 } [ `f `a d `a d `a ] } - { \stem{ -1 } `d2 r4 } > | + < \multivoice { \stem{ 1 } [ 'f 'a d 'a d 'a ] } + { \stem{ -1 } 'd2 r4 } > | %%12 == 6 - < \multivoice { \stem{ 1 } [ `d `e `g `e `g `e ] } - { \stem{ -1 } ``bes2 r4 } > | + < \multivoice { \stem{ 1 } [ 'd 'e 'g 'e 'g 'e ] } + { \stem{ -1 } ''bes2 r4 } > | %13 - < \multivoice { [ `e `g `bes `g `bes `g ] } - { \stem{ -1 } `c2 r4 } > | + < \multivoice { [ 'e 'g 'bes 'g 'bes 'g ] } + { \stem{ -1 } 'c2 r4 } > | %%14 - < \multivoice { \stem{ 1 } [ `a c f c f c ] } - { \stem{ -1 } `f2 r4 } > | + < \multivoice { \stem{ 1 } [ 'a c f c f c ] } + { \stem{ -1 } 'f2 r4 } > | %%15 - [ `c `g `bes `g `bes `g ] | + [ 'c 'g 'bes 'g 'bes 'g ] | %%16 - [ ``f `c `f `c `f `c ] | + [ ''f 'c 'f 'c 'f 'c ] | %%17 - < \multivoice { \stem{ 1 } [ ``a `e `g `e `g `e ] } - { \stem{ -1 } ``a2 r4 } > | + < \multivoice { \stem{ 1 } [ ''a 'e 'g 'e 'g 'e ] } + { \stem{ -1 } ''a2 r4 } > | %%18 - < \multivoice { \stem{ 1 } [ `d `a d `a d `a ] } - { \stem{ -1 } `d2 r4 } > | + < \multivoice { \stem{ 1 } [ 'd 'a d 'a d 'a ] } + { \stem{ -1 } 'd2 r4 } > | %%19 - < \multivoice { \stem{ 1 } [ ``bes `f `bes `f `bes `f ] } - { \stem{ -1 } ``bes2 r4 } > | + < \multivoice { \stem{ 1 } [ ''bes 'f 'bes 'f 'bes 'f ] } + { \stem{ -1 } ''bes2 r4 } > | %%20 - < \multivoice { \stem{ 1 } [ ``f `c `f `c `f `c ] } - { \stem{ -1 } ``f2 r4 } > | + < \multivoice { \stem{ 1 } [ ''f 'c 'f 'c 'f 'c ] } + { \stem{ -1 } ''f2 r4 } > | %%21 - < [ `e `c > `g c `g c `g ] | + < [ 'e 'c > 'g c 'g c 'g ] | %%22 - [ `f `a c `a `f `c ] | + [ 'f 'a c 'a 'f 'c ] | %%23 - < \multivoice { \stem{ 1 } [ ``a `e `g `e `g `e ] } - { \stem{ -1 } ``a2 r4 } > | + < \multivoice { \stem{ 1 } [ ''a 'e 'g 'e 'g 'e ] } + { \stem{ -1 } ''a2 r4 } > | %%24 - < \multivoice { \stem{ 1 } [ `d `fis `a `fis `a `fis ] } - { \stem{ -1 } `d2 r4 } > | + < \multivoice { \stem{ 1 } [ 'd 'fis 'a 'fis 'a 'fis ] } + { \stem{ -1 } 'd2 r4 } > | %%25 - < \multivoice { \stem{ 1 } [ ``g `d `b `d `b `d ] } - { \stem{ -1 } ``g2 r4 } > | + < \multivoice { \stem{ 1 } [ ''g 'd 'b 'd 'b 'd ] } + { \stem{ -1 } ''g2 r4 } > | %%26 - < \multivoice { \stem{ 1 } [ `d `a d `a d `a ] } - { \stem{ -1 } `d2 r4 } > | + < \multivoice { \stem{ 1 } [ 'd 'a d 'a d 'a ] } + { \stem{ -1 } 'd2 r4 } > | %%27 - < [ `cis ``a > `e `a `e `a `e ] | + < [ 'cis ''a > 'e 'a 'e 'a 'e ] | %%28 - [ `d `a d `a d `a ] | + [ 'd 'a d 'a d 'a ] | %%29 - [ `d `g `bes `g `bes `g ] | + [ 'd 'g 'bes 'g 'bes 'g ] | %#%\volta1 %%30 - [ `d `fis `a `fis `a `fis ] | + [ 'd 'fis 'a 'fis 'a 'fis ] | %%31 - [ ``a `e `a `e `a `e ] | + [ ''a 'e 'a 'e 'a 'e ] | %%32 - [ `d `fis `a `fis `a `fis ] | + [ 'd 'fis 'a 'fis 'a 'fis ] | %%33 - [ `d `g `b `g `b `g ] | + [ 'd 'g 'b 'g 'b 'g ] | %%34 - [ `d `fis `a `fis `a `fis ] | + [ 'd 'fis 'a 'fis 'a 'fis ] | %%35 - [ ``a `e `a `e `a `e ] | + [ ''a 'e 'a 'e 'a 'e ] | %%36 - [ `d `fis `a `fis `a `fis ] | + [ 'd 'fis 'a 'fis 'a 'fis ] | %#%\volta2 %#%:| %%37 - [ ``a `e `g `e ``bes^> `e ] | + [ ''a 'e 'g 'e ''bes^> 'e ] | %%38 - [ ``a < e cis `a > < e cis `a > < e cis `a > < e cis `a > < e cis `a ] > | + [ ''a < e cis 'a > < e cis 'a > < e cis 'a > < e cis 'a > < e cis 'a ] > | %%39 - [ ``a `e `g `e ``bes^> `e ] | + [ ''a 'e 'g 'e ''bes^> 'e ] | %%40 - [ ``a < e cis `a > < e cis `a > < e cis `a > < e cis `a > < e cis `a ] > | + [ ''a < e cis 'a > < e cis 'a > < e cis 'a > < e cis 'a > < e cis 'a ] > | %%41 - [ ``ais `e `fis `e `fis `e ] | + [ ''ais 'e 'fis 'e 'fis 'e ] | %%42 - < [ `d ``b > `fis `b `fis `b `fis ] | + < [ 'd ''b > 'fis 'b 'fis 'b 'fis ] | %%43 - < [ `e ``b > `g `b `g `b `g ] | + < [ 'e ''b > 'g 'b 'g 'b 'g ] | %%44 - < [ `d ``b > `fis `b `fis `b `fis ] | + < [ 'd ''b > 'fis 'b 'fis 'b 'fis ] | %%45 - < \multivoice { \stem{ 1 } [ ``g `d `b `d `b `d ] } - { \stem{ -1 } ``g2 r4 } > | + < \multivoice { \stem{ 1 } [ ''g 'd 'b 'd 'b 'd ] } + { \stem{ -1 } ''g2 r4 } > | %%46 - < \multivoice { \stem{ 1 } [ `d `a d `a d `a ] } - { \stem{ -1 } `d2 r4 } > | + < \multivoice { \stem{ 1 } [ 'd 'a d 'a d 'a ] } + { \stem{ -1 } 'd2 r4 } > | %%47 - < [ `cis ``a > `e `a `e `a `e ] | + < [ 'cis ''a > 'e 'a 'e 'a 'e ] | %%48 - [ `d `fis `a `fis `a `fis ] | + [ 'd 'fis 'a 'fis 'a 'fis ] | %%49 - [ `d `a d `a d `a ] | + [ 'd 'a d 'a d 'a ] | %%50 - [ ``g `e `g `e `g `e ] | + [ ''g 'e 'g 'e 'g 'e ] | %%51 - [ ``a `e `g `e `g `e ] | + [ ''a 'e 'g 'e 'g 'e ] | %%52 - [ ``d `d `fis `d `fis `d ] | + [ ''d 'd 'fis 'd 'fis 'd ] | %%53 - [ `d `g `bes `g `bes `g ] | + [ 'd 'g 'bes 'g 'bes 'g ] | %%54 - [ `d `fis `a `fis `a `fis ] | + [ 'd 'fis 'a 'fis 'a 'fis ] | %%55 - [ ``a `e `g `e `g `e ] | + [ ''a 'e 'g 'e 'g 'e ] | %%56 - [ ``d ``a `d ``a `d ``a ] | + [ ''d ''a 'd ''a 'd ''a ] | %%57 - [ ``d ``a `d ``a `d ``a ] + [ ''d ''a 'd ''a 'd ''a ] %%58 - < `d2.^\fermata ``d2. > | + < 'd2.^\fermata ''d2. > | } @@ -447,7 +447,7 @@ tekstII= \lyrics { \music { tekstI } \music { tekstII } } -% Setting up music ...lilypond: ../flower/include/cursor.inl:98: class Cursor<void *> Cursor<void *>::operator ++(int): Assertion `pointer_' failed. +% Setting up music ...lilypond: ../flower/include/cursor.inl:98: class Cursor<void *> Cursor<void *>::operator ++(int): Assertion 'pointer_' failed. %IOT trap/Abort % als geen music in staff \staff { diff --git a/input/twinkle.ly b/input/twinkle.ly index 14f6030cc7..6a2bf0dd9d 100644 --- a/input/twinkle.ly +++ b/input/twinkle.ly @@ -6,7 +6,7 @@ melodie = \music { \clef\violin - c c | g g | a a | g g | + c4 c | g g | a a | g g | f f | e e | d d8.( e16 | )c2 | % :| g g | f f | e e | d d | @@ -20,7 +20,7 @@ melodie = \music { begeleiding = \music { \clef \bass - \octave{`} + \octave{-1} c c' | e' c' | f' c' | e' c' | d' b | c' a | f g | c2 | diff --git a/input/wohltemperirt.ly b/input/wohltemperirt.ly index 921cdbb983..9e3389a370 100644 --- a/input/wohltemperirt.ly +++ b/input/wohltemperirt.ly @@ -6,13 +6,15 @@ % global=\music{\meter {4/4} \grouping {2*2} - \key {bes es as}} + \key {bes es as} + +} dux = \music { - \clef \violin + \clef \violin\octave{1} \duration { \last } - - r8-"dux" \stem{-1} + \stem{-1} + r8-"dux" [c'16 b] [c'8 g] [as c'16 b] [c'8 d'] | [g c'16 b] [c'8 d'] [f16 g] as4 [g16 f] | [es c' b a] [ g f es d] [c8 es' d' c'] | @@ -24,22 +26,21 @@ dux = \music { } comes = \music { - \octave {'} - r1 \stem{1} - | + \octave {2}\stem{1} + r1 | r1 | r8-"comes" [g16 fis] [g8 c] [es g16 f] [g8 a]| [d8 g16 fis] [g8 a] [c16 d] es4 [d16 c] | - [`bes8 es16 d] [es8 `g8] [`as f16 es] [f8 `a] - [`bes8 g16 f] [g8 `b] [c8 d16 es] f4( | - [) f8 es16 d] [c16 `bes `as `g] [`f8 as g f] - [es d es f] [`b c d `b] | + ['bes8 es16 d] [es8 'g8] ['as f16 es] [f8 'a] + ['bes8 g16 f] [g8 'b] [c8 d16 es] f4( | + [) f8 es16 d] [c16 'bes 'as 'g] ['f8 as g f] + [es d es f] ['b c d 'b] | } bassdux = \music { \clef \bass - \octave { } + \octave {1} r1 | r | r | diff --git a/lib/binary-source-file.cc b/lib/binary-source-file.cc index 34f6645de6..f080c2dab2 100644 --- a/lib/binary-source-file.cc +++ b/lib/binary-source-file.cc @@ -34,8 +34,8 @@ Binary_source_file::error_str( char const* pos_ch_c_l ) if ( !in_b( pos_ch_c_l ) ) return ""; - char const* begin_ch_c_l = pos_ch_c_l - 8 >? ch_c_l(); - char const* end_ch_c_l = pos_ch_c_l + 7 <? ch_c_l() + length_off(); + char const* begin_ch_c_l = pos_ch_c_l - 8 >? ch_C(); + char const* end_ch_c_l = pos_ch_c_l + 7 <? ch_C() + length_off(); String pre_str( (Byte const*)begin_ch_c_l, pos_ch_c_l - begin_ch_c_l ); pre_str = String_convert::bin2hex_str( pre_str ); @@ -59,6 +59,6 @@ Binary_source_file::line_i( char const* pos_ch_c_l ) if ( !in_b( pos_ch_c_l ) ) return 0; - return pos_ch_c_l - ch_c_l(); + return pos_ch_c_l - ch_C(); } diff --git a/lib/duration-convert.cc b/lib/duration-convert.cc new file mode 100644 index 0000000000..bb4d4fe400 --- /dev/null +++ b/lib/duration-convert.cc @@ -0,0 +1,287 @@ +/* + duration-convert.cc -- implement + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ +#include <assert.h> +#include "duration-convert.hh" +#include "debug.hh" + +// statics Duration_convert +bool Duration_convert::be_blonde_b_s = false; +bool Duration_convert::no_double_dots_b_s = false; +bool Duration_convert::no_triplets_b_s = false; +int Duration_convert::no_smaller_than_i_s = 0; + +String +Duration_convert::dur2_str( Duration dur ) +{ + if ( dur.ticks_i_ ) + return String( "[" ) + String( dur.ticks_i_ ) + "]"; + + String str( dur.type_i_ ); + str += String( '.', dur.dots_i_ ); + if ( dur.plet_b()) + str += String( "*" ) + String( dur.plet_.iso_i_ ) + + String( "/" ) + String( dur.plet_.type_i_ ); + return str; +} + +#if 0 +int +Duration_convert::dur2_i( Duration dur, int division_1_i ) +{ + return dur2_mom( dur ) * Moment( division_1_i ); +} +#endif + +int +Duration_convert::dur2ticks_i( Duration dur ) +{ + if ( dur.ticks_i_ ) + return dur.ticks_i_; + return dur2_mom( dur ) * Moment( Duration::division_1_i_s ); +} + +Moment +Duration_convert::dur2_mom( Duration dur ) +{ + if ( dur.ticks_i_ ) + return Moment( dur.ticks_i_, Duration::division_1_i_s ); + + // or simply assert? + if ( !dur.type_i_ ) + return Moment( 0 ); + + Moment mom = Moment( 1 , dur.type_i_ ); + + Moment delta = mom; + while ( dur.dots_i_-- ) { + delta /= 2.0; + mom += delta; + } + + return mom * plet_factor_mom( dur ); +} + +#if 0 +Moment +Duration_convert::i2_mom( int time_i, int division_1_i ) +{ + if ( !time_i ) + return Moment( 0 ); + + if ( division_1_i > 0 ) + return Moment( time_i, division_1_i ); + else + return Moment( -division_1_i, time_i ); +} +#endif + +#if 0 +Duration +Duration_convert::mom2_dur( Moment mom ) +{ + /* this is cute, + but filling an array using Duration_iterator + might speed things up, a little + */ + Duration_iterator iter_dur; + assert( iter_dur ); + while ( iter_dur ) { + Duration lower_dur = iter_dur++; + Duration upper_dur( 0 ); + if ( iter_dur ) + upper_dur = iter_dur(); + Moment lower_mom = dur2_mom( lower_dur ); + Moment upper_mom = dur2_mom( upper_dur ); + if ( mom == lower_mom ) + return lower_dur; + 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 ); + if ( abs( mom - lower_mom ) < abs( mom - upper_mom ) ) + return lower_dur; + else + return upper_dur; + } + lower_dur = upper_dur; + } + return Duration( 0 ); +} +#endif + +Moment +Duration_convert::plet_factor_mom( Duration dur ) +{ + return dur.plet_.mom(); +} + +Real +Duration_convert::sync_f( Duration dur, Moment mom ) +{ + return mom / dur2_mom( dur ); +} + +Duration +Duration_convert::ticks2_dur( int ticks_i ) +{ + /* this is cute, + but filling an array using Duration_iterator + might speed things up, a little + */ + Moment mom( ticks_i, Duration::division_1_i_s ); + Duration_iterator iter_dur; + assert( iter_dur ); + while ( iter_dur ) { + Duration dur = iter_dur++; + if ( mom == dur2_mom( dur ) ) + return dur; + } + Duration dur( 0 ); + dur.set_ticks( ticks_i ); + return dur; +} + +Duration +Duration_convert::ticks2standardised_dur( int ticks_i ) +{ + /* this is cute, + but filling an array using Duration_iterator + might speed things up, a little + */ + Moment mom( ticks_i, Duration::division_1_i_s ); + Duration_iterator iter_dur; + assert( iter_dur ); + while ( iter_dur ) { + Duration lower_dur = iter_dur++; +// Duration upper_dur( 0 ); + Duration upper_dur( 1, 1 ); + if ( iter_dur ) + upper_dur = iter_dur(); + Moment lower_mom = dur2_mom( lower_dur ); + Moment upper_mom = dur2_mom( upper_dur ); + if ( mom < lower_mom ) + return lower_dur; + if ( mom == lower_mom ) + return lower_dur; + 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 ); + if ( abs( mom - lower_mom ) < abs( mom - upper_mom ) ) + return lower_dur; + else + return upper_dur; + } + lower_dur = upper_dur; + } + return iter_dur(); +} + +Duration_iterator::Duration_iterator() +{ + cursor_dur_.type_i_ = 128; + if ( Duration_convert::no_smaller_than_i_s ) + cursor_dur_.type_i_ = Duration_convert::no_smaller_than_i_s; + cursor_dur_.set_plet( 0,1 ); // ugh? +} + +Duration +Duration_iterator::operator ++(int) +{ + return forward_dur(); +} + +Duration +Duration_iterator::operator ()() +{ + return dur(); +} + +Duration_iterator::operator bool() +{ + return ok(); +} + +Duration +Duration_iterator::dur() +{ + return cursor_dur_; +} + +Duration +Duration_iterator::forward_dur() +{ + /* should do smart table? guessing: + duration wholes + 16 0.0625 + 32.. 0.0703 + 8:2/3 0.0833 + 16. 0.0938 + 8 0.1250 + 16.. 0.1406 + 4:2/3 0.1667 + 8. 0.1875 + + */ + assert( ok() ); + + Duration dur = cursor_dur_; + + if ( !cursor_dur_.dots_i_ && !cursor_dur_.plet_b() ) { + cursor_dur_.type_i_ *= 2; + cursor_dur_.dots_i_ = 2; + } + else if ( cursor_dur_.dots_i_ == 2 ) { + assert( !cursor_dur_.plet_b() ); + cursor_dur_.dots_i_ = 0; + cursor_dur_.type_i_ /= 4; + cursor_dur_.set_plet( 2, 3 ); + } + else if ( cursor_dur_.plet_b() + && ( cursor_dur_.plet_.iso_i_ == 2 ) + && ( cursor_dur_.plet_.type_i_ == 3 ) ) { + assert( !cursor_dur_.dots_i_ ); + cursor_dur_.set_plet( 0,1 ); + cursor_dur_.type_i_ *= 2; + cursor_dur_.dots_i_ = 1; + } + else if ( cursor_dur_.dots_i_ == 1 ) { + assert( !cursor_dur_.plet_b() ); + cursor_dur_.dots_i_ = 0; + cursor_dur_.type_i_ /= 2; + } + + if ( Duration_convert::no_triplets_b_s + && cursor_dur_.plet_b() && ok() ) + forward_dur(); + if ( Duration_convert::no_double_dots_b_s + && ( cursor_dur_.dots_i_ == 2 ) && ok() ) + forward_dur(); + if ( Duration_convert::no_smaller_than_i_s + && ( cursor_dur_.type_i_ > Duration_convert::no_smaller_than_i_s ) && ok() ) + forward_dur(); + if ( Duration_convert::no_smaller_than_i_s + && cursor_dur_.dots_i_ + && ( cursor_dur_.type_i_ >= Duration_convert::no_smaller_than_i_s ) + && ok() ) + forward_dur(); + if ( Duration_convert::no_smaller_than_i_s + && ( cursor_dur_.dots_i_ == 2 ) + && ( cursor_dur_.type_i_ >= Duration_convert::no_smaller_than_i_s / 2 ) + && ok() ) + forward_dur(); + + return dur; +} + +bool +Duration_iterator::ok() +{ + return ( cursor_dur_.type_i_ + && !( ( cursor_dur_.type_i_ == 1 ) && ( cursor_dur_.dots_i_ > 2 ) ) ); +} diff --git a/lib/duration.cc b/lib/duration.cc index 5504ed6e35..e341d75831 100644 --- a/lib/duration.cc +++ b/lib/duration.cc @@ -1,7 +1,12 @@ -// -// duration.cc -- implement Duration, Plet, Duration_convert, Duration_iterator -// -// copyright 1997 Jan Nieuwenhuizen <jan@digicash.com> +/* + duration.cc -- implement Duration, Plet, + + source file of the LilyPond music typesetter + + copyright 1997 Jan Nieuwenhuizen <jan@digicash.com> + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ // split into 4? @@ -13,337 +18,64 @@ #include "moment.hh" #include "duration.hh" #include "debug.hh" //ugh +#include "duration-convert.hh" // statics Duration int Duration::division_1_i_s = 384 * 4; -Duration::Duration( int type_i, int dots_i = 0, Plet* plet_l ) +Duration::Duration( int type_i, int dots_i = 0) { type_i_ = type_i; dots_i_ = dots_i; - plet_p_ = 0; - ticks_i_ = 0; - set_plet( plet_l ); -} - -Duration::Duration( Duration const& dur_c_r ) -{ - type_i_ = 0; - dots_i_ = 0; - plet_p_ = 0; ticks_i_ = 0; - *this = dur_c_r; -} - -Duration::~Duration() -{ - delete plet_p_; } - -Duration const& -Duration::operator =( Duration const& dur_c_r ) +void +Duration::set_plet(int i, int t) { - if ( &dur_c_r == this ) - return *this; - - type_i_ = dur_c_r.type_i_; - dots_i_ = dur_c_r.dots_i_; - ticks_i_ = dur_c_r.ticks_i_; - set_plet( dur_c_r.plet_p_ ); - - return *this; + plet_.iso_i_ = i; + plet_.type_i_ = t; } -void -Duration::set_plet( Plet* plet_l ) +Moment +Duration::length() const { - delete plet_p_; - plet_p_ = 0; - if ( plet_l ) - plet_p_ = new Plet( *plet_l ); + return Duration_convert::dur2_mom(*this); } - void Duration::set_ticks( int ticks_i ) { assert( !type_i_ ); assert( !dots_i_ ); - assert( !plet_p_ ); ticks_i_ = ticks_i; } - +String +Duration::str()const +{ + return Duration_convert::dur2_str(*this); +} Plet::Plet( int iso_i, int type_i ) { iso_i_ = iso_i; type_i_ = type_i; } - - -// statics Duration_convert -bool Duration_convert::be_blonde_b_s = false; -bool Duration_convert::no_double_dots_b_s = false; -bool Duration_convert::no_triplets_b_s = false; -int Duration_convert::no_smaller_than_i_s = 0; - -String -Duration_convert::dur2_str( Duration dur ) -{ - if ( dur.ticks_i_ ) - return String( "[" ) + String( dur.ticks_i_ ) + "]"; - - String str( dur.type_i_ ); - str += String( '.', dur.dots_i_ ); - if ( dur.plet_p_ ) - str += String( "*" ) + String( dur.plet_p_->iso_i_ ) - + String( "/" ) + String( dur.plet_p_->type_i_ ); - return str; -} - -#if 0 -int -Duration_convert::dur2_i( Duration dur, int division_1_i ) -{ - return dur2_mom( dur ) * Moment( division_1_i ); -} -#endif - -int -Duration_convert::dur2ticks_i( Duration dur ) -{ - if ( dur.ticks_i_ ) - return dur.ticks_i_; - return dur2_mom( dur ) * Moment( Duration::division_1_i_s ); -} - -Moment -Duration_convert::dur2_mom( Duration dur ) -{ - if ( dur.ticks_i_ ) - return Moment( dur.ticks_i_, Duration::division_1_i_s ); - - // or simply assert? - if ( !dur.type_i_ ) - return Moment( 0 ); - - Moment mom = Moment( 1 , dur.type_i_ ); - - Moment delta = mom; - while ( dur.dots_i_-- ) { - delta /= 2.0; - mom += delta; - } - - return mom * plet_factor_mom( dur ); -} - -#if 0 -Moment -Duration_convert::i2_mom( int time_i, int division_1_i ) -{ - if ( !time_i ) - return Moment( 0 ); - - if ( division_1_i > 0 ) - return Moment( time_i, division_1_i ); - else - return Moment( -division_1_i, time_i ); -} -#endif - -#if 0 -Duration -Duration_convert::mom2_dur( Moment mom ) -{ - /* this is cute, - but filling an array using Duration_iterator - might speed things up, a little - */ - Duration_iterator iter_dur; - assert( iter_dur ); - while ( iter_dur ) { - Duration lower_dur = iter_dur++; - Duration upper_dur( 0 ); - if ( iter_dur ) - upper_dur = iter_dur(); - Moment lower_mom = dur2_mom( lower_dur ); - Moment upper_mom = dur2_mom( upper_dur ); - if ( mom == lower_mom ) - return lower_dur; - 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 ); - if ( abs( mom - lower_mom ) < abs( mom - upper_mom ) ) - return lower_dur; - else - return upper_dur; - } - lower_dur = upper_dur; - } - return Duration( 0 ); -} -#endif - Moment -Duration_convert::plet_factor_mom( Duration dur ) -{ - if ( !dur.plet_p_ ) - return 1; - return Moment( dur.plet_p_->iso_i_, dur.plet_p_->type_i_ ); -} - -Real -Duration_convert::sync_f( Duration dur, Moment mom ) -{ - return mom / dur2_mom( dur ); -} - -Duration -Duration_convert::ticks2_dur( int ticks_i ) -{ - /* this is cute, - but filling an array using Duration_iterator - might speed things up, a little - */ - Moment mom( ticks_i, Duration::division_1_i_s ); - Duration_iterator iter_dur; - assert( iter_dur ); - while ( iter_dur ) { - Duration dur = iter_dur++; - if ( mom == dur2_mom( dur ) ) - return dur; - } - Duration dur( 0 ); - dur.set_ticks( ticks_i ); - return dur; -} - -Duration -Duration_convert::ticks2standardised_dur( int ticks_i ) +Plet::mom()const { - /* this is cute, - but filling an array using Duration_iterator - might speed things up, a little - */ - Moment mom( ticks_i, Duration::division_1_i_s ); - Duration_iterator iter_dur; - assert( iter_dur ); - while ( iter_dur ) { - Duration lower_dur = iter_dur++; -// Duration upper_dur( 0 ); - Duration upper_dur( 1, 1 ); - if ( iter_dur ) - upper_dur = iter_dur(); - Moment lower_mom = dur2_mom( lower_dur ); - Moment upper_mom = dur2_mom( upper_dur ); - if ( mom < lower_mom ) - return lower_dur; - if ( mom == lower_mom ) - return lower_dur; - 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 ); - if ( abs( mom - lower_mom ) < abs( mom - upper_mom ) ) - return lower_dur; - else - return upper_dur; - } - lower_dur = upper_dur; - } - return iter_dur(); + return Moment( iso_i_, type_i_ ); } -Duration_iterator::Duration_iterator() +Plet::Plet() { - cursor_dur_.type_i_ = 128; - if ( Duration_convert::no_smaller_than_i_s ) - cursor_dur_.type_i_ = Duration_convert::no_smaller_than_i_s; - cursor_dur_.set_plet( 0 ); + type_i_ = 1; + iso_i_ = 1; } - -Duration -Duration_iterator::operator ++(int) -{ - return forward_dur(); -} - -Duration -Duration_iterator::operator ()() -{ - return dur(); -} - -Duration_iterator::operator bool() -{ - return ok(); -} - -Duration -Duration_iterator::dur() +bool +Plet::unit_b()const { - return cursor_dur_; + return type_i_ == 1 && iso_i_ == 1; } - -Duration -Duration_iterator::forward_dur() -{ - // should do smart table? guessing: - // duration wholes - // 16 0.0625 - // 32.. 0.0703 - // 8:2/3 0.0833 - // 16. 0.0938 - // 8 0.1250 - // 16.. 0.1406 - // 4:2/3 0.1667 - // 8. 0.1875 - - assert( ok() ); - - Duration dur = cursor_dur_; - - if ( !cursor_dur_.dots_i_ && !cursor_dur_.plet_p_ ) { - cursor_dur_.type_i_ *= 2; - cursor_dur_.dots_i_ = 2; - } - else if ( cursor_dur_.dots_i_ == 2 ) { - assert( !cursor_dur_.plet_p_ ); - cursor_dur_.dots_i_ = 0; - cursor_dur_.type_i_ /= 4; - cursor_dur_.set_plet( &Plet( 2, 3 ) ); - } - else if ( cursor_dur_.plet_p_ - && ( cursor_dur_.plet_p_->iso_i_ == 2 ) - && ( cursor_dur_.plet_p_->type_i_ == 3 ) ) { - assert( !cursor_dur_.dots_i_ ); - cursor_dur_.set_plet( 0 ); - cursor_dur_.type_i_ *= 2; - cursor_dur_.dots_i_ = 1; - } - else if ( cursor_dur_.dots_i_ == 1 ) { - assert( !cursor_dur_.plet_p_ ); - cursor_dur_.dots_i_ = 0; - cursor_dur_.type_i_ /= 2; - } - - if ( Duration_convert::no_triplets_b_s && cursor_dur_.plet_p_ && ok() ) - forward_dur(); - if ( Duration_convert::no_double_dots_b_s && ( cursor_dur_.dots_i_ == 2 ) && ok() ) - forward_dur(); - if ( Duration_convert::no_smaller_than_i_s && ( cursor_dur_.type_i_ > Duration_convert::no_smaller_than_i_s ) && ok() ) - forward_dur(); - if ( Duration_convert::no_smaller_than_i_s && cursor_dur_.dots_i_ && ( cursor_dur_.type_i_ >= Duration_convert::no_smaller_than_i_s ) && ok() ) - forward_dur(); - if ( Duration_convert::no_smaller_than_i_s && ( cursor_dur_.dots_i_ == 2 ) && ( cursor_dur_.type_i_ >= Duration_convert::no_smaller_than_i_s / 2 ) && ok() ) - forward_dur(); - - return dur; -} - bool -Duration_iterator::ok() +Duration::plet_b() { - return ( cursor_dur_.type_i_ - && !( ( cursor_dur_.type_i_ == 1 ) && ( cursor_dur_.dots_i_ > 2 ) ) ); + return !plet_.unit_b(); } diff --git a/lib/includable-lexer.cc b/lib/includable-lexer.cc new file mode 100644 index 0000000000..f394907823 --- /dev/null +++ b/lib/includable-lexer.cc @@ -0,0 +1,77 @@ +/* + includable-lexer.cc -- implement Includable_lexer + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ +#include "includable-lexer.hh" +#include "source-file.hh" +#include "source.hh" + +Includable_lexer::Includable_lexer() +{ + yy_current_buffer = 0; +} + +/** set the new input to s, remember old file. +*/ +void +Includable_lexer::new_input(String s, Sources * global_sources) +{ + Source_file * sl = global_sources->get_file_l(s); + if (!sl) { + LexerError("can't find file"); + return; + } + char_count_stack_.push(0); + if (yy_current_buffer) + state_stack_.push(yy_current_buffer); + cout << "[" << s<<flush; + include_stack_.push(sl); + + // ugh. We'd want to create a buffer from the bytes directly. + yy_switch_to_buffer(yy_create_buffer( sl->istream_l(), sl->length_off() )); +} + +/** pop the inputstack. conceptually this is a destructor, but it + does not destruct the Source_file it creates. */ +bool +Includable_lexer::close_input() +{ + include_stack_.pop(); + char_count_stack_.pop(); + cout << "]"<<flush; + yy_delete_buffer(yy_current_buffer ); + if (state_stack_.empty()) { + yy_current_buffer = 0; + return false; + }else { + yy_switch_to_buffer(state_stack_.pop()); + return true; + } +} + +char const* +Includable_lexer::here_ch_C() +{ + if (include_stack_.empty()) + return 0; + return include_stack_.top()->ch_C() + char_count_stack_.top(); +} + +Includable_lexer::~Includable_lexer() +{ + while (!include_stack_.empty()) { + close_input(); + }; +} +/** + Since we don't create the buffer state from the bytes directly, we + don't know about the location of the lexer. Add this as a + YY_USER_ACTION */ +void +Includable_lexer::add_lexed_char(int count) +{ + char_count_stack_.top() += count; +} diff --git a/lib/include/binary-source-file.hh b/lib/include/binary-source-file.hh index 1af35631be..bc8279f6ab 100644 --- a/lib/include/binary-source-file.hh +++ b/lib/include/binary-source-file.hh @@ -6,6 +6,8 @@ #ifndef BINARY_SOURCE_FILE_HH #define BINARY_SOURCE_FILE_HH +#include "source-file.hh" + class Binary_source_file : public Source_file { public: Binary_source_file( String& filename_str ); diff --git a/lib/include/duration-convert.hh b/lib/include/duration-convert.hh new file mode 100644 index 0000000000..9c8b53d709 --- /dev/null +++ b/lib/include/duration-convert.hh @@ -0,0 +1,103 @@ + +/* + duration-convert.hh -- declare + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef DURATION_CONVERT_HH +#define DURATION_CONVERT_HH +#include "duration.hh" +#include "string.hh" + +/** + Duration_convert handles all conversions to -n fro Duration (dur). + That is including (integer + division) representation for MIDI, + and conversion from unexact time representation (best guess :-). + + A Moment (mom) is a Rational that holds the time fraction + compared to a whole note (before also called wholes). + + SUGGESTION: currently a moment in time is called moment too; + let-s typedef Rational When too, so that we get + When Staff_column::when(), Moment Voice_element::mom(). +*/ +struct Duration_convert { + + /* Urgh. statics. + */ + static bool be_blonde_b_s; // cute, but not informative. everythiing is blonde, right? HW + static bool no_double_dots_b_s; + static bool no_triplets_b_s; + static int no_smaller_than_i_s; + +// /// Most used division in MIDI, all fine with me. +// static int const division_1_c_i = 384; + +// /// Return (integer, division) representation. +// static int dur2_i( Duration dur, int division_1_i = division_1_c_i ); + + /// Return number of ticks in (ticks, division_1) representation + static int dur2ticks_i( Duration dur ); + + /// Return Moment representation (fraction of whole note). + static Moment dur2_mom( Duration dur ); + + /// Return Mudela string representation. + static String dur2_str( Duration dur ); + +// /// Return Moment from (integer, division) representation. +// static Moment i2_mom( int i, int division_1_i = division_1_c_i ); + +// /// Return Moment (fraction of whole) representation, best guess. +// static Duration mom2_dur( Moment mom ); + + /// Return plet factor (not a Moment: should use Rational?). + static Moment plet_factor_mom( Duration dur ); + + /** Return synchronisation factor for mom, so that + mom2_dur( mom / sync_f ) will return the duration dur. + */ + static Real sync_f( Duration dur, Moment mom ); + + /// Return exact duration, in midi-ticks if not-exact. + static Duration ticks2_dur( int ticks_i ); + + /// Return standardised duration, best guess if not exact. + static Duration ticks2standardised_dur( int ticks_i ); +}; + +/// (iter_dur) +struct Duration_iterator { + /// start at shortest: 128:2/3 + Duration_iterator(); + + // **** what about these three here ? + /// return forward_dur(); + Duration operator ++(int); + + /// return ok() + operator bool(); + + /// return dur() + Duration operator ()(); + // **** + + /// return current dur + Duration dur(); + + /// return dur(), step to next + Duration forward_dur(); + + /// durations left? + bool ok(); + +private: + Duration cursor_dur_; +}; + + +#endif // DURATION_CONVERT_HH diff --git a/lib/include/duration.hh b/lib/include/duration.hh index 5c56285954..de576e9884 100644 --- a/lib/include/duration.hh +++ b/lib/include/duration.hh @@ -1,128 +1,57 @@ -// -// duration.hh -- declare Duration, Plet, Duration_convert Duration_iterator -// -// copyright 1997 Jan Nieuwenhuizen <jan@digicash.com> +/* + duration.hh -- declare Duration Plet + + source file of the LilyPond music typesetter + + (c) 1997 Jan Nieuwenhuizen <jan@digicash.com> + +*/ // split into 4? #ifndef DURATION_HH #define DURATION_HH +#include "fproto.hh" +#include "moment.hh" + // ugh, to get me in lily lib extern bool no_triplets_bo_g; -/// (dur) -struct Duration { - // actually i hate it when other people use default arguments, - // because it makes you easily loose track of what-s really - // happening; in the routine-s implementation you-re not aware - // of this defaultness (who sets this stupid value?). - Duration( int type_i = 1, int dots_i = 0, Plet* plet_p = 0 ); - Duration( Duration const& dur_c_r ); - ~Duration(); - - Duration const& operator =( Duration const& dur_c_r ); - - void set_plet( Plet* plet_l ); // handiger: newt zelf - void set_ticks( int ticks_i ); - - static int division_1_i_s; - int type_i_; - int dots_i_; - Plet* plet_p_; - int ticks_i_; -}; - -/// (plet) +/** (plet) + The type and replacement value of a plet (triplet, quintuplet.) Conceptually the same as a rational, but 4/6 != 2/3 + */ struct Plet { - Plet( int replace_i, int type_i ); - + Plet( int replace_i, int type_i ); + Plet(); + Moment mom()const; + bool unit_b()const; int iso_i_; // 2/3; 2 is not duration, maar of count! - int type_i_; + int type_i_; }; /** - Duration_convert handles all conversions to -n fro Duration (dur). - That is including (integer + division) representation for MIDI, - and conversion from unexact time representation (best guess :-). - - A Moment (mom) is a Rational that holds the time fraction - compared to a whole note (before also called wholes). - - SUGGESTION: currently a moment in time is called moment too; - let-s typedef Rational When too, so that we get - When Staff_column::when(), Moment Voice_element::mom(). -*/ -struct Duration_convert { - static bool be_blonde_b_s; - static bool no_double_dots_b_s; - static bool no_triplets_b_s; - static int no_smaller_than_i_s; - -// /// Most used division in MIDI, all fine with me. -// static int const division_1_c_i = 384; - -// /// Return (integer, division) representation. -// static int dur2_i( Duration dur, int division_1_i = division_1_c_i ); - - /// Return number of ticks in (ticks, division_1) representation - static int dur2ticks_i( Duration dur ); - - /// Return Moment representation (fraction of whole note). - static Moment dur2_mom( Duration dur ); - - /// Return Mudela string representation. - static String dur2_str( Duration dur ); - -// /// Return Moment from (integer, division) representation. -// static Moment i2_mom( int i, int division_1_i = division_1_c_i ); - -// /// Return Moment (fraction of whole) representation, best guess. -// static Duration mom2_dur( Moment mom ); - - /// Return plet factor (not a Moment: should use Rational?). - static Moment plet_factor_mom( Duration dur ); - - /** Return synchronisation factor for mom, so that - mom2_dur( mom / sync_f ) will return the duration dur. - */ - static Real sync_f( Duration dur, Moment mom ); - - /// Return exact duration, in midi-ticks if not-exact. - static Duration ticks2_dur( int ticks_i ); - - /// Return standardised duration, best guess if not exact. - static Duration ticks2standardised_dur( int ticks_i ); -}; - -/// (iter_dur) -struct Duration_iterator { - /// start at shortest: 128:2/3 - Duration_iterator(); - - // **** what about these three here ? - /// return forward_dur(); - Duration operator ++(int); - - /// return ok() - operator bool(); - - /// return dur() - Duration operator ()(); - // **** - - /// return current dur - Duration dur(); - - /// return dur(), step to next - Duration forward_dur(); - - /// durations left? - bool ok(); - -private: - Duration cursor_dur_; + Class to handle "musical" durations. This means: balltype 1,2,4,etc. and dots. + + (dur) + */ +struct Duration { + /* actually i hate it when other people use default arguments, + because it makes you easily loose track of what-s really + happening; in the routine-s implementation you-re not aware + of this defaultness (who sets this stupid value?).*/ + Duration( int type_i = 1, int dots_i = 0); + /// is the "plet factor" of this note != 1 ? + bool plet_b(); + String str()const; + void set_plet(int,int ); + void set_ticks( int ticks_i ); + Moment length() const ; // zo naai mij + static int division_1_i_s; + int type_i_; + int dots_i_; + Plet plet_; + int ticks_i_; }; - #endif // DURATION_HH diff --git a/lib/include/includable-lexer.hh b/lib/include/includable-lexer.hh new file mode 100644 index 0000000000..3a076181a4 --- /dev/null +++ b/lib/include/includable-lexer.hh @@ -0,0 +1,39 @@ +/* + includable-lexer.hh -- declare + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef INCLUDABLE_LEXER_HH +#define INCLUDABLE_LEXER_HH +#include "string.hh" +#include <FlexLexer.h> +#include "varray.hh" +#include "fproto.hh" +#include "proto.hh" + +// GIGA urg! +typedef struct yy_buffer_state *YY_BUFFER_STATE; + +/** + an yyFlexLexer child with provisions for inclusion. + */ +class Includable_lexer : public yyFlexLexer { + Array<YY_BUFFER_STATE> state_stack_; +protected: + bool close_input(); + Array<Source_file*> include_stack_; + Array<int> char_count_stack_; +public: + void new_input(String s,Sources*); + Includable_lexer(); + ~Includable_lexer(); + void add_lexed_char(int); + char const * here_ch_C(); +}; + + +#endif // INCLUDABLE_LEXER_HH diff --git a/lib/include/input-file.hh b/lib/include/input-file.hh deleted file mode 100644 index a01ea75076..0000000000 --- a/lib/include/input-file.hh +++ /dev/null @@ -1,28 +0,0 @@ -/* - input-file.hh -- declare Input_file - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> -*/ - -#ifndef INPUT_FILE_HH -#define INPUT_FILE_HH -#include <FlexLexer.h> -#include "proto.hh" -#include "fproto.hh" -#include "varray.hh" -#include "string.hh" - -struct Input_file { - istream* is; - char const* defined_ch_c_l_; - Source_file* sourcefile_l_; - int line; - String name; - - Input_file(String); - ~Input_file(); -}; - -#endif // INPUT_FILE_HH diff --git a/lib/include/proto.hh b/lib/include/proto.hh index a58e2969c1..32714730c7 100644 --- a/lib/include/proto.hh +++ b/lib/include/proto.hh @@ -131,7 +131,7 @@ struct Skip_req; struct Slur; struct Slur_register; struct Slur_req; -struct Source; +struct Sources; struct Source_file; struct Spacing_req ; struct Span_req; diff --git a/lib/include/source-file.hh b/lib/include/source-file.hh index 7f7168eb7e..6fdcc5d88a 100644 --- a/lib/include/source-file.hh +++ b/lib/include/source-file.hh @@ -5,19 +5,21 @@ #ifndef SOURCE_FILE_HH #define SOURCE_FILE_HH - +#include "fproto.hh" +#include "string.hh" +class istream; /// class for reading and mapping a file. class Source_file { public: /** Ugh! filename gets changed! The path to the opened file may change, since it might be searched in multiple directories. */ - Source_file( String& filename_str_r ); + Source_file( String filename_str_r ); virtual ~Source_file(); - char const* ch_c_l(); + char const* ch_C(); virtual String error_str( char const* pos_ch_c_l ); - istream* istream_l(); + istream * istream_l(); bool in_b( char const* pos_ch_c_l ); off_t length_off(); virtual int line_i( char const* pos_ch_c_l ); diff --git a/lib/include/source.hh b/lib/include/source.hh index 6c79b75a99..05890f1310 100644 --- a/lib/include/source.hh +++ b/lib/include/source.hh @@ -5,22 +5,24 @@ #ifndef SOURCE_HH #define SOURCE_HH - -class Source +#include "source-file.hh" +#include "plist.hh" +#include "path.hh" +class Sources { public: - Source(); - ~Source(); - - void add( Source_file* sourcefile_p ); + Source_file * get_file_l( String &filename ); Source_file* sourcefile_l( char const* ch_c_l ); - + void set_path(File_path*p_C); + Sources(); + void set_binary(bool); private: + const File_path * path_C_; + void add( Source_file* sourcefile_p ); IPointerList<Source_file*> sourcefile_p_iplist_; + bool binary_b_ ; }; -// ugh -extern Source* source_l_g; #endif // SOURCE_HH // diff --git a/lib/input-file.cc b/lib/input-file.cc deleted file mode 100644 index a0f1018be6..0000000000 --- a/lib/input-file.cc +++ /dev/null @@ -1,47 +0,0 @@ -/* - input-file.cc -- implement Input_file - - source file of the LilyPond music typesetter - - (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> Jan Nieuwenhuizen <jan@digicash.com> -*/ - -#include <iostream.h> -#include <strstream.h> -#include "proto.hh" -#include "plist.hh" -#include "input-file.hh" -#include "debug.hh" -#include "source-file.hh" -#include "binary-source-file.hh" -#include "source.hh" - -Input_file::Input_file(String s) -{ - name = s; - line = 1; - String pf(s); - if ( pf == "" ) { - is = &cin; - defined_ch_c_l_ = 0; - sourcefile_l_ = 0; - } - else { - Source_file* sourcefile_p = 0; - // ugh, very dirty, need to go away - if ( ( pf.right_str( 3 ).lower_str() == "mid" ) || ( pf.right_str( 4 ).lower_str() == "midi" ) ) - sourcefile_p = new Binary_source_file( pf ); - else - sourcefile_p = new Source_file( pf ); - source_l_g->add( sourcefile_p ); - sourcefile_l_ = sourcefile_p; - is = sourcefile_l_->istream_l(); - defined_ch_c_l_ = sourcefile_l_->ch_c_l(); - } - cout << "[" << pf << flush; -} - -Input_file::~Input_file() -{ - cout << "]" << flush; -} diff --git a/lib/source-file.cc b/lib/source-file.cc index a39a57cbfa..28ede975d6 100644 --- a/lib/source-file.cc +++ b/lib/source-file.cc @@ -18,20 +18,13 @@ #include "proto.hh" #include "plist.hh" -//#include "lexer.hh" #include "debug.hh" #include "windhoos-suck-suck-suck-thank-you-cygnus.hh" -// #include "parseconstruct.hh" // defined_ch_c_l -extern char const* defined_ch_c_l; - -// ugh -// #include "main.hh" // find_file -String find_file(String); #include "source-file.hh" -Source_file::Source_file( String &filename_str ) +Source_file::Source_file( String filename_str ) { data_caddr_ = 0; fildes_i_ = 0; @@ -41,8 +34,21 @@ Source_file::Source_file( String &filename_str ) open(); map(); - // ugh!?, should call name_str() ! - filename_str = name_str_; +} + +istream* +Source_file::istream_l() +{ + assert( fildes_i_ ); + if ( !istream_p_ ) { + if ( size_off_ ) // can-t this be done without such a hack? + istream_p_ = new istrstream( ch_C(), size_off_ ); + else { + istream_p_ = new istrstream( "", 0 ); + istream_p_->set(ios::eofbit); + } + } + return istream_p_; } Source_file::~Source_file() @@ -54,7 +60,7 @@ Source_file::~Source_file() } char const* -Source_file::ch_c_l() +Source_file::ch_C() { assert( this ); return (char const*)data_caddr_; @@ -70,73 +76,52 @@ Source_file::close() } String -Source_file::error_str( char const* pos_ch_c_l ) +Source_file::error_str( char const* pos_ch_C ) { - assert( this ); - if ( !in_b( pos_ch_c_l ) ) - return ""; - - char const* begin_ch_c_l = pos_ch_c_l; - char const* data_ch_c_l = ch_c_l(); - while ( begin_ch_c_l > data_ch_c_l ) - if ( *--begin_ch_c_l == '\n' ) { - begin_ch_c_l++; + char const* data_ch_C = ch_C(); + char const * eof_C_ = data_ch_C + size_off_; + if ( !in_b( pos_ch_C ) ) + return "(position unknown)"; + + + if ( pos_ch_C == eof_C_) + pos_ch_C --; + char const* begin_ch_C = pos_ch_C; + while ( begin_ch_C > data_ch_C ) + if ( *--begin_ch_C == '\n' ) { + begin_ch_C++; break; } - char const* end_ch_c_l = pos_ch_c_l; - while ( end_ch_c_l < data_ch_c_l + size_off_ ) - if ( *end_ch_c_l++ == '\n' ) { - break; + char const* end_ch_C = pos_ch_C; + while ( end_ch_C < eof_C_ ) + if ( *end_ch_C++ == '\n' ) { + end_ch_C--; + break; } - end_ch_c_l--; - -#if 1 -// String( char const* p, int length ) is missing!? - String line_str( (Byte const*)begin_ch_c_l, end_ch_c_l - begin_ch_c_l ); -#else - int length_i = end_ch_c_l - begin_ch_c_l; - char* ch_p = new char[ length_i + 1 ]; - strncpy( ch_p, begin_ch_c_l, length_i ); - ch_p[ length_i ] = 0; - String line_str( ch_p ); - delete ch_p; -#endif + + // String( char const* p, int length ) is missing!? + String line_str( (Byte const*)begin_ch_C, end_ch_C - begin_ch_C ); int error_col_i = 0; - char const* scan_ch_c_l = begin_ch_c_l; - while ( scan_ch_c_l < pos_ch_c_l ) - if ( *scan_ch_c_l++ == '\t' ) + char const* scan_ch_C = begin_ch_C; + while ( scan_ch_C < pos_ch_C ) + if ( *scan_ch_C++ == '\t' ) error_col_i = ( error_col_i / 8 + 1 ) * 8; else error_col_i++; - String str = line_str.left_str( pos_ch_c_l - begin_ch_c_l ) + String str = line_str.left_str( pos_ch_C - begin_ch_C ) + String( '\n' ) + String( ' ', error_col_i ) - + line_str.mid_str( pos_ch_c_l - begin_ch_c_l, INT_MAX ); // String::mid should take 0 arg.. + + line_str.mid_str( pos_ch_C - begin_ch_C, INT_MAX ); // String::mid should take 0 arg.. return str; } bool -Source_file::in_b( char const* pos_ch_c_l ) -{ - return ( pos_ch_c_l && ( pos_ch_c_l >= ch_c_l() ) && ( pos_ch_c_l < ch_c_l() + size_off_ ) ); -} - -istream* -Source_file::istream_l() +Source_file::in_b( char const* pos_ch_C ) { - assert( fildes_i_ ); - if ( !istream_p_ ) { - if ( size_off_ ) // can-t this be done without such a hack? - istream_p_ = new istrstream( ch_c_l(), size_off_ ); - else { - istream_p_ = new istrstream( "", 0 ); - istream_p_->set(ios::eofbit); - } - } - return istream_p_; + return ( pos_ch_C && ( pos_ch_C >= ch_C() ) && ( pos_ch_C <= ch_C() + size_off_ ) ); } off_t @@ -146,15 +131,15 @@ Source_file::length_off() } int -Source_file::line_i( char const* pos_ch_c_l ) +Source_file::line_i( char const* pos_ch_C ) { - if ( !in_b( pos_ch_c_l ) ) + if ( !in_b( pos_ch_C ) ) return 0; int i = 1; - char const* scan_ch_c_l = ch_c_l(); - while ( scan_ch_c_l < pos_ch_c_l ) - if ( *scan_ch_c_l++ == '\n' ) + char const* scan_ch_C = ch_C(); + while ( scan_ch_C < pos_ch_C ) + if ( *scan_ch_C++ == '\n' ) i++; return i; } @@ -168,8 +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 ) - // ugh: defined_ch_c_l... - warning( String( "can't map: " ) + name_str_ + String( ": " ) + strerror( errno ), defined_ch_c_l ); //lexer->here_ch_c_l() ); + warning( String( "can't map: " ) + name_str_ + String( ": " ) + strerror( errno ), 0); } String @@ -181,14 +165,10 @@ Source_file::name_str() void Source_file::open() { - String name_str = find_file( name_str_ ); - if ( name_str != "" ) - name_str_ = name_str; - fildes_i_ = ::open( name_str_, O_RDONLY ); if ( fildes_i_ == -1 ) { - warning( String( "can't open: " ) + name_str_ + String( ": " ) + strerror( errno ), defined_ch_c_l ); // lexer->here_ch_c_l() ); + warning( String( "can't open: " ) + name_str_ + String( ": " ) + strerror( errno ), 0 ); return; } @@ -207,8 +187,8 @@ Source_file::unmap() } } String -Source_file::file_line_no_str(char const *ch_c_l ) +Source_file::file_line_no_str(char const *ch_C ) { return name_str() + ": " - + String( line_i( ch_c_l ) ); + + String( line_i( ch_C ) ); } diff --git a/lib/source.cc b/lib/source.cc index 8a8c528835..3247c8d82c 100644 --- a/lib/source.cc +++ b/lib/source.cc @@ -1,36 +1,72 @@ -// -// source.cc -// +/* + source.cc -- implement Source + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + #include <assert.h> +#include "binary-source-file.hh" #include "string.hh" #include "proto.hh" #include "plist.hh" - #include "source-file.hh" #include "source.hh" -Source::Source() +void +Sources::set_path(File_path *f_C) +{ + path_C_ = f_C; +} + +/** + open a file + + @param file_str the file to be opened, name might be changed if it + is found in a search path. + + @return 0 if no file found + */ +Source_file* +Sources::get_file_l(String &file_str ) { + if (path_C_){ + file_str = path_C_->find(file_str); + if (file_str== "") + return 0; + } + Source_file * f_p= (!binary_b_) ? + new Source_file(file_str) : new Binary_source_file(file_str); + add(f_p); + return f_p; } -Source::~Source() +Sources::Sources() { + path_C_= 0; + binary_b_ = false; } void -Source::add( Source_file* sourcefile_p ) +Sources::add( Source_file* sourcefile_p ) { sourcefile_p_iplist_.bottom().add( sourcefile_p ); } +/** + search the list for file whose map contains pointer #ch_C# + + @return 0 if not found. + */ Source_file* -Source::sourcefile_l( char const* ch_c_l ) +Sources::sourcefile_l( char const* ch_C ) { PCursor<Source_file*> sourcefile_l_pcur( sourcefile_p_iplist_.top() ); for ( ; sourcefile_l_pcur.ok(); sourcefile_l_pcur++ ) - if ( sourcefile_l_pcur->in_b( ch_c_l ) ) + if ( sourcefile_l_pcur->in_b( ch_C ) ) return *sourcefile_l_pcur; return 0; } diff --git a/lib/template.cc b/lib/template.cc new file mode 100644 index 0000000000..2e3d527baf --- /dev/null +++ b/lib/template.cc @@ -0,0 +1,6 @@ +#include "source-file.hh" +#include "plist.tcc" +#include "pcursor.tcc" + + +IPL_instantiate(Source_file); diff --git a/lily/.version b/lily/.version index 0ae4d984d1..c74b79390b 100644 --- a/lily/.version +++ b/lily/.version @@ -1,6 +1,6 @@ MAJOR_VERSION = 0 MINOR_VERSION = 0 -PATCH_LEVEL = 43 +PATCH_LEVEL = 44 # use to send patches, always empty for released version: # include separator: ".postfix", "-pl" makes rpm barf diff --git a/lily/Makefile b/lily/Makefile index cb49063ad6..f052914063 100644 --- a/lily/Makefile +++ b/lily/Makefile @@ -69,7 +69,7 @@ include ./$(depth)/make/Rules.make # force these: Make can't know these have to be generated in advance my-lily-lexer.cc: $(outdir)/parser.hh -lexer.l: $(outdir)/parser.hh +$(outdir)/lexer.cc: $(outdir)/parser.hh # diff --git a/lily/bar-reg.cc b/lily/bar-reg.cc index c7c0d05e3d..c28443df62 100644 --- a/lily/bar-reg.cc +++ b/lily/bar-reg.cc @@ -35,7 +35,7 @@ Bar_register::process_requests() { if (bar_req_l_ ) { bar_p_ = new Bar(bar_req_l_->type_str_); - } else if (!get_staff_info().time_c_l_->whole_in_measure_) { + } else if (!get_staff_info().time_C_->whole_in_measure_) { bar_p_ = new Bar("|"); } diff --git a/lily/clef-reg.cc b/lily/clef-reg.cc index b4775721bb..2492703cdf 100644 --- a/lily/clef-reg.cc +++ b/lily/clef-reg.cc @@ -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_l_); + error("unknown clef type ", c_l->defined_ch_C_); } bool @@ -65,7 +65,7 @@ Clef_register::try_request(Request * r_l) void Clef_register::process_requests() { - Time_description const *time_l = get_staff_info().time_c_l_; + Time_description const *time_l = get_staff_info().time_C_; if (!clef_req_l_ && (!time_l->whole_in_measure_|| !time_l->when_)) { clef_p_ = new Clef_item; clef_p_->change = false; diff --git a/lily/debug.cc b/lily/debug.cc index 01a35bd140..67bcd70681 100644 --- a/lily/debug.cc +++ b/lily/debug.cc @@ -4,11 +4,11 @@ #include <stdlib.h> #include "debug.hh" #include "dstream.hh" -#include "vector.hh" +#include "flower-debug.hh" Dstream *monitor=0; ostream * nulldev =0; - +// ugh struct _Dinit { _Dinit() { nulldev = new ofstream("/dev/null"); @@ -44,7 +44,8 @@ debug_init() #ifndef NDEBUG set_new_handler(&mynewhandler); #endif - set_matrix_debug(*monitor); + set_flower_debug(*monitor, check_debug); + signal(SIGFPE, float_handler); } diff --git a/lily/headreg.cc b/lily/headreg.cc index 7f1a9bbae8..93ea9b2d08 100644 --- a/lily/headreg.cc +++ b/lily/headreg.cc @@ -48,9 +48,8 @@ Notehead_register::process_requests() n_p->position = note_req_l_->note()->height() + *get_staff_info().c0_position_i_; } else { - note_p_ = new Rest ( note_req_l_->rhythmic()->balltype, - note_req_l_->rhythmic()->dots); - if (note_req_l_->rhythmic()->balltype <= 2) + note_p_ = new Rest ( note_req_l_->rhythmic()->duration_); + if (note_req_l_->rhythmic()->duration_.type_i_ <= 2) note_p_->translate( Offset(0, 6 * paper()->internote())); diff --git a/lily/include/input-score.hh b/lily/include/input-score.hh index a7468e03fa..36baf691c9 100644 --- a/lily/include/input-score.hh +++ b/lily/include/input-score.hh @@ -19,7 +19,7 @@ /// the total music def of one movement struct Input_score { /// defined where? - char const * defined_ch_c_l_; + char const * defined_ch_C_; int errorlevel_i_; /// paper_, staffs_ and commands_ form the problem definition. diff --git a/lily/include/input-staff.hh b/lily/include/input-staff.hh index 23495bd744..25e1431162 100644 --- a/lily/include/input-staff.hh +++ b/lily/include/input-staff.hh @@ -14,7 +14,7 @@ struct Input_staff { - char const * defined_ch_c_l_; + char const * defined_ch_C_; String type; IPointerList<Input_music*> music_; diff --git a/lily/include/lily-proto.hh b/lily/include/lily-proto.hh new file mode 100644 index 0000000000..88b7adaa78 --- /dev/null +++ b/lily/include/lily-proto.hh @@ -0,0 +1,2 @@ +struct My_lily_lexer; +struct My_lily_parser; diff --git a/lily/include/local-key-reg.hh b/lily/include/local-key-reg.hh index 9611449383..628ccc7c42 100644 --- a/lily/include/local-key-reg.hh +++ b/lily/include/local-key-reg.hh @@ -13,7 +13,7 @@ struct Local_key_register : Request_register { Local_key local_key_; Local_key_item* key_item_p_; - Key const *key_c_l_; + Key const *key_C_; /* *************** */ virtual void process_requests(); virtual void acknowledge_element(Staff_elem_info); diff --git a/lily/include/main.hh b/lily/include/main.hh index 203eac71ae..10fc7c3f47 100644 --- a/lily/include/main.hh +++ b/lily/include/main.hh @@ -10,8 +10,7 @@ void set_default_output(String s); Input_score* current_iscore_l(); String find_file(String); String get_version_str(); -extern String infile_str_g; -extern Source* source_l_g; +extern Sources* source_l_g; extern bool only_midi; extern String default_out_fn; diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index 761efce6bd..d9a13deda9 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -11,6 +11,7 @@ #define MUSICALREQUESTS_HH #include "request.hh" +#include "duration.hh" /** @@ -38,14 +39,13 @@ struct Skip_req : Musical_req { This request is used only a base class. */ struct Rhythmic_req : virtual Musical_req { - int balltype; - int dots; - Moment plet_factor; + Duration duration_; + /* *************** */ + void set_duration(Duration); static int compare(const Rhythmic_req &, const Rhythmic_req &); virtual Moment duration() const; Rhythmic_req(); - Rhythmic_req(int,int); REQUESTMETHODS(Rhythmic_req, rhythmic); }; @@ -133,7 +133,7 @@ public: struct Stem_req : Rhythmic_req { /// preferred direction for the stem int dir_i_; - Stem_req(int s, int dots); + Stem_req(); REQUESTMETHODS(Stem_req,stem); }; diff --git a/lily/include/my-lily-lexer.hh b/lily/include/my-lily-lexer.hh index c3f2bfa388..8dbc42e861 100644 --- a/lily/include/my-lily-lexer.hh +++ b/lily/include/my-lily-lexer.hh @@ -8,46 +8,33 @@ #ifndef LEXER_HH #define LEXER_HH + #include <FlexLexer.h> + #include "proto.hh" #include "fproto.hh" #include "varray.hh" #include "string.hh" +#include "includable-lexer.hh" +#include "duration.hh" -int yylex(); -void yyerror(char const *s); bool busy_parsing(); void kill_lexer(); void set_lexer(); -struct Lexer_prefs { - int default_duration, default_dots, default_octave_i_; - int default_plet_type, default_plet_dur; - String textstyle_str_; - - bool last_duration_mode ; - - Lexer_prefs(); - Moment plet_mom(); - void set_default_duration(int *); - void set_last_duration(int n); - void set_duration_mode(String s); - void get_default_duration(int *); - void set_plet(int,int); -}; - -/// lexer with provisions for include files. -class My_lily_lexer : public yyFlexLexer { +/// lexer for Mudela +class My_lily_lexer : public Includable_lexer { int lookup_keyword(String); void lookup_notename(int &large, int &small, String s); int scan_bare_word(String); int scan_escaped_word(String); + bool post_quotes_b_; public: - Lexer_prefs prefs; + void * lexval_l; + - Array<Input_file*> include_stack_; Assoc<String, Identifier*> *identifier_assoc_p_; Keyword_table * keytable_p_; int errorlevel_i_; @@ -55,25 +42,19 @@ public: /* *************** */ Identifier*lookup_identifier(String s); - char const* here_ch_c_l(); void push_note_state(); void push_lyric_state(); void pop_state(); void LexerError(char const *); - String spot() const; My_lily_lexer(); void add_identifier(Identifier*i); ~My_lily_lexer(); - void new_input(String s); - bool close_input(); int yylex(); - void print_init_declarations() const; - void print_user_declarations() const; + void print_declarations(bool init_b) const; + bool note_state_b() const; bool lyric_state_b() const; }; -extern My_lily_lexer *lexer; - #endif diff --git a/lily/include/my-lily-parser.hh b/lily/include/my-lily-parser.hh new file mode 100644 index 0000000000..679c381181 --- /dev/null +++ b/lily/include/my-lily-parser.hh @@ -0,0 +1,65 @@ +/* + my-lily-parser.hh -- declare + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + + +#ifndef MY_LILY_PARSER_HH +#define MY_LILY_PARSER_HH +#include "proto.hh" +#include "duration.hh" +#include "string.hh" +#include "varray.hh" +#include "lily-proto.hh" +#include "proto.hh" +#include "duration.hh" +#include "string.hh" +#include "varray.hh" + +class My_lily_parser { +public: + friend int yyparse( void*); + + int default_octave_i_; + Duration default_duration_; + String textstyle_str_; + + bool last_duration_mode ; + + Array<Request*> pre_reqs, post_reqs; + Array<const char *> define_spot_array_; + char const* defined_ch_C_; + int fatal_error_i_; + Sources * source_l_; + int error_level_i_; + bool init_parse_b_; + 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; + void remember_spot(); + Paper_def*default_paper(); + void do_yyparse(); + void parser_error(String); + + Request* get_parens_request(char c); + + void set_debug(); + void set_yydebug(bool); + void print_declarations(); +public: + void parse_file ( String init_str, String file_str); + My_lily_parser(Sources * sources_l); +}; + +#endif // MY_LILY_PARSER_HH diff --git a/lily/include/parseconstruct.hh b/lily/include/parseconstruct.hh index 6a44167532..45b7c3f3c8 100644 --- a/lily/include/parseconstruct.hh +++ b/lily/include/parseconstruct.hh @@ -9,27 +9,12 @@ #include "proto.hh" -extern char const* defined_ch_c_l; -extern char const* req_defined_ch_c_l; - - - - -Voice_element * get_note_element(Note_req * ,int *); -Voice_element* get_rest_element(String,int *); -Voice_element* get_word_element(Text_def*, int*); -void add_requests( Voice_element*v, Array<Request*>&req); -Request* get_request(char); -Script_def* get_scriptdef(char); -Text_def*get_text(String s); +String * get_scriptdef(char c); +Request* get_script_req(char); Request* get_plet_request( char c, int dur_i, int type_i ); Request*get_script_req(int d , Script_def*def); Request*get_text_req(int d , Text_def*def); Request* get_stemdir_req(int); - - - - Request*get_grouping_req(Array<int> i_arr); #endif // PARSECONSTRUCT_HH diff --git a/lily/include/request.hh b/lily/include/request.hh index 6e9bfd4df2..66e62d4843 100644 --- a/lily/include/request.hh +++ b/lily/include/request.hh @@ -23,7 +23,7 @@ class Request { public: Voice_element*elt_l_; - char const* defined_ch_c_l_; + char const* defined_ch_C_; /* *************** */ Voice * voice_l(); diff --git a/lily/include/rest.hh b/lily/include/rest.hh index 85c7266677..67ca259f54 100644 --- a/lily/include/rest.hh +++ b/lily/include/rest.hh @@ -12,11 +12,13 @@ struct Rest : Item { int dots; int balltype; - + + /// rests can be translated up and down. + int pos_i_; /* *************** */ - Rest(int dur,int dots); + Rest(Duration); void do_print()const; NAME_MEMBERS(Rest); Molecule* brew_molecule_p()const; diff --git a/lily/include/score.hh b/lily/include/score.hh index 4f10a7f95f..293801a98e 100644 --- a/lily/include/score.hh +++ b/lily/include/score.hh @@ -28,7 +28,7 @@ struct Score { IPointerList<Score_column*> cols_; PScore *pscore_p_; - char const *defined_ch_c_l_; + char const *defined_ch_C_; int errorlevel_i_; /* *************************************************************** */ diff --git a/lily/include/staff-elem-info.hh b/lily/include/staff-elem-info.hh index 4e3392027d..2dcbc845a9 100644 --- a/lily/include/staff-elem-info.hh +++ b/lily/include/staff-elem-info.hh @@ -28,8 +28,8 @@ struct Staff_elem_info { struct Staff_info { int *c0_position_i_; Staff_walker *walk_l_; - Time_description const *time_c_l_; - Rhythmic_grouping const *rhythmic_c_l_; + Time_description const *time_C_; + Rhythmic_grouping const *rhythmic_C_; bool break_allowed_b_; }; diff --git a/lily/include/text-def.hh b/lily/include/text-def.hh index b59df7f532..50bb98105c 100644 --- a/lily/include/text-def.hh +++ b/lily/include/text-def.hh @@ -14,7 +14,7 @@ struct Text_def { int align_i_; String text_str_; String style_str_; - char const* defined_ch_c_l_; + char const* defined_ch_C_; /* *************** */ diff --git a/lily/include/voice-element.hh b/lily/include/voice-element.hh index cf398bc9b6..0b606f1301 100644 --- a/lily/include/voice-element.hh +++ b/lily/include/voice-element.hh @@ -18,7 +18,7 @@ *the requests, */ struct Voice_element { Moment duration; - char const* defined_ch_c_l_; + char const* defined_ch_C_; Voice const *voice_l_; IPointerList<Request*> reqs; diff --git a/lily/input-music.cc b/lily/input-music.cc index 5c8aa72472..26377e7f53 100644 --- a/lily/input-music.cc +++ b/lily/input-music.cc @@ -11,7 +11,7 @@ Input_music::check_plet(Voice_element* velt_l) if ( i->plet() ) { Moment start_moment = 0; if ( !find_plet_start_bo( i->plet()->type_c_, start_moment ) ) { - error( "begin of plet not found", i->defined_ch_c_l_ ); + error( "begin of plet not found", i->defined_ch_C_ ); break; } Moment moment = 0; diff --git a/lily/input-score.cc b/lily/input-score.cc index d68dd10959..ed7d831eea 100644 --- a/lily/input-score.cc +++ b/lily/input-score.cc @@ -40,7 +40,7 @@ Input_score::Input_score(Input_score const&s) { paper_p_ = (s.paper_p_)? new Paper_def(*s.paper_p_) :0; midi_p_ = (s.midi_p_)? new Midi_def(*s.midi_p_) : 0; - defined_ch_c_l_ = s.defined_ch_c_l_; + 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_l_= defined_ch_c_l_; + 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,7 @@ Input_score::~Input_score() Input_score::Input_score() { - defined_ch_c_l_=0; + 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 2d42e2a1ba..9262851f3c 100644 --- a/lily/input-staff.cc +++ b/lily/input-staff.cc @@ -20,7 +20,7 @@ Input_staff::Input_staff(String s) { type= s; - defined_ch_c_l_ = 0; + defined_ch_C_ = 0; } void @@ -38,7 +38,7 @@ Input_staff::parse(Score*score_l) else if (type == "lyric") p = new Lyric_staff; else { - error( "Unknown staff-type `" + type +"\'", defined_ch_c_l_ ); + error( "Unknown staff-type `" + type +"\'", defined_ch_C_ ); exit( 1 ); } @@ -55,7 +55,7 @@ Input_staff::Input_staff(Input_staff const&s) { for (iter_top(s.music_,i); i.ok(); i++) add(i->clone()); - defined_ch_c_l_ = s.defined_ch_c_l_; + defined_ch_C_ = s.defined_ch_C_; type = s.type; } diff --git a/lily/key-reg.cc b/lily/key-reg.cc index 865eea264e..8b8b2373b3 100644 --- a/lily/key-reg.cc +++ b/lily/key-reg.cc @@ -49,7 +49,7 @@ Key_register::acknowledge_element(Staff_elem_info info) void Key_register::process_requests() { - Time_description const *time_l = get_staff_info().time_c_l_; + Time_description const *time_l = get_staff_info().time_C_; if (!keyreq_l_ && (!time_l->whole_in_measure_|| !time_l->when_)) { diff --git a/lily/lexer.l b/lily/lexer.l index 549a957efd..21ce7aa06b 100644 --- a/lily/lexer.l +++ b/lily/lexer.l @@ -17,16 +17,19 @@ yy_push_state(quote);\ yylval.string = new String +#define yylval (*(YYSTYPE*)lexval_l) +#define YY_USER_ACTION add_lexed_char(YYLeng()); %} %option c++ %option noyywrap %option nodefault -%option yylineno %option debug %option yyclass="My_lily_lexer" %option stack +%option never-interactive +%option warn %x incl %x lyrics @@ -64,16 +67,17 @@ COMMENT %.*\n -^include { +include { yy_push_state(incl); } <incl>{WHITE}* { /* eat the whitespace */ } <incl>\"[^"]*\" { /* got the include file name */ - String s (YYText()+1); - s = s.left_str(s.length_i()-1); - defined_ch_c_l = here_ch_c_l() - String( YYText() ).length_i() - 1; - new_input(s); - yy_pop_state(); + String s (YYText()+1); + s = s.left_str(s.length_i()-1); + mtor << "#include `" << s << "\'\n"; +// defined_ch_C = here_ch_C() - String( YYText() ).length_i() - 1; + new_input(s,source_l_g); + yy_pop_state(); } <notes>{RESTNAME} { @@ -92,6 +96,18 @@ COMMENT %.*\n s=s.left_str(s.length_i() - 1); return scan_bare_word(s); } +<notes>{ALPHAWORD}/\' { + post_quotes_b_ = true; + return scan_bare_word(YYText()); +} +<notes>\'+ { + yylval.i = YYLeng(); + if (post_quotes_b_) { + post_quotes_b_ = false; + return POST_QUOTES; + } else + return PRE_QUOTES; +} <notes>{ALPHAWORD} { return scan_bare_word(YYText()); @@ -109,23 +125,21 @@ COMMENT %.*\n yylval.i = String_convert::dec2_i( String( YYText() ) ); return INT; } -<notes>[ \t\n]+ { -} <notes>\+\+ { return CONCAT; } <notes>\" { start_quote(); } -<notes>. { - return yylval.c = YYText()[0]; -} \" { start_quote(); } +<quote>\\\\ { + *yylval.string += '\\'; +} <quote>\\\" { *yylval.string +='\"'; } @@ -176,14 +190,13 @@ COMMENT %.*\n <lyrics>[()\[\]|/.^>_-] { return yylval.c = YYText()[0]; } -<lyrics>[ \t\n]+ { -} <<EOF>> { - mtor << "<<EOF>>"; + mtor << "<<eof>>"; - if (! close_input()) + if (! close_input()) { yyterminate(); // can't move this, since it actually rets a YY_NULL + } } {WORD} { return scan_bare_word(YYText()); @@ -210,15 +223,15 @@ COMMENT %.*\n mtor << "misc char" <<c<<"\n"; return c; } -[ \t\n]+ { +<*>{WHITE}+ { } - -{COMMENT} { - //ignore +<notes>. { + return yylval.c = YYText()[0]; } -. { - error( String( "illegal character: " ) + String( YYText()[0] ), here_ch_c_l() ); + +<*>. { + error( String( "illegal character: " ) + String( YYText()[0] ), here_ch_C() ); return YYText()[0]; } diff --git a/lily/local-key-reg.cc b/lily/local-key-reg.cc index bf7eb9c352..0ce36e955c 100644 --- a/lily/local-key-reg.cc +++ b/lily/local-key-reg.cc @@ -16,7 +16,7 @@ Local_key_register::Local_key_register() { key_item_p_ = 0; - key_c_l_ = 0; + key_C_ = 0; } void @@ -51,19 +51,19 @@ Local_key_register::acknowledge_element(Staff_elem_info info) } else if (info.elem_p_->name()==Key_item::static_name()) { Key_register * key_reg_l = (Key_register*)info.origin_reg_l_arr_[0]; - key_c_l_ = &key_reg_l->key_; - local_key_.reset(*key_c_l_); + key_C_ = &key_reg_l->key_; + local_key_.reset(*key_C_); } } void Local_key_register::process_requests() { - Time_description const * time_c_l_ = get_staff_info().time_c_l_; - if (! time_c_l_->whole_in_measure_){ - if (key_c_l_) - local_key_.reset(*key_c_l_); - else if( time_c_l_->when_ >Moment(0)) + Time_description const * time_C_ = get_staff_info().time_C_; + if (! time_C_->whole_in_measure_){ + if (key_C_) + local_key_.reset(*key_C_); + else if( time_C_->when_ >Moment(0)) warning ("Help me! can't figure current key", 0); } } diff --git a/lily/lyric-item.cc b/lily/lyric-item.cc index 6e3fdf02b8..1a54f12bca 100644 --- a/lily/lyric-item.cc +++ b/lily/lyric-item.cc @@ -8,7 +8,6 @@ #include "source-file.hh" #include "source.hh" #include "debug.hh" -#include "main.hh" Lyric_item::Lyric_item(Lyric_req* lreq_l, int voice_count_i) : Text_item(lreq_l,0) @@ -23,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_l_ ); + warning( "foul word", tdef_l()->defined_ch_C_ ); } diff --git a/lily/main.cc b/lily/main.cc index 43a44f3c52..85a6bd923b 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -1,3 +1,11 @@ +/* + main.cc -- implement main: entrypoints + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + #include <iostream.h> #include <assert.h> #include "proto.hh" @@ -8,12 +16,10 @@ #include "main.hh" #include "path.hh" #include "config.hh" -#include "source-file.hh" #include "source.hh" +#include "my-lily-parser.hh" -Source source; -Source* source_l_g = &source; -String infile_str_g; +Sources* source_l_g = 0; bool only_midi = false; extern void parse_file(String,String); @@ -98,6 +104,18 @@ struct Main_init { } } main_init; +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); + do_scores(); + delete source_l_g; + source_l_g = 0; +} + int main (int argc, char **argv) { @@ -141,19 +159,15 @@ main (int argc, char **argv) while ( (arg= oparser.get_next_arg()) ) { String f(arg); destill_inname(f); - infile_str_g = f; - parse_file(init_str,f); - do_scores(); + do_one_file(init_str,f); p++; } if (!p) { - parse_file(init_str, ""); - do_scores(); + do_one_file(init_str, ""); } return 0; } - String find_file(String f) { diff --git a/lily/midi-item.cc b/lily/midi-item.cc index 2bc00a3a0f..04e1286197 100644 --- a/lily/midi-item.cc +++ b/lily/midi-item.cc @@ -213,7 +213,7 @@ Midi_track::Midi_track( int number_i ) number_i_ = number_i; - char const* data_ch_c_l = "" + char const* data_ch_C = "" // "00" "ff58" "0404" "0218" "08" // "00" "ff51" "0307" "a120" // why a key at all, in midi? @@ -225,10 +225,10 @@ Midi_track::Midi_track( int number_i ) String data_str; // only for format 0 (currently using format 1)? - data_str += String_convert::hex2bin_str( data_ch_c_l ); + data_str += String_convert::hex2bin_str( data_ch_C ); - char const* footer_ch_c_l = "00" "ff2f" "00"; - String footer_str = String_convert::hex2bin_str( footer_ch_c_l ); + char const* footer_ch_C = "00" "ff2f" "00"; + String footer_str = String_convert::hex2bin_str( footer_ch_C ); set( "MTrk", data_str, footer_str ); } diff --git a/lily/midi-output.cc b/lily/midi-output.cc index 72f71de64e..73d0260c2b 100644 --- a/lily/midi-output.cc +++ b/lily/midi-output.cc @@ -8,7 +8,8 @@ // "" huh? #include "time.h" - +#include "main.hh" +#include "source.hh" #include "proto.hh" #include "plist.hh" #include "string.hh" @@ -48,36 +49,25 @@ Midi_output::do_staff(Staff*st_l,int track_i) // set track name Midi_text track_name( Midi_text::TRACK_NAME, "Track " + String_convert::i2dec_str( track_i, 0, '0' ) ); - midi_track.add( Moment( 0.0 ), &track_name ); + midi_track.add( Moment( 0 ), &track_name ); // set instrument :-) Midi_text instrument_name( Midi_text::INSTRUMENT_NAME, "piano" ); - midi_track.add( Moment( 0.0 ), &instrument_name ); + midi_track.add( Moment( 0 ), &instrument_name ); // set key, help, where to get key, where to get major/minor? int accidentals_i = 0; int minor_i = 0; -#ifdef UGR - // uph, sorry, wanna test this... - // menuetto in F - if ( ( infile_str_g.index_i( "scsii-menuetto" ) >= 0 ) - || ( infile_str_g.index_i( "standchen" ) >= 0 ) - || ( infile_str_g.left_str( 1 ) == String( "s" ) ) ) - accidentals_i = -1; - // standchen in d - if ( ( infile_str_g.index_i( "standchen" ) >= 0 ) ) - minor_i = 1; -#endif Midi_key midi_key( accidentals_i, minor_i ); - midi_track.add( Moment( 0.0 ), &midi_key ); + midi_track.add( Moment( 0 ), &midi_key ); Midi_tempo midi_tempo( midi_l_->get_tempo_i( Moment( 1, 4 ) ) ); - midi_track.add( Moment( 0.0 ), &midi_tempo ); + midi_track.add( Moment( 0 ), &midi_tempo ); Midi_time midi_time( Midi_def::num_i_s, Midi_def::den_i_s, 18 ); - midi_track.add( Moment( 0.0 ), &midi_time ); + midi_track.add( Moment( 0 ), &midi_time ); for (Midi_walker w (st_l, &midi_track); w.ok(); w++) w.process_requests(); @@ -96,41 +86,26 @@ Midi_output::header() String str = String( "Creator: " ) + get_version_str() + "\n"; Midi_text creator( Midi_text::TEXT, str ); - midi_track.add( Moment( 0.0 ), &creator ); + midi_track.add( Moment( 0 ), &creator ); str = "Generated, at "; str += ctime( &t ); str = str.left_str( str.length_i() - 1 ); str += ",\n"; Midi_text generate( Midi_text::TEXT, str ); - midi_track.add( Moment( 0.0 ), &generate ); + midi_track.add( Moment( 0 ), &generate ); + Source_file* sourcefile_l = source_l_g->sourcefile_l( score_l_->defined_ch_C_ ); + if ( sourcefile_l ) { + str = "from musical definition: " + + sourcefile_l->file_line_no_str(score_l_->defined_ch_C_); - str = "from musical definition: " + infile_str_g + "\n"; + } Midi_text from( Midi_text::TEXT, str ); - midi_track.add( Moment( 0.0 ), &from ); + midi_track.add( Moment( 0 ), &from ); // set track name Midi_text track_name( Midi_text::TRACK_NAME, "Track " + String_convert::i2dec_str( 0, 0, '0' ) ); - midi_track.add( Moment( 0.0 ), &track_name ); - -#if 0 - /* - shouldn't impose copyright on output. - */ - struct tm* tm_l = gmtime( &t ); - String year_str = String_convert::i2dec_str( 1900 + tm_l->tm_year, 4, '0' ); - - // your copyleft here - str = " Copyleft (o) " + year_str + "by\n"; - Midi_text copyleft( Midi_text::COPYRIGHT, str ); - midi_track.add( Moment( 0.0 ), ©left ); - - str = " Han-Wen Nienhuys <hanwen@stack.nl>," - " Jan Nieuwenhuizen <jan@digicash.com>\n"; - - Midi_text authors( Midi_text::COPYRIGHT, str ); - midi_track.add( Moment( 0.0 ), &authors ); -#endif + midi_track.add( Moment( 0 ), &track_name ); *midi_stream_l_ << midi_track; } diff --git a/lily/midi-stream.cc b/lily/midi-stream.cc index 88e5eb2dc6..e6a2e35b3c 100644 --- a/lily/midi-stream.cc +++ b/lily/midi-stream.cc @@ -73,8 +73,8 @@ Midi_stream::header() // 00 01 one track // 00 60 96 per quarter-note -// char const ch_c_l = "0000" "0006" "0001" "0001" "0060"; -// str += String_convert::hex2bin_str( ch_c_l ); +// char const ch_C = "0000" "0006" "0001" "0001" "0060"; +// str += String_convert::hex2bin_str( ch_C ); // *os_p_ << str; // *this << Midi_header( 1, 1, tempo_i_ ); diff --git a/lily/musical-request.cc b/lily/musical-request.cc index 597a60ac76..e90be35ba3 100644 --- a/lily/musical-request.cc +++ b/lily/musical-request.cc @@ -17,12 +17,13 @@ void Stem_req::do_print() const { +#ifndef NPRINT Rhythmic_req::do_print(); mtor << "dir : " << dir_i_; +#endif } -Stem_req::Stem_req(int s, int d) - : Rhythmic_req(s,d) +Stem_req::Stem_req() { dir_i_ = 0; } @@ -56,12 +57,12 @@ Span_req::do_print() const Request::Request() { elt_l_ = 0; - defined_ch_c_l_ = 0; + defined_ch_C_ = 0; } Request::Request(Request const&src) { elt_l_ = 0; - defined_ch_c_l_ = src.defined_ch_c_l_; + defined_ch_C_ = src.defined_ch_C_; } /* *************** */ Spacing_req::Spacing_req() @@ -103,7 +104,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_l_); + delta.defined_ch_C_); } } @@ -153,37 +154,29 @@ Rhythmic_req::compare(Rhythmic_req const &r1, Rhythmic_req const &r2) { return sign(r1.duration() - r2.duration()); } -Rhythmic_req::Rhythmic_req(int b, int d) + +void +Rhythmic_req::set_duration(Duration d) { - plet_factor = 1; - balltype = b; - dots = d; + duration_ = d; } Rhythmic_req::Rhythmic_req() { - plet_factor = 1; - balltype = 1; - dots = 0; } void Rhythmic_req::do_print() const { #ifndef NPRINT - mtor << "ball: " << balltype ; - int d =dots; - while (d--) - mtor << '.'; - - mtor<<", plet factor"<<plet_factor<<"\n"; + mtor << duration_.str(); #endif } Moment Rhythmic_req::duration() const { - return wholes(balltype,dots)*plet_factor; + return duration_.length(); } /* *************** */ @@ -210,8 +203,8 @@ void Note_req::do_print() const { #ifndef NPRINT - mtor << " forceacc_b_ " << forceacc_b_ << '\n'; Melodic_req::do_print(); + mtor << " forceacc_b_ " << forceacc_b_ << '\n'; Rhythmic_req::do_print(); #endif } diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index 8c02f127b8..cdbfd35b78 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -1,9 +1,17 @@ +/* + my-lily-lexer.cc -- implement My_lily_lexer + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + #include <strstream.h> +#include <ctype.h> #include "interval.hh" #include "identifier.hh" #include "assoc-iter.hh" -#include "input-file.hh" #include "out/parser.hh" #include "keyword.hh" #include "assoc.hh" @@ -58,6 +66,8 @@ My_lily_lexer::My_lily_lexer() keytable_p_ = new Keyword_table(the_key_tab); identifier_assoc_p_ = new Assoc<String, Identifier*>; errorlevel_i_ = 0; + post_quotes_b_ = false; + } int @@ -75,11 +85,6 @@ My_lily_lexer::lookup_identifier(String s) return (*identifier_assoc_p_)[s]; } -char const* -My_lily_lexer::here_ch_c_l() -{ - return include_stack_.top()->sourcefile_l_->ch_c_l() + yyin->tellg(); -} void My_lily_lexer::add_identifier(Identifier*i) @@ -104,78 +109,30 @@ My_lily_lexer::~My_lily_lexer() delete identifier_assoc_p_; } void -My_lily_lexer::print_init_declarations()const +My_lily_lexer::print_declarations(bool init_b)const { for (Assoc_iter<String,Identifier*> ai(*identifier_assoc_p_); ai.ok(); ai++) { - if (ai.val()->init_b_) - ai.val()->print(); - } -} -void -My_lily_lexer::print_user_declarations()const -{ - for (Assoc_iter<String,Identifier*> ai(*identifier_assoc_p_); ai.ok(); ai++) { - if (!ai.val()->init_b_) + if (ai.val()->init_b_ == init_b) ai.val()->print(); } } -String -My_lily_lexer::spot()const -{ - return include_stack_.top()->name + ": " + String( lineno() ); -} - void My_lily_lexer::LexerError(char const *s) { - if (lexer->include_stack_.empty()) { + if (include_stack_.empty()) { *mlog << "error at EOF" << s << '\n'; } else { - char const* ch_c_l = here_ch_c_l(); - if ( ch_c_l ) { - ch_c_l--; - while ( ( *ch_c_l == ' ' ) || ( *ch_c_l == '\t' ) || ( *ch_c_l == '\n' ) ) - ch_c_l--; - ch_c_l++; + char const* ch_C = here_ch_C(); + if ( ch_C ) { + ch_C--; + while (isspace(*ch_C == ' ' )) + ch_C--; + ch_C++; } errorlevel_i_ |= 1; - error( s, ch_c_l ); + error( s, ch_C ); } } -// set the new input to s, remember old file. -void -My_lily_lexer::new_input(String s) -{ - if (!include_stack_.empty()) { - include_stack_.top()->line = lineno(); - // should this be saved at all? - include_stack_.top()->defined_ch_c_l_ = defined_ch_c_l; - } - - Input_file *newin = new Input_file(s); - include_stack_.push(newin); - switch_streams(newin->is); - - yylineno = 1; -} - -// pop the inputstack. -bool -My_lily_lexer::close_input() -{ - Input_file *old = include_stack_.pop(); - bool ok = true; - if (include_stack_.empty()) { - ok = false; - } else { - Input_file *i = include_stack_.top(); - switch_streams(i->is); - yylineno = i->line; - defined_ch_c_l = i->defined_ch_c_l_; - } - delete old; - return ok; -} diff --git a/lily/my-lily-parser.cc b/lily/my-lily-parser.cc new file mode 100644 index 0000000000..6340a918b8 --- /dev/null +++ b/lily/my-lily-parser.cc @@ -0,0 +1,232 @@ +/* + my-lily-parser.cc -- implement + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ + +#include "my-lily-parser.hh" +#include "my-lily-lexer.hh" +#include "debug.hh" +#include "main.hh" +#include "voice-element.hh" +#include "musical-request.hh" +#include "command-request.hh" + +void +My_lily_parser::set_debug() +{ +#ifndef NPRINT + String s = ""; + if (init_parse_b_) + s = "Init"; + set_yydebug( !monitor->silence(s+"Parser") && check_debug); + lexer_p_->set_debug( !monitor->silence(s+"Lexer") && check_debug); +#endif +} +void +My_lily_parser::print_declarations() +{ +#ifndef NPRINT + String s = ""; + if (init_parse_b_) + s = "Init"; + if (!monitor->silence(s+"Declarations") && check_debug) { + lexer_p_->print_declarations(init_parse_b_); + } +#endif +} + +void +My_lily_parser::parse_file(String init, String s) +{ + *mlog << "Parsing ... "; + lexer_p_ = new My_lily_lexer; + + set_debug(); + + lexer_p_->new_input(init, source_l_); + do_yyparse(); + print_declarations(); + + init_parse_b_ = false; + lexer_p_->new_input(s, source_l_); + do_yyparse(); + + + if(!define_spot_array_.empty()) + warning("Braces don't match.",0); +} + +My_lily_parser::~My_lily_parser() +{ + delete lexer_p_; +} + +void +My_lily_parser::remember_spot() +{ + define_spot_array_.push(here_ch_C()); +} + +char const * +My_lily_parser::here_ch_C()const +{ + return lexer_p_->here_ch_C(); +} + +void +My_lily_parser::parser_error(String s) +{ + lexer_p_->LexerError(s); + + if ( fatal_error_i_ ) + exit( fatal_error_i_ ); + error_level_i_ = 1; +} + +void +My_lily_parser::set_duration_mode(String s) +{ + s = s.upper_str(); + last_duration_mode = (s== "LAST"); +} + +void +My_lily_parser::set_last_duration(Duration const *d) +{ + if (last_duration_mode) + default_duration_ = *d; +} + + +Voice_element* +My_lily_parser::get_word_element(Text_def* tdef_p, Duration * duration_p) +{ + Voice_element* velt_p = new Voice_element; + + Lyric_req* lreq_p = new Lyric_req(tdef_p); + + lreq_p->duration_ = *duration_p; + lreq_p->print(); + lreq_p->defined_ch_C_ = here_ch_C(); + + velt_p->add(lreq_p); + + delete duration_p; + return velt_p; +} + +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(); + + Rest_req * rest_req_p = new Rest_req; + rest_req_p->duration_ = *duration_p; + rest_req_p->print(); + rest_req_p->defined_ch_C_ = here_ch_C(); + + velt_p->add(rest_req_p); + delete duration_p; + return velt_p; +} + +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(); + + 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(); + v->add(stem_req_p); + } + + rq->set_duration(*duration_p); + rq->defined_ch_C_ = here_ch_C(); + + + v->add(rq); + delete duration_p ; + return v; +} + +Request* +My_lily_parser::get_parens_request(char c) +{ + Request* req_p=0; + switch (c) { + case '|': + req_p = new Barcheck_req; + break; + + case '[': + case ']': + { + Beam_req*b = new Beam_req; + int p_i=default_duration_.plet_.type_i_ ; // ugh . Should junk? + if (p_i!= 1) + b->nplet = p_i; + req_p = b; + } + break; + + + case ')': + case '(': + req_p = new Slur_req; + break; + default: + assert(false); + break; + } + + switch (c) { + case '(': + case '[': + req_p->span()->spantype = Span_req::START; + break; + case ')': + case ']': + req_p->span()->spantype = Span_req::STOP; + break; + + default: + break; + } + + req_p->defined_ch_C_ = here_ch_C(); + return req_p; +} + +My_lily_parser::My_lily_parser(Sources * source_l) +{ + source_l_ = source_l; + lexer_p_ = 0; + default_duration_.type_i_ = 4; + default_octave_i_=0; + textstyle_str_="roman"; // in lexer? + error_level_i_ = 0; + last_duration_mode = false; + defined_ch_C_ = 0; + fatal_error_i_ = 0; +} + +void +My_lily_parser::add_requests(Voice_element*v) +{ + for (int i = 0; i < pre_reqs.size(); i++) { + v->add(pre_reqs[i]); + } + pre_reqs.set_size(0); + for (int i = 0; i <post_reqs.size(); i++) { + v->add(post_reqs[i]); + } + post_reqs.set_size(0); +} diff --git a/lily/note.cc b/lily/note.cc index 9c26c57f08..0d43d53234 100644 --- a/lily/note.cc +++ b/lily/note.cc @@ -16,138 +16,7 @@ #include "parseconstruct.hh" #include "input-music.hh" #include "voice-element.hh" -Moment -Lexer_prefs::plet_mom() -{ - return Moment(default_plet_dur, default_plet_type); -} -Lexer_prefs::Lexer_prefs() -{ - default_duration = 4, default_dots=0, default_octave_i_=0; - default_plet_type = 1, default_plet_dur = 1; - textstyle_str_="roman"; // in lexer? - - last_duration_mode = false; -} - -void -Lexer_prefs::set_duration_mode(String s) -{ - s = s.upper_str(); - last_duration_mode = (s== "LAST"); -} - -void -Lexer_prefs::set_last_duration(int n) -{ - if (last_duration_mode) - default_duration = n; -} - -/* triplet is '2/3' */ -void -Lexer_prefs::set_plet(int num,int den) -{ - assert(num >0&& den>0); - default_plet_dur = num; - default_plet_type = den; -} - -Text_def* -get_text(String s) return t; -{ - t= new Text_def; - t->text_str_= s; - t->style_str_ = lexer->prefs.textstyle_str_; - t->defined_ch_c_l_ = defined_ch_c_l; - return t; -} -Voice_element * -get_note_element(Note_req *rq, int * duration ) -{ - Voice_element*v = new Voice_element; - v->defined_ch_c_l_ = defined_ch_c_l; - - int dur = duration[0]; - int dots = duration[1]; - - if (dur >= 2) { - Stem_req * stem_req_p = new Stem_req(dur,dots); - stem_req_p->plet_factor = lexer->prefs.plet_mom(); - - stem_req_p->defined_ch_c_l_ = defined_ch_c_l; - v->add(stem_req_p); - } - - if ( !defined_ch_c_l ) - defined_ch_c_l = lexer->here_ch_c_l(); - - rq->balltype = dur; - rq->dots = dots; - rq->plet_factor = lexer->prefs.plet_mom(); - - rq->defined_ch_c_l_ = defined_ch_c_l; - - v->add(rq); - - return v; -} - -Voice_element* -get_word_element(Text_def* tdef_p, int* duration) -{ - Voice_element* velt_p = new Voice_element; - velt_p->defined_ch_c_l_ = defined_ch_c_l; - - int dur = duration[0]; - int dots=duration[1]; - - tdef_p->defined_ch_c_l_ = defined_ch_c_l; - - Lyric_req* lreq_p = new Lyric_req(tdef_p); - - lreq_p->balltype = dur; - lreq_p->dots = dots; - lreq_p->plet_factor = lexer->prefs.plet_mom(); - lreq_p->print(); - lreq_p->defined_ch_c_l_ = defined_ch_c_l; - - velt_p->add(lreq_p); - - return velt_p; -} -Voice_element * -get_rest_element(String, int * duration ) -{ - Voice_element* velt_p = new Voice_element; - velt_p->defined_ch_c_l_ = defined_ch_c_l; - - Rest_req * rest_req_p = new Rest_req; - rest_req_p->plet_factor = lexer->prefs.plet_mom(); - rest_req_p->balltype = duration[0]; - rest_req_p->dots = duration[1]; - rest_req_p->print(); - rest_req_p->defined_ch_c_l_ = defined_ch_c_l; - - velt_p->add(rest_req_p); - - return velt_p; -} - -void -Lexer_prefs::get_default_duration(int *p) -{ - *p++ = default_duration; - *p = default_dots; -} - -void -Lexer_prefs::set_default_duration(int *p) -{ - default_duration = *p++; - default_dots = *p++; -} Request* get_plet_request( char c, int dur_i, int type_i ) @@ -159,53 +28,6 @@ get_plet_request( char c, int dur_i, int type_i ) return plet_req_p; } -Request* -get_request(char c) -{ - Request* req_p=0; - switch (c) { - case '|': - req_p = new Barcheck_req; - break; - - case '[': - case ']': - { - Beam_req*b = new Beam_req; - int p_i=lexer->prefs.default_plet_type ; - if (p_i!= 1) - b->nplet = p_i; - req_p = b; - } - break; - - - case ')': - case '(': - req_p = new Slur_req; - break; - default: - assert(false); - break; - } - - switch (c) { - case '(': - case '[': - req_p->span()->spantype = Span_req::START; - break; - case ')': - case ']': - req_p->span()->spantype = Span_req::STOP; - break; - - default: - break; - } - - req_p->defined_ch_c_l_ = req_defined_ch_c_l; - return req_p; -} void add_requests(Voice_element *v, Array<Request*> &req) @@ -215,8 +37,7 @@ add_requests(Voice_element *v, Array<Request*> &req) } req.set_size(0); } - -Script_def* +String * get_scriptdef(char c) { String s; @@ -238,7 +59,7 @@ get_scriptdef(char c) case '.' : s = "staccato"; break; } - return lexer->lookup_identifier(s)->script(1); + return new String(s); } Request* diff --git a/lily/notehead.cc b/lily/notehead.cc index fb0c1166c1..b1f660ef17 100644 --- a/lily/notehead.cc +++ b/lily/notehead.cc @@ -22,8 +22,8 @@ Notehead::Notehead(int ss) void Notehead::set_rhythmic(Rhythmic_req*r_req_l) { - balltype = r_req_l->balltype; - dots = r_req_l->dots; + balltype = r_req_l->duration_.type_i_; + dots = r_req_l->duration_.dots_i_; } void diff --git a/lily/parser.y b/lily/parser.y index d5d53de1d1..c379ade770 100644 --- a/lily/parser.y +++ b/lily/parser.y @@ -1,5 +1,7 @@ %{ // -*-Fundamental-*- #include <iostream.h> + + #include "script-def.hh" #include "symtable.hh" #include "lookup.hh" @@ -19,26 +21,30 @@ #include "command-request.hh" #include "musical-request.hh" #include "voice-element.hh" +#include "my-lily-parser.hh" +#include "text-def.hh" #ifndef NDEBUG #define YYDEBUG 1 #endif -Array<Request*> pre_reqs, post_reqs; -Array<const char *> define_spots; -Paper_def*default_paper(); -char const* defined_ch_c_l; -char const* req_defined_ch_c_l; -int fatal_error_i = 0; -bool init_parse_b; +#define YYERROR_VERBOSE 1 + +#define YYPARSE_PARAM my_lily_parser_l +#define YYLEX_PARAM my_lily_parser_l +#define THIS ((My_lily_parser *) my_lily_parser_l) + +#define yyerror THIS->parser_error + %} %union { - Array<Melodic_req*> *melreqvec; + Array<Melodic_req*> *melreqvec;/* should clean up naming */ Array<String> * strvec; Array<int> *intvec; Box *box; + Duration *duration; Identifier *id; Input_music *music; Input_score *score; @@ -67,12 +73,28 @@ bool init_parse_b; int i; int ii[10]; } +%{ + +int +yylex(YYSTYPE *s, void * v_l) +{ + My_lily_parser *pars_l = (My_lily_parser*) v_l; + My_lily_lexer * lex_l = pars_l->lexer_p_; + lex_l->lexval_l = (void*) s; + return lex_l->yylex(); +} + + +%} +%pure_parser + +/* tokens which are not keywords */ +%token CONCAT %token BAR %token CADENZA %token CLEF %token CM_T -%token CONCAT %token DURATIONCOMMAND %token DYNAMIC %token END @@ -124,17 +146,18 @@ bool init_parse_b; %token <real> REAL %token <string> DURATION RESTNAME %token <string> STRING +%token <i> POST_QUOTES +%token <i> PRE_QUOTES + %type <box> box %type <c> open_request_parens close_request_parens close_plet_parens %type <chord> music_chord music_chord_body init_music_chord %type <el> voice_elt full_element lyrics_elt command_elt %type <i> int -%type <i> octave_quotes octave_quote %type <i> script_dir %type <id> declaration -%type <ii> default_duration explicit_duration notemode_duration -%type <ii> mudela_duration +%type <duration> explicit_duration notemode_duration %type <interval> dinterval %type <intvec> intastint_list %type <lookup> symtables symtables_body @@ -155,6 +178,8 @@ bool init_parse_b; %type <script> script_definition script_body mudela_script %type <staff> staff_block staff_init staff_body %type <string> declarable_identifier +%type <string> script_abbreviation +%type <id> old_identifier %type <symbol> symboldef %type <symtable> symtable symtable_body %type <textdef> mudela_text @@ -171,6 +196,7 @@ mudela: /* empty */ add_score($2); } | mudela add_declaration { } + | mudela error ; @@ -178,26 +204,38 @@ mudela: /* empty */ DECLARATIONS */ add_declaration: declaration { - lexer->add_identifier($1); - $1->init_b_ = init_parse_b; - $1->defined_ch_C_ = define_spots.pop(); + THIS->lexer_p_->add_identifier($1); + $1->init_b_ = THIS->init_parse_b_; + $1->defined_ch_C_ = THIS->define_spot_array_.pop(); } ; declarable_identifier: STRING { - define_spots.push(lexer->here_ch_c_l()); + THIS->remember_spot(); $$ = $1; - if (lexer->lookup_identifier(*$1)) - warning("redeclaration of `" + *$1 + "'", - lexer->here_ch_c_l()); } - | IDENTIFIER { - define_spots.push(lexer->here_ch_c_l()); + | old_identifier { + THIS->remember_spot(); $$ = new String($1->name); + warning("redeclaration of `" + *$$ + "'", THIS->here_ch_C()); } ; + +old_identifier: + IDENTIFIER + | MELODIC_REQUEST_IDENTIFIER + | CHORD_IDENTIFIER + | VOICE_IDENTIFIER + | POST_REQUEST_IDENTIFIER + | SCRIPT_IDENTIFIER + | STAFF_IDENTIFIER + | REAL_IDENTIFIER + | SCORE_IDENTIFIER + | REQUEST_IDENTIFIER + ; + declaration: declarable_identifier '=' score_block { $$ = new Score_id(*$1, $3, SCORE_IDENTIFIER); @@ -231,9 +269,7 @@ declaration: $$ = new Real_id(*$1, new Real($3), REAL_IDENTIFIER); delete $1; } - | declarable_identifier error '}' { - - } + | declarable_identifier '=' pure_post_request { $$ = new Request_id(*$1, $3, POST_REQUEST_IDENTIFIER); delete $1; @@ -249,16 +285,16 @@ declaration: SCORE */ score_block: - SCORE { define_spots.push(lexer->here_ch_c_l()); } + SCORE { THIS->remember_spot(); } /*cont*/ '{' score_body '}' { $$ = $4; - $$->defined_ch_c_l_ = define_spots.pop(); + $$->defined_ch_C_ = THIS->define_spot_array_.pop(); if (!$$->paper_p_ && ! $$->midi_p_) - $$->paper_p_ = default_paper(); + $$->paper_p_ = THIS->default_paper(); /* handle error levels. */ - $$->errorlevel_i_ = lexer->errorlevel_i_; - lexer->errorlevel_i_ = 0; + $$->errorlevel_i_ = THIS->error_level_i_; + THIS->error_level_i_ = 0; } ; @@ -294,7 +330,8 @@ paper_block: paper_body: /* empty */ { - $$ = default_paper(); + $$ = THIS->default_paper(); + } | paper_body WIDTH dim { $$->linewidth = $3;} | paper_body OUTPUT STRING { $$->outfile = *$3; @@ -324,8 +361,8 @@ midi_body: { $$->outfile_str_ = *$3; delete $3; } - | midi_body TEMPO mudela_duration ':' int { - $$->set_tempo( wholes( $3[0], $3[1] ), $5 ); + | midi_body TEMPO notemode_duration ':' int { + $$->set_tempo( $3->length(), $5 ); } | midi_body error { @@ -336,10 +373,10 @@ midi_body: { STAFFs */ staff_block: - STAFF { define_spots.push(lexer->here_ch_c_l()); } + STAFF { THIS->remember_spot(); } /*cont*/ '{' staff_body '}' { $$ = $4; - $$-> defined_ch_c_l_ = define_spots.pop(); + $$-> defined_ch_C_ = THIS->define_spot_array_.pop(); } ; @@ -376,19 +413,19 @@ init_music: ; init_lyrics_voice: - LYRICS { lexer->push_lyric_state(); } - music_voice { $$ = $3; lexer->pop_state(); } + LYRICS { THIS->lexer_p_->push_lyric_state(); } + music_voice { $$ = $3; THIS->lexer_p_->pop_state(); } ; init_music_voice: - MUSIC { lexer->push_note_state(); } + MUSIC { THIS->lexer_p_->push_note_state(); } /* cont*/ music_voice - { $$=$3; lexer->pop_state(); } + { $$=$3; THIS->lexer_p_->pop_state(); } ; init_music_chord: - MUSIC { lexer->push_note_state(); } + MUSIC { THIS->lexer_p_->push_note_state(); } /* cont*/ music_chord - { $$=$3; lexer->pop_state(); } + { $$=$3; THIS->lexer_p_->pop_state(); } ; /* MUSIC @@ -431,8 +468,8 @@ music_voice_body: | music_voice_body error { } | music_voice_body '>' { - fatal_error_i = 1; - yyerror("Confused by errors: bailing out"); + THIS->fatal_error_i_ = 1; + THIS->parser_error("Confused by errors: bailing out"); }; music_chord: '<' music_chord_body '>' { $$ = $2; } @@ -455,8 +492,8 @@ music_chord_body: $$ ->add_elt($2); } | music_chord_body '}' { - fatal_error_i = 1; - yyerror("Confused by errors: bailing out"); + THIS->fatal_error_i_ = 1; + THIS->parser_error("Confused by errors: bailing out"); } | music_chord_body error { } @@ -466,26 +503,24 @@ music_chord_body: VOICE ELEMENTS */ full_element: pre_requests voice_elt post_requests { - add_requests($2, pre_reqs); - add_requests($2, post_reqs); + THIS->add_requests($2); $$ = $2; } | pre_requests lyrics_elt post_requests { - add_requests($2, pre_reqs); - add_requests($2, post_reqs); + THIS->add_requests($2); $$ = $2; } | command_elt - ; + ; command_elt: /* empty */ { $$ = new Voice_element; - $$-> defined_ch_c_l_ = lexer->here_ch_c_l(); + $$-> defined_ch_C_ = THIS->here_ch_C(); } /* cont: */ command_req { - $2-> defined_ch_c_l_ = $$->defined_ch_c_l_; + $2-> defined_ch_C_ = $$->defined_ch_C_; $$->add($2); } @@ -543,16 +578,15 @@ command_req: post_requests: { - assert(post_reqs.empty()); + assert(THIS->post_reqs.empty()); } | post_requests post_request { - $2->defined_ch_c_l_ = lexer->here_ch_c_l(); - post_reqs.push($2); + $2->defined_ch_C_ = THIS->here_ch_C(); + THIS->post_reqs.push($2); } | post_requests close_plet_parens INT '/' INT { - post_reqs.push( get_request($2) ); - req_defined_ch_c_l = lexer->here_ch_c_l(); - post_reqs.push( get_plet_request( $2, $3, $5 ) ); + THIS->post_reqs.push( THIS->get_parens_request($2) ); + THIS->post_reqs.push( get_plet_request( $2, $3, $5 ) ); } ; @@ -565,7 +599,7 @@ post_request: pure_post_request: close_request_parens { - $$ = get_request($1); + $$ = THIS->get_parens_request($1); } | script_req | textscript_req @@ -573,15 +607,6 @@ pure_post_request: ; -octave_quote: - '\'' { $$ = 1; } - | '`' { $$ = -1 ; } - ; - -octave_quotes: - /**/ { $$ = 0; } - | octave_quotes octave_quote{ $$ += $2; } - ; /* URG!! @@ -589,14 +614,14 @@ octave_quotes: steno_melodic_req: MELODIC_REQUEST_IDENTIFIER { $$ = $1->request(false)->clone()->melodic(); - $$->octave_i_ += lexer->prefs.default_octave_i_; + $$->octave_i_ += THIS->default_octave_i_; } - | steno_melodic_req '\'' { - $$-> octave_i_ ++; + | steno_melodic_req POST_QUOTES { + $$-> octave_i_ += $2; } - | '`' steno_melodic_req { + | PRE_QUOTES steno_melodic_req { $$ = $2; - $2-> octave_i_ --; + $2-> octave_i_ -= $1; } ; @@ -631,7 +656,7 @@ dynamic_req: close_plet_parens: ']' { - req_defined_ch_c_l = lexer->here_ch_c_l(); + //req_defined_ch_C = THIS->here_ch_C(); $$ = ']'; } ; @@ -671,9 +696,11 @@ textscript_req: mudela_text: STRING { - defined_ch_c_l = lexer->here_ch_c_l(); - $$ = get_text(*$1); + //defined_ch_C = THIS->here_ch_C(); + $$ = new Text_def; + $$->text_str_ = *$1; delete $1; + $$->style_str_ = THIS->textstyle_str_; } ; @@ -682,25 +709,26 @@ script_req: $$ = get_script_req($1, $2); } ; - -mudela_script: - SCRIPT_IDENTIFIER { $$ = $1->script(true); } - | script_definition { $$ = $1; } - | '^' { $$ = get_scriptdef('^'); } +script_abbreviation: + '^' { $$ = get_scriptdef('^'); } | '+' { $$ = get_scriptdef('+'); } | '-' { $$ = get_scriptdef('-'); } | '|' { $$ = get_scriptdef('|'); } | 'o' { $$ = get_scriptdef('o'); } | '>' { $$ = get_scriptdef('>'); } - | '.' { $$ = get_scriptdef('.'); } | DOTS { if ( $1 > 1 ) - warning( "too many staccato dots", lexer->here_ch_c_l() ); + warning( "too many staccato dots", THIS->here_ch_C() ); $$ = get_scriptdef('.'); } - | error { - $$ = get_scriptdef('.'); - yyerrok; + ; + +mudela_script: + SCRIPT_IDENTIFIER { $$ = $1->script(true); } + | script_definition { $$ = $1; } + | script_abbreviation { + $$ = THIS->lexer_p_->lookup_identifier(*$1)->script(true); + delete $1; } ; @@ -712,112 +740,96 @@ script_dir: pre_requests: | pre_requests pre_request { - pre_reqs.push($2); - $2->defined_ch_c_l_ = lexer->here_ch_c_l(); + THIS->pre_reqs.push($2); + $2->defined_ch_C_ = THIS->here_ch_C(); } ; pre_request: open_request_parens { - defined_ch_c_l = lexer->here_ch_c_l(); - $$ = get_request($1); + //defined_ch_C = THIS->here_ch_C(); + $$ = THIS->get_parens_request($1); } ; voice_command: PLET '{' INT '/' INT '}' { - lexer->prefs.set_plet($3,$5); + THIS->default_duration_.set_plet($3,$5); } | DURATIONCOMMAND '{' STRING '}' { - lexer->prefs.set_duration_mode(*$3); + THIS->set_duration_mode(*$3); delete $3; } | DURATIONCOMMAND '{' notemode_duration '}' { - lexer->prefs.set_default_duration($3); + THIS->default_duration_ = *$3; + delete $3; } - | OCTAVECOMMAND '{' octave_quotes '}' { - lexer->prefs.default_octave_i_ = $3; + | OCTAVECOMMAND '{' int '}' { + THIS->default_octave_i_ = $3; } | TEXTSTYLE STRING { - lexer->prefs.textstyle_str_ = *$2; + THIS->textstyle_str_ = *$2; delete $2; } ; duration_length: - mudela_duration { - $$ = new Moment(wholes($1[0], $1[1])); + { + $$ = new Moment(0,1); } - |int '*' mudela_duration { - $$ = new Moment(Rational($1) * wholes($3[0], $3[1])); + | duration_length explicit_duration { + *$$ += $2->length(); } ; notemode_duration: - explicit_duration - | default_duration - ; - -mudela_duration: - int { - $$[0] = $1; - $$[1] = 0; + /* */ { + $$ = new Duration(THIS->default_duration_); } - | int DOTS { - $$[0] = $1; - $$[1] = $2; + | DOTS { + $$ = new Duration(THIS->default_duration_); + $$->dots_i_ = $1; + } + | explicit_duration { + THIS->set_last_duration($1); + $$ = $1; } ; - explicit_duration: - INT { - lexer->prefs.set_last_duration($1); - $$[0] = $1; - $$[1] = 0; - } - | INT DOTS { - lexer->prefs.set_last_duration($1); - $$[0] = $1; - $$[1] = $2; + int { + $$ = new Duration; + $$->type_i_ = $1; } - | DOTS { - lexer->prefs.get_default_duration($$); - $$[1] = $1; + | explicit_duration DOTS { + $$->dots_i_ = $2; } - | INT '*' INT '/' INT { - // ugh, must use Duration - lexer->prefs.set_plet( $3, $5 ); - $$[ 0 ] = $1; - $$[ 1 ] = 0; - lexer->prefs.set_plet( 1, 1 ); + | explicit_duration '*' int { + $$->plet_.iso_i_ *= $3; } - ; - -default_duration: - /* empty */ { - lexer->prefs.get_default_duration($$); + | explicit_duration '/' int { + $$->plet_.type_i_ *= $3; } ; voice_elt: steno_note_req notemode_duration { - if (!lexer->note_state_b()) - yyerror("have to be in Note mode for notes"); - $$ = get_note_element($1, $2); + if (!THIS->lexer_p_->note_state_b()) + THIS->parser_error("have to be in Note mode for notes"); + $$ = THIS->get_note_element($1, $2); } | RESTNAME notemode_duration { - $$ = get_rest_element(*$1, $2); + $$ = THIS->get_rest_element(*$1, $2); delete $1; } ; lyrics_elt: mudela_text notemode_duration { - if (!lexer->lyric_state_b()) - yyerror("Have to be in Lyric mode for lyrics"); - $$ = get_word_element($1, $2); + if (!THIS->lexer_p_->lyric_state_b()) + THIS->parser_error("Have to be in Lyric mode for lyrics"); + $$ = THIS->get_word_element($1, $2); }; @@ -930,56 +942,23 @@ dinterval: dim dim { %% -void -yyerror(const char *s) +void +My_lily_parser::set_yydebug(bool b ) { - lexer->LexerError(s); - - if ( fatal_error_i ) - exit( fatal_error_i ); +#ifdef YYDEBUG + yydebug = b; +#endif } - void -parse_file(String init, String s) +My_lily_parser::do_yyparse() { - *mlog << "Parsing ... "; - lexer = new My_lily_lexer; - -#ifndef NPRINT - yydebug = !monitor->silence("InitParser") && check_debug; - lexer->set_debug( !monitor->silence("InitLexer") && check_debug); -#endif - init_parse_b = true; - lexer->new_input(init); - yyparse(); - -#ifndef NPRINT - if (!monitor->silence("InitDeclarations") && check_debug) - lexer->print_init_declarations(); - - yydebug = !monitor->silence("Parser") && check_debug; - lexer->set_debug( !monitor->silence("Lexer") && check_debug); -#endif - init_parse_b = false; - lexer->new_input(s); - yyparse(); - -#ifdef NPRINT - if (!monitor->silence("Declarations") && check_debug) - lexer->print_user_declarations(); -#endif - delete lexer; - lexer = 0; - - if(!define_spots.empty()) - warning("Braces don't match.",0); + yyparse((void*)this); } Paper_def* -default_paper() +My_lily_parser::default_paper() { return new Paper_def( - lexer->lookup_identifier("default_table")->lookup(true)); + lexer_p_->lookup_identifier("default_table")->lookup(true)); } - diff --git a/lily/rest.cc b/lily/rest.cc index 39347b1d5b..97f91a6a6a 100644 --- a/lily/rest.cc +++ b/lily/rest.cc @@ -1,15 +1,24 @@ +/* + rest.cc -- implement Rest + + source file of the LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl> +*/ +#include "duration.hh" #include "rest.hh" #include "dimen.hh" #include "debug.hh" #include "paper-def.hh" #include "lookup.hh" #include "molecule.hh" +#include "rest.hh" - -Rest::Rest(int t, int d) +Rest::Rest(Duration d) { - balltype = t; - dots = d; + balltype = d.type_i_; + dots = d.dots_i_; + pos_i_ = 0; } @@ -37,6 +46,7 @@ Rest::brew_molecule_p()const dm.add(Atom(d)); m->add_right(dm); } + m->translate(Offset(0,pos_i_ * paper()->internote())); return m; } diff --git a/lily/score.cc b/lily/score.cc index cb764b2f7a..09b5439667 100644 --- a/lily/score.cc +++ b/lily/score.cc @@ -27,7 +27,7 @@ Score::setup_music() *mlog << "\nSetting up music ..." << flush; if (last() == Moment(0)) { errorlevel_i_ |= 1; - error("Need to have music in a score.", defined_ch_c_l_); + error("Need to have music in a score.", defined_ch_C_); } for (iter_top(staffs_,i); i.ok(); i++) { @@ -234,7 +234,7 @@ Score::Score() paper_p_ = 0; midi_p_ = 0; errorlevel_i_ = 0; - defined_ch_c_l_ = 0; + defined_ch_C_ = 0; } Score::~Score() @@ -263,7 +263,7 @@ Score::paper_output() the_output << "% outputting Score, defined at: " << source_l_g-> - sourcefile_l (defined_ch_c_l_)->file_line_no_str(defined_ch_c_l_) << "\n"; + sourcefile_l (defined_ch_C_)->file_line_no_str(defined_ch_C_) << "\n"; pscore_p_->output(the_output); } diff --git a/lily/scores.cc b/lily/scores.cc index a6df7ead96..3115cb5007 100644 --- a/lily/scores.cc +++ b/lily/scores.cc @@ -15,7 +15,7 @@ do_scores() Input_score* &is_p = score_array_global[i]; if (is_p->errorlevel_i_) { warning("Score contains errors. Will not process it. ", - is_p->defined_ch_c_l_); + is_p->defined_ch_C_); delete is_p; continue; } diff --git a/lily/slur-reg.cc b/lily/slur-reg.cc index 34bffee73d..a076664dd7 100644 --- a/lily/slur-reg.cc +++ b/lily/slur-reg.cc @@ -58,7 +58,7 @@ Slur_register::process_requests() if (slur_req_l->spantype == Span_req::STOP) { if (slur_l_stack_.empty()) warning("can't find slur to end", - slur_req_l->defined_ch_c_l_); + slur_req_l->defined_ch_C_); else { end_slur_l_arr_.push(slur_l_stack_.pop()); requests_arr_.pop(); @@ -95,6 +95,6 @@ Slur_register::post_move_processing() Slur_register::~Slur_register() { for (int i=0; i < requests_arr_.size(); i++) { - warning("unterminated slur", requests_arr_[i]->defined_ch_c_l_); + warning("unterminated slur", requests_arr_[i]->defined_ch_C_); } } diff --git a/lily/staff-walker.cc b/lily/staff-walker.cc index 9a817f0190..32cd6dab1f 100644 --- a/lily/staff-walker.cc +++ b/lily/staff-walker.cc @@ -69,7 +69,7 @@ Staff_walker::process_timing_reqs() if (tr_l->partial()) { time_.setpartial(tr_l->partial()->duration_); } else if (tr_l->barcheck() && time_.whole_in_measure_) { - warning( "Barcheck failed", tr_l->defined_ch_c_l_ ); + warning( "Barcheck failed", tr_l->defined_ch_C_ ); } else if (tr_l->cadenza()) { time_.set_cadenza(tr_l->cadenza()->on_b_); } else if (tr_l->measuregrouping()) { diff --git a/lily/stem-beam-reg.cc b/lily/stem-beam-reg.cc index de09bb0940..ad947d2899 100644 --- a/lily/stem-beam-reg.cc +++ b/lily/stem-beam-reg.cc @@ -41,7 +41,7 @@ Stem_beam_register::try_request(Request*req_l) if ( req_l->stem() ) { if (current_grouping && !current_grouping->child_fit_query( - get_staff_info().time_c_l_->whole_in_measure_)) + get_staff_info().time_C_->whole_in_measure_)) return false; if (stem_req_l_ && Stem_req::compare(*stem_req_l_, *req_l->stem())) @@ -81,15 +81,15 @@ Stem_beam_register::process_requests() stem_p_ = new Stem(4); if (current_grouping) current_grouping->add_child( - get_staff_info().time_c_l_->whole_in_measure_, + get_staff_info().time_C_->whole_in_measure_, stem_req_l_->duration()); - stem_p_->flag = stem_req_l_->balltype; + stem_p_->flag = stem_req_l_->duration_.type_i_; if (beam_p_) { - if (stem_req_l_->balltype<= 4) + if (stem_req_l_->duration_.type_i_<= 4) warning( "stem doesn't fit in Beam", - stem_req_l_->defined_ch_c_l_); + stem_req_l_->defined_ch_C_); else beam_p_->add(stem_p_); stem_p_->print_flag = false; @@ -124,9 +124,9 @@ Stem_beam_register::pre_move_processing() stem_p_ = 0; } if (beam_p_ && end_beam_b_) { - Rhythmic_grouping const * rg_c_l = get_staff_info().rhythmic_c_l_; - rg_c_l->extend(current_grouping->interval()); - beam_p_->set_grouping(*rg_c_l, *current_grouping); + Rhythmic_grouping const * rg_C = get_staff_info().rhythmic_C_; + rg_C->extend(current_grouping->interval()); + beam_p_->set_grouping(*rg_C, *current_grouping); typeset_element(beam_p_); delete current_grouping; current_grouping = 0; @@ -146,7 +146,7 @@ Stem_beam_register::post_move_processing() Stem_beam_register::~Stem_beam_register() { if (beam_p_) - warning("unterminated beam", start_req_l_->defined_ch_c_l_); + warning("unterminated beam", start_req_l_->defined_ch_C_); } void diff --git a/lily/template3.cc b/lily/template3.cc index 7df0ef372b..4881783f5c 100644 --- a/lily/template3.cc +++ b/lily/template3.cc @@ -3,13 +3,10 @@ #include "input-staff.hh" #include "input-music.hh" #include "molecule.hh" -#include "source-file.hh" #include "voice-element.hh" #include "plist.tcc" #include "pcursor.tcc" -IPL_instantiate(Atom); IPL_instantiate(Atom); IPL_instantiate(Input_staff); IPL_instantiate(Input_music); -IPL_instantiate(Source_file); diff --git a/lily/tex-stream.cc b/lily/tex-stream.cc index 4157f08563..5e2e959181 100644 --- a/lily/tex-stream.cc +++ b/lily/tex-stream.cc @@ -29,8 +29,7 @@ Tex_stream::header() *os << "% Creator: " << get_version_str(); *os << "% Automatically generated, at "; time_t t(time(0)); - *os << ctime(&t); - *os << "% from musical definition: " + infile_str_g + "\n"; + *os << ctime(&t)<<"\n"; } Tex_stream::~Tex_stream() { diff --git a/lily/text-def.cc b/lily/text-def.cc index cd2961b65e..22affae7ed 100644 --- a/lily/text-def.cc +++ b/lily/text-def.cc @@ -8,7 +8,7 @@ Text_def::Text_def() { align_i_ = 1; // right style_str_ = "roman"; - defined_ch_c_l_ = 0; + defined_ch_C_ = 0; } bool Text_def::compare(Text_def const &def) diff --git a/lily/voice-elt.cc b/lily/voice-elt.cc index 5b59242c75..4c1249b140 100644 --- a/lily/voice-elt.cc +++ b/lily/voice-elt.cc @@ -52,12 +52,12 @@ Voice_element::Voice_element() { voice_l_ = 0; duration = 0; - defined_ch_c_l_ = 0; + defined_ch_C_ = 0; } Voice_element::Voice_element(Voice_element const&src) { - defined_ch_c_l_ = src.defined_ch_c_l_; + defined_ch_C_ = src.defined_ch_C_; voice_l_=0; for (iter_top(src.reqs, i); i.ok(); i++) @@ -97,9 +97,10 @@ Voice_element::set_plet_backwards(Moment& now_moment_r, for ( PCursor<Request*> i( reqs.top() ); i.ok(); i++ ) { if (i->beam() && i->beam()->spantype == Span_req::START ) i->beam()->nplet = den_i; - if (i->rhythmic()) - i->rhythmic()->plet_factor = Moment(num_i, den_i); - if (i->stem()) - i->stem()->plet_factor = Moment(num_i, den_i); + if (i->rhythmic()) { + i->rhythmic()->duration_.plet_.type_i_ = den_i; + i->rhythmic()->duration_.plet_.iso_i_ = num_i; + + } } } diff --git a/lily/walk-regs.cc b/lily/walk-regs.cc index 425167422f..b258bd559d 100644 --- a/lily/walk-regs.cc +++ b/lily/walk-regs.cc @@ -153,7 +153,7 @@ Walker_registers::try_request(Request * r) change_group(cr_l->groupchange(), 0, 0); } else warning("junking request: " + String(r->name()), - r->defined_ch_c_l_); + r->defined_ch_C_); } return b; } @@ -166,8 +166,8 @@ Walker_registers::get_staff_info() return inf; inf.break_allowed_b_ = walk_l_->score_walk_l_->break_allowed_b(); inf.c0_position_i_ = &walk_l_->c0_position_i_; inf.walk_l_ = walk_l_; - inf.time_c_l_ = &walk_l_->time_; - inf.rhythmic_c_l_ = walk_l_->default_grouping; + inf.time_C_ = &walk_l_->time_; + inf.rhythmic_C_ = walk_l_->default_grouping; } Paper_def* diff --git a/lily/warn.cc b/lily/warn.cc index 4fe33452cc..2b9f1db767 100644 --- a/lily/warn.cc +++ b/lily/warn.cc @@ -21,10 +21,7 @@ warning(String s) void error(String s) { - if (busy_parsing()) - yyerror(s); - else - cerr << "error: " << s << "\n"; + cerr << "error: " << s << "\n"; exit(1); } @@ -45,17 +42,17 @@ error_t(String const & s, Time_description const &t_tdes) } void -message( String message_str, char const* context_ch_c_l ) +message( String message_str, char const* context_ch_C ) { String str = ""; //"lilypond: ";// GNU format messages! - Source_file* sourcefile_l = source_l_g->sourcefile_l( context_ch_c_l ); + Source_file* sourcefile_l = source_l_g->sourcefile_l( context_ch_C ); if ( sourcefile_l ) { - str += sourcefile_l->file_line_no_str(context_ch_c_l) + String(": "); + str += sourcefile_l->file_line_no_str(context_ch_C) + String(": "); } str += message_str; if ( sourcefile_l ) { str += ":\n"; - str += sourcefile_l->error_str( context_ch_c_l ); + str += sourcefile_l->error_str( context_ch_C ); } if ( busy_parsing() ) cerr << endl; @@ -63,19 +60,19 @@ message( String message_str, char const* context_ch_c_l ) } void -warning( String message_str, char const* context_ch_c_l ) +warning( String message_str, char const* context_ch_C ) { - message( "warning: " + message_str, context_ch_c_l ); + message( "warning: " + message_str, context_ch_C ); } void -error( String message_str, char const* context_ch_c_l ) +error( String message_str, char const* context_ch_C ) { - message( message_str, context_ch_c_l ); + message( message_str, context_ch_C ); // since when exits error again? // i-d say: error: errorlevel |= 1; -> no output upon error // warning: recovery -> output (possibly wrong) - if ( lexer ) - lexer->errorlevel_i_ |= 1; +/* if ( lexer ) + lexer->errorlevel_i_ |= 1;*/ // exit( 1 ); } diff --git a/make/Rules.make b/make/Rules.make index 0e06b46cac..3f3e5f86d1 100644 --- a/make/Rules.make +++ b/make/Rules.make @@ -40,7 +40,7 @@ $(outdir)/%.hh: %.y mv $(shell basename $@ .hh ).tab.c $(outdir)/$(shell basename $@ .hh).cc $(outdir)/%.cc: %.l - $(FLEX) -t $< > $@ + $(FLEX) -Cfe -p -p -t $< > $@ $(outdir)/%.text: $(outdir)/%.1 groff -man -Tascii $< > $@ @@ -65,21 +65,3 @@ $(outdir)/%.1: %.pod %/.build: echo 0 >$@ - -# specific stuff: -# -$(LIBFLOWER): check-flower-deps - -check-flower-deps: - $(MAKE) -C $(depth)/flower/ $(outdir)/$(notdir $(LIBFLOWER)) - -check-lily-deps: check-flower-deps - $(MAKE) -C $(depth)/lib - -check-doc-deps: - $(MAKE) -C $(depth)/Documentation - -$(LIBLILY): dummy - $(MAKE) ./$(outdir)/$(@F) -C $(depth)/lib -# - diff --git a/make/Targets.make b/make/Targets.make index 9859802a58..5ae0c4bdc5 100644 --- a/make/Targets.make +++ b/make/Targets.make @@ -31,7 +31,7 @@ include ./$(depth)/make/out/Site.make EXECUTABLE = $(lily_bindir)/$(NAME) $(EXECUTABLE): $(build) $(OFILES) $(CUSTOMLIBES) $(INCREASE_BUILD) - $(MAKE) $(OFILES) $(SILENT_LOG) + $(MAKE) -S $(OFILES) $(SILENT_LOG) # $(STRIPDEBUG) $(STABLEOBS) $(LD_COMMAND) $(OFILES) $(LOADLIBES) @@ -138,20 +138,19 @@ ifdef SUBDIRS set -e; for i in $(SUBDIRS); do $(MAKE) localdir=$(localdir)/$$i -C $$i localmoduledist; done endif -all-tags: TAGS -ifdef SUBDIRS - set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i all-tags; done -endif - -TAGS: $(all-tag-sources) +TAGS:$(all-tag-sources) ifdef all-tag-sources -etags -CT $(all-tag-sources) /dev/null endif +ifdef SUBDIRS + set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i TAGS ; done +endif + # version stuff: # -out/version.hh: .version +$(outdir)/version.hh: .version ./$(lily_bindir)/make_version > $@ @@ -176,3 +175,21 @@ ifdef SUBDIRS endif localuninstall: + +# specific stuff: +# +$(LIBFLOWER): check-flower-deps + +check-flower-deps: + $(MAKE) -C $(depth)/flower/ $(outdir)/$(notdir $(LIBFLOWER)) + +check-lily-deps: check-flower-deps + $(MAKE) -C $(depth)/lib + +check-doc-deps: + $(MAKE) -C $(depth)/Documentation + +$(LIBLILY): dummy + $(MAKE) ./$(outdir)/$(@F) -C $(depth)/lib +# + diff --git a/make/Variables.make b/make/Variables.make index 8c54e9fba0..abe60c7a9a 100644 --- a/make/Variables.make +++ b/make/Variables.make @@ -95,6 +95,7 @@ DUMMYDEPS=\ ERROR_LOG = 2> /dev/null SILENT_LOG = >& /dev/null allexe = $(lily_bindir)/lilypond $(lily_bindir)/mi2mu +allhh := $(shell $(FIND) -name "*.hh" $(ERROR_LOG)) allcc := $(shell $(FIND) -name "*.cc" $(ERROR_LOG)) allobs := $(shell $(FIND) $(outdir) -name "*.o" $(ERROR_LOG)) allibs := $(shell $(FIND) $(libdir) -name "*.lib" $(ERROR_LOG)) @@ -121,7 +122,7 @@ CXXFLAGS = $(CFLAGS) $(USER_CXXFLAGS) $(EXTRA_CXXFLAGS) INCLUDES = -Iinclude -I$(outdir) -I$(include-lib) -I$(libout) -I$(include-flower) -I$(flowerout) CXX_OUTPUT_OPTION = $< -o $@ LDFLAGS = $(EXTRA_LDFLAGS) -LOADLIBES = $(EXTRA_LIBES) $(CUSTOMLIBES) -lg++ +LOADLIBES = $(EXTRA_LIBES) $(CUSTOMLIBES) # # librarian: @@ -168,3 +169,7 @@ LIBRARY = $(LIB_PREFIX)$(NAME)$(LIB_SUFFIX) STRIPDEBUG=true #replace to do stripping of certain objects DISTFILES=$(EXTRA_DISTFILES) Makefile $(ALL_SOURCES) +DOCDIR=$(depth)/doc++ + + +progdocs=$(allhh) $(allcc) diff --git a/make/lilypond.spec.in b/make/lilypond.spec.in index 887c92075a..600f62b617 100644 --- a/make/lilypond.spec.in +++ b/make/lilypond.spec.in @@ -7,7 +7,7 @@ Source0: pcnov095.win.tue.nl:/pub/lilypond/lilypond-@TOPLEVEL_VERSION@.tar.gz Summary: A preprocessor to make TeX typeset music. URL: http://www.stack.nl/~hanwen/lilypond Packager: Han-Wen Nienhuys <hanwen@stack.nl> -Icon: lelie_logo.gif +Icon: lelie_icon.gif %description LilyPond is a program which converts a music-script (mudela) into diff --git a/mi2mu/include/mi2mu.hh b/mi2mu/include/mi2mu.hh index 0210f523eb..a6a7c59102 100644 --- a/mi2mu/include/mi2mu.hh +++ b/mi2mu/include/mi2mu.hh @@ -32,8 +32,8 @@ #include "lgetopt.hh" #include "moment.hh" +#include "duration-convert.hh" #include "duration.hh" -#include "input-file.hh" #include "source-file.hh" #include "source.hh" diff --git a/mi2mu/include/midi-global.hh b/mi2mu/include/midi-global.hh index 0ab49a340d..13ef771067 100644 --- a/mi2mu/include/midi-global.hh +++ b/mi2mu/include/midi-global.hh @@ -25,10 +25,10 @@ extern Verbose level_ver; #define qtor if ( level_ver >= QUIET_ver ) *monitor_p_g #endif -extern Source* source_l_g; -void message( String message_str, char const* context_ch_c_l ); -void warning( String message_str, char const* context_ch_c_l ); -void error( String message_str, char const* context_ch_c_l ); +extern Sources* source_l_g; +void message( String message_str, char const* context_ch_C ); +void warning( String message_str, char const* context_ch_C ); +void error( String message_str, char const* context_ch_C ); String mi2mu_version_str(); diff --git a/mi2mu/include/my-midi-lexer.hh b/mi2mu/include/my-midi-lexer.hh index 032bf6752b..9db1c43614 100644 --- a/mi2mu/include/my-midi-lexer.hh +++ b/mi2mu/include/my-midi-lexer.hh @@ -14,25 +14,21 @@ int yylex(); void yyerror(const char *s); -// bool busy_parsing(); -// void kill_lexer(); -// void set_lexer(); /// (midi_lexer) class My_midi_lexer : yyFlexLexer { public: - My_midi_lexer( String filename_str ); + My_midi_lexer( String &filename_str ,Sources * ); ~My_midi_lexer(); int close_i(); void error( char const* sz_l ); - char const* here_ch_c_l(); + char const* here_ch_C(); static int varint2_i( String str ); int yylex(); - + Source_file * source_file_p_ ; private: - Input_file* input_file_p_; - + int char_count_; public: // ugh int errorlevel_i_; }; diff --git a/mi2mu/include/my-midi-parser.hh b/mi2mu/include/my-midi-parser.hh index 02bbb843e8..95367f3fa0 100644 --- a/mi2mu/include/my-midi-parser.hh +++ b/mi2mu/include/my-midi-parser.hh @@ -6,55 +6,56 @@ #ifndef MY_MIDI_PARSER_HH #define MY_MIDI_PARSER_HH -// #include "proto.hh" -// #include "string.hh" int yyparse(); -/// (midi_parser) +/** + An interface to the YACC midi parser. + (midi_parser) + */ class My_midi_parser { public: - My_midi_parser( String filename_str ); - ~My_midi_parser(); - - void add_score( Midi_score* midi_score_p ); - void error( char const* sz_l ); - int parse(); - void forward( int i ); - Moment mom(); - void note_begin( int channel_i, int pitch_i, int dyn_i ); - Midi_event* note_end_midi_event_p( int channel_i, int pitch_i, int dyn_i ); - int output_mudela( String filename_str ); - void reset(); - void set_division_4( int division_4_i ); - void set_key( int accidentals_i, int minor_i ); - void set_tempo( int useconds_per_4_i ); - void set_time( int num_i, int den_i, int clocks_i, int count_32_i ); - - int bar_i_; - int track_i_; - String filename_str_; - String copyright_str_; - String instrument_str_; - String track_name_str_; - - Midi_key* midi_key_p_; - Midi_tempo* midi_tempo_p_; - Midi_time* midi_time_p_; + My_midi_parser( String filename_str,Sources * ); + ~My_midi_parser(); + + void add_score( Midi_score* midi_score_p ); + void error( char const* sz_l ); + int parse(); + void forward( int i ); + Moment mom(); + void note_begin( int channel_i, int pitch_i, int dyn_i ); + Midi_event* note_end_midi_event_p( int channel_i, int pitch_i, int dyn_i ); + int output_mudela( String filename_str ); + void reset(); + void set_division_4( int division_4_i ); + void set_key( int accidentals_i, int minor_i ); + void set_tempo( int useconds_per_4_i ); + void set_time( int num_i, int den_i, int clocks_i, int count_32_i ); + + int bar_i_; + int track_i_; + String filename_str_; + String copyright_str_; + String instrument_str_; + String track_name_str_; + + Midi_key* midi_key_p_; + Midi_tempo* midi_tempo_p_; + Midi_time* midi_time_p_; private: - I64 now_i64_; // 31 bits yields tipically about 1000 bars + I64 now_i64_; // 31 bits yields tipically about 1000 bars - static int const CHANNELS_i = 16; - static int const PITCHES_i = 128; - I64 running_i64_i64_a_[ CHANNELS_i ][ PITCHES_i ]; + static int const CHANNELS_i = 16; + static int const PITCHES_i = 128; + I64 running_i64_i64_a_[ CHANNELS_i ][ PITCHES_i ]; - Midi_score* midi_score_p_; - int division_1_i_; + Midi_score* midi_score_p_; + int division_1_i_; - char const* defined_ch_c_l_; - int fatal_error_i_; - My_midi_lexer* midi_lexer_p_; + char const* defined_ch_C_; + int fatal_error_i_; + My_midi_lexer* midi_lexer_p_; }; extern My_midi_parser* midi_parser_l_g; diff --git a/mi2mu/lily-stream.cc b/mi2mu/lily-stream.cc index 2ac5bc778d..f1b61cab5b 100644 --- a/mi2mu/lily-stream.cc +++ b/mi2mu/lily-stream.cc @@ -11,132 +11,134 @@ Lily_stream::Lily_stream( String filename_str ) { - filename_str_ = filename_str; - os_p_ = 0; - indent_i_ = 0; - comment_mode_bo_ = false; - column_i_ = 0; - wrap_column_i_ = 60; - open(); - header(); + filename_str_ = filename_str; + os_p_ = 0; + indent_i_ = 0; + comment_mode_bo_ = false; + column_i_ = 0; + wrap_column_i_ = 60; + open(); + header(); } Lily_stream::~Lily_stream() { - delete os_p_; - if ( indent_i_ ) - warning( "lily indent level: " + String( indent_i_ ), 0 ); + delete os_p_; + if ( indent_i_ ) + warning( "lily indent level: " + String( indent_i_ ), 0 ); } Lily_stream& Lily_stream::operator <<( String str ) { - static String nobreak_str = "\\`'_-.^<>*@"; - while ( str.length_i() ) { - int max_i = wrap_column_i_ - column_i_ - 1; - int i = str.length_i() - 1 <? max_i; - int nl_i = str.left_str( i + 1 ).index_i( '\n' ); - if ( nl_i != -1 ) { - i = nl_i - 1; - str = str.nomid_str( nl_i, 1 ); - } + static String nobreak_str = "\\`'_-.^<>*@"; + while ( str.length_i() ) { + int max_i = wrap_column_i_ - column_i_ - 1; + int i = str.length_i() - 1 <? max_i; + int nl_i = str.left_str( i + 1 ).index_i( '\n' ); + if ( nl_i != -1 ) { + i = nl_i - 1; + str = str.nomid_str( nl_i, 1 ); + } - if ( ( i != str.length_i() - 1 ) && ( nl_i == -1 ) ) { - while ( i && ( isalnum( str[ i ] ) - || ( nobreak_str.index_i( str[ i ] ) != -1 ) ) ) - i--; + if ( ( i != str.length_i() - 1 ) && ( nl_i == -1 ) ) { + while ( i && ( isalnum( str[ i ] ) + || ( nobreak_str.index_i( str[ i ] ) != -1 ) ) ) + i--; - if ( !i ) { // no room left - if ( column_i_ > 8 * indent_i_ ) { - newline(); - if ( comment_mode_bo_ && ( str[ 0 ] != '%' ) ) - str = "%" + str; - continue; - } - else { // cannot break neatly... - i = max_i; - } - } + if ( !i ) { // no room left + if ( column_i_ > 8 * indent_i_ ) { + newline(); + if ( comment_mode_bo_ && ( str[ 0 ] != '%' ) ) + str = "%" + str; + continue; } - - String line = str.left_str( i + 1 ); - str = str.mid_str( i + 1, INT_MAX ); - *os_p_ << line; - column_i_ += line.length_i(); - if ( nl_i != -1 ) - newline(); - else - check_comment( line ); - if ( ( str.length_i() && ( nl_i == -1 ) ) || ( column_i_ >= wrap_column_i_ ) ) { - //brr. - if ( comment_mode_bo_ ) - str = "%" + str; - newline(); + else { // cannot break neatly... + i = max_i; } - } - return *this; + } + } + + String line = str.left_str( i + 1 ); + str = str.mid_str( i + 1, INT_MAX ); + *os_p_ << line; + column_i_ += line.length_i(); + if ( nl_i != -1 ) + newline(); + else + check_comment( line ); + if ( ( str.length_i() && ( nl_i == -1 ) ) || ( column_i_ >= wrap_column_i_ ) ) { + //brr. + if ( comment_mode_bo_ ) + str = "%" + str; + newline(); + } + } + return *this; } Lily_stream& Lily_stream::operator <<( Midi_event& midi_event_r ) { - midi_event_r.output_mudela( *this, false ); - *os_p_ << flush; - return *this; + midi_event_r.output_mudela( *this, false ); + *os_p_ << flush; + return *this; } void Lily_stream::check_comment( String str ) { - int newline_i = str.index_last_i( '\n' ); - if ( newline_i != -1 ) { - str = str.mid_str( newline_i +1, INT_MAX ); - comment_mode_bo_ = false; - } - if ( str.index_i( '%' ) != -1 ) - comment_mode_bo_ = true; + int newline_i = str.index_last_i( '\n' ); + if ( newline_i != -1 ) { + str = str.mid_str( newline_i +1, INT_MAX ); + comment_mode_bo_ = false; + } + if ( str.index_i( '%' ) != -1 ) + comment_mode_bo_ = true; } void Lily_stream::header() { - *os_p_ << "% Creator: " << mi2mu_version_str() << "\n"; - *os_p_ << "% Automatically generated, at "; - time_t t( time( 0 ) ); - *os_p_ << ctime( &t ); - *os_p_ << "% from input file: "; - *os_p_ << midi_parser_l_g->filename_str_; - *os_p_ << "\n\n"; + *os_p_ << "% Creator: " << mi2mu_version_str() << "\n"; + *os_p_ << "% Automatically generated, at "; + time_t t( time( 0 ) ); + *os_p_ << ctime( &t ); + *os_p_ << "% from input file: "; + *os_p_ << midi_parser_l_g->filename_str_; + *os_p_ << "\n\n"; } - +/* + snapnie: dit kan toch automaties? Zie ook dstream. + */ void Lily_stream::indent() { - indent_i_++; - newline(); + indent_i_++; + newline(); } void Lily_stream::newline() { - *os_p_ << endl << String( '\t', indent_i_ ); - column_i_ = indent_i_ * 8; - comment_mode_bo_ = false; + *os_p_ << endl << String( '\t', indent_i_ ); + column_i_ = indent_i_ * 8; + comment_mode_bo_ = false; } void Lily_stream::open() { - os_p_ = new ofstream( filename_str_ ); - if ( !*os_p_ ) - error ( "can't open `" + filename_str_ + "\'", 0 ); + os_p_ = new ofstream( filename_str_ ); + if ( !*os_p_ ) + error ( "can't open `" + filename_str_ + "\'", 0 ); } void Lily_stream::tnedni() { - assert( indent_i_ > 0 ); - indent_i_--; - newline(); + assert( indent_i_ > 0 ); + indent_i_--; + newline(); } diff --git a/mi2mu/main.cc b/mi2mu/main.cc index e04cb02b09..31dfe9e5e0 100644 --- a/mi2mu/main.cc +++ b/mi2mu/main.cc @@ -6,13 +6,13 @@ #include "mi2mu.hh" -Source source; -Source* source_l_g = &source; +Sources source; +Sources* source_l_g = &source; Verbose level_ver = NORMAL_ver; //ugh -char const* defined_ch_c_l = 0; +char const* defined_ch_C = 0; // ugh, another global String @@ -23,17 +23,17 @@ find_file( String str ) // ugh, copied from warn.cc, cannot use void -message( String message_str, char const* context_ch_c_l ) +message( String message_str, char const* context_ch_C ) { String str = "mi2mu: "; - Source_file* sourcefile_l = source_l_g->sourcefile_l( context_ch_c_l ); + Source_file* sourcefile_l = source_l_g->sourcefile_l( context_ch_C ); if ( sourcefile_l ) { - str += sourcefile_l->file_line_no_str(context_ch_c_l) + String(": "); + str += sourcefile_l->file_line_no_str(context_ch_C) + String(": "); } str += message_str; if ( sourcefile_l ) { str += ":\n"; - str += sourcefile_l->error_str( context_ch_c_l ); + str += sourcefile_l->error_str( context_ch_C ); } // if ( busy_parsing() ) cerr << endl; // until we have fine output manager... @@ -41,15 +41,15 @@ message( String message_str, char const* context_ch_c_l ) } void -warning( String message_str, char const* context_ch_c_l ) +warning( String message_str, char const* context_ch_C ) { - message( "warning: " + message_str, context_ch_c_l ); + message( "warning: " + message_str, context_ch_C ); } void -error( String message_str, char const* context_ch_c_l ) +error( String message_str, char const* context_ch_C ) { - message( message_str, context_ch_c_l ); + message( message_str, context_ch_C ); // since when exits error again? // i-d say: error: errorlevel |= 1; -> no output upon error // warning: recovery -> output (possibly wrong) @@ -89,7 +89,6 @@ notice() " Han-Wen Nienhuys <hanwen@stack.nl>\n" // "Contributors\n" " Jan Nieuwenhuizen <jan@digicash.com>\n" -// " Mats Bengtsson <matsb@s3.kth.se>\n" "\n" " This program is free software; you can redistribute it and/or\n" "modify it under the terms of the GNU General Public License version 2\n" @@ -113,7 +112,6 @@ main( int argc_i, char* argv_sz_a[] ) 0, "be-blonde", 'b', 0, "debug", 'd', 0, "help", 'h', -// 1, "include", 'I', 0, "no-silly", 'n', 1, "output", 'o', 0, "quiet", 'q', @@ -137,9 +135,6 @@ main( int argc_i, char* argv_sz_a[] ) help(); exit( 0 ); break; -// case 'I': -// path->push( getopt_long.optarg ); -// break; case 'n': Duration_convert::no_double_dots_b_s = false; Duration_convert::no_triplets_b_s = true; @@ -165,20 +160,23 @@ main( int argc_i, char* argv_sz_a[] ) char* arg_sz = 0; while ( ( arg_sz = getopt_long.get_next_arg() ) ) { - My_midi_parser midi_parser( arg_sz ); + My_midi_parser midi_parser( arg_sz, & source ); + midi_parser_l_g = &midi_parser; + int error_i = midi_parser.parse(); if ( error_i ) return error_i; if ( !output_str.length_i() ) { - output_str = String( arg_sz ) + ".ly"; - // i-m sure there-s already some routine for this - int name_i; // too bad we can-t declare local to if - if ( ( name_i = output_str.index_last_i( '/' ) ) != -1 ) - output_str = output_str.mid_str( name_i + 1, INT_MAX ); + String d, dir, base, ext; + + split_path(arg_sz, d, dir, base, ext); + + output_str = base + ext + ".ly"; } error_i = midi_parser.output_mudela( output_str ); if ( error_i ) return error_i; + midi_parser_l_g = 0; } return 0; } diff --git a/mi2mu/mi2mu-version.cc b/mi2mu/mi2mu-version.cc index e1b7178851..78773e7208 100644 --- a/mi2mu/mi2mu-version.cc +++ b/mi2mu/mi2mu-version.cc @@ -6,7 +6,7 @@ #include "version.hh" -static char *s = "mi2mu " MAJOR_VERSION "." MINOR_VERSION "." MY_PATCH_LEVEL " #%d"; +static char *s = "mi2mu " MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL MY_PATCH_LEVEL " #%d"; static const int build= #include ".build" diff --git a/mi2mu/midi-event.cc b/mi2mu/midi-event.cc index 6bc15a4cf9..4ab611cd4f 100644 --- a/mi2mu/midi-event.cc +++ b/mi2mu/midi-event.cc @@ -97,20 +97,20 @@ Midi_note::mudela_str( bool command_mode_bo ) //ugh String str; - if ( dur_.plet_p_ ) + if ( dur_.plet_b() ) str += String( "\\plet{ " ) - + String_convert::i2dec_str( dur_.plet_p_->iso_i_, 0, 0 ) + + String_convert::i2dec_str( dur_.plet_.iso_i_, 0, 0 ) + "/" - + String_convert::i2dec_str( dur_.plet_p_->type_i_, 0, 0 ) + + String_convert::i2dec_str( dur_.plet_.type_i_, 0, 0 ) + " } "; str += name_str_; Duration dur = dur_; - dur.set_plet( 0 ); + dur.set_plet( 1,1 ); str += Duration_convert::dur2_str( dur ); - if ( dur_.plet_p_ ) + if ( dur_.plet_b() ) str += String( " \\plet{ 1/1 }" ); return str; @@ -162,7 +162,7 @@ Midi_text::mudela_str( bool command_mode_bo ) { (void)command_mode_bo; if ( !text_str_.length_i() - || ( text_str_.length_i() != (int)strlen( text_str_.ch_c_l() ) ) ) + || ( text_str_.length_i() != (int)strlen( text_str_.ch_C() ) ) ) return ""; return "% " + text_str_ + "\n\t"; diff --git a/mi2mu/midi-lexer.l b/mi2mu/midi-lexer.l index f83258789f..6add2613c7 100644 --- a/mi2mu/midi-lexer.l +++ b/mi2mu/midi-lexer.l @@ -1,16 +1,16 @@ -%{ +%{//-*-Fundamental-*- // midi-lexer.l #include "mi2mu.hh" #include "midi-parser.hh" +#define YY_USER_ACTION char_count_ += YYLeng(); // ugh %} %option c++ %option noyywrap %option nodefault -%option yylineno %option debug %option yyclass="My_midi_lexer" %option stack @@ -374,7 +374,7 @@ SSME [\0x7f][\x03] <meta_event>{U8} { warning( String( "meta_event: unimplemented event: " ) + String_convert::bin2hex_str( String( *YYText() ) ), - this->here_ch_c_l() ); + this->here_ch_C() ); yy_pop_state(); yy_pop_state(); yy_push_state( u8 ); diff --git a/mi2mu/my-midi-lexer.cc b/mi2mu/my-midi-lexer.cc index 843899567b..ba578d1dfc 100644 --- a/mi2mu/my-midi-lexer.cc +++ b/mi2mu/my-midi-lexer.cc @@ -8,71 +8,68 @@ int yylex() { - return midi_lexer_l_g->yylex(); + return midi_lexer_l_g->yylex(); } My_midi_lexer* midi_lexer_l_g = 0; -My_midi_lexer::My_midi_lexer( String filename_str ) +My_midi_lexer::My_midi_lexer( String &filename_str, Sources * sources ) { - midi_lexer_l_g = this; - input_file_p_ = new Input_file( filename_str ); - switch_streams( input_file_p_->is ); - errorlevel_i_ = 0; + source_file_p_ =sources->get_file_l(filename_str); + switch_streams( source_file_p_->istream_l() ); + errorlevel_i_ = 0; + char_count_ = 0; } My_midi_lexer::~My_midi_lexer() { - delete input_file_p_; - midi_lexer_l_g = 0; + delete source_file_p_; } void My_midi_lexer::error( char const* sz_l ) { - if ( !input_file_p_ ) { -// *mlog << "error at EOF" << sz_l << '\n'; + if ( !source_file_p_ ) { cerr << "error at EOF" << sz_l << '\n'; } else { - char const* ch_c_l = here_ch_c_l(); - if ( ch_c_l ) { - ch_c_l--; - while ( ( *ch_c_l == ' ' ) || ( *ch_c_l == '\t' ) || ( *ch_c_l == '\n' ) ) - ch_c_l--; - ch_c_l++; + char const* ch_C = here_ch_C(); + if ( ch_C ) { + ch_C--; + while ( ( *ch_C == ' ' ) || ( *ch_C == '\t' ) || ( *ch_C == '\n' ) ) + ch_C--; + ch_C++; } errorlevel_i_ |= 1; -// ::error( sz_l, ch_c_l ); - ::error( sz_l, ch_c_l ); + ::error( sz_l, ch_C ); } } char const* -My_midi_lexer::here_ch_c_l() +My_midi_lexer::here_ch_C() { - return input_file_p_->sourcefile_l_->ch_c_l() + yyin->tellg(); + return source_file_p_->ch_C() + char_count_ ; } int My_midi_lexer::varint2_i( String str ) { - int var_i = 0; + int var_i = 0; - for ( int i = 0; i < str.length_i(); i++ ) { - Byte byte = str[ i ]; - var_i <<= 7; - var_i += byte & 0x7f; - if ( ! ( byte & 0x80 ) ) - return var_i; - } - cout << "\nvarint2_i:" << String_convert::bin2hex_str( str ) << endl; - assert( 0 ); // illegal varint - return 0; + for ( int i = 0; i < str.length_i(); i++ ) { + Byte byte = str[ i ]; + var_i <<= 7; + var_i += byte & 0x7f; + if ( ! ( byte & 0x80 ) ) + return var_i; + } + cout << "\nvarint2_i:" << String_convert::bin2hex_str( str ) << endl; + assert( 0 ); // illegal varint + return 0; } int My_midi_lexer::close_i() { - return 0; + return 0; } diff --git a/mi2mu/my-midi-parser.cc b/mi2mu/my-midi-parser.cc index 5e6c2ced7d..9a7ece723b 100644 --- a/mi2mu/my-midi-parser.cc +++ b/mi2mu/my-midi-parser.cc @@ -14,12 +14,13 @@ yyerror(char const* sz_l ) My_midi_parser* midi_parser_l_g = 0; -My_midi_parser::My_midi_parser( String filename_str ) +My_midi_parser::My_midi_parser( String filename_str, Sources *sources_l ) { - midi_parser_l_g = this; filename_str_ = filename_str; - midi_lexer_p_ = new My_midi_lexer( filename_str_ ); - defined_ch_c_l_ = 0; + midi_lexer_p_ = new My_midi_lexer( filename_str_,sources_l ); + midi_lexer_l_g = midi_lexer_p_; // ugh + + defined_ch_C_ = 0; fatal_error_i_ = 0; midi_key_p_ = 0; midi_score_p_ = 0; @@ -32,8 +33,9 @@ My_midi_parser::My_midi_parser( String filename_str ) My_midi_parser::~My_midi_parser() { + midi_lexer_l_g = 0; // ugh + delete midi_lexer_p_; - midi_parser_l_g = 0; delete midi_key_p_; delete midi_tempo_p_; delete midi_time_p_; diff --git a/mi2mu/template.cc b/mi2mu/template.cc index be7a2a2352..6024aa9f1d 100644 --- a/mi2mu/template.cc +++ b/mi2mu/template.cc @@ -21,6 +21,5 @@ IPL_instantiate(Midi_event); IPL_instantiate(Midi_track); PL_instantiate(Midi_voice); IPL_instantiate(Midi_voice); -IPL_instantiate(Source_file); IPL_instantiate(Track_column); diff --git a/mi2mu/version.cc b/mi2mu/version.cc index d9fe95dac7..3eb7e4d25c 100644 --- a/mi2mu/version.cc +++ b/mi2mu/version.cc @@ -7,7 +7,7 @@ String mi2mu_version_str() { return String ( "This is " ) + mi2mu_version_sz() - + flower_version_sz() + + "/" + flower_version_sz() + " of " + __DATE__ + " " + __TIME__; }