]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 0.0.33 release/0.0.33
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 20 Feb 1997 23:15:12 +0000 (00:15 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 20 Feb 1997 23:15:12 +0000 (00:15 +0100)
98 files changed:
.dstreamrc
Documentation/CodingStyle.pod
Documentation/README.pod
Documentation/faq.pod
Documentation/lilygut.pod
Documentation/lilyinput.pod
Documentation/make_website
Makefile
NEWS
README
Sources.make
TODO
Variables.make
configure
flower/NEWS
flower/Sources.make
flower/Variables.make
flower/dataf.cc [deleted file]
flower/datafile.cc [new file with mode: 0644]
flower/datafile.hh [new file with mode: 0644]
flower/dstream.cc
flower/matdebug.cc
flower/scalar.cc
flower/string.cc
flower/string.hh
flower/stringconversion.cc [new file with mode: 0644]
flower/stringconversion.hh [new file with mode: 0644]
flower/stringtest.cc [new file with mode: 0644]
flower/stringutil.cc [new file with mode: 0644]
flower/stringutil.hh
flower/textdb.hh
flower/textstr.hh [deleted file]
flower/textstream.cc [new file with mode: 0644]
flower/textstream.hh [new file with mode: 0644]
hdr/commandrequest.hh
hdr/debug.hh
hdr/inputmusic.hh
hdr/inputscore.hh
hdr/lexer.hh
hdr/lyriccolumn.hh
hdr/lyricitem.hh
hdr/lyricstaff.hh
hdr/lyricwalker.hh
hdr/musicalrequest.hh
hdr/parseconstruct.hh
hdr/proto.hh
hdr/request.hh
hdr/score.hh
hdr/source.hh
hdr/sourcefile.hh
hdr/staff.hh
hdr/voice.hh
init/Makefile
init/swedish.ini [new file with mode: 0644]
input/Makefile
input/cadenza.ly
input/coriolan-alto.ly
input/error.ly
input/kortjakje.ly
input/martien.ly
input/midi.ly [new file with mode: 0644]
input/mlalt.ly
input/mlcello.ly
input/mlvio1.ly
input/mlvio2.ly
input/pavane.ly
input/plet.ly [new file with mode: 0644]
input/rhythm.ly
input/scales.ly
input/scsii-menuetto.ly
input/standchen.ly
input/standchen.tex
input/twinkle.ly
input/wohltemperirt.ly
src/barreg.cc
src/commandrequest.cc
src/debug.cc
src/inputmusic.cc
src/inputscore.cc
src/inputstaff.cc
src/lexer.l
src/lyricwalker.cc
src/midicolumn.cc [new file with mode: 0644]
src/midistaff.cc [new file with mode: 0644]
src/mylexer.cc
src/note.cc
src/parser.y
src/request.cc
src/score.cc
src/scores.cc
src/slurreg.cc
src/source.cc
src/staff.cc
src/voice.cc
src/voiceelt.cc
src/voicegroup.cc
src/voiceregs.cc
src/warn.cc

index b4d6029922c1d2e5901460cd9913ba9ad92acfd2..b2c6cfc5daf07796df2ce1a5e3eab78ed09b9994 100644 (file)
@@ -38,8 +38,9 @@ Input_cursor          1
 Commands_at            1
 Input_command          1
 Time_description       1
-Melodic_req            0
-Stem_req               0
+Melodic_req            1
+Midi_walker            0
+Stem_req               1
 Group_change_req       1
 Script_req             1
 Colinfo                        1
index fdbab0668bafa409aa1138d6d4e03e7dc88bd2c7..02b580c6025dc71b2bdc93b280d320cce0751ceb 100644 (file)
@@ -45,6 +45,7 @@ http://www.zib.de/Visual/software/doc++/index.html
        /**
                short description.
                Long class documentation.
+               (Hungarian postfix)
        */
        class Class {
                /** short description.
@@ -89,9 +90,9 @@ Standard methods:
        void print() const
 
        /**
-       protected member. Usually invoked by non-virtual A_virtual_func()
+       protected member. Usually invoked by non-virtual XXXX()
        */
-       virtual do_A_virtual_func()
+       virtual do_XXXX()
 
        /**add some data to *this.
        Presence of these methods usually imply that it is not feasible to this
@@ -109,22 +110,17 @@ Notation>.
 
 =head2 Hungarian
 
-The Hungarian Notation was conceived by
-or at least got its name from,
-the hungarian programmer x. 
-It is a naming convention with the aim 
-to make code more readable (for fellow programmers)
-and more accessible for programmers 
-that are new to a project.
-
-The essence of the Hungarian Notation 
-is that every identifier has a part
-which identifies its type 
-(for functions this is the result type).
-This is particularly useful in object oriented programming,
-where a particular object implies a specific interface
-(a set of member functions, perhaps some redefined operators),
-and for accounting heap allocated memory pointers and links.
+The Hungarian Notation was conceived by or at least got its name from,
+the hungarian programmer x.  It is a naming convention with the aim to
+make code more readable (for fellow programmers) and more accessible
+for programmers that are new to a project.
+
+The essence of the Hungarian Notation is that every identifier has a
+part which identifies its type (for functions this is the result
+type).  This is particularly useful in object oriented programming,
+where a particular object implies a specific interface (a set of
+member functions, perhaps some redefined operators), and for
+accounting heap allocated memory pointers and links.
 
 =head2 Advantages
 
@@ -203,6 +199,9 @@ with the parts of the names separated by underscores.
 
 =over 5
 
+=item C<byte>
+unsigned cher. (The postfix _by is ambiguous)
+
 =item C<b>
 bool
 
@@ -276,7 +275,7 @@ Temporary variable: an unsigned integer
 =item C<test_ch>
 Variable Test: a character
 
-=item C<firstName_str>
+=item C<first_name_str>
 Variable first_name: a String class object
 
 =item C<first_name_ch_a>
index 87e2b65fbea84770e351ed91f8fc0d56ea24881b..a837d6a07096c6bd28c4ac9eef75885d8a1c40f6 100644 (file)
@@ -21,6 +21,9 @@ music. LilyPond has these features:
 ASCII script input, with identifiers (for music reuse),
 customizable notenames, customizable fontset
 
+=item *
+MIDI output lets you check if you have entered the correct notes.
+
 =item *
 Multiple staffs in one score. Each staff can have a different meters.
 
@@ -33,7 +36,7 @@ triplets, general n-plet (triplet, quadruplets, etc.), lyrics
 
 =item *
 multiple voices within one staff; beams optionally shared
-between voices. (well, more than 2 voices won't look pretty)
+between voices. (well, more than 2 voices won't look pretty --yet.)
 
 =item *
 multiple scores within one input file. Each score is output to
@@ -95,8 +98,6 @@ LilyPond does not display notes directly, nor will it be rehacked to be
 used interactively. LilyPond writes output to a file.  It will not be
 extended to play music, or to recognize music.
 
-It will output MIDI, though (at some stage)
-
 =item *
 LilyPond is intended to run on Unix platforms, but it should
 be portable to any platform which can run TeX and the GNU tools
@@ -115,21 +116,21 @@ broken systems.
 
 =over 5
 
-=item  B<-I,--include>=F<FILE>
+=item B<-I,--include>=F<FILE>,
 
 add F<FILE> to the search path for input files.
 
-=item  B<-d,--debug>,
+=item B<-d,--debug>,
 
 Turn debugging info. LilyPond will read the file F<.dstreamrc>, which
 tells for what functions and classes may produce copious debugging
 output.
 
-=item  B<-w,--warranty>,
+=item B<-w,--warranty>,
 
 Show the warranty with which LilyPond comes. (It comes with B<NO WARRANTY>!)
 
-=item  B<-o,--output=>F<FILE>,
+=item B<-o,--output=>F<FILE>,
 
 Set the default output file to F<FILE>.
 
@@ -139,10 +140,10 @@ Show a summary of usage
 
 =item  B<-i,--init=>F<FILE>
 
-set init file (default: F<symbol.ini>)
+set init file to F<FILE> (default: F<symbol.ini>)
 
-=item B<--include, -I>
-add to file search path.
+=item B<--include, -I>=F<DIRECTORY>
+add F<DIRECTORY> to the search path for input files.
 
 =back
 
@@ -157,7 +158,7 @@ the GNU General Public License, which is in the file F<COPYING>
 
 =head1 PREREQUISITES
 
-Compilation:
+For compilation you need.
 
 =over 5
 
@@ -174,17 +175,18 @@ or better recommended. I doubt if it will compile with AT&T CC.
 GNU make.
 
 =item *
-flex (2.5.1 or better)
+Flex (2.5.1 or better)
 
 =item *
 Bison.
 
 =item *
 The "Flower" library, which should be available from the same
-source you got this from.
+source you got this from. The version of flower lib should match the
+one which is found in the F<configure> script.
 
 =item *
-perl.  The Makefile uses perl for trivial operations, and you
+Perl.  The Makefile uses Perl for trivial operations, and you
 could tinker with it to use sed or awk.
 
 =back
@@ -194,14 +196,16 @@ LilyPond does use a lot of resources. For operation you need the following:
 =over 5
 
 =item *
-a fast computer (well; full page of music typically takes 1
-minute on my 486/66, using the DEBUG compile)
+a fast computer (a full page of music typically takes 1 minute
+on my 486/66, using the DEBUG compile. It's lot slower than most
+MusiXTeX preprocessors)
 
 =item *
 TeX
 
 =item *
-The MusixTeX fonts. (I use version T.59)
+The MusixTeX fonts. (I use version those found in MusixTeX
+Taupin version T.59)
 
 =back
 
@@ -216,7 +220,7 @@ Do:
        make
 
 You might want to edit Variables.make to tailor the compilation flags.
-why G++ >= 2.7? LilyPond & flower lib uses:
+why G++ >= 2.7? LilyPond & FlowerLib uses:
 
 =over 5
 
@@ -298,15 +302,15 @@ This is what the output looks like over here:
        hw:~/musix/spacer$ xdvi test&
        [1] 855
 
-Check out F<kortjakje.ly>, it has some comments
+Check out the input files, some of them have comments
 
 
 =head1 PROBLEMS
 
-If LilyPond bombs out, then please recompile using B<-g>, and send a
-copy of the input which causes the error and a gdb stacktrace of the
-crash. It also helps if you can print the values of the objects. So if
-your trace is
+If LilyPond bombs out, then please recompile using with debugging info
+turned on, and send a copy of the input which causes the error and a
+gdb stacktrace of the crash. It also helps if you can print the values
+of the objects. So if your trace is
 
        (gdb) backtrace 12
        #0  Interval::operator+= (this=0x11fffec60..)
@@ -346,7 +350,6 @@ among others: lilygut, lilyinput, error, faq,
 LilyPond has no connection with the music package RoseGarden, other
 than the names being similar :-)
 
-
 =head1 HISTORY
 
 (for a  detailed changelog, see F<NEWS>)
index df28977c5c4d89b5962a3439a408bd1f960b528f..fac6903cb1d1575bcb96cdb66b7650f41ce944c0 100644 (file)
@@ -4,6 +4,7 @@ FAQ - LilyPond FAQs
 
 =head1 DESCRIPTION
 
+Some questions that have been answered before.
 
 Q: Why are [] around the notes, and () inbetween?
 
@@ -31,3 +32,12 @@ please :).
 Q: Why GPL?
 
 A: Yes.
+
+Q: Why shouldn't I put all commands (\clef, \meter) inside the music?
+
+A: You should do what you like, but at some time we will enable
+quoting of music ("Stichnoten"). Besides if you are going to type an
+orchestral score, then you'd probably want to enter most of those
+commands only once.
+
+
index e348b644d0f914ff114fac7c440dabf8b107b86f..1ac0c5290d31ae837e68f566d9dc6fcbedbc5e47 100644 (file)
@@ -25,8 +25,10 @@ No difficult algorithms. Associated datastructures have prefix Input
 
 =item 2. Processing:
 
-Requests are processed and granted. In this step data-structures for
-3. are created and filled with data: PScore, PCol, PStaff
+Requests are processed and granted. This is done by three cooperating
+structeres: Staff, Staff_walker and Staff_column.  In this step
+data-structures for 3. are created and filled with data: PScore, PCol,
+PStaff
 
 =item 3. Calculation:
 
@@ -140,11 +142,11 @@ should not be shared.
 
 The judge in this "allocation" problem is Staff (actually, it's child
 C<Complex_staff>). It uses the C<Request_register> to do most of the
-work class.  For each request C<Complex_staff> queries so-called
+work.  For each request C<Complex_staff> queries so-called
 C<Request_register>s if they want to accept a request eg, the
 C<Notehead_register> will accept C<Note_req>s, and turn down
-C<Slur_req>s. If C<Complex_staff> cannot find a register wants the
-request, it is junked (with a warning message).
+C<Slur_req>s. If C<Complex_staff> cannot find a register that wants
+the request, it is junked (with a warning message).
 
 After all requests have been either assigned, or junked, the Register
 will process the requests (which usually means creating an C<Item> or
index b7d48880064e465b7e4631a5b2a3071bfa5db595..58a4378d4b9ec862f8958a797b2603457a539f4c 100644 (file)
@@ -70,7 +70,10 @@ Not really crystallized; you can use '#' or '%' as line comment
 LilyPond first reads 'symbol.ini', which contains declarations crucial
 to proper operation of LilyPond (symbol tables, note names).
 
-This language looks a lot like Rayce's which in turn owes a lot to the
-POVRay raytracer. Now, I know, musictypesetting and Raytracing do not
-necessarily require the same input format, but I was just to lazy to
-make up a new and/or better input format. Suggestions appreciated.
+This language looks a lot like Rayce's (Rayce is a raytracer that I've
+written as a hobby project. I used as a practice program for writing
+(among others) C++ and Yacc. It also gave me RSI :-( ) which in turn
+owes a lot to the POVRay raytracer. Now, I know, musictypesetting and
+Raytracing do not necessarily require the same input format, but I was
+just to lazy to make up a new and/or better input format. Suggestions
+appreciated.
index 4b1a9aaf4af78dc71d7c794217f209853b73948f..1aede3536704a3feaf6d3a2549d092960ea577d2 100755 (executable)
@@ -11,7 +11,7 @@ sub
 local $base="lilypond/";
 local @examples=("wohltemperirt");
 
-system  'make html';
+system  'pod2html';
 
 print "resetting refs.\n";
 
@@ -31,7 +31,6 @@ foreach $a (@examples) {
        "gs -q -sDEVICE=ppmraw -sOutputFile=- -r200 -dNOPAUSE  $a.ps -c quit |pnmscale 0.5| ppmtogif > $a.gif"
 }
 
-system "mkdir docxx; make -C.. docxx; ln ../docxx/* ./docxx/;"
-
-system "tar cf website.tar *.html *.gif *.png *.ps docxx/;" .
-"gzip -9 website.tar;"
+system "mkdir docxx; make -C.. docxx; ln ../docxx/* ./docxx/;" .
+        "tar cf website.tar *.html *.gif *.png *.ps docxx/;" .
+       "gzip -9 website.tar;"
index f34bcbc4ca1bef03a86f49fdd06884169fec1896..830b08c36043d0de30be49d0f432c6a75b91cfcc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,8 @@ distclean: clean
 
 all: kompijl doc
 
-win32: # value of $(OSTYPE) on windhoos; "make $OSTYPE" if u use bash :-)
+# value of $(OSTYPE) on windhoos; "make $OSTYPE" if u use bash :-)
+win32: 
        $(MAKE) -C . CXX=g++ 
 
 doc:
diff --git a/NEWS b/NEWS
index 34f241725cf09df96c623eb1597cb396babb44ed..ce2cca67caa4e897e5366874df8a78231d70e097 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,12 +1,58 @@
+*******
+pl33
+Examples
+       - Swedish notenames (MB)
+Features
+       - Jan's patches, see below
+Bugfix
+       - some midi bugfixes.
+
+pl pre33-1 (JCN)
+
+
+       - midi output using pitches iso notename
+Examples
+       - added midi output (some midi output files broken?)
+       - all melodic fixed (except for error.ly:-) 
+       - midi.ly
+Bugfix
+       - midiwalker line break
+       - empty/nonexistent include at top of ly
+       - midi #tracks
+       - midi pitch c0
+       - midi poor man-s staff dynamics
+Internal
+       - Midi_column, Midi_staff, Midi_walker
+
+pl pre33 (JCN)
+       - Jan's patches, see below
+
+Features
+       - simple plet notation (JCN)
+       - lyrics centred, but no fully suppored? (JCN)
+Internal
+       - Midi_stream 
+       - Mididef
+       - Midi_item, Midi_pitch, Midi_duration
+       - Midi_chunk, Midi_header, Midi_track
+       - preparations for midi output 
+       - no exit upon context error (JCN)
+       - converted some "warnings" to errors; no output (JCN)
+Bugfix:
+       - simple plet bugfix
+Examples
+       - updated standchen, menuetto (JCN)
+       - new plet notation (JCN)
+       - plet.ly (parse and spacing tests) (JCN)
+
+*******
 pl 32
+Features
        - multiple meters, see rhythm.ly
-       
-
-pl 32-2
        - skip syntax/Skip_req
-       - command carnage
        - score_wide_music: commands in staff now override commands in score.
 Internal:
+       - command carnage
        - Key_register
        - Bar_register
        - Meter_register
@@ -20,12 +66,12 @@ pl 32-1
        - website added to doco
        - clef must *inside* music
        - fixed spurious "beam too narrow" messages.
-Internal
+Internal:
        - merge musical / non-musical staff_column
        - musical/ non-musical requests
        - Clef_register
        - split up request.hh, Musical_req vs. Nonmusical_req
-
+*******
 pl 31
 
 Examples
@@ -33,7 +79,7 @@ Examples
        - standchen updated
 Bugfix
        - calcideal assertion bugfix
-
+*******
 pl 30
 
 Features
@@ -58,7 +104,7 @@ Bugfix
 pl 29
        - multiplatform Makefile (JN)
        - context errors: bugfixes (JN)
-
+*******
 pl 28
 
 Internal
@@ -72,7 +118,7 @@ Bugfix
        - stupid typo in Staff_elem::post_processing()
        - init of hpos in PCol::PCol
        - Word_wrap::solve() bug 
-
+*******
 pl 27
        - preliminary WIN32 support (JN)
 Features
@@ -98,7 +144,7 @@ Examples
 
 Internal:
        - Text_reg and Script_reg
-
+*******
 pl 26
        - Documentation/lelie_logo.png
        - 8-bit chars for input (see ltest.tex) (MB)
@@ -110,14 +156,16 @@ Internal:
        - added Request_register
        - Voice_group_registers, Voice_registers, *_register
        - Complex_staff
-
+*******
 pl 25
        - other clefs added, keys typeset properly (MB)
 
+*******
 pl 24:
        - Lyrics (JCN)
        - Commands in music-mode (an input feature) (there you are, Mats)
 
+*******
 pl 23:
        - TODO file inc'd
        - cadenza mode.
@@ -134,6 +182,7 @@ Bugfixes:
        - unconnected columns
 
 
+*******
 pl 22:
        - doco from mpp
        - repeat signs
@@ -146,6 +195,7 @@ Bugfixes:
        - bug noteheadswap
        - huge memleak fixed; unearthed lots of bugs
 
+*******
 pl 21:
        - scripts
        - texts
@@ -154,6 +204,7 @@ Internal changes:
        - Move breaking stuff into a separate class Break_algorithm
        - dependencies for Staff_elem's
 
+*******
 pl 20:
        - updated doco to .pod
        - include files from .ly
@@ -161,33 +212,40 @@ Internal changes:
        - Rational for time measurement
        - directionalspanner/textspanner
 
+*******
 pl 19:
        - grouping code: LilyPond can set advanced multibeams.
 Internal changes:
        - struct Moment
 
+*******
 
 pl 18:
        - robust Staff_commands
 
+*******
 pl 17:
        - robust Input_commands
        - merged Vertical_/Horizontal music
        - PARTIALs with duration
        - modularized lexer: multiple runs
 
+*******
 pl 16
        - notenames configurable
 
+*******
 pl 15
        - grouping code
        - multibeams (simple)
 
+*******
 pl 14
        - symtables from .ly
        - Input_command
        - Input_{score/staff}
 
+*******
 pl 13
        - Horizontal/Vertical music
        - Input_commands
diff --git a/README b/README
index 8c2b831b5af0ddf294b450727312de2e3a5274fb..83f807a7a097bb203f0863b887130c40294e10a7 100644 (file)
--- a/README
+++ b/README
@@ -1,11 +1,14 @@
-IMPORTANT: if you have downloaded a
+IMPORTANT:
+
+if you have downloaded a
 
        *.pre*
 
 version, then this is version is *not* meant for producing nice output
-(but to keep your patchsets up to date)
+(but to keep your patchsets up to date). It might not even compile.
 
 ====================
+
 Please refer to the directory Documentation/, Documentation/README.*
 
 To generate the pretty-printed docs, do this:
@@ -21,8 +24,9 @@ NOTE:
 
 LilyPond is a long way from finished and polished. I do appreciate
 criticism, comments, bugreports, patches, etc. Please send e-mail to
+me,
 
-       hanwen@stack.urc.tue.nl
+       hanwen@stack.nl
 
 Have fun!
 
index ffb0f96cd59e0313d4f2aa95fcd130d4cfda296f..2312887b2a4c92f32b0d1069df68f6a17d1fb33a 100644 (file)
@@ -12,7 +12,10 @@ hdr=   bar.hh barreg.hh beam.hh boxes.hh break.hh clefreg.hh clefitem.hh\
        keyword.hh leastsquares.hh lexer.hh linespace.hh \
        localkeyitem.hh localkeyreg.hh lookup.hh \
        lyriccolumn.hh  lyricitem.hh lyricstaff.hh lyricwalker.hh\
-       main.hh  meter.hh meterreg.hh misc.hh\
+       main.hh  meter.hh meterreg.hh\
+       midicolumn.hh mididef.hh midiitem.hh midistaff.hh midistream.hh\
+       midiwalker.hh midiscorewalker.hh\
+       misc.hh\
        molecule.hh moment.hh musicalrequest.hh\
        notehead.hh notename.hh offset.hh paperdef.hh\
        parseconstruct.hh pcol.hh proto.hh pscore.hh pstaff.hh qlp.hh\
@@ -42,6 +45,8 @@ mycc=bar.cc barreg.cc beam.cc boxes.cc break.cc calcideal.cc clefreg.cc\
        localkeyitem.cc localkeyreg.cc lookup.cc\
        lyriccolumn.cc lyricitem.cc lyricstaff.cc lyricwalker.cc\
        main.cc  meter.cc meterreg.cc\
+       mididef.cc midicolumn.cc midiitem.cc midistaff.cc midistream.cc\
+       midiwalker.cc midiscorewalker.cc\
        misc.cc molecule.cc mylexer.cc note.cc notehead.cc  notename.cc\
        paperdef.cc pcol.cc pscore.cc pstaff.cc qlp.cc qlpsolve.cc\
        register.cc request.cc rest.cc  sccol.cc score.cc\
diff --git a/TODO b/TODO
index 1803ad21c3cfcf7efe328a0bb5e9c556716e05b6..4eba110c2d5867f7403c0cca372a868114dad223 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,19 +1,19 @@
 
 before 0.1
 
-       * martien.ly, standchen.ly
+       * Register_groups as a baseclass.
+
+       * Junk Staff/Staff_col children.
 
        * pushgroup, popgroup.
 
        * basic dynamics
 
-       * triplet notation
-
-       * midi output
+       * MIDI syntax.
 
        * decent TeX page layout
        
-       * < .. > vs. { .. }
+       * < .. > vs. { .. } syntax? ! 
 
 This is an assorted collection of stuff that will be done, might be
 done, or is an idea that I want to think about
@@ -25,6 +25,10 @@ BUGS
 
        * $cis ( | ) cis$
 
+       * Group_feature at start of music. 
+
+       * size of Key_item
+
 SEVERELY LACKING:
 
        * grace notes
@@ -45,7 +49,9 @@ INPUTLANGUAGE
 
 SMALLISH PROJECTS
 
-       * bar numbers
+       * parshape
+
+       * bar numbers/repetition marks
 
        * read from mmap directly: study yy_scan_buffer
 
@@ -123,7 +129,7 @@ IDEAS
 
        * enter Requests directly
 
-       * itemcolumns
+       * itemcolumns: Use dummy items.
 
        * use an embedded language: scheme, lisp, S-lang, Perl, ?
 
index 6c7566575700645ea021269d4032802236a91e21..96aa6194dd963f18da63cbb9e76db6d38157b1e5 100644 (file)
@@ -3,7 +3,7 @@
 # version info
 MAJVER=0
 MINVER=0
-PATCHLEVEL=32
+PATCHLEVEL=33
 
 
 
@@ -28,7 +28,7 @@ EXTRACXXFLAGS=-pipe -Wall -W   -Wmissing-prototypes
 # VM hardware to trap malloc/free errors.
 #
 
-EXTRALIB= #+=-lefence
+EXTRALIB+= #-lefence
 
 ####
 #### END USER CONFIGURABLE part.
@@ -110,6 +110,6 @@ DODEP=rm -f $(depfile); DEPENDENCIES_OUTPUT="$(depfile) $(OBJECTDIR)/$(notdir $@
 
 STRIPDEBUG=true #replace to do stripping of certain objects
 LINKER=$(CXX)
+include Site.make
 
-
-include Site.make
\ No newline at end of file
+include Site.make
index b1b21e0631aad197b8d4c474442e2d618c92c956..21ee567e831f2f7a04cca783f272103474b2279f 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,12 +1,26 @@
 #!/bin/sh
 
+# script to setup library and auto generated files.
+
+function setversion() {
+    eval `sed -n 's/^\([A-Z]*\)=\([p0-9].*\)$/\1=\2/p' Variables.make`
+    NEWVER=$MAJVER.$MINVER.$PATCHLEVEL
+    echo
+    echo "Current  version ("`pwd`") is $NEWVER"
+    echo
+}
+
+MAKE=${MAKE:-make}
 PREFIX=${PREFIX:-.}
+NEEDFLOWERVER=1.1.1
+
 echo using PREFIX=$PREFIX
+echo I need Flower version $NEEDFLOWERVER
 
-NEEDFLOWERVER=1.0.27
 flowertar=flower-$NEEDFLOWERVER
 here=`pwd`
 cd ..
+
 if [ -x flower ]
 then
     echo Found flowerdir
@@ -19,14 +33,23 @@ else
     fi
     rm flower
     ln -s $flowertar flower
-
 fi
+
 echo Compiling Library
-(cd flower;make)
+{
+    cd flower;
+    setversion
+    if [ $NEWVER != $NEEDFLOWERVER ]; then
+       echo "You seem to be having an incorrect version of the Flower library"
+    else
+       echo "You got the correct Flower version."
+    fi
+    $MAKE
+}
 
 cd $here
 
 echo '#define LIBDIR "'$PREFIX'/"'> hdr/config.hh
 touch Site.make
-make -f Initial.make
+$MAKE -f Initial.make
 
index b89a032048d24d2f41b51292bc67762d1eaa1c9f..c545441b69fb5818a5d379e159579ee9762fec16 100644 (file)
@@ -1,3 +1,18 @@
+
+1.1:
+               
+
+------------------
+1.0:
+
+pl 27-1,2 (not released)
+       patches by JCN
+       - stringutils.cc included again 
+       - bin2hex_str bugfix
+       - String class handles null bytes
+       - StringUtils inlined/outlined by #define
+       - StringConversion (only hex for now)
+
 pl 27
        - (temporarily?) removed findcursor* t*mat*
 
@@ -14,4 +29,4 @@ pl 23
        - win32 patches (JN)
 
 pl 22
-       - Array::add -> Array::push
\ No newline at end of file
+       - Array::add -> Array::push
index 23d5164f0a9c99548e71cd1124229740f61390e1..4b7cca4ec6fc5a9cda46ff8f8808c7856e64a9a7 100644 (file)
@@ -1,6 +1,7 @@
 
-cc=choleski.cc dataf.cc dstream.cc lgetopt.cc matdebug.cc matrix.cc\
-path.cc scalar.cc smat.cc string.cc textdb.cc unionfind.cc vector.cc
+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\
+textdb.cc textstream.cc unionfind.cc vector.cc 
 
 templatecc=cursor.tcc list.tcc plist.tcc interval.tcc\
        pcursor.tcc
@@ -9,5 +10,8 @@ inl=link.inl list.inl  cursor.inl plist.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 stringutil.hh textdb.hh textstr.hh unionfind.hh\
-varray.hh vector.hh vsmat.hh
+smat.hh string.hh stringconversion.hh stringutil.hh \
+textdb.hh textstream.hh unionfind.hh\
+varray.hh vector.hh vsmat.hh datafile.hh
+
+extra=stringtest.cc
index 6d0cec88bde3e83fe959ec39984e9449af1bdc46..d2a35182bdac3a7981dab269dd45367b9fcdd6df 100644 (file)
@@ -1,12 +1,12 @@
 MAJVER=1
-MINVER=0
-PATCHLEVEL=27
+MINVER=1
+PATCHLEVEL=0
 
 PACKAGENAME=flower
 
 #PROFILEFLAG=-pg
-DEBUGFLAG= -O2 -DNDEBUG # -g
-OPTIFLAG=-DNDEBUG -DNPRINT -O2
+DEBUGFLAG= -g
+OPTIFLAG= -DNPRINT -O2 -DSTRING_UTILS_INLINED -DNDEBUG 
 
 #########################################
 
@@ -32,7 +32,7 @@ include Sources.make
 
 obs=$(cc:.cc=.o)
 staticlib=libflower.a
-ALLSOURCES=$(hh) $(cc) $(inl) $(templatecc) 
+ALLSOURCES=$(hh) $(cc) $(inl) $(templatecc) $(extra)
 DFILES=$(ALLSOURCES) Makefile Variables.make make_version\
        Sources.make TODO README NEWS
 DDIR=$(DNAME)
diff --git a/flower/dataf.cc b/flower/dataf.cc
deleted file mode 100644 (file)
index 29b366c..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-#include <fstream.h>
-#include <ctype.h>
-
-#include "textstr.hh"
-Text_stream::Text_stream(String fn)
-{      
-        if (fn == "") 
-           {
-           name = "<STDIN>";       
-           f = stdin;
-           }
-       
-       else 
-           {
-           name = fn;      
-           f = fopen(fn, "r");
-           }
-       
-       if (!f) {
-           cerr <<__FUNCTION__<< ": can't open `" << fn << "'\n";
-           exit(1);
-       }
-
-       line_no = 1;
-    }
-
-void
-Text_stream::message(String s)
-{
-    cerr << "\n"<<get_name() << ": " << line()<<": "<<s<<endl;
-}
-
-void 
-Data_file::gobble_white()
-{
-    char c;
-    
-    while ((c=data_get()) == ' ' ||c == '\t')
-       if (eof()) 
-           break;
-
-    data_unget(c);
-}
-
-String
-Data_file::get_word() 
-{// should handle escape seq's
-    String s;
-
-    while (1) 
-       {
-       char    c  = data_get();
-       
-       if (isspace(c) || eof()) 
-           {
-           data_unget(c);
-           break;
-           }
-       
-       
-       if (c == '\"')
-           {
-           rawmode= true;
-
-           while ((c  = data_get()) != '\"')
-               if (eof())
-                   error("EOF in a string");           
-               else
-                   s += c;
-           
-
-           rawmode= false;
-           }       
-       else
-           s += c;             
-       }
-    
-    return s;        
-}
-
-/**  get a char 
-   Only class member who uses text_file::get
-   */
-char
-Data_file::data_get() {
-    char c =  get(); 
-    if (!rawmode && c == '#') // gobble comment
-       {       
-       while ((c = get()) != '\n' && !eof()) 
-           ;
-           return '\n';
-       }    
-
-    return c;
-}
-
-/// read line, gobble '\n'    
-String Data_file::get_line()     
-{
-    char c; 
-    String s;
-
-    while ((c  = data_get()) != '\n' && !eof())
-       s += c;
-    return s;  
-}
-
-/// gobble stuff before first entry on a line.    
-void
-Data_file::gobble_leading_white() 
-{
-    // eat blank lines.
-    while (!eof()) {
-       char c = data_get();                
-       if (!isspace(c)) {
-           data_unget(c);
-           break;
-       }
-    }
-}
-
-
diff --git a/flower/datafile.cc b/flower/datafile.cc
new file mode 100644 (file)
index 0000000..e5940b4
--- /dev/null
@@ -0,0 +1,95 @@
+#include <fstream.h>
+#include <ctype.h>
+
+#include "datafile.hh"
+
+void 
+Data_file::gobble_white()
+{
+    char c;
+    
+    while ((c=data_get()) == ' ' ||c == '\t')
+       if (eof()) 
+           break;
+
+    data_unget(c);
+}
+
+String
+Data_file::get_word() 
+{// should handle escape seq's
+    String s;
+
+    while (1) 
+       {
+       char    c  = data_get();
+       
+       if (isspace(c) || eof()) 
+           {
+           data_unget(c);
+           break;
+           }
+       
+       
+       if (c == '\"')
+           {
+           rawmode= true;
+
+           while ((c  = data_get()) != '\"')
+               if (eof())
+                   error("EOF in a string");           
+               else
+                   s += c;
+           
+
+           rawmode= false;
+           }       
+       else
+           s += c;             
+       }
+    
+    return s;        
+}
+
+/**  get a char 
+   Only class member who uses text_file::get
+   */
+char
+Data_file::data_get() {
+    char c =  get(); 
+    if (!rawmode && c == '#') // gobble comment
+       {       
+       while ((c = get()) != '\n' && !eof()) 
+           ;
+           return '\n';
+       }    
+
+    return c;
+}
+
+/// read line, gobble '\n'    
+String Data_file::get_line()     
+{
+    char c; 
+    String s;
+
+    while ((c  = data_get()) != '\n' && !eof())
+       s += c;
+    return s;  
+}
+
+/// gobble stuff before first entry on a line.    
+void
+Data_file::gobble_leading_white() 
+{
+    // eat blank lines.
+    while (!eof()) {
+       char c = data_get();                
+       if (!isspace(c)) {
+           data_unget(c);
+           break;
+       }
+    }
+}
+
+
diff --git a/flower/datafile.hh b/flower/datafile.hh
new file mode 100644 (file)
index 0000000..14d5736
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+  datafile.hh -- declare Data_file
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef DATAFILE_HH
+#define DATAFILE_HH
+
+#include "textstream.hh"
+
+/// read a data file
+class Data_file : private Text_stream
+{
+    
+ public:
+    bool rawmode;
+
+    Text_stream::line;    
+    Text_stream::eof;
+    Text_stream::get_name;    
+
+    char data_get();    
+    void data_unget(char c) {
+       unget(c);
+    }
+
+    /// read line, eat #\n#
+    String get_line();
+    
+    /// read a word till next space, leave space. Also does quotes
+    String get_word();
+
+    /// gobble horizontal white stuff.
+    void gobble_white();
+
+    /// gobble empty stuff before first field.
+    void gobble_leading_white();
+    Data_file(String s) : Text_stream(s) {
+       //*mlog << "(" << s << flush;   
+       rawmode=  false;        
+    }
+
+    ~Data_file()  {
+       //      *mlog << ")"<<flush;    
+    }    
+
+    warning(String s) {
+       message("warning: " + s);
+    }
+    error(String s){
+       message(s);
+       exit(1);    
+    }
+};
+#endif // DATAFILE_HH
index b045a0f455bf4d53cf4a5fff7c89cd7693e52bb6..92790b5a08113c425aa9ca4d31bdb8fde5ae0c74 100644 (file)
@@ -100,9 +100,9 @@ Dstream::Dstream(ostream *r, const char * cfg_nm )
 {
     os = r;
     silent = new Assoc<String,bool>;
+    indentlvl = 0;
     if (!os)
        return;
-    indentlvl = 0;
     
     const char * fn =cfg_nm ? cfg_nm : ".dstreamrc";
     {
index 4c7866f09372fa8742277420556bb5f88f5956e4..1a5d8679037cd795fa77f376899cbb47cd453eb8 100644 (file)
@@ -1,8 +1,10 @@
 #include "dstream.hh"
 #include "matrix.hh"
 
-static Dstream *dout = new Dstream(0,0);
-
+static Dstream *dout = 0;
+/**
+  Set the debugging output. Will not delete/swallow argument.
+ */
 void set_matrix_debug(Dstream&ds)
 {
     dout = &ds;
@@ -10,8 +12,9 @@ void set_matrix_debug(Dstream&ds)
 
 Matrix::operator String() const
 {
-    String s("matrix {\n");
+    String s;
 #ifndef NPRINT
+    s="matrix {\n";
     for (int i=0; i< rows(); i++){
        for (int j = 0; j < cols(); j++) {
            s+= String(dat->elem(i,j), "%6f ");
@@ -28,19 +31,22 @@ void
 Matrix::print() const
 {
 #ifndef NPRINT
+    if (!dout)
+       return;
     *dout << *this;
 #endif
 }
 
 Vector::operator String() const
 {
-    String s("vector [");
+    String s;
 #ifndef NPRINT
+    s="vector [";
     for (int i=0; i < dim(); i++) {
        s += String(dat[i], "%6f") + String(' ');
     }
-#endif
     s+="]";
+#endif
     return s;
 }
 
@@ -49,6 +55,8 @@ void
 Vector::print() const
 {
 #ifndef NDEBUG
+    if (!dout)
+       return;
     *dout << *this<<'\n';
 #endif
 }
index d8e6f9e74b927876f92c384d339daba951be650d..044b4d0b0fe7a1bae4193cfe9aadd0429255d17c 100644 (file)
@@ -1,3 +1,4 @@
+#include <assert.h>
 #include <stdio.h>
 #include "scalar.hh"
 
@@ -26,7 +27,7 @@ Scalar::isnum()
     int conv = false;
     if (len()) {
        long l =0;
-       conv = sscanf(data, "%ld", &l);
+       conv = sscanf(strh_.ch_c_l(), "%ld", &l);
     }
     return len() && conv;
 }
index 9c7f2d0801e0ce350ed776eae5385bb5e0ec223e..8a53710dcb34ee804a3f36b0154815d9c4cfa382 100644 (file)
@@ -5,8 +5,7 @@
   Rehacked by HWN 3/nov/95
   removed String &
   introduced Class String_handle
-
-*/
+  */
 
 #include <string.h>
 #include <stdlib.h>
@@ -17,7 +16,8 @@
 #include "string.hh"
 
 
-static char* strlwr( char* s )
+static char* 
+strlwr( char* s )
 {
     char* p = s;
 
@@ -29,7 +29,8 @@ static char* strlwr( char* s )
     return s;
 }
 
-static char* strupr( char* s )
+static char* 
+strupr( char* s )
 {
     char* p = s;
 
@@ -56,41 +57,51 @@ String::String(Rational r)
 }
 
 // return array, alloced with new.
-char *
-String::copy_array() const
+Byte*
+String::copy_by_p() const
 {
-    const char *src = data;
-    char *dest = new char[data.len() + 1];
-    strcpy(dest, src);
+    Byte const* src = strh_.by_c_l();
+    Byte* dest = new Byte[strh_.length_i() + 1];
+    memmove( dest, src, strh_.length_i() + 1 );
     return dest;    
 }
 
 void
 String::printOn(ostream& os) const
 {
-    os << (const char*) data;
+    if ( length_i() == strlen( ch_c_l() ) )
+        os << ch_c_l();
+    else
+       for ( int i = 0; i < length_i(); i++ )
+           os << (Byte)(*this)[ i ];
 }
 
 String::String (bool b)
 {
-    *this = (const char *) (b ? "true" : "false");
+    *this = (char const* ) (b ? "true" : "false");
 }
-String::String( const char* source )
+String::String( char const* source )
 {   
     assert(source);    
-    data = source;    
+    strh_ = source;    
+}
+
+String::String( Byte const* by_l, int length_i )
+{   
+    assert( !length_i || by_l );
+    strh_.set( by_l, length_i );    
 }
 
 void
 String::operator +=(String s)
 {
-    *this += (const char *) s;
+    strh_.append( s.by_c_l(), s.length_i() );
 }
 
 int
-String::len() const
+String::length_i() const
 {
-    return data.len();
+    return strh_.length_i();
 }
 
 String::String(char c,  int n)
@@ -101,18 +112,19 @@ String::String(char c,  int n)
     char s[81];
     memset(s, c, l);
     s[l] = 0;
-    data = s;
+//    strh_ = s;
+    strh_.set( (Byte*)s, n );
 }
 
 String::String(int i)
 {
-    char digits[ 81 ];             // who the FUCK is 80???
+    char digits[ 81 ];             // who the fuck is 80???
     digits[ 0 ] = '\0';
     sprintf(digits, "%d", i );     // assume radix 10
-    data = digits;
+    strh_ = digits;
 }
 
-String::String( const int i, const int n, const char c )
+String::String( const int i, const int n, char const c )
 {
     char fillChar = c;
     if ( fillChar)
@@ -120,39 +132,66 @@ String::String( const int i, const int n, const char c )
 
     String v( i );
     
-    data = String( fillChar, n - v.len() ) + String( v );
-    // String convd to const char *
+    String str = String( fillChar, n - v.length_i() ) + String( v );
+    strh_.set( str.by_c_l(), str.length_i() );
 }
 
-const char*
-String::cptr() const
+Byte const*
+String::by_c_l() const
 {
-    return data;
+    return strh_.by_c_l();
 }
 
+char const*
+String::ch_c_l() const
+{
+    return strh_.ch_c_l();
+}
 
+Byte*
+String::by_l()
+{
+    return strh_.by_l();
+}
+
+char*
+String::ch_l()
+{
+    return strh_.ch_l();
+}
 
-// signed comparison,  analogous to strcmp;
+// signed comparison,  analogous to memcmp;
 int
-String::compare(const String& s1,const  String &s2 ) 
+String::compare(String const& s1, String const& s2 ) 
 {
-    const char * p1=s1.cptr();
-    const char * p2 = s2.cptr();
-    if (p1 == p2)
+    Byte const* p1 = s1.by_c_l();
+    Byte const* p2 = s2.by_c_l();
+    if ( p1 == p2 )
        return 0;
 
-    return strcmp(p1,p2);
+    int i1 = s1.length_i();
+    int i2 = s2.length_i();
+    int i = i1 <? i2;
+
+    if (! i ) 
+       return 0;
+       
+    int result =  memcmp( p1, p2, i );
+    
+    return (result)? result : i1 - i2;
 }
 
 
 int
-String::lastPos( const char c ) const
+String::lastPos( char const c ) const
 {
-    const char *me = data;
+    // not binary safe
+    assert( length_i() == strlen( ch_c_l() ) );
+    char const* me = strh_.ch_c_l();
     int pos = 0;
-    if ( len() )
+    if ( length_i() )
         {
-       const char* p = strrchr(me, c );
+       char const* p = strrchr(me, c );
         if ( p )
             pos = p - me + 1;
         }
@@ -160,17 +199,19 @@ String::lastPos( const char c ) const
 }
 
 int
-String::lastPos( const char* string ) const
+String::lastPos( char const* string ) const
 {
+    // not binary safe
+    assert( length_i() == strlen( ch_c_l() ) );
     int pos = 0;
     int length = strlen( string );
-    if ( len() && length )
+    if ( length_i() && length )
         {
         int nextpos = this->pos( string );
         while( nextpos )
             {
             pos += nextpos;
-            nextpos = right( len() - pos - length + 1 ).pos( string );
+            nextpos = right( length_i() - pos - length + 1 ).pos( string );
             }
         }
     return pos;
@@ -179,15 +220,17 @@ String::lastPos( const char* string ) const
 // find c
 // return 0 if not found. 
 
-// ? should return len()?, as in string.left(pos(delimiter))
+// ? should return length_i()?, as in string.left(pos(delimiter))
 int
 String::pos(char c ) const
 {
-    const char *me = data;
+    // not binary safe
+    assert( length_i() == strlen( ch_c_l() ) );
+    char const* me = strh_.ch_c_l();
     int pos = 0;
-    if ( len() )
+    if ( length_i() )
         {
-       const char* p = strchr( me, c );
+       char const* p = strchr( me, c );
         if ( p )
             pos = p - me + 1;
         }
@@ -196,13 +239,15 @@ String::pos(char c ) const
 
 // find searchfor. (what if this == "" && searchfor == "") ???
 int
-String::pos( const char* searchfor ) const
+String::pos( char const* searchfor ) const
 {
-    const char *me = data;
+    // not binary safe
+    assert( length_i() == strlen( ch_c_l() ) );
+    char const* me = strh_.ch_c_l();
     int pos = 0;
-    if ( len() && searchfor)
+    if ( length_i() && searchfor)
         {
-       const char* p = strstr(me, searchfor);
+       char const* p = strstr(me, searchfor);
         if ( p )
            pos = p - me + 1;
         }
@@ -211,13 +256,15 @@ String::pos( const char* searchfor ) const
 
 // find chars of a set.
 int
-String::posAny( const char* string ) const
+String::posAny( char const* string ) const
 {
+    // not binary safe
+    assert( length_i() == strlen( ch_c_l() ) );
     int pos = 0;
-    const char *s = (const char *)data;
-    if ( len() && string )
+    char const* s = (char const* )strh_.ch_c_l();
+    if ( length_i() && string )
         {
-       const char* p = strpbrk( s, string );
+       char const* p = strpbrk( s, string );
         if ( p )
            pos = p - s + 1;
         }
@@ -227,7 +274,7 @@ String::posAny( const char* string ) const
 String
 String::left( int n ) const
 {
-    if (n >= len())
+    if (n >= length_i())
        return *this;
 
     String retval;     
@@ -235,7 +282,7 @@ String::left( int n ) const
         return retval;
     
     retval = *this;
-    retval.data.trunc(n);
+    retval.strh_.trunc(n);
     return retval;
 }
 
@@ -244,17 +291,13 @@ String::left( int n ) const
 String
 String::right( int n ) const
 {
-    if (n > len())
+    if (n > length_i())
        return *this;
     
-    String retval;
     if ( n < 1)
-        return retval;
+        String(); 
     
-    const char *src = (const char *)data + len() - n; 
-    retval += src;
-
-    return retval;
+    return String( strh_.by_c_l() + length_i() - n, n ); 
 }
 
 
@@ -265,29 +308,27 @@ String::nomid( const int pos, const int n ) const
         
     if ( pos < 1 )
         return String("");
-    if ( pos > len())
+    if ( pos > length_i())
        return *this;
     
-    return String( String( left( pos - 1 ) ) + right( len() - pos - n + 1 ));
+    return String( String( left( pos - 1 ) ) + right( length_i() - pos - n + 1 ));
 }
 
 
 String
 String::mid( int pos, int n ) const
 {
-    String retval;
-
-    // HWN. This SUX:
-    // pos 1 == data->string[ 0 ];
+    // HWN. This SUX: JCN: yep, please change me + all my invocations
+    // pos 1 == strh_->string[ 0 ];
     // pos 0 allowed for convenience
-    if ( !len() || ( pos < 0 ) || ( pos > len() ) && ( n < 1 ) )
-        return retval;
+    if ( !length_i() || ( pos < 0 ) || ( pos > length_i() ) && ( n < 1 ) )
+        return String();
 
-    retval = ((const char *) data) + pos -1;
-    if (n > retval.len())
-       n =retval.len();
-    retval.data.trunc(n);
-    return retval;
+    // overflow...
+    if ( ( n > length_i() ) ||  ( pos + n - 1 > length_i() ) )
+       n = length_i() - pos + 1;
+
+    return String( by_c_l() + pos -1, n );
 }
 
 
@@ -295,24 +336,29 @@ String::mid( int pos, int n ) const
 String
 String::upper()
 {
-    char *s = data.array_for_modify();
-    strupr(s );
+    // not binary safe
+    assert( length_i() == strlen( ch_c_l() ) );
+    char *s = strh_.by_l();
+    strupr( s );
     return *this;
 }
 
 
 // to lowercase
-String String::lower()
+String 
+String::lower()
 {
-    char  *s = data.array_for_modify();
+    // not binary safe
+    assert( length_i() == strlen( ch_c_l() ) );
+    char* s = strh_.by_l();
     strlwr(s);
     return *this;
 }
 
-String::String (double f, const char *fmt)
+String::String (double f, char const* fmt)
 {
     /* worst case would be printing HUGE (or 1/HUGE), which is approx
-      2e318, this number would have approx 318 zero's in its string.
+       2e318, this number would have approx 318 zero's in its string.
 
       1024 is a safe length for the buffer
       */
@@ -329,8 +375,8 @@ long
 String::value() const
 {
     long l =0;
-    if (len()) {
-       int conv = sscanf(data, "%ld", &l);
+    if (length_i()) {
+       int conv = sscanf(strh_.ch_c_l(), "%ld", &l);
        assert(conv);
     }
     return l;
@@ -340,8 +386,8 @@ double
 String::fvalue() const
 {
     double d =0;
-    if (len()) {
-       int conv = sscanf(data, "%lf", &d);
+    if (length_i()) {
+       int conv = sscanf(strh_.ch_c_l(), "%lf", &d);
        assert(conv);
     }
     return d;
@@ -354,26 +400,26 @@ String quoteString( String msg, String quote)
 }
 
 
-char *strrev(char *s)
+Byte*
+strrev( Byte* by_l, int length_i )
 {
-  char c;
-  char *p = s;
-  char *q = s + strlen(s) - 1;
-
-  while (q > p) {
-    c = *p;
-    *p++ = *q;
-    *q-- = c;
+  Byte by;
+  Byte* left_by_l = by_l;
+  Byte* right_by_l = by_l + length_i;
+
+  while ( right_by_l > left_by_l ) {
+    by = *left_by_l;
+    *left_by_l++ = *right_by_l;
+    *right_by_l-- = by;
   }
-  return s;
+  return by_l;
 }
 
 
 String 
 String::reversed() const
 {
-    String retval=*this;
-    char  *s = retval.data.array_for_modify();
-    strrev(s);
-    return retval;    
+    String str = *this;
+    strrev( str.by_l(), str.length_i() );
+    return str;    
 }
index 420d5f959d85491096ad798696d3e034cd4bd5e8..23608994bf10cb6ec6a4c4efa93071d0d9f1f4df 100644 (file)
 
 #include "stringutil.hh"
 
-/**  the smart string class.  
-
+/** 
   Intuitive string class. provides 
-
+\begin{itemize}
+\item
   ref counting through #String_handle#
+\item
 
   conversion from bool, int, double, char *, char.
+\item
 
   conversion to int, upcase, downcase
 
+\item
 
   printable. 
 
+\item
   indexing (pos, posAny, lastPos)
 
+\item
   cutting (left, right, mid)
 
+\item
   concat (+=, +)
 
+\item
   signed comparison (<, >, ==, etc)
 
+\item
   No operator[] is provided, since this would be enormously  slow. If needed,
-  convert to const char *. 
+  convert to const char *.
+\end{itemize}
 */
 class String
 {
 protected:
-    String_handle data; // should derive String from String_handle?
+    String_handle strh_; // should derive String from String_handle?
 
 public:
-    /**  init to "".  needed because other constructors are provided.*/
+
+    /**   init to "". needed because other constructors are provided.*/
     String() {  }                  
     String(Rational);
     /// String s = "abc";
     String( const char* source ); 
+
+    String( Byte const* l_by_c, int length_i ); 
     
     /// "ccccc"
     String( char c, int n = 1 );
@@ -69,21 +82,23 @@ public:
     String(  int i,  int n,  char c = ' ' );
 
     ///  return a "new"-ed copy of contents
-    char *copy_array() const; //  return a "new"-ed copy of contents
+    Byte* copy_by_p() const; //  return a "new"-ed copy of contents
 
-    const char *cptr() const;
-    const char *ptr() { return ((const String *)this)->cptr(); }
+    char const* ch_c_l() const;
+    Byte const* by_c_l() const;
+    char* ch_l();
+    Byte* by_l();
 
-    /// return the data. Don't use for writing the data.
-    operator const char *() const { return cptr(); }
+    /// deprecated; use ch_c_l()
+    operator const char *() const { return ch_c_l(); }
     
-    String operator =( const String & source ) { data = source.data; return *this; }
+    String operator =( const String & source ) { strh_ = source.strh_; return *this; }
 
     /// concatenate s
-    void operator += (const char *s) { data += s; }
+    void operator += (char const* s) { strh_ += s; }
     void operator += (String s);
 
-    char operator []( int n ) const { return data[n]; }
+    char operator []( int n ) const { return strh_[n]; }
 
     /// return n leftmost chars
     String left( int n ) const;
@@ -101,13 +116,13 @@ public:
     String reversed() const;
 
 
-    /// return a piece starting at pos (first char = pos 1), length n
+    /// return a piece starting at pos (first char = pos 1), ength n
     String mid(int pos,  int n ) const;
 
     /// cut out a middle piece, return remainder
     String nomid(int pos, int n ) const;
 
-    /// signed comparison,  analogous to strcmp;
+    /// signed comparison,  analogous to memcmp;
     static int compare(const String& s1,const  String& s2);
        
     /// index of rightmost c 
@@ -116,8 +131,10 @@ public:
     /// index of rightmost element of string 
     int lastPos( const char* string ) const;
 
-    /**  index of leftmost c. 
-    RETURN:
+    /**
+      index of leftmost c.
+      
+    @return
     0 if not found, else index + 1
     */
     int pos(char c ) const;
@@ -135,7 +152,12 @@ public:
     double fvalue() const;
     
     /// the length of the string
-    int len() const;
+    int length_i() const;
+
+    // deprecated 
+    int len() const {
+       return length_i();
+    }
 
 };
 
@@ -176,4 +198,6 @@ operator << ( ostream& os, String d )
 
 String quoteString(String message, String quote);
 
+#include "stringconversion.hh"
+
 #endif
diff --git a/flower/stringconversion.cc b/flower/stringconversion.cc
new file mode 100644 (file)
index 0000000..7a9d1f4
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+  PROJECT: FlowerSoft C++ library
+  FILE   : stringconversion.cc
+
+--*/
+
+
+#include <assert.h>
+#include "string.hh"
+
+String
+StringConversion::bin2hex_str( String bin_str )
+{
+    String str;
+    Byte const* by_c_l = bin_str.by_c_l();
+    for ( int i = 0; i < bin_str.length_i(); i++ ) {
+       str += (char)nibble2hex_by( *by_c_l >> 4 );
+       str += (char)nibble2hex_by( *by_c_l++ );
+    }
+    return str;
+}
+
+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* by_c_l= hex_str.by_c_l();
+    int i = 0;
+    while ( i < hex_str.length_i() ) {   
+        int high_i = hex2nibble_i( *by_c_l++ );
+        int low_i = hex2nibble_i( *by_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
new file mode 100644 (file)
index 0000000..39b809e
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+  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 )
+  Quite empty
+  */
+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 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 //
diff --git a/flower/stringtest.cc b/flower/stringtest.cc
new file mode 100644 (file)
index 0000000..71c1557
--- /dev/null
@@ -0,0 +1,43 @@
+// stringtest.cc
+
+#include <iostream.h>
+#include "string.hh"
+
+int 
+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 << "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;
+
+    str += " daar";
+    cout << str << endl;
+
+    str = String( "hallo" ) + " daar" + '!';
+    cout << str << endl;
+
+    if ( str == String( "" ) )
+        cout << str << " is empty" << endl;
+    String fn = "";
+    if ( fn == "" )
+        cout << fn << " is empty" << endl;
+
+    fn = "";
+    fn += "";
+    delete fn.copy_by_p();
+
+    delete str.copy_by_p();
+
+    cout << StringConversion::bin2hex_str( String( (char)0xff ) ) << endl;
+}
diff --git a/flower/stringutil.cc b/flower/stringutil.cc
new file mode 100644 (file)
index 0000000..bca803a
--- /dev/null
@@ -0,0 +1,340 @@
+// stringutil.cc
+#ifndef __STRING_UTIL_CC
+#define __STRING_UTIL_CC
+
+// include only when 
+// *  reading stringutil.hh, or 
+// *  string util stuff not inlined
+#if !defined STRING_UTILS_INLINED
+
+#include <assert.h>
+#include <memory.h>
+#include "stringutil.hh"
+
+
+// namespace StringData { namespaces are broken in this version of g++ 
+// gcc version 2.7.2.1
+
+
+StringData::StringData() 
+{
+    references=0;
+    maxlen = INITIALMAX;
+    data_by_p_ = new Byte[maxlen + 1];
+    data_by_p_[0] = 0;
+    length_i_ = 0;
+}
+
+StringData::StringData(StringData const &src) 
+{
+    references=0;      
+    maxlen = length_i_ = src.length_i_;                
+    data_by_p_ = new Byte[maxlen+1]; // should calc GNU 8byte overhead.        
+    memmove( data_by_p_, src.data_by_p_, length_i_ + 1 );      
+}
+
+
+StringData::~StringData() 
+{
+    assert(references == 0);
+    delete[] data_by_p_;
+}
+
+void 
+StringData::setmax(int j) 
+{      
+    OKW();
+    if (j > maxlen) {
+       delete data_by_p_;
+       maxlen = j;
+       data_by_p_ = new Byte[maxlen + 1];
+    
+       data_by_p_[0] = 0;
+       length_i_ = 0;
+    }
+}
+
+
+void 
+StringData::remax(int j) 
+{
+    OKW();
+    if (j > maxlen) {
+       maxlen = j;
+       Byte *p = new Byte[maxlen + 1];     
+       memmove( p, data_by_p_, length_i_ + 1 );            
+       delete[] data_by_p_;
+       data_by_p_ = p;
+    //    length_i_ = strlength_i(data_by_p_);
+    }
+}
+
+
+void 
+StringData::OKW() 
+{
+    assert (references == 1);
+}
+
+void 
+StringData::OK() 
+{
+// can-t do this with binary data
+//     assert(strlen(data_by_p_) == size_t(length_i_));
+    assert(maxlen >= length_i_);
+    assert(bool(data_by_p_));
+    assert(references >= 1);
+}
+
+//    // needed?
+// well, we can't -> depreciated
+//    void update() {
+//     length_i_  = strlen (data_by_p_);
+//    }
+
+
+void 
+StringData::tighten() 
+{ // should be dec'd const
+    maxlen = length_i_;
+    Byte *p = new Byte[maxlen + 1];        
+    memmove( p, data_by_p_, length_i_ + 1 );       
+    delete[] data_by_p_;
+    data_by_p_ = p;            
+}
+
+// assignment.
+void 
+StringData::set( Byte const* by_c_l, int length_i ) 
+{
+    OKW();
+
+    assert( by_c_l && by_c_l != data_by_p_);
+
+    length_i_ = length_i;
+    remax( length_i_ );
+    memmove( data_by_p_, by_c_l, length_i_ );
+    data_by_p_[ length_i_ ] = 0;
+}
+
+
+void 
+StringData::set( char const* ch_c_l ) 
+{
+    set( (Byte const*)ch_c_l, strlen( ch_c_l ) );
+}
+
+
+/// concatenation.
+void 
+StringData::append( Byte const* by_c_l, int length_i ) 
+{
+    OK();
+    OKW();
+    int old_i = length_i_;
+    
+    length_i_ += length_i;
+    remax( length_i_ );
+    memmove( data_by_p_ + old_i, by_c_l, length_i );   
+    data_by_p_[ length_i_ ] = 0;
+}
+
+
+void 
+StringData::operator += ( char const* ch_c_l ) 
+{
+    append( (Byte const*)ch_c_l, strlen( ch_c_l ) );
+}
+
+char const*
+StringData::ch_c_l() const
+{
+    return (char const*)data_by_p_; 
+}
+
+char* 
+StringData::ch_l() 
+{ 
+    return (char*)data_by_p_; 
+}
+
+Byte const*
+StringData::by_c_l() const 
+{ 
+    return data_by_p_; 
+}
+
+// idem, non const
+Byte* 
+StringData::by_l() 
+{
+    OKW();
+    return data_by_p_;
+}
+
+void 
+StringData::trunc(int j) 
+{
+    OKW(); 
+    assert(j >= 0 && j <= length_i_);
+    data_by_p_[j] = 0;
+    length_i_ = j;
+}
+
+Byte&
+StringData::operator [](int j) 
+{
+    assert(j >= 0 && j <= length_i_);
+    return data_by_p_[j] ; 
+}
+
+Byte 
+StringData::operator [](int j) const 
+{
+    assert(j >= 0 && j <= length_i_);
+    return data_by_p_[j]; 
+}
+
+
+// } namespace broken
+
+
+
+
+// namespace String_handle {
+
+
+void 
+String_handle::down() 
+{ 
+    if (!(--data->references)) delete data; data = 0; 
+}
+
+/// increase ref count
+void 
+String_handle::up(StringData *d) 
+{ 
+    data=d; data->references ++; 
+}
+
+void 
+String_handle::copy() 
+{
+    if (data->references !=1){
+       StringData *newdata = new StringData(*data);
+       down();
+       up(newdata);
+    }
+}
+
+String_handle::String_handle() 
+{
+    up(new StringData);
+}
+String_handle::~String_handle() 
+{      
+    down();
+}    
+String_handle::String_handle(String_handle const & src) 
+{      
+    up(src.data);
+}
+
+Byte* 
+String_handle::by_l() 
+{
+    copy();
+    return data->by_l();
+}
+
+char* 
+String_handle::ch_l() 
+{
+    copy();
+    return (char*)data->by_l();
+}
+
+Byte 
+const* String_handle::by_c_l() const 
+{
+    return data->by_c_l();
+}
+
+char const* 
+String_handle::ch_c_l() const 
+{
+    return (char const*)data->by_c_l();
+}
+
+void 
+String_handle::operator =(String_handle const &src) 
+{
+    if (this == &src)
+       return;
+    down();
+    up(src.data);
+}
+
+void 
+String_handle::operator += (char const *s) 
+{      
+    copy();
+    *data += s;
+}    
+
+
+Byte 
+String_handle::operator[](int j) const 
+{ 
+    return (*data)[j]; 
+}
+
+// !NOT SAFE!
+// don't use this for loops. Use by_c_l()
+Byte &
+String_handle::operator[](int j) 
+{
+    copy();    // hmm. Not efficient
+    return data->by_l()[j];
+}
+
+void 
+String_handle::append( Byte const* by_c_l, int length_i ) 
+{
+    copy();
+    data->append( by_c_l, length_i );
+}
+                          
+void 
+String_handle::set( Byte const* by_c_l, int length_i ) 
+{
+    copy();
+    data->set( by_c_l, length_i );
+}
+                          
+void 
+String_handle::operator = (char const *p) 
+{
+    copy();
+    data->set( p );
+}
+                          
+void 
+String_handle::trunc(int j) 
+{
+    copy(); data->trunc(j); 
+}
+
+int 
+String_handle::length_i() const 
+{ 
+    return data->length_i_; 
+}
+
+
+// } namespaces broken
+
+
+#endif // not STRING_UTILS_INLINED //
+
+#endif // __STRING_UTIL_CC //
index 2f62caee3d73564cd41bdaf0863680071b897243..728ce9bb306c93395fa0dbf6e64ee52339835079 100644 (file)
-#ifndef STRINGUTIL_HH
-#define STRINGUTIL_HH
-#include <assert.h>
-
+#ifndef __STRING_UTIL_HH
+#define __STRING_UTIL_HH
+#if 0
 #if !defined(NDEBUG)
 #define NDEBUG BLONDE
 #endif
-
+#endif
 const INITIALMAX=8;
 class String_handle;
 
-/**  Internal String struct. 
+
+typedef unsigned char Byte;
+
+#ifdef STRING_UTILS_INLINED
+#define INLINE inline
+#else
+#define INLINE
+#endif
+
+/**Internal String struct.
    the data itself. Handles simple tasks (resizing, resetting)
    */
-
 class StringData {
     // GNU malloc: storage overhead is 8 bytes anyway.
 
-
 friend class String_handle;
     int maxlen;        // maxlen is arraysize-1
     
-    int length;
-    char* string;
+    int length_i_;
+    Byte* data_by_p_;
     int references;
 
     /// init to ""
-    StringData() {
-       references=0;
-       maxlen = INITIALMAX;
-       string = new char[maxlen + 1];
-       string[0] = 0;
-       length = 0;
-    }
+    INLINE StringData();
 
     /// init from src. Conservative allocation.
-    StringData(StringData const &src) {
-       references=0;   
-       maxlen = length = src.length;           
-       string = new char[maxlen+1]; // should calc GNU 8byte overhead.         
-       strcpy(string, src.string);     
-    }
+    INLINE StringData(StringData const &src); 
     
-    ~StringData() {
-       assert(references == 0);
-       delete[] string;
-    }
-
+    ~StringData();
 
     /** POST: maxlen >= j.
-      IN: j, maximum stringlength.    
+      IN: j, maximum stringlength_i_.    
       contents thrown away.
     */
-    void setmax(int j) {       
-       OKW();
-       if (j > maxlen) {
-           delete string;
-           maxlen = j;
-           string = new char[maxlen + 1];
-       
-           string[0] = 0;
-           length = 0;
-       }
-    }
+    INLINE void setmax(int j);
     
     /** POST: maxlen >= j.
-      IN: j, maximum stringlength.
+      IN: j, maximum stringlength_i_.
       contents are kept if it grows.
       */
-    void remax(int j) {
-       OKW();
-       if (j > maxlen) {
-           maxlen = j;
-           char *p = new char[maxlen + 1];         
-           strcpy(p,string);       
-           delete[] string;
-           string = p;
-       //    length = strlen(string);
-       }
-    }
-    /// check if writeable.
-    void OKW() {
-
-       assert (references == 1);
+    INLINE void remax(int j);
 
-    }
+    /// check if writeable.
+    INLINE void OKW();
 
     /// check state.
-    void OK() {
-       assert(strlen(string) == size_t(length));
-       assert(maxlen >= length);
-       assert(bool(string));
-       assert(references >= 1);
-    }
-
-    // needed?
-    void update() {
-       length  = strlen (string);
-    }
+    INLINE void OK();
 
     /// reduce memory usage.
-    void tighten() { // should be dec'd const
-       maxlen = length;
-       char *p = new char[maxlen + 1];     
-       strcpy(p,string);           
-       delete[] string;
-       string = p;             
-    }
+    INLINE void tighten();
 
     // assignment.
-    void set(const char *s) {
-       OKW();
-
-       assert(s);
+    INLINE void set( Byte const* by_c_l, int length_i );
 
-       length = strlen (s);
-       remax(length);
-       strcpy(string,s);
-    }
+    INLINE void set( char const* ch_c_l );
     
     /// concatenation.
-    void operator += (const char *s) {
-       OK();
-       OKW();
-       int old = length;
-       
-       length += strlen(s);
-       remax (length);
-       strcpy(string + old, s);        
-    }
-
-    /// the array itself
-    operator const char *() const { return string; }
+    INLINE void append( Byte const* by_c_l, int length_i );
+
+    INLINE void operator += ( char const* ch_c_l );
+
+    INLINE char const* ch_c_l() const; 
+
+    INLINE char* ch_l();
+
+    INLINE Byte const* by_c_l() const;
 
     // idem, non const
-    char *array_for_modify() {
-       OKW();
-       return string;
-    }
-    void trunc(int j) {
-       OKW(); 
-       assert(j >= 0 && j <= length);
-       string[j] = 0;
-       length = j;
-    }
-
-    /** access a char. not really safe. Can alter length without
-      *StringData knowing it. */
-    char &operator [](int j) {
-       assert(j >= 0 && j <= length);
-       return string[j] ; 
-    }
-
-    char operator [](int j) const {
-       assert(j >= 0 && j <= length);
-       return string[j]; 
-    }
+    INLINE Byte* by_l();
+
+    INLINE void trunc(int j);
+
+    /** not really safe. Can alter length_i_ without StringData knowing it.
+      */
+    INLINE Byte &operator [](int j);
+    INLINE Byte operator [](int j) const;
 };
 
 
 
-/**  ref. counting for strings. 
-   handles ref. counting, and provides a very thin
-   interface using char *
- */
+
+/**
+  Reference counting for strings.
+  
+   handles ref. counting, and provides a very thin interface using
+   Byte *
+
+   */
 class String_handle {
     StringData* data;
     
     /// decrease ref count. Named kind of like a Tanenbaum semafore 
-    void down() { if (!(--data->references)) delete data; data = 0; }
+    INLINE void down();
 
     /// increase ref count
-    void up(StringData *d) { data=d; data->references ++; }
+    INLINE void up(StringData *d);
     
     /** make sure data has only one reference.      
        POST: data->references == 1
       */
-    void copy() {
-       if (data->references !=1){
-           StringData *newdata = new StringData(*data);
-           down();
-           up(newdata);
-       }
-    }
+    INLINE void copy();
     
 public:
-
-    String_handle() {
-       up(new StringData);
-    }
-    ~String_handle() { 
-       down();
-    }    
-    String_handle(String_handle const & src) { 
-       up(src.data);
-    }
-
-    /// retrieve the actual array.
-    operator const char *() const { return *data; }    
-    char *array_for_modify() {
-       copy();
-       return data->array_for_modify();
-    }
-    
-    void operator =(String_handle const &src) {
-       if (this == &src)
-           return;
-       down();
-       up(src.data);
-    }
-    
-    void operator += (const char *s) { 
-       copy();
-       *data += s;
-    }    
-
-    
-    char operator[](int j) const { return (*data)[j]; }
-
-    // !NOT SAFE!
-    // don't use this for loops. Use array_for_modify()
-    char &operator[](int j) {
-       copy();         // hmm. Not efficient
-       return data->array_for_modify()[j];
-    }
-
-    void operator = (char const *p) {
-       copy();
-       data->set(p);
-    }
-                              
-    void trunc(int j) { copy(); data->trunc(j); }
-    int len() const { return data->length; }
+    INLINE String_handle();
+    INLINE ~String_handle();
+    INLINE String_handle(String_handle const & src);
+
+    INLINE Byte const* by_c_l() const;
+    INLINE char const* ch_c_l() const;
+    INLINE Byte* by_l();
+    INLINE char* ch_l();
+
+    INLINE void operator =(String_handle const &src);
+    INLINE void operator += (char const *s);
+    INLINE Byte operator[](int j) const;
+
+    /** Access elements. WARNING: NOT SAFE
+       don't use this for loops. Use by_c_l()
+       */
+    INLINE Byte &operator[](int j);
+    INLINE void append( Byte const* by_c_l, int length_i );
+    INLINE void set( Byte const* by_c_l, int length_i );
+    INLINE void operator = (char const *p);
+    INLINE void trunc(int j);
+    INLINE int length_i() const;
 };
 
+#if 0
 #ifdef NDEBUG
 #if (NDEBUG == BLONDE)
 #undef NDEBUG
 #endif
 #endif
+#endif
 
+#ifdef STRING_UTILS_INLINED
+#include "stringutil.cc"
+#endif
 
-
-#endif // STRINGUTIL_HH
+#endif // __STRING_UTIL_HH //
index 3586c0d180628fd611e3f99ef4a02e22592afa33..c2cff2461be07ba0319d0d06271350b9589b02d5 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef TEXTDB_HH
 #define TEXTDB_HH
 
-#include "textstr.hh"
+#include "datafile.hh"
 
 /**a "const" Array. Contents can't be changed. do "#" comments, read quote enclosed  fields */
 
diff --git a/flower/textstr.hh b/flower/textstr.hh
deleted file mode 100644 (file)
index 2d648d4..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-
-#ifndef TEXTSTR_HH
-#define TEXTSTR_HH
-
-#include <stdio.h>
-#include <ctype.h>
-#include "string.hh"
-#include "varray.hh"
-
-/**  line counting input stream. 
- a stream for textfiles. linecounting. Thin interface getchar and
- ungetchar.  (ungetc is unlimited) 
-
- should protect get and unget against improper use
-*/
-
-
-class Text_stream
-{
-    int line_no;
-
-    // could just have used streams. 
-    FILE *f;  
-    Array<char> pushback;
-    String name;
-    
- public:
-    Text_stream(String fn);
-    String get_name() { return name; }
-    bool eof() {
-       return feof(f);
-    }
-    bool eol() {
-       return (peek() == '\n');
-    }
-    char peek() {
-       char c = get();
-       unget(c);
-       return c;
-    }
-    int line(){
-       return line_no;
-    }
-
-    char    get() {
-       char c;
-       
-       if (pushback.empty())
-           c = getc(f);        
-       else 
-           c = pushback.pop();
-
-       if (c =='\n')
-           line_no++;
-       return c;       
-    }
-    void unget(char c) {
-       if (c =='\n')
-           line_no--;
-       pushback.push(c);
-    }
-    ~Text_stream (){
-       if (!eof()) 
-           cerr <<__FUNCTION__<< ": closing unended file";
-    
-       fclose(f);
-    }
-
-    /// GNU format message.
-    void message(String s); 
-};
-/// read a data file
-class Data_file : private Text_stream
-{
-    
- public:
-    bool rawmode;
-
-    Text_stream::line;    
-    Text_stream::eof;
-    Text_stream::get_name;    
-
-    char data_get();    
-    void data_unget(char c) {
-       unget(c);
-    }
-
-    /// read line, eat #\n#
-    String get_line();
-    
-    /// read a word till next space, leave space. Also does quotes
-    String get_word();
-
-    /// gobble horizontal white stuff.
-    void gobble_white();
-
-    /// gobble empty stuff before first field.
-    void gobble_leading_white();
-    Data_file(String s) : Text_stream(s) {
-       //*mlog << "(" << s << flush;   
-       rawmode=  false;        
-    }
-
-    ~Data_file()  {
-       //      *mlog << ")"<<flush;    
-    }    
-
-    warning(String s) {
-       message("warning: " + s);
-    }
-    error(String s){
-       message(s);
-       exit(1);    
-    }
-};
-#endif
diff --git a/flower/textstream.cc b/flower/textstream.cc
new file mode 100644 (file)
index 0000000..5ab3f3f
--- /dev/null
@@ -0,0 +1,31 @@
+#include "textstream.hh"
+
+Text_stream::Text_stream(String fn)
+{
+    ios::sync_with_stdio();
+    if (fn == "") 
+           {
+           name = "<STDIN>";       
+           f = stdin;
+           }
+       
+       else 
+           {
+           name = fn;      
+           f = fopen(fn, "r");
+           }
+       
+       if (!f) {
+           cerr <<__FUNCTION__<< ": can't open `" << fn << "'\n";
+           exit(1);
+       }
+
+       line_no = 1;
+    }
+
+void
+Text_stream::message(String s)
+{
+    cerr << "\n"<<get_name() << ": " << line()<<": "<<s<<endl;
+}
+
diff --git a/flower/textstream.hh b/flower/textstream.hh
new file mode 100644 (file)
index 0000000..437f869
--- /dev/null
@@ -0,0 +1,74 @@
+
+#ifndef TEXTSTR_HH
+#define TEXTSTR_HH
+
+#include <stdio.h>
+#include <ctype.h>
+#include "string.hh"
+#include "varray.hh"
+
+/**
+  line counting input stream. 
+  a stream for textfiles. linecounting. Thin interface getchar and
+  ungetchar.  (ungetc is unlimited) 
+  
+  should protect get and unget against improper use
+*/
+
+
+class Text_stream
+{
+    int line_no;
+
+    // could just have used streams. 
+    FILE *f;  
+    Array<char> pushback;
+    String name;
+    
+ public:
+    Text_stream(String fn);
+    String get_name() { return name; }
+    bool eof() {
+       return feof(f);
+    }
+    bool eol() {
+       return (peek() == '\n');
+    }
+    char peek() {
+       char c = get();
+       unget(c);
+       return c;
+    }
+    int line(){
+       return line_no;
+    }
+
+    char    get() {
+       char c;
+       
+       if (pushback.empty())
+           c = getc(f);        
+       else 
+           c = pushback.pop();
+
+       if (c =='\n')
+           line_no++;
+       return c;       
+    }
+    void unget(char c) {
+       if (c =='\n')
+           line_no--;
+       pushback.push(c);
+    }
+    ~Text_stream (){
+       if (!eof()) 
+           cerr <<__FUNCTION__<< ": closing unended file";
+    
+       fclose(f);
+    }
+
+    /// GNU format message.
+    void message(String s); 
+};
+
+#endif
index e5419da75929609a9e09544d532156e82bff1ee5..f9eef852fd5759a1d905580f1dbdb6f0b550d8a8 100644 (file)
@@ -84,8 +84,9 @@ struct Group_change_req : Nonmusical_req {
 /** draw a (repeat)-bar. This something different than #Barcheck_req#,
   the latter should only happen at the start of a measure.  */
 struct Bar_req : Nonmusical_req {
-    String type;
+    String type_str_;
     Bar_req(String);
+    int compare(const Bar_req&)const;
     REQUESTMETHODS(Bar_req,bar);
 };
 struct Terminate_voice_req : Nonmusical_req {
index f6855fcabee183aaac65d9a678030075860d0fe3..92715dbfdc1fab1d9387a494da1c7b5756acf78b 100644 (file)
@@ -22,12 +22,12 @@ extern ostream &warnout ;
 extern ostream *mlog;
 
 // debugging
-extern Dstream monitor; // monitor
+extern Dstream *monitor; // monitor
 
 #ifdef NPRINT
-#define mtor if (0) monitor    // clever hack 
+#define mtor if (0) *monitor   // clever hack 
 #else
-#define mtor if (check_debug) monitor.identify_as(__PRETTY_FUNCTION__)
+#define mtor if (check_debug) monitor->identify_as(__PRETTY_FUNCTION__)
 #endif
 
 extern bool check_debug;
index 13e8f4a3653ec7ee55f2760e496f8a408f17ac4f..da3030f11b28dea34d9b093663b640b906957f9a 100644 (file)
@@ -29,11 +29,14 @@ struct Voice_list : public PointerList<Voice*> {
   */
 struct Input_music {
     virtual Voice_list convert()const=0;
+    void check_plet(Voice_element* velt_l);
     virtual Moment length()const=0;
     virtual void translate_time(Moment dt)=0;
     virtual ~Input_music(){}
     virtual void print() const =0;
     virtual void set_default_group(String)=0;
+    virtual bool find_plet_start_bo(char c, Moment& moment_r) = 0;
+    virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i) = 0;
     // virtual void transpose(...) const =0;
     
     
@@ -53,6 +56,8 @@ struct Simple_music : Input_music {
     virtual Voice_list convert()const;
     virtual void translate_time(Moment dt);
     virtual void print() const;
+    virtual bool find_plet_start_bo(char c, Moment& moment_r);
+    virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i);
     virtual Input_music *clone() const {
        return new Simple_music(*this);
     }
@@ -69,6 +74,8 @@ struct Complex_music : Input_music {
     Complex_music(Complex_music const &);
     virtual void print() const ;
     void concatenate(Complex_music*);
+    virtual bool find_plet_start_bo(char c, Moment& moment_r);
+    virtual void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i);
  
 };
 
index 024c6d132c25d129780796c1ff4c6c1ff8c7837e..3b84d44fdb9b51d933c4f43ce24b39d1ea69d6ff 100644 (file)
@@ -24,6 +24,7 @@ struct Input_score {
     
     /// paper_, staffs_ and commands_ form the problem definition.
     Paperdef *paper_p_;
+    Mididef* midi_p_;
     IPointerList<Input_staff*> staffs_;
 
     Input_music * score_wide_music_p_;
@@ -36,6 +37,7 @@ struct Input_score {
     ~Input_score();
     /// construction
     void set(Paperdef*);
+    void set(Mididef* midi_p);
     void print() const;
     Score*parse();
     void set(Input_music*);
index 8f1e67123e9c20a69b79e979715f15d80c4c508b..ce760fe22dd4bb894151b9a41c4094778cb24412 100644 (file)
@@ -31,7 +31,6 @@ struct My_flex_lexer : yyFlexLexer {
     Assoc<String, Identifier*> *the_id_tab;
     Keyword_table * keytable;
     Notename_tab * defaulttab;
-    char const* data_ch_c_l_;
     int errorlevel_i_;
     /* *************** */
     int ret_notename(int *p, String text, int octave_mod);    
index a7202e593d53ba5b25398fa0313c0f1c7a787cb8..e7aaaafc86a87c52e989ba00c7d18984b907c768 100644 (file)
@@ -1,11 +1,11 @@
 //
 // lyriccolumn.hh -- declare Lyric_column
 //
-// copyright 1997 Jan Nieuwenhuizen <jan@digicash.nl>
+// copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
 
 
-#ifndef LYRICCOLUMN_HH
-#define LYRICCOLUMN_HH
+#ifndef LYRIC_COLUMN_HH
+#define LYRIC_COLUMN_HH
 
 #include "key.hh"
 #include "stcol.hh"
@@ -23,7 +23,7 @@ struct Lyric_column : Staff_column {
     Lyric_column(Lyric_staff*rs);
 };
 
-#endif // LYRICSTAFF_HH
+#endif // LYRIC_COLUMN_HH
 
 
 
index 5dcd90c8897d20b8c0dc35006e5a0ecc3662de27..46873d8f519536108729c5a39fe5fc216cc39d09 100644 (file)
@@ -1,7 +1,7 @@
 //
 //  lyricitem.hh -- part of LilyPond
 //
-//  copyright 1997 Jan Nieuwenhuizen <jan@digicash.nl>
+//  copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
 
 #ifndef LYRIC_ITEM_HH
 #define LYRIC_ITEM_HH
@@ -15,5 +15,5 @@ struct Lyric_item : Text_item {
 };
 
 
-#endif // LYRICITEM_HH
+#endif // LYRIC_ITEM_HH //
 
index 31cc62caaab75ae64ebcf67b28856dec6f6230a8..f7166bfc99b491e8694743389a75dd5fa090c6bc 100644 (file)
@@ -1,7 +1,7 @@
 /*
   lyricstaff.hh -- part of LilyPond
 
-  copyright 1997 Jan Nieuwenhuizen <jan@digicash.nl>
+  copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
   */
 
 #ifndef LYRICSTAFF_HH
index 5f413f2ab9569acff29dd7dc1c385168226dc651..f89be762496e79b687d5723bc9fad8cae87cbe82 100644 (file)
@@ -1,8 +1,8 @@
-/*
-  lyricwalker.hh -- declare Lyric_walker
-
-  (c) 1996,97 Han-Wen Nienhuys, Jan Nieuwenhuizen <jan@digicash.nl>
-*/
+//
+//  lyricwalker.hh -- declare Lyric_walker
+//
+//  (c) 1996,97 Han-Wen Nienhuys, Jan Nieuwenhuizen <jan@digicash.com>
+//
 
 #ifndef LYRICWALKER_HH
 #define LYRICWALKER_HH
index 2a864eb9efd4a3bc4e831d2c6c4db71d051b507d..240b72afd9c7cb96da5ec58a8d3cdc3923d42e61 100644 (file)
@@ -96,6 +96,8 @@ struct Melodic_req :virtual Musical_req
 
     /// return height from central c (in halflines)
     int height()const; 
+    /// return pitch from central c (in halfnotes)
+    int pitch()const; 
     Melodic_req();
    
     REQUESTMETHODS(Melodic_req,melodic);
@@ -144,6 +146,17 @@ struct Span_req : Musical_req {
   
 };
 
+/// request for backward plet generation
+struct Plet_req : Request {
+     char type_c_;
+     int dur_i_;
+     int type_i_;
+     Plet_req();
+     REQUESTMETHODS(Plet_req,plet);
+};
+/** 
+*/
 
 /** Start / stop a beam at this note.  if #nplet# is set, the staff will try to put an
 appropriate number over the beam
index 5ee82774c06f5df206c77f8341134286ae2c990b..7b9e3e3ec216c59fd1f4d238c6527e42f6ae1b85 100644 (file)
@@ -25,6 +25,7 @@ Request* get_request(char);
 void set_text_style(String);
 Script_def* get_scriptdef(char);
 Text_def*get_text(String s);
+Request* get_plet_request( char c, int dur_i, int type_i ); 
 Request*get_script_req(int d , Script_def*def);
 Request*get_text_req(int d , Text_def*def);
 Request* get_stemdir_req(int);
index 5610e4f54b7512b546ed841e039d6fcd89c0b5d6..967df3d56ce4633e27cf110b66827e52f8f9f009 100644 (file)
@@ -65,6 +65,16 @@ struct Measure_grouping_req;
 struct Meter_change_req;
 struct Meter;
 struct Meter_register;
+struct Midi_column;
+struct Mididef;
+struct Midi_duration;
+struct Midi_header;
+struct Midi_item;
+struct Midi_pitch;
+struct Midi_staff;
+struct Midi_stream;
+struct Midi_track;
+struct Midi_walker;
 struct Mixed_qp;
 struct Molecule;
 struct Musical_req;
@@ -78,6 +88,7 @@ struct Notename_tab;
 struct Offset;
 struct Output;
 struct PCol;
+struct Plet_req;
 struct PScore;
 struct PStaff;
 struct Paperdef;
index 56fc3e4ea590e3d39a9c9dfa68a4cf82888d0497..bf94d1a02e8fc561776464f37ca5ed068fca95e1 100644 (file)
@@ -45,6 +45,7 @@ struct Request {
     virtual Rest_req *rest() { return 0; }
     virtual Span_req *span() { return 0; }
     virtual Beam_req *beam() { return 0 ; }
+    virtual Plet_req* plet() { return 0; }
     virtual Slur_req *slur() { return 0 ; }
     virtual Rhythmic_req*rhythmic() { return 0; }
     virtual Lyric_req* lreq_l() { return 0; }
index f48ad356df76b869d7012ed04062aa04c5f68f36..b9555b20369a9fba995f031d674049d21e7fc243 100644 (file)
@@ -21,6 +21,7 @@
 struct Score {
     /// paper_, staffs_ and commands_ form the problem definition.
     Paperdef *paper_p_;
+    Mididef *midi_p_;
     IPointerList<Staff*> staffs_;
     
     /// "runtime" fields for setting up spacing    
@@ -43,6 +44,12 @@ struct Score {
     /// output to file
     void output(String fn);
 
+    /// do midi stuff
+    void midi();
+
+    ///
+    void set(Mididef* midi_p);
+
     // standard
     void OK() const;
     void print() const;
index 063905baaa91821727e026813cc34355220750bb..3bdbef721e249e1f3289ac97cfcc9556c02be27d 100644 (file)
@@ -1,7 +1,7 @@
 //
 //  source.hh -- part of LilyPond
 //
-//  copyright 1997 Jan Nieuwenhuizen <jan@digicash.nl>
+//  copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
 
 #ifndef SOURCE_HH
 #define SOURCE_HH
index a52e76f66a30052453bdf8162a9b4195239bf1d2..36c7aaa575590b64ccdc76ec65df622c918ddac0 100644 (file)
@@ -1,7 +1,7 @@
 //
 //  sourcefile.hh -- declare Source_file
 //
-//  copyright 1997 Jan Nieuwenhuizen <jan@digicash.nl>
+//  copyright 1997 Jan Nieuwenhuizen <jan@digicash.com>
 
 #ifndef SOURCE_FILE_HH
 #define SOURCE_FILE_HH
index 4c507c4b5bb1ccedb2c18879d742a953b2f35a48..74b7df13408e0122e47d12ae668005b9a85fcf5c 100644 (file)
@@ -44,6 +44,9 @@ public:
     /// when does the last *musical* element finish?
     Moment last() const;
 
+//    /// extract midi info
+//    Midi_track* midi_track_p();
+
     /// remove unused cols
     void clean_cols() ;
     Staff();
index 4d282ddea176c61697abb511d83d7c8f27a2f1c4..4b8e258c1f7b5f0c859bd354a1d01060849feb0a 100644 (file)
@@ -17,13 +17,17 @@ struct Voice {
     Moment start;
 
     /* *************** */
-    Moment when(const Voice_element*)const;
-    Moment last() const;
     Voice();
     Voice(Voice const&);
+
+    Moment when(const Voice_element*)const;
+    Moment last() const;
+
     void add(Voice_element*);
+    bool find_plet_start_bo(char c, Moment& moment_r);
     void print() const;
     void set_default_group(String id);
+    void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i);
 };
 
 /** one horizontal bit.  Apart from being a container for the requests, Voice_element is nothing
@@ -36,10 +40,14 @@ struct Voice_element {
 
     /* *************** */
     
-    void add(Request*);
     Voice_element();
     Voice_element(Voice_element const & src );
+
+    void add(Request*);
+    bool find_plet_start_bo(char c, Moment& moment_r);
     void print ()const;
     void set_default_group(String id);
+    void set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i);
+    /// return true when done
 };
 #endif
index 7aa3964262b3fe9df0b0fbda4152cb932e55317c..83a2e5b9ae12f4d6933d31ca505191340b632ac6 100644 (file)
@@ -1,5 +1,5 @@
 DFILES=dutch.ini table_sixteen.ini table_twenty.ini\
-       english.ini script.ini symbol.ini bare.ini
+       english.ini script.ini symbol.ini bare.ini swedish.ini
 
 default:
        echo huh?
diff --git a/init/swedish.ini b/init/swedish.ini
new file mode 100644 (file)
index 0000000..b3c2694
--- /dev/null
@@ -0,0 +1,19 @@
+%
+% common Swedish names for notes. "-ess" means flat, "-iss" means sharp
+%
+% by Mats Bengtsson.
+
+swedish_names = 
+notenames {
+       "cessess" 0 -2 "cess" 0 -1      "c" 0 0         "ciss" 0 1 "cississ" 0 2
+       "dessess" 1 -2 "dess" 1 -1      "d" 1 0         "diss" 1 1 "dississ" 1 2
+       "essess"  2 -2 "ess"  2 -1      "e" 2 0         "eiss" 2 1 "eississ" 2 2
+       "fessess" 3 -2 "fess" 3 -1      "f" 3 0         "fiss" 3 1 "fississ" 3 2
+       "gessess" 4 -2 "gess" 4 -1      "g" 4 0         "giss" 4 1 "gississ" 4 2
+       "assess"  5 -2 "ass"  5 -1      "a" 5 0         "aiss" 5 1 "aississ" 5 2
+       "hessess" 6 -2 "b" 6 -1         "h" 6 0         "hiss" 6 1 "hississ" 6 2
+}
+
+
+notenames { swedish_names }
+
index 885dcf19a9ebd373203898ffe80f27d7fb1c261d..5e7ff852495c8f35250a72c5814c284722528b5b 100644 (file)
@@ -2,7 +2,8 @@ default: ;
 
 DISTFILES=Makefile  kortjakje.ly pavane.ly  maartje.ly\
        cadenza.ly scales.ly standchen.ly twinkle.ly\
-       wohltemperirt.ly error.ly\
+       wohltemperirt.ly\
+       error.ly midi.ly plet.ly\
        martien.ly mlalt.ly mlvio1.ly mlvio2.ly mlcello.ly\
        coriolan-alto.ly rhythm.ly \
        standchen.tex pavane.tex scsii-menuetto.tex scsii-menuetto.ly\
index 6773143fea3eef97ab42958ab2280318dd53c67a..fb7669e3fab4eeb3d0a44b5217f4572feaf4117b 100644 (file)
@@ -33,7 +33,7 @@ cad = music { $
        \duration{16}   [d cis d e]
        f4()[f e d c]
        `b4
-       \octave{} \plet{2/3} ['d8 'c8 a8] \plet{1/1}
+       \octave{} ['d8 'c8 a8]2/3
        g2
                \bar \empty 
        [g c e g] ['c e g 'c]\octave{'} 
@@ -50,7 +50,9 @@ score {
                music { cad }
        }
        commands {
-               cadenza $1$
+               cadenza {1}
                grouping{1*4}
        }
-}
+       midi { tempo 4:80 }
+       staff { midi  music { cad } }
+}
\ No newline at end of file
index 683141814d55773b7bbd06f9a11221854ee22d86..2037580f1366d187282b75b8c08c768984d107ba 100644 (file)
@@ -14,9 +14,9 @@
 alto = music { 
        $
        \duration{ 8 }
-       \key {$bes es as$}
+       \key {bes es as}
                
-       }                       \clef "alto"
+       \clef "alto"
        % these are chords (i.e. non-divisi)
        % that-s why i-d rather type chords, 
        % but how to type slurs?
index 922f9ebefd4641649d81c036c8c4d95d1dd7078a..74924e9b25da244a09d0cd8be8846c31b9a2659c 100644 (file)
@@ -1,7 +1,11 @@
+include "this-is-hopefully-a-nonexisting-file"
+
 mwa = music {
        $
        [ a8 a8 a8 a8 a8 ]      % 
        [ a8 ]  % 
+%       segfault
+%      { \music{ [ bes^"1"( )a bes-. g-. ] a4-.^"4" } \music{ [ e ] } \music{ [ c ] } } |
        a ) b ] c       % warning
        &               % ok; error
        a b ) ]         % ok; error
index 6da101c266ca06b3774aa611b4207ced558dd4ec..645c1f9d4b19c9e353bfd94b6e11f9e39a4083f5 100644 (file)
@@ -33,9 +33,11 @@ $}
 
                                % more of this.
 begeleiding =
-$      \clef "bass"            % bass-clef
-       \music {                % as you can see, the $ sign obliges 
+%      $\clef bass             % bass-clef
+%      \music {                % as you can see, the $ sign obliges 
                                % you to precede keyword by a backslash: \
+       music { $
+       \clef "bass"
        \octave { ` }           % default octave: 1 below the first octave.
 
        %%% theme
index cf40cc97886f571e06c3cb778d8248a329853da8..683f14d46466e4028a3e1bb1094644a7232ec24d 100644 (file)
@@ -41,15 +41,15 @@ score {
        } 
        commands {
                meter {2*4}
-               key $fis$
+%              key $fis$
                skip 56*2
-               key $bes es as$
+%              key $bes es as$
                skip 8*2
                meter {6*8}
                skip 48*8
                meter {2*4}
                skip 16*2
-               key $fis$
+%              key $fis$
        }
        paper {
 %              unitspace 16mm
@@ -57,4 +57,23 @@ score {
                width 195mm
                output "martien.out"
        }
+       staff { 
+               midi_track 
+               music { alto }
+       }
+       staff { 
+               midi_track 
+               music { violin1 }
+       }
+       staff { 
+               midi_track 
+               music { violin2 }
+       } 
+       staff { 
+               midi_track 
+               music { cello }
+       } 
+       midi { 
+               tempo 4:80
+       }
 }
diff --git a/input/midi.ly b/input/midi.ly
new file mode 100644 (file)
index 0000000..c08b1bc
--- /dev/null
@@ -0,0 +1,50 @@
+% midi.ly
+% test source for lilypond-s midi output
+
+
+% BUG: 2e noot van begeleiding bij g2 niet gespeeld.
+% BUG: rust (5e maat) niet gespeeld.
+melodie = music {
+       $\clef\violin
+       c c | g g | a a | g2 | r2
+       f f | e e | d d8.( e16 | )c2 | % :|
+       $
+}
+
+begeleiding = music {
+       $
+       \clef \bass
+       \octave{`}
+       c 'c | 'e 'c | 'f 'c | 'e 'c | r2
+       'd b | 'c a | f g | c2 | 
+       $
+}
+
+mstaf = staff {
+       melodic
+       music { melodie }
+}
+
+bass_staf = staff {
+       melodic 
+       music { begeleiding }
+}
+
+score {
+%      staff { mstaf }
+%      staff { bass_staf }
+%      paper { unitspace 2.5cm }
+       % in own audio {  } block iso score { } ?
+       % allow no score { } block ?
+
+       staff { midi music { melodie } }
+       staff { midi music { begeleiding } }
+%      staff { midi music { bla } }
+       midi {
+               tempo 4:120
+       }
+       commands {
+               meter { 2 * 4 }
+       }
+}
+
index 51f7de87423634135e65fb353b472f152c930584..cbe46e0f2339cca8ecbe44e76351ea2b8fef8190 100644 (file)
@@ -16,6 +16,7 @@ alto = music {
        \duration{16}
        \clef\alto
        \octave{}
+       \key{fis}
 %1
         [ `b8. `a ] [ `g8 `b c ] |
 %2
@@ -112,31 +113,31 @@ alto = music {
 %44
        [ `b8. c32 `b32 ] `a4 |
 %45
-       \plet{ 4/6 } [ `g `a `g `a `g `a ] \plet{ 1/1 } \plet{ 4/6 } [ `g `b c d e fis ] \plet{ 1/1 } |
+       [ `g `a `g `a `g `a ]4/6   [ `g `b c d e fis ]4/6  |
 %46
-       \plet{ 4/6 } [ g fis e d `b `g ] \plet{ 1/1 } [ `a8 `g8 ] |
+       [ g fis e d `b `g ]4/6  [ `a8 `g8 ] |
 %47
-       \plet{ 4/6 } [ g fis e d c `b ] \plet{ 1/1 } \plet{ 4/6 } [ e d c `b `a `g ] \plet{ 1/1 } |
+       [ g fis e d c `b ]4/6   [ e d c `b `a `g ]4/6  |
 %48
-       \plet{ 4/6 } [ d e d d `b `g ] \plet{ 1/1 } [ `a8 `g8 ] |
+       [ d e d d `b `g ]4/6  [ `a8 `g8 ] |
 %theme 2
        \duration{8}
 %49
-       \plet{ 2/3 } [ f e d ] \plet{ 1/1 } f4 |
+       [ f e d ]2/3  f4 |
 %50
-       \plet{ 2/3 } [ e d c ] \plet{ 1/1 } e4 |
+       [ e d c ]2/3  e4 |
 %51
-       \plet{ 2/3 } [ d g `g ] \plet{ 1/1 } \plet{ 2/3 } [ `g `a `b ] \plet{ 1/1 } |
+       [ d g `g ]2/3   [ `g `a `b ]2/3  |
 %52
         d4 e4 |
 %53
-       \plet{ 2/3 } [ f e d ] \plet{ 1/1 } f4 |
+       [ f e d ]2/3  f4 |
 %54
-       \plet{ 2/3 } [ e d c ] \plet{ 1/1 } e4 |
+       [ e d c ]2/3  e4 |
 %55
-       \plet{ 2/3 } [ d g `g ] \plet{ 1/1 } \plet{ 2/3 } [ `g `a `b ] \plet{ 1/1 } |
+       [ d g `g ]2/3   [ `g `a `b ]2/3  |
 %56
-        `b4 c4 | % || \key\Es
+        `b4 c4 \key{bes es as} | % || \key\Es
 %57
        [ `b d ] [ `g `b ] |
 %58
@@ -205,7 +206,7 @@ alto = music {
         `b2 |
 %88
        \textstyle "italic"
-        c2_"dacapo" |
+        c2_"dacapo" \key{fis} |
        \textstyle "roman"
 %\scoreverb{\mulooseness=1}
 %      \key\G ||
index cdc0b433483a50678ffeb416b6edba1188455fec..558fc1fb15788c5de7566340f6cee5b131241938 100644 (file)
@@ -15,6 +15,7 @@ cello = music {
        $
 \clef"bass"    \octave{`}
        \duration{4}
+       \key{fis}
 %%1
        g `g |
 %%2
@@ -127,22 +128,22 @@ cello = music {
 %%49
        \textstyle "italic"
        r4_"arco"
-       \plet{ 2/3 } [ `g `g `g ] \plet{ 1/1 } |
+        [ `g `g `g ]2/3  |
        \textstyle "roman"
 %%50
-       r4 \plet{ 2/3 } [ c c c ] \plet{ 1/1 } |
+       r4  [ c c c ]2/3  |
 %%51
        g2 |
 %%52
        c2 |
 %%53
-       r4 \plet{ 2/3 } [ `g `g `g ] \plet{ 1/1 } |
+       r4  [ `g `g `g ]2/3  |
 %%54
-       r4 \plet{ 2/3 } [ c c c ] \plet{ 1/1 } |
+       r4  [ c c c ]2/3  |
 %%55
        g2 |
 %%56
-       `g4 `c4 |
+       `g4 `c4 \key{bes es as}|
 % \key\`es ||
 %%57
        g r g r |
@@ -212,7 +213,7 @@ cello = music {
        d |
 %%88
        \textstyle "italic"
-       d_"dacapo"
+       d_"dacapo" \key{fis} |
        \textstyle "roman"
 % \key\`g ||
        $
index a6f2b049f44a9a4a0b778b3707f624b3728b8e18..b1d277bd313ff3829f3532ba926a4e11f1d59e36 100644 (file)
 %
 violin1 = music { 
        $
-\clef "violin"
+       \clef "violin"
        \octave{}
        \duration{4}
+       \key{fis}
 %1
        g [ b8. a16 ] |
 %2
@@ -123,22 +124,22 @@ violin1 = music {
 %theme 2
 %49
        \textstyle "italic"
-       r4_"arco" \plet{ 2/3 } [ b8  b  b ] \plet{ 1/1 }
+       r4_"arco"  [ b8  b  b ]2/3 
        \textstyle "roman" |
 %50
-       r4 \plet{ 2/3 } [ g g g ] \plet{ 1/1 } |
+       r4  [ g g g ]2/3  |
 %51
        b2 |
 %52
        'c2 |
 %53
-       r4 \plet{ 2/3 } [ b b b ] \plet{ 1/1 } |
+       r4  [ b b b ]2/3  |
 %54
-       r4 \plet{ 2/3 } [ g g g ] \plet{ 1/1 } |
+       r4  [ g g g ]2/3  |
 %55
        b2 |
 %56
-       g2 |
+       g2 \key{bes es as}|
 % \key\Es ||
 %57
        f r f r |
@@ -150,11 +151,11 @@ violin1 = music {
        'c r 'c4 |
 %61
        \duration{16}
-       \plet{ 4/6 } [ as f d f as 'd ] \plet{ 1/1 } \plet{ 4/6 } [ as f d `as d f ] \plet{ 1/1 } |
+        [ as f d f as 'd ]4/6   [ as f d `as d f ]4/6  |
 %62
-       \plet{ 4/6 } [ g es c `g c es ] \plet{ 1/1 } \plet{ 4/6 } [ g 'c 'es 'c g es ] \plet{ 1/1 } |
+        [ g es c `g c es ]4/6   [ g 'c 'es 'c g es ]4/6  |
 %63
-       \plet{ 4/6 } [ g d g bes 'd 'g ] \plet{ 1/1 } \plet{ 4/6 } [ 'f 'd bes g f d ] \plet{ 1/1 } |
+        [ g d g bes 'd 'g ]4/6   [ 'f 'd bes g f d ]4/6  |
 %64
        \duration{8}
        [ c g ] g4 |
@@ -186,11 +187,11 @@ violin1 = music {
        'c r 'c4 |
 %77
        \duration{16}
-       \plet{ 4/6 } [ as f d f as 'd ] \plet{ 1/1 } \plet{ 4/6 } [ as f d `as d f ] \plet{ 1/1 } |
+        [ as f d f as 'd ]4/6   [ as f d `as d f ]4/6  |
 %78
-       \plet{ 4/6 } [ g es c `g c es ] \plet{ 1/1 } \plet{ 4/6 } [ f 'c 'es 'c g es ] \plet{ 1/1 } |
+        [ g es c `g c es ]4/6   [ f 'c 'es 'c g es ]4/6  |
 %79
-       \plet{ 4/6 } [ g d f b 'd 'g ] \plet{ 1/1 } \plet{ 4/6 } [ 'f 'd b g f d ] \plet{ 1/1 } |
+        [ g d f b 'd 'g ]4/6   [ 'f 'd b g f d ]4/6  |
 %80
        [ c8 g8 ] g4 |
 %81
@@ -212,6 +213,7 @@ violin1 = music {
        \textstyle "italic"
        a_"dacapo"
        \textstyle "roman"
+       \key{fis} |
 % \key\G ||
        $
 }
index ad6deb44a41f465ed16703b801edf9119af0b5e9..c3ed9bb999c4c88b2606d785a9b606c562d4bf68 100644 (file)
@@ -15,6 +15,7 @@ violin2 = music {
        $
 \clef "violin" \octave{}
        \duration{4}
+       \key{fis}
 %1
        d2 |
 %2
@@ -92,7 +93,7 @@ violin2 = music {
 %35
        [ g8 e e ] [ e8 g g ] |
 %36
-        b4 fis4 |
+       b4 fis4 |
 %37
        [ a8 a a ] [ a8 a a ] |
 %38
@@ -126,21 +127,21 @@ violin2 = music {
        \textstyle "italic"
        r4_"arco"
        \textstyle "roman"
-       \plet{ 2/3 } [ d8 d d ] \plet{ 1/1 } |
+       [ d8 d d ]2/3  |
 %50
-       r4 \plet{ 2/3 } [ g8 g g ] \plet{ 1/1 } |
+       r4  [ g8 g g ]2/3  |
 %51
        d2 |
 %52
        c2 |
 %53
-       r4 \plet{ 2/3 } [ d8 d d ] \plet{ 1/1 } |
+       r4  [ d8 d d ]2/3  |
 %54
-        r4 \plet{ 2/3 } [ e e e ] \plet{ 1/1 } |
+       r4  [ e e e ]2/3  |
 %55
        d2 |
 %56
-       f4 e4 |
+       f4 e4 \key{bes es as}|
 % \key\Es ||
 %57
        d r `b r |
@@ -182,9 +183,9 @@ violin2 = music {
 %74
        `g r es r |
 %75
-        g r g r |
+       g r g r |
 %76
-        g r es4 |
+       g r es4 |
 %77
        \duration{2}
        f |
@@ -210,7 +211,7 @@ violin2 = music {
 %      = g |
 %88
        \textstyle "italic"
-       fis_"dacapo" |
+       fis_"dacapo" \key{fis}|
        \textstyle "roman"
 % \key\G ||
        $
index 4f0b3b8812b390b1b3bbdc4e74a67997fe3597f0..1e2c6da688318afa64d5ab9e92b7068aec6782af 100644 (file)
@@ -11,9 +11,8 @@
 %
 
 horn =
-staff {
-       melodic
-       music{  $
+music {
+       $
        \octave { ' }
        \key{  fis cis }
        \duration { 8 }
@@ -68,13 +67,12 @@ staff {
        r1^"1er mouvement"      
        \duration {8}
        | r2 [c-.( e-. c-. )`a-. ]      
-       \plet {2/3}\octave{}    |
-       |       [c e a ] \plet{1/1} b4-> () [b c-- e-- a--]     |
+       \octave{}       |
+       |        [c e a ]2/3  b4-> () [b c-- e-- a--]   |
        b4. b8()g2      |
        r1      |
        r2              [f a f d] 
-       \plet {2/3}
-       | [f a 'c] \plet{1/1} 'e4-^ () ['e f-> a-> 'c->]        |
+       |  [f a 'c]2/3  'e4-^ () ['e f-> a-> 'c->]      |
        'e4._"sf" 'e8()'c4 r4 |
        r1      |
        \meter {2 *4}
@@ -96,11 +94,10 @@ staff {
        )b [fis a b ] 'cis4 b4  |
        fis2 r2 |
        r1-\fermata     
-       $}
+       $
 }
 score {
-       staff {
-               horn
+       staff { melodic music { horn }
        }
        paper {
                output "pavane.out"
@@ -110,11 +107,13 @@ score {
        }
        commands  {
                meter {4 *4}
-               skip 39*1
+               skip {39*1}
                bar "|:"
-               skip 10*1
+               skip {10*1}
                bar ":|"
-               skip 13*1
+               skip {13*1}
                bar "||"
        }
-}
\ No newline at end of file
+       midi { tempo 4:70 }
+       staff { midi   music { horn } }
+}
diff --git a/input/plet.ly b/input/plet.ly
new file mode 100644 (file)
index 0000000..752a6ba
--- /dev/null
@@ -0,0 +1,45 @@
+
+melanie = music {
+       $
+       \duration{8}
+       [ c d ] { [ d 'd } { c 'c ] } |
+       [ c d ] [ e { d g } c ]2/3 |
+       [ c d ] [ c16 d16 'e16 'e16 d16 c16 ]4/6 |
+       [ c d e e d c ]4/6 |
+       [c d ] { \music{ [ c d e ]2/3 } \music{ [ f g a ]2/3 } } |
+       [ c d ] [ d c ] |
+        $
+}
+
+michelle = music {
+       $
+       \duration{8}
+       [ c c c c ] |
+       [ c c c c ] |
+       [ c c c c ] |
+       [ c c c c ] |
+       [ c c c c ] |
+       [ c c c c ] |
+       $
+}
+
+mireille = music {
+       @
+       \duration{8}
+       o o o o |
+       o o [ o o o ]2/3 |
+       [ o o o ]2/3 [ o16 o16 o16 o16 o16 o16 ]4/6 |
+       [ o o o o o o]4/6 |
+       o o [ o o o ]2/3 |
+       o o o o |
+       @
+}
+
+score {
+       staff { lyric music { mireille } }
+       staff { melodic music { melanie } }
+       staff { melodic music { michelle } }
+       commands{ 
+               meter {2*4}
+       }
+}
index c74c9d8dcd69f66e587b81224b05c6aa81bf7a6b..368d04b9bf4a3b797a99c06cb813ec379d91eaed 100644 (file)
@@ -29,15 +29,21 @@ ritme = staff {
        
        $ }
 
+       %
+       % The commands section takes the same stuff that music { } takes;
+       % the commands issued below could have been issued inside the above
+       % music block;
+       %
+
        commands {      % override "commands" section of Score.
-               partial 1*8
+               partial {1*8}   % doesn't have to be here. 
                meter{ 4*4}
        }
 }
 another = staff {
        melodic
        music { $
-               c1 c1 c1 c4 c4 c4 c4  {\meter 4*4} c1 c1 c1
+               c1 c1 c1 c4 c4 c4 c4  \meter{ 4*4} c1 c1 c1
        $ }
 }
 
@@ -57,4 +63,4 @@ score {
                unitspace 2cm
                geometric 1.3
        }
-}
\ No newline at end of file
+}
index fba2c9ff4d3e63f2d686b1658ea73dc845a81546..d98c1bba4326051c8aeea47190b026514680a9a9 100644 (file)
@@ -4,25 +4,25 @@ staff {melodic
        music{  $
 \duration { 8 }
                        \octave{ }
-                       \plet { 6/9 } |[ a a a a a a a a a ] \plet { 1/1 }
+                        |[ a a a a a a a a a ] 
                        \octave{ ' }
-                       \plet { 6/9 } |[ a a a a a a a a a ] \plet { 1/1 }
+                        |[ a a a a a a a a a ] 
                        \octave { ` } 
-                       \plet { 6/9 } [ `c `g d a 'e 'b ''f '''c '''g ] \plet { 1/1 }
-                       \plet { 6/9 } [ '''g '''c ''f 'b 'e a d `g `c ] \plet { 1/1 }
+                        [ `c `g d a 'e 'b ''f '''c '''g ] 
+                        [ '''g '''c ''f 'b 'e a d `g `c ] 
                        \octave{ ' }
-                       \plet { 6/9 } [ `c `g d a 'e 'b ''f '''c '''g ] \plet { 1/1 }
-                       \plet { 6/9 } [ '''g '''c ''f 'b 'e a d `g `c ] \plet { 1/1 }
+                        [ `c `g d a 'e 'b ''f '''c '''g ] 
+                        [ '''g '''c ''f 'b 'e a d `g `c ] 
                        \octave { } 
-                       \plet { 2/3 } [ c g 'd ] \plet { 1/1 }
-                       \plet { 2/3 } [ 'd g c ] \plet { 1/1 } 
-                       \plet { 2/3 } [ f 'c 'g ] \plet { 1/1 }
-                       \plet { 2/3 } [ 'g 'c f ] \plet { 1/1 } 
+                        [ c g 'd ]2/3 
+                        [ 'd g c ]2/3  
+                        [ f 'c 'g ]2/3 
+                        [ 'g 'c f ]2/3  
                        \octave{ ' }
-                       \plet { 2/3 } [ c g 'd ] \plet { 1/1 }
-                       \plet { 2/3 } [ 'd g c ] \plet { 1/1 } 
-                       \plet { 2/3 } [ f 'c 'g ] \plet { 1/1 }
-                       \plet { 2/3 } [ 'g 'c f ] \plet { 1/1 }
+                        [ c g 'd ]2/3 
+                        [ 'd g c ]2/3  
+                        [ f 'c 'g ]2/3 
+                        [ 'g 'c f ]2/3 
 
 c1
        \duration { 8}
index 00fde25284e75671c79334cebae0054041d51e55..932bd7d381774a0f7fa3fd269d80a8bb1628bac0 100644 (file)
@@ -57,8 +57,8 @@ ii_menuetto = music {
 %      { 'e4-.-\downbow g4 `g4\stemdown } |
        { 'e4-.-\downbow g4 `g4 } |
 %%8
-%      { 'cis2.-\upbow e2. `a2.\stemdown } :||:
-       { 'cis2.-\upbow e2. `a2. } | % :||:
+%      { 'cis2.-\upbow e2. `a2.\stemdown } :|:%%sorry!!
+       { 'cis2.-\upbow e2. `a2. } \bar ":|:"%%!! sorry!
 %%9
        \clef "violin"
 %      { 'e2 a2_f\stemdown }
@@ -99,27 +99,25 @@ ii_menuetto = music {
        { a2^"0" fis2_"3" } bes4 |
 %%%18
 %%     [ { 'c( es } ) bes 'c a ] fis4^\tr |
-       { [ 'c es } bes 'c a ] fis4 |
+       { \music{ [ 'c( )bes 'c a ] } \music{ [ es ] } } fis4 |
 %%%19
-%%     { 'd4-\downbow g4 `bes4\stemdown } { 'c4-\upbow g4 c4\stemdown } [ { bes d } a ] |
        { 'd4-\downbow g4 `bes4 } { 'c4-\upbow g4 c4 } { [ bes d } a ] |
 %%%20
 %%     [ { 'c( d `g } bes a ) bes g ( ) bes ] |
-       { [ 'c d `g } bes a bes g( )bes ] |
+       { \music{ [ 'c( bes a )bes g( )bes ] } \music{ [ d ] } \music{ [ g ] } } |
 %%%21
 %%     { 'd4\stemup g2\stemdown } (^ ) 'cis4\stemup { 'd4\stemup =f4\stemdown } |
-%      { 'd4 g2 } 'cis4 { 'd4 f4 } |
        { \multivoice \music {\stem{1}  'd4(\stem{1} ) 'cis4 'd4 } \music { \stem{-1} g2 f4 } } |
 %%%22
 %%     [ { g(  cis } )f g e ] { f4 d4 } |
-       { [ g cis } f g e ] { f4 d4 } |
+       { \music{ [ g( )f g e ] } \music{ [ cis ] } } { f4 d4 } |
 %%%23
 %%     [ `g g ] { e4.\stemup^\tr `a4.\stemdown } d\stemup-\upbow |
        [ `g g ] { e4. `a4. } d-\upbow |
 %%%24
 %%     { d2.^{fine}  `a2. `d2.\stemup_{ }_{ }_{3 mins.}}       s4 :||
 %%     { \textstyle "italic" d2.^"fine" `a2. \textstyle "roman" `d2._"3 mins."} | % :||
-       { d2.^"fine" `a2. `d2._"3 mins."} | % :||
+       { d2.^"fine" `a2. `d2._"3 mins."} \bar ":||"
 %% \tighten            % use one line less
        $
 }
@@ -130,13 +128,6 @@ score {
        }
        commands {
                meter {3 * 4}
-               skip {24 * 4}% 8 measures
-               bar ":|:"
-
-               skip {15 * 4} % 5 meas.
-
-               skip {36*4}
-               bar ":||"
        }
        paper {
                symboltables { table_sixteen }
@@ -146,4 +137,11 @@ score {
                geometric 1.4
                output "scsii-menuetto.out"
        }
-o}
+       staff {
+               midi music { ii_menuetto }
+       }
+       midi { 
+               tempo 4:120
+               output "scsii-menuetto.midi"
+       }
+}
index edc487c9b06999704cf9a201020eb9d462446cc2..219cb50765f098b9863acce7fd6dac9f9eff4ccb 100644 (file)
@@ -12,7 +12,7 @@
 % comments with # note missing stuff
 % heu, make that %#%
 %
-% thanks to \music "2" group changing, all notes 
+% thanks to \music group changing, all notes 
 % (except for grace notes) are printed
 %
 
@@ -36,6 +36,7 @@
 %#%\duration8
 %%1
 melodie = music { $ \clef\violin
+       \key{bes}
        \duration{ 8 }
        r_"\pp" { [ d `a-| } f-| { d `a-| } f-| { d `a-| ] } |
 %%2
@@ -48,30 +49,30 @@ melodie = music { $ \clef\violin
        r { [ `a cis } e { `a cis } e { `a cis ] } |
 %#%:|
 %%5
-       \plet{ 2/3 } [ a()bes a ] \plet{ 1/1 } 'd4. a |
+       [ a()bes a ]2/3  'd4. a |
 %%6
-       \plet{ 2/3 } [ g()a g ] \plet{ 1/1 } 'd4 a r |
+       [ g()a g ]2/3  'd4 a r |
 %#%\tighten
 %#%\newline
 %%7
-       a4.^> g \plet{ 2/3 } [ g( f )e ] \plet{ 1/1 } |
+       a4.^> g  [ g( f )e ]2/3  |
 %%8
        f2 r4 |
 %%9
-       { \music{ 'a4.( )'g \plet{ 2/3 } [ 'g( 'f )'e ] \plet{ 1/1 } }
-         \music{ 'cis4. 'e_"dolce" \plet{ 2/3 } 'e \plet{ 1/1 } } } |
+%      { \music{ 'a4.( )'g  [ 'g( 'f )'e ]2/3  } \music{ 'cis4. 'e_"dolce"  [ 'e ] 2/3 } } |
+       { \music{ 'a4.( )'g  [ 'g( 'f )'e ]2/3  } \music{ 'cis4. 'e_"dolce"  \plet{ 2/3 } 'e \plet{ 1/1 } } } |
 %%10
        { 'f2. 'd2. } |
 %%11
-       \plet { 2/3 } [ a_"\pp"( )bes a ] \plet { 1/1 } 'f4. a |
+       [ a_"\pp"( )bes a ]2/3  'f4. a |
 %%12
-       \plet { 2/3 } [ g( ) a g ] \plet { 1/1 } 'e4. 'd |
+       [ g( ) a g ]2/3  'e4. 'd |
 %%13
-       'c4. bes \plet { 2/3 } [ bes( ) a g ] \plet { 1/1 } |
+       'c4. bes  [ bes( ) a g ]2/3  |
 %%14
        a2 r 
-       { \music{ 'd( | )'c4. g \plet { 2/3 } [ bes a g ] \plet { 1/1 } }
-         \music{ f_"\p"( | )e4._"dolce" bes \plet { 2/3 } [ g ] \plet { 1/1 } } } |
+%      { \music{ 'd( | )'c4. g  [ bes a g ]2/3  } \music{ f_"\p"( | )e4._"dolce" bes  [ g ]2/3  } } |
+       { \music{ 'd( | )'c4. g  [ bes a g ]2/3  } \music{ f_"\p"( | )e4._"dolce" bes  \plet{ 2/3 } g \plet{ 1/1 }  } } |
 %%16
        { a2. f2. } |
 %%17
@@ -82,12 +83,12 @@ melodie = music { $ \clef\violin
        [ 'd8. a16 ] f4. d |
 %%19
 %#%    'c\grace\stemup
-       \plet { 2/3 } [ bes_"\pp"( ) a bes ] \plet { 1/1 } 'd4. bes |
+       [ bes_"\pp"( ) a bes ]2/3  'd4. bes |
 %%20
        a2. |
 %%21
 %#%    a\grace
-       \plet { 2/3 } [ g( )fis g ] \plet { 1/1 } bes4.^> g |
+       [ g( )fis g ]2/3  bes4.^> g |
 %%22
 %#%    =f2. |
        f2. |
@@ -97,12 +98,12 @@ melodie = music { $ \clef\violin
        [ 'd8. a16 ] fis4. d |
 %%25
 %#%    'cis\grace\stemup
-       \plet { 2/3 } [ b_"\mf"( ) ais b ] \plet { 1/1 }        'd4. b |
+       [ b_"\mf"( ) ais b ]2/3 'd4. b |
 %%26
        { a2. fis2. } |
 %#%\tighten\newline
 %%27
-       \plet { 2/3 } [ 'e_"\f"( )'dis 'e ] \plet { 1/1 } 'g4. 'cis |
+       [ 'e_"\f"( )'dis 'e ]2/3 'g4. 'cis |
 %%28
        { 'd2. fis2. } |
 %#%\volta1
@@ -139,8 +140,8 @@ melodie = music { $ \clef\violin
 %%40
        'cis2 r4 |
 %%41
-%#%    { > 'fis4. 'cis4._f } 'e [ 'e( ) 'd >! 'cis ] \plet { 1/1 } |
-       { 'fis4. 'cis4._"\f" } 'e \plet { 2/3 } [ 'e( )'d 'cis ] \plet { 1/1 } |
+%#%    { > 'fis4. 'cis4._f } 'e [ 'e( ) 'd >! 'cis ]  |
+       { 'fis4. 'cis4._"\f" } 'e  [ 'e( )'d 'cis ]2/3  |
 %%42
        [ b8. 'cis16 ] 'd4^> b r |
 %%43
@@ -151,19 +152,19 @@ melodie = music { $ \clef\violin
        [ b8. 'cis16 ] 'd4^> b r |
 %%45
 %#%    'cis\grace\stemup
-       \plet { 2/3 } [ b_"\p"( )ais b ] \plet { 1/1 } 'd4. b |
+       [ b_"\p"( )ais b ]2/3  'd4. b |
 %%46
 %#%    { =a2. fis2. } |
        { a2. fis2. } |
 %%47
-       \plet { 2/3 } [ 'e_"\f"( )'dis 'e ] \plet { 1/1 } 'g4.^> 'cis |
+       [ 'e_"\f"( )'dis 'e ]2/3  'g4.^> 'cis |
 %%48
 %#%    { fis2.(v ='d2.\stemup(^ }
 %      { fis2. 'd2. } |
 %%49
 %#%    { ) 'd4 ) =f2._> } { r4 s4_{decr} } 'd4\stemup
        \textstyle "italic"
-       { \multivoice \music{ \stem{ 1 } fis2.( | \stem{ -1 } )f2. } \music  { \stem{ 1 } 'd2.( | \stem{ 1 } )'d4 r4_"decresc." 'd4 } }
+       { \multivoice \music{ \stem{ 1 } fis2.( | \stem{ -1 } )f2. } \music { \stem{ 1 } 'd2.( | \stem{ 1 } )'d4 r4_"decresc." 'd4 } }
        \textstyle "roman" |
 %%50
        { bes2. e2. } |
@@ -194,73 +195,71 @@ melodie = music { $ \clef\violin
 $ }
 
 begeleiding = music { $
-\clef\bass
-\duration{2}
-       `d r4
+       \key{bes}
+       \clef\bass
+       \duration{2}
+       `d r4 |
 %%2
-       ``bes r4
+       ``bes r4 |
 
 %%3
-       ``g r4
+       ``g r4 |
 
 %%4
-       ``a r4
+       ``a r4 |
 %#%:|
 %%5
 %#%\stemlength2
 \duration{ 8 }
 %#%    { =`f `d2 } `a d `a { d r4 } `a
-       { \multivoice \music{ \stem{1}[ `f `a d `a d `a ] } \music  { \stem{ -1 } `d2 r4 } } |
+       { \multivoice \music{ \stem{ 1 } [ `f `a d `a d `a ] } \music { \stem{ -1 } `d2 r4 } } |
 %%6
-       { \multivoice \music{\stem{1} [ `d `e `g `e `g `e ] } \music { \stem{ -1 } ``bes2 r4 } } |
+       { \multivoice \music{ \stem{ 1 } [ `d `e `g `e `g `e ] } \music { \stem{ -1 } ``bes2 r4 } } |
 %%7 
 % this (one note missing) fails with assertion:
-% lilypond: src/beam.cc:144: void Beam::set_grouping(struct Rhythmic_grouping,
-% struct Rhythmic_grouping): Assertion `cur.children.size() == stems.size()' failed.
-
-%% seems fixed now, HWN
-%      { \multivoice \music{ \stem{1}[ `cis `e `g `e `g ] } \music { \stem{ -1 } ``a2 r4 } } |
-       { \multivoice \music{\stem{1} [ `cis `e `g `e `g e ] } \music { \stem{ -1 } ``a2 r4 } } |
+% lilypond: src/beam.cc:144: void Beam::set_grouping(struct Rhythmic_grouping, struct Rhythmic_grouping): Assertion `cur.children.size() == stems.size()' failed.
+%      { \multivoice \music{ \stem{ 1 } [ `cis `e `g `e `g ] } \music { \stem{ -1 } ``a2 r4 } } |
+       { \multivoice \music{ \stem{ 1 } [ `cis `e `g `e `g e ] } \music { \stem{ -1 } ``a2 r4 } } |
 %%8
-       { \multivoice \music{ \stem{1}[ `d `a d `a d `a ] } \music { \stem{ -1 } `d2 r4 } } |
+       { \multivoice \music{ \stem{ 1 } [ `d `a d `a d `a ] } \music { \stem{ -1 } `d2 r4 } } |
 %%9
        [ `a e f e f e ] |
 %%10
        [ `d `a d `a d `a ] |
 %%11
-       { \multivoice \music{ \stem{1} [ `f `a d `a d `a ] } \music  { \stem{ -1 } `d2 r4 } } |
+       { \multivoice \music{ \stem{ 1 } [ `f `a d `a d `a ] } \music { \stem{ -1 } `d2 r4 } } |
 %%12 == 6
-       { \multivoice \music{ \stem{1}[ `d `e `g `e `g `e ] } \music  { \stem{ -1 } ``bes2 r4 } } |
+       { \multivoice \music{ \stem{ 1 } [ `d `e `g `e `g `e ] } \music { \stem{ -1 } ``bes2 r4 } } |
 %13
-       { \multivoice \music{ \stem{1}[ `e `e `g `e `g `e ] } \music  { \stem{ -1 } ``bes2 r4 } } |
+       { \multivoice \music{ [ `e `e `g `e `g `e ] } \music { \stem{ -1 } ``bes2 r4 } } |
 %%14
-       { \multivoice \music{ \stem{1}[ `a c f c f c ] } \music  { \stem{ -1 } `f2 r4 } } |
+       { \multivoice \music{ \stem{ 1 } [ `a c f c f c ] } \music { \stem{ -1 } `f2 r4 } } |
 %%15
        [ `c `g `bes `g `bes `g ] |
 %%16
        [ ``f `c `f `c `f `c ] |
 %%17
-       { \multivoice \music{ \stem{1}[ ``a `e `g `e `g `e ] } \music  { \stem{ -1 } ``a2 r4 } } |
+       { \multivoice \music{ \stem{ 1 } [ ``a `e `g `e `g `e ] } \music { \stem{ -1 } ``a2 r4 } } |
 %%18
-       { \multivoice \music{ \stem{1}[ `d `a d `a d `a ] } \music  { \stem{ -1 } `d2 r4 } } |
+       { \multivoice \music{ \stem{ 1 } [ `d `a d `a d `a ] } \music { \stem{ -1 } `d2 r4 } } |
 %%19
-       { \multivoice \music{ \stem{1}[ ``bes `f `bes `f `bes `f ] } \music  { \stem{ -1 } ``bes2 r4 } } |
+       { \multivoice \music{ \stem{ 1 } [ ``bes `f `bes `f `bes `f ] } \music { \stem{ -1 } ``bes2 r4 } } |
 %%20
-       { \multivoice \music{ \stem{1}[ ``f `c `f `c `f `c ] } \music  { \stem{ -1 } ``f2 r4 } } |
+       { \multivoice \music{ \stem{ 1 } [ ``f `c `f `c `f `c ] } \music { \stem{ -1 } ``f2 r4 } } |
 %%21
 %#%    s8               % skip space of grace note
        { [ `e `c } `g c `g c `g ] |
 %%22
        [ `f `a c `a `f `c ] |
 %%23
-       { \multivoice \music{ \stem{1}[ ``a `e `g `e `g `e ] } \music  { \stem{ -1 } ``a2 r4 } } |
+       { \multivoice \music{ \stem{ 1 } [ ``a `e `g `e `g `e ] } \music { \stem{ -1 } ``a2 r4 } } |
 %%24
-       { \multivoice \music{ \stem{1}[ `d `fis `a `fis `a `fis ] } \music  { \stem{ -1 } `d2 r4 } } |
+       { \multivoice \music{ \stem{ 1 } [ `d `fis `a `fis `a `fis ] } \music { \stem{ -1 } `d2 r4 } } |
 %%25
 %#%    s8               % skip space of grace note
-       { \multivoice \music{ \stem{1}[ ``g `d `b `d `b `d ] } \music  { \stem{ -1 } ``g2 r4 } } |
+       { \multivoice \music{ \stem{ 1 } [ ``g `d `b `d `b `d ] } \music { \stem{ -1 } ``g2 r4 } } |
 %%26
-       { \multivoice \music{ \stem{1}[ `d `a d `a d `a ] } \music  { \stem{ -1 } `d2 r4 } } |
+       { \multivoice \music{ \stem{ 1 } [ `d `a d `a d `a ] } \music { \stem{ -1 } `d2 r4 } } |
 %%27
        { [ `cis ``a } `e `a `e `a `e ] |
 %%28
@@ -303,9 +302,9 @@ begeleiding = music { $
        { [ `d ``b } `fis `b `fis `b `fis ] |
 %%45
 %#%    s8               % skip space of grace note
-       { \multivoice \music{ [ ``g `d `b `d `b `d ] } \music  { \stem{ -1 } ``g2 r4 } } |
+       { \multivoice \music{ \stem{ 1 } [ ``g `d `b `d `b `d ] } \music { \stem{ -1 } ``g2 r4 } } |
 %%46
-       { \multivoice \music{ [ `d `a d `a d `a ] } \music  { \stem{ -1 } `d2 r4 } } |
+       { \multivoice \music{ \stem{ 1 } [ `d `a d `a d `a ] } \music { \stem{ -1 } `d2 r4 } } |
 %%47
        { [ `cis ``a } `e `a `e `a `e ] |
 %%48
@@ -341,16 +340,16 @@ tekst1 = music {
        _ _ _
        _ _ _
 % 5
-       \plet{ 2/3 } Lei- se8 \plet{ 1/1 } fleh-4. en8 
-       \plet{ 2/3 } mei- ne8 \plet{ 1/1 } Lie- der8 _8
-       Durch4. die8 \plet{ 2/3 } Nacht zu8 \plet{ 1/1 } 
+       [ Lei- se8 ]2/3 fleh-4. en8 
+       [ mei- ne8 ]2/3 Lie- der8 _8
+       Durch4. die8 [ Nacht zu8 ]2/3 
        dir;2 _        
        _ _ _ 
        _ _ _
 % 11
-       \plet{ 2/3 } In den8 \plet{ 1/1 } stil-4. len8 
-       \plet{ 2/3 } Hain her-8 \plet{ 1/1 } nie-4. der,8
-       Lieb4. chen,8 \plet{ 2/3 } komm zu8 \plet{ 1/1 } 
+       [ In den8 ]2/3 stil-4. len8 
+       [ Hain her-8 ]2/3 nie-4. der,8
+       Lieb4. chen,8 [ komm zu8 ]2/3 
        mir!2 _
        _ _ _ 
        _ _ _
@@ -358,7 +357,7 @@ tekst1 = music {
 % 17
        Fl\"us-8. ternd16 schlan-4. ke8 
        Wip-8. fel16 rau-4. schen8
-       \plet{ 2/3 } In des8 \plet{ 1/1 } Mon-4. des8 
+       [ In des8 ]2/3 Mon-4. des8 
        Licht;2.
        _ _ _ 
        _ _ _
@@ -366,7 +365,7 @@ tekst1 = music {
 % 23
        Des8. Ver-16 r\"a-4. ters8 
        feind-8. lich16 Lau-4. schen8
-       \plet{ 2/3 } F\"urch- te,8 \plet{ 1/1 } Hol-4. de,8 
+       [ F\"urch- te,8 ]2/3 Hol-4. de,8 
        nicht.2.
        _ _ _ 
        _ _ _
@@ -386,7 +385,7 @@ tekst1 = music {
        mich!2 _
        Be-8. bend16 harr' ich8 _8
        dir8. ent-16 ge- gen!8 _8
-       \plet{ 2/3 } Komm, be-8 \plet{ 1/1 } gl\"u4. cke8 
+       [ Komm, be-8 ]2/3 gl\"u4. cke8 
        mich!2.
        _ _ _ _ _ _
 % 47
@@ -408,17 +407,17 @@ tekst2 = music {
        _ _ _
        _ _ _
 % 5
-       \plet{ 2/3 } H\"orst die8 \plet{ 1/1 } Nach-4. ti-8 
-       \plet{ 2/3 } gal- len8 \plet{ 1/1 } schla- gen?8 _8
-       Ach!4. sie8 \plet{ 2/3 } fleh- en8 \plet{ 1/1 } 
+       [ H\"orst die8 ]2/3 Nach-4. ti-8 
+       [ gal- len8 ]2/3 schla- gen?8 _8
+       Ach!4. sie8 [ fleh- en8 ]2/3 
        dich,2 _
        _ _ _ 
        _ _ _
 
 % 11
-       \plet{ 2/3 } Mit der8 \plet{ 1/1 } T\"o-4. ne8
-       \plet{ 2/3 } s\"u\ss- en8 \plet{ 1/1 } Kla-4. gen8
-       Fleh-4. en8 \plet{ 2/3 } sie f\"ur8 \plet{ 1/1 }
+       [ Mit der8 ]2/3 T\"o-4. ne8
+       [ s\"u\ss- en8 ]2/3 Kla-4. gen8
+       Fleh-4. en8 [ sie f\"ur8 ]2/3
        mich.2 _
        _ _ _ 
        _ _ _
@@ -426,7 +425,7 @@ tekst2 = music {
 % 17
        Sie-8. ver-16 stehn4. des8
        Bus-8. ens16 Seh-4. nen,8
-       \plet{ 2/3 } Ken- nen8 \plet{ 1/1 } Lieb-4. es-8 
+       [ Ken- nen8 ]2/3 Lieb-4. es-8 
        schmerz,2.
        _ _ _ 
        _ _ _
@@ -434,7 +433,7 @@ tekst2 = music {
 % 23
        R\"uh-8. ren16 mit4. den8 
        Sil-8. ber-16 t\"o-4. nen8
-       \plet{ 2/3 } Jed- es8 \plet{ 1/1 } wei-4. che8 
+       [ Jed- es8 ]2/3 wei-4. che8 
        Herz.2.
        _ _ _ 
        _ _ _
@@ -465,35 +464,36 @@ tekst2 = music {
 }
 
 score {
-       staff { 
-               lyric 
-               music { tekst1 }
-               music { tekst2 }
-       }
-       staff { 
-               melodic 
-               music { melodie }
-       }
-       staff { 
-               melodic 
-               music { begeleiding }
-       }
+%      staff { 
+%              lyric 
+       %       music { tekst1 }
+       %       music { tekst2 }
+%      }
+%      staff { 
+%              melodic 
+%              music { melodie }
+%      }
+%      staff { 
+%              melodic 
+%              music { begeleiding }
+%      }
        commands { 
-               meter { 3*4 }
-               key $bes$
-               skip 12*4
-               bar ":|"
-               skip 96*4
-               bar ":|"
-               skip 66*4
-               bar "||"
+               meter {3*4}
        }
        paper {
                symboltables { table_sixteen }
                width 195mm
-               unitspace 20mm
-%              unitspace 4.0 cm % leaves all text stand free
-%              geometric 1.4
+
+               % on two pages...
+%              unitspace 10mm
+%              geometric 1.2
+               unitspace 9mm
+               geometric 1.2
                output "standchen.out"
        }
+       staff { midi music { melodie } }
+       staff { midi music { begeleiding } }
+       midi {
+               tempo 4:50
+       }
 }
index 9c87c4cc9054c02088fbd0d9cf396348524045ba..4b19a6aef591b24a27bc9dd335373c093fee4956 100644 (file)
 \begin{document}
 \input lilyponddefs
 \input titledefs
-%\def\interstaffline{\vskip10pt}
-%\def\interscoreline{\vskip12pt}
-\def\interstaffline{\vskip1mm}
-\def\interscoreline{\vskip2mm}
+\def\interstaffline{\vskip2mm}
+\def\interscoreline{\vskip3mm}
 \vbox to 10mm{\vss}
 \title{St\"andchen\normalsize\\[2ex](Serenade)}
 \composer{Franz Schubert (1797-1828)}
index 9b081c43fab54d3900d09f9a65e4bf45915eca40..a356386099a97ecee73492ba95dd9ac12fe40a12 100644 (file)
@@ -15,6 +15,7 @@ melodie = music {
 
        c c | g g | a a | g g |
        f f | e e | d d8.( e16 | )c2 % :|
+       \bar ":|"
        $
 }
 
@@ -30,6 +31,7 @@ begeleiding = music {
 
        c 'c | 'e 'c | 'f 'c | 'e 'c | 
        'd b | 'c a | f g | c2 
+       \bar ":|"
        $
 }
 
@@ -150,8 +152,13 @@ score {
        }
        commands {
                meter {2 * 4}
-               skip 24*2
-               bar "||"
+%              skip 24*2
+%              bar "||"
+       }
+       staff { midi_track music { melodie } }
+       staff { midi_track music { begeleiding } }
+       midi { 
+               tempo 4:120 
        }
 }
 
index c4c0f2455e849ea19787103f60baa2a997c47779..1038169bab11b74e0f4622c529e58da734f5bc66 100644 (file)
@@ -8,9 +8,9 @@
 dux = music { $
        \clef \violin
        \duration { \last }
-       \stem{-1}
        
-        r8-"dux" ['c16 b] ['c8 g] [as 'c16 b] ['c8 'd] |
+        r8-"dux"       \stem{-1}
+       ['c16 b] ['c8 g] [as 'c16 b] ['c8 'd] |
        [g 'c16 b] ['c8 'd] [f16 g] as4 [g16 f] |
        [es 'c b a] [ g f es d] [c8 'es 'd 'c] |
        [bes a bes 'c] [fis g a fis] |
@@ -21,9 +21,10 @@ dux = music { $
 $}
 
 comes = music { $
-       r1 r1
-       \stem{1}
        \octave {'}
+       r1      \stem{1}
+ |
+       r1 |
        r8-"comes" [g16 fis] [g8 c] [es g16 f] [g8 a]|
        [d8 g16 fis] [g8 a] [c16 d] es4 [d16 c] |
        [`bes8 es16 d] [es8 `g8] [`as f16 es] [f8 `a] 
@@ -35,11 +36,16 @@ $}
 
 bassdux = music { $
        \clef \bass
-       r1 r r r r r
        \octave { }
+       r1 |
+       r |
+       r |
+       r |
+       r |
+       r |
        r8 [c16 B] [c8 G] [As c16 B] [c8 d] |
-       [G c16 B] [c8 d] [F16 G] As4 [G16 F] | $
-}
+       [G c16 B] [c8 d] [F16 G] As4 [G16 F] | 
+$}
 
 basstaf = staff { melodic
        music { bassdux }
@@ -58,5 +64,11 @@ score {
                grouping {2*2}
                key {$bes es as$}
        }
+       staff { midi music { dux } }
+       staff { midi music { comes } }
+       staff { midi music { bassdux } }
+       midi {
+               tempo 4:80
+       }
 }
 
index 03b49497b7b3d580c2c90ddbcbd1dfbc778133a1..566b9d58a587993c462b9a50b50093c4e3be7b9d 100644 (file)
@@ -37,7 +37,7 @@ Bar_register::process_request()
 {
 
     if (bar_req_l_ ) {
-       bar_p_ = new Bar(bar_req_l_->type);
+       bar_p_ = new Bar(bar_req_l_->type_str_);
     } else if (!walk_l_->time_.whole_in_measure_) {
        bar_p_ = new Bar("|");
     }
index 065f69ae5367a2a6eaa91e9b60d743e3aa019fd7..9af17503f37f90407b36f56a48cfde453c34e56b 100644 (file)
@@ -17,10 +17,21 @@ Cadenza_req::do_print()const
     mtor << on_b;
 }
 
+int
+Bar_req::compare(const Bar_req &c1)const
+{
+    return type_str_ == c1.type_str_;
+}
+
 void
 Bar_req::do_print() const
 {
-    mtor << type;
+    mtor << type_str_;
+}
+
+Bar_req::Bar_req(String s)
+{
+    type_str_ = s;
 }
 
 Partial_measure_req::Partial_measure_req(Moment m)
@@ -55,10 +66,6 @@ Nonmusical_req::do_print()const{}
 void
 Barcheck_req::do_print() const{}
 
-Bar_req::Bar_req(String s)
-{
-    type = s;
-}
 /* *************** */
 void
 Clef_change_req::do_print() const
index 228f7c70195dc058e19c59deed99468f5ad59f86..01a35bd140feeebda41d767aed18027df111149b 100644 (file)
@@ -6,12 +6,18 @@
 #include "dstream.hh"
 #include "vector.hh"
 
-Dstream monitor(&cout,".dstreamrc");
+Dstream *monitor=0;
 ostream * nulldev =0;
 
 struct _Dinit {
-    _Dinit() { nulldev = new ofstream("/dev/null");}
-    ~_Dinit() { delete nulldev; }
+    _Dinit() {
+       nulldev = new ofstream("/dev/null");
+       monitor = new Dstream(&cout,".dstreamrc");
+    }
+    ~_Dinit() {
+       delete nulldev;
+       delete monitor;
+    }
 } dinit;
 
 
@@ -38,7 +44,7 @@ debug_init()
 #ifndef NDEBUG
     set_new_handler(&mynewhandler);
 #endif
-    set_matrix_debug(monitor);
+    set_matrix_debug(*monitor);
     signal(SIGFPE, float_handler);
 }   
 
index 05918a1a5f68e2eeae05c6fda0b2a7e7cc89c80a..8f3ca2cb933bc96e9c8450a69306d30ede325b78 100644 (file)
@@ -3,6 +3,23 @@
 #include "voice.hh"
 #include "musicalrequest.hh"
 
+void
+Input_music::check_plet(Voice_element* velt_l)
+{
+    for (iter_top(velt_l->reqs,i); i.ok(); i++)
+       if ( i->plet() ) {
+           Moment start_moment = 0.0;
+           if ( !find_plet_start_bo( i->plet()->type_c_, start_moment ) ) {
+               error( "begin of plet not found", i->defined_ch_c_l_ );
+               break;
+           }
+           Moment moment = 0.0;
+           set_plet_backwards( moment, start_moment, i->plet()->dur_i_, i->plet()->type_i_ );
+           i.del();
+           break;
+        }
+}
+
 void
 Simple_music::add(Voice_element*v)
 {
@@ -36,6 +53,16 @@ Simple_music::print() const
     voice_.print();
     mtor << "}\n";
 }
+bool
+Simple_music::find_plet_start_bo(char c, Moment& moment_r)
+{
+    return voice_.find_plet_start_bo(c, moment_r);
+}
+void 
+Simple_music::set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i)
+{
+    voice_.set_plet_backwards(now_moment_r, until_moment, num_i, den_i);
+}
 
 /* *************** */
 
@@ -74,6 +101,22 @@ Complex_music::set_default_group(String g)
     for (iter_top(elts,i); i.ok(); i++)
            i->set_default_group(g);
 }
+bool
+Complex_music::find_plet_start_bo(char c, Moment& moment_r)
+{
+    for (iter_bot(elts,i); i.ok(); i--) {
+        if ( i->find_plet_start_bo(c, moment_r) )
+           return true;
+    }
+    return false;
+}
+void 
+Complex_music::set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i)
+{
+    for (iter_bot(elts,i); i.ok(); i--) {
+       i->set_plet_backwards(now_moment_r, until_moment, num_i, den_i);
+    }
+}
 /* *************************************************************** */
 
 void
@@ -97,6 +140,8 @@ Music_voice::add_elt(Voice_element*v)
     c = elts.bottom();
     Simple_music *s = c->simple();
     s->add(v);             
+
+    check_plet(v);
 }
 
 Moment
@@ -142,6 +187,8 @@ Music_general_chord::add_elt(Voice_element*v)
     Simple_music*vs = new Simple_music;
     vs->add(v);
     elts.bottom().add(vs);
+
+    check_plet(v);
 }
 
 void
index a8a653982cdb9ab2639a393b71fcc3123d405ac3..82d7a6c96ab1ef67382f646896cd9ff2121b4f77 100644 (file)
@@ -12,6 +12,7 @@
 #include "inputmusic.hh"
 #include "score.hh"
 #include "paperdef.hh"
+#include "mididef.hh"
 #include "staff.hh"
 
 
@@ -28,6 +29,13 @@ Input_score::set(Paperdef*p)
     paper_p_ = p;
 }
 
+void
+Input_score::set(Mididef* midi_p)
+{
+    delete midi_p_;
+    midi_p_ = midi_p;
+}
 Input_score::Input_score(Input_score const&s)
 {
     paper_p_ = (s.paper_p_)? new Paperdef(*s.paper_p_) :0;
@@ -44,6 +52,8 @@ Input_score::parse()
     Score *s_p = new Score(paper_p);
     s_p->defined_ch_c_l_= defined_ch_c_l_;
     s_p->errorlevel_i_ = errorlevel_i_;
+    s_p->set(midi_p_);
+    midi_p_ = 0;
 
     for (iter_top(staffs_,i); i.ok(); i++) {
        Staff* staf_p=i->parse(s_p, score_wide_music_p_);
@@ -65,6 +75,7 @@ Input_score::~Input_score()
 {
     delete paper_p_;
     delete score_wide_music_p_;
+    delete midi_p_;
 }
 
 Input_score::Input_score()
@@ -72,6 +83,7 @@ Input_score::Input_score()
     score_wide_music_p_ =0;
     defined_ch_c_l_=0;
     paper_p_= 0;
+    midi_p_ = 0;
     errorlevel_i_ = 0;
 }
 
index 116624574ca1f53ec90f48ddeb6aa2eb2fb17d11..7fbc37dbac3976c01eac1a0a45dc62752d0888cc 100644 (file)
@@ -1,11 +1,20 @@
+/*
+  inputstaff.cc -- implement Input_staff
+
+  source file of the LilyPond music typesetter
+
+  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
 #include "debug.hh"
 #include "score.hh"
 #include "inputmusic.hh"
 #include "inputstaff.hh"
 #include "staff.hh"
 #include "complexstaff.hh"
-#include "lexer.hh"
 #include "lyricstaff.hh"
+#include "midistaff.hh"
+#include "lexer.hh"
 
 
 Input_staff::Input_staff(String s)
@@ -29,8 +38,12 @@ Input_staff::parse(Score*score_l, Input_music *default_score_wide)
        p = new Complex_staff;
     else if (type == "lyric")
        p = new Lyric_staff;
-    else
-       error( "Unknown staff-type `" + type +"\'", defined_ch_c_l_);
+    else if (type == "midi")
+       p = new Midi_staff;
+    else {
+       error( "Unknown staff-type `" + type +"\'", defined_ch_c_l_ );
+       exit( 1 );
+    }
 
     p->score_l_ = score_l;
     
index f0652ac6c78d757f15cee3b22b9a7c8d72089438..1e4e8488a558801ec27db128310198d0821c332c 100644 (file)
@@ -179,11 +179,11 @@ COMMENT           [%#].*\n
 <lyrics>{LYRICS} {
        String s (YYText()); 
        int i = 0;
-       while ((i=s.pos("_")) != 0)// ugh. Whats this.
-               *((char*)s.cptr() + i - 1) = ' ';
-       if ((i=s.pos("\\,")) !=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 "
                {
-               *((char*)s.cptr() + i) = 'c';
+               *(s.ch_l() + i) = 'c';
                s = s.left(i+1) + " " + s.right(s.len()-i-1);
                }
        yylval.string = new String(s);
index 960c1e76e00e4955ba22af5172c235a258d86b95..51a2b0359402e017265c0b72d4c195cd62eab426 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the LilyPond music typesetter
 
-  (c) 1997 Jan Nieuwenhuizen <jan@digicash.nl>
+  (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
 */
 
 #include "musicalrequest.hh"
diff --git a/src/midicolumn.cc b/src/midicolumn.cc
new file mode 100644 (file)
index 0000000..13abbd0
--- /dev/null
@@ -0,0 +1,44 @@
+#include "musicalrequest.hh"
+#include "voice.hh"
+#include "staffwalker.hh"
+#include "debug.hh"
+#include "staff.hh"
+#include "midistaff.hh"
+#include "midicolumn.hh"
+#include "midiitem.hh"
+#include "sccol.hh" 
+#include "pscore.hh"
+#include "main.hh"
+
+Midi_column::Midi_column(Midi_staff* mstaff_l)
+{
+       mstaff_l_ = mstaff_l;
+}
+
+void
+Midi_column::setup_one_request(Request*req_l)
+{
+       if ( req_l->melodic() ) 
+               melreq_l_array_.push( req_l->melodic() );   
+}
+
+void
+Midi_column::note_off( Midi_track* midi_track_l, Moment next )
+{
+       Moment delta_t = next - when();
+       for ( int i = 0; i < melreq_l_array_.size(); i++ )  {
+               Midi_note midi_note( melreq_l_array_[ i ], midi_track_l->number_i_, false );
+               midi_track_l->add( delta_t, &midi_note );
+               delta_t = 0.0;
+       }
+}
+
+void
+Midi_column::note_on( Midi_track* midi_track_l )
+{
+       Moment delta_t = 0.0;
+       for ( int i = 0; i < melreq_l_array_.size(); i++ )  {
+               Midi_note midi_note( melreq_l_array_[ i ], midi_track_l->number_i_, true );
+               midi_track_l->add( delta_t, &midi_note );
+       }
+}
diff --git a/src/midistaff.cc b/src/midistaff.cc
new file mode 100644 (file)
index 0000000..c63ac96
--- /dev/null
@@ -0,0 +1,50 @@
+#include "musicalrequest.hh"
+#include "voice.hh"
+#include "staffwalker.hh"
+#include "debug.hh"
+#include "staff.hh"
+#include "midistaff.hh"
+#include "midicolumn.hh"
+#include "midiwalker.hh"
+#include "midiitem.hh"
+#include "midistream.hh"
+
+Midi_staff::Midi_staff()
+{
+}
+
+Staff_column*
+Midi_staff::create_col()
+{
+       return new Midi_column(this);
+}
+
+Staff_walker*
+Midi_staff::get_walker_p()
+{
+       return new Midi_walker(this);
+}
+
+void
+Midi_staff::midi( Midi_stream* midi_stream_l, int track_i )
+{
+       Midi_track midi_track( track_i );
+       Midi_column* last_mcol_l = 0;
+       for ( Midi_walker w( this ); w.ok(); w++ ) {
+               Midi_column* mcol_l = (Midi_column*)*w;
+               if ( last_mcol_l )
+                       last_mcol_l->note_off( &midi_track, w->when() );
+               mcol_l->note_on( &midi_track );
+               last_mcol_l = mcol_l;
+       }
+       if ( last_mcol_l )
+               last_mcol_l->note_off( &midi_track, last() );
+       *midi_stream_l << midi_track;
+}
+
+void
+Midi_staff::set_output(PScore*pscore_l)
+{
+       //i don-t want no pscore!
+}
+
index 7af820ae449efcfc859a7d71a7c6e225b36ab1b6..ea86b3094b4d4d1a6b1b3901917eb6ba6076a247 100644 (file)
@@ -26,6 +26,7 @@ static Keyword_ent the_key_tab[]={
     "key", KEY,
 
     "meter", METER,
+    "midi", MIDI,
     "mm", MM_T,
     "multivoice", MULTIVOICE,
     "octave", OCTAVECOMMAND,
@@ -43,6 +44,7 @@ static Keyword_ent the_key_tab[]={
     "table", TABLE,
     "symboltables", SYMBOLTABLES,
     "notenames", NOTENAMES,
+    "tempo", TEMPO,
     "texid", TEXID,
     "textstyle", TEXTSTYLE,
     "unitspace", UNITSPACE,
@@ -59,10 +61,12 @@ My_flex_lexer::ret_notename(int *p, String text, int octave_mod)
 {
     text.lower();
     char const* ch_c_l = here_ch_c_l();
-    ch_c_l--;
-    while ( ( *ch_c_l == ' ' ) || ( *ch_c_l == '\t' ) || ( *ch_c_l == '\n' ) )
+    if ( ch_c_l ) {
        ch_c_l--;
-    ch_c_l++;
+       while ( ( *ch_c_l == ' ' ) || ( *ch_c_l == '\t' ) || ( *ch_c_l == '\n' ) )
+           ch_c_l--;
+       ch_c_l++;
+    }
        
     lookup_notename(p[0], p[1], text);
     p[2] = octave_mod;
@@ -70,7 +74,7 @@ My_flex_lexer::ret_notename(int *p, String text, int octave_mod)
     if (p[0] < 0) {
 
        errorlevel_i_ |= 1;
-       warning( String( "notename does not exist: " ) + YYText(), ch_c_l );
+       error( String( "notename does not exist: " ) + YYText(), ch_c_l );
        p[0] = p[1] = 0;
     }
     return NOTENAME;
@@ -81,7 +85,6 @@ My_flex_lexer::My_flex_lexer()
     keytable = new Keyword_table(the_key_tab);
     the_id_tab = new Assoc<String, Identifier*>;
     defaulttab = 0;
-    data_ch_c_l_ = 0;
     errorlevel_i_ = 0;
 }
 
@@ -103,7 +106,7 @@ My_flex_lexer::lookup_identifier(String s)
 char const*
 My_flex_lexer::here_ch_c_l()
 {
-    return data_ch_c_l_ ? data_ch_c_l_ + yyin->tellg() : 0;
+    return include_stack.top()->sourcefile_l_->ch_c_l() + yyin->tellg();
 }
 
 void
@@ -144,7 +147,7 @@ My_flex_lexer::LexerError(const char *s)
            ch_c_l++;
        }
        errorlevel_i_ |= 1;
-       warning( s, ch_c_l );
+       error( s, ch_c_l );
     }
 }
 
@@ -161,10 +164,6 @@ My_flex_lexer::new_input(String s)
    Input_file *newin = new Input_file(s);
    include_stack.push(newin);
    switch_streams(newin->is);
-   if ( newin->sourcefile_l_ )
-       data_ch_c_l_ = newin->sourcefile_l_->ch_c_l();
-   else
-       data_ch_c_l_ = 0;
 
    yylineno = 1;
 }
index 2a89743e95aaa17fdc1da20d376c7e5a5e521fd0..95a7d8313d5a6fc831479e2790426bd81ecc4945 100644 (file)
@@ -14,6 +14,7 @@
 #include "varray.hh"
 #include "textdef.hh"
 #include "parseconstruct.hh"
+#include "inputmusic.hh"
 
 int default_duration = 4, default_dots=0, default_octave=0;
 int default_plet_type = 1, default_plet_dur = 1;
@@ -36,7 +37,8 @@ last_duration(int n)
 }
 
 /* triplet is '2/3' */
-void set_plet(int num,int den)
+void 
+set_plet(int num,int den)
 {
     assert(num >0&& den>0);
     default_plet_dur = num;
@@ -193,6 +195,16 @@ set_default_octave(String d)
     parse_octave(d, i, default_octave);
 }
 
+Request*
+get_plet_request( char c, int dur_i, int type_i )
+{
+    Plet_req* plet_req_p = new Plet_req;
+    plet_req_p->dur_i_ = dur_i;
+    plet_req_p->type_i_ = type_i;
+    plet_req_p->type_c_ = c;
+    return plet_req_p;
+}
+
 Request*
 get_request(char c)
 {
index 6c471fc95f1f1efb98b944b50004021b7abae696..f761069e3e7b8c7a1efa1502891dc7f18ae4b925 100644 (file)
@@ -5,6 +5,7 @@
 #include "misc.hh"
 #include "lexer.hh"
 #include "paperdef.hh"
+#include "mididef.hh"
 #include "inputscore.hh"
 #include "main.hh"
 #include "keyword.hh"
@@ -38,6 +39,7 @@ int fatal_error_i = 0;
     String *string;
     const char *consstr;
     Paperdef *paper;
+    Mididef* midi;
     Input_music *music;
     Music_general_chord *chord;
     Music_voice *mvoice; 
@@ -69,6 +71,7 @@ int fatal_error_i = 0;
 %token PARTIAL MUSIC GROUPING CADENZA
 %token END SYMBOLTABLES TEXID TABLE NOTENAMES SCRIPT TEXTSTYLE PLET
 %token  GOTO
+%token MIDI TEMPO
 
 %token <id>  IDENTIFIER
 %token <string> PITCHMOD DURATION RESTNAME
@@ -79,10 +82,11 @@ int fatal_error_i = 0;
 %token <i> DOTS INT
 %type <real> unit
 %type <melreqvec> pitch_list 
-%type <c> open_request_parens close_request_parens
+%type <c> open_request_parens close_request_parens close_plet_parens
 %type <id> declaration
 %type <string> declarable_identifier
 %type <paper> paper_block paper_body
+%type <midi> midi_block midi_body
 %type <real> dim real
 %type <ii>  default_duration explicit_duration notemode_duration mudela_duration
 %type <ii> notename
@@ -214,6 +218,7 @@ score_body:         {
                $$->set($4);
        }
        | score_body paper_block                { $$->set($2);  }
+       | score_body midi_block         { $$->set($2);  }
        | score_body error {
 
        }
@@ -252,6 +257,30 @@ paper_body:
        }
        ;
 
+/*
+       MIDI
+*/
+midi_block:
+       MIDI
+
+       '{' midi_body '}'       { $$ = $3; }
+       ;
+
+midi_body: { 
+               $$ = new Mididef; 
+       }
+       | midi_body OUTPUT STRING       { 
+               $$->outfile_str_ = *$3; 
+               delete $3; 
+       }
+       | midi_body TEMPO mudela_duration ':' int {
+               $$->set_tempo( wholes( $3[0], $3[1] ), $5 );
+       }
+       | midi_body error {
+
+       }
+       ;
+
 /*
        STAFFs
 */
@@ -271,6 +300,9 @@ staff_init:
                $$ = new Input_staff(*$1);
                delete $1;
        }
+       | MIDI          {
+               $$ = new Input_staff("midi");
+       }
        ;
 
 staff_body:
@@ -340,7 +372,6 @@ music_chord_body:
        ;
 
 
-
 /*
        VOICE ELEMENTS
 */
@@ -349,26 +380,32 @@ full_element:     pre_requests voice_elt post_requests {
                add_requests($2, post_reqs);
                $$ = $2;
        }
-       | lyrics_elt
+       | pre_requests lyrics_elt post_requests {
+               add_requests($2, pre_reqs);
+               add_requests($2, post_reqs);
+               $$ = $2;
+        }
        | command_elt
        ;
 
 command_elt:
-       command_req     {
+/* empty */    {
                $$ = new Voice_element;
-               $$->add($1);
-               $1-> defined_ch_c_l_ = lexer->here_ch_c_l();
+               $$-> defined_ch_c_l_ = lexer->here_ch_c_l();
+       }
+/* cont: */
+       command_req     {
+               $2-> defined_ch_c_l_ = $$->defined_ch_c_l_;
+               $$->add($2);
+
        }
-/* can't do this, since "| |" has  shift/reduce conflict. :
-       command_elt command_req { .. }
-*/
        ;
 
 command_req:
         '|'                            { 
                $$ = new Barcheck_req;
        }
-       | BAR STRING                    {
+       | BAR STRING                    {
                $$ = new Bar_req(*$2);
                delete $2;
        }
@@ -377,18 +414,18 @@ command_req:
                m->set($3,$5);
                $$ = m;
        }
-       | SKIP duration_length {
+       | SKIP '{' duration_length '}' {
                Skip_req * skip_p = new Skip_req;
-               skip_p->duration_ = *$2;
-               delete $2;
+               skip_p->duration_ = *$3;
+               delete $3;
                $$ = skip_p;
        }
-       | CADENZA int   {
-               $$ = new Cadenza_req($2);
+       | CADENZA '{' int '}'   {
+               $$ = new Cadenza_req($3);
        }
-       | PARTIAL duration_length       {
-               $$ = new Partial_measure_req(*$2);
-               delete $2;
+       | PARTIAL '{' duration_length '}'       {
+               $$ = new Partial_measure_req(*$3);
+               delete $3;
        }
        | STEM '{' int '}'              {
                $$ = get_stemdir_req($3);
@@ -416,6 +453,11 @@ post_requests:
                $2->defined_ch_c_l_ = lexer->here_ch_c_l();
                post_reqs.push($2);
        }
+       | post_requests close_plet_parens INT '/' INT { 
+               post_reqs.push( get_request($2) ); 
+               req_defined_ch_c_l = lexer->here_ch_c_l();
+               post_reqs.push( get_plet_request( $2, $3, $5 ) ); 
+       }
        ;
 
 post_request:
@@ -426,6 +468,13 @@ post_request:
        | textscript_req
        ;
 
+close_plet_parens:
+       ']' {
+               req_defined_ch_c_l = lexer->here_ch_c_l();
+               $$ = ']';
+       }
+       ;
+
 close_request_parens:
        '('     { 
                $$='(';
@@ -529,7 +578,7 @@ voice_command:
                set_default_octave(*$3);
                delete $3;
        }
-       | TEXTSTYLE STRING      {
+       | TEXTSTYLE STRING      {
                set_text_style(*$2);
                delete $2;
        }
@@ -743,16 +792,16 @@ parse_file(String init, String s)
    lexer = new My_flex_lexer;
 
 #ifdef YYDEBUG
-   yydebug = !monitor.silence("InitParser") && check_debug;
-   lexer->set_debug( !monitor.silence("InitLexer") && check_debug);
+   yydebug = !monitor->silence("InitParser") && check_debug;
+   lexer->set_debug( !monitor->silence("InitLexer") && check_debug);
 #endif
 
    lexer->new_input(init);
    yyparse();
 
 #ifdef YYDEBUG
-   yydebug = !monitor.silence("Parser") && check_debug;
-   lexer->set_debug( !monitor.silence("Lexer") && check_debug);
+   yydebug = !monitor->silence("Parser") && check_debug;
+   lexer->set_debug( !monitor->silence("Lexer") && check_debug);
 #endif
 
    lexer->new_input(s);
index 72b8a3544aa3fed86ba3ae8d4c1c20da00a27272..bce34a85756606da6c08552b54c9fb55b7a94190 100644 (file)
@@ -71,6 +71,7 @@ Spacing_req::do_print()const
 {
     mtor << "next " << next << "dist " << distance << "strength\n";
 }
+
 void
 Blank_req::do_print()const
 {
@@ -88,7 +89,7 @@ Melodic_req::Melodic_req()
 void
 Melodic_req::do_print() const
 {
-    mtor << "notename: " << notename_i_ << " oct: "<< octave_i_;
+    mtor << "notename: " << notename_i_ << " acc: " <<accidental_i_<<" oct: "<< octave_i_;
 }
 
 int
@@ -97,6 +98,30 @@ Melodic_req::height() const
     return  notename_i_ + octave_i_*7;
 }
 
+/*
+ should be settable from input to allow "viola"-mode
+ */
+static Byte pitch_by_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;
+}
+
+Plet_req::Plet_req()
+{
+    type_c_ = ']';
+    dur_i_ = 1;
+    type_i_ = 1;
+}
+
+void
+Plet_req::do_print() const
+{
+    mtor << "plet: " << type_c_ << ": " << dur_i_ << "/" << type_i_;
+}
+
 /* *************** */
 int
 Rhythmic_req::compare(const Rhythmic_req &r1, const Rhythmic_req &r2)
@@ -138,7 +163,7 @@ Rhythmic_req::duration() const {
 Lyric_req::Lyric_req(Text_def* def_p)
     :Text_req(0, def_p)
 {
-    def_p->align_i_ = 1;       // raggedright
+    def_p->align_i_ = 0;       // centre
     dir_i_ = -1;               // lyrics below (invisible) staff
 }
 
index 3084f90c90e96f64cf1c0cd597a29ce8c798b832..368188bbc19ecdd46fc69d1c6f0367e95b81352d 100644 (file)
 #include "source.hh"
 #include "sourcefile.hh"
 #include "scorewalker.hh"
+#include "mididef.hh"
+#include "midiitem.hh"
+#include "midistream.hh"
+#include "midicolumn.hh"
+#include "midistaff.hh"
+#include "midiwalker.hh"
 
 void
 Score::setup_music()
 {
     *mlog << "\nSetting up music ..." << flush;
     if (last() == Moment(0)) {
-       warning("Need to have music in a score.", defined_ch_c_l_);
+       errorlevel_i_ |= 1;
+       error("Need to have music in a score.", defined_ch_c_l_);
     }
 
     pscore_p_ = new PScore(paper_p_);
@@ -45,13 +52,14 @@ Score::process_music()
     *mlog << "Processing music ..." << flush;
     for (Score_walker w(this); w.ok(); w++) {
        w.process();
-    }
+   }
 }
 
 void
 Score::process()
 {
     setup_music();
+
     process_music();
 
     // do this after processing, staffs first have to generate PCols.
@@ -158,6 +166,13 @@ Score::last() const
     return l;
 }
 
+void
+Score::set(Mididef* midi_p)
+{    
+    delete midi_p_;
+    midi_p_ = midi_p;
+}
+
 void
 Score::OK() const
 {
@@ -197,6 +212,7 @@ Score::Score(Paperdef*paper_p)
 {
     pscore_p_=0;
     paper_p_ = paper_p;
+    midi_p_ = 0;
     errorlevel_i_ = 0;
     defined_ch_c_l_ = 0;
 }
@@ -205,6 +221,7 @@ Score::~Score()
 {
     delete pscore_p_;
     delete paper_p_;
+    delete midi_p_;
 }
 
 void
@@ -230,7 +247,30 @@ Score::output(String s)
     pscore_p_->output(the_output);
 }
 
+void
+Score::midi()
+{
+    if (!midi_p_)
+       return;
+
+    *mlog << "midi output to " << midi_p_->outfile_str_ << "...\n";
+
+    int track_i = 0;
+    for ( PCursor<Staff*> staff_l_pcur( staffs_.top() ); staff_l_pcur.ok(); staff_l_pcur++ ) {
+       Midi_staff* mstaff_l = (Midi_staff*)*staff_l_pcur;
+       if ( !mstaff_l->pscore_l_ ) // we _are_ a midi-staff, ugh
+           track_i++;
+    }
 
+    Midi_stream midi_stream( midi_p_->outfile_str_, track_i, midi_p_->get_tempo_i( Moment( 1, 4 ) )  );
+
+    track_i = 0;
+    for ( PCursor<Staff*> staff_l_pcur( staffs_.top() ); staff_l_pcur.ok(); staff_l_pcur++ ) {
+       Midi_staff* mstaff_l = (Midi_staff*)*staff_l_pcur;
+       if ( !mstaff_l->pscore_l_ ) // we _are_ a midi-staff, ugh
+           mstaff_l->midi( &midi_stream, track_i++ );
+    }
+}
 
 void
 Score::add(Staff*s)
index 59b6f6670deba01704e125f9336879341c479984..2788fe062a958eecbd40c0117d1a49f8aae82da8 100644 (file)
@@ -17,6 +17,7 @@ do_scores()
        s_p->print ();
        s_p->process();
        s_p->output(outfn);
+       s_p->midi();
        delete s_p;
     }
     score_array_global.set_size(0);
index 48f60878be2b1994bb8ea1612497e808e5f02f5b..d1eb312d85970e548ea2be3b52a713986d768963 100644 (file)
@@ -4,6 +4,7 @@
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
 
+#include "plist.hh"
 #include "musicalrequest.hh"
 #include "complexwalker.hh"
 #include "slurreg.hh"
index 34f1a8808f00a8ef6644812deec1c36108beca28..519a6fe96aad58dea7f6d1558e3b9ebe587512cc 100644 (file)
@@ -28,9 +28,9 @@ Source::add( Source_file* sourcefile_p )
 Source_file*
 Source::sourcefile_l( char const* ch_c_l )
 {
-    PCursor<Source_file*> sourcefile_p_pcur( sourcefile_p_iplist_.top() );
-    for ( ; sourcefile_p_pcur.ok(); sourcefile_p_pcur++ )
-       if ( sourcefile_p_pcur->in_b( ch_c_l ) )        
-           return *sourcefile_p_pcur;
+    PCursor<Source_file*> sourcefile_l_pcur( sourcefile_p_iplist_.top() );
+    for ( ; sourcefile_l_pcur.ok(); sourcefile_l_pcur++ )
+       if ( sourcefile_l_pcur->in_b( ch_c_l ) )        
+           return *sourcefile_l_pcur;
     return 0;
 }
index a69f625aed51d024cde0fda7f4942de5da8bccd8..c93ca997cc87b285de6fb4b11a366408abad7935 100644 (file)
@@ -8,6 +8,7 @@
 #include "debug.hh"
 #include "musicalrequest.hh"
 #include "commandrequest.hh" // todo
+#include "midistream.hh"
 
 void
 Staff::add(PointerList<Voice*> const &l)
@@ -39,6 +40,13 @@ Staff::clean_cols()
     }
 }
 
+// Midi_track*
+// Staff::midi_track_p()
+// {
+//     Midi_track_p midi_track_p = new Midi_track;
+//    Midi_walker( *this );
+// }
+
 Staff_column *
 Staff::get_col(Moment w, PCursor<Staff_column*> *last)
 {    
@@ -123,7 +131,6 @@ Staff::last() const
     return l;
 }
 
-
 void
 Staff::print() const
 {
index 3dd4becf218270afe77904ce964fc22499ee4cb6..718e7cb6d1124b215d79b5f053bcf2bfcea6b765 100644 (file)
@@ -10,6 +10,8 @@
 #include "voice.hh"
 #include "musicalrequest.hh"
 #include "commandrequest.hh"
+#include "midiitem.hh"
+#include "midistream.hh"
 
 void
 Voice::set_default_group(String s)
@@ -17,6 +19,25 @@ Voice::set_default_group(String s)
     elts.top()->set_default_group(s);
 }
 
+bool
+Voice::find_plet_start_bo(char c, Moment& moment_r)
+{
+    for (iter_bot(elts, i); i.ok(); i--)
+       if ( i->find_plet_start_bo(c, moment_r) )
+           return true;
+    return false;
+}
+
+void 
+Voice::set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i)
+{
+    for (iter_bot(elts, i); i.ok(); i--) 
+       if ( now_moment_r <= until_moment ) 
+           i->set_plet_backwards(now_moment_r, until_moment, num_i, den_i);
+       else
+           return;
+}
+
 Voice::Voice(Voice const&src)
 {
     for (iter_top(src.elts, i); i.ok(); i++)
index 72ba0a77d5f32c47aea03eba2dd522917fac49c1..670dcdfaaaeef88415d3d46b268a3bfb7f19a9e4 100644 (file)
@@ -53,6 +53,20 @@ Voice_element::Voice_element(Voice_element const&src)
        add(i->clone());
 
 }
+bool
+Voice_element::find_plet_start_bo(char c, Moment& moment_r)
+{
+    assert( c == ']' );
+    moment_r += duration;
+    for ( PCursor<Request*> req_l_pcur( reqs.top() ); req_l_pcur.ok(); req_l_pcur++ ) {
+       if (req_l_pcur->melodic())
+           mtor << (char)('c' + req_l_pcur->melodic()->height()) << "\n";
+       if (req_l_pcur->beam() && req_l_pcur->beam()->spantype == Span_req::START )
+           return true;
+    }
+    return false;
+}
+
 void
 Voice_element::set_default_group(String s)
 {
@@ -63,3 +77,21 @@ Voice_element::set_default_group(String s)
     greq->newgroup_str_ = s;
     add(greq);
 }
+
+void
+Voice_element::set_plet_backwards(Moment& now_moment_r, Moment until_moment, int num_i, int den_i)
+{
+    now_moment_r += duration;
+    if ( now_moment_r > until_moment )
+       return;
+    for ( PCursor<Request*> req_l_pcur( reqs.top() ); req_l_pcur.ok(); req_l_pcur++ ) {
+       if (req_l_pcur->beam() && req_l_pcur->beam()->spantype == Span_req::START )
+           req_l_pcur->beam()->nplet = den_i;
+       if (req_l_pcur->rhythmic())
+           req_l_pcur->rhythmic()->plet_factor = Moment(num_i, den_i);
+       if (req_l_pcur->stem())
+           req_l_pcur->stem()->plet_factor = Moment(num_i, den_i);
+       if (req_l_pcur->melodic())
+           mtor << (char)('c' + req_l_pcur->melodic()->height()) << "\n";
+    }
+}
index 4f622c93849f4c97038674f17f0390078efe66ac..0674ee08c86b6c6a70340aacaf859e6b47e936c4 100644 (file)
@@ -6,6 +6,7 @@
   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
 */
 
+#include "plist.hh"
 #include "musicalrequest.hh"
 #include "voicegroup.hh"
 #include "register.hh"
index 4eba8c55f7adae0a925c6e2abc3582a4448c391f..d6c24cd674e1e2bb2ca72ed9f118c0007e49a01c 100644 (file)
@@ -66,3 +66,4 @@ Voice_registers::set_dir(int i)
     head_reg_->set_dir(i);
     slur_reg_->set_dir(i);
 }
+
index 46d779e10f511cf8495f8c2506b7e19f6aa3188e..63490de581077299168faf69b39d54a2bccf2f11 100644 (file)
@@ -72,5 +72,10 @@ void
 error( String message_str, char const* context_ch_c_l )
 {
     message( message_str, context_ch_c_l );
-    exit( 1 );
+    // since when exits error again?
+    // i-d say: error: errorlevel |= 1; -> no output upon error
+    //          warning: recovery -> output (possibly wrong)
+    if ( lexer )
+        lexer->errorlevel_i_ |= 1;
+//    exit( 1 );
 }