]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 0.0.37 release/0.0.37
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 27 Feb 1997 22:17:37 +0000 (23:17 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 27 Feb 1997 22:17:37 +0000 (23:17 +0100)
67 files changed:
Documentation/Makefile
Documentation/faq.pod
Documentation/language.pod [new file with mode: 0644]
NEWS
Sources.make
Variables.make
configure
deps/dummy.dep
flower/NEWS
flower/Sources.make
flower/Variables.make
flower/dstream.cc
flower/fproto.hh
flower/path.cc
flower/scalar.cc
flower/string.cc
flower/string.hh
flower/stringconversion.cc [deleted file]
flower/stringconversion.hh [deleted file]
flower/stringdata.inl
flower/stringtest.cc
flower/stringutil.cc
hdr/midi-event.hh
hdr/midi-main.hh
hdr/midi-score.hh
hdr/midi-track.hh
hdr/midiitem.hh
hdr/my-midi-lexer.hh
hdr/my-midi-parser.hh
hdr/proto.hh
hdr/script.hh
hdr/stem.hh
hdr/textitem.hh
input/Makefile
input/fugue1.midi.ly [new file with mode: 0644]
input/pre1.midi.ly [new file with mode: 0644]
input/standchen.ly
src/beam.cc
src/binary-source-file.cc
src/dimen.cc
src/inputfile.cc
src/lexer.l
src/lyricitem.cc
src/main.cc
src/midi-event.cc
src/midi-lexer.l
src/midi-main.cc
src/midi-parser.y
src/midi-score.cc
src/midi-template.cc
src/midi-track.cc
src/midiitem.cc
src/midistream.cc
src/misc.cc
src/my-midi-lexer.cc
src/my-midi-parser.cc
src/mylexer.cc
src/note.cc
src/parser.y
src/request.cc
src/script.cc
src/sourcefile.cc
src/stem.cc
src/tex.cc
src/textitem.cc
src/timedescription.cc
src/walkregs.cc

index f8211b708cd8ee35b80370b917a3b22d26fa528b..0dc97f7dbe4a25d2b03293a2567a157e8c22b1c4 100644 (file)
@@ -1,5 +1,5 @@
 PODS=README.pod CodingStyle.pod lilygut.pod lilyinput.pod error.pod\
-       faq.pod index.pod
+       faq.pod index.pod language.pod
 TXTS=$(PODS:.pod=.txt)
 MANS=$(PODS:.pod=.1)
 HTMLS=$(PODS:.pod=.html)
index d54266f053612be28755fbe1aa96ed15401ca207..79e511498ef3dcb34e2fb516c35e78ff76518348 100644 (file)
@@ -56,11 +56,14 @@ A: By using g++ LilyPond is portable to all platforms which support
 g++ (there are quite a few). Not having to support other compilers
 saves us a *lot* of trouble. LilyPond & FlowerLib uses:
 
-=over 5
+=over 6
 
 =item *
 builtin bool
 
+=item *
+64 bit integral type long long
+
 =item *
 typeof
 
diff --git a/Documentation/language.pod b/Documentation/language.pod
new file mode 100644 (file)
index 0000000..e316fdc
--- /dev/null
@@ -0,0 +1,413 @@
+=head1 NAME
+
+language.pod -- state of the art mudela-vapourware.
+
+=head1 SYNOPSIS
+
+(damn pod)
+
+=head1 DESCRIPTION
+
+here are some thoughts on the language. Most of the examples are in
+pseudo current mudela.  Some stuff gratuitously taken from your mails.
+
+=head1 NOTE
+
+I dislike vapourware. That's why I oppose to concrete plans on how to
+do input for features we don't know how to produce on paper 
+
+=head1 AIM
+
+A musical notation that is relatively easy to comprehend to both
+programmers and non programmers. The final aim is to be able to
+express what can be expressed in sheet music.
+
+=over 5
+
+=item *
+play pieces
+
+=item *
+typeset the pieces
+
+=back
+
+further requirements:
+
+=over 5
+
+=item *
+Possible to edit the layout without danger of changing the
+original music. (fingerings, interpretation)
+
+=item *
+Simple music manipulations, such as transposing, creating a
+score for individual instruments as well as for the conductor,
+extracting short pieces from a longer one, glueing several shorter
+pieces into a single score.
+
+=back
+
+Pieces could be:
+
+
+=over 5
+
+=item *
+Mahlerian orchestral score
+
+=item *
+piano pieces
+
+=item *
+pop songs (lyrics + chords)
+
+=item *
+gregorian chant (?)
+
+=item *
+bach multivoice organ music.
+
+=item *
+short excerpts to be used in musicological publications.
+
+=back
+
+=head1 REQUIREMENTS
+
+=head2 Parser output 
+
+When I say LilyPond input, I mean the final output of the parsing
+step, which should be roughly the same as it is now: hierarchically,
+using pseudo syntax
+
+       Score {
+               Midi_def
+               Paper_def
+               Staff [multiple] {
+                       Voices
+                       Stafftype
+                       (instrument)
+               }
+       }
+
+
+Voice should stay the same:
+
+       Voice {
+               Voice_elements 
+       }
+
+and
+
+       Voice_elements {
+               requests
+       }
+
+
+=head2 Staffs
+
+We definitely need the concept of staff in the parser output, because
+it is fundamental to LilyPond.  I think the input language should
+allow the user to do something like:
+
+       melody = { c d e f g }
+
+       %At this time I can't think of more than these stafftypes
+       staff { gregorian music { melody } }
+       staff { pianostaff music { melody } }
+       staff { melodic music { melody } }
+       staff { rhythmic music { melody } }
+       staff { lyric music { melody } }        % silly, i admit.
+
+The staff could also define what the instrument would be (both in
+print and in MIDI)
+
+Moreover, if music {} in score equals staff, then how do we do multiple
+voices on one staff?
+
+We might be able to do without the staff{} construct, but I doubt if
+it will make things easier.
+
+=head1 THOUGHTS
+
+=head2 Typing
+
+It is difficult to make mistakes with typing now because you have to
+tell LilyPond what it is dealing with
+
+       staff { identifier }
+
+versus
+
+       staff { music { identifier } }
+
+I'm not sure on dropping this, I'm afraid it will make the language
+less legible. Technically, dropping it is not very difficult (it will
+introduce slight parser-source bloat)
+
+What if the staff is extended to have some more blocks, all of which
+can be declared? Like the score now:
+
+       score {
+               a_staff_id
+               a_midi_id
+               a_paper_id
+               a_command_id
+       }
+
+This will only be readable if the Mudela-user rigidly uses hungarian,
+which he/she won't.
+
+=head2 Backslash
+
+I like it. Let's keep it in the language if we need it, it's a
+universally accepted escape sequence.
+
+=head2 Braces
+
+I like the idea of <> vs. {}. Not because I think it is more clear,
+but I dislike the word "music", I can't seem to find the proper word
+for what "music" currently does, so I'd like to flush it.
+
+I would like to point that both <> and {} are indicating a
+hierarchy. I think, we should continue to allow them to nest. I still
+have no preference what to use for what.
+
+=head2 Command syntax
+
+Braces on commands are here now, because the {} are the only nesting
+braces.  We need to avoid that, since the brace is overused as it
+is. We don't like lisp that much. (the key is the only commands which
+really needs {} now)
+
+How about
+
+       \bar "some args", "some more";
+
+(note the ; ), which is a mix of perl and TeX.
+
+Of course \key should take a \notename. In fact, I think we should
+program the note intervals (which are now hardcoded for midi purposes)
+To allow adaptation to other scales.
+
+As simple fix, we might do key declarations:
+
+       \keybes= \key { bes es }
+
+       \key{\keybes}
+
+
+
+[LOOSE THOUGHT]
+
+We might drop this {} argument altogether, by merely enforcing
+that each "statement" (music,score,staff,chord) takes a LIST as
+argument, and use the {} to group lists. This is admittedly perl. This
+is very sketchy.
+
+
+=head2 Requests
+
+I want to give the user some access to the internals. Technically,
+walkers/registers will happily typeset voices which mix lyrics and
+notes, which combine stem requests and lyricreqs. I want to have a
+
+       \request { melodic name = 5, acc = -10
+               rhythmic ball=4 dots 2, lyric = "foobar" }
+
+type of syntax. This is the most flexible input format possible, since
+any valid LilyPond input can be made. This strongly implies tying
+mudela to LilyPond. That I don't mind, but it hampers
+portability. Suppose some commercial systems want to read mudela
+too.
+
+=head2 Lexer modes
+
+the $ and @ were quick hacks, which suck badly. Replacing it by a
+mechanism that switches the lexer automatically would be better, but
+it is still error prone, and it hurts uniformity. What I would like
+best is unified syntax, but this seems impossible since lyrics could
+clash with notenames. If possible it would simplify the parser, the
+scanner, and the explanation of the language.
+
+What about:
+
+       bes c d e f     % notes
+       'bes- sen sap   % some lyric syllables
+
+We can make one of the ' ` " a lyric-indication, but then we would
+have to change the octave indication, eg.
+
+       _bes % lower
+       ^bes % higher
+
+or
+
+       +bes % higher
+       -bes % lower
+
+And I am still not sure if it would be possible now, but I think this
+is worthwile to investigate. Or we could replace @ by a
+quote (take your pick) sign, which is a lot more intuitive. 
+
+The big question remaining is: do we want to add any more modes than
+lyric and note?
+
+
+[LOOSE THOUGHT]
+
+Even looser ideas: we can take a look at the perl wagon. It has numerous
+inputmodes. What about:
+
+       lyric << ENDLYRIC
+
+       bes- sen- sap
+
+       ENDLYRIC
+
+       music << ENDMUSIC
+
+       c d e f g
+
+       ENDMUSIC
+
+
+[LOOSE THOUGHT]
+
+If we free up $ @ from their current meaning, $ and @ could be used to
+signify other things.
+
+=head2 Concrete solution to lyric vs. note
+
+I think
+
+       "lyric"
+
+is a valid lyric too. This implies that any bare string is checked if
+it is a note. Now it prints an error if not, but I could change it to
+assume it is a STRING (and can be reduced to lyric). Heck! I could
+implement this tonight. We'd lose one mode!  (after checking lexer
+source) the only problem is preventing puctuation and the - and _ from
+clashing with script symbols.
+
+
+=head2 Command placement:
+
+Mats is an arduous fan of having the commands inside music. I am
+not. I see the Mudela music as something which can be plugged into
+different staffs, transposed, translated in time, copied, quoted,
+etc. Encouraging "inline" commands would be bad since they hinder this
+reuse of typed music.
+
+The way I figure it, the bad part is essentially counting
+bars/wholes. Maybe we can get rid of it, by reinstalling the "mark"
+commands.
+
+I definitely want  to avoid complicated logic  ("Hey there is  another
+bar request, should we merge this bar with another staff's", this kind
+of "smartness" makes a  lot M$ software inconsistent) inside LilyPond,
+by making the input unambiguous in this respect.
+
+There is another complication: some symbols (bars) sometimes are
+linked across staffs. I should first think of a way to do this in
+LilyPond, before even considering a syntax.
+
+
+=head2 Volta
+
+uhh?
+
+=head2 Numbers
+
+The syntax of /, * and : has to be settled, we have
+
+       - notes (1, 2, 4, 8 etc)
+       - meter 2*4
+       - plet 2/3
+       - multiple notes: 3*4
+       - abbreviations (not implemented)  c4/4 or c4*4
+
+=head2 Filtering
+
+This is a idea of mine: we could filter some request types from
+voices,
+
+eg:
+
+       \mel1 = \music { c-. d-. e-. f-. \meter {2*4} g-. a-. b.- c-. }
+
+       \m1 = \filter { "script_req" \mel1 }
+       \m2 = \filter { "command_req" \mel1 }
+       \m3 = \filter { "melodic_req" \mel1 }
+       \m3 = \filter { ("rhythmic_req") && (!"lyric_req") &&
+               ("stem_req" || "beam_req") \mel1 }
+               % syntax needs change. Clash with () slur?
+
+       \mel2 = \music { c c g  g a a g2 }
+
+       \combined = \merge { \m1, \mel2  }
+
+This means m1 contains the scripts, of \mel, \m2 only the meter
+command surrounded by (essentially) some skips, and \m3 the notes
+without scripts or meters. This could be a solution to the "command in
+music vs. command with skip".
+
+Combined with merging of requests, this would be a powerful tool. In
+this example \combined is a combination of melody mel2 and the accents
+of \mel1.
+
+This idea is for advanced users, but it would come in handy in urtext
+editions:
+
+       include "mozart-horn.ly"
+
+       \m1 = \merge { \urmozart + \dennisbrain_interpretation }
+       \m2 = \merge { \urmozart + \barrytuckwell_interpretation }
+
+
+=head2 Proposed operators:
+
+Just ideas:
+
+       || && !         filter syntax 
+       ++              concatenation of voices
+       +               merging of voices
+
+
+=head2 C++ OOP like input.
+
+I don't see the big win of this.
+
+       score sc1= melody;
+       sc1.staff{\verse};
+       sc1.staff{<\b1 \b2>}
+       sc1.paper=mypaperdef;
+
+
+We're not doing a programming language. In this syntax the parser has
+to lookup what sc1 means, decide if it should copied shallow/deep,
+decide if has a staff block, switch the mode after it finds that staff
+takes music. May be I'm just ranting, but it looks hairy to
+me. Remember that at this stage we're just filling structs.
+
+In a distant future there might be a need for programming (are you
+listening, Philip Glass?), but I think that would be something for
+Mudela version 3. And I think using m4 (or something alike) would be
+just as convenient.
+
+=head2 Transposition
+
+Has to be done. How about:
+
+       \transpose { \from c \to g \music { ... }} 
+
+=head2 Quoting
+
+Difficult. Hmm...
+
+       \oboe = \music { ........................ }
+
+       \oboefragment = \extract { \from 5*2 \to 6*2 \music { \oboe } }
+
+
diff --git a/NEWS b/NEWS
index 785c5bf38d15439f9a5641976b41c670ace27037..6592108aece8f3a44cbaa994deec6275c1e18e01 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,27 @@
+pl 37
+
+
+Documentation
+       - language.pod as starting point for mudela devel.
+
+       - Jan's patches:
+(jan's pl 36-3)
+
+       - m2m produces .ly output
+Internal
+       - simpler and better naming for Duration*
+       - the great String renaming / index to base=0 change
+       - Track_column, Lily_stream
+Features
+       - m2m patchy --no-triplet option;
+         lilypond accepts m2m's real midi output (hand-add red tape)
+       - m2m output only valid durations, resync option wip
+Bugfix
+       - m2m duration calc
+Internal
+       - Duration, Plet, Duration_convert taking load off duration calc.
+
+
 pl 36
        - Jan's patches:
        - do MIDI rests cleanly.
index 014621714925a3ee3084789d08c437bb1919efd6..a4e776d8f4dec10108c4752f37b5e940d37fef8e 100644 (file)
@@ -1,7 +1,9 @@
 # Sources.make
 # sourcefiles to be shipped. Also used for dependencies
 
-hdr=bar.hh barreg.hh beam.hh boxes.hh break.hh clefreg.hh clefitem.hh\
+hdr=bar.hh barreg.hh beam.hh\
+       binary-source-file.hh\
+       boxes.hh break.hh clefreg.hh clefitem.hh\
        colhpos.hh  commandrequest.hh   \
        complexwalker.hh complexstaff.hh\
        const.hh debug.hh dimen.hh directionalspanner.hh\
@@ -86,20 +88,30 @@ stablecc=request.cc bar.cc boxes.cc break.cc  \
 # m2m headers
 #
 mym2mhh=\
- binary-source-file.hh\
+ duration.hh\
+ lily-stream.hh\
  midi-event.hh\
  midi-main.hh\
  midi-score.hh\
  midi-track.hh\
  my-midi-lexer.hh\
  my-midi-parser.hh\
+ track-column.hh\
+
+#
+
+# m2m shared headers
+#
+mym2msharedhh=\
+ binary-source-file.hh\
 
 #
+
 # m2m source
 #
 mym2mcc=\
- binary-source-file.cc\
+ duration.cc\
+ lily-stream.cc\
  midi-event.cc\
  midi-main.cc\
  midi-score.cc\
@@ -107,15 +119,17 @@ mym2mcc=\
  midi-track.cc\
  my-midi-lexer.cc\
  my-midi-parser.cc\
+ track-column.cc\
 
 #
 
 # m2m shared source
 #
 mym2msharedcc=\
+ binary-source-file.cc\
  inputfile.cc\
  sourcefile.cc\
  source.cc\
 
-
 # 
+
index 886b6eb256a6267a4be6dd82c1e63f41e80112d0..6a9b2cf738520a5cfd630876db83fb6574558e23 100644 (file)
@@ -3,7 +3,7 @@
 # version info
 MAJVER=0
 MINVER=0
-PATCHLEVEL=36
+PATCHLEVEL=37
 
 
 
index 1c611713a579f727fe0dbdf6008ec4baf821a2d3..fec8a5617d930894208dcd8848636971e3b91891 100755 (executable)
--- a/configure
+++ b/configure
@@ -12,7 +12,7 @@ function setversion() {
 
 MAKE=${MAKE:-make}
 PREFIX=${PREFIX:-.}
-NEEDFLOWERVER=1.1.2
+NEEDFLOWERVER=1.1.4
 
 echo using PREFIX=$PREFIX
 echo I need Flower version $NEEDFLOWERVER
index 8b137891791fe96927ad78e64b0aad7bded08bdc..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1 +0,0 @@
-
index a01d6a140bf56399a5f3699e3f59706949c744c9..d6d6d86aed3c938ad0247a5505c968a646539bcc 100644 (file)
@@ -1,3 +1,12 @@
+pl 1.1.3-1
+       - great renaming of String and String_convert interfaces
+       - more conversions moved (copied actually) to String_convert
+       - String indexing now all base = 0, not found = -1
+       - renamed by to byte
+
+pl 1.1.3
+       - String::mid
+       - memmove test code
 
 pl 1.1.2 
        - StringConversio::bin2int_i
index 3964ba9be5fe3a5d3eb0ca6cef4ed74a9d43e16d..82454e3e3cf84e9f5a3cacb3234ea986f65eab26 100644 (file)
@@ -1,6 +1,6 @@
 
 cc=choleski.cc datafile.cc dstream.cc lgetopt.cc matdebug.cc matrix.cc\
-path.cc scalar.cc smat.cc string.cc stringconversion.cc stringutil.cc\
+path.cc scalar.cc smat.cc string.cc string-convert.cc stringutil.cc\
 textdb.cc textstream.cc unionfind.cc vector.cc 
 
 templatecc=cursor.tcc list.tcc plist.tcc interval.tcc\
@@ -11,7 +11,7 @@ inl=link.inl list.inl  cursor.inl plist.inl stringdata.inl stringhandle.inl
 hh=assoc.hh associter.hh choleski.hh compare.hh cursor.hh dstream.hh\
 fproto.hh handle.hh interval.hh iterate.hh lgetopt.hh link.hh list.hh\
 matrix.hh path.hh pcursor.hh plist.hh rational.hh real.hh scalar.hh\
-smat.hh string.hh stringconversion.hh stringhandle.hh stringdata.hh\
+smat.hh string.hh string-convert.hh stringhandle.hh stringdata.hh\
 textdb.hh textstream.hh unionfind.hh pqueue.hh\
 varray.hh vector.hh vsmat.hh datafile.hh
 
index 4e40f2453d148e926381d3ee6352babee84b65f1..d8cca75c97e561dee3faf37a6364731c512127e2 100644 (file)
@@ -1,6 +1,6 @@
 MAJVER=1
 MINVER=1
-PATCHLEVEL=2
+PATCHLEVEL=3
 
 PACKAGENAME=flower
 
index 92790b5a08113c425aa9ca4d31bdb8fde5ae0c74..8452b742ebb682761810976889d96a1bfa2c29b8 100644 (file)
@@ -13,16 +13,16 @@ const INDTAB = 3;
 static String
 strip_pretty(String pret)
 {
-    String cl(pret.left(pret.pos('(')-1));
-    int l = cl.lastPos(' ');
-    cl = cl.right(cl.len() -l);
+    String cl(pret.left_str(pret.index_i('(')));
+    int l = cl.index_last_i(' ');
+    cl = cl.right_str(cl.len() - l - 1);
     return cl;
 }
 
 static String
 strip_member(String pret)
 {
-    String cl(pret.left(pret.lastPos(':')-2));
+    String cl(pret.left_str(pret.index_last_i(':')-1));
     return cl;
 }
 
index 1d643ed621a167370edfc196f53916cf840f7b57..509d25d3fa7c80cd1357193ce7d686f582ce9bb5 100644 (file)
@@ -29,6 +29,7 @@ struct Getopt_long ;
 struct Matrix ;
 struct String_data ;
 struct String_handle ;
+struct String_convert;
 struct String;
 struct virtual_smat ;
 struct Vector  ;
index 3dc38366f26405fa583c5def9d921f6dca61e27d..c79962f00fc384caad3b3909eb71087fbe66c3d7 100644 (file)
@@ -17,30 +17,29 @@ split_path(String path,
           String &drive, String &dirs, String &filebase, String &extension)
 {
     // peel off components, one by one.
-    int di = path.pos(':');
-    if (di) 
+    int di = path.index_i(':');
+    if (di >= 0
        {
-       drive = path.left(di);
-       path = path.right(path.len() - di);
+       drive = path.left_str(di + 1);
+       path = path.right_str(path.len() - di -1);
        } 
     else
        drive = "";
     
-    di = path.lastPos(PATHSEP);
-    if (di) 
+    di = path.index_last_i(PATHSEP);
+    if (di >=0
        {
-       dirs = path.left(di);
-       path = path.right(path.len()-di);
+       dirs = path.left_str(di + 1);
+       path = path.right_str(path.len()-di -1);
        }
     else
        dirs = "";
     
-    di = path.lastPos('.');
-    if (di) 
+    di = path.index_last_i('.');
+    if (di >= 0
        {
-       di --; // don't forget '.'
-       filebase = path.left(di);
-       extension =path.right(path.len()-di);   
+       filebase = path.left_str(di);
+       extension =path.right_str(path.len()-di);       
        } 
     else 
        {
index 044b4d0b0fe7a1bae4193cfe9aadd0429255d17c..5edd9e997f3ba2128cc2760282419c198074e5c6 100644 (file)
@@ -10,15 +10,14 @@ Scalar::Scalar(Rational r)
 
 Scalar::operator Rational()
 {
-    int p = pos('/');
-    if (!p)
+    int p = index_i('/');
+    if (p == -1)
        return int(*this);
     
-    String s2 = right(len()-p);
-    p--;
-    String s1 = left(p);
+    String s2 = right_str(len()-p-1);
+    String s1 = left_str(p);
 
-    return Rational(s1.value(), s2.value());
+    return Rational(s1.value_i(), s2.value_i());
 }
 
 bool
@@ -35,13 +34,13 @@ Scalar::isnum()
 Scalar::operator Real()
 {
     assert (isnum());
-    return fvalue();
+    return value_f();
 }
 
 Scalar::operator int()
 {
     assert (isnum());
-    return value();
+    return value_i();
 }
 
 
@@ -52,8 +51,7 @@ Scalar::operator bool() const
     if (*this == "0")
        return false;
     String u (*this);
-    u.upper();
-    if (u== "FALSE")
+    if ( u.upper_str() == "FALSE")
        return false;
     return true;
 }
index 6e7378fdcc854ef295bd5349ee3f143f66b9f34b..a9368fe4e4cc623006b2820bcb25531ac64af24c 100644 (file)
@@ -16,7 +16,7 @@
 #include "string.hh"
 
 #ifdef STRING_DEBUG
-void* mymemmove( void* dest, void* src, size_t n );
+void* mymemmove( void* dest, void const* src, size_t n );
 #define memmove mymemmove
 #endif
 
@@ -25,11 +25,10 @@ strlwr( char* s )
 {
     char* p = s;
 
-    while( *p )
-        {
+    while( *p ) {
         *p = tolower( *p );    /* a macro on some compilers */
         p++;
-        }
+    }
     return s;
 }
 
@@ -38,11 +37,10 @@ strupr( char* s )
 {
     char* p = s;
 
-    while( *p )
-        {
+    while( *p ) {
         *p = toupper( *p );    /* a macro on some compilers */
         p++;
-        }
+    }
     return s;
 }
 
@@ -71,7 +69,7 @@ String::copy_byte_p() const
 }
 
 void
-String::printOn(ostream& os) const
+String::print_on(ostream& os) const
 {
     if ( length_i() == strlen( ch_c_l() ) )
         os << ch_c_l();
@@ -128,13 +126,13 @@ String::String(int i)
 
 String::String( const int i, const int n, char const c )
 {
-    char fillChar = c;
-    if ( fillChar)
-        fillChar = '0';
+    char fill_ch = c;
+    if ( fill_ch)
+        fill_ch = '0';
 
     String v( i );
     
-    String str = String( fillChar, n - v.length_i() ) + String( v );
+    String str = String( fill_ch, n - v.length_i() ) + String( v );
     strh_.set( str.byte_c_l(), str.length_i() );
 }
 
@@ -164,7 +162,7 @@ String::ch_l()
 
 // signed comparison,  analogous to memcmp;
 int
-String::compare(String const& s1, String const& s2 ) 
+String::compare_i(String const& s1, String const& s2 ) 
 {
     Byte const* p1 = s1.byte_c_l();
     Byte const* p2 = s2.byte_c_l();
@@ -181,96 +179,96 @@ String::compare(String const& s1, String const& s2 )
 
 
 int
-String::lastPos( char const c ) const
+String::index_last_i( char const c ) const
 {
-    // not binary safe
-    assert( length_i() == strlen( ch_c_l() ) );
-    char const* me = strh_.ch_c_l();
-    int pos = 0;
-    if ( length_i() )
-        {
+       // not binary safe
+       assert( length_i() == strlen( ch_c_l() ) );
+       if ( !length_i() ) 
+               return -1;
+
+       char const* me = strh_.ch_c_l();
        char const* p = strrchr(me, c );
-        if ( p )
-            pos = p - me + 1;
-        }
-    return pos;
+       if ( p )
+               return p - me;
+       return -1;
 }
 
 int
-String::lastPos( char const* string ) const
+String::index_last_i( char const* string ) const
 {
-    // not binary safe
-    assert( length_i() == strlen( ch_c_l() ) );
-    int pos = 0;
-    int length = strlen( string );
-    if ( length_i() && length )
-        {
-        int nextpos = this->pos( string );
-        while( nextpos )
-            {
-            pos += nextpos;
-            nextpos = right( length_i() - pos - length + 1 ).pos( string );
-            }
-        }
-    return pos;
+       // not binary safe
+       assert( length_i() == strlen( ch_c_l() ) );
+
+       int length = strlen( string );
+       if ( !length_i() || !length ) 
+               return -1;
+
+       int next_i = index_i( string );
+       if ( next_i == -1 )
+               return -1;
+               
+       int index_i = 0;
+       while( next_i >= 0 ) {
+               index_i += next_i;
+               next_i = right_str( length_i() - index_i - length ).index_i( string );
+       }
+       return index_i;
 }
 
 // find c
-// return 0 if not found. 
+// return -1 if not found. 
 
-// ? should return length_i()?, as in string.left(pos(delimiter))
+// ? should return length_i()?, as in string.left_str(index_i(delimiter))
 int
-String::pos(char c ) const
+String::index_i(char c ) const
 {
-    // not binary safe
-    assert( length_i() == strlen( ch_c_l() ) );
-    char const* me = strh_.ch_c_l();
-    int pos = 0;
-    if ( length_i() )
-        {
+       // not binary safe
+       assert( length_i() == strlen( ch_c_l() ) );
+       if ( !length_i() )
+               return -1;
+
+       char const* me = strh_.ch_c_l();
        char const* p = strchr( me, c );
-        if ( p )
-            pos = p - me + 1;
-        }
-    return pos;
+       if ( p )
+               return p - me;
+       return -1;
 }
 
 // find searchfor. (what if this == "" && searchfor == "") ???
 int
-String::pos( char const* searchfor ) const
-{
-    // not binary safe
-    assert( length_i() == strlen( ch_c_l() ) );
-    char const* me = strh_.ch_c_l();
-    int pos = 0;
-    if ( length_i() && searchfor)
-        {
+String::index_i( char const* searchfor ) const
+{
+       // not binary safe
+       assert( length_i() == strlen( ch_c_l() ) );
+       if ( !length_i() || !searchfor )
+               return -1;
+               
+       char const* me = strh_.ch_c_l();
        char const* p = strstr(me, searchfor);
-        if ( p )
-           pos = p - me + 1;
-        }
-    return pos;
+       if ( p )
+               return p - me;
+       return -1;
 }
 
 // find chars of a set.
 int
-String::posAny( char const* string ) const
+String::index_any_i( char const* string ) const
 {
-    // not binary safe
-    assert( length_i() == strlen( ch_c_l() ) );
-    int pos = 0;
-    char const* s = (char const* )strh_.ch_c_l();
-    if ( length_i() && string )
-        {
+       // not binary safe
+       assert( length_i() == strlen( ch_c_l() ) );
+
+       if ( !length_i() || !string )
+               return -1;
+               
+       char const* s = (char const* )strh_.ch_c_l();
        char const* p = strpbrk( s, string );
-        if ( p )
-           pos = p - s + 1;
-        }
-    return pos;
+       if ( p )
+               return p - s;
+       return -1;
 }
 
 String
-String::left( int n ) const
+String::left_str( int n ) const
 {
     if (n >= length_i())
        return *this;
@@ -287,7 +285,7 @@ String::left( int n ) const
 
 // n rightmst chars
 String
-String::right( int n ) const
+String::right_str( int n ) const
 {
     if (n > length_i())
        return *this;
@@ -300,57 +298,53 @@ String::right( int n ) const
 
 
 String
-String::nomid( const int pos, const int n ) const
+String::nomid_str( int index_i, int n ) const
 {
-    String retval;
-        
-    if ( pos < 1 )
-        return String("");
-    if ( pos > length_i())
-       return *this;
+       if ( index_i < 0 )
+               return String();
+       if ( index_i >= length_i() )
+               return *this;
     
-    return String( String( left( pos - 1 ) ) + right( length_i() - pos - n + 1 ));
+       return String( String( left_str( index_i ) ) + right_str( length_i() - index_i - n ));
 }
 
 
 String
-String::mid( int pos, int n ) const
+String::mid_str( int index_i, int n ) const
 {
-    // HWN. This SUX: JCN: yep, please change me + all my invocations
-    // pos 1 == strh_->string[ 0 ];
-    // pos 0 allowed for convenience
-    if ( !length_i() || ( pos < 0 ) || ( pos > length_i() ) && ( n < 1 ) )
-        return String();
+       if ( !length_i() || ( index_i < 0 ) || ( index_i >= length_i() ) || ( n < 1 ) )
+               return String();
 
-    // overflow...
-    if ( ( n > length_i() ) ||  ( pos + n - 1 > length_i() ) )
-       n = length_i() - pos + 1;
+       if ( ( n > length_i() ) ||  ( index_i + n > length_i() ) )
+               n = length_i() - index_i;
 
-    return String( byte_c_l() + pos -1, n );
+       return String( byte_c_l() + index_i, n );
 }
 
 
-// to  uppercase
+// return uppercase
 String
-String::upper()
+String::upper_str() const
 {
     // not binary safe
     assert( length_i() == strlen( ch_c_l() ) );
-    char *s = strh_.byte_l();
+    String str = *this;
+    char *s = str.strh_.byte_l();
     strupr( s );
-    return *this;
+    return str;
 }
 
 
-// to lowercase
+// return lowercase
 String 
-String::lower()
+String::lower_str() const
 {
     // not binary safe
     assert( length_i() == strlen( ch_c_l() ) );
-    char* s = strh_.byte_l();
+    String str = *this;
+    char* s = str.strh_.ch_l();
     strlwr(s);
-    return *this;
+    return str;
 }
 
 String::String (double f, char const* fmt)
@@ -369,53 +363,45 @@ String::String (double f, char const* fmt)
     *this = buf;
 }
 
-long
-String::value() const
+int
+String::value_i() const
 {
-    long l =0;
-    if (length_i()) {
-       int conv = sscanf(strh_.ch_c_l(), "%ld", &l);
-       assert(conv);
-    }
-    return l;
+       return String_convert::dec2_i( *this );
 }
 
 double
-String::fvalue() const
+String::value_f() const
 {
-    double d =0;
-    if (length_i()) {
-       int conv = sscanf(strh_.ch_c_l(), "%lf", &d);
-       assert(conv);
-    }
-    return d;
+       return String_convert::dec2_f( *this );
 }
 
 
-String quoteString( String msg, String quote)
+#if 0
+String 
+quoteString( String msg, String quote)
 {
-    return msg + " `" + quote  + "' ";
+     return msg + " `" + quote  + "' ";
 }
-
+#endif // 0
 
 Byte*
 strrev( Byte* byte_l, int length_i )
 {
-  Byte by;
+  Byte byte;
   Byte* left_byte_l = byte_l;
   Byte* right_byte_l = byte_l + length_i;
 
   while ( right_byte_l > left_byte_l ) {
-    by = *left_byte_l;
+    byte = *left_byte_l;
     *left_byte_l++ = *right_byte_l;
-    *right_byte_l-- = by;
+    *right_byte_l-- = byte;
   }
   return byte_l;
 }
 
 
 String 
-String::reversed() const
+String::reversed_str() const
 {
     String str = *this;
     strrev( str.byte_l(), str.length_i() );
index a253b7ca613a6859f0d9e67531f0a920464bf1f0..7aa19047d1731e29b200f3db2fbd1dda5a26336a 100644 (file)
   ref counting through #String_handle#
 \item
 
-  conversion from bool, int, double, char *, char.
+  conversion from bool, int, double, char, char.
 \item
 
-  conversion to int, upcase, downcase
+  to be moved to String_convert:
+  conversion to int, upcase, downcase 
 
 \item
 
   printable. 
 
 \item
-  indexing (pos, posAny, lastPos)
+  indexing (index_i, index_any_i, last_index_i)
 
 \item
-  cutting (left, right, mid)
+  cutting (left_str, right_str, mid_str)
 
 \item
   concat (+=, +)
@@ -48,7 +49,7 @@
 
 \item
   No operator[] is provided, since this would be enormously  slow. If needed,
-  convert to const char *.
+  convert to char const* .
 \end{itemize}
 */
 class String
@@ -62,9 +63,9 @@ public:
     String() {  }                  
     String(Rational);
     /// String s = "abc";
-    String( const char* source ); 
+    String( char const* source ); 
 
-    String( Byte const* l_byte_c, int length_i ); 
+    String( Byte const* byte_c_l, int length_i ); 
     
     /// "ccccc"
     String( char c, int n = 1 );
@@ -76,7 +77,7 @@ public:
     String(bool );
 
     /// String s( 3.14, 6, '#' );
-    String ( double f , const char *fmt =0);
+    String ( double f , char const* fmt =0);
     String(  int i,  int n,  char c = ' ' );
 
     ///  return a "new"-ed copy of contents
@@ -88,7 +89,7 @@ public:
     Byte* byte_l();
 
     /// deprecated; use ch_c_l()
-    operator const char *() const { return ch_c_l(); }
+    operator char const* () const { return ch_c_l(); }
     
     String operator =( const String & source ) { strh_ = source.strh_; return *this; }
 
@@ -99,82 +100,82 @@ public:
     char operator []( int n ) const { return strh_[n]; }
 
     /// return n leftmost chars
-    String left( int n ) const;
+    String left_str( int n ) const;
 
     /// return n rightmost chars
-    String right( int n ) const;
+    String right_str( int n ) const;
 
-    /// convert this to upcase
-    String upper();
+    /// return uppercase of *this
+    String upper_str() const;
 
-    /// convert this to downcase
-    String lower(); // & ??
+    /// return lowercase of *this
+    String lower_str() const;
 
     /// return the "esrever" of *this
-    String reversed() const;
+    String reversed_str() const;
 
 
-    /// return a piece starting at pos (first char = pos 1), ength n
-    String mid(int pos,  int n ) const;
+    /// return a piece starting at index_i (first char = index_i 0), length n
+    String mid_str(int index_i, int n ) const;
 
     /// cut out a middle piece, return remainder
-    String nomid(int pos, int n ) const;
+    String nomid_str(int index_i, int n ) const;
 
     /// signed comparison,  analogous to memcmp;
-    static int compare(const String& s1,const  String& s2);
+    static int compare_i(const String& s1,const  String& s2);
        
     /// index of rightmost c 
-    int lastPos( char c) const;
+    int index_last_i( char c) const;
 
     /// index of rightmost element of string 
-    int lastPos( const char* string ) const;
+    int index_last_i( char const* string ) const;
 
     /**
       index of leftmost c.
       
     @return
-    0 if not found, else index + 1
+    -1 if not found, else index
     */
-    int pos(char c ) const;
-    int pos(const char* string ) const;
-    int posAny(const char* string ) const;
+    int index_i(char c ) const;
+    int index_i(char const* string ) const;
+    int index_any_i(char const* string ) const;
 
 
     /// provide Stream output
-    void printOn(ostream& os) const;
+    void print_on(ostream& os) const;
 
-    /// convert to an integer
-    long value() const;
-
-    /// convert to a double
-    double fvalue() const;
-    
     /// the length of the string
     int length_i() const;
 
-    // deprecated 
+    // ***** depreciated
     int len() const {
        return length_i();
     }
 
+    /// convert to an integer
+    int value_i() const;
+
+    /// convert to a double
+    double value_f() const;
+    // *****     
 };
 
 #include "compare.hh"
 
-instantiate_compare(const String &, String::compare);
+instantiate_compare(const String &, String::compare_i);
 
-// because const char* also has an operator ==, this is for safety:
-inline bool operator==(String s1, const char *s2){
+// because char const* also has an operator ==, this is for safety:
+inline bool operator==(String s1, char const* s2){
     return s1 == String(s2);
 }
-inline bool operator==(const char *s1, String s2)
+inline bool operator==(char const* s1, String s2)
 {
     return String(s1)==s2;
 }
-inline bool operator!=(String s1, const char *s2  ) {
+inline bool operator!=(String s1, char const* s2  ) {
     return s1!=String(s2);
 }
-inline bool operator!=(const char *s1,String s2) {
+inline bool operator!=(char const* s1,String s2) {
     return String(s2) !=s1;
 }
 
@@ -189,13 +190,13 @@ operator  + (String s1, String  s2)
 inline ostream &
 operator << ( ostream& os, String d )
 {
-    d.printOn(os);
+    d.print_on(os);
     return os;
 }
 
 
-String quoteString(String message, String quote);
+// String quoteString(String message, String quote);
 
-#include "stringconversion.hh"
+#include "string-convert.hh"
 
 #endif
diff --git a/flower/stringconversion.cc b/flower/stringconversion.cc
deleted file mode 100644 (file)
index 8b9144a..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-  PROJECT: FlowerSoft C++ library
-  FILE   : stringconversion.cc
-
---*/
-
-
-#include <assert.h>
-#include "string.hh"
-
-String
-StringConversion::bin2hex_str( String bin_str )
-{
-    String str;
-    Byte const* byte_c_l = bin_str.byte_c_l();
-    for ( int i = 0; i < bin_str.length_i(); i++ ) {
-       str += (char)nibble2hex_by( *byte_c_l >> 4 );
-       str += (char)nibble2hex_by( *byte_c_l++ );
-    }
-    return str;
-}
-
-int
-StringConversion::bin2int_i( String bin_str )
-{
-    assert( bin_str.length_i() <= 4 );
-
-    int result_i = 0;
-    for ( int i = 0; i < bin_str.length_i(); i++ ) {
-       result_i <<= 8;
-       result_i |= bin_str[ i ];
-    }
-    return result_i;
-}
-
-
-int
-StringConversion::hex2bin_i( String hex_str, String& bin_str_r )
-{
-    if ( hex_str.length_i() % 2 )
-        hex_str = "0" + hex_str;
-
-    bin_str_r = "";
-    Byte const* byte_c_l= hex_str.byte_c_l();
-    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++ );
-        if ( high_i < 0 || low_i < 0 )
-            return 1; // illegal char
-        bin_str_r += String( (char)( high_i << 4 | low_i ), 1 );
-        i += 2;
-    }
-    return 0;
-}
-
-String 
-StringConversion::hex2bin_str( String hex_str )
-{
-    String str;
-//  silly, asserts should alway be "on"!
-//    assert( !hex2bin_i( hex_str, str ) );
-    int error_i = hex2bin_i( hex_str, str );
-    assert( !error_i );
-    return str;
-}
-
-int 
-StringConversion::hex2nibble_i( Byte by )
-{
-    if ( by >= '0' && by <= '9' )
-        return by - '0';
-    if ( by >= 'A' && by <= 'F' )
-        return by - 'A' + 10;
-    if ( by >= 'a' && by <= 'f')
-        return by - 'a' + 10;
-    return -1;
-}
-    
-String 
-StringConversion::int2hex_str( int i, int length_i, char ch )
-{
-    String str;
-    if ( !i )
-       str = "0";
-    while ( i ) {
-       str = ( i % 16 )["0123456789abcdef"] + str;
-       i /= 16;
-    }
-    if ( str.length_i() < length_i )
-       str = String( ch, length_i - str.length_i() ) + str;
-    return str;
-}
-
-Byte
-StringConversion::nibble2hex_by( Byte by )
-{
-    if ( ( by & 0x0f ) <= 9 )
-       return ( by & 0x0f ) + '0';
-    else
-       return ( by & 0x0f ) - 10 + 'a';
-}
diff --git a/flower/stringconversion.hh b/flower/stringconversion.hh
deleted file mode 100644 (file)
index 0bcd7f5..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-  PROJECT: FlowerSoft C++ library
-  FILE   : stringconversion.hh
-
-*/
-
-#ifndef STRING_CONVERSION_HH
-#define STRING_CONVERSION_HH
-
-/**
-  all conversions from/to String go in here.( some time, anyway )
-  The class is quite empty from data view.
-  */
-class StringConversion {
-       static int hex2bin_i( String hex_str, String& bin_str_r );
-       static int hex2nibble_i( Byte by );
-       static Byte nibble2hex_by( Byte by );
-public:
-       static String bin2dec_str( String dec_str );
-       static String bin2hex_str( String bin_str );
-       static String dec2bin_str( String str );
-       static int bin2int_i( String str );
-       static int dec2int_i( String str );
-       static int hex2int_i( String str );
-       static String hex2bin_str( String str );
-       static String int2hex_str( int i, int length_i, char ch );
-       static String int2dec_str( int i, int length_i, char ch );
-};
-
-#endif // __STRING_CONVERSION_HH //
index 927ca0998d328b57f29cf84a4de932687e46da9c..7b55481085484ece724fdc734ad90aa827c58619 100644 (file)
 #include "stringdata.hh"
 const int INITIALMAX=8;
 
-#ifdef STRING_DEBUG 
-
-INLINE void* mymemmove( void* dest, void* src, size_t n )
-{
-       return memcpy( dest, src, n ); // wohltempererit: 69006
+#include <sys/types.h>
+void* 
+mymemmove( void* dest, void const* src, size_t n );
+#if 0 // redef STRING_DEBUG 
+INLINE void* 
+mymemmove( void* dest, void const* src, size_t n )
+{
+       return memmove( dest, src, n ); // wohltempererit: 69006
 }
 #define memmove mymemmove
 #endif
index 71c15579124426eb3d3f0a616b0642bcfef7c8c3..c0c50da5c6e4acd586d79a74c57d9b27d44ceaea 100644 (file)
@@ -9,17 +9,17 @@ main()
     String str( "hai" );
     cout <<  str << endl;
     cout << "left" << endl;
-    cout << "  0:" << str.left( 0 ) << endl;
-    cout << "  1:" << str.left( 1 ) << endl;
-    cout << "  2:" << str.left( 2 ) << endl;
-    cout << "  3:" << str.left( 3 ) << endl;
-    cout << "  4:" << str.left( 4 ) << endl;
+    cout << "  0:" << str.left_str( 0 ) << endl;
+    cout << "  1:" << str.left_str( 1 ) << endl;
+    cout << "  2:" << str.left_str( 2 ) << endl;
+    cout << "  3:" << str.left_str( 3 ) << endl;
+    cout << "  4:" << str.left_str( 4 ) << endl;
     cout << "right" << endl;
-    cout << "  0:" << str.right( 0 ) << endl;
-    cout << "  1:" << str.right( 1 ) << endl;
-    cout << "  2:" << str.right( 2 ) << endl;
-    cout << "  3:" << str.right( 3 ) << endl;
-    cout << "  4:" << str.right( 4 ) << endl;
+    cout << "  0:" << str.right_str( 0 ) << endl;
+    cout << "  1:" << str.right_str( 1 ) << endl;
+    cout << "  2:" << str.right_str( 2 ) << endl;
+    cout << "  3:" << str.right_str( 3 ) << endl;
+    cout << "  4:" << str.right_str( 4 ) << endl;
 
     str += " daar";
     cout << str << endl;
@@ -35,9 +35,9 @@ main()
 
     fn = "";
     fn += "";
-    delete fn.copy_by_p();
+    delete fn.copy_byte_p();
 
-    delete str.copy_by_p();
+    delete str.copy_byte_p();
 
-    cout << StringConversion::bin2hex_str( String( (char)0xff ) ) << endl;
+    cout << String_convert::bin2hex_str( String( (char)0xff ) ) << endl;
 }
index 9adcd2ea1dbd2ceb04cdcd7811f704a7421c5cf3..55e4fa1426e2ac8e6f6bcd8db12cb8798f534f90 100644 (file)
@@ -7,9 +7,12 @@
 */
 
 #ifdef STRING_DEBUG 
-void* mymemmove( void* dest, void* src, size_t n )
+#include <sys/types.h>
+#include <memory.h>
+void* 
+mymemmove( void* dest, void const* src, size_t n )
 {
-       return memmove( dest, src, n ); // wohltempererit: 69006
+       return memcpy( dest, src, n ); // wohltempererit: 69006
 }
 #define memmove mymemmove
 #endif
index a566dc50f730b275fbef15819c34d24180e31fa9..06b17221aa06de547769baa2f5baee0b982f451b 100644 (file)
@@ -19,12 +19,12 @@ public:
        Midi_event();
        virtual ~Midi_event();
        
-       String mudela_str();
+       virtual String mudela_str(); // = 0;
+       virtual void output_mudela( Lily_stream& lily_stream_r );
+       virtual Moment mom();
 
 protected:
        String mudela_str_;
-
-private:
 };
 
 class Midi_key : public Midi_event {
@@ -41,11 +41,16 @@ private:
 };
 
 class Midi_note : public Midi_event {
-public:
-//     Midi_note( Midi_key* midi_key_l, Midi_tempo* midi_tempo_l, Midi_time* midi_time_l, int pitch_i, Real duration_f );
-       Midi_note( Midi_key* midi_key_l, Midi_time* midi_time_l, int clocks_per_whole_i, int pitch_i, Real duration_f );
+    public:
+       int const c0_pitch_i_c_ = 60;
+
+        Midi_note( Midi_key* midi_key_l, Midi_time* midi_time_l, int division_1_i, int pitch_i, int time_i );
        virtual ~Midi_note();
 
+       virtual Moment mom();
+       
+private:
+       Duration dur_;
 };
 
 class Midi_tempo : public Midi_event {
@@ -62,14 +67,16 @@ private:
 
 class Midi_time : public Midi_event {
 public:
-       Midi_time( int num_i, int den_i, int clocks_i, int count_32_i );
+       Midi_time( int num_i, int den_i, int division_4_i, int count_32_i );
        virtual ~Midi_time();
 
-       String duration_str( int usecond24th_per_clock_i, Real delta_time_f );
-       int whole_clocks_i();
+       Duration i2_dur( int time_i, int division_1_i );
+       int clocks_1_i();
 
 private:
-       int whole_clocks_i_;
+       Real sync_f_;
+       Duration sync_dur_;
+       int clocks_1_i_;
        int num_i_;
        int den_i_;
 };
index 4eb86c27d2d0c58797f1fddacaa25d519190d64c..b58e077d432d06309699da86f205cf55010c3db4 100644 (file)
@@ -19,6 +19,9 @@ extern Verbose level_ver;
 #endif
 
 extern Source* source_l_g;
+extern bool no_triplets_bo_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 );
+
+String version_str();
index 2f88168a11daa244dff5daa898dddad1862d8b6b..68707633ef1987a427a03ed4416ff2d4ba7b01ef 100644 (file)
@@ -14,7 +14,10 @@ public:
 
        void add_track( Midi_track* midi_track_p );
 
+       int output_mudela( String filename_str );
+
 private:
+       IPointerList<Midi_track*> midi_track_p_list_;
        int format_i_;
        int tracks_i_;
        int tempo_i_;
index ce258c6eae33b938d2bec7769353889bde23ef49..d1458ed0ca98563c46cbd8470749ec9dfaa55ff4 100644 (file)
@@ -9,12 +9,17 @@
 /// (midi_track)
 class Midi_track {
 public:
-       Midi_track();
+       Midi_track( int track_i );
        ~Midi_track();
 
-       void add_event( Midi_event* midi_event_p );
+       void add_event( Moment mom, Midi_event* midi_event_p );
+       String name_str();
+       void output_mudela( Lily_stream& lily_stream_r );
+       Track_column* tcol_l( Moment mom );
 
 private:
+       IPointerList<Track_column*> tcol_p_list_;
+       String name_str_;
 };
 
 #endif // MIDI_TRACK_HH
index 486637c367a56c8f62df81264635bf0ed1698214..f4b14aa5ef14cda2c562bc3d447abd94b887312c 100644 (file)
@@ -10,7 +10,7 @@
 
 struct Midi_item {
     /* *************** */
-    static String int2varlength_str( int i );
+    static String i2varint_str( int i );
     virtual void output_midi( Midi_stream& midi_stream_r );
     virtual String str() = 0;
 };
index 5245d1be844151a46ff74c593ab306133e0f4910..032bf6752b848a8b02bd206246bf4ddda910cbce 100644 (file)
@@ -27,7 +27,7 @@ public:
        int close_i();
        void error( char const* sz_l );
        char const* here_ch_c_l();
-       static int varint2int_i( String str );
+       static int varint2_i( String str );
        int yylex();
 
 private:
index fd7e088654495c0f975c233288251ba9a896a864..d199bc1c4ec3decfc0011fcb4dfe76228815309b 100644 (file)
@@ -6,9 +6,8 @@
 #ifndef MY_MIDI_PARSER_HH
 #define MY_MIDI_PARSER_HH
 
-#include "proto.hh"
-#include "varray.hh"
-#include "string.hh"
+// #include "proto.hh"
+// #include "string.hh"
 
 int yyparse();
 
@@ -20,25 +19,26 @@ public:
        void add_score( Midi_score* midi_score_p );
        void error( char const* sz_l );
        int parse();
-       void forward( Real f );
+       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( String filename_str );
-       void set_division( int clocks_per_4_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_i );
        void set_time( int num_i, int den_i, int clocks_i, int count_32_i );
 
 private:
-       Real now_f_;
-       Real step_f_;
+       Int64 now_i64_; // 31 bits yields tipically about 1000 bars
 
        static int const CHANNELS_i = 16;
        static int const PITCHES_i = 128;
-       Real running_f_f_a_[ CHANNELS_i ][ PITCHES_i ];
+       Int64 running_i64_i64_a_[ CHANNELS_i ][ PITCHES_i ];
 
-       Array<Midi_score*> midi_score_p_array_;
-       int clocks_per_whole_i_;
+       Midi_score* midi_score_p_;
+       int division_1_i_;
        Midi_key* midi_key_p_;
        Midi_tempo* midi_tempo_p_;
        Midi_time* midi_time_p_;
index 0f2a007c7929a7668895156560155df8c0e50c9a..0ca6d726ddf10f5459df36b785f70a3da6947e93 100644 (file)
@@ -10,6 +10,9 @@
 #include "fproto.hh"
 #include "real.hh"
 
+/// (i64)
+typedef long long Int64;
+
 struct Absdynamic_req;
 struct Accidental;
 struct Atom;
@@ -33,6 +36,8 @@ struct Complex_staff;
 struct Complex_walker;
 struct Cresc_req;
 struct Decresc_req;
+struct Duration;
+struct Duration_iterator;
 struct Durational_req;
 struct Dynamic;
 struct Group_change_req;
@@ -50,6 +55,7 @@ struct Key_change_req;
 struct Key_item;
 struct Keyword;
 struct Keyword_table;
+struct Lily_stream;
 struct Line_of_score;
 struct Line_of_staff;
 struct Linestaff;
@@ -98,6 +104,7 @@ struct Offset;
 struct Output;
 struct PCol;
 struct Plet_req;
+struct Plet;
 struct PScore;
 struct PStaff;
 struct Paperdef;
@@ -151,6 +158,7 @@ struct Text_register;
 struct Text_req;
 struct Timing_req;
 struct Time_description;
+struct Track_column;
 struct Voice;
 struct Voice_element;
 struct Voice_group_registers;
index 9c48c75e248d5d33b631436df1965d1985f6b526..7c089e3a5426475b286df86a655b49c1418cfc1e 100644 (file)
@@ -32,7 +32,7 @@ struct Script : Item {
 private:
     void       set_symdir();
     void       set_default_dir();
-    void       set_default_pos();
+    void       set_default_index();
     Symbol symbol()const;
 };
 
index ccc02a6b594a561f223860b7f6813d60817b452c..2aafd66074c0ba1db2f5de7faa5eccd3b81d4c0f 100644 (file)
@@ -63,7 +63,7 @@ struct Stem : Item {
     void add(Notehead*n);
     const char * name() const;
 
-    Real hpos()const;
+    Real hindex()const;
     void do_print() const;
     void set_stemend(Real);
     int get_default_dir();
index c7df9069d96c11420b39e81616801b90335d717b..4e0e454941b85fde587ab1fd7a34345196a0dbc5 100644 (file)
@@ -18,7 +18,7 @@ struct Text_item : Item {
     
     /* ***************/
     const char * name() const;    
-    virtual void set_default_pos();
+    virtual void set_default_index();
     Molecule* brew_molecule_p() const;
     void do_pre_processing();
     
index 92dfaf11c5ed391866ad03e27046627a01b9e58d..47e58f972d5a823373f00d89ceac7b6029dc3346 100644 (file)
@@ -7,7 +7,8 @@ DISTFILES=Makefile  kortjakje.ly maartje.ly\
        martien.ly mlalt.ly mlvio1.ly mlvio2.ly mlcello.ly\
        coriolan-alto.ly rhythm.ly \
        standchen.tex  scsii-menuetto.tex scsii-menuetto.ly\
-       martien.tex
+       martien.tex\
+       pre1.midi.ly fugue1.midi.ly
 
 
 dist:
diff --git a/input/fugue1.midi.ly b/input/fugue1.midi.ly
new file mode 100644 (file)
index 0000000..b2c091f
--- /dev/null
@@ -0,0 +1,100 @@
+% Creator: This is m2m 0.0.36-2/FlowerLib 1.1.3-1 of Feb 27 1997 02:41:23
+% Automatically generated, at Thu Feb 27 08:38:27 1997
+% from input file: 
+
+track0 = music { $
+       % \Time: 4/8, 96: 8 % \Tempo: 967742: 61 4 per minute 
+       % \Tempo: 1000000: 60 4 per minute 
+       % \Tempo: 1052632: 56 4 per minute 
+       % \Tempo: 1132075: 53 4 per minute 
+       % \Tempo: 1200000: 50 4 per minute 
+       % \Tempo: 1463415: 40 4 per minute 
+       % \Tempo: 1578947: 38 4 per minute 
+       
+$} % track0
+
+track1 = music { $
+       g8 a8 b8 c8. d32 c32 b8 e8 a8 d8. e16 d16 c16 
+       b16 g16 a16 b16 c16 b16 c16 d16 e16 d16 e16 
+       fis16 g8 b8 c8 a8 d16 c16 b16 a16 g8. g16 f16 
+       e16 f16 g16 a16 g16 a16 b16 c2 b4 c8 d8 e8 f8. 
+       g32 f32 e8 a8 d8 g8. a16 g16 f16 e8 a8. b16 a16 
+       g16 f2 e8. fis16 g2 fis4 g16 f16 e16 d16 c16 
+       d16 c16 b16 a16 c16 b16 a16 c16 a16 gis8 e8 
+       d8 c16 b16 a16 gis16 a16 b16 c16 fis16 gis16 
+       a16 b8 a16 b16 c8 f8 e8 d4 c16 b16 c64 b64 c64 
+       b64 c64 b64 c64 b64 c64 b32. a32. a4 g8 a8 b8 
+       c8. d32 c32 b8 c8 d8 e8 f8. g32 f32 e8 a8 d8 g8. 
+       a16 g16 f16 e8 a8 d8 ais8 a8 g16 f16 g16 f16 
+       g16 e16 f16 g16 g64 a64 g32 f32 g32 a16 cis16 
+       d16 g16 f64 e64 f64 e64 f64 e16. d32. d8. g8 
+       a8 b8 c8. d32 c32 b8 e8 a8 d8. e16 d16 c16 b16 
+       c16 d16 e16 f16 g16 a16 g16 f16 e16 d16 c16 
+       c64 b64 c64 b8. c8 d8 g8 c4 b8 c4 b8 ais8 a8 d4 
+       c8 d8 e8 f8.. a32. g32. f32. e32. f32. e32. 
+       d32. c2 g32 a32 b16 c16 d16 e16 f8. c32 d32 
+       e32 f16 g16 a8. b16 c2 
+$} % track1
+
+track2 = music { $
+       c8 d8 e8 f8. g32 f32 e8 a8 d8 g8. a16 g16 f16 
+       e16 f16 e16 d16 c16 d16 c16 b16 a8 fis8 g4. 
+       f16 e16 f8 d8 g8 f8 e8 d8 g4 f16 e16 f8.. f16 
+       e8 d4 c8 f8 g16 f16 e16 f8 d8 g4.. g8 a8 b8 c8. 
+       d32 c32 b8 e8 a8 d8. e16 d16 c16 b16.. d8 e8 
+       fis8 g8. a32 g32 f8 b8 e8 a8. b16 a16 gis16 
+       fis8 f8 e8 d8. e16 fis16 gis16 a16 gis16 a16 
+       b16 gis16 fis16 gis16 a16 b8 c8 d8 e8 f8. g32 
+       f32 e8 a8 d8 g8. a16 g16 f16 e16. e16. fis16. 
+       g4 fis8 gis8 a4 g8 a8 b8 c8. d32 c32 b16. e8 
+       a8 d8. e16 d16 c16 b8 g8 cis8 d8 e8 cis8 d8 e8 
+       a8 e8 fis8 g8 a8. b32 a32 g8 c8 fis8 b8. c16 
+       b16 a16 g16 fis16 e16 d16 e4 d4. a16 g16 f16 
+       e16 g16 f16 g4. a16 a16 ais8 c4 d8 g8 g4. f4 
+       e8 d4 e16. a4 g4 f8 g8 a8 ais8. c32 ais32 a8 
+       d8 g8 c8. d16 c16 ais16 a16 ais16 a16 g16 f16 
+       g16 f16 e16 g16 a4 f16 d8 e2 
+$} % track2
+
+track3 = music { $
+       g8 a8 b8 c8. d32 c32 b8 e8 a8 d8. e16 d16 c16 
+       b8 c4 ais8 a8 d8 g8 c8 a16 b16 c16 d4 g4 g8 a8 
+       b8 c8. d32 c32 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. b32 a32 
+       g8 c8 fis8 b8. c16 b16 a16 gis16.. a4 gis8 
+       a4 g8 a8 b8 c8. d32 c32 b8 e8 a8 d4 g8 d4 c8 a8 
+       e4 d8 a8 b8 cis8 d8. e32 d32 c8 f8 b8 e8. f16 
+       e16 d16 cis8 a8 b8 cis8 d8. e32 d32 c8 fis8 
+       b8 e8. fis16 e16 d16 c4.. d16 c16 b16 a16 g16 
+       a16 fis16 g16.. b16.. c16.. d8 e8. f32 e32 
+       d8 g8 c8 f8. g16 f16 e16 d4 e8 d4 g8 g4. c8 d8 
+       e8 f8. g32 f32 e8 a8 d8 g8. a16 g16 f16 e16 d16 
+       e16 f16 g16 a16 ais16 g16 a16 e16 f16 g16 a16 
+       b16 c16 a16 c1 
+$} % track3
+
+track4 = music { $
+       c8 d8 e8 f8. g32 f32 e8 a8 d8 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. d32 c32 b8 
+       e8 a8 d8. e16 d16 c16 b8 e4 d8 c8 f4 e4 d4 e8 f8 
+       e16 d16 e4 a4 g8 a8 b8 c8. d32 c32 b8 e8 a8 d8. 
+       e16 d16 c16 b8 ais8 a8 g8 a8 fis8 g8 e8 d4 e8 
+       f8 g8. a32 g32 f8 ais8 e8 a8. b16. a16 g16 f16 
+       e16 f16 d16 g8 a8 d4.. e16 d16 c16 b16 a16 g16 
+       fis16 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 
+$} % track4
+
+score {
+       staff { melodic music { track0 } }
+       staff { melodic music { track1 } }
+       staff { melodic music { track2 } }
+       staff { melodic music { track3 } }
+       staff { melodic music { track4 } }
+       commands { meter { 4*4 } }
+       midi { tempo 4:60 }
+}
diff --git a/input/pre1.midi.ly b/input/pre1.midi.ly
new file mode 100644 (file)
index 0000000..ca6beaf
--- /dev/null
@@ -0,0 +1,80 @@
+% Creator: This is m2m 0.0.36-2/FlowerLib 1.1.3-1 of Feb 27 1997 02:41:23
+% Automatically generated, at Thu Feb 27 02:54:33 1997
+% from input file: 
+
+track0 = music { $
+       % \Time: 4/8, 96: 8 % \Tempo: 857143: 69 4 per minute 
+       % \Tempo: 882353: 67 4 per minute 
+       % \Tempo: 909091: 65 4 per minute 
+       % \Tempo: 937500: 64 4 per minute 
+       % \Tempo: 967742: 61 4 per minute 
+       % \Tempo: 1000000: 60 4 per minute 
+       % \Tempo: 1200000: 50 4 per minute 
+       % \Tempo: 1224490: 48 4 per minute 
+       % \Tempo: 833333: 72 4 per minute 
+       
+$} % track0
+
+track1 = music { $
+       g16 c16 e16 g16 c16 e16 g16 c16 e16 g16 c16 
+       e16 a16 d16 f16 a16 d16 f16 a16 d16 f16 a16 
+       d16 f16 g16 d16 f16 g16 d16 f16 g16 d16 f16 
+       g16 d16 f16 g16 c16 e16 g16 c16 e16 g16 c16 
+       e16 g16 c16 e16 a16 e16 a16 a16 e16 a16 a16 
+       e16 a16 a16 e16 a16 fis16 a16 d16 fis16 a16 
+       d16 fis16 a16 d16 fis16 a16 d16 g16 d16 g16 
+       g16 d16 g16 g16 d16 g16 g16 d16 g16 e16 g16 
+       c16 e16 g16 c16 e16 g16 c16 e16 g16 c16 e16 
+       g16 c16 e16 g16 c16 e16 g16 c16 e16 g16 c16 
+       d16 fis16 c16 d16 fis16 c16 d16 fis16 c16 
+       d16 fis16 c16 d16 g16 b16 d16 g16 b16 d16 g16 
+       b16 d16 g16 b16 e16 g16 cis16 e16 g16 cis16 
+       e16 g16 cis16 e16 g16 cis16 d16 a16 d16 d16 
+       a16 d16 d16 a16 d16 d16 a16 d16 d16 f16 b16 
+       d16 f16 b16 d16 f16 b16 d16 f16 b16 c16 g16 
+       c16 c16 g16 c16 c16 g16 c16 c16 g16 c16 a16 
+       c16 f16 a16 c16 f16 a16 c16 f16 a16 c16 f16 
+       a16 c16 f16 a16 c16 f16 a16 c16 f16 a16 c16 
+       f16 g16 b16 f16 g16 b16 f16 g16 b16 f16 g16 
+       b16 f16 g16 c16 e16 g16 c16 e16 g16 c16 e16 
+       g16 c16 e16 ais16 c16 e16 ais16 c16 e16 ais16 
+       c16 e16 ais16 c16 e16 a16 c16 e16 a16 c16 e16 
+       a16 c16 e16 a16 c16 e16 a16 c16 dis16 a16 c16 
+       dis16 a16 c16 dis16 a16 c16 dis16 b16 c16 
+       d16 b16 c16 d16 b16 c16 d16 b16 c16 d16 g16 
+       b16 d16 g16 b16 d16 g16 b16 d16 g16 b16 d16 
+       g16 c16 e16 g16 c16 e16 g16 c16 e16 g16 c16 
+       e16 g16 c16 f16 g16 c16 f16 g16 c16 f16 g16 
+       c16 f16 g16 b16 f16 g16 b16 f16 g16 b16 f16 
+       g16 b16 f16 a16 c16 fis16 a16 c16 fis16 a16 
+       c16 fis16 a16 c16 fis16 g16 c16 g16 g16 c16 
+       g16 g16 c16 g16 g16 c16 g16 g16 c16 f16 g16 
+       c16 f16 g16 c16 f16 g16 c16 f16 g16 b16 f16 
+       g16 b16 f16 g16 b16 f16 g16 b16 f16 g16 ais16 
+       e16 g16 ais16 e16 g16 ais16 e16 g16 ais16 
+       e16 f16 a16 c16 f16 c16 a16 c16 a16 f16 a16 
+       f16 d16 f16 d16 g16 b16 d16 f16 d16 b16 d16 
+       b16 g16 b16 d16 f16 e64 f64 e32 d16 c1 
+$} % track1
+
+track2 = music { $
+       c2 e4. c2 e4. c2 d4. c2 d4. b2 d4. b2 d4. c2 e4. 
+       c2 e4. c2 e4. c2 e4. c2 d4. c2 d4. b2 d4. b2 d4. 
+       b2 c4. b2 c4. a2 c4. a2 c4. d2 a4. d2 a4. g2 b4. 
+       g2 b4. g2 ais4. g2 ais4. f2 a4. f2 a4. f2 gis4. 
+       f2 gis4. e2 g4. e2 g4. e2 f4. e2 f4. d2 f4. d2 
+       f4. g2 d4. g2 d4. c2 e4. c2 e4. c2 g4. c2 g4. 
+       f2 f4. f2 f4. fis2 c2 fis2 c4. gis2 f4. gis2 
+       f4. g2 f4. g2 f4. g2 e2 g2 e4. g2 d4. g2 d2 g2 
+       d4. g2 d4. g2 dis4. g2 dis4. g2 e4. g2 e4. g2 
+       d4. g2 d4. g2 d4. g2 d4. c2 c4. c2 c4. c1 c1 b1 
+       c1 c1 
+$} % track2
+
+score {
+       staff { melodic music { track0 } }
+       staff { melodic music { track1 } }
+       staff { melodic music { track2 } }
+       commands { meter { 4*4 } }
+       midi { tempo 4:60 }
+}
index 41abb47413138c3815fffcb1ecbb781d83913b1c..650cf456a3b2b1c39e43c534faf2b35b638acb0d 100644 (file)
@@ -487,6 +487,6 @@ score {
                output "standchen.out"
        }
        midi {
-               tempo 4:80
+               tempo 4:60
        }
 }
index 1b0fa2baa3c53f610eb5983aae11e20f0ffa8b48..f554d424bcbfee973ed9f3d15e6d5d40fdca9679 100644 (file)
@@ -28,7 +28,7 @@ struct Stem_info {
 
 Stem_info::Stem_info(const Stem*s)
 {
-    x = s->hpos();
+    x = s->hindex();
     int dir = s->dir;
     idealy  = max(dir*s->top, dir*s->bot);
     miny = max(dir*s->minnote, dir*s-> maxnote);
@@ -119,9 +119,9 @@ void
 Beam::set_stemlens()
 {
     iter_top(stems,s);
-    Real x0 = s->hpos();    
+    Real x0 = s->hindex();    
     for (; s.ok() ; s++) {
-       Real x =  s->hpos()-x0;
+       Real x =  s->hindex()-x0;
        s->set_stemend(left_pos + slope * x);   
     }
 }
@@ -192,8 +192,8 @@ Interval
 Beam::width() const
 {
     Beam * me = (Beam*) this;  // ugh
-    return Interval( (*me->stems.top()) ->hpos(),
-                    (*me->stems.bottom()) ->hpos() );
+    return Interval( (*me->stems.top()) ->hindex(),
+                    (*me->stems.bottom()) ->hindex() );
 }
 
 /*
@@ -202,8 +202,8 @@ Beam::width() const
 Molecule
 Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
 {
-    assert( !next || next->hpos() > here->hpos()  );
-    assert( !prev || prev->hpos() < here->hpos()  );
+    assert( !next || next->hindex() > here->hindex()  );
+    assert( !prev || prev->hindex() < here->hindex()  );
     Real dy=paper()->internote()*2;
     Real stemdx = paper()->rule_thickness();
     Real sl = slope*paper()->internote();
@@ -216,7 +216,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
     if (prev) {
        int lhalfs= lhalfs = here->beams_left - prev->beams_right ;
        int lwholebeams= here->beams_left <? prev->beams_right ;
-       Real w = (here->hpos() - prev->hpos())/4;
+       Real w = (here->hindex() - prev->hindex())/4;
        Symbol dummy;
        Atom a(dummy);
        if (lhalfs)             // generates warnings if not
@@ -233,7 +233,7 @@ Beam::stem_beams(Stem *here, Stem *next, Stem *prev)const
        int rhalfs = here->beams_right - next->beams_left;
        int rwholebeams = here->beams_right <? next->beams_left; 
 
-       Real w = next->hpos() - here->hpos();
+       Real w = next->hindex() - here->hindex();
        Atom a = paper()->lookup_p_->beam(sl, w + stemdx);
        
        int j = 0;
@@ -264,7 +264,7 @@ Beam::brew_molecule_p() const return out;
 {
     Real inter=paper()->internote();
     out = new Molecule;
-    Real x0 = stems.top()->hpos();
+    Real x0 = stems.top()->hindex();
     
     for (iter_top(stems,i); i.ok(); i++) {
        PCursor<Stem*> p(i-1);
@@ -273,7 +273,7 @@ Beam::brew_molecule_p() const return out;
        Stem * next = n.ok() ? n.ptr() : 0;
 
        Molecule sb = stem_beams(i, next, prev);
-       Real  x = i->hpos()-x0;
+       Real  x = i->hindex()-x0;
        sb.translate(Offset(x, (x * slope  + left_pos)* inter));
        out->add(sb);
     }
index 8335a13a5eed895b66e4a08bcb0c713bfc941efa..8545f221e9f260c80675df0cea252eafe93ffa4f 100644 (file)
@@ -32,13 +32,13 @@ Binary_source_file::error_str( char const* pos_ch_c_l )
     char const* end_ch_c_l = pos_ch_c_l + 7 <? ch_c_l() + length_off();
 
     String pre_str( (Byte const*)begin_ch_c_l, pos_ch_c_l - begin_ch_c_l );
-    pre_str = StringConversion::bin2hex_str( pre_str );
+    pre_str = String_convert::bin2hex_str( pre_str );
     for ( int i = 2; i < pre_str.length_i(); i += 3 )
-       pre_str = pre_str.left( i ) + " " + pre_str.mid( i + 1, INT_MAX );
+       pre_str = pre_str.left_str( i ) + " " + pre_str.mid_str( i + 1, INT_MAX );
     String post_str( (Byte const*)pos_ch_c_l, end_ch_c_l - pos_ch_c_l );
-    post_str = StringConversion::bin2hex_str( post_str );
+    post_str = String_convert::bin2hex_str( post_str );
     for ( int i = 2; i < post_str.length_i(); i += 3 )
-       post_str = post_str.left( i ) + " " + post_str.mid( i + 1, INT_MAX );
+       post_str = post_str.left_str( i ) + " " + post_str.mid_str( i + 1, INT_MAX );
 
     String str = pre_str
        + String( '\n' )
index 93077bd87b5b92e81ee4d05fd4739683ff2b5fa0..9489ae9a1eef6d7f1e66275776037c1badf93d24 100644 (file)
@@ -6,13 +6,13 @@
 Real
 parse_dimen(String dim)
 {
-    int i=dim.len()-1;
+    int i=dim.length_i()-1;
     const char *s = dim;
     while  (i > 0 && (isspace(s[i]) || isalpha(s[i])) ){
        i--;
     }
     String unit(s + i+1);
-    return convert_dimen(dim.fvalue(), unit); 
+    return convert_dimen(dim.value_f(), unit); 
 }
 
 
index 2245c8dbe0136426257bf3f5419fbc6b2a57ea69..9e1a49683456786d793dbddb807d0655edd01715 100644 (file)
@@ -29,7 +29,7 @@ Input_file::Input_file(String s)
        else {
                Source_file* sourcefile_p = 0;
                // ugh, very dirty, need to go away
-               if ( ( pf.right( 3 ).lower() == "mid" ) || ( pf.right( 4 ).lower() == "midi" ) )
+               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 );
index 1e4e8488a558801ec27db128310198d0821c332c..6f72f7f2cce95883290829bebe82af920a6e89e3 100644 (file)
@@ -106,7 +106,7 @@ COMMENT             [%#].*\n
        return DOTS;
 }
 <notes>{INT}           {
-       yylval.i = String(YYText()).value();
+       yylval.i = String_convert::dec2_i( String( YYText() ) );
        return INT;
 }
 <notes>{COMMENT}       {
@@ -119,7 +119,7 @@ COMMENT             [%#].*\n
 }
 <notes>\"[^"]*\" {
        String s (YYText()+1);
-       s = s.left(s.len()-1);
+       s = s.left_str(s.length_i()-1);
        yylval.string = new String(s);
        return STRING;
 }
@@ -144,7 +144,7 @@ COMMENT             [%#].*\n
        return DOTS;
 }
 <lyrics>{INT}          {
-       yylval.i = String(YYText()).value();
+       yylval.i = String_convert::dec2_i( String( YYText() ) );
        return INT;
 }
 <lyrics>{NOTECOMMAND}  {
@@ -172,19 +172,19 @@ COMMENT           [%#].*\n
 }
 <lyrics>\"[^"]*\" {
        String s (YYText()+1);
-       s = s.left(s.len()-1);
+       s = s.left_str(s.length_i()-1);
        yylval.string = new String(s);
        return STRING;
 }
 <lyrics>{LYRICS} {
        String s (YYText()); 
        int i = 0;
-       while ((i=s.pos("_")) != 0) // change word binding "_" to " "
-               *(s.ch_l() + i - 1) = ' ';
-       if ((i=s.pos("\\,")) !=0)   // change "\," to TeX's "\c "
+       while ((i=s.index_i("_")) != -1) // change word binding "_" to " "
+               *(s.ch_l() + i) = ' ';
+       if ((i=s.index_i("\\,")) != -1)   // change "\," to TeX's "\c "
                {
-               *(s.ch_l() + i) = 'c';
-               s = s.left(i+1) + " " + s.right(s.len()-i-1);
+               *(s.ch_l() + i + 1) = 'c';
+               s = s.left_str(i+2) + " " + s.right_str(s.length_i()-i-2);
                }
        yylval.string = new String(s);
        return STRING;
@@ -221,8 +221,8 @@ include           {
 <incl>[ \t]*      { /* eat the whitespace */ }
 <incl>\"[^"]*\"+   { /* got the include file name */
    String s (YYText()+1);
-   s = s.left(s.len()-1);
-   defined_ch_c_l = here_ch_c_l() - String( YYText() ).len() - 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();
 }
index 30f49e5bf4b71bc17a8afe13841a3bf4cc5a744f..b35c86676158e8617b4c63c18636e5709c85348d 100644 (file)
@@ -23,6 +23,6 @@ Lyric_item::do_pre_processing()
     // override Text_item
 
     // test context-error
-    if ( tdef_l_->text_str_.pos( "Gates" ) )// :-)
+    if ( tdef_l_->text_str_.index_i( "Gates" ) )// :-)
        warning( "foul word", tdef_l_->defined_ch_c_l_ );
 }
index 55a5129055fece4b9cdfcd598ce1a47f1e0f0496..450545ab253dda4d13f201faf307b746e6acbebc 100644 (file)
@@ -18,7 +18,7 @@ extern void parse_file(String,String);
 
 
 void
-destill_inname( String &inName);
+destill_inname( String &name_str_r);
 long_option_init theopts[] = {
     1, "output", 'o',
     0, "warranty", 'w',
@@ -147,20 +147,20 @@ find_file(String f)
 
 /// make input file name: add default extension. "" is stdin.
 void
-destill_inname( String &inName)
+destill_inname( String &name_str_r)
 {
-    if ( inName.len() )
+    if ( name_str_r.length_i() )
         {
-        if( inName[ 0 ] != '-' ) 
+        if( name_str_r[ 0 ] != '-' ) 
            {
            String a,b,c,d;
-           split_path(inName,a,b,c,d);
+           split_path(name_str_r,a,b,c,d);
 
            // add extension if not present.
            if (d == "") 
                d = ".ly";
-           inName = a+b+c+d;
+           name_str_r = a+b+c+d;
            }
-       } else inName = "";   
+       } else name_str_r = "";   
 }
 
index 850379271c376b5575370154384d70d44b57e80c..e62a888a8351aacbff0cd9c874d40ccea5bf161b 100644 (file)
@@ -4,16 +4,17 @@
 // copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
 
 #include <assert.h>
-#include "proto.hh"
 
+#include "proto.hh"
 #include "plist.hh"      // all for midi-main.hh
 #include "string.hh"
 #include "source.hh"
 #include "sourcefile.hh"
 #include "midi-main.hh"  // *tors
-
 #include "moment.hh"
+#include "duration.hh"
 #include "midi-event.hh"
+#include "lily-stream.hh"
 
 Midi_event::Midi_event()
 {
@@ -23,12 +24,24 @@ Midi_event::~Midi_event()
 {
 }
 
+Moment
+Midi_event::mom()
+{
+       return Moment( 0 );
+}
+
 String
 Midi_event::mudela_str()
 {
        return mudela_str_;
 }
 
+void
+Midi_event::output_mudela( Lily_stream& lily_stream_r )
+{
+       lily_stream_r << mudela_str_ << String( " " );
+}
+
 Midi_key::Midi_key( int accidentals_i, int minor_i )
 {
        accidentals_i_ = accidentals_i;
@@ -37,7 +50,7 @@ Midi_key::Midi_key( int accidentals_i, int minor_i )
                key_i_ = ( ( accidentals_i % 7 )[ "cgdaebf" ] - 'a' + 2 ) % 7;
        else
                key_i_ = ( ( -accidentals_i % 7 )[ "fbeadg" ] - 'a' + 2 ) % 7;
-       mudela_str_ = String( "\\key\\" );
+       mudela_str_ = String( "\\key\\" );
        if ( !minor_i_ ) 
                mudela_str_ += String( (char)( key_i_ - 2 + 'A'  ) );
        else
@@ -72,28 +85,53 @@ Midi_key::notename_str( int pitch_i )
                else
                        notename_str += "es";
        accidental_i--;
-       return notename_str;
+       String octave_str;
+
+       octave_str += String( '\'', ( pitch_i - Midi_note::c0_pitch_i_c_ ) / 12 );
+       octave_str += String( '`', ( Midi_note::c0_pitch_i_c_ - pitch_i ) / 12 );
+       return octave_str + notename_str;
 }
 
 Midi_key::~Midi_key()
 {
 }
 
-Midi_note::Midi_note( Midi_key* midi_key_l, Midi_time* midi_time_l, int clocks_per_whole_i, int pitch_i, Real delta_time_f )
+Midi_note::Midi_note( Midi_key* midi_key_l, Midi_time* midi_time_l, int division_1_i, int pitch_i, int time_i )
 {
-       mudela_str_ = midi_key_l->notename_str( pitch_i );
-       mudela_str_ += midi_time_l->duration_str( clocks_per_whole_i, delta_time_f );
+       dur_ = midi_time_l->i2_dur( time_i, division_1_i );
+
+       if ( dur_.plet_p_ )
+               mudela_str_ += String( "\\plet{ " )
+                       + String_convert::i2dec_str( dur_.plet_p_->iso_i_, 0, 0 )
+                       + "/"
+                       + String_convert::i2dec_str( dur_.plet_p_->type_i_, 0, 0 )
+                       + " } ";
+
+       mudela_str_ += midi_key_l->notename_str( pitch_i );
+
+       Duration dur = dur_;
+       dur.set_plet( 0 );
+       mudela_str_ += Duration_convert::dur2_str( dur );
+
+       if ( dur_.plet_p_ )
+               mudela_str_ += String( " \\plet{ 1/1 }" );
 }
 
 Midi_note::~Midi_note()
 {
 }
 
+Moment
+Midi_note::mom()
+{
+       return Duration_convert::dur2_mom( dur_ );
+}
+
 Midi_tempo::Midi_tempo( int useconds_per_4_i )
 {
        useconds_per_4_i_ = useconds_per_4_i;
        seconds_per_1_f_ = (Real)useconds_per_4_i_ * 4 / 1e6;
-       mudela_str_ = "\\Tempo: ";
+       mudela_str_ = "\\Tempo: ";
        mudela_str_ += String( useconds_per_4_i_ );
        mudela_str_ += String( ": " ) 
                + String( get_tempo_i( Moment( 1, 4 ) ) )
@@ -110,21 +148,18 @@ Midi_tempo::get_tempo_i( Moment moment )
        return Moment( 60 ) / moment / Moment( seconds_per_1_f_ );
 }
 
-Midi_time::Midi_time( int num_i, int den_i, int clocks_i, int count_32_i )
+Midi_time::Midi_time( int num_i, int den_i, int clocks_4_i, int count_32_i )
+       : sync_dur_( 8 )
 {
-//     we should warn, at least!
-//     assert( count_32_i == 8 );
+       sync_f_ = 1.0;
        if ( count_32_i != 8 )
                warning( String( "#32 in quarter: " ) + String( count_32_i ), 0 );
        num_i_ = num_i;
        den_i_ = 2 << den_i;
-       // huh?, see midiitem.cc; reasonably for fugue1.midi
-//     whole_clocks_i_ = clocks_i * 4 * 10; 
-       whole_clocks_i_ = clocks_i * 4; 
-//     whole_clocks_i_ = clocks_i; 
-       mudela_str_ = "\\Time: ";
+       clocks_1_i_ = clocks_4_i * 4; 
+       mudela_str_ = "% \\Time: ";
        mudela_str_ += String( num_i_ ) + "/" + String( den_i_ )
-               + ", " + String( whole_clocks_i_ )
+               + ", " + String( clocks_1_i_ )
                + ": " + String( count_32_i );
 }
 
@@ -132,101 +167,32 @@ Midi_time::~Midi_time()
 {
 }
 
-String
-Midi_time::duration_str( int clocks_per_whole_i, Real delta_time_f )
-{
-       dtor << "(" << delta_time_f;
-       String str;
-
-       Moment delta_time_moment = 1.0;
-       if ( delta_time_f ) {
-               // 288/96*.25 = .75
-               // 96/96*.25 = .25
-               // 24/96*.25 = 0.0625
-//             delta_time_moment = Moment( delta_time_f ) / Moment( whole_clocks_i() );
-               if ( clocks_per_whole_i > 0 )
-                       delta_time_moment = Moment( delta_time_f ) / Moment( clocks_per_whole_i );
-               else 
-                       delta_time_moment = Moment( -clocks_per_whole_i ) / Moment( delta_time_f );
-       }               
-
-       dtor << ", " << (Real)delta_time_moment << "): ";
-
-       static Real sync_f = 1;
-       delta_time_moment = delta_time_moment / sync_f;
-
-       double dummy_f;
-       if ( ( sync_f == 1 ) 
-               && ( abs( modf( (Real)delta_time_moment / ( (Real)1 / 64 / 3 ), &dummy_f ) ) ) > 1e-6 ) {
-               sync_f = (Real)delta_time_moment / 0.125;
-               delta_time_moment = (Real)delta_time_moment / sync_f;
-               mtor << "\nsyncing: " << sync_f << ", "
-//                     << (Real)sync_f / usecond24th_per_clock_i << endl;
-                       << (Real)whole_clocks_i() << endl;
-       }
-
-       static bool must_resync_bo = false;
-       if ( ( (Real)delta_time_moment / 0.125 > 16 )
-               || ( (Real)delta_time_moment / 0.125 < ( (Real)1 / 16 ) ) ) 
-               must_resync_bo = true;
-       
-       if ( must_resync_bo ) {
-               must_resync_bo = false;
-               delta_time_moment = delta_time_moment * sync_f;
-               sync_f = (Real)delta_time_moment / 0.125;
-               delta_time_moment = (Real)delta_time_moment / sync_f;
-               mtor << "\nresyncing: " << sync_f << ", "
-//                     << (Real)sync_f / usecond24th_per_clock_i << endl;
-                       << (Real)whole_clocks_i() << endl;
-       }
-
-       if ( !delta_time_moment ) 
-               return "0";
-
-       // output of modf: double 
-       double duration_f = 0;
-       Real rest_f = modf( ( Moment( 1 ) / delta_time_moment ), &duration_f );
-       int dots_i = 0;
-       int plet_type_i = 0;
-       if ( rest_f ) {
-               // output of modf: double 
-               double dots_f = 0;
-               Real dots_rest_f = modf( rest_f * 3, &dots_f );
-               if ( !dots_rest_f )
-                       dots_i = (int)rint( dots_f );
-               else if ( abs( dots_rest_f - rint( dots_rest_f ) ) < 1e-8 )
-                       dots_i = (int)rint( dots_rest_f );
-               // try 3plet
-               else if ( !modf( (Real)3 * delta_time_moment / 2, &duration_f ) )
-                       plet_type_i = 3;
-               // try 6plet
-               else if ( !modf( (Real)6 * delta_time_moment / 2, &duration_f ) )
-                       plet_type_i = 6;
-               else {
-//                     str += String( "\n*" ) + String( (int)( 1 / rest_f ) );
-                       str += String( "\n*" ) + String( rest_f );
-                       must_resync_bo = true;
-               }
-       }
-
-       if ( dots_i ) {
-               for ( int i = dots_i; i ; i-- )
-                       delta_time_moment *= (Real)2 / 3;
-               modf( ( Moment( 1 ) / delta_time_moment ), &duration_f );
+Duration
+Midi_time::i2_dur( int time_i, int division_1_i )
+{
+       Moment mom = Duration_convert::i2_mom( time_i, division_1_i );
+       mom /= sync_f_;
+
+       dtor << "\n% (" << time_i << ", " << mom << "): "
+               << sync_f_ << endl;
+
+       Duration dur = Duration_convert::mom2_dur( mom );
+       if ( !dur.type_i_ ) {
+               vtor << "\n% resyncing(" << time_i << ", " << mom << "): "
+                       << sync_f_ << " -> ";
+               mom *= sync_f_;
+               sync_f_ = Duration_convert::sync_f( sync_dur_, mom );
+               vtor << sync_f_ << endl;
+               mom /= sync_f_;
+               dur = Duration_convert::mom2_dur( mom );
        }
 
-       str += String( (int)( duration_f ) );
-       if ( dots_i )
-               str += String( '.', dots_i );
-       if ( plet_type_i )
-               str += String( "/" ) + String( plet_type_i );
-
-       return str;
+       return dur;
 }
 
 int
-Midi_time::whole_clocks_i()
+Midi_time::clocks_1_i()
 {
-       return whole_clocks_i_;
+       return clocks_1_i_;
 }
 
index dfbafd5fbf6eb688de5a0770a13953404a59183c..49f74ead0e613500845a0870495381cb11a45d03 100644 (file)
@@ -89,14 +89,14 @@ SSME                [\0x7f][\x03]
 }
 {INT8} {
        error( String( "top level: illegal byte: " )
-               + StringConversion::bin2hex_str( String( *YYText() ) ) );
+               + String_convert::bin2hex_str( String( *YYText() ) ) );
        exit( 1 );
 }
 <int32>{INT32} {
        dtor << "lex: int32" << endl;
        assert( YYLeng() == 4 );
        String str( (Byte const*)YYText(), YYLeng() );
-       yylval.i = StringConversion::bin2int_i( str );
+       yylval.i = String_convert::bin2_i( str );
        yy_pop_state();
        return INT32;
 }
@@ -104,7 +104,7 @@ SSME                [\0x7f][\x03]
        dtor << "lex: int16" << endl;
        assert( YYLeng() == 2 );
        String str( (Byte const*)YYText(), YYLeng() );
-       yylval.i = StringConversion::bin2int_i( str );
+       yylval.i = String_convert::bin2_i( str );
        yy_pop_state();
        return INT16;
 }
@@ -119,16 +119,16 @@ SSME              [\0x7f][\x03]
 
 <track>{VARINT} {
        String str( (Byte const*)YYText(), YYLeng() );
-       yylval.i = My_midi_lexer::varint2int_i( str );
+       yylval.i = My_midi_lexer::varint2_i( str );
        dtor << String( "lex: track: varint(" ) 
                + String( yylval.i ) + "): "
-               + StringConversion::bin2hex_str( str ) << endl;
+               + String_convert::bin2hex_str( str ) << endl;
        yy_push_state( event ); 
        return VARINT;
 }
 <track>{INT8}  {
        error( String( "track: illegal byte: " ) 
-               + StringConversion::bin2hex_str( String( *YYText() ) ) );
+               + String_convert::bin2hex_str( String( *YYText() ) ) );
        exit( 1 );
 }
 <event>{RUNNING_STATUS}        {
@@ -240,7 +240,7 @@ SSME                [\0x7f][\x03]
 }
 <event>{INT8}  {
        error( String( "event: illegal byte: " ) 
-               + StringConversion::bin2hex_str( String( *YYText() ) ) );
+               + String_convert::bin2hex_str( String( *YYText() ) ) );
        exit( 1 );
 }
 <meta_event>{SEQUENCE} {       // ssss sequence number
@@ -353,7 +353,7 @@ SSME                [\0x7f][\x03]
 }
 <meta_event>{INT8} {
        warning( String( "meta_event: unimplemented event: " )
-               + StringConversion::bin2hex_str( String( *YYText() ) ),
+               + String_convert::bin2hex_str( String( *YYText() ) ),
                *this->here_ch_c_l() );
        yy_pop_state();
        yy_pop_state();
@@ -365,7 +365,7 @@ SSME                [\0x7f][\x03]
 <data>{VARINT} {
        dtor << "lex: data" << endl;
        String str( (Byte const*)YYText(), YYLeng() );
-       int i = My_midi_lexer::varint2int_i( str );
+       int i = My_midi_lexer::varint2_i( str );
        String* str_p = new String;
        while ( i-- )
                *str_p += (char)yyinput();
@@ -375,7 +375,7 @@ SSME                [\0x7f][\x03]
 }
 <data>{INT8}   {
        error( String( "data: illegal byte: " )
-               + StringConversion::bin2hex_str( String( *YYText() ) ) );
+               + String_convert::bin2hex_str( String( *YYText() ) ) );
        exit( 1 );
 }
 
index 5b6ecb3e2d73c4d68ea8fe599286d2b68e3eecd6..5dfdf64662bf89b11c4a23ebca8d8b1881ecee09 100644 (file)
@@ -5,6 +5,7 @@
 // copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
 
 #include <iostream.h>
+#include <limits.h>
 #include "proto.hh"
 #include "plist.hh"
 #include "version.hh"
@@ -15,6 +16,7 @@
 #include "sourcefile.hh"
 #include "midi-main.hh"
 #include "moment.hh"
+#include "duration.hh"
 #include "midi-event.hh"
 #include "midi-track.hh"
 #include "my-midi-lexer.hh"
@@ -25,6 +27,9 @@ Source* source_l_g = &source;
 
 Verbose level_ver = NORMAL_ver;
 
+// ugh
+bool no_triplets_bo_g = false;
+
 //ugh
 char const* defined_ch_c_l = 0;
 
@@ -76,9 +81,10 @@ help()
 {
     btor <<
        "--debug, -d            be really verbose\n"
-       "--help, -h             This help\n"
-        "--include, -I         add to file search path.\n"
-       "--output, -o           set default output\n"
+       "--help, -h             this help\n"
+        "--include=DIR, -I DIR add DIR to search path\n"
+        "--no-triplets, -n     assume no triplets\n"
+       "--output=FILE, -o FILE set FILE as default output\n"
        "--quiet, -q            be quiet\n"
        "--verbose, -v          be verbose\n"
        "--warranty, -w         show warranty & copyright\n"
@@ -88,8 +94,7 @@ help()
 void
 identify()
 {
-       mtor << "This is m2m "  << VERSIONSTR << "/FlowerLib " << FVERSIONSTR
-               << " of " << __DATE__ << " " << __TIME__ << endl;
+       mtor << version_str() << endl;
 }
     
 void 
@@ -119,6 +124,15 @@ notice()
        "USA.\n";
 }
 
+// should simply have Root class...
+String
+version_str()
+{
+       return String ( "This is m2m " ) + VERSIONSTR 
+               + "/FlowerLib " + FVERSIONSTR
+               + " of " +  __DATE__ + " " + __TIME__;
+}
+
 int
 main( int argc_i, char* argv_sz_a[] )
 {
@@ -126,6 +140,7 @@ main( int argc_i, char* argv_sz_a[] )
                0, "debug", 'd',
                0, "help", 'h',
 //             1, "include", 'I',
+               0, "no-triplets", 'n',
                1, "output", 'o',
                0, "quiet", 'q',
                0, "verbose", 'v',
@@ -148,6 +163,9 @@ main( int argc_i, char* argv_sz_a[] )
 //                     case 'I':
 //                             path->push( getopt_long.optarg );
 //                             break;
+                       case 'n':
+                               no_triplets_bo_g = true;
+                               break;
                        case 'o':
                                output_str = getopt_long.optarg;
                                break;
@@ -172,7 +190,14 @@ main( int argc_i, char* argv_sz_a[] )
                int error_i = midi_parser.parse();
                if ( error_i )
                        return error_i;
-               error_i = midi_parser.output( output_str );
+               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 );
+               }
+               error_i = midi_parser.output_mudela( output_str );
                if ( error_i )
                        return error_i;
        }
index 56680f4b773771ded5de455f35f97e4beab3d1cd..466b5c58d53abb7fe68d521031dffc759b162c1a 100644 (file)
@@ -12,6 +12,7 @@
 #include "my-midi-lexer.hh"
 #include "my-midi-parser.hh"
 #include "moment.hh"
+#include "duration.hh"
 #include "midi-event.hh"
 #include "midi-track.hh"
 #include "midi-score.hh"
@@ -20,6 +21,9 @@
 #define YYDEBUG 1
 #endif
 
+//ugh
+static track_i = 0;
+
 %}
 
 %union {
@@ -61,6 +65,7 @@
 midi:  /* empty */
        | midi midi_score {
                midi_parser_l_g->add_score( $2 );               
+               track_i = 0;
        }
        ;
 
@@ -69,34 +74,31 @@ midi_score:
        }
        | midi_score track {
                $$->add_track( $2 );
+               midi_parser_l_g->reset();
        }
        ;
 
 header:        
        HEADER INT32 INT16 INT16 INT16 {
                $$ = new Midi_score( $3, $4, $5 );
-               midi_parser_l_g->set_division( $5 );
+               midi_parser_l_g->set_division_4( $5 );
        }
        ;
 
 track: 
        TRACK INT32 {
-               $$ = new Midi_track;
+               $$ = new Midi_track( track_i++ );
        }
        | track event {
-               $$->add_event( $2 );
+               $$->add_event( midi_parser_l_g->mom(), $2 );
        }
        ;
 
 event: 
        varint the_event {
-               if ( $2 && $2->mudela_str().length_i() ) {
-                       if ( ( $2->mudela_str()[ 0 ] >= 'a' ) 
-                               && $2->mudela_str()[ 0 ] <= 'g' ) 
-                               qtor << $2->mudela_str() << " ";
-                       else
-                               vtor << $2->mudela_str() << " ";
-               }
+               $$ = $2;
+               if ( $2 && $2->mudela_str().length_i() )
+                       dtor << $2->mudela_str() << " " << flush;
        }
        ;
        
@@ -130,7 +132,7 @@ the_meta_event:
        }
        | text_event DATA {
                $$ = 0;
-               vtor << *$2 << endl;
+               dtor << *$2 << endl;
                delete $2;
        }
        | END_OF_TRACK {
@@ -138,7 +140,7 @@ the_meta_event:
        }
        | TEMPO INT8 INT8 INT8 { 
                $$ = new Midi_tempo( ( $2 << 16 ) + ( $3 << 8 ) + $4 );
-               vtor << $$->mudela_str() << endl; // ?? waai not at event:
+               dtor << $$->mudela_str() << endl; // ?? waai not at event:
                midi_parser_l_g->set_tempo( ( $2 << 16 ) + ( $3 << 8 ) + $4 );
        }
        | SMPTE_OFFSET INT8 INT8 INT8 INT8 INT8 { 
@@ -146,7 +148,7 @@ the_meta_event:
        }
        | TIME INT8 INT8 INT8 INT8 { 
                $$ = new Midi_time( $2, $3, $4, $5 );
-               vtor << $$->mudela_str() << endl; // ?? waai not at event:
+               dtor << $$->mudela_str() << endl; // ?? waai not at event:
                midi_parser_l_g->set_time( $2, $3, $4, $5 );
        }
        | KEY INT8 INT8 { 
@@ -161,25 +163,25 @@ the_meta_event:
 
 text_event: 
        TEXT {
-               vtor << endl << "Text: ";
+               dtor << "\n% Text: ";
        }
        | COPYRIGHT {
-               vtor << endl << "Copyright: ";
+               dtor << "\n% Copyright: ";
        }
        | TRACK_NAME {
-               vtor << endl << "Track  name: ";
+               dtor << "\n% Track  name: ";
        }
        | INSTRUMENT_NAME {
-               vtor << endl << "Instrument  name: ";
+               dtor << "\n% Instrument  name: ";
        }
        | LYRIC {
-               vtor << endl << "Lyric: ";
+               dtor << "\n% Lyric: ";
        }
        | MARKER {
-               vtor << endl << "Marker: ";
+               dtor << "\n% Marker: ";
        }
        | CUE_POINT {
-               vtor << endl << "Cue point: ";
+               dtor << "\n% Cue point: ";
        }
        ;
 
index 02a79a542d022861b52e65cc71729672d945081d..f24f9093d1178d43125eda84c589e7d04fdecddf 100644 (file)
@@ -4,6 +4,16 @@
 // copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
 
 #include "proto.hh"
+#include "plist.hh"
+#include "string.hh"
+#include "moment.hh"
+#include "duration.hh"
+#include "sourcefile.hh"
+#include "source.hh"
+#include "midi-main.hh"    // *tors
+#include "midi-event.hh"
+#include "lily-stream.hh"
+#include "track-column.hh"
 #include "midi-track.hh"
 #include "midi-score.hh"
 
@@ -21,4 +31,33 @@ Midi_score::~Midi_score()
 void
 Midi_score::add_track( Midi_track* midi_track_p )
 {
+       midi_track_p_list_.bottom().add( midi_track_p );
 }
+
+int
+Midi_score::output_mudela( String filename_str )
+{
+       mtor << "Lily output to " << filename_str << " ..." << endl;
+
+       Lily_stream lily_stream( filename_str );
+       for ( PCursor<Midi_track*> midi_track_l_pcur( midi_track_p_list_.top() ); midi_track_l_pcur.ok(); midi_track_l_pcur++ ) {
+               midi_track_l_pcur->output_mudela( lily_stream );
+               lily_stream << "\n";
+       }
+
+       lily_stream << "score {\n";
+
+       for ( PCursor<Midi_track*> midi_track_l_pcur( midi_track_p_list_.top() ); midi_track_l_pcur.ok(); midi_track_l_pcur++ ) {
+               lily_stream << "\tstaff { melodic music { ";
+               lily_stream << midi_track_l_pcur->name_str();
+               lily_stream << " } }\n";
+       }
+
+       lily_stream << "\tcommands { meter { 4*4 } }\n";
+       lily_stream << "\tmidi { tempo 4:60 }\n";
+
+       lily_stream << "}\n";
+
+       return 0;
+}
+
index 02315c320b21f49a782b90723a4ab20fcc4f1844..c4caa838b4d28bf2fdf7f1af29bfa5411145a7bd 100644 (file)
@@ -16,4 +16,14 @@ class ostream;
 #include "string.hh"
 #include "sourcefile.hh"
 
+#include "moment.hh"
+#include "duration.hh"
+#include "midi-event.hh"
+#include "lily-stream.hh"
+#include "track-column.hh"
+#include "midi-track.hh"
+
+IPL_instantiate(Midi_event);
+IPL_instantiate(Midi_track);
 IPL_instantiate(Source_file);
+IPL_instantiate(Track_column);
index 77abf04e1c8f76e3e779da579dd091da9bf9e98d..99bd9dee8c1d80f327e3ed2bafaef313c09b6b78 100644 (file)
@@ -4,13 +4,23 @@
 // copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
 
 #include "proto.hh"
+#include "plist.hh"
 #include "string.hh"
+#include "sourcefile.hh"
+#include "source.hh"
+#include "midi-main.hh"    // *tors
+
 #include "moment.hh"
+#include "duration.hh"
 #include "midi-event.hh"
+#include "lily-stream.hh"
+#include "track-column.hh"
 #include "midi-track.hh"
 
-Midi_track::Midi_track()
+Midi_track::Midi_track( int track_i )
 {
+       name_str_ = String( "track" ) + String( track_i );
+       tcol_p_list_.bottom().add( new Track_column( Moment( 0 ) ) );
 }
 
 Midi_track::~Midi_track()
@@ -18,6 +28,57 @@ Midi_track::~Midi_track()
 }
 
 void
-Midi_track::add_event( Midi_event* midi_event_p )
+Midi_track::add_event( Moment mom, Midi_event* midi_event_p )
+{
+       if ( ! midi_event_p )
+               return;
+       tcol_l( mom - midi_event_p->mom() )->add_event( midi_event_p );
+}
+
+// too much red tape ?
+String
+Midi_track::name_str()
+{
+       return name_str_;
+}
+
+void
+Midi_track::output_mudela( Lily_stream& lily_stream_r )
 {
+       lily_stream_r << name_str_ << " = music { $\n";
+       lily_stream_r << "\t";
+       int column_i = 8;
+
+       for ( PCursor<Track_column*> tcol_l_pcur( tcol_p_list_.top() ); tcol_l_pcur.ok(); tcol_l_pcur++ ) {
+               if ( tcol_l_pcur->midi_event_p_list_.size() > 1 )
+                       warning( "oeps, chord: can-t do that yet", 0 );
+               if ( !tcol_l_pcur->midi_event_p_list_.size() )
+                       continue;
+               lily_stream_r << **tcol_l_pcur->midi_event_p_list_.top();
+               column_i += tcol_l_pcur->midi_event_p_list_.top()->mudela_str().length_i();
+               if ( column_i > 40 ) {
+                       lily_stream_r << "\n\t";
+                       column_i = 8;
+               }
+       }
+       lily_stream_r << "\n$} % " << name_str_ << "\n";
 }
+
+Track_column*
+Midi_track::tcol_l( Moment mom )
+{
+       for ( PCursor<Track_column*> tcol_l_pcur( tcol_p_list_.top() ); tcol_l_pcur.ok(); tcol_l_pcur++ ) {
+               if ( tcol_l_pcur->mom() == mom )
+                       return *tcol_l_pcur;
+               if ( tcol_l_pcur->mom() > mom ) {
+                       Track_column* tcol_p = new Track_column( mom );
+                       tcol_l_pcur.insert( tcol_p );
+                       return tcol_p;
+               }
+       }
+
+       Track_column* tcol_p = new Track_column( mom );
+       tcol_p_list_.bottom().add( tcol_p );
+       return tcol_p;
+}
+
index 0ce9ead5e0357c58e14db154da7c888642e239a6..c57f9ff5de70d8e545aa3651b9efa168bc99d68d 100644 (file)
@@ -38,8 +38,8 @@ String
 Midi_chunk::str()
 {
     String str = header_str_;
-    String length_str = StringConversion::int2hex_str( data_str_.length_i() + footer_str_.length_i(), 8, '0' );
-    length_str = StringConversion::hex2bin_str( length_str );
+    String length_str = String_convert::i2hex_str( data_str_.length_i() + footer_str_.length_i(), 8, '0' );
+    length_str = String_convert::hex2bin_str( length_str );
     str += length_str;
     str += data_str_;
     str += footer_str_;
@@ -61,20 +61,20 @@ Midi_header::Midi_header( int format_i, int tracks_i, int clocks_per_4_i )
 {
     String str;
        
-    String format_str = StringConversion::int2hex_str( format_i, 4, '0' );
-    str += StringConversion::hex2bin_str( format_str );
+    String format_str = String_convert::i2hex_str( format_i, 4, '0' );
+    str += String_convert::hex2bin_str( format_str );
        
-    String tracks_str = StringConversion::int2hex_str( tracks_i, 4, '0' );
-    str += StringConversion::hex2bin_str( tracks_str );
+    String tracks_str = String_convert::i2hex_str( tracks_i, 4, '0' );
+    str += String_convert::hex2bin_str( tracks_str );
 
-    String tempo_str = StringConversion::int2hex_str( clocks_per_4_i, 4, '0' );
-    str += StringConversion::hex2bin_str( tempo_str );
+    String tempo_str = String_convert::i2hex_str( clocks_per_4_i, 4, '0' );
+    str += String_convert::hex2bin_str( tempo_str );
 
     set( "MThd", str, "" );
 }
 
 String
-Midi_item::int2varlength_str( int i )
+Midi_item::i2varint_str( int i )
 {
     int buffer_i = i & 0x7f;
     while ( (i >>= 7) > 0 ) {
@@ -136,8 +136,8 @@ Midi_tempo::str()
 {
     int useconds_per_4_i = 60 * (int)1e6 / tempo_i_;
     String str = "ff5103";
-    str += StringConversion::int2hex_str( useconds_per_4_i, 6, '0' );
-    return StringConversion::hex2bin_str( str );
+    str += String_convert::i2hex_str( useconds_per_4_i, 6, '0' );
+    return String_convert::hex2bin_str( str );
 }
 
 Midi_track::Midi_track( int number_i )
@@ -169,10 +169,10 @@ Midi_track::Midi_track( int number_i )
 
     String data_str;
     // only for format 0 (currently using format 1)?
-    data_str += StringConversion::hex2bin_str( data_ch_c_l );
+    data_str += String_convert::hex2bin_str( data_ch_c_l );
 
     char const* footer_ch_c_l = "00" "ff2f" "00";
-    String footer_str = StringConversion::hex2bin_str( footer_ch_c_l );
+    String footer_str = String_convert::hex2bin_str( footer_ch_c_l );
 
     set( "MTrk", data_str, footer_str );
 }
@@ -181,13 +181,14 @@ void
 Midi_track::add( int delta_time_i, String event_str )
 {
     assert(delta_time_i >= 0);
-    Midi_chunk::add( int2varlength_str( delta_time_i ) + event_str );
+    Midi_chunk::add( i2varint_str( delta_time_i ) + event_str );
 }
 
 void 
 Midi_track::add( Moment delta_time_moment, Midi_item* mitem_l )
 {
     // use convention of 384 clocks per 4
+    // use Duration_convert
     int delta_time_i = delta_time_moment * Moment( 384 ) / Moment( 1, 4 );
     add( delta_time_i, mitem_l->str() );
 }
index 84b105d27dc823282b1d3e3ef6c6c56dc83dca14..f561e0b946bf0659ffb6a48c56cf6a3e2d4b5f69 100644 (file)
@@ -18,6 +18,7 @@ Midi_stream::Midi_stream( String filename_str, int tracks_i, int clocks_per_4_i
     filename_str_ = filename_str;
     tracks_i_ = tracks_i;
     clocks_per_4_i_ = clocks_per_4_i;
+    os_p_ = 0;
     open();
     header();
 }
@@ -32,7 +33,7 @@ Midi_stream::operator <<( String str )
 {
     // still debugging...
     if ( check_debug )
-       str = StringConversion::bin2hex_str( str );
+       str = String_convert::bin2hex_str( str );
     // string now 1.0.26-2 handles binary streaming
     *os_p_ << str;
     return *this;
@@ -51,7 +52,7 @@ Midi_stream&
 Midi_stream::operator <<( int i )
 {
     // output binary string ourselves
-    *this << Midi_item::int2varlength_str( i );
+    *this << Midi_item::i2varint_str( i );
     return *this;
 }
 
@@ -71,7 +72,7 @@ Midi_stream::header()
 //                00 60   96 per quarter-note
 
 //    char const ch_c_l = "0000" "0006" "0001" "0001" "0060";
-//    str += StringConversion::hex2bin_str( ch_c_l );
+//    str += String_convert::hex2bin_str( ch_c_l );
 //    *os_p_ << str;
 
 //      *this << Midi_header( 1, 1, tempo_i_ );
index f89cdec9f1c455f187d92ab49ff4400703f314f6..093af7f0d4b89b80264671dd2eaab4c85961be2c 100644 (file)
@@ -6,6 +6,7 @@
 #include "moment.hh"
 
 
+// depreciated, see struct Duration*
 Moment
 wholes(int dur, int dots)
 {
index a070992f534f0dfab6435eaa178e8d8ecd610b21..c261e5c503c9d7c1d4f2815752cbbf05c4c5fd4b 100644 (file)
@@ -57,7 +57,7 @@ My_midi_lexer::here_ch_c_l()
 }
 
 int
-My_midi_lexer::varint2int_i( String str )
+My_midi_lexer::varint2_i( String str )
 {
         int var_i = 0;
 
@@ -68,7 +68,7 @@ My_midi_lexer::varint2int_i( String str )
                if ( ! ( byte & 0x80 ) )
                        return var_i;
        }
-       cout << "\nvarint2int:" << StringConversion::bin2hex_str( str ) << endl;
+       cout << "\nvarint2_i:" << String_convert::bin2hex_str( str ) << endl;
        assert( 0 ); // illegal varint
        return 0;
 }
index cd12082239c7e3bdb33b0751eb756b9c2e0044fa..62f4d499c888d0b973b0d518a923933b03eb0edf 100644 (file)
 
 #include "my-midi-lexer.hh"
 #include "my-midi-parser.hh"
+#include "duration.hh"
 #include "midi-event.hh"
+#include "lily-stream.hh"
+#include "track-column.hh"
+#include "midi-track.hh"
+#include "midi-score.hh"
 #include "my-midi-lexer.hh"
 #include "my-midi-parser.hh"
 
@@ -30,21 +35,32 @@ My_midi_parser::My_midi_parser( String filename_str )
 {
        midi_lexer_p_ = new My_midi_lexer( filename_str );
        midi_parser_l_g = this;
+       defined_ch_c_l_ = 0;
+       fatal_error_i_ = 0;
+       midi_key_p_ = 0;
+       midi_score_p_ = 0;
+       midi_tempo_p_ = 0;
+       midi_time_p_ = 0;
+       reset();
+}
 
+void
+My_midi_parser::reset()
+{
+       delete midi_key_p_;
        midi_key_p_ = new Midi_key( 0, 0 );
-//     midi_tempo_p_ = new Midi_tempo( 384 ); // wiellie dunno!
-       // 07A120 == 500000
-       midi_tempo_p_ = new Midi_tempo( 0x07a120 ); // wiellie dunno!
-       midi_time_p_ = new Midi_time( 4, 4, 0x24, 8 );
+       // useconds per 4: 250000 === 60 4 per minute
+       delete midi_tempo_p_;
+       midi_tempo_p_ = new Midi_tempo( 250000 );
+       delete midi_time_p_;
+       midi_time_p_ = new Midi_time( 4, 4, 384, 8 );
 
-       defined_ch_c_l_ = 0;
-       fatal_error_i_ = 0;
-       now_f_ = 0;
-       step_f_ = 0;
+       now_i64_ = 0;
 
        for ( int i = 0; i < CHANNELS_i; i++ )
                for ( int j = 0; j < PITCHES_i; j++ )
-                       running_f_f_a_[ i ][ j ] = 0;
+//                     running_i64_i64_a_[ i ][ j ] = -1;
+                       running_i64_i64_a_[ i ][ j ] = 0;
 }
 
 My_midi_parser::~My_midi_parser()
@@ -54,13 +70,14 @@ My_midi_parser::~My_midi_parser()
        delete midi_key_p_;
        delete midi_tempo_p_;
        delete midi_time_p_;
+       delete midi_score_p_;
 }
 
 void
 My_midi_parser::add_score( Midi_score* midi_score_p )
 {
-       midi_score_p_array_.push( midi_score_p );
-       cout << endl;
+       assert( !midi_score_p_ );
+       midi_score_p_ = midi_score_p;
 }
 
 void
@@ -73,36 +90,41 @@ My_midi_parser::error( char const* sz_l )
 }
 
 void
-My_midi_parser::forward( Real f )
+My_midi_parser::forward( int i )
+{
+       now_i64_ += i;
+}
+
+Moment
+My_midi_parser::mom()
 {
-       // ugh
-       if ( f )
-               step_f_ = f;
-       now_f_ += step_f_;
+       return Duration_convert::i2_mom( now_i64_, division_1_i_ );
 }
 
 void
 My_midi_parser::note_begin( int channel_i, int pitch_i, int dyn_i )
 {
        // one pitch a channel at time!
-       //  heu, what if start at t = 0?
-//     assert( !running_f_f_a_[ channel_i ][ pitch_i ] );
-       running_f_f_a_[ channel_i ][ pitch_i ] = now_f_;
+       // heu, what about { < c2 >  < c4 d4 > }
+//     assert( running_i64_i64_a_[ channel_i ][ pitch_i ]  == -1 );
+       running_i64_i64_a_[ channel_i ][ pitch_i ] = now_i64_;
 }
 
 Midi_event*
 My_midi_parser::note_end_midi_event_p( int channel_i, int pitch_i, int dyn_i )
 {
-       Real start_f = running_f_f_a_[ channel_i ] [ pitch_i ];
-       // did we start? -> heu, don-t know: what if start at t = 0?
-//     assert( start_f ); 
-       return new Midi_note( midi_key_p_, midi_time_p_, clocks_per_whole_i_, pitch_i, now_f_ - start_f );
+       Int64 start_i64 = running_i64_i64_a_[ channel_i ][ pitch_i ];
+//     running_i64_i64_a_[ channel_i ][ pitch_i ] = -1;
+       // did we start?
+//     assert( start_i64 != -1 ); 
+       return new Midi_note( midi_key_p_, midi_time_p_, division_1_i_, pitch_i, now_i64_ - start_i64 );
 }
 
 int
-My_midi_parser::output( String filename_str )
+My_midi_parser::output_mudela( String filename_str )
 {
-       return 0;
+       assert( midi_score_p_ );
+       return midi_score_p_->output_mudela( filename_str );
 }
 
 int
@@ -112,10 +134,10 @@ My_midi_parser::parse()
 }
 
 void
-My_midi_parser::set_division( int clocks_per_4_i )
+My_midi_parser::set_division_4( int division_4_i )
 {
-       clocks_per_whole_i_ = clocks_per_4_i * 4;
-       if ( clocks_per_4_i < 0 )
+       division_1_i_ = division_4_i * 4;
+       if ( division_4_i < 0 )
                warning( "seconds iso metrical time" , 0 );
 }
 
index a02c323ea35bb7288ecd06c61d6b90e337000278..10c395759c321aca3a14b76270134301641eb4b3 100644 (file)
@@ -60,7 +60,7 @@ static Keyword_ent the_key_tab[]={
 int
 My_flex_lexer::ret_notename(int *p, String text, int octave_mod)
 {
-    text.lower();
+    text = text.lower_str();
     char const* ch_c_l = here_ch_c_l();
     if ( ch_c_l ) {
        ch_c_l--;
index 95a7d8313d5a6fc831479e2790426bd81ecc4945..0f7eb8e85fb70e14b760bf0585bc9cf1871ab63e 100644 (file)
@@ -25,7 +25,7 @@ bool last_duration_mode = false;
 void
 set_duration_mode(String s)
 {
-    s.upper();
+    s = s.upper_str();
     last_duration_mode = (s== "LAST");
 }
 
index d065f19cae89b1209754f347b42bceaef4c91dba..b8b175ef1a5f30cf9710bf374a6982e2d34bf45e 100644 (file)
@@ -622,6 +622,13 @@ explicit_duration:
                 get_default_duration($$);
                 $$[1] = $1;
        }
+       | INT '*' INT '/' INT {
+               // ugh, must use Duration
+               set_plet( $3, $5 );
+               $$[ 0 ] = $1;
+               $$[ 1 ] = 0;
+               set_plet( 1, 1 );
+       }
        ;
 
 default_duration:
index bce34a85756606da6c08552b54c9fb55b7a94190..991be88550463031a76447cc13eae7a34daba4c9 100644 (file)
@@ -101,12 +101,12 @@ Melodic_req::height() const
 /*
  should be settable from input to allow "viola"-mode
  */
-static Byte pitch_by_a[ 7 ] = { 0, 2, 4, 5, 7, 9, 11 };        
+static Byte pitch_byte_a[ 7 ] = { 0, 2, 4, 5, 7, 9, 11 };      
 
 int
 Melodic_req::pitch() const
 {
-    return  pitch_by_a[ notename_i_ % 7 ] + accidental_i_ + octave_i_ * 12;
+    return  pitch_byte_a[ notename_i_ % 7 ] + accidental_i_ + octave_i_ * 12;
 }
 
 Plet_req::Plet_req()
index db87b6baf1d6583cca20c0e46e2b53a0537a8134..a98a8a9926850cbac6cd8fbb5b529b13767eb575 100644 (file)
@@ -57,7 +57,7 @@ Script::support_height() const return r;
 }
 
 void
-Script::set_default_pos()
+Script::set_default_index()
 {
     Real inter_f= paper()->internote();
     Interval dy = symbol().dim.y;
@@ -115,7 +115,7 @@ Script::do_pre_processing()
 void
 Script::do_post_processing()
 {
-    set_default_pos();
+    set_default_index();
 }
 
 Molecule*
index eac2b1f84a6454385608c7c65be96c356e9d06f2..5caa8545fa3ed86d8a4a678745e2de7f125a03da 100644 (file)
@@ -104,10 +104,10 @@ Source_file::error_str( char const* pos_ch_c_l )
        else
            error_col_i++;
 
-    String str = line_str.left( pos_ch_c_l - begin_ch_c_l ) 
+    String str = line_str.left_str( pos_ch_c_l - begin_ch_c_l ) 
        + String( '\n' )
        + String( ' ', error_col_i ) 
-       + line_str.mid( pos_ch_c_l - begin_ch_c_l + 1, INT_MAX ); // String::mid should take 0 arg..
+       + line_str.mid_str( pos_ch_c_l - begin_ch_c_l + 1, INT_MAX ); // String::mid should take 0 arg..
     return str;
 }
 
index 22123356c682a3fda6b912dc36aec5b4ca1c0316..e9a4f943bf43140bbc785befb810365711b6368e 100644 (file)
@@ -186,7 +186,7 @@ Stem::brew_molecule_p()const return out;
 }
 
 Real
-Stem::hpos()const
+Stem::hindex()const
 {
     return pcol_l_->hpos + stem_xoffset; // hmm.  + offset_.x;
 }
index 1a5c4a08c57d7b815e327edc08216129834e7942..d7f1162d29bb2a871a209acc904eb89b83f77887 100644 (file)
@@ -14,10 +14,10 @@ vstrut(Real h)
 static void
 substitute_arg(String& r, String arg)
 {
-    int p = r.pos('%');
+    int p = r.index_i('%');
     if (!p ) return ;
     else p--;
-    r = r.left(p) + arg + r.right(r.len() - p -1);
+    r = r.left_str(p) + arg + r.right_str(r.length_i() - p -1);
 }
 
 
@@ -27,7 +27,7 @@ substitute_args(String source, Array<String> args)
     String retval (source);
     for (int i = 0 ; i < args.size(); i++)
         substitute_arg(retval, args[i]);
-    while (retval.pos('%'))
+    while (retval.index_i('%'))
         substitute_arg(retval, "");
     return retval;
 }
index 110e95e3bfe166488c9d84f0f91044be5375cac7..56fb8e054b80d74c21590ed23a439abe0d491c37 100644 (file)
@@ -17,7 +17,7 @@ Text_item::Text_item(Text_req* treq_l, int staffsize_i)
 }
 
 void
-Text_item::set_default_pos()
+Text_item::set_default_index()
 {
     pos_i_  = (dir_i_ > 0) ? staffsize_i_ + 2: -4;
 }
@@ -25,7 +25,7 @@ Text_item::set_default_pos()
 void
 Text_item::do_pre_processing()
 {
-    set_default_pos();
+    set_default_index();
 }
 
     
index c9c3d52860866797be8f30f283774f44da35dbfc..59d1189b11b81acf2c7a9e3d8ad16e9a1bcde2d4 100644 (file)
@@ -1,3 +1,11 @@
+/*
+  timedescription.cc -- implement Time_description
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
 #include "timedescription.hh"
 #include "debug.hh"
 
@@ -17,13 +25,15 @@ Time_description::str()const
 
 void
 Time_description::print() const
-{    
+{
+#ifndef NPRINT
     mtor << str();
+#endif
 }
 void
 Time_description::OK() const
 {
-#ifdef NDEBUG
+#ifndef NDEBUG
     if (!cadenza_b_)
        assert(whole_in_measure_ < whole_per_measure_);
     assert(0 <= whole_in_measure_);
@@ -52,6 +62,7 @@ Time_description::Time_description()
     bars_i_ = 0;
     cadenza_b_ = false;
 }
+
 void
 Time_description::add(Moment dt)
 {
index 43816883982bf239ea0bbd7e07924867031a63e5..dc24ecd96a86c907bc535febef28d6cb4cbcf961 100644 (file)
@@ -16,8 +16,8 @@
 Walker_registers::Walker_registers(Complex_walker *w)
 {
     add( new Bar_register(w));
-    add( new Meter_register(w));
     add( new Clef_register(w));
     add( new Key_register(w));
+    add( new Meter_register(w));
     add( new Local_key_register(w));
 }